diff options
Diffstat (limited to 'queen')
-rw-r--r-- | queen/command.cpp | 57 | ||||
-rw-r--r-- | queen/cutaway.cpp | 12 | ||||
-rw-r--r-- | queen/display.cpp | 16 | ||||
-rw-r--r-- | queen/graphics.cpp | 6 | ||||
-rw-r--r-- | queen/input.cpp | 4 | ||||
-rw-r--r-- | queen/logic.cpp | 70 | ||||
-rw-r--r-- | queen/logic.h | 6 | ||||
-rw-r--r-- | queen/queen.cpp | 2 | ||||
-rw-r--r-- | queen/resource.cpp | 20 | ||||
-rw-r--r-- | queen/sound.cpp | 16 | ||||
-rw-r--r-- | queen/talk.cpp | 14 | ||||
-rw-r--r-- | queen/talk.h | 34 | ||||
-rw-r--r-- | queen/walk.cpp | 42 | ||||
-rw-r--r-- | queen/walk.h | 2 |
14 files changed, 146 insertions, 155 deletions
diff --git a/queen/command.cpp b/queen/command.cpp index c2eb937f87..229b1199f0 100644 --- a/queen/command.cpp +++ b/queen/command.cpp @@ -240,8 +240,8 @@ void Command::executeCurrentAction(bool walk) { return; } - // process each associated command for the Object, until all done - // or one of the Gamestate tests fails... + // process each associated command for the Object, until all done + // or one of the Gamestate tests fails... int16 cond = 0; CmdListData *com = &_cmdList[0]; uint16 comId = 0; @@ -361,7 +361,7 @@ void Command::executeCurrentAction(bool walk) { } } - // don't play music on an OPEN/CLOSE command - in case the command fails + // don't play music on an OPEN/CLOSE command - in case the command fails if (_selCmd.action.value() != VERB_OPEN && _selCmd.action.value() != VERB_CLOSE) { // only play song if it's a PLAY BEFORE type if (com->song > 0) { @@ -369,7 +369,6 @@ void Command::executeCurrentAction(bool walk) { } } - // do a special hardcoded section // l.419-452 execute.c switch (com->specialSection) { @@ -402,8 +401,8 @@ void Command::executeCurrentAction(bool walk) { if (cond > 0) { const char *desc = _logic->objectTextualDescription(cond); - // Joe needs to say something as a result of a Gamestate - // check first to see if it is a cutaway scene! + // Joe needs to say something as a result of a Gamestate + // check first to see if it is a cutaway scene! if (executeIfCutaway(desc)) { } else if (executeIfDialog(desc)) { @@ -422,7 +421,7 @@ void Command::executeCurrentAction(bool walk) { cleanupCurrentAction(); return; } - } + } // only play song if it's a PLAY AFTER type if (com->song > 0) { @@ -495,7 +494,7 @@ void Command::readCommandsFrom(byte *&ptr) { for (i = 1; i <= _numCmdArea; i++) { _cmdArea[i].readFrom(ptr); } - + // Command OBJECT _numCmdObject = READ_BE_UINT16(ptr); ptr += 2; @@ -513,7 +512,7 @@ void Command::readCommandsFrom(byte *&ptr) { for (i = 1; i <= _numCmdInventory; i++) { _cmdInventory[i].readFrom(ptr); } - + // Command GAMESTATE _numCmdGameState = READ_BE_UINT16(ptr); ptr += 2; _cmdGameState = new CmdGameState[_numCmdGameState + 1]; @@ -611,7 +610,7 @@ void Command::grabSelectedObject(int16 objNum, uint16 objState, uint16 objName) _curCmd.addObject(objNum); - // if first noun and it's a 2 level command then set up action word + // if first noun and it's a 2 level command then set up action word if (_curCmd.action.value() == VERB_USE && _curCmd.commandLevel == 1) { if (State::findUse(objState) == STATE_USE_ON) { // object supports 2 levels @@ -644,7 +643,6 @@ void Command::grabSelectedObject(int16 objNum, uint16 objState, uint16 objName) _selCmd.action = _curCmd.action; _curCmd.action = Verb(VERB_NONE); } - } @@ -732,9 +730,9 @@ 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 - // click object without a command, if DEFAULT then - // do that, otherwise do a WALK! + // set PARSE to TRUE, default FALSE if command half complete + // click object without a command, if DEFAULT then + // do that, otherwise do a WALK! uint16 objNum = _logic->currentRoomData() + _curCmd.noun; int16 objName = _logic->objectData(objNum)->name; @@ -769,7 +767,7 @@ void Command::grabSelectedNoun() { } if (_cmdText.isEmpty()) { - // Ensures that Right Mkey will select correct default + // Ensures that Right Mkey will select correct default _curCmd.verb = findDefault(objNum, false); if (!_curCmd.verb.isNone()) { // no match made, redefine as Walk To @@ -805,12 +803,12 @@ void Command::grabSelectedNoun() { _selCmd.noun = 0; grabSelectedObject(objNum, _logic->objectData(objNum)->state, objName); } - + void Command::grabSelectedVerb() { if (_curCmd.verb.isScrollInventory()) { - // move through inventory (by four if right mouse button) + // move through inventory (by four if right mouse button) uint16 scroll = _mouseKey == Input::MOUSE_RBUTTON ? 4 : 1; _logic->inventoryScroll(scroll, _curCmd.verb.value() == VERB_SCROLL_UP); } @@ -823,7 +821,7 @@ void Command::grabSelectedVerb() { if (_mouseKey == Input::MOUSE_RBUTTON) { _selCmd.defaultVerb = _curCmd.verb; _cmdText.displayTemp(11, true, _curCmd.verb); - } + } else { _selCmd.defaultVerb = Verb(VERB_NONE); if (_logic->joeWalk() == 1 && !_curCmd.verb.isNone()) { @@ -875,7 +873,6 @@ bool Command::executeIfDialog(const char *description) { } - bool Command::handleBadCommand(bool walk) { // l.96-141 execute.c @@ -899,7 +896,7 @@ bool Command::handleBadCommand(bool walk) { _curCmd.subject2 > 0 && _logic->objectData(_curCmd.subject2)->name <= 0) { return true; } - // check for USE command on exists + // check for USE command on exists if (_selCmd.action.value() == VERB_USE && _curCmd.subject1 > 0 && _logic->objectData(_curCmd.subject1)->entryObj > 0) { _selCmd.action = Verb(VERB_WALK_TO); @@ -927,7 +924,7 @@ void Command::executeStandardStuff(const Verb& action, int16 subj1, int16 subj2) case VERB_LOOK_AT: look(); break; - + case VERB_OPEN: // 'it doesn't seem to open' _logic->joeSpeak(1); @@ -947,11 +944,11 @@ void Command::executeStandardStuff(const Verb& action, int16 subj1, int16 subj2) _logic->joeSpeak(1); } break; - + case VERB_TALK_TO: _logic->joeSpeak(24 + Logic::randomizer.getRandomNumber(2)); break; - + case VERB_CLOSE: _logic->joeSpeak(2); break; @@ -1048,7 +1045,7 @@ void Command::changeObjectState(const Verb& action, int16 obj, int16 song, bool } if (objData->entryObj != 0) { - // if it's a door, then update door that it links to + // if it's a door, then update door that it links to openOrCloseAssociatedObject(action, objData->entryObj); objData->entryObj = ABS(objData->entryObj); } @@ -1070,7 +1067,7 @@ void Command::changeObjectState(const Verb& action, int16 obj, int16 song, bool } if (objData->entryObj != 0) { - // if it's a door, then update door that it links to + // if it's a door, then update door that it links to openOrCloseAssociatedObject(action, objData->entryObj); objData->entryObj = -ABS(objData->entryObj); } @@ -1085,7 +1082,6 @@ void Command::changeObjectState(const Verb& action, int16 obj, int16 song, bool } } - void Command::cleanupCurrentAction() { // l.595-597 execute.c @@ -1142,8 +1138,6 @@ void Command::alterDefault(const Verb& def, bool itemType) { } - - void Command::openOrCloseAssociatedObject(const Verb& action, int16 otherObj) { CmdListData *cmdList = &_cmdList[1]; @@ -1198,6 +1192,7 @@ void Command::openOrCloseAssociatedObject(const Verb& action, int16 otherObj) { } } + int16 Command::setConditions(uint16 command, bool lastCmd) { debug(9, "Command::setConditions(%d, %d)", command, lastCmd); @@ -1283,7 +1278,7 @@ void Command::setAreas(uint16 command) { void Command::setObjects(uint16 command) { - + debug(9, "Command::setObjects(%d)", command); CmdObject *cmdObj = &_cmdObject[1]; @@ -1614,8 +1609,4 @@ void Command::lookCurrentIcon() { } } - } - - - diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp index e5d58839af..35904f844e 100644 --- a/queen/cutaway.cpp +++ b/queen/cutaway.cpp @@ -365,7 +365,7 @@ void Cutaway::actionSpecialMove(int index) { _logic->update(); } - planeBob->scale = 100; + planeBob->scale = 100; _logic->display()->horizontalScroll(0); planeBob->x -= -8; @@ -380,7 +380,7 @@ void Cutaway::actionSpecialMove(int index) { _graphics->bankUnpack(18, lightningBob->frameNum, 15); _graphics->bankUnpack(4, planeBob ->frameNum, 15); - // Plane plunges into the jungle! + // Plane plunges into the jungle! BobSlot *fireBob = _graphics->bob(6); @@ -517,7 +517,7 @@ void Cutaway::actionSpecialMove(int index) { _input->fastMode(false); } break; - + // cdint.cut - flash white case 37: _logic->display()->palCustomFlash(); @@ -1105,7 +1105,7 @@ byte *Cutaway::handleAnimation(byte *ptr, CutawayObject &object) { static void findCdCut(const char *basename, int index, char *result) { // Function find_cd_cut, lines 5-15 in execute.c - + strcpy(result, basename); for (int i = strlen(basename); i < 5; i++) result[i] = '_'; @@ -1122,7 +1122,7 @@ void Cutaway::handlePersonRecord( Person p; _personFaceCount = 0; //Hello, please verify me. (Fixes crash on OSX) - + if (object.objectNumber == OBJECT_JOE) { if (object.moveToX || object.moveToY) { _walk->joeMove(0, object.moveToX, object.moveToY, true); @@ -1735,7 +1735,7 @@ int Cutaway::scale(CutawayObject &object) { else if (!object.objectNumber) { // Only scale Joe int x, y; - + if (object.bobStartX > 0 || object.bobStartY > 0) { x = object.bobStartX; y = object.bobStartY; diff --git a/queen/display.cpp b/queen/display.cpp index c41d4c9bcb..a78bb9e914 100644 --- a/queen/display.cpp +++ b/queen/display.cpp @@ -48,8 +48,8 @@ void TextRenderer::init() { } charWidth[i] += 2; } - charWidth[(uint8)' '] = 4; - --charWidth[(uint8)'^']; + charWidth[(uint8)' '] = 4; + --charWidth[(uint8)'^']; } @@ -351,7 +351,7 @@ void Display::palCustomColors(uint16 roomNum) { debug(9, "Display::palCustomColors(%d)", roomNum); int i; - switch (roomNum) { + switch (roomNum) { case 31: for(i = 72; i < 84; i++) { _pals.room[i * 3 + 1] = _pals.room[i * 3 + 1] * 90 / 100; @@ -369,7 +369,7 @@ void Display::palCustomColors(uint16 roomNum) { _pals.room[i * 3 + 0] = _pals.room[i * 3 + 0] * 60 / 100; _pals.room[i * 3 + 1] = _pals.room[i * 3 + 1] * 80 / 100; } - break; + break; case 28: for(i = 72; i < 84; i++) { _pals.room[i * 3 + 0] = _pals.room[i * 3 + 0] * 80 / 100; @@ -381,7 +381,7 @@ void Display::palCustomColors(uint16 roomNum) { void Display::palCustomScroll(uint16 roomNum) { - + debug(9, "Display::palCustomScroll(%d)", roomNum); static int16 scrollx = 0; @@ -456,7 +456,7 @@ void Display::palCustomScroll(uint16 roomNum) { case 62: if(scrollx & 1) { palScroll(0x6c, 0x77); - loPal = 0x6c; + loPal = 0x6c; hiPal = 0x77; } break; @@ -589,7 +589,7 @@ void Display::palCustomScroll(uint16 roomNum) { loPal = 101; hiPal = 127; break; - } + } _pals.dirtyMin = MIN(_pals.dirtyMin, loPal); _pals.dirtyMax = MAX(_pals.dirtyMax, hiPal); } @@ -680,7 +680,7 @@ 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 = _buffers[dst] + dstPitch * dstY + dstX; diff --git a/queen/graphics.cpp b/queen/graphics.cpp index e1a8c78e3d..e3a2c0e144 100644 --- a/queen/graphics.cpp +++ b/queen/graphics.cpp @@ -96,7 +96,7 @@ void Graphics::bankUnpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) { pbf->height = READ_LE_UINT16(p + 2); pbf->xhotspot = READ_LE_UINT16(p + 4); pbf->yhotspot = READ_LE_UINT16(p + 6); - + uint32 size = pbf->width * pbf->height; pbf->data = new uint8[ size ]; memcpy(pbf->data, p + 8, size); @@ -111,7 +111,7 @@ void Graphics::bankOverpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) { uint8 *p = _banks[bankslot].data + _banks[bankslot].indexes[srcframe]; uint16 src_w = READ_LE_UINT16(p + 0); uint16 src_h = READ_LE_UINT16(p + 2); - + // unpack if destination frame is smaller than source one if (_frames[dstframe].width < src_w || _frames[dstframe].height < src_h) { bankUnpack(srcframe, dstframe, bankslot); @@ -392,7 +392,7 @@ void Graphics::bobDraw(uint32 bobnum, int16 x, int16 y, uint16 scale, bool xflip x += w_new - 1; _display->blit(RB_SCREEN, x, y, src, w_new, h_new, w, xflip, true); } - } + } } diff --git a/queen/input.cpp b/queen/input.cpp index c35f8be7e7..be227032b3 100644 --- a/queen/input.cpp +++ b/queen/input.cpp @@ -205,10 +205,10 @@ void Input::checkKeys() { _keyVerb = Verb(VERB_USE); break; } - + _inKey = 0; //reset } - + } // End of namespace Queen diff --git a/queen/logic.cpp b/queen/logic.cpp index 966cea1839..3ee9c85cea 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -100,16 +100,16 @@ Verb State::findDefaultVerb(uint16 state) { case 8: v = Verb(VERB_GIVE); break; - case 12: + case 12: v = Verb(VERB_USE); break; - case 14: + case 14: v = Verb(VERB_PICK_UP); break; - case 9: + case 9: v = Verb(VERB_TALK_TO); break; - case 6: + case 6: v = Verb(VERB_LOOK_AT); break; default: @@ -151,16 +151,16 @@ void State::alterDefaultVerb(uint16 *objState, Verb v) { case VERB_GIVE: val = 8; break; - case VERB_USE: + case VERB_USE: val = 12; break; - case VERB_PICK_UP: + case VERB_PICK_UP: val = 14; break; - case VERB_TALK_TO: + case VERB_TALK_TO: val = 9; break; - case VERB_LOOK_AT: + case VERB_LOOK_AT: val = 6; break; default: @@ -196,19 +196,19 @@ Logic::~Logic() { void Logic::initialise() { int16 i, j; uint8 *ptr = _jas; - + _numRooms = READ_BE_UINT16(ptr); ptr += 2; _numNames = READ_BE_UINT16(ptr); ptr += 2; _numObjects = READ_BE_UINT16(ptr); ptr += 2; _numDescriptions = READ_BE_UINT16(ptr); ptr += 2; - + // Object data _objectData = new ObjectData[_numObjects + 1]; memset(&_objectData[0], 0, sizeof(ObjectData)); for (i = 1; i <= _numObjects; i++) { _objectData[i].readFrom(ptr); } - + // Room data _roomData = new uint16[_numRooms + 2]; _roomData[0] = 0; @@ -238,7 +238,7 @@ void Logic::initialise() { for (i = 1; i <= _numItems; i++) { _itemData[i].readFrom(ptr); } - + // Graphic Image Data _numGraphics = READ_BE_UINT16(ptr); ptr += 2; @@ -247,7 +247,7 @@ void Logic::initialise() { for (i = 1; i <= _numGraphics; i++) { _graphicData[i].readFrom(ptr); } - + _objMax = new int16[_numRooms + 1]; _areaMax = new int16[_numRooms + 1]; _area = new Area[_numRooms + 1][MAX_AREAS_NUMBER]; @@ -454,7 +454,7 @@ uint16 Logic::findBob(uint16 obj) { if (room >= _numRooms) { warning("room (%i) > _numRooms (%i)", room, _numRooms); } - + int16 img = _objectData[obj].image; if(img != 0) { if(img == -3 || img == -4) { @@ -1242,7 +1242,7 @@ uint16 Logic::findScale(uint16 x, uint16 y) { void Logic::personSetData(int16 noun, const char *actorName, bool loadBank, Person *pp) { - + if (noun <= 0) { warning("Logic::personSetData() - Invalid object number: %i", noun); } @@ -1292,7 +1292,7 @@ void Logic::personSetData(int16 noun, const char *actorName, bool loadBank, Pers else { pp->anim = NULL; } - + if (loadBank) { const char *actorFile = _aFile[pp->actor->actorFile]; if (actorFile) { @@ -1302,7 +1302,7 @@ void Logic::personSetData(int16 noun, const char *actorName, bool loadBank, Pers pp->bankNum = 15; } } - + if (pp->actor->bobNum >= 1 && pp->actor->bobNum <= 3) { pp->bobFrame = 29 + FRAMES_JOE_XTRA + pp->actor->bobNum; } @@ -1338,7 +1338,7 @@ uint16 Logic::personSetup(uint16 noun, uint16 curImage) { pbs->y = pad->y; pbs->frameNum = p.bobFrame; pbs->xflip = xflip; - + if (p.anim != NULL) { _personFrames[pad->bobNum] = curImage + 1; curImage = animCreate(curImage, &p); @@ -1351,7 +1351,7 @@ uint16 Logic::personSetup(uint16 noun, uint16 curImage) { uint16 Logic::personAllocate(uint16 noun, uint16 curImage) { - + uint16 i; uint16 person = _roomData[_currentRoom] + noun; @@ -1363,7 +1363,7 @@ uint16 Logic::personAllocate(uint16 noun, uint16 curImage) { ++bobNum; } } - + // search for a matching actor uint16 actor = 0; for (i = 1; i <= _numActors; ++i) { @@ -1377,7 +1377,7 @@ uint16 Logic::personAllocate(uint16 noun, uint16 curImage) { } } } - + if (actor > 0) { const char *animStr = _aAnim[_actorData[actor].anim]; if (animStr) { @@ -1415,7 +1415,7 @@ uint16 Logic::animCreate(uint16 curImage, const Person *person) { sscanf(p, "%3hu,%3hu", &f1, &f2); animFrames[frame].frame = f1; animFrames[frame].speed = f2; - + if (f1 > 500) { // SFX allocatedFrames[f1 - 500] = 1; @@ -1446,7 +1446,7 @@ uint16 Logic::animCreate(uint16 curImage, const Person *person) { animFrames[i].frame = curImage + allocatedFrames[frameNum]; } } - + // unpack necessary frames for (i = 1; i <= 255; ++i) { if (allocatedFrames[i] != 0) { @@ -1454,10 +1454,10 @@ uint16 Logic::animCreate(uint16 curImage, const Person *person) { _graphics->bankUnpack(i, curImage, person->bankNum); } } - + // start animation _graphics->bobAnimString(person->actor->bobNum, animFrames); - + return curImage; } @@ -1620,7 +1620,7 @@ ObjectData *Logic::joeSetupInRoom(bool autoPosition, uint16 scale) { // TODO: cutawayJoeFacing - // check to see which way Joe entered room + // check to see which way Joe entered room _joe.facing = State::findDirection(pod->state); _joe.prevFacing = _joe.facing; @@ -1739,10 +1739,10 @@ void Logic::joeGrabDirection(StateGrab grab, uint16 speed) { bobJoe->scale = _joe.scale; update(); // grab up - _graphics->bankUnpack(7, 29 + FRAMES_JOE_XTRA, 7); + _graphics->bankUnpack(7, 29 + FRAMES_JOE_XTRA, 7); bobJoe->xflip = (_joe.facing == DIR_LEFT); bobJoe->scale = _joe.scale; - update(); + update(); // turn back if (speed == 0) { frame = 7; @@ -1752,7 +1752,7 @@ void Logic::joeGrabDirection(StateGrab grab, uint16 speed) { } break; } - + if (frame != 0) { _graphics->bankUnpack(frame, 29 + FRAMES_JOE_XTRA, 7); bobJoe->xflip = (_joe.facing == DIR_LEFT); @@ -1913,7 +1913,7 @@ uint16 Logic::findInventoryItem(int invSlot) const { void Logic::inventorySetup() { - + _graphics->bankLoad("objects.BBK", 14); _inventoryItem[0] = ITEM_BAT; _inventoryItem[1] = _resource->isDemo() ? ITEM_JOURNAL_DEMO : ITEM_JOURNAL; @@ -1922,7 +1922,7 @@ void Logic::inventorySetup() { } void Logic::inventoryRefresh() { - + int16 i; uint16 x = 182; for (i = 0; i < 4; ++i) { @@ -1993,7 +1993,7 @@ void Logic::inventoryInsertItem(uint16 itemNum, bool refresh) { _inventoryItem[i] = item; removeDuplicateItems(); } - + if (refresh) inventoryRefresh(); } @@ -2007,7 +2007,7 @@ void Logic::inventoryDeleteItem(uint16 itemNum, bool refresh) { _inventoryItem[i] = item; removeDuplicateItems(); } - + if (refresh) inventoryRefresh(); } @@ -2105,7 +2105,7 @@ void Logic::customMoveJoe(int facing, uint16 areaNum, uint16 walkDataNum) { // Stop animating Joe _graphics->bob(0)->animating = false; - // Make Joe face the right direction + // Make Joe face the right direction joeFacing(facing); joeFace(); @@ -2328,7 +2328,7 @@ void Logic::sceneStart(bool showMouseCursor) { _display->panel(false); _display->palFadePanel(); } - + update(); } diff --git a/queen/logic.h b/queen/logic.h index f3d479ec49..b5758a52de 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -128,7 +128,7 @@ public: else error("Invalid room number: %i", room); } - + uint16 oldRoom() const { return _oldRoom; } void oldRoom(uint16 room) { if (room <= _numRooms) @@ -136,7 +136,7 @@ public: else error("Invalid room number: %i", room); } - + uint16 newRoom() const { return _newRoom; } void newRoom(uint16 room) { if (room <= _numRooms) @@ -190,7 +190,7 @@ public: else error("Invalid room number: %i", roomNum); } - + const char *objectName(uint16 objNum) const { return _objName[objNum]; } const char *objectTextualDescription(uint16 objNum) const { return _objDescription[objNum]; } diff --git a/queen/queen.cpp b/queen/queen.cpp index f94dda8ab3..8b5f56dd3c 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -94,7 +94,7 @@ QueenEngine::QueenEngine(GameDetector *detector, OSystem *syst) warning("Sound initialisation failed."); _mixer->setVolume(ConfMan.getInt("sfx_volume")); - + _debugMode = ConfMan.hasKey("debuglevel"); _debugLevel = ConfMan.getInt("debuglevel"); _detector = detector; diff --git a/queen/resource.cpp b/queen/resource.cpp index cf23c7057e..5c2a5f7781 100644 --- a/queen/resource.cpp +++ b/queen/resource.cpp @@ -53,13 +53,13 @@ Resource::Resource(const Common::String &datafilePath, const char *datafileName) _resourceFile->open(datafileName, _datafilePath); if (_resourceFile->isOpen() == false) error("Could not open resource file '%s%s'", _datafilePath.c_str(), datafileName); - + if (_resourceFile->readUint32BE() == 'QTBL') { readTableCompResource(); } else { _compression = COMPRESSION_NONE; _gameVersion = detectGameVersion(_resourceFile->size()); - + if (!readTableFile()) { //check if it is the english floppy version, for which we have a hardcoded version of the tables if (!strcmp(_gameVersion->versionString, _gameVersions[VER_ENG_FLOPPY].versionString)) { @@ -90,7 +90,7 @@ int32 Resource::resourceIndex(const char *filename) { char entryName[14]; char *ptr = entryName; - + assert(strlen(filename)); strcpy(entryName, filename); do @@ -128,13 +128,13 @@ int32 Resource::resourceIndex(const char *filename) { } char *Resource::getJAS2Line() { - char *startOfLine = _JAS2Ptr + _JAS2Pos; - char *curPos = startOfLine; - while (*curPos++ != 0xd) ; - *(curPos-1) = '\0'; // '\r' - *curPos = '\0'; // '\n' - _JAS2Pos = (curPos - _JAS2Ptr) + 1; - return startOfLine; + char *startOfLine = _JAS2Ptr + _JAS2Pos; + char *curPos = startOfLine; + while (*curPos++ != 0xd) ; + *(curPos - 1) = '\0'; // '\r' + *curPos = '\0'; // '\n' + _JAS2Pos = (curPos - _JAS2Ptr) + 1; + return startOfLine; } uint32 Resource::fileSize(const char *filename) { diff --git a/queen/sound.cpp b/queen/sound.cpp index 4cd38fa26f..766659c78a 100644 --- a/queen/sound.cpp +++ b/queen/sound.cpp @@ -95,7 +95,7 @@ static ov_callbacks g_File_wrap = { #endif Sound::Sound(SoundMixer *mixer, Input *input, Resource *resource) : - _mixer(mixer), _input(input), _resource(resource), _lastOverride(0), _currentSong(0), _sfxHandle(0) { + _mixer(mixer), _input(input), _resource(resource), _lastOverride(0), _currentSong(0), _sfxHandle(0) { } Sound::~Sound() { @@ -281,18 +281,18 @@ void Sound::playSong(int16 songNum) { // Volume normal case 5: warning("Sound::playSong() -> alter_current_volume() not implemented yet"); - //alter_current_volume(); - return; + //alter_current_volume(); + return; // Volume soft case 15: - //volumecontrol(-1,(20*VOLUME)/100); - return; + //volumecontrol(-1,(20*VOLUME)/100); + return; // Volume medium case 14: - //volumecontrol(-1,(32*VOLUME)/100); - return; + //volumecontrol(-1,(32*VOLUME)/100); + return; // Open door case 25: @@ -301,7 +301,7 @@ void Sound::playSong(int16 songNum) { // Close door case 26: - sfxPlay("105ASSSS"); + sfxPlay("105ASSSS"); return; // Light switch diff --git a/queen/talk.cpp b/queen/talk.cpp index 426d246839..15e6306df8 100644 --- a/queen/talk.cpp +++ b/queen/talk.cpp @@ -57,7 +57,7 @@ bool Talk::speak( Input *input, Logic *logic, Resource *resource, - Sound *sound) { + Sound *sound) { Talk *talk = new Talk(graphics, input, logic, resource, sound); bool result; if (sentence) @@ -93,7 +93,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { _oldSelectedSentenceValue = 0; debug(0, "----- talk(\"%s\") -----", filename); - + cutawayFilename[0] = '\0'; // XXX S=SUBJECT[1]; @@ -133,7 +133,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { if (NULL == person.name) { error("Invalid person object"); } - + int16 oldLevel = 0; bool personWalking = false; // OWALK in talk.c @@ -278,8 +278,8 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { else { disableSentence(oldLevel, selectedSentence); } - } - + } + // Check selected person to see if any Gamestates need setting int16 index = _dialogueTree[level][0].gameStateIndex; @@ -1081,8 +1081,8 @@ void Talk::speakSegment( } } - // Moved here so that Text is cleared when a Torso command done! - _graphics->textClear(0,198); + // Moved here so that Text is cleared when a Torso command done! + _graphics->textClear(0,198); if (oracle) { // lines 1831-1339 in talk.c diff --git a/queen/talk.h b/queen/talk.h index 320db2ad16..9946751ff7 100644 --- a/queen/talk.h +++ b/queen/talk.h @@ -60,7 +60,7 @@ class Talk { //! Read a string from ptr and return new ptr static byte *getString(byte *ptr, char *str, int maxLength, int align = 2); - private: +private: //! Collection of constants used by Talk enum { LINE_HEIGHT = 10, @@ -77,29 +77,29 @@ class Talk { //! Special commands for speech enum { - SPEAK_DEFAULT = 0, - SPEAK_FACE_LEFT = -1, - SPEAK_FACE_RIGHT = -2, - SPEAK_FACE_FRONT = -3, - SPEAK_FACE_BACK = -4, - SPEAK_ORACLE = -5, - SPEAK_UNKNOWN_6 = -6, - SPEAK_AMAL_ON = -7, - SPEAK_PAUSE = -8, - SPEAK_NONE = -9 + SPEAK_DEFAULT = 0, + SPEAK_FACE_LEFT = -1, + SPEAK_FACE_RIGHT = -2, + SPEAK_FACE_FRONT = -3, + SPEAK_FACE_BACK = -4, + SPEAK_ORACLE = -5, + SPEAK_UNKNOWN_6 = -6, + SPEAK_AMAL_ON = -7, + SPEAK_PAUSE = -8, + SPEAK_NONE = -9 }; //! TODO Move this to struct.h later! struct TalkSelected { - int16 hasTalkedTo; - int16 values[4]; + int16 hasTalkedTo; + int16 values[4]; }; struct DialogueNode { - int16 head; - int16 dialogueNodeValue1; - int16 gameStateIndex; - int16 gameStateValue; + int16 head; + int16 dialogueNodeValue1; + int16 gameStateIndex; + int16 gameStateValue; }; struct SpeechParameters { diff --git a/queen/walk.cpp b/queen/walk.cpp index 116e72b95b..3215c0bf0e 100644 --- a/queen/walk.cpp +++ b/queen/walk.cpp @@ -29,27 +29,27 @@ namespace Queen { const MovePersonData Walk::MOVE_DATA[] = { - {"COMPY", -1, -6, 1, 6, 0, 0, 0, 0, 12, 12, 1, 14}, - {"DEINO", -1, -8, 1, 8, 0, 0, 0, 0, 11, 11, 1, 10}, - {"FAYE", -1, -6, 1, 6, 13, 18, 7, 12, 19, 22, 2, 5}, - {"GUARDS", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 5}, - {"PRINCESS1", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5}, - {"PRINCESS2", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5}, - {"AMGUARD", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5}, - {"SPARKY", -1, -6, 1, 6, 13, 18, 7, 12, 21, 20, 2, 5}, - {"LOLA_SHOWER", -1, -6, 55, 60, 0, 0, 0, 0, 7, 7, 2, 5}, - {"LOLA", -24, -29, 24, 29, 0, 0, 0, 0, 30, 30, 2, 5}, - {"BOB", -15, -20, 15, 20, 21, 26, 0, 0, 27, 29, 2, 5}, - {"CHEF", -1, -4, 1, 4, 0, 0, 0, 0, 1, 5, 2, 4}, - {"HENRY", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 6}, - {"ANDERSON", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 5}, - {"JASPAR", -4, -9, 4, 9, 16, 21, 10, 15, 1, 3, 1, 10}, - {"PYGMY", -7, -12, 7, 12, 0, 0, 0, 0, 27, 27, 2, 5}, - {"FRANK", 7, 12, 1, 6, 0, 0, 0, 0, 13, 13, 2, 4}, - {"WEDGEWOOD", -20, -25, 20, 25, 0, 0, 0, 0, 1, 1, 1, 5}, - {"TMPD", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5}, - {"IAN", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 6}, - {"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + {"COMPY", -1, -6, 1, 6, 0, 0, 0, 0, 12, 12, 1, 14}, + {"DEINO", -1, -8, 1, 8, 0, 0, 0, 0, 11, 11, 1, 10}, + {"FAYE", -1, -6, 1, 6, 13, 18, 7, 12, 19, 22, 2, 5}, + {"GUARDS", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 5}, + {"PRINCESS1", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5}, + {"PRINCESS2", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5}, + {"AMGUARD", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5}, + {"SPARKY", -1, -6, 1, 6, 13, 18, 7, 12, 21, 20, 2, 5}, + {"LOLA_SHOWER", -1, -6, 55, 60, 0, 0, 0, 0, 7, 7, 2, 5}, + {"LOLA", -24, -29, 24, 29, 0, 0, 0, 0, 30, 30, 2, 5}, + {"BOB", -15, -20, 15, 20, 21, 26, 0, 0, 27, 29, 2, 5}, + {"CHEF", -1, -4, 1, 4, 0, 0, 0, 0, 1, 5, 2, 4}, + {"HENRY", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 6}, + {"ANDERSON", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 5}, + {"JASPAR", -4, -9, 4, 9, 16, 21, 10, 15, 1, 3, 1, 10}, + {"PYGMY", -7, -12, 7, 12, 0, 0, 0, 0, 27, 27, 2, 5}, + {"FRANK", 7, 12, 1, 6, 0, 0, 0, 0, 13, 13, 2, 4}, + {"WEDGEWOOD", -20, -25, 20, 25, 0, 0, 0, 0, 1, 1, 1, 5}, + {"TMPD", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5}, + {"IAN", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 6}, + {"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; diff --git a/queen/walk.h b/queen/walk.h index 9c2febbcf3..ca2b46a243 100644 --- a/queen/walk.h +++ b/queen/walk.h @@ -109,7 +109,7 @@ private: void incWalkData(int16 px, int16 py, int16 x, int16 y, uint16 area); //! compute path (and populates _walkData) from current position to the new one - void calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y); + void calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y); WalkData _walkData[MAX_WALK_DATA]; |