aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-12-01 00:45:16 +0000
committerMax Horn2003-12-01 00:45:16 +0000
commit242efda7fb8260fbd2120e2e7fc22de2b12bb371 (patch)
tree38be962a252ce5babefe69590320baf31c91c704
parent577aad5eddf9bf9c3df67a92da1f34446e20d6e5 (diff)
downloadscummvm-rg350-242efda7fb8260fbd2120e2e7fc22de2b12bb371.tar.gz
scummvm-rg350-242efda7fb8260fbd2120e2e7fc22de2b12bb371.tar.bz2
scummvm-rg350-242efda7fb8260fbd2120e2e7fc22de2b12bb371.zip
cleanup
svn-id: r11439
-rw-r--r--simon/debug.cpp2
-rw-r--r--simon/intern.h8
-rw-r--r--simon/simon.cpp104
-rw-r--r--simon/simon.h8
-rw-r--r--simon/sound.cpp4
-rw-r--r--simon/vga.cpp14
6 files changed, 52 insertions, 88 deletions
diff --git a/simon/debug.cpp b/simon/debug.cpp
index d1eb7c1e62..339e13cca0 100644
--- a/simon/debug.cpp
+++ b/simon/debug.cpp
@@ -183,7 +183,7 @@ void SimonEngine::dump_video_script(byte *src, bool one_opcode_only) {
opcode = *src++;
}
- if (opcode >= gss->NUM_VIDEO_OP_CODES) {
+ if (opcode >= NUM_VIDEO_OP_CODES) {
error("Invalid opcode %x\n", opcode);
return;
}
diff --git a/simon/intern.h b/simon/intern.h
index be0ffbe564..fbceb3a538 100644
--- a/simon/intern.h
+++ b/simon/intern.h
@@ -119,14 +119,6 @@ struct TimeEvent {
};
struct GameSpecificSettings {
- uint VGA_DELAY_BASE;
- uint TABLE_INDEX_BASE;
- uint TEXT_INDEX_BASE;
- uint NUM_VIDEO_OP_CODES;
- uint VGA_MEM_SIZE;
- uint TABLES_MEM_SIZE;
- uint MUSIC_INDEX_BASE;
- uint SOUND_INDEX_BASE;
#ifndef __PALM_OS__
const char *gme_filename;
const char *wav_filename;
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 7d814d4413..f4f333c8cd 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -118,14 +118,6 @@ static const GameSpecificSettings *simon2dos_settings;
#else
#define PTR(a) &a
static const GameSpecificSettings simon1_settings = {
- 1, // VGA_DELAY_BASE
- 1576 / 4, // TABLE_INDEX_BASE
- 1460 / 4, // TEXT_INDEX_BASE
- 64, // NUM_VIDEO_OP_CODES
- 1000000, // VGA_MEM_SIZE
- 50000, // TABLES_MEM_SIZE
- 1316 / 4, // MUSIC_INDEX_BASE
- 0, // SOUND_INDEX_BASE
"SIMON.GME", // gme_filename
"SIMON.WAV", // wav_filename
"SIMON.VOC", // voc_filename
@@ -136,14 +128,6 @@ static const GameSpecificSettings simon1_settings = {
};
static const GameSpecificSettings simon1acorn_settings = {
- 1, // VGA_DELAY_BASE
- 1576 / 4, // TABLE_INDEX_BASE
- 1460 / 4, // TEXT_INDEX_BASE
- 64, // NUM_VIDEO_OP_CODES
- 1000000, // VGA_MEM_SIZE
- 50000, // TABLES_MEM_SIZE
- 1316 / 4, // MUSIC_INDEX_BASE
- 0, // SOUND_INDEX_BASE
"DATA", // gme_filename
"", // wav_filename
"SIMON", // voc_filename
@@ -154,14 +138,6 @@ static const GameSpecificSettings simon1acorn_settings = {
};
static const GameSpecificSettings simon1amiga_settings = {
- 1, // VGA_DELAY_BASE
- 1576 / 4, // TABLE_INDEX_BASE
- 1460 / 4, // TEXT_INDEX_BASE
- 64, // NUM_VIDEO_OP_CODES
- 1000000, // VGA_MEM_SIZE
- 50000, // TABLES_MEM_SIZE
- 1316 / 4, // MUSIC_INDEX_BASE
- 0, // SOUND_INDEX_BASE
"", // gme_filename
"", // wav_filename
"", // voc_filename
@@ -172,14 +148,6 @@ static const GameSpecificSettings simon1amiga_settings = {
};
static const GameSpecificSettings simon1demo_settings = {
- 1, // VGA_DELAY_BASE
- 1576 / 4, // TABLE_INDEX_BASE
- 1460 / 4, // TEXT_INDEX_BASE
- 64, // NUM_VIDEO_OP_CODES
- 1000000, // VGA_MEM_SIZE
- 50000, // TABLES_MEM_SIZE
- 1316 / 4, // MUSIC_INDEX_BASE
- 0, // SOUND_INDEX_BASE
"", // gme_filename
"", // wav_filename
"", // voc_filename
@@ -190,14 +158,6 @@ static const GameSpecificSettings simon1demo_settings = {
};
static const GameSpecificSettings simon2win_settings = {
- 5, // VGA_DELAY_BASE
- 1580 / 4, // TABLE_INDEX_BASE
- 1500 / 4, // TEXT_INDEX_BASE
- 75, // NUM_VIDEO_OP_CODES
- 2000000, // VGA_MEM_SIZE
- 100000, // TABLES_MEM_SIZE
- 1128 / 4, // MUSIC_INDEX_BASE
- 1660 / 4, // SOUND_INDEX_BASE
"SIMON2.GME", // gme_filename
"SIMON2.WAV", // wav_filename
"SIMON2.VOC", // voc_filename
@@ -208,14 +168,6 @@ static const GameSpecificSettings simon2win_settings = {
};
static const GameSpecificSettings simon2mac_settings = {
- 5, // VGA_DELAY_BASE
- 1580 / 4, // TABLE_INDEX_BASE
- 1500 / 4, // TEXT_INDEX_BASE
- 75, // NUM_VIDEO_OP_CODES
- 2000000, // VGA_MEM_SIZE
- 100000, // TABLES_MEM_SIZE
- 1128 / 4, // MUSIC_INDEX_BASE
- 1660 / 4, // SOUND_INDEX_BASE
"Simon2.gme", // gme_filename
"", // wav_filename
"", // voc_filename
@@ -226,14 +178,6 @@ static const GameSpecificSettings simon2mac_settings = {
};
static const GameSpecificSettings simon2dos_settings = {
- 5, // VGA_DELAY_BASE
- 1580 / 4, // TABLE_INDEX_BASE
- 1500 / 4, // TEXT_INDEX_BASE
- 75, // NUM_VIDEO_OP_CODES
- 2000000, // VGA_MEM_SIZE
- 100000, // TABLES_MEM_SIZE
- 1128 / 4, // MUSIC_INDEX_BASE
- 1660 / 4, // SOUND_INDEX_BASE
"SIMON2.GME", // gme_filename
"", // wav_filename
"", // voc_filename
@@ -252,6 +196,26 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst)
_game = (byte)detector->_game.features;
+ if (_game & GF_SIMON2) {
+ VGA_DELAY_BASE = 5;
+ TABLE_INDEX_BASE = 1580 / 4;
+ TEXT_INDEX_BASE = 1500 / 4;
+ NUM_VIDEO_OP_CODES = 75;
+ VGA_MEM_SIZE = 2000000;
+ TABLES_MEM_SIZE = 100000;
+ MUSIC_INDEX_BASE = 1128 / 4;
+ SOUND_INDEX_BASE = 1660 / 4;
+ } else {
+ VGA_DELAY_BASE = 1;
+ TABLE_INDEX_BASE = 1576 / 4;
+ TEXT_INDEX_BASE = 1460 / 4;
+ NUM_VIDEO_OP_CODES = 64;
+ VGA_MEM_SIZE = 1000000;
+ TABLES_MEM_SIZE = 50000;
+ MUSIC_INDEX_BASE = 1316 / 4;
+ SOUND_INDEX_BASE = 0;
+ }
+
if (_game & GF_MAC)
gss = PTR(simon2mac_settings);
else if ((_game & GF_SIMON2) && (_game & GF_TALKIE))
@@ -259,7 +223,7 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst)
else if (_game & GF_SIMON2)
gss = PTR(simon2dos_settings);
else if (_game & GF_ACORN)
- gss =PTR(simon1acorn_settings);
+ gss = PTR(simon1acorn_settings);
else if (_game & GF_AMIGA)
gss = PTR(simon1amiga_settings);
else if (_game & GF_DEMO)
@@ -823,9 +787,9 @@ void SimonEngine::allocItemHeap() {
}
void SimonEngine::allocTablesHeap() {
- _tablesheap_size = gss->TABLES_MEM_SIZE;
+ _tablesheap_size = TABLES_MEM_SIZE;
_tablesheap_curpos = 0;
- _tablesheap_ptr = (byte *)calloc(gss->TABLES_MEM_SIZE, 1);
+ _tablesheap_ptr = (byte *)calloc(TABLES_MEM_SIZE, 1);
}
void SimonEngine::setItemUnk3(Item *item, int value) {
@@ -1148,7 +1112,7 @@ void SimonEngine::loadTablesIntoMem(uint subr_id) {
memcpy(filename, "SFXXXX", 6);
_sound->readSfxFile(filename, _gameDataPath);
} else if (_game & GF_SIMON2) {
- _sound->loadSfxTable(_game_file, _game_offsets_ptr[atoi(filename + 6) - 1 + gss->SOUND_INDEX_BASE]);
+ _sound->loadSfxTable(_game_file, _game_offsets_ptr[atoi(filename + 6) - 1 + SOUND_INDEX_BASE]);
}
alignTableMem();
@@ -1216,7 +1180,7 @@ uint SimonEngine::loadTextFile_gme(const char *filename, byte *dst) {
uint32 offs;
uint32 size;
- res = atoi(filename + 4) + gss->TEXT_INDEX_BASE - 1;
+ res = atoi(filename + 4) + TEXT_INDEX_BASE - 1;
offs = _game_offsets_ptr[res];
size = _game_offsets_ptr[res + 1] - offs;
@@ -1229,7 +1193,7 @@ File *SimonEngine::openTablesFile_gme(const char *filename) {
uint res;
uint32 offs;
- res = atoi(filename + 6) + gss->TABLE_INDEX_BASE - 1;
+ res = atoi(filename + 6) + TABLE_INDEX_BASE - 1;
offs = _game_offsets_ptr[res];
_game_file->seek(offs, SEEK_SET);
@@ -2194,13 +2158,13 @@ byte *SimonEngine::setup_vga_destination(uint32 size) {
void SimonEngine::setup_vga_file_buf_pointers() {
byte *alloced;
- alloced = (byte *)malloc(gss->VGA_MEM_SIZE);
+ alloced = (byte *)malloc(VGA_MEM_SIZE);
_vga_buf_free_start = alloced;
_vga_buf_start = alloced;
_vga_file_buf_org = alloced;
_vga_file_buf_org_2 = alloced;
- _vga_buf_end = alloced + gss->VGA_MEM_SIZE;
+ _vga_buf_end = alloced + VGA_MEM_SIZE;
}
void SimonEngine::vga_buf_unk_proc3(byte *end) {
@@ -3756,7 +3720,7 @@ void decompress_icon_amiga (byte *dst, byte *src, byte base, uint pitch) {
}
}
-void decompress_icon(byte *dst, byte *src, uint w, uint h_org, byte base, uint pitch) {
+static void decompress_icon(byte *dst, byte *src, uint w, uint h_org, byte base, uint pitch) {
int8 reps;
byte color_1, color_2;
byte *dst_org = dst;
@@ -3948,7 +3912,7 @@ void SimonEngine::start_vga_code(uint b, uint vga_res, uint vga_sprite_id, uint
//dump_vga_script(pp + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), vga_res, vga_sprite_id);
- add_vga_timer(gss->VGA_DELAY_BASE, pp + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_sprite_id, vga_res);
+ add_vga_timer(VGA_DELAY_BASE, pp + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_sprite_id, vga_res);
break;
}
p += sizeof(VgaFile1Struct0x6);
@@ -4041,7 +4005,7 @@ void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *str
_variableArray[85] = _variableArray[141] * len_div_3;
} else {
if (_variableArray[86] == 0)
- len_div_3 = len_div_3 / 2;
+ len_div_3 >>= 1;
if (_variableArray[86] == 2)
len_div_3 <<= 1;
_variableArray[85] = len_div_3 * 5;
@@ -5066,7 +5030,7 @@ bool SimonEngine::load_game(uint slot) {
void SimonEngine::loadMusic (uint music) {
if (_game & GF_SIMON2) { // Simon 2 music
midi.stop();
- _game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music - 1], SEEK_SET);
+ _game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
if (_game & GF_WIN) {
midi.loadMultipleSMF (_game_file);
} else {
@@ -5096,10 +5060,10 @@ void SimonEngine::loadMusic (uint music) {
if (music == 35)
midi.setLoop (false);
- _game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET);
+ _game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music], SEEK_SET);
midi.loadMultipleSMF (_game_file);
} else if (_game & GF_TALKIE) {
- _game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET);
+ _game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music], SEEK_SET);
midi.loadSMF (_game_file, music);
} else {
char buf[50];
diff --git a/simon/simon.h b/simon/simon.h
index 7f49dc8e84..6cd1b05bea 100644
--- a/simon/simon.h
+++ b/simon/simon.h
@@ -114,6 +114,14 @@ protected:
uint32 *_game_offsets_ptr;
+ uint VGA_DELAY_BASE;
+ uint TABLE_INDEX_BASE;
+ uint TEXT_INDEX_BASE;
+ uint NUM_VIDEO_OP_CODES;
+ uint VGA_MEM_SIZE;
+ uint TABLES_MEM_SIZE;
+ uint MUSIC_INDEX_BASE;
+ uint SOUND_INDEX_BASE;
const GameSpecificSettings *gss;
byte _game;
diff --git a/simon/sound.cpp b/simon/sound.cpp
index 4c241810ad..c8258ab08a 100644
--- a/simon/sound.cpp
+++ b/simon/sound.cpp
@@ -261,7 +261,7 @@ SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const C
_voice = new MP3Sound(_mixer, file);
}
#endif
- if (!file->isOpen()) {
+ if (!_voice) {
// for simon2 mac/amiga, only read index file
if (_game == GAME_SIMON2MAC) {
file->open("voices.idx", gameDataPath);
@@ -315,7 +315,7 @@ SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const C
_effects = new MP3Sound(_mixer, file);
}
#endif
- if (!file->isOpen()) {
+ if (!_effects) {
s = gss->voc_effects_filename;
file->open(s, gameDataPath);
if (file->isOpen() == false) {
diff --git a/simon/vga.cpp b/simon/vga.cpp
index 6adfac93a3..a24fc57656 100644
--- a/simon/vga.cpp
+++ b/simon/vga.cpp
@@ -128,7 +128,7 @@ void SimonEngine::run_vga_script() {
opcode = *_vc_ptr++;
}
- if (opcode >= gss->NUM_VIDEO_OP_CODES)
+ if (opcode >= NUM_VIDEO_OP_CODES)
error("Invalid VGA opcode '%d' encountered", opcode);
if (opcode == 0)
@@ -349,7 +349,7 @@ void SimonEngine::vc_3_new_sprite() {
//dump_vga_script(_cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), res, vga_sprite_id);
- add_vga_timer(gss->VGA_DELAY_BASE, _cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_sprite_id, res);
+ add_vga_timer(VGA_DELAY_BASE, _cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_sprite_id, res);
_cur_vga_file_1 = old_file_1;
}
@@ -1011,9 +1011,9 @@ void SimonEngine::vc_12_delay() {
}
if (_continous_vgascript)
- fprintf(_dump_file, "; sleep_ex = %d\n", num + gss->VGA_DELAY_BASE);
+ fprintf(_dump_file, "; sleep_ex = %d\n", num + VGA_DELAY_BASE);
- add_vga_timer(num + gss->VGA_DELAY_BASE, _vc_ptr, _vga_cur_sprite_id, _vga_cur_file_id);
+ add_vga_timer(num + VGA_DELAY_BASE, _vc_ptr, _vga_cur_sprite_id, _vga_cur_file_id);
_vc_ptr = (byte *)&vc_get_out_of_code;
}
@@ -1034,7 +1034,7 @@ void SimonEngine::vc_15_wakeup_id() {
uint16 id = vc_read_next_word();
while (vfs->ident != 0) {
if (vfs->ident == id) {
- add_vga_timer(gss->VGA_DELAY_BASE, vfs->code_ptr, vfs->sprite_id, vfs->cur_vga_file);
+ add_vga_timer(VGA_DELAY_BASE, vfs->code_ptr, vfs->sprite_id, vfs->cur_vga_file);
vfs_tmp = vfs;
do {
memcpy(vfs_tmp, vfs_tmp + 1, sizeof(VgaSleepStruct));
@@ -1584,9 +1584,9 @@ void SimonEngine::vc_56_delay() {
uint num = vc_read_var_or_word() * _vga_base_delay;
if (_continous_vgascript)
- fprintf(_dump_file, "; sleep_ex = %d\n", num + gss->VGA_DELAY_BASE);
+ fprintf(_dump_file, "; sleep_ex = %d\n", num + VGA_DELAY_BASE);
- add_vga_timer(num + gss->VGA_DELAY_BASE, _vc_ptr, _vga_cur_sprite_id, _vga_cur_file_id);
+ add_vga_timer(num + VGA_DELAY_BASE, _vc_ptr, _vga_cur_sprite_id, _vga_cur_file_id);
_vc_ptr = (byte *)&vc_get_out_of_code;
}
}