[Scummvm-cvs-logs] CVS: scummvm/simon simonintern.h,NONE,1.1 simon.cpp,1.46,1.47 simon.h,1.25,1.26 simondebug.cpp,1.2,1.3 simonitems.cpp,1.5,1.6 simonres.cpp,1.4,1.5 simonsys.cpp,1.10,1.11 simonverb.cpp,1.4,1.5 simonvga.cpp,1.3,1.4

Max Horn fingolfin at users.sourceforge.net
Sun Aug 18 09:22:03 CEST 2002


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

Modified Files:
	simon.cpp simon.h simondebug.cpp simonitems.cpp simonres.cpp 
	simonsys.cpp simonverb.cpp simonvga.cpp 
Added Files:
	simonintern.h 
Log Message:
trying to clean up the Simon code - gee this is a *BIG* mess! Argh!

--- NEW FILE: simonintern.h ---
/* 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
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header: /cvsroot/scummvm/scummvm/simon/simonintern.h,v 1.1 2002/08/18 16:21:08 fingolfin Exp $
 *
 */

#ifndef SIMON_INTERN_H
#define SIMON_INTERN_H

struct Child {
	Child *next;
	uint16 type;
};

struct Child1 : Child {
	uint16 subroutine_id;
	uint16 fr2;
	uint16 array[1];
};

struct Child2 : Child {
	uint16 string_id;
	uint32 avail_props;
	int16 array[1];
};

struct Child3 : Child {
};

struct Child9 : Child {
	uint16 array[4];
};

enum {
	CHILD1_SIZE = sizeof(Child1) - sizeof(uint16),
	CHILD2_SIZE = sizeof(Child2) - sizeof(int16)
};


struct Item {
	uint16 parent;
	uint16 child;
	uint16 sibling;
	int16 unk1;
	int16 unk2;
	int16 unk3;										/* signed int */
	uint16 unk4;
	uint16 xxx_1;									/* unused? */
	Child *children;
};

struct Subroutine {
	uint16 id;										/* subroutine ID */
	uint16 first;									/* offset from subroutine start to first subroutine line */
	Subroutine *next;							/* next subroutine in linked list */
};

struct FillOrCopyDataEntry {
	Item *item;
	uint16 hit_area;
	uint16 xxx_1;
};

struct FillOrCopyData {
	int16 unk1;
	Item *item_ptr;
	FillOrCopyDataEntry e[64];
	int16 unk3, unk4;
	uint16 unk2;
};

struct FillOrCopyStruct {
	byte mode;
	byte flags;
	uint16 x, y;
	uint16 width, height;
	uint16 textColumn, textRow;
	uint8 textColumnOffset, textLength, textMaxLength;
    uint8 fill_color, text_color, unk5;
	FillOrCopyData *fcs_data;
};
// note on text offset: 
// the actual x-coordinate is: textColumn * 8 + textColumnOffset
// the actual y-coordinate is: textRow * 8


enum {
	SUBROUTINE_LINE_SMALL_SIZE = 2,
	SUBROUTINE_LINE_BIG_SIZE = 8,
};

struct SubroutineLine {
	uint16 next;
	int16 cond_a;
	int16 cond_b;
	int16 cond_c;
};

struct TimeEvent {
	uint32 time;
	uint16 subroutine_id;
	TimeEvent *next;
};

struct VgaFile1Header {
	uint16 x_1, x_2;
	uint16 hdr2_start;
	uint16 x_3, x_4;
};

struct VgaFile1Header2 {
	uint16 x_1;
	uint16 unk1;
	uint16 x_2;
	uint16 id_count;
	uint16 x_3;
	uint16 unk2_offs;
	uint16 x_4;
	uint16 id_table;
	uint16 x_5;
};

struct VgaFile1Struct0x8 {
	uint16 id;
	uint16 x_1;
	uint16 x_2;
	uint16 script_offs;
};

struct VgaFile1Struct0x6 {
	uint16 id;
	uint16 x_2;
	uint16 script_offs;
};


struct GameSpecificSettings {
	uint VGA_DELAY_BASE;
	uint TABLE_INDEX_BASE;
	uint TEXT_INDEX_BASE;
	uint NUM_GAME_OFFSETS;
	uint NUM_VIDEO_OP_CODES;
	uint VGA_MEM_SIZE;
	uint TABLES_MEM_SIZE;
	uint NUM_VOICE_RESOURCES;
	uint NUM_EFFECTS_RESOURCES;
	uint MUSIC_INDEX_BASE;
	uint SOUND_INDEX_BASE;
	const char *gme_filename;
	const char *wav_filename;
	const char *wav_filename2;
	const char *effects_filename;
	const char *gamepc_filename;
};

#endif

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- simon.cpp	11 Aug 2002 09:05:30 -0000	1.46
+++ simon.cpp	18 Aug 2002 16:21:08 -0000	1.47
@@ -21,16 +21,9 @@
 
 #include "stdafx.h"
 #include "simon.h"
+#include "simonintern.h"
 #include <errno.h>
 
-int sdl_mouse_x, sdl_mouse_y;
-
-byte *sdl_buf_3;
-byte *sdl_buf;
-byte *sdl_buf_attached;
-
-SimonState *g_simon;
-
 #ifdef _WIN32_WCE
 
 extern bool toolbar_drawn;
@@ -39,6 +32,101 @@
 #endif
 
 
+static const GameSpecificSettings simon1_settings = {
+	1,														/* VGA_DELAY_BASE */
+	1576 / 4,											/* TABLE_INDEX_BASE */
+	1460 / 4,											/* TEXT_INDEX_BASE */
+	1700 / 4,											/* NUM_GAME_OFFSETS */
+	64,														/* NUM_VIDEO_OP_CODES */
+	1000000,											/* VGA_MEM_SIZE */
+	50000,												/* TABLES_MEM_SIZE */
+	3624,													/* NUM_VOICE_RESOURCES */
+	141,													/* NUM_EFFECT_RESOURCES */
+	1316 / 4,											/* MUSIC_INDEX_BASE */
+	0,														/* SOUND_INDEX_BASE */
+	"SIMON.GME",									/* gme_filename */
+	"SIMON.WAV",									/* wav_filename */
+	"SIMON.VOC",									/* wav_filename2 */
+	"EFFECTS.VOC",								/* effects_filename */
+	"GAMEPC",											/* gamepc_filename */
+};
+
+static const GameSpecificSettings simon2_settings = {
+	5,														/* VGA_DELAY_BASE */
+	1580 / 4,											/* TABLE_INDEX_BASE */
+	1500 / 4,											/* TEXT_INDEX_BASE */
+	2116 / 4,											/* NUM_GAME_OFFSETS */
+	75,														/* NUM_VIDEO_OP_CODES */
+	2000000,											/* VGA_MEM_SIZE */
+	100000,												/* TABLES_MEM_SIZE */
+	12256,												/* NUM_VOICE_RESOURCES */
+	0,
+	1128 / 4,											/* MUSIC_INDEX_BASE */
+	1660 / 4,											/* SOUND_INDEX_BASE */
+	"SIMON2.GME",									/* gme_filename */
+	"SIMON2.WAV",									/* wav_filename */
+	NULL,
+	"",
+	"GSPTR30",										/* gamepc_filename */
+};
+
+static const GameSpecificSettings simon2win_settings = {
+	5,														/* VGA_DELAY_BASE */
+	1580 / 4,											/* TABLE_INDEX_BASE */
+	1500 / 4,											/* TEXT_INDEX_BASE */
+	2116 / 4,											/* NUM_GAME_OFFSETS */
+	75,														/* NUM_VIDEO_OP_CODES */
+	2000000,											/* VGA_MEM_SIZE */
+	100000,												/* TABLES_MEM_SIZE */
+	12256,												/* NUM_VOICE_RESOURCES */
+	0,
+	1128 / 4,											/* MUSIC_INDEX_BASE */
+	1660 / 4,											/* SOUND_INDEX_BASE */
+	"SIMON2.GME",									/* gme_filename */
+	"SIMON2.WAV",									/* wav_filename */
+	NULL,
+	"",
+	"GSPTR30",										/* gamepc_filename */
+};
+
+static const GameSpecificSettings simon2dos_settings = {
+	5,														/* VGA_DELAY_BASE */
+	1580 / 4,											/* TABLE_INDEX_BASE */
+	1500 / 4,											/* TEXT_INDEX_BASE */
+	2116 / 4,											/* NUM_GAME_OFFSETS */
+	75,														/* NUM_VIDEO_OP_CODES */
+	2000000,											/* VGA_MEM_SIZE */
+	100000,												/* TABLES_MEM_SIZE */
+	12256,												/* NUM_VOICE_RESOURCES */
+	0,
+	1128 / 4,											/* MUSIC_INDEX_BASE */
+	1660 / 4,											/* SOUND_INDEX_BASE */
+	"SIMON2.GME",									/* gme_filename */
+	"SIMON2.WAV",									/* wav_filename */
+	NULL,
+	"",
+	"GAME32",											/* gamepc_filename */
+};
+
+
+SimonState::SimonState()
+{
+	_dummy_item_1 = new Item();
+	_dummy_item_2 = new Item();
+	_dummy_item_3 = new Item();
+	
+	_fcs_list = new FillOrCopyStruct[16];
+}
+
+SimonState::~SimonState()
+{
+	delete _dummy_item_1;
+	delete _dummy_item_2;
+	delete _dummy_item_3;
+	
+	delete [] _fcs_list;
+}
+
 SimonState *SimonState::create(OSystem *syst, MidiDriver *driver)
 {
 	SimonState *s = new SimonState;
@@ -440,11 +528,11 @@
 	case -3:
 		return _object_item;
 	case -5:
-		return &_dummy_item_2;
+		return _dummy_item_2;
 	case -7:
 		return NULL;
 	case -9:
-		return &_dummy_item_3;
+		return _dummy_item_3;
 	default:
 		return derefItem(a);
 	}
@@ -474,7 +562,7 @@
 {
 	if (_item_1_ptr)
 		return _item_1_ptr;
-	return &_dummy_item_1;
+	return _dummy_item_1;
 }
 
 Item *SimonState::getItemPtrB()
@@ -482,7 +570,7 @@
 	error("getItemPtrB: is this code ever used?");
 	if (_item_ptr_B)
 		return _item_ptr_B;
-	return &_dummy_item_1;
+	return _dummy_item_1;
 }
 
 uint SimonState::getNextVarContents()
@@ -967,10 +1055,10 @@
 	_item_1_ptr = item;
 	_object_item = _hitarea_object_item;
 
-	if (_object_item == &_dummy_item_2)
+	if (_object_item == _dummy_item_2)
 		_object_item = getItem1Ptr();
 
-	if (_object_item == &_dummy_item_3)
+	if (_object_item == _dummy_item_3)
 		_object_item = derefItem(getItem1Ptr()->parent);
 
 	if (_object_item != NULL) {
@@ -1007,7 +1095,11 @@
 		_left_button_down = 0;
 
 		do {
+#ifdef WIN32
 			if (GetAsyncKeyState(VK_F5) != 0 && _bit_array[0] & 0x200) {
+#else
+			if (_bit_array[0] & 0x200) {
+#endif
 				startSubroutine170();
 				goto out_of_here;
 			}
@@ -1071,7 +1163,9 @@
 
 	if (_lock_counter != 0) {
 		if (_lock_counter == 1) {
+#ifdef WIN32
 			GetAsyncKeyState(VK_LBUTTON);
+#endif
 		}
 		_lock_counter--;
 	}
@@ -1550,8 +1644,8 @@
 
 void SimonState::pollMouseXY()
 {
-	_mouse_x = sdl_mouse_x;
-	_mouse_y = sdl_mouse_y;
+	_mouse_x = _sdl_mouse_x;
+	_mouse_y = _sdl_mouse_y;
 }
 
 void SimonState::handle_verb_clicked(uint verb)
@@ -1562,18 +1656,18 @@
 	_item_1_ptr = _item_1;
 
 	_object_item = _hitarea_object_item;
-	if (_object_item == &_dummy_item_2) {
+	if (_object_item == _dummy_item_2) {
 		_object_item = getItem1Ptr();
 	}
-	if (_object_item == &_dummy_item_3) {
+	if (_object_item == _dummy_item_3) {
 		_object_item = derefItem(getItem1Ptr()->parent);
 	}
 
 	_subject_item = _hitarea_subject_item;
-	if (_subject_item == &_dummy_item_2) {
+	if (_subject_item == _dummy_item_2) {
 		_subject_item = getItem1Ptr();
 	}
-	if (_subject_item == &_dummy_item_3) {
+	if (_subject_item == _dummy_item_3) {
 		_subject_item = derefItem(getItem1Ptr()->parent);
 	}
 
@@ -2487,7 +2581,7 @@
 	}
 
 #ifdef DRAW_IMAGES_DEBUG
-	memset(sdl_buf_attached, 0, 320 * 200);
+	memset(_sdl_buf_attached, 0, 320 * 200);
 #endif
 	_video_var_8++;
 	_vc_ptr = vc_ptr_org;
@@ -2517,7 +2611,7 @@
 	dx_unlock_2();
 
 
-	memcpy(sdl_buf_attached, sdl_buf, 320 * 200);
+	memcpy(_sdl_buf_attached, _sdl_buf, 320 * 200);
 	dx_copy_from_attached_to_3(_vga_var5);
 
 
@@ -4111,7 +4205,7 @@
 	uint i;
 
 	dst = dx_lock_2();
-	src = sdl_buf_3;
+	src = _sdl_buf_3;
 
 	dst += y * _dx_surface_pitch;
 	src += y * _dx_surface_pitch;
@@ -4129,26 +4223,26 @@
 
 void SimonState::dx_clear_surfaces(uint num_lines)
 {
-	memset(sdl_buf_attached, 0, num_lines * 320);
+	memset(_sdl_buf_attached, 0, num_lines * 320);
 
-	_system->copy_rect(sdl_buf_attached, 320, 0, 0, 320, 200);
+	_system->copy_rect(_sdl_buf_attached, 320, 0, 0, 320, 200);
 
 	if (_dx_use_3_or_4_for_lock) {
-		memset(sdl_buf, 0, num_lines * 320);
-		memset(sdl_buf_3, 0, num_lines * 320);
+		memset(_sdl_buf, 0, num_lines * 320);
+		memset(_sdl_buf_3, 0, num_lines * 320);
 	}
 }
 
 void SimonState::dx_clear_attached_from_top(uint lines)
 {
-	memset(sdl_buf_attached, 0, lines * 320);
+	memset(_sdl_buf_attached, 0, lines * 320);
 }
 
 void SimonState::dx_copy_from_attached_to_2(uint x, uint y, uint w, uint h)
 {
 	uint offs = x + y * 320;
-	byte *s = sdl_buf_attached + offs;
-	byte *d = sdl_buf + offs;
+	byte *s = _sdl_buf_attached + offs;
+	byte *d = _sdl_buf + offs;
 
 	do {
 		memcpy(d, s, w);
@@ -4160,8 +4254,8 @@
 void SimonState::dx_copy_from_2_to_attached(uint x, uint y, uint w, uint h)
 {
 	uint offs = x + y * 320;
-	byte *s = sdl_buf + offs;
-	byte *d = sdl_buf_attached + offs;
+	byte *s = _sdl_buf + offs;
+	byte *d = _sdl_buf_attached + offs;
 
 	do {
 		memcpy(d, s, w);
@@ -4174,7 +4268,7 @@
 
 void SimonState::dx_copy_from_attached_to_3(uint lines)
 {
-	memcpy(sdl_buf_3, sdl_buf_attached, lines * 320);
+	memcpy(_sdl_buf_3, _sdl_buf_attached, lines * 320);
 }
 
 void SimonState::dx_update_screen_and_palette()
@@ -4193,13 +4287,13 @@
 
 		if (_mouse_pos_changed) {
 			_mouse_pos_changed = false;
-			_system->set_mouse_pos(sdl_mouse_x, sdl_mouse_y);
+			_system->set_mouse_pos(_sdl_mouse_x, _sdl_mouse_y);
 		}
-		_system->copy_rect(sdl_buf_attached, 320, 0, 0, 320, 200);
+		_system->copy_rect(_sdl_buf_attached, 320, 0, 0, 320, 200);
 		_system->update_screen();
 	}
 
-	memcpy(sdl_buf_attached, sdl_buf, 320 * 200);
+	memcpy(_sdl_buf_attached, _sdl_buf, 320 * 200);
 
 	if (_palette_color_count != 0) {
 		if (!(_game & GAME_SIMON2) && _use_palette_delay) {
@@ -4233,9 +4327,9 @@
 		_dump_file = stdout;
 
 	/* allocate buffers */
-	sdl_buf_3 = (byte *)calloc(320 * 200, 1);
-	sdl_buf = (byte *)calloc(320 * 200, 1);
-	sdl_buf_attached = (byte *)calloc(320 * 200, 1);
+	_sdl_buf_3 = (byte *)calloc(320 * 200, 1);
+	_sdl_buf = (byte *)calloc(320 * 200, 1);
+	_sdl_buf_attached = (byte *)calloc(320 * 200, 1);
 
 	if (_game == GAME_SIMON2WIN) {
 		gss = &simon2win_settings;
@@ -4304,7 +4398,8 @@
 
 		while (_system->poll_event(&event)) {
 			switch (event.event_code) {
-				case OSystem::EVENT_KEYDOWN:if (event.kbd.keycode == 't') {
+				case OSystem::EVENT_KEYDOWN:
+				if (event.kbd.keycode == 't') {
 					_vk_t_toggle ^= 1;
 				} else if (event.kbd.flags == OSystem::KBD_CTRL) {
 					if (event.kbd.keycode == 'f') {
@@ -4313,19 +4408,22 @@
 				}
 				_key_pressed = (byte)event.kbd.ascii;
 				break;
-				case OSystem::EVENT_MOUSEMOVE:sdl_mouse_x = event.mouse.x;
-				sdl_mouse_y = event.mouse.y;
+				case OSystem::EVENT_MOUSEMOVE:
+				_sdl_mouse_x = event.mouse.x;
+				_sdl_mouse_y = event.mouse.y;
 				_mouse_pos_changed = true;
 				break;
 
-				case OSystem::EVENT_LBUTTONDOWN:_left_button_down++;
+				case OSystem::EVENT_LBUTTONDOWN:
+				_left_button_down++;
 #ifdef _WIN32_WCE
-				sdl_mouse_x = event.mouse.x;
-				sdl_mouse_y = event.mouse.y;
+				_sdl_mouse_x = event.mouse.x;
+				_sdl_mouse_y = event.mouse.y;
 #endif
 				break;
 
-				case OSystem::EVENT_RBUTTONDOWN:_exit_cutscene = true;
+				case OSystem::EVENT_RBUTTONDOWN:
+				_exit_cutscene = true;
 				break;
 			}
 		}
@@ -4824,7 +4922,7 @@
 byte *SimonState::dx_lock_2()
 {
 	_dx_surface_pitch = 320;
-	return sdl_buf;
+	return _sdl_buf;
 }
 
 void SimonState::dx_unlock_2()
@@ -4834,7 +4932,7 @@
 byte *SimonState::dx_lock_attached()
 {
 	_dx_surface_pitch = 320;
-	return _dx_use_3_or_4_for_lock ? sdl_buf_3 : sdl_buf_attached;
+	return _dx_use_3_or_4_for_lock ? _sdl_buf_3 : _sdl_buf_attached;
 }
 
 void SimonState::dx_unlock_attached()

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- simon.h	14 Aug 2002 10:18:03 -0000	1.25
+++ simon.h	18 Aug 2002 16:21:08 -0000	1.26
@@ -19,9 +19,13 @@
  *
  */
 
+#ifndef SIMON_H
+#define SIMON_H
+
 #include <time.h>
 #include <sys/stat.h>
 #include "engine.h"
+#include "simon/midi.h"
 
 /* Various other settings */
 //#define DUMP_CONTINOUS_MAINSCRIPT
@@ -48,111 +52,21 @@
 #define CHECK_BOUNDS(x,y) assert((uint)(x)<ARRAYSIZE(y))
 #define NUM_PALETTE_FADEOUT 32
 
-struct Child {
-	Child *next;
-	uint16 type;
-};
-
-struct Child2 {
-	Child hdr;
-
-	uint16 string_id;
-	uint32 avail_props;
-	int16 array[1];
-};
-
-struct Child1 {
-	Child hdr;
-
-	uint16 subroutine_id;
-	uint16 fr2;
-	uint16 array[1];
-};
-
-struct Child9 {
-	Child hdr;
-
-	uint16 array[4];
-};
+struct Child;
+struct Child1;
+struct Child2;
+struct Child3;
 
-struct Child3 {
-	Child hdr;
-};
+struct Item;
+struct FillOrCopyStruct;
+struct Subroutine;
+struct SubroutineLine;
+struct TimeEvent;
 
 struct ThreeValues {
 	int16 a, b, c;
 };
 
-enum {
-	CHILD1_SIZE = sizeof(Child1) - sizeof(uint16),
-	CHILD2_SIZE = sizeof(Child2) - sizeof(int16)
-};
-
-struct Item {
-	uint16 parent;
-	uint16 child;
-	uint16 sibling;
-	int16 unk1;
-	int16 unk2;
-	int16 unk3;										/* signed int */
-	uint16 unk4;
-	uint16 xxx_1;									/* unused? */
-	Child *children;
-};
-
-struct Subroutine {
-	uint16 id;										/* subroutine ID */
-	uint16 first;									/* offset from subroutine start to first subroutine line */
-	Subroutine *next;							/* next subroutine in linked list */
-};
-
-struct FillOrCopyDataEntry {
-	Item *item;
-	uint16 hit_area;
-	uint16 xxx_1;
-};
-
-struct FillOrCopyData {
-	int16 unk1;
-	Item *item_ptr;
-	FillOrCopyDataEntry e[64];
-	int16 unk3, unk4;
-	uint16 unk2;
-};
-
-struct FillOrCopyStruct {
-	byte mode;
-	byte flags;
-	uint16 x, y;
-	uint16 width, height;
-	uint16 textColumn, textRow;
-	uint8 textColumnOffset, textLength, textMaxLength;
-    uint8 fill_color, text_color, unk5;
-	FillOrCopyData *fcs_data;
-};
-// note on text offset: 
-// the actual x-coordinate is: textColumn * 8 + textColumnOffset
-// the actual y-coordinate is: textRow * 8
-
-
-enum {
-	SUBROUTINE_LINE_SMALL_SIZE = 2,
-	SUBROUTINE_LINE_BIG_SIZE = 8,
-};
-
-struct SubroutineLine {
-	uint16 next;
-	int16 cond_a;
-	int16 cond_b;
-	int16 cond_c;
-};
-
-struct TimeEvent {
-	uint32 time;
-	uint16 subroutine_id;
-	TimeEvent *next;
-};
-
 struct HitArea {
 	uint16 x, y;
 	uint16 width, height;
@@ -192,165 +106,7 @@
 	uint16 cur_vga_file;
 };
 
-struct VgaFile1Header {
-	uint16 x_1, x_2;
-	uint16 hdr2_start;
-	uint16 x_3, x_4;
-};
-
-struct VgaFile1Header2 {
-	uint16 x_1;
-	uint16 unk1;
-	uint16 x_2;
-	uint16 id_count;
-	uint16 x_3;
-	uint16 unk2_offs;
-	uint16 x_4;
-	uint16 id_table;
-	uint16 x_5;
-};
-
-struct VgaFile1Struct0x8 {
-	uint16 id;
-	uint16 x_1;
-	uint16 x_2;
-	uint16 script_offs;
-};
-
-struct VgaFile1Struct0x6 {
-	uint16 id;
-	uint16 x_2;
-	uint16 script_offs;
-};
-
-/* dummy typedefs to make it compile in *nix */
-#if defined(UNIX) || defined(__MORPHOS__) || defined(__DC__) || defined(macintosh)
-typedef void *HMIDISTRM;
-typedef void *HMIDIOUT;
-typedef uint32 UINT;
-typedef void *MIDIHDR;
-typedef uint32 MMRESULT;
-#define CALLBACK
-typedef uint32 DWORD;
-
-enum {
-	VK_F5 = 1,
-	VK_LBUTTON = 2,
-	VK_SHIFT = 3,
-
-};
-
-int GetAsyncKeyState(int key);
-#endif
-
-class MidiDriver;
-struct MidiEvent;
-
-class MidiPlayer {
-public:
-	void read_all_songs(FILE *in);
-	void read_all_songs_old(FILE *in);
-	void initialize();
-	void shutdown();
-	void play();
-	void set_driver(MidiDriver *md);
-
-private:
-	struct Track {
-		uint32 a;
-		uint32 data_size;
-		uint32 data_cur_size;
-		byte *data_ptr;
-		byte *data_cur_ptr;
-		uint32 delay;
-		byte last_cmd;
-	};
-
-	struct Song {
-		uint ppqn;
-		uint midi_format;
-		uint num_tracks;
-		Track *tracks;
-	};
-
-	struct NoteRec {
-		uint32 delay;
-		byte cmd;
-		byte param_1;
-		byte param_2;
-		uint cmd_length;
-		byte *sysex_data;
-	};
-
-	MidiDriver *_md;
-
-	FILE *_input;
-
-	uint _midi_var10, _midi_5;
-	bool _midi_var9;
-	byte _midi_var1;
-	bool _shutting_down;
-	uint _midi_var8;
-
-	uint _midi_var11;
-
-	uint32 _midi_tempo;
-
-	Track *_midi_tick_track_ptr;
-	Track *_midi_track_ptr;
-	int16 _midi_song_id;
-	int16 _midi_song_id_2;
-	int16 _midi_var2;
-
-	Song *_midi_cur_song_ptr;
-
-	uint32 _midi_volume_table[16];
-
-	Song _midi_songs[8];
-
-	void read_mthd(Song *s, bool old);
-
-	void read_from_file(void *dst, uint size);
-	void read_one_song(Song *s);
-	byte read_byte_from_file();
-	uint32 read_uint32_from_file();
-	uint16 read_uint16_from_file();
-
-	static uint32 track_read_gamma(Track *t);
-	static byte track_read_byte(Track *t);
-
-	int fill(MidiEvent *me, int num_event);
-	bool fill_helper(NoteRec *nr, MidiEvent *me);
-
-	void reset_tracks();
-	void read_next_note(Track *t, NoteRec *nr);
-
-	void unload();
-
-	static int on_fill(void *param, MidiEvent *ev, int num);
-
-};
-
-
-struct GameSpecificSettings {
-	uint VGA_DELAY_BASE;
-	uint TABLE_INDEX_BASE;
-	uint TEXT_INDEX_BASE;
-	uint NUM_GAME_OFFSETS;
-	uint NUM_VIDEO_OP_CODES;
-	uint VGA_MEM_SIZE;
-	uint TABLES_MEM_SIZE;
-	uint NUM_VOICE_RESOURCES;
-	uint NUM_EFFECTS_RESOURCES;
-	uint MUSIC_INDEX_BASE;
-	uint SOUND_INDEX_BASE;
-	const char *gme_filename;
-	const char *wav_filename;
-	const char *wav_filename2;
-	const char *effects_filename;
-	const char *gamepc_filename;
-};
-
+struct GameSpecificSettings;
 
 class SimonState : public Engine {
 public:
@@ -487,9 +243,9 @@
 	uint _mouse_x, _mouse_y;
 	uint _mouse_x_old, _mouse_y_old;
 
-	Item _dummy_item_1;
-	Item _dummy_item_2;
-	Item _dummy_item_3;
+	Item *_dummy_item_1;
+	Item *_dummy_item_2;
+	Item *_dummy_item_3;
 
 	uint16 _lock_word;
 	uint16 _scroll_up_hit_area;
@@ -569,7 +325,7 @@
 
 	VgaTimerEntry _vga_timer_list[95];
 
-	FillOrCopyStruct _fcs_list[16];
+	FillOrCopyStruct *_fcs_list;
 
 	byte _letters_to_print_buf[80];
 
@@ -594,6 +350,15 @@
 	bool _save_or_load;
 	bool _saveload_flag;
 
+	int _sdl_mouse_x, _sdl_mouse_y;
+	
+	byte *_sdl_buf_3;
+	byte *_sdl_buf;
+	byte *_sdl_buf_attached;
+
+	SimonState();
+	virtual ~SimonState();
+
 	int allocGamePcVars(FILE *in);
 	Item *allocItem1();
 	void loginPlayerHelper(Item *item, int a, int b);
@@ -1064,78 +829,4 @@
 void dx_set_palette(uint32 *colors, uint num);
 void palette_fadeout(uint32 *pal_values, uint num);
 
-static const GameSpecificSettings simon1_settings = {
-	1,														/* VGA_DELAY_BASE */
-	1576 / 4,											/* TABLE_INDEX_BASE */
-	1460 / 4,											/* TEXT_INDEX_BASE */
-	1700 / 4,											/* NUM_GAME_OFFSETS */
-	64,														/* NUM_VIDEO_OP_CODES */
-	1000000,											/* VGA_MEM_SIZE */
-	50000,												/* TABLES_MEM_SIZE */
-	3624,													/* NUM_VOICE_RESOURCES */
-	141,													/* NUM_EFFECT_RESOURCES */
-	1316 / 4,											/* MUSIC_INDEX_BASE */
-	0,														/* SOUND_INDEX_BASE */
-	"SIMON.GME",									/* gme_filename */
-	"SIMON.WAV",									/* wav_filename */
-	"SIMON.VOC",									/* wav_filename2 */
-	"EFFECTS.VOC",								/* effects_filename */
-	"GAMEPC",											/* gamepc_filename */
-};
-
-static const GameSpecificSettings simon2_settings = {
-	5,														/* VGA_DELAY_BASE */
-	1580 / 4,											/* TABLE_INDEX_BASE */
-	1500 / 4,											/* TEXT_INDEX_BASE */
-	2116 / 4,											/* NUM_GAME_OFFSETS */
-	75,														/* NUM_VIDEO_OP_CODES */
-	2000000,											/* VGA_MEM_SIZE */
-	100000,												/* TABLES_MEM_SIZE */
-	12256,												/* NUM_VOICE_RESOURCES */
-	0,
-	1128 / 4,											/* MUSIC_INDEX_BASE */
-	1660 / 4,											/* SOUND_INDEX_BASE */
-	"SIMON2.GME",									/* gme_filename */
-	"SIMON2.WAV",									/* wav_filename */
-	NULL,
-	"",
-	"GSPTR30",										/* gamepc_filename */
-};
-
-static const GameSpecificSettings simon2win_settings = {
-	5,														/* VGA_DELAY_BASE */
-	1580 / 4,											/* TABLE_INDEX_BASE */
-	1500 / 4,											/* TEXT_INDEX_BASE */
-	2116 / 4,											/* NUM_GAME_OFFSETS */
-	75,														/* NUM_VIDEO_OP_CODES */
-	2000000,											/* VGA_MEM_SIZE */
-	100000,												/* TABLES_MEM_SIZE */
-	12256,												/* NUM_VOICE_RESOURCES */
-	0,
-	1128 / 4,											/* MUSIC_INDEX_BASE */
-	1660 / 4,											/* SOUND_INDEX_BASE */
-	"SIMON2.GME",									/* gme_filename */
-	"SIMON2.WAV",									/* wav_filename */
-	NULL,
-	"",
-	"GSPTR30",										/* gamepc_filename */
-};
-
-static const GameSpecificSettings simon2dos_settings = {
-	5,														/* VGA_DELAY_BASE */
-	1580 / 4,											/* TABLE_INDEX_BASE */
-	1500 / 4,											/* TEXT_INDEX_BASE */
-	2116 / 4,											/* NUM_GAME_OFFSETS */
-	75,														/* NUM_VIDEO_OP_CODES */
-	2000000,											/* VGA_MEM_SIZE */
-	100000,												/* TABLES_MEM_SIZE */
-	12256,												/* NUM_VOICE_RESOURCES */
-	0,
-	1128 / 4,											/* MUSIC_INDEX_BASE */
-	1660 / 4,											/* SOUND_INDEX_BASE */
-	"SIMON2.GME",									/* gme_filename */
-	"SIMON2.WAV",									/* wav_filename */
-	NULL,
-	"",
-	"GAME32",											/* gamepc_filename */
-};
+#endif

Index: simondebug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simondebug.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- simondebug.cpp	7 Jul 2002 19:06:48 -0000	1.2
+++ simondebug.cpp	18 Aug 2002 16:21:08 -0000	1.3
@@ -22,6 +22,7 @@
 // Simon debug functions
 #include "stdafx.h"
 #include "simon.h"
+#include "simonintern.h"
 
 #ifdef SIMONDEBUG
 #define SIMON2

Index: simonitems.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simonitems.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- simonitems.cpp	11 Aug 2002 09:05:30 -0000	1.5
+++ simonitems.cpp	18 Aug 2002 16:21:08 -0000	1.6
@@ -22,6 +22,7 @@
 // Item script opcodes for Simon1/Simon2
 #include "stdafx.h"
 #include "simon.h"
+#include "simonintern.h"
 
 #ifdef _WIN32_WCE
 
@@ -372,7 +373,7 @@
 				int h = getVarOrWord();
 				int number = getVarOrByte();
 				if (number < 20)
-					addNewHitArea(id, x, y, w, h, (number << 8) + 129, 0xD0, &_dummy_item_2);
+					addNewHitArea(id, x, y, w, h, (number << 8) + 129, 0xD0, _dummy_item_2);
 			}
 			break;
 

Index: simonres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simonres.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- simonres.cpp	4 Aug 2002 16:21:28 -0000	1.4
+++ simonres.cpp	18 Aug 2002 16:21:08 -0000	1.5
@@ -22,6 +22,7 @@
 // Resource file routines for Simon1/Simon2
 #include "stdafx.h"
 #include "simon.h"
+#include "simonintern.h"
 
 // Script opcodes to load into memory
 static const char *const opcode_arg_table_simon1win[256] = {

Index: simonsys.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simonsys.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- simonsys.cpp	7 Jul 2002 19:06:48 -0000	1.10
+++ simonsys.cpp	18 Aug 2002 16:21:08 -0000	1.11
@@ -69,11 +69,3 @@
 	value = TO_BE_16(value);
 	fwrite(&value, sizeof(value), 1, in);
 }
-
-#ifndef WIN32
-/* GetAsyncKeyState for unix */
-int GetAsyncKeyState(int key)
-{
-	return 0;
-}
-#endif

Index: simonverb.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simonverb.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- simonverb.cpp	4 Aug 2002 13:25:06 -0000	1.4
+++ simonverb.cpp	18 Aug 2002 16:21:08 -0000	1.5
@@ -22,6 +22,7 @@
 // Verb and hitarea handling
 #include "stdafx.h"
 #include "simon.h"
+#include "simonintern.h"
 
 void SimonState::defocusHitarea()
 {
@@ -430,7 +431,7 @@
 	uint x;
 	const byte *string_ptr;
 
-	if (item == 0 || item == &_dummy_item_2 || item == &_dummy_item_3)
+	if (item == 0 || item == _dummy_item_2 || item == _dummy_item_3)
 		return false;
 
 	child2 = findChildOfType2(item);

Index: simonvga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simonvga.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- simonvga.cpp	18 Jul 2002 22:49:59 -0000	1.3
+++ simonvga.cpp	18 Aug 2002 16:21:08 -0000	1.4
@@ -22,6 +22,7 @@
 // Video script opcodes for Simon1/Simon2
 #include "stdafx.h"
 #include "simon.h"
+#include "simonintern.h"
 
 typedef void (SimonState::*VgaOpcodeProc) ();
 static const uint16 vc_get_out_of_code = 0;





More information about the Scummvm-git-logs mailing list