aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorFilippos Karapetis2008-12-04 18:38:02 +0000
committerFilippos Karapetis2008-12-04 18:38:02 +0000
commitb4cc40166eae9b31201d1c856f29b85b62d170a2 (patch)
tree6720389d196cd99346c0fcf503b80568cc536255 /engines/saga
parent5b74ea3d440109006dd42753d8532dc404718c70 (diff)
downloadscummvm-rg350-b4cc40166eae9b31201d1c856f29b85b62d170a2.tar.gz
scummvm-rg350-b4cc40166eae9b31201d1c856f29b85b62d170a2.tar.bz2
scummvm-rg350-b4cc40166eae9b31201d1c856f29b85b62d170a2.zip
Disabled all the test functions in SAGA. They can be enabled again by defining SAGA_DEBUG to 1 in saga.h. This cuts down on the engine size a bit, for devices with little memory (e.g. the DS)
svn-id: r35238
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/actor.h2
-rw-r--r--engines/saga/actor_path.cpp4
-rw-r--r--engines/saga/input.cpp7
-rw-r--r--engines/saga/objectmap.cpp6
-rw-r--r--engines/saga/objectmap.h4
-rw-r--r--engines/saga/render.cpp12
-rw-r--r--engines/saga/render.h4
-rw-r--r--engines/saga/saga.h1
8 files changed, 35 insertions, 5 deletions
diff --git a/engines/saga/actor.h b/engines/saga/actor.h
index c31b78731f..351abd78e3 100644
--- a/engines/saga/actor.h
+++ b/engines/saga/actor.h
@@ -604,7 +604,9 @@ public:
void drawSpeech();
+#ifdef ACTOR_DEBUG
void drawPathTest();
+#endif
uint16 hitTest(const Point &testPoint, bool skipProtagonist);
void takeExit(uint16 actorId, const HitZone *hitZone);
diff --git a/engines/saga/actor_path.cpp b/engines/saga/actor_path.cpp
index 1a6fff8395..434b019f67 100644
--- a/engines/saga/actor_path.cpp
+++ b/engines/saga/actor_path.cpp
@@ -589,8 +589,8 @@ void Actor::removePathPoints() {
_pathNodeListIndex = j - 1;
}
-void Actor::drawPathTest() {
#ifdef ACTOR_DEBUG
+void Actor::drawPathTest() {
int i;
Surface *surface;
surface = _vm->_gfx->getBackBuffer();
@@ -601,7 +601,7 @@ void Actor::drawPathTest() {
for (i = 0; i < _debugPointsCount; i++) {
*((byte *)surface->pixels + (_debugPoints[i].point.y * surface->pitch) + _debugPoints[i].point.x) = _debugPoints[i].color;
}
-#endif
}
+#endif
} // End of namespace Saga
diff --git a/engines/saga/input.cpp b/engines/saga/input.cpp
index 61b729b701..7bce00686c 100644
--- a/engines/saga/input.cpp
+++ b/engines/saga/input.cpp
@@ -77,6 +77,8 @@ int SagaEngine::processInput() {
}
break;
#endif
+
+#ifdef SAGA_DEBUG
case Common::KEYCODE_F1:
_render->toggleFlag(RF_SHOW_FPS);
_actor->_handleActionDiv = (_actor->_handleActionDiv == 15) ? 50 : 15;
@@ -90,10 +92,13 @@ int SagaEngine::processInput() {
case Common::KEYCODE_F4:
_render->toggleFlag(RF_OBJECTMAP_TEST);
break;
+#endif
case Common::KEYCODE_F5:
if (_interface->getSaveReminderState() > 0)
_interface->setMode(kPanelOption);
break;
+
+#ifdef SAGA_DEBUG
case Common::KEYCODE_F6:
_render->toggleFlag(RF_ACTOR_PATH_TEST);
break;
@@ -102,6 +107,8 @@ int SagaEngine::processInput() {
break;
case Common::KEYCODE_F8:
break;
+#endif
+
case Common::KEYCODE_F9:
_interface->keyBoss();
break;
diff --git a/engines/saga/objectmap.cpp b/engines/saga/objectmap.cpp
index c500ccf5ab..6ad3d38cfb 100644
--- a/engines/saga/objectmap.cpp
+++ b/engines/saga/objectmap.cpp
@@ -141,6 +141,7 @@ bool HitZone::hitTest(const Point &testPoint) {
return false;
}
+#ifdef SAGA_DEBUG
void HitZone::draw(SagaEngine *vm, Surface *ds, int color) {
int i, pointsCount, j;
Location location;
@@ -186,7 +187,7 @@ void HitZone::draw(SagaEngine *vm, Surface *ds, int color) {
ds->drawFrame(specialPoint1, specialPoint2, color);
}
}
-
+#endif
// Loads an object map resource ( objects ( clickareas ( points ) ) )
void ObjectMap::load(const byte *resourcePointer, size_t resourceLength) {
@@ -235,7 +236,7 @@ void ObjectMap::freeMem() {
}
-
+#ifdef SAGA_DEBUG
void ObjectMap::draw(Surface *ds, const Point& testPoint, int color, int color2) {
int i;
int hitZoneIndex;
@@ -264,6 +265,7 @@ void ObjectMap::draw(Surface *ds, const Point& testPoint, int color, int color2)
_vm->_font->textDraw(kKnownFontSmall, ds, txtBuf, textPoint, kITEColorBrightWhite, kITEColorBlack, kFontOutline);
}
}
+#endif
int ObjectMap::hitTest(const Point& testPoint) {
int i;
diff --git a/engines/saga/objectmap.h b/engines/saga/objectmap.h
index e9c04bf476..05207007db 100644
--- a/engines/saga/objectmap.h
+++ b/engines/saga/objectmap.h
@@ -76,7 +76,9 @@ public:
return objectIndexToId(kGameObjectStepZone, _index);
}
bool getSpecialPoint(Point &specialPoint) const;
+#ifdef SAGA_DEBUG
void draw(SagaEngine *vm, Surface *ds, int color);
+#endif
bool hitTest(const Point &testPoint);
private:
@@ -104,7 +106,9 @@ public:
void load(const byte *resourcePointer, size_t resourceLength);
void freeMem(void);
+#ifdef SAGA_DEBUG
void draw(Surface *drawSurface, const Point& testPoint, int color, int color2);
+#endif
int hitTest(const Point& testPoint);
HitZone *getHitZone(int16 index) {
if ((index < 0) || (index >= _hitZoneListCount)) {
diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp
index 8f7e9e5b50..17ad13b11b 100644
--- a/engines/saga/render.cpp
+++ b/engines/saga/render.cpp
@@ -73,7 +73,6 @@ bool Render::initialized() {
void Render::drawScene() {
Surface *backBufferSurface;
- char txtBuffer[20];
Point mousePoint;
Point textPoint;
@@ -101,15 +100,21 @@ void Render::drawScene() {
_vm->_actor->drawActors();
}
+#ifdef SAGA_DEBUG
if (getFlags() & RF_OBJECTMAP_TEST) {
if (_vm->_scene->_objectMap)
_vm->_scene->_objectMap->draw(backBufferSurface, mousePoint, kITEColorBrightWhite, kITEColorBlack);
if (_vm->_scene->_actionMap)
_vm->_scene->_actionMap->draw(backBufferSurface, mousePoint, kITEColorRed, kITEColorBlack);
}
+#endif
+
+#ifdef ACTOR_DEBUG
if (getFlags() & RF_ACTOR_PATH_TEST) {
_vm->_actor->drawPathTest();
}
+#endif
+
}
}
@@ -143,14 +148,17 @@ void Render::drawScene() {
// Handle user input
_vm->processInput();
+#ifdef SAGA_DEBUG
// Display rendering information
if (_flags & RF_SHOW_FPS) {
+ char txtBuffer[20];
sprintf(txtBuffer, "%d", _fps);
textPoint.x = backBufferSurface->w - _vm->_font->getStringWidth(kKnownFontSmall, txtBuffer, 0, kFontOutline);
textPoint.y = 2;
_vm->_font->textDraw(kKnownFontSmall, backBufferSurface, txtBuffer, textPoint, kITEColorBrightWhite, kITEColorBlack, kFontOutline);
}
+#endif
// Display "paused game" message, if applicable
if (_flags & RF_RENDERPAUSE) {
@@ -170,6 +178,7 @@ void Render::drawScene() {
// Update user interface
_vm->_interface->update(mousePoint, UPDATE_MOUSEMOVE);
+#ifdef SAGA_DEBUG
// Display text formatting test, if applicable
if (_flags & RF_TEXT_TEST) {
Rect rect(mousePoint.x, mousePoint.y, mousePoint.x + 100, mousePoint.y + 50);
@@ -181,6 +190,7 @@ void Render::drawScene() {
if (_flags & RF_PALETTE_TEST) {
backBufferSurface->drawPalette();
}
+#endif
_system->copyRectToScreen((byte *)backBufferSurface->pixels, backBufferSurface->w, 0, 0,
backBufferSurface->w, backBufferSurface->h);
diff --git a/engines/saga/render.h b/engines/saga/render.h
index 55c59a7631..caf68d4c51 100644
--- a/engines/saga/render.h
+++ b/engines/saga/render.h
@@ -33,13 +33,17 @@
namespace Saga {
enum RENDER_FLAGS {
+#ifdef SAGA_DEBUG
RF_SHOW_FPS = (1 << 0),
RF_PALETTE_TEST = (1 << 1),
RF_TEXT_TEST = (1 << 2),
RF_OBJECTMAP_TEST = (1 << 3),
+#endif
RF_RENDERPAUSE = (1 << 4),
RF_GAMEPAUSE = (1 << 5),
+#ifdef SAGA_DEBUG
RF_ACTOR_PATH_TEST = (1 << 6),
+#endif
RF_MAP = (1 << 7),
RF_DISABLE_ACTORS = (1 << 8),
RF_DEMO_SUBST = (1 << 9)
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 7276d93c94..8e26a46e1f 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -65,6 +65,7 @@ struct StringList;
using Common::MemoryReadStream;
using Common::MemoryReadStreamEndian;
+//#define SAGA_DEBUG 1 // define for test functions
#define SAGA_IMAGE_DATA_OFFSET 776
#define SAGA_IMAGE_HEADER_LEN 8