rename debugLevel to gDebugLevel

This commit is contained in:
Pawel Kolodziejski 2009-05-17 08:33:52 +00:00
parent d142aa4196
commit 390381c8aa
21 changed files with 114 additions and 114 deletions

View File

@ -90,7 +90,7 @@ void debug(const char *s, ...) {
void debug(int level, const char *s, ...) {
va_list va;
if (level > debugLevel)
if (level > gDebugLevel)
return;
va_start(va, s);

View File

@ -46,7 +46,7 @@ enum enDebugLevels {
DEBUG_CHORES,
DEBUG_ALL
};
extern enDebugLevels debugLevel;
extern enDebugLevels gDebugLevel;
extern const char *debug_levels[];
extern const char *debug_descriptions[];

View File

@ -456,11 +456,11 @@ void Actor::popCostume() {
else
newCost = _costumeStack.back();
if (!newCost) {
if (debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("Popped (freed) the last costume for an actor.\n");
}
} else {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Attempted to pop (free) a costume when the stack is empty!");
}
}

View File

@ -34,7 +34,7 @@ Bitmap::Bitmap(const char *filename, const char *data, int len) :
Resource(filename) {
if (len < 8 || memcmp(data, "BM F\0\0\0", 8) != 0) {
if (debugLevel == DEBUG_BITMAPS || debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("Invalid magic loading bitmap");
}
@ -84,7 +84,7 @@ Bitmap::Bitmap(const char *filename, const char *data, int len) :
Bitmap::Bitmap(const char *data, int width, int height, const char *filename) :
Resource(filename) {
if (debugLevel == DEBUG_BITMAPS || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("New bitmap loaded: %s\n", filename);
strcpy(_filename, filename);
_currImage = 1;

View File

@ -187,14 +187,14 @@ void BitmapComponent::setKey(int val) {
// bitmaps were not loading with the scene. This was because they were requested
// as a different case then they were stored (tu_0_dorcu_door_open versus
// TU_0_DORCU_door_open), which was causing problems in the string comparison.
if (debugLevel == DEBUG_BITMAPS || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Missing scene bitmap: %s", bitmap);
/* In case you feel like drawing the missing bitmap anyway...
// Assume that all objects the scene file forgot about are OBJSTATE_STATE class
state = new ObjectState(0, ObjectState::OBJSTATE_STATE, bitmap, NULL, true);
if (!state) {
if (debugLevel == DEBUG_BITMAPS || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Couldn't find bitmap %s in current scene", _filename.c_str());
return;
}
@ -236,7 +236,7 @@ void ModelComponent::init() {
// Get the default colormap if we haven't found
// a valid colormap
if (!cmap) {
if (debugLevel == DEBUG_MODEL || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("No colormap specified for %s, using %s", _filename.c_str(), DEFAULT_COLORMAP);
cmap = g_resourceloader->loadColormap(DEFAULT_COLORMAP);
@ -258,7 +258,7 @@ void ModelComponent::init() {
if (mc)
mc->node()->addChild(_hier);
else if (debugLevel == DEBUG_MODEL || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
else if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Parent of model %s wasn't a mesh", _filename.c_str());
}
}
@ -437,7 +437,7 @@ void KeyframeComponent::setKey(int val) {
_active = false;
break;
default:
if (debugLevel == DEBUG_MODEL || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Unknown key %d for keyframe %s", val, _keyf->filename());
}
}
@ -472,7 +472,7 @@ void KeyframeComponent::update() {
_currTime = animLength;
break;
default:
if (debugLevel == DEBUG_MODEL || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Unknown repeat mode %d for keyframe %s", _repeatMode, _keyf->filename());
}
}
@ -484,7 +484,7 @@ void KeyframeComponent::init() {
if (mc)
_hier = mc->hierarchy();
else {
if (debugLevel == DEBUG_MODEL || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Parent of %s was not a model", _keyf->filename());
_hier = NULL;
}
@ -502,7 +502,7 @@ void MeshComponent::init() {
if (mc)
_node = mc->hierarchy() + _num;
else {
if (debugLevel == DEBUG_MODEL || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Parent of mesh %d was not a model", _num);
_node = NULL;
}
@ -525,7 +525,7 @@ MaterialComponent::MaterialComponent(Costume::Component *parent, int parentID, c
Costume::Component(parent, parentID, tag), _filename(filename),
_num(0) {
if (debugLevel == DEBUG_MODEL || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Constructing MaterialComponent %s", filename);
}
@ -534,7 +534,7 @@ void MaterialComponent::init() {
if (!cmap) {
// Use the default colormap if we're still drawing a blank
if (debugLevel == DEBUG_MODEL || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("MaterialComponent::init on %s", _filename.c_str());
cmap = g_resourceloader->loadColormap(DEFAULT_COLORMAP);
@ -615,7 +615,7 @@ void SoundComponent::setKey(int val) {
g_imuse->setHookId(_soundName.c_str(), 0x80);
break;
default:
if (debugLevel == DEBUG_MODEL || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Unknown key %d for sound %s", val, _soundName.c_str());
}
}
@ -700,7 +700,7 @@ Costume::Costume(const char *filename, const char *data, int len, Costume *prevC
_chores[id]._length = length;
_chores[id]._numTracks = tracks;
memcpy(_chores[id]._name, name, 32);
if (debugLevel == DEBUG_ALL || debugLevel == DEBUG_CHORES)
if (gDebugLevel == DEBUG_ALL || gDebugLevel == DEBUG_CHORES)
printf("Loaded chore: %s\n", name);
}
@ -928,7 +928,7 @@ Model::HierNode *Costume::getModelNodes()
void Costume::playChoreLooping(int num) {
if (num < 0 || num >= _numChores) {
if (debugLevel == DEBUG_CHORES || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Requested chore number %d is outside the range of chores (0-%d)!", num, _numChores);
return;
}
@ -937,7 +937,7 @@ void Costume::playChoreLooping(int num) {
void Costume::playChore(int num) {
if (num < 0 || num >= _numChores) {
if (debugLevel == DEBUG_CHORES || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Requested chore number %d is outside the range of chores (0-%d)!", num, _numChores);
return;
}

View File

@ -805,7 +805,7 @@ void GrimEngine::setSceneLock(const char *name, bool lockStatus) {
Scene *scene = findScene(name);
if (!scene) {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Scene object '%s' not found in list!", name);
return;
}

View File

@ -99,7 +99,7 @@ uint16 Font::getCharIndex(unsigned char c) {
if (_charIndex[i] == c2)
return i;
}
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("The requsted character (code 0x%x) does not correspond to anything in the font data!", c2);
// If we couldn't find the character then default to
// the first character in the font so that something

View File

@ -319,7 +319,7 @@ void Imuse::switchToNextRegion(Track *track) {
assert(track);
if (track->trackId >= MAX_IMUSE_TRACKS) {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::switchToNextRegion(): fadeTrack end: soundName:%s\n", track->soundName);
flushTrack(track);
return;
@ -328,7 +328,7 @@ void Imuse::switchToNextRegion(Track *track) {
int numRegions = _sound->getNumRegions(track->soundDesc);
if (++track->curRegion == numRegions) {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::switchToNextRegion(): end of tracks: soundName:%s\n", track->soundName);
flushTrack(track);
return;
@ -339,7 +339,7 @@ void Imuse::switchToNextRegion(Track *track) {
if (jumpId == -1)
jumpId = _sound->getJumpIdByRegionAndHookId(soundDesc, track->curRegion, 0);
if (jumpId != -1) {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::switchToNextRegion(): JUMP: soundName:%s\n", track->soundName);
int region = _sound->getRegionIdByJumpId(soundDesc, jumpId);
assert(region != -1);
@ -362,7 +362,7 @@ void Imuse::switchToNextRegion(Track *track) {
track->curHookId = 0;
}
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::switchToNextRegion(): REGION %d: soundName:%s\n", (int)track->curRegion, track->soundName);
track->dataOffset = _sound->getRegionOffset(soundDesc, track->curRegion);
track->regionOffset = 0;

View File

@ -40,7 +40,7 @@ void Imuse::setMusicState(int stateId) {
}
assert(num != -1);
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::setMusicState(): SoundId %d, filename: %s\n", _stateMusicTable[l].soundId, _stateMusicTable[l].filename);
if (_curMusicState == num)
@ -71,7 +71,7 @@ int Imuse::setMusicSequence(int seqId) {
assert(num != -1);
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::setMusicSequence(): SoundId %d, filename: %s\n", _seqMusicTable[l].soundId, _seqMusicTable[l].filename);
if (_curMusicSeq == num)

View File

@ -73,25 +73,25 @@ void Imuse::refreshScripts() {
}
void Imuse::startVoice(const char *soundName, int volume, int pan) {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::startVoice(): SoundName %s, vol:%d, pan:%d\n", soundName, volume, pan);
startSound(soundName, IMUSE_VOLGRP_VOICE, 0, volume, pan, 127, NULL);
}
void Imuse::startMusic(const char *soundName, int hookId, int volume, int pan) {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::startMusic(): SoundName %s, hookId:%d, vol:%d, pan:%d\n", soundName, hookId, volume, pan);
startSound(soundName, IMUSE_VOLGRP_MUSIC, hookId, volume, pan, 126, NULL);
}
void Imuse::startMusicWithOtherPos(const char *soundName, int hookId, int volume, int pan, Track *otherTrack) {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::startMusicWithOtherPos(): SoundName %s, hookId:%d, vol:%d, pan:%d\n", soundName, hookId, volume, pan);
startSound(soundName, IMUSE_VOLGRP_MUSIC, hookId, volume, pan, 126, otherTrack);
}
void Imuse::startSfx(const char *soundName, int priority) {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::startSfx(): SoundName %s, priority:%d\n", soundName, priority);
startSound(soundName, IMUSE_VOLGRP_SFX, 0, 127, 0, priority, NULL);
}
@ -103,7 +103,7 @@ int32 Imuse::getPosIn60HzTicks(const char *soundName) {
getTrack = findTrack(soundName);
// Warn the user if the track was not found
if (getTrack == NULL) {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Sound '%s' could not be found to get ticks!", soundName);
return false;
}
@ -138,7 +138,7 @@ bool Imuse::getSoundStatus(const char *soundName) {
if (track == NULL || !g_system->getMixer()->isSoundHandleActive(track->handle)) {
// This debug warning should be "light" since this function gets called
// on occassion to see if a sound has stopped yet
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("Sound '%s' could not be found to get status, assume inactive.\n", soundName);
return false;
}
@ -147,14 +147,14 @@ bool Imuse::getSoundStatus(const char *soundName) {
void Imuse::stopSound(const char *soundName) {
Common::StackLock lock(_mutex);
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::stopSound(): SoundName %s\n", soundName);
Track *removeTrack = NULL;
removeTrack = findTrack(soundName);
// Warn the user if the track was not found
if (removeTrack == NULL) {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Sound track '%s' could not be found to stop!", soundName);
return;
}
@ -163,7 +163,7 @@ void Imuse::stopSound(const char *soundName) {
void Imuse::stopAllSounds() {
Common::StackLock lock(_mutex);
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::stopAllSounds()\n");
for (int l = 0; l < MAX_IMUSE_TRACKS + MAX_IMUSE_FADETRACKS; l++) {

View File

@ -78,7 +78,7 @@ bool Imuse::startSound(const char *soundName, int volGroupId, int hookId, int vo
for (i = 0; i < MAX_IMUSE_TRACKS + MAX_IMUSE_FADETRACKS; i++) {
// Filenames are case insensitive, see findTrack
if (!strcasecmp(_track[i]->soundName, soundName)) {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("Imuse::startSound(): Track '%s' already playing.\n", soundName);
return true;
}

View File

@ -42,7 +42,7 @@ KeyframeAnim::KeyframeAnim(const char *filename, const char *data, int len) :
void KeyframeAnim::loadBinary(const char *data, int len) {
// First four bytes are the FYEK Keyframe identifier code
// Next 36 bytes are the filename
if (debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL) {
if (gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL) {
char filebuf[37];
memcpy(filebuf, data + 4, 36);
@ -90,7 +90,7 @@ void KeyframeAnim::loadBinary(const char *data, int len) {
// else is still wrong but it should now load correctly in
// all cases
if (nodeNum >= _numJoints) {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL) {
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL) {
warning("A node number was greater than the maximum number of nodes (%d/%d)", nodeNum, _numJoints);
}
return;

View File

@ -191,11 +191,11 @@ static Costume *get_costume(Actor *a, int param, const char *called_from) {
Costume *result;
if (lua_isnil(lua_getparam(param))) {
result = a->currentCostume();
if (!result && (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL))
if (!result && (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL))
warning("Actor %s has no costume [%s]", a->name(), called_from);
} else {
result = a->findCostume(luaL_check_string(param));
if (!result && (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL))
if (!result && (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL))
warning("Actor %s has no costume %s [%s]", a->name(), lua_getstring(lua_getparam(param)), called_from);
}
return result;
@ -212,7 +212,7 @@ static void new_dofile() {
static void PrintDebug() {
DEBUG_FUNCTION();
if (debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL) {
if (gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL) {
Common::String msg("Debug: ");
msg += Common::String(luaL_check_string(1)) + "\n";
printf(msg.c_str());
@ -221,7 +221,7 @@ static void PrintDebug() {
static void PrintError() {
DEBUG_FUNCTION();
if (debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL) {
if (gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL) {
Common::String msg("Error: ");
msg += Common::String(luaL_check_string(1)) + "\n";
printf(msg.c_str());
@ -230,7 +230,7 @@ static void PrintError() {
static void PrintWarning() {
DEBUG_FUNCTION();
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL) {
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL) {
Common::String msg("Warning: ");
msg += Common::String(luaL_check_string(1)) + "\n";
printf(msg.c_str());
@ -461,12 +461,12 @@ static void SetActorWalkChore() {
chore = check_int(2);
costume = get_costume(act, 3, "SetActorWalkChore");
if (!costume) {
if (debugLevel == DEBUG_CHORES || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("SetActorWalkChore() could not find the requested costume, attempting to load...");
act->pushCostume(lua_getstring(lua_getparam(3)));
costume = get_costume(act, 3, "SetActorWalkChore");
if (!costume) {
if (debugLevel == DEBUG_CHORES || debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("SetActorWalkChore() could not find the requested costume!");
return;
}
@ -608,7 +608,7 @@ static void GetActorYawToPoint() {
} else if (lua_istable(param2)) {
yawVector = tableToVector(param2);
} else {
if (debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("Unhandled data type for GetActorYawToPoint!");
lua_pushnil();
return;
@ -800,7 +800,7 @@ static void GetActorNodeLocation() {
lua_pushnil();
lua_pushnil();
lua_pushnil();
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("GetActorNodeLocation() when actor has no costume (which means no nodes)!");
return;
}
@ -809,7 +809,7 @@ static void GetActorNodeLocation() {
lua_pushnil();
lua_pushnil();
lua_pushnil();
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("GetActorNodeLocation() when actor has no nodes!");
return;
}
@ -907,7 +907,7 @@ static void GetActorCostume() {
c = act->currentCostume();
if (!c) {
lua_pushnil();
if (debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("GetActorCostume() on '%s' when actor has no costume!", act->name());
return;
}
@ -940,7 +940,7 @@ static void PlayActorChore() {
num = check_int(2);
cost = get_costume(act, 3, "playActorChore");
if (!cost) {
if (debugLevel == DEBUG_CHORES || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Actor costume not found, unable to perform chore.");
return;
}
@ -967,7 +967,7 @@ static void CompleteActorChore() {
num = check_int(2);
cost = get_costume(act, 3, "completeActorChore");
if (!cost) {
if (debugLevel == DEBUG_CHORES || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Actor costume not found, unable to perform chore.");
return;
}
@ -1051,7 +1051,7 @@ static void IsActorChoring() {
else if (lua_isstring(param2))
result = cost->isChoring(lua_getstring(param2), excludeLooping);
else {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("IsActorChoring: LUA Parameter 2 is of unhandled type!");
}
@ -1077,7 +1077,7 @@ static void ActorLookAt() {
// Look at nothing
if (lua_isnil(x)) {
if (act->isLookAtVectorZero()) {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Actor requested to look at nothing, already looking at nothing!");
return;
}
@ -1114,7 +1114,7 @@ static void ActorLookAt() {
if (lua_isnumber(y))
rate = luaL_check_number(3);
} else {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("ActorLookAt: Don't know what to look at!");
return;
}
@ -1153,7 +1153,7 @@ static void TurnActorTo() {
y = destActor->pos().y();
z = destActor->pos().z();
} else {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("TurnActorTo() parameter type not understood");
return;
}
@ -1264,7 +1264,7 @@ static void RotateVector() {
lua_pushnumber(vec2.z());
lua_settable();
} else {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("RotateVector() parameter type not understood!");
// This will likely cause a crash since LUA is expecting
// a table out of this function
@ -1292,7 +1292,7 @@ static void SetActorPitch() {
act->setRot(pitch, act->yaw(), act->roll());
} else {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("SetActorPitch() parameter type not understood!");
return;
}
@ -1350,7 +1350,7 @@ static void SetActorFollowBoxes() {
DEBUG_FUNCTION();
act = check_actor(1);
mode = !lua_isnil(lua_getparam(2));
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("SetActorFollowBoxes() not implemented");
// that is not walkbox walking, but temporary hack
// act->enableWalkbox(mode);
@ -1627,7 +1627,7 @@ static void SayLine() {
paramObj = lua_getparam(paramId++);
} while (!lua_isnil(paramObj));
if (msg.empty()) {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("SayLine: Did not find a message ID!");
stubWarning("ERROR: SayLine");
return;
@ -1693,7 +1693,7 @@ static void GetPointSector() {
result = NULL;
}
if (!result) {
if (debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("GetPointSector() passed an unhandled type or failed to find any matching sector!");
lua_pushnil();
lua_pushnil();
@ -1758,7 +1758,7 @@ static void MakeSectorActive() {
sectorName = lua_getparam(1);
visible = !lua_isnil(lua_getparam(2));
// FIXME: This happens on initial load. Are we initting something in the wrong order?
if (!g_grim->currScene() && (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)) {
if (!g_grim->currScene() && (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)) {
warning("!!!! Trying to call MakeSectorActive without a scene!");
return;
}
@ -1788,7 +1788,7 @@ static void MakeSectorActive() {
return;
}
}
} else if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL){
} else if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL){
warning("MakeSectorActive Parameter is not a sector ID or Name");
return;
} else
@ -1819,7 +1819,7 @@ static void MakeCurrentSet() {
DEBUG_FUNCTION();
name = luaL_check_string(1);
if (debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("Entered new scene '%s'.\n", name);
g_grim->setScene(name);
}
@ -1864,7 +1864,7 @@ static void GetCurrentSetup() {
name = luaL_check_string(1);
scene = g_grim->findScene(name);
if (!scene) {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("GetCurrentSetup() Requested scene (%s) is not loaded!", name);
lua_pushnil();
return;
@ -1884,7 +1884,7 @@ static void GetShrinkPos() {
lua_pushnumber(x);
lua_pushnumber(y);
lua_pushnumber(z);
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Stub function GetShrinkPos(%g,%g,%g,%g) called", x, y, z, r);
}
@ -1914,10 +1914,10 @@ static void ImStartSound() {
} else {
// Allow soft failing when loading sounds, hard failing when not
if (priority == 127) {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("ImStartSound failed to load '%s'", soundName);
} else {
if (debugLevel == DEBUG_IMUSE || debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("ImStartSound failed to start '%s'", soundName);
}
lua_pushnil();
@ -1952,7 +1952,7 @@ static void ImSetVoiceEffect() {
DEBUG_FUNCTION();
effectName = luaL_check_string(1);
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("ImSetVoiceEffect(%s) Voice effects are not yet supported", effectName);
}
@ -2003,7 +2003,7 @@ static void ImSetParam() {
break;
default:
lua_pushnil();
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("ImSetParam() Unimplemented %d, %d", param, value);
}
}
@ -2024,7 +2024,7 @@ void ImGetParam() {
break;
default:
lua_pushnil();
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("ImGetParam() Unimplemented %d", param);
}
}
@ -2344,7 +2344,7 @@ static void KillTextObject() {
DEBUG_FUNCTION();
if (lua_isnil(lua_getparam(1))) {
if (debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("KillTextObject(NULL)");
return;
}
@ -2685,7 +2685,7 @@ static void ChangePrimitive() {
if (!pmodify) {
// When Manny exists Don's computer (using ESC) the primitive objects
// are destroyed just before the last call to change them
if (debugLevel == DEBUG_WARN)
if (gDebugLevel == DEBUG_WARN)
warning("Primitive object not found.");
return;
}
@ -3016,7 +3016,7 @@ static void Load() {
} else if (lua_isstring(fileName)) {
g_grim->_savegameFileName = lua_getstring(fileName);
} else {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Load() fileName is wrong");
return;
}
@ -3033,7 +3033,7 @@ static void Save() {
} else if (lua_isstring(fileName)) {
g_grim->_savegameFileName = lua_getstring(fileName);
} else {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Save() fileName is wrong");
return;
}
@ -3150,19 +3150,19 @@ static void ForceRefresh() {
static void JustLoaded() {
DEBUG_FUNCTION();
if (debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("OPCODE USAGE VERIFICATION: JustLoaded");
}
static void PlaySound() {
DEBUG_FUNCTION();
if (debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("OPCODE USAGE VERIFICATION: PlaySound");
}
static void SetEmergencyFont() {
DEBUG_FUNCTION();
if (debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("OPCODE USAGE VERIFICATION: SetEmergencyFont");
}
@ -3185,7 +3185,7 @@ static void debugFunction(const char *debugMessage, const char *funcName) {
bool stubFn = strcmp(debugMessage, "WARNING: Stub function") == 0;
FILE *output;
if (!stubFn && debugLevel != DEBUG_FUNC && debugLevel != DEBUG_ALL)
if (!stubFn && gDebugLevel != DEBUG_FUNC && gDebugLevel != DEBUG_ALL)
return;
if (stubFn)
@ -3229,7 +3229,7 @@ static void debugFunction(const char *debugMessage, const char *funcName) {
// Stub function for builtin functions not yet implemented
static void stubWarning(const char *funcName) {
// If the user doesn't want these debug messages then don't print them
if (debugLevel != DEBUG_WARN && debugLevel != DEBUG_STUB && debugLevel != DEBUG_FUNC && debugLevel != DEBUG_ALL)
if (gDebugLevel != DEBUG_WARN && gDebugLevel != DEBUG_STUB && gDebugLevel != DEBUG_FUNC && gDebugLevel != DEBUG_ALL)
return;
debugFunction("WARNING: Stub function", funcName);
@ -3818,7 +3818,7 @@ int bundle_dofile(const char *filename) {
delete b;
// Don't print warnings on Scripts\foo.lua,
// d:\grimFandango\Scripts\foo.lua
if (!strstr(filename, "Scripts\\") && (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL))
if (!strstr(filename, "Scripts\\") && (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL))
warning("Cannot find script %s", filename);
return 2;
@ -3847,7 +3847,7 @@ lua_Object getTableFunction(lua_Object table, const char *name) {
}
if (!lua_isfunction(handler)) {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Invalid event handler %s", name);
return LUA_NOOBJECT;
}

View File

@ -43,7 +43,7 @@
// Hacky global toggles for experimental/debug code
bool SHOWFPS_GLOBAL, TINYGL_GLOBAL;
enDebugLevels debugLevel = DEBUG_NONE;
enDebugLevels gDebugLevel = DEBUG_NONE;
static bool g_lua_initialized = false;
GfxBase *g_driver = NULL;
@ -83,11 +83,11 @@ extern "C" int residual_main(int argc, char *argv[]) {
// soonest possible moment to ensure debug output starts early on, if
// requested.
if (settings.contains("debuglevel")) {
debugLevel = (enDebugLevels)strtol(settings["debuglevel"].c_str(), 0, 10);
printf("Debuglevel (from command line): %d\n", debugLevel);
gDebugLevel = (enDebugLevels)strtol(settings["debuglevel"].c_str(), 0, 10);
printf("Debuglevel (from command line): %d\n", gDebugLevel);
settings.erase("debuglevel"); // This option should not be passed to ConfMan.
} else if (ConfMan.hasKey("debuglevel"))
debugLevel = (enDebugLevels)ConfMan.getInt("debuglevel");
gDebugLevel = (enDebugLevels)ConfMan.getInt("debuglevel");
if (settings.contains("debugflags")) {
specialDebug = settings["debugflags"];

View File

@ -39,7 +39,7 @@ Material::Material(const char *filename, const char *data, int len, const CMap &
_height = READ_LE_UINT32(data + 80 + _numImages * 40);
if (_width == 0 || _height == 0) {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("skip load texture: bad texture size (%dx%d) for texture %s", _width, _height, filename);
return;
}

View File

@ -330,7 +330,7 @@ void Model::loadText(TextSplitter &ts, const CMap &cmap) {
_rootHierNode[num]._totalWeight = 1;
}
if (!ts.eof() && (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL))
if (!ts.eof() && (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL))
warning("Unexpected junk at end of model text");
}
@ -361,7 +361,7 @@ void Model::Mesh::loadText(TextSplitter &ts, ResPtr<Material> *materials) {
// In data001/rope_scale.3do, the shadow line is missing
if (sscanf(ts.currentLine(), "shadow %d", &_shadow) < 1) {
_shadow = 0;
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Missing shadow directive in model");
} else
ts.nextLine();

View File

@ -172,7 +172,7 @@ Bitmap *ResourceLoader::loadBitmap(const char *filename) {
Block *b = getFileBlock(filename);
if (!b) { // Grim sometimes asks for non-existant bitmaps (eg, ha_overhead)
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Could not find bitmap %s", filename);
return NULL;
}
@ -270,7 +270,7 @@ LipSync *ResourceLoader::loadLipSync(const char *filename) {
Block *b = getFileBlock(filename);
if (!b) {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("Could not find lipsync file %s", filename);
result = NULL;
} else {

View File

@ -120,10 +120,10 @@ void Scene::Setup::load(TextSplitter &ts) {
ts.scanString(" background %256s", 1, buf);
_bkgndBm = g_resourceloader->loadBitmap(buf);
if (!_bkgndBm) {
if (debugLevel == DEBUG_BITMAPS || debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
printf("Unable to load scene bitmap: %s\n", buf);
} else {
if (debugLevel == DEBUG_BITMAPS || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("Loaded scene bitmap: %s\n", buf);
}
@ -135,7 +135,7 @@ void Scene::Setup::load(TextSplitter &ts) {
// Don't even try to load if it's the "none" bitmap
if (strcmp(buf, "<none>.lbm") != 0) {
_bkgndZBm = g_resourceloader->loadBitmap(buf);
if (debugLevel == DEBUG_BITMAPS || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("Loading scene z-buffer bitmap: %s\n", buf);
}
}
@ -262,7 +262,7 @@ ObjectState *Scene::findState(const char *filename) {
if (strcmp(file, filename) == 0)
return *i;
if (strcasecmp(file, filename) == 0) {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("State object request '%s' matches object '%s' but is the wrong case!", filename, file);
return *i;
}

View File

@ -174,12 +174,12 @@ void Smush::handleFrame() {
// MakeAnim animation type 'Bl16' parameters: 6000;8000;100;0;0;0;0;0;2;0;
// Lola engine room (loops a limited number of times?):
// MakeAnim animation type 'Bl16' parameters: 6000;8000;90;1;0;0;0;0;2;0;
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("Announcement data: %s\n", anno);
// It looks like the announcement data is actually for setting some of the
// header parameters, not for any looping purpose
} else {
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("Announcement header not understood: %s\n", anno);
}
delete[] anno;
@ -202,7 +202,7 @@ void Smush::handleFrame() {
else
handleWave(frame + pos + 8 + 4, decompressed_size);
pos += READ_BE_UINT32(frame + pos + 4) + 8;
} else if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL) {
} else if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL) {
error("Smush::handleFrame() unknown tag");
}
} while (pos < size);
@ -241,7 +241,7 @@ void Smush::handleFramesHeader() {
_freq = READ_LE_UINT32(f_header + pos + 8);
_channels = READ_LE_UINT32(f_header + pos + 12);
pos += 20;
} else if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL){
} else if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL){
error("Smush::handleFramesHeader() unknown tag");
}
} while (pos < size);
@ -281,7 +281,7 @@ bool Smush::setupAnim(const char *file, int x, int y) {
_speed = READ_LE_UINT32(s_header + 14);
flags = READ_LE_UINT16(s_header + 18);
// Output information for checking out the flags
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL) {
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL) {
printf("SMUSH Flags:");
for (int i = 0; i < 16; i++)
printf(" %d", (flags & (1 << i)) != 0);
@ -311,7 +311,7 @@ void Smush::stop() {
bool Smush::play(const char *filename, int x, int y) {
deinit();
if (debugLevel == DEBUG_SMUSH)
if (gDebugLevel == DEBUG_SMUSH)
printf("Playing video '%s'.\n", filename);
// Load the video
@ -340,7 +340,7 @@ struct SavePos *zlibFile::getPos() {
uint32 position = _handle->pos();
if (position == ((uint32) -1)) {
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("zlibFile::open() unable to find start position! %m");
return NULL;
}
@ -381,7 +381,7 @@ bool zlibFile::open(const char *filename) {
memset(_inBuf, 0, BUFFER_SIZE);
if (_handle) {
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("zlibFile::open() File %s already opened", filename);
return false;
}
@ -391,7 +391,7 @@ bool zlibFile::open(const char *filename) {
_handle = g_resourceloader->openNewStreamFile(filename);
if (!_handle->isOpen()) {
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("zlibFile::open() zlibFile %s not found", filename);
return false;
}
@ -405,7 +405,7 @@ bool zlibFile::open(const char *filename) {
// Xtra & Comment
if (flags & 0x04 || flags & 0x10) {
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL) {
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL) {
error("zlibFile::open() Unsupported header flag");
}
return false;
@ -425,7 +425,7 @@ bool zlibFile::open(const char *filename) {
_stream.zfree = NULL;
_stream.opaque = Z_NULL;
if (inflateInit2(&_stream, -15) != Z_OK && (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL))
if (inflateInit2(&_stream, -15) != Z_OK && (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL))
error("zlibFile::open() inflateInit2 failed");
_stream.next_in = NULL;
@ -456,7 +456,7 @@ uint32 zlibFile::read(void *ptr, uint32 len) {
bool fileEOF = false;
if (!_handle->isOpen()) {
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("zlibFile::read() File is not open!");
return 0;
}
@ -482,19 +482,19 @@ uint32 zlibFile::read(void *ptr, uint32 len) {
if (result == Z_STREAM_END) { // EOF
// "Stream end" is zlib's way of saying that it's done after the current call,
// so as long as no calls are made after we've received this message we're OK
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("zlibFile::read() Stream ended\n");
_fileDone = true;
break;
}
if (result == Z_DATA_ERROR) {
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("zlibFile::read() Decompression error");
_fileDone = true;
break;
}
if (result != Z_OK || fileEOF) {
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("zlibFile::read() Unknown decomp result: %d/%d", result, fileEOF);
_fileDone = true;
break;

View File

@ -247,7 +247,7 @@ void TextObject::draw() {
x = 0;
g_driver->drawTextBitmap(x, height + y, _textObjectHandle[i]);
} else if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
} else if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("TextObject::draw: Unknown justification code (%d)!", _justify);
height += _font->getHeight();

View File

@ -61,7 +61,7 @@ void Sector::load(TextSplitter &ts) {
_type = 0x4000;
else if (strstr(buf, "chernobyl"))
_type = 0x8000;
else if (debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
else if (gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("Unknown sector type '%s' in room setup", buf);
ts.scanString(" default visibility %256s", 1, buf);
@ -122,7 +122,7 @@ bool Sector::isPointInSector(Vector3d point) const {
}
if (!heightOK) {
/* Use this for debugging problems at height interfaces
if (debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL) {
if (gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL) {
printf("Rejected trigger due to height: %s (%f)\n", _name.c_str(), _height);
printf("Actor Z: %f\n", point.z());
for (int i = 0; i < _numVertices; i++)