more access cleanup; also reorderd some method/function declarations in class Scumm

svn-id: r6593
This commit is contained in:
Max Horn 2003-02-08 01:27:21 +00:00
parent 5863805e2c
commit 24cba45574
5 changed files with 70 additions and 62 deletions

View file

@ -427,19 +427,14 @@ void SaveLoadDialog::fillList()
void SaveLoadDialog::save() void SaveLoadDialog::save()
{ {
// Save the selected item // Save the selected item
_scumm->_saveLoadSlot = _savegameList->getSelected() + 1; _scumm->requestSave(_savegameList->getSelected() + 1, _savegameList->getSelectedString().c_str());
_scumm->_saveLoadCompatible = false;
_scumm->_saveLoadFlag = 1; // 1 for save, I assume (Painelf)
strcpy(_scumm->_saveLoadName, _savegameList->getSelectedString().c_str());
close(); close();
} }
void SaveLoadDialog::load() void SaveLoadDialog::load()
{ {
// Load the selected item // Load the selected item
_scumm->_saveLoadSlot = _savegameList->getSelected(); _scumm->requestLoad(_savegameList->getSelected());
_scumm->_saveLoadCompatible = false;
_scumm->_saveLoadFlag = 2; // 2 for load. Magic number anyone?
close(); close();
} }

View file

@ -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) bool Scumm::saveState(int slot, bool compat, SaveFileManager *mgr)
{ {
char filename[256]; char filename[256];

View file

@ -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]); warning("o8_kernelSetFunctions: saveGameStampScreenshot(%d, %d, %d, %d, %d, %d)", args[1], args[2], args[3], args[4], args[5], args[6]);
break; break;
case 29: // setKeyScript case 29: // setKeyScript
keyScriptKey = args[1]; _keyScriptKey = args[1];
keyScriptNo = args[2]; _keyScriptNo = args[2];
break; break;
case 30: // killAllScriptsButMe case 30: // killAllScriptsButMe
warning("o8_kernelSetFunctions: killAllScriptsButMe()"); warning("o8_kernelSetFunctions: killAllScriptsButMe()");

View file

@ -242,9 +242,9 @@ public:
VerbSlot *_verbs; VerbSlot *_verbs;
ObjectData *_objs; ObjectData *_objs;
ScummDebugger *_debugger; ScummDebugger *_debugger;
Bundle * _bundle; Bundle *_bundle;
Timer * _timer; Timer *_timer;
Sound * _sound; Sound *_sound;
struct { struct {
byte mode[rtNumTypes]; byte mode[rtNumTypes];
@ -272,39 +272,49 @@ public:
int16 x, y; int16 x, y;
} mouse; } mouse;
/* Init functions, etc */ // Constructor / Destructor
byte _fastMode;
/* Scumm main loop */
void mainRun();
void scummInit();
int scummLoop(int delta);
void initScummVars();
void launch();
Scumm(GameDetector *detector, OSystem *syst); Scumm(GameDetector *detector, OSystem *syst);
virtual ~Scumm(); virtual ~Scumm();
// Init functions
void scummInit();
void initScummVars();
virtual void setupScummVars();
// Startup functions
void main();
void parseCommandLine(int argc, char **argv);
void showHelpAndExit();
bool detectGame();
void launch();
void go(); void go();
// Scumm main loop
void mainRun();
int scummLoop(int delta);
// Event handling
void waitForTimer(int msec_delay); 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 updateCursor();
void animateCursor(); void animateCursor();
void updatePalette(); void updatePalette();
/* _insane vars */ /* _insane vars */
int _smushFrameRate; int _smushFrameRate;
bool _insaneState; bool _insaneState;
bool _videoFinished; bool _videoFinished;
const char *getExeName() const { return _exe_name; }
const char *getGameDataPath() const { return _gameDataPath; }
void pauseGame(bool user); void pauseGame(bool user);
void shutDown(int i); void shutDown(int i);
void setOptions(void); void setOptions(void);
@ -324,18 +334,8 @@ public:
void optionsDialog(); void optionsDialog();
char displayError(bool showCancel, const char *message, ...); 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: protected:
int keyScriptKey, keyScriptNo; byte _fastMode;
/* Random number generation */ /* Random number generation */
RandomSource _rnd; RandomSource _rnd;
@ -392,12 +392,9 @@ protected:
bool _dumpScripts; bool _dumpScripts;
uint16 _debugMode, _soundCardType; uint16 _debugMode, _soundCardType;
public:
/* Not sure where this stuff goes */ /* Not sure where this stuff goes */
uint16 _language; uint16 _language;
byte isMaskActiveAt(int l, int t, int r, int b, byte *mem);
void startScene(int room, Actor *a, int b); void startScene(int room, Actor *a, int b);
virtual void setupScummVars();
byte *_objectOwnerTable, *_objectRoomTable, *_objectStateTable; byte *_objectOwnerTable, *_objectRoomTable, *_objectStateTable;
ObjectIDMap _objectIDMap; ObjectIDMap _objectIDMap;
byte _numObjectsInRoom; byte _numObjectsInRoom;
@ -408,8 +405,8 @@ public:
/* GUI class */ /* GUI class */
void drawString(int a); void drawString(int a);
int getKeyInput(int a);
protected:
/* Save/Load class - some of this may be GUI */ /* Save/Load class - some of this may be GUI */
byte _saveLoadFlag, _saveLoadSlot; byte _saveLoadFlag, _saveLoadSlot;
uint32 _lastSaveTime; uint32 _lastSaveTime;
@ -434,23 +431,25 @@ public:
} }
void saveOrLoad(Serializer *s, uint32 savegameVersion); void saveOrLoad(Serializer *s, uint32 savegameVersion);
public:
bool getSavegameName(int slot, char *desc, SaveFileManager *mgr); bool getSavegameName(int slot, char *desc, SaveFileManager *mgr);
void makeSavegameName(char *out, int slot, bool compatible); void makeSavegameName(char *out, int slot, bool compatible);
void saveLoadResource(Serializer *ser, int type, int index); void saveLoadResource(Serializer *ser, int type, int index);
void listSavegames(bool *marks, int num, SaveFileManager *mgr); void listSavegames(bool *marks, int num, SaveFileManager *mgr);
void requestSave(int slot, const char *name);
void requestLoad(int slot);
protected:
/* Heap and memory management */ /* Heap and memory management */
uint32 _maxHeapThreshold, _minHeapThreshold; uint32 _maxHeapThreshold, _minHeapThreshold;
void checkRange(int max, int min, int no, const char *str);
void lock(int type, int i); void lock(int type, int i);
void unlock(int type, int i); void unlock(int type, int i);
void heapClear(int mode); void heapClear(int mode);
void unkHeapProc2(int a, int b); void unkHeapProc2(int a, int b);
protected:
/* Script VM - should be in Script class */ /* Script VM - should be in Script class */
uint32 _localScriptList[NUM_LOCALSCRIPT]; uint32 _localScriptList[NUM_LOCALSCRIPT];
byte *_scriptPointer, *_scriptOrgPointer; byte *_scriptPointer, *_scriptOrgPointer;
byte _opcode, _numNestedScripts, _currentScript; byte _opcode, _numNestedScripts, _currentScript;
@ -458,6 +457,7 @@ protected:
byte **_lastCodePtr; byte **_lastCodePtr;
int _resultVarNumber, _scummStackPos; int _resultVarNumber, _scummStackPos;
int _localParamList[16], _scummStack[150]; int _localParamList[16], _scummStack[150];
int _keyScriptKey, _keyScriptNo;
virtual void setupOpcodes() = 0; virtual void setupOpcodes() = 0;
virtual void executeOpcode(int i) = 0; virtual void executeOpcode(int i) = 0;
@ -634,10 +634,6 @@ public:
byte *getOBCDFromObject(int obj); byte *getOBCDFromObject(int obj);
int getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, int f); 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: protected:
/* Should be in Verb class */ /* Should be in Verb class */
@ -683,20 +679,21 @@ public:
SentenceTab _sentence[6]; SentenceTab _sentence[6];
StringTab _string[6]; StringTab _string[6];
void actorTalk(); void actorTalk();
void stopTalk(); void stopTalk();
/* Akos Class */ // 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_increaseAnims(byte *akos, Actor *a);
bool akos_increaseAnim(Actor *a, int i, byte *aksq, uint16 *akfo, int numakfo); 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); void akos_queCommand(byte cmd, Actor *a, int param_1, int param_2);
bool akos_compare(int a, int b, byte cmd); bool akos_compare(int a, int b, byte cmd);
void akos_decodeData(Actor *a, int frame, uint usemask); void akos_decodeData(Actor *a, int frame, uint usemask);
int akos_frameToAnim(Actor *a, int frame); int akos_frameToAnim(Actor *a, int frame);
bool akos_hasManyDirections(Actor *a); bool akos_hasManyDirections(Actor *a);
/* Should be in Graphics class? */ /* Should be in Graphics class? */
uint16 _screenB, _screenH; uint16 _screenB, _screenH;
int _scrHeight, _scrWidth, _realHeight, _realWidth; int _scrHeight, _scrWidth, _realHeight, _realWidth;
@ -796,6 +793,8 @@ public:
VirtScreen *findVirtScreen(int y); VirtScreen *findVirtScreen(int y);
void setVirtscreenDirty(VirtScreen *vs, int left, int top, int right, int bottom); 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 drawFlashlight();
void fadeIn(int effect); void fadeIn(int effect);

View file

@ -1118,7 +1118,7 @@ void Scumm::shutDown(int i)
void Scumm::processKbd() void Scumm::processKbd()
{ {
int saveloadkey; int saveloadkey;
getKeyInput(0); getKeyInput();
if (_features & GF_OLD256) /* FIXME: Support ingame screen */ if (_features & GF_OLD256) /* FIXME: Support ingame screen */
saveloadkey = 319; saveloadkey = 319;
@ -1153,8 +1153,8 @@ void Scumm::processKbd()
if (!_lastKeyHit) if (!_lastKeyHit)
return; return;
if (keyScriptNo && (keyScriptKey == _lastKeyHit)) { if (_keyScriptNo && (_keyScriptKey == _lastKeyHit)) {
runScript(keyScriptNo, 0, 0, 0); runScript(_keyScriptNo, 0, 0, 0);
return; return;
} }
@ -1228,13 +1228,12 @@ void Scumm::processKbd()
_mouseButStat = _lastKeyHit; _mouseButStat = _lastKeyHit;
} }
int Scumm::getKeyInput(int a) int Scumm::getKeyInput()
{ {
_mouseButStat = 0; _mouseButStat = 0;
_lastKeyHit = checkKeyHit(); _lastKeyHit = checkKeyHit();
if (a == 0) convertKeysToClicks();
convertKeysToClicks();
if (mouse.x < 0) if (mouse.x < 0)
mouse.x = 0; mouse.x = 0;