fix warnings

This commit is contained in:
Pawel Kolodziejski 2009-10-17 12:48:23 +00:00
parent 9d2b149b1e
commit 788713d3b4
23 changed files with 192 additions and 193 deletions

View File

@ -35,8 +35,8 @@ namespace Grim {
int g_winX1, g_winY1, g_winX2, g_winY2;
Actor::Actor(const char *name) :
_name(name), _setName(""), _talkColor(255, 255, 255), _pos(0, 0, 0),
Actor::Actor(const char *actorName) :
_name(actorName), _setName(""), _talkColor(255, 255, 255), _pos(0, 0, 0),
// Some actors don't set walk and turn rates, so we default the
// _turnRate so Doug at the cat races can turn and we set the
// _walkRate so Glottis at the demon beaver entrance can walk
@ -84,30 +84,30 @@ void Actor::saveState(SaveGame *savedState) {
}
void Actor::setYaw(float yaw) {
void Actor::setYaw(float yawParam) {
// While the program correctly handle yaw angles outside
// of the range [0, 360), proper convention is to roll
// these values over correctly
if (yaw >= 360.0)
_yaw = yaw - 360;
else if (yaw < 0.0)
_yaw = yaw + 360;
if (yawParam >= 360.0)
_yaw = yawParam - 360;
else if (yawParam < 0.0)
_yaw = yawParam + 360;
else
_yaw = yaw;
_yaw = yawParam;
}
void Actor::setRot(float pitch, float yaw, float roll) {
_pitch = pitch;
setYaw(yaw);
_roll = roll;
void Actor::setRot(float pitchParam, float yawParam, float rollParam) {
_pitch = pitchParam;
setYaw(yawParam);
_roll = rollParam;
}
void Actor::turnTo(float pitch, float yaw, float roll) {
_pitch = pitch;
_roll = roll;
if (_yaw != yaw) {
void Actor::turnTo(float pitchParam, float yawParam, float rollParam) {
_pitch = pitchParam;
_roll = rollParam;
if (_yaw != yawParam) {
_turning = true;
_destYaw = yaw;
_destYaw = yawParam;
} else
_turning = false;
}
@ -172,12 +172,12 @@ void Actor::walkForward() {
while (currSector) {
prevSector = currSector;
Graphics::Vector3d puckVector = currSector->projectToPuckVector(forwardVec);
puckVector /= puckVector.magnitude();
currSector->getExitInfo(_pos, puckVector, &ei);
Graphics::Vector3d puckVec = currSector->projectToPuckVector(forwardVec);
puckVec /= puckVec.magnitude();
currSector->getExitInfo(_pos, puckVec, &ei);
float exitDist = (ei.exitPoint - _pos).magnitude();
if (dist < exitDist) {
_pos += puckVector * dist;
_pos += puckVec * dist;
_walkedCur = true;
return;
}
@ -188,7 +188,7 @@ void Actor::walkForward() {
// Check for an adjacent sector which can continue
// the path
currSector = g_grim->currScene()->findPointSector(ei.exitPoint + (float)0.0001 * puckVector, 0x1000);
currSector = g_grim->currScene()->findPointSector(ei.exitPoint + (float)0.0001 * puckVec, 0x1000);
if (currSector == prevSector)
break;
}
@ -422,8 +422,8 @@ void Actor::shutUp() {
}
}
void Actor::pushCostume(const char *name) {
Costume *newCost = g_resourceloader->loadCostume(name, currentCostume());
void Actor::pushCostume(const char *n) {
Costume *newCost = g_resourceloader->loadCostume(n, currentCostume());
newCost->setColormap(NULL);
_costumeStack.push_back(newCost);
@ -438,11 +438,11 @@ void Actor::setColormap(const char *map) {
}
}
void Actor::setCostume(const char *name) {
void Actor::setCostume(const char *n) {
if (!_costumeStack.empty())
popCostume();
pushCostume(name);
pushCostume(n);
}
void Actor::popCostume() {
@ -488,9 +488,9 @@ void Actor::setHead(int joint1, int joint2, int joint3, float maxRoll, float max
}
}
Costume *Actor::findCostume(const char *name) {
Costume *Actor::findCostume(const char *n) {
for (Common::List<Costume *>::iterator i = _costumeStack.begin(); i != _costumeStack.end(); i++)
if (strcasecmp((*i)->filename(), name) == 0)
if (strcasecmp((*i)->filename(), n) == 0)
return *i;
return NULL;
@ -681,20 +681,20 @@ void Actor::undraw(bool /*visible*/) {
#define strmatch(src, dst) (strlen(src) == strlen(dst) && strcmp(src, dst) == 0)
void Actor::setShadowPlane(const char *name) {
void Actor::setShadowPlane(const char *n) {
assert(_activeShadowSlot != -1);
_shadowArray[_activeShadowSlot].name = name;
_shadowArray[_activeShadowSlot].name = n;
}
void Actor::addShadowPlane(const char *name) {
void Actor::addShadowPlane(const char *n) {
assert(_activeShadowSlot != -1);
int numSectors = g_grim->currScene()->getSectorCount();
for (int i = 0; i < numSectors; i++) {
Sector *sector = g_grim->currScene()->getSectorBase(i);
if (strmatch(sector->name(), name)) {
if (strmatch(sector->name(), n)) {
_shadowArray[_activeShadowSlot].planeList.push_back(sector);
g_grim->flagRefreshShadowMask(true);
return;
@ -722,10 +722,10 @@ void Actor::setActivateShadow(int shadowId, bool state) {
_shadowArray[shadowId].active = state;
}
void Actor::setShadowPoint(Graphics::Vector3d pos) {
void Actor::setShadowPoint(Graphics::Vector3d p) {
assert(_activeShadowSlot != -1);
_shadowArray[_activeShadowSlot].pos = pos;
_shadowArray[_activeShadowSlot].pos = p;
}
void Actor::clearShadowPlanes() {

View File

@ -60,7 +60,7 @@ public:
void setTalkColor(const Color& c) { _talkColor = c; }
Color talkColor() const { return _talkColor; }
void setPos(Graphics::Vector3d pos) { _pos = pos; }
void setPos(Graphics::Vector3d position) { _pos = position; }
// When the actor is walking report where the actor is going to and
// not the actual current position, this fixes some scene change
// change issues with the Bone Wagon (along with other fixes)
@ -83,7 +83,7 @@ public:
bool visible() const { return _visible; }
// The set should change immediately, otherwise a very rapid set change
// for an actor will be recognized incorrectly and the actor will be lost.
void putInSet(const char *name) { _setName = name; }
void putInSet(const char *setName) { _setName = setName; }
void setTurnRate(float rate) { _turnRate = rate; }
float turnRate() const { return _turnRate; }
void setWalkRate(float rate) { _walkRate = rate; }
@ -93,8 +93,8 @@ public:
float angleTo(const Actor &a) const;
float yawTo(Graphics::Vector3d p) const;
bool inSet(const char *name) const {
return _setName == name;
bool inSet(const char *setName) const {
return _setName == setName;
}
void walkForward();
void setReflection(float angle) { _reflectionAngle = angle; }

View File

@ -33,15 +33,15 @@ namespace Grim {
static void decompress_codec3(const char *compressed, char *result);
Bitmap::Bitmap(const char *filename, const char *data, int len) {
_fname = filename;
Bitmap::Bitmap(const char *fname, const char *data, int len) {
_fname = fname;
if (len < 8 || memcmp(data, "BM F\0\0\0", 8) != 0) {
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("Invalid magic loading bitmap");
}
strcpy(_filename, filename);
strcpy(_filename, fname);
int codec = READ_LE_UINT32(data + 8);
// _paletteIncluded = READ_LE_UINT32(data + 12);
@ -85,17 +85,17 @@ Bitmap::Bitmap(const char *filename, const char *data, int len) {
g_driver->createBitmap(this);
}
Bitmap::Bitmap(const char *data, int width, int height, const char *filename) {
_fname = filename;
Bitmap::Bitmap(const char *data, int w, int h, const char *fname) {
_fname = fname;
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
printf("New bitmap loaded: %s\n", filename);
strcpy(_filename, filename);
printf("New bitmap loaded: %s\n", fname);
strcpy(_filename, fname);
_currImage = 1;
_numImages = 1;
_x = 0;
_y = 0;
_width = width;
_height = height;
_width = w;
_height = h;
_format = 1;
_numTex = 0;
_texIds = NULL;

View File

@ -50,8 +50,8 @@ public:
int height() const { return _height; }
int x() const { return _x; }
int y() const { return _y; }
void setX(int x) { _x = x; }
void setY(int y) { _y = y; }
void setX(int xPos) { _x = xPos; }
void setY(int yPos) { _y = yPos; }
char *getData() { return _data[_currImage]; }

View File

@ -35,8 +35,8 @@ namespace Grim {
class CMap {
public:
// Load a colormap from the given data.
CMap(const char *filename, const char *data, int len) {
_fname = filename;
CMap(const char *fileName, const char *data, int len) {
_fname = fileName;
if (len < 4 || READ_BE_UINT32(data) != MKID_BE('CMP '))
error("Invalid magic loading colormap");
memcpy(_colors, data + 64, sizeof(_colors));

View File

@ -172,8 +172,8 @@ private:
Graphics::Matrix4 _matrix;
};
BitmapComponent::BitmapComponent(Costume::Component *parent, int parentID, const char *filename, tag32 tag) :
Costume::Component(parent, parentID, tag), _filename(filename) {
BitmapComponent::BitmapComponent(Costume::Component *p, int parentID, const char *filename, tag32 t) :
Costume::Component(p, parentID, t), _filename(filename) {
}
void BitmapComponent::setKey(int val) {
@ -205,8 +205,8 @@ void BitmapComponent::setKey(int val) {
*/
}
ModelComponent::ModelComponent(Costume::Component *parent, int parentID, const char *filename, Costume::Component *prevComponent, tag32 tag) :
Costume::Component(parent, parentID, tag), _filename(filename),
ModelComponent::ModelComponent(Costume::Component *p, int parentID, const char *filename, Costume::Component *prevComponent, tag32 t) :
Costume::Component(p, parentID, t), _filename(filename),
_obj(NULL), _hier(NULL) {
const char *comma = strchr(filename, ',');
@ -233,17 +233,17 @@ void ModelComponent::init() {
// by the sharing MainModelComponent
// constructor before
if (!_obj) {
CMap *cmap = this->cmap();
CMap *cm = this->cmap();
// Get the default colormap if we haven't found
// a valid colormap
if (!cmap) {
if (!cm) {
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);
cm = g_resourceloader->loadColormap(DEFAULT_COLORMAP);
}
_obj = g_resourceloader->loadModel(_filename.c_str(), cmap);
_obj = g_resourceloader->loadModel(_filename.c_str(), cm);
_hier = _obj->copyHierarchy();
// Use parent availablity to decide whether to default the
// component to being visible
@ -289,11 +289,11 @@ void ModelComponent::update() {
}
void ModelComponent::resetColormap() {
CMap *cmap;
CMap *cm;
cmap = this->cmap();
if (_obj && cmap)
_obj->reload(cmap);
cm = this->cmap();
if (_obj && cm)
_obj->reload(cm);
}
ModelComponent::~ModelComponent() {
@ -328,8 +328,8 @@ void ModelComponent::draw() {
translateObject(_hier->_parent, true);
}
MainModelComponent::MainModelComponent(Costume::Component *parent, int parentID, const char *filename, Costume::Component *prevComponent, tag32 tag) :
ModelComponent(parent, parentID, filename, prevComponent, tag), _hierShared(false) {
MainModelComponent::MainModelComponent(Costume::Component *p, int parentID, const char *filename, Costume::Component *prevComponent, tag32 t) :
ModelComponent(p, parentID, filename, prevComponent, t), _hierShared(false) {
if (parentID == -2 && prevComponent) {
MainModelComponent *mmc = dynamic_cast<MainModelComponent *>(prevComponent);
@ -381,12 +381,12 @@ private:
int _num;
};
ColormapComponent::ColormapComponent(Costume::Component *parent, int parentID, const char *filename, tag32 tag) :
Costume::Component(parent, parentID, tag) {
ColormapComponent::ColormapComponent(Costume::Component *p, int parentID, const char *filename, tag32 t) :
Costume::Component(p, parentID, t) {
_cmap = g_resourceloader->loadColormap(filename);
if (parent)
parent->setColormap(_cmap);
if (p)
p->setColormap(_cmap);
else
warning("No parent to apply colormap object on.");
}
@ -413,8 +413,8 @@ private:
Common::String _fname;
};
KeyframeComponent::KeyframeComponent(Costume::Component *parent, int parentID, const char *filename, tag32 tag) :
Costume::Component(parent, parentID, tag), _priority1(1), _priority2(5), _hier(NULL), _active(false) {
KeyframeComponent::KeyframeComponent(Costume::Component *p, int parentID, const char *filename, tag32 t) :
Costume::Component(p, parentID, t), _priority1(1), _priority2(5), _hier(NULL), _active(false) {
_fname = filename;
const char *comma = strchr(filename, ',');
if (comma) {
@ -494,8 +494,8 @@ void KeyframeComponent::init() {
}
}
MeshComponent::MeshComponent(Costume::Component *parent, int parentID, const char *name, tag32 tag) :
Costume::Component(parent, parentID, tag), _name(name), _node(NULL) {
MeshComponent::MeshComponent(Costume::Component *p, int parentID, const char *name, tag32 t) :
Costume::Component(p, parentID, t), _name(name), _node(NULL) {
if (sscanf(name, "mesh %d", &_num) < 1)
error("Couldn't parse mesh name %s", name);
@ -525,8 +525,8 @@ void MeshComponent::update() {
_node->update();
}
MaterialComponent::MaterialComponent(Costume::Component *parent, int parentID, const char *filename, tag32 tag) :
Costume::Component(parent, parentID, tag), _filename(filename),
MaterialComponent::MaterialComponent(Costume::Component *p, int parentID, const char *filename, tag32 t) :
Costume::Component(p, parentID, t), _filename(filename),
_num(0) {
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
@ -534,16 +534,16 @@ MaterialComponent::MaterialComponent(Costume::Component *parent, int parentID, c
}
void MaterialComponent::init() {
CMap *cmap = this->cmap();
CMap *cm = this->cmap();
if (!cmap) {
if (!cm) {
// Use the default colormap if we're still drawing a blank
if (gDebugLevel == DEBUG_MODEL || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
warning("MaterialComponent::init on %s", _filename.c_str());
cmap = g_resourceloader->loadColormap(DEFAULT_COLORMAP);
cm = g_resourceloader->loadColormap(DEFAULT_COLORMAP);
}
_mat = g_resourceloader->loadMaterial(_filename.c_str(), cmap);
_mat = g_resourceloader->loadMaterial(_filename.c_str(), cm);
}
void MaterialComponent::setKey(int val) {
@ -568,8 +568,8 @@ private:
Common::String _name;
};
LuaVarComponent::LuaVarComponent(Costume::Component *parent, int parentID, const char *name, tag32 tag) :
Costume::Component(parent, parentID, tag), _name(name) {
LuaVarComponent::LuaVarComponent(Costume::Component *p, int parentID, const char *name, tag32 t) :
Costume::Component(p, parentID, t), _name(name) {
}
void LuaVarComponent::setKey(int val) {
@ -591,8 +591,8 @@ private:
Common::String _soundName;
};
SoundComponent::SoundComponent(Costume::Component *parent, int parentID, const char *filename, tag32 tag) :
Costume::Component(parent, parentID, tag) {
SoundComponent::SoundComponent(Costume::Component *p, int parentID, const char *filename, tag32 t) :
Costume::Component(p, parentID, t) {
const char *comma = strchr(filename, ',');
if (comma) {
_soundName = Common::String(filename, comma);
@ -630,8 +630,8 @@ void SoundComponent::reset() {
g_imuse->stopSound(_soundName.c_str());
}
Costume::Costume(const char *filename, const char *data, int len, Costume *prevCost) :
_fname(filename), _cmap(NULL) {
Costume::Costume(const char *fname, const char *data, int len, Costume *prevCost) :
_fname(fname), _cmap(NULL) {
TextSplitter ts(data, len);
ts.expectString("costume v0.1");
@ -727,15 +727,15 @@ Costume::~Costume() {
delete[] _chores;
}
Costume::Component::Component(Component *parent, int parentID, tag32 tag) {
Costume::Component::Component(Component *p, int parentID, tag32 t) {
_visible = true;
_previousCmap = NULL;
_cmap = NULL;
_cost = NULL;
_parent = NULL;
_parentID = parentID;
setParent(parent);
_tag = tag;
setParent(p);
_tag = t;
}
void Costume::Component::setColormap(CMap *c) {

View File

@ -115,7 +115,7 @@ static const GrimGameDescription gameDescriptions[] = {
};
static const GrimGameDescription fallbackGameDescriptions[] = {
{{"grim", 0, {{0, 0, 0, 0}}, Common::UNK_LANG, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO_NONE}}
{{"grim", 0, {{0, 0, 0, 0}}, Common::UNK_LANG, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO_NONE}, 0}
};
static const ADFileBasedFallback grimFallback[] = {

View File

@ -970,7 +970,7 @@ void GrimEngine::savegameRestore() {
printf("GrimEngine::savegameRestore() finished.\n");
}
void GrimEngine::storeSaveGameImage(SaveGame *savedState) {
void GrimEngine::storeSaveGameImage(SaveGame *state) {
int width = 250, height = 188;
Bitmap *screenshot;
@ -981,16 +981,16 @@ void GrimEngine::storeSaveGameImage(SaveGame *savedState) {
g_grim->updateDisplayScene();
screenshot = g_driver->getScreenshot(width, height);
g_grim->setMode(mode);
savedState->beginSection('SIMG');
state->beginSection('SIMG');
if (screenshot) {
int size = screenshot->width() * screenshot->height() * sizeof(uint16);
screenshot->setNumber(0);
char *data = screenshot->getData();
savedState->write(data, size);
state->write(data, size);
} else {
error("Unable to store screenshot");
}
savedState->endSection();
state->endSection();
g_grim->killBitmap(screenshot);
printf("GrimEngine::StoreSaveGameImage() finished.\n");
}
@ -1040,95 +1040,95 @@ void GrimEngine::savegameSave() {
printf("GrimEngine::savegameSave() finished.\n");
}
void GrimEngine::saveActors(SaveGame *savedState) {
savedState->beginSection('ACTR');
void GrimEngine::saveActors(SaveGame *state) {
state->beginSection('ACTR');
savedState->writeLESint32(_actors.size());
state->writeLESint32(_actors.size());
for (ActorListType::iterator i = _actors.begin(); i != _actors.end(); i++) {
Actor *a = *i;
PointerId ptr = makeIdFromPointer(a);
savedState->writeLEUint32(ptr.low);
savedState->writeLEUint32(ptr.hi);
a->saveState(savedState);
state->writeLEUint32(ptr.low);
state->writeLEUint32(ptr.hi);
a->saveState(state);
}
savedState->endSection();
state->endSection();
}
void GrimEngine::saveFonts(SaveGame *savedState) {
savedState->beginSection('FONT');
void GrimEngine::saveFonts(SaveGame *state) {
state->beginSection('FONT');
savedState->writeLESint32(_fonts.size());
state->writeLESint32(_fonts.size());
for (Common::List<Font *>::iterator i = _fonts.begin(); i != _fonts.end(); i++) {
Font *f = *i;
PointerId ptr = makeIdFromPointer(f);
savedState->writeLEUint32(ptr.low);
savedState->writeLEUint32(ptr.hi);
state->writeLEUint32(ptr.low);
state->writeLEUint32(ptr.hi);
Common::String filename = f->getFilename();
savedState->writeLESint32(filename.size());
savedState->write(filename.c_str(), filename.size());
state->writeLESint32(filename.size());
state->write(filename.c_str(), filename.size());
}
savedState->endSection();
state->endSection();
}
void GrimEngine::saveTextObjects(SaveGame *savedState) {
void GrimEngine::saveTextObjects(SaveGame *state) {
PointerId ptr;
savedState->beginSection('TEXT');
state->beginSection('TEXT');
savedState->writeLESint32(sayLineDefaults.disabled);
savedState->writeByte(sayLineDefaults.fgColor.red());
savedState->writeByte(sayLineDefaults.fgColor.green());
savedState->writeByte(sayLineDefaults.fgColor.blue());
state->writeLESint32(sayLineDefaults.disabled);
state->writeByte(sayLineDefaults.fgColor.red());
state->writeByte(sayLineDefaults.fgColor.green());
state->writeByte(sayLineDefaults.fgColor.blue());
ptr = makeIdFromPointer(sayLineDefaults.font);
savedState->writeLEUint32(ptr.low);
savedState->writeLEUint32(ptr.hi);
savedState->writeLESint32(sayLineDefaults.height);
savedState->writeLESint32(sayLineDefaults.justify);
savedState->writeLESint32(sayLineDefaults.width);
savedState->writeLESint32(sayLineDefaults.x);
savedState->writeLESint32(sayLineDefaults.y);
state->writeLEUint32(ptr.low);
state->writeLEUint32(ptr.hi);
state->writeLESint32(sayLineDefaults.height);
state->writeLESint32(sayLineDefaults.justify);
state->writeLESint32(sayLineDefaults.width);
state->writeLESint32(sayLineDefaults.x);
state->writeLESint32(sayLineDefaults.y);
savedState->writeLESint32(_textObjects.size());
state->writeLESint32(_textObjects.size());
for (TextListType::iterator i = _textObjects.begin(); i != _textObjects.end(); i++) {
TextObject *t = *i;
ptr = makeIdFromPointer(t);
savedState->writeLEUint32(ptr.low);
savedState->writeLEUint32(ptr.hi);
t->saveState(savedState);
state->writeLEUint32(ptr.low);
state->writeLEUint32(ptr.hi);
t->saveState(state);
}
savedState->endSection();
state->endSection();
}
void GrimEngine::saveScenes(SaveGame *savedState) {
savedState->beginSection('SET ');
void GrimEngine::saveScenes(SaveGame *state) {
state->beginSection('SET ');
savedState->writeLESint32(_scenes.size());
state->writeLESint32(_scenes.size());
for (SceneListType::iterator i = _scenes.begin(); i != _scenes.end(); i++) {
Scene *s = *i;
s->saveState(savedState);
s->saveState(state);
}
savedState->endSection();
state->endSection();
}
void GrimEngine::savePrimitives(SaveGame *savedState) {
void GrimEngine::savePrimitives(SaveGame *state) {
PointerId ptr;
savedState->beginSection('PRIM');
state->beginSection('PRIM');
savedState->writeLESint32(_primitiveObjects.size());
state->writeLESint32(_primitiveObjects.size());
for (PrimitiveListType::iterator i = _primitiveObjects.begin(); i != _primitiveObjects.end(); i++) {
PrimitiveObject *p = *i;
ptr = makeIdFromPointer(p);
savedState->writeLEUint32(ptr.low);
savedState->writeLEUint32(ptr.hi);
p->saveState(savedState);
state->writeLEUint32(ptr.low);
state->writeLEUint32(ptr.hi);
p->saveState(state);
}
savedState->endSection();
state->endSection();
}
void GrimEngine::savegameCallback() {

View File

@ -75,7 +75,7 @@ void ImuseSndMgr::countElements(byte *ptr, int &numRegions, int &numJumps) {
void ImuseSndMgr::parseSoundHeader(byte *ptr, SoundDesc *sound, int &headerSize) {
if (READ_BE_UINT32(ptr) == MKID_BE('RIFF')) {
sound->region = new Region[1];
sound->jump = new Jump[0];
sound->jump = new Jump[1];
sound->numJumps = 0;
sound->numRegions = 1;
sound->region[0].offset = 0;

View File

@ -31,8 +31,8 @@
namespace Grim {
KeyframeAnim::KeyframeAnim(const char *filename, const char *data, int len) {
_fname = filename;
KeyframeAnim::KeyframeAnim(const char *fname, const char *data, int len) {
_fname = fname;
if (len >= 4 && READ_BE_UINT32(data) == MKID_BE('FYEK'))
loadBinary(data, len);

View File

@ -38,7 +38,7 @@ class LuaFile;
class Block {
public:
Block(const char *data, int len) : _data(data), _len(len) {}
Block(const char *dataPtr, int length) : _data(dataPtr), _len(length) {}
const char *data() const { return _data; }
int len() const { return _len; }

View File

@ -56,7 +56,7 @@ LipSync::LipSync(const char *filename, const char *data, int len) {
readPhoneme = READ_LE_UINT16(data + 2);
// Look for the animation corresponding to the phoneme
for (j = 0; j < _animTableSize && readPhoneme != _animTable[j].phoneme; j++);
for (j = 0; (j < _animTableSize) && (readPhoneme != _animTable[j].phoneme); j++) { ; }
if (readPhoneme != _animTable[j].phoneme) {
warning("Unknown phoneme: 0x%X in file %s", readPhoneme, filename);

View File

@ -129,8 +129,8 @@ static StkId callC(lua_CFunction f, StkId base) {
CS->lua2C = base;
CS->base = base + numarg; // == top - stack
if (lua_callhook) {
TObject *f = lua_state->stack.stack + base - 1;
(*lua_callhook)(Ref(f), "(C)", -1);
TObject *r = lua_state->stack.stack + base - 1;
(*lua_callhook)(Ref(r), "(C)", -1);
}
lua_state->state_counter2++;
(*f)(); // do the actual call

View File

@ -277,7 +277,7 @@ void lua_Restore(RestoreStream restoreStream, RestoreSint32 restoreSint32, Resto
else
tempString = luaS_createudata((void *)makePointerFromId(ptr), tag);
if (restoreCallbackPtr) {
PointerId ptr = makeIdFromPointer(tempString->globalval.value.ts);
ptr = makeIdFromPointer(tempString->globalval.value.ts);
ptr = restoreCallbackPtr(tempString->globalval.ttype, ptr, restoreSint32);
tempString->globalval.value.ts = (TaggedString *)makePointerFromId(ptr);
}
@ -358,7 +358,6 @@ void lua_Restore(RestoreStream restoreStream, RestoreSint32 restoreSint32, Resto
}
for (l = 0; l < countVariables; l++) {
PointerId ptr;
ptr.low = restoreSint32();
ptr.hi = restoreSint32();
tempProtoFunc->locvars[l].varname = (TaggedString *)makePointerFromId(ptr);

View File

@ -2043,7 +2043,7 @@ loop:
}
static void PrintLine() {
int vol = 127, buffer = 64, paramId = 1, x = -1, y = -1;
int vol = 127, buffer = 64, /*paramId = 1, */x = -1, y = -1;
bool background = true;
char msgId[50];
Common::String msg;

View File

@ -29,8 +29,8 @@
namespace Grim {
ObjectState::ObjectState(int setupID, ObjectState::Position pos, const char *bitmap, const char *zbitmap, bool transparency) :
_setupID(setupID), _pos(pos), _visibility(false) {
ObjectState::ObjectState(int setup, ObjectState::Position position, const char *bitmap, const char *zbitmap, bool transparency) :
_setupID(setup), _pos(position), _visibility(false) {
_bitmap = g_resourceloader->loadBitmap(bitmap);
if (zbitmap)
_zbitmap = g_resourceloader->loadBitmap(zbitmap);

View File

@ -48,7 +48,7 @@ public:
int setupID() const { return _setupID; }
Position pos() const { return _pos; }
void setPos(Position pos) { _pos = pos; }
void setPos(Position position) { _pos = position; }
const char *bitmapFilename() const {
return _bitmap->filename();

View File

@ -33,8 +33,8 @@
namespace Grim {
Scene::Scene(const char *name, const char *buf, int len) :
_locked(false), _name(name), _enableLights(false) {
Scene::Scene(const char *sceneName, const char *buf, int len) :
_locked(false), _name(sceneName), _enableLights(false) {
TextSplitter ts(buf, len);
char tempBuf[256];
@ -255,7 +255,7 @@ Sector *Scene::findPointSector(Graphics::Vector3d p, int flags) {
return NULL;
}
void Scene::findClosestSector(Graphics::Vector3d p, Sector **sect, Graphics::Vector3d *closestPt) {
void Scene::findClosestSector(Graphics::Vector3d p, Sector **sect, Graphics::Vector3d *closestPoint) {
Sector *resultSect = NULL;
Graphics::Vector3d resultPt = p;
float minDist = 0.0;
@ -268,7 +268,7 @@ void Scene::findClosestSector(Graphics::Vector3d p, Sector **sect, Graphics::Vec
float thisDist = (closestPt - p).magnitude();
if (!resultSect || thisDist < minDist) {
resultSect = sector;
resultPt = closestPt;
resultPt = *closestPoint;
minDist = thisDist;
}
}
@ -276,8 +276,8 @@ void Scene::findClosestSector(Graphics::Vector3d p, Sector **sect, Graphics::Vec
if (sect)
*sect = resultSect;
if (closestPt)
*closestPt = resultPt;
if (closestPoint)
*closestPoint = resultPt;
}
ObjectState *Scene::findState(const char *filename) {

View File

@ -106,7 +106,7 @@ public:
bool play(const char *filename, bool looping, int x, int y);
void stop();
void pause(bool pause) { _videoPause = pause; }
void pause(bool p) { _videoPause = p; }
bool isPlaying() { return !_videoFinished; }
bool isUpdateNeeded() { return _updateNeeded; }
byte *getDstPtr() { return _externalBuffer; }

View File

@ -156,16 +156,16 @@ void TextObject::createBitmap() {
_numberLines = (stringWidth / maxWidth) + 1;
int numberCharsPerLine = (msg.size() / _numberLines) + 1;
int line = 1;
int cline = 1;
int lineWidth = 0;
int maxLineWidth = 0;
for (int i = 0; i < (int)msg.size(); i++) {
lineWidth += MAX(_font->getCharWidth(msg[i]), _font->getCharDataWidth(msg[i]));
if (i + 1 == numberCharsPerLine * line) {
if (i + 1 == numberCharsPerLine * cline) {
if (lineWidth > maxLineWidth)
maxLineWidth = lineWidth;
++line;
++cline;
lineWidth = 0;
if (message.contains(' ')) {
@ -224,8 +224,8 @@ void TextObject::createBitmap() {
// Fill bitmap
int startOffset = 0;
for (unsigned int c = 0; c < currentLine.size(); c++) {
int ch = currentLine[c];
for (unsigned int d = 0; d < currentLine.size(); d++) {
int ch = currentLine[d];
int8 startingLine = _font->getCharStartingLine(ch) + _font->getBaseOffsetY();
int32 charDataWidth = _font->getCharDataWidth(ch);
int32 charWidth = _font->getCharWidth(ch);

View File

@ -33,7 +33,7 @@ namespace Grim {
void Sector::load(TextSplitter &ts) {
char buf[256];
int id = 0, i = 0;
int ident = 0, i = 0;
Graphics::Vector3d tempVert;
// Sector NAMES can be null, but ts isn't flexible enough
@ -44,10 +44,10 @@ void Sector::load(TextSplitter &ts) {
strcpy(buf, "");
}
ts.scanString(" id %d", 1, &id);
ts.scanString(" id %d", 1, &ident);
_name = buf;
_id = id;
_id = ident;
ts.scanString(" type %256s", 1, buf);
if (strstr(buf, "walk"))
@ -88,8 +88,8 @@ void Sector::load(TextSplitter &ts) {
_normal /= length;
}
void Sector::setVisible(bool visible) {
_visible = visible;
void Sector::setVisible(bool vis) {
_visible = vis;
}
bool Sector::isPointInSector(Graphics::Vector3d point) const {

View File

@ -58,7 +58,7 @@ void ZB_fillTriangleSmooth(ZBuffer *zb, ZBufferPoint *p0, ZBufferPoint *p1, ZBuf
register unsigned short *pz; \
register unsigned int *pz_2; \
register PIXEL *pp; \
register unsigned int tmp, z, zz, rgb, drgbdx; \
register unsigned int z, zz, rgb, drgbdx; \
register int n; \
n = (x2 >> 16) - x1; \
pp = pp1 + x1; \
@ -126,8 +126,8 @@ void ZB_fillTriangleMappingPerspective(ZBuffer *zb, ZBufferPoint *p0, ZBufferPoi
#define NB_INTERP 8
ZBufferPoint *t, *pr1 = 0, *pr2 = 0, *l1 = 0, *l2 = 0;
float fdx1, fdx2, fdy1, fdy2, fz, d1, d2;
ZBufferPoint *tp, *pr1 = 0, *pr2 = 0, *l1 = 0, *l2 = 0;
float fdx1, fdx2, fdy1, fdy2, fz0, d1, d2;
unsigned short *pz1;
unsigned int *pz2;
PIXEL *pp1;
@ -151,19 +151,19 @@ void ZB_fillTriangleMappingPerspective(ZBuffer *zb, ZBufferPoint *p0, ZBufferPoi
// we sort the vertex with increasing y
if (p1->y < p0->y) {
t = p0;
tp = p0;
p0 = p1;
p1 = t;
p1 = tp;
}
if (p2->y < p0->y) {
t = p2;
tp = p2;
p2 = p1;
p1 = p0;
p0 = t;
p0 = tp;
} else if (p2->y < p1->y) {
t = p1;
tp = p1;
p1 = p2;
p2 = t;
p2 = tp;
}
// we compute dXdx and dXdy for all interpolated values
@ -174,15 +174,15 @@ void ZB_fillTriangleMappingPerspective(ZBuffer *zb, ZBufferPoint *p0, ZBufferPoi
fdx2 = (float)(p2->x - p0->x);
fdy2 = (float)(p2->y - p0->y);
fz = fdx1 * fdy2 - fdx2 * fdy1;
if (fz == 0)
fz0 = fdx1 * fdy2 - fdx2 * fdy1;
if (fz0 == 0)
return;
fz = (float)(1.0 / fz);
fz0 = (float)(1.0 / fz0);
fdx1 *= fz;
fdy1 *= fz;
fdx2 *= fz;
fdy2 *= fz;
fdx1 *= fz0;
fdy1 *= fz0;
fdx2 *= fz0;
fdy2 *= fz0;
d1 = (float)(p1->z - p0->z);
d2 = (float)(p2->z - p0->z);
@ -244,7 +244,7 @@ void ZB_fillTriangleMappingPerspective(ZBuffer *zb, ZBufferPoint *p0, ZBufferPoi
for (part = 0; part < 2; part++) {
if (part == 0) {
if (fz > 0) {
if (fz0 > 0) {
update_left = 1;
update_right = 1;
l1 = p0;
@ -262,7 +262,7 @@ void ZB_fillTriangleMappingPerspective(ZBuffer *zb, ZBufferPoint *p0, ZBufferPoi
nb_lines = p1->y - p0->y;
} else {
// second part
if (fz > 0) {
if (fz0 > 0) {
update_left = 0;
update_right = 1;
pr1 = p1;

View File

@ -2,7 +2,7 @@
// We draw a triangle with various interpolations
{
ZBufferPoint *t, *pr1 = 0, *pr2 = 0, *l1 = 0, *l2 = 0;
ZBufferPoint *tp, *pr1 = 0, *pr2 = 0, *l1 = 0, *l2 = 0;
float fdx1, fdx2, fdy1, fdy2, fz, d1, d2;
unsigned short *pz1;
unsigned int *pz2;
@ -35,19 +35,19 @@
// we sort the vertex with increasing y
if (p1->y < p0->y) {
t = p0;
tp = p0;
p0 = p1;
p1 = t;
p1 = tp;
}
if (p2->y < p0->y) {
t = p2;
tp = p2;
p2 = p1;
p1 = p0;
p0 = t;
p0 = tp;
} else if (p2->y < p1->y) {
t = p1;
tp = p1;
p1 = p2;
p2 = t;
p2 = tp;
}
// we compute dXdx and dXdy for all interpolated values