[Scummvm-cvs-logs] CVS: scummvm/queen display.cpp,1.44,1.45 display.h,1.32,1.33 graphics.cpp,1.66,1.67 graphics.h,1.50,1.51 journal.cpp,1.15,1.16 logic.cpp,1.155,1.156

Gregory Montoir cyx at users.sourceforge.net
Tue Jan 6 01:31:01 CET 2004


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv11676/queen

Modified Files:
	display.cpp display.h graphics.cpp graphics.h journal.cpp 
	logic.cpp 
Log Message:
simplified room switching code a bit

Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- display.cpp	4 Jan 2004 20:25:21 -0000	1.44
+++ display.cpp	6 Jan 2004 09:29:33 -0000	1.45
@@ -30,7 +30,8 @@
 
 
 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::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 @@
 	};
 	(this->*effects[current])();
 	current = (current + 1) % ARRAYSIZE(effects);
+	forceFullRefresh();
 }
 
 

Index: display.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- display.h	4 Jan 2004 20:25:21 -0000	1.32
+++ display.h	6 Jan 2004 09:29:33 -0000	1.33
@@ -59,6 +59,8 @@
 	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);

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- graphics.cpp	5 Jan 2004 20:46:37 -0000	1.66
+++ graphics.cpp	6 Jan 2004 09:29:33 -0000	1.67
@@ -668,26 +668,6 @@
 }
 
 
-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) {

Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- graphics.h	5 Jan 2004 13:40:27 -0000	1.50
+++ graphics.h	6 Jan 2004 09:29:33 -0000	1.51
@@ -179,11 +179,9 @@
 	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);
 

Index: journal.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/journal.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- journal.cpp	5 Jan 2004 13:40:27 -0000	1.15
+++ journal.cpp	6 Jan 2004 09:29:33 -0000	1.16
@@ -88,7 +88,7 @@
 	_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 @@
 	_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 @@
     _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;

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -d -r1.155 -r1.156
--- logic.cpp	5 Jan 2004 13:40:27 -0000	1.155
+++ logic.cpp	6 Jan 2004 09:29:33 -0000	1.156
@@ -953,13 +953,8 @@
 
 
 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 @@
 	_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 @@
 	roomSetupObjects();
 
 	_vm->display()->forceFullRefresh();
+
+	if (_currentRoom >= 90) {
+		_vm->graphics()->putCameraOnBob(0);
+	}
 }
 
 
@@ -1338,6 +1338,7 @@
 
 void Logic::joeSetup() {
 	joeSetupFromBanks("joe_a.BBK", "joe_b.BBK");
+	joePrevFacing(DIR_FRONT);
 	joeFacing(DIR_FRONT);
 }
 
@@ -1409,7 +1410,7 @@
 	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::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 @@
 	_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::asmPutCameraOnDino() {
-	_vm->graphics()->cameraBob(-1);
+	_vm->graphics()->putCameraOnBob(-1);
 	int16 scrollx = _vm->display()->horizontalScroll();
 	while (scrollx < 320) {
 		scrollx += 16;
@@ -2696,17 +2697,17 @@
 		_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::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::asmPanRightFromJoe() {
-	_vm->graphics()->cameraBob(-1);
+	_vm->graphics()->putCameraOnBob(-1);
 	int16 scrollx = _vm->display()->horizontalScroll();
 	while (scrollx < 320) {
 		scrollx += 16;
@@ -2780,7 +2781,7 @@
 	} 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 @@
 		}
 		update();
 	}
-	_vm->graphics()->cameraBob(0);
+	_vm->graphics()->putCameraOnBob(0);
 }
 
 
@@ -2812,7 +2813,7 @@
 
 
 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::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::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 @@
 		update();
 	}
 
-	_vm->graphics()->cameraBob(0);
+	_vm->graphics()->putCameraOnBob(0);
 }
 
 
@@ -3014,7 +3015,7 @@
 	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 @@
 	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 @@
 	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::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 @@
 	}
 
 	// put camera on Joe
-	_vm->graphics()->cameraBob(0);
+	_vm->graphics()->putCameraOnBob(0);
 }
 
 





More information about the Scummvm-git-logs mailing list