diff options
author | Gregory Montoir | 2003-12-29 20:18:31 +0000 |
---|---|---|
committer | Gregory Montoir | 2003-12-29 20:18:31 +0000 |
commit | bd23a44f495e32aef7e920896848cc6ad3c4bb68 (patch) | |
tree | efa4110a178209a2e6f966f297c8229604fb1536 | |
parent | 865797cbeec0678a3042314875a0ea0f2c07994c (diff) | |
download | scummvm-rg350-bd23a44f495e32aef7e920896848cc6ad3c4bb68.tar.gz scummvm-rg350-bd23a44f495e32aef7e920896848cc6ad3c4bb68.tar.bz2 scummvm-rg350-bd23a44f495e32aef7e920896848cc6ad3c4bb68.zip |
cleanup & follow code conventions
svn-id: r12019
-rw-r--r-- | queen/command.cpp | 206 | ||||
-rw-r--r-- | queen/debug.cpp | 10 | ||||
-rw-r--r-- | queen/display.cpp | 79 | ||||
-rw-r--r-- | queen/graphics.cpp | 81 | ||||
-rw-r--r-- | queen/journal.cpp | 93 | ||||
-rw-r--r-- | queen/queen.cpp | 13 | ||||
-rw-r--r-- | queen/walk.cpp | 102 | ||||
-rw-r--r-- | queen/walk.h | 1 | ||||
-rw-r--r-- | queen/xref.txt | 2 |
9 files changed, 139 insertions, 448 deletions
diff --git a/queen/command.cpp b/queen/command.cpp index 34351e06e8..023941b75a 100644 --- a/queen/command.cpp +++ b/queen/command.cpp @@ -36,25 +36,21 @@ namespace Queen { void CmdText::clear() { - memset(_command, 0, sizeof(_command)); } void CmdText::display(uint8 color) { - _vm->graphics()->textCurrentColor(color); _vm->graphics()->textSetCentered(COMMAND_Y_POS, _command, false); } void CmdText::displayTemp(uint8 color, bool locked, Verb v, const char *name) { - char temp[MAX_COMMAND_LEN]; if (locked) { sprintf(temp, "%s%s", _vm->logic()->joeResponse(39), _vm->logic()->verbName(v)); - } - else { + } else { strcpy(temp, _vm->logic()->verbName(v)); } if (name != NULL) { @@ -67,7 +63,6 @@ void CmdText::displayTemp(uint8 color, bool locked, Verb v, const char *name) { void CmdText::displayTemp(uint8 color, const char *name) { - char temp[MAX_COMMAND_LEN]; sprintf(temp, "%s %s", _command, name); _vm->graphics()->textCurrentColor(color); @@ -76,20 +71,17 @@ void CmdText::displayTemp(uint8 color, const char *name) { void CmdText::setVerb(Verb v) { - strcpy(_command, _vm->logic()->verbName(v)); } void CmdText::addLinkWord(Verb v) { - strcat(_command, " "); strcat(_command, _vm->logic()->verbName(v)); } void CmdText::addObject(const char *objName) { - strcat(_command, " "); strcat(_command, objName); } @@ -101,7 +93,6 @@ bool CmdText::isEmpty() const { void CmdState::init() { - commandLevel = 1; oldVerb = verb = action = VERB_NONE; oldNoun = noun = subject[0] = subject[1] = 0; @@ -113,12 +104,12 @@ void CmdState::init() { Command::Command(QueenEngine *vm) : _vm(vm) { + _cmdText._vm = vm; } void Command::clear(bool clearTexts) { - _cmdText.clear(); if (clearTexts) { _vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); @@ -129,7 +120,6 @@ void Command::clear(bool clearTexts) { void Command::executeCurrentAction() { - _vm->logic()->entryObj(0); // if (_state.commandLevel == 2 && _mouseKey == Input::MOUSE_RBUTTON) { @@ -201,14 +191,12 @@ void Command::executeCurrentAction() { // only exit on a condition fail if at last command // Joe hasnt spoken, so do normal LOOK command break; - } - else if (cond == -2 && i == comMax) { + } else if (cond == -2 && i == comMax) { // only exit on a condition fail if at last command // Joe has spoken, so skip LOOK command cleanupCurrentAction(); return; - } - else if (cond >= 0) { + } else if (cond >= 0) { // we've had a successful Gamestate check, so we must now exit cond = executeCommand(comId, cond); break; @@ -217,8 +205,7 @@ void Command::executeCurrentAction() { if (cond <= 0 && _state.selAction == VERB_LOOK_AT) { lookAtSelectedObject(); - } - else { + } else { // only play song if it's a PLAY AFTER type if (com->song < 0) { _vm->sound()->playSong(-com->song); @@ -230,7 +217,6 @@ void Command::executeCurrentAction() { void Command::updatePlayer() { - if (_vm->logic()->joeWalk() != JWM_MOVE) { int16 cx = _vm->input()->mousePosX(); int16 cy = _vm->input()->mousePosY(); @@ -243,8 +229,7 @@ void Command::updatePlayer() { if (_vm->input()->keyVerb() == VERB_USE_JOURNAL) { _vm->input()->clearKeyVerb(); _vm->logic()->useJournal(); - } - else if (_vm->input()->keyVerb() != VERB_SKIP_TEXT) { + } else if (_vm->input()->keyVerb() != VERB_SKIP_TEXT) { _state.verb = _vm->input()->keyVerb(); if (isVerbInv(_state.verb)) { _state.noun = _state.selNoun = 0; @@ -255,8 +240,7 @@ void Command::updatePlayer() { _state.oldNoun = 0; _state.oldVerb = VERB_NONE; grabSelectedItem(); - } - else { + } else { grabSelectedVerb(); } _vm->input()->clearKeyVerb(); @@ -272,7 +256,6 @@ void Command::updatePlayer() { void Command::readCommandsFrom(byte *&ptr) { - uint16 i; _numCmdList = READ_BE_UINT16(ptr); ptr += 2; @@ -313,7 +296,6 @@ void Command::readCommandsFrom(byte *&ptr) { ObjectData *Command::findObjectData(uint16 objRoomNum) const { - ObjectData *od = NULL; if (objRoomNum != 0) { objRoomNum += _vm->logic()->currentRoomData(); @@ -324,7 +306,6 @@ ObjectData *Command::findObjectData(uint16 objRoomNum) const { ItemData *Command::findItemData(Verb invNum) const { - ItemData *id = NULL; uint16 itNum = _vm->logic()->findInventoryItem(invNum - VERB_INV_FIRST); if (itNum != 0) { @@ -335,7 +316,6 @@ ItemData *Command::findItemData(Verb invNum) const { int16 Command::executeCommand(uint16 comId, int16 condResult) { - // execute.c l.313-452 debug(0, "Command::executeCommand() - cond = %X, com = %X", condResult, comId); @@ -366,8 +346,7 @@ int16 Command::executeCommand(uint16 comId, int16 condResult) { if (executeIfCutaway(desc)) { condResult = 0; cutDone = true; - } - else if (executeIfDialog(desc)) { + } else if (executeIfDialog(desc)) { condResult = 0; } } @@ -395,13 +374,11 @@ int16 Command::executeCommand(uint16 comId, int16 condResult) { // make sure that object is not already updated od->image = -(od->image + 10); } - } - else { + } else { od->image = com->imageOrder; } _vm->logic()->roomRefreshObject(_state.subject[0]); - } - else { + } else { // this object is not being updated by command list, see if // it has another image copied to it if (_state.subject[0] > 0) { @@ -437,9 +414,8 @@ int16 Command::executeCommand(uint16 comId, int16 condResult) { break; } - if (_state.subject[0] > 0) { + if (_state.subject[0] > 0) changeObjectState(_state.selAction, _state.subject[0], com->song, cutDone); - } // execute.c l.533-548 // FIXME: useless test, as .dog has already been played @@ -461,7 +437,6 @@ int16 Command::executeCommand(uint16 comId, int16 condResult) { int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, Verb v, bool mustWalk) { - // Check to see if object is actually an exit to another // room. If so, then set up new room ObjectData *objData = _vm->logic()->objectData(objNum); @@ -482,8 +457,7 @@ int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, Verb v, bool mustWa y = wod->y; } } - } - else { + } else { _vm->logic()->entryObj(0); _vm->logic()->newRoom(0); } @@ -499,8 +473,7 @@ int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, Verb v, bool mustWa if (x == bobJoe->x && y == bobJoe->y) { _vm->logic()->joeFacing(facing); _vm->logic()->joeFace(); - } - else { + } else { p = _vm->walk()->moveJoe(facing, x, y, false); if (p != 0) { _vm->logic()->newRoom(0); // cancel makeJoeWalkTo, that should be equivalent to cr10 fix @@ -514,7 +487,6 @@ int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, Verb v, bool mustWa void Command::grabCurrentSelection() { - _selPosX = _vm->input()->mousePosX(); _selPosY = _vm->input()->mousePosY(); @@ -528,17 +500,13 @@ void Command::grabCurrentSelection() { // move through inventory (by four if right mouse button) uint16 scroll = (_mouseKey == Input::MOUSE_RBUTTON) ? 4 : 1; _vm->logic()->inventoryScroll(scroll, _state.verb == VERB_SCROLL_UP); - } - else if (isVerbAction(_state.verb)) { + } else if (isVerbAction(_state.verb)) { grabSelectedVerb(); - } - else if (isVerbInv(_state.verb)) { + } else if (isVerbInv(_state.verb)) { grabSelectedItem(); - } - else if (_state.noun != 0) { // 0 && _state.noun <= _vm->logic()->currentRoomObjMax()) { + } else if (_state.noun != 0) { // 0 && _state.noun <= _vm->logic()->currentRoomObjMax()) { grabSelectedNoun(); - } - else if (_selPosY < ROOM_ZONE_HEIGHT && _state.verb == VERB_NONE) { + } else if (_selPosY < ROOM_ZONE_HEIGHT && _state.verb == VERB_NONE) { // select without a command, do a WALK clear(true); _vm->logic()->joeWalk(JWM_EXECUTE); @@ -547,7 +515,6 @@ void Command::grabCurrentSelection() { void Command::grabSelectedObject(int16 objNum, uint16 objState, uint16 objName) { - if (_state.action != VERB_NONE) { _cmdText.addObject(_vm->logic()->objectName(objName)); } @@ -562,20 +529,17 @@ void Command::grabSelectedObject(int16 objNum, uint16 objState, uint16 objName) _cmdText.addLinkWord(VERB_PREP_WITH); _cmdText.display(INK_CMD_NORMAL); _parse = false; - } - else { + } else { // _cmdText.display(INK_CMD_SELECT); _parse = true; } - } - else if (_state.action == VERB_GIVE && _state.commandLevel == 1) { + } else if (_state.action == VERB_GIVE && _state.commandLevel == 1) { // command not fully constructed _state.commandLevel = 2; _cmdText.addLinkWord(VERB_PREP_TO); _cmdText.display(INK_CMD_NORMAL); _parse = false; - } - else { + } else { // _cmdText.display(INK_CMD_SELECT); _parse = true; } @@ -591,7 +555,6 @@ void Command::grabSelectedObject(int16 objNum, uint16 objState, uint16 objName) void Command::grabSelectedItem() { - // _parse = true; ItemData *id = findItemData(_state.verb); @@ -617,8 +580,7 @@ void Command::grabSelectedItem() { _cmdText.setVerb(VERB_LOOK_AT); } _state.action = _state.verb; - } - else { + } else { // Action>0 ONLY if command has been constructed // Left Mouse Button pressed just do Look At _state.action = VERB_LOOK_AT; @@ -626,8 +588,7 @@ void Command::grabSelectedItem() { } } _state.verb = VERB_NONE; - } - else { + } else { // if (_vm->logic()->joeWalk() == JWM_MOVE) { // _cmdText.clear(); // _state.commandLevel = 1; @@ -647,20 +608,16 @@ void Command::grabSelectedItem() { _state.verb = VERB_LOOK_AT; _state.action = VERB_LOOK_AT; _cmdText.setVerb(VERB_LOOK_AT); - } - else { - if (_state.commandLevel == 2 && _parse) { + } else { + if (_state.commandLevel == 2 && _parse) _state.verb = _state.action; - } - else { + else _state.verb = State::findDefaultVerb(id->state); - } if (_state.verb == VERB_NONE) { // No match made, so command not yet completed. Redefine as LOOK AT _state.action = VERB_LOOK_AT; _cmdText.setVerb(VERB_LOOK_AT); - } - else { + } else { _state.action = _state.verb; } _state.verb = VERB_NONE; @@ -672,7 +629,6 @@ void Command::grabSelectedItem() { void Command::grabSelectedNoun() { - // if the NOUN has been selected from screen then it is positive // otherwise it has been selected from inventory and is negative // set PARSE to TRUE, default FALSE if command half complete @@ -699,8 +655,7 @@ void Command::grabSelectedNoun() { _state.action = VERB_WALK_TO; _cmdText.setVerb(VERB_WALK_TO); } - } - else if (_mouseKey == Input::MOUSE_RBUTTON) { + } else if (_mouseKey == Input::MOUSE_RBUTTON) { // rmb pressed, do default if one exists if (_state.defaultVerb != VERB_NONE) { @@ -717,13 +672,11 @@ void Command::grabSelectedNoun() { _state.selAction = (_state.verb == VERB_NONE) ? VERB_WALK_TO : _state.verb; _cmdText.setVerb(_state.selAction); _cmdText.addObject(_vm->logic()->objectName(od->name)); - } - else { + } else { _state.verb = VERB_NONE; if ((_state.commandLevel == 2 && !_parse) || _state.action != VERB_NONE) { _state.verb = _state.action; - } - else { + } else { _state.verb = State::findDefaultVerb(od->state); } _state.action = (_state.verb == VERB_NONE) ? VERB_WALK_TO : _state.verb; @@ -739,7 +692,6 @@ void Command::grabSelectedNoun() { void Command::grabSelectedVerb() { - _state.action = _state.verb; _state.subject[0] = 0; _state.subject[1] = 0; @@ -764,7 +716,6 @@ void Command::grabSelectedVerb() { bool Command::executeIfCutaway(const char *description) { - if (strlen(description) > 4 && scumm_stricmp(description + strlen(description) - 4, ".cut") == 0) { @@ -783,7 +734,6 @@ bool Command::executeIfCutaway(const char *description) { bool Command::executeIfDialog(const char *description) { - if (strlen(description) > 4 && scumm_stricmp(description + strlen(description) - 4, ".dog") == 0) { @@ -805,7 +755,6 @@ bool Command::executeIfDialog(const char *description) { bool Command::handleWrongAction() { - // l.96-141 execute.c uint16 objMax = _vm->logic()->currentRoomObjMax(); uint16 roomData = _vm->logic()->currentRoomData(); @@ -849,7 +798,6 @@ bool Command::handleWrongAction() { void Command::sayInvalidAction(Verb action, int16 subj1, int16 subj2) { - // l.158-272 execute.c switch (action) { @@ -867,12 +815,10 @@ void Command::sayInvalidAction(Verb action, int16 subj1, int16 subj2) { uint16 k = _vm->logic()->itemData(-subj1)->sfxDescription; if (k > 0) { _vm->logic()->joeSpeak(k, true); - } - else { + } else { _vm->logic()->joeSpeak(2); } - } - else { + } else { _vm->logic()->joeSpeak(2); } break; @@ -891,12 +837,10 @@ void Command::sayInvalidAction(Verb action, int16 subj1, int16 subj2) { int16 img = _vm->logic()->objectData(subj1)->image; if (img == -4 || img == -3) { _vm->logic()->joeSpeak(18); - } - else { + } else { _vm->logic()->joeSpeak(3); } - } - else { + } else { _vm->logic()->joeSpeak(3); } break; @@ -909,12 +853,10 @@ void Command::sayInvalidAction(Verb action, int16 subj1, int16 subj2) { if (img == -4 || img == -3) { _vm->logic()->joeSpeak(27 + _vm->randomizer.getRandomNumber(2)); } - } - else { + } else { _vm->logic()->joeSpeak(11); } - } - else { + } else { _vm->logic()->joeSpeak(12); } break; @@ -922,14 +864,12 @@ void Command::sayInvalidAction(Verb action, int16 subj1, int16 subj2) { case VERB_PICK_UP: if (subj1 < 0) { _vm->logic()->joeSpeak(14); - } - else { + } else { int16 img = _vm->logic()->objectData(subj2)->image; if (img == -4 || img == -3) { // Trying to get a person _vm->logic()->joeSpeak(20); - } - else { + } else { // 5 : 'I can't pick that up' // 6 : 'I don't think I need that' // 7 : 'I'd rather leave it here' @@ -946,7 +886,6 @@ void Command::sayInvalidAction(Verb action, int16 subj1, int16 subj2) { void Command::changeObjectState(Verb action, int16 obj, int16 song, bool cutDone) { - // l.456-533 execute.c ObjectData *objData = _vm->logic()->objectData(obj); @@ -965,13 +904,11 @@ void Command::changeObjectState(Verb action, int16 obj, int16 song, bool cutDone openOrCloseAssociatedObject(action, ABS(objData->entryObj)); objData->entryObj = ABS(objData->entryObj); } - } - else { + } else { // 'it's already open !' _vm->logic()->joeSpeak(9); } - } - else if (action == VERB_CLOSE && !cutDone) { + } else if (action == VERB_CLOSE && !cutDone) { if (State::findOn(objData->state) == STATE_ON_OFF) { State::alterOn(&objData->state, STATE_ON_ON); State::alterDefaultVerb(&objData->state, VERB_OPEN); @@ -986,19 +923,16 @@ void Command::changeObjectState(Verb action, int16 obj, int16 song, bool cutDone openOrCloseAssociatedObject(action, ABS(objData->entryObj)); objData->entryObj = -ABS(objData->entryObj); } - } - else { + } else { // 'it's already closed !' _vm->logic()->joeSpeak(10); } - } - else if (action == VERB_MOVE) { + } else if (action == VERB_MOVE) { State::alterOn(&objData->state, STATE_ON_OFF); } } void Command::cleanupCurrentAction() { - // l.595-597 execute.c _vm->logic()->joeFace(); _state.oldNoun = 0; @@ -1007,7 +941,6 @@ void Command::cleanupCurrentAction() { void Command::openOrCloseAssociatedObject(Verb action, int16 otherObj) { - CmdListData *cmdList = &_cmdList[1]; uint16 com = 0; uint16 i; @@ -1026,8 +959,7 @@ void Command::openOrCloseAssociatedObject(Verb action, int16 otherObj) { } } } - } - else { + } else { com = i; break; } @@ -1051,8 +983,7 @@ void Command::openOrCloseAssociatedObject(Verb action, int16 otherObj) { State::alterDefaultVerb(&objData->state, VERB_NONE); objData->entryObj = ABS(objData->entryObj); } - } - else if (action == VERB_CLOSE) { + } else if (action == VERB_CLOSE) { if (State::findOn(objData->state) == STATE_ON_OFF) { State::alterOn(&objData->state, STATE_ON_ON); State::alterDefaultVerb(&objData->state, VERB_OPEN); @@ -1064,7 +995,6 @@ void Command::openOrCloseAssociatedObject(Verb action, int16 otherObj) { int16 Command::setConditions(uint16 command, bool lastCmd) { - debug(9, "Command::setConditions(%d, %d)", command, lastCmd); // Test conditions, if FAIL write && exit, Return -1 // if(Joe speaks before he returns, -2 is returned @@ -1086,8 +1016,7 @@ int16 Command::setConditions(uint16 command, bool lastCmd) { ret = i; break; } - } - else { + } else { temp[tempInd] = i; ++tempInd; } @@ -1104,12 +1033,10 @@ int16 Command::setConditions(uint16 command, bool lastCmd) { _vm->logic()->joeSpeak(cmdGs->speakValue, true); } ret = -2; - } - else { + } else { ret = -1; } - } - else { + } else { ret = 0; // all tests were okay, now set gamestates for (i = 0; i < tempInd; ++i) { @@ -1124,7 +1051,6 @@ int16 Command::setConditions(uint16 command, bool lastCmd) { void Command::setAreas(uint16 command) { - debug(9, "Command::setAreas(%d)", command); CmdArea *cmdArea = &_cmdArea[1]; @@ -1136,8 +1062,7 @@ void Command::setAreas(uint16 command) { if (cmdArea->area > 0) { // turn on area area->mapNeighbours = ABS(area->mapNeighbours); - } - else { + } else { // turn off area area->mapNeighbours = -ABS(area->mapNeighbours); } @@ -1147,7 +1072,6 @@ void Command::setAreas(uint16 command) { void Command::setObjects(uint16 command) { - debug(9, "Command::setObjects(%d)", command); CmdObject *cmdObj = &_cmdObject[1]; @@ -1205,8 +1129,7 @@ void Command::setObjects(uint16 command) { // is not current object then update it _vm->logic()->roomRefreshObject(dstObj); } - } - else { + } else { // hide the object if (objData->name > 0) { objData->name = -objData->name; @@ -1222,7 +1145,6 @@ void Command::setObjects(uint16 command) { void Command::setItems(uint16 command) { - debug(9, "Command::setItems(%d)", command); CmdInventory *cmdInv = &_cmdInventory[1]; @@ -1235,22 +1157,19 @@ void Command::setItems(uint16 command) { if (cmdInv->dstItem > 0) { // add item to inventory if (cmdInv->srcItem > 0) { - // copy data from source item to item + // copy data from source item to item, then enable it items[dstItem] = items[cmdInv->srcItem]; - // enable it items[dstItem].name = ABS(items[dstItem].name); } _vm->logic()->inventoryInsertItem(cmdInv->dstItem); - } - else { + } else { // delete item if (items[dstItem].name > 0) { _vm->logic()->inventoryDeleteItem(dstItem); } if (cmdInv->srcItem > 0) { - // copy data from source item to item + // copy data from source item to item, then disable it items[dstItem] = items[cmdInv->srcItem]; - // disable it items[dstItem].name = -ABS(items[dstItem].name); } } @@ -1260,7 +1179,6 @@ void Command::setItems(uint16 command) { uint16 Command::nextObjectDescription(ObjectDescription* objDesc, uint16 firstDesc) { - // l.69-103 select.c uint16 i; uint16 diff = objDesc->lastDescription - firstDesc; @@ -1300,7 +1218,6 @@ uint16 Command::nextObjectDescription(ObjectDescription* objDesc, uint16 firstDe void Command::lookAtSelectedObject() { - // if (_state.selNoun > 0 && _state.selNoun <= _vm->logic()->currentRoomObjMax()) { // uint16 objNum = _vm->logic()->currentRoomData() + _state.selNoun; // if (_vm->logic()->objectData(objNum)->entryObj == 0) { @@ -1314,8 +1231,7 @@ void Command::lookAtSelectedObject() { uint16 desc; if (_state.subject[0] < 0) { desc = _vm->logic()->itemData(-_state.subject[0])->description; - } - else { + } else { ObjectData *objData = _vm->logic()->objectData(_state.subject[0]); if (objData->name <= 0) { return; @@ -1364,7 +1280,6 @@ void Command::lookAtSelectedObject() { void Command::lookForCurrentObject(int16 cx, int16 cy) { - uint16 obj = _vm->logic()->findObjectUnderCursor(cx, cy); _state.noun = _vm->logic()->findObjectNumber(obj); @@ -1395,8 +1310,7 @@ void Command::lookForCurrentObject(int16 cx, int16 cy) { _vm->graphics()->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS); if (_state.defaultVerb != VERB_NONE) { _cmdText.displayTemp(INK_CMD_LOCK, true, _state.defaultVerb); - } - else if (_state.action != VERB_NONE) { + } else if (_state.action != VERB_NONE) { _cmdText.display(INK_CMD_NORMAL); } return; @@ -1413,8 +1327,7 @@ void Command::lookForCurrentObject(int16 cx, int16 cy) { const char *name = _vm->logic()->objectName(od->name); if (_state.defaultVerb != VERB_NONE) { _cmdText.displayTemp(INK_CMD_LOCK, true, _state.defaultVerb, name); - } - else { + } else { _cmdText.displayTemp(INK_CMD_NORMAL, name); } _state.oldNoun = _state.noun; @@ -1422,7 +1335,6 @@ void Command::lookForCurrentObject(int16 cx, int16 cy) { void Command::lookForCurrentIcon(int16 cx, int16 cy) { - _state.verb = _vm->logic()->findVerbUnderCursor(cx, cy); if (_state.oldVerb != _state.verb) { @@ -1441,19 +1353,15 @@ void Command::lookForCurrentIcon(int16 cx, int16 cy) { const char *name = _vm->logic()->objectName(id->name); if (_state.defaultVerb != VERB_NONE) { _cmdText.displayTemp(INK_CMD_LOCK, true, _state.defaultVerb, name); - } - else { + } else { _cmdText.displayTemp(INK_CMD_NORMAL, name); } } - } - else if (isVerbAction(_state.verb)) { + } else if (isVerbAction(_state.verb)) { _cmdText.displayTemp(INK_CMD_NORMAL, false, _state.verb); - } - else if (_state.verb == VERB_NONE) { + } else if (_state.verb == VERB_NONE) { _cmdText.display(INK_CMD_NORMAL); } - _state.oldVerb = _state.verb; } } diff --git a/queen/debug.cpp b/queen/debug.cpp index 89ed421fd2..96c5b7752a 100644 --- a/queen/debug.cpp +++ b/queen/debug.cpp @@ -52,20 +52,17 @@ Debugger::Debugger(QueenEngine *vm) void Debugger::preEnter() { - // XXX mute all sounds } void Debugger::postEnter() { - // XXX un-mute all sounds _vm->graphics()->bobSetupControl(); // re-init mouse cursor } bool Debugger::Cmd_Exit(int argc, const char **argv) { - _detach_now = true; return false; } @@ -94,7 +91,6 @@ bool Debugger::Cmd_Help(int argc, const char **argv) { bool Debugger::Cmd_Asm(int argc, const char **argv) { - if (argc == 2) { uint16 sm = atoi(argv[1]); DebugPrintf("Executing special move %d\n", sm); @@ -107,7 +103,6 @@ bool Debugger::Cmd_Asm(int argc, const char **argv) { bool Debugger::Cmd_Areas(int argc, const char **argv) { - _drawAreas = !_drawAreas; DebugPrintf("Room areas display %s\n", _drawAreas ? "on" : "off"); return true; @@ -115,7 +110,6 @@ bool Debugger::Cmd_Areas(int argc, const char **argv) { bool Debugger::Cmd_GameState(int argc, const char **argv) { - uint16 slot; switch (argc) { case 2: @@ -139,7 +133,6 @@ bool Debugger::Cmd_GameState(int argc, const char **argv) { bool Debugger::Cmd_Info(int argc, const char **argv) { - DebugPrintf("Version: %s\n", _vm->resource()->JASVersion()); DebugPrintf("Room number: %d\n", _vm->logic()->currentRoom()); DebugPrintf("Room name: %s\n", _vm->logic()->roomName(_vm->logic()->currentRoom())); @@ -148,7 +141,6 @@ bool Debugger::Cmd_Info(int argc, const char **argv) { bool Debugger::Cmd_Items(int argc, const char **argv) { - int n = _vm->logic()->itemDataCount(); ItemData *item = _vm->logic()->itemData(1); while (n--) { @@ -161,7 +153,6 @@ bool Debugger::Cmd_Items(int argc, const char **argv) { bool Debugger::Cmd_Room(int argc, const char **argv) { - if (argc == 2) { uint16 roomNum = atoi(argv[1]); _vm->logic()->joeX(0); @@ -176,7 +167,6 @@ bool Debugger::Cmd_Room(int argc, const char **argv) { } bool Debugger::Cmd_Song(int argc, const char **argv) { - if (argc == 2) { int16 songNum = atoi(argv[1]); _vm->sound()->playSong(songNum); diff --git a/queen/display.cpp b/queen/display.cpp index 9aed6c6957..fe83852d38 100644 --- a/queen/display.cpp +++ b/queen/display.cpp @@ -30,7 +30,6 @@ namespace Queen { void TextRenderer::init() { - // calculate font justification sizes uint16 i, y, x; @@ -52,7 +51,6 @@ void TextRenderer::init() { void TextRenderer::drawString(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, uint8 color, const char *text, bool outlined) { - const uint8 *str = (const uint8*)text; while (*str && x < dstPitch) { @@ -78,7 +76,6 @@ void TextRenderer::drawString(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y void TextRenderer::drawChar(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, uint8 color, const uint8 *chr) { - dstBuf += dstPitch * y + x; uint16 j, i; for (j = 0; j < 8; ++j) { @@ -100,8 +97,7 @@ void TextRenderer::drawChar(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, Display::Display(QueenEngine *vm, Language language, OSystem *system) - : _system(system), _vm(vm) { - + : _system(system), _vm(vm), _horizontalScroll(0), _curBlankingEffect(0) { _dynalum.prevColMask = 0xFF; _textRenderer._lang = language; _textRenderer.init(); @@ -126,14 +122,10 @@ Display::Display(QueenEngine *vm, Language language, OSystem *system) _pal.dirtyMin = 0; _pal.dirtyMax = 255; _pal.scrollable = true; - - _horizontalScroll = 0; - _curBlankingEffect = 0; } Display::~Display() { - delete[] _buffer[RB_BACKDROP]; delete[] _buffer[RB_PANEL]; delete[] _buffer[RB_SCREEN]; @@ -145,7 +137,6 @@ Display::~Display() { void Display::dynalumInit(const char *roomName, uint16 roomNum) { - debug(9, "Display::dynalumInit(%s, %d)", roomName, roomNum); memset(_dynalum.msk, 0, sizeof(_dynalum.msk)); memset(_dynalum.lum, 0, sizeof(_dynalum.lum)); @@ -168,20 +159,17 @@ void Display::dynalumInit(const char *roomName, uint16 roomNum) { void Display::dynalumUpdate(int16 x, int16 y) { - if (!_dynalum.valid) return; if (x < 0) { x = 0; - } - else if (x >= _bdWidth) { + } else if (x >= _bdWidth) { x = _bdWidth; } if (y < 0) { y = 0; - } - else if (y >= ROOM_ZONE_HEIGHT - 1) { + } else if (y >= ROOM_ZONE_HEIGHT - 1) { y = ROOM_ZONE_HEIGHT - 1; } @@ -202,8 +190,7 @@ void Display::dynalumUpdate(int16 x, int16 y) { int16 c = (int16)(_pal.room[i * 3 + j] + _dynalum.lum[colMask * 3 + j] * 4); if (c < 0) { c = 0; - } - else if (c > 255) { + } else if (c > 255) { c = 255; } _pal.screen[i * 3 + j] = (uint8)c; @@ -217,7 +204,6 @@ void Display::dynalumUpdate(int16 x, int16 y) { void Display::palConvert(uint8 *outPal, const uint8 *inPal, int start, int end) { - int i; for (i = start; i <= end; i++) { outPal[4 * i + 0] = inPal[3 * i + 0]; @@ -229,7 +215,6 @@ void Display::palConvert(uint8 *outPal, const uint8 *inPal, int start, int end) void Display::palSet(const uint8 *pal, int start, int end, bool updateScreen) { - debug(9, "Display::palSet(%d, %d)", start, end); uint8 tempPal[256 * 4]; palConvert(tempPal, pal, start, end); @@ -242,7 +227,6 @@ void Display::palSet(const uint8 *pal, int start, int end, bool updateScreen) { void Display::palSetJoe(JoePalette pal) { - debug(9, "Display::palSetJoe(%d)", pal); const uint8 *palJoe = NULL; switch (pal) { @@ -260,7 +244,6 @@ void Display::palSetJoe(JoePalette pal) { void Display::palFadeIn(int start, int end, uint16 roomNum, bool dynalum, int16 dynaX, int16 dynaY) { - debug(9, "Display::palFadeIn(%d, %d)", start, end); memcpy(_pal.screen, _pal.room, 256 * 3); if (!(IS_ALT_INTRO_ROOM(roomNum) || IS_CD_INTRO_ROOM(roomNum))) { @@ -289,15 +272,13 @@ void Display::palFadeIn(int start, int end, uint16 roomNum, bool dynalum, int16 void Display::palFadeOut(int start, int end, uint16 roomNum) { - debug(9, "Display::palFadeOut(%d, %d)", start, end); _pal.scrollable = false; int n = end - start + 1; if (IS_ALT_INTRO_ROOM(roomNum) || IS_CD_INTRO_ROOM(roomNum)) { memset(_pal.screen + start * 3, 0, n * 3); palSet(_pal.screen, start, end, true); - } - else { + } else { uint8 tempPal[256 * 3]; memcpy(tempPal + start * 3, _pal.screen + start * 3, n * 3); int i; @@ -317,7 +298,6 @@ void Display::palFadeOut(int start, int end, uint16 roomNum) { void Display::palFadePanel() { - int i; uint8 tempPal[256 * 3]; for (i = 224 * 3; i < 256 * 3; i += 3) { @@ -330,7 +310,6 @@ void Display::palFadePanel() { void Display::palScroll(int start, int end) { - debug(9, "Display::palScroll(%d, %d)", start, end); uint8 *palEnd = _pal.screen + end * 3; @@ -353,7 +332,6 @@ void Display::palScroll(int start, int end) { void Display::palCustomColors(uint16 roomNum) { - debug(9, "Display::palCustomColors(%d)", roomNum); int i; switch (roomNum) { @@ -386,7 +364,6 @@ void Display::palCustomColors(uint16 roomNum) { void Display::palCustomScroll(uint16 roomNum) { - debug(9, "Display::palCustomScroll(%d)", roomNum); static int16 scrollx = 0; @@ -426,8 +403,7 @@ void Display::palCustomScroll(uint16 roomNum) { if (_vm->randomizer.getRandomNumber(1)) { if (ABS(jdir) == 1) { jdir *= 2; - } - else { + } else { jdir /= 2; } } @@ -597,7 +573,6 @@ void Display::palCustomScroll(uint16 roomNum) { void Display::palCustomFlash() { - uint8 tempPal[256 * 3]; int i = 0; while (i < 17 * 3) { @@ -620,7 +595,6 @@ void Display::palCustomFlash() { void Display::palCustomLightsOff(uint16 roomNum) { - int end = 223; int start = (roomNum == ROOM_FLODA_FRONTDESK) ? 32 : 16; int n = end - start + 1; @@ -633,7 +607,6 @@ void Display::palCustomLightsOff(uint16 roomNum) { void Display::palCustomLightsOn(uint16 roomNum) { - int end = 223; int start = (roomNum == ROOM_FLODA_FRONTDESK) ? 32 : 0; int n = end - start + 1; @@ -648,7 +621,6 @@ void Display::palCustomLightsOn(uint16 roomNum) { void Display::screenMode(int comPanel, bool inCutaway) { - debug(0, "Display::screenMode(%d, %d)", comPanel, inCutaway); // FIXME: this is temporary, just to see if my theory is right @@ -658,15 +630,13 @@ void Display::screenMode(int comPanel, bool inCutaway) { if (comPanel == 2 && inCutaway) { _fullscreen = (_bdHeight == GAME_SCREEN_HEIGHT); - } - else if (comPanel == 1) { + } else if (comPanel == 1) { _fullscreen = false; } } void Display::prepareUpdate() { - if (!_fullscreen) { // draw the panel memcpy(_buffer[RB_SCREEN] + _bufPitch[RB_SCREEN] * ROOM_ZONE_HEIGHT, @@ -687,7 +657,6 @@ void Display::prepareUpdate() { void Display::update(bool dynalum, int16 dynaX, int16 dynaY) { - if (_pal.scrollable && dynalum) { dynalumUpdate(dynaX, dynaY); } @@ -701,7 +670,6 @@ void Display::update(bool dynalum, int16 dynaX, int16 dynaY) { void Display::blit(RenderingBuffer dst, uint16 dstX, uint16 dstY, const uint8 *srcBuf, uint16 srcW, uint16 srcH, uint16 srcPitch, bool xflip, bool masked) { - uint16 dstPitch = _bufPitch[dst]; uint8 *dstBuf = _buffer[dst] + dstPitch * dstY + dstX; @@ -711,8 +679,7 @@ void Display::blit(RenderingBuffer dst, uint16 dstX, uint16 dstY, const uint8 *s srcBuf += srcPitch; dstBuf += dstPitch; } - } - else if (!xflip) { // Masked bitmap unflipped + } else if (!xflip) { // Masked bitmap unflipped while (srcH--) { int i; for(i = 0; i < srcW; ++i) { @@ -724,8 +691,7 @@ void Display::blit(RenderingBuffer dst, uint16 dstX, uint16 dstY, const uint8 *s srcBuf += srcPitch; dstBuf += dstPitch; } - } - else { // Masked bitmap flipped + } else { // Masked bitmap flipped while (srcH--) { int i; for(i = 0; i < srcW; ++i) { @@ -742,7 +708,6 @@ void Display::blit(RenderingBuffer dst, uint16 dstX, uint16 dstY, const uint8 *s void Display::fill(RenderingBuffer dst, uint16 x, uint16 y, uint16 w, uint16 h, uint8 color) { - assert(w <= _bufPitch[dst]); uint16 dstPitch = _bufPitch[dst]; uint8 *dstBuf = _buffer[dst] + dstPitch * y + x; @@ -754,7 +719,6 @@ void Display::fill(RenderingBuffer dst, uint16 x, uint16 y, uint16 w, uint16 h, void Display::readPCX(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, uint16 h) { - while (h--) { uint8 *p = dst; while (p < dst + w ) { @@ -763,8 +727,7 @@ void Display::readPCX(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, u uint8 len = col & 0x3F; memset(p, *src++, len); p += len; - } - else { + } else { *p++ = col; } } @@ -774,7 +737,6 @@ void Display::readPCX(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, u void Display::readPCXBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal) { - _bdWidth = READ_LE_UINT16(pcxBuf + 12); _bdHeight = READ_LE_UINT16(pcxBuf + 14); readPCX(_buffer[RB_BACKDROP], _bufPitch[RB_BACKDROP], pcxBuf + 128, _bdWidth, _bdHeight); @@ -783,7 +745,6 @@ void Display::readPCXBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal) void Display::readPCXPanel(const uint8 *pcxBuf, uint32 size) { - uint8 *dst = _buffer[RB_PANEL] + PANEL_W * 10; readPCX(dst, PANEL_W, pcxBuf + 128, PANEL_W, PANEL_H - 10); memcpy(_pal.room + 144 * 3, pcxBuf + size - 768 + 144 * 3, (256 - 144) * 3); @@ -791,14 +752,12 @@ void Display::readPCXPanel(const uint8 *pcxBuf, uint32 size) { void Display::horizontalScrollUpdate(int16 xCamera) { - debug(9, "Display::horizontalScrollUpdate(%d)", xCamera); _horizontalScroll = 0; if (_bdWidth > 320) { if (xCamera > 160 && xCamera < 480) { _horizontalScroll = xCamera - 160; - } - else if (xCamera >= 480) { + } else if (xCamera >= 480) { _horizontalScroll = 320; } } @@ -806,19 +765,16 @@ void Display::horizontalScrollUpdate(int16 xCamera) { void Display::horizontalScroll(int16 scroll) { - _horizontalScroll = scroll; } void Display::handleTimer() { - _gotTick = true; } void Display::waitForTimer() { - _gotTick = false; while (!_gotTick) { _vm->input()->delay(10); @@ -827,15 +783,13 @@ void Display::waitForTimer() { void Display::setMouseCursor(uint8 *buf, uint16 w, uint16 h, uint16 xhs, uint16 yhs) { - // change transparency color match the one expected by the backend (0xFF) uint16 size = w * h; uint8 *p = buf; while (size--) { if (*p == 255) { *p = 254; - } - else if (*p == 0) { + } else if (*p == 0) { *p = 255; } ++p; @@ -845,13 +799,11 @@ void Display::setMouseCursor(uint8 *buf, uint16 w, uint16 h, uint16 xhs, uint16 void Display::showMouseCursor(bool show) { - _system->show_mouse(show); } uint16 Display::textWidth(const char *text) const { - uint16 len = 0; while (*text) { len += _textRenderer._charWidth[ (uint8)*text ]; @@ -862,14 +814,12 @@ uint16 Display::textWidth(const char *text) const { void Display::drawText(uint16 x, uint16 y, uint8 color, const char *text, bool outlined) { - debug(9, "Display::drawText(%s)", text); _textRenderer.drawString(_buffer[RB_SCREEN], _bufPitch[RB_SCREEN], x, y, color, text, outlined); } void Display::drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col) { - uint8 *p = _buffer[RB_SCREEN]; uint16 pitch = _bufPitch[RB_SCREEN]; @@ -884,7 +834,6 @@ void Display::drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col) { void Display::drawScreen() { - _system->copy_rect(_buffer[RB_SCREEN], _bufPitch[RB_SCREEN], 0, 0, SCREEN_W, SCREEN_H); _system->update_screen(); waitForTimer(); @@ -893,7 +842,6 @@ void Display::drawScreen() { void Display::blankScreen() { - typedef void (Display::*BlankerEffect)(); static const BlankerEffect effects[] = { &Display::blankScreenEffect1, @@ -906,7 +854,6 @@ void Display::blankScreen() { void Display::blankScreenEffect1() { - while (_vm->input()->idleTime() >= Input::DELAY_SCREEN_BLANKER) { for(int i = 0; i < 2; ++i) { uint16 x = _vm->randomizer.getRandomNumber(SCREEN_W - MINI_W - 2) + 1; @@ -931,7 +878,6 @@ void Display::blankScreenEffect1() { void Display::blankScreenEffect2() { - while (_vm->input()->idleTime() >= Input::DELAY_SCREEN_BLANKER) { uint16 x = _vm->randomizer.getRandomNumber(SCREEN_W - 2); uint16 y = _vm->randomizer.getRandomNumber(SCREEN_H - 2); @@ -964,7 +910,6 @@ void Display::blankScreenEffect2() { void Display::blankScreenEffect3() { - uint32 i = 0; while (_vm->input()->idleTime() >= Input::DELAY_SCREEN_BLANKER) { uint16 x = _vm->randomizer.getRandomNumber(SCREEN_W - 2); diff --git a/queen/graphics.cpp b/queen/graphics.cpp index 6cdda3e44a..7080d36982 100644 --- a/queen/graphics.cpp +++ b/queen/graphics.cpp @@ -32,7 +32,6 @@ namespace Queen { void BobSlot::curPos(int16 xx, int16 yy) { - active = true; x = xx; y = yy; @@ -40,7 +39,6 @@ void BobSlot::curPos(int16 xx, int16 yy) { void BobSlot::move(int16 dstx, int16 dsty, int16 spd) { - active = true; moving = true; @@ -53,8 +51,7 @@ void BobSlot::move(int16 dstx, int16 dsty, int16 spd) { if (deltax < 0) { dx = -deltax; xdir = -1; - } - else { + } else { dx = deltax; xdir = 1; } @@ -62,8 +59,7 @@ void BobSlot::move(int16 dstx, int16 dsty, int16 spd) { if (deltay < 0) { dy = -deltay; ydir = -1; - } - else { + } else { dy = deltay; ydir = 1; } @@ -71,8 +67,7 @@ void BobSlot::move(int16 dstx, int16 dsty, int16 spd) { if (dx > dy) { total = dy / 2; xmajor = true; - } - else { + } else { total = dx / 2; xmajor = false; } @@ -83,13 +78,11 @@ void BobSlot::move(int16 dstx, int16 dsty, int16 spd) { void BobSlot::moveOneStep() { - if(xmajor) { if(x == endx) { y = endy; moving = false; - } - else { + } else { x += xdir; total += dy; if(total > dx) { @@ -97,13 +90,11 @@ void BobSlot::moveOneStep() { total -= dx; } } - } - else { + } else { if(y == endy) { x = endx; moving = false; - } - else { + } else { y += ydir; total += dx; if(total > dy) { @@ -116,7 +107,6 @@ void BobSlot::moveOneStep() { void BobSlot::animOneStep() { - if (anim.string.buffer != NULL) { --anim.speed; if(anim.speed <= 0) { @@ -126,14 +116,12 @@ void BobSlot::animOneStep() { if (nextFrame == 0) { anim.string.curPos = anim.string.buffer; frameNum = anim.string.curPos->frame; - } - else { + } else { frameNum = nextFrame; } anim.speed = anim.string.curPos->speed / 4; } - } - else { + } else { // normal looping animation --anim.speed; if(anim.speed == 0) { @@ -143,8 +131,7 @@ void BobSlot::animOneStep() { if (nextFrame > anim.normal.lastFrame || nextFrame < anim.normal.firstFrame) { if (anim.normal.rebound) { frameDir *= -1; - } - else { + } else { frameNum = anim.normal.firstFrame - 1; } } @@ -155,7 +142,6 @@ void BobSlot::animOneStep() { void BobSlot::animString(const AnimFrame *animBuf) { - active = true; animating = true; anim.string.buffer = animBuf; @@ -166,7 +152,6 @@ void BobSlot::animString(const AnimFrame *animBuf) { void BobSlot::animNormal(uint16 firstFrame, uint16 lastFrame, uint16 spd, bool rebound, bool flip) { - active = true; animating = true; frameNum = firstFrame; @@ -182,7 +167,6 @@ void BobSlot::animNormal(uint16 firstFrame, uint16 lastFrame, uint16 spd, bool r void BobSlot::clear() { - active = false; xflip = false; animating = false; @@ -198,7 +182,6 @@ void BobSlot::clear() { Graphics::Graphics(QueenEngine *vm) : _cameraBob(0), _vm(vm) { - memset(_frames, 0, sizeof(_frames)); memset(_banks, 0, sizeof(_banks)); memset(_bobs, 0, sizeof(_bobs)); @@ -209,7 +192,6 @@ Graphics::Graphics(QueenEngine *vm) Graphics::~Graphics() { - uint32 i; for(i = 0; i < ARRAYSIZE(_banks); ++i) { delete[] _banks[i].data; @@ -220,7 +202,6 @@ Graphics::~Graphics() { void Graphics::bankLoad(const char *bankname, uint32 bankslot) { - bankErase(bankslot); _banks[bankslot].data = _vm->resource()->loadFile(bankname); if (!_banks[bankslot].data) { @@ -248,7 +229,6 @@ void Graphics::bankLoad(const char *bankname, uint32 bankslot) { void Graphics::bankUnpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) { - debug(9, "Graphics::bankUnpack(%d, %d, %d)", srcframe, dstframe, bankslot); uint8 *p = _banks[bankslot].data + _banks[bankslot].indexes[srcframe]; @@ -273,7 +253,6 @@ void Graphics::bankUnpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) { void Graphics::bankOverpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) { - debug(9, "Graphics::bankOverpack(%d, %d, %d)", srcframe, dstframe, bankslot); uint8 *p = _banks[bankslot].data + _banks[bankslot].indexes[srcframe]; @@ -283,8 +262,7 @@ void Graphics::bankOverpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) { // unpack if destination frame is smaller than source one if (_frames[dstframe].width < src_w || _frames[dstframe].height < src_h) { bankUnpack(srcframe, dstframe, bankslot); - } - else { + } else { // copy data 'over' destination frame (without changing frame header) memcpy(_frames[dstframe].data, p + 8, src_w * src_h); } @@ -292,7 +270,6 @@ void Graphics::bankOverpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) { void Graphics::bankErase(uint32 bankslot) { - debug(9, "Graphics::bankErase(%d)", bankslot); delete[] _banks[bankslot].data; _banks[bankslot].data = 0; @@ -300,7 +277,6 @@ void Graphics::bankErase(uint32 bankslot) { void Graphics::bobSetupControl() { - bankLoad("control.BBK",17); bankUnpack(1, 1, 17); // Mouse pointer bankUnpack(3, 3, 17); // Up arrow dialogue @@ -313,7 +289,6 @@ void Graphics::bobSetupControl() { void Graphics::bobDraw(const BobSlot *bs, int16 x, int16 y) { - uint16 w, h; debug(9, "Graphics::bobDraw(%d, %d, %d)", bs->frameNum, x, y); @@ -361,8 +336,7 @@ void Graphics::bobDraw(const BobSlot *bs, int16 x, int16 y) { if (!bs->xflip) { src += x_skip; _vm->display()->blit(RB_SCREEN, x, y, src, w_new, h_new, w, bs->xflip, true); - } - else { + } else { src += w - w_new - x_skip; x += w_new - 1; _vm->display()->blit(RB_SCREEN, x, y, src, w_new, h_new, w, bs->xflip, true); @@ -373,12 +347,10 @@ void Graphics::bobDraw(const BobSlot *bs, int16 x, int16 y) { void Graphics::bobDrawInventoryItem(uint32 bobnum, uint16 x, uint16 y) { - if (bobnum == 0) { // clear panel area _vm->display()->fill(RB_PANEL, x, y, 32, 32, INK_BG_PANEL); - } - else { + } else { BobFrame *pbf = &_frames[bobnum]; _vm->display()->blit(RB_PANEL, x, y, pbf->data, pbf->width, pbf->height, pbf->width, false, false); } @@ -386,7 +358,6 @@ void Graphics::bobDrawInventoryItem(uint32 bobnum, uint16 x, uint16 y) { void Graphics::bobPaste(uint32 frameNum, int16 x, int16 y) { - BobFrame *pbf = &_frames[frameNum]; _vm->display()->blit(RB_BACKDROP, x, y, pbf->data, pbf->width, pbf->height, pbf->width, false, true); frameErase(frameNum); @@ -394,7 +365,6 @@ void Graphics::bobPaste(uint32 frameNum, int16 x, int16 y) { void Graphics::bobShrink(const BobFrame *bf, uint16 percentage) { - // computing new size, rounding to upper value uint16 new_w = (bf->width * percentage + 50) / 100; uint16 new_h = (bf->height * percentage + 50) / 100; @@ -440,7 +410,6 @@ void Graphics::bobShrink(const BobFrame *bf, uint16 percentage) { void Graphics::bobClear(uint32 bobnum) { - BobSlot *pbs = &_bobs[bobnum]; pbs->clear(); if (_vm->display()->fullscreen() || bobnum == 16) { // FIXME: does bob number 16 really used ? @@ -450,7 +419,6 @@ void Graphics::bobClear(uint32 bobnum) { void Graphics::bobSortAll() { - _sortedBobsCount = 0; // animate/move the bobs @@ -494,7 +462,6 @@ void Graphics::bobSortAll() { void Graphics::bobDrawAll() { - int i; for (i = 0; i < _sortedBobsCount; ++i) { BobSlot *pbs = _sortedBobs[i]; @@ -527,7 +494,6 @@ void Graphics::bobDrawAll() { void Graphics::bobClearAll() { - for(int32 i = 0; i < ARRAYSIZE(_bobs); ++i) { bobClear(i); } @@ -535,7 +501,6 @@ void Graphics::bobClearAll() { void Graphics::bobStopAll() { - for(int32 i = 0; i < ARRAYSIZE(_bobs); ++i) { _bobs[i].moving = false; } @@ -543,7 +508,6 @@ void Graphics::bobStopAll() { BobSlot *Graphics::bob(int index) { - if (index < MAX_BOBS_NUMBER) return _bobs + index; else { @@ -554,7 +518,6 @@ BobSlot *Graphics::bob(int index) { void Graphics::bobCustomParallax(uint16 roomNum) { - int i; uint16 screenScroll = _vm->display()->horizontalScroll(); switch (roomNum) { @@ -624,13 +587,11 @@ void Graphics::bobCustomParallax(uint16 roomNum) { void Graphics::textCurrentColor(uint8 color) { - _curTextColor = color; } void Graphics::textSet(uint16 x, uint16 y, const char *text, bool outlined) { - if (y < GAME_SCREEN_HEIGHT) { if (x == 0) x = 1; if (y == 0) y = 1; @@ -645,14 +606,12 @@ void Graphics::textSet(uint16 x, uint16 y, const char *text, bool outlined) { void Graphics::textSetCentered(uint16 y, const char *text, bool outlined) { - uint16 x = (GAME_SCREEN_WIDTH - textWidth(text)) / 2; textSet(x, y, text, outlined); } void Graphics::textDrawAll() { - int y; for (y = GAME_SCREEN_HEIGHT - 1; y > 0; --y) { const TextSlot *pts = &_texts[y]; @@ -664,7 +623,6 @@ void Graphics::textDrawAll() { void Graphics::textClear(uint16 y1, uint16 y2) { - while (y1 <= y2) { _texts[y1].text.clear(); ++y1; @@ -673,13 +631,11 @@ void Graphics::textClear(uint16 y1, uint16 y2) { uint16 Graphics::textWidth(const char* text) const { - return _vm->display()->textWidth(text); } void Graphics::frameErase(uint32 fslot) { - BobFrame *pbf = &_frames[fslot]; pbf->width = 0; pbf->height = 0; @@ -689,7 +645,6 @@ void Graphics::frameErase(uint32 fslot) { void Graphics::frameEraseAll(bool joe) { - int i = 0; if (!joe) { i = FRAMES_JOE + FRAMES_JOE_XTRA; @@ -702,7 +657,6 @@ void Graphics::frameEraseAll(bool joe) { void Graphics::loadBackdrop(const char* name, uint16 room) { - char roomPrefix[20]; strcpy(roomPrefix, name); roomPrefix[ strlen(roomPrefix) - 4 ] = '\0'; @@ -723,7 +677,6 @@ void Graphics::loadBackdrop(const char* name, uint16 room) { void Graphics::loadPanel() { - uint8 *pcxbuf = _vm->resource()->loadFile("panel.pcx"); if (pcxbuf == NULL) { error("Unable to open panel file"); @@ -735,7 +688,6 @@ void Graphics::loadPanel() { void BamScene::updateCarAnimation() { - if (_flag != F_STOP) { const BamDataBlock *bdb = &_carData[_index]; @@ -770,7 +722,6 @@ void BamScene::updateCarAnimation() { void BamScene::updateFightAnimation() { - if (_flag != F_STOP) { const BamDataBlock *bdb = &_fightData[_index]; @@ -831,7 +782,6 @@ void BamScene::updateFightAnimation() { void Graphics::update(uint16 room) { - bobSortAll(); if (_cameraBob >= 0) { _vm->display()->horizontalScrollUpdate(_bobs[_cameraBob].x); @@ -917,8 +867,7 @@ void Graphics::bobSetText( y = textY; width = 0; - } - else { + } else { x = pbs->x; y = pbs->y; @@ -939,8 +888,7 @@ void Graphics::bobSetText( x += width / 2; else x -= width / 2 + maxLineWidth; - } - else if (!flags) + } else if (!flags) x -= maxLineWidth / 2; if (x < 0) @@ -970,7 +918,6 @@ BamScene::BamScene(QueenEngine *vm) void BamScene::prepareAnimation() { - _obj1 = _vm->graphics()->bob(BOB_OBJ1); _vm->graphics()->bobClear(BOB_OBJ1); _obj1->active = true; diff --git a/queen/journal.cpp b/queen/journal.cpp index 076e92402a..836943e57f 100644 --- a/queen/journal.cpp +++ b/queen/journal.cpp @@ -40,7 +40,6 @@ Journal::Journal(QueenEngine *vm) void Journal::use() { - BobSlot *joe = _vm->graphics()->bob(0); _prevJoeX = joe->x; _prevJoeY = joe->y; @@ -97,7 +96,6 @@ void Journal::use() { void Journal::prepare() { - _vm->display()->horizontalScroll(0); _vm->display()->fullscreen(true); @@ -142,7 +140,6 @@ void Journal::prepare() { void Journal::restore() { - _vm->display()->fullscreen(false); _vm->logic()->joeX(_prevJoeX); @@ -156,7 +153,6 @@ void Journal::restore() { void Journal::redraw() { - drawNormalPanel(); drawConfigPanel(); drawSaveSlot(); @@ -165,7 +161,6 @@ void Journal::redraw() { void Journal::update() { - _vm->graphics()->update(JOURNAL_ROOM); if (_edit.enable) { int16 x = 136 + _edit.posCursor; @@ -177,7 +172,6 @@ void Journal::update() { void Journal::showBob(int bobNum, int16 x, int16 y, int frameNum) { - BobSlot *bob = _vm->graphics()->bob(bobNum); bob->curPos(x, y); bob->frameNum = JOURNAL_FRAMES + frameNum; @@ -185,13 +179,11 @@ void Journal::showBob(int bobNum, int16 x, int16 y, int frameNum) { void Journal::hideBob(int bobNum) { - _vm->graphics()->bob(bobNum)->active = false; } void Journal::findSaveDescriptions() { - SaveFileManager *mgr = OSystem::instance()->get_savefile_manager(); char filename[256]; makeSavegameName(filename); @@ -215,7 +207,6 @@ void Journal::findSaveDescriptions() { void Journal::drawSaveDescriptions() { - int i; for (i = 0; i < SAVE_PER_PAGE; ++i) { int n = _currentSavePage * 10 + i; @@ -231,13 +222,11 @@ void Journal::drawSaveDescriptions() { void Journal::drawSaveSlot() { - showBob(BOB_SAVE_DESC, 130, 6 + _currentSaveSlot * 13, 17); } void Journal::enterYesNoMode(int16 zoneNum, int titleNum) { - _mode = M_YES_NO; _prevZoneNum = zoneNum; drawYesNoPanel(titleNum); @@ -245,7 +234,6 @@ void Journal::enterYesNoMode(int16 zoneNum, int titleNum) { void Journal::exitYesNoMode() { - _mode = M_NORMAL; if (_prevZoneNum == ZN_MAKE_ENTRY) { _edit.enable = false; @@ -255,60 +243,47 @@ void Journal::exitYesNoMode() { void Journal::handleNormalMode(int16 zoneNum, int x) { - if (zoneNum == ZN_REVIEW_ENTRY) { enterYesNoMode(zoneNum, TXT_REVIEW_ENTRY); - } - else if (zoneNum == ZN_MAKE_ENTRY) { + } else if (zoneNum == ZN_MAKE_ENTRY) { initEditBuffer(_saveDescriptions[_currentSavePage * 10 + _currentSaveSlot]); enterYesNoMode(zoneNum, TXT_MAKE_ENTRY); - } - else if (zoneNum == ZN_CLOSE) { + } else if (zoneNum == ZN_CLOSE) { _quit = true; - } - else if (zoneNum == ZN_GIVEUP) { + } else if (zoneNum == ZN_GIVEUP) { enterYesNoMode(zoneNum, TXT_GIVE_UP); } if (zoneNum == ZN_TEXT_SPEED) { _vm->logic()->talkSpeed((x - 136) * 100 / 130); drawConfigPanel(); - } - else if (zoneNum == ZN_SFX_TOGGLE) { + } else if (zoneNum == ZN_SFX_TOGGLE) { _vm->sound()->toggleSfx(); drawConfigPanel(); - } - else if (zoneNum == ZN_MUSIC_VOLUME) { + } else if (zoneNum == ZN_MUSIC_VOLUME) { // int val = (x - 136) * 100 / 130; // XXX alter_current_volume(); drawConfigPanel(); - } - else if (zoneNum >= ZN_DESC_FIRST && zoneNum <= ZN_DESC_LAST) { + } else if (zoneNum >= ZN_DESC_FIRST && zoneNum <= ZN_DESC_LAST) { _currentSaveSlot = zoneNum - ZN_DESC_FIRST; drawSaveSlot(); - } - else if (zoneNum >= ZN_PAGE_FIRST && zoneNum <= ZN_PAGE_LAST) { + } else if (zoneNum >= ZN_PAGE_FIRST && zoneNum <= ZN_PAGE_LAST) { _currentSavePage = zoneNum - ZN_PAGE_FIRST; drawSaveDescriptions(); - } - else if (zoneNum == ZN_INFO_BOX) { + } else if (zoneNum == ZN_INFO_BOX) { _mode = M_INFO_BOX; showInformationBox(); - } - else if (zoneNum == ZN_MUSIC_TOGGLE) { + } else if (zoneNum == ZN_MUSIC_TOGGLE) { _vm->sound()->toggleMusic(); if (_vm->sound()->musicOn()) { // XXX playsong(lastoverride); - } - else { + } else { // XXX playsong(-1); } drawConfigPanel(); - } - else if (zoneNum == ZN_VOICE_TOGGLE) { + } else if (zoneNum == ZN_VOICE_TOGGLE) { _vm->sound()->toggleSpeech(); drawConfigPanel(); - } - else if (zoneNum == ZN_TEXT_TOGGLE) { + } else if (zoneNum == ZN_TEXT_TOGGLE) { _vm->logic()->subtitles(!_vm->logic()->subtitles()); drawConfigPanel(); } @@ -316,14 +291,12 @@ void Journal::handleNormalMode(int16 zoneNum, int x) { void Journal::handleInfoBoxMode(int16 zoneNum) { - hideInformationBox(); _mode = M_NORMAL; } void Journal::handleYesNoMode(int16 zoneNum) { - if (zoneNum == ZN_YES) { _mode = M_NORMAL; int currentSlot = _currentSavePage * 10 + _currentSaveSlot; @@ -337,8 +310,7 @@ void Journal::handleYesNoMode(int16 zoneNum) { // XXX walkgameload=1; _quit = true; _quitCleanly = false; - } - else { + } else { exitYesNoMode(); } break; @@ -346,8 +318,7 @@ void Journal::handleYesNoMode(int16 zoneNum) { if (_edit.text[0]) { saveState(currentSlot, _edit.text); _quit = true; - } - else { + } else { exitYesNoMode(); } break; @@ -355,8 +326,7 @@ void Journal::handleYesNoMode(int16 zoneNum) { OSystem::instance()->quit(); break; } - } - else if (zoneNum == ZN_NO) { + } else if (zoneNum == ZN_NO) { exitYesNoMode(); } } @@ -382,11 +352,9 @@ void Journal::handleMouseDown(int x, int y) { int16 zone = _vm->logic()->zoneIn(ZONE_ROOM, x, y); if (_mode == M_INFO_BOX) { handleInfoBoxMode(_mode); - } - else if (_mode == M_YES_NO) { + } else if (_mode == M_YES_NO) { handleYesNoMode(zone); - } - else if (_mode == M_NORMAL) { + } else if (_mode == M_NORMAL) { handleNormalMode(zone, x); } update(); @@ -398,12 +366,10 @@ void Journal::handleKeyDown(uint16 ascii, int keycode) { if (_mode == M_YES_NO) { if (keycode == 27) { // escape handleYesNoMode(ZN_NO); - } - else if (_edit.enable) { + } else if (_edit.enable) { updateEditBuffer(ascii, keycode); } - } - else if (_mode == M_NORMAL) { + } else if (_mode == M_NORMAL) { handleNormalMode(ZN_CLOSE, 0); } } @@ -427,8 +393,7 @@ void Journal::drawPanelText(int y, const char *text) { int x = (128 - _vm->graphics()->textWidth(s)) / 2; _vm->graphics()->textSet(x, y, s, false); _panelTextY[_panelTextCount++] = y; - } - else { + } else { *p++ = '\0'; drawPanelText(y - 5, s); drawPanelText(y + 5, p); @@ -440,21 +405,18 @@ void Journal::drawCheckBox(bool active, int bobNum, int16 x, int16 y, int frameN if (active) { showBob(bobNum, x, y, frameNum); - } - else { + } else { hideBob(bobNum); } } void Journal::drawSlideBar(int value, int hi, int lo, int bobNum, int16 x, int16 y, int frameNum) { - showBob(bobNum, x + value * hi / lo, y, frameNum); } void Journal::drawPanel(const int *frames, const int *titles, int n) { - clearPanelTexts(); _panelTextCount = 0; int bobNum = 1; @@ -468,7 +430,6 @@ void Journal::drawPanel(const int *frames, const int *titles, int n) { void Journal::drawNormalPanel() { - int frames[] = { FRAME_BLUE_1, FRAME_BLUE_2, FRAME_BLUE_1, FRAME_ORANGE }; int titles[] = { TXT_REVIEW_ENTRY, TXT_MAKE_ENTRY, TXT_CLOSE, TXT_GIVE_UP }; drawPanel(frames, titles, 4); @@ -476,7 +437,6 @@ void Journal::drawNormalPanel() { void Journal::drawYesNoPanel(int titleNum) { - int frames[] = { FRAME_GREY, FRAME_BLUE_1, FRAME_BLUE_2 }; int titles[] = { titleNum, TXT_YES, TXT_NO }; drawPanel(frames, titles, 3); @@ -492,7 +452,6 @@ void Journal::drawYesNoPanel(int titleNum) { void Journal::drawConfigPanel() { - _vm->logic()->checkOptionSettings(); drawSlideBar(_vm->logic()->talkSpeed(), 130, 100, BOB_TALK_SPEED, 136 - 4, 164, FRAME_BLUE_PIN); @@ -507,7 +466,6 @@ void Journal::drawConfigPanel() { void Journal::showInformationBox() { - _vm->graphics()->textClear(0, GAME_SCREEN_HEIGHT - 1); showBob(BOB_INFO_BOX, 72, 221, FRAME_INFO_BOX); @@ -550,7 +508,6 @@ void Journal::showInformationBox() { void Journal::hideInformationBox() { - _vm->graphics()->textClear(0, GAME_SCREEN_HEIGHT - 1); hideBob(BOB_INFO_BOX); redraw(); @@ -558,7 +515,6 @@ void Journal::hideInformationBox() { void Journal::initEditBuffer(const char *desc) { - _edit.enable = true; _edit.posCursor = _vm->graphics()->textWidth(desc); _edit.textCharsCount = strlen(desc); @@ -568,7 +524,6 @@ void Journal::initEditBuffer(const char *desc) { void Journal::updateEditBuffer(uint16 ascii, int keycode) { - bool dirty = false; switch (keycode) { case 8: // backspace @@ -601,25 +556,21 @@ void Journal::updateEditBuffer(uint16 ascii, int keycode) { void Journal::makeSavegameName(char *buf, int slot) { - if (slot >= 0) { sprintf(buf, "queensav.%03d", slot); // "queen.s%02d" - } - else { + } else { sprintf(buf, "queensav."); // "queen.s" } } void Journal::saveState(int slot, const char *desc) { - warning("Journal::saveState(%d, %s)", slot, desc); _vm->logic()->gameSave(slot, desc); } void Journal::loadState(int slot) { - warning("Journal::loadState(%d)", slot); _vm->logic()->gameLoad(slot); } diff --git a/queen/queen.cpp b/queen/queen.cpp index 07675f4795..41491a12ed 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -97,11 +97,10 @@ QueenEngine::QueenEngine(GameDetector *detector, OSystem *syst) _debugLevel = ConfMan.getInt("debuglevel"); - _system->init_size(320, 200); + _system->init_size(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT); } QueenEngine::~QueenEngine() { - _timer->removeTimerProc(&timerHandler); delete _bam; delete _resource; @@ -122,7 +121,6 @@ void QueenEngine::errorString(const char *buf1, char *buf2) { void QueenEngine::go() { - initialise(); _logic->registerDefaultSettings(); @@ -143,13 +141,11 @@ void QueenEngine::go() { if (_logic->currentRoom() == _logic->newRoom()) { _logic->newRoom(0); } - } - else { + } else { if (_logic->joeWalk() == JWM_EXECUTE) { _logic->joeWalk(JWM_NORMAL); _command->executeCurrentAction(); - } - else { + } else { // if (_command->parse()) { // _command->clear(true); // } @@ -161,7 +157,6 @@ void QueenEngine::go() { } void QueenEngine::initialise(void) { - _bam = new BamScene(this); _resource = new Resource(_gameDataPath, _system->get_savefile_manager(), getSavePath()); _command = new Command(this); @@ -178,13 +173,11 @@ void QueenEngine::initialise(void) { void QueenEngine::timerHandler(void *ptr) { - ((QueenEngine *)ptr)->gotTimerTick(); } void QueenEngine::gotTimerTick() { - _display->handleTimer(); } diff --git a/queen/walk.cpp b/queen/walk.cpp index 6b90601704..f83c4211af 100644 --- a/queen/walk.cpp +++ b/queen/walk.cpp @@ -70,8 +70,7 @@ void Walk::animateJoePrepare() { if (pwd->dx < 0) { pwd->anim.set(11, 16 + FRAMES_JOE_XTRA, DIR_LEFT); - } - else { + } else { pwd->anim.set(11, 16 + FRAMES_JOE_XTRA, DIR_RIGHT); } @@ -85,16 +84,13 @@ void Walk::animateJoePrepare() { if (pwd->dy < 0) { if (ds < 0) { pwd->anim.set(17 + FRAMES_JOE_XTRA, 22 + FRAMES_JOE_XTRA, DIR_FRONT); - } - else { + } else { pwd->anim.set(23 + FRAMES_JOE_XTRA, 28 + FRAMES_JOE_XTRA, DIR_BACK); } - } - else if (pwd->dy > 0) { + } else if (pwd->dy > 0) { if (ds < 0) { pwd->anim.set(23 + FRAMES_JOE_XTRA, 28 + FRAMES_JOE_XTRA, DIR_BACK); - } - else { + } else { pwd->anim.set(17 + FRAMES_JOE_XTRA, 22 + FRAMES_JOE_XTRA, DIR_FRONT); } } @@ -135,8 +131,7 @@ void Walk::animateJoe() { _vm->logic()->joeScale(pbs->scale); if (pbs->xmajor) { pbs->speed = pbs->scale * 6 / 100; - } - else { + } else { pbs->speed = pbs->scale * 3 / 100; } if (pbs->speed == 0) { @@ -166,21 +161,17 @@ void Walk::animatePersonPrepare(const MovePersonData *mpd, int direction) { if (pwd->dx < 0) { pwd->anim.set(mpd->walkLeft1, mpd->walkLeft2, DIR_LEFT); - } - else if (pwd->dx > 0) { + } else if (pwd->dx > 0) { pwd->anim.set(mpd->walkRight1, mpd->walkRight2, DIR_RIGHT); - } - else { + } else { if (ABS(mpd->walkLeft1) == ABS(mpd->walkRight1)) { pwd->anim.set(mpd->walkRight1, mpd->walkRight2, DIR_RIGHT); - } - else { + } else { // we have specific moves for this actor, see what direction they were last facing if (direction == -3) { // previously facing right pwd->anim.set(mpd->walkLeft1, mpd->walkLeft2, DIR_LEFT); - } - else { + } else { // previously facing left pwd->anim.set(mpd->walkRight1, mpd->walkRight2, DIR_RIGHT); } @@ -197,33 +188,26 @@ void Walk::animatePersonPrepare(const MovePersonData *mpd, int direction) { if (pwd->dy < 0) { if (mpd->walkBack1 > 0) { pwd->anim.set(mpd->walkBack1, mpd->walkBack2, DIR_BACK); - } - else if (pwd->dx < 0) { + } else if (pwd->dx < 0) { pwd->anim.set(mpd->walkLeft1, mpd->walkLeft2, DIR_BACK); - } - else { + } else { pwd->anim.set(mpd->walkRight1, mpd->walkRight2, DIR_BACK); } - } - else if (pwd->dy > 0) { + } else if (pwd->dy > 0) { if (mpd->walkFront1 > 0) { pwd->anim.set(mpd->walkFront1, mpd->walkFront2, DIR_FRONT); - } - else if(ABS(mpd->walkLeft1) == ABS(mpd->walkRight1)) { + } else if(ABS(mpd->walkLeft1) == ABS(mpd->walkRight1)) { if (pwd->dx < 0) { pwd->anim.set(mpd->walkLeft1, mpd->walkLeft2, DIR_FRONT); - } - else { + } else { pwd->anim.set(mpd->walkRight1, mpd->walkRight2, DIR_FRONT); } - } - else { + } else { // we have a special move for left/right, so select that instead! if (direction == -3) { // previously facing right pwd->anim.set(mpd->walkLeft1, mpd->walkLeft2, DIR_FRONT); - } - else { + } else { // previously facing left pwd->anim.set(mpd->walkRight1, mpd->walkRight2, DIR_FRONT); } @@ -236,14 +220,12 @@ void Walk::animatePersonPrepare(const MovePersonData *mpd, int direction) { void Walk::animatePerson(const MovePersonData *mpd, uint16 image, uint16 bobNum, uint16 bankNum, int direction) { // queen.c l.2572-2651 - BobSlot *pbs = _vm->graphics()->bob(bobNum); // check to see which way person should be facing if (mpd->walkLeft1 == mpd->walkRight1) { pbs->xflip = (direction == -3); - } - else { + } else { // they have special walk for left and right, so don't flip pbs->xflip = false; } @@ -263,8 +245,7 @@ void Walk::animatePerson(const MovePersonData *mpd, uint16 image, uint16 bobNum, // pass across bobs direction ONLY if walk is a mirror flip! if (ABS(mpd->walkLeft1) == ABS(mpd->walkRight1)) { pbs->animNormal(image, dstFrame - 1, mpd->animSpeed, false, pbs->xflip); - } - else { + } else { pbs->animNormal(image, dstFrame - 1, mpd->animSpeed, false, false); } @@ -283,8 +264,7 @@ void Walk::animatePerson(const MovePersonData *mpd, uint16 image, uint16 bobNum, pbs->scale = scale; if (pbs->xmajor) { pbs->speed = scale * mpd->moveSpeed / 100; - } - else { + } else { pbs->speed = scale * (mpd->moveSpeed / 2) / 100; } if (pbs->speed == 0) { @@ -297,7 +277,6 @@ void Walk::animatePerson(const MovePersonData *mpd, uint16 image, uint16 bobNum, int16 Walk::moveJoe(int direction, int16 endx, int16 endy, bool inCutaway) { - _joeInterrupted = false; _joeMoveBlock = false; int16 can = 0; @@ -316,8 +295,7 @@ int16 Walk::moveJoe(int direction, int16 endx, int16 endy, bool inCutaway) { // if in cutaway, allow Joe to walk anywhere if(newPos == 0 && inCutaway) { incWalkData(oldx, oldy, endx, endy, oldPos); - } - else { + } else { if (calc(oldPos, newPos, oldx, oldy, endx, endy)) { if (_walkDataCount > 0) { animateJoePrepare(); @@ -326,8 +304,7 @@ int16 Walk::moveJoe(int direction, int16 endx, int16 endy, bool inCutaway) { can = -1; } } - } - else { + } else { // path has been blocked, make Joe say so _vm->logic()->joeSpeak(4); can = -1; @@ -341,8 +318,7 @@ int16 Walk::moveJoe(int direction, int16 endx, int16 endy, bool inCutaway) { if (_joeMoveBlock) { can = -2; _joeMoveBlock = false; - } - else if (direction > 0) { + } else if (direction > 0) { _vm->logic()->joeFacing(direction); } _vm->logic()->joePrevFacing(_vm->logic()->joeFacing()); @@ -352,7 +328,6 @@ int16 Walk::moveJoe(int direction, int16 endx, int16 endy, bool inCutaway) { int16 Walk::movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage, int direction) { - if (endx == 0 && endy == 0) { warning("Walk::movePerson() - endx == 0 && endy == 0"); return 0; @@ -386,8 +361,7 @@ int16 Walk::movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage animatePersonPrepare(mpd, direction); animatePerson(mpd, curImage, bobNum, bankNum, direction); } - } - else { + } else { can = -1; } @@ -401,16 +375,14 @@ int16 Walk::movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage pbs->scale = _walkData[_walkDataCount].area->calcScale(endy); if (_walkData[_walkDataCount].anim.facing == DIR_BACK) { _vm->graphics()->bankUnpack(mpd->backStandingFrame, standingFrame, bankNum); - } - else { + } else { _vm->graphics()->bankUnpack(mpd->frontStandingFrame, standingFrame, bankNum); } uint16 obj = _vm->logic()->objectForPerson(bobNum); if (_walkData[_walkDataCount].dx < 0) { _vm->logic()->objectData(obj)->image = -3; pbs->xflip = true; - } - else { + } else { _vm->logic()->objectData(obj)->image = -4; pbs->xflip = false; } @@ -420,14 +392,12 @@ int16 Walk::movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage void Walk::stopJoe() { - _vm->graphics()->bob(0)->moving = false; _joeInterrupted = true; } bool Walk::calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y) { - // if newPos is outside of an AREA then traverse Y axis until an AREA is found if (newPos == 0) { newPos = findAreaPosition(&x, &y, true); @@ -442,8 +412,7 @@ bool Walk::calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, i if (oldPos == newPos) { incWalkData(oldx, oldy, x, y, newPos); return true; - } - else if (calcPath(oldPos, newPos)) { + } else if (calcPath(oldPos, newPos)) { uint16 i; int16 px = oldx; int16 py = oldy; @@ -466,14 +435,12 @@ bool Walk::calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, i int16 Walk::calcC(int16 c1, int16 c2, int16 c3, int16 c4, int16 lastc) { - int16 s1 = MAX(c1, c3); int16 s2 = MIN(c2, c4); int16 c; if ((lastc >= s1 && lastc <= s2) || (lastc >= s2 && lastc <= s1)) { c = lastc; - } - else { + } else { c = (s1 + s2) / 2; } return c; @@ -509,11 +476,9 @@ int16 Walk::findAreaPosition(int16 *x, int16 *y, bool recalibrate) { uint32 dist = minDist; if (!inX && !inY) { dist = csx * csx + csy * csy; - } - else if (inX) { + } else if (inX) { dist = csy * csy; - } - else if (inY) { + } else if (inY) { dist = csx * csx; } @@ -536,7 +501,6 @@ int16 Walk::findAreaPosition(int16 *x, int16 *y, bool recalibrate) { uint16 Walk::findFreeArea(uint16 area) const { - uint16 testArea; uint16 freeArea = 0; uint16 map = ABS(_vm->logic()->currentRoomArea(area)->mapNeighbours); @@ -556,7 +520,6 @@ uint16 Walk::findFreeArea(uint16 area) const { bool Walk::isAreaStruck(uint16 area) const { - uint16 i; bool found = false; for (i = 1; i <= _areaStrikeCount; ++i) { @@ -570,7 +533,6 @@ bool Walk::isAreaStruck(uint16 area) const { bool Walk::calcPath(uint16 oldArea, uint16 newArea) { - debug(9, "Walk::calcPath(%d, %d)", oldArea, newArea); _areaList[1] = _areaStrike[1] = oldArea; _areaListCount = _areaStrikeCount = 1; @@ -582,8 +544,7 @@ bool Walk::calcPath(uint16 oldArea, uint16 newArea) { _areaList[_areaListCount] = 0; --_areaListCount; area = _areaList[_areaListCount]; - } - else { + } else { ++_areaListCount; _areaList[_areaListCount] = area; if(!isAreaStruck(area)) { @@ -597,7 +558,6 @@ bool Walk::calcPath(uint16 oldArea, uint16 newArea) { void Walk::initWalkData() { - _walkDataCount = 0; memset(_walkData, 0, sizeof(_walkData)); _areaStrikeCount = 0; @@ -608,7 +568,6 @@ void Walk::initWalkData() { void Walk::incWalkData(int16 px, int16 py, int16 x, int16 y, uint16 areaNum) { - debug(9, "Walk::incWalkData(%d, %d, %d)", (x - px), (y - py), areaNum); if (px != x || py != y) { @@ -618,7 +577,6 @@ void Walk::incWalkData(int16 px, int16 py, int16 x, int16 y, uint16 areaNum) { pwd->dy = y - py; pwd->area = _vm->logic()->currentRoomArea(areaNum); pwd->areaNum = areaNum; -// pwd->sign = ((pwd->dx < 0) ? -1 : ((pwd->dx > 0) ? 1 : 0)) ; } } diff --git a/queen/walk.h b/queen/walk.h index 369676da0b..1a63e260da 100644 --- a/queen/walk.h +++ b/queen/walk.h @@ -42,7 +42,6 @@ struct MovePersonAnim { struct WalkData { -// int16 sign; // never used int16 dx, dy; const Area *area; uint16 areaNum; // extra stuff for customMoveJoe diff --git a/queen/xref.txt b/queen/xref.txt index 980912a509..410fc4df08 100644 --- a/queen/xref.txt +++ b/queen/xref.txt @@ -319,7 +319,7 @@ clothespal Display::_palJoeClothes COMPANEL *not needed* (argument) dresspal Display::_palJoeDress font TextRenderer::_font -font_sizes TextRenderer::charWidth +font_sizes TextRenderer::_charWidth FULLSCREEN Display::_fullscreen nopalscroll Display::_pal.scrollable palette Display::_pal.room |