[Scummvm-cvs-logs] CVS: scummvm/sky logic.cpp,1.118,1.119 logic.h,1.31,1.32 mouse.cpp,1.19,1.20 mouse.h,1.15,1.16 sky.cpp,1.83,1.84 sky.h,1.40,1.41

Robert G?ffringmann lavosspawn at users.sourceforge.net
Thu Jul 10 01:25:05 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv4349/sky

Modified Files:
	logic.cpp logic.h mouse.cpp mouse.h sky.cpp sky.h 
Log Message:
implemented fnOpenHand/fnCloseHand, added debug cheats

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- logic.cpp	10 Jul 2003 00:08:07 -0000	1.118
+++ logic.cpp	10 Jul 2003 08:24:16 -0000	1.119
@@ -1443,7 +1443,10 @@
 }
 
 bool SkyLogic::fnCrossMouse(uint32 a, uint32 b, uint32 c) {
-	_skyMouse->spriteMouse(MOUSE_CROSS, 11, 11);
+	if (_scriptVariables[OBJECT_HELD])
+		_skyMouse->fnOpenCloseHand(false);
+	else
+		_skyMouse->spriteMouse(MOUSE_CROSS, 4, 4);
 	return true;
 }
 
@@ -1468,12 +1471,12 @@
 }
 
 bool SkyLogic::fnOpenHand(uint32 a, uint32 b, uint32 c) {
-	warning("Stub: fnOpenHand");
+	_skyMouse->fnOpenCloseHand(true);
 	return true;
 }
 
 bool SkyLogic::fnCloseHand(uint32 a, uint32 b, uint32 c) {
-	warning("Stub: fnCloseHand");
+	_skyMouse->fnOpenCloseHand(false);
 	return true;
 }
 
@@ -2218,10 +2221,10 @@
 
 bool SkyLogic::fnLeaveSection(uint32 sectionNo, uint32 b, uint32 c) {
 	if (SkyState::isDemo())
-		error("End of demo");
+		_skyControl->showGameQuitMsg();
 	
 	if (sectionNo == 5) //linc section - has different mouse icons
-		_skyMouse->replaceMouseCursors(60302);
+		_skyMouse->replaceMouseCursors(60301);
 
 	_currentSection = 0xFF; // force music-, sound- and gridreload
 
@@ -2230,9 +2233,8 @@
 
 bool SkyLogic::fnEnterSection(uint32 sectionNo, uint32 b, uint32 c) {
 
-	if (SkyState::isDemo())
-		if (sectionNo > 2)
-			error("End of demo");
+	if (SkyState::isDemo() && (sectionNo > 2))
+		_skyControl->showGameQuitMsg();
 
 	_scriptVariables[CUR_SECTION] = sectionNo;
 	SkyState::_systemVars.currentMusic = 0;
@@ -2242,13 +2244,11 @@
 
 	if (sectionNo != _currentSection) {
 		_currentSection = sectionNo;
-		_saveCurrentSection = sectionNo;
 
 		sectionNo++;
 		_skyMusic->loadSection((byte)sectionNo);
 		_skySound->loadSection((byte)sectionNo);
 		_skyGrid->loadGrids();
-
 	}
 			
 	return true;

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- logic.h	1 Jul 2003 13:07:17 -0000	1.31
+++ logic.h	10 Jul 2003 08:24:16 -0000	1.32
@@ -63,6 +63,7 @@
 	MENU_LENGTH = 100,
 	SCROLL_OFFSET = 101,
 	MENU = 102,
+	OBJECT_HELD = 103,
 	RND = 115,
 	CUR_SECTION = 143,
 	CONSOLE_TYPE = 345,
@@ -253,7 +254,6 @@
 	uint32 _objectList[30];
 
 	uint32 _currentSection;
-	uint32 _saveCurrentSection;
 
 	RandomSource _rnd;
 	

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/mouse.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mouse.cpp	7 Jul 2003 00:39:22 -0000	1.19
+++ mouse.cpp	10 Jul 2003 08:24:16 -0000	1.20
@@ -26,7 +26,7 @@
 #define NO_MAIN_OBJECTS	24
 #define NO_LINC_OBJECTS	21
 
-uint32 _mouseObjectList[] = {
+uint32 SkyMouse::_mouseMainObjects[24] = {
 	65,
 	9,
 	66,
@@ -50,10 +50,10 @@
 	34,
 	35,
 	77,
-	38,
-
-	//Link cursors
+	38
+};
 
+uint32 SkyMouse::_mouseLincObjects[21] = {
 	24625,
 	24649,
 	24827,
@@ -204,7 +204,7 @@
 
 	//_system->set_mouse_cursor(_mouseData2, _mouseWidth, _mouseHeight, mouseX, mouseY);
 	// there's something wrong about the mouse's hotspot. using 4/4 seems to work fine. 
-	_system->set_mouse_cursor(_mouseData2, _mouseWidth, _mouseHeight, 4, 4);
+	_system->set_mouse_cursor(_mouseData2, _mouseWidth, _mouseHeight, mouseX, mouseY);
 	if (frameNum == MOUSE_BLANK) _system->show_mouse(false);
 	else _system->show_mouse(true);
 
@@ -292,3 +292,40 @@
 		}
 	}
 }
+
+uint16 SkyMouse::findMouseCursor(uint32 itemNum) {
+
+	uint8 cnt;
+	for (cnt = 0; cnt < NO_MAIN_OBJECTS; cnt++) {
+		if (itemNum == _mouseMainObjects[cnt]) {
+			return cnt;
+		}
+	}
+	for (cnt = 0; cnt < NO_LINC_OBJECTS; cnt++) {
+		if (itemNum == _mouseLincObjects[cnt]) {
+			return cnt;
+		}
+	}
+    return 0;
+}
+
+void SkyMouse::fnOpenCloseHand(bool open) {
+    
+	if ((!open) && (!SkyLogic::_scriptVariables[OBJECT_HELD])) {
+		spriteMouse(1, 0, 0);
+		return;
+	}
+	uint16 cursor = findMouseCursor(SkyLogic::_scriptVariables[OBJECT_HELD]) << 1;
+	if (open)
+		cursor++;
+
+	uint32 size = ((dataFileHeader*)_objectMouseData)->s_sp_size;
+	uint8 *srcData;
+	uint8 *destData;
+	
+	srcData = (uint8 *)_objectMouseData + size * cursor + sizeof(dataFileHeader);
+	destData = (uint8 *)_miceData + sizeof(dataFileHeader);
+	memcpy(destData, srcData, size);
+    spriteMouse(0, 5, 5);
+}
+

Index: mouse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/mouse.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- mouse.h	1 Jul 2003 23:44:31 -0000	1.15
+++ mouse.h	10 Jul 2003 08:24:16 -0000	1.16
@@ -40,6 +40,8 @@
 	void replaceMouseCursors(uint16 fileNo);
 	bool fnAddHuman(void);
 	void fnSaveCoods(void);
+	void fnOpenCloseHand(bool open);
+	uint16 findMouseCursor(uint32 itemNum);
 	void lockMouse(void);
 	void unlockMouse(void);
 	void restoreMouseData(uint16 frameNum);
@@ -93,7 +95,8 @@
 
 	uint16	_mouseXOff;
 
-	static uint32 _mouseObjectList[];
+	static uint32 _mouseMainObjects[24];
+	static uint32 _mouseLincObjects[21];
 
 	OSystem *_system;
 	SkyDisk *_skyDisk;

Index: sky.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- sky.cpp	10 Jul 2003 00:08:07 -0000	1.83
+++ sky.cpp	10 Jul 2003 08:24:16 -0000	1.84
@@ -55,6 +55,8 @@
  With apologies to the CD32 SteelSky file.
 */
 
+#undef WITH_DEBUG_CHEATS
+
 static const VersionSettings sky_settings[] = {
 	/* Beneath a Steel Sky */
 	{"sky", "Beneath a Steel Sky", GID_SKY_FIRST, 99, VersionSettings::ADLIB_DONT_CARE, 0, "sky.dsk" },
@@ -108,6 +110,30 @@
 	strcpy(buf2, buf1);
 }
 
+void SkyState::doCheat(uint8 num) {
+
+	switch(num) {
+		case 1: warning("executed cheat: get jammer");
+			SkyLogic::_scriptVariables[258] = 42; // got_jammer
+			SkyLogic::_scriptVariables[240] = 69; // got_sponsor
+			break;
+		case 2: warning("executed cheat: computer room");
+			SkyLogic::_scriptVariables[479] = 2; // card_status
+			SkyLogic::_scriptVariables[480] = 1; // card_fix
+			break;
+		case 3: warning("executed cheat: get to burke");
+			SkyLogic::_scriptVariables[190] = 42; // knows_port
+			break;
+		case 4: warning("executed cheat: get to reactor section");
+			SkyLogic::_scriptVariables[451] = 42; // foreman_friend
+			_skyLogic->fnSendSync(8484, 1, 0); // send sync to RAD suit (put in locker)
+			_skyLogic->fnKillId(ID_ANITA_SPY, 0, 0); // stop anita from getting to you
+			break;
+		default: warning("unknown cheat: %d", num);
+			break;
+	}
+}
+
 void SkyState::go() {
 
 	if (!_dump_file)
@@ -131,6 +157,19 @@
 
 	while (1) {
 		delay(_systemVars.gameSpeed);
+		if (_key_pressed == 63) {
+			_key_pressed = 0;
+			_skyControl->doControlPanel();
+		}			
+		if ((_key_pressed == 27) && (!_systemVars.pastIntro)) {
+			_skyControl->restartGame();
+			_key_pressed = 0;
+		}
+#ifdef WITH_DEBUG_CHEATS
+		if ((_key_pressed >= '0') && (_key_pressed <= '9')) {
+			doCheat(_key_pressed - '0');
+			_key_pressed = 0;
+		}
 		if (_key_pressed == 'r') {
 			warning("loading grid");
 			_skyLogic->_skyGrid->loadGrids();
@@ -143,16 +182,7 @@
 				_skyScreen->forceRefresh();
 			_key_pressed = 0;
 		}
-		
-		if (_key_pressed == 63) {
-			_key_pressed = 0;
-			_skyControl->doControlPanel();
-		}			
-		if ((_key_pressed == 27) && (!_systemVars.pastIntro)) {
-			_skyControl->restartGame();
-			_key_pressed = 0;
-		}
-
+#endif
 		_skySound->checkFxQueue();
 		_skyMouse->mouseEngine((uint16)_sdl_mouse_x, (uint16)_sdl_mouse_y);
 		_skyLogic->engine();

Index: sky.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- sky.h	9 Jul 2003 18:12:58 -0000	1.40
+++ sky.h	10 Jul 2003 08:24:16 -0000	1.41
@@ -119,6 +119,7 @@
 	void logic_engine();
 	void delay(uint amount);
 	void go();
+	void doCheat(uint8 num);
 
 	//intro related
 	static uint8 fosterImg[297 * 143];





More information about the Scummvm-git-logs mailing list