and more cleanup ....

svn-id: r6720
This commit is contained in:
Paweł Kołodziejski 2003-03-06 19:16:24 +00:00
parent a8c3057875
commit 4fe8dcd671
12 changed files with 427 additions and 866 deletions

View File

@ -30,8 +30,7 @@
#include <sys/stat.h>
#endif
byte *SimonState::dumpOpcode(byte *p)
{
byte *SimonState::dumpOpcode(byte *p) {
byte opcode;
const char *s, *st;
@ -114,12 +113,12 @@ byte *SimonState::dumpOpcode(byte *p)
fprintf(_dump_file, "<%d> ", n);
break;
}
case 'J':{
fprintf(_dump_file, "-> ");
}
break;
case 'T':{
uint n = ((p[0] << 8) | p[1]);
p += 2;
@ -133,11 +132,9 @@ byte *SimonState::dumpOpcode(byte *p)
}
}
void SimonState::dumpSubroutineLine(SubroutineLine *sl, Subroutine *sub)
{
void SimonState::dumpSubroutineLine(SubroutineLine *sl, Subroutine *sub) {
byte *p;
printf("; ****\n");
p = (byte *)sl + SUBROUTINE_LINE_SMALL_SIZE;
@ -153,8 +150,7 @@ void SimonState::dumpSubroutineLine(SubroutineLine *sl, Subroutine *sub)
}
}
void SimonState::dumpSubroutine(Subroutine *sub)
{
void SimonState::dumpSubroutine(Subroutine *sub) {
SubroutineLine *sl;
fprintf(_dump_file, "\n******************************************\n;Subroutine, ID=%d:\nSUB_%d:\n", sub->id, sub->id);
@ -166,16 +162,14 @@ void SimonState::dumpSubroutine(Subroutine *sub)
fflush(_dump_file);
}
void SimonState::dumpSubroutines()
{
void SimonState::dumpSubroutines() {
Subroutine *sub = _subroutine_list;
for (; sub; sub = sub->next) {
dumpSubroutine(sub);
}
}
void SimonState::dump_video_script(byte *src, bool one_opcode_only)
{
void SimonState::dump_video_script(byte *src, bool one_opcode_only) {
uint opcode;
const char *str, *strn;
@ -239,8 +233,7 @@ void SimonState::dump_video_script(byte *src, bool one_opcode_only)
} while (!one_opcode_only);
}
void SimonState::dump_vga_file(byte *vga)
{
void SimonState::dump_vga_file(byte *vga) {
{
byte *pp;
byte *p;
@ -276,8 +269,6 @@ void SimonState::dump_vga_file(byte *vga)
}
}
const byte bmp_hdr[] = {
0x42, 0x4D,
0x9E, 0x14, 0x00, 0x00, /* offset 2, file size */
@ -297,8 +288,7 @@ const byte bmp_hdr[] = {
0x00, 0x01, 0x00, 0x00,
};
void dump_bmp(const char *filename, int w, int h, const byte *bytes, const uint32 *palette)
{
void dump_bmp(const char *filename, int w, int h, const byte *bytes, const uint32 *palette) {
FILE *out = fopen(filename, "wb");
byte my_hdr[sizeof(bmp_hdr)];
int i;
@ -361,8 +351,7 @@ void dump_bitmap(const char *filename, byte *offs, int w, int h, int flags, cons
free(b);
}
void SimonState::dump_single_bitmap(int file, int image, byte *offs, int w, int h, byte base)
{
void SimonState::dump_single_bitmap(int file, int image, byte *offs, int w, int h, byte base) {
/* Only supported for win32 atm. mkdir doesn't work otherwise. */
#if defined (WIN32) && !defined(_WIN32_WCE)
char buf[255], buf2[255];
@ -455,16 +444,14 @@ void SimonState::dump_vga_bitmaps(byte *vga, byte *vga1, int res) {
#endif
}
void SimonState::dump_vga_script_always(byte *ptr, uint res, uint sprite_id)
{
void SimonState::dump_vga_script_always(byte *ptr, uint res, uint sprite_id) {
fprintf(_dump_file, "; address=%x, vgafile=%d vgasprite=%d\n",
ptr - _vga_buffer_pointers[res].vgaFile1, res, sprite_id);
dump_video_script(ptr, false);
fprintf(_dump_file, "; end\n");
}
void SimonState::dump_vga_script(byte *ptr, uint res, uint sprite_id)
{
void SimonState::dump_vga_script(byte *ptr, uint res, uint sprite_id) {
dump_vga_script_always(ptr, res, sprite_id);
}

View File

@ -1060,7 +1060,6 @@ const char *const simon1_video_opcode_name_table[] = {
"|PALETTE_THING_2",
};
const char *const simon2_video_opcode_name_table[] = {
/* 0 */
"x|RET",

View File

@ -48,7 +48,6 @@ enum {
CHILD2_SIZE = sizeof(Child2) - sizeof(int16)
};
struct Item {
uint16 parent;
uint16 child;

View File

@ -32,8 +32,7 @@ extern void force_keyboard(bool);
#endif
int SimonState::runScript()
{
int SimonState::runScript() {
byte opcode;
bool flag, condition;
@ -1090,8 +1089,7 @@ int SimonState::runScript()
return 0;
}
int SimonState::startSubroutine(Subroutine *sub)
{
int SimonState::startSubroutine(Subroutine *sub) {
int result = -1;
SubroutineLine *sl;
byte *old_code_ptr;
@ -1137,14 +1135,12 @@ int SimonState::startSubroutine(Subroutine *sub)
return result;
}
int SimonState::startSubroutineEx(Subroutine *sub)
{
int SimonState::startSubroutineEx(Subroutine *sub) {
_item_1_ptr = _item_1;
return startSubroutine(sub);
}
bool SimonState::checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub)
{
bool SimonState::checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub) {
if (sub->id)
return true;
@ -1163,8 +1159,7 @@ bool SimonState::checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub)
return true;
}
void SimonState::o_83_helper()
{
void SimonState::o_83_helper() {
if (_exit_cutscene) {
if (vc_get_bit(9)) {
startSubroutine170();
@ -1174,8 +1169,7 @@ void SimonState::o_83_helper()
}
}
void SimonState::o_190_helper(uint i)
{
void SimonState::o_190_helper(uint i) {
_exit_cutscene = false;
while (!(_op_189_flags & (1 << i))) {
if (_exit_cutscene) {
@ -1192,8 +1186,7 @@ void SimonState::o_190_helper(uint i)
}
bool SimonState::o_unk_23(uint a)
{
bool SimonState::o_unk_23(uint a) {
if (a == 0)
return 0;
@ -1222,8 +1215,7 @@ bool SimonState::o_unk_23(uint a)
return 0;
}
void SimonState::o_177()
{
void SimonState::o_177() {
uint a = getVarOrByte();
uint b = getVarOrByte();
const char *s = NULL;
@ -1309,8 +1301,7 @@ void SimonState::o_177()
}
}
void SimonState::o_quit_if_user_presses_y()
{
void SimonState::o_quit_if_user_presses_y() {
for (;;) {
delay(1);
if (_key_pressed == 'f' && _language == 20) // Hebrew
@ -1332,8 +1323,7 @@ void SimonState::o_quit_if_user_presses_y()
get_out:;
}
void SimonState::o_unk_137(uint fcs_index)
{
void SimonState::o_unk_137(uint fcs_index) {
FillOrCopyStruct *fcs;
fcs = _fcs_ptr_array_3[fcs_index & 7];
@ -1342,37 +1332,30 @@ void SimonState::o_unk_137(uint fcs_index)
fcs_unk_proc_1(fcs_index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2);
}
void SimonState::o_unk_138()
{
void SimonState::o_unk_138() {
_vga_buf_start = _vga_buf_free_start;
_vga_file_buf_org = _vga_buf_free_start;
}
void SimonState::o_unk_186()
{
void SimonState::o_unk_186() {
_vga_buf_free_start = _vga_file_buf_org_2;
_vga_buf_start = _vga_file_buf_org_2;
_vga_file_buf_org = _vga_file_buf_org_2;
}
void SimonState::o_unk_175()
{
void SimonState::o_unk_175() {
_vga_buf_start = _vga_buf_free_start;
}
void SimonState::o_unk_176()
{
void SimonState::o_unk_176() {
_vga_buf_free_start = _vga_file_buf_org;
_vga_buf_start = _vga_file_buf_org;
}
int SimonState::o_unk_132_helper(bool *b, char *buf)
{
int SimonState::o_unk_132_helper(bool *b, char *buf) {
HitArea *ha;
*b = true;
if (!_saveload_flag) {
strange_jump:;
_saveload_flag = false;
@ -1429,14 +1412,12 @@ start_over_2:;
return ha->id - 208;
}
void SimonState::o_unk_132_helper_3()
{
void SimonState::o_unk_132_helper_3() {
for (int i = 208; i != 208 + 6; i++)
set_hitarea_bit_0x40(i);
}
void SimonState::o_unk_132_helper_2(FillOrCopyStruct *fcs, int x)
{
void SimonState::o_unk_132_helper_2(FillOrCopyStruct *fcs, int x) {
byte old_text;
video_putchar(fcs, x);
@ -1452,8 +1433,7 @@ void SimonState::o_unk_132_helper_2(FillOrCopyStruct *fcs, int x)
video_putchar(fcs, 8);
}
void SimonState::o_unk_127()
{
void SimonState::o_unk_127() {
uint a = getVarOrWord();
uint b = getVarOrWord();
if (_game & GF_SIMON2) {
@ -1491,8 +1471,7 @@ void SimonState::o_unk_127()
}
}
void SimonState::o_unk_120(uint a)
{
void SimonState::o_unk_120(uint a) {
uint16 id = TO_BE_16(a);
if (_game & GF_SIMON2) {
_lock_word |= 0x8000;
@ -1507,29 +1486,25 @@ void SimonState::o_unk_120(uint a)
}
}
void SimonState::o_unk_163(uint a)
{
void SimonState::o_unk_163(uint a) {
if (_game == GAME_SIMON1DOS)
playSting(a);
else
_sound->playEffects(a);
}
void SimonState::o_unk_160(uint a)
{
void SimonState::o_unk_160(uint a) {
fcs_setTextColor(_fcs_ptr_array_3[_fcs_unk_1], a);
}
void SimonState::o_unk_103()
{
void SimonState::o_unk_103() {
lock();
fcs_unk1(_fcs_unk_1);
showMessageFormat("\x0C");
unlock();
}
void SimonState::o_unk_99_simon1(uint a)
{
void SimonState::o_unk_99_simon1(uint a) {
uint16 b = TO_BE_16(a);
_lock_word |= 0x4000;
_vc_ptr = (byte *)&b;
@ -1537,8 +1512,7 @@ void SimonState::o_unk_99_simon1(uint a)
_lock_word &= ~0x4000;
}
void SimonState::o_unk_99_simon2(uint a, uint b)
{
void SimonState::o_unk_99_simon2(uint a, uint b) {
uint16 items[2];
items[0] = TO_BE_16(a);
@ -1551,8 +1525,7 @@ void SimonState::o_unk_99_simon2(uint a, uint b)
}
/* OK */
void SimonState::o_unk26_helper(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h)
{
void SimonState::o_unk26_helper(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h) {
a &= 7;
if (_fcs_ptr_array_3[a])
@ -1562,7 +1535,6 @@ void SimonState::o_unk26_helper(uint a, uint b, uint c, uint d, uint e, uint f,
if (a == _fcs_unk_1) {
_fcs_ptr_1 = _fcs_ptr_array_3[a];
showmessage_helper_3(_fcs_ptr_1->textLength,
_fcs_ptr_1->textMaxLength);
showmessage_helper_3(_fcs_ptr_1->textLength, _fcs_ptr_1->textMaxLength);
}
}

View File

@ -35,8 +35,7 @@ MidiPlayer::MidiPlayer() {
_masterVolume = 255;
}
void MidiPlayer::read_all_songs(File *in, uint music)
{
void MidiPlayer::read_all_songs(File *in, uint music) {
uint i, num;
_currentSong = _songs;
@ -48,8 +47,7 @@ void MidiPlayer::read_all_songs(File *in, uint music)
}
}
void MidiPlayer::read_all_songs_old(File *in, uint music)
{
void MidiPlayer::read_all_songs_old(File *in, uint music) {
uint i, num;
_currentSong = _songs;
@ -61,8 +59,7 @@ void MidiPlayer::read_all_songs_old(File *in, uint music)
}
}
void MidiPlayer::read_all_songs_old(File *in, uint music, uint16 size)
{
void MidiPlayer::read_all_songs_old(File *in, uint music, uint16 size) {
_currentSong = _songs;
_lastDelay = 0;
@ -70,8 +67,7 @@ void MidiPlayer::read_all_songs_old(File *in, uint music, uint16 size)
read_one_song(in, &_songs[0], music, size);
}
void MidiPlayer::read_mthd(File *in, Song *s, bool old, uint music, uint16 size)
{
void MidiPlayer::read_mthd(File *in, Song *s, bool old, uint music, uint16 size) {
Track *t;
uint i;
@ -135,8 +131,7 @@ void MidiPlayer::read_mthd(File *in, Song *s, bool old, uint music, uint16 size)
}
}
void MidiPlayer::read_one_song(File *in, Song *s, uint music, uint16 size)
{
void MidiPlayer::read_one_song(File *in, Song *s, uint music, uint16 size) {
_lastDelay = 0;
s->ppqn = 0;
@ -161,8 +156,7 @@ void MidiPlayer::read_one_song(File *in, Song *s, uint music, uint16 size)
}
uint32 MidiPlayer::track_read_gamma(Track *t)
{
uint32 MidiPlayer::track_read_gamma(Track *t) {
uint32 sum;
byte b;
@ -175,8 +169,7 @@ uint32 MidiPlayer::track_read_gamma(Track *t)
return sum;
}
byte MidiPlayer::track_read_byte(Track *t)
{
byte MidiPlayer::track_read_byte(Track *t) {
if (t->a & 1)
error("Trying to read byte from MIDI stream when end reached");
@ -187,8 +180,7 @@ byte MidiPlayer::track_read_byte(Track *t)
return *t->data_cur_ptr++;
}
void MidiPlayer::initialize()
{
void MidiPlayer::initialize() {
int res;
int i;
@ -205,8 +197,7 @@ void MidiPlayer::initialize()
_midiDriver->pause (true);
}
int MidiPlayer::fill(MidiEvent *me, int num_event)
{
int MidiPlayer::fill(MidiEvent *me, int num_event) {
uint32 best, j;
Track *best_track, *t;
bool did_reset;
@ -252,14 +243,12 @@ int MidiPlayer::fill(MidiEvent *me, int num_event)
return i;
}
int MidiPlayer::on_fill(void *param, MidiEvent *ev, int num)
{
int MidiPlayer::on_fill(void *param, MidiEvent *ev, int num) {
MidiPlayer *mp = (MidiPlayer *) param;
return mp->fill(ev, num);
}
bool MidiPlayer::fill_helper(NoteRec *nr, MidiEvent *me)
{
bool MidiPlayer::fill_helper(NoteRec *nr, MidiEvent *me) {
uint b;
b = nr->delay - _lastDelay;
@ -291,8 +280,7 @@ bool MidiPlayer::fill_helper(NoteRec *nr, MidiEvent *me)
return true;
}
void MidiPlayer::reset_tracks()
{
void MidiPlayer::reset_tracks() {
if (_midi_sfx_toggle)
return;
@ -315,8 +303,7 @@ void MidiPlayer::reset_tracks()
}
}
void MidiPlayer::read_next_note(Track *t, NoteRec *nr)
{
void MidiPlayer::read_next_note(Track *t, NoteRec *nr) {
byte cmd_byte;
uint i;
@ -402,14 +389,12 @@ void MidiPlayer::read_next_note(Track *t, NoteRec *nr)
}
}
void MidiPlayer::shutdown()
{
void MidiPlayer::shutdown() {
_midiDriver->close();
unload();
}
void MidiPlayer::unload()
{
void MidiPlayer::unload() {
uint i, j;
Song *s;
Track *t;
@ -425,14 +410,12 @@ void MidiPlayer::unload()
}
}
void MidiPlayer::play()
{
void MidiPlayer::play() {
if (!_paused)
_midiDriver->pause(false);
}
void MidiPlayer::pause (bool b)
{
void MidiPlayer::pause (bool b) {
if (_paused == b)
return;
_paused = b;
@ -444,13 +427,11 @@ void MidiPlayer::pause (bool b)
}
int MidiPlayer::get_volume()
{
int MidiPlayer::get_volume() {
return _masterVolume;
}
void MidiPlayer::set_volume (int volume)
{
void MidiPlayer::set_volume (int volume) {
if (volume < 0)
volume = 0;
else if (volume > 255)
@ -469,8 +450,7 @@ void MidiPlayer::set_volume (int volume)
}
}
void MidiPlayer::set_driver(MidiDriver *md)
{
void MidiPlayer::set_driver(MidiDriver *md) {
// We must always use the MidiStreamer front-end
// so we can support user-initiated MIDI events (like volume).
_midiDriver = new MidiStreamer (md);

View File

@ -94,8 +94,7 @@ static const char *const opcode_arg_table_simon2dos[256] = {
" ", " ", "BT ", " ", "B "
};
void SimonState::loadGamePcFile(const char *filename)
{
void SimonState::loadGamePcFile(const char *filename) {
File * in = new File();
int num_inited_objects;
int i, file_size;
@ -161,8 +160,7 @@ void SimonState::loadGamePcFile(const char *filename)
in->close();
}
void SimonState::readGamePcText(File *in)
{
void SimonState::readGamePcText(File *in) {
uint text_size;
byte *text_mem;
@ -176,8 +174,7 @@ void SimonState::readGamePcText(File *in)
setupStringTable(text_mem, _stringtab_num);
}
void SimonState::readItemFromGamePc(File *in, Item *item)
{
void SimonState::readItemFromGamePc(File *in, Item *item) {
uint32 type;
item->unk2 = in->readUint16BE();
@ -198,8 +195,7 @@ void SimonState::readItemFromGamePc(File *in, Item *item)
}
}
void SimonState::readItemChildren(File *in, Item *item, uint type)
{
void SimonState::readItemChildren(File *in, Item *item, uint type) {
if (type == 1) {
uint fr1 = in->readUint16BE();
uint fr2 = in->readUint16BE();
@ -246,16 +242,14 @@ void SimonState::readItemChildren(File *in, Item *item, uint type)
}
}
uint fileReadItemID(File *in)
{
uint fileReadItemID(File *in) {
uint32 val = in->readUint32BE();
if (val == 0xFFFFFFFF)
return 0;
return val + 2;
}
byte *SimonState::readSingleOpcode(File *in, byte *ptr)
{
byte *SimonState::readSingleOpcode(File *in, byte *ptr) {
int i, l;
const char *string_ptr;
uint val;

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,7 @@
uint fileReadItemID(File *in);
#define CHECK_BOUNDS(x,y) assert((uint)(x)<ARRAYSIZE(y))
#define CHECK_BOUNDS(x, y) assert((uint)(x) < ARRAYSIZE(y))
#define NUM_PALETTE_FADEOUT 32
struct Child;
@ -486,7 +486,6 @@ public:
void o_unk_186();
void o_fade_to_black();
ThreeValues *getThreeValues(uint a);
void o_print_str();
void o_setup_cond_c();
@ -801,7 +800,6 @@ public:
RandomSource _rnd;
};
void palette_fadeout(uint32 *pal_values, uint num);
#endif

View File

@ -22,8 +22,7 @@
#include "common/file.h"
#include "common/engine.h"
SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const char *gameDataPath, SoundMixer *mixer)
{
SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const char *gameDataPath, SoundMixer *mixer) {
_game = game;
_gameDataPath = gameDataPath;
_mixer = mixer;
@ -111,8 +110,7 @@ SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const c
}
}
void SimonSound::readSfxFile(const char *filename, const char *gameDataPath)
{
void SimonSound::readSfxFile(const char *filename, const char *gameDataPath) {
stopAll();
File *file = new File();
@ -135,8 +133,7 @@ void SimonSound::readSfxFile(const char *filename, const char *gameDataPath)
_effects = new WavSound(_mixer, file);
}
void SimonSound::loadSfxTable(File *gameFile, uint32 base)
{
void SimonSound::loadSfxTable(File *gameFile, uint32 base) {
stopAll();
if (_game & GF_WIN)
@ -145,8 +142,7 @@ void SimonSound::loadSfxTable(File *gameFile, uint32 base)
_effects = new VocSound(_mixer, gameFile, base);
}
void SimonSound::playVoice(uint sound)
{
void SimonSound::playVoice(uint sound) {
if (_game == GAME_SIMON2MAC && _filenums) {
char filename[16];
sprintf(filename, "voices%d.dat", _filenums[sound]);
@ -165,8 +161,7 @@ void SimonSound::playVoice(uint sound)
_voice_index = _voice->playSound(sound, &_voice_handle);
}
void SimonSound::playEffects(uint sound)
{
void SimonSound::playEffects(uint sound) {
if (!_effects)
return;
@ -176,8 +171,7 @@ void SimonSound::playEffects(uint sound)
_effects->playSound(sound, &_effects_handle);
}
void SimonSound::playAmbient(uint sound)
{
void SimonSound::playAmbient(uint sound) {
if (!_effects)
return;
@ -195,29 +189,24 @@ void SimonSound::playAmbient(uint sound)
_ambient_index = _effects->playSound(sound, &_ambient_handle, SoundMixer::FLAG_LOOP);
}
bool SimonSound::hasVoice()
{
bool SimonSound::hasVoice() {
return _voice_file;
}
void SimonSound::stopVoice()
{
void SimonSound::stopVoice() {
_mixer->stop(_voice_index);
}
void SimonSound::stopAll()
{
void SimonSound::stopAll() {
_mixer->stopAll();
_ambient_playing = 0;
}
void SimonSound::effectsPause(bool b)
{
void SimonSound::effectsPause(bool b) {
_effects_paused = b;
}
void SimonSound::ambientPause(bool b)
{
void SimonSound::ambientPause(bool b) {
_ambient_paused = b;
if (_ambient_paused && _ambient_playing) {
@ -231,8 +220,7 @@ void SimonSound::ambientPause(bool b)
/******************************************************************************/
SimonSound::Sound::Sound(SoundMixer *mixer, File *file, uint32 base)
{
SimonSound::Sound::Sound(SoundMixer *mixer, File *file, uint32 base) {
_mixer = mixer;
_file = file;
@ -263,8 +251,7 @@ SimonSound::Sound::Sound(SoundMixer *mixer, File *file, uint32 base)
_offsets[res] = _file->pos();
}
SimonSound::Sound::Sound(SoundMixer *mixer, File *file, uint32 *offsets)
{
SimonSound::Sound::Sound(SoundMixer *mixer, File *file, uint32 *offsets) {
_mixer = mixer;
_file = file;
_offsets = offsets;
@ -328,8 +315,7 @@ int SimonSound::MP3Sound::playSound(uint sound, PlayingSoundHandle *handle, byte
}
#endif
int SimonSound::VocSound::playSound(uint sound, PlayingSoundHandle *handle, byte flags)
{
int SimonSound::VocSound::playSound(uint sound, PlayingSoundHandle *handle, byte flags) {
if (_offsets == NULL)
return 0;
@ -367,8 +353,7 @@ int SimonSound::VocSound::playSound(uint sound, PlayingSoundHandle *handle, byte
return _mixer->playRaw(handle, buffer, size, samples_per_sec, flags);
}
int SimonSound::WavSound::playSound(uint sound, PlayingSoundHandle *handle, byte flags)
{
int SimonSound::WavSound::playSound(uint sound, PlayingSoundHandle *handle, byte flags) {
if (_offsets == NULL)
return 0;

View File

@ -77,8 +77,7 @@ static const char *const english_verb_prep_names[] = {
"", "", "", "to whom ?"
};
void SimonState::defocusHitarea()
{
void SimonState::defocusHitarea() {
HitArea *last;
HitArea *ha;
@ -103,8 +102,7 @@ void SimonState::defocusHitarea()
focusVerb(last->id);
}
void SimonState::focusVerb(uint hitarea_id)
{
void SimonState::focusVerb(uint hitarea_id) {
uint x;
const char *txt;
const char * const *verb_prep_names;
@ -128,11 +126,9 @@ void SimonState::focusVerb(uint hitarea_id)
}
x = (53 - strlen(txt)) * 3;
showActionString(x, (const byte *)txt);
}
void SimonState::showActionString(uint x, const byte *string)
{
void SimonState::showActionString(uint x, const byte *string) {
FillOrCopyStruct *fcs;
fcs = _fcs_ptr_array_3[1];
@ -146,9 +142,7 @@ void SimonState::showActionString(uint x, const byte *string)
video_putchar(fcs, *string);
}
void SimonState::hitareaChangedHelper()
{
void SimonState::hitareaChangedHelper() {
FillOrCopyStruct *fcs;
if (_game & GF_SIMON2) {
@ -164,8 +158,7 @@ void SimonState::hitareaChangedHelper()
_hitarea_ptr_7 = NULL;
}
HitArea *SimonState::findHitAreaByID(uint hitarea_id)
{
HitArea *SimonState::findHitAreaByID(uint hitarea_id) {
HitArea *ha = _hit_areas;
uint count = ARRAYSIZE(_hit_areas);
@ -176,8 +169,7 @@ HitArea *SimonState::findHitAreaByID(uint hitarea_id)
return NULL;
}
HitArea *SimonState::findEmptyHitArea()
{
HitArea *SimonState::findEmptyHitArea() {
HitArea *ha = _hit_areas;
uint count = ARRAYSIZE(_hit_areas);
@ -188,15 +180,13 @@ HitArea *SimonState::findEmptyHitArea()
return NULL;
}
void SimonState::clear_hitarea_bit_0x40(uint hitarea)
{
void SimonState::clear_hitarea_bit_0x40(uint hitarea) {
HitArea *ha = findHitAreaByID(hitarea);
if (ha != NULL)
ha->flags &= ~0x40;
}
void SimonState::set_hitarea_bit_0x40(uint hitarea)
{
void SimonState::set_hitarea_bit_0x40(uint hitarea) {
HitArea *ha = findHitAreaByID(hitarea);
if (ha != NULL) {
ha->flags |= 0x40;
@ -206,8 +196,7 @@ void SimonState::set_hitarea_bit_0x40(uint hitarea)
}
}
void SimonState::set_hitarea_x_y(uint hitarea, int x, int y)
{
void SimonState::set_hitarea_x_y(uint hitarea, int x, int y) {
HitArea *ha = findHitAreaByID(hitarea);
if (ha != NULL) {
ha->x = x;
@ -215,8 +204,7 @@ void SimonState::set_hitarea_x_y(uint hitarea, int x, int y)
}
}
void SimonState::delete_hitarea(uint hitarea)
{
void SimonState::delete_hitarea(uint hitarea) {
HitArea *ha = findHitAreaByID(hitarea);
if (ha != NULL) {
ha->flags = 0;
@ -226,17 +214,14 @@ void SimonState::delete_hitarea(uint hitarea)
}
}
bool SimonState::is_hitarea_0x40_clear(uint hitarea)
{
bool SimonState::is_hitarea_0x40_clear(uint hitarea) {
HitArea *ha = findHitAreaByID(hitarea);
if (ha == NULL)
return false;
return (ha->flags & 0x40) == 0;
}
void SimonState::addNewHitArea(int id, int x, int y, int width, int height, int flags, int unk3, Item *item_ptr)
{
void SimonState::addNewHitArea(int id, int x, int y, int width, int height, int flags, int unk3, Item *item_ptr) {
HitArea *ha;
delete_hitarea(id);
@ -253,8 +238,7 @@ void SimonState::addNewHitArea(int id, int x, int y, int width, int height, int
_need_hitarea_recalc++;
}
void SimonState::hitarea_proc_1()
{
void SimonState::hitarea_proc_1() {
uint id;
HitArea *ha;
@ -264,7 +248,6 @@ void SimonState::hitarea_proc_1()
id = (_mouse_y >= 136) ? 102 : 101;
} else {
id = (_mouse_y >= 136) ? 102 : 101;
}
_hitarea_unk_4 = id;
@ -282,8 +265,7 @@ void SimonState::hitarea_proc_1()
}
}
void SimonState::handle_verb_hitarea(HitArea * ha)
{
void SimonState::handle_verb_hitarea(HitArea *ha) {
HitArea *tmp = _hitarea_ptr_5;
if (ha == tmp)
@ -307,14 +289,11 @@ void SimonState::handle_verb_hitarea(HitArea * ha)
return;
_mouse_cursor = ha->id - 101;
_need_hitarea_recalc++;
}
_hitarea_ptr_5 = ha;
}
void SimonState::hitarea_leave(HitArea * ha)
{
void SimonState::hitarea_leave(HitArea *ha) {
if (!(_game & GF_SIMON2)) {
video_toggle_colors(ha, 0xdf, 0xd5, 0xda, 5);
} else {
@ -322,15 +301,13 @@ void SimonState::hitarea_leave(HitArea * ha)
}
}
void SimonState::leaveHitAreaById(uint hitarea_id)
{
void SimonState::leaveHitAreaById(uint hitarea_id) {
HitArea *ha = findHitAreaByID(hitarea_id);
if (ha)
hitarea_leave(ha);
}
void SimonState::handle_unk2_hitarea(FillOrCopyStruct *fcs)
{
void SimonState::handle_unk2_hitarea(FillOrCopyStruct *fcs) {
uint index;
index = get_fcs_ptr_3_index(fcs);
@ -343,8 +320,7 @@ void SimonState::handle_unk2_hitarea(FillOrCopyStruct *fcs)
unlock();
}
void SimonState::handle_unk_hitarea(FillOrCopyStruct *fcs)
{
void SimonState::handle_unk_hitarea(FillOrCopyStruct *fcs) {
uint index;
index = get_fcs_ptr_3_index(fcs);
@ -354,8 +330,7 @@ void SimonState::handle_unk_hitarea(FillOrCopyStruct *fcs)
unlock();
}
void SimonState::setup_hitarea_from_pos(uint x, uint y, uint mode)
{
void SimonState::setup_hitarea_from_pos(uint x, uint y, uint mode) {
HitArea *best_ha;
HitArea *ha = _hit_areas;
uint count = ARRAYSIZE(_hit_areas);
@ -415,8 +390,7 @@ void SimonState::setup_hitarea_from_pos(uint x, uint y, uint mode)
return;
}
void SimonState::new_current_hitarea(HitArea * ha)
{
void SimonState::new_current_hitarea(HitArea *ha) {
bool result;
hitareaChangedHelper();
@ -430,8 +404,7 @@ void SimonState::new_current_hitarea(HitArea * ha)
_last_hitarea_2_ptr = ha;
}
bool SimonState::hitarea_proc_2(uint a)
{
bool SimonState::hitarea_proc_2(uint a) {
uint x;
const byte *string_ptr;
@ -460,8 +433,7 @@ bool SimonState::hitarea_proc_2(uint a)
return true;
}
bool SimonState::hitarea_proc_3(Item *item)
{
bool SimonState::hitarea_proc_3(Item *item) {
Child2 *child2;
uint x;
const byte *string_ptr;

View File

@ -108,17 +108,16 @@ static const VgaOpcodeProc vga_opcode_table[] = {
};
// Script parser
void SimonState::run_vga_script()
{
void SimonState::run_vga_script() {
for (;;) {
uint opcode;
if (_continous_vgascript) {
if ((void *)_vc_ptr != (void *)&vc_get_out_of_code) {
fprintf(_dump_file, "%.5d %.5X: %5d %4d ", _vga_tick_counter, _vc_ptr - _cur_vga_file_1, _vga_cur_sprite_id, _vga_cur_file_id);
dump_video_script(_vc_ptr, true);
if (_continous_vgascript) {
if ((void *)_vc_ptr != (void *)&vc_get_out_of_code) {
fprintf(_dump_file, "%.5d %.5X: %5d %4d ", _vga_tick_counter, _vc_ptr - _cur_vga_file_1, _vga_cur_sprite_id, _vga_cur_file_id);
dump_video_script(_vc_ptr, true);
}
}
}
if (!(_game & GF_SIMON2)) {
opcode = READ_BE_UINT16_UNALIGNED(_vc_ptr);
@ -137,29 +136,24 @@ if (_continous_vgascript) {
}
}
int SimonState::vc_read_var_or_word()
{
int SimonState::vc_read_var_or_word() {
int16 var = vc_read_next_word();
if (var < 0)
var = vc_read_var(-var);
return var;
}
uint SimonState::vc_read_next_word()
{
uint SimonState::vc_read_next_word() {
uint a = READ_BE_UINT16_UNALIGNED(_vc_ptr);
_vc_ptr += 2;
return a;
}
uint SimonState::vc_read_next_byte()
{
uint SimonState::vc_read_next_byte() {
return *_vc_ptr++;
}
void SimonState::vc_skip_next_instruction()
{
void SimonState::vc_skip_next_instruction() {
static const byte opcode_param_len_simon1[] = {
0, 6, 2, 10, 6, 4, 2, 2,
4, 4, 10, 0, 2, 2, 2, 2,
@ -196,8 +190,8 @@ void SimonState::vc_skip_next_instruction()
fprintf(_dump_file, "; skipped\n");
}
void SimonState::o_read_vgares_23()
{ // Simon1 Only
void SimonState::o_read_vgares_23() {
// Simon1 Only
if (_vga_res_328_loaded == true) {
_vga_res_328_loaded = false;
_lock_word |= 0x4000;
@ -206,8 +200,8 @@ void SimonState::o_read_vgares_23()
}
}
void SimonState::o_read_vgares_328()
{ // Simon1 Only
void SimonState::o_read_vgares_328() {
// Simon1 Only
if (_vga_res_328_loaded == false) {
_vga_res_328_loaded = true;
_lock_word |= 0x4000;
@ -216,16 +210,13 @@ void SimonState::o_read_vgares_328()
}
}
// VGA Script commands
void SimonState::vc_1_dummy_op()
{
void SimonState::vc_1_dummy_op() {
/* dummy opcode */
_vc_ptr += 6;
}
void SimonState::vc_2_call()
{
void SimonState::vc_2_call() {
VgaPointersEntry *vpe;
uint num;
uint res;
@ -273,8 +264,7 @@ void SimonState::vc_2_call()
_vc_ptr = vc_ptr_org;
}
void SimonState::vc_3_new_thread()
{
void SimonState::vc_3_new_thread() {
uint16 a, b, c, d, e, f;
uint16 res;
VgaSprite *vsp;
@ -358,50 +348,43 @@ void SimonState::vc_3_new_thread()
add_vga_timer(gss->VGA_DELAY_BASE, _cur_vga_file_1 + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->script_offs), b, res);
}
void SimonState::vc_4_dummy_op()
{
void SimonState::vc_4_dummy_op() {
/* dummy opcode */
_vc_ptr += 6;
}
void SimonState::vc_5_skip_if_neq()
{
void SimonState::vc_5_skip_if_neq() {
uint var = vc_read_next_word();
uint value = vc_read_next_word();
if (vc_read_var(var) != value)
vc_skip_next_instruction();
}
void SimonState::vc_6_skip_ifn_sib_with_a() // vc_6_maybe_skip_3_inv
{
void SimonState::vc_6_skip_ifn_sib_with_a() { // vc_6_maybe_skip_3_inv
if (!vc_maybe_skip_proc_3(vc_read_next_word()))
vc_skip_next_instruction();
}
void SimonState::vc_7_skip_if_sib_with_a() // vc_7_maybe_skip_3
{
void SimonState::vc_7_skip_if_sib_with_a() { // vc_7_maybe_skip_3
if (vc_maybe_skip_proc_3(vc_read_next_word()))
vc_skip_next_instruction();
}
void SimonState::vc_8_skip_if_parent_is() // vc_8_maybe_skip_2
{
void SimonState::vc_8_skip_if_parent_is() { // vc_8_maybe_skip_2
uint a = vc_read_next_word();
uint b = vc_read_next_word();
if (!vc_maybe_skip_proc_2(a, b))
vc_skip_next_instruction();
}
void SimonState::vc_9_skip_if_unk3_is() // vc_9_maybe_skip
{
void SimonState::vc_9_skip_if_unk3_is() { // vc_9_maybe_skip
uint a = vc_read_next_word();
uint b = vc_read_next_word();
if (!vc_maybe_skip_proc_1(a, b))
vc_skip_next_instruction();
}
byte *vc_10_depack_column(VC10_state * vs)
{
byte *vc_10_depack_column(VC10_state * vs) {
int8 a = vs->depack_cont;
byte *src = vs->depack_src;
byte *dst = vs->depack_dest;
@ -444,8 +427,7 @@ get_out:;
return vs->depack_dest + vs->y_skip;
}
void vc_10_skip_cols(VC10_state * vs)
{
void vc_10_skip_cols(VC10_state *vs) {
vs->depack_cont = -0x80;
while (vs->x_skip) {
vc_10_depack_column(vs);
@ -453,8 +435,7 @@ void vc_10_skip_cols(VC10_state * vs)
}
}
byte *SimonState::vc_10_depack_swap(byte *src, uint w, uint h)
{
byte *SimonState::vc_10_depack_swap(byte *src, uint w, uint h) {
w <<= 3;
{
@ -525,11 +506,9 @@ byte *SimonState::vc_10_depack_swap(byte *src, uint w, uint h)
}
return _video_buf_1;
}
byte *vc_10_no_depack_swap(byte *src)
{
byte *vc_10_no_depack_swap(byte *src) {
error("vc_10_no_depack_swap unimpl");
return NULL;
}
@ -544,8 +523,7 @@ static uint16 _video_windows[128] = {
};
/* simon2 specific */
void SimonState::vc_10_helper_8(byte *dst, byte *src)
{
void SimonState::vc_10_helper_8(byte *dst, byte *src) {
const uint pitch = _dx_surface_pitch;
int8 reps = (int8)0x80;
byte color;
@ -589,8 +567,7 @@ void SimonState::vc_10_helper_8(byte *dst, byte *src)
}
}
void SimonState::vc_10_draw()
{
void SimonState::vc_10_draw() {
byte *p2;
uint width, height;
byte flags;
@ -670,7 +647,6 @@ void SimonState::vc_10_draw()
dx_unlock_attached();
return;
}
@ -987,13 +963,11 @@ void SimonState::vc_10_draw()
}
void SimonState::vc_11_clear_pathfind_array()
{
void SimonState::vc_11_clear_pathfind_array() {
memset(&_pathfind_array, 0, sizeof(_pathfind_array));
}
void SimonState::vc_12_delay() //vc_12_sleep_variable
{
void SimonState::vc_12_delay() { //vc_12_sleep_variable
uint num;
if (!(_game & GF_SIMON2)) {
@ -1006,24 +980,21 @@ void SimonState::vc_12_delay() //vc_12_sleep_variable
_vc_ptr = (byte *)&vc_get_out_of_code;
}
void SimonState::vc_13_offset_x()
{
void SimonState::vc_13_offset_x() {
VgaSprite *vsp = find_cur_sprite();
int16 a = vc_read_next_word();
vsp->x += a;
_vga_sprite_changed++;
}
void SimonState::vc_14_offset_y()
{
void SimonState::vc_14_offset_y() {
VgaSprite *vsp = find_cur_sprite();
int16 a = vc_read_next_word();
vsp->y += a;
_vga_sprite_changed++;
}
void SimonState::vc_15_wakeup_id() //vc_15_start_funkystruct_by_id
{
void SimonState::vc_15_wakeup_id() { //vc_15_start_funkystruct_by_id
VgaSleepStruct *vfs = _vga_sleep_structs, *vfs_tmp;
uint16 id = vc_read_next_word();
while (vfs->ident != 0) {
@ -1044,9 +1015,7 @@ void SimonState::vc_15_wakeup_id() //vc_15_start_funkystruct_by_id
_vga_wait_for = 0;
}
void SimonState::vc_16_sleep_on_id() //vc_16_setup_funkystruct
{
void SimonState::vc_16_sleep_on_id() { //vc_16_setup_funkystruct
VgaSleepStruct *vfs = _vga_sleep_structs;
while (vfs->ident)
vfs++;
@ -1059,8 +1028,7 @@ void SimonState::vc_16_sleep_on_id() //vc_16_setup_funkystruct
_vc_ptr = (byte *)&vc_get_out_of_code;
}
void SimonState::vc_17_set_pathfind_item()
{
void SimonState::vc_17_set_pathfind_item() {
uint a = vc_read_next_word();
_pathfind_array[a - 1] = (uint16 *)_vc_ptr;
while (READ_BE_UINT16_UNALIGNED(_vc_ptr) != 999)
@ -1068,46 +1036,39 @@ void SimonState::vc_17_set_pathfind_item()
_vc_ptr += 2;
}
void SimonState::vc_18_jump_rel()
{
void SimonState::vc_18_jump_rel() {
int16 offs = vc_read_next_word();
_vc_ptr += offs;
}
/* chain to script? */
void SimonState::vc_19_chain_to_script()
{
void SimonState::vc_19_chain_to_script() {
/* XXX: not implemented */
error("vc_19_chain_to_script: not implemented");
}
/* helper routines */
/* write unaligned 16-bit */
static void write_16_le(void *p, uint16 a)
{
static void write_16_le(void *p, uint16 a) {
((byte *)p)[0] = (byte)(a);
((byte *)p)[1] = (byte)(a >> 8);
}
/* read unaligned 16-bit */
static uint16 read_16_le(void *p)
{
static uint16 read_16_le(void *p) {
return ((byte *)p)[0] | (((byte *)p)[1] << 8);
}
/* FIXME: unaligned access */
void SimonState::vc_20_set_code_word()
{
void SimonState::vc_20_set_code_word() {
uint16 a = vc_read_next_word();
write_16_le(_vc_ptr, a);
_vc_ptr += 2;
}
/* FIXME: unaligned access */
void SimonState::vc_21_jump_if_code_word()
{
void SimonState::vc_21_jump_if_code_word() {
if (!(_game & GF_SIMON2)) {
int16 a = vc_read_next_word();
byte *tmp = _vc_ptr + a;
@ -1129,8 +1090,7 @@ void SimonState::vc_21_jump_if_code_word()
}
}
void SimonState::vc_22_set_pal()
{
void SimonState::vc_22_set_pal() {
uint a = vc_read_next_word();
uint b = vc_read_next_word();
uint num = a == 0 ? 0x20 : 0x10;
@ -1154,8 +1114,7 @@ void SimonState::vc_22_set_pal()
_vga_sprite_changed++;
}
void SimonState::vc_23_set_pri()
{
void SimonState::vc_23_set_pri() {
VgaSprite *vsp = find_cur_sprite(), *vus2;
uint16 pri = vc_read_next_word();
VgaSprite bak;
@ -1194,8 +1153,7 @@ void SimonState::vc_23_set_pri()
_vga_sprite_changed++;
}
void SimonState::vc_24_set_image_xy()
{
void SimonState::vc_24_set_image_xy() {
VgaSprite *vsp = find_cur_sprite();
vsp->image = vc_read_var_or_word();
@ -1215,8 +1173,7 @@ void SimonState::vc_24_set_image_xy()
_vga_sprite_changed++;
}
void SimonState::vc_25_halt_thread() //vc_25_del_sprite_and_get_out
{
void SimonState::vc_25_halt_thread() { //vc_25_del_sprite_and_get_out
VgaSprite *vsp = find_cur_sprite();
while (vsp->id != 0) {
memcpy(vsp, vsp + 1, sizeof(VgaSprite));
@ -1226,8 +1183,7 @@ void SimonState::vc_25_halt_thread() //vc_25_del_sprite_and_get_out
_vga_sprite_changed++;
}
void SimonState::vc_26_set_window()
{
void SimonState::vc_26_set_window() {
uint16 *as = &_video_windows[vc_read_next_word() * 4];
as[0] = vc_read_next_word();
as[1] = vc_read_next_word();
@ -1235,8 +1191,7 @@ void SimonState::vc_26_set_window()
as[3] = vc_read_next_word();
}
void SimonState::vc_27_reset_simon1()
{
void SimonState::vc_27_reset_simon1() {
VgaSprite bak, *vsp;
VgaSleepStruct *vfs;
VgaTimerEntry *vte, *vte2;
@ -1282,9 +1237,7 @@ void SimonState::vc_27_reset_simon1()
_lock_word &= ~8;
}
void SimonState::vc_27_reset_simon2()
{
void SimonState::vc_27_reset_simon2() {
_lock_word |= 8;
{
@ -1319,76 +1272,64 @@ void SimonState::vc_27_reset_simon2()
_lock_word &= ~8;
}
void SimonState::vc_27_reset()
{
void SimonState::vc_27_reset() {
if (!(_game & GF_SIMON2))
vc_27_reset_simon1();
else
vc_27_reset_simon2();
}
void SimonState::vc_28_dummy_op()
{
void SimonState::vc_28_dummy_op() {
/* dummy opcode */
_vc_ptr += 8;
}
void SimonState::vc_29_stop_all_sounds()
{
void SimonState::vc_29_stop_all_sounds() {
_sound->stopAll();
}
void SimonState::vc_30_set_base_delay()
{
void SimonState::vc_30_set_base_delay() {
_vga_base_delay = vc_read_next_word();
}
void SimonState::vc_31_set_palette_mode()
{
void SimonState::vc_31_set_palette_mode() {
_video_palette_mode = vc_read_next_word();
}
uint SimonState::vc_read_var(uint var)
{
uint SimonState::vc_read_var(uint var) {
assert(var < 255);
return (uint16)_variableArray[var];
}
void SimonState::vc_write_var(uint var, int16 value)
{
void SimonState::vc_write_var(uint var, int16 value) {
_variableArray[var] = value;
}
void SimonState::vc_32_copy_var()
{
void SimonState::vc_32_copy_var() {
uint16 a = vc_read_var(vc_read_next_word());
vc_write_var(vc_read_next_word(), a);
}
void SimonState::vc_33_force_unlock()
{
void SimonState::vc_33_force_unlock() {
if (_lock_counter != 0) {
_lock_counter = 1;
unlock();
}
}
void SimonState::vc_34_force_lock()
{
void SimonState::vc_34_force_lock() {
lock();
_lock_counter = 200;
_left_button_down = 0;
}
void SimonState::vc_35()
{
void SimonState::vc_35() {
/* not used? */
_vc_ptr += 4;
_vga_sprite_changed++;
}
void SimonState::vc_36_saveload_thing()
{
void SimonState::vc_36_saveload_thing() {
_video_var_8 = false;
uint vga_res = vc_read_next_word();
uint mode = vc_read_next_word();
@ -1404,29 +1345,25 @@ void SimonState::vc_36_saveload_thing()
}
}
void SimonState::vc_37_offset_y_f() //vc_37_sprite_unk3_add
{
void SimonState::vc_37_offset_y_f() { //vc_37_sprite_unk3_add
VgaSprite *vsp = find_cur_sprite();
vsp->y += vc_read_var(vc_read_next_word());
_vga_sprite_changed++;
}
void SimonState::vc_38_skip_if_var_zero()
{
void SimonState::vc_38_skip_if_var_zero() {
uint var = vc_read_next_word();
if (vc_read_var(var) == 0)
vc_skip_next_instruction();
}
void SimonState::vc_39_set_var()
{
void SimonState::vc_39_set_var() {
uint var = vc_read_next_word();
int16 value = vc_read_next_word();
vc_write_var(var, value);
}
void SimonState::vc_40_var_add()
{
void SimonState::vc_40_var_add() {
uint var = vc_read_next_word();
int16 value = vc_read_var(var) + vc_read_next_word();
@ -1455,8 +1392,7 @@ no_scroll:;
vc_write_var(var, value);
}
void SimonState::vc_41_var_sub()
{
void SimonState::vc_41_var_sub() {
uint var = vc_read_next_word();
int16 value = vc_read_var(var) - vc_read_next_word();
@ -1485,8 +1421,7 @@ no_scroll:;
vc_write_var(var, value);
}
void SimonState::vc_42_delay_if_not_eq()
{
void SimonState::vc_42_delay_if_not_eq() {
uint val = vc_read_var(vc_read_next_word());
if (val == vc_read_next_word()) {
@ -1495,42 +1430,36 @@ void SimonState::vc_42_delay_if_not_eq()
}
}
void SimonState::vc_43_skip_if_bit_clear()
{
void SimonState::vc_43_skip_if_bit_clear() {
if (!vc_get_bit(vc_read_next_word())) {
vc_skip_next_instruction();
}
}
void SimonState::vc_44_skip_if_bit_set()
{
void SimonState::vc_44_skip_if_bit_set() {
if (vc_get_bit(vc_read_next_word())) {
vc_skip_next_instruction();
}
}
void SimonState::vc_45_set_x()
{
void SimonState::vc_45_set_x() {
VgaSprite *vsp = find_cur_sprite();
vsp->x = vc_read_var(vc_read_next_word());
_vga_sprite_changed++;
}
void SimonState::vc_46_set_y()
{
void SimonState::vc_46_set_y() {
VgaSprite *vsp = find_cur_sprite();
vsp->y = vc_read_var(vc_read_next_word());
_vga_sprite_changed++;
}
void SimonState::vc_47_add_var_f()
{
void SimonState::vc_47_add_var_f() {
uint var = vc_read_next_word();
vc_write_var(var, vc_read_var(var) + vc_read_var(vc_read_next_word()));
}
void SimonState::vc_48()
{
void SimonState::vc_48() {
uint a = (uint16)_variableArray[12];
uint b = (uint16)_variableArray[13];
int c = _variableArray[14];
@ -1561,38 +1490,31 @@ void SimonState::vc_48()
vp += 2;
} while (--c);
}
void SimonState::vc_set_bit_to(uint bit, bool value)
{
void SimonState::vc_set_bit_to(uint bit, bool value) {
uint16 *bits = &_bit_array[bit >> 4];
*bits = (*bits & ~(1 << (bit & 15))) | (value << (bit & 15));
}
bool SimonState::vc_get_bit(uint bit)
{
bool SimonState::vc_get_bit(uint bit) {
uint16 *bits = &_bit_array[bit >> 4];
return (*bits & (1 << (bit & 15))) != 0;
}
void SimonState::vc_49_set_bit()
{
void SimonState::vc_49_set_bit() {
vc_set_bit_to(vc_read_next_word(), true);
}
void SimonState::vc_50_clear_bit()
{
void SimonState::vc_50_clear_bit() {
vc_set_bit_to(vc_read_next_word(), false);
}
void SimonState::vc_51_clear_hitarea_bit_0x40()
{
void SimonState::vc_51_clear_hitarea_bit_0x40() {
clear_hitarea_bit_0x40(vc_read_next_word());
}
void SimonState::vc_52_play_sound()
{
void SimonState::vc_52_play_sound() {
uint16 a = vc_read_next_word();
if (_game == GAME_SIMON1DOS) {
@ -1609,18 +1531,15 @@ void SimonState::vc_52_play_sound()
}
}
void SimonState::vc_53_no_op()
{
void SimonState::vc_53_no_op() {
/* no op */
}
void SimonState::vc_54_no_op()
{
void SimonState::vc_54_no_op() {
/* no op */
}
void SimonState::vc_55_offset_hit_area()
{
void SimonState::vc_55_offset_hit_area() {
HitArea *ha = _hit_areas;
uint count = ARRAYSIZE(_hit_areas);
uint16 id = vc_read_next_word();
@ -1641,8 +1560,7 @@ void SimonState::vc_55_offset_hit_area()
_need_hitarea_recalc++;
}
void SimonState::vc_56_no_op()
{
void SimonState::vc_56_no_op() {
/* no op in simon1 */
if (_game & GF_SIMON2) {
uint num = vc_read_var_or_word() * _vga_base_delay;
@ -1655,8 +1573,7 @@ void SimonState::vc_56_no_op()
}
}
void SimonState::vc_59()
{
void SimonState::vc_59() {
if (_game & GF_SIMON2) {
uint file = vc_read_next_word();
uint start = vc_read_next_word();
@ -1671,8 +1588,7 @@ void SimonState::vc_59()
}
}
void SimonState::vc_58()
{
void SimonState::vc_58() {
uint sprite = _vga_cur_sprite_id;
uint file = _vga_cur_file_id;
byte *vc_ptr;
@ -1692,14 +1608,11 @@ void SimonState::vc_58()
_vga_cur_file_id = file;
}
void SimonState::vc_57_no_op()
{
void SimonState::vc_57_no_op() {
/* no op */
}
void SimonState::vc_kill_thread(uint file, uint sprite)
{
void SimonState::vc_kill_thread(uint file, uint sprite) {
uint16 old_sprite_id, old_cur_file_id;
VgaSleepStruct *vfs;
VgaSprite *vsp;
@ -1748,8 +1661,7 @@ void SimonState::vc_kill_thread(uint file, uint sprite)
_vc_ptr = vc_org;
}
void SimonState::vc_60_kill_thread()
{
void SimonState::vc_60_kill_thread() {
uint file;
if (_game & GF_SIMON2) {
@ -1761,8 +1673,7 @@ void SimonState::vc_60_kill_thread()
vc_kill_thread(file, sprite);
}
void SimonState::vc_61_sprite_change()
{
void SimonState::vc_61_sprite_change() {
VgaSprite *vsp = find_cur_sprite();
vsp->image = vc_read_var_or_word();
@ -1774,12 +1685,10 @@ void SimonState::vc_61_sprite_change()
_vga_sprite_changed++;
}
void SimonState::vc_62_palette_thing()
{
void SimonState::vc_62_palette_thing() {
uint i;
byte *vc_ptr_org = _vc_ptr;
vc_29_stop_all_sounds();
if (!_video_var_3) {
@ -1842,8 +1751,7 @@ void SimonState::vc_62_palette_thing()
_vc_ptr = vc_ptr_org;
}
void SimonState::vc_63_palette_thing_2()
{
void SimonState::vc_63_palette_thing_2() {
_palette_color_count = 208;
if (_video_palette_mode != 4) {
_palette_color_count = 256;
@ -1851,14 +1759,14 @@ void SimonState::vc_63_palette_thing_2()
_video_var_3 = false;
}
void SimonState::vc_64_skip_if_text()
{ // Simon2
void SimonState::vc_64_skip_if_text() {
// Simon2
if (vc_59_helper())
vc_skip_next_instruction();
}
void SimonState::vc_65_palette_thing_3()
{ // Simon2
void SimonState::vc_65_palette_thing_3() {
// Simon2
_palette_color_count = 0x270;
_video_num_pal_colors = 0x0D0;
if (_video_palette_mode != 4) {
@ -1869,8 +1777,8 @@ void SimonState::vc_65_palette_thing_3()
_video_var_3 = false;
}
void SimonState::vc_66_skip_if_nz()
{ // Simon2
void SimonState::vc_66_skip_if_nz() {
// Simon2
uint a = vc_read_next_word();
uint b = vc_read_next_word();
@ -1878,8 +1786,8 @@ void SimonState::vc_66_skip_if_nz()
vc_skip_next_instruction();
}
void SimonState::vc_67_skip_if_ge()
{ // Simon2
void SimonState::vc_67_skip_if_ge() {
// Simon2
uint a = vc_read_next_word();
uint b = vc_read_next_word();
@ -1887,8 +1795,8 @@ void SimonState::vc_67_skip_if_ge()
vc_skip_next_instruction();
}
void SimonState::vc_68_skip_if_le()
{ // Simon2
void SimonState::vc_68_skip_if_le() {
// Simon2
uint a = vc_read_next_word();
uint b = vc_read_next_word();
@ -1896,8 +1804,8 @@ void SimonState::vc_68_skip_if_le()
vc_skip_next_instruction();
}
void SimonState::vc_69()
{ // Simon2
void SimonState::vc_69() {
// Simon2
uint16 a = vc_read_next_word();
uint16 b = vc_read_next_word();
@ -1920,8 +1828,8 @@ void SimonState::vc_69()
}
void SimonState::vc_70()
{ // Simon2
void SimonState::vc_70() {
// Simon2
uint16 a = vc_read_next_word();
uint16 b = vc_read_next_word();
@ -1932,15 +1840,14 @@ void SimonState::vc_70()
warning("vc_70(%d,%d): music stuff?", a, b);
}
void SimonState::vc_71()
{ // Simon2
void SimonState::vc_71() {
// Simon2
if (_vc72_var3 == 0xFFFF && _vc72_var1 == 0xFFFF)
vc_skip_next_instruction();
}
void SimonState::vc_72()
{ // Simon2
void SimonState::vc_72() {
// Simon2
uint16 a = vc_read_next_word();
uint16 b = vc_read_next_word();
if (a != _vc72_var1) {
@ -1952,14 +1859,14 @@ void SimonState::vc_72()
warning("vc_72(%d,%d): music stuff?", a, b);
}
void SimonState::vc_73_set_op189_flag()
{ // Simon2
void SimonState::vc_73_set_op189_flag() {
// Simon2
vc_read_next_byte();
_op_189_flags |= 1 << vc_read_next_byte();
}
void SimonState::vc_74_clear_op189_flag()
{ // Simon2
void SimonState::vc_74_clear_op189_flag() {
// Simon2
vc_read_next_byte();
_op_189_flags &= ~(1 << vc_read_next_byte());
}

View File

@ -77,7 +77,7 @@ struct VC10_state {
byte depack_dest[200];
};
byte *vc_10_depack_column(VC10_state * vs);
byte *vc_10_depack_column(VC10_state *vs);
#endif