more const qualifiers
svn-id: r8649
This commit is contained in:
parent
870ce2879e
commit
7f3118f8d8
7 changed files with 53 additions and 83 deletions
|
@ -724,7 +724,7 @@ byte LoadedCostume::increaseAnim(Actor *a, int slot) {
|
||||||
} while (1);
|
} while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scumm::isCostumeInUse(int cost) {
|
bool Scumm::isCostumeInUse(int cost) const {
|
||||||
int i;
|
int i;
|
||||||
Actor *a;
|
Actor *a;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
#include "gui/message.h"
|
#include "gui/message.h"
|
||||||
#include "dialogs.h"
|
#include "dialogs.h"
|
||||||
|
|
||||||
uint16 newTag2Old(uint32 oldTag);
|
static uint16 newTag2Old(uint32 oldTag);
|
||||||
|
static const char *resTypeFromId(int id);
|
||||||
|
|
||||||
/* Open a room */
|
/* Open a room */
|
||||||
void Scumm::openRoom(int room) {
|
void Scumm::openRoom(int room) {
|
||||||
|
@ -1318,7 +1319,7 @@ byte *Scumm::createResource(int type, int idx, uint32 size) {
|
||||||
return ptr + sizeof(MemBlkHeader); /* skip header */
|
return ptr + sizeof(MemBlkHeader); /* skip header */
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scumm::validateResource(const char *str, int type, int idx) {
|
bool Scumm::validateResource(const char *str, int type, int idx) const {
|
||||||
if (type < rtFirst || type > rtLast || (uint) idx >= (uint) res.num[type]) {
|
if (type < rtFirst || type > rtLast || (uint) idx >= (uint) res.num[type]) {
|
||||||
warning("%s Illegal Glob type %s (%d) num %d", str, resTypeFromId(type), type, idx);
|
warning("%s Illegal Glob type %s (%d) num %d", str, resTypeFromId(type), type, idx);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1509,8 +1510,7 @@ void Scumm::unlock(int type, int i) {
|
||||||
// debug(1, "unlocking %d,%d", type, i);
|
// debug(1, "unlocking %d,%d", type, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scumm::isResourceInUse(int type, int i)
|
bool Scumm::isResourceInUse(int type, int i) const {
|
||||||
{
|
|
||||||
if (!validateResource("isResourceInUse", type, i))
|
if (!validateResource("isResourceInUse", type, i))
|
||||||
return false;
|
return false;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -1625,7 +1625,7 @@ void Scumm::loadPtrToResource(int type, int resindex, const byte *source) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scumm::isResourceLoaded(int type, int idx) {
|
bool Scumm::isResourceLoaded(int type, int idx) const {
|
||||||
if (!validateResource("isLoaded", type, idx))
|
if (!validateResource("isLoaded", type, idx))
|
||||||
return false;
|
return false;
|
||||||
return res.address[type][idx] != NULL;
|
return res.address[type][idx] != NULL;
|
||||||
|
@ -1781,7 +1781,7 @@ void Scumm::allocateArrays() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Scumm::isGlobInMemory(int type, int idx) {
|
bool Scumm::isGlobInMemory(int type, int idx) const{
|
||||||
if (!validateResource("isGlobInMemory", type, idx))
|
if (!validateResource("isGlobInMemory", type, idx))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1792,99 +1792,71 @@ uint16 newTag2Old(uint32 oldTag) {
|
||||||
switch (oldTag) {
|
switch (oldTag) {
|
||||||
case (MKID('RMHD')):
|
case (MKID('RMHD')):
|
||||||
return (0x4448); // HD
|
return (0x4448); // HD
|
||||||
break;
|
|
||||||
case (MKID('IM00')):
|
case (MKID('IM00')):
|
||||||
return (0x4D42); // BM
|
return (0x4D42); // BM
|
||||||
break;
|
|
||||||
case (MKID('EXCD')):
|
case (MKID('EXCD')):
|
||||||
return (0x5845); // EX
|
return (0x5845); // EX
|
||||||
break;
|
|
||||||
case (MKID('ENCD')):
|
case (MKID('ENCD')):
|
||||||
return (0x4E45); // EN
|
return (0x4E45); // EN
|
||||||
break;
|
|
||||||
case (MKID('SCAL')):
|
case (MKID('SCAL')):
|
||||||
return (0x4153); // SA
|
return (0x4153); // SA
|
||||||
break;
|
|
||||||
case (MKID('LSCR')):
|
case (MKID('LSCR')):
|
||||||
return (0x534C); // LS
|
return (0x534C); // LS
|
||||||
break;
|
|
||||||
case (MKID('OBCD')):
|
case (MKID('OBCD')):
|
||||||
return (0x434F); // OC
|
return (0x434F); // OC
|
||||||
break;
|
|
||||||
case (MKID('OBIM')):
|
case (MKID('OBIM')):
|
||||||
return (0x494F); // OI
|
return (0x494F); // OI
|
||||||
break;
|
|
||||||
case (MKID('SMAP')):
|
case (MKID('SMAP')):
|
||||||
return (0x4D42); // BM
|
return (0x4D42); // BM
|
||||||
break;
|
|
||||||
case (MKID('CLUT')):
|
case (MKID('CLUT')):
|
||||||
return (0x4150); // PA
|
return (0x4150); // PA
|
||||||
break;
|
|
||||||
case (MKID('BOXD')):
|
case (MKID('BOXD')):
|
||||||
return (0x5842); // BX
|
return (0x5842); // BX
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *Scumm::resTypeFromId(int id) {
|
const char *resTypeFromId(int id) {
|
||||||
static char buf[100];
|
static char buf[100];
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case rtRoom:
|
case rtRoom:
|
||||||
sprintf(buf, "Room");
|
return "Room";
|
||||||
break;
|
|
||||||
case rtScript:
|
case rtScript:
|
||||||
sprintf(buf, "Script");
|
return "Script";
|
||||||
break;
|
|
||||||
case rtCostume:
|
case rtCostume:
|
||||||
sprintf(buf, "Costume");
|
return "Costume";
|
||||||
break;
|
|
||||||
case rtSound:
|
case rtSound:
|
||||||
sprintf(buf, "Sound");
|
return "Sound";
|
||||||
break;
|
|
||||||
case rtInventory:
|
case rtInventory:
|
||||||
sprintf(buf, "Inventory");
|
return "Inventory";
|
||||||
break;
|
|
||||||
case rtCharset:
|
case rtCharset:
|
||||||
sprintf(buf, "Charset");
|
return "Charset";
|
||||||
break;
|
|
||||||
case rtString:
|
case rtString:
|
||||||
sprintf(buf, "String");
|
return "String";
|
||||||
break;
|
|
||||||
case rtVerb:
|
case rtVerb:
|
||||||
sprintf(buf, "Verb");
|
return "Verb";
|
||||||
break;
|
|
||||||
case rtActorName:
|
case rtActorName:
|
||||||
sprintf(buf, "ActorName");
|
return "ActorName";
|
||||||
break;
|
|
||||||
case rtBuffer:
|
case rtBuffer:
|
||||||
sprintf(buf, "Buffer");
|
return "Buffer";
|
||||||
break;
|
|
||||||
case rtScaleTable:
|
case rtScaleTable:
|
||||||
sprintf(buf, "ScaleTable");
|
return "ScaleTable";
|
||||||
break;
|
|
||||||
case rtTemp:
|
case rtTemp:
|
||||||
sprintf(buf, "Temp");
|
return "Temp";
|
||||||
break;
|
|
||||||
case rtFlObject:
|
case rtFlObject:
|
||||||
sprintf(buf, "FlObject");
|
return "FlObject";
|
||||||
break;
|
|
||||||
case rtMatrix:
|
case rtMatrix:
|
||||||
sprintf(buf, "Matrix");
|
return "Matrix";
|
||||||
break;
|
|
||||||
case rtBox:
|
case rtBox:
|
||||||
sprintf(buf, "Box");
|
return "Box";
|
||||||
break;
|
|
||||||
case rtLast:
|
case rtLast:
|
||||||
sprintf(buf, "Last");
|
return "Last";
|
||||||
break;
|
|
||||||
case rtNumTypes:
|
case rtNumTypes:
|
||||||
sprintf(buf, "NumTypes");
|
return "NumTypes";
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
sprintf(buf, "%d", id);
|
sprintf(buf, "%d", id);
|
||||||
|
return buf;
|
||||||
}
|
}
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,7 +342,6 @@ public:
|
||||||
// Startup functions
|
// Startup functions
|
||||||
void main();
|
void main();
|
||||||
void parseCommandLine(int argc, char **argv);
|
void parseCommandLine(int argc, char **argv);
|
||||||
void showHelpAndExit();
|
|
||||||
bool detectGame();
|
bool detectGame();
|
||||||
void launch();
|
void launch();
|
||||||
void go();
|
void go();
|
||||||
|
@ -619,15 +618,14 @@ protected:
|
||||||
|
|
||||||
void loadPtrToResource(int type, int i, const byte *ptr);
|
void loadPtrToResource(int type, int i, const byte *ptr);
|
||||||
void readResTypeList(int id, uint32 tag, const char *name);
|
void readResTypeList(int id, uint32 tag, const char *name);
|
||||||
char *resTypeFromId(int id);
|
|
||||||
void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode);
|
void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode);
|
||||||
byte *createResource(int type, int index, uint32 size);
|
byte *createResource(int type, int index, uint32 size);
|
||||||
int loadResource(int type, int i);
|
int loadResource(int type, int i);
|
||||||
void nukeResource(int type, int i);
|
void nukeResource(int type, int i);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool isGlobInMemory(int type, int index);
|
bool isGlobInMemory(int type, int index) const;
|
||||||
bool isResourceLoaded(int type, int index);
|
bool isResourceLoaded(int type, int index) const;
|
||||||
byte *getResourceAddress(int type, int i);
|
byte *getResourceAddress(int type, int i);
|
||||||
byte *getStringAddress(int i);
|
byte *getStringAddress(int i);
|
||||||
byte *getStringAddressVar(int i);
|
byte *getStringAddressVar(int i);
|
||||||
|
@ -638,9 +636,9 @@ protected:
|
||||||
int readSoundResource(int type, int index);
|
int readSoundResource(int type, int index);
|
||||||
int readSoundResourceSmallHeader(int type, int index);
|
int readSoundResourceSmallHeader(int type, int index);
|
||||||
void setResourceCounter(int type, int index, byte flag);
|
void setResourceCounter(int type, int index, byte flag);
|
||||||
bool validateResource(const char *str, int type, int index);
|
bool validateResource(const char *str, int type, int index) const;
|
||||||
void increaseResourceCounter();
|
void increaseResourceCounter();
|
||||||
bool isResourceInUse(int type, int i);
|
bool isResourceInUse(int type, int i) const;
|
||||||
void initRoomSubBlocks();
|
void initRoomSubBlocks();
|
||||||
void clearRoomObjects();
|
void clearRoomObjects();
|
||||||
void loadRoomObjects();
|
void loadRoomObjects();
|
||||||
|
@ -738,12 +736,12 @@ protected:
|
||||||
void redrawVerbs();
|
void redrawVerbs();
|
||||||
void checkExecVerbs();
|
void checkExecVerbs();
|
||||||
void verbMouseOver(int verb);
|
void verbMouseOver(int verb);
|
||||||
int checkMouseOver(int x, int y);
|
int checkMouseOver(int x, int y) const;
|
||||||
void drawVerb(int verb, int mode);
|
void drawVerb(int verb, int mode);
|
||||||
void runInputScript(int a, int cmd, int mode);
|
void runInputScript(int a, int cmd, int mode);
|
||||||
void restoreVerbBG(int verb);
|
void restoreVerbBG(int verb);
|
||||||
void drawVerbBitmap(int verb, int x, int y);
|
void drawVerbBitmap(int verb, int x, int y);
|
||||||
int getVerbSlot(int id, int mode);
|
int getVerbSlot(int id, int mode) const;
|
||||||
void killVerb(int slot);
|
void killVerb(int slot);
|
||||||
void setVerbObject(uint room, uint object, uint verb);
|
void setVerbObject(uint room, uint object, uint verb);
|
||||||
|
|
||||||
|
@ -759,8 +757,8 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Should be in Actor class */
|
/* Should be in Actor class */
|
||||||
Actor *derefActor(int id, const char *errmsg = 0);
|
Actor *derefActor(int id, const char *errmsg = 0) const;
|
||||||
Actor *derefActorSafe(int id, const char *errmsg);
|
Actor *derefActorSafe(int id, const char *errmsg) const;
|
||||||
|
|
||||||
uint32 *_classData;
|
uint32 *_classData;
|
||||||
|
|
||||||
|
@ -776,7 +774,7 @@ protected:
|
||||||
void processUpperActors();
|
void processUpperActors();
|
||||||
int getActorFromPos(int x, int y);
|
int getActorFromPos(int x, int y);
|
||||||
|
|
||||||
bool isCostumeInUse(int i);
|
bool isCostumeInUse(int i) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Actor talking stuff */
|
/* Actor talking stuff */
|
||||||
|
|
|
@ -2115,7 +2115,7 @@ void Scumm::convertKeysToClicks() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor *Scumm::derefActor(int id, const char *errmsg) {
|
Actor *Scumm::derefActor(int id, const char *errmsg) const {
|
||||||
if (id < 1 || id >= _numActors || _actors[id].number != id) {
|
if (id < 1 || id >= _numActors || _actors[id].number != id) {
|
||||||
if (errmsg)
|
if (errmsg)
|
||||||
error("Invalid actor %d in %s", id, errmsg);
|
error("Invalid actor %d in %s", id, errmsg);
|
||||||
|
@ -2125,7 +2125,7 @@ Actor *Scumm::derefActor(int id, const char *errmsg) {
|
||||||
return &_actors[id];
|
return &_actors[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor *Scumm::derefActorSafe(int id, const char *errmsg) {
|
Actor *Scumm::derefActorSafe(int id, const char *errmsg) const {
|
||||||
if (id < 1 || id >= _numActors || _actors[id].number != id) {
|
if (id < 1 || id >= _numActors || _actors[id].number != id) {
|
||||||
debug(2, "Invalid actor %d in %s (script %d, opcode 0x%x) - This is potentially a BIG problem.",
|
debug(2, "Invalid actor %d in %s (script %d, opcode 0x%x) - This is potentially a BIG problem.",
|
||||||
id, errmsg, vm.slot[_curExecScript].number, _opcode);
|
id, errmsg, vm.slot[_curExecScript].number, _opcode);
|
||||||
|
|
|
@ -591,7 +591,7 @@ bool Sound::isMouthSyncOff(uint pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Sound::isSoundRunning(int sound) {
|
int Sound::isSoundRunning(int sound) const {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (sound == _current_cd_sound)
|
if (sound == _current_cd_sound)
|
||||||
|
@ -603,7 +603,7 @@ int Sound::isSoundRunning(int sound) {
|
||||||
} else if (sound == -1) {
|
} else if (sound == -1) {
|
||||||
// getSoundStatus(), with a -1, will return the
|
// getSoundStatus(), with a -1, will return the
|
||||||
// ID number of the first active music it finds.
|
// ID number of the first active music it finds.
|
||||||
return _scumm->_imuse->getSoundStatus (sound);
|
return _scumm->_imuse->getSoundStatus(sound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,7 +626,7 @@ int Sound::isSoundRunning(int sound) {
|
||||||
return _scumm->_imuse->getSoundStatus(sound);
|
return _scumm->_imuse->getSoundStatus(sound);
|
||||||
|
|
||||||
if (_scumm->_playerV2)
|
if (_scumm->_playerV2)
|
||||||
return _scumm->_playerV2->getSoundStatus (sound);
|
return _scumm->_playerV2->getSoundStatus(sound);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ int Sound::isSoundRunning(int sound) {
|
||||||
// calls IMuse::get_sound_active() instead of IMuse::getSoundStatus().
|
// calls IMuse::get_sound_active() instead of IMuse::getSoundStatus().
|
||||||
// This is necessary when determining what resources to
|
// This is necessary when determining what resources to
|
||||||
// expire from memory.
|
// expire from memory.
|
||||||
bool Sound::isSoundActive(int sound) {
|
bool Sound::isSoundActive(int sound) const {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (sound == _current_cd_sound)
|
if (sound == _current_cd_sound)
|
||||||
|
@ -662,7 +662,7 @@ bool Sound::isSoundActive(int sound) {
|
||||||
return _scumm->_imuse->get_sound_active(sound);
|
return _scumm->_imuse->get_sound_active(sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sound::isSoundInQueue(int sound) {
|
bool Sound::isSoundInQueue(int sound) const {
|
||||||
int i = 0, j, num;
|
int i = 0, j, num;
|
||||||
int16 table[16];
|
int16 table[16];
|
||||||
|
|
||||||
|
@ -961,7 +961,7 @@ void Sound::stopSfxSound() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sound::isSfxFinished() {
|
bool Sound::isSfxFinished() const {
|
||||||
return !_scumm->_mixer->hasActiveSFXChannel();
|
return !_scumm->_mixer->hasActiveSFXChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1454,7 +1454,7 @@ void Sound::stopCD() {
|
||||||
_scumm->_system->stop_cdrom();
|
_scumm->_system->stop_cdrom();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Sound::pollCD() {
|
int Sound::pollCD() const {
|
||||||
if (pollMP3CD())
|
if (pollMP3CD())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -1566,7 +1566,7 @@ int Sound::stopMP3CD() {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Sound::pollMP3CD() {
|
int Sound::pollMP3CD() const{
|
||||||
if (_dig_cd_playing == true)
|
if (_dig_cd_playing == true)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -118,9 +118,9 @@ public:
|
||||||
int startTalkSound(uint32 offset, uint32 b, int mode);
|
int startTalkSound(uint32 offset, uint32 b, int mode);
|
||||||
void stopTalkSound();
|
void stopTalkSound();
|
||||||
bool isMouthSyncOff(uint pos);
|
bool isMouthSyncOff(uint pos);
|
||||||
int isSoundRunning(int sound);
|
int isSoundRunning(int sound) const;
|
||||||
bool isSoundActive(int sound);
|
bool isSoundActive(int sound) const;
|
||||||
bool isSoundInQueue(int sound);
|
bool isSoundInQueue(int sound) const;
|
||||||
void stopSound(int a);
|
void stopSound(int a);
|
||||||
void stopAllSounds();
|
void stopAllSounds();
|
||||||
void soundKludge(int *list, int num);
|
void soundKludge(int *list, int num);
|
||||||
|
@ -141,7 +141,7 @@ public:
|
||||||
|
|
||||||
void playCDTrack(int track, int num_loops, int start, int delay);
|
void playCDTrack(int track, int num_loops, int start, int delay);
|
||||||
void stopCD();
|
void stopCD();
|
||||||
int pollCD();
|
int pollCD() const;
|
||||||
void updateCD();
|
void updateCD();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -150,7 +150,7 @@ protected:
|
||||||
File *openSfxFile();
|
File *openSfxFile();
|
||||||
int startSfxSound(File *file, int file_size);
|
int startSfxSound(File *file, int file_size);
|
||||||
void stopSfxSound();
|
void stopSfxSound();
|
||||||
bool isSfxFinished();
|
bool isSfxFinished() const;
|
||||||
int playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned);
|
int playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned);
|
||||||
int playSfxSound_MP3(void *sound, uint32 size);
|
int playSfxSound_MP3(void *sound, uint32 size);
|
||||||
int playSfxSound_Vorbis(void *sound, uint32 size);
|
int playSfxSound_Vorbis(void *sound, uint32 size);
|
||||||
|
@ -158,7 +158,7 @@ protected:
|
||||||
int getCachedTrack(int track);
|
int getCachedTrack(int track);
|
||||||
int playMP3CDTrack(int track, int num_loops, int start, int delay);
|
int playMP3CDTrack(int track, int num_loops, int start, int delay);
|
||||||
int stopMP3CD();
|
int stopMP3CD();
|
||||||
int pollMP3CD();
|
int pollMP3CD() const;
|
||||||
int updateMP3CD();
|
int updateMP3CD();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ void Scumm::verbMouseOver(int verb) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Scumm::checkMouseOver(int x, int y) {
|
int Scumm::checkMouseOver(int x, int y) const {
|
||||||
VerbSlot *vs;
|
VerbSlot *vs;
|
||||||
int i = _maxVerbs - 1;
|
int i = _maxVerbs - 1;
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ void Scumm::drawVerbBitmap(int verb, int x, int y) {
|
||||||
vs->alloctwobuffers = twobufs;
|
vs->alloctwobuffers = twobufs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Scumm::getVerbSlot(int id, int mode) {
|
int Scumm::getVerbSlot(int id, int mode) const {
|
||||||
int i;
|
int i;
|
||||||
for (i = 1; i < _maxVerbs; i++) {
|
for (i = 1; i < _maxVerbs; i++) {
|
||||||
if (_verbs[i].verbid == id && _verbs[i].saveid == mode) {
|
if (_verbs[i].verbid == id && _verbs[i].saveid == mode) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue