[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.129,1.130 object.cpp,1.127,1.128 resource.cpp,1.98,1.99 script.cpp,1.117,1.118 scumm.h,1.258,1.259 scummvm.cpp,2.253,2.254 sound.cpp,1.143,1.144 sound.h,1.33,1.34
Max Horn
fingolfin at users.sourceforge.net
Wed Jun 25 16:26:12 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm script.cpp,1.116,1.117
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm costume.cpp,1.65,1.66 resource.cpp,1.99,1.100 scumm.h,1.259,1.260 scummvm.cpp,2.254,2.255 sound.cpp,1.144,1.145 sound.h,1.34,1.35 verbs.cpp,1.57,1.58
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv9342
Modified Files:
actor.cpp object.cpp resource.cpp script.cpp scumm.h
scummvm.cpp sound.cpp sound.h
Log Message:
added some const qualifiers; moved _bundle & _current_cd_sound from class Scumm to class Sound; some other tweaks
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- actor.cpp 21 Jun 2003 15:10:30 -0000 1.129
+++ actor.cpp 25 Jun 2003 23:25:51 -0000 1.130
@@ -116,7 +116,7 @@
}
}
-int Scumm::getAngleFromPos(int x, int y) {
+int Scumm::getAngleFromPos(int x, int y) const {
if (_gameId == GID_DIG || _gameId == GID_CMI) {
double temp = atan2((double)x, (double)-y);
return normalizeAngle((int)(temp * 180 / 3.1415926535));
Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- object.cpp 20 Jun 2003 11:14:18 -0000 1.127
+++ object.cpp 25 Jun 2003 23:25:51 -0000 1.128
@@ -50,8 +50,7 @@
#endif
-bool Scumm::getClass(int obj, int cls)
-{
+bool Scumm::getClass(int obj, int cls) const {
checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getClass");
cls &= 0x7F;
checkRange(32, 1, cls, "Class %d out of range in getClass");
@@ -78,8 +77,7 @@
return (_classData[obj] & (1 << (cls - 1))) != 0;
}
-void Scumm::putClass(int obj, int cls, bool set)
-{
+void Scumm::putClass(int obj, int cls, bool set) {
checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putClass");
cls &= 0x7F;
checkRange(32, 1, cls, "Class %d out of range in putClass");
@@ -119,7 +117,7 @@
}
}
-int Scumm::getOwner(int obj) {
+int Scumm::getOwner(int obj) const {
checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getOwner");
return _objectOwnerTable[obj];
}
@@ -160,12 +158,12 @@
_objectStateTable[obj] = state;
}
-int Scumm::getObjectRoom(int obj) {
+int Scumm::getObjectRoom(int obj) const {
checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getObjectRoom");
return _objectRoomTable[obj];
}
-int Scumm::getObjectIndex(int object) {
+int Scumm::getObjectIndex(int object) const {
int i;
if (object < 1)
@@ -178,7 +176,7 @@
return -1;
}
-int Scumm::whereIsObject(int object) {
+int Scumm::whereIsObject(int object) const {
int i;
if (object >= _numGlobalObjects)
@@ -941,7 +939,7 @@
return findResourceData(MKID('OBNA'), objptr);
}
-uint32 Scumm::getOBCDOffs(int object) {
+uint32 Scumm::getOBCDOffs(int object) const {
int i;
if (_objectOwnerTable[object] != OF_OWNER_ROOM)
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- resource.cpp 14 Jun 2003 18:52:29 -0000 1.98
+++ resource.cpp 25 Jun 2003 23:25:51 -0000 1.99
@@ -222,8 +222,8 @@
if (_version == 8) {
char result;
- _bundle->closeVoiceFile();
- _bundle->closeMusicFile();
+ _sound->_bundle->closeVoiceFile();
+ _sound->_bundle->closeMusicFile();
#ifdef MACOSX
sprintf(buf, "Cannot find file: '%s'\nPlease insert disc %d.\nHit OK to retry, Cancel to exit", filename, disknum);
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- script.cpp 25 Jun 2003 20:16:47 -0000 1.117
+++ script.cpp 25 Jun 2003 23:25:51 -0000 1.118
@@ -969,27 +969,27 @@
}
}
-bool Scumm::isScriptInUse(int script) {
+bool Scumm::isScriptInUse(int script) const {
int i;
- ScriptSlot *ss = vm.slot;
+ const ScriptSlot *ss = vm.slot;
for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++)
if (ss->number == script)
return true;
return false;
}
-bool Scumm::isScriptRunning(int script) {
+bool Scumm::isScriptRunning(int script) const {
int i;
- ScriptSlot *ss = vm.slot;
+ const ScriptSlot *ss = vm.slot;
for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++)
if (ss->number == script && (ss->where == WIO_GLOBAL || ss->where == WIO_LOCAL) && ss->status != ssDead)
return true;
return false;
}
-bool Scumm::isRoomScriptRunning(int script) {
+bool Scumm::isRoomScriptRunning(int script) const {
int i;
- ScriptSlot *ss = vm.slot;
+ const ScriptSlot *ss = vm.slot;
for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++)
if (ss->number == script && ss->where == WIO_ROOM && ss->status != ssDead)
return true;
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.258
retrieving revision 1.259
diff -u -d -r1.258 -r1.259
--- scumm.h 19 Jun 2003 12:29:13 -0000 1.258
+++ scumm.h 25 Jun 2003 23:25:51 -0000 1.259
@@ -32,22 +32,21 @@
#include "gfx.h"
#include "boxes.h"
+class Actor;
+class BaseCostumeRenderer;
class CharsetRenderer;
-class GameDetector;
-class NewGui;
-class Dialog;
class ConsoleDialog;
-class Scumm;
+class Dialog;
+class GameDetector;
class IMuse;
class IMuseDigital;
+class NewGui;
class Player_V2;
-class Actor;
-class Sound;
-class Bundle;
+class Scumm;
class ScummDebugger;
class Serializer;
+class Sound;
struct FindObjectInRoom;
-class BaseCostumeRenderer;
typedef ScummVM::Map<ScummVM::String, int> ObjectIDMap;
@@ -296,18 +295,17 @@
IMuse *_imuse;
IMuseDigital *_imuseDigital;
Player_V2 *_playerV2;
+ Sound *_sound;
+
+ VerbSlot *_verbs;
+ ObjectData *_objs;
+ ScummDebugger *_debugger;
byte _version;
uint32 _features; // Should only be accessed for reading (TODO enforce it compiler-wise with making it private and creating an accessor)
void setFeatures (uint32 newFeatures); // Changes the features set. This allows some gamewide stuff to be precalculated/prepared (ie CostumeRenderer)
- VerbSlot *_verbs;
- ObjectData *_objs;
- ScummDebugger *_debugger;
- Bundle *_bundle;
- Sound *_sound;
-
struct {
byte mode[rtNumTypes];
uint16 num[rtNumTypes];
@@ -319,6 +317,7 @@
uint32 *roomoffs[rtNumTypes];
} res;
+protected:
struct {
uint32 cutScenePtr[5];
byte cutSceneScript[5];
@@ -330,6 +329,7 @@
int32 localvar[NUM_SCRIPT_SLOT][26];
} vm;
+public:
// Constructor / Destructor
Scumm(GameDetector *detector, OSystem *syst);
virtual ~Scumm();
@@ -361,7 +361,7 @@
void clearClickedStatus();
// Misc utility functions
- void checkRange(int max, int min, int no, const char *str);
+ void checkRange(int max, int min, int no, const char *str) const;
const char *getExeName() const { return _exe_name; }
const char *getGameDataPath() const;
@@ -544,7 +544,7 @@
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
+ bool isScriptRunning(int script) const; // FIXME - should be protected, used by Sound::startTalkSound
protected:
void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars);
@@ -559,8 +559,8 @@
void freezeScripts(int scr);
void unfreezeScripts();
- bool isScriptInUse(int script);
- bool isRoomScriptRunning(int script);
+ bool isScriptInUse(int script) const;
+ bool isRoomScriptRunning(int script) const;
void killAllScriptsExceptCurrent();
void killScriptsAndResources();
@@ -669,7 +669,6 @@
void resourceStats();
void expireResources(uint32 size);
void freeResources();
- void destroy();
public:
/* Should be in Object class */
@@ -693,25 +692,25 @@
void addObjectToInventory(uint obj, uint room);
void fixObjectFlags();
public:
- bool getClass(int obj, int cls); // Used in actor.cpp, hence public
+ bool getClass(int obj, int cls) const; // Used in actor.cpp, hence public
protected:
void putClass(int obj, int cls, bool set);
int getState(int obj);
void putState(int obj, int state);
void setObjectState(int obj, int state, int x, int y);
- int getOwner(int obj);
+ int getOwner(int obj) const;
void putOwner(int obj, int owner);
void setOwnerOf(int obj, int owner);
void clearOwnerOf(int obj);
- int getObjectRoom(int obj);
+ int getObjectRoom(int obj) const;
int getObjX(int obj);
int getObjY(int obj);
void getObjectXYPos(int object, int &x, int &y) { int dir; getObjectXYPos(object, x, y, dir); }
void getObjectXYPos(int object, int &x, int &y, int &dir);
int getObjOldDir(int obj);
int getObjNewDir(int obj);
- int getObjectIndex(int object);
- int whereIsObject(int object);
+ int getObjectIndex(int object) const;
+ int whereIsObject(int object) const;
int findObject(int x, int y);
void findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint object, uint room);
public:
@@ -724,8 +723,8 @@
void clearDrawObjectQueue();
void processDrawQue();
- uint32 getOBCDOffs(int object);
- byte *getOBCDFromObject(int obj);
+ uint32 getOBCDOffs(int object) const;
+ byte *getOBCDFromObject(int obj);
int getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, int f);
@@ -765,7 +764,7 @@
uint32 *_classData;
- int getAngleFromPos(int x, int y);
+ int getAngleFromPos(int x, int y) const;
protected:
void walkActors();
@@ -1004,7 +1003,6 @@
int _saveSound;
public:
bool _silentDigitalImuse, _noDigitalSamples;
- int current_cd_sound; // Used in class Sound
public:
uint16 _extraBoxFlags[65];
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.253
retrieving revision 2.254
diff -u -d -r2.253 -r2.254
--- scummvm.cpp 22 Jun 2003 23:09:56 -0000 2.253
+++ scummvm.cpp 25 Jun 2003 23:25:52 -0000 2.254
@@ -23,7 +23,6 @@
#include "stdafx.h"
#include "scumm.h"
#include "actor.h"
-#include "bundle.h"
#include "charset.h"
#include "debugger.h"
#include "dialogs.h"
@@ -229,7 +228,6 @@
_verbs = NULL;
_objs = NULL;
_debugger = NULL;
- _bundle = NULL;
_sound = NULL;
memset(&res, 0, sizeof(res));
memset(&vm, 0, sizeof(vm));
@@ -395,7 +393,6 @@
_silentDigitalImuse = 0;
_noDigitalSamples = 0;
_saveSound = 1;
- current_cd_sound = 0;
memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
memset(_scaleSlots, 0, sizeof(_scaleSlots));
_charset = NULL;
@@ -583,7 +580,6 @@
gdi._numStrips = _screenWidth / 8;
_newgui = g_gui;
- _bundle = new Bundle();
_sound = new Sound(this);
_sound->_sound_volume_master = detector->_master_volume;
@@ -721,7 +717,6 @@
delete _optionsDialog;
delete _saveLoadDialog;
- delete _bundle;
delete _sound;
delete _imuse;
delete _imuseDigital;
@@ -733,7 +728,23 @@
free(_shadowPalette);
- destroy();
+ freeResources();
+
+ free(_objectStateTable);
+ free(_objectRoomTable);
+ free(_objectOwnerTable);
+ free(_inventory);
+ free(_verbs);
+ free(_objs);
+ free(_scummVars);
+ free(_bitVars);
+ free(_newNames);
+ free(_classData);
+ free(_exe_name);
+ free(_game_name);
+
+ free(_roomStrips);
+ free(_languageIndex);
delete g_debugger;
}
@@ -959,7 +970,7 @@
VAR(VAR_TALK_ACTOR) = 0;
}
-void Scumm::checkRange(int max, int min, int no, const char *str) {
+void Scumm::checkRange(int max, int min, int no, const char *str) const {
if (no < min || no > max) {
#ifdef __PALM_OS__
char buf[256]; // 1024 is too big overflow the stack
@@ -2137,26 +2148,6 @@
void Scumm::startManiac() {
warning("stub startManiac()");
-}
-
-void Scumm::destroy() {
- freeResources();
-
- free(_objectStateTable);
- free(_objectRoomTable);
- free(_objectOwnerTable);
- free(_inventory);
- free(_verbs);
- free(_objs);
- free(_scummVars);
- free(_bitVars);
- free(_newNames);
- free(_classData);
- free(_exe_name);
- free(_game_name);
-
- free(_roomStrips);
- free(_languageIndex);
}
//
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -d -r1.143 -r1.144
--- sound.cpp 23 Jun 2003 21:23:09 -0000 1.143
+++ sound.cpp 25 Jun 2003 23:25:52 -0000 1.144
@@ -93,6 +93,9 @@
_musicDisk = 0;
_talkChannel = -1;
_current_cache = 0;
+ _current_cd_sound = 0;
+
+ _bundle = new Bundle();
}
Sound::~Sound() {
@@ -100,6 +103,7 @@
_sfxFile->close();
delete _sfxFile;
}
+ delete _bundle;
}
void Sound::addSoundToQueue(int sound) {
@@ -195,7 +199,7 @@
playCDTrack(ptr[16], ptr[17] == 0xff ? -1 : ptr[17],
(ptr[18] * 60 + ptr[19]) * 75 + ptr[20], 0);
- _scumm->current_cd_sound = soundID;
+ _current_cd_sound = soundID;
return;
}
// Support for SFX in Monkey Island 1, Mac version
@@ -368,12 +372,12 @@
if (size == 30) {
int track = *(ptr + 0x16);
- if (track == _scumm->current_cd_sound)
+ if (track == _current_cd_sound)
if (pollCD() == 1)
return;
playCDTrack(track, 1, 0, 0);
- _scumm->current_cd_sound = track;
+ _current_cd_sound = track;
return;
}
@@ -590,7 +594,7 @@
int Sound::isSoundRunning(int sound) {
int i;
- if (sound == _scumm->current_cd_sound)
+ if (sound == _current_cd_sound)
return pollCD();
if (_scumm->_features & GF_HUMONGOUS) {
@@ -634,7 +638,7 @@
bool Sound::isSoundActive(int sound) {
int i;
- if (sound == _scumm->current_cd_sound)
+ if (sound == _current_cd_sound)
return pollCD() != 0;
i = _soundQue2Pos;
@@ -681,8 +685,8 @@
void Sound::stopSound(int a) {
int i;
- if (a != 0 && a == _scumm->current_cd_sound) {
- _scumm->current_cd_sound = 0;
+ if (a != 0 && a == _current_cd_sound) {
+ _current_cd_sound = 0;
stopCD();
}
@@ -700,8 +704,8 @@
}
void Sound::stopAllSounds() {
- if (_scumm->current_cd_sound != 0) {
- _scumm->current_cd_sound = 0;
+ if (_current_cd_sound != 0) {
+ _current_cd_sound = 0;
stopCD();
}
@@ -1007,10 +1011,10 @@
char bunfile[20];
sprintf(bunfile, "musdisk%d.bun", _scumm->VAR(_scumm->VAR_CURRENTDISK));
if (_musicDisk != _scumm->VAR(_scumm->VAR_CURRENTDISK))
- _scumm->_bundle->closeMusicFile();
+ _bundle->closeMusicFile();
- if (_scumm->_bundle->openMusicFile(bunfile, _scumm->getGameDataPath()) == false) {
- if (_scumm->_bundle->openMusicFile("music.bun", _scumm->getGameDataPath()) == false) {
+ if (_bundle->openMusicFile(bunfile, _scumm->getGameDataPath()) == false) {
+ if (_bundle->openMusicFile("music.bun", _scumm->getGameDataPath()) == false) {
_outputMixerSize = 0;
return;
}
@@ -1019,7 +1023,7 @@
_musicDisk = (byte)_scumm->VAR(_scumm->VAR_CURRENTDISK);
_outputMixerSize = 88140; // ((22050 * 2 * 2)
} else {
- if (_scumm->_bundle->openMusicFile("digmusic.bun", _scumm->getGameDataPath()) == false)
+ if (_bundle->openMusicFile("digmusic.bun", _scumm->getGameDataPath()) == false)
return;
}
_musicBundleBufFinal = (byte *)malloc(_outputMixerSize);
@@ -1032,7 +1036,7 @@
_musicBundleToBeRemoved = false;
_musicBundleToBeChanged = false;
_bundleMusicTrack = -1;
- _numberSamplesBundleMusic = _scumm->_bundle->getNumberOfMusicSamplesByName(song);
+ _numberSamplesBundleMusic = _bundle->getNumberOfMusicSamplesByName(song);
_nameBundleMusic = song;
_scumm->_timer->installProcedure(&music_handler, 1000000);
return;
@@ -1081,7 +1085,7 @@
if (_musicBundleToBeChanged == true) {
_nameBundleMusic = _newNameBundleMusic;
- _numberSamplesBundleMusic = _scumm->_bundle->getNumberOfMusicSamplesByName(_nameBundleMusic);
+ _numberSamplesBundleMusic = _bundle->getNumberOfMusicSamplesByName(_nameBundleMusic);
_currentSampleBundleMusic = 0;
_offsetSampleBundleMusic = 0;
_offsetBufBundleMusic = 0;
@@ -1092,7 +1096,7 @@
ptr = _musicBundleBufOutput;
for (k = 0, l = _currentSampleBundleMusic; l < num; k++) {
- length = _scumm->_bundle->decompressMusicSampleByName(_nameBundleMusic, l, (_musicBundleBufOutput + ((k * 0x2000) + _offsetBufBundleMusic)));
+ length = _bundle->decompressMusicSampleByName(_nameBundleMusic, l, (_musicBundleBufOutput + ((k * 0x2000) + _offsetBufBundleMusic)));
_offsetSampleBundleMusic += length;
if (l == 0) {
@@ -1196,15 +1200,15 @@
char voxfile[20];
sprintf(voxfile, "voxdisk%d.bun", _scumm->VAR(_scumm->VAR_CURRENTDISK));
if (_voiceDisk != _scumm->VAR(_scumm->VAR_CURRENTDISK))
- _scumm->_bundle->closeVoiceFile();
+ _bundle->closeVoiceFile();
- result = _scumm->_bundle->openVoiceFile(voxfile, _scumm->getGameDataPath());
+ result = _bundle->openVoiceFile(voxfile, _scumm->getGameDataPath());
if (result == false)
- result = _scumm->_bundle->openVoiceFile("voice.bun", _scumm->getGameDataPath());
+ result = _bundle->openVoiceFile("voice.bun", _scumm->getGameDataPath());
_voiceDisk = (byte)_scumm->VAR(_scumm->VAR_CURRENTDISK);
} else if (_scumm->_gameId == GID_DIG)
- result = _scumm->_bundle->openVoiceFile("digvoice.bun", _scumm->getGameDataPath());
+ result = _bundle->openVoiceFile("digvoice.bun", _scumm->getGameDataPath());
else
error("Don't know which bundle file to load");
@@ -1220,9 +1224,9 @@
strcpy(name, sound);
if (_scumm->_maxRooms != 6) // CMI demo does not have .IMX for voice but does for music...
strcat(name, ".IMX");
- output_size = _scumm->_bundle->decompressVoiceSampleByName(name, &ptr);
+ output_size = _bundle->decompressVoiceSampleByName(name, &ptr);
} else {
- output_size = _scumm->_bundle->decompressVoiceSampleByName(sound, &ptr);
+ output_size = _bundle->decompressVoiceSampleByName(sound, &ptr);
}
orig_ptr = ptr;
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- sound.h 23 Jun 2003 21:23:10 -0000 1.33
+++ sound.h 25 Jun 2003 23:25:52 -0000 1.34
@@ -23,6 +23,7 @@
#include "scummsys.h"
+class Bundle;
class DigitalTrackInfo;
class File;
class Scumm;
@@ -75,10 +76,14 @@
int num_sound_effects; // SO3 MP3 compressed audio
bool _vorbis_mode; // true if using SOG, false if using SO3
- #define CACHE_TRACKS 10
+ enum {
+ CACHE_TRACKS = 10
+ };
/* used for mp3 CD music */
+ int _current_cd_sound;
+
int _cached_tracks[CACHE_TRACKS];
int _dig_cd_index;
int _dig_cd_track;
@@ -99,6 +104,8 @@
bool _soundsPaused;
int16 _sound_volume_master, _sound_volume_music, _sound_volume_sfx;
byte _sfxMode;
+
+ Bundle *_bundle; // FIXME: should be protected but is used by Scumm::askForDisk
public:
Sound(Scumm *parent);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm script.cpp,1.116,1.117
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm costume.cpp,1.65,1.66 resource.cpp,1.99,1.100 scumm.h,1.259,1.260 scummvm.cpp,2.254,2.255 sound.cpp,1.144,1.145 sound.h,1.34,1.35 verbs.cpp,1.57,1.58
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list