[Scummvm-cvs-logs] CVS: scummvm/sword1 logic.cpp,1.17,1.18 menu.cpp,1.6,1.7 menu.h,1.3,1.4 mouse.cpp,1.10,1.11 sword1.cpp,1.16,1.17 sworddefs.h,1.8,1.9

Robert G?ffringmann lavosspawn at users.sourceforge.net
Sun Dec 21 08:51:00 CET 2003


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv28598/sword1

Modified Files:
	logic.cpp menu.cpp menu.h mouse.cpp sword1.cpp sworddefs.h 
Log Message:
now two inventory items can be combined

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/logic.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- logic.cpp	20 Dec 2003 20:20:53 -0000	1.17
+++ logic.cpp	21 Dec 2003 16:50:02 -0000	1.18
@@ -856,7 +856,7 @@
 }
 
 int SwordLogic::fnFadeUp(BsObject *cpt, int32 id, int32 speed, int32 d, int32 e, int32 f, int32 z, int32 x) {
-	//warning("fnFadeUp speed = %d", speed);
+	warning("fnFadeUp speed = %d", speed);
 	//_screen->fadeUpPalette();
 	return SCRIPT_CONT;
 }
@@ -894,6 +894,9 @@
 
 int SwordLogic::fnPlaySequence(BsObject *cpt, int32 id, int32 sequenceId, int32 d, int32 e, int32 f, int32 z, int32 x) {
 	warning("fnPlaySequence(%d) called", sequenceId);
+	_scriptVars[NEW_PALETTE] = 1;
+	/* the logic usually calls fnFadeDown before playing the sequence, so we have to
+	   set NEW_PALETTE now to force a palette refresh */
 	return SCRIPT_CONT;
 }
 
@@ -1539,9 +1542,8 @@
 }
 
 int SwordLogic::fnCheckCD(BsObject *cpt, int32 id, int32 screen, int32 b, int32 c, int32 d, int32 z, int32 x) {
-	warning("fnCheckCd called");
-	// Not sure if we really have to check that here. I think we can do it in the main loop
-	// and leave a dummy here.
+	// only a dummy, here.
+	// the check is done in the mainloop
 	return SCRIPT_CONT;
 }
 

Index: menu.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/menu.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- menu.cpp	20 Dec 2003 17:55:09 -0000	1.6
+++ menu.cpp	21 Dec 2003 16:50:02 -0000	1.7
@@ -93,7 +93,15 @@
 		for (uint8 cnt = 0; cnt < _inMenu; cnt++) {
 			if (_objects[cnt]->wasClicked(x, y))
 				if (mouseEvent & BS1L_BUTTON_DOWN) {
-					SwordLogic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
+					if (SwordLogic::_scriptVars[OBJECT_HELD]) {
+						if (SwordLogic::_scriptVars[OBJECT_HELD] == _menuList[cnt])
+							SwordLogic::_scriptVars[OBJECT_HELD] = 0; // reselected => deselect it
+						else { // the player is clicking another item on this one.
+							   // run its use-script, if there is one
+							SwordLogic::_scriptVars[SECOND_ITEM] = _menuList[cnt];
+						}
+					} else
+						SwordLogic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
 					buildMenu();
 				} else if (mouseEvent & BS1L_BUTTON_UP) {
 					if (SwordLogic::_scriptVars[OBJECT_HELD] == _menuList[cnt]) {
@@ -144,8 +152,8 @@
 		if (SwordLogic::_scriptVars[MENU_LOOKING] || _subjectBarShown) { // either we're in the chooser or we're doing a 'LOOK AT'
 			if ((!objHeld) || (objHeld == _menuList[menuSlot]))
 				_objects[menuSlot]->setSelect(true);
-		} else if (_secondItem) { // clicked luggage onto 2nd icon - we need to colour-highlight the 2 relevant icons & grey out the rest
-			if ((_menuList[menuSlot] == objHeld) || (_menuList[menuSlot] == _secondItem))
+		} else if (SwordLogic::_scriptVars[SECOND_ITEM]) { // clicked luggage onto 2nd icon - we need to colour-highlight the 2 relevant icons & grey out the rest
+			if ((_menuList[menuSlot] == objHeld) || (_menuList[menuSlot] == SwordLogic::_scriptVars[SECOND_ITEM]))
 				_objects[menuSlot]->setSelect(true);
 		} else { // this object is selected - ie. GREYED OUT
 			if (objHeld != _menuList[menuSlot])
@@ -162,9 +170,9 @@
 }
 
 void SwordMenu::fnStartMenu(void) {
-	SwordLogic::_scriptVars[OBJECT_HELD] = 0;  // icon no longer selected
-	SwordLogic::_scriptVars[MENU_LOOKING] = 0; // second icon no longer selected (after using one on another)
-	_secondItem = 0;                           // no longer 'looking at' an icon
+	SwordLogic::_scriptVars[OBJECT_HELD]  = 0; // icon no longer selected
+	SwordLogic::_scriptVars[SECOND_ITEM]  = 0; // second icon no longer selected (after using one on another)
+	SwordLogic::_scriptVars[MENU_LOOKING] = 0; // no longer 'looking at' an icon
 	buildMenu();
 	if (_inMenu > 0) {	// if there's something in the object menu
 		_objectBarShown = true;

Index: menu.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/menu.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- menu.h	17 Dec 2003 05:16:36 -0000	1.3
+++ menu.h	21 Dec 2003 16:50:02 -0000	1.4
@@ -72,6 +72,7 @@
 	void fnStartMenu(void);
 	void fnEndMenu(void);
 	void checkTopMenu(void);
+	static const MenuObject _objectDefs[TOTAL_pockets + 1];
 
 private:
 	void buildSubjects(void);
@@ -87,12 +88,10 @@
 	SwordMenuIcon *_objects[TOTAL_pockets];
 	uint32 _menuList[TOTAL_pockets];
 	uint32 _inMenu;
-	uint32 _secondItem;
 
 	SwordScreen *_screen;
 	SwordMouse *_mouse;
 	static const Subject _subjectList[TOTAL_subjects];
-	static const MenuObject _objectDefs[TOTAL_pockets + 1];
 };
 
 #endif //BSMENU_H

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/mouse.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mouse.cpp	20 Dec 2003 17:55:09 -0000	1.10
+++ mouse.cpp	21 Dec 2003 16:50:02 -0000	1.11
@@ -35,24 +35,6 @@
 	_resMan = pResMan;
 	_objMan = pObjMan;
 	_system = system;
-	/*_resMan->resOpen(MSE_POINTER);		// normal mouse (1 frame anim)
-	_resMan->resOpen(MSE_OPERATE);
-	_resMan->resOpen(MSE_PICKUP);
-	_resMan->resOpen(MSE_EXAMINE);
-	_resMan->resOpen(MSE_MOUTH);
-	_resMan->resOpen(MSE_BECKON_L);
-	_resMan->resOpen(MSE_BECKON_R);
-	_resMan->resOpen(MSE_ARROW0);
-	_resMan->resOpen(MSE_ARROW1);
-	_resMan->resOpen(MSE_ARROW2);
-	_resMan->resOpen(MSE_ARROW3);
-	_resMan->resOpen(MSE_ARROW4);
-	_resMan->resOpen(MSE_ARROW5);
-	_resMan->resOpen(MSE_ARROW6);
-	_resMan->resOpen(MSE_ARROW7);
-	_resMan->resOpen(MSE_ARROW8);		// UPWARDS
-	_resMan->resOpen(MSE_ARROW9);*/		// DOWNWARDS
-	// luggage & chess stuff is opened dynamically
 }
 
 void SwordMouse::initialize(void) {
@@ -179,7 +161,9 @@
 	} else
 		SwordLogic::_scriptVars[SPECIAL_ITEM] = 0;
 	if (_state & MOUSE_DOWN_MASK) {
-		// todo: handle top menu?
+		if (_inTopMenu && SwordLogic::_scriptVars[SECOND_ITEM])
+			_logic->runMouseScript(NULL, _menu->_objectDefs[SwordLogic::_scriptVars[SECOND_ITEM]].useScript);
+		
 		SwordLogic::_scriptVars[MOUSE_BUTTON] = _state & MOUSE_DOWN_MASK;
 		if (SwordLogic::_scriptVars[SPECIAL_ITEM]) {
 			BsObject *compact = _objMan->fetchObject(SwordLogic::_scriptVars[SPECIAL_ITEM]);

Index: sword1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- sword1.cpp	21 Dec 2003 15:29:51 -0000	1.16
+++ sword1.cpp	21 Dec 2003 16:50:02 -0000	1.17
@@ -1058,8 +1058,6 @@
 		} else if (controlRes == CONTROL_GAME_RESTORED) {
 			reinitialize();  // first clear anything which was loaded
 			control->doRestore(); // then actually load the savegame data.
-			_mouse->fnUnlockMouse(); // and allow mouse movements.
-			_mouse->fnAddHuman();
 		}
 		_systemVars.deathScreenFlag = 0;
 	} while (true);

Index: sworddefs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sworddefs.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- sworddefs.h	19 Dec 2003 14:07:12 -0000	1.8
+++ sworddefs.h	21 Dec 2003 16:50:02 -0000	1.9
@@ -396,7 +396,7 @@
 	MAX_SCROLL_OFFSET_Y,
 	FEET_X,
 	FEET_Y,
-	SECOND_ICON,
+	SECOND_ITEM, //SECOND_ICON,
 	SUBJECT_CHOSEN,
 	IN_SUBJECT,
 	DEBUG_FLAG_1,





More information about the Scummvm-git-logs mailing list