aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Montoir2003-10-12 13:16:35 +0000
committerGregory Montoir2003-10-12 13:16:35 +0000
commit1e6837281653c8e38afde8c6580592b43a8a71d9 (patch)
treea2eb95ed5ff459e463962459edf6fbbcd19a3f60
parent70667d14daa4cbecccc56ac62352107381145203 (diff)
downloadscummvm-rg350-1e6837281653c8e38afde8c6580592b43a8a71d9.tar.gz
scummvm-rg350-1e6837281653c8e38afde8c6580592b43a8a71d9.tar.bz2
scummvm-rg350-1e6837281653c8e38afde8c6580592b43a8a71d9.zip
DISP_ROOM additions/corrections
svn-id: r10743
-rw-r--r--queen/logic.cpp78
-rw-r--r--queen/logic.h18
-rw-r--r--queen/walk.cpp11
-rw-r--r--queen/walk.h2
4 files changed, 70 insertions, 39 deletions
diff --git a/queen/logic.cpp b/queen/logic.cpp
index 8884edf76f..bed16e608a 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -220,6 +220,7 @@ void Logic::initialise() {
memset(_zones, 0, sizeof(_zones));
_oldRoom = 0;
+ _entryObj = 0;
}
uint16 Logic::currentRoom() {
@@ -360,7 +361,7 @@ uint16 Logic::findBob(uint16 obj) {
else {
// animated bob
if(idxAnimated > 0) {
- bobnum = 4 + _numFurnitureAnimated + _numFurnitureAnimatedLen;
+ bobnum = 4 + _numFurnitureAnimated + idxAnimated;
}
}
}
@@ -385,7 +386,7 @@ uint16 Logic::findFrame(uint16 obj) {
}
}
if(bobnum <= 3) {
- framenum = 29 + FRAMES_JOE_XTRA;
+ framenum = 29 + FRAMES_JOE_XTRA + bobnum;
}
}
else {
@@ -399,6 +400,7 @@ uint16 Logic::findFrame(uint16 obj) {
idx += ABS(pgd->lastFrame) - pgd->firstFrame + 1;
}
else {
+ // static bob, skip one frame
++idx;
}
}
@@ -439,7 +441,7 @@ uint16 Logic::findFrame(uint16 obj) {
// calculate only if there are person frames
if(idx > 0) {
- framenum = 36 + _numFurnitureStatic + _numFurnitureAnimatedLen + idx + FRAMES_JOE_XTRA;
+ framenum = 36 + FRAMES_JOE_XTRA + _numFurnitureStatic + _numFurnitureAnimatedLen + idx;
}
}
return framenum;
@@ -636,7 +638,7 @@ void Logic::roomErase() {
}
-uint16 Logic::roomSetupFurniture(uint16 frames) {
+void Logic::roomSetupFurniture() {
_numFurnitureStatic = 0;
_numFurnitureAnimated = 0;
_numFurnitureAnimatedLen = 0;
@@ -652,17 +654,17 @@ uint16 Logic::roomSetupFurniture(uint16 frames) {
// _gameState[furnitureTotal] = _furnitureData[i].gameStateValue;
// }
// }
-// if (furnitureTotal == 0) {
-// return;
-// }
+ if (furnitureTotal == 0) {
+ return;
+ }
// unpack the furniture from the bank 15
// there are 3 kinds :
- // - static (paste downs), gamestate range = ]0;5000]
+ // - static (bobs), gamestate range = ]0;5000]
// - animated (bobs), gamestate range = ]0;5000]
- // - static (overlaying paste downs), gamestate range = [5000; [
+ // - static (paste downs), gamestate range = [5000; [
- // unpack the paste downs
+ // unpack the static bobs
for (i = 1; i <= furnitureTotal; ++i) {
int16 obj = _gameState[i];
if (obj > 0 && obj <= 5000) {
@@ -671,13 +673,12 @@ uint16 Logic::roomSetupFurniture(uint16 frames) {
++_numFurnitureStatic;
++curImage;
_graphics->bankUnpack(pgd->firstFrame, curImage, 15);
- ++frames;
+ ++_numFrames;
BobSlot *pbs = _graphics->bob(19 + _numFurnitureStatic);
pbs->active = true;
pbs->x = pgd->x;
pbs->y = pgd->y;
pbs->frameNum = curImage;
- warning("Logic::roomSetupFurniture() : static furniture instead of animated");
}
}
}
@@ -704,7 +705,7 @@ uint16 Logic::roomSetupFurniture(uint16 frames) {
for (k = pgd->firstFrame; k <= pgd->lastFrame; ++k) {
++curImage;
_graphics->bankUnpack(k, curImage, 15);
- ++frames;
+ ++_numFrames;
}
_graphics->bobAnimNormal(5 + curBob, image, curImage, pgd->speed / 4, rebound, false);
BobSlot *pbs = _graphics->bob(5 + curBob);
@@ -715,7 +716,7 @@ uint16 Logic::roomSetupFurniture(uint16 frames) {
}
}
- // unpack the overlaying paste downs
+ // unpack the paste downs
++curImage;
for (i = 1; i <= furnitureTotal; ++i) {
int16 obj = _gameState[i];
@@ -724,15 +725,40 @@ uint16 Logic::roomSetupFurniture(uint16 frames) {
GraphicData *pgd = &_graphicData[obj];
_graphics->bankUnpack(pgd->firstFrame, curImage, 15);
_graphics->bobPaste(curImage, pgd->x, pgd->y);
+ // no need to increment curImage here, as bobPaste() destroys the
+ // unpacked frame after blitting it
}
}
-
- return frames;
}
void Logic::roomSetupObjects() {
- warning("Logic::roomSetupObjects() unimplemented");
+ warning("Logic::roomSetupObjects() not fully implemented");
+
+ uint16 i;
+ uint16 curImage = 36 + FRAMES_JOE_XTRA + _numFurnitureStatic + _numFurnitureAnimatedLen;
+ uint16 firstRoomObj = _roomData[_currentRoom] + 1;
+ uint16 lastRoomObj = _roomData[_currentRoom + 1];
+
+ for (i = 1; i <= 3; ++i) {
+ _graphics->bob(i)->active = false;
+ }
+
+ // TODO: bobs static/animated
+ // TODO: bobs persons
+
+ // paste downs list
+ ++curImage;
+ _numFrames = curImage;
+ for (i = firstRoomObj; i <= lastRoomObj; ++i) {
+ int16 obj = _objectData[i].image;
+ if (obj > 5000) {
+ obj -= 5000;
+ GraphicData *pgd = &_graphicData[obj];
+ _graphics->bankUnpack(pgd->firstFrame, curImage, 15);
+ _graphics->bobPaste(curImage, pgd->x, pgd->y);
+ }
+ }
}
@@ -756,27 +782,25 @@ void Logic::roomSetup(const char* room, int comPanel, bool inCutaway) {
Common::String bkFile(room);
bkFile += ".BBK";
_graphics->bankLoad(bkFile.c_str(), 15);
- roomSetupFurniture(37 + FRAMES_JOE_XTRA);
+ _numFrames = 37 + FRAMES_JOE_XTRA;
+ roomSetupFurniture();
roomSetupObjects();
}
-void Logic::roomDisplay(const char* room, int state, uint16 scale, int comPanel, bool inCutaway) {
- // STATE = 0, Fade in, no Joe
- // = 1, if Joe is to be displayed
- // = 2, Screen does not dissolve into view
- // = 3, Display Joe at the current X, Y coords
+void Logic::roomDisplay(const char* room, RoomDisplayMode mode, uint16 scale, int comPanel, bool inCutaway) {
+
+ debug(9, "Logic::roomDisplay(%s, %d, %d, %d, %d)", room, mode, scale, comPanel, inCutaway);
roomErase();
// TODO: _sound->loadSFX(SFXNAME[_currentRoom]);
roomSetup(room, comPanel, inCutaway);
zoneSetup();
ObjectData *pod = NULL;
- if (state != 0) {
- _entryObj = _roomData[70] + 1; // TEMP
- pod = _walk->joeSetupInRoom(state, scale, _entryObj);
+ if (mode != RDM_FADE_NOJOE) {
+ pod = _walk->joeSetupInRoom(mode != RDM_FADE_JOE_XY, scale);
}
- if (state != 2) {
+ if (mode != RDM_NOFADE_JOE) {
_graphics->update();
// TODO: _display->fadeIn();
}
diff --git a/queen/logic.h b/queen/logic.h
index 86934b3dd6..51a34fe662 100644
--- a/queen/logic.h
+++ b/queen/logic.h
@@ -38,7 +38,10 @@ enum Language {
};
enum RoomDisplayMode {
-
+ RDM_FADE_NOJOE = 0, // fade in, no Joe
+ RDM_FADE_JOE = 1, // Joe is to be displayed
+ RDM_NOFADE_JOE = 2, // screen does not dissolve into view
+ RDM_FADE_JOE_XY = 3 // display Joe at the current X, Y coords
};
struct ZoneSlot {
@@ -65,8 +68,8 @@ public:
uint16 objMax(int room);
GraphicData* graphicData(int index);
- uint16 findBob(uint16 obj); // FIXME: move that to QueenDisplay ?
- uint16 findFrame(uint16 obj); // FIXME: move that to QueenDisplay ?
+ uint16 findBob(uint16 obj);
+ uint16 findFrame(uint16 obj);
uint16 objectForPerson(uint16 bobnum);
WalkOffData *walkOffPointForObject(uint16 obj);
@@ -102,13 +105,16 @@ public:
void zoneSetup();
void roomErase();
- uint16 roomSetupFurniture(uint16 frames); // SETUP_FURNITURE()
+ void roomSetupFurniture(); // SETUP_FURNITURE()
void roomSetupObjects(); // DISP_OBJECTS
void roomSetup(const char* room, int comPanel, bool inCutaway);
- void roomDisplay(const char* room, int state, uint16 joeScale, int comPanel, bool inCutaway); // DISP_ROOM
+ void roomDisplay(const char* room, RoomDisplayMode mode, uint16 joeScale, int comPanel, bool inCutaway); // DISP_ROOM
uint16 findScale(uint16 x, uint16 y);
+ int16 entryObj() const { return _entryObj; }
+ void entryObj(int16 obj) { _entryObj = obj; }
+
protected:
uint8 *_jas;
@@ -157,9 +163,11 @@ protected:
uint16 _numFurnitureAnimated; // FMAXA
uint16 _numFurnitureStatic; // FMAX
uint16 _numFurnitureAnimatedLen; // FMAXLEN
+ uint16 _numFrames; // FRAMES
Resource *_resource;
Graphics *_graphics;
+public:
Walk *_walk;
void initialise();
diff --git a/queen/walk.cpp b/queen/walk.cpp
index 6b060d85d7..26678e3a25 100644
--- a/queen/walk.cpp
+++ b/queen/walk.cpp
@@ -303,7 +303,6 @@ void Walk::animatePerson(const MovePersonData *mpd, const Person *pp) {
uint16 i;
for (i = 1; i <= _walkDataCount; ++i) {
-// MovePersonAnim *mpa = &_moveAnim[i];
WalkData *pwd = &_walkData[i];
// unpack necessary frames for bob animation
uint16 dstFrame = pp->image;
@@ -364,25 +363,25 @@ void Walk::joeSetup() {
}
-ObjectData *Walk::joeSetupInRoom(int state, uint16 scale, uint16 entryObj) {
+ObjectData *Walk::joeSetupInRoom(bool autoPosition, uint16 scale) {
// queen.c SETUP_HERO()
uint16 oldx;
uint16 oldy;
WalkOffData *pwo = NULL;
- ObjectData *pod = _logic->objectData(entryObj);
+ ObjectData *pod = _logic->objectData(_logic->entryObj());
if (pod == NULL) {
- error("Walk::joeSetupInRoom() - No object data for obj %d", entryObj);
+ error("Walk::joeSetupInRoom() - No object data for obj %d", _logic->entryObj());
}
- if (state == 3 || _logic->joeX() != 0 || _logic->joeY()) {
+ if (!autoPosition || _logic->joeX() != 0 || _logic->joeY() != 0) {
oldx = _logic->joeX();
oldy = _logic->joeY();
}
else {
// find the walk off point for the entry object and make
// Joe walking to that point
- pwo = _logic->walkOffPointForObject(entryObj);
+ pwo = _logic->walkOffPointForObject(_logic->entryObj());
if (pwo != NULL) {
oldx = pwo->x;
oldy = pwo->y;
diff --git a/queen/walk.h b/queen/walk.h
index f1f9615eef..54d502f65a 100644
--- a/queen/walk.h
+++ b/queen/walk.h
@@ -86,7 +86,7 @@ public:
void joeSetup();
//! SETUP_HERO(), places Joe at the right place when entering a room
- ObjectData *joeSetupInRoom(int state, uint16 scale, uint16 entryObj);
+ ObjectData *joeSetupInRoom(bool autoPosition, uint16 scale);
//! MOVE_JOE()
void joeMove(int direction, uint16 endx, uint16 endy, bool inCutaway);