Skip to content

Commit

Permalink
PETKA: fixed compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
voltya committed Aug 25, 2019
1 parent 78efb53 commit 072c254
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 22 deletions.
11 changes: 11 additions & 0 deletions engines/petka/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ enum Opcode {
class QMessageObject;

struct QMessage {
QMessage() {}
QMessage(uint16 objId, uint16 opcode, uint16 arg1, int16 arg2, int16 arg3, QMessageObject *sender, int unk) {
this->objId = objId;
this->opcode = opcode;
this->arg1 = arg1;
this->arg2 = arg2;
this->arg3 = arg3;
this->sender = sender;
this->unk = unk;
}

uint16 objId;
uint16 opcode;
uint16 arg1;
Expand Down
2 changes: 1 addition & 1 deletion engines/petka/big_dialogue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void BigDialogue::loadSpeechesInfo() {
char *curr = str;
file->read(str, file->size() - file->pos());
for (uint i = 0; i < _speeches.size(); ++i) {
_speeches[i].text = Common::convertToU32String(curr, Common::CodePage::kWindows1251);
_speeches[i].text = Common::convertToU32String(curr, Common::kWindows1251);
curr += strlen(curr) + 1;
}
delete[] str;
Expand Down
2 changes: 1 addition & 1 deletion engines/petka/flc.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FlicDecoder : public Video::FlicDecoder {

private:
Common::Rect _bounds;
Common::Array<Common::Array<Common::Rect>> _msk;
Common::Array<Common::Array<Common::Rect> > _msk;
};
};

Expand Down
12 changes: 2 additions & 10 deletions engines/petka/interfaces/dialog_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void DialogInterface::sub_4155D0(int a) {
if (talkerId != talkerId2) {
sendMsg(kSay);
}
g_vm->getQSystem()->_mainInterface->setText(info->text, _talker->_dialogColor);
//g_vm->getQSystem()->_mainInterface->setText(info->text, _talker->_dialogColor);
_field18 = 1;
break;
}
Expand All @@ -129,15 +129,7 @@ void DialogInterface::sub_4155D0(int a) {

void DialogInterface::sendMsg(uint16 opcode) {
if (_talker) {
QMessage msg;
msg.objId = _talker->_id;
msg.opcode = opcode;
msg.arg1 = 0;
msg.arg2 = 0;
msg.arg3 = 0;
msg.unk = 0;
msg.sender = nullptr;
_talker->processMessage(msg);
_talker->processMessage(QMessage(_talker->_id, opcode, 0, 0, 0, nullptr, 0));
}
}

Expand Down
2 changes: 1 addition & 1 deletion engines/petka/interfaces/startup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void InterfaceStartup::start() {
QObjectBG *bg = (QObjectBG *)g_vm->getQSystem()->findObject(kStartupObjName);
_objs.push_back(bg);

Sound *s = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(bg->_musicId), Audio::Mixer::SoundType::kMusicSoundType);
Sound *s = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(bg->_musicId), Audio::Mixer::kMusicSoundType);
s->play(true);

const Common::Array<BGInfo> &infos = g_vm->getQSystem()->_mainInterface->_bgs;
Expand Down
12 changes: 6 additions & 6 deletions engines/petka/objects/heroes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void QObjectPetka::updateWalk() {
_isWalking = false;
setPos(_destX, _destY);

QMessage msg {_id, kSet, (uint16)_imageId, 1, 0, nullptr, 0};
QMessage msg(_id, kSet, (uint16)_imageId, 1, 0, nullptr, 0);
if (_heroReaction) {
uint i;
for (i = 0; i < _heroReaction->messages.size(); ++i) {
Expand All @@ -204,10 +204,10 @@ void QObjectPetka::updateWalk() {

initSurface();

processMessage(QMessage {_id, kAnimate, 0, 0, 0, nullptr, 0});
processMessage(QMessage(_id, kAnimate, 0, 0, 0, nullptr, 0));

_heroReaction->messages.push_back(msg);
_heroReaction->messages.push_back(QMessage {_id, kAnimate, 1, 0, 0, nullptr, 0});
_heroReaction->messages.push_back(QMessage(_id, kAnimate, 1, 0, 0, nullptr, 0));
break;
}
}
Expand All @@ -227,7 +227,7 @@ void QObjectPetka::setReactionAfterWalk(uint index, QReaction **reaction, QMessa

stopWalk();

QMessage msg {_id, kWalked, 0, 0, 0, sender, 0};
QMessage msg(_id, kWalked, 0, 0, 0, sender, 0);
_heroReaction = new QReaction();
_sender = sender;

Expand All @@ -252,7 +252,7 @@ void QObjectPetka::stopWalk() {
_isWalking = false;
_msgProcessingPaused = false;

Common::List<QMessage> &list = g_vm->getQSystem()->_messages;
Common::List<QMessage> &list = g_vm->getQSystem()->_messages;
for (Common::List<QMessage>::iterator it = list.begin(); it != list.end();) {
if (it->opcode == kWalked && it->objId == _id) {
it->objId = -1;
Expand All @@ -264,7 +264,7 @@ void QObjectPetka::stopWalk() {
_heroReaction = nullptr;

if (!_field7C) {
QMessage msg {_id, kSet, (uint16)_imageId, 1, 0, nullptr, 0};
QMessage msg(_id, kSet, (uint16)_imageId, 1, 0, nullptr, 0);
processMessage(msg);
}
}
Expand Down
6 changes: 3 additions & 3 deletions engines/petka/q_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static void readObject(QMessageObject &obj, Common::SeekableReadStream &stream,
if (castIni.getKey(obj._name, "all", rgbString)) {
int r, g, b;
sscanf(rgbString.c_str(), "%d %d %d", &r, &g, &b);
obj._dialogColor = Graphics::RGBToColor<Graphics::ColorMasks<888>>((byte)r, (byte)g, (byte)b);
obj._dialogColor = Graphics::RGBToColor<Graphics::ColorMasks<888> >((byte)r, (byte)g, (byte)b);
}
}

Expand Down Expand Up @@ -181,12 +181,12 @@ void QSystem::addMessage(const QMessage &msg) {
}

void QSystem::addMessage(uint16 objId, uint16 opcode, int16 arg1, int16 arg2, int16 arg3, int32 unk, QMessageObject *sender) {
_messages.push_back({objId, opcode, arg1, arg2, arg3, sender, unk});
_messages.push_back(QMessage(objId, opcode, arg1, arg2, arg3, sender, unk));
}

void QSystem::addMessageForAllObjects(uint16 opcode, int16 arg1, int16 arg2, int16 arg3, int32 unk, QMessageObject *sender) {
for (uint i = 0; i < _allObjects.size(); ++i) {
_messages.push_back({_allObjects[i]->_id, opcode, arg1, arg2, arg3, sender, unk});
_messages.push_back(QMessage(_allObjects[i]->_id, opcode, arg1, arg2, arg3, sender, unk));
}
}

Expand Down

0 comments on commit 072c254

Please sign in to comment.