fix warnings, cleanup code

This commit is contained in:
Pawel Kolodziejski 2005-08-10 08:33:45 +00:00
parent 0eec34348c
commit 0df9c083fd
16 changed files with 60 additions and 58 deletions

View file

@ -32,12 +32,12 @@
#include <cstring>
Actor::Actor(const char *name) :
_name(name), _talkColor(255, 255, 255), _pos(0, 0, 0),
_name(name), _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
_pitch(0), _yaw(0), _roll(0), _walkRate(1.0f), _turnRate(100.0f),
_reflectionAngle(80), _setName(""),
_reflectionAngle(80),
_visible(true), _lipSynch(NULL), _turning(false), _walking(false),
_restCostume(NULL), _restChore(-1),
_walkCostume(NULL), _walkChore(-1), _walkedLast(false), _walkedCur(false),
@ -588,7 +588,7 @@ void Actor::draw() {
}
// "Undraw objects" (handle objects for actors that may not be on screen)
void Actor::undraw(bool visible) {
void Actor::undraw(bool /*visible*/) {
if (!talking() || !g_imuse->isVoicePlaying())
shutUp();
}

View file

@ -206,8 +206,8 @@ void BitmapComponent::setKey(int val) {
}
ModelComponent::ModelComponent(Costume::Component *parent, int parentID, const char *filename, char *tag) :
Costume::Component(parent, parentID, tag), _filename(filename), _obj(NULL), _cmap(NULL),
_colormap(DEFAULT_COLORMAP), _hier(NULL) {
Costume::Component(parent, parentID, tag), _colormap(DEFAULT_COLORMAP), _filename(filename),
_obj(NULL), _cmap(NULL), _hier(NULL) {
const char *comma = std::strchr(filename, ',');
// Can be called with a comma and a numeric parameter afterward, but
@ -626,7 +626,7 @@ void SoundComponent::reset() {
}
Costume::Costume(const char *filename, const char *data, int len, Costume *prevCost) :
_fname(filename), _colormap(DEFAULT_COLORMAP) {
_colormap(DEFAULT_COLORMAP), _fname(filename) {
TextSplitter ts(data, len);
ts.expectString("costume v0.1");
@ -729,7 +729,7 @@ void Costume::Component::setParent(Component *newParent) {
}
// Should initialize the status variables so the chore can't play unexpectedly
Costume::Chore::Chore() : _playing(false), _hasPlayed(false), _looping(false), _currTime(-1) {
Costume::Chore::Chore() : _hasPlayed(false), _playing(false), _looping(false), _currTime(-1) {
}
void Costume::Chore::load(Costume *owner, TextSplitter &ts) {

View file

@ -47,11 +47,7 @@ public:
continue;
// Needs to handle Main Models (pigeons) and normal Models
// (when Manny climbs the rope)
if (
std::memcmp(_components[i]->tag(), "mmdl", 4) == 0
||
std::memcmp(_components[i]->tag(), "mat ", 4) == 0
)
if (std::memcmp(_components[i]->tag(), "mmdl", 4) == 0 || std::memcmp(_components[i]->tag(), "mat ", 4) == 0)
_components[i]->setMapName(_colormap);
}
}

View file

@ -106,3 +106,34 @@ void error(const char *fmt, ...) {
exit(1);
}
const char *debug_levels[] = {
"NONE",
"NORMAL",
"WARN",
"ERROR",
"FUNC",
"BITMAP",
"MODEL",
"STUB",
"SMUSH",
"IMUSE",
"CHORE",
"ALL"
};
const char *debug_descriptions[] = {
"No debug messages will be printed (default)",
"\"Normal\" debug messages will be printed",
"Warning debug messages will be printed",
"Error debug messages will be printed",
"Function (normal and stub) debug messages will be printed",
"Bitmap debug messages will be printed",
"Model debug messages will be printed",
"Stub (missing function) debug messages will be printed",
"SMUSH (video) debug messages will be printed",
"IMUSE (audio) debug messages will be printed",
"Chore debug messages will be printed",
"All debug messages will be printed",
};

31
debug.h
View file

@ -35,34 +35,9 @@ enum enDebugLevels {
DEBUG_ALL
};
extern enDebugLevels debugLevel;
static const char *debug_levels[] = {
"NONE",
"NORMAL",
"WARN",
"ERROR",
"FUNC",
"BITMAP",
"MODEL",
"STUB",
"SMUSH",
"IMUSE",
"CHORE",
"ALL"
};
static const char *debug_descriptions[] = {
"No debug messages will be printed (default)",
"\"Normal\" debug messages will be printed",
"Warning debug messages will be printed",
"Error debug messages will be printed",
"Function (normal and stub) debug messages will be printed",
"Bitmap debug messages will be printed",
"Model debug messages will be printed",
"Stub (missing function) debug messages will be printed",
"SMUSH (video) debug messages will be printed",
"IMUSE (audio) debug messages will be printed",
"Chore debug messages will be printed",
"All debug messages will be printed",
};
extern const char *debug_levels[];
extern const char *debug_descriptions[];
// Hacky toggles for experimental / debug code (defined/set in main.cpp)
extern bool ZBUFFER_GLOBAL, SHOWFPS_GLOBAL;

View file

@ -33,6 +33,7 @@ class Bitmap;
class Driver {
public:
Driver() { ; }
virtual ~Driver() { ; }
Driver(int screenW, int screenH, int screenBPP, bool fullscreen = false) {
_screenWidth = screenW;
_screenHeight = screenH;

View file

@ -699,7 +699,7 @@ void DriverGL::destroyTextBitmap(TextObjectHandle *handle) {
delete[] (GLuint *)handle->texIds;
}
Bitmap *DriverGL::getScreenshot(int w, int h) {
Bitmap *DriverGL::getScreenshot(int /*w*/, int /*h*/) {
return NULL;
}

View file

@ -66,8 +66,8 @@ public:
void drawBitmap();
Bitmap *getScreenshot(int w, int h);
void enableDim(int x, int y, int w, int h) { _dim = true; }
void disableDim(int x, int y, int w, int h) { _dim = false; }
void enableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = true; }
void disableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = false; }
void drawEmergString(int x, int y, const char *text, const Color &fgColor);
void loadEmergFont();

View file

@ -533,7 +533,7 @@ void DriverTinyGL::drawLine(PrimitiveObject *primitive) {
int y1 = primitive->getY1();
int y2 = primitive->getY2();
float m = (y2 - y1) / (x2 - x1);
int b = -m * x1 + y1;
int b = (int)(-m * x1 + y1);
Color color = primitive->getColor();
uint16 c = ((color.red() & 0xF8) << 8) | ((color.green() & 0xFC) << 3) | (color.blue() >> 3);

View file

@ -68,8 +68,8 @@ public:
void drawBitmap();
Bitmap *getScreenshot(int w, int h);
void enableDim(int x, int y, int w, int h) { _dim = true; }
void disableDim(int x, int y, int w, int h) { _dim = false; }
void enableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = true; }
void disableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = false; }
void drawEmergString(int x, int y, const char *text, const Color &fgColor);
void loadEmergFont();

View file

@ -534,7 +534,7 @@ void Engine::setSceneLock(const char *name, bool lockStatus) {
return;
}
// Change the locking status
scene->locked = lockStatus;
scene->_locked = lockStatus;
}
void Engine::setScene(const char *name) {
@ -553,7 +553,7 @@ void Engine::setScene(const char *name) {
registerScene(_currScene);
_currScene->setSoundParameters(20, 127);
// should delete the old scene after creating the new one
if (lastScene != NULL && !lastScene->locked) {
if (lastScene != NULL && !lastScene->_locked) {
removeScene(lastScene);
delete lastScene;
}
@ -566,7 +566,7 @@ void Engine::setScene(Scene *scene) {
_currScene = scene;
_currScene->setSoundParameters(20, 127);
// should delete the old scene after setting the new one
if (lastScene != NULL && !lastScene->locked) {
if (lastScene != NULL && !lastScene->_locked) {
removeScene(lastScene);
delete lastScene;
}

View file

@ -53,7 +53,7 @@ void PrimitiveObject::createRectangle(int x1, int x2, int y1, int y2, Color colo
_type = 1;
}
void PrimitiveObject::createBitmap(Bitmap *bitmap, int x, int y, bool transparent) {
void PrimitiveObject::createBitmap(Bitmap *bitmap, int x, int y, bool /*transparent*/) {
_type = 2;
_bitmap = bitmap;
_bitmap->setX(x);

View file

@ -31,7 +31,7 @@
#include <cmath>
Scene::Scene(const char *name, const char *buf, int len) :
_name(name), locked(false) {
_locked(false), _name(name) {
TextSplitter ts(buf, len);
char tempBuf[256];

View file

@ -121,7 +121,7 @@ public:
float _intensity, _umbraangle, _penumbraangle;
};
bool locked;
bool _locked;
private:

View file

@ -157,7 +157,7 @@ void Smush::handleFrame() {
_file.read(data, size);
anno = (char *)data;
if (strncmp(anno, ANNO_HEADER, sizeof(ANNO_HEADER)-1) == 0) {
char *annoData = anno + sizeof(ANNO_HEADER);
//char *annoData = anno + sizeof(ANNO_HEADER);
// Examples:
// Water streaming around boat from Manny's balcony

View file

@ -29,9 +29,8 @@ TextObjectDefaults textObjectDefaults;
TextObject::TextObject() :
_created(false), _x(0), _y(0), _width(0), _height(0), _justify(0),
_font(NULL), _textBitmap(NULL), _bitmapWidthPtr(NULL),
_bitmapHeightPtr(NULL), _disabled(false), _textObjectHandle(NULL),
_numberLines(1) {
_numberLines(1), _disabled(false), _font(NULL), _textBitmap(NULL),
_bitmapWidthPtr(NULL), _bitmapHeightPtr(NULL), _textObjectHandle(NULL) {
memset(_textID, 0, sizeof(_textID));
_fgColor._vals[0] = 0;
_fgColor._vals[1] = 0;