aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorEugene Sandulenko2004-05-03 23:12:59 +0000
committerEugene Sandulenko2004-05-03 23:12:59 +0000
commit5de55d2dfa82c31e330d5b9d8b5f4cbd4c395634 (patch)
tree9fc2776de0b1c5d567efc0ad9eaf89d1f9e2b0da /saga
parentf7f485464d1d600ef33adea44f2d0c92abe37c16 (diff)
downloadscummvm-rg350-5de55d2dfa82c31e330d5b9d8b5f4cbd4c395634.tar.gz
scummvm-rg350-5de55d2dfa82c31e330d5b9d8b5f4cbd4c395634.tar.bz2
scummvm-rg350-5de55d2dfa82c31e330d5b9d8b5f4cbd4c395634.zip
indent
svn-id: r13771
Diffstat (limited to 'saga')
-rw-r--r--saga/actionmap.cpp223
1 files changed, 110 insertions, 113 deletions
diff --git a/saga/actionmap.cpp b/saga/actionmap.cpp
index 9bdab9fa21..33cffadb59 100644
--- a/saga/actionmap.cpp
+++ b/saga/actionmap.cpp
@@ -35,166 +35,163 @@
#include "actionmap.h"
namespace Saga {
- static R_ACTIONMAP_INFO ActmapModule;
+static R_ACTIONMAP_INFO ActmapModule;
- int ACTIONMAP_Register(void) {
- CVAR_RegisterFunc(CF_action_info,
- "action_info", NULL, R_CVAR_NONE, 0, 0);
- return R_SUCCESS;
- }
+int ACTIONMAP_Register(void) {
+ CVAR_RegisterFunc(CF_action_info,
+ "action_info", NULL, R_CVAR_NONE, 0, 0);
+ return R_SUCCESS;
+}
- int ACTIONMAP_Init(void) {
- R_printf(R_STDOUT, "ACTIONMAP Module: Initializing...\n");
- ActmapModule.init = 1;
- return R_SUCCESS;
- }
+int ACTIONMAP_Init(void) {
+ R_printf(R_STDOUT, "ACTIONMAP Module: Initializing...\n");
+ ActmapModule.init = 1;
+ return R_SUCCESS;
+}
- int ACTIONMAP_Load(const byte * exmap_res, size_t exmap_res_len) {
- //Loads exit map data from specified exit map resource
- R_ACTIONMAP_ENTRY *exmap_entry;
- R_POINT *exmap_pt_tbl;
+int ACTIONMAP_Load(const byte * exmap_res, size_t exmap_res_len) {
+ // Loads exit map data from specified exit map resource
+ R_ACTIONMAP_ENTRY *exmap_entry;
+ R_POINT *exmap_pt_tbl;
- int exit_ct;
- int i, pt;
+ int exit_ct;
+ int i, pt;
+
+ assert(ActmapModule.init);
+ assert(exmap_res != NULL);
+
+ MemoryReadStream *exmapStream = new MemoryReadStream(exmap_res, exmap_res_len);
+
+ // Load exits
+ exit_ct = exmapStream->readSint16LE();
+ if (exit_ct < 0) {
+ return R_FAILURE;
+ }
- assert(ActmapModule.init);
- assert(exmap_res != NULL);
+ exmap_entry = (R_ACTIONMAP_ENTRY *)malloc(exit_ct * sizeof *exmap_entry);
+ if (exmap_entry == NULL) {
+ R_printf(R_STDERR, "Memory allocation failure.\n");
+ return R_MEM;
+ }
- MemoryReadStream *exmapStream = new MemoryReadStream(exmap_res, exmap_res_len);
+ for (i = 0; i < exit_ct; i++) {
+ exmap_entry[i].unknown00 = exmapStream->readSint16LE();
+ exmap_entry[i].unknown02 = exmapStream->readSint16LE();
+ exmap_entry[i].exit_scene = exmapStream->readSint16LE();
+ exmap_entry[i].unknown06 = exmapStream->readSint16LE();
- // Load exits
- exit_ct = exmapStream->readSint16LE();
- if (exit_ct < 0) {
+ exmap_entry[i].pt_count = exmapStream->readSint16LE();
+ if (exmap_entry[i].pt_count < 0) {
+ free(exmap_entry);
return R_FAILURE;
}
- exmap_entry = (R_ACTIONMAP_ENTRY *)malloc(exit_ct * sizeof *exmap_entry);
- if (exmap_entry == NULL) {
+ exmap_pt_tbl = (R_POINT *)malloc(exmap_entry[i].pt_count * sizeof *exmap_pt_tbl);
+ if (exmap_pt_tbl == NULL) {
R_printf(R_STDERR, "Memory allocation failure.\n");
return R_MEM;
}
- for (i = 0; i < exit_ct; i++) {
- exmap_entry[i].unknown00 = exmapStream->readSint16LE();
- exmap_entry[i].unknown02 = exmapStream->readSint16LE();
- exmap_entry[i].exit_scene = exmapStream->readSint16LE();
- exmap_entry[i].unknown06 = exmapStream->readSint16LE();
-
- exmap_entry[i].pt_count = exmapStream->readSint16LE();
- if (exmap_entry[i].pt_count < 0) {
- free(exmap_entry);
- return R_FAILURE;
- }
-
- exmap_pt_tbl = (R_POINT *)malloc(exmap_entry[i].pt_count * sizeof *exmap_pt_tbl);
- if (exmap_pt_tbl == NULL) {
- R_printf(R_STDERR, "Memory allocation failure.\n");
- return R_MEM;
- }
-
- for (pt = 0; pt < exmap_entry[i].pt_count; pt++) {
- exmap_pt_tbl[pt].x = exmapStream->readSint16LE();
- exmap_pt_tbl[pt].y = exmapStream->readSint16LE();
- }
-
- exmap_entry[i].pt_tbl = exmap_pt_tbl;
+ for (pt = 0; pt < exmap_entry[i].pt_count; pt++) {
+ exmap_pt_tbl[pt].x = exmapStream->readSint16LE();
+ exmap_pt_tbl[pt].y = exmapStream->readSint16LE();
}
- ActmapModule.exits_loaded = 1;
- ActmapModule.n_exits = exit_ct;
- ActmapModule.exits_tbl = exmap_entry;
-
- ActmapModule.exmap_res = exmap_res;
- ActmapModule.exmap_res_len = exmap_res_len;
-
- return R_SUCCESS;
+ exmap_entry[i].pt_tbl = exmap_pt_tbl;
}
- int ACTIONMAP_Free(void) {
- // Frees the currently loaded exit map data
- R_ACTIONMAP_ENTRY *exmap_entry;
- int i;
+ ActmapModule.exits_loaded = 1;
+ ActmapModule.n_exits = exit_ct;
+ ActmapModule.exits_tbl = exmap_entry;
- if (!ActmapModule.exits_loaded) {
- return R_SUCCESS;
- }
-
- for (i = 0; i < ActmapModule.n_exits; i++) {
- exmap_entry = &ActmapModule.exits_tbl[i];
-
- free(exmap_entry->pt_tbl);
- }
+ ActmapModule.exmap_res = exmap_res;
+ ActmapModule.exmap_res_len = exmap_res_len;
- free(ActmapModule.exits_tbl);
+ return R_SUCCESS;
+}
- ActmapModule.exits_loaded = 0;
- ActmapModule.exits_tbl = NULL;
- ActmapModule.n_exits = 0;
+int ACTIONMAP_Free(void) {
+ // Frees the currently loaded exit map data
+ R_ACTIONMAP_ENTRY *exmap_entry;
+ int i;
+ if (!ActmapModule.exits_loaded) {
return R_SUCCESS;
}
- int ACTIONMAP_Shutdown(void) {
- return R_SUCCESS;
+ for (i = 0; i < ActmapModule.n_exits; i++) {
+ exmap_entry = &ActmapModule.exits_tbl[i];
+
+ free(exmap_entry->pt_tbl);
}
- int ACTIONMAP_Draw(R_SURFACE * ds, int color) {
- int i;
+ free(ActmapModule.exits_tbl);
- assert(ActmapModule.init);
+ ActmapModule.exits_loaded = 0;
+ ActmapModule.exits_tbl = NULL;
+ ActmapModule.n_exits = 0;
- if (!ActmapModule.exits_loaded) {
- return R_FAILURE;
- }
+ return R_SUCCESS;
+}
- for (i = 0; i < ActmapModule.n_exits; i++) {
+int ACTIONMAP_Shutdown(void) {
+ return R_SUCCESS;
+}
- if (ActmapModule.exits_tbl[i].pt_count == 2) {
+int ACTIONMAP_Draw(R_SURFACE * ds, int color) {
+ int i;
+ assert(ActmapModule.init);
+
+ if (!ActmapModule.exits_loaded) {
+ return R_FAILURE;
+ }
+
+ for (i = 0; i < ActmapModule.n_exits; i++) {
+ if (ActmapModule.exits_tbl[i].pt_count == 2) {
GFX_DrawFrame(ds,
&ActmapModule.exits_tbl[i].pt_tbl[0],
&ActmapModule.exits_tbl[i].pt_tbl[1], color);
- } else if (ActmapModule.exits_tbl[i].pt_count > 2) {
- GFX_DrawPolyLine(ds, ActmapModule.exits_tbl[i].pt_tbl,
- ActmapModule.exits_tbl[i].pt_count, color);
- }
+ } else if (ActmapModule.exits_tbl[i].pt_count > 2) {
+ GFX_DrawPolyLine(ds, ActmapModule.exits_tbl[i].pt_tbl,
+ ActmapModule.exits_tbl[i].pt_count, color);
}
-
- return R_SUCCESS;
}
- void CF_action_info(int argc, char *argv[]) {
- R_POINT *pt;
+ return R_SUCCESS;
+}
- int i;
- int pt_i;
+void CF_action_info(int argc, char *argv[]) {
+ R_POINT *pt;
- YS_IGNORE_PARAM(argc);
- YS_IGNORE_PARAM(argv);
+ int i;
+ int pt_i;
- if (!ActmapModule.exits_loaded) {
- return;
- }
+ YS_IGNORE_PARAM(argc);
+ YS_IGNORE_PARAM(argv);
- CON_Print("%d exits loaded.\n", ActmapModule.n_exits);
+ if (!ActmapModule.exits_loaded) {
+ return;
+ }
- for (i = 0; i < ActmapModule.n_exits; i++) {
+ CON_Print("%d exits loaded.\n", ActmapModule.n_exits);
- CON_Print ("Action %d: Exit to: %d; Pts: %d; Unk0: %d Unk2: %d Scr_N: %d",
- i, ActmapModule.exits_tbl[i].exit_scene,
- ActmapModule.exits_tbl[i].pt_count,
- ActmapModule.exits_tbl[i].unknown00,
- ActmapModule.exits_tbl[i].unknown02,
- ActmapModule.exits_tbl[i].unknown06);
+ for (i = 0; i < ActmapModule.n_exits; i++) {
+ CON_Print ("Action %d: Exit to: %d; Pts: %d; Unk0: %d Unk2: %d Scr_N: %d",
+ i, ActmapModule.exits_tbl[i].exit_scene,
+ ActmapModule.exits_tbl[i].pt_count,
+ ActmapModule.exits_tbl[i].unknown00,
+ ActmapModule.exits_tbl[i].unknown02,
+ ActmapModule.exits_tbl[i].unknown06);
- for (pt_i = 0; pt_i < ActmapModule.exits_tbl[i].pt_count; pt_i++) {
- pt = &ActmapModule.exits_tbl[i].pt_tbl[pt_i];
+ for (pt_i = 0; pt_i < ActmapModule.exits_tbl[i].pt_count; pt_i++) {
+ pt = &ActmapModule.exits_tbl[i].pt_tbl[pt_i];
- CON_Print(" pt: %d (%d, %d)", pt_i, pt->x, pt->y);
- }
+ CON_Print(" pt: %d (%d, %d)", pt_i, pt->x, pt->y);
}
-
- return;
}
+ return;
+}
+
} // End of namespace Saga