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);
|
||||
}
|
||||
|
||||
bool Scumm::isCostumeInUse(int cost) {
|
||||
bool Scumm::isCostumeInUse(int cost) const {
|
||||
int i;
|
||||
Actor *a;
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
#include "gui/message.h"
|
||||
#include "dialogs.h"
|
||||
|
||||
uint16 newTag2Old(uint32 oldTag);
|
||||
static uint16 newTag2Old(uint32 oldTag);
|
||||
static const char *resTypeFromId(int id);
|
||||
|
||||
/* Open a 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 */
|
||||
}
|
||||
|
||||
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]) {
|
||||
warning("%s Illegal Glob type %s (%d) num %d", str, resTypeFromId(type), type, idx);
|
||||
return false;
|
||||
|
@ -1509,8 +1510,7 @@ void Scumm::unlock(int type, int 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))
|
||||
return false;
|
||||
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))
|
||||
return false;
|
||||
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))
|
||||
return false;
|
||||
|
||||
|
@ -1792,99 +1792,71 @@ uint16 newTag2Old(uint32 oldTag) {
|
|||
switch (oldTag) {
|
||||
case (MKID('RMHD')):
|
||||
return (0x4448); // HD
|
||||
break;
|
||||
case (MKID('IM00')):
|
||||
return (0x4D42); // BM
|
||||
break;
|
||||
case (MKID('EXCD')):
|
||||
return (0x5845); // EX
|
||||
break;
|
||||
case (MKID('ENCD')):
|
||||
return (0x4E45); // EN
|
||||
break;
|
||||
case (MKID('SCAL')):
|
||||
return (0x4153); // SA
|
||||
break;
|
||||
case (MKID('LSCR')):
|
||||
return (0x534C); // LS
|
||||
break;
|
||||
case (MKID('OBCD')):
|
||||
return (0x434F); // OC
|
||||
break;
|
||||
case (MKID('OBIM')):
|
||||
return (0x494F); // OI
|
||||
break;
|
||||
case (MKID('SMAP')):
|
||||
return (0x4D42); // BM
|
||||
break;
|
||||
case (MKID('CLUT')):
|
||||
return (0x4150); // PA
|
||||
break;
|
||||
case (MKID('BOXD')):
|
||||
return (0x5842); // BX
|
||||
break;
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
char *Scumm::resTypeFromId(int id) {
|
||||
const char *resTypeFromId(int id) {
|
||||
static char buf[100];
|
||||
|
||||
switch (id) {
|
||||
case rtRoom:
|
||||
sprintf(buf, "Room");
|
||||
break;
|
||||
return "Room";
|
||||
case rtScript:
|
||||
sprintf(buf, "Script");
|
||||
break;
|
||||
return "Script";
|
||||
case rtCostume:
|
||||
sprintf(buf, "Costume");
|
||||
break;
|
||||
return "Costume";
|
||||
case rtSound:
|
||||
sprintf(buf, "Sound");
|
||||
break;
|
||||
return "Sound";
|
||||
case rtInventory:
|
||||
sprintf(buf, "Inventory");
|
||||
break;
|
||||
return "Inventory";
|
||||
case rtCharset:
|
||||
sprintf(buf, "Charset");
|
||||
break;
|
||||
return "Charset";
|
||||
case rtString:
|
||||
sprintf(buf, "String");
|
||||
break;
|
||||
return "String";
|
||||
case rtVerb:
|
||||
sprintf(buf, "Verb");
|
||||
break;
|
||||
return "Verb";
|
||||
case rtActorName:
|
||||
sprintf(buf, "ActorName");
|
||||
break;
|
||||
return "ActorName";
|
||||
case rtBuffer:
|
||||
sprintf(buf, "Buffer");
|
||||
break;
|
||||
return "Buffer";
|
||||
case rtScaleTable:
|
||||
sprintf(buf, "ScaleTable");
|
||||
break;
|
||||
return "ScaleTable";
|
||||
case rtTemp:
|
||||
sprintf(buf, "Temp");
|
||||
break;
|
||||
return "Temp";
|
||||
case rtFlObject:
|
||||
sprintf(buf, "FlObject");
|
||||
break;
|
||||
return "FlObject";
|
||||
case rtMatrix:
|
||||
sprintf(buf, "Matrix");
|
||||
break;
|
||||
return "Matrix";
|
||||
case rtBox:
|
||||
sprintf(buf, "Box");
|
||||
break;
|
||||
return "Box";
|
||||
case rtLast:
|
||||
sprintf(buf, "Last");
|
||||
break;
|
||||
return "Last";
|
||||
case rtNumTypes:
|
||||
sprintf(buf, "NumTypes");
|
||||
break;
|
||||
return "NumTypes";
|
||||
default:
|
||||
sprintf(buf, "%d", id);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -342,7 +342,6 @@ public:
|
|||
// Startup functions
|
||||
void main();
|
||||
void parseCommandLine(int argc, char **argv);
|
||||
void showHelpAndExit();
|
||||
bool detectGame();
|
||||
void launch();
|
||||
void go();
|
||||
|
@ -619,15 +618,14 @@ protected:
|
|||
|
||||
void loadPtrToResource(int type, int i, const byte *ptr);
|
||||
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);
|
||||
byte *createResource(int type, int index, uint32 size);
|
||||
int loadResource(int type, int i);
|
||||
void nukeResource(int type, int i);
|
||||
|
||||
public:
|
||||
bool isGlobInMemory(int type, int index);
|
||||
bool isResourceLoaded(int type, int index);
|
||||
bool isGlobInMemory(int type, int index) const;
|
||||
bool isResourceLoaded(int type, int index) const;
|
||||
byte *getResourceAddress(int type, int i);
|
||||
byte *getStringAddress(int i);
|
||||
byte *getStringAddressVar(int i);
|
||||
|
@ -638,9 +636,9 @@ protected:
|
|||
int readSoundResource(int type, int index);
|
||||
int readSoundResourceSmallHeader(int type, int index);
|
||||
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();
|
||||
bool isResourceInUse(int type, int i);
|
||||
bool isResourceInUse(int type, int i) const;
|
||||
void initRoomSubBlocks();
|
||||
void clearRoomObjects();
|
||||
void loadRoomObjects();
|
||||
|
@ -738,12 +736,12 @@ protected:
|
|||
void redrawVerbs();
|
||||
void checkExecVerbs();
|
||||
void verbMouseOver(int verb);
|
||||
int checkMouseOver(int x, int y);
|
||||
int checkMouseOver(int x, int y) const;
|
||||
void drawVerb(int verb, int mode);
|
||||
void runInputScript(int a, int cmd, int mode);
|
||||
void restoreVerbBG(int verb);
|
||||
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 setVerbObject(uint room, uint object, uint verb);
|
||||
|
||||
|
@ -759,8 +757,8 @@ protected:
|
|||
|
||||
public:
|
||||
/* Should be in Actor class */
|
||||
Actor *derefActor(int id, const char *errmsg = 0);
|
||||
Actor *derefActorSafe(int id, const char *errmsg);
|
||||
Actor *derefActor(int id, const char *errmsg = 0) const;
|
||||
Actor *derefActorSafe(int id, const char *errmsg) const;
|
||||
|
||||
uint32 *_classData;
|
||||
|
||||
|
@ -776,7 +774,7 @@ protected:
|
|||
void processUpperActors();
|
||||
int getActorFromPos(int x, int y);
|
||||
|
||||
bool isCostumeInUse(int i);
|
||||
bool isCostumeInUse(int i) const;
|
||||
|
||||
public:
|
||||
/* 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 (errmsg)
|
||||
error("Invalid actor %d in %s", id, errmsg);
|
||||
|
@ -2125,7 +2125,7 @@ Actor *Scumm::derefActor(int id, const char *errmsg) {
|
|||
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) {
|
||||
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);
|
||||
|
|
|
@ -591,7 +591,7 @@ bool Sound::isMouthSyncOff(uint pos) {
|
|||
}
|
||||
|
||||
|
||||
int Sound::isSoundRunning(int sound) {
|
||||
int Sound::isSoundRunning(int sound) const {
|
||||
int i;
|
||||
|
||||
if (sound == _current_cd_sound)
|
||||
|
@ -635,7 +635,7 @@ int Sound::isSoundRunning(int sound) {
|
|||
// calls IMuse::get_sound_active() instead of IMuse::getSoundStatus().
|
||||
// This is necessary when determining what resources to
|
||||
// expire from memory.
|
||||
bool Sound::isSoundActive(int sound) {
|
||||
bool Sound::isSoundActive(int sound) const {
|
||||
int i;
|
||||
|
||||
if (sound == _current_cd_sound)
|
||||
|
@ -662,7 +662,7 @@ bool Sound::isSoundActive(int sound) {
|
|||
return _scumm->_imuse->get_sound_active(sound);
|
||||
}
|
||||
|
||||
bool Sound::isSoundInQueue(int sound) {
|
||||
bool Sound::isSoundInQueue(int sound) const {
|
||||
int i = 0, j, num;
|
||||
int16 table[16];
|
||||
|
||||
|
@ -961,7 +961,7 @@ void Sound::stopSfxSound() {
|
|||
}
|
||||
}
|
||||
|
||||
bool Sound::isSfxFinished() {
|
||||
bool Sound::isSfxFinished() const {
|
||||
return !_scumm->_mixer->hasActiveSFXChannel();
|
||||
}
|
||||
|
||||
|
@ -1454,7 +1454,7 @@ void Sound::stopCD() {
|
|||
_scumm->_system->stop_cdrom();
|
||||
}
|
||||
|
||||
int Sound::pollCD() {
|
||||
int Sound::pollCD() const {
|
||||
if (pollMP3CD())
|
||||
return 1;
|
||||
|
||||
|
@ -1566,7 +1566,7 @@ int Sound::stopMP3CD() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
int Sound::pollMP3CD() {
|
||||
int Sound::pollMP3CD() const{
|
||||
if (_dig_cd_playing == true)
|
||||
return 1;
|
||||
return 0;
|
||||
|
|
|
@ -118,9 +118,9 @@ public:
|
|||
int startTalkSound(uint32 offset, uint32 b, int mode);
|
||||
void stopTalkSound();
|
||||
bool isMouthSyncOff(uint pos);
|
||||
int isSoundRunning(int sound);
|
||||
bool isSoundActive(int sound);
|
||||
bool isSoundInQueue(int sound);
|
||||
int isSoundRunning(int sound) const;
|
||||
bool isSoundActive(int sound) const;
|
||||
bool isSoundInQueue(int sound) const;
|
||||
void stopSound(int a);
|
||||
void stopAllSounds();
|
||||
void soundKludge(int *list, int num);
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
|
||||
void playCDTrack(int track, int num_loops, int start, int delay);
|
||||
void stopCD();
|
||||
int pollCD();
|
||||
int pollCD() const;
|
||||
void updateCD();
|
||||
|
||||
protected:
|
||||
|
@ -150,7 +150,7 @@ protected:
|
|||
File *openSfxFile();
|
||||
int startSfxSound(File *file, int file_size);
|
||||
void stopSfxSound();
|
||||
bool isSfxFinished();
|
||||
bool isSfxFinished() const;
|
||||
int playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned);
|
||||
int playSfxSound_MP3(void *sound, uint32 size);
|
||||
int playSfxSound_Vorbis(void *sound, uint32 size);
|
||||
|
@ -158,7 +158,7 @@ protected:
|
|||
int getCachedTrack(int track);
|
||||
int playMP3CDTrack(int track, int num_loops, int start, int delay);
|
||||
int stopMP3CD();
|
||||
int pollMP3CD();
|
||||
int pollMP3CD() const;
|
||||
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;
|
||||
int i = _maxVerbs - 1;
|
||||
|
||||
|
@ -505,7 +505,7 @@ void Scumm::drawVerbBitmap(int verb, int x, int y) {
|
|||
vs->alloctwobuffers = twobufs;
|
||||
}
|
||||
|
||||
int Scumm::getVerbSlot(int id, int mode) {
|
||||
int Scumm::getVerbSlot(int id, int mode) const {
|
||||
int i;
|
||||
for (i = 1; i < _maxVerbs; i++) {
|
||||
if (_verbs[i].verbid == id && _verbs[i].saveid == mode) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue