aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorChris Apers2004-03-17 14:10:51 +0000
committerChris Apers2004-03-17 14:10:51 +0000
commit6e1200dc6788ee24e46f17d084254f6cd84bb95a (patch)
tree105ebc42e9766e757d30aad36097d13939ed013a /queen
parent1ca917d81bef47379066d229142f8f86c1aae1e7 (diff)
downloadscummvm-rg350-6e1200dc6788ee24e46f17d084254f6cd84bb95a.tar.gz
scummvm-rg350-6e1200dc6788ee24e46f17d084254f6cd84bb95a.tar.bz2
scummvm-rg350-6e1200dc6788ee24e46f17d084254f6cd84bb95a.zip
Added PalmOS support
svn-id: r13336
Diffstat (limited to 'queen')
-rw-r--r--queen/display.cpp47
-rw-r--r--queen/display.h2
-rw-r--r--queen/graphics.cpp27
-rw-r--r--queen/graphics.h8
-rw-r--r--queen/input.cpp3
-rw-r--r--queen/musicdata.cpp35
-rw-r--r--queen/resource.cpp30
-rw-r--r--queen/resource.h3
-rw-r--r--queen/restables.cpp4
-rw-r--r--queen/sound.cpp4
-rw-r--r--queen/sound.h9
-rw-r--r--queen/talk.cpp26
-rw-r--r--queen/talk.h14
13 files changed, 202 insertions, 10 deletions
diff --git a/queen/display.cpp b/queen/display.cpp
index b002573d8d..eb2dcc400f 100644
--- a/queen/display.cpp
+++ b/queen/display.cpp
@@ -29,11 +29,18 @@
namespace Queen {
+#ifdef __PALM_OS__
+static const uint8 *_fontRegular;
+static const uint8 *_fontHebrew;
+static const uint8 *_palJoeClothes;
+static const uint8 *_palJoeDress;
+#endif
+
Display::Display(QueenEngine *vm, OSystem *system)
: _fullscreen(true), _horizontalScroll(0), _bdWidth(0), _bdHeight(0),
_system(system), _vm(vm) {
_dynalum.prevColMask = 0xFF;
-
+
if (vm->resource()->getLanguage() == HEBREW)
_font = _fontHebrew;
else
@@ -41,12 +48,18 @@ Display::Display(QueenEngine *vm, OSystem *system)
initFont();
+#ifndef __PALM_OS__
_screenBuf = new uint8[SCREEN_W * SCREEN_H];
_panelBuf = new uint8[PANEL_W * PANEL_H];
_backdropBuf = new uint8[BACKDROP_W * BACKDROP_H];
memset(_screenBuf, 0, SCREEN_W * SCREEN_H);
memset(_panelBuf, 0, PANEL_W * PANEL_H);
memset(_backdropBuf, 0, BACKDROP_W * BACKDROP_H);
+#else
+ _screenBuf = (uint8 *)calloc(SCREEN_W * SCREEN_H, sizeof(uint8));
+ _panelBuf = (uint8 *)calloc(PANEL_W * PANEL_H, sizeof(uint8));
+ _backdropBuf = (uint8 *)calloc(BACKDROP_W * BACKDROP_H, sizeof(uint8));
+#endif
memset(_mousePtr, 0, sizeof(_mousePtr));
@@ -68,9 +81,15 @@ Display::Display(QueenEngine *vm, OSystem *system)
}
Display::~Display() {
+#ifndef __PALM_OS__
delete[] _backdropBuf;
delete[] _panelBuf;
delete[] _screenBuf;
+#else
+ free(_backdropBuf);
+ free(_panelBuf);
+ free(_screenBuf);
+#endif
delete[] _pal.room;
delete[] _pal.screen;
@@ -991,7 +1010,7 @@ void Display::blankScreenEffect2() {
p += SCREEN_W;
}
_system->copy_rect(buf, SCREEN_W, x, y, 2, 2);
- _system->updateScreen();
+ _system->updateScreen();
_vm->input()->delay(10);
}
}
@@ -1020,11 +1039,12 @@ void Display::blankScreenEffect3() {
++i;
_system->copy_rect(buf, SCREEN_W, x, y, 2, 2);
}
- _system->updateScreen();
+ _system->updateScreen();
_vm->input()->delay(10);
}
}
+#ifndef __PALM_OS__
const uint8 Display::_fontRegular[] = {
0xF8, 0xB0, 0xB0, 0x80, 0xB0, 0xB0, 0xC0, 0x00, 0xF8, 0xB0,
0xB0, 0x80, 0xB0, 0xB0, 0xC0, 0x00, 0xF8, 0xB0, 0xB0, 0x80,
@@ -1458,6 +1478,25 @@ const uint8 Display::_palJoeDress[] = {
0x80, 0x45, 0x45, 0xA3, 0x5F, 0x5F, 0xC8, 0x7C, 0x7C,
0xEC, 0x9C, 0x9C
};
-
+#endif
} // End of namespace Queen
+
+#ifdef __PALM_OS__
+#include "scumm_globals.h"
+
+_GINIT(Queen_Display)
+_GSETPTR(Queen::_fontRegular, GBVARS_DISPLAYFONTREGULAR_INDEX, uint8, GBVARS_QUEEN)
+_GSETPTR(Queen::_fontHebrew, GBVARS_DISPLAYFONTHEBREW_INDEX, uint8, GBVARS_QUEEN)
+_GSETPTR(Queen::_palJoeClothes, GBVARS_DISPLAYPALJOECLOTHES_INDEX, uint8, GBVARS_QUEEN)
+_GSETPTR(Queen::_palJoeDress, GBVARS_DISPLAYPALJOEDRESS_INDEX, uint8, GBVARS_QUEEN)
+_GEND
+
+_GRELEASE(Queen_Display)
+_GRELEASEPTR(GBVARS_DISPLAYFONTREGULAR_INDEX, GBVARS_QUEEN)
+_GRELEASEPTR(GBVARS_DISPLAYFONTHEBREW_INDEX, GBVARS_QUEEN)
+_GRELEASEPTR(GBVARS_DISPLAYPALJOECLOTHES_INDEX, GBVARS_QUEEN)
+_GRELEASEPTR(GBVARS_DISPLAYPALJOEDRESS_INDEX, GBVARS_QUEEN)
+_GEND
+
+#endif
diff --git a/queen/display.h b/queen/display.h
index feee51d032..ff15a877a4 100644
--- a/queen/display.h
+++ b/queen/display.h
@@ -175,10 +175,12 @@ private:
QueenEngine *_vm;
const uint8 *_font;
+#ifndef __PALM_OS__
static const uint8 _fontRegular[];
static const uint8 _fontHebrew[];
static const uint8 _palJoeClothes[];
static const uint8 _palJoeDress[];
+#endif
};
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index d16889dc63..1c4681e8d2 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -32,6 +32,13 @@
namespace Queen {
+#ifdef __PALM_OS__
+static const BamScene::BamDataBlock *_carData;
+static const BamScene::BamDataBlock *_fight1Data;
+static const BamScene::BamDataBlock *_fight2Data;
+static const BamScene::BamDataBlock *_fight3Data;
+#endif
+
const Box BobSlot::_defaultBox(-1, -1, -1, -1);
void BobSlot::curPos(int16 xx, int16 yy) {
@@ -1229,6 +1236,7 @@ void BamScene::loadState(uint32 ver, byte *&ptr) {
_flag = READ_BE_UINT16(ptr); ptr += 2;
}
+#ifndef __PALM_OS__
const BamScene::BamDataBlock BamScene::_carData[] = {
{ { 310, 105, 1 }, { 314, 106, 17 }, { 366, 101, 1 }, 0 },
{ { 303, 105, 1 }, { 307, 106, 17 }, { 214, 0, 10 }, 0 },
@@ -1495,6 +1503,25 @@ const BamScene::BamDataBlock BamScene::_fight3Data[] = {
{ { 75, 96, 1 }, { 187, 96, -23 }, { 183, 41, 47 }, 0 },
{ { 75, 96, 1 }, { 187, 96, -23 }, { 183, 41, 47 }, 99 }
};
+#endif
} // End of namespace Queen
+#ifdef __PALM_OS__
+#include "scumm_globals.h"
+
+_GINIT(Queen_Graphics)
+_GSETPTR(Queen::_carData, GBVARS_GRAPHICSCARDATA_INDEX, Queen::BamScene::BamDataBlock, GBVARS_QUEEN)
+_GSETPTR(Queen::_fight1Data, GBVARS_GRAPHICSFIGHT1DATA_INDEX, Queen::BamScene::BamDataBlock, GBVARS_QUEEN)
+_GSETPTR(Queen::_fight2Data, GBVARS_GRAPHICSFIGHT2DATA_INDEX, Queen::BamScene::BamDataBlock, GBVARS_QUEEN)
+_GSETPTR(Queen::_fight3Data, GBVARS_GRAPHICSFIGHT3DATA_INDEX, Queen::BamScene::BamDataBlock, GBVARS_QUEEN)
+_GEND
+
+_GRELEASE(Queen_Graphics)
+_GRELEASEPTR(GBVARS_GRAPHICSCARDATA_INDEX, GBVARS_QUEEN)
+_GRELEASEPTR(GBVARS_GRAPHICSFIGHT1DATA_INDEX, GBVARS_QUEEN)
+_GRELEASEPTR(GBVARS_GRAPHICSFIGHT2DATA_INDEX, GBVARS_QUEEN)
+_GRELEASEPTR(GBVARS_GRAPHICSFIGHT3DATA_INDEX, GBVARS_QUEEN)
+_GEND
+
+#endif
diff --git a/queen/graphics.h b/queen/graphics.h
index 0d755a81dd..68360bd381 100644
--- a/queen/graphics.h
+++ b/queen/graphics.h
@@ -227,12 +227,18 @@ private:
int16 frame;
};
+#ifdef __PALM_OS__
+public:
+#endif
struct BamDataBlock {
BamDataObj obj1; // truck / Frank
BamDataObj obj2; // Rico / robot
BamDataObj fx;
int16 sfx;
};
+#ifdef __PALM_OS__
+private:
+#endif
BobSlot *_obj1;
BobSlot *_obj2;
@@ -243,10 +249,12 @@ private:
QueenEngine *_vm;
+#ifndef __PALM_OS__
static const BamDataBlock _carData[];
static const BamDataBlock _fight1Data[];
static const BamDataBlock _fight2Data[];
static const BamDataBlock _fight3Data[];
+#endif
};
} // End of namespace Queen
diff --git a/queen/input.cpp b/queen/input.cpp
index 380ab0c4b4..7e43c1bff2 100644
--- a/queen/input.cpp
+++ b/queen/input.cpp
@@ -106,7 +106,7 @@ void Input::delay(uint amount) {
case OSystem::EVENT_LBUTTONDOWN:
_mouseButton |= MOUSE_LBUTTON;
-#ifdef _WIN32_WCE
+#if defined(_WIN32_WCE) || defined(__PALM_OS__)
_mouse_x = event.mouse.x;
_mouse_y = event.mouse.y;
#endif
@@ -234,4 +234,3 @@ int Input::checkKeys() {
} // End of namespace Queen
-
diff --git a/queen/musicdata.cpp b/queen/musicdata.cpp
index 287c1f1f0f..b5d40aeaff 100644
--- a/queen/musicdata.cpp
+++ b/queen/musicdata.cpp
@@ -24,6 +24,16 @@
namespace Queen {
+#ifdef __PALM_OS__
+
+const songData *Sound::_songDemo;
+const songData *Sound::_song;
+const tuneData *Sound::_tuneDemo;
+const tuneData *Sound::_tune;
+const char *Sound::_sfxName;
+const int16 *Sound::_jungleList;
+
+#else
const songData Sound::_songDemo[] = {
/* 1 - Hotel Gangsters */
{ { 1, 0 }, 128, 128, 128, 1, 0 },
@@ -1477,6 +1487,7 @@ const tuneData Sound::_tune[] = {
/* 207 - Frank Destroyed */
{ { 25, 1044, 0 }, { 0, 0 }, 1, 0 },
+
/* 208 - Jaspar Eats */
{ { 0, 0 }, { 134, 0 }, 2, 0 },
@@ -1904,5 +1915,29 @@ const char *Sound::_sfxName[] = {
};
const int16 Sound::_jungleList[] = { 15, 16, 17, 18, 7, 8, 9, 10, 11, 12, 13, 14, 0 };
+#endif
} // End of namespace Queen
+
+#ifdef __PALM_OS__
+#include "scumm_globals.h"
+
+_GINIT(Queen_Musicdata)
+_GSETPTR(Queen::Sound::_songDemo, GBVARS_MUSICDATASONGDEMO_INDEX, Queen::songData, GBVARS_QUEEN)
+_GSETPTR(Queen::Sound::_song, GBVARS_MUSICDATASONG_INDEX, Queen::songData, GBVARS_QUEEN)
+_GSETPTR(Queen::Sound::_tuneDemo, GBVARS_MUSICDATATUNEDEMO_INDEX, Queen::tuneData, GBVARS_QUEEN)
+_GSETPTR(Queen::Sound::_tune, GBVARS_MUSICDATATUNE_INDEX, Queen::tuneData, GBVARS_QUEEN)
+_GSETPTR(Queen::Sound::_sfxName, GBVARS_MUSICDATASFXNAME_INDEX, char, GBVARS_QUEEN)
+_GSETPTR(Queen::Sound::_jungleList, GBVARS_MUSICDATAJUNGLELIST_INDEX, int16, GBVARS_QUEEN)
+_GEND
+
+_GRELEASE(Queen_Musicdata)
+_GRELEASEPTR(GBVARS_MUSICDATASONGDEMO_INDEX, GBVARS_QUEEN)
+_GRELEASEPTR(GBVARS_MUSICDATASONG_INDEX, GBVARS_QUEEN)
+_GRELEASEPTR(GBVARS_MUSICDATATUNEDEMO_INDEX, GBVARS_QUEEN)
+_GRELEASEPTR(GBVARS_MUSICDATATUNE_INDEX, GBVARS_QUEEN)
+_GRELEASEPTR(GBVARS_MUSICDATASFXNAME_INDEX, GBVARS_QUEEN)
+_GRELEASEPTR(GBVARS_MUSICDATAJUNGLELIST_INDEX, GBVARS_QUEEN)
+_GEND
+
+#endif
diff --git a/queen/resource.cpp b/queen/resource.cpp
index 5c703c3dac..4b55824ec9 100644
--- a/queen/resource.cpp
+++ b/queen/resource.cpp
@@ -24,6 +24,9 @@
namespace Queen {
+#ifdef __PALM_OS__
+static ResourceEntry *_resourceTablePEM10;
+#endif
const char *Resource::_tableFilename = "queen.tbl";
@@ -56,6 +59,7 @@ Resource::Resource(const Common::String &datafilePath)
Resource::~Resource() {
_resourceFile->close();
delete _resourceFile;
+
if(_resourceTable != _resourceTablePEM10)
delete[] _resourceTable;
}
@@ -81,6 +85,7 @@ int32 Resource::resourceIndex(const char *filename) const {
//Use simple binary search to locate file
+#ifndef __PALM_OS__
for (;;) {
uint32 cur = (low + high) / 2;
int32 diff = strcmp(entryName, _resourceTable[cur].filename);
@@ -96,6 +101,14 @@ int32 Resource::resourceIndex(const char *filename) const {
else
high = cur;
}
+#else
+ // Does work for me (????) use this instead
+ uint32 cur = 0;
+ do {
+ if (!strcmp(entryName, _resourceTable[cur].filename))
+ return cur;
+ } while (cur++ <= high);
+#endif
debug(7, "Couldn't find file '%s'", entryName);
return -1;
@@ -113,8 +126,13 @@ uint8 *Resource::loadFile(const char *filename, uint32 skipBytes, byte *dstBuf)
ResourceEntry *re = resourceEntry(filename);
assert(re != NULL);
uint32 size = re->size - skipBytes;
+#ifndef __PALM_OS__
if (dstBuf == NULL)
dstBuf = new byte[size];
+#else
+ if (dstBuf == NULL)
+ dstBuf = (byte *)calloc(size, sizeof(byte));
+#endif
_resourceFile->seek(re->offset + skipBytes);
_resourceFile->read(dstBuf, size);
return dstBuf;
@@ -272,3 +290,15 @@ char *LineReader::nextLine() {
} // End of namespace Queen
+#ifdef __PALM_OS__
+#include "scumm_globals.h"
+
+_GINIT(Queen_Restables)
+_GSETPTR(Queen::_resourceTablePEM10, GBVARS_RESOURCETABLEPM10_INDEX, Queen::ResourceEntry, GBVARS_QUEEN)
+_GEND
+
+_GRELEASE(Queen_Restables)
+_GRELEASEPTR(GBVARS_RESOURCETABLEPM10_INDEX, GBVARS_QUEEN)
+_GEND
+
+#endif
diff --git a/queen/resource.h b/queen/resource.h
index c9b6036359..bc65aa0a6b 100644
--- a/queen/resource.h
+++ b/queen/resource.h
@@ -124,10 +124,11 @@ protected:
static const char *_tableFilename;
static const GameVersion _gameVersions[];
+#ifndef __PALM_OS__
static ResourceEntry _resourceTablePEM10[];
+#endif
};
} // End of namespace Queen
#endif
-
diff --git a/queen/restables.cpp b/queen/restables.cpp
index 47acd90aae..e29c169f42 100644
--- a/queen/restables.cpp
+++ b/queen/restables.cpp
@@ -23,7 +23,7 @@
namespace Queen {
-
+#ifndef __PALM_OS__
//English Floppy Version
ResourceEntry Resource::_resourceTablePEM10[] = {
{ "1000SSSS.SB", 1, 0x00000000, 0x000027fe },
@@ -1103,5 +1103,5 @@ ResourceEntry Resource::_resourceTablePEM10[] = {
{ "ZOMBIE1.DOG", 1, 0x0159ecef, 0x00000f6a },
{ "ZOMBIE2.DOG", 1, 0x0159fc59, 0x00000c40 }
};
-
+#endif
} // End of namespace Queen
diff --git a/queen/sound.cpp b/queen/sound.cpp
index 8d560a9af8..26c75af9a1 100644
--- a/queen/sound.cpp
+++ b/queen/sound.cpp
@@ -90,7 +90,11 @@ void Sound::playSfx(uint16 sfx, bool isSpeech) {
if (sfx != 0) {
char name[13];
+#ifndef __PALM_OS__
strcpy(name, _sfxName[sfx - 1]);
+#else
+ strncpy(name, _sfxName + 10 * (sfx - 1), 10); // saved as 8char + /0/0
+#endif
strcat(name, ".SB");
waitFinished(isSpeech);
sfxPlay(name, isSpeech);
diff --git a/queen/sound.h b/queen/sound.h
index 9b8e9f7f40..33c9398fb2 100644
--- a/queen/sound.h
+++ b/queen/sound.h
@@ -78,12 +78,21 @@ public:
void saveState(byte *&ptr);
void loadState(uint32 ver, byte *&ptr);
+#ifndef __PALM_OS__
static const songData _songDemo[];
static const songData _song[];
static const tuneData _tuneDemo[];
static const tuneData _tune[];
static const char *_sfxName[];
static const int16 _jungleList[];
+#else
+ static const songData *_songDemo;
+ static const songData *_song;
+ static const tuneData *_tuneDemo;
+ static const tuneData *_tune;
+ static const char *_sfxName;
+ static const int16 *_jungleList;
+#endif
protected:
void waitFinished(bool isSpeech);
diff --git a/queen/talk.cpp b/queen/talk.cpp
index b4f3e2c822..26c114648e 100644
--- a/queen/talk.cpp
+++ b/queen/talk.cpp
@@ -38,6 +38,10 @@
namespace Queen {
+#ifdef __PALM_OS__
+static const Talk::SpeechParameters *_speechParameters;
+#endif
+
void Talk::talk(
const char *filename,
int personInRoom,
@@ -892,7 +896,13 @@ void Talk::speakSegment(
segment[length] = '\0';
char voiceFileName[MAX_STRING_SIZE];
+#ifndef __PALM_OS__
snprintf(voiceFileName, sizeof(voiceFileName), "%s%1x", voiceFilePrefix, index + 1);
+#else
+ // %(X)x is not supported on PalmOS
+ sprintf(voiceFileName, "%s%1x", voiceFilePrefix, index + 1);
+ strncpy(voiceFileName + strlen(voiceFileName) - 8, voiceFileName + strlen(voiceFileName) - 1, 2);
+#endif
// debug(6, "Sentence segment '%*s' is said by person '%s' and voice file '%s' is played",
// length, segment, person->name, voiceFileName);
@@ -1415,6 +1425,7 @@ int16 Talk::selectSentence() {
return selectedSentence;
}
+#ifndef __PALM_OS__
const Talk::SpeechParameters Talk::_speechParameters[] = {
{ "JOE",0,1,1,10,2,3,"",0},
{ "JOE",0,3,3,28,2,3,"",0},
@@ -1875,6 +1886,19 @@ const Talk::SpeechParameters Talk::_speechParameters[] = {
{ "*",0,0,0,0,0,0,"",0}
};
-
+#endif
} // End of namespace Queen
+
+#ifdef __PALM_OS__
+#include "scumm_globals.h"
+
+_GINIT(Queen_Talk)
+_GSETPTR(Queen::_speechParameters, GBVARS_SPEECHPARAMETERS_INDEX, Queen::Talk::SpeechParameters, GBVARS_QUEEN)
+_GEND
+
+_GRELEASE(Queen_Talk)
+_GRELEASEPTR(GBVARS_SPEECHPARAMETERS_INDEX, GBVARS_QUEEN)
+_GEND
+
+#endif
diff --git a/queen/talk.h b/queen/talk.h
index e996140eea..03b92c9598 100644
--- a/queen/talk.h
+++ b/queen/talk.h
@@ -84,6 +84,7 @@ private:
int16 gameStateValue;
};
+#ifndef __PALM_OS__
struct SpeechParameters {
const char *name;
signed char state,faceDirection;
@@ -91,6 +92,17 @@ private:
const char *animation;
signed char ff;
};
+#else
+public:
+ struct SpeechParameters {
+ const char name[11];
+ signed char state,faceDirection;
+ signed char body,bf,rf,af;
+ const char animation[80];
+ signed char ff;
+ };
+private:
+#endif
QueenEngine *_vm;
@@ -145,7 +157,9 @@ private:
char _talkString[5][MAX_STRING_SIZE];
char _joeVoiceFilePrefix[5][MAX_STRING_SIZE];
+#ifndef __PALM_OS__
static const SpeechParameters _speechParameters[];
+#endif
Talk(QueenEngine *vm);
~Talk();