diff options
author | Oliver Kiehl | 2003-05-26 14:45:10 +0000 |
---|---|---|
committer | Oliver Kiehl | 2003-05-26 14:45:10 +0000 |
commit | dce77eb79bd2ea7b0cb5e2b05b5cbfd18b7e1ce2 (patch) | |
tree | b96fbc4c6a50cba6759d60c93175403b1567c3e7 /sky | |
parent | c5dbd8355f6c188325c8053ed3fbf4b477019504 (diff) | |
download | scummvm-rg350-dce77eb79bd2ea7b0cb5e2b05b5cbfd18b7e1ce2.tar.gz scummvm-rg350-dce77eb79bd2ea7b0cb5e2b05b5cbfd18b7e1ce2.tar.bz2 scummvm-rg350-dce77eb79bd2ea7b0cb5e2b05b5cbfd18b7e1ce2.zip |
add more stuff/cleanup
svn-id: r8008
Diffstat (limited to 'sky')
-rw-r--r-- | sky/logic.cpp | 59 | ||||
-rw-r--r-- | sky/skydefs.h | 4 |
2 files changed, 49 insertions, 14 deletions
diff --git a/sky/logic.cpp b/sky/logic.cpp index 961428d533..12fffff1bb 100644 --- a/sky/logic.cpp +++ b/sky/logic.cpp @@ -522,10 +522,9 @@ bool SkyLogic::collide(Compact *cpt) { MegaSet *m1 = (MegaSet *)SkyCompact::getCompactElem(_compact, C_GRID_WIDTH + _compact->extCompact->megaSet); MegaSet *m2 = (MegaSet *)SkyCompact::getCompactElem(cpt, C_GRID_WIDTH + cpt->extCompact->megaSet); - uint16 x = cpt->xcood; // target's base coordinates - x &= 0xfff8; - uint16 y = cpt->ycood; - y &= 0xfff8; + // target's base coordinates + uint16 x = cpt->xcood & 0xfff8; + uint16 y = cpt->ycood & 0xfff8; // The collision is direction dependant switch (_compact->extCompact->dir) { @@ -1714,28 +1713,59 @@ uint32 SkyLogic::fnMouseOff(uint32 a, uint32 b, uint32 c) { error("Stub: fnMouseOff"); } -uint32 SkyLogic::fnFetchX(uint32 a, uint32 b, uint32 c) { - Compact *cpt = SkyState::fetchCompact(a); +uint32 SkyLogic::fnFetchX(uint32 id, uint32 b, uint32 c) { + Compact *cpt = SkyState::fetchCompact(id); _scriptVariables[RESULT] = cpt->xcood; return 1; } -uint32 SkyLogic::fnFetchY(uint32 a, uint32 b, uint32 c) { - Compact *cpt = SkyState::fetchCompact(a); +uint32 SkyLogic::fnFetchY(uint32 id, uint32 b, uint32 c) { + Compact *cpt = SkyState::fetchCompact(id); _scriptVariables[RESULT] = cpt->ycood; return 1; } -uint32 SkyLogic::fnTestList(uint32 a, uint32 b, uint32 c) { - error("Stub: fnTestList"); +uint32 SkyLogic::fnTestList(uint32 id, uint32 x, uint32 y) { + _scriptVariables[RESULT] = 0; // assume fail + uint16 *list = (uint16 *)SkyState::fetchCompact(id); + + while (*list) { // end of list? + if (*list++ >= x) // left x + continue; + + if (*list++ < x) // right x + continue; + + if (*list++ >= y) // top y + continue; + + if (*list++ < y) // bottom y + continue; + + // get value + _scriptVariables[RESULT] = *list++; + } + return 1; } -uint32 SkyLogic::fnFetchPlace(uint32 a, uint32 b, uint32 c) { - error("Stub: fnFetchPlace"); +uint32 SkyLogic::fnFetchPlace(uint32 id, uint32 b, uint32 c) { + Compact *cpt = SkyState::fetchCompact(id); + _scriptVariables[RESULT] = cpt->place; + return 1; } -uint32 SkyLogic::fnCustomJoey(uint32 a, uint32 b, uint32 c) { - error("Stub: fnCustomJoey"); +uint32 SkyLogic::fnCustomJoey(uint32 id, uint32 b, uint32 c) { + // return id's x & y coordinate & c_mood (i.e. stood still yes/no) + // used by Joey-Logic - done in code like this because scripts can't + // get access to another megas compact as easily + + Compact *cpt = SkyState::fetchCompact(id); + + _scriptVariables[PLAYER_X] = cpt->xcood; + _scriptVariables[PLAYER_Y] = cpt->ycood; + _scriptVariables[PLAYER_MOOD] = cpt->mood; + _scriptVariables[PLAYER_SCREEN] = cpt->screen; + return 1; } uint32 SkyLogic::fnSetPalette(uint32 a, uint32 b, uint32 c) { @@ -1909,6 +1939,7 @@ uint32 SkyLogic::fnStopMusic(uint32 a, uint32 b, uint32 c) { } uint32 SkyLogic::fnFadeDown(uint32 a, uint32 b, uint32 c) { + // this is actually already implemented in SkyScreen error("Stub: fnFadeDown"); } diff --git a/sky/skydefs.h b/sky/skydefs.h index 4a85ec77a9..73eeecef16 100644 --- a/sky/skydefs.h +++ b/sky/skydefs.h @@ -43,6 +43,10 @@ #define MOUSE_STATUS 13 #define MOUSE_STOP 14 #define GET_OFF 18 +#define PLAYER_X 27 +#define PLAYER_Y 28 +#define PLAYER_MOOD 29 +#define PLAYER_SCREEN 30 #define HIT_ID 37 #define THE_CHOSEN_ONE 51 #define TEXT1 53 |