aboutsummaryrefslogtreecommitdiff
path: root/sky
diff options
context:
space:
mode:
authorRobert Göffringmann2003-07-10 08:24:16 +0000
committerRobert Göffringmann2003-07-10 08:24:16 +0000
commita9ae95a64e34b80826795eca28c456ac6bab620f (patch)
treeda5d9a5d8f4a65231393e621b54137902948bcd5 /sky
parent6ae8144929194ff6fc29a0ca4750faefc78169a0 (diff)
downloadscummvm-rg350-a9ae95a64e34b80826795eca28c456ac6bab620f.tar.gz
scummvm-rg350-a9ae95a64e34b80826795eca28c456ac6bab620f.tar.bz2
scummvm-rg350-a9ae95a64e34b80826795eca28c456ac6bab620f.zip
implemented fnOpenHand/fnCloseHand, added debug cheats
svn-id: r8896
Diffstat (limited to 'sky')
-rw-r--r--sky/logic.cpp20
-rw-r--r--sky/logic.h2
-rw-r--r--sky/mouse.cpp47
-rw-r--r--sky/mouse.h5
-rw-r--r--sky/sky.cpp50
-rw-r--r--sky/sky.h1
6 files changed, 98 insertions, 27 deletions
diff --git a/sky/logic.cpp b/sky/logic.cpp
index 398957b8f7..f72d05021b 100644
--- a/sky/logic.cpp
+++ b/sky/logic.cpp
@@ -1443,7 +1443,10 @@ bool SkyLogic::fnBlankMouse(uint32 a, uint32 b, uint32 c) {
}
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::fnCursorUp(uint32 a, uint32 b, uint32 c) {
}
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::fnEyeball(uint32 id, uint32 b, uint32 c) {
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::fnLeaveSection(uint32 sectionNo, uint32 b, uint32 c) {
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 @@ bool SkyLogic::fnEnterSection(uint32 sectionNo, uint32 b, uint32 c) {
if (sectionNo != _currentSection) {
_currentSection = sectionNo;
- _saveCurrentSection = sectionNo;
sectionNo++;
_skyMusic->loadSection((byte)sectionNo);
_skySound->loadSection((byte)sectionNo);
_skyGrid->loadGrids();
-
}
return true;
diff --git a/sky/logic.h b/sky/logic.h
index add2db4f15..52dfa4bb04 100644
--- a/sky/logic.h
+++ b/sky/logic.h
@@ -63,6 +63,7 @@ enum scriptVariableOffsets {
MENU_LENGTH = 100,
SCROLL_OFFSET = 101,
MENU = 102,
+ OBJECT_HELD = 103,
RND = 115,
CUR_SECTION = 143,
CONSOLE_TYPE = 345,
@@ -253,7 +254,6 @@ protected:
uint32 _objectList[30];
uint32 _currentSection;
- uint32 _saveCurrentSection;
RandomSource _rnd;
diff --git a/sky/mouse.cpp b/sky/mouse.cpp
index 29d6a59341..7c5e71aeb2 100644
--- a/sky/mouse.cpp
+++ b/sky/mouse.cpp
@@ -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 @@ uint32 _mouseObjectList[] = {
34,
35,
77,
- 38,
-
- //Link cursors
+ 38
+};
+uint32 SkyMouse::_mouseLincObjects[21] = {
24625,
24649,
24827,
@@ -204,7 +204,7 @@ void SkyMouse::spriteMouse(uint16 frameNum, uint8 mouseX, uint8 mouseY) {
//_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 @@ void SkyMouse::buttonEngine1(void) {
}
}
}
+
+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);
+}
+
diff --git a/sky/mouse.h b/sky/mouse.h
index 16f44e5b2d..65c9b179ea 100644
--- a/sky/mouse.h
+++ b/sky/mouse.h
@@ -40,6 +40,8 @@ public:
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 @@ protected:
uint16 _mouseXOff;
- static uint32 _mouseObjectList[];
+ static uint32 _mouseMainObjects[24];
+ static uint32 _mouseLincObjects[21];
OSystem *_system;
SkyDisk *_skyDisk;
diff --git a/sky/sky.cpp b/sky/sky.cpp
index 8197c86f95..6bc10f5820 100644
--- a/sky/sky.cpp
+++ b/sky/sky.cpp
@@ -55,6 +55,8 @@ extern bool draw_keyboard;
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 @@ void SkyState::errorString(const char *buf1, char *buf2) {
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 @@ void SkyState::go() {
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 @@ void SkyState::go() {
_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();
diff --git a/sky/sky.h b/sky/sky.h
index 6f6eb32128..5d62159765 100644
--- a/sky/sky.h
+++ b/sky/sky.h
@@ -119,6 +119,7 @@ protected:
void logic_engine();
void delay(uint amount);
void go();
+ void doCheat(uint8 num);
//intro related
static uint8 fosterImg[297 * 143];