1 | --- simon.cpp.orig Thu May 30 20:11:14 2002
|
---|
2 | +++ simon.cpp Thu May 30 23:47:48 2002
|
---|
3 | @@ -19,6 +19,7 @@
|
---|
4 | *
|
---|
5 | */
|
---|
6 |
|
---|
7 | +#define MY_SIMON
|
---|
8 |
|
---|
9 | #include "stdafx.h"
|
---|
10 | #include "scummsys.h"
|
---|
11 | @@ -54,10 +55,18 @@
|
---|
12 | 1000000, /* VGA_MEM_SIZE */
|
---|
13 | 50000, /* TABLES_MEM_SIZE */
|
---|
14 | 3624, /* NUM_VOICE_RESOURCES */
|
---|
15 | +#ifdef MY_SIMON
|
---|
16 | + 141, /* NUM_EFFECTS_RESOURCES */
|
---|
17 | +#endif
|
---|
18 | 1316/4, /* MUSIC_INDEX_BASE */
|
---|
19 | 0, /* SOUND_INDEX_BASE */
|
---|
20 | "SIMON.GME", /* gme_filename */
|
---|
21 | +#ifndef MY_SIMON
|
---|
22 | "SIMON.WAV", /* wav_filename */
|
---|
23 | +#else
|
---|
24 | + "SIMON.VOC", /* wav_filename */
|
---|
25 | + "EFFECTS.VOC", /* effects_filename */
|
---|
26 | +#endif
|
---|
27 | "GAMEPC", /* gamepc_filename */
|
---|
28 | };
|
---|
29 |
|
---|
30 | @@ -70,10 +79,16 @@
|
---|
31 | 2000000, /* VGA_MEM_SIZE */
|
---|
32 | 100000, /* TABLES_MEM_SIZE */
|
---|
33 | 12256, /* NUM_VOICE_RESOURCES */
|
---|
34 | +#ifdef MY_SIMON
|
---|
35 | + 0,
|
---|
36 | +#endif
|
---|
37 | 1128/4, /* MUSIC_INDEX_BASE */
|
---|
38 | 1660/4, /* SOUND_INDEX_BASE */
|
---|
39 | "SIMON2.GME", /* gme_filename */
|
---|
40 | "SIMON2.WAV", /* wav_filename */
|
---|
41 | +#ifdef MY_SIMON
|
---|
42 | + "",
|
---|
43 | +#endif
|
---|
44 | "GSPTR30", /* gamepc_filename */
|
---|
45 | };
|
---|
46 |
|
---|
47 | @@ -8256,10 +8271,34 @@
|
---|
48 |
|
---|
49 | if (fread(_voice_offsets, gss->NUM_VOICE_RESOURCES * sizeof(uint32), 1, _voice_file) != 1)
|
---|
50 | error("Cannot read voice offsets");
|
---|
51 | +
|
---|
52 | +#ifdef MY_SIMON
|
---|
53 | + const char *e = gss->effects_filename;
|
---|
54 | +
|
---|
55 | + _effects_offsets = NULL;
|
---|
56 | +
|
---|
57 | + _effects_file = fopen_maybe_lowercase(e);
|
---|
58 | + if (_effects_file == NULL) {
|
---|
59 | + warning("Cannot open %s",e);
|
---|
60 | + return;
|
---|
61 | + }
|
---|
62 | +
|
---|
63 | + _effects_offsets = (uint32*)malloc(gss->NUM_EFFECTS_RESOURCES * sizeof(uint32));
|
---|
64 | + if (_effects_offsets == NULL)
|
---|
65 | + error("Out of memory for effects offsets");
|
---|
66 | +
|
---|
67 | + if (fread(_effects_offsets, gss->NUM_EFFECTS_RESOURCES * sizeof(uint32), 1, _effects_file) != 1)
|
---|
68 | + error("Cannot read effects offsets");
|
---|
69 | +#endif
|
---|
70 | +
|
---|
71 | #if defined(SCUMM_BIG_ENDIAN)
|
---|
72 | for( int r = 0; r < gss->NUM_VOICE_RESOURCES; r++ )
|
---|
73 | _voice_offsets[ r ] = READ_LE_UINT32( &_voice_offsets[ r ] );
|
---|
74 | -#endif
|
---|
75 | +#ifdef MY_SIMON
|
---|
76 | + for( int r = 0; r < gss->NUM_EFFECTS_RESOURCES; r++ )
|
---|
77 | + _effects_offsets[ r ] = READ_LE_UINT32( &_effects_offsets[ r ] );
|
---|
78 | +#endif /* MY_SIMON */
|
---|
79 | +#endif /* defined(SCUMM_BIG_ENDIAN) */
|
---|
80 | }
|
---|
81 | }
|
---|
82 |
|
---|
83 | @@ -8284,14 +8323,29 @@
|
---|
84 | uint16 bits_per_sample;
|
---|
85 | } GCC_PACK;
|
---|
86 |
|
---|
87 | +struct VocHeader {
|
---|
88 | + uint8 desc[20];
|
---|
89 | + uint16 datablock_offset;
|
---|
90 | + uint16 version;
|
---|
91 | + uint16 id;
|
---|
92 | + uint8 blocktype;
|
---|
93 | +} GCC_PACK;
|
---|
94 | +
|
---|
95 | +struct VocBlockHeader {
|
---|
96 | + uint8 tc;
|
---|
97 | + uint8 pack;
|
---|
98 | +} GCC_PACK;
|
---|
99 | +
|
---|
100 | #if !defined(__GNUC__)
|
---|
101 | #pragma END_PACK_STRUCTS
|
---|
102 | #endif
|
---|
103 |
|
---|
104 |
|
---|
105 | void SimonState::playVoice(uint voice) {
|
---|
106 | +#ifndef MY_SIMON
|
---|
107 | WaveHeader wave_hdr;
|
---|
108 | uint32 data[2];
|
---|
109 | +#endif
|
---|
110 |
|
---|
111 | // assert(voice < 14496/4);
|
---|
112 |
|
---|
113 | @@ -8302,6 +8356,7 @@
|
---|
114 |
|
---|
115 | fseek(_voice_file, _voice_offsets[voice], SEEK_SET);
|
---|
116 |
|
---|
117 | +#ifndef MY_SIMON
|
---|
118 | if (fread(&wave_hdr, sizeof(wave_hdr), 1, _voice_file)!=1 ||
|
---|
119 | wave_hdr.riff!=MKID('RIFF') || wave_hdr.wave!=MKID('WAVE') || wave_hdr.fmt!=MKID('fmt ') ||
|
---|
120 | READ_LE_UINT16(&wave_hdr.format_tag)!=1 || READ_LE_UINT16(&wave_hdr.channels)!=1 ||
|
---|
121 | @@ -8322,11 +8377,31 @@
|
---|
122 |
|
---|
123 | _mixer->play_raw(&_voice_sound, _voice_file, data[1], READ_LE_UINT32(&wave_hdr.samples_per_sec),
|
---|
124 | SoundMixer::FLAG_FILE|SoundMixer::FLAG_UNSIGNED);
|
---|
125 | +#else
|
---|
126 | + VocHeader voc_hdr;
|
---|
127 | + VocBlockHeader voc_block_hdr;
|
---|
128 | + uint32 size;
|
---|
129 | +
|
---|
130 | + if (fread(&voc_hdr, sizeof(voc_hdr), 1, _voice_file)!=1 ||
|
---|
131 | + strncmp((char *)voc_hdr.desc,"Creative Voice File\x1A",10)!=0) {
|
---|
132 | + warning("playVoice(%d): cannot read voc header", voice);
|
---|
133 | + return;
|
---|
134 | + }
|
---|
135 | +
|
---|
136 | + fread(&size, 3, 1, _voice_file);
|
---|
137 | + fread(&voc_block_hdr, sizeof(voc_block_hdr), 1, _voice_file);
|
---|
138 | +
|
---|
139 | + ulong samples_per_sec = 1000000L/(256L-(long)voc_block_hdr.tc);
|
---|
140 | +
|
---|
141 | + _mixer->play_raw(&_voice_sound, _voice_file, size, samples_per_sec,
|
---|
142 | + SoundMixer::FLAG_FILE|SoundMixer::FLAG_UNSIGNED);
|
---|
143 | +#endif
|
---|
144 | }
|
---|
145 |
|
---|
146 |
|
---|
147 | void SimonState::playSound(uint sound) {
|
---|
148 | if (_game & GAME_WIN) {
|
---|
149 | +#ifndef MY_SIMON
|
---|
150 | byte *p;
|
---|
151 |
|
---|
152 | _mixer->stop(_playing_sound);
|
---|
153 | @@ -8352,6 +8427,32 @@
|
---|
154 | }
|
---|
155 |
|
---|
156 | _mixer->play_raw(&_playing_sound, p+8,READ_LE_UINT32(p+4),22050,SoundMixer::FLAG_UNSIGNED);
|
---|
157 | +#else
|
---|
158 | + if (_effects_offsets == NULL)
|
---|
159 | + return;
|
---|
160 | +
|
---|
161 | + _mixer->stop(_effects_sound);
|
---|
162 | +
|
---|
163 | + fseek(_effects_file, _effects_offsets[sound], SEEK_SET);
|
---|
164 | +
|
---|
165 | + VocHeader voc_hdr;
|
---|
166 | + VocBlockHeader voc_block_hdr;
|
---|
167 | + uint32 size;
|
---|
168 | +
|
---|
169 | + if (fread(&voc_hdr, sizeof(voc_hdr), 1, _effects_file)!=1 ||
|
---|
170 | + strncmp((char *)voc_hdr.desc,"Creative Voice File\x1A",10)!=0) {
|
---|
171 | + warning("playSound(%d): cannot read voc header", sound);
|
---|
172 | + return;
|
---|
173 | + }
|
---|
174 | +
|
---|
175 | + fread(&size, 3, 1, _effects_file);
|
---|
176 | + fread(&voc_block_hdr, sizeof(voc_block_hdr), 1, _effects_file);
|
---|
177 | +
|
---|
178 | + ulong samples_per_sec = 1000000L/(256L-(long)voc_block_hdr.tc);
|
---|
179 | +
|
---|
180 | + _mixer->play_raw(&_effects_sound, _effects_file, size, samples_per_sec,
|
---|
181 | + SoundMixer::FLAG_FILE|SoundMixer::FLAG_UNSIGNED);
|
---|
182 | +#endif
|
---|
183 | } else {
|
---|
184 | warning("playSound(%d)", sound);
|
---|
185 | }
|
---|
186 | @@ -8364,7 +8465,11 @@
|
---|
187 |
|
---|
188 | /* FIXME: not properly implemented */
|
---|
189 | if (_game & GAME_WIN) {
|
---|
190 | +#ifndef MY_SIMON
|
---|
191 | fseek(_game_file, _game_offsets_ptr[gss->MUSIC_INDEX_BASE + music],SEEK_SET);
|
---|
192 | +#else
|
---|
193 | + fseek(_game_file, _game_offsets_ptr[gss->MUSIC_INDEX_BASE + music] - 1,SEEK_SET);
|
---|
194 | +#endif
|
---|
195 | f = _game_file;
|
---|
196 |
|
---|
197 | midi.read_all_songs(f);
|
---|
198 | --- simon.h.orig Thu May 30 21:10:30 2002
|
---|
199 | +++ simon.h Thu May 30 23:23:55 2002
|
---|
200 | @@ -19,6 +19,8 @@
|
---|
201 | *
|
---|
202 | */
|
---|
203 |
|
---|
204 | +#define MY_SIMON
|
---|
205 | +
|
---|
206 | /* GFX Settings. Sound & Music only works properly with SIMON1WIN */
|
---|
207 | #define USE_SOUND
|
---|
208 | #define USE_MUSIC
|
---|
209 | @@ -337,10 +339,16 @@
|
---|
210 | uint VGA_MEM_SIZE;
|
---|
211 | uint TABLES_MEM_SIZE;
|
---|
212 | uint NUM_VOICE_RESOURCES;
|
---|
213 | +#ifdef MY_SIMON
|
---|
214 | + uint NUM_EFFECTS_RESOURCES;
|
---|
215 | +#endif
|
---|
216 | uint MUSIC_INDEX_BASE;
|
---|
217 | uint SOUND_INDEX_BASE;
|
---|
218 | const char *gme_filename;
|
---|
219 | const char *wav_filename;
|
---|
220 | +#ifdef MY_SIMON
|
---|
221 | + const char *effects_filename;
|
---|
222 | +#endif
|
---|
223 | const char *gamepc_filename;
|
---|
224 | };
|
---|
225 |
|
---|
226 | @@ -374,6 +382,11 @@
|
---|
227 | FILE *_game_file;
|
---|
228 | FILE *_voice_file;
|
---|
229 | uint32 *_voice_offsets;
|
---|
230 | +#ifdef MY_SIMON
|
---|
231 | + FILE *_effects_file;
|
---|
232 | + uint32 *_effects_offsets;
|
---|
233 | +#endif
|
---|
234 | +
|
---|
235 |
|
---|
236 | byte *_stripped_txt_mem;
|
---|
237 | uint _text_size;
|
---|
238 | @@ -589,7 +602,11 @@
|
---|
239 | int _num_screen_updates;
|
---|
240 | int _vga_tick_counter;
|
---|
241 |
|
---|
242 | +#ifndef MY_SIMON
|
---|
243 | PlayingSoundHandle _playing_sound;
|
---|
244 | +#else
|
---|
245 | + PlayingSoundHandle _effects_sound;
|
---|
246 | +#endif
|
---|
247 | PlayingSoundHandle _voice_sound;
|
---|
248 |
|
---|
249 | int _timer_id;
|
---|