diff options
Diffstat (limited to 'queen')
-rw-r--r-- | queen/command.cpp | 44 | ||||
-rw-r--r-- | queen/cutaway.cpp | 5 | ||||
-rw-r--r-- | queen/graphics.cpp | 135 | ||||
-rw-r--r-- | queen/graphics.h | 12 | ||||
-rw-r--r-- | queen/logic.cpp | 90 | ||||
-rw-r--r-- | queen/logic.h | 19 | ||||
-rw-r--r-- | queen/talk.cpp | 6 | ||||
-rw-r--r-- | queen/walk.cpp | 2 | ||||
-rw-r--r-- | queen/xref.txt | 19 |
9 files changed, 168 insertions, 164 deletions
diff --git a/queen/command.cpp b/queen/command.cpp index 4bccc8ea8c..33e4459a04 100644 --- a/queen/command.cpp +++ b/queen/command.cpp @@ -446,7 +446,7 @@ int16 Command::executeCommand(uint16 comId, int16 condResult) { // FIXME: the EXECUTE_EXIT1 stuff can be omitted as it is // more or less redundant code if (condResult > 0) { - _vm->logic()->joeSpeak(condResult, true); + _vm->logic()->makeJoeSpeak(condResult, true); } return condResult; } @@ -757,7 +757,7 @@ bool Command::executeIfDialog(const char *description) { char cutaway[20]; memset(cutaway, 0, sizeof(cutaway)); - _vm->logic()->dialogue(description, _state.selNoun, cutaway); + _vm->logic()->startDialogue(description, _state.selNoun, cutaway); while (cutaway[0] != '\0') { char currentCutaway[20]; @@ -823,28 +823,28 @@ void Command::sayInvalidAction(Verb action, int16 subj1, int16 subj2) { case VERB_OPEN: // 'it doesn't seem to open' - _vm->logic()->joeSpeak(1); + _vm->logic()->makeJoeSpeak(1); break; case VERB_USE: if (subj1 < 0) { uint16 k = _vm->logic()->itemData(-subj1)->sfxDescription; if (k > 0) { - _vm->logic()->joeSpeak(k, true); + _vm->logic()->makeJoeSpeak(k, true); } else { - _vm->logic()->joeSpeak(2); + _vm->logic()->makeJoeSpeak(2); } } else { - _vm->logic()->joeSpeak(2); + _vm->logic()->makeJoeSpeak(2); } break; case VERB_TALK_TO: - _vm->logic()->joeSpeak(24 + _vm->randomizer.getRandomNumber(2)); + _vm->logic()->makeJoeSpeak(24 + _vm->randomizer.getRandomNumber(2)); break; case VERB_CLOSE: - _vm->logic()->joeSpeak(2); + _vm->logic()->makeJoeSpeak(2); break; case VERB_MOVE: @@ -852,12 +852,12 @@ void Command::sayInvalidAction(Verb action, int16 subj1, int16 subj2) { if (subj1 > 0) { int16 img = _vm->logic()->objectData(subj1)->image; if (img == -4 || img == -3) { - _vm->logic()->joeSpeak(18); + _vm->logic()->makeJoeSpeak(18); } else { - _vm->logic()->joeSpeak(3); + _vm->logic()->makeJoeSpeak(3); } } else { - _vm->logic()->joeSpeak(3); + _vm->logic()->makeJoeSpeak(3); } break; @@ -867,30 +867,30 @@ void Command::sayInvalidAction(Verb action, int16 subj1, int16 subj2) { if (subj2 > 0) { int16 img = _vm->logic()->objectData(subj2)->image; if (img == -4 || img == -3) { - _vm->logic()->joeSpeak(27 + _vm->randomizer.getRandomNumber(2)); + _vm->logic()->makeJoeSpeak(27 + _vm->randomizer.getRandomNumber(2)); } } else { - _vm->logic()->joeSpeak(11); + _vm->logic()->makeJoeSpeak(11); } } else { - _vm->logic()->joeSpeak(12); + _vm->logic()->makeJoeSpeak(12); } break; case VERB_PICK_UP: if (subj1 < 0) { - _vm->logic()->joeSpeak(14); + _vm->logic()->makeJoeSpeak(14); } else { int16 img = _vm->logic()->objectData(subj2)->image; if (img == -4 || img == -3) { // Trying to get a person - _vm->logic()->joeSpeak(20); + _vm->logic()->makeJoeSpeak(20); } else { // 5 : 'I can't pick that up' // 6 : 'I don't think I need that' // 7 : 'I'd rather leave it here' // 8 : 'I don't think I'd have any use for that' - _vm->logic()->joeSpeak(5 + _vm->randomizer.getRandomNumber(3)); + _vm->logic()->makeJoeSpeak(5 + _vm->randomizer.getRandomNumber(3)); } } break; @@ -922,7 +922,7 @@ void Command::changeObjectState(Verb action, int16 obj, int16 song, bool cutDone } } else { // 'it's already open !' - _vm->logic()->joeSpeak(9); + _vm->logic()->makeJoeSpeak(9); } } else if (action == VERB_CLOSE && !cutDone) { if (State::findOn(objData->state) == STATE_ON_OFF) { @@ -941,7 +941,7 @@ void Command::changeObjectState(Verb action, int16 obj, int16 song, bool cutDone } } else { // 'it's already closed !' - _vm->logic()->joeSpeak(10); + _vm->logic()->makeJoeSpeak(10); } } else if (action == VERB_MOVE) { State::alterOn(&objData->state, STATE_ON_OFF); @@ -1046,7 +1046,7 @@ int16 Command::setConditions(uint16 command, bool lastCmd) { // check to see if fail state is in fact a cutaway const char *objDesc = _vm->logic()->objectTextualDescription(cmdGs->speakValue); if (!executeIfCutaway(objDesc) && !executeIfDialog(objDesc)) { - _vm->logic()->joeSpeak(cmdGs->speakValue, true); + _vm->logic()->makeJoeSpeak(cmdGs->speakValue, true); } ret = -2; } else { @@ -1239,7 +1239,7 @@ void Command::lookAtSelectedObject() { // if (_vm->logic()->objectData(objNum)->entryObj == 0) { // if (makeJoeWalkTo(_selPosX, _selPosY, objNum, _state.selAction, false) == -2) { // // 'I can't get close enough to have a look.' -// _vm->logic()->joeSpeak(13); +// _vm->logic()->makeJoeSpeak(13); // } // } // } @@ -1267,7 +1267,7 @@ void Command::lookAtSelectedObject() { } } - _vm->logic()->joeSpeak(desc, true); + _vm->logic()->makeJoeSpeak(desc, true); _vm->logic()->joeFace(); } diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp index 05e345a219..c8b9c08308 100644 --- a/queen/cutaway.cpp +++ b/queen/cutaway.cpp @@ -794,7 +794,7 @@ void Cutaway::handlePersonRecord( } } else { - _vm->logic()->personSetData( + _vm->logic()->initPerson( object.objectNumber - _vm->logic()->currentRoomData(), "", true, &p); @@ -1023,7 +1023,7 @@ void Cutaway::run(char *nextFilename) { if (object->image == -3 || object->image == -4) { k++; if (object->name > 0) { - _vm->graphics()->animReset(k); + _vm->graphics()->resetPersonAnim(k); } } } @@ -1040,7 +1040,6 @@ void Cutaway::run(char *nextFilename) { _vm->logic()->gameState(3, 1); _vm->logic()->inventoryRefresh(); } - } joeBob->animating = 0; diff --git a/queen/graphics.cpp b/queen/graphics.cpp index 6dd0dd04d5..178bb5cbb1 100644 --- a/queen/graphics.cpp +++ b/queen/graphics.cpp @@ -278,11 +278,10 @@ BobFrame *BankManager::fetchFrame(uint32 index) { void BankManager::eraseFrame(uint32 index) { + debug(9, "BankManager::eraseFrame(%d)", index); BobFrame *pbf = &_frames[index]; - pbf->width = 0; - pbf->height = 0; delete[] pbf->data; - pbf->data = 0; + memset(pbf, 0, sizeof(BobFrame)); } @@ -465,9 +464,9 @@ void Graphics::bobSortAll() { if (pbs->animating) { pbs->animOneStep(); - if (pbs->frameNum > 500) { - pbs->frameNum -= 500; + if (pbs->frameNum > 500) { // SFX frame _vm->sound()->playSfx(_vm->logic()->currentRoomSfx()); + pbs->frameNum -= 500; } } if (pbs->moving) { @@ -668,64 +667,40 @@ uint16 Graphics::textWidth(const char* text) const { } -uint16 Graphics::animCreate(uint16 curImage, const Person *person) { - AnimFrame *animFrames = _newAnim[person->actor->bobNum]; +void Graphics::fillAnimBuffer(const char *anim, AnimFrame *af) { + while (true) { + sscanf(anim, "%3hu,%3hu", &af->frame, &af->speed); + if (af->frame == 0) + break; + anim += 8; + ++af; + } +} - uint16 allocatedFrames[256]; - memset(allocatedFrames, 0, sizeof(allocatedFrames)); - const char *p = person->anim; - int frame = 0; - uint16 f1, f2; - do { - sscanf(p, "%3hu,%3hu", &f1, &f2); - animFrames[frame].frame = f1; - animFrames[frame].speed = f2; - if (f1 > 500) { - // SFX - allocatedFrames[f1 - 500] = 1; - } else { - allocatedFrames[f1] = 1; - } - - p += 8; - ++frame; - } while(f1 != 0); - - // ajust frame numbers - uint16 n = 1; - uint16 i; - for (i = 1; i <= 255; ++i) { - if (allocatedFrames[i] != 0) { - allocatedFrames[i] = n; - ++n; - } - } - for (i = 0; animFrames[i].frame != 0; ++i) { - uint16 frameNum = animFrames[i].frame; +uint16 Graphics::countAnimFrames(const char *anim) { + AnimFrame afbuf[30]; + fillAnimBuffer(anim, afbuf); + + bool frames[256]; + memset(frames, 0, sizeof(frames)); + uint16 count = 0; + AnimFrame *af = afbuf; + for ( ; af->frame != 0; ++af) { + uint16 frameNum = af->frame; if (frameNum > 500) { - animFrames[i].frame = curImage + allocatedFrames[frameNum - 500] + 500; - } else { - animFrames[i].frame = curImage + allocatedFrames[frameNum]; + frameNum -= 500; } - } - - // unpack necessary frames - for (i = 1; i <= 255; ++i) { - if (allocatedFrames[i] != 0) { - ++curImage; - _vm->bankMan()->unpack(i, curImage, person->actor->bankNum); + if (!frames[frameNum]) { + frames[frameNum] = true; + ++count; } } - - // start animation - bob(person->actor->bobNum)->animString(animFrames); - - return curImage; + return count; } -void Graphics::animSetup(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible) { +void Graphics::setupObjectAnim(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible) { int16 tempFrames[20]; memset(tempFrames, 0, sizeof(tempFrames)); uint16 numTempFrames = 0; @@ -801,14 +776,60 @@ void Graphics::animSetup(const GraphicData *gd, uint16 firstImage, uint16 bobNum } -void Graphics::animReset(uint16 bobNum) { +uint16 Graphics::setupPersonAnim(const ActorData *ad, const char *anim, uint16 curImage) { + debug(9, "Graphics::setupPersonAnim(%s, %d)", anim, curImage); + AnimFrame *animFrames = _newAnim[ad->bobNum]; + fillAnimBuffer(anim, animFrames); + uint16 frameCount[256]; + memset(frameCount, 0, sizeof(frameCount)); + AnimFrame *af = animFrames; + for ( ; af->frame != 0; ++af) { + uint16 frameNum = af->frame; + if (frameNum > 500) { + frameNum -= 500; + } + if (!frameCount[frameNum]) { + frameCount[frameNum] = 1; + } + } + uint16 i, n = 1; + for (i = 1; i < 256; ++i) { + if (frameCount[i]) { + frameCount[i] = n; + ++n; + } + } + af = animFrames; + for ( ; af->frame != 0; ++af) { + if (af->frame > 500) { + af->frame = curImage + frameCount[af->frame - 500] + 500; + } else { + af->frame = curImage + frameCount[af->frame]; + } + } + + // unpack necessary frames + for (i = 1; i < 256; ++i) { + if (frameCount[i]) { + ++curImage; + _vm->bankMan()->unpack(i, curImage, ad->bankNum); + } + } + + // start animation + bob(ad->bobNum)->animString(animFrames); + return curImage; +} + + +void Graphics::resetPersonAnim(uint16 bobNum) { if (_newAnim[bobNum][0].frame != 0) { bob(bobNum)->animString(_newAnim[bobNum]); } } -void Graphics::animErase(uint16 bobNum) { +void Graphics::erasePersonAnim(uint16 bobNum) { _newAnim[bobNum][0].frame = 0; BobSlot *pbs = bob(bobNum); pbs->animating = false; @@ -816,7 +837,7 @@ void Graphics::animErase(uint16 bobNum) { } -void Graphics::animEraseAll() { +void Graphics::eraseAllAnims() { for (int i = 1; i <= 16; ++i) { _newAnim[i][0].frame = 0; } diff --git a/queen/graphics.h b/queen/graphics.h index 2b9140c331..5f52acf7ee 100644 --- a/queen/graphics.h +++ b/queen/graphics.h @@ -179,11 +179,13 @@ public: int textCenterX(const char *text) const; // MIDDLE() void textColor(uint16 y, uint8 color) { _texts[y].color = color; } - uint16 animCreate(uint16 curImage, const Person *person); - void animSetup(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible); - void animReset(uint16 bobNum); - void animErase(uint16 bobNum); - void animEraseAll(); + void fillAnimBuffer(const char *anim, AnimFrame *af); + uint16 countAnimFrames(const char *anim); + void setupObjectAnim(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible); + uint16 setupPersonAnim(const ActorData *ad, const char *anim, uint16 curImage); + void resetPersonAnim(uint16 bobNum); + void erasePersonAnim(uint16 bobNum); + void eraseAllAnims(); void loadPanel(); diff --git a/queen/logic.cpp b/queen/logic.cpp index 5144e44117..7a9b94bc5e 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -260,7 +260,7 @@ void Logic::initialise() { memset(_gameState, 0, sizeof(_gameState)); _vm->graphics()->loadPanel(); _vm->graphics()->bobSetupControl(); - joeSetup(); + setupJoe(); zoneSetupPanel(); _oldRoom = 0; @@ -268,11 +268,7 @@ void Logic::initialise() { ObjectData* Logic::objectData(int index) const { - if (index < 0) { - warning("Logic::objectData() called with negative object index: %i", index); - } - index = ABS(index); // cyx: is that really necessary ? - if (index <= _numObjects) + if (index >= 0 && index <= _numObjects) return &_objectData[index]; else error("[Logic::objectData] Invalid object data index: %i", index); @@ -480,7 +476,7 @@ void Logic::joeWalk(JoeWalkMode walking) { } -int16 Logic::gameState(int index) { +int16 Logic::gameState(int index) const { if (index >= 0 && index < GAME_STATE_COUNT) return _gameState[index]; else @@ -616,7 +612,7 @@ void Logic::roomErase() { for (i = 0; i <= 3; ++i) { _personFrames[i] = 0; } - _vm->graphics()->animEraseAll(); + _vm->graphics()->eraseAllAnims(); uint16 cur = _roomData[_oldRoom] + 1; uint16 last = _roomData[_oldRoom + 1]; @@ -767,7 +763,7 @@ void Logic::roomSetupObjects() { if (pgd->firstFrame < 0) { // FIXME: if(TEMPA[1]<0) bobs[CURRBOB].xflip=1; curBob = 5 + _numFurnitureAnimated; - _vm->graphics()->animSetup(pgd, curImage + 1, curBob + numObjectAnimated, pod->name > 0); + _vm->graphics()->setupObjectAnim(pgd, curImage + 1, curBob + numObjectAnimated, pod->name > 0); curImage += pgd->lastFrame; ++numObjectAnimated; } else if (lastFrame != 0) { @@ -816,9 +812,9 @@ void Logic::roomSetupObjects() { debug(6, "Logic::roomSetupObjects() - Setting up person %X, name=%X", i, pod->name); uint16 noun = i - currentRoomData(); if (pod->name > 0) { - curImage = personSetup(noun, curImage); + curImage = setupPersonInRoom(noun, curImage); } else { - curImage = personAllocate(noun, curImage); + curImage = countPersonFrames(noun, curImage); } } } @@ -879,7 +875,7 @@ uint16 Logic::roomRefreshObject(uint16 obj) { curImage = _numFrames; _personFrames[pNum] = curImage; } - curImage = personSetup(obj - currentRoomData(), curImage); + curImage = setupPersonInRoom(obj - currentRoomData(), curImage); } return curImage; } @@ -906,7 +902,7 @@ uint16 Logic::roomRefreshObject(uint16 obj) { rebound = true; } if (pgd->firstFrame < 0) { - _vm->graphics()->animSetup(pgd, curImage, curBob, pod->name != 0); + _vm->graphics()->setupObjectAnim(pgd, curImage, curBob, pod->name != 0); curImage += pgd->lastFrame - 1; } else if (lastFrame != 0) { // turn on an animated bob @@ -975,7 +971,7 @@ void Logic::roomDisplay(uint16 room, RoomDisplayMode mode, uint16 scale, int com roomSetup(roomName(room), comPanel, inCutaway); ObjectData *pod = NULL; if (mode != RDM_FADE_NOJOE) { - pod = joeSetupInRoom(mode != RDM_FADE_JOE_XY, scale); + pod = setupJoeInRoom(mode != RDM_FADE_JOE_XY, scale); } if (mode != RDM_NOFADE_JOE) { update(); @@ -1035,9 +1031,9 @@ ActorData *Logic::findActor(uint16 noun, const char *name) { } -void Logic::personSetData(int16 noun, const char *actorName, bool loadBank, Person *pp) { +void Logic::initPerson(int16 noun, const char *actorName, bool loadBank, Person *pp) { if (noun <= 0) { - warning("Person::setData() - Invalid object number: %i", noun); + warning("Logic::initPerson() - Invalid object number: %i", noun); } ActorData *pad = findActor(noun, actorName); if (pad != NULL) { @@ -1058,14 +1054,14 @@ void Logic::personSetData(int16 noun, const char *actorName, bool loadBank, Pers } -uint16 Logic::personSetup(uint16 noun, uint16 curImage) { +uint16 Logic::setupPersonInRoom(uint16 noun, uint16 curImage) { if (noun == 0) { warning("Trying to setup person 0"); return curImage; } Person p; - personSetData(noun, "", true, &p); + initPerson(noun, "", true, &p); const ActorData *pad = p.actor; uint16 scale = 100; @@ -1087,39 +1083,25 @@ uint16 Logic::personSetup(uint16 noun, uint16 curImage) { if (p.anim != NULL) { _personFrames[pad->bobNum] = curImage + 1; - curImage = _vm->graphics()->animCreate(curImage, &p); + curImage = _vm->graphics()->setupPersonAnim(pad, p.anim, curImage); } else { - _vm->graphics()->animErase(pad->bobNum); + _vm->graphics()->erasePersonAnim(pad->bobNum); } return curImage; } -uint16 Logic::personAllocate(uint16 noun, uint16 curImage) { +uint16 Logic::countPersonFrames(uint16 noun, uint16 curImage) { ActorData *pad = findActor(noun); if (pad != NULL && pad->anim != 0) { - const char *animStr = _aAnim[pad->anim]; - bool allocatedFrames[256]; - memset(allocatedFrames, 0, sizeof(allocatedFrames)); - uint16 f1, f2; - do { - sscanf(animStr, "%3hu,%3hu", &f1, &f2); - animStr += 8; - allocatedFrames[f1] = true; - } while(f1 != 0); - for (int i = 1; i <= 255; ++i) { - if (allocatedFrames[i]) { - ++curImage; - } - } - // FIXME: shouldn't this line be executed BEFORE curImage is incremented ? + curImage += _vm->graphics()->countAnimFrames(_aAnim[pad->anim]); _personFrames[pad->bobNum] = curImage + 1; } return curImage; } -void Logic::joeSetupFromBanks(const char *animBank, const char *standBank) { +void Logic::loadJoeBanks(const char *animBank, const char *standBank) { int i; _vm->bankMan()->load(animBank, 13); for (i = 11; i <= 28 + FRAMES_JOE_XTRA; ++i) { @@ -1134,22 +1116,22 @@ void Logic::joeSetupFromBanks(const char *animBank, const char *standBank) { } -void Logic::joeSetup() { - joeSetupFromBanks("joe_a.BBK", "joe_b.BBK"); +void Logic::setupJoe() { + loadJoeBanks("joe_a.BBK", "joe_b.BBK"); joePrevFacing(DIR_FRONT); joeFacing(DIR_FRONT); } -ObjectData *Logic::joeSetupInRoom(bool autoPosition, uint16 scale) { - debug(6, "Logic::joeSetupInRoom(%d, %d) joe.x=%d joe.y=%d", autoPosition, scale, _joe.x, _joe.y); +ObjectData *Logic::setupJoeInRoom(bool autoPosition, uint16 scale) { + debug(9, "Logic::setupJoeInRoom(%d, %d) joe.x=%d joe.y=%d", autoPosition, scale, _joe.x, _joe.y); uint16 oldx; uint16 oldy; WalkOffData *pwo = NULL; ObjectData *pod = objectData(_entryObj); if (pod == NULL) { - error("Logic::joeSetupInRoom() - No object data for obj %d", _entryObj); + error("Logic::setupJoeInRoom() - No object data for obj %d", _entryObj); } if (!autoPosition || joeX() != 0 || joeY() != 0) { @@ -1349,7 +1331,7 @@ void Logic::joeUseDress(bool showCut) { } } _vm->display()->palSetJoeDress(); - joeSetupFromBanks("JoeD_A.BBK", "JoeD_B.BBK"); + loadJoeBanks("JoeD_A.BBK", "JoeD_B.BBK"); inventoryDeleteItem(ITEM_DRESS); gameState(VAR_DRESSING_MODE, 2); } @@ -1363,7 +1345,7 @@ void Logic::joeUseClothes(bool showCut) { inventoryInsertItem(ITEM_DRESS); } _vm->display()->palSetJoeNormal(); - joeSetupFromBanks("Joe_A.BBK", "Joe_B.BBK"); + loadJoeBanks("Joe_A.BBK", "Joe_B.BBK"); inventoryDeleteItem(ITEM_CLOTHES); gameState(VAR_DRESSING_MODE, 0); } @@ -1371,7 +1353,7 @@ void Logic::joeUseClothes(bool showCut) { void Logic::joeUseUnderwear() { _vm->display()->palSetJoeNormal(); - joeSetupFromBanks("JoeU_A.BBK", "JoeU_B.BBK"); + loadJoeBanks("JoeU_A.BBK", "JoeU_B.BBK"); gameState(VAR_DRESSING_MODE, 1); } @@ -1382,7 +1364,7 @@ void Logic::makePersonSpeak(const char *sentence, Person *person, const char *vo } -void Logic::dialogue(const char *dlgFile, int personInRoom, char *cutaway) { +void Logic::startDialogue(const char *dlgFile, int personInRoom, char *cutaway) { char cutawayFile[20]; if (cutaway == NULL) { cutaway = cutawayFile; @@ -1405,9 +1387,9 @@ void Logic::playCutaway(const char *cutFile, char *next) { } -void Logic::joeSpeak(uint16 descNum, bool objectType) { - // joeSpeak(k, false) == SPEAK(JOE_RESPstr[k],"JOE",find_cd_desc(k)) - // joeSpeak(k, true) == SPEAK(OBJECT_DESCRstr[k],"JOE",find_cd_desc(JOERESPMAX+k)) +void Logic::makeJoeSpeak(uint16 descNum, bool objectType) { + // makeJoeSpeak(k, false) == SPEAK(JOE_RESPstr[k],"JOE",find_cd_desc(k)) + // makeJoeSpeak(k, true) == SPEAK(OBJECT_DESCRstr[k],"JOE",find_cd_desc(JOERESPMAX+k)) const char *text = objectType ? _objDescription[descNum] : _joeResponse[descNum]; if (objectType) { descNum += JOE_RESPONSE_MAX; @@ -1685,7 +1667,7 @@ void Logic::customMoveJoe(int facing, uint16 areaNum, uint16 walkDataNum) { switch (_currentRoom) { case ROOM_JUNGLE_BRIDGE: - joeSpeak(16); + makeJoeSpeak(16); break; case ROOM_JUNGLE_GORILLA_1: playCutaway("c6c.CUT", nextCut); @@ -1734,10 +1716,10 @@ void Logic::customMoveJoe(int facing, uint16 areaNum, uint16 walkDataNum) { playCutaway("c53b.CUT", nextCut); break; case ROOM_TEMPLE_LIZARD_LASER: - joeSpeak(19); + makeJoeSpeak(19); break; case ROOM_HOTEL_DOWNSTAIRS: - joeSpeak(21); + makeJoeSpeak(21); break; case ROOM_HOTEL_LOBBY: if (_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] == 0) { @@ -1754,7 +1736,7 @@ void Logic::customMoveJoe(int facing, uint16 areaNum, uint16 walkDataNum) { break; case ROOM_TEMPLE_MAZE_5: if (areaNum == 7) { - joeSpeak(17); + makeJoeSpeak(17); } break; case ROOM_TEMPLE_MAZE_6: @@ -2563,7 +2545,7 @@ void Logic::asmShakeScreen() { void Logic::asmAttemptPuzzle() { ++_puzzleAttemptCount; if (_puzzleAttemptCount & 4) { - joeSpeak(226, true); + makeJoeSpeak(226, true); _puzzleAttemptCount = 0; } } diff --git a/queen/logic.h b/queen/logic.h index b0b69036c2..38fd8d90d6 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -130,7 +130,7 @@ public: const char *joeResponse(int i) const { return _joeResponse[i]; } const char *verbName(Verb v) const { return _verbName[v]; } - int16 gameState(int index); + int16 gameState(int index) const; void gameState(int index, int16 newValue); TalkSelected *talkSelected(int index) { return _talkSelected + index; } @@ -169,18 +169,18 @@ public: uint16 numFrames() const { return _numFrames; } ActorData *findActor(uint16 noun, const char *name = NULL); - void personSetData(int16 noun, const char *actorName, bool loadBank, Person *pp); - uint16 personSetup(uint16 noun, uint16 curImage); - uint16 personAllocate(uint16 noun, uint16 curImage); + void initPerson(int16 noun, const char *actorName, bool loadBank, Person *pp); + uint16 setupPersonInRoom(uint16 noun, uint16 curImage); + uint16 countPersonFrames(uint16 noun, uint16 curImage); uint16 personFrames(uint16 bobNum) const { return _personFrames[bobNum]; } - void joeSetupFromBanks(const char *animBank, const char *standBank); + void loadJoeBanks(const char *animBank, const char *standBank); //! Load the various bobs needed to animate Joe - void joeSetup(); + void setupJoe(); //! Setup Joe at the right place when entering a room - ObjectData *joeSetupInRoom(bool autoPosition, uint16 scale); + ObjectData *setupJoeInRoom(bool autoPosition, uint16 scale); uint16 joeFace(); void joeGrab(int16 grabState); @@ -189,10 +189,9 @@ public: void joeUseClothes(bool showCut); void joeUseUnderwear(); - void joeSpeak(uint16 descNum, bool objectType = false); - + void makeJoeSpeak(uint16 descNum, bool objectType = false); void makePersonSpeak(const char *sentence, Person *person, const char *voiceFilePrefix); - void dialogue(const char *dlgFile, int personInRoom, char *cutaway); + void startDialogue(const char *dlgFile, int personInRoom, char *cutaway); void playCutaway(const char *cutFile, char *next = NULL); Verb findVerbUnderCursor(int16 cursorx, int16 cursory) const; diff --git a/queen/talk.cpp b/queen/talk.cpp index 564a270f27..1b561322e2 100644 --- a/queen/talk.cpp +++ b/queen/talk.cpp @@ -99,7 +99,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { if (State::findTalk(data->state) == STATE_TALK_MUTE) { // 'I can't talk to that' - _vm->logic()->joeSpeak(24 + _vm->randomizer.getRandomNumber(2)); + _vm->logic()->makeJoeSpeak(24 + _vm->randomizer.getRandomNumber(2)); return; } @@ -107,7 +107,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { Person person; memset(&person, 0, sizeof(Person)); - _vm->logic()->personSetData(personInRoom, "", false, &person); + _vm->logic()->initPerson(personInRoom, "", false, &person); if (NULL == person.name) { error("Invalid person object"); @@ -337,7 +337,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { pbs->y = person.actor->y; // Better kick start the persons anim sequence - _vm->graphics()->animReset(person.actor->bobNum); + _vm->graphics()->resetPersonAnim(person.actor->bobNum); } _vm->logic()->joeWalk(JWM_NORMAL); diff --git a/queen/walk.cpp b/queen/walk.cpp index f918b391d2..1712d46c23 100644 --- a/queen/walk.cpp +++ b/queen/walk.cpp @@ -306,7 +306,7 @@ int16 Walk::moveJoe(int direction, int16 endx, int16 endy, bool inCutaway) { } } else { // path has been blocked, make Joe say so - _vm->logic()->joeSpeak(4); + _vm->logic()->makeJoeSpeak(4); can = -1; } } diff --git a/queen/xref.txt b/queen/xref.txt index d23b3a0cdd..6e5bbe7e07 100644 --- a/queen/xref.txt +++ b/queen/xref.txt @@ -126,7 +126,7 @@ clearallbobs() Graphics::bobClearAll clearbob() Graphics::bobClear drawbobs() Graphics::bobDrawAll invbob() Graphics::bobDrawInventoryItem -loadbackdrop() Graphics::loadBackdrop +loadbackdrop() *included in Display::setupNewRoom* loadpanel() Graphics::loadPanel MAKE_SPEAK_BOB() Graphics::bobSetText makeanim() BobSlot::animNormal @@ -172,8 +172,8 @@ JOE === FACE_JOE() Logic::joeFace GRAB_DIR(),GRAB_JOE() Logic::joeGrab -SETUP_HERO() Logic::joeSetupInRoom -SETUP_JOE() Logic::joeSetup +SETUP_HERO() Logic::setupJoeInRoom +SETUP_JOE() Logic::setupJoe USE_UNDERWEAR() Logic::joeUseUnderwear USE_CLOTHES() Logic::joeUseClothes USE_DRESS() Logic::joeUseDress @@ -205,6 +205,7 @@ walkgameload *not needed ?* LOGIC ===== CHECK_PLAYER() Logic::checkPlayer +CUTAWAY_SPECIAL() DISP_OBJECTS() Logic::roomSetupObjects DISP_ROOM() Logic::roomDisplay FIND_BOB() Logic::findBob @@ -248,7 +249,6 @@ GRAPHIC_MAX Logic::_numGraphics ITEMTOT Logic::_numItems ITEM_DATA Logic::_itemData NAMETOT Logic::_numNames -NEW_ANIM Logic::_newAnim OBJ_DESC_DATA Logic::_objectDescription OBJ_DESC_MAX Logic::_numObjDesc OBJECT_BOX Logic::_objectBox @@ -262,19 +262,20 @@ ROOMTOT Logic::_numRooms ROOM_DATA Logic::_roomData ROOM_NAMEstr Logic::_roomName SFACTOR Logic::_joe.scale -VERB_NAMEstr Verb::_verbName +VERB_NAMEstr Logic::_verbName WALK_OFF_DATA Logic::_walkOffData WALK_OFF_MAX Logic::_numWalkOffs PERSONS ======= -ALLOCATE_PERSON() Logic::personAllocate -CREATE_ANIM() Graphics::animCreate -SET_PERSON_DATA() Logic::personSetData -SETUP_PERSON() Logic::personSetup +ALLOCATE_PERSON() Logic::allocatePersonFrames +CREATE_ANIM() Graphics::setupPersonAnim +SET_PERSON_DATA() Logic::initPerson +SETUP_PERSON() Logic::setupPersonInRoom OBJ_PERSON() Logic::objectForPerson - +NEW_ANIM Graphics::_newAnim PERSON_FACE PERSON_FACE_MAX PERSON_FRAMES Logic::_personFrames |