From 4cda7abda198296f890326483cc694e35e76d263 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sun, 31 Aug 2008 10:24:32 +0000 Subject: More cleanup. svn-id: r34223 --- engines/parallaction/gui_ns.cpp | 17 +- engines/parallaction/parallaction.cpp | 2 - engines/parallaction/parallaction.h | 385 ++++++++++++------------------- engines/parallaction/parallaction_ns.cpp | 55 ++++- 4 files changed, 200 insertions(+), 259 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp index 5d7425fb1f..d172c30103 100644 --- a/engines/parallaction/gui_ns.cpp +++ b/engines/parallaction/gui_ns.cpp @@ -764,17 +764,18 @@ public: _allPartsComplete = (completed[0] && completed[1] && completed[2]); _vm->_input->setMouseState(MOUSE_DISABLED); + uint16 language = _vm->getInternLanguage(); uint id[4]; if (_allPartsComplete) { - id[0] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg4[_language], 1); - id[1] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg5[_language], 1); - id[2] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg6[_language], 1); - id[3] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg7[_language], 1); + id[0] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg4[language], 1); + id[1] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg5[language], 1); + id[2] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg6[language], 1); + id[3] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg7[language], 1); } else { - id[0] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg0[_language], 1); - id[1] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg1[_language], 1); - id[2] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg2[_language], 1); - id[3] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg3[_language], 1); + id[0] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg0[language], 1); + id[1] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg1[language], 1); + id[2] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg2[language], 1); + id[3] = _vm->_gfx->createLabel(_vm->_menuFont, endMsg3[language], 1); } _vm->_gfx->showLabel(id[0], CENTER_LABEL_HORIZONTAL, 70); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 78df9c24a8..f69e39519c 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -48,7 +48,6 @@ Parallaction *_vm = NULL; // public stuff char _saveData1[30] = { '\0' }; -uint16 _language = 0; uint32 _engineFlags = 0; uint16 _score = 1; @@ -115,7 +114,6 @@ int Parallaction::init() { _objectsNames = NULL; _globalFlagsNames = NULL; _location._hasSound = false; - _baseTime = 0; _numLocations = 0; _location._startPosition.x = -1000; _location._startPosition.y = -1000; diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 5aaba21ba9..b8464e7c7a 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -100,7 +100,6 @@ struct PARALLACTIONGameDescription; extern char _password[8]; extern uint16 _score; -extern uint16 _language; extern uint32 _engineFlags; extern char _saveData1[]; extern uint32 _globalFlags; @@ -212,219 +211,144 @@ class SaveLoad; class Parallaction : public Engine { friend class Debugger; -public: - - Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gameDesc); - ~Parallaction(); - - int init(); - - Input *_input; - - void processInput(int event); - - void pauseJobs(); - void resumeJobs(); - - bool checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y); - bool checkZoneBox(ZonePtr z, uint32 type, uint x, uint y); - bool checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y); - ZonePtr findZone(const char *name); - ZonePtr hitZone(uint32 type, uint16 x, uint16 y); - void runZone(ZonePtr z); - void freeZones(); - - AnimationPtr findAnimation(const char *name); - void freeAnimations(); - - void setBackground(const char *background, const char *mask, const char *path); - void freeBackground(); - - Table *_globalFlagsNames; - Table *_objectsNames; - Table *_callableNames; - Table *_localFlagNames; - public: int getGameType() const; uint32 getFeatures() const; Common::Language getLanguage() const; Common::Platform getPlatform() const; +protected: // members + bool detectGame(void); + private: const PARALLACTIONGameDescription *_gameDescription; + uint16 _language; public: + Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gameDesc); + ~Parallaction(); + + int init(); + // info int32 _screenWidth; int32 _screenHeight; int32 _screenSize; - PathBuffer *_pathBuffer; - + // subsystems + Gfx *_gfx; + Disk *_disk; + Input *_input; SoundMan *_soundMan; + Debugger *_debugger; + SaveLoad *_saveLoad; + MenuInputHelper *_menuHelper; + Common::RandomSource _rnd; - Gfx* _gfx; - Disk* _disk; + // fonts + Font *_labelFont; + Font *_menuFont; + Font *_introFont; + Font *_dialogueFont; - CommandExec* _cmdExec; - ProgramExec* _programExec; + // game utilities + Table *_globalFlagsNames; + Table *_objectsNames; + Table *_callableNames; + Table *_localFlagNames; + CommandExec *_cmdExec; + ProgramExec *_programExec; + PathBuffer *_pathBuffer; + Inventory *_inventory; + BalloonManager *_balloonMan; + DialogueManager *_dialogueMan; + InventoryRenderer *_inventoryRenderer; + + // game data Character _char; - - void setLocationFlags(uint32 flags); - void clearLocationFlags(uint32 flags); - void toggleLocationFlags(uint32 flags); - uint32 getLocationFlags(); - uint32 _localFlags[NUM_LOCATIONS]; char _locationNames[NUM_LOCATIONS][32]; int16 _currentLocationIndex; uint16 _numLocations; Location _location; - ZonePtr _activeZone; + char _characterName1[50]; // only used in changeCharacter + ZonePtr _zoneTrap; + ZonePtr _commentZone; - - Font *_labelFont; - Font *_menuFont; - Font *_introFont; - Font *_dialogueFont; - - Common::RandomSource _rnd; - - Debugger *_debugger; - - char _characterName1[50]; // only used in changeCharacter - -protected: // data - uint32 _baseTime; - - Common::String _saveFileName; - - -protected: // members - bool detectGame(void); - - void runGame(); - void updateView(); - - void doLocationEnterTransition(); - virtual void changeLocation(char *location) = 0; - virtual void runPendingZones() = 0; - void allocateLocationSlot(const char *name); - void finalizeLocationParsing(); - void freeLocation(); - void showLocationComment(const char *text, bool end); - - void freeCharacter(); - - bool pickupItem(ZonePtr z); +protected: + void runGame(); + void runGuiFrame(); + void cleanupGui(); + void runDialogueFrame(); + void exitDialogueMode(); + void runCommentFrame(); + void enterCommentMode(ZonePtr z); + void exitCommentMode(); + void processInput(int event); + void updateView(); + void drawAnimations(); + void freeCharacter(); + void freeLocation(); + void doLocationEnterTransition(); + void allocateLocationSlot(const char *name); + void finalizeLocationParsing(); + void showLocationComment(const char *text, bool end); + void setupBalloonManager(); public: - void scheduleLocationSwitch(const char *location); - virtual void changeCharacter(const char *name) = 0; + void beep(); + void pauseJobs(); + void resumeJobs(); + void hideDialogueStuff(); + uint getInternLanguage(); + void setInternLanguage(uint id); + void enterDialogueMode(ZonePtr z); + void scheduleLocationSwitch(const char *location); + void showSlide(const char *name, int x = 0, int y = 0); - virtual void callFunction(uint index, void* parm) { } +public: + void setLocationFlags(uint32 flags); + void clearLocationFlags(uint32 flags); + void toggleLocationFlags(uint32 flags); + uint32 getLocationFlags(); + bool checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y); + bool checkZoneBox(ZonePtr z, uint32 type, uint x, uint y); + bool checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y); + ZonePtr findZone(const char *name); + ZonePtr hitZone(uint32 type, uint16 x, uint16 y); + void runZone(ZonePtr z); + void freeZones(); + bool pickupItem(ZonePtr z); + void updateDoor(ZonePtr z, bool close); + void showZone(ZonePtr z, bool visible); + AnimationPtr findAnimation(const char *name); + void freeAnimations(); + void setBackground(const char *background, const char *mask, const char *path); + void freeBackground(); + void highlightInventoryItem(ItemPosition pos); + int16 getHoverInventoryItem(int16 x, int16 y); + int addInventoryItem(ItemName item); + int addInventoryItem(ItemName item, uint32 value); + void dropItem(uint16 v); + bool isItemInInventory(int32 v); + const InventoryItem* getInventoryItem(int16 pos); + int16 getInventoryItemIndex(int16 pos); + void initInventory(); + void destroyInventory(); + void cleanInventory(bool keepVerbs = true); + void openInventory(); + void closeInventory(); virtual void parseLocation(const char* name) = 0; - - void updateDoor(ZonePtr z, bool close); - - void drawAnimations(); - - void beep(); - void showSlide(const char *name, int x = 0, int y = 0); - - ZonePtr _zoneTrap; - SaveLoad *_saveLoad; - + virtual void changeLocation(char *location) = 0; + virtual void changeCharacter(const char *name) = 0; + virtual void callFunction(uint index, void* parm) = 0; + virtual void runPendingZones() = 0; virtual void cleanupGame() = 0; - -public: - void highlightInventoryItem(ItemPosition pos); - int16 getHoverInventoryItem(int16 x, int16 y); - int addInventoryItem(ItemName item); - int addInventoryItem(ItemName item, uint32 value); - void dropItem(uint16 v); - bool isItemInInventory(int32 v); - const InventoryItem* getInventoryItem(int16 pos); - int16 getInventoryItemIndex(int16 pos); - void initInventory(); - void destroyInventory(); - void cleanInventory(bool keepVerbs = true); - void openInventory(); - void closeInventory(); - - Inventory *_inventory; - InventoryRenderer *_inventoryRenderer; - - BalloonManager *_balloonMan; - - void setupBalloonManager(); - - void hideDialogueStuff(); - DialogueManager *_dialogueMan; - void enterDialogueMode(ZonePtr z); - void exitDialogueMode(); - void runDialogueFrame(); - - MenuInputHelper *_menuHelper; - void runGuiFrame(); - void cleanupGui(); - - ZonePtr _commentZone; - void enterCommentMode(ZonePtr z); - void exitCommentMode(); - void runCommentFrame(); - - void setInternLanguage(uint id); - uint getInternLanguage(); - - void showZone(ZonePtr z, bool visible); }; -class LocationName { - - Common::String _slide; - Common::String _character; - Common::String _location; - - bool _hasCharacter; - bool _hasSlide; - char *_buf; - -public: - LocationName(); - ~LocationName(); - - void bind(const char*); - - const char *location() const { - return _location.c_str(); - } - - bool hasCharacter() const { - return _hasCharacter; - } - - const char *character() const { - return _character.c_str(); - } - - bool hasSlide() const { - return _hasSlide; - } - - const char *slide() const { - return _slide.c_str(); - } - - const char *c_str() const { - return _buf; - } -}; - class Parallaction_ns : public Parallaction { @@ -436,47 +360,45 @@ public: int go(); public: - typedef void (Parallaction_ns::*Callable)(void*); + virtual void parseLocation(const char *filename); + virtual void changeLocation(char *location); + virtual void changeCharacter(const char *name); + virtual void callFunction(uint index, void* parm); + virtual void runPendingZones(); + virtual void cleanupGame(); - virtual void callFunction(uint index, void* parm); - void switchBackground(const char* background, const char* mask); - - void cleanupGame(); + void switchBackground(const char* background, const char* mask); private: - bool _inTestResult; - - LocationParser_ns *_locationParser; - ProgramParser_ns *_programParser; - - void initFonts(); - void freeFonts(); + bool _inTestResult; + LocationParser_ns *_locationParser; + ProgramParser_ns *_programParser; private: - void changeLocation(char *location); - void changeCharacter(const char *name); - void runPendingZones(); + void initFonts(); + void freeFonts(); + void initResources(); + void startGui(); + void startCreditSequence(); + void startEndPartSequence(); + void loadProgram(AnimationPtr a, const char *filename); - void initResources(); - - static const Callable _dosCallables[25]; - static const Callable _amigaCallables[25]; - - /* - game callables data members - */ + // callables data + typedef void (Parallaction_ns::*Callable)(void*); + const Callable *_callables; ZonePtr _moveSarcZone0; ZonePtr _moveSarcZone1; uint16 num_foglie; int16 _introSarcData1; uint16 _introSarcData2; // sarcophagus stuff to be saved uint16 _introSarcData3; // sarcophagus stuff to be saved - ZonePtr _moveSarcZones[5]; ZonePtr _moveSarcExaZones[5]; AnimationPtr _rightHandAnim; + static const Callable _dosCallables[25]; + static const Callable _amigaCallables[25]; // common callables void _c_play_boogie(void*); @@ -510,17 +432,6 @@ private: void _c_startMusic(void*); void _c_closeMusic(void*); void _c_HBOn(void*); - - const Callable *_callables; - -protected: - - void parseLocation(const char *filename); - void loadProgram(AnimationPtr a, const char *filename); - - void startGui(); - void startCreditSequence(); - void startEndPartSequence(); }; @@ -537,63 +448,55 @@ public: int go(); public: - typedef void (Parallaction_br::*Callable)(void*); + virtual void parseLocation(const char* name); + virtual void changeLocation(char *location); + virtual void changeCharacter(const char *name); virtual void callFunction(uint index, void* parm); - void changeCharacter(const char *name); + virtual void runPendingZones(); + virtual void cleanupGame(); + + void setupSubtitles(char *s, char *s2, int y); void clearSubtitles(); public: Table *_countersNames; - const char **_audioCommandsNamesRes; - + static const char *_partNames[]; int _part; - #if 0 // disabled since I couldn't find any references to lip sync in the scripts int16 _lipSyncVal; uint _subtitleLipSync; #endif int _subtitleY; int _subtitle[2]; - ZonePtr _activeZone2; - int32 _counters[32]; - uint32 _zoneFlags[NUM_LOCATIONS][NUM_ZONES]; + private: LocationParser_br *_locationParser; ProgramParser_br *_programParser; - void initResources(); - void initFonts(); - void freeFonts(); - void changeLocation(char *location); - void runPendingZones(); - - void freeLocation(); - - - static const char *_partNames[]; - - void startGui(bool showSplash); +private: + void initResources(); + void initFonts(); + void freeFonts(); + void freeLocation(); + void loadProgram(AnimationPtr a, const char *filename); + void startGui(bool showSplash); + typedef void (Parallaction_br::*Callable)(void*); + const Callable *_callables; static const Callable _dosCallables[6]; + // dos callables void _c_blufade(void*); void _c_resetpalette(void*); void _c_ferrcycle(void*); void _c_lipsinc(void*); void _c_albcycle(void*); void _c_password(void*); - - const Callable *_callables; - - void parseLocation(const char* name); - void loadProgram(AnimationPtr a, const char *filename); - - void cleanupGame(); }; // FIXME: remove global diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index ec12306d92..85a4689301 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -36,15 +36,54 @@ namespace Parallaction { -LocationName::LocationName() { - _buf = 0; - _hasSlide = false; - _hasCharacter = false; -} +class LocationName { + + Common::String _slide; + Common::String _character; + Common::String _location; + + bool _hasCharacter; + bool _hasSlide; + char *_buf; + +public: + LocationName() { + _buf = 0; + _hasSlide = false; + _hasCharacter = false; + } + + ~LocationName() { + free(_buf); + } + + void bind(const char*); + + const char *location() const { + return _location.c_str(); + } + + bool hasCharacter() const { + return _hasCharacter; + } + + const char *character() const { + return _character.c_str(); + } + + bool hasSlide() const { + return _hasSlide; + } + + const char *slide() const { + return _slide.c_str(); + } + + const char *c_str() const { + return _buf; + } +}; -LocationName::~LocationName() { - free(_buf); -} /* -- cgit v1.2.3