[Scummvm-cvs-logs] CVS: scummvm/sword1 screen.cpp,1.20,1.21 screen.h,1.8,1.9 sword1.cpp,1.18,1.19 sword1.h,1.6,1.7

Robert G?ffringmann lavosspawn at users.sourceforge.net
Sun Dec 21 17:21:11 CET 2003


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv24921/sword1

Modified Files:
	screen.cpp screen.h sword1.cpp sword1.h 
Log Message:
changed the way the control panel is started

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- screen.cpp	22 Dec 2003 00:34:02 -0000	1.20
+++ screen.cpp	22 Dec 2003 01:20:47 -0000	1.21
@@ -109,6 +109,10 @@
 		_system->set_palette(_targetPalette, start, length);
 }
 
+void SwordScreen::refreshPalette(void) {
+	_system->set_palette(_targetPalette, 0, 256);
+}
+
 bool SwordScreen::stillFading(void) {
 	return !_isBlack;
 }

Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- screen.h	21 Dec 2003 17:55:40 -0000	1.8
+++ screen.h	22 Dec 2003 01:20:47 -0000	1.9
@@ -66,21 +66,19 @@
 	SwordScreen(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan);
 	void useTextManager(SwordText *pTextMan);
 	~SwordScreen(void);
-	void flushSprites(void) { _backLength = _sortLength = _foreLength = 0; };
+	void draw(void);
 
 	void quitScreen(void);
 	void newScreen(uint32 screen);
 
 	void setScrolling(int16 offsetX, int16 offsetY);
-
 	void addToGraphicList(uint8 listId, uint32 objId);
 
-	void draw(void);
-
 	void fadeDownPalette(void);
 	void fadeUpPalette(void);
 	void fnSetPalette(uint8 start, uint16 length, uint32 id, bool fadeUp);
 	bool stillFading(void);
+	void refreshPalette(void);
 
 	void updateScreen(void);
 	void showFrame(uint16 x, uint16 y, uint32 resId, uint32 frameNo, const byte *fadeMask = NULL, int8 fadeStatus = 0);

Index: sword1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- sword1.cpp	21 Dec 2003 17:34:44 -0000	1.18
+++ sword1.cpp	22 Dec 2003 01:20:47 -0000	1.19
@@ -148,6 +148,7 @@
 	_logic->initialize();
 	_objectMan->initialize();
 	_mouse->initialize();
+	_control = new SwordControl(_resMan, _objectMan, _system, _mouse, getSavePath());
 }
 
 void SwordEngine::reinitialize(void) {
@@ -903,10 +904,14 @@
 			//---------------------------
 			case 63:	// train_one
 			{
-				SwordLogic::_scriptVars[CHANGE_X] = 1288;
-				SwordLogic::_scriptVars[CHANGE_Y] = 264;
-				SwordLogic::_scriptVars[CHANGE_DIR] = RIGHT;
+				SwordLogic::_scriptVars[CHANGE_X] = 710;
+				SwordLogic::_scriptVars[CHANGE_Y] = 450;
+				SwordLogic::_scriptVars[CHANGE_DIR] = LEFT;
 				SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_63;
+				SwordLogic::_scriptVars[DOOR_SC65_FLAG] = 2;
+				SwordLogic::_scriptVars[DOOR_ONE_63_OPEN] = 0;
+				SwordLogic::_scriptVars[DOOR_65_OPEN] = 1;
+				SwordLogic::_scriptVars[VAIL_TEXT] = 1;
 			}
 			break;
 			//---------------------------
@@ -1029,8 +1034,6 @@
 		   1 = dead
 		   2 = game won
 		   3 = game was just started */
-	SwordControl *control = new SwordControl(_resMan, _objectMan, _system, _mouse, getSavePath());
-	uint8 controlRes = 0;
 
 	uint8 startPos = ConfMan.getInt("boot_param");
 	if (startPos) {
@@ -1045,20 +1048,13 @@
 	}
 
 	do {
-        mainLoop();
+        uint8 action = mainLoop();
 
-		// the mainloop was left, either because the player pressed F5 or because the logic
-		// wants to restart the game.
-		if (!_systemVars.forceRestart)
-			controlRes = control->runPanel();
-		if ((controlRes == CONTROL_RESTART_GAME) || (_systemVars.forceRestart)) {
-			_music->fadeDown();
-			startPositions(1);
-			_systemVars.forceRestart = false;
-		} else if (controlRes == CONTROL_GAME_RESTORED) {
-			reinitialize();  // first clear anything which was loaded
-			control->doRestore(); // then actually load the savegame data.
-		}
+		// the mainloop was left, we have to reinitialize.
+		reinitialize();
+		if (action == CONTROL_GAME_RESTORED)
+			_control->doRestore();
+		_systemVars.forceRestart = false;
 		_systemVars.deathScreenFlag = 0;
 	} while (true);
 }
@@ -1072,10 +1068,10 @@
 		_systemVars.currentCD = needCd;
 }
 
-void SwordEngine::mainLoop(void) {
-	uint32 newTime, frameTime;
-	bool wantControlPanel = false;
-	do {
+uint8 SwordEngine::mainLoop(void) {
+	uint8 retCode = 0;
+
+	while (retCode == 0) {
 		// do we need the section45-hack from sword.c here?
 		checkCd();
 
@@ -1086,61 +1082,55 @@
 		
 		do {
 			_music->stream();
-			frameTime = _system->get_msecs();
+			uint32 frameTime = _system->get_msecs();
 			_logic->engine();
 			_logic->updateScreenParams(); // sets scrolling
 
 			_screen->draw();
 			_mouse->animate();
 
-			newTime = _system->get_msecs();
-			/*if ((newTime - frameTime < 50) && (!SwordLogic::_scriptVars[NEW_PALETTE])) {
-				RenderScreenGDK();
-				BlitMenusGDK();
-				BlitMousePm();
-				if (newTime - frameTime < 40)
-					_system->delay_msecs(40 - (newTime - frameTime));
-				FlipScreens();
-			}*/
+			uint32 newTime = _system->get_msecs();
 
 			_sound->engine();
 			_screen->updateScreen();
-		//-
+
 			_menu->refresh(MENU_TOP);
 			_menu->refresh(MENU_BOT);
 
-			newTime = _system->get_msecs();
 			if (newTime - frameTime < 80)
 				delay(80 - (newTime - frameTime));
 			else
 				delay(0);
 
-			/*FlipScreens(); this is done in SwordScreen::updateScreen() now.
-			if (SwordLogic::_scriptVars[NEW_PALETTE]) {
-				SwordLogic::_scriptVars[NEW_PALETTE] = 0;
-				startFadePaletteUp();
-			}*/
-
 			_mouse->engine( _mouseX, _mouseY, _mouseState);
 			_mouseState = 0;
-			if (_keyPressed == 63)
-				wantControlPanel = true;
+
+			if (_systemVars.forceRestart)
+				retCode = CONTROL_RESTART_GAME;
+			else if (_keyPressed == 63) {
+				retCode = _control->runPanel();
+				if (!retCode)
+					_screen->refreshPalette();
+			}
+
 			// do something smart here to implement pausing the game. If we even want that, that is.
-		} while ((SwordLogic::_scriptVars[SCREEN] == SwordLogic::_scriptVars[NEW_SCREEN]) &&
-			(!_systemVars.forceRestart) && (!wantControlPanel));
+		} while ((SwordLogic::_scriptVars[SCREEN] == SwordLogic::_scriptVars[NEW_SCREEN]) && (retCode == 0));
         
-		if (SwordLogic::_scriptVars[SCREEN] != 53) // we don't fade down after syria pan (53).
-			_screen->fadeDownPalette();
-		while (_screen->stillFading()) {
-			_music->stream();
-			_screen->updateScreen();
-			delay(1000/12);
+		if (retCode == 0) {
+			if (SwordLogic::_scriptVars[SCREEN] != 53) // we don't fade down after syria pan (53).
+				_screen->fadeDownPalette();
+			while (_screen->stillFading()) {
+				_music->stream();
+				_screen->updateScreen();
+				delay(1000/12);
+			}
 		}
 
 		_sound->quitScreen();
 		_screen->quitScreen(); // close graphic resources
 		_objectMan->closeSection(SwordLogic::_scriptVars[SCREEN]); // close the section that PLAYER has just left, if it's empty now
-	} while ((!_systemVars.forceRestart) && (!wantControlPanel));
+	}
+	return retCode;
 }
 
 void SwordEngine::delay(uint amount) { //copied and mutilated from sky.cpp

Index: sword1.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sword1.h	20 Dec 2003 20:20:53 -0000	1.6
+++ sword1.h	22 Dec 2003 01:20:47 -0000	1.7
@@ -35,6 +35,7 @@
 class ObjectMan;
 class SwordMenu;
 class SwordMusic;
+class SwordControl;
 
 struct SystemVars {
 	// todo: move these to a better place
@@ -64,7 +65,7 @@
 	void initialize(void);
 
 	void checkCd(void);
-	void mainLoop(void);
+	uint8 mainLoop(void);
 	void startPositions(int32 startNumber);
 
 	uint16 _mouseX, _mouseY, _mouseState;
@@ -82,5 +83,6 @@
 	SwordSound	*_sound;
 	SwordMenu	*_menu;
 	SwordMusic  *_music;
+	SwordControl *_control;
 	static const uint8 _cdList[TOTAL_SECTIONS];
 };





More information about the Scummvm-git-logs mailing list