aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Montoir2004-01-06 09:29:33 +0000
committerGregory Montoir2004-01-06 09:29:33 +0000
commitd62d44d29cd4a437c0caf061239a7da542c33918 (patch)
tree59d4120e76d30059061accbd3d78cac0b58ed742
parent1e0c78d9a2f2fde032f5dd9e65c3ba710980ea53 (diff)
downloadscummvm-rg350-d62d44d29cd4a437c0caf061239a7da542c33918.tar.gz
scummvm-rg350-d62d44d29cd4a437c0caf061239a7da542c33918.tar.bz2
scummvm-rg350-d62d44d29cd4a437c0caf061239a7da542c33918.zip
simplified room switching code a bit
svn-id: r12165
-rw-r--r--queen/display.cpp20
-rw-r--r--queen/display.h2
-rw-r--r--queen/graphics.cpp20
-rw-r--r--queen/graphics.h4
-rw-r--r--queen/journal.cpp6
-rw-r--r--queen/logic.cpp55
6 files changed, 53 insertions, 54 deletions
diff --git a/queen/display.cpp b/queen/display.cpp
index 15351be3e1..0091993bc5 100644
--- a/queen/display.cpp
+++ b/queen/display.cpp
@@ -30,7 +30,8 @@ namespace Queen {
Display::Display(QueenEngine *vm, OSystem *system)
- : _horizontalScroll(0), _system(system), _vm(vm) {
+ : _fullscreen(true), _horizontalScroll(0), _bdWidth(0), _bdHeight(0),
+ _system(system), _vm(vm) {
_dynalum.prevColMask = 0xFF;
initFont();
@@ -635,6 +636,22 @@ void Display::update(bool dynalum, int16 dynaX, int16 dynaY) {
}
+void Display::setupNewRoom(const char *name, uint16 room) {
+ dynalumInit(name, room);
+
+ char filename[20];
+ sprintf(filename, "%s.PCX", name);
+ uint8 *pcxbuf = _vm->resource()->loadFile(filename);
+ uint32 size = _vm->resource()->fileSize(filename);
+ readPCXBackdrop(pcxbuf, size, room > 114);
+ delete[] pcxbuf;
+
+ palCustomColors(room);
+
+ forceFullRefresh();
+}
+
+
void Display::drawBobSprite(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h, uint16 pitch, bool xflip) {
blit(_screenBuf, SCREEN_W, x, y, data, pitch, w, h, xflip, true);
setDirtyBlock(xflip ? (x - w + 1) : x, y, w, h);
@@ -910,6 +927,7 @@ void Display::blankScreen() {
};
(this->*effects[current])();
current = (current + 1) % ARRAYSIZE(effects);
+ forceFullRefresh();
}
diff --git a/queen/display.h b/queen/display.h
index ae3708d5dc..b4d5249d2d 100644
--- a/queen/display.h
+++ b/queen/display.h
@@ -59,6 +59,8 @@ public:
void prepareUpdate();
void update(bool dynalum = false, int16 dynaX = 0, int16 dynaY = 0);
+ void setupNewRoom(const char *name, uint16 room);
+
void drawBobSprite(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h, uint16 pitch, bool xflip);
void drawBobPasteDown(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h);
void drawInventoryItem(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h);
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index f55e268d0b..72080ce77e 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -668,26 +668,6 @@ uint16 Graphics::textWidth(const char* text) const {
}
-void Graphics::loadBackdrop(const char* name, uint16 room) {
- char roomPrefix[20];
- strcpy(roomPrefix, name);
- roomPrefix[ strlen(roomPrefix) - 4 ] = '\0';
- _vm->display()->dynalumInit(roomPrefix, room);
-
- uint8 *pcxbuf = _vm->resource()->loadFile(name);
- if (pcxbuf == NULL) {
- error("Unable to load backdrop : '%s'", name);
- }
- uint32 size = _vm->resource()->fileSize(name);
- _vm->display()->readPCXBackdrop(pcxbuf, size, room > 114);
- delete[] pcxbuf;
-
- if (room >= 90) {
- _cameraBob = 0;
- }
-}
-
-
void Graphics::loadPanel() {
uint8 *pcxbuf = _vm->resource()->loadFile("panel.pcx");
if (pcxbuf == NULL) {
diff --git a/queen/graphics.h b/queen/graphics.h
index f056bf20a8..f6982ed3d4 100644
--- a/queen/graphics.h
+++ b/queen/graphics.h
@@ -179,11 +179,9 @@ public:
int textCenterX(const char *text) const; // MIDDLE()
void textColor(uint16 y, uint8 color) { _texts[y].color = color; }
- void loadBackdrop(const char *name, uint16 room);
void loadPanel();
- void cameraBob(int bobNum) { _cameraBob = bobNum; }
- int cameraBob() const { return _cameraBob; }
+ void putCameraOnBob(int bobNum) { _cameraBob = bobNum; }
void update(uint16 room);
diff --git a/queen/journal.cpp b/queen/journal.cpp
index d0ad8c96fe..5a2705fb28 100644
--- a/queen/journal.cpp
+++ b/queen/journal.cpp
@@ -88,7 +88,7 @@ void Journal::use() {
_vm->logic()->writeOptionSettings();
_vm->graphics()->textClear(0, GAME_SCREEN_HEIGHT - 1);
- _vm->graphics()->cameraBob(0);
+ _vm->graphics()->putCameraOnBob(0);
if (_quitCleanly) {
restore();
}
@@ -99,7 +99,7 @@ void Journal::prepare() {
_vm->display()->horizontalScroll(0);
_vm->display()->fullscreen(true);
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
_vm->graphics()->bobClearAll();
_vm->graphics()->textClear(0, GAME_SCREEN_HEIGHT - 1);
_vm->bankMan()->eraseAllFrames(false);
@@ -122,7 +122,7 @@ void Journal::prepare() {
_vm->logic()->zoneSet(ZONE_ROOM, ZN_VOICE_TOGGLE, 158 - 24, 155, 168, 164);
_vm->logic()->zoneSet(ZONE_ROOM, ZN_TEXT_TOGGLE, 125 - 16, 168, 135, 177);
- _vm->graphics()->loadBackdrop("journal.PCX", JOURNAL_ROOM);
+ _vm->display()->setupNewRoom("journal", JOURNAL_ROOM);
_vm->bankMan()->load("journal.BBK", JOURNAL_BANK);
for (i = 1; i <= 20; ++i) {
int frameNum = JOURNAL_FRAMES + i;
diff --git a/queen/logic.cpp b/queen/logic.cpp
index 26f0b9b913..3b6657f1c4 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -953,13 +953,8 @@ uint16 Logic::roomRefreshObject(uint16 obj) {
void Logic::roomSetup(const char *room, int comPanel, bool inCutaway) {
- // loads background image
- char filename[20];
- sprintf(filename, "%s.PCX", room);
- _vm->graphics()->loadBackdrop(filename, _currentRoom);
-
- // custom colors
- _vm->display()->palCustomColors(_currentRoom);
+ // load backdrop image, init dynalum, setup colors
+ _vm->display()->setupNewRoom(room, _currentRoom);
// setup graphics to enter fullscreen/panel mode
_vm->display()->screenMode(comPanel, inCutaway);
@@ -968,6 +963,7 @@ void Logic::roomSetup(const char *room, int comPanel, bool inCutaway) {
_vm->graphics()->bobClearAll();
// load/setup objects associated to this room
+ char filename[20];
sprintf(filename, "%s.BBK", room);
_vm->bankMan()->load(filename, 15);
@@ -977,6 +973,10 @@ void Logic::roomSetup(const char *room, int comPanel, bool inCutaway) {
roomSetupObjects();
_vm->display()->forceFullRefresh();
+
+ if (_currentRoom >= 90) {
+ _vm->graphics()->putCameraOnBob(0);
+ }
}
@@ -1338,6 +1338,7 @@ void Logic::joeSetupFromBanks(const char *animBank, const char *standBank) {
void Logic::joeSetup() {
joeSetupFromBanks("joe_a.BBK", "joe_b.BBK");
+ joePrevFacing(DIR_FRONT);
joeFacing(DIR_FRONT);
}
@@ -1409,7 +1410,7 @@ ObjectData *Logic::joeSetupInRoom(bool autoPosition, uint16 scale) {
pbs->scale = joeScale();
if (_currentRoom == 108) {
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
_vm->bankMan()->load("joe_e.act", 7);
_vm->bankMan()->unpack(2, 29 + FRAMES_JOE_XTRA, 7);
@@ -1984,7 +1985,7 @@ void Logic::customMoveJoe(int facing, uint16 areaNum, uint16 walkDataNum) {
void Logic::handlePinnacleRoom() {
// camera does not follow Joe anymore
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
roomDisplay(ROOM_JUNGLE_PINNACLE, RDM_NOFADE_JOE, 100, 2, true);
BobSlot *joe = _vm->graphics()->bob(6);
@@ -2076,7 +2077,7 @@ void Logic::handlePinnacleRoom() {
_vm->graphics()->textClear(5, 5);
// camera follows Joe again
- _vm->graphics()->cameraBob(0);
+ _vm->graphics()->putCameraOnBob(0);
_vm->display()->palFadeOut(0, 223, ROOM_JUNGLE_PINNACLE);
}
@@ -2686,7 +2687,7 @@ void Logic::asmEndGame() {
void Logic::asmPutCameraOnDino() {
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
int16 scrollx = _vm->display()->horizontalScroll();
while (scrollx < 320) {
scrollx += 16;
@@ -2696,17 +2697,17 @@ void Logic::asmPutCameraOnDino() {
_vm->display()->horizontalScroll(scrollx);
update();
}
- _vm->graphics()->cameraBob(1);
+ _vm->graphics()->putCameraOnBob(1);
}
void Logic::asmPutCameraOnJoe() {
- _vm->graphics()->cameraBob(0);
+ _vm->graphics()->putCameraOnBob(0);
}
void Logic::asmAltIntroPanRight() {
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
_vm->input()->fastMode(true);
update();
int16 scrollx = _vm->display()->horizontalScroll();
@@ -2723,7 +2724,7 @@ void Logic::asmAltIntroPanRight() {
void Logic::asmAltIntroPanLeft() {
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
_vm->input()->fastMode(true);
int16 scrollx = _vm->display()->horizontalScroll();
while (scrollx > 0 && !_vm->input()->cutawayQuit()) {
@@ -2744,7 +2745,7 @@ void Logic::asmSetAzuraInLove() {
void Logic::asmPanRightFromJoe() {
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
int16 scrollx = _vm->display()->horizontalScroll();
while (scrollx < 320) {
scrollx += 16;
@@ -2780,7 +2781,7 @@ void Logic::asmPanToJoe() {
} else if (i > 320) {
i = 320;
}
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
int16 scrollx = _vm->display()->horizontalScroll();
if (i < scrollx) {
while (scrollx > i) {
@@ -2802,7 +2803,7 @@ void Logic::asmPanToJoe() {
}
update();
}
- _vm->graphics()->cameraBob(0);
+ _vm->graphics()->putCameraOnBob(0);
}
@@ -2812,7 +2813,7 @@ void Logic::asmTurnGuardOn() {
void Logic::asmPanLeft320To144() {
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
int16 scrollx = _vm->display()->horizontalScroll();
while (scrollx > 144) {
scrollx -= 8;
@@ -2826,7 +2827,7 @@ void Logic::asmPanLeft320To144() {
void Logic::asmSmooch() {
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
BobSlot *bobAzura = _vm->graphics()->bob(5);
BobSlot *bobJoe = _vm->graphics()->bob(6);
int16 scrollx = _vm->display()->horizontalScroll();
@@ -2846,7 +2847,7 @@ void Logic::asmSmooch() {
void Logic::asmMakeLightningHitPlane() {
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
short iy = 0, x, ydir = -1, j, k;
BobSlot *planeBob = _vm->graphics()->bob(5);
@@ -2922,7 +2923,7 @@ void Logic::asmMakeLightningHitPlane() {
update();
}
- _vm->graphics()->cameraBob(0);
+ _vm->graphics()->putCameraOnBob(0);
}
@@ -3014,7 +3015,7 @@ void Logic::asmPanRightToHugh() {
BobSlot *bob_thugB1 = _vm->graphics()->bob(25);
BobSlot *bob_thugB2 = _vm->graphics()->bob(26);
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
_vm->input()->fastMode(true);
update();
@@ -3078,7 +3079,7 @@ void Logic::asmPanRightToJoeAndRita() { // cdint.cut
BobSlot *bob_clock = _vm->graphics()->bob(23);
BobSlot *bob_hands = _vm->graphics()->bob(24);
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
_vm->input()->fastMode(true);
update();
@@ -3114,7 +3115,7 @@ void Logic::asmPanLeftToBomb() {
BobSlot *bob21 = _vm->graphics()->bob(21);
BobSlot *bob22 = _vm->graphics()->bob(22);
- _vm->graphics()->cameraBob(-1);
+ _vm->graphics()->putCameraOnBob(-1);
_vm->input()->fastMode(true);
int horizontalScroll = _vm->display()->horizontalScroll();
@@ -3148,7 +3149,7 @@ void Logic::asmEndDemo() {
void Logic::asmInterviewIntro() {
// put camera on airship
- _vm->graphics()->cameraBob(5);
+ _vm->graphics()->putCameraOnBob(5);
BobSlot *bas = _vm->graphics()->bob(5);
bas->curPos(-30, 40);
@@ -3183,7 +3184,7 @@ void Logic::asmInterviewIntro() {
}
// put camera on Joe
- _vm->graphics()->cameraBob(0);
+ _vm->graphics()->putCameraOnBob(0);
}