[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.85,1.86 scumm.h,1.210,1.211 scummvm.cpp,2.178,2.179
Max Horn
fingolfin at users.sourceforge.net
Sat May 24 15:18:02 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.116,1.117 sound.cpp,1.122,1.123 resource_v3.cpp,1.17,1.18 actor.cpp,1.110,1.111
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sky logic.cpp,1.29,1.30
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv31500
Modified Files:
resource.cpp scumm.h scummvm.cpp
Log Message:
(somewhat hackish) support for COMI CD changing on Mac OS X; reordered stuff in scumm.h
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- resource.cpp 23 May 2003 04:47:47 -0000 1.85
+++ resource.cpp 24 May 2003 22:17:44 -0000 1.86
@@ -205,16 +205,13 @@
}
bool Scumm::openResourceFile(const char *filename) {
- char buf[256];
-
debug(9, "openResourceFile(%s)", filename);
if (_fileHandle.isOpen() == true) {
_fileHandle.close();
}
- strcpy(buf, filename);
- _fileHandle.open(buf, getGameDataPath(), 1, _encbyte);
+ _fileHandle.open(filename, getGameDataPath(), 1, _encbyte);
return _fileHandle.isOpen();
}
@@ -228,7 +225,11 @@
_bundle->closeVoiceFile();
_bundle->closeMusicFile();
- sprintf(buf, "Cannot find file: '%s'\nInsert disc %d into drive %s\nHit Ok to retry, Cancel to exit", filename, disknum, getGameDataPath());
+#ifdef MACOSX
+ sprintf(buf, "Cannot find file: '%s'\nPlease insert disc %d.\nHit OK to retry, Cancel to exit", filename, disknum);
+#else
+ sprintf(buf, "Cannot find file: '%s'\nInsert disc %d into drive %s\nHit OK to retry, Cancel to exit", filename, disknum, getGameDataPath());
+#endif
result = displayError(true, buf);
if (result == 2)
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -d -r1.210 -r1.211
--- scumm.h 23 May 2003 12:48:50 -0000 1.210
+++ scumm.h 24 May 2003 22:17:44 -0000 1.211
@@ -331,7 +331,7 @@
// 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; }
+ const char *getGameDataPath() const;
// Cursor/palette
void updateCursor();
@@ -389,7 +389,7 @@
// VAR is a wrapper around scummVar, which attempts to include additional
// useful information should an illegal var access be detected.
#define VAR(x) scummVar(x, #x, __FILE__, __LINE__)
- inline int32& scummVar(byte var, const char *varName, const char *file, int line)
+ int32& scummVar(byte var, const char *varName, const char *file, int line)
{
if (var == 0xFF) {
warning("Illegal access to variable %s in file %s, line %d", varName, file, line);
@@ -425,10 +425,12 @@
int _curVerb;
int _curVerbSlot;
int _curPalIndex;
-public:
- byte _currentRoom;
+public:
+ byte _currentRoom; // FIXME - should be protected but Actor::isInCurrentRoom uses it
+ int _roomResource; // FIXME - should be protected but Sound::pauseSounds uses it
bool _egoPositioned; // Used by Actor::putActor, hence public
+
protected:
int _keyPressed;
uint16 _lastKeyHit;
@@ -447,8 +449,7 @@
bool _showStack;
uint16 _debugMode;
-protected:
- /* Save/Load class - some of this may be GUI */
+ // Save/Load class - some of this may be GUI
byte _saveLoadFlag, _saveLoadSlot;
uint32 _lastSaveTime;
bool _saveLoadCompatible;
@@ -469,11 +470,11 @@
return result;
}
void saveOrLoad(Serializer *s, uint32 savegameVersion);
+ void saveLoadResource(Serializer *ser, int type, int index);
+ void makeSavegameName(char *out, int slot, bool compatible);
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);
@@ -508,13 +509,35 @@
public:
void runScript(int script, bool freezeResistant, bool recursive, int *lvarptr);
void stopScript(int script);
+ bool isScriptRunning(int script); // FIXME - should be protected, used by Sound::startTalkSound
protected:
+ void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars);
void runScriptNested(int script);
- void executeScript();
+ void executeScript();
void updateScriptPtr();
+ void runHook(int i);
+ void checkAndRunSentenceScript();
+ void runExitScript();
+ void runEntryScript();
+ void runAllScripts();
+ void freezeScripts(int scr);
+ void unfreezeScripts();
+
+ bool isScriptInUse(int script);
+ bool isRoomScriptRunning(int script);
+
+ void killAllScriptsExceptCurrent();
+ void killScriptsAndResources();
+ void decreaseScriptDelay(int amount);
+
+ void stopObjectCode();
+ void stopObjectScript(int script);
+
void getScriptBaseAddress();
void getScriptEntryPoint();
+ int getVerbEntrypoint(int obj, int entry);
+
byte fetchScriptByte();
virtual uint fetchScriptWord();
virtual int fetchScriptWordSigned();
@@ -526,37 +549,18 @@
int pop();
virtual int readVar(uint var);
virtual void writeVar(uint var, int value);
- void runHook(int i);
- bool isScriptInUse(int script);
- void freezeScripts(int scr);
- void unfreezeScripts();
- void runAllScripts();
void beginCutscene(int *args);
void endCutscene();
void abortCutscene();
- void runExitScript();
- void runEntryScript();
-
void beginOverride();
void endOverride();
- void killAllScriptsExceptCurrent();
- void killScriptsAndResources();
- void checkAndRunSentenceScript();
- void decreaseScriptDelay(int amount);
-public:
- bool isScriptRunning(int script); // FIXME - should be protected, used by Sound::startTalkSound
-protected:
- bool isRoomScriptRunning(int script);
+
void copyScriptString(byte *dst);
int resStrLen(const byte *src) const;
void doSentence(int c, int b, int a);
void setStringVars(int i);
- /* Script VM or Object class? */
- void stopObjectCode();
- void stopObjectScript(int script);
-
/* Should be in Resource class */
byte _encbyte;
File _fileHandle;
@@ -578,7 +582,6 @@
void askForDisk(const char *filename, int disknum);
bool openResourceFile(const char *filename);
-protected:
void loadPtrToResource(int type, int i, const byte *ptr);
void readResTypeList(int id, uint32 tag, const char *name);
char *resTypeFromId(int id);
@@ -617,7 +620,6 @@
int _lastLoadedRoom;
public:
- int _roomResource; // FIXME - should be protected but Sound::pauseSounds accesses it
byte *findResourceData(uint32 tag, byte *ptr);
int getResourceDataSize(byte *ptr);
void dumpResource(char *tag, int index, byte *ptr, int length = -1);
@@ -707,10 +709,8 @@
void runInputScript(int a, int cmd, int mode);
void restoreVerbBG(int verb);
void drawVerbBitmap(int verb, int x, int y);
- int getVerbEntrypoint(int obj, int entry);
int getVerbSlot(int id, int mode);
void killVerb(int slot);
- void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars);
void setVerbObject(uint room, uint object, uint verb);
void checkV2Inventory(int x, int y);
@@ -720,15 +720,16 @@
/* Should be in Actor class */
Actor *derefActor(int id, const char *errmsg = 0);
Actor *derefActorSafe(int id, const char *errmsg);
- void showActors();
uint32 *_classData;
int getAngleFromPos(int x, int y);
+protected:
void walkActors();
void playActorSounds();
void setActorRedrawFlags(bool fg, bool bg);
+ void showActors();
void resetActorBgs();
void processActors();
void processUpperActors();
@@ -737,6 +738,7 @@
bool isCostumeInUse(int i);
+public:
/* Actor talking stuff */
byte _actorToPrintStrFor;
int _sentenceNum;
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.178
retrieving revision 2.179
diff -u -d -r2.178 -r2.179
--- scummvm.cpp 23 May 2003 18:35:53 -0000 2.178
+++ scummvm.cpp 24 May 2003 22:17:45 -0000 2.179
@@ -42,6 +42,10 @@
#include "gui/message.h"
#include "sound/mixer.h"
#include "sound/mididrv.h"
+#ifdef MACOSX
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
#ifdef _WIN32_WCE
extern void drawError(char*);
@@ -2004,6 +2008,35 @@
temp = (angle + 360) % 360;
return toSimpleDir(1, temp) * 45;
+}
+
+const char *Scumm::getGameDataPath() const {
+#ifdef MACOSX
+ if (_features & GF_AFTER_V8 && !memcmp(_gameDataPath, "/Volumes/MONKEY3_", 17)) {
+ // Special case for COMI on Mac OS X. The mount points on OS X depend
+ // on the volume name. Hence if playing from CD, we'd get a problem.
+ // So if loading of a resource file fails, we fall back to the (fixed)
+ // CD mount points (/Volumes/MONKEY3_1 and /Volumes/MONKEY3_2).
+ //
+ // The check for whether we play from CD or not is very hackish, though.
+ static char buf[256];
+ struct stat st;
+ int disk = (_scummVars && _scummVars[VAR_CURRENTDISK] == 2) ? 2 : 1;
+ sprintf(buf, "/Volumes/MONKEY3_%d", disk);
+
+ if (!stat(buf, &st)) {
+ return buf;
+ }
+
+ // Apparently that disk is not inserted. However since many data files
+ // (fonts, comi.la0) are on both disks, we also try the other CD.
+ disk = (disk == 1) ? 2 : 1;
+ sprintf(buf, "/Volumes/MONKEY3_%d", disk);
+ return buf;
+ }
+#endif
+
+ return _gameDataPath;
}
void Scumm::errorString(const char *buf1, char *buf2) {
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.116,1.117 sound.cpp,1.122,1.123 resource_v3.cpp,1.17,1.18 actor.cpp,1.110,1.111
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sky logic.cpp,1.29,1.30
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list