[Scummvm-cvs-logs] CVS: scummvm/queen defs.h,1.16,1.17 logic.h,1.43,1.44 logic.cpp,1.59,1.60 xref.txt,1.19,1.20

Gregory Montoir cyx at users.sourceforge.net
Sat Oct 25 02:26:06 CEST 2003


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

Modified Files:
	defs.h logic.h logic.cpp xref.txt 
Log Message:
added GameSettings class + FIND_VERB implementation

Index: defs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/defs.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- defs.h	24 Oct 2003 08:55:13 -0000	1.16
+++ defs.h	25 Oct 2003 09:11:35 -0000	1.17
@@ -81,24 +81,6 @@
 };
 
 
-enum {
-	PANEL_AREA_OPEN     = 1,
-	PANEL_AREA_CLOSE    = 2,
-	PANEL_AREA_MOVE     = 3,
-	PANEL_AREA_GIVE     = 4,
-	PANEL_AREA_LOOKAT   = 5,
-	PANEL_AREA_PICKUP   = 6,
-	PANEL_AREA_TALKTO   = 7,
-	PANEL_AREA_USE      = 8,
-	PANEL_AREA_INV_UP   = 9,
-	PANEL_AREA_INV_DOWN = 10,
-	PANEL_AREA_INV_1    = 11,
-	PANEL_AREA_INV_2    = 12,
-	PANEL_AREA_INV_3    = 13,
-	PANEL_AREA_INV_4    = 14
-};
-
-
 enum Language {
 	ENGLISH  = 'E',
 	FRENCH   = 'F',

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- logic.h	24 Oct 2003 08:55:13 -0000	1.43
+++ logic.h	25 Oct 2003 09:11:35 -0000	1.44
@@ -49,6 +49,15 @@
 	uint16 noun, noun2;
 };
 
+struct GameSettings {
+	int musicVolume;
+	bool musicToggle;
+	bool sfxToggle;
+	bool textToggle;
+	bool speechToggle;
+	int talkSpeed;
+};
+
 struct State {
 
 	//! FIND_STATE(state, "DIR");
@@ -96,10 +105,10 @@
 	uint16 newRoom() const { return _newRoom; }
 	void newRoom(uint16 room) { _newRoom = room; }
 
-	ObjectData* objectData(int index);
+	ObjectData *objectData(int index);
 	uint16 roomData(int room);
 	uint16 objMax(int room);
-	GraphicData* graphicData(int index);
+	GraphicData *graphicData(int index);
 
 	uint16 findBob(uint16 obj);
 	uint16 findFrame(uint16 obj);
@@ -135,12 +144,13 @@
 
 	uint16 numFrames() { return _numFrames; }
 
+	int talkSpeed() const { return _settings.talkSpeed; }
 	Language language()	{ return _resource->getLanguage(); } 
 
 	void zoneSet(uint16 screen, uint16 zone, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
 	void zoneSet(uint16 screen, uint16 zone, const Box& box);
-	uint16 zoneIn(uint16 screen, uint16 x, uint16 y);
-	uint16 zoneInArea(uint16 screen, uint16 x, uint16 y);
+	uint16 zoneIn(uint16 screen, uint16 x, uint16 y) const;
+	uint16 zoneInArea(uint16 screen, uint16 x, uint16 y) const;
 	void zoneClearAll(uint16 screen);
 	void zoneSetup();
 	void zoneSetupPanel();
@@ -165,10 +175,6 @@
 	void animErase(uint16 bobNum);
 	void animSetup(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible); // FIND_GRAPHIC_ANIMS
 
-	Walk *walk()	{ return _walk; }
-
-	int talkSpeed() { return _talkSpeed; }
-
 	void joeSetupFromBanks(const char *animBank, const char *standBank);
 
 	//! SETUP_JOE(), loads the various bobs needed to animate Joe
@@ -202,14 +208,20 @@
 
 	const char* objectOrItemName(int16 obj) const;
 
+	//! return selected verb in panel
+	Verb findVerb(int16 cursorx, int16 cursory) const;
+
+	Walk *walk() { return _walk; }
 	Display *display() { return _display; }
 
 	void update();
 
 protected:
-	bool _textToggle;
-	bool _speechToggle;
-	
+
+	GameSettings _settings;
+
+	void initialise();
+
 	uint8 *_jas;
 	uint16 _numRooms;
 	uint16 _currentRoom;
@@ -305,9 +317,8 @@
 	Sound *_sound;
 	Walk *_walk;
 
-	int _talkSpeed;	// TALKSPD
-
-	void initialise();
+	//! Verbs (in order) available in panel
+	static const Verb PANEL_VERBS[];
 
 	friend class Command; // TEMP
 };

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- logic.cpp	25 Oct 2003 01:11:14 -0000	1.59
+++ logic.cpp	25 Oct 2003 09:11:35 -0000	1.60
@@ -31,6 +31,24 @@
 
 namespace Queen {
 
+const Verb Logic::PANEL_VERBS[] = {
+	VERB_NONE,
+	VERB_OPEN,
+	VERB_CLOSE,
+	VERB_MOVE,
+	VERB_GIVE,
+	VERB_LOOK_AT,
+	VERB_PICK_UP,
+	VERB_TALK_TO,
+	VERB_USE,
+	VERB_SCROLL_UP,
+	VERB_SCROLL_DOWN,
+	VERB_DIGIT_1, // inventory item 1
+	VERB_DIGIT_2, // inventory item 2
+	VERB_DIGIT_3, // inventory item 3
+	VERB_DIGIT_4, // inventory item 4
+};
+
 
 Direction State::findDirection(uint16 state) {
 	// queen.c l.4014-4021
@@ -146,7 +164,8 @@
 
 Logic::Logic(Resource *resource, Graphics *graphics, Display *theDisplay, Input *input, Sound *sound)
 	: _resource(resource), _graphics(graphics), _display(theDisplay), 
-	_input(input), _sound(sound), _talkSpeed(DEFAULT_TALK_SPEED) {
+	_input(input), _sound(sound) {
+	_settings.talkSpeed = DEFAULT_TALK_SPEED;
 	_jas = _resource->loadFile("QUEEN.JAS", 20);
 	_joe.x = _joe.y = 0;
 	_joe.scale = 100;
@@ -339,6 +358,7 @@
 	}
 	
 	/*
+		// FIXME: move to Input class ?
 		switch (_resource->getLanguage()) {
 			case	ENGLISH:
 					_keyLanguage = _keyCommands[KEYS_ENGLISH];
@@ -403,11 +423,11 @@
 	for (i = 1; i <= _numAFile; i++)
 		_aFile[i] = _resource->getJAS2Line();
 
-	_textToggle = true;	
+	_settings.textToggle = true;	
 	if (_resource->isFloppy())
-		_speechToggle = false;
+		_settings.speechToggle = false;
 	else
-		_speechToggle = true;
+		_settings.speechToggle = true;
 
 	_graphics->loadPanel();
 	_graphics->bobSetupControl();
@@ -729,14 +749,14 @@
 }
 
 
-uint16 Logic::zoneIn(uint16 screen, uint16 x, uint16 y) {
+uint16 Logic::zoneIn(uint16 screen, uint16 x, uint16 y) const {
 
 	int i;
 	if (screen == ZONE_PANEL) {
 		y -= ROOM_ZONE_HEIGHT;
 	}
 	for(i = 1; i < MAX_ZONES_NUMBER; ++i) {
-		ZoneSlot *pzs = &_zones[screen][i];
+		const ZoneSlot *pzs = &_zones[screen][i];
 		if (pzs->valid && pzs->box.contains(x, y)) {
 			return i;
 		}
@@ -745,7 +765,8 @@
 }
 
 
-uint16 Logic::zoneInArea(uint16 screen, uint16 x, uint16 y) {
+uint16 Logic::zoneInArea(uint16 screen, uint16 x, uint16 y) const {
+
 	uint16 zone = zoneIn(screen, x, y);
 	if (zone <= _objMax[_currentRoom]) {
 		zone = 0;
@@ -795,23 +816,22 @@
 
 void Logic::zoneSetupPanel() {
 
-	int i;
-
 	// verbs 
+	int i;
 	for (i = 0; i <= 7; ++i) {
 		int x = i * 20;
 		zoneSet(ZONE_PANEL, i + 1, x, 10, x + 19, 49);
 	}
 
 	// inventory scrolls
-	zoneSet(ZONE_PANEL, PANEL_AREA_INV_UP,   160, 10, 179, 29);
-	zoneSet(ZONE_PANEL, PANEL_AREA_INV_DOWN, 160, 30, 179, 49);
+	zoneSet(ZONE_PANEL,  9, 160, 10, 179, 29);
+	zoneSet(ZONE_PANEL, 10, 160, 30, 179, 49);
 
 	// inventory items
-	zoneSet(ZONE_PANEL, PANEL_AREA_INV_1, 180, 10, 213, 49);
-	zoneSet(ZONE_PANEL, PANEL_AREA_INV_2, 214, 10, 249, 49);
-	zoneSet(ZONE_PANEL, PANEL_AREA_INV_3, 250, 10, 284, 49);
-	zoneSet(ZONE_PANEL, PANEL_AREA_INV_4, 285, 10, 320, 49);
+	zoneSet(ZONE_PANEL, 11, 180, 10, 213, 49);
+	zoneSet(ZONE_PANEL, 12, 214, 10, 249, 49);
+	zoneSet(ZONE_PANEL, 13, 250, 10, 284, 49);
+	zoneSet(ZONE_PANEL, 14, 285, 10, 320, 49);
 }
 
 
@@ -1897,6 +1917,12 @@
 	}
 	return _objName[name];
 
+}
+
+
+Verb Logic::findVerb(int16 cursorx, int16 cursory) const {
+
+	return PANEL_VERBS[zoneIn(ZONE_PANEL, cursorx, cursory)];
 }
 
 

Index: xref.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/xref.txt,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- xref.txt	24 Oct 2003 08:55:13 -0000	1.19
+++ xref.txt	25 Oct 2003 09:11:35 -0000	1.20
@@ -14,7 +14,7 @@
 
 COMMAND
 =======
-ALTER_DEFAULT()
+ALTER_DEFAULT()				Command::alterDefault
 CLEAR_COMMAND()				Command::clear
 EXECUTE_ACTION()			Command::executeCurrentAction
 FIND_DEFAULT()				Command::findDefault
@@ -23,10 +23,10 @@
 P2_SET_AREAS()				Command::setAreas
 P3_SET_OBJECTS()			Command::setObjects
 P4_SET_ITEMS()				Command::setItems
-SELECT()
-SELECT_ITEM()
-SELECT_NOUN()
-SELECT_VERB()
+SELECT()					Command::grabCurrentSelection
+SELECT_ITEM()				Command::grabSelectedItem
+SELECT_NOUN()				Command::grabSelectedNoun
+SELECT_VERB()				Command::grabSelectedVerb
 -
 ACTION,ACTION2				Command::_action*
 CLEVEL						Command::_commandLevel
@@ -90,12 +90,12 @@
 =============
 -
 config_request
-MUSICTOGGLE
-SFXTOGGLE
-TALKSPD						Logic::_talkSpeed
-TEXTTOGGLE
+MUSICTOGGLE					GameSettings::musicToggle
+SFXTOGGLE					GameSettings::sfxToggle
+TALKSPD						GameSettings::talkSpeed
+TEXTTOGGLE					GameSettings::textToggle
 VersionStr					Logic::language (add more functions if needed)
-VOICETOGGLE
+VOICETOGGLE					GameSettings::speechToggle
 
 
 GRAPHICS
@@ -195,7 +195,7 @@
 FIND_FRAME()				Logic::findFrame
 FIND_GRAPHIC()				Logic::graphicData
 FIND_SCALE()				Logic::findScale
-FIND_VERB()
+FIND_VERB()					Logic::findVerb
 LOOK()
 LOOK_ICON()
 LOOK_ITEM()
@@ -300,7 +300,7 @@
 ======
 changejoepal()				Display::palSetJoe
 check_colors()				Display::palCustomColors
-dynalum()					Display::dynalumUpdate
+dynalum()					Dynalum::update
 fadein()					Display::palFadeIn
 fadeout()					Display::palFadeOut
 flashspecial()				Display::palCustomFlash





More information about the Scummvm-git-logs mailing list