aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorMax Horn2007-11-23 10:51:16 +0000
committerMax Horn2007-11-23 10:51:16 +0000
commit402a3dbbe34e326ffffcef607be206a1a8818a7b (patch)
tree6222a20814cc567ce96d2ebaaa90a711a6c85830 /engines/agi
parent2f6343c9cd6214691a7bb1b2d182c5b7115941be (diff)
downloadscummvm-rg350-402a3dbbe34e326ffffcef607be206a1a8818a7b.tar.gz
scummvm-rg350-402a3dbbe34e326ffffcef607be206a1a8818a7b.tar.bz2
scummvm-rg350-402a3dbbe34e326ffffcef607be206a1a8818a7b.zip
cleanup
svn-id: r29617
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/agi.cpp2
-rw-r--r--engines/agi/agi.h11
-rw-r--r--engines/agi/graphics.cpp20
-rw-r--r--engines/agi/graphics.h2
-rw-r--r--engines/agi/preagi.cpp25
-rw-r--r--engines/agi/preagi.h3
-rw-r--r--engines/agi/preagi_mickey.h3
-rw-r--r--engines/agi/preagi_troll.h5
-rw-r--r--engines/agi/preagi_winnie.h3
9 files changed, 33 insertions, 41 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index dd03a9d589..b5b396f0e9 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -758,7 +758,7 @@ AgiEngine::~AgiEngine() {
free(_predictiveDictText);
}
-int AgiEngine::init() {
+int AgiBase::init() {
// Initialize backend
_system->beginGFXTransaction();
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index b74c606692..86e6901c71 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -644,7 +644,15 @@ struct StringData {
#define KEY_QUEUE_SIZE 16
class AgiBase : public ::Engine {
+protected:
+ // Engine API
+ int init();
+
+ virtual void initialize() = 0;
+
public:
+ GfxMgr *_gfx;
+
AgiButtonStyle _defaultButtonStyle;
AgiButtonStyle _buttonStyle;
Common::RenderMode _renderMode;
@@ -685,9 +693,7 @@ class AgiEngine : public AgiBase {
int _gameId;
protected:
- int init();
int go();
- void shutdown();
void initialize();
public:
@@ -736,7 +742,6 @@ public:
char _lastSentence[40];
SpritesMgr *_sprites;
- GfxMgr *_gfx;
SoundMgr *_sound;
PictureMgr *_picture;
AgiLoader *_loader; /* loader */
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index ce988ac2ba..63565bac20 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -48,7 +48,7 @@ namespace Agi {
* This array contains the 6-bit RGB values of the EGA palette exported
* to the console drivers.
*/
-uint8 egaPalette[16 * 3] = {
+static const uint8 egaPalette[16 * 3] = {
0x00, 0x00, 0x00,
0x00, 0x00, 0x2a,
0x00, 0x2a, 0x00,
@@ -73,7 +73,7 @@ uint8 egaPalette[16 * 3] = {
* from Donald Duck's Playground (1986) to Manhunter II (1989).
* 16 RGB colors. 3 bits per color component.
*/
-uint8 atariStAgiPalette[16 * 3] = {
+static const uint8 atariStAgiPalette[16 * 3] = {
0x0, 0x0, 0x0,
0x0, 0x0, 0x7,
0x0, 0x4, 0x0,
@@ -110,7 +110,7 @@ uint8 atariStAgiPalette[16 * 3] = {
* 3.001 (Black Cauldron v1.0O 1989-02-24 (CE))
* 3.003 (Gold Rush! v1.0M 1989-02-28 (CE))
*/
-uint8 appleIIgsAgiPaletteV2[16 * 3] = {
+static const uint8 appleIIgsAgiPaletteV2[16 * 3] = {
0x0, 0x0, 0x0,
0x0, 0x0, 0xF,
0x0, 0x8, 0x0,
@@ -144,7 +144,7 @@ uint8 appleIIgsAgiPaletteV2[16 * 3] = {
* Also used by at least the following Apple IIGS AGI versions:
* 1.002 (Space Quest I, intro says v2.2 1987)
*/
-uint8 amigaAgiPaletteV1[16 * 3] = {
+static const uint8 amigaAgiPaletteV1[16 * 3] = {
0x0, 0x0, 0x0,
0x0, 0x0, 0xF,
0x0, 0x8, 0x0,
@@ -170,7 +170,7 @@ uint8 amigaAgiPaletteV1[16 * 3] = {
* Used by at least the following Amiga AGI versions:
* 2.202 (Space Quest II v2.0F. Intro says 1988. ScummVM 0.10.0 detects as 1986-12-09)
*/
-uint8 amigaAgiPaletteV2[16 * 3] = {
+static const uint8 amigaAgiPaletteV2[16 * 3] = {
0x0, 0x0, 0x0,
0x0, 0x0, 0xF,
0x0, 0x8, 0x0,
@@ -200,7 +200,7 @@ uint8 amigaAgiPaletteV2[16 * 3] = {
* 2.333 (Manhunter II v3.06 1989-08-17)
* 2.333 (King's Quest III v2.15 1989-11-15)
*/
-uint8 amigaAgiPaletteV3[16 * 3] = {
+static const uint8 amigaAgiPaletteV3[16 * 3] = {
0x0, 0x0, 0x0,
0x0, 0x0, 0xB,
0x0, 0xB, 0x0,
@@ -222,7 +222,7 @@ uint8 amigaAgiPaletteV3[16 * 3] = {
/**
* 16 color amiga-ish palette.
*/
-uint8 newPalette[16 * 3] = {
+static const uint8 newPalette[16 * 3] = {
0x00, 0x00, 0x00,
0x00, 0x00, 0x3f,
0x00, 0x2A, 0x00,
@@ -245,7 +245,7 @@ uint8 newPalette[16 * 3] = {
* 256 color palette used with AGI256 and AGI256-2 games.
* Uses full 8 bits per color component.
*/
-uint8 vgaPalette[256 * 3] = {
+static const uint8 vgaPalette[256 * 3] = {
0x00, 0x00, 0x00,
0x00, 0x00, 0xA8,
0x00, 0xA8, 0x00,
@@ -504,7 +504,7 @@ uint8 vgaPalette[256 * 3] = {
0x0C, 0x0C, 0x0C
};
-static uint16 cgaMap[16] = {
+static const uint16 cgaMap[16] = {
0x0000, /* 0 - black */
0x0d00, /* 1 - blue */
0x0b00, /* 2 - green */
@@ -816,7 +816,7 @@ int GfxMgr::keypress() {
* @param fromBits Bits per source color component.
* @param toBits Bits per destination color component.
*/
-void GfxMgr::initPalette(uint8 *p, uint colorCount, uint fromBits, uint toBits) {
+void GfxMgr::initPalette(const uint8 *p, uint colorCount, uint fromBits, uint toBits) {
const uint srcMax = (1 << fromBits) - 1;
const uint destMax = (1 << toBits) - 1;
for (uint col = 0; col < colorCount; col++) {
diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h
index da6acf6774..2965dd0da3 100644
--- a/engines/agi/graphics.h
+++ b/engines/agi/graphics.h
@@ -85,7 +85,7 @@ public:
void drawRectangle(int, int, int, int, int);
void saveBlock(int, int, int, int, uint8 *);
void restoreBlock(int, int, int, int, uint8 *);
- void initPalette(uint8 *p, uint colorCount = 16, uint fromBits = 6, uint toBits = 8);
+ void initPalette(const uint8 *p, uint colorCount = 16, uint fromBits = 6, uint toBits = 8);
void setAGIPal(int);
int getAGIPalFileNum();
void drawFrame(int x1, int y1, int x2, int y2, int c1, int c2);
diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp
index 8679de6003..b356223936 100644
--- a/engines/agi/preagi.cpp
+++ b/engines/agi/preagi.cpp
@@ -103,10 +103,6 @@ PreAgiEngine::PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) :
_intobj = NULL;
- _stackSize = 0;
- _imageStack = NULL;
- _imageStackPointer = 0;
-
_lastSentence[0] = 0;
memset(&_stringdata, 0, sizeof(struct StringData));
@@ -200,23 +196,15 @@ PreAgiEngine::~PreAgiEngine() {
delete _speakerStream;
}
-int PreAgiEngine::init() {
- // Initialize backend
- _system->beginGFXTransaction();
- initCommonGFX(false);
- _system->initSize(320, 200);
- _system->endGFXTransaction();
-
- initialize();
-
- _gfx->gfxSetPalette();
-
- return 0;
-}
int PreAgiEngine::go() {
setflag(fSoundOn, true); // enable sound
+/*
+FIXME (Fingolfin asks): Why are Mickey, Winnie and Troll standalone classes
+ instead of being subclasses of PreAgiEngine ?
+*/
+
// run preagi engine main loop
switch (getGameID()) {
case GID_MICKEY:
@@ -224,6 +212,7 @@ int PreAgiEngine::go() {
Mickey *mickey = new Mickey(this);
mickey->init();
mickey->run();
+ delete mickey;
}
break;
case GID_WINNIE:
@@ -231,6 +220,7 @@ int PreAgiEngine::go() {
Winnie *winnie = new Winnie(this);
winnie->init();
winnie->run();
+ delete winnie;
}
break;
case GID_TROLL:
@@ -238,6 +228,7 @@ int PreAgiEngine::go() {
Troll *troll = new Troll(this);
troll->init();
troll->run();
+ delete troll;
}
break;
default:
diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h
index 063ad329d8..500f98546b 100644
--- a/engines/agi/preagi.h
+++ b/engines/agi/preagi.h
@@ -37,9 +37,7 @@ class PreAgiEngine : public AgiBase {
int _gameId;
protected:
- int init();
int go();
- void shutdown();
void initialize();
public:
@@ -53,7 +51,6 @@ public:
return _gameId;
}
- GfxMgr *_gfx;
//SoundMgr *_sound;
PictureMgr *_picture;
PreAGI_Console *_console;
diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h
index 85dcc92c16..c44ac75b0c 100644
--- a/engines/agi/preagi_mickey.h
+++ b/engines/agi/preagi_mickey.h
@@ -730,15 +730,16 @@ struct MSA_GAME {
};
class Mickey {
- friend class PreAgiEngine;
public:
Mickey(PreAgiEngine *vm);
~Mickey();
void init();
void run();
+
protected:
PreAgiEngine *_vm;
+
MSA_GAME _game;
bool _clickToMove;
diff --git a/engines/agi/preagi_troll.h b/engines/agi/preagi_troll.h
index aae72a6c89..8519925e0a 100644
--- a/engines/agi/preagi_troll.h
+++ b/engines/agi/preagi_troll.h
@@ -163,7 +163,6 @@ struct Item {
};
class Troll {
- friend class PreAgiEngine;
public:
Troll(PreAgiEngine *vm);
@@ -171,6 +170,8 @@ public:
void run();
private:
+ PreAgiEngine *_vm;
+
int _roomPicture;
int _treasuresLeft;
int _currentRoom;
@@ -184,8 +185,6 @@ private:
byte *_gameData;
- PreAgiEngine *_vm;
-
void intro();
void drawPic(int iPic, bool f3IsCont, bool clear, bool troll = false);
void drawTroll();
diff --git a/engines/agi/preagi_winnie.h b/engines/agi/preagi_winnie.h
index 68e476d3d5..9783992d48 100644
--- a/engines/agi/preagi_winnie.h
+++ b/engines/agi/preagi_winnie.h
@@ -298,10 +298,8 @@ struct WTP_SAVE_GAME {
class PreAgiEngine;
class Winnie {
- friend class PreAgiEngine;
public:
Winnie(PreAgiEngine *vm);
- //~Winnie();
void init();
void run();
@@ -310,6 +308,7 @@ public:
private:
PreAgiEngine *_vm;
+
WTP_SAVE_GAME _game;
int _room;
int _mist;