[Scummvm-cvs-logs] CVS: scummvm/simon items.cpp,1.37,1.38 simon.cpp,1.118,1.119

Travis Howell kirben at users.sourceforge.net
Thu Dec 12 03:08:02 CET 2002


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv12239/simon

Modified Files:
	items.cpp simon.cpp 
Log Message:

Small code cleanup


Index: items.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/items.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- items.cpp	12 Dec 2002 02:55:57 -0000	1.37
+++ items.cpp	12 Dec 2002 11:07:01 -0000	1.38
@@ -989,7 +989,7 @@
 					uint d = _array_4[a];
 					if (d != 0)
 						talk_with_speech(d, b);
-				} else if (_game == GAME_SIMON1DEMO || _game == GAME_SIMON1DOS) {
+				} else if (_game == GAME_SIMON1DEMO || _game == GAME_SIMON1DOS || _game == GAME_SIMON2DOS) {
 					const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]);
 					ThreeValues *tv = getThreeValues(b);
 
@@ -1001,14 +1001,7 @@
 
 					if (d != 0 && !_vk_t_toggle)
 						talk_with_speech(d, b);
-
-					if (s != NULL && _vk_t_toggle)
-						talk_with_text(b, c, s, tv->a, tv->b, tv->c);
-				} else if (_game == GAME_SIMON2DOS) {
-					const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]);
-					ThreeValues *tv = getThreeValues(b);
-
-					if (s != NULL)
+					else
 						talk_with_text(b, c, s, tv->a, tv->b, tv->c);
 				}
 			}
@@ -1237,11 +1230,11 @@
 
 void SimonState::o_177()
 {
+	uint a = getVarOrByte();
+	uint b = getVarOrByte();
+	Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
 	if (_game == GAME_SIMON1TALKIE || _game == GAME_SIMON1WIN) {
-		uint a = getVarOrByte();
-		/*uint b = */ getVarOrByte();
 		uint offs;
-		Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
 		if (child != NULL && child->avail_props & 0x200) {
 			offs = getOffsetOfChild2Param(child, 0x200);
 			talk_with_speech(child->array[offs], a);
@@ -1249,10 +1242,7 @@
 			offs = getOffsetOfChild2Param(child, 0x100);
 			talk_with_speech(child->array[offs] + 3550, a);
 		}
-	} else if ((_game == GAME_SIMON1DEMO) || (_game == GAME_SIMON1DOS)) {
-		uint a = getVarOrByte();
-		uint b = getVarOrByte();
-		Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
+	} else if (_game == GAME_SIMON1DEMO || _game == GAME_SIMON1DOS || _game == _game == GAME_SIMON2DOS) {
 		if (child != NULL && child->avail_props & 1) {
 			const char *s = (const char *)getStringPtrByID(child->array[0]);
 			char buf[256];
@@ -1260,17 +1250,13 @@
 			ThreeValues *tv = getThreeValues(a);
 
 			if (child->avail_props & 0x100) {
-				uint x = getOffsetOfChild2Param(child, 0x100);
-				sprintf(buf, "%d%s", child->array[x], s);
+				sprintf(buf, "%d%s", child->array[getOffsetOfChild2Param(child, 0x100)], s);
 				s = buf;
 			}
 
 			talk_with_text(a, b, s, tv->a, tv->b, tv->c);
 		}
 	} else if (_game == GAME_SIMON2TALKIE || _game == GAME_SIMON2WIN) {
-		uint a = getVarOrByte();
-		uint b = getVarOrByte();
-		Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
 		const char *s = NULL;
 		ThreeValues *tv = NULL;
 		char buf[256];
@@ -1333,28 +1319,6 @@
 
 		if (!_vk_t_toggle)
 			return;
-
-		if (child == NULL || !(child->avail_props & 1))
-			return;
-
-		if (child->avail_props & 0x100) {
-			sprintf(buf, "%d%s", child->array[getOffsetOfChild2Param(child, 0x100)], s);
-			s = buf;
-		}
-
-		talk_with_text(a, b, s, tv->a, tv->b, tv->c);
-	} else if (_game == GAME_SIMON2DOS) {
-		uint a = getVarOrByte();
-		uint b = getVarOrByte();
-		Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
-		const char *s = NULL;
-		ThreeValues *tv = NULL;
-		char buf[256];
-
-		if (child != NULL && child->avail_props & 1) {
-			s = (const char *)getStringPtrByID(child->array[0]);
-			tv = getThreeValues(a);
-		}
 
 		if (child == NULL || !(child->avail_props & 1))
 			return;

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- simon.cpp	8 Dec 2002 19:43:11 -0000	1.118
+++ simon.cpp	12 Dec 2002 11:07:01 -0000	1.119
@@ -2983,16 +2983,14 @@
 	_lock_word |= 0x8000;
 
 	if (!(_game & GAME_SIMON2)) {
-		dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8 + ((fcs == _fcs_ptr_array_3[2]) ? 1 : 0),
-														(fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
+		dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8 + ((fcs == _fcs_ptr_array_3[2]) ? 1 : 0), (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
 	} else {
 		if (_vga_var6 && _fcs_ptr_array_3[2] == fcs) {
 			fcs = _fcs_ptr_array_3[0x18 / 4];
 			_vga_var6 = 0;
 		}
 
-		dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8,
-														(fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
+		dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8, (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
 	}
 
 	_lock_word &= ~0x8000;
@@ -4317,43 +4315,6 @@
 
 	startUp_helper_2();
 }
-
-#if 0
-void SimonState::generateSound(byte *ptr, int len)
-{
-	uint cur;
-
-	cur = _voice_size;
-	if (cur > (uint) len)
-		cur = (uint) len;
-	_voice_size -= cur;
-
-	if (cur != 0) {
-		fread(ptr, cur, 1, _voice_file);
-	}
-
-	memset(ptr + cur, 0x80, len - cur);
-
-	cur = _sound_size;
-	if (cur) {
-		uint i;
-
-		if (cur > (uint) len)
-			cur = (uint) len;
-
-		for (i = 0; i != cur; i++) {
-			ptr[i] += _sound_ptr[i] ^ 0x80;
-		}
-
-		_sound_size -= cur;
-		_sound_ptr += cur;
-	}
-}
-#endif
-
-//static void fill_sound(void *userdata, int16 *stream, int len) {
-//  ((SimonState*)userdata)->generateSound((byte*)stream, len*2);
-//}
 
 void SimonState::dx_copy_rgn_from_3_to_2(uint b, uint r, uint y, uint x)
 {





More information about the Scummvm-git-logs mailing list