aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Montoir2004-01-14 14:34:05 +0000
committerGregory Montoir2004-01-14 14:34:05 +0000
commit6c78f2a6b801ae8a8efb7f9db9bf0213ce3eb759 (patch)
treeaaf89d79270a296bb9beab7d563639f20acbf260
parent9f8caa6889c5504edb279cacc524c142eb5829d1 (diff)
downloadscummvm-rg350-6c78f2a6b801ae8a8efb7f9db9bf0213ce3eb759.tar.gz
scummvm-rg350-6c78f2a6b801ae8a8efb7f9db9bf0213ce3eb759.tar.bz2
scummvm-rg350-6c78f2a6b801ae8a8efb7f9db9bf0213ce3eb759.zip
- tweaked a bit walking functions to make persons stop walking when a cutaway is canceled
- removed unpack to bob frame 2 (as it is never used) - changed some error() calls to assert() - minor cleanups svn-id: r12385
-rw-r--r--queen/bankman.cpp9
-rw-r--r--queen/command.cpp3
-rw-r--r--queen/cutaway.cpp5
-rw-r--r--queen/display.cpp8
-rw-r--r--queen/graphics.cpp11
-rw-r--r--queen/logic.cpp119
-rw-r--r--queen/logic.h35
-rw-r--r--queen/talk.cpp3
-rw-r--r--queen/walk.cpp42
-rw-r--r--queen/walk.h9
10 files changed, 54 insertions, 190 deletions
diff --git a/queen/bankman.cpp b/queen/bankman.cpp
index 236573b664..6627cb60bd 100644
--- a/queen/bankman.cpp
+++ b/queen/bankman.cpp
@@ -103,14 +103,15 @@ void BankManager::close(uint32 bankslot) {
BobFrame *BankManager::fetchFrame(uint32 index) {
debug(9, "BankManager::fetchFrame(%d)", index);
- if (index >= MAX_FRAMES_NUMBER) {
- error("BankManager::fetchFrame() invalid frame index = %d", index);
- }
- return &_frames[index];
+ assert(index < MAX_FRAMES_NUMBER);
+ BobFrame *pbf = &_frames[index];
+ assert(pbf->data != 0);
+ return pbf;
}
void BankManager::eraseFrame(uint32 index) {
debug(9, "BankManager::eraseFrame(%d)", index);
+ assert(index < MAX_FRAMES_NUMBER);
BobFrame *pbf = &_frames[index];
delete[] pbf->data;
memset(pbf, 0, sizeof(BobFrame));
diff --git a/queen/command.cpp b/queen/command.cpp
index c278ea64b6..302db35072 100644
--- a/queen/command.cpp
+++ b/queen/command.cpp
@@ -455,8 +455,7 @@ int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, Verb v, bool mustWa
if (mustWalk) {
// determine which way for Joe to face Object
uint16 facing = State::findDirection(objData->state);
-
- BobSlot *bobJoe = _vm->graphics()->bob(0);
+ BobSlot *bobJoe = _vm->graphics()->bob(0);
if (x == bobJoe->x && y == bobJoe->y) {
_vm->logic()->joeFacing(facing);
_vm->logic()->joeFace();
diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp
index 78d301d5ef..a1fb7ef3d3 100644
--- a/queen/cutaway.cpp
+++ b/queen/cutaway.cpp
@@ -77,9 +77,6 @@ void Cutaway::load(const char *filename) {
debug(6, "----- Cutaway::load(\"%s\") -----", filename);
ptr = _fileData = _vm->resource()->loadFile(filename, 20);
- if (!_fileData) {
- error("Failed to load resource data file '%s'", filename);
- }
if (0 == scumm_stricmp(filename, "comic.cut"))
/* XXX _songBeforeComic = CURRSONG */;
@@ -956,7 +953,7 @@ void Cutaway::run(char *nextFilename) {
if (_roomFade) {
_vm->update();
int end = 223;
- if (_vm->logic()->isIntroRoom(_vm->logic()->currentRoom())) {
+ if (Logic::isIntroRoom(_vm->logic()->currentRoom())) {
end = 255;
}
BobSlot *j = _vm->graphics()->bob(0);
diff --git a/queen/display.cpp b/queen/display.cpp
index c3b70dc220..8bc7862606 100644
--- a/queen/display.cpp
+++ b/queen/display.cpp
@@ -79,7 +79,7 @@ void Display::dynalumInit(const char *roomName, uint16 roomNum) {
_dynalum.valid = false;
_dynalum.prevColMask = 0xFF;
- if (!(_vm->logic()->isAltIntroRoom(roomNum) || _vm->logic()->isIntroRoom(roomNum))) {
+ if (!(Logic::isAltIntroRoom(roomNum) || Logic::isIntroRoom(roomNum))) {
char filename[20];
sprintf(filename, "%s.msk", roomName);
@@ -177,7 +177,7 @@ void Display::palSetPanel() {
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 (!(_vm->logic()->isAltIntroRoom(roomNum) || _vm->logic()->isIntroRoom(roomNum))) {
+ if (!(Logic::isAltIntroRoom(roomNum) || Logic::isIntroRoom(roomNum))) {
if (dynalum) {
dynalumUpdate(dynaX, dynaY);
}
@@ -205,7 +205,7 @@ 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 (_vm->logic()->isAltIntroRoom(roomNum) || _vm->logic()->isIntroRoom(roomNum)) {
+ if (Logic::isAltIntroRoom(roomNum) || Logic::isIntroRoom(roomNum)) {
memset(_pal.screen + start * 3, 0, n * 3);
palSet(_pal.screen, start, end, true);
} else {
@@ -638,7 +638,7 @@ void Display::setupNewRoom(const char *name, uint16 room) {
_bdWidth = READ_LE_UINT16(pcxBuf + 12);
_bdHeight = READ_LE_UINT16(pcxBuf + 14);
readPCX(_backdropBuf, BACKDROP_W, pcxBuf + 128, _bdWidth, _bdHeight);
- memcpy(_pal.room, pcxBuf + size - 768, _vm->logic()->isIntroRoom(room) ? 256 * 3 : 144 * 3);
+ memcpy(_pal.room, pcxBuf + size - 768, Logic::isIntroRoom(room) ? 256 * 3 : 144 * 3);
delete[] pcxBuf;
palCustomColors(room);
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index 5dc79f966e..fd13de9202 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -407,12 +407,8 @@ void Graphics::stopBobs() {
}
BobSlot *Graphics::bob(int index) {
- if (index < MAX_BOBS_NUMBER)
- return _bobs + index;
- else {
- error("QueenGraphics::bob called with index = %i but MAX_BOBS_NUMBER = %i",
- index, MAX_BOBS_NUMBER);
- }
+ assert(index < MAX_BOBS_NUMBER);
+ return _bobs + index;
}
void Graphics::setBobText(
@@ -846,7 +842,6 @@ uint16 Graphics::refreshObject(uint16 obj) {
curImage += pgd->lastFrame - 1;
} else if (lastFrame != 0) {
// turn on an animated bob
- _vm->bankMan()->unpack(pgd->firstFrame, 2, 15);
pbs->animating = false;
uint16 firstImage = curImage;
--curImage;
@@ -861,8 +856,6 @@ uint16 Graphics::refreshObject(uint16 obj) {
pbs->animNormal(firstImage, curImage, pgd->speed / 4, rebound, false);
}
} else {
- // frame 2 is used as a buffer frame to prevent BOB flickering
- _vm->bankMan()->unpack(pgd->firstFrame, 2, 15);
_vm->bankMan()->unpack(pgd->firstFrame, curImage, 15);
pbs->curPos(pgd->x, pgd->y);
pbs->frameNum = curImage;
diff --git a/queen/logic.cpp b/queen/logic.cpp
index 03a6c1de9f..38c9a23112 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -41,7 +41,6 @@
#include "queen/talk.h"
#include "queen/walk.h"
-
namespace Queen {
Logic::Logic(QueenEngine *vm)
@@ -250,27 +249,18 @@ void Logic::initialise() {
_oldRoom = 0;
}
-
ObjectData* Logic::objectData(int index) const {
- if (index >= 0 && index <= _numObjects)
- return &_objectData[index];
- else
- error("[Logic::objectData] Invalid object data index: %i", index);
+ assert(index >= 0 && index <= _numObjects);
+ return &_objectData[index];
}
-
uint16 Logic::findBob(uint16 obj) {
- uint16 bobnum = 0;
-
- if (obj > _numObjects)
- error("Object index (%i) > _numObjects (%i)", obj, _numObjects);
+ assert(obj <= _numObjects);
uint16 room = _objectData[obj].room;
+ assert(room <= _numRooms);
- if (room >= _numRooms) {
- warning("room (%i) > _numRooms (%i)", room, _numRooms);
- }
-
+ uint16 bobnum = 0;
int16 img = _objectData[obj].image;
if(img != 0) {
if(img == -3 || img == -4) {
@@ -339,7 +329,6 @@ uint16 Logic::findBob(uint16 obj) {
return bobnum;
}
-
uint16 Logic::findFrame(uint16 obj) {
uint16 i;
uint16 framenum = 0;
@@ -402,7 +391,6 @@ uint16 Logic::findFrame(uint16 obj) {
return framenum;
}
-
uint16 Logic::objectForPerson(uint16 bobNum) const {
uint16 bobcur = 0;
// first object number in the room
@@ -423,7 +411,6 @@ uint16 Logic::objectForPerson(uint16 bobNum) const {
return 0;
}
-
WalkOffData *Logic::walkOffPointForObject(uint16 obj) const {
uint16 i;
for (i = 1; i <= _numWalkOffs; ++i) {
@@ -434,30 +421,27 @@ WalkOffData *Logic::walkOffPointForObject(uint16 obj) const {
return NULL;
}
-
void Logic::joeWalk(JoeWalkMode walking) {
_joe.walk = walking;
// Do this so that Input doesn't need to know the walk value
_vm->input()->dialogueRunning(JWM_SPEAK == walking);
}
-
int16 Logic::gameState(int index) const {
- if (index >= 0 && index < GAME_STATE_COUNT)
- return _gameState[index];
- else
- error("[QueenLogic::gameState] invalid index: %i", index);
+ assert(index >= 0 && index < GAME_STATE_COUNT);
+ return _gameState[index];
}
void Logic::gameState(int index, int16 newValue) {
- if (index >= 0 && index < GAME_STATE_COUNT) {
-// debug(6, "Logic::gameState() - GAMESTATE[%d] = %d", index, newValue);
- _gameState[index] = newValue;
- }
- else
- error("[QueenLogic::gameState] invalid index: %i", index);
+ assert(index >= 0 && index < GAME_STATE_COUNT);
+ debug(8, "Logic::gameState() [%d] = %d", index, newValue);
+ _gameState[index] = newValue;
}
+const char *Logic::roomName(uint16 roomNum) const {
+ assert(roomNum >= 1 && roomNum <= _numRooms);
+ return _roomName[roomNum];
+}
void Logic::eraseRoom() {
_vm->bankMan()->eraseFrames(false);
@@ -496,7 +480,6 @@ void Logic::eraseRoom() {
}
}
-
void Logic::setupRoom(const char *room, int comPanel, bool inCutaway) {
// load backdrop image, init dynalum, setup colors
_vm->display()->setupNewRoom(room, _currentRoom);
@@ -517,10 +500,8 @@ void Logic::setupRoom(const char *room, int comPanel, bool inCutaway) {
_vm->graphics()->setupNewRoom(room, _currentRoom, furn, furnTot);
_vm->display()->forceFullRefresh();
-
}
-
void Logic::displayRoom(uint16 room, RoomDisplayMode mode, uint16 scale, int comPanel, bool inCutaway) {
debug(6, "Logic::displayRoom(%d, %d, %d, %d, %d)", room, mode, scale, comPanel, inCutaway);
@@ -545,7 +526,6 @@ void Logic::displayRoom(uint16 room, RoomDisplayMode mode, uint16 scale, int com
}
}
-
ActorData *Logic::findActor(uint16 noun, const char *name) {
uint16 obj = currentRoomData() + noun;
int16 img = objectData(obj)->image;
@@ -572,7 +552,6 @@ ActorData *Logic::findActor(uint16 noun, const char *name) {
return NULL;
}
-
bool Logic::initPerson(uint16 noun, const char *actorName, bool loadBank, Person *pp) {
ActorData *pad = findActor(noun, actorName);
if (pad != NULL) {
@@ -593,7 +572,6 @@ bool Logic::initPerson(uint16 noun, const char *actorName, bool loadBank, Person
return pad != NULL;
}
-
uint16 Logic::findPersonNumber(uint16 obj) const {
uint16 num = 0;
uint16 i;
@@ -606,7 +584,6 @@ uint16 Logic::findPersonNumber(uint16 obj) const {
return num;
}
-
void Logic::loadJoeBanks(const char *animBank, const char *standBank) {
int i;
_vm->bankMan()->load(animBank, 13);
@@ -621,14 +598,12 @@ void Logic::loadJoeBanks(const char *animBank, const char *standBank) {
_vm->bankMan()->unpack(5, 35 + FRAMES_JOE_XTRA, 7);
}
-
void Logic::setupJoe() {
loadJoeBanks("joe_a.BBK", "joe_b.BBK");
joePrevFacing(DIR_FRONT);
joeFacing(DIR_FRONT);
}
-
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);
WalkOffData *pwo = NULL;
@@ -717,7 +692,6 @@ ObjectData *Logic::setupJoeInRoom(bool autoPosition, uint16 scale) {
return NULL;
}
-
uint16 Logic::joeFace() {
debug(9, "Logic::joeFace() - curFace = %d, prevFace = %d", _joe.facing, _joe.prevFacing);
BobSlot *pbs = _vm->graphics()->bob(0);
@@ -765,7 +739,6 @@ uint16 Logic::joeFace() {
return frame;
}
-
void Logic::joeGrab(int16 grabState) {
uint16 frame = 0;
BobSlot *bobJoe = _vm->graphics()->bob(0);
@@ -822,7 +795,6 @@ void Logic::joeGrab(int16 grabState) {
}
}
-
void Logic::joeUseDress(bool showCut) {
if (showCut) {
joeFacing(DIR_FRONT);
@@ -840,7 +812,6 @@ void Logic::joeUseDress(bool showCut) {
gameState(VAR_DRESSING_MODE, 2);
}
-
void Logic::joeUseClothes(bool showCut) {
if (showCut) {
joeFacing(DIR_FRONT);
@@ -854,20 +825,17 @@ void Logic::joeUseClothes(bool showCut) {
gameState(VAR_DRESSING_MODE, 0);
}
-
void Logic::joeUseUnderwear() {
_vm->display()->palSetJoeNormal();
loadJoeBanks("JoeU_A.BBK", "JoeU_B.BBK");
gameState(VAR_DRESSING_MODE, 1);
}
-
void Logic::makePersonSpeak(const char *sentence, Person *person, const char *voiceFilePrefix) {
_vm->command()->clear(false);
Talk::speak(sentence, person, voiceFilePrefix, _vm);
}
-
void Logic::startDialogue(const char *dlgFile, int personInRoom, char *cutaway) {
char cutawayFile[20];
if (cutaway == NULL) {
@@ -880,7 +848,6 @@ void Logic::startDialogue(const char *dlgFile, int personInRoom, char *cutaway)
}
}
-
void Logic::playCutaway(const char *cutFile, char *next) {
char nextFile[20];
if (next == NULL) {
@@ -890,7 +857,6 @@ void Logic::playCutaway(const char *cutFile, char *next) {
Cutaway::run(cutFile, next, _vm);
}
-
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))
@@ -903,7 +869,6 @@ void Logic::makeJoeSpeak(uint16 descNum, bool objectType) {
makePersonSpeak(text, NULL, descFilePrefix);
}
-
uint16 Logic::findInventoryItem(int invSlot) const {
// queen.c l.3894-3898
if (invSlot >= 0 && invSlot < 4) {
@@ -912,7 +877,6 @@ uint16 Logic::findInventoryItem(int invSlot) const {
return 0;
}
-
void Logic::inventorySetup() {
_vm->bankMan()->load("objects.BBK", 14);
if (_vm->resource()->isInterview()) {
@@ -1003,7 +967,6 @@ void Logic::inventoryInsertItem(uint16 itemNum, bool refresh) {
inventoryRefresh();
}
-
void Logic::inventoryDeleteItem(uint16 itemNum, bool refresh) {
int16 item = (int16)itemNum;
_itemData[itemNum].name = -ABS(_itemData[itemNum].name); //set invisible
@@ -1017,7 +980,6 @@ void Logic::inventoryDeleteItem(uint16 itemNum, bool refresh) {
inventoryRefresh();
}
-
void Logic::inventoryScroll(uint16 count, bool up) {
if (!(numItemsInventory() > 4))
return;
@@ -1036,7 +998,6 @@ void Logic::inventoryScroll(uint16 count, bool up) {
inventoryRefresh();
}
-
void Logic::removeHotelItemsFromInventory() {
if (currentRoom() == 1 && gameState(3) == 0) {
inventoryDeleteItem(ITEM_CROWBAR, false);
@@ -1050,7 +1011,6 @@ void Logic::removeHotelItemsFromInventory() {
}
}
-
void Logic::objectCopy(int dummyObjectIndex, int realObjectIndex) {
// P3_COPY_FROM function in cutaway.c
/* Copy data from Dummy (D) object to object (K)
@@ -1109,7 +1069,6 @@ void Logic::objectCopy(int dummyObjectIndex, int realObjectIndex) {
}
}
-
void Logic::handleSpecialArea(Direction facing, uint16 areaNum, uint16 walkDataNum) {
// queen.c l.2838-2911
debug(9, "handleSpecialArea(%d, %d, %d)\n", facing, areaNum, walkDataNum);
@@ -1224,7 +1183,6 @@ void Logic::handleSpecialArea(Direction facing, uint16 areaNum, uint16 walkDataN
}
}
-
void Logic::handlePinnacleRoom() {
// camera does not follow Joe anymore
_vm->graphics()->putCameraOnBob(-1);
@@ -1324,7 +1282,6 @@ void Logic::handlePinnacleRoom() {
_vm->display()->palFadeOut(0, 223, ROOM_JUNGLE_PINNACLE);
}
-
void Logic::update() {
if (_credits)
_credits->update();
@@ -1334,7 +1291,6 @@ void Logic::update() {
}
}
-
void Logic::saveState(byte *&ptr) {
uint16 i;
for (i = 0; i < 4; i++) {
@@ -1370,7 +1326,6 @@ void Logic::saveState(byte *&ptr) {
_objectDescription[i].writeToBE(ptr);
}
-
void Logic::loadState(uint32 ver, byte *&ptr) {
uint16 i;
for (i = 0; i < 4; i++) {
@@ -1440,7 +1395,6 @@ void Logic::setupRestoredGame() {
inventoryRefresh();
}
-
void Logic::sceneStart() {
debug(6, "[Logic::sceneStart] _scene = %i", _scene);
_scene++;
@@ -1466,66 +1420,55 @@ void Logic::sceneStop() {
_vm->grid()->setupPanel();
}
-
void Logic::changeRoom() {
if (!preChangeRoom())
displayRoom(currentRoom(), RDM_FADE_JOE, 100, 1, false);
_vm->display()->showMouseCursor(true);
}
-
void Logic::executeSpecialMove(uint16 sm) {
debug(6, "Special move: %d", sm);
if (!handleSpecialMove(sm))
warning("unhandled / invalid special move : %d", sm);
}
-
void Logic::asmMakeJoeUseDress() {
joeUseDress(false);
}
-
void Logic::asmMakeJoeUseNormalClothes() {
joeUseClothes(false);
}
-
void Logic::asmMakeJoeUseUnderwear() {
joeUseUnderwear();
}
-
void Logic::asmSwitchToDressPalette() {
_vm->display()->palSetJoeDress();
}
-
void Logic::asmSwitchToNormalPalette() {
_vm->display()->palSetJoeNormal();
}
-
void Logic::asmStartCarAnimation() {
_vm->bam()->_flag = BamScene::F_PLAY;
_vm->bam()->prepareAnimation();
}
-
void Logic::asmStopCarAnimation() {
_vm->bam()->_flag = BamScene::F_STOP;
_vm->graphics()->bob(findBob(594))->active = false; // oil object
_vm->graphics()->bob(7)->active = false; // gun shots
}
-
void Logic::asmStartFightAnimation() {
_vm->bam()->_flag = BamScene::F_PLAY;
_vm->bam()->prepareAnimation();
gameState(148, 1);
}
-
void Logic::asmWaitForFrankPosition() {
_vm->bam()->_flag = BamScene::F_REQ_STOP;
while (_vm->bam()->_flag != BamScene::F_STOP) {
@@ -1533,7 +1476,6 @@ void Logic::asmWaitForFrankPosition() {
}
}
-
void Logic::asmMakeFrankGrowing() {
_vm->bankMan()->unpack(1, 38, 15);
BobSlot *bobFrank = _vm->graphics()->bob(5);
@@ -1558,7 +1500,6 @@ void Logic::asmMakeFrankGrowing() {
gameState(157, 1); // No more Ironstein
}
-
void Logic::asmMakeRobotGrowing() {
_vm->bankMan()->unpack(1, 38, 15);
BobSlot *bobRobot = _vm->graphics()->bob(5);
@@ -1579,7 +1520,6 @@ void Logic::asmMakeRobotGrowing() {
objectData(526)->name = -ABS(objectData(526)->name); // Frank object off
}
-
void Logic::asmShrinkRobot() {
int i;
BobSlot *robot = _vm->graphics()->bob(6);
@@ -1589,7 +1529,6 @@ void Logic::asmShrinkRobot() {
}
}
-
void Logic::asmEndGame() {
int i;
for (i = 0; i < 40; ++i) {
@@ -1599,7 +1538,6 @@ void Logic::asmEndGame() {
OSystem::instance()->quit();
}
-
void Logic::asmPutCameraOnDino() {
_vm->graphics()->putCameraOnBob(-1);
int16 scrollx = _vm->display()->horizontalScroll();
@@ -1614,12 +1552,10 @@ void Logic::asmPutCameraOnDino() {
_vm->graphics()->putCameraOnBob(1);
}
-
void Logic::asmPutCameraOnJoe() {
_vm->graphics()->putCameraOnBob(0);
}
-
void Logic::asmAltIntroPanRight() {
_vm->graphics()->putCameraOnBob(-1);
_vm->input()->fastMode(true);
@@ -1636,7 +1572,6 @@ void Logic::asmAltIntroPanRight() {
_vm->input()->fastMode(false);
}
-
void Logic::asmAltIntroPanLeft() {
_vm->graphics()->putCameraOnBob(-1);
_vm->input()->fastMode(true);
@@ -1652,12 +1587,10 @@ void Logic::asmAltIntroPanLeft() {
_vm->input()->fastMode(false);
}
-
void Logic::asmSetAzuraInLove() {
gameState(VAR_AZURA_IN_LOVE, 1);
}
-
void Logic::asmPanRightFromJoe() {
_vm->graphics()->putCameraOnBob(-1);
int16 scrollx = _vm->display()->horizontalScroll();
@@ -1671,23 +1604,19 @@ void Logic::asmPanRightFromJoe() {
}
}
-
void Logic::asmSetLightsOff() {
_vm->display()->palCustomLightsOff(currentRoom());
}
-
void Logic::asmSetLightsOn() {
_vm->display()->palCustomLightsOn(currentRoom());
}
-
void Logic::asmSetManequinAreaOn() {
Area *a = _vm->grid()->area(ROOM_FLODA_FRONTDESK, 7);
a->mapNeighbours = ABS(a->mapNeighbours);
}
-
void Logic::asmPanToJoe() {
int i = _vm->graphics()->bob(0)->x - 160;
if (i < 0) {
@@ -1720,12 +1649,10 @@ void Logic::asmPanToJoe() {
_vm->graphics()->putCameraOnBob(0);
}
-
void Logic::asmTurnGuardOn() {
gameState(85, 1);
}
-
void Logic::asmPanLeft320To144() {
_vm->graphics()->putCameraOnBob(-1);
int16 scrollx = _vm->display()->horizontalScroll();
@@ -1739,7 +1666,6 @@ void Logic::asmPanLeft320To144() {
}
}
-
void Logic::asmSmooch() {
_vm->graphics()->putCameraOnBob(-1);
BobSlot *bobAzura = _vm->graphics()->bob(5);
@@ -1759,7 +1685,6 @@ void Logic::asmSmooch() {
}
}
-
void Logic::asmMakeLightningHitPlane() {
_vm->graphics()->putCameraOnBob(-1);
short iy = 0, x, ydir = -1, j, k;
@@ -1840,7 +1765,6 @@ void Logic::asmMakeLightningHitPlane() {
_vm->graphics()->putCameraOnBob(0);
}
-
void Logic::asmScaleBlimp() {
int16 z = 256;
BobSlot *bob = _vm->graphics()->bob(7);
@@ -1860,7 +1784,6 @@ void Logic::asmScaleBlimp() {
}
}
-
void Logic::asmScaleEnding() {
_vm->graphics()->bob(7)->active = false; // Turn off blimp
BobSlot *b = _vm->graphics()->bob(20);
@@ -1877,7 +1800,6 @@ void Logic::asmScaleEnding() {
_vm->display()->palFadeOut(0, 255, currentRoom());
}
-
void Logic::asmWaitForCarPosition() {
// Wait for car to reach correct position before pouring oil
while (_vm->bam()->_index != 60) {
@@ -1885,7 +1807,6 @@ void Logic::asmWaitForCarPosition() {
}
}
-
void Logic::asmShakeScreen() {
_vm->display()->shake(false);
_vm->update();
@@ -1893,7 +1814,6 @@ void Logic::asmShakeScreen() {
_vm->update();
}
-
void Logic::asmAttemptPuzzle() {
++_puzzleAttemptCount;
if (_puzzleAttemptCount & 4) {
@@ -1902,7 +1822,6 @@ void Logic::asmAttemptPuzzle() {
}
}
-
void Logic::asmScaleTitle() {
BobSlot *bob = _vm->graphics()->bob(5);
bob->animating = false;
@@ -1918,7 +1837,6 @@ void Logic::asmScaleTitle() {
}
}
-
void Logic::asmPanRightToHugh() {
BobSlot *bob_thugA1 = _vm->graphics()->bob(20);
BobSlot *bob_thugA2 = _vm->graphics()->bob(21);
@@ -1980,12 +1898,10 @@ void Logic::asmPanRightToHugh() {
_vm->input()->fastMode(false);
}
-
void Logic::asmMakeWhiteFlash() {
_vm->display()->palCustomFlash();
}
-
void Logic::asmPanRightToJoeAndRita() { // cdint.cut
BobSlot *bob_box = _vm->graphics()->bob(20);
BobSlot *bob_beam = _vm->graphics()->bob(21);
@@ -2024,7 +1940,6 @@ void Logic::asmPanRightToJoeAndRita() { // cdint.cut
_vm->input()->fastMode(false);
}
-
void Logic::asmPanLeftToBomb() {
BobSlot *bob21 = _vm->graphics()->bob(21);
BobSlot *bob22 = _vm->graphics()->bob(22);
@@ -2054,13 +1969,11 @@ void Logic::asmPanLeftToBomb() {
_vm->input()->fastMode(false);
}
-
void Logic::asmEndDemo() {
debug(0, "Flight of the Amazon Queen, released January 95.");
OSystem::instance()->quit();
}
-
void Logic::asmInterviewIntro() {
// put camera on airship
_vm->graphics()->putCameraOnBob(5);
@@ -2101,7 +2014,6 @@ void Logic::asmInterviewIntro() {
_vm->graphics()->putCameraOnBob(0);
}
-
void Logic::asmEndInterview() {
debug(0, "Interactive Interview copyright (c) 1995, IBI.");
OSystem::instance()->quit();
@@ -2120,7 +2032,6 @@ void Logic::stopCredits() {
}
}
-
void LogicDemo::useJournal() {
makePersonSpeak("This is a demo, so I can't load or save games*14", NULL, "");
}
@@ -2231,7 +2142,7 @@ bool LogicGame::preChangeRoom() {
}
bool LogicGame::handleSpecialMove(uint16 sm) {
- typedef void (Logic::*SpecialMoveProc)();
+ typedef void (LogicGame::*SpecialMoveProc)();
static const SpecialMoveProc asmTable[] = {
/* 00 */
0,
diff --git a/queen/logic.h b/queen/logic.h
index 8c283e1cf6..f2a6ffdce1 100644
--- a/queen/logic.h
+++ b/queen/logic.h
@@ -55,35 +55,24 @@ public:
uint16 currentRoom() const { return _currentRoom; }
void currentRoom(uint16 room) {
- if (room >= 1 && room <= _numRooms)
- _currentRoom = room;
- else
- error("Invalid room number: %i", room);
+ assert(room >= 1 && room <= _numRooms);
+ _currentRoom = room;
}
uint16 oldRoom() const { return _oldRoom; }
void oldRoom(uint16 room) {
- if (room <= _numRooms)
- _oldRoom = room;
- else
- error("Invalid room number: %i", room);
+ assert(room <= _numRooms);
+ _oldRoom = room;
}
uint16 newRoom() const { return _newRoom; }
void newRoom(uint16 room) {
- if (room <= _numRooms)
- _newRoom = room;
- else
- error("Invalid room number: %i", room);
+ assert(room <= _numRooms);
+ _newRoom = room;
}
- bool isAltIntroRoom(uint16 room) const {
- return room >= 90 && room <= 94;
- }
-
- bool isIntroRoom(uint16 room) const {
- return room >= 115 && room <= 125;
- }
+ static bool isAltIntroRoom(uint16 room) { return room >= 90 && room <= 94; }
+ static bool isIntroRoom(uint16 room) { return room >= 115 && room <= 125; }
ObjectData *objectData(int index) const;
uint16 roomData(int room) const { return _roomData[room]; }
@@ -128,13 +117,7 @@ public:
TalkSelected *talkSelected(int index) { return _talkSelected + index; }
- const char *roomName(uint16 roomNum) const {
- if (roomNum >= 1 && roomNum <= _numRooms)
- return _roomName[roomNum];
- else
- error("Invalid room number: %i", roomNum);
- }
-
+ const char *roomName(uint16 roomNum) const;
const char *objectName(uint16 objNum) const { return _objName[objNum]; }
const char *objectTextualDescription(uint16 objNum) const { return _objDescription[objNum]; }
diff --git a/queen/talk.cpp b/queen/talk.cpp
index b200fa8e7f..d51dafe1db 100644
--- a/queen/talk.cpp
+++ b/queen/talk.cpp
@@ -413,9 +413,6 @@ void Talk::load(const char *filename) {
int i;
byte *ptr = _fileData = loadDialogFile(filename);
- if (!_fileData) {
- error("Failed to load resource data file '%s'", filename);
- }
bool canQuit;
diff --git a/queen/walk.cpp b/queen/walk.cpp
index 4bfa62e03f..1df150ac17 100644
--- a/queen/walk.cpp
+++ b/queen/walk.cpp
@@ -23,6 +23,7 @@
#include "queen/walk.h"
#include "queen/bankman.h"
+#include "queen/input.h"
#include "queen/logic.h"
#include "queen/graphics.h"
#include "queen/grid.h"
@@ -30,7 +31,6 @@
namespace Queen {
-
const MovePersonData Walk::_moveData[] = {
{"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},
@@ -55,13 +55,10 @@ const MovePersonData Walk::_moveData[] = {
{"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
-
-
Walk::Walk(QueenEngine *vm)
: _vm(vm) {
}
-
void Walk::animateJoePrepare() {
// queen.c l.2748-2788
uint16 i;
@@ -99,7 +96,6 @@ void Walk::animateJoePrepare() {
}
}
-
void Walk::animateJoe() {
// queen.c l.2789-2835
uint16 lastDirection = 0;
@@ -139,12 +135,9 @@ void Walk::animateJoe() {
pbs->speed = 1;
}
_vm->update(true);
- // FIXME it would nice to be able to get rid of these 3 lines
- // as stopJoe() should be do the same...
- if (_vm->logic()->joeWalk() == JWM_EXECUTE) { // XXX || cutQuit
- // we are about to do something else, so stop walking
- _joeInterrupted = true;
- pbs->moving = false;
+ if (_vm->input()->cutawayQuit() || _vm->logic()->joeWalk() == JWM_EXECUTE) {
+ stopJoe();
+ break;
}
}
lastDirection = pwd->anim.facing;
@@ -152,7 +145,6 @@ void Walk::animateJoe() {
_vm->logic()->joeFacing(lastDirection);
}
-
void Walk::animatePersonPrepare(const MovePersonData *mpd, int direction) {
// queen.c l.2469-2572
int i;
@@ -218,7 +210,6 @@ 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);
@@ -271,12 +262,14 @@ void Walk::animatePerson(const MovePersonData *mpd, uint16 image, uint16 bobNum,
if (pbs->speed == 0) {
pbs->speed = 1;
}
- // XXX if (cutQuit)
+ if (_vm->input()->cutawayQuit()) {
+ stopPerson(bobNum);
+ break;
+ }
}
}
}
-
int16 Walk::moveJoe(int direction, int16 endx, int16 endy, bool inCutaway) {
_joeInterrupted = false;
_joeMoveBlock = false;
@@ -327,7 +320,6 @@ int16 Walk::moveJoe(int direction, int16 endx, int16 endy, bool inCutaway) {
return can;
}
-
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");
@@ -391,12 +383,18 @@ int16 Walk::movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage
return can;
}
-
void Walk::stopJoe() {
- _vm->graphics()->bob(0)->moving = false;
+ BobSlot *pbs = _vm->graphics()->bob(0);
+ pbs->moving = false;
_joeInterrupted = true;
}
+void Walk::stopPerson(uint16 bobNum) {
+ BobSlot *pbs = _vm->graphics()->bob(bobNum);
+ pbs->x = pbs->endx;
+ pbs->y = pbs->endy;
+ pbs->moving = false;
+}
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
@@ -434,7 +432,6 @@ bool Walk::calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, i
return false;
}
-
int16 Walk::calcC(int16 c1, int16 c2, int16 c3, int16 c4, int16 lastc) {
int16 s1 = MAX(c1, c3);
int16 s2 = MIN(c2, c4);
@@ -447,7 +444,6 @@ int16 Walk::calcC(int16 c1, int16 c2, int16 c3, int16 c4, int16 lastc) {
return c;
}
-
int16 Walk::findAreaPosition(int16 *x, int16 *y, bool recalibrate) {
// FIXME - in order to locate the nearest available area, the original
// algorithm computes the X (or Y) closest face distance for each available
@@ -500,7 +496,6 @@ int16 Walk::findAreaPosition(int16 *x, int16 *y, bool recalibrate) {
return pos;
}
-
uint16 Walk::findFreeArea(uint16 area) const {
uint16 testArea;
uint16 freeArea = 0;
@@ -519,7 +514,6 @@ uint16 Walk::findFreeArea(uint16 area) const {
return freeArea;
}
-
bool Walk::isAreaStruck(uint16 area) const {
uint16 i;
bool found = false;
@@ -532,7 +526,6 @@ bool Walk::isAreaStruck(uint16 area) const {
return found;
}
-
bool Walk::calcPath(uint16 oldArea, uint16 newArea) {
debug(9, "Walk::calcPath(%d, %d)", oldArea, newArea);
_areaList[1] = _areaStrike[1] = oldArea;
@@ -557,7 +550,6 @@ bool Walk::calcPath(uint16 oldArea, uint16 newArea) {
return _areaList[1] != 0;
}
-
void Walk::initWalkData() {
uint16 curRoom = _vm->logic()->currentRoom();
_roomArea = _vm->grid()->area(curRoom, 0);
@@ -571,7 +563,6 @@ void Walk::initWalkData() {
memset(_areaList, 0, sizeof(_areaList));
}
-
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) {
@@ -584,5 +575,4 @@ void Walk::incWalkData(int16 px, int16 py, int16 x, int16 y, uint16 areaNum) {
}
}
-
} // End of namespace Queen
diff --git a/queen/walk.h b/queen/walk.h
index 2f63278afa..1f9244193d 100644
--- a/queen/walk.h
+++ b/queen/walk.h
@@ -27,7 +27,6 @@
namespace Queen {
-
struct MovePersonAnim {
int16 firstFrame;
int16 lastFrame;
@@ -40,7 +39,6 @@ struct MovePersonAnim {
}
};
-
struct WalkData {
int16 dx, dy;
const Area *area;
@@ -48,7 +46,6 @@ struct WalkData {
MovePersonAnim anim;
};
-
struct MovePersonData {
const char *name;
int16 walkLeft1, walkLeft2;
@@ -61,7 +58,6 @@ struct MovePersonData {
uint16 moveSpeed;
};
-
class QueenEngine;
class Walk {
@@ -73,13 +69,12 @@ public:
int16 movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage, int direction);
void stopJoe();
-
+ void stopPerson(uint16 bobNum);
enum {
MAX_WALK_DATA = 16
};
-
private:
void animateJoePrepare();
@@ -133,11 +128,9 @@ private:
QueenEngine *_vm;
-
static const MovePersonData _moveData[];
};
-
} // End of namespace Queen
#endif