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()
{
// 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();
}

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)
{
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]);
break;
case 29: // setKeyScript
keyScriptKey = args[1];
keyScriptNo = args[2];
_keyScriptKey = args[1];
_keyScriptNo = args[2];
break;
case 30: // killAllScriptsButMe
warning("o8_kernelSetFunctions: killAllScriptsButMe()");

View file

@ -272,39 +272,49 @@ public:
int16 x, y;
} mouse;
/* Init functions, etc */
byte _fastMode;
/* Scumm main loop */
void mainRun();
void scummInit();
int scummLoop(int delta);
void initScummVars();
void launch();
// Constructor / Destructor
Scumm(GameDetector *detector, OSystem *syst);
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 waitForTimer(int msec_delay);
// 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 */
@ -685,18 +681,19 @@ public:
void actorTalk();
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_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);

View file

@ -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,12 +1228,11 @@ void Scumm::processKbd()
_mouseButStat = _lastKeyHit;
}
int Scumm::getKeyInput(int a)
int Scumm::getKeyInput()
{
_mouseButStat = 0;
_lastKeyHit = checkKeyHit();
if (a == 0)
convertKeysToClicks();
if (mouse.x < 0)