some more cleanup

svn-id: r5360
This commit is contained in:
Max Horn 2002-10-31 01:27:05 +00:00
parent 8d760a44ec
commit b43410e6f6
3 changed files with 63 additions and 76 deletions

View File

@ -263,8 +263,6 @@ byte *SimonState::readSingleOpcode(File *in, byte *ptr)
table = opcode_arg_table_simon2win;
break;
case GAME_SIMON1DOS:
table = opcode_arg_table_simon1dos;
break;
case GAME_SIMON1DEMO:
table = opcode_arg_table_simon1dos;
break;

View File

@ -4936,42 +4936,32 @@ void SimonState::playMusic(uint music)
if (_game & GAME_WIN) {
_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET);
File *f = _game_file;
midi.read_all_songs(f);
midi.read_all_songs(_game_file);
}
midi.initialize();
midi.play();
} else {
midi.shutdown();
if (_game == GAME_SIMON1DOS) {
midi.shutdown();
char buf[50];
File *f = new File();
sprintf(buf, "MOD%d.MUS", music);
f->open(buf, _gameDataPath);
if (f->isOpen() == false) {
warning("Cannot load music from '%s'", buf);
return;
char buf[50];
File *f = new File();
sprintf(buf, "MOD%d.MUS", music);
f->open(buf, _gameDataPath);
if (f->isOpen() == false) {
warning("Cannot load music from '%s'", buf);
return;
}
midi.read_all_songs_old(f);
delete f;
} else if (_game == GAME_SIMON1WIN) {
_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET);
midi.read_all_songs_old(_game_file);
}
midi.read_all_songs_old(f);
delete f;
midi.initialize();
midi.play();
}
if (_game == GAME_SIMON1WIN) {
midi.shutdown();
_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET);
File *f = _game_file;
midi.read_all_songs_old(f);
midi.initialize();
midi.play();
}
}
}

View File

@ -24,6 +24,30 @@
#include "simon/simon.h"
#include "simon/intern.h"
static const char *const verb_names[] = {
"Walk to",
"Look at",
"Open",
"Move",
"Consume",
"Pick up",
"Close",
"Use",
"Talk to",
"Remove",
"Wear",
"Give"
};
static const char *const verb_prep_names[] = {
"", "", "", "",
"", "", "", "with what ?",
"", "", "", "to whom ?"
};
void SimonState::defocusHitarea()
{
HitArea *last;
@ -50,29 +74,6 @@ void SimonState::defocusHitarea()
focusVerb(last->id);
}
static const char *const verb_names[] = {
"Walk to",
"Look at",
"Open",
"Move",
"Consume",
"Pick up",
"Close",
"Use",
"Talk to",
"Remove",
"Wear",
"Give"
};
static const char *const verb_prep_names[] = {
"", "", "", "",
"", "", "", "with what ?",
"", "", "", "to whom ?"
};
void SimonState::focusVerb(uint hitarea_id)
{
uint x;
@ -318,42 +319,39 @@ void SimonState::handle_unk_hitarea(FillOrCopyStruct *fcs)
void SimonState::setup_hitarea_from_pos(uint x, uint y, uint mode)
{
HitArea *best_ha;
if (_game & GAME_SIMON2) {
if (_bit_array[4] & 0x8000 || y < 134) {
x += _x_scroll * 8;
}
}
{
HitArea *ha = _hit_areas;
uint count = ARRAYSIZE(_hit_areas);
uint16 layer = 0;
const uint16 x_ = x;
const uint16 y_ = y;
HitArea *best_ha;
HitArea *ha = _hit_areas;
uint count = ARRAYSIZE(_hit_areas);
uint16 layer = 0;
const uint16 x_ = x;
const uint16 y_ = y;
best_ha = NULL;
best_ha = NULL;
do {
if (ha->flags & 0x20) {
if (!(ha->flags & 0x40)) {
if (x_ >= ha->x && y_ >= ha->y &&
x_ - ha->x < ha->width && y_ - ha->y < ha->height && layer <= ha->layer) {
layer = ha->layer;
best_ha = ha;
} else {
if (ha->flags & 2) {
hitarea_leave(ha);
ha->flags &= ~2;
}
}
do {
if (ha->flags & 0x20) {
if (!(ha->flags & 0x40)) {
if (x_ >= ha->x && y_ >= ha->y &&
x_ - ha->x < ha->width && y_ - ha->y < ha->height && layer <= ha->layer) {
layer = ha->layer;
best_ha = ha;
} else {
ha->flags &= ~2;
if (ha->flags & 2) {
hitarea_leave(ha);
ha->flags &= ~2;
}
}
} else {
ha->flags &= ~2;
}
} while (ha++, --count);
}
}
} while (ha++, --count);
if (best_ha == NULL) {
defocusHitarea();
@ -445,5 +443,6 @@ bool SimonState::hitarea_proc_3(Item *item)
else
x = 0;
showActionString(x, string_ptr);
return true;
}