diff options
author | Max Horn | 2003-02-08 01:27:21 +0000 |
---|---|---|
committer | Max Horn | 2003-02-08 01:27:21 +0000 |
commit | 24cba45574285fbc8a24436f2b9211d314a68783 (patch) | |
tree | 9c8974f679486ac0158e2a847fcff48f0175a74f | |
parent | 5863805e2cc4fdb7da5903dbf58d1582d3a9f754 (diff) | |
download | scummvm-rg350-24cba45574285fbc8a24436f2b9211d314a68783.tar.gz scummvm-rg350-24cba45574285fbc8a24436f2b9211d314a68783.tar.bz2 scummvm-rg350-24cba45574285fbc8a24436f2b9211d314a68783.zip |
more access cleanup; also reorderd some method/function declarations in class Scumm
svn-id: r6593
-rw-r--r-- | scumm/dialogs.cpp | 9 | ||||
-rw-r--r-- | scumm/saveload.cpp | 15 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 4 | ||||
-rw-r--r-- | scumm/scumm.h | 89 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 11 |
5 files changed, 68 insertions, 60 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index e61e87d644..b5dd57f234 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -427,19 +427,14 @@ void SaveLoadDialog::fillList() void SaveLoadDialog::save() { // Save the selected item - _scumm->_saveLoadSlot = _savegameList->getSelected() + 1; - _scumm->_saveLoadCompatible = false; - _scumm->_saveLoadFlag = 1; // 1 for save, I assume (Painelf) - strcpy(_scumm->_saveLoadName, _savegameList->getSelectedString().c_str()); + _scumm->requestSave(_savegameList->getSelected() + 1, _savegameList->getSelectedString().c_str()); close(); } void SaveLoadDialog::load() { // Load the selected item - _scumm->_saveLoadSlot = _savegameList->getSelected(); - _scumm->_saveLoadCompatible = false; - _scumm->_saveLoadFlag = 2; // 2 for load. Magic number anyone? + _scumm->requestLoad(_savegameList->getSelected()); close(); } diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index d120106f95..73d85ea2d4 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -40,6 +40,21 @@ struct SaveGameHeader { }; +void Scumm::requestSave(int slot, const char *name) +{ + _saveLoadSlot = slot; + _saveLoadCompatible = false; + _saveLoadFlag = 1; // 1 for save + strcpy(_saveLoadName, name); +} + +void Scumm::requestLoad(int slot) +{ + _saveLoadSlot = slot; + _saveLoadCompatible = false; + _saveLoadFlag = 2; // 2 for load +} + bool Scumm::saveState(int slot, bool compat, SaveFileManager *mgr) { char filename[256]; diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 51d3d8f141..a34a33ee41 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -1501,8 +1501,8 @@ void Scumm_v8::o8_kernelSetFunctions() warning("o8_kernelSetFunctions: saveGameStampScreenshot(%d, %d, %d, %d, %d, %d)", args[1], args[2], args[3], args[4], args[5], args[6]); break; case 29: // setKeyScript - keyScriptKey = args[1]; - keyScriptNo = args[2]; + _keyScriptKey = args[1]; + _keyScriptNo = args[2]; break; case 30: // killAllScriptsButMe warning("o8_kernelSetFunctions: killAllScriptsButMe()"); diff --git a/scumm/scumm.h b/scumm/scumm.h index 65f6ed0f04..c59e6da487 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -242,9 +242,9 @@ public: VerbSlot *_verbs; ObjectData *_objs; ScummDebugger *_debugger; - Bundle * _bundle; - Timer * _timer; - Sound * _sound; + Bundle *_bundle; + Timer *_timer; + Sound *_sound; struct { byte mode[rtNumTypes]; @@ -272,39 +272,49 @@ public: int16 x, y; } mouse; - /* Init functions, etc */ - byte _fastMode; - - /* Scumm main loop */ - - void mainRun(); + // Constructor / Destructor + Scumm(GameDetector *detector, OSystem *syst); + virtual ~Scumm(); + // Init functions void scummInit(); - int scummLoop(int delta); void initScummVars(); + virtual void setupScummVars(); + // Startup functions + void main(); + void parseCommandLine(int argc, char **argv); + void showHelpAndExit(); + bool detectGame(); void launch(); - - Scumm(GameDetector *detector, OSystem *syst); - virtual ~Scumm(); - void go(); + // Scumm main loop + void mainRun(); + int scummLoop(int delta); + + // Event handling void waitForTimer(int msec_delay); + void processKbd(); + int checkKeyHit(); + void convertKeysToClicks(); + int getKeyInput(); + // Misc utility functions + void checkRange(int max, int min, int no, const char *str); + const char *getExeName() const { return _exe_name; } + const char *getGameDataPath() const { return _gameDataPath; } + + // Cursor/palette void updateCursor(); void animateCursor(); void updatePalette(); /* _insane vars */ - int _smushFrameRate; bool _insaneState; bool _videoFinished; - const char *getExeName() const { return _exe_name; } - const char *getGameDataPath() const { return _gameDataPath; } - void pauseGame(bool user); void shutDown(int i); void setOptions(void); @@ -324,18 +334,8 @@ public: void optionsDialog(); char displayError(bool showCancel, const char *message, ...); - // Misc startup/event functions - void main(); - void parseCommandLine(int argc, char **argv); - void showHelpAndExit(); - bool detectGame(); - void processKbd(); - - int checkKeyHit(); - void convertKeysToClicks(); - protected: - int keyScriptKey, keyScriptNo; + byte _fastMode; /* Random number generation */ RandomSource _rnd; @@ -392,12 +392,9 @@ protected: bool _dumpScripts; uint16 _debugMode, _soundCardType; -public: /* Not sure where this stuff goes */ uint16 _language; - byte isMaskActiveAt(int l, int t, int r, int b, byte *mem); void startScene(int room, Actor *a, int b); - virtual void setupScummVars(); byte *_objectOwnerTable, *_objectRoomTable, *_objectStateTable; ObjectIDMap _objectIDMap; byte _numObjectsInRoom; @@ -408,8 +405,8 @@ public: /* GUI class */ void drawString(int a); - int getKeyInput(int a); +protected: /* Save/Load class - some of this may be GUI */ byte _saveLoadFlag, _saveLoadSlot; uint32 _lastSaveTime; @@ -434,23 +431,25 @@ public: } void saveOrLoad(Serializer *s, uint32 savegameVersion); +public: bool getSavegameName(int slot, char *desc, SaveFileManager *mgr); void makeSavegameName(char *out, int slot, bool compatible); void saveLoadResource(Serializer *ser, int type, int index); void listSavegames(bool *marks, int num, SaveFileManager *mgr); + + void requestSave(int slot, const char *name); + void requestLoad(int slot); +protected: /* Heap and memory management */ uint32 _maxHeapThreshold, _minHeapThreshold; - void checkRange(int max, int min, int no, const char *str); void lock(int type, int i); void unlock(int type, int i); void heapClear(int mode); void unkHeapProc2(int a, int b); -protected: /* Script VM - should be in Script class */ - uint32 _localScriptList[NUM_LOCALSCRIPT]; byte *_scriptPointer, *_scriptOrgPointer; byte _opcode, _numNestedScripts, _currentScript; @@ -458,6 +457,7 @@ protected: byte **_lastCodePtr; int _resultVarNumber, _scummStackPos; int _localParamList[16], _scummStack[150]; + int _keyScriptKey, _keyScriptNo; virtual void setupOpcodes() = 0; virtual void executeOpcode(int i) = 0; @@ -634,10 +634,6 @@ public: byte *getOBCDFromObject(int obj); int getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, int f); - /* Should be in Costume class */ - void cost_decodeData(Actor *a, int frame, uint usemask); - int cost_frameToAnim(Actor *a, int frame); - protected: /* Should be in Verb class */ @@ -683,20 +679,21 @@ public: SentenceTab _sentence[6]; StringTab _string[6]; void actorTalk(); - void stopTalk(); - - /* Akos Class */ + void stopTalk(); + + // Costume class + void cost_decodeData(Actor *a, int frame, uint usemask); + int cost_frameToAnim(Actor *a, int frame); + // Akos Class bool akos_increaseAnims(byte *akos, Actor *a); bool akos_increaseAnim(Actor *a, int i, byte *aksq, uint16 *akfo, int numakfo); - void akos_queCommand(byte cmd, Actor *a, int param_1, int param_2); bool akos_compare(int a, int b, byte cmd); void akos_decodeData(Actor *a, int frame, uint usemask); int akos_frameToAnim(Actor *a, int frame); bool akos_hasManyDirections(Actor *a); - /* Should be in Graphics class? */ uint16 _screenB, _screenH; int _scrHeight, _scrWidth, _realHeight, _realWidth; @@ -796,6 +793,8 @@ public: VirtScreen *findVirtScreen(int y); void setVirtscreenDirty(VirtScreen *vs, int left, int top, int right, int bottom); + byte isMaskActiveAt(int l, int t, int r, int b, byte *mem); + void drawFlashlight(); void fadeIn(int effect); diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index fbdb7b0e3e..2472dc70a1 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -1118,7 +1118,7 @@ void Scumm::shutDown(int i) void Scumm::processKbd() { int saveloadkey; - getKeyInput(0); + getKeyInput(); if (_features & GF_OLD256) /* FIXME: Support ingame screen */ saveloadkey = 319; @@ -1153,8 +1153,8 @@ void Scumm::processKbd() if (!_lastKeyHit) return; - if (keyScriptNo && (keyScriptKey == _lastKeyHit)) { - runScript(keyScriptNo, 0, 0, 0); + if (_keyScriptNo && (_keyScriptKey == _lastKeyHit)) { + runScript(_keyScriptNo, 0, 0, 0); return; } @@ -1228,13 +1228,12 @@ void Scumm::processKbd() _mouseButStat = _lastKeyHit; } -int Scumm::getKeyInput(int a) +int Scumm::getKeyInput() { _mouseButStat = 0; _lastKeyHit = checkKeyHit(); - if (a == 0) - convertKeysToClicks(); + convertKeysToClicks(); if (mouse.x < 0) mouse.x = 0; |