[Scummvm-cvs-logs] CVS: scummvm/sky skydefs.h,1.14,1.15 logic.cpp,1.44,1.45

Oliver Kiehl olki at users.sourceforge.net
Mon May 26 08:07:05 CEST 2003


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

Modified Files:
	skydefs.h logic.cpp 
Log Message:
add more stuff/cleanup


Index: skydefs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/skydefs.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- skydefs.h	25 May 2003 14:36:33 -0000	1.14
+++ skydefs.h	26 May 2003 14:45:10 -0000	1.15
@@ -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

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- logic.cpp	26 May 2003 14:19:24 -0000	1.44
+++ logic.cpp	26 May 2003 14:45:10 -0000	1.45
@@ -522,10 +522,9 @@
 	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 @@
 	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::fnFadeDown(uint32 a, uint32 b, uint32 c) {
+	// this is actually already implemented in SkyScreen
 	error("Stub: fnFadeDown");
 }
 





More information about the Scummvm-git-logs mailing list