aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorEugene Sandulenko2004-10-07 23:02:19 +0000
committerEugene Sandulenko2004-10-07 23:02:19 +0000
commit4dc49e713b04137a4242ee64b901713e4ff43136 (patch)
treeff5e26d1e1921605bf625e1979d03066ec6fde20 /saga
parent29a5f6bbd37ce1f2ca3d41f215d4bd2608c0a9ac (diff)
downloadscummvm-rg350-4dc49e713b04137a4242ee64b901713e4ff43136.tar.gz
scummvm-rg350-4dc49e713b04137a4242ee64b901713e4ff43136.tar.bz2
scummvm-rg350-4dc49e713b04137a4242ee64b901713e4ff43136.zip
Turn ObjectMap into real object.
svn-id: r15457
Diffstat (limited to 'saga')
-rw-r--r--saga/interface.cpp12
-rw-r--r--saga/objectmap.cpp175
-rw-r--r--saga/objectmap.h26
-rw-r--r--saga/render.cpp19
-rw-r--r--saga/render.h4
-rw-r--r--saga/saga.cpp6
-rw-r--r--saga/saga.h2
-rw-r--r--saga/scene.cpp18
-rw-r--r--saga/scene.h7
9 files changed, 119 insertions, 150 deletions
diff --git a/saga/interface.cpp b/saga/interface.cpp
index 8ad46fa0a5..93e22c4a80 100644
--- a/saga/interface.cpp
+++ b/saga/interface.cpp
@@ -484,7 +484,7 @@ int Interface::handlePlayfieldClick(R_SURFACE *ds, Point *imouse_pt) {
int script_num;
Point iactor_pt;
- hit_object = _vm->_objectMap->hitTest(imouse_pt, &object_num);
+ hit_object = _vm->_scene->_objectMap->hitTest(imouse_pt, &object_num);
if (hit_object != R_SUCCESS) {
// Player clicked on empty spot - walk here regardless of verb
@@ -493,10 +493,10 @@ int Interface::handlePlayfieldClick(R_SURFACE *ds, Point *imouse_pt) {
return R_SUCCESS;
}
- object_flags = _vm->_objectMap->getFlags(object_num);
+ object_flags = _vm->_scene->_objectMap->getFlags(object_num);
if (object_flags & R_OBJECT_NORMAL) {
- if ((script_num = _vm->_objectMap->getEPNum(object_num)) != -1) {
+ if ((script_num = _vm->_scene->_objectMap->getEPNum(object_num)) != -1) {
// Set active verb in script module
_vm->_sdata->putWord(4, 4, I_VerbData[_activeVerb].s_verb);
@@ -525,7 +525,7 @@ int Interface::handlePlayfieldUpdate(R_SURFACE *ds, Point *imouse_pt) {
new_status[0] = 0;
- hit_object = _vm->_objectMap->hitTest(imouse_pt, &object_num);
+ hit_object = _vm->_scene->_objectMap->hitTest(imouse_pt, &object_num);
if (hit_object != R_SUCCESS) {
// Cursor over nothing - just display current verb
@@ -533,9 +533,9 @@ int Interface::handlePlayfieldUpdate(R_SURFACE *ds, Point *imouse_pt) {
return R_SUCCESS;
}
- object_flags = _vm->_objectMap->getFlags(object_num);
+ object_flags = _vm->_scene->_objectMap->getFlags(object_num);
- object_name = _vm->_objectMap->getName(object_num);
+ object_name = _vm->_scene->_objectMap->getName(object_num);
if (object_flags & R_OBJECT_NORMAL) {
// Normal scene object - display as subject of verb
diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp
index 7b9ebaee2c..7f5003a59d 100644
--- a/saga/objectmap.cpp
+++ b/saga/objectmap.cpp
@@ -36,33 +36,16 @@
namespace Saga {
-static void CF_object_info(int argc, char *argv[], void *refCon);
-
-int ObjectMap::reg() {
- CVAR_RegisterFunc(CF_object_info, "object_info", NULL, R_CVAR_NONE, 0, 0, this);
-
- return R_SUCCESS;
-}
-
// Initializes the object map module, creates module allocation context
-ObjectMap::ObjectMap(Gfx *gfx) {
- debug(0, "ObjectMap Module: Initializing...");
- _gfx = gfx;
- _initialized = 1;
- _objects_loaded = 0;
- _names_loaded = 0;
+ObjectMap::ObjectMap(SagaEngine *vm) : _vm(vm) {
+ _objectsLoaded = false;
+ _namesLoaded = false;
}
// Shuts down the object map module, destroys module allocation context
ObjectMap::~ObjectMap() {
- debug(0, "ObjectMap Module: Shutting down...");
-
freeMem();
freeNames();
-
- debug(0, "ObjectMap Module: Shutdown OK.");
-
- _initialized = 0;
}
// Loads an object map resource ( objects ( clickareas ( points ) ) )
@@ -75,35 +58,30 @@ int ObjectMap::load(const byte *om_res, size_t om_res_len) {
MemoryReadStream readS(om_res, om_res_len);
- if (!_initialized) {
- warning("Error: Object map module not initialized");
- return R_FAILURE;
- }
-
- if (_objects_loaded) {
+ if (_objectsLoaded) {
freeMem();
}
// Obtain object count N and allocate space for N objects
- _n_objects = readS.readUint16LE();
+ _nObjects = readS.readUint16LE();
- _object_maps = (R_OBJECTMAP_ENTRY *)malloc(_n_objects * sizeof *_object_maps);
+ _objectMaps = (R_OBJECTMAP_ENTRY *)malloc(_nObjects * sizeof *_objectMaps);
- if (_object_maps == NULL) {
+ if (_objectMaps == NULL) {
warning("Error: Memory allocation failed");
return R_MEM;
}
// Load all N objects
- for (i = 0; i < _n_objects; i++) {
- object_map = &_object_maps[i];
+ for (i = 0; i < _nObjects; i++) {
+ object_map = &_objectMaps[i];
object_map->flags = readS.readByte();
- object_map->n_clickareas = readS.readByte();
+ object_map->nClickareas = readS.readByte();
object_map->defaultVerb = readS.readByte();
readS.readByte();
- object_map->object_num = readS.readUint16LE();
- object_map->script_num = readS.readUint16LE();
- object_map->clickareas = (R_CLICKAREA *)malloc(object_map->n_clickareas * sizeof *(object_map->clickareas));
+ object_map->objectNum = readS.readUint16LE();
+ object_map->scriptNum = readS.readUint16LE();
+ object_map->clickareas = (R_CLICKAREA *)malloc(object_map->nClickareas * sizeof *(object_map->clickareas));
if (object_map->clickareas == NULL) {
warning("Error: Memory allocation failed");
@@ -111,7 +89,7 @@ int ObjectMap::load(const byte *om_res, size_t om_res_len) {
}
// Load all clickareas for this object
- for (k = 0; k < object_map->n_clickareas; k++) {
+ for (k = 0; k < object_map->nClickareas; k++) {
clickarea = &object_map->clickareas[k];
clickarea->n_points = readS.readUint16LE();
assert(clickarea->n_points != 0);
@@ -129,11 +107,11 @@ int ObjectMap::load(const byte *om_res, size_t om_res_len) {
point->y = readS.readSint16LE();
}
debug(2, "ObjectMap::load(): Read %d points for clickarea %d in object %d.",
- clickarea->n_points, k, object_map->object_num);
+ clickarea->n_points, k, object_map->objectNum);
}
}
- _objects_loaded = 1;
+ _objectsLoaded = true;
return R_SUCCESS;
}
@@ -145,24 +123,24 @@ int ObjectMap::freeMem() {
int i, k;
- if (!_objects_loaded) {
+ if (!_objectsLoaded) {
return R_FAILURE;
}
- for (i = 0; i < _n_objects; i++) {
- object_map = &_object_maps[i];
- for (k = 0; k < object_map->n_clickareas; k++) {
+ for (i = 0; i < _nObjects; i++) {
+ object_map = &_objectMaps[i];
+ for (k = 0; k < object_map->nClickareas; k++) {
clickarea = &object_map->clickareas[k];
free(clickarea->points);
}
free(object_map->clickareas);
}
- if (_n_objects) {
- free(_object_maps);
+ if (_nObjects) {
+ free(_objectMaps);
}
- _objects_loaded = 0;
+ _objectsLoaded = false;
return R_SUCCESS;
}
@@ -177,14 +155,14 @@ int ObjectMap::loadNames(const unsigned char *onl_res, size_t onl_res_len) {
MemoryReadStream readS(onl_res, onl_res_len);
- if (_names_loaded) {
+ if (_namesLoaded) {
freeNames();
}
table_len = readS.readUint16LE();
n_names = table_len / 2 - 2;
- _n_names = n_names;
+ _nNames = n_names;
debug(2, "ObjectMap::loadNames: Loading %d object names.", n_names);
_names = (const char **)malloc(n_names * sizeof *_names);
@@ -201,22 +179,22 @@ int ObjectMap::loadNames(const unsigned char *onl_res, size_t onl_res_len) {
debug(3, "Loaded object name string: %s", _names[i]);
}
- _names_loaded = 1;
+ _namesLoaded = true;
return R_SUCCESS;
}
// Frees all storage allocated for the current object name list data
int ObjectMap::freeNames() {
- if (!_names_loaded) {
+ if (!_namesLoaded) {
return R_FAILURE;
}
- if (_n_names) {
+ if (_nNames) {
free(_names);
}
- _names_loaded = 0;
+ _namesLoaded = false;
return R_SUCCESS;
}
@@ -225,8 +203,8 @@ int ObjectMap::freeNames() {
// corresponding to 'object' and returns R_SUCCESS. Otherwise it returns
// R_FAILURE.
const char *ObjectMap::getName(int object) {
- assert(_names_loaded);
- assert((object > 0) && (object <= _n_names));
+ assert(_namesLoaded);
+ assert((object > 0) && (object <= _nNames));
return _names[object - 1];
}
@@ -234,12 +212,12 @@ const char *ObjectMap::getName(int object) {
const uint16 ObjectMap::getFlags(int object) {
int i;
- assert(_names_loaded);
- assert((object > 0) && (object <= _n_names));
+ assert(_namesLoaded);
+ assert((object > 0) && (object <= _nNames));
- for (i = 0; i < _n_objects; i++) {
- if (_object_maps[i].object_num == object) {
- return _object_maps[i].flags;
+ for (i = 0; i < _nObjects; i++) {
+ if (_objectMaps[i].objectNum == object) {
+ return _objectMaps[i].flags;
}
}
@@ -253,14 +231,14 @@ const uint16 ObjectMap::getFlags(int object) {
const int ObjectMap::getEPNum(int object) {
int i;
- assert(_names_loaded);
+ assert(_namesLoaded);
- if ((object < 0) || (object > (_n_objects + 1)))
+ if ((object < 0) || (object > (_nObjects + 1)))
return -1;
- for (i = 0; i < _n_objects; i++)
- if (_object_maps[i].object_num == object)
- return _object_maps[i].script_num;
+ for (i = 0; i < _nObjects; i++)
+ if (_objectMaps[i].objectNum == object)
+ return _objectMaps[i].scriptNum;
return -1;
}
@@ -277,52 +255,50 @@ int ObjectMap::draw(R_SURFACE *ds, Point *imouse_pt, int color, int color2) {
int draw_txt = 0;
int hit_object = 0;
- int object_num = 0;
+ int objectNum = 0;
int pointcount = 0;
int i, k;
- assert(_initialized);
-
- if (!_objects_loaded) {
+ if (!_objectsLoaded) {
return R_FAILURE;
}
if (imouse_pt != NULL) {
- if (hitTest(imouse_pt, &object_num) == R_SUCCESS) {
+ if (hitTest(imouse_pt, &objectNum) == R_SUCCESS) {
hit_object = 1;
}
}
- for (i = 0; i < _n_objects; i++) {
+ for (i = 0; i < _nObjects; i++) {
draw_color = color;
- if (hit_object && (object_num == _object_maps[i].object_num)) {
+ if (hit_object && (objectNum == _objectMaps[i].objectNum)) {
snprintf(txt_buf, sizeof txt_buf, "obj %d: v %d, f %X",
- _object_maps[i].object_num,
- _object_maps[i].defaultVerb,
- _object_maps[i].flags);
+ _objectMaps[i].objectNum,
+ _objectMaps[i].defaultVerb,
+ _objectMaps[i].flags);
draw_txt = 1;
draw_color = color2;
}
- object_map = &_object_maps[i];
+ object_map = &_objectMaps[i];
- for (k = 0; k < object_map->n_clickareas; k++) {
+ for (k = 0; k < object_map->nClickareas; k++) {
clickarea = &object_map->clickareas[k];
pointcount = 0;
if (clickarea->n_points == 2) {
// 2 points represent a box
- _gfx->drawFrame(ds, &clickarea->points[0], &clickarea->points[1], draw_color);
+ _vm->_gfx->drawFrame(ds, &clickarea->points[0], &clickarea->points[1], draw_color);
} else if (clickarea->n_points > 2) {
// Otherwise draw a polyline
- _gfx->drawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
+ _vm->_gfx->drawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
}
}
}
if (draw_txt) {
_vm->_font->draw(SMALL_FONT_ID, ds, txt_buf, 0, 2, 2,
- _gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE);
+ _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
}
return R_SUCCESS;
@@ -353,7 +329,7 @@ static bool MATH_HitTestPoly(Point *points, unsigned int npoints, Point test_poi
return inside_flag;
}
-int ObjectMap::hitTest(Point * imouse_pt, int *object_num) {
+int ObjectMap::hitTest(Point *imouse_pt, int *objectNum) {
Point imouse;
R_OBJECTMAP_ENTRY *object_map;
R_CLICKAREA *clickarea;
@@ -362,17 +338,17 @@ int ObjectMap::hitTest(Point * imouse_pt, int *object_num) {
int i, k;
- assert((imouse_pt != NULL) && (object_num != NULL));
+ assert((imouse_pt != NULL) && (objectNum != NULL));
imouse.x = imouse_pt->x;
imouse.y = imouse_pt->y;
// Loop through all scene objects
- for (i = 0; i < _n_objects; i++) {
- object_map = &_object_maps[i];
+ for (i = 0; i < _nObjects; i++) {
+ object_map = &_objectMaps[i];
// Hit-test all clickareas for this object
- for (k = 0; k < object_map->n_clickareas; k++) {
+ for (k = 0; k < object_map->nClickareas; k++) {
clickarea = &object_map->clickareas[k];
n_points = clickarea->n_points;
points = clickarea->points;
@@ -382,51 +358,40 @@ int ObjectMap::hitTest(Point * imouse_pt, int *object_num) {
if ((imouse.x > points[0].x) && (imouse.x <= points[1].x) &&
(imouse.y > points[0].y) &&
(imouse.y <= points[1].y)) {
- *object_num = object_map->object_num;
+ *objectNum = object_map->objectNum;
return R_SUCCESS;
}
} else if (n_points > 2) {
// Hit-test a polygon
if (MATH_HitTestPoly(points, n_points, imouse)) {
- *object_num = object_map->object_num;
+ *objectNum = object_map->objectNum;
return R_SUCCESS;
}
}
}
}
- *object_num = 0;
+ *objectNum = 0;
return R_FAILURE;
}
-void ObjectMap::objectInfo(int argc, char *argv[]) {
+void ObjectMap::info(void) {
int i;
- (void)(argc);
- (void)(argv);
-
- if (!_initialized) {
- return;
- }
-
- _vm->_console->print("%d objects loaded.", _n_objects);
+ _vm->_console->print("%d objects loaded.", _nObjects);
- for (i = 0; i < _n_objects; i++) {
+ for (i = 0; i < _nObjects; i++) {
_vm->_console->print("%s:", _names[i]);
_vm->_console->print("%d. verb: %d, flags: %X, name_i: %d, scr_n: %d, ca_ct: %d", i,
- _object_maps[i].defaultVerb,
- _object_maps[i].flags,
- _object_maps[i].object_num,
- _object_maps[i].script_num,
- _object_maps[i].n_clickareas);
+ _objectMaps[i].defaultVerb,
+ _objectMaps[i].flags,
+ _objectMaps[i].objectNum,
+ _objectMaps[i].scriptNum,
+ _objectMaps[i].nClickareas);
}
return;
}
-static void CF_object_info(int argc, char *argv[], void *refCon) {
- ((ObjectMap *)refCon)->objectInfo(argc, argv);
-}
-
} // End of namespace Saga
diff --git a/saga/objectmap.h b/saga/objectmap.h
index 47350825f1..89ed7d4a34 100644
--- a/saga/objectmap.h
+++ b/saga/objectmap.h
@@ -42,10 +42,10 @@ struct R_OBJECTMAP_ENTRY {
byte flags;
byte defaultVerb;
- int object_num;
- int script_num;
+ int objectNum;
+ int scriptNum;
- int n_clickareas;
+ int nClickareas;
R_CLICKAREA *clickareas;
};
@@ -54,7 +54,7 @@ class Gfx;
class ObjectMap{
public:
int reg(void);
- ObjectMap(Gfx *gfx);
+ ObjectMap(SagaEngine *vm);
~ObjectMap(void);
int load(const byte *om_res, size_t om_res_len);
int freeMem(void);
@@ -63,20 +63,20 @@ public:
const char *getName(int object);
const uint16 getFlags(int object);
const int getEPNum(int object);
- int draw(R_SURFACE *draw_surface, Point *imouse_pt, int color, int color2);
+ int draw(R_SURFACE *draw_surface, Point *imousePt, int color, int color2);
int hitTest(Point *imouse_pt, int *object_num);
- void objectInfo(int argc, char *argv[]);
+ void info(void);
+
private:
- int _initialized;
- int _objects_loaded;
- int _n_objects;
- R_OBJECTMAP_ENTRY *_object_maps;
+ bool _objectsLoaded;
+ int _nObjects;
+ R_OBJECTMAP_ENTRY *_objectMaps;
- int _names_loaded;
- int _n_names;
+ bool _namesLoaded;
+ int _nNames;
const char **_names;
- Gfx *_gfx;
+ SagaEngine *_vm;
};
} // End of namespace Saga
diff --git a/saga/render.cpp b/saga/render.cpp
index 0d1337e68b..df7536f704 100644
--- a/saga/render.cpp
+++ b/saga/render.cpp
@@ -34,6 +34,7 @@
#include "saga/scene.h"
#include "saga/text.h"
+#include "saga/actionmap.h"
#include "saga/objectmap.h"
#include "saga/render.h"
@@ -47,11 +48,9 @@ int Render::reg(void) {
return R_SUCCESS;
}
-Render::Render(SagaEngine *vm, OSystem *system, Gfx *gfx, ObjectMap *omap) {
+Render::Render(SagaEngine *vm, OSystem *system) {
_vm = vm;
_system = system;
- _gfx = gfx;
- _omap = omap;
_initialized = false;
R_GAME_DISPLAYINFO disp_info;
@@ -87,7 +86,7 @@ Render::Render(SagaEngine *vm, OSystem *system, Gfx *gfx, ObjectMap *omap) {
_tmp_buf_w = tmp_w;
_tmp_buf_h = tmp_h;
- _backbuf_surface = _gfx->getBackBuffer();
+ _backbuf_surface = _vm->_gfx->getBackBuffer();
_flags = 0;
_initialized = true;
@@ -135,8 +134,8 @@ int Render::drawScene() {
// Display scene maps, if applicable
if (getFlags() & RF_OBJECTMAP_TEST) {
- _omap->draw(backbuf_surface, &mouse_pt, _gfx->getWhite(), _gfx->getBlack());
- _vm->_scene->drawActionMap(backbuf_surface, _gfx->matchColor(R_RGB_RED));
+ _vm->_scene->_objectMap->draw(backbuf_surface, &mouse_pt, _vm->_gfx->getWhite(), _vm->_gfx->getBlack());
+ _vm->_scene->_actionMap->draw(backbuf_surface, _vm->_gfx->matchColor(R_RGB_RED));
}
// Draw queued actors
@@ -155,7 +154,7 @@ int Render::drawScene() {
sprintf(txt_buf, "%d", _fps);
fps_width = _vm->_font->getStringWidth(SMALL_FONT_ID, txt_buf, 0, FONT_NORMAL);
_vm->_font->draw(SMALL_FONT_ID, backbuf_surface, txt_buf, 0, backbuf_surface->buf_w - fps_width, 2,
- _gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE);
+ _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
}
// Display "paused game" message, if applicable
@@ -163,7 +162,7 @@ int Render::drawScene() {
int msg_len = strlen(R_PAUSEGAME_MSG);
int msg_w = _vm->_font->getStringWidth(BIG_FONT_ID, R_PAUSEGAME_MSG, msg_len, FONT_OUTLINE);
_vm->_font->draw(BIG_FONT_ID, backbuf_surface, R_PAUSEGAME_MSG, msg_len,
- (backbuf_surface->buf_w - msg_w) / 2, 90, _gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE);
+ (backbuf_surface->buf_w - msg_w) / 2, 90, _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
}
// Update user interface
@@ -173,12 +172,12 @@ int Render::drawScene() {
// Display text formatting test, if applicable
if (_flags & RF_TEXT_TEST) {
_vm->textDraw(MEDIUM_FONT_ID, backbuf_surface, test_txt, mouse_pt.x, mouse_pt.y,
- _gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE | FONT_CENTERED);
+ _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE | FONT_CENTERED);
}
// Display palette test, if applicable
if (_flags & RF_PALETTE_TEST) {
- _gfx->drawPalette(backbuf_surface);
+ _vm->_gfx->drawPalette(backbuf_surface);
}
// Draw console
diff --git a/saga/render.h b/saga/render.h
index c8c90c3eda..a694f718e5 100644
--- a/saga/render.h
+++ b/saga/render.h
@@ -52,7 +52,7 @@ struct R_BUFFER_INFO {
class Render {
public:
int reg(void);
- Render(SagaEngine *vm, OSystem *system, Gfx *gfx, ObjectMap *omap);
+ Render(SagaEngine *vm, OSystem *system);
~Render(void);
bool initialized();
int drawScene(void);
@@ -70,8 +70,6 @@ private:
SagaEngine *_vm;
OSystem *_system;
bool _initialized;
- Gfx *_gfx;
- ObjectMap *_omap;
// Module data
R_SURFACE *_backbuf_surface;
diff --git a/saga/saga.cpp b/saga/saga.cpp
index 6b1b2780c8..df42153402 100644
--- a/saga/saga.cpp
+++ b/saga/saga.cpp
@@ -50,7 +50,6 @@
#include "saga/sdata.h"
#include "saga/sndres.h"
#include "saga/sprite.h"
-#include "saga/objectmap.h"
#include "saga/sound.h"
#include "saga/music.h"
#include "saga/game_mod.h"
@@ -184,9 +183,8 @@ void SagaEngine::go() {
_gfx = new Gfx(_system, disp_info.logical_w, disp_info.logical_h);
_isoMap = new IsoMap(_gfx);
- _objectMap = new ObjectMap(_gfx);
- _render = new Render(this, _system, _gfx, _objectMap);
+ _render = new Render(this, _system);
if (!_render->initialized()) {
return;
}
@@ -205,7 +203,6 @@ void SagaEngine::go() {
_script->reg();
_render->reg();
_anim->reg();
- _objectMap->reg();
_previousTicks = _system->getMillis();
@@ -254,7 +251,6 @@ void SagaEngine::shutdown() {
delete _interface;
delete _render;
delete _isoMap;
- delete _objectMap;
delete _sndRes;
delete _sdata;
// Shutdown system modules */
diff --git a/saga/saga.h b/saga/saga.h
index 63456c5a20..d5c906917c 100644
--- a/saga/saga.h
+++ b/saga/saga.h
@@ -46,7 +46,6 @@ class Music;
class Anim;
class Render;
class IsoMap;
-class ObjectMap;
class Gfx;
class SData;
class Script;
@@ -100,7 +99,6 @@ public:
Anim *_anim;
Render *_render;
IsoMap *_isoMap;
- ObjectMap *_objectMap;
Gfx *_gfx;
SData *_sdata;
Script *_script;
diff --git a/saga/scene.cpp b/saga/scene.cpp
index 3eb0f1b64d..13ef26c975 100644
--- a/saga/scene.cpp
+++ b/saga/scene.cpp
@@ -49,6 +49,7 @@ namespace Saga {
static void CF_scenechange(int argc, char *argv[], void *refCon);
static void CF_sceneinfo(int argc, char *argv[], void *refCon);
static void CF_actioninfo(int argc, char *argv[], void *refCon);
+static void CF_objectinfo(int argc, char *argv[], void *refCon);
int Scene::reg() {
@@ -57,6 +58,7 @@ int Scene::reg() {
CVAR_RegisterFunc(CF_sceneinfo, "scene_info", NULL, R_CVAR_NONE, 0, 0, this);
CVAR_RegisterFunc(CF_actioninfo,
"action_info", NULL, R_CVAR_NONE, 0, 0, this);
+ CVAR_RegisterFunc(CF_objectinfo, "object_info", NULL, R_CVAR_NONE, 0, 0, this);
return R_SUCCESS;
}
@@ -627,6 +629,8 @@ int Scene::processSceneResources() {
const byte *pal_p;
int i;
+ _objectMap = new ObjectMap(_vm);
+
// Process the scene resource list
for (i = 0; i < _resListEntries; i++) {
res_data = _resList[i].res_data;
@@ -670,11 +674,11 @@ int Scene::processSceneResources() {
break;
case SAGA_OBJECT_NAME_LIST:
debug(0, "Loading object name list resource...");
- _vm->_objectMap->loadNames(_resList[i].res_data, _resList[i].res_data_len);
+ _objectMap->loadNames(_resList[i].res_data, _resList[i].res_data_len);
break;
case SAGA_OBJECT_MAP:
debug(0, "Loading object map resource...");
- if (_vm->_objectMap->load(res_data,
+ if (_objectMap->load(res_data,
res_data_len) != R_SUCCESS) {
warning("Scene::ProcessSceneResources(): Error loading object map resource");
return R_FAILURE;
@@ -851,7 +855,7 @@ int Scene::endScene() {
_vm->_anim->reset();
_vm->_palanim->freePalAnim();
- _vm->_objectMap->freeMem();
+ delete _objectMap;
delete _actionMap;
ys_dll_destroy(_animList);
@@ -924,6 +928,14 @@ static void CF_actioninfo(int argc, char *argv[], void *refCon) {
((Scene *)refCon)->_actionMap->info();
}
+static void CF_objectinfo(int argc, char *argv[], void *refCon) {
+ (void)(argc);
+ (void)(argv);
+
+ ((Scene *)refCon)->_objectMap->info();
+}
+
+
int Scene::defaultScene(int param, R_SCENE_INFO *scene_info) {
R_EVENT event;
diff --git a/saga/scene.h b/saga/scene.h
index 6a7a0ce480..0f7176b7d7 100644
--- a/saga/scene.h
+++ b/saga/scene.h
@@ -27,10 +27,12 @@
#define SAGA_SCENE_H
#include "saga/text.h"
-#include "saga/actionmap.h"
namespace Saga {
+class ActionMap;
+class ObjectMap;
+
enum R_SCENE_MODES {
R_SCENE_MODE_INVALID,
R_SCENE_MODE_NORMAL,
@@ -236,8 +238,6 @@ class Scene {
void sceneInfoCmd(int argc, char *argv[]);
void sceneChangeCmd(int argc, char *argv[]);
- void drawActionMap(R_SURFACE *ds, int color) { _actionMap->draw(ds, color); }
-
private:
int loadScene(int scene, int load_flag, R_SCENE_PROC scene_proc, R_SCENE_DESC *,
int fadeIn);
@@ -276,6 +276,7 @@ class Scene {
public:
ActionMap *_actionMap;
+ ObjectMap *_objectMap;
private:
int IHNMStartProc();