[Scummvm-cvs-logs] CVS: scummvm/queen defs.h,1.12,1.13 structs.h,1.14,1.15 logic.h,1.40,1.41 logic.cpp,1.55,1.56

Gregory Montoir cyx at users.sourceforge.net
Sat Oct 25 16:02:52 CEST 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv5437

Modified Files:
	defs.h structs.h logic.h logic.cpp 
Log Message:
minor changes for future Command class

Index: defs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/defs.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- defs.h	23 Oct 2003 06:44:35 -0000	1.12
+++ defs.h	23 Oct 2003 08:09:49 -0000	1.13
@@ -160,6 +160,12 @@
 };
 
 
+enum StateOn {
+	STATE_ON_ON,
+	STATE_ON_OFF
+};
+
+
 } // End of namespace Queen
 
 #endif

Index: structs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/structs.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- structs.h	19 Oct 2003 18:52:28 -0000	1.14
+++ structs.h	23 Oct 2003 08:09:49 -0000	1.15
@@ -155,7 +155,7 @@
 	//! room in which this object is available
 	uint16 room;
 	//! state of the object (grab direction, on/off, default command...)
-	int16 state;
+	uint16 state;
 	//! entry in GraphicData (can be negative)
 	/*!
 		<table>
@@ -198,7 +198,7 @@
 		description = READ_BE_UINT16(ptr); ptr += 2;
 		entryObj = (int16)READ_BE_UINT16(ptr); ptr += 2;
 		room = READ_BE_UINT16(ptr); ptr += 2;
-		state = (int16)READ_BE_UINT16(ptr); ptr += 2;
+		state = READ_BE_UINT16(ptr); ptr += 2;
 		image = (int16)READ_BE_UINT16(ptr); ptr += 2;
 	}
 };
@@ -253,7 +253,7 @@
 	//! entry in OBJECT_DESCR
 	uint16 description;
 	//! state of the object
-	int16 state;
+	uint16 state;
 	//! bank bobframe 
 	uint16 bobFrame;
 	//! entry in OBJECT_DESCR (>0 if available)
@@ -262,7 +262,7 @@
 	void readFrom(byte *&ptr) {
 		item = (int16)READ_BE_UINT16(ptr); ptr += 2;
 		description = READ_BE_UINT16(ptr); ptr += 2;
-		state = (int16)READ_BE_UINT16(ptr); ptr += 2;
+		state = READ_BE_UINT16(ptr); ptr += 2;
 		bobFrame = READ_BE_UINT16(ptr); ptr += 2;
 		sfxDescription = (int16)READ_BE_UINT16(ptr); ptr += 2;
 	}

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- logic.h	23 Oct 2003 06:44:35 -0000	1.40
+++ logic.h	23 Oct 2003 08:09:49 -0000	1.41
@@ -45,7 +45,7 @@
 };
 
 
-struct Command {
+struct Command_ {
 	Verb action, action2;
 	uint16 noun, noun2;
 };
@@ -142,9 +142,11 @@
 	void animErase(uint16 bobNum);
 	void animSetup(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible); // FIND_GRAPHIC_ANIMS
 
-	StateDirection findStateDirection(uint16 state); // == FIND_STATE(state, "DIR");
-	StateTalk      findStateTalk     (uint16 state); // == FIND_STATE(state, "TALK");
-	StateGrab      findStateGrab     (uint16 state); // == FIND_STATE(state, "GRAB");
+	StateDirection findStateDirection(uint16 state) const; // == FIND_STATE(state, "DIR");
+	StateTalk      findStateTalk     (uint16 state) const; // == FIND_STATE(state, "TALK");
+	StateGrab      findStateGrab     (uint16 state) const; // == FIND_STATE(state, "GRAB");
+	StateOn        findStateOn       (uint16 state) const; // == FIND_STATE(state, "ON");
+	void alterStateOn(uint16 *objState, StateOn state) const; // == ALTER_STATE(state, "ON");
 
 	Walk *walk()	{ return _walk; }
 
@@ -162,7 +164,7 @@
 	uint16 joeFace();
 
 	//! WALK()
-	int16 joeWalkTo(int16 x, int16 y, const Command *cmd, bool mustWalk);
+	int16 joeWalkTo(int16 x, int16 y, const Command_ *cmd, bool mustWalk);
 
 	//! GRAB_JOE()
 	void joeGrab(uint16 state, uint16 speed);
@@ -287,6 +289,8 @@
 	int _talkSpeed;	// TALKSPD
 
 	void initialise();
+
+	friend class Command; // TEMP
 };
 
 } // End of namespace Queen

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- logic.cpp	23 Oct 2003 06:44:35 -0000	1.55
+++ logic.cpp	23 Oct 2003 08:09:49 -0000	1.56
@@ -1457,7 +1457,7 @@
 }
 
 
-StateDirection Logic::findStateDirection(uint16 state) {
+StateDirection Logic::findStateDirection(uint16 state) const {
 
 	// FIXME: may be we should return a DIR_* constant instead
 	// of a STATE_DIR_*. Some (all ?) calls to FIND_STATE(, "DIR")
@@ -1473,11 +1473,11 @@
 	return sd[(state >> 2) & 3];
 }
 
-StateTalk Logic::findStateTalk(uint16 state) {
+StateTalk Logic::findStateTalk(uint16 state) const {
 	return (state & (1 << 9)) ? STATE_TALK_TALK : STATE_TALK_MUTE;
 }
 
-StateGrab Logic::findStateGrab(uint16 state) {
+StateGrab Logic::findStateGrab(uint16 state) const {
 
 	// queen.c l.4022-4029
 	static const StateGrab gd[] = {
@@ -1489,6 +1489,22 @@
 	return gd[state & 3];
 }
 
+StateOn Logic::findStateOn(uint16 state) const {
+	return (state & (1 << 8)) ? STATE_ON_ON : STATE_ON_OFF;
+}
+
+
+void Logic::alterStateOn(uint16 *objState, StateOn state) const {
+	switch (state) {
+	case STATE_ON_ON:
+		*objState |= (1 << 8);
+		break;
+	case STATE_ON_OFF:
+		*objState &= ~(1 << 8);
+		break;
+	}
+}
+
 
 void Logic::joeSetupFromBanks(const char *bank1, const char* bank2) {
 
@@ -1644,7 +1660,7 @@
 }
 
 
-int16 Logic::joeWalkTo(int16 x, int16 y, const Command *cmd, bool mustWalk) {
+int16 Logic::joeWalkTo(int16 x, int16 y, const Command_ *cmd, bool mustWalk) {
 
 	// Check to see if object is actually an exit to another
 	// room. If so, then set up new room





More information about the Scummvm-git-logs mailing list