[Scummvm-cvs-logs] SF.net SVN: scummvm:[34476] residual/trunk/engine
aquadran at users.sourceforge.net
aquadran at users.sourceforge.net
Wed Sep 10 13:16:58 CEST 2008
Revision: 34476
http://scummvm.svn.sourceforge.net/scummvm/?rev=34476&view=rev
Author: aquadran
Date: 2008-09-10 11:16:57 +0000 (Wed, 10 Sep 2008)
Log Message:
-----------
formating code
Modified Paths:
--------------
residual/trunk/engine/actor.cpp
residual/trunk/engine/backend/platform/sdl/driver_tinygl.cpp
residual/trunk/engine/bitmap.cpp
residual/trunk/engine/cmd_line.cpp
residual/trunk/engine/costume.cpp
residual/trunk/engine/imuse/imuse_sndmgr.cpp
residual/trunk/engine/lua/lstring.cpp
residual/trunk/engine/lua.cpp
residual/trunk/engine/model.cpp
residual/trunk/engine/registry.cpp
residual/trunk/engine/scene.cpp
residual/trunk/engine/scene.h
residual/trunk/engine/smush/smush.cpp
residual/trunk/engine/textobject.cpp
residual/trunk/engine/tinygl/light.cpp
residual/trunk/engine/tinygl/list.cpp
residual/trunk/engine/tinygl/select.cpp
residual/trunk/engine/tinygl/texture.cpp
residual/trunk/engine/tinygl/zbuffer.cpp
Modified: residual/trunk/engine/actor.cpp
===================================================================
--- residual/trunk/engine/actor.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/actor.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -159,13 +159,13 @@
Sector::ExitInfo ei;
g_engine->currScene()->findClosestSector(_pos, &currSector, &_pos);
- if (currSector == NULL) { // Shouldn't happen...
+ if (!currSector) { // Shouldn't happen...
_pos += forwardVec * dist;
_walkedCur = true;
return;
}
- while (currSector != NULL) {
+ while (currSector) {
prevSector = currSector;
Vector3d puckVector = currSector->projectToPuckVector(forwardVec);
puckVector /= puckVector.magnitude();
@@ -210,7 +210,7 @@
Vector3d forwardVec(-std::sin(yaw_rad), std::cos(yaw_rad), 0);
Sector *sector = g_engine->currScene()->findPointSector(_pos, 0x1000);
- if (sector == NULL)
+ if (!sector)
return forwardVec;
else
return sector->projectToPuckVector(forwardVec);
@@ -351,7 +351,7 @@
_lipSynch = g_resourceloader->loadLipSynch(soundLip.c_str());
// If there's no lip synch file then load the mumble chore if it exists
// (the mumble chore doesn't exist with the cat races announcer)
- if (_lipSynch == NULL && _mumbleChore != -1)
+ if (!_lipSynch && _mumbleChore != -1)
_mumbleCostume->playChoreLooping(_mumbleChore);
_talkAnim = -1;
@@ -398,15 +398,15 @@
g_imuse->stopSound(_talkSoundName.c_str());
_talkSoundName = "";
}
- if (_lipSynch != NULL) {
- if ((_talkAnim != -1) && (_talkChore[_talkAnim] >= 0))
+ if (_lipSynch) {
+ if (_talkAnim != -1 && _talkChore[_talkAnim] >= 0)
_talkCostume[_talkAnim]->stopChore(_talkChore[_talkAnim]);
_lipSynch = NULL;
} else if (_mumbleChore >= 0) {
_mumbleCostume->stopChore(_mumbleChore);
}
- if (_sayLineText != NULL) {
+ if (_sayLineText) {
g_engine->killTextObject(_sayLineText);
_sayLineText = NULL;
}
@@ -456,7 +456,7 @@
newCost = NULL;
else
newCost = _costumeStack.back();
- if (newCost == NULL) {
+ if (!newCost) {
if (debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
printf("Popped (freed) the last costume for an actor.\n");
}
@@ -568,7 +568,7 @@
_currTurnDir = 0;
// Update lip synching
- if (_lipSynch != NULL) {
+ if (_lipSynch) {
int posSound;
// While getPosIn60HzTicks will return "-1" to indicate that the
Modified: residual/trunk/engine/backend/platform/sdl/driver_tinygl.cpp
===================================================================
--- residual/trunk/engine/backend/platform/sdl/driver_tinygl.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/backend/platform/sdl/driver_tinygl.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -324,7 +324,7 @@
for (int i = 0; i < face->_numVertices; i++) {
tglNormal3fv(vertNormals + 3 * face->_vertices[i]);
- if (face->_texVertices != NULL)
+ if (face->_texVertices)
tglTexCoord2fv(textureVerts + 2 * face->_texVertices[i]);
tglVertex3fv(vertices + 3 * face->_vertices[i]);
@@ -348,7 +348,7 @@
void DriverTinyGL::drawHierachyNode(const Model::HierNode *node) {
translateViewpoint(node->_animPos / node->_totalWeight, node->_animPitch / node->_totalWeight, node->_animYaw / node->_totalWeight, node->_animRoll / node->_totalWeight);
if (node->_hierVisible) {
- if (node->_mesh != NULL && node->_meshVisible) {
+ if (node->_mesh && node->_meshVisible) {
tglPushMatrix();
tglTranslatef(node->_pivot.x(), node->_pivot.y(), node->_pivot.z());
node->_mesh->draw();
@@ -356,14 +356,14 @@
tglPopMatrix();
}
- if (node->_child != NULL) {
+ if (node->_child) {
node->_child->draw();
tglMatrixMode(TGL_MODELVIEW);
}
}
translateViewpoint();
- if (node->_sibling != NULL)
+ if (node->_sibling)
node->_sibling->draw();
}
Modified: residual/trunk/engine/bitmap.cpp
===================================================================
--- residual/trunk/engine/bitmap.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/bitmap.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -117,9 +117,9 @@
}
Bitmap::~Bitmap() {
- if(_data != NULL) {
+ if (_data) {
for (int i = 0; i < _numImages; i++)
- if(_data[i])
+ if (_data[i])
delete[] _data[i];
delete[] _data;
Modified: residual/trunk/engine/cmd_line.cpp
===================================================================
--- residual/trunk/engine/cmd_line.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/cmd_line.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -197,7 +197,7 @@
DO_OPTION(shortCmd, longCmd) \
char *endptr = 0; \
int intValue; intValue = (int)strtol(option, &endptr, 0); \
- if (endptr == NULL || *endptr != 0) usage("--%s: Invalid number '%s'", longCmd, option);
+ if (!endptr || *endptr != 0) usage("--%s: Invalid number '%s'", longCmd, option);
// Use this for boolean options; this distinguishes between "-x" and "-X",
// resp. between "--some-option" and "--no-some-option".
Modified: residual/trunk/engine/costume.cpp
===================================================================
--- residual/trunk/engine/costume.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/costume.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -200,7 +200,7 @@
/* 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 == NULL) {
+ if (!state) {
if (debugLevel == DEBUG_BITMAPS || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
warning("Couldn't find bitmap %s in current scene\n", _filename.c_str());
return;
@@ -242,7 +242,7 @@
// Get the default colormap if we haven't found
// a valid colormap
- if (cmap == NULL) {
+ if (!cmap) {
if (debugLevel == DEBUG_MODEL || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
warning("No colormap specified for %s, using %s\n", _filename.c_str(), DEFAULT_COLORMAP);
@@ -942,8 +942,7 @@
void Costume::setColormap(char *map) {
// Sometimes setColormap is called on a null costume,
// see where raoul is gone in hh.set
- // ??? this == null - aquadran
- if (this == NULL || !map)
+ if (!map)
return;
_cmap = g_resourceloader->loadColormap(map);
for (int i = 0; i < _numComponents; i++)
Modified: residual/trunk/engine/imuse/imuse_sndmgr.cpp
===================================================================
--- residual/trunk/engine/imuse/imuse_sndmgr.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/imuse/imuse_sndmgr.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -177,7 +177,7 @@
if (strcasecmp(extension, "imu") == 0) {
sound->blockRes = g_resourceloader->getFileBlock(soundName);
- if (sound->blockRes != NULL) {
+ if (sound->blockRes) {
ptr = (byte *)sound->blockRes->data();
parseSoundHeader(ptr, sound, headerSize);
sound->mcmpData = false;
Modified: residual/trunk/engine/lua/lstring.cpp
===================================================================
--- residual/trunk/engine/lua/lstring.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/lua/lstring.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -41,7 +41,7 @@
// count how many entries are really in use
for (i = 0; i < size; i++)
- if (tb->hash[i] != NULL && tb->hash[i] != &EMPTY)
+ if (tb->hash[i] && tb->hash[i] != &EMPTY)
realuse++;
if (2 * (realuse + 1) <= size) // +1 is the new element
return size; // don't need to grow, just rehash to clear EMPTYs
@@ -59,7 +59,7 @@
// rehash
tb->nuse = 0;
for (i = 0; i < tb->size; i++) {
- if (tb->hash[i] != NULL && tb->hash[i] != &EMPTY) {
+ if (tb->hash[i] && tb->hash[i] != &EMPTY) {
int32 h = tb->hash[i]->hash % ns;
while (newhash[h])
h = (h + 1) % ns;
Modified: residual/trunk/engine/lua.cpp
===================================================================
--- residual/trunk/engine/lua.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/lua.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -303,7 +303,7 @@
int curr_line = lua_currentline(lua_getparam(1));
if (curr_line > 0)
sprintf(buf + strlen(buf), " at line %d", curr_line);
- if (filename != NULL)
+ if (filename)
sprintf(buf + strlen(buf), " [in file %.100s]", filename);
lua_pushstring(buf);
}
@@ -490,7 +490,7 @@
act = check_actor(1);
chore = check_int(2);
costume = get_costume(act, 3, "SetActorWalkChore");
- if (costume == NULL) {
+ if (!costume) {
if (debugLevel == DEBUG_CHORES || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
warning("SetActorWalkChore() could not find the requested costume, attempting to load...");
act->pushCostume(lua_getstring(lua_getparam(3)));
@@ -858,7 +858,7 @@
DEBUG_FUNCTION();
act = check_actor(1);
- if (act == NULL) {
+ if (!act) {
lua_pushnil();
return;
}
@@ -1115,7 +1115,7 @@
nullvector = true;
if (lua_isnumber(y))
rate = luaL_check_number(3);
- } else if ( lua_isnumber(x)) { // look at xyz
+ } else if (lua_isnumber(x)) { // look at xyz
float fX;
float fY;
float fZ;
@@ -1860,7 +1860,7 @@
DEBUG_FUNCTION();
name = luaL_check_string(1);
scene = g_engine->findScene(name);
- if (scene == NULL) {
+ if (!scene) {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
warning("GetCurrentSetup() Requested scene (%s) is not loaded!", name);
lua_pushnil();
@@ -2357,7 +2357,7 @@
textObjectParm = check_textobject(1);
delText = TextObjectExists((char *) textObjectParm->name());
- if (delText != NULL)
+ if (delText)
g_engine->killTextObject(delText);
}
@@ -2505,7 +2505,7 @@
DEBUG_FUNCTION();
mode = check_int(1);
- if ((mode >= 1) && (mode <= 3))
+ if (mode >= 1 && mode <= 3)
g_engine->setSpeechMode(mode);
}
@@ -2959,7 +2959,7 @@
table = lua_getparam(1);
savedState = g_engine->savedState();
- if (savedState == NULL)
+ if (!savedState)
error("Cannot obtain saved game!");
savedState->beginSection('SUBS');
count = 0;
@@ -3828,7 +3828,7 @@
delete b;
// Don't print warnings on Scripts\foo.lua,
// d:\grimFandango\Scripts\foo.lua
- if (std::strstr(filename, "Scripts\\") == NULL && (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL))
+ if (!std::strstr(filename, "Scripts\\") && (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL))
warning("Cannot find script %s\n", filename);
return 2;
Modified: residual/trunk/engine/model.cpp
===================================================================
--- residual/trunk/engine/model.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/model.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -253,11 +253,11 @@
std::memcpy(result, _rootHierNode, _numHierNodes * sizeof(HierNode));
// Now adjust pointers
for (int i = 0; i < _numHierNodes; i++) {
- if (result[i]._parent != NULL)
+ if (result[i]._parent)
result[i]._parent = result + (_rootHierNode[i]._parent - _rootHierNode);
- if (result[i]._child != NULL)
+ if (result[i]._child)
result[i]._child = result + (_rootHierNode[i]._child - _rootHierNode);
- if (result[i]._sibling != NULL)
+ if (result[i]._sibling)
result[i]._sibling = result + (_rootHierNode[i]._sibling - _rootHierNode);
}
return result;
Modified: residual/trunk/engine/registry.cpp
===================================================================
--- residual/trunk/engine/registry.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/registry.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -125,8 +125,8 @@
void Registry::set(const char *key, const char *val) {
// Hack: Don't save these, so we can run in good_times mode
// without new games being bogus.
- if (strstr(key, "GrimLastSet") || strstr(key, "GrimMannyState"))
- return;
+// if (strstr(key, "GrimLastSet") || strstr(key, "GrimMannyState"))
+// return;
_dirty = true;
assert(val);
Modified: residual/trunk/engine/scene.cpp
===================================================================
--- residual/trunk/engine/scene.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/scene.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -250,7 +250,7 @@
continue;
Vector3d closestPt = sector->closestPoint(p);
float thisDist = (closestPt - p).magnitude();
- if (resultSect == NULL || thisDist < minDist) {
+ if (!resultSect || thisDist < minDist) {
resultSect = sector;
resultPt = closestPt;
minDist = thisDist;
Modified: residual/trunk/engine/scene.h
===================================================================
--- residual/trunk/engine/scene.h 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/scene.h 2008-09-10 11:16:57 UTC (rev 34476)
@@ -50,10 +50,10 @@
int _maxVolume;
void drawBackground() const {
- if (_currSetup->_bkgndZBm != NULL) // Some screens have no zbuffer mask (eg, Alley)
+ if (_currSetup->_bkgndZBm) // Some screens have no zbuffer mask (eg, Alley)
_currSetup->_bkgndZBm->draw();
- if (_currSetup->_bkgndBm == NULL) {
+ if (!_currSetup->_bkgndBm) {
// This should fail softly, for some reason jumping to the signpost (sg) will load
// the scene in such a way that the background isn't immediately available
warning("Background hasn't loaded yet for setup %s in %s!", _currSetup->_name.c_str(), _name.c_str());
@@ -83,9 +83,6 @@
// Sector access functions
int getSectorCount() {
- // TODO: Find where this is called before we're initialized
- if (this == NULL)
- return 0;
return _numSectors;
}
Sector *getSectorBase(int id) {
Modified: residual/trunk/engine/smush/smush.cpp
===================================================================
--- residual/trunk/engine/smush/smush.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/smush/smush.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -105,7 +105,7 @@
delete[] _externalBuffer;
_externalBuffer = NULL;
}
- if (_videoLooping && _startPos != NULL) {
+ if (_videoLooping && _startPos) {
delete[] _startPos->tmpBuf;
delete[] _startPos;
_startPos = NULL;
@@ -362,7 +362,7 @@
}
bool zlibFile::setPos(struct SavePos *pos) {
- if (pos == NULL) {
+ if (!pos) {
warning("Unable to rewind SMUSH movie (no position passed)!");
return false;
}
Modified: residual/trunk/engine/textobject.cpp
===================================================================
--- residual/trunk/engine/textobject.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/textobject.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -74,7 +74,7 @@
}
int TextObject::getBitmapWidth() {
- if (_bitmapWidthPtr == NULL)
+ if (!_bitmapWidthPtr)
return 0;
int width = 0;
Modified: residual/trunk/engine/tinygl/light.cpp
===================================================================
--- residual/trunk/engine/tinygl/light.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/tinygl/light.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -174,11 +174,11 @@
l->prev = NULL;
} else if (!v && l->enabled) {
l->enabled = 0;
- if (l->prev == NULL)
+ if (!l->prev)
c->first_light = l->next;
else
l->prev->next=l->next;
- if (l->next != NULL)
+ if (l->next)
l->next->prev=l->prev;
}
}
Modified: residual/trunk/engine/tinygl/list.cpp
===================================================================
--- residual/trunk/engine/tinygl/list.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/tinygl/list.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -32,11 +32,11 @@
GLList *l;
l = find_list(c, list);
- assert(l != NULL);
+ assert(l);
// free param buffer
pb = l->first_op_buffer;
- while (pb != NULL) {
+ while (pb) {
pb1 = pb->next;
gl_free(pb);
pb = pb1;
Modified: residual/trunk/engine/tinygl/select.cpp
===================================================================
--- residual/trunk/engine/tinygl/select.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/tinygl/select.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -84,7 +84,7 @@
int n, i;
if (!c->select_overflow) {
- if (c->select_hit == NULL) {
+ if (!c->select_hit) {
n = c->name_stack_size;
if ((c->select_ptr-c->select_buffer + 3 + n) > c->select_size) {
c->select_overflow = 1;
Modified: residual/trunk/engine/tinygl/texture.cpp
===================================================================
--- residual/trunk/engine/tinygl/texture.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/tinygl/texture.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -7,7 +7,7 @@
GLTexture *t;
t = c->shared_state.texture_hash_table[h % TEXTURE_HASH_TABLE_SIZE];
- while (t != NULL) {
+ while (t) {
if (t->handle == h)
return t;
t = t->next;
@@ -32,7 +32,7 @@
for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
im = &t->images[i];
- if (im->pixmap != NULL)
+ if (im->pixmap)
gl_free(im->pixmap);
}
Modified: residual/trunk/engine/tinygl/zbuffer.cpp
===================================================================
--- residual/trunk/engine/tinygl/zbuffer.cpp 2008-09-10 09:27:07 UTC (rev 34475)
+++ residual/trunk/engine/tinygl/zbuffer.cpp 2008-09-10 11:16:57 UTC (rev 34476)
@@ -31,19 +31,19 @@
size = zb->xsize * zb->ysize * sizeof(unsigned short);
zb->zbuf = (unsigned short *)gl_malloc(size);
- if (zb->zbuf == NULL)
+ if (!zb->zbuf)
goto error;
size = zb->xsize * zb->ysize * sizeof(unsigned int);
zb->zbuf2 = (unsigned int *)gl_malloc(size);
- if (zb->zbuf2 == NULL) {
+ if (!zb->zbuf2) {
gl_free(zb->zbuf);
goto error;
}
- if (frame_buffer == NULL) {
+ if (!frame_buffer) {
zb->pbuf = (PIXEL *)gl_malloc(zb->ysize * zb->linesize);
- if (zb->pbuf == NULL) {
+ if (!zb->pbuf) {
gl_free(zb->zbuf);
gl_free(zb->zbuf2);
goto error;
@@ -95,7 +95,7 @@
if (zb->frame_buffer_allocated)
gl_free(zb->pbuf);
- if (frame_buffer == NULL) {
+ if (!frame_buffer) {
zb->pbuf = (PIXEL *)gl_malloc(zb->ysize * zb->linesize);
zb->frame_buffer_allocated = 1;
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list