[Scummvm-cvs-logs] CVS: scummvm/simon intern.h,1.3,1.4 items.cpp,1.3,1.4 simon.cpp,1.36,1.37 simon.h,1.6,1.7 verb.cpp,1.2,1.3

Max Horn fingolfin at users.sourceforge.net
Wed Oct 30 15:53:02 CET 2002


Update of /cvsroot/scummvm/scummvm/simon
In directory usw-pr-cvs1:/tmp/cvs-serv23106

Modified Files:
	intern.h items.cpp simon.cpp simon.h verb.cpp 
Log Message:
don't open files all the time just to detect whether we use VOC/WAV/MP3 music: we have a concept of so called 'variables' which can be used to store data, make use of this cool technique <g>; load effects even if voice file is missing; cleanup

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/intern.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- intern.h	29 Oct 2002 14:33:58 -0000	1.3
+++ intern.h	30 Oct 2002 23:52:19 -0000	1.4
@@ -39,9 +39,6 @@
 	int16 array[1];
 };
 
-struct Child3 : Child {
-};
-
 struct Child9 : Child {
 	uint16 array[4];
 };

Index: items.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/items.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- items.cpp	30 Oct 2002 11:12:37 -0000	1.3
+++ items.cpp	30 Oct 2002 23:52:19 -0000	1.4
@@ -166,7 +166,7 @@
 			break;
 
 		case 28:{									/* item has prop */
-				Child2 *child = findChildOfType2(getNextItemPtr());
+				Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
 				byte num = getVarOrByte();
 				condition = child != NULL && (child->avail_props & (1 << num)) != 0;
 			} break;
@@ -304,7 +304,7 @@
 			break;
 
 		case 56:{									/* set child2 fr bit */
-				Child2 *child = findChildOfType2(getNextItemPtr());
+				Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
 				int value = getVarOrByte();
 				if (child != NULL && value >= 0x10)
 					child->avail_props |= 1 << value;
@@ -312,7 +312,7 @@
 			break;
 
 		case 57:{									/* clear child2 fr bit */
-				Child2 *child = findChildOfType2(getNextItemPtr());
+				Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
 				int value = getVarOrByte();
 				if (child != NULL && value >= 0x10)
 					child->avail_props &= ~(1 << value);
@@ -448,7 +448,7 @@
 			break;
 
 		case 79:{									/* childstruct fr2 is */
-				Child2 *child = findChildOfType2(getNextItemPtr());
+				Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
 				uint string_id = getNextStringID();
 				condition = (child != NULL) && child->string_id == string_id;
 			}
@@ -826,7 +826,7 @@
 			break;
 
 		case 143:{									/* start item sub */
-				Child1 *child = findChildOfType1(getNextItemPtr());
+				Child1 *child = (Child1 *)findChildOfType(getNextItemPtr(), 1);
 				if (child != NULL) {
 					Subroutine *sub = getSubroutineByID(child->subroutine_id);
 					if (sub)
@@ -879,7 +879,7 @@
 
 		case 157:{									/* get item int prop */
 				Item *item = getNextItemPtr();
-				Child2 *child = findChildOfType2(item);
+				Child2 *child = (Child2 *)findChildOfType(item, 2);
 				uint prop = getVarOrByte();
 
 				if (child != NULL && child->avail_props & (1 << prop) && prop < 16) {
@@ -893,7 +893,7 @@
 
 		case 158:{									/* set item prop */
 				Item *item = getNextItemPtr();
-				Child2 *child = findChildOfType2(item);
+				Child2 *child = (Child2 *)findChildOfType(item, 2);
 				uint prop = getVarOrByte();
 				int value = getVarOrWord();
 
@@ -1281,7 +1281,7 @@
 		uint a = getVarOrByte();
 		/*uint b = */ getVarOrByte();
 		uint offs;
-		Child2 *child = findChildOfType2(getNextItemPtr());
+		Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
 		if (child != NULL && child->avail_props & 0x200) {
 			offs = getOffsetOfChild2Param(child, 0x200);
 			talk_with_speech(child->array[offs], a);
@@ -1292,7 +1292,7 @@
 	} else if ((_game == GAME_SIMON1DEMO) || (_game == GAME_SIMON1DOS)) {
 		uint a = getVarOrByte();
 		uint b = getVarOrByte();
-		Child2 *child = findChildOfType2(getNextItemPtr());
+		Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
 		if (child != NULL && child->avail_props & 1) {
 			const char *s = (const char *)getStringPtrByID(child->array[0]);
 			ThreeValues *tv;
@@ -1325,7 +1325,7 @@
 	} else if (_game == GAME_SIMON2WIN || _game == GAME_SIMON2DOS) {
 		uint a = getVarOrByte();
 		uint b = getVarOrByte();
-		Child2 *child = findChildOfType2(getNextItemPtr());
+		Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
 		const char *s = NULL;
 		ThreeValues *tv = NULL;
 		char buf[256];

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- simon.cpp	30 Oct 2002 02:22:54 -0000	1.36
+++ simon.cpp	30 Oct 2002 23:52:19 -0000	1.37
@@ -1,5020 +1,5007 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001/2002 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
[...9996 lines suppressed...]
+byte *SimonState::dx_lock_attached()
+{
+	_dx_surface_pitch = 320;
+	return _dx_use_3_or_4_for_lock ? _sdl_buf_3 : _sdl_buf_attached;
+}
+
+void SimonState::dx_unlock_attached()
+{
+}
+
+void SimonState::set_volume(byte volume)
+{
+	_mixer->setVolume(volume);
+}
+
+
+byte SimonState::getByte()
+{
+	return *_code_ptr++;
+}

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- simon.h	25 Oct 2002 15:32:56 -0000	1.6
+++ simon.h	30 Oct 2002 23:52:19 -0000	1.7
@@ -47,9 +47,7 @@
 #define NUM_PALETTE_FADEOUT 32
 
 struct Child;
-struct Child1;
 struct Child2;
-struct Child3;
 
 struct Item;
 struct FillOrCopyStruct;
@@ -124,11 +122,21 @@
 		GAME_SIMON1DEMO = 4,
 	};
 
+	typedef enum {
+		FORMAT_NONE,
+		FORMAT_MP3,
+		FORMAT_WAV,
+		FORMAT_VOC
+	} SoundFormat;
+
 	File *_game_file;
+	
 	File *_voice_file;
 	uint32 *_voice_offsets;
+	SoundFormat _voice_type;
 	File *_effects_file;
 	uint32 *_effects_offsets;
+	SoundFormat _effects_type;
 
 	byte *_stripped_txt_mem;
 	uint _text_size;
@@ -429,10 +437,6 @@
 
 	bool hasChildOfType1(Item *item);
 	bool hasChildOfType2(Item *item);
-
-	Child1 *findChildOfType1(Item *item);
-	Child2 *findChildOfType2(Item *item);
-	Child3 *findChildOfType3(Item *item);
 
 	void itemChildrenChanged(Item *item);
 	void unlinkItem(Item *item);

Index: verb.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/verb.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- verb.cpp	22 Oct 2002 06:30:45 -0000	1.2
+++ verb.cpp	30 Oct 2002 23:52:19 -0000	1.3
@@ -434,7 +434,7 @@
 	if (item == 0 || item == _dummy_item_2 || item == _dummy_item_3)
 		return false;
 
-	child2 = findChildOfType2(item);
+	child2 = (Child2 *)findChildOfType(item, 2);
 	if (child2 == NULL)
 		return false;
 





More information about the Scummvm-git-logs mailing list