aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/PalmOS/Src/scumm_globals.h45
-rw-r--r--gui/newgui.cpp15
-rw-r--r--scumm/akos.cpp17
-rw-r--r--scumm/bundle.cpp18
-rw-r--r--scumm/charset.cpp33
-rw-r--r--scumm/costume.cpp17
-rw-r--r--scumm/dialogs.cpp25
-rw-r--r--scumm/gfx.cpp15
-rw-r--r--scumm/imuse_digi.cpp41
-rw-r--r--scumm/smush/codec47.cpp16
10 files changed, 159 insertions, 83 deletions
diff --git a/backends/PalmOS/Src/scumm_globals.h b/backends/PalmOS/Src/scumm_globals.h
index 8b9ef90c5c..3dd5f08715 100644
--- a/backends/PalmOS/Src/scumm_globals.h
+++ b/backends/PalmOS/Src/scumm_globals.h
@@ -29,7 +29,7 @@
#define GBVARS_FTSEQMUSICTABLE_INDEX 6
#define GBVARS_GUIFONT_INDEX 7
#define GBVARS_DEFAULTSCALETABLE_INDEX 8
-#define GBVARS_CODEC37TABLE_INDEX 9
+#define GBVARS_IMCTABLE_INDEX 9
#define GBVARS_CODEC47TABLE_INDEX 10
#define GBVARS_TRANSITIONEFFECTS_INDEX 11
#define GBVARS_STRINGMAPTABLEV7_INDEX 12
@@ -40,34 +40,37 @@
#define GBVARS_ENGLISHCHARSETDATAV2_INDEX 17
#define GBVARS_ITALIANCHARSETDATAV2_INDEX 18
#define GBVARS_SPANISHCHARSETDATAV2_INDEX 19
+#define GBVARS_COSTSCALETABLE_INDEX 20
#define GBVARS_SCUMM 0
#define GBVARS_SIMON 1
#define GBVARS_SKY 2
+#define GBVARS_SWORD2 3
-#define GSETPTR(var,index,format,id) var = (format *)GBGetRecord(index,id);
-#define GRELEASEPTR(index,id) GBReleaseRecord(index,id);
+#define _GINIT(x) void initGlobals_##x() {
+#define _GEND }
+#define _GRELEASE(x) void releaseGlobals_##x() {
-void *GBGetRecord(UInt16 index, UInt16 id);
-void GBReleaseRecord(UInt16 index, UInt16 id);
-
-void IMuseDigital_initGlobals();
-void IMuseDigital_releaseGlobals();
+#define CALL_INIT(x) initGlobals_##x();
+#define CALL_RELEASE(x) releaseGlobals_##x();
-void NewGui_initGlobals();
-void NewGui_releaseGlobals();
+#define _GSETPTR(var,index,format,id) var = (format *)GBGetRecord(index,id);
+#define _GRELEASEPTR(index,id) GBReleaseRecord(index,id);
-void Codec47_initGlobals();
-void Codec47_releaseGlobals();
-
-void Gfx_initGlobals();
-void Gfx_releaseGlobals();
+void *GBGetRecord(UInt16 index, UInt16 id);
+void GBReleaseRecord(UInt16 index, UInt16 id);
-void Akos_initGlobals();
-void Akos_releaseGlobals();
+#define PROTO_GLOBALS(x) void CALL_INIT(x);\
+ void CALL_RELEASE(x);
-void Dialogs_initGlobals();
-void Dialogs_releaseGlobals();
+PROTO_GLOBALS(IMuseDigital)
+PROTO_GLOBALS(NewGui)
+PROTO_GLOBALS(Akos)
+PROTO_GLOBALS(Bundle)
+PROTO_GLOBALS(Codec47)
+PROTO_GLOBALS(Gfx)
+PROTO_GLOBALS(Dialogs)
+PROTO_GLOBALS(Charset)
+PROTO_GLOBALS(Costume)
-void Charset_initGlobals();
-void Charset_releaseGlobals();
+#undef PROTO_GLOBALS \ No newline at end of file
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 5a23fbfb19..d44e9b6836 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -516,9 +516,14 @@ void NewGui::animateCursor() {
}
#ifdef __PALM_OS__
-#include "scumm_globals.h" // init globals
-void NewGui_initGlobals() {
- GSETPTR(guifont, GBVARS_GUIFONT_INDEX, byte, GBVARS_SCUMM)
-}
-void NewGui_releaseGlobals(){ GRELEASEPTR(GBVARS_GUIFONT_INDEX, GBVARS_SCUMM) }
+#include "scumm_globals.h"
+
+_GINIT(NewGui)
+_GSETPTR(guifont, GBVARS_GUIFONT_INDEX, byte, GBVARS_SCUMM)
+_GEND
+
+_GRELEASE(NewGui)
+_GRELEASEPTR(GBVARS_GUIFONT_INDEX, GBVARS_SCUMM)
+_GEND
+
#endif
diff --git a/scumm/akos.cpp b/scumm/akos.cpp
index c9f1ed2078..c79f285d74 100644
--- a/scumm/akos.cpp
+++ b/scumm/akos.cpp
@@ -1366,11 +1366,14 @@ void Scumm::akos_queCommand(byte cmd, Actor *a, int param_1, int param_2) {
}
#ifdef __PALM_OS__
-#include "scumm_globals.h" // init globals
-void Akos_initGlobals() {
- GSETPTR(defaultScaleTable, GBVARS_DEFAULTSCALETABLE_INDEX, byte, GBVARS_SCUMM)
-}
-void Akos_releaseGlobals() {
- GRELEASEPTR(GBVARS_DEFAULTSCALETABLE_INDEX, GBVARS_SCUMM)
-}
+#include "scumm_globals.h"
+
+_GINIT(Akos)
+_GSETPTR(defaultScaleTable, GBVARS_DEFAULTSCALETABLE_INDEX, byte, GBVARS_SCUMM)
+_GEND
+
+_GRELEASE(Akos)
+_GRELEASEPTR(GBVARS_DEFAULTSCALETABLE_INDEX, GBVARS_SCUMM)
+_GEND
+
#endif
diff --git a/scumm/bundle.cpp b/scumm/bundle.cpp
index 329929a4a9..f866ea0a98 100644
--- a/scumm/bundle.cpp
+++ b/scumm/bundle.cpp
@@ -23,6 +23,9 @@
#include "scumm/scumm.h"
#include "scumm/bundle.h"
+#ifdef __PALM_OS__
+static const int16 *imcTable;
+#else
static const int16 imcTable[] = {
0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x0010, 0x0011,
0x0013, 0x0015, 0x0017, 0x0019, 0x001C, 0x001F, 0x0022, 0x0025, 0x0029, 0x002D,
@@ -34,6 +37,7 @@ static const int16 imcTable[] = {
0x1706, 0x1954, 0x1BDC, 0x1EA5, 0x21B6, 0x2515, 0x28CA, 0x2CDF, 0x315B, 0x364B,
0x3BB9, 0x41B2, 0x4844, 0x4F7E, 0x5771, 0x602F, 0x69CE, 0x7462, 0x7FFF
};
+#endif
static const byte imxOtherTable[6][128] = {
{
@@ -91,6 +95,7 @@ const byte imxShortTable[] = {
0, 0, 1, 3, 7, 15, 31, 63
};
+
Bundle::Bundle() {
_compVoiceTable = NULL;
_compMusicTable = NULL;
@@ -938,3 +943,16 @@ int32 Bundle::decompressCodec(int32 codec, byte *comp_input, byte *comp_output,
return output_size;
}
+
+#ifdef __PALM_OS__
+#include "scumm_globals.h"
+
+_GINIT(Bundle)
+_GSETPTR(imcTable, GBVARS_IMCTABLE_INDEX, int16, GBVARS_SCUMM)
+_GEND
+
+_GRELEASE(Bundle)
+_GRELEASEPTR(GBVARS_IMCTABLE_INDEX, GBVARS_SCUMM)
+_GEND
+
+#endif
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index 040c166929..a51074d8cf 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -1301,19 +1301,22 @@ void CharsetRendererNut::printChar(int chr) {
}
#ifdef __PALM_OS__
-#include "scumm_globals.h" // init globals
-void Charset_initGlobals() {
- GSETPTR(germanCharsetDataV2, GBVARS_GERMANCHARSETDATAV2_INDEX, byte, GBVARS_SCUMM)
- GSETPTR(frenchCharsetDataV2, GBVARS_FRENCHCHARSETDATAV2_INDEX, byte, GBVARS_SCUMM)
- GSETPTR(englishCharsetDataV2, GBVARS_ENGLISHCHARSETDATAV2_INDEX, byte, GBVARS_SCUMM)
- GSETPTR(italianCharsetDataV2, GBVARS_ITALIANCHARSETDATAV2_INDEX, byte, GBVARS_SCUMM)
- GSETPTR(spanishCharsetDataV2, GBVARS_SPANISHCHARSETDATAV2_INDEX, byte, GBVARS_SCUMM)
-}
-void Charset_releaseGlobals() {
- GRELEASEPTR(GBVARS_GERMANCHARSETDATAV2_INDEX, GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_FRENCHCHARSETDATAV2_INDEX, GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_ENGLISHCHARSETDATAV2_INDEX, GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_ITALIANCHARSETDATAV2_INDEX, GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_SPANISHCHARSETDATAV2_INDEX, GBVARS_SCUMM)
-}
+#include "scumm_globals.h"
+
+_GINIT(Charset)
+_GSETPTR(germanCharsetDataV2, GBVARS_GERMANCHARSETDATAV2_INDEX, byte, GBVARS_SCUMM)
+_GSETPTR(frenchCharsetDataV2, GBVARS_FRENCHCHARSETDATAV2_INDEX, byte, GBVARS_SCUMM)
+_GSETPTR(englishCharsetDataV2, GBVARS_ENGLISHCHARSETDATAV2_INDEX, byte, GBVARS_SCUMM)
+_GSETPTR(italianCharsetDataV2, GBVARS_ITALIANCHARSETDATAV2_INDEX, byte, GBVARS_SCUMM)
+_GSETPTR(spanishCharsetDataV2, GBVARS_SPANISHCHARSETDATAV2_INDEX, byte, GBVARS_SCUMM)
+_GEND
+
+_GRELEASE(Charset)
+_GRELEASEPTR(GBVARS_GERMANCHARSETDATAV2_INDEX, GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_FRENCHCHARSETDATAV2_INDEX, GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_ENGLISHCHARSETDATAV2_INDEX, GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_ITALIANCHARSETDATAV2_INDEX, GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_SPANISHCHARSETDATAV2_INDEX, GBVARS_SCUMM)
+_GEND
+
#endif
diff --git a/scumm/costume.cpp b/scumm/costume.cpp
index f19be6dc08..cf10e252b8 100644
--- a/scumm/costume.cpp
+++ b/scumm/costume.cpp
@@ -28,6 +28,9 @@
const byte revBitMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
+#ifdef __PALM_OS__
+const byte *cost_scaleTable;
+#else
const byte cost_scaleTable[256] = {
0xFF, 0xFD, 0x7D, 0xBD, 0x3D, 0xDD, 0x5D, 0x9D,
0x1D, 0xED, 0x6D, 0xAD, 0x2D, 0xCD, 0x4D, 0x8D,
@@ -62,6 +65,7 @@ const byte cost_scaleTable[256] = {
0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE,
0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE
};
+#endif
byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
int i, skip;
@@ -844,3 +848,16 @@ bool Scumm::isCostumeInUse(int cost) const {
return false;
}
+
+#ifdef __PALM_OS__
+#include "scumm_globals.h"
+
+_GINIT(Costume)
+_GSETPTR(cost_scaleTable, GBVARS_COSTSCALETABLE_INDEX, byte, GBVARS_SCUMM)
+_GEND
+
+_GRELEASE(Costume)
+_GRELEASEPTR(GBVARS_COSTSCALETABLE_INDEX, GBVARS_SCUMM)
+_GEND
+
+#endif
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index ba2b72d258..ebc90249b8 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -789,15 +789,18 @@ void KeysDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
#endif
#ifdef __PALM_OS__
-#include "scumm_globals.h" // init globals
-void Dialogs_initGlobals() {
- GSETPTR(string_map_table_v7, GBVARS_STRINGMAPTABLEV7_INDEX, ResString, GBVARS_SCUMM)
- GSETPTR(string_map_table_v6, GBVARS_STRINGMAPTABLEV6_INDEX, ResString, GBVARS_SCUMM)
- GSETPTR(string_map_table_v5, GBVARS_STRINGMAPTABLEV5_INDEX, ResString, GBVARS_SCUMM)
-}
-void Dialogs_releaseGlobals() {
- GRELEASEPTR(GBVARS_STRINGMAPTABLEV7_INDEX, GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_STRINGMAPTABLEV6_INDEX, GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_STRINGMAPTABLEV5_INDEX, GBVARS_SCUMM)
-}
+#include "scumm_globals.h"
+
+_GINIT(Dialogs)
+_GSETPTR(string_map_table_v7, GBVARS_STRINGMAPTABLEV7_INDEX, ResString, GBVARS_SCUMM)
+_GSETPTR(string_map_table_v6, GBVARS_STRINGMAPTABLEV6_INDEX, ResString, GBVARS_SCUMM)
+_GSETPTR(string_map_table_v5, GBVARS_STRINGMAPTABLEV5_INDEX, ResString, GBVARS_SCUMM)
+_GEND
+
+_GRELEASE(Dialogs)
+_GRELEASEPTR(GBVARS_STRINGMAPTABLEV7_INDEX, GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_STRINGMAPTABLEV6_INDEX, GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_STRINGMAPTABLEV5_INDEX, GBVARS_SCUMM)
+_GEND
+
#endif
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index cb3afd8ded..2ed343bd54 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -3602,9 +3602,14 @@ void Scumm::makeCursorColorTransparent(int a) {
#ifdef __PALM_OS__
-#include "scumm_globals.h" // init globals
-void Gfx_initGlobals() {
- GSETPTR(transitionEffects, GBVARS_TRANSITIONEFFECTS_INDEX, TransitionEffect, GBVARS_SCUMM)
-}
-void Gfx_releaseGlobals() { GRELEASEPTR(GBVARS_TRANSITIONEFFECTS_INDEX, GBVARS_SCUMM)}
+#include "scumm_globals.h"
+
+_GINIT(Gfx)
+_GSETPTR(transitionEffects, GBVARS_TRANSITIONEFFECTS_INDEX, TransitionEffect, GBVARS_SCUMM)
+_GEND
+
+_GRELEASE(Gfx)
+_GRELEASEPTR(GBVARS_TRANSITIONEFFECTS_INDEX, GBVARS_SCUMM)
+_GEND
+
#endif
diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp
index 114a2cf0e9..90f9f82334 100644
--- a/scumm/imuse_digi.cpp
+++ b/scumm/imuse_digi.cpp
@@ -1242,23 +1242,26 @@ int IMuseDigital::getSoundStatus(int sound) {
#ifdef __PALM_OS__
-#include "scumm_globals.h" // init globals
-void IMuseDigital_initGlobals() {
- GSETPTR(_digStateMusicMap, GBVARS_DIGSTATEMUSICMAP_INDEX, imuse_music_map , GBVARS_SCUMM)
- GSETPTR(_digStateMusicTable, GBVARS_DIGSTATEMUSICTABLE_INDEX, imuse_music_table , GBVARS_SCUMM)
- GSETPTR(_comiStateMusicTable, GBVARS_COMISTATEMUSICTABLE_INDEX, imuse_music_table , GBVARS_SCUMM)
- GSETPTR(_comiSeqMusicTable, GBVARS_COMISEQMUSICTABLE_INDEX, imuse_music_table , GBVARS_SCUMM)
- GSETPTR(_digSeqMusicTable, GBVARS_DIGSEQMUSICTABLE_INDEX, imuse_music_table , GBVARS_SCUMM)
- GSETPTR(_ftStateMusicTable, GBVARS_FTSTATEMUSICTABLE_INDEX, imuse_ft_music_table, GBVARS_SCUMM)
- GSETPTR(_ftSeqMusicTable, GBVARS_FTSEQMUSICTABLE_INDEX, imuse_ft_music_table, GBVARS_SCUMM)
-}
-void IMuseDigital_releaseGlobals() {
- GRELEASEPTR(GBVARS_DIGSTATEMUSICMAP_INDEX , GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_DIGSTATEMUSICTABLE_INDEX , GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_COMISTATEMUSICTABLE_INDEX , GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_COMISEQMUSICTABLE_INDEX , GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_DIGSEQMUSICTABLE_INDEX , GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_FTSTATEMUSICTABLE_INDEX , GBVARS_SCUMM)
- GRELEASEPTR(GBVARS_FTSEQMUSICTABLE_INDEX , GBVARS_SCUMM)
-}
+#include "scumm_globals.h"
+
+_GINIT(IMuseDigital)
+_GSETPTR(_digStateMusicMap, GBVARS_DIGSTATEMUSICMAP_INDEX, imuse_music_map , GBVARS_SCUMM)
+_GSETPTR(_digStateMusicTable, GBVARS_DIGSTATEMUSICTABLE_INDEX, imuse_music_table , GBVARS_SCUMM)
+_GSETPTR(_comiStateMusicTable, GBVARS_COMISTATEMUSICTABLE_INDEX, imuse_music_table , GBVARS_SCUMM)
+_GSETPTR(_comiSeqMusicTable, GBVARS_COMISEQMUSICTABLE_INDEX, imuse_music_table , GBVARS_SCUMM)
+_GSETPTR(_digSeqMusicTable, GBVARS_DIGSEQMUSICTABLE_INDEX, imuse_music_table , GBVARS_SCUMM)
+_GSETPTR(_ftStateMusicTable, GBVARS_FTSTATEMUSICTABLE_INDEX, imuse_ft_music_table, GBVARS_SCUMM)
+_GSETPTR(_ftSeqMusicTable, GBVARS_FTSEQMUSICTABLE_INDEX, imuse_ft_music_table, GBVARS_SCUMM)
+_GEND
+
+_GRELEASE(IMuseDigital)
+_GRELEASEPTR(GBVARS_DIGSTATEMUSICMAP_INDEX , GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_DIGSTATEMUSICTABLE_INDEX , GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_COMISTATEMUSICTABLE_INDEX , GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_COMISEQMUSICTABLE_INDEX , GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_DIGSEQMUSICTABLE_INDEX , GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_FTSTATEMUSICTABLE_INDEX , GBVARS_SCUMM)
+_GRELEASEPTR(GBVARS_FTSEQMUSICTABLE_INDEX , GBVARS_SCUMM)
+_GEND
+
#endif
diff --git a/scumm/smush/codec47.cpp b/scumm/smush/codec47.cpp
index 4083528635..cacd1bd937 100644
--- a/scumm/smush/codec47.cpp
+++ b/scumm/smush/codec47.cpp
@@ -82,6 +82,9 @@ static int8 codec47_table_big2[] = {
0, 0, 0, 0, 1, 3, 4, 6, 7, 7, 7, 7, 6, 4, 3, 1,
};
+#ifdef __PALM_OS__
+static int8 *codec47_table;
+#else
static int8 codec47_table[] = {
0, 0, -1, -43, 6, -43, -9, -42, 13, -41,
-16, -40, 19, -39, -23, -36, 26, -34, -2, -33,
@@ -135,6 +138,7 @@ static int8 codec47_table[] = {
23, 36, -19, 39, 16, 40, -13, 41, 9, 42,
-6, 43, 1, 43, 0, 0, 0, 0, 0, 0
};
+#endif
void Codec47Decoder::makeTablesInterpolation(int param) {
int32 variable1, variable2;
@@ -612,3 +616,15 @@ bool Codec47Decoder::decode(byte *dst, const byte *src) {
return true;
}
+#ifdef __PALM_OS__
+#include "scumm_globals.h"
+
+_GINIT(Codec47)
+_GSETPTR(codec47_table, GBVARS_CODEC47TABLE_INDEX, int8, GBVARS_SCUMM)
+_GEND
+
+_GRELEASE(Codec47)
+_GRELEASEPTR(GBVARS_CODEC47TABLE_INDEX, GBVARS_SCUMM)
+_GEND
+
+#endif