[Scummvm-cvs-logs] SF.net SVN: scummvm: [29617] scummvm/trunk/engines/agi

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Nov 23 11:51:16 CET 2007


Revision: 29617
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29617&view=rev
Author:   fingolfin
Date:     2007-11-23 02:51:16 -0800 (Fri, 23 Nov 2007)

Log Message:
-----------
cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.cpp
    scummvm/trunk/engines/agi/agi.h
    scummvm/trunk/engines/agi/graphics.cpp
    scummvm/trunk/engines/agi/graphics.h
    scummvm/trunk/engines/agi/preagi.cpp
    scummvm/trunk/engines/agi/preagi.h
    scummvm/trunk/engines/agi/preagi_mickey.h
    scummvm/trunk/engines/agi/preagi_troll.h
    scummvm/trunk/engines/agi/preagi_winnie.h

Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp	2007-11-22 22:32:58 UTC (rev 29616)
+++ scummvm/trunk/engines/agi/agi.cpp	2007-11-23 10:51:16 UTC (rev 29617)
@@ -758,7 +758,7 @@
 	free(_predictiveDictText);
 }
 
-int AgiEngine::init() {
+int AgiBase::init() {
 
 	// Initialize backend
 	_system->beginGFXTransaction();

Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h	2007-11-22 22:32:58 UTC (rev 29616)
+++ scummvm/trunk/engines/agi/agi.h	2007-11-23 10:51:16 UTC (rev 29617)
@@ -644,7 +644,15 @@
 #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 @@
 	int _gameId;
 
 protected:
-	int init();
 	int go();
-	void shutdown();
 	void initialize();
 
 public:
@@ -736,7 +742,6 @@
 	char _lastSentence[40];
 
 	SpritesMgr *_sprites;
-	GfxMgr *_gfx;
 	SoundMgr *_sound;
 	PictureMgr *_picture;
 	AgiLoader *_loader;	/* loader */

Modified: scummvm/trunk/engines/agi/graphics.cpp
===================================================================
--- scummvm/trunk/engines/agi/graphics.cpp	2007-11-22 22:32:58 UTC (rev 29616)
+++ scummvm/trunk/engines/agi/graphics.cpp	2007-11-23 10:51:16 UTC (rev 29617)
@@ -48,7 +48,7 @@
  * 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 @@
  * 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 @@
  * 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 @@
  * 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 @@
  * 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 @@
  * 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 @@
 /**
  * 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 @@
  * 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 @@
 	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 @@
  * @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++) {

Modified: scummvm/trunk/engines/agi/graphics.h
===================================================================
--- scummvm/trunk/engines/agi/graphics.h	2007-11-22 22:32:58 UTC (rev 29616)
+++ scummvm/trunk/engines/agi/graphics.h	2007-11-23 10:51:16 UTC (rev 29617)
@@ -85,7 +85,7 @@
 	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);

Modified: scummvm/trunk/engines/agi/preagi.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi.cpp	2007-11-22 22:32:58 UTC (rev 29616)
+++ scummvm/trunk/engines/agi/preagi.cpp	2007-11-23 10:51:16 UTC (rev 29617)
@@ -103,10 +103,6 @@
 
 	_intobj = NULL;
 
-	_stackSize = 0;
-	_imageStack = NULL;
-	_imageStackPointer = 0;
-
 	_lastSentence[0] = 0;
 	memset(&_stringdata, 0, sizeof(struct StringData));
 
@@ -200,23 +196,15 @@
 	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 @@
 				Mickey *mickey = new Mickey(this);
 				mickey->init();
 				mickey->run();
+				delete mickey;
 			}
 			break;
 		case GID_WINNIE:
@@ -231,6 +220,7 @@
 				Winnie *winnie = new Winnie(this);
 				winnie->init();
 				winnie->run();
+				delete winnie;
 			}
 			break;
 		case GID_TROLL:
@@ -238,6 +228,7 @@
 				Troll *troll = new Troll(this);
 				troll->init();
 				troll->run();
+				delete troll;
 			}
 			break;
 		default:

Modified: scummvm/trunk/engines/agi/preagi.h
===================================================================
--- scummvm/trunk/engines/agi/preagi.h	2007-11-22 22:32:58 UTC (rev 29616)
+++ scummvm/trunk/engines/agi/preagi.h	2007-11-23 10:51:16 UTC (rev 29617)
@@ -37,9 +37,7 @@
 	int _gameId;
 
 protected:
-	int init();
 	int go();
-	void shutdown();
 	void initialize();
 
 public:
@@ -53,7 +51,6 @@
 		return _gameId;
 	}
 
-	GfxMgr *_gfx;
 	//SoundMgr *_sound;
 	PictureMgr *_picture;
 	PreAGI_Console *_console;

Modified: scummvm/trunk/engines/agi/preagi_mickey.h
===================================================================
--- scummvm/trunk/engines/agi/preagi_mickey.h	2007-11-22 22:32:58 UTC (rev 29616)
+++ scummvm/trunk/engines/agi/preagi_mickey.h	2007-11-23 10:51:16 UTC (rev 29617)
@@ -730,15 +730,16 @@
 };
 
 class Mickey {
-	friend class PreAgiEngine;
 public:
 	Mickey(PreAgiEngine *vm);
 	~Mickey();
 
 	void init();
 	void run();
+
 protected:
 	PreAgiEngine *_vm;
+
 	MSA_GAME _game;
 	bool _clickToMove;
 

Modified: scummvm/trunk/engines/agi/preagi_troll.h
===================================================================
--- scummvm/trunk/engines/agi/preagi_troll.h	2007-11-22 22:32:58 UTC (rev 29616)
+++ scummvm/trunk/engines/agi/preagi_troll.h	2007-11-23 10:51:16 UTC (rev 29617)
@@ -163,7 +163,6 @@
 };
 
 class Troll {
-	friend class PreAgiEngine;
 public:
 	Troll(PreAgiEngine *vm);
 
@@ -171,6 +170,8 @@
 	void run();
 
 private:
+	PreAgiEngine *_vm;
+
 	int _roomPicture;
 	int _treasuresLeft;
 	int _currentRoom;
@@ -184,8 +185,6 @@
 
 	byte *_gameData;
 
-	PreAgiEngine *_vm;
-
 	void intro();
 	void drawPic(int iPic, bool f3IsCont, bool clear, bool troll = false);
 	void drawTroll();

Modified: scummvm/trunk/engines/agi/preagi_winnie.h
===================================================================
--- scummvm/trunk/engines/agi/preagi_winnie.h	2007-11-22 22:32:58 UTC (rev 29616)
+++ scummvm/trunk/engines/agi/preagi_winnie.h	2007-11-23 10:51:16 UTC (rev 29617)
@@ -298,10 +298,8 @@
 class PreAgiEngine;
 
 class Winnie {
-	friend class PreAgiEngine;
 public:
 	Winnie(PreAgiEngine *vm);
-	//~Winnie();
 
 	void init();
 	void run();
@@ -310,6 +308,7 @@
 
 private:
 	PreAgiEngine *_vm;
+
 	WTP_SAVE_GAME _game;
 	int _room;
 	int	_mist;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list