aboutsummaryrefslogtreecommitdiff
path: root/engines/agos
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agos')
-rw-r--r--engines/agos/agos.h4
-rw-r--r--engines/agos/game.cpp3
-rw-r--r--engines/agos/items.cpp23
-rw-r--r--engines/agos/vga.cpp15
4 files changed, 17 insertions, 28 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 6e3fc6b2bd..b277087651 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -151,13 +151,13 @@ class AGOSEngine : public Engine {
void setupPuzzleOpcodes(OpcodeProc *op);
void setupOpcodes();
- const OpcodeProc *_opcode_table;
+ OpcodeProc _opcode_table[300];
int _numOpcodes;
typedef void (AGOSEngine::*VgaOpcodeProc) ();
void setupVgaOpcodes();
- const VgaOpcodeProc *_vga_opcode_table;
+ VgaOpcodeProc _vga_opcode_table[100];
uint _numVideoOpcodes;
void setupCommonVideoOpcodes(VgaOpcodeProc *op);
diff --git a/engines/agos/game.cpp b/engines/agos/game.cpp
index 387ca80128..d25be232ba 100644
--- a/engines/agos/game.cpp
+++ b/engines/agos/game.cpp
@@ -1844,7 +1844,6 @@ DetectedGame toDetectedGame(const ADGameDescription &g) {
}
bool AGOSEngine::initGame() {
- uint16 gameCount = ARRAYSIZE(gameDescriptions);
int gameNumber = -1;
DetectedGameList detectedGames;
@@ -1884,7 +1883,7 @@ bool AGOSEngine::initGame() {
//delete &matches;
- if (gameNumber >= gameCount || gameNumber == -1) {
+ if (gameNumber >= ARRAYSIZE(gameDescriptions) || gameNumber == -1) {
error("AGOSEngine::loadGame wrong gameNumber");
}
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index edf3e2a26c..6d17693868 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.cpp
@@ -585,35 +585,30 @@ void AGOSEngine::setupPuzzleOpcodes(OpcodeProc *op) {
}
void AGOSEngine::setupOpcodes() {
- static OpcodeProc opcode_table[300];
-
- for (int i = 0; i < ARRAYSIZE(opcode_table); i++)
- opcode_table[i] = NULL;
-
- _opcode_table = opcode_table;
- _numOpcodes = ARRAYSIZE(opcode_table);
+ memset(_opcode_table, 0, sizeof(_opcode_table));
+ _numOpcodes = ARRAYSIZE(_opcode_table);
switch (getGameType()) {
case GType_ELVIRA1:
- setupElvira1Opcodes(opcode_table);
+ setupElvira1Opcodes(_opcode_table);
break;
case GType_ELVIRA2:
- setupElvira2Opcodes(opcode_table);
+ setupElvira2Opcodes(_opcode_table);
break;
case GType_WW:
- setupWaxworksOpcodes(opcode_table);
+ setupWaxworksOpcodes(_opcode_table);
break;
case GType_SIMON1:
- setupSimon1Opcodes(opcode_table);
+ setupSimon1Opcodes(_opcode_table);
break;
case GType_SIMON2:
- setupSimon2Opcodes(opcode_table);
+ setupSimon2Opcodes(_opcode_table);
break;
case GType_FF:
- setupFeebleOpcodes(opcode_table);
+ setupFeebleOpcodes(_opcode_table);
break;
case GType_PP:
- setupPuzzleOpcodes(opcode_table);
+ setupPuzzleOpcodes(_opcode_table);
break;
default:
error("setupOpcodes: Unknown game");
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index 71f9fff097..1e533231dc 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -177,28 +177,23 @@ void AGOSEngine::setupFeebleVideoOpcodes(VgaOpcodeProc *op) {
}
void AGOSEngine::setupVgaOpcodes() {
- static VgaOpcodeProc vga_opcode_table[100];
-
- for (int i = 0; i < ARRAYSIZE(vga_opcode_table); i++)
- vga_opcode_table[i] = NULL;
-
- _vga_opcode_table = vga_opcode_table;
+ memset(_vga_opcode_table, 0, sizeof(_vga_opcode_table));
switch (getGameType()) {
case GType_ELVIRA1:
- setupElvira1VideoOpcodes(vga_opcode_table);
+ setupElvira1VideoOpcodes(_vga_opcode_table);
break;
case GType_ELVIRA2:
case GType_WW:
case GType_SIMON1:
- setupCommonVideoOpcodes(vga_opcode_table);
+ setupCommonVideoOpcodes(_vga_opcode_table);
break;
case GType_SIMON2:
- setupSimon2VideoOpcodes(vga_opcode_table);
+ setupSimon2VideoOpcodes(_vga_opcode_table);
break;
case GType_FF:
case GType_PP:
- setupFeebleVideoOpcodes(vga_opcode_table);
+ setupFeebleVideoOpcodes(_vga_opcode_table);
break;
default:
error("setupVgaOpcodes: Unknown game");