- Changed PalmOS ifdef

- Move opcode table to setupVgaOpcodes so that the table is correctly initialized with PalmOS ARM

svn-id: r19471
This commit is contained in:
Chris Apers 2005-11-05 18:47:03 +00:00
parent 3fe9730fc9
commit af1cbcde85
3 changed files with 112 additions and 98 deletions

View File

@ -45,7 +45,7 @@
extern bool isSmartphone(void);
#endif
#ifdef __PALM_OS__
#ifdef PALMOS_68K
#include "globals.h"
#endif
@ -169,7 +169,7 @@ REGISTER_PLUGIN(SIMON, "Simon the Sorcerer")
namespace Simon {
#ifdef __PALM_OS__
#ifdef PALMOS_68K
#define PTR(a) a
static const GameSpecificSettings *simon1_settings;
static const GameSpecificSettings *simon1acorn_settings;
@ -177,6 +177,7 @@ static const GameSpecificSettings *simon1amiga_settings;
static const GameSpecificSettings *simon1demo_settings;
static const GameSpecificSettings *simon2win_settings;
static const GameSpecificSettings *simon2dos_settings;
static const GameSpecificSettings *feeblefiles_settings;
#else
#define PTR(a) &a
static const GameSpecificSettings simon1_settings = {
@ -292,6 +293,7 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst)
_gameOffsetsPtr = 0;
_debugger = 0;
setupVgaOpcodes();
const SimonGameSettings *g = simon_settings;
while (g->name) {
@ -364,7 +366,7 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst)
VGA_DELAY_BASE = 1;
if (_game == GAME_FEEBLEFILES) {
NUM_VIDEO_OP_CODES = 85;
#ifndef __PALM_OS__
#ifndef PALMOS_68K
VGA_MEM_SIZE = 7500000;
#else
VGA_MEM_SIZE = gVars->memory[kMemSimon2Games];
@ -374,7 +376,7 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst)
TABLE_INDEX_BASE = 1580 / 4;
TEXT_INDEX_BASE = 1500 / 4;
NUM_VIDEO_OP_CODES = 75;
#ifndef __PALM_OS__
#ifndef PALMOS_68K
VGA_MEM_SIZE = 2000000;
#else
VGA_MEM_SIZE = gVars->memory[kMemSimon2Games];
@ -390,7 +392,7 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst)
TABLE_INDEX_BASE = 1576 / 4;
TEXT_INDEX_BASE = 1460 / 4;
NUM_VIDEO_OP_CODES = 64;
#ifndef __PALM_OS__
#ifndef PALMOS_68K
VGA_MEM_SIZE = 1000000;
#else
VGA_MEM_SIZE = gVars->memory[kMemSimon1Games];
@ -1404,7 +1406,6 @@ void SimonEngine::loadTablesIntoMem(uint subr_id) {
in = openTablesFile(filename);
readSubroutineBlock(in);
closeTablesFile(in);
if (_game == GAME_FEEBLEFILES) {
// TODO
} else if (_game & GF_SIMON2) {
@ -2572,6 +2573,7 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) {
} else {
_vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon *) b)->scriptOffs);
}
//dump_vga_script(_vcPtr, num, vga_res_id);
run_vga_script();
_vcPtr = vc_ptr_org;
@ -2593,8 +2595,10 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) {
num_lines = 200;
else
num_lines = _windowNum == 4 ? 134 : 200;
dx_copy_from_attached_to_2(0, 0, _screenWidth, num_lines);
dx_copy_from_attached_to_3(num_lines);
_syncFlag2 = 1;
_timer5 = 0;
}
@ -4200,7 +4204,7 @@ void SimonEngine::delay(uint amount) {
break;
case OSystem::EVENT_LBUTTONDOWN:
_leftButtonDown++;
#if defined (_WIN32_WCE) || defined(__PALM_OS__)
#if defined (_WIN32_WCE) || defined(PALMOS_MODE)
_sdlMouseX = event.mouse.x;
_sdlMouseY = event.mouse.y;
#endif
@ -4325,7 +4329,7 @@ byte SimonEngine::getByte() {
} // End of namespace Simon
#ifdef __PALM_OS__
#ifdef PALMOS_68K
#include "scumm_globals.h"
_GINIT(Simon_Simon)
@ -4335,6 +4339,7 @@ _GSETPTR(Simon::simon1amiga_settings, GBVARS_SIMON1AMIGASETTINGS_INDEX, Simon::G
_GSETPTR(Simon::simon1demo_settings, GBVARS_SIMON1DEMOSETTINGS_INDEX, Simon::GameSpecificSettings, GBVARS_SIMON)
_GSETPTR(Simon::simon2win_settings, GBVARS_SIMON2WINSETTINGS_INDEX, Simon::GameSpecificSettings, GBVARS_SIMON)
_GSETPTR(Simon::simon2dos_settings, GBVARS_SIMON2DOSSETTINGS_INDEX, Simon::GameSpecificSettings, GBVARS_SIMON)
_GSETPTR(Simon::feeblefiles_settings, GBVARS_FEEBLEFILESSETTINGS_INDEX, Simon::GameSpecificSettings, GBVARS_SIMON)
_GEND
_GRELEASE(Simon_Simon)
@ -4344,6 +4349,7 @@ _GRELEASEPTR(GBVARS_SIMON1AMIGASETTINGS_INDEX, GBVARS_SIMON)
_GRELEASEPTR(GBVARS_SIMON1DEMOSETTINGS_INDEX, GBVARS_SIMON)
_GRELEASEPTR(GBVARS_SIMON2WINSETTINGS_INDEX, GBVARS_SIMON)
_GRELEASEPTR(GBVARS_SIMON2DOSSETTINGS_INDEX, GBVARS_SIMON)
_GRELEASEPTR(GBVARS_FEEBLEFILESSETTINGS_INDEX, GBVARS_SIMON)
_GEND
#endif

View File

@ -109,6 +109,11 @@ class SimonEngine : public Engine {
friend class Debugger;
void errorString(const char *buf_input, char *buf_output);
typedef void (SimonEngine::*VgaOpcodeProc) ();
void setupVgaOpcodes();
const VgaOpcodeProc *_vga_opcode_table;
protected:
void playSting(uint a);

View File

@ -29,96 +29,98 @@
namespace Simon {
typedef void (SimonEngine::*VgaOpcodeProc) ();
// Opcode tables
static const VgaOpcodeProc vga_opcode_table[] = {
NULL,
&SimonEngine::vc1_fadeOut,
&SimonEngine::vc2_call,
&SimonEngine::vc3_loadSprite,
&SimonEngine::vc4_fadeIn,
&SimonEngine::vc5_skip_if_neq,
&SimonEngine::vc6_skip_ifn_sib_with_a,
&SimonEngine::vc7_skip_if_sib_with_a,
&SimonEngine::vc8_skip_if_parent_is,
&SimonEngine::vc9_skip_if_unk3_is,
&SimonEngine::vc10_draw,
&SimonEngine::vc11_clearPathFinder,
&SimonEngine::vc12_delay,
&SimonEngine::vc13_addToSpriteX,
&SimonEngine::vc14_addToSpriteY,
&SimonEngine::vc15_wakeup_id,
&SimonEngine::vc16_sleep_on_id,
&SimonEngine::vc17_setPathfinderItem,
&SimonEngine::vc18_jump,
&SimonEngine::vc19_chain_to_script,
&SimonEngine::vc20_setRepeat,
&SimonEngine::vc21_endRepeat,
&SimonEngine::vc22_setSpritePalette,
&SimonEngine::vc23_setSpritePriority,
&SimonEngine::vc24_setSpriteXY,
&SimonEngine::vc25_halt_sprite,
&SimonEngine::vc26_setSubWindow,
&SimonEngine::vc27_resetSprite,
&SimonEngine::vc28_dummy_op,
&SimonEngine::vc29_stopAllSounds,
&SimonEngine::vc30_setFrameRate,
&SimonEngine::vc31_setWindow,
&SimonEngine::vc32_copyVar,
&SimonEngine::vc33_setMouseOn,
&SimonEngine::vc34_setMouseOff,
&SimonEngine::vc35_clearWindow,
&SimonEngine::vc36_setWindowImage,
&SimonEngine::vc37_addToSpriteY,
&SimonEngine::vc38_skipIfVarZero,
&SimonEngine::vc39_setVar,
&SimonEngine::vc40,
&SimonEngine::vc41,
&SimonEngine::vc42_delayIfNotEQ,
&SimonEngine::vc43_skipIfBitClear,
&SimonEngine::vc44_skipIfBitSet,
&SimonEngine::vc45_setSpriteX,
&SimonEngine::vc46_setSpriteY,
&SimonEngine::vc47_addToVar,
&SimonEngine::vc48_setPathFinder,
&SimonEngine::vc49_setBit,
&SimonEngine::vc50_clearBit,
&SimonEngine::vc51_clear_hitarea_bit_0x40,
&SimonEngine::vc52_playSound,
&SimonEngine::vc53_no_op,
&SimonEngine::vc54_no_op,
&SimonEngine::vc55_offset_hit_area,
&SimonEngine::vc56_delay,
&SimonEngine::vc57_no_op,
&SimonEngine::vc58,
&SimonEngine::vc59,
&SimonEngine::vc60_killSprite,
&SimonEngine::vc61_changeSprite,
&SimonEngine::vc62_fastFadeOut,
&SimonEngine::vc63_fastFadeIn,
&SimonEngine::vc64_skipIfSpeechEnded,
&SimonEngine::vc65_slowFadeIn,
&SimonEngine::vc66_skipIfNotEqual,
&SimonEngine::vc67_skipIfGE,
&SimonEngine::vc68_skipIfLE,
&SimonEngine::vc69_playTrack,
&SimonEngine::vc70_queueMusic,
&SimonEngine::vc71_checkMusicQueue,
&SimonEngine::vc72_play_track_2,
&SimonEngine::vc73_setMark,
&SimonEngine::vc74_clearMark,
&SimonEngine::vc75_setScale,
&SimonEngine::vc76_setScaleXOffs,
&SimonEngine::vc77_setScaleYOffs,
&SimonEngine::vc78_pathUnk1,
&SimonEngine::vc79_pathUnk2,
&SimonEngine::vc80_setOverlayImage,
&SimonEngine::vc81_setRandom,
&SimonEngine::vc82_pathUnk3,
&SimonEngine::vc83_playSoundLoop,
&SimonEngine::vc84_stopSoundLoop,
};
void SimonEngine::setupVgaOpcodes() {
static const VgaOpcodeProc vga_opcode_table[] = {
NULL,
&SimonEngine::vc1_fadeOut,
&SimonEngine::vc2_call,
&SimonEngine::vc3_loadSprite,
&SimonEngine::vc4_fadeIn,
&SimonEngine::vc5_skip_if_neq,
&SimonEngine::vc6_skip_ifn_sib_with_a,
&SimonEngine::vc7_skip_if_sib_with_a,
&SimonEngine::vc8_skip_if_parent_is,
&SimonEngine::vc9_skip_if_unk3_is,
&SimonEngine::vc10_draw,
&SimonEngine::vc11_clearPathFinder,
&SimonEngine::vc12_delay,
&SimonEngine::vc13_addToSpriteX,
&SimonEngine::vc14_addToSpriteY,
&SimonEngine::vc15_wakeup_id,
&SimonEngine::vc16_sleep_on_id,
&SimonEngine::vc17_setPathfinderItem,
&SimonEngine::vc18_jump,
&SimonEngine::vc19_chain_to_script,
&SimonEngine::vc20_setRepeat,
&SimonEngine::vc21_endRepeat,
&SimonEngine::vc22_setSpritePalette,
&SimonEngine::vc23_setSpritePriority,
&SimonEngine::vc24_setSpriteXY,
&SimonEngine::vc25_halt_sprite,
&SimonEngine::vc26_setSubWindow,
&SimonEngine::vc27_resetSprite,
&SimonEngine::vc28_dummy_op,
&SimonEngine::vc29_stopAllSounds,
&SimonEngine::vc30_setFrameRate,
&SimonEngine::vc31_setWindow,
&SimonEngine::vc32_copyVar,
&SimonEngine::vc33_setMouseOn,
&SimonEngine::vc34_setMouseOff,
&SimonEngine::vc35_clearWindow,
&SimonEngine::vc36_setWindowImage,
&SimonEngine::vc37_addToSpriteY,
&SimonEngine::vc38_skipIfVarZero,
&SimonEngine::vc39_setVar,
&SimonEngine::vc40,
&SimonEngine::vc41,
&SimonEngine::vc42_delayIfNotEQ,
&SimonEngine::vc43_skipIfBitClear,
&SimonEngine::vc44_skipIfBitSet,
&SimonEngine::vc45_setSpriteX,
&SimonEngine::vc46_setSpriteY,
&SimonEngine::vc47_addToVar,
&SimonEngine::vc48_setPathFinder,
&SimonEngine::vc49_setBit,
&SimonEngine::vc50_clearBit,
&SimonEngine::vc51_clear_hitarea_bit_0x40,
&SimonEngine::vc52_playSound,
&SimonEngine::vc53_no_op,
&SimonEngine::vc54_no_op,
&SimonEngine::vc55_offset_hit_area,
&SimonEngine::vc56_delay,
&SimonEngine::vc57_no_op,
&SimonEngine::vc58,
&SimonEngine::vc59,
&SimonEngine::vc60_killSprite,
&SimonEngine::vc61_changeSprite,
&SimonEngine::vc62_fastFadeOut,
&SimonEngine::vc63_fastFadeIn,
&SimonEngine::vc64_skipIfSpeechEnded,
&SimonEngine::vc65_slowFadeIn,
&SimonEngine::vc66_skipIfNotEqual,
&SimonEngine::vc67_skipIfGE,
&SimonEngine::vc68_skipIfLE,
&SimonEngine::vc69_playTrack,
&SimonEngine::vc70_queueMusic,
&SimonEngine::vc71_checkMusicQueue,
&SimonEngine::vc72_play_track_2,
&SimonEngine::vc73_setMark,
&SimonEngine::vc74_clearMark,
&SimonEngine::vc75_setScale,
&SimonEngine::vc76_setScaleXOffs,
&SimonEngine::vc77_setScaleYOffs,
&SimonEngine::vc78_pathUnk1,
&SimonEngine::vc79_pathUnk2,
&SimonEngine::vc80_setOverlayImage,
&SimonEngine::vc81_setRandom,
&SimonEngine::vc82_pathUnk3,
&SimonEngine::vc83_playSoundLoop,
&SimonEngine::vc84_stopSoundLoop,
};
_vga_opcode_table = vga_opcode_table;
}
// Script parser
void SimonEngine::run_vga_script() {
@ -145,7 +147,7 @@ void SimonEngine::run_vga_script() {
if (opcode == 0)
return;
(this->*vga_opcode_table[opcode]) ();
(this->*_vga_opcode_table[opcode]) ();
}
}
@ -665,6 +667,7 @@ void SimonEngine::vc10_draw() {
state.palette = (_vcPtr[1] << 4);
_vcPtr += 2;
state.x = (int16)vc_read_next_word();
if (_game & GF_SIMON2) {
state.x -= _scrollX;
}