2004-04-12 21:40:49 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2004 The ScummVM project
|
|
|
|
*
|
|
|
|
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Object map / Object click-area module
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Polygon Hit Test code ( HitTestPoly() ) adapted from code (C) Eric Haines
|
|
|
|
// appearing in Graphics Gems IV, "Point in Polygon Strategies."
|
|
|
|
// p. 24-46, code: p. 34-45
|
2004-05-04 03:33:03 +00:00
|
|
|
#include "saga.h"
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-01 11:48:53 +00:00
|
|
|
#include "gfx.h"
|
2004-04-12 21:40:49 +00:00
|
|
|
#include "cvar_mod.h"
|
|
|
|
#include "console_mod.h"
|
|
|
|
#include "font_mod.h"
|
|
|
|
|
|
|
|
#include "objectmap_mod.h"
|
|
|
|
#include "objectmap.h"
|
|
|
|
|
|
|
|
namespace Saga {
|
|
|
|
|
|
|
|
static R_OBJECTMAP_INFO OMInfo;
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
int OBJECTMAP_Register() {
|
2004-07-31 23:33:14 +00:00
|
|
|
CVAR_RegisterFunc(CF_object_info, "object_info", NULL, R_CVAR_NONE, 0, 0, NULL);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Initializes the object map module, creates module allocation context
|
|
|
|
int OBJECTMAP_Init() {
|
2004-05-05 13:05:45 +00:00
|
|
|
debug(0, "OBJECTMAP Module: Initializing...");
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
OMInfo.initialized = 1;
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Shuts down the object map module, destroys module allocation context
|
|
|
|
int OBJECTMAP_Shutdown() {
|
2004-04-12 21:40:49 +00:00
|
|
|
if (!OMInfo.initialized) {
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
2004-05-05 13:05:45 +00:00
|
|
|
debug(0, "OBJECTMAP Module: Shutting down...");
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
OBJECTMAP_Free();
|
|
|
|
OBJECTMAP_FreeNames();
|
|
|
|
|
2004-05-05 13:05:45 +00:00
|
|
|
debug(0, "OBJECTMAP Module: Shutdown AOK.");
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
OMInfo.initialized = 0;
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Loads an object map resource ( objects ( clickareas ( points ) ) )
|
|
|
|
int OBJECTMAP_Load(const byte *om_res, size_t om_res_len) {
|
2004-04-12 21:40:49 +00:00
|
|
|
R_OBJECTMAP_ENTRY *object_map;
|
|
|
|
R_CLICKAREA *clickarea;
|
|
|
|
R_POINT *point;
|
|
|
|
|
|
|
|
int i, k, m;
|
|
|
|
|
2004-05-04 03:33:03 +00:00
|
|
|
MemoryReadStream *readS = new MemoryReadStream(om_res, om_res_len);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
if (!OMInfo.initialized) {
|
2004-05-05 13:05:45 +00:00
|
|
|
warning("Error: Object map module not initialized");
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OMInfo.objects_loaded) {
|
|
|
|
OBJECTMAP_Free();
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Obtain object count N and allocate space for N objects
|
2004-05-04 03:33:03 +00:00
|
|
|
OMInfo.n_objects = readS->readUint16LE();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
OMInfo.object_maps = (R_OBJECTMAP_ENTRY *)malloc(OMInfo.n_objects * sizeof *OMInfo.object_maps);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
if (OMInfo.object_maps == NULL) {
|
2004-05-05 13:05:45 +00:00
|
|
|
warning("Error: Memory allocation failed");
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_MEM;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Load all N objects
|
2004-04-12 21:40:49 +00:00
|
|
|
for (i = 0; i < OMInfo.n_objects; i++) {
|
|
|
|
object_map = &OMInfo.object_maps[i];
|
2004-05-04 03:33:03 +00:00
|
|
|
object_map->unknown0 = readS->readByte();
|
|
|
|
object_map->n_clickareas = readS->readByte();
|
|
|
|
object_map->flags = readS->readUint16LE();
|
|
|
|
object_map->object_num = readS->readUint16LE();
|
|
|
|
object_map->script_num = readS->readUint16LE();
|
2004-05-01 13:04:31 +00:00
|
|
|
object_map->clickareas = (R_CLICKAREA *)malloc(object_map->n_clickareas * sizeof *(object_map->clickareas));
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
if (object_map->clickareas == NULL) {
|
2004-05-05 13:05:45 +00:00
|
|
|
warning("Error: Memory allocation failed");
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_MEM;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Load all clickareas for this object
|
2004-04-12 21:40:49 +00:00
|
|
|
for (k = 0; k < object_map->n_clickareas; k++) {
|
|
|
|
clickarea = &object_map->clickareas[k];
|
2004-05-04 03:33:03 +00:00
|
|
|
clickarea->n_points = readS->readUint16LE();
|
2004-04-12 21:40:49 +00:00
|
|
|
assert(clickarea->n_points != 0);
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
clickarea->points = (R_POINT *)malloc(clickarea->n_points * sizeof *(clickarea->points));
|
2004-04-12 21:40:49 +00:00
|
|
|
if (clickarea->points == NULL) {
|
2004-05-05 13:05:45 +00:00
|
|
|
warning("Error: Memory allocation failed");
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_MEM;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Load all points for this clickarea
|
2004-04-12 21:40:49 +00:00
|
|
|
for (m = 0; m < clickarea->n_points; m++) {
|
|
|
|
point = &clickarea->points[m];
|
2004-05-04 03:33:03 +00:00
|
|
|
point->x = readS->readSint16LE();
|
|
|
|
point->y = readS->readSint16LE();
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
2004-05-05 13:05:45 +00:00
|
|
|
debug(2, "OBJECTMAP_Load(): Read %d points for clickarea %d in object %d.",
|
2004-05-01 13:04:31 +00:00
|
|
|
clickarea->n_points, k, object_map->object_num);
|
|
|
|
}
|
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
OMInfo.objects_loaded = 1;
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Frees all storage allocated for the current object map data
|
|
|
|
int OBJECTMAP_Free() {
|
2004-04-12 21:40:49 +00:00
|
|
|
R_OBJECTMAP_ENTRY *object_map;
|
|
|
|
R_CLICKAREA *clickarea;
|
|
|
|
|
|
|
|
int i, k;
|
|
|
|
|
|
|
|
if (!OMInfo.objects_loaded) {
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < OMInfo.n_objects; i++) {
|
|
|
|
object_map = &OMInfo.object_maps[i];
|
|
|
|
for (k = 0; k < object_map->n_clickareas; k++) {
|
|
|
|
clickarea = &object_map->clickareas[k];
|
|
|
|
free(clickarea->points);
|
|
|
|
}
|
|
|
|
free(object_map->clickareas);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OMInfo.n_objects) {
|
|
|
|
free(OMInfo.object_maps);
|
|
|
|
}
|
|
|
|
|
|
|
|
OMInfo.objects_loaded = 0;
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Loads an object name list resource
|
|
|
|
int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len) {
|
2004-04-12 21:40:49 +00:00
|
|
|
int table_len;
|
|
|
|
int n_names;
|
|
|
|
size_t name_offset;
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
2004-05-04 03:33:03 +00:00
|
|
|
MemoryReadStream *readS = new MemoryReadStream(onl_res, onl_res_len);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
if (OMInfo.names_loaded) {
|
|
|
|
OBJECTMAP_FreeNames();
|
|
|
|
}
|
|
|
|
|
2004-05-04 03:33:03 +00:00
|
|
|
table_len = readS->readUint16LE();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
n_names = table_len / 2 - 2;
|
|
|
|
OMInfo.n_names = n_names;
|
|
|
|
|
2004-05-05 13:05:45 +00:00
|
|
|
debug(2, "OBJECTMAP_LoadNames: Loading %d object names.", n_names);
|
2004-04-25 14:42:14 +00:00
|
|
|
OMInfo.names = (const char **)malloc(n_names * sizeof *OMInfo.names);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
if (OMInfo.names == NULL) {
|
2004-05-05 13:05:45 +00:00
|
|
|
warning("Error: Memory allocation failed");
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_MEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < n_names; i++) {
|
2004-05-04 03:33:03 +00:00
|
|
|
name_offset = readS->readUint16LE();
|
2004-04-25 14:42:14 +00:00
|
|
|
OMInfo.names[i] = (const char *)(onl_res + name_offset);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-05-05 13:05:45 +00:00
|
|
|
debug(3, "Loaded object name string: %s", OMInfo.names[i]);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OMInfo.names_loaded = 1;
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Frees all storage allocated for the current object name list data
|
|
|
|
int OBJECTMAP_FreeNames() {
|
2004-04-12 21:40:49 +00:00
|
|
|
if (!OMInfo.names_loaded) {
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OMInfo.n_names) {
|
|
|
|
free(OMInfo.names);
|
|
|
|
}
|
|
|
|
|
|
|
|
OMInfo.names_loaded = 0;
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// If 'object' is a valid object number in the currently loaded object
|
|
|
|
// name list resource, the funciton sets '*name' to the descriptive string
|
|
|
|
// corresponding to 'object' and returns R_SUCCESS. Otherwise it returns
|
|
|
|
// R_FAILURE.
|
|
|
|
int OBJECTMAP_GetName(int object, const char **name) {
|
2004-04-12 21:40:49 +00:00
|
|
|
if (!OMInfo.names_loaded) {
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((object <= 0) || (object > OMInfo.n_names)) {
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*name = OMInfo.names[object - 1];
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
int OBJECTMAP_GetFlags(int object, uint16 *flags) {
|
2004-04-12 21:40:49 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!OMInfo.names_loaded) {
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((object <= 0) || (object > OMInfo.n_names)) {
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < OMInfo.n_objects; i++) {
|
|
|
|
if (OMInfo.object_maps[i].object_num == object) {
|
|
|
|
*flags = OMInfo.object_maps[i].flags;
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// If 'object' is a valid object number in the currently loaded object
|
|
|
|
// name list resource, the funciton sets '*ep_num' to the entrypoint number
|
|
|
|
// corresponding to 'object' and returns R_SUCCESS. Otherwise, it returns
|
|
|
|
// R_FAILURE.
|
|
|
|
int OBJECTMAP_GetEPNum(int object, int *ep_num) {
|
2004-04-12 21:40:49 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!OMInfo.names_loaded) {
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((object < 0) || (object > (OMInfo.n_objects + 1))) {
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < OMInfo.n_objects; i++) {
|
|
|
|
|
|
|
|
if (OMInfo.object_maps[i].object_num == object) {
|
|
|
|
|
|
|
|
*ep_num = OMInfo.object_maps[i].script_num;
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
2004-08-01 11:48:53 +00:00
|
|
|
// Uses Gfx::drawLine to display all clickareas for each object in the
|
2004-05-01 13:04:31 +00:00
|
|
|
// currently loaded object map resource.
|
|
|
|
int OBJECTMAP_Draw(R_SURFACE *ds, R_POINT *imouse_pt, int color, int color2) {
|
2004-04-12 21:40:49 +00:00
|
|
|
R_OBJECTMAP_ENTRY *object_map;
|
|
|
|
R_CLICKAREA *clickarea;
|
|
|
|
|
|
|
|
char txt_buf[32];
|
|
|
|
|
|
|
|
int draw_color = color;
|
|
|
|
int draw_txt = 0;
|
|
|
|
|
|
|
|
int hit_object = 0;
|
|
|
|
int object_num = 0;
|
|
|
|
|
|
|
|
int pointcount = 0;
|
|
|
|
int i, k;
|
|
|
|
|
|
|
|
assert(OMInfo.initialized);
|
|
|
|
|
|
|
|
if (!OMInfo.objects_loaded) {
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (imouse_pt != NULL) {
|
|
|
|
if (OBJECTMAP_HitTest(imouse_pt, &object_num) == R_SUCCESS) {
|
|
|
|
hit_object = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < OMInfo.n_objects; i++) {
|
|
|
|
draw_color = color;
|
2004-05-01 13:04:31 +00:00
|
|
|
if (hit_object && (object_num == OMInfo.object_maps[i].object_num)) {
|
|
|
|
snprintf(txt_buf, sizeof txt_buf, "obj %d: ? %d, f %X",
|
|
|
|
OMInfo.object_maps[i].object_num,
|
|
|
|
OMInfo.object_maps[i].unknown0,
|
|
|
|
OMInfo.object_maps[i].flags);
|
2004-04-12 21:40:49 +00:00
|
|
|
draw_txt = 1;
|
|
|
|
draw_color = color2;
|
|
|
|
}
|
|
|
|
|
|
|
|
object_map = &OMInfo.object_maps[i];
|
|
|
|
|
|
|
|
for (k = 0; k < object_map->n_clickareas; k++) {
|
|
|
|
clickarea = &object_map->clickareas[k];
|
|
|
|
pointcount = 0;
|
|
|
|
if (clickarea->n_points == 2) {
|
2004-05-01 13:04:31 +00:00
|
|
|
// 2 points represent a box
|
2004-08-01 11:48:53 +00:00
|
|
|
_vm->_gfx->drawFrame(ds, &clickarea->points[0], &clickarea->points[1], draw_color);
|
2004-04-12 21:40:49 +00:00
|
|
|
} else if (clickarea->n_points > 2) {
|
2004-05-01 13:04:31 +00:00
|
|
|
// Otherwise draw a polyline
|
2004-08-01 11:48:53 +00:00
|
|
|
_vm->_gfx->drawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
2004-05-01 13:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
if (draw_txt) {
|
2004-08-01 11:48:53 +00:00
|
|
|
FONT_Draw(SMALL_FONT_ID, ds, txt_buf, 0, 2, 2,
|
|
|
|
_vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
static bool MATH_HitTestPoly(R_POINT *points, unsigned int npoints, R_POINT test_point) {
|
2004-04-28 00:30:16 +00:00
|
|
|
int yflag0;
|
|
|
|
int yflag1;
|
|
|
|
bool inside_flag = false;
|
|
|
|
unsigned int pt;
|
|
|
|
|
|
|
|
R_POINT *vtx0 = &points[npoints - 1];
|
|
|
|
R_POINT *vtx1 = &points[0];
|
|
|
|
|
|
|
|
yflag0 = (vtx0->y >= test_point.y);
|
|
|
|
for (pt = 0; pt < npoints; pt++, vtx1++) {
|
|
|
|
yflag1 = (vtx1->y >= test_point.y);
|
|
|
|
if (yflag0 != yflag1) {
|
|
|
|
if (((vtx1->y - test_point.y) * (vtx0->x - vtx1->x) >=
|
2004-05-01 13:04:31 +00:00
|
|
|
(vtx1->x - test_point.x) * (vtx0->y - vtx1->y)) == yflag1) {
|
2004-04-28 00:30:16 +00:00
|
|
|
inside_flag = !inside_flag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yflag0 = yflag1;
|
|
|
|
vtx0 = vtx1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return inside_flag;
|
|
|
|
}
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
int OBJECTMAP_HitTest(R_POINT * imouse_pt, int *object_num) {
|
2004-04-12 21:40:49 +00:00
|
|
|
R_POINT imouse;
|
|
|
|
R_OBJECTMAP_ENTRY *object_map;
|
|
|
|
R_CLICKAREA *clickarea;
|
|
|
|
R_POINT *points;
|
|
|
|
int n_points;
|
|
|
|
|
|
|
|
int i, k;
|
|
|
|
|
|
|
|
assert((imouse_pt != NULL) && (object_num != NULL));
|
|
|
|
|
|
|
|
imouse.x = imouse_pt->x;
|
|
|
|
imouse.y = imouse_pt->y;
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Loop through all scene objects
|
2004-04-12 21:40:49 +00:00
|
|
|
for (i = 0; i < OMInfo.n_objects; i++) {
|
|
|
|
object_map = &OMInfo.object_maps[i];
|
|
|
|
|
2004-05-01 13:04:31 +00:00
|
|
|
// Hit-test all clickareas for this object
|
2004-04-12 21:40:49 +00:00
|
|
|
for (k = 0; k < object_map->n_clickareas; k++) {
|
|
|
|
clickarea = &object_map->clickareas[k];
|
|
|
|
n_points = clickarea->n_points;
|
|
|
|
points = clickarea->points;
|
|
|
|
|
|
|
|
if (n_points == 2) {
|
2004-05-01 13:04:31 +00:00
|
|
|
// Hit-test a box region
|
|
|
|
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;
|
|
|
|
return R_SUCCESS;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
} else if (n_points > 2) {
|
2004-05-01 13:04:31 +00:00
|
|
|
// Hit-test a polygon
|
2004-04-12 21:40:49 +00:00
|
|
|
if (MATH_HitTestPoly(points, n_points, imouse)) {
|
|
|
|
*object_num = object_map->object_num;
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
2004-05-01 13:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
*object_num = 0;
|
|
|
|
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
2004-07-31 23:33:14 +00:00
|
|
|
static void CF_object_info(int argc, char *argv[], void *refCon) {
|
2004-04-12 21:40:49 +00:00
|
|
|
int i;
|
|
|
|
|
2004-05-04 03:33:03 +00:00
|
|
|
(void)(argc);
|
|
|
|
(void)(argv);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
if (!OMInfo.initialized) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CON_Print("%d objects loaded.", OMInfo.n_objects);
|
|
|
|
|
|
|
|
for (i = 0; i < OMInfo.n_objects; i++) {
|
|
|
|
CON_Print("%s:", OMInfo.names[i]);
|
2004-05-01 13:04:31 +00:00
|
|
|
CON_Print("%d. Unk1: %d, flags: %X, name_i: %d, scr_n: %d, ca_ct: %d", i, OMInfo.object_maps[i].unknown0,
|
|
|
|
OMInfo.object_maps[i].flags,
|
|
|
|
OMInfo.object_maps[i].object_num,
|
|
|
|
OMInfo.object_maps[i].script_num,
|
|
|
|
OMInfo.object_maps[i].n_clickareas);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Saga
|