aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorPaweł Kołodziejski2004-05-01 13:04:31 +0000
committerPaweł Kołodziejski2004-05-01 13:04:31 +0000
commit84eb0101a777540d4652c0b9da6901863f91bbe2 (patch)
treebdb39f61e3f2e40a298ccf2ec31ce7fc06e41dff /saga
parentbc77ba431a7ccfc9a961df5fa8f1531e2f72fd44 (diff)
downloadscummvm-rg350-84eb0101a777540d4652c0b9da6901863f91bbe2.tar.gz
scummvm-rg350-84eb0101a777540d4652c0b9da6901863f91bbe2.tar.bz2
scummvm-rg350-84eb0101a777540d4652c0b9da6901863f91bbe2.zip
indent
svn-id: r13706
Diffstat (limited to 'saga')
-rw-r--r--saga/isomap.cpp102
-rw-r--r--saga/isomap.h25
-rw-r--r--saga/isomap_mod.h17
-rw-r--r--saga/ite_introproc.cpp533
-rw-r--r--saga/ite_introproc.h14
-rw-r--r--saga/ite_introproc_mod.h9
-rw-r--r--saga/music.cpp39
-rw-r--r--saga/music.h39
-rw-r--r--saga/objectmap.cpp287
-rw-r--r--saga/objectmap.h16
-rw-r--r--saga/objectmap_mod.h44
11 files changed, 337 insertions, 788 deletions
diff --git a/saga/isomap.cpp b/saga/isomap.cpp
index 1e1d91bb97..0236034288 100644
--- a/saga/isomap.cpp
+++ b/saga/isomap.cpp
@@ -20,27 +20,16 @@
* $Header$
*
*/
-/*
- Description:
-
- Isometric level module
- Notes:
-*/
+// Isometric level module
#include "reinherit.h"
#include "yslib.h"
-/*
- * Uses the following modules:
-\*--------------------------------------------------------------------------*/
#include "game_mod.h"
#include "gfx_mod.h"
-/*
- * Begin module component
-\*--------------------------------------------------------------------------*/
#include "isomap_mod.h"
#include "isomap.h"
@@ -48,16 +37,13 @@ namespace Saga {
static R_ISOMAP_MODULE IsoModule;
-int ISOMAP_Init(void)
-{
+int ISOMAP_Init() {
IsoModule.init = 1;
return R_SUCCESS;
}
-int ISOMAP_LoadTileset(const byte * tileres_p, size_t tileres_len)
-{
-
+int ISOMAP_LoadTileset(const byte *tileres_p, size_t tileres_len) {
R_ISOTILE_ENTRY first_entry;
R_ISOTILE_ENTRY *tile_tbl;
@@ -83,10 +69,8 @@ int ISOMAP_LoadTileset(const byte * tileres_p, size_t tileres_len)
}
for (i = 0; i < IsoModule.tile_ct; i++) {
-
tile_tbl[i].tile_h = ys_read_u8(read_p, &read_p);
tile_tbl[i].unknown01 = ys_read_u8(read_p, &read_p);
-
tile_tbl[i].tile_offset = ys_read_u16_le(read_p, &read_p);
tile_tbl[i].unknown04 = ys_read_s16_le(read_p, &read_p);
tile_tbl[i].unknown06 = ys_read_s16_le(read_p, &read_p);
@@ -100,17 +84,12 @@ int ISOMAP_LoadTileset(const byte * tileres_p, size_t tileres_len)
return R_SUCCESS;
}
-int ISOMAP_LoadMetaTileset(const byte * mtileres_p, size_t mtileres_len)
-{
-
+int ISOMAP_LoadMetaTileset(const byte *mtileres_p, size_t mtileres_len) {
R_ISO_METATILE_ENTRY *mtile_tbl;
-
const byte *read_p = mtileres_p;
size_t read_len = mtileres_len;
-
uint16 mtile_ct;
uint16 ct;
-
int i;
assert(IsoModule.init);
@@ -119,22 +98,19 @@ int ISOMAP_LoadMetaTileset(const byte * mtileres_p, size_t mtileres_len)
(void)read_len;
mtile_ct = mtileres_len / SAGA_METATILE_ENTRY_LEN;
-
mtile_tbl = (R_ISO_METATILE_ENTRY *)malloc(mtile_ct * sizeof *mtile_tbl);
if (mtile_tbl == NULL) {
return R_MEM;
}
for (ct = 0; ct < mtile_ct; ct++) {
-
mtile_tbl[ct].mtile_n = ys_read_u16_le(read_p, &read_p);
mtile_tbl[ct].unknown02 = ys_read_s16_le(read_p, &read_p);
mtile_tbl[ct].unknown04 = ys_read_s16_le(read_p, &read_p);
mtile_tbl[ct].unknown06 = ys_read_s16_le(read_p, &read_p);
for (i = 0; i < SAGA_METATILE_SIZE; i++) {
- mtile_tbl[ct].tile_tbl[i] =
- ys_read_u16_le(read_p, &read_p);
+ mtile_tbl[ct].tile_tbl[i] = ys_read_u16_le(read_p, &read_p);
}
}
@@ -148,12 +124,9 @@ int ISOMAP_LoadMetaTileset(const byte * mtileres_p, size_t mtileres_len)
return R_SUCCESS;
}
-int ISOMAP_LoadMetamap(const byte * mm_res_p, size_t mm_res_len)
-{
-
+int ISOMAP_LoadMetamap(const byte *mm_res_p, size_t mm_res_len) {
const byte *read_p = mm_res_p;
size_t read_len = mm_res_len;
-
int i;
(void)read_len;
@@ -161,7 +134,6 @@ int ISOMAP_LoadMetamap(const byte * mm_res_p, size_t mm_res_len)
IsoModule.metamap_n = ys_read_s16_le(read_p, &read_p);
for (i = 0; i < SAGA_METAMAP_SIZE; i++) {
-
IsoModule.metamap_tbl[i] = ys_read_u16_le(read_p, &read_p);
}
@@ -172,47 +144,31 @@ int ISOMAP_LoadMetamap(const byte * mm_res_p, size_t mm_res_len)
return R_SUCCESS;
}
-int ISOMAP_Draw(R_SURFACE * dst_s)
-{
-
+int ISOMAP_Draw(R_SURFACE *dst_s) {
R_GAME_DISPLAYINFO disp_info;
-
GAME_GetDisplayInfo(&disp_info);
-
R_RECT iso_rect(disp_info.logical_w - 1, disp_info.scene_h - 1);
-
GFX_DrawRect(dst_s, &iso_rect, 0);
-
ISOMAP_DrawMetamap(dst_s, -1000, -500);
return R_SUCCESS;
}
-int ISOMAP_DrawMetamap(R_SURFACE * dst_s, int map_x, int map_y)
-{
+int ISOMAP_DrawMetamap(R_SURFACE *dst_s, int map_x, int map_y) {
int meta_base_x = map_x;
int meta_base_y = map_y;
-
int meta_xi;
int meta_yi;
-
int meta_x;
int meta_y;
-
int meta_idx;
for (meta_yi = SAGA_METAMAP_H - 1; meta_yi >= 0; meta_yi--) {
-
meta_x = meta_base_x;
meta_y = meta_base_y;
-
for (meta_xi = SAGA_METAMAP_W - 1; meta_xi >= 0; meta_xi--) {
-
meta_idx = meta_xi + (meta_yi * 16);
-
- ISOMAP_DrawMetaTile(dst_s,
- IsoModule.metamap_tbl[meta_idx], meta_x, meta_y);
-
+ ISOMAP_DrawMetaTile(dst_s, IsoModule.metamap_tbl[meta_idx], meta_x, meta_y);
meta_x += 128;
meta_y += 64;
}
@@ -224,21 +180,14 @@ int ISOMAP_DrawMetamap(R_SURFACE * dst_s, int map_x, int map_y)
return R_SUCCESS;
}
-int
-ISOMAP_DrawMetaTile(R_SURFACE * dst_s, uint16 mtile_i, int mtile_x, int mtile_y)
-{
-
+int ISOMAP_DrawMetaTile(R_SURFACE *dst_s, uint16 mtile_i, int mtile_x, int mtile_y) {
int tile_xi;
int tile_yi;
-
int tile_x;
int tile_y;
-
int tile_base_x;
int tile_base_y;
-
int tile_i;
-
R_ISO_METATILE_ENTRY *mtile_p;
assert(IsoModule.init && IsoModule.mtiles_loaded);
@@ -252,45 +201,30 @@ ISOMAP_DrawMetaTile(R_SURFACE * dst_s, uint16 mtile_i, int mtile_x, int mtile_y)
tile_base_y = mtile_y;
for (tile_yi = SAGA_METATILE_H - 1; tile_yi >= 0; tile_yi--) {
-
tile_y = tile_base_y;
tile_x = tile_base_x;
-
for (tile_xi = SAGA_METATILE_W - 1; tile_xi >= 0; tile_xi--) {
-
tile_i = tile_xi + (tile_yi * SAGA_METATILE_W);
-
- ISOMAP_DrawTile(dst_s,
- mtile_p->tile_tbl[tile_i], tile_x, tile_y);
-
+ ISOMAP_DrawTile(dst_s, mtile_p->tile_tbl[tile_i], tile_x, tile_y);
tile_x += SAGA_ISOTILE_WIDTH / 2;
tile_y += SAGA_ISOTILE_BASEHEIGHT / 2 + 1;
-
}
-
tile_base_x -= SAGA_ISOTILE_WIDTH / 2;
tile_base_y += SAGA_ISOTILE_BASEHEIGHT / 2 + 1;
-
}
return R_SUCCESS;
}
-int ISOMAP_DrawTile(R_SURFACE * dst_s, uint16 tile_i, int tile_x, int tile_y)
-{
-
+int ISOMAP_DrawTile(R_SURFACE *dst_s, uint16 tile_i, int tile_x, int tile_y) {
const byte *tile_p;
const byte *read_p;
-
byte *draw_p;
-
int draw_x;
int draw_y;
-
int tile_h;
int w_count = 0;
int row;
-
int bg_runct;
int fg_runct;
int ct;
@@ -324,38 +258,32 @@ int ISOMAP_DrawTile(R_SURFACE * dst_s, uint16 tile_i, int tile_x, int tile_y)
draw_y = tile_y - (tile_h - SAGA_ISOTILE_BASEHEIGHT);
}
- /* temporary y clip */
+ // temporary y clip
if (draw_y < 0) {
return R_SUCCESS;
}
for (row = 0; row < tile_h; row++) {
-
- draw_p =
- dst_s->buf + draw_x + ((draw_y + row) * dst_s->buf_pitch);
+ draw_p = dst_s->buf + draw_x + ((draw_y + row) * dst_s->buf_pitch);
w_count = 0;
- /* temporary y clip */
+ // temporary y clip
if ((draw_y + row) >= 137) {
return R_SUCCESS;
}
for (;;) {
-
bg_runct = *read_p++;
w_count += bg_runct;
-
if (w_count >= SAGA_ISOTILE_WIDTH) {
break;
}
draw_p += bg_runct;
-
fg_runct = *read_p++;
w_count += fg_runct;
for (ct = 0; ct < fg_runct; ct++) {
-
*draw_p++ = *read_p++;
}
}
diff --git a/saga/isomap.h b/saga/isomap.h
index 413d4bde6c..e6ba590902 100644
--- a/saga/isomap.h
+++ b/saga/isomap.h
@@ -20,13 +20,8 @@
* $Header$
*
*/
-/*
- Description:
-
- Isometric level module - private header
- Notes:
-*/
+// Isometric level module - private header
#ifndef SAGA_ISOMAP_H_
#define SAGA_ISOMAP_H_
@@ -34,7 +29,6 @@
namespace Saga {
struct R_ISOTILE_ENTRY {
-
int tile_h;
int unknown01;
size_t tile_offset;
@@ -56,22 +50,17 @@ struct R_ISOTILE_ENTRY {
#define SAGA_METAMAP_SIZE 256
struct R_ISO_METATILE_ENTRY {
-
int mtile_n;
int unknown02;
int unknown04;
int unknown06;
-
int tile_tbl[SAGA_METATILE_SIZE];
-
};
#define SAGA_METATILE_ENTRY_LEN 136
struct R_ISOMAP_MODULE {
-
int init;
-
int tiles_loaded;
const byte *tileres_p;
size_t tileres_len;
@@ -89,16 +78,12 @@ struct R_ISOMAP_MODULE {
uint16 metamap_tbl[SAGA_METAMAP_SIZE];
const byte *mm_res_p;
size_t mm_res_len;
-
};
-int ISOMAP_DrawTile(R_SURFACE * dst_s, uint16 tile_i, int tile_x, int tile_y);
-
-int
-ISOMAP_DrawMetaTile(R_SURFACE * dst_s, uint16 mtile_i, int mtile_x, int mtile_y);
-
-int ISOMAP_DrawMetamap(R_SURFACE * dst_s, int map_x, int map_y);
+int ISOMAP_DrawTile(R_SURFACE *dst_s, uint16 tile_i, int tile_x, int tile_y);
+int ISOMAP_DrawMetaTile(R_SURFACE *dst_s, uint16 mtile_i, int mtile_x, int mtile_y);
+int ISOMAP_DrawMetamap(R_SURFACE *dst_s, int map_x, int map_y);
} // End of namespace Saga
-#endif /* SAGA_ISOMAP_H_ */
+#endif
diff --git a/saga/isomap_mod.h b/saga/isomap_mod.h
index c9a8261537..27d0c9cd72 100644
--- a/saga/isomap_mod.h
+++ b/saga/isomap_mod.h
@@ -20,13 +20,8 @@
* $Header$
*
*/
-/*
- Description:
-
- Isometric level module - public module header
- Notes:
-*/
+// Isometric level module - public module header
#ifndef SAGA_ISOMAP_MOD_H_
#define SAGA_ISOMAP_MOD_H_
@@ -34,15 +29,11 @@
namespace Saga {
int ISOMAP_Init(void);
-
int ISOMAP_LoadTileset(const byte *, size_t);
-
int ISOMAP_LoadMetaTileset(const byte *, size_t);
-
-int ISOMAP_LoadMetamap(const byte * mm_res_p, size_t mm_res_len);
-
-int ISOMAP_Draw(R_SURFACE * dst_s);
+int ISOMAP_LoadMetamap(const byte *mm_res_p, size_t mm_res_len);
+int ISOMAP_Draw(R_SURFACE *dst_s);
} // End of namespace Saga
-#endif /* SAGA_ISOMAP_MOD_H_ */
+#endif
diff --git a/saga/ite_introproc.cpp b/saga/ite_introproc.cpp
index 6b0fb0dfc4..ccf6d74fb4 100644
--- a/saga/ite_introproc.cpp
+++ b/saga/ite_introproc.cpp
@@ -20,21 +20,15 @@
* $Header$
*
*/
-/*
- Description:
-
- Intro sequence scene procedures
- Notes:
-*/
+
+// Intro sequence scene procedures
+
#include "saga.h"
#include "reinherit.h"
#include "yslib.h"
-/*
- * Uses the following modules:
-\*--------------------------------------------------------------------------*/
#include "animation_mod.h"
#include "cvar_mod.h"
#include "events_mod.h"
@@ -47,70 +41,77 @@
#include "palanim_mod.h"
#include "music.h"
-/*
- * Begin module:
-\*--------------------------------------------------------------------------*/
#include "scene.h"
#include "ite_introproc.h"
namespace Saga {
static R_INTRO_DIALOGUE IntroDiag[] = {
-
{
- CAVE_VOICE_0, "intro1a",
- "We see the sky, we see the land, we see the water, "
- "and we wonder: Are we the only ones?"},
+ CAVE_VOICE_0, "intro1a",
+ "We see the sky, we see the land, we see the water, "
+ "and we wonder: Are we the only ones?"
+ },
{
- CAVE_VOICE_1, "intro2a",
- "Long before we came to exist, the humans ruled "
- "the Earth."},
+ CAVE_VOICE_1, "intro2a",
+ "Long before we came to exist, the humans ruled "
+ "the Earth."
+ },
{
- CAVE_VOICE_2, "intro3a",
- "They made marvelous things, and moved whole " "mountains."},
+ CAVE_VOICE_2, "intro3a",
+ "They made marvelous things, and moved whole " "mountains."
+ },
{
- CAVE_VOICE_3, "intro4a",
- "They knew the Secret of Flight, the Secret of "
- "Happiness, and other secrets beyond our imagining."},
+ CAVE_VOICE_3, "intro4a",
+ "They knew the Secret of Flight, the Secret of "
+ "Happiness, and other secrets beyond our imagining."
+ },
{
- CAVE_VOICE_4, "intro1b",
- "The humans also knew the Secret of Life, "
- "and used it to give us the Four Great Gifts:"},
+ CAVE_VOICE_4, "intro1b",
+ "The humans also knew the Secret of Life, "
+ "and used it to give us the Four Great Gifts:"
+ },
{
- CAVE_VOICE_5, "intro2b",
- "Thinking minds, feeling hearts, speaking "
- "mouths, and reaching hands."},
+ CAVE_VOICE_5, "intro2b",
+ "Thinking minds, feeling hearts, speaking "
+ "mouths, and reaching hands."
+ },
{
- CAVE_VOICE_6, "intro3b",
- "We are their children."},
+ CAVE_VOICE_6, "intro3b",
+ "We are their children."
+ },
{
- CAVE_VOICE_7, "intro1c",
- "They taught us how to use our hands, and how " "to speak."},
+ CAVE_VOICE_7, "intro1c",
+ "They taught us how to use our hands, and how " "to speak."
+ },
{
- CAVE_VOICE_8, "intro2c",
- "They showed us the joy of using our minds."},
+ CAVE_VOICE_8, "intro2c",
+ "They showed us the joy of using our minds."
+ },
{
- CAVE_VOICE_9, "intro3c",
- "They loved us, and when we were ready, they "
- "surely would have given us the Secret of Happiness."},
-
+ CAVE_VOICE_9, "intro3c",
+ "They loved us, and when we were ready, they "
+ "surely would have given us the Secret of Happiness."
+ },
{
- CAVE_VOICE_10, "intro1d",
- "And now we see the sky, the land, and the water "
- "that we are heirs to, and we wonder: why did "
- "they leave?"},
-
+ CAVE_VOICE_10, "intro1d",
+ "And now we see the sky, the land, and the water "
+ "that we are heirs to, and we wonder: why did "
+ "they leave?"
+ },
{
- CAVE_VOICE_11, "intro2d",
- "Do they live still, in the stars? In the oceans "
- "depths? In the wind?"},
+ CAVE_VOICE_11, "intro2d",
+ "Do they live still, in the stars? In the oceans "
+ "depths? In the wind?"
+ },
{
- CAVE_VOICE_12, "intro3d",
- "We wonder, was their fate good or evil?"},
-
+ CAVE_VOICE_12, "intro3d",
+ "We wonder, was their fate good or evil?"
+ },
{
- CAVE_VOICE_13, "intro4d",
- "And will we also share the same fate one day?"},
+ CAVE_VOICE_13, "intro4d",
+ "And will we also share the same fate one day?"
+ },
};
R_SCENE_QUEUE ITE_IntroList[] = {
@@ -125,8 +126,7 @@ R_SCENE_QUEUE ITE_IntroList[] = {
{ITE_FAIRETENT_SCENE, NULL, BY_RESOURCE, ITE_IntroFaireTentProc, 0}
};
-int ITE_StartProc(void)
-{
+int ITE_StartProc() {
size_t n_introscenes;
size_t i;
@@ -136,7 +136,6 @@ int ITE_StartProc(void)
n_introscenes = ARRAYSIZE(ITE_IntroList);
for (i = 0; i < n_introscenes; i++) {
-
SCENE_Queue(&ITE_IntroList[i]);
}
@@ -152,20 +151,14 @@ int ITE_StartProc(void)
return R_SUCCESS;
}
-int ITE_IntroRegisterLang(void)
-{
-
+int ITE_IntroRegisterLang() {
size_t i;
for (i = 0; i < ARRAYSIZE(IntroDiag); i++) {
-
if (CVAR_Register_S(IntroDiag[i].i_str,
IntroDiag[i].i_cvar_name,
NULL, R_CVAR_CFG, R_INTRO_STRMAX) != R_SUCCESS) {
-
- R_printf(R_STDERR,
- "Error registering intro text cvars.");
-
+ R_printf(R_STDERR, "Error registering intro text cvars.");
return R_FAILURE;
}
}
@@ -173,22 +166,16 @@ int ITE_IntroRegisterLang(void)
return R_SUCCESS;
}
-int ITE_IntroAnimProc(int param, R_SCENE_INFO * scene_info)
-/*--------------------------------------------------------------------------*\
- * Handles the introductory Dreamer's Guild / NWC logo animation scene.
-\*--------------------------------------------------------------------------*/
-{
+// Handles the introductory Dreamer's Guild / NWC logo animation scene.
+int ITE_IntroAnimProc(int param, R_SCENE_INFO *scene_info) {
R_EVENT event;
-
YS_IGNORE_PARAM(scene_info);
switch (param) {
-
case SCENE_BEGIN:
- /* Background for intro scene is the first frame of the
- * intro animation; display it and set the palette
- \*-----------------------------------------------------*/
+ // Background for intro scene is the first frame of the
+ // intro animation; display it and set the palette
event.type = R_ONESHOT_EVENT;
event.code = R_BG_EVENT;
event.op = EVENT_DISPLAY;
@@ -202,9 +189,8 @@ int ITE_IntroAnimProc(int param, R_SCENE_INFO * scene_info)
ANIM_SetFrameTime(0, ITE_INTRO_FRAMETIME);
- /* Link this scene's animation resources for continuous
- * playback
- \*-----------------------------------------------------*/
+ // Link this scene's animation resources for continuous
+ // playback
ANIM_Link(0, 1);
ANIM_Link(1, 2);
ANIM_Link(2, 3);
@@ -212,16 +198,14 @@ int ITE_IntroAnimProc(int param, R_SCENE_INFO * scene_info)
ANIM_Link(4, 5);
ANIM_Link(5, 6);
- /* Scene should end on display of last animation frame
- * \*----------------------------------------------------- */
+ // Scene should end on display of last animation frame
ANIM_SetFlag(6, ANIM_ENDSCENE);
R_printf(R_STDOUT, "Beginning animation playback.\n");
ANIM_Play(0, 0);
- /* Queue intro music playback
- * \*----------------------------------------------------- */
+ // Queue intro music playback
event.type = R_ONESHOT_EVENT;
event.code = R_MUSIC_EVENT;
event.param = MUSIC_1;
@@ -231,73 +215,52 @@ int ITE_IntroAnimProc(int param, R_SCENE_INFO * scene_info)
EVENT_Queue(&event);
break;
-
case SCENE_END:
break;
-
default:
R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
break;
-
}
return 0;
}
-int ITE_IntroCave1Proc(int param, R_SCENE_INFO * scene_info)
-/*--------------------------------------------------------------------------*\
- * Handles first introductory cave painting scene
-\*--------------------------------------------------------------------------*/
-{
+// Handles first introductory cave painting scene
+int ITE_IntroCave1Proc(int param, R_SCENE_INFO *scene_info) {
R_EVENT event;
R_EVENT *q_event;
-
int event_time = 0;
int voice_len;
int voice_pad = 50;
-
R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
-
PALENTRY *pal;
-
static PALENTRY current_pal[R_PAL_ENTRIES];
-
int i;
-
int font_flags = FONT_OUTLINE | FONT_CENTERED;
switch (param) {
-
case SCENE_BEGIN:
-
- /* Fade to black out of the intro DG/NWC logo animation
- * \*----------------------------------------------------- */
+ // Fade to black out of the intro DG/NWC logo animation
SYSGFX_GetCurrentPal(current_pal);
-
event.type = R_CONTINUOUS_EVENT;
event.code = R_PAL_EVENT;
event.op = EVENT_PALTOBLACK;
event.time = 0;
event.duration = PALETTE_FADE_DURATION;
event.data = current_pal;
-
q_event = EVENT_Queue(&event);
- /* Display scene background, but stay with black palette
- * \*----------------------------------------------------- */
+ // Display scene background, but stay with black palette
event.type = R_ONESHOT_EVENT;
event.code = R_BG_EVENT;
event.op = EVENT_DISPLAY;
event.param = NO_SET_PALETTE;
event.time = 0;
-
q_event = EVENT_Chain(q_event, &event);
- /* Fade in from black to the scene background palette
- * \*----------------------------------------------------- */
+ // Fade in from black to the scene background palette
SCENE_GetBGPal(&pal);
-
event.type = R_CONTINUOUS_EVENT;
event.code = R_PAL_EVENT;
event.op = EVENT_BLACKTOPAL;
@@ -307,8 +270,7 @@ int ITE_IntroCave1Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- /* Begin palette cycling animation for candles
- * \*----------------------------------------------------- */
+ // Begin palette cycling animation for candles
event.type = R_ONESHOT_EVENT;
event.code = R_PALANIM_EVENT;
event.op = EVENT_CYCLESTART;
@@ -316,8 +278,7 @@ int ITE_IntroCave1Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- /* Queue narrator dialogue list
- * \*----------------------------------------------------- */
+ // Queue narrator dialogue list
text_entry.color = 255;
text_entry.effect_color = 0;
text_entry.text_x = 320 / 2;
@@ -326,13 +287,10 @@ int ITE_IntroCave1Proc(int param, R_SCENE_INFO * scene_info)
text_entry.flags = font_flags;
for (i = INTRO_CAVE1_START; i < INTRO_CAVE1_END; i++) {
-
text_entry.string = IntroDiag[i].i_str;
+ entry_p = TEXT_AddEntry(scene_info->text_list, &text_entry);
- entry_p = TEXT_AddEntry(scene_info->text_list,
- &text_entry);
-
- /* Display text */
+ // Display text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_DISPLAY;
@@ -341,7 +299,7 @@ int ITE_IntroCave1Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- /* Play voice */
+ // Play voice
event.type = R_ONESHOT_EVENT;
event.code = R_VOICE_EVENT;
event.op = EVENT_PLAY;
@@ -350,14 +308,12 @@ int ITE_IntroCave1Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- voice_len =
- _vm->_sndRes->getVoiceLength(IntroDiag[i].i_voice_rn);
+ voice_len = _vm->_sndRes->getVoiceLength(IntroDiag[i].i_voice_rn);
if (voice_len < 0) {
- voice_len = strlen(IntroDiag[i].i_str) *
- VOICE_LETTERLEN;
+ voice_len = strlen(IntroDiag[i].i_str) * VOICE_LETTERLEN;
}
- /* Remove text */
+ // Remove text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_REMOVE;
@@ -367,58 +323,42 @@ int ITE_IntroCave1Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
event_time = voice_pad;
-
}
- /* End scene after last dialogue over
- * \*----------------------------------------------------- */
+ // End scene after last dialogue over
event.type = R_ONESHOT_EVENT;
event.code = R_SCENE_EVENT;
event.op = EVENT_END;
event.time = 0;
q_event = EVENT_Chain(q_event, &event);
-
break;
-
case SCENE_END:
break;
default:
R_printf(R_STDERR, "Illegal scene procedure paramater.\n");
break;
-
}
return 0;
}
-int ITE_IntroCave2Proc(int param, R_SCENE_INFO * scene_info)
-/*--------------------------------------------------------------------------*\
- * Handles second introductory cave painting scene
-\*--------------------------------------------------------------------------*/
-{
-
+// Handles second introductory cave painting scene
+int ITE_IntroCave2Proc(int param, R_SCENE_INFO *scene_info) {
R_EVENT event;
R_EVENT *q_event;
-
int event_time = 0;
int voice_len;
int voice_pad = 50;
-
R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
-
int i;
-
int font_flags = FONT_OUTLINE | FONT_CENTERED;
switch (param) {
-
case SCENE_BEGIN:
-
- /* Start 'dissolve' transition to new scene background
- * \*----------------------------------------------------- */
+ // Start 'dissolve' transition to new scene background
event.type = R_CONTINUOUS_EVENT;
event.code = R_TRANSITION_EVENT;
event.op = EVENT_DISSOLVE;
@@ -427,8 +367,7 @@ int ITE_IntroCave2Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Queue(&event);
- /* Begin palette cycling animation for candles
- * \*----------------------------------------------------- */
+ // Begin palette cycling animation for candles
event.type = R_ONESHOT_EVENT;
event.code = R_PALANIM_EVENT;
event.op = EVENT_CYCLESTART;
@@ -436,8 +375,7 @@ int ITE_IntroCave2Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- /* Queue narrator dialogue list
- * \*----------------------------------------------------- */
+ // Queue narrator dialogue list
text_entry.color = 255;
text_entry.effect_color = 0;
text_entry.text_x = 320 / 2;
@@ -446,13 +384,10 @@ int ITE_IntroCave2Proc(int param, R_SCENE_INFO * scene_info)
text_entry.flags = font_flags;
for (i = INTRO_CAVE2_START; i < INTRO_CAVE2_END; i++) {
-
text_entry.string = IntroDiag[i].i_str;
+ entry_p = TEXT_AddEntry(scene_info->text_list, &text_entry);
- entry_p = TEXT_AddEntry(scene_info->text_list,
- &text_entry);
-
- /* Display text */
+ // Display text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_DISPLAY;
@@ -461,7 +396,7 @@ int ITE_IntroCave2Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- /* Play voice */
+ // Play voice
event.type = R_ONESHOT_EVENT;
event.code = R_VOICE_EVENT;
event.op = EVENT_PLAY;
@@ -470,14 +405,12 @@ int ITE_IntroCave2Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- voice_len =
- _vm->_sndRes->getVoiceLength(IntroDiag[i].i_voice_rn);
+ voice_len = _vm->_sndRes->getVoiceLength(IntroDiag[i].i_voice_rn);
if (voice_len < 0) {
- voice_len = strlen(IntroDiag[i].i_str) *
- VOICE_LETTERLEN;
+ voice_len = strlen(IntroDiag[i].i_str) * VOICE_LETTERLEN;
}
- /* Remove text */
+ // Remove text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_REMOVE;
@@ -489,54 +422,39 @@ int ITE_IntroCave2Proc(int param, R_SCENE_INFO * scene_info)
event_time = voice_pad;
}
- /* End scene after last dialogue over
- * \*----------------------------------------------------- */
+ // End scene after last dialogue over
event.type = R_ONESHOT_EVENT;
event.code = R_SCENE_EVENT;
event.op = EVENT_END;
event.time = event_time;
q_event = EVENT_Chain(q_event, &event);
-
break;
-
case SCENE_END:
break;
-
default:
R_printf(R_STDERR, "Illegal scene procedure paramater.\n");
break;
-
}
return 0;
}
-int ITE_IntroCave3Proc(int param, R_SCENE_INFO * scene_info)
-/*--------------------------------------------------------------------------*\
- * Handles third introductory cave painting scene
-\*--------------------------------------------------------------------------*/
-{
+// Handles third introductory cave painting scene
+int ITE_IntroCave3Proc(int param, R_SCENE_INFO *scene_info) {
R_EVENT event;
R_EVENT *q_event;
-
int event_time = 0;
int voice_len;
int voice_pad = 50;
-
R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
-
int i;
-
int font_flags = FONT_OUTLINE | FONT_CENTERED;
switch (param) {
-
case SCENE_BEGIN:
-
- /* Start 'dissolve' transition to new scene background
- * \*----------------------------------------------------- */
+ // Start 'dissolve' transition to new scene background
event.type = R_CONTINUOUS_EVENT;
event.code = R_TRANSITION_EVENT;
event.op = EVENT_DISSOLVE;
@@ -545,8 +463,7 @@ int ITE_IntroCave3Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Queue(&event);
- /* Begin palette cycling animation for candles
- * \*----------------------------------------------------- */
+ // Begin palette cycling animation for candles
event.type = R_ONESHOT_EVENT;
event.code = R_PALANIM_EVENT;
event.op = EVENT_CYCLESTART;
@@ -554,8 +471,7 @@ int ITE_IntroCave3Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- /* Queue narrator dialogue list
- * \*----------------------------------------------------- */
+ // Queue narrator dialogue list
text_entry.color = 255;
text_entry.effect_color = 0;
text_entry.text_x = 320 / 2;
@@ -564,13 +480,10 @@ int ITE_IntroCave3Proc(int param, R_SCENE_INFO * scene_info)
text_entry.flags = font_flags;
for (i = INTRO_CAVE3_START; i < INTRO_CAVE3_END; i++) {
-
text_entry.string = IntroDiag[i].i_str;
+ entry_p = TEXT_AddEntry(scene_info->text_list, &text_entry);
- entry_p = TEXT_AddEntry(scene_info->text_list,
- &text_entry);
-
- /* Display text */
+ // Display text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_DISPLAY;
@@ -579,7 +492,7 @@ int ITE_IntroCave3Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- /* Play voice */
+ // Play voice
event.type = R_ONESHOT_EVENT;
event.code = R_VOICE_EVENT;
event.op = EVENT_PLAY;
@@ -588,14 +501,12 @@ int ITE_IntroCave3Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- voice_len =
- _vm->_sndRes->getVoiceLength(IntroDiag[i].i_voice_rn);
+ voice_len = _vm->_sndRes->getVoiceLength(IntroDiag[i].i_voice_rn);
if (voice_len < 0) {
- voice_len = strlen(IntroDiag[i].i_str) *
- VOICE_LETTERLEN;
+ voice_len = strlen(IntroDiag[i].i_str) * VOICE_LETTERLEN;
}
- /* Remove text */
+ // Remove text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_REMOVE;
@@ -607,8 +518,7 @@ int ITE_IntroCave3Proc(int param, R_SCENE_INFO * scene_info)
event_time = voice_pad;
}
- /* End scene after last dialogue over
- * \*----------------------------------------------------- */
+ // End scene after last dialogue over
event.type = R_ONESHOT_EVENT;
event.code = R_SCENE_EVENT;
event.op = EVENT_END;
@@ -617,44 +527,31 @@ int ITE_IntroCave3Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
break;
-
case SCENE_END:
break;
-
default:
R_printf(R_STDERR, "Illegal scene procedure paramater.\n");
break;
-
}
return 0;
}
-int ITE_IntroCave4Proc(int param, R_SCENE_INFO * scene_info)
-/*--------------------------------------------------------------------------*\
- * Handles fourth introductory cave painting scene
-\*--------------------------------------------------------------------------*/
-{
+// Handles fourth introductory cave painting scene
+int ITE_IntroCave4Proc(int param, R_SCENE_INFO *scene_info) {
R_EVENT event;
R_EVENT *q_event;
-
int event_time = 0;
int voice_len;
int voice_pad = 50;
-
R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
-
int i;
-
int font_flags = FONT_OUTLINE | FONT_CENTERED;
switch (param) {
-
case SCENE_BEGIN:
-
- /* Start 'dissolve' transition to new scene background
- * \*----------------------------------------------------- */
+ // Start 'dissolve' transition to new scene background
event.type = R_CONTINUOUS_EVENT;
event.code = R_TRANSITION_EVENT;
event.op = EVENT_DISSOLVE;
@@ -663,8 +560,7 @@ int ITE_IntroCave4Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Queue(&event);
- /* Begin palette cycling animation for candles
- * \*----------------------------------------------------- */
+ // Begin palette cycling animation for candles
event.type = R_ONESHOT_EVENT;
event.code = R_PALANIM_EVENT;
event.op = EVENT_CYCLESTART;
@@ -672,8 +568,7 @@ int ITE_IntroCave4Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- /* Queue narrator dialogue list
- * \*----------------------------------------------------- */
+ // Queue narrator dialogue list
text_entry.color = 255;
text_entry.effect_color = 0;
text_entry.text_x = 320 / 2;
@@ -682,12 +577,10 @@ int ITE_IntroCave4Proc(int param, R_SCENE_INFO * scene_info)
text_entry.flags = font_flags;
for (i = INTRO_CAVE4_START; i < INTRO_CAVE4_END; i++) {
-
text_entry.string = IntroDiag[i].i_str;
- entry_p = TEXT_AddEntry(scene_info->text_list,
- &text_entry);
+ entry_p = TEXT_AddEntry(scene_info->text_list, &text_entry);
- /* Display text */
+ // Display text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_DISPLAY;
@@ -696,7 +589,7 @@ int ITE_IntroCave4Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- /* Play voice */
+ // Play voice
event.type = R_ONESHOT_EVENT;
event.code = R_VOICE_EVENT;
event.op = EVENT_PLAY;
@@ -705,14 +598,12 @@ int ITE_IntroCave4Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- voice_len =
- _vm->_sndRes->getVoiceLength(IntroDiag[i].i_voice_rn);
+ voice_len = _vm->_sndRes->getVoiceLength(IntroDiag[i].i_voice_rn);
if (voice_len < 0) {
- voice_len = strlen(IntroDiag[i].i_str) *
- VOICE_LETTERLEN;
+ voice_len = strlen(IntroDiag[i].i_str) * VOICE_LETTERLEN;
}
- /* Remove text */
+ // Remove text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_REMOVE;
@@ -722,11 +613,9 @@ int ITE_IntroCave4Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
event_time = voice_pad;
-
}
- /* End scene after last dialogue over
- * \*----------------------------------------------------- */
+ // End scene after last dialogue over
event.type = R_ONESHOT_EVENT;
event.code = R_SCENE_EVENT;
event.op = EVENT_END;
@@ -735,58 +624,46 @@ int ITE_IntroCave4Proc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
break;
-
case SCENE_END:
break;
-
default:
R_printf(R_STDERR, "Illegal scene procedure paramater.\n");
break;
-
}
return 0;
-
}
-int ITE_IntroValleyProc(int param, R_SCENE_INFO * scene_info)
-/*--------------------------------------------------------------------------*\
- * Handles intro title scene (valley overlook)
-\*--------------------------------------------------------------------------*/
-{
+// Handles intro title scene (valley overlook)
+int ITE_IntroValleyProc(int param, R_SCENE_INFO *scene_info) {
R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
-
R_EVENT event;
R_EVENT *q_event;
-
int i;
const INTRO_CREDIT credits[] = {
{160, 44, 9000, CREDIT_DURATION1,
- "Producer", SMALL_FONT_ID},
+ "Producer", SMALL_FONT_ID},
{160, 56, 0, CREDIT_DURATION1,
- "Walter Hochbrueckner", MEDIUM_FONT_ID},
+ "Walter Hochbrueckner", MEDIUM_FONT_ID},
{160, 88, 0, CREDIT_DURATION1,
- "Executive Producer", SMALL_FONT_ID},
+ "Executive Producer", SMALL_FONT_ID},
{160, 100, 0, CREDIT_DURATION1,
- "Robert McNally", MEDIUM_FONT_ID},
+ "Robert McNally", MEDIUM_FONT_ID},
{160, 132, 0, CREDIT_DURATION1,
- "Publisher", SMALL_FONT_ID},
+ "Publisher", SMALL_FONT_ID},
{160, 144, 0, CREDIT_DURATION1,
- "Jon Van Caneghem", MEDIUM_FONT_ID}
+ "Jon Van Caneghem", MEDIUM_FONT_ID}
};
int n_credits = sizeof credits / sizeof credits[0];
-
int event_delay = 0;
switch (param) {
-
case SCENE_BEGIN:
- /* Display ITE title screen background
- * \*----------------------------------------------------- */
+ // Display ITE title screen background
event.type = R_ONESHOT_EVENT;
event.code = R_BG_EVENT;
event.op = EVENT_DISPLAY;
@@ -797,13 +674,11 @@ int ITE_IntroValleyProc(int param, R_SCENE_INFO * scene_info)
R_printf(R_STDOUT, "Beginning animation playback.\n");
- /* Begin title screen background animation
- * \*----------------------------------------------------- */
+ // Begin title screen background animation
ANIM_SetFlag(0, ANIM_LOOP);
ANIM_Play(0, 0);
- /* Begin ITE title theme music
- * \*----------------------------------------------------- */
+ // Begin ITE title theme music
_vm->_music->stop();
event.type = R_ONESHOT_EVENT;
@@ -814,23 +689,20 @@ int ITE_IntroValleyProc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
- /* Queue game credits list
- * \*----------------------------------------------------- */
+ // Queue game credits list
text_entry.color = 255;
text_entry.effect_color = 0;
text_entry.flags = FONT_OUTLINE | FONT_CENTERED;
for (i = 0; i < n_credits; i++) {
-
text_entry.string = credits[i].string;
text_entry.font_id = credits[i].font_id;
text_entry.text_x = credits[i].text_x;
text_entry.text_y = credits[i].text_y;
- entry_p = TEXT_AddEntry(scene_info->text_list,
- &text_entry);
+ entry_p = TEXT_AddEntry(scene_info->text_list, &text_entry);
- /* Display text */
+ // Display text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_DISPLAY;
@@ -839,7 +711,7 @@ int ITE_IntroValleyProc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Queue(&event);
- /* Remove text */
+ // Remove text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_REMOVE;
@@ -849,8 +721,7 @@ int ITE_IntroValleyProc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
}
- /* End scene after credit display
- * \*----------------------------------------------------- */
+ // End scene after credit display
event.type = R_ONESHOT_EVENT;
event.code = R_SCENE_EVENT;
event.op = EVENT_END;
@@ -858,27 +729,20 @@ int ITE_IntroValleyProc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
break;
-
case SCENE_END:
break;
-
default:
R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
break;
-
}
return 0;
}
-int ITE_IntroTreeHouseProc(int param, R_SCENE_INFO * scene_info)
-/*--------------------------------------------------------------------------*\
- * Handles second intro credit screen (treehouse view)
-\*--------------------------------------------------------------------------*/
-{
+// Handles second intro credit screen (treehouse view)
+int ITE_IntroTreeHouseProc(int param, R_SCENE_INFO *scene_info) {
R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
-
R_EVENT event;
R_EVENT *q_event;
@@ -886,41 +750,37 @@ int ITE_IntroTreeHouseProc(int param, R_SCENE_INFO * scene_info)
const INTRO_CREDIT credits[] = {
{160, 58, 2000, CREDIT_DURATION1,
- "Game Design", SMALL_FONT_ID},
+ "Game Design", SMALL_FONT_ID},
{160, 70, 0, CREDIT_DURATION1,
- "Talin, Joe Pearce, Robert McNally", MEDIUM_FONT_ID},
+ "Talin, Joe Pearce, Robert McNally", MEDIUM_FONT_ID},
{160, 80, 0, CREDIT_DURATION1,
- "and Carolly Hauksdottir", MEDIUM_FONT_ID},
+ "and Carolly Hauksdottir", MEDIUM_FONT_ID},
{160, 119, 0, CREDIT_DURATION1,
- "Screenplay and Dialog", SMALL_FONT_ID},
+ "Screenplay and Dialog", SMALL_FONT_ID},
{160, 131, 0, CREDIT_DURATION1,
- "Robert Leh, Len Wein, and Bill Rotsler",
- MEDIUM_FONT_ID},
+ "Robert Leh, Len Wein, and Bill Rotsler",
+ MEDIUM_FONT_ID},
{160, 54, 5000, CREDIT_DURATION1,
- "Art", SMALL_FONT_ID},
+ "Art", SMALL_FONT_ID},
{160, 66, 0, CREDIT_DURATION1,
- "Edward Lacabanne, Glenn Price, April Lee,",
- MEDIUM_FONT_ID},
+ "Edward Lacabanne, Glenn Price, April Lee,",
+ MEDIUM_FONT_ID},
{160, 76, 0, CREDIT_DURATION1,
- "Lisa Iennaco, Brian Dowrick, Reed", MEDIUM_FONT_ID},
+ "Lisa Iennaco, Brian Dowrick, Reed", MEDIUM_FONT_ID},
{160, 86, 0, CREDIT_DURATION1,
- "Waller, Allison Hershey and Talin", MEDIUM_FONT_ID},
+ "Waller, Allison Hershey and Talin", MEDIUM_FONT_ID},
{160, 123, 0, CREDIT_DURATION1,
- "Art Direction", SMALL_FONT_ID},
+ "Art Direction", SMALL_FONT_ID},
{160, 135, 0, CREDIT_DURATION1,
- "Allison Hershey", MEDIUM_FONT_ID}
+ "Allison Hershey", MEDIUM_FONT_ID}
};
int n_credits = ARRAYSIZE(credits);
-
int event_delay = 0;
switch (param) {
-
case SCENE_BEGIN:
-
- /* Start 'dissolve' transition to new scene background
- * \*----------------------------------------------------- */
+ // Start 'dissolve' transition to new scene background
event.type = R_CONTINUOUS_EVENT;
event.code = R_TRANSITION_EVENT;
event.op = EVENT_DISSOLVE;
@@ -931,28 +791,24 @@ int ITE_IntroTreeHouseProc(int param, R_SCENE_INFO * scene_info)
event_delay = DISSOLVE_DURATION;
- /* Begin title screen background animation
- * \*----------------------------------------------------- */
+ // Begin title screen background animation
ANIM_SetFrameTime(0, 100);
ANIM_Play(0, event_delay);
- /* Queue game credits list
- * \*----------------------------------------------------- */
+ // Queue game credits list
text_entry.color = 255;
text_entry.effect_color = 0;
text_entry.flags = FONT_OUTLINE | FONT_CENTERED;
for (i = 0; i < n_credits; i++) {
-
text_entry.string = credits[i].string;
text_entry.font_id = credits[i].font_id;
text_entry.text_x = credits[i].text_x;
text_entry.text_y = credits[i].text_y;
- entry_p = TEXT_AddEntry(scene_info->text_list,
- &text_entry);
+ entry_p = TEXT_AddEntry(scene_info->text_list, &text_entry);
- /* Display text */
+ // Display text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_DISPLAY;
@@ -961,7 +817,7 @@ int ITE_IntroTreeHouseProc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Queue(&event);
- /* Remove text */
+ // Remove text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_REMOVE;
@@ -971,84 +827,69 @@ int ITE_IntroTreeHouseProc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
}
- /* End scene after credit display
- * \*----------------------------------------------------- */
+ // End scene after credit display
event.type = R_ONESHOT_EVENT;
event.code = R_SCENE_EVENT;
event.op = EVENT_END;
event.time = 1000;
q_event = EVENT_Chain(q_event, &event);
-
break;
-
case SCENE_END:
-
break;
-
default:
R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
break;
-
}
return 0;
-
}
-int ITE_IntroFairePathProc(int param, R_SCENE_INFO * scene_info)
-/*--------------------------------------------------------------------------*\
- * Handles third intro credit screen (path to puzzle tent)
-\*--------------------------------------------------------------------------*/
-{
+// Handles third intro credit screen (path to puzzle tent)
+int ITE_IntroFairePathProc(int param, R_SCENE_INFO *scene_info) {
R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
-
R_EVENT event;
R_EVENT *q_event;
-
long event_delay = 0;
-
int i;
INTRO_CREDIT credits[] = {
{160, 58, 2000, CREDIT_DURATION1,
- "Original Game Engine Programming", SMALL_FONT_ID},
+ "Original Game Engine Programming", SMALL_FONT_ID},
{160, 70, 0, CREDIT_DURATION1,
- "Talin, Walter Hochbrueckner,", MEDIUM_FONT_ID},
+ "Talin, Walter Hochbrueckner,", MEDIUM_FONT_ID},
{160, 80, 0, CREDIT_DURATION1,
- "Joe Burks and Robert Wiggins", MEDIUM_FONT_ID},
+ "Joe Burks and Robert Wiggins", MEDIUM_FONT_ID},
{160, 119, 0, CREDIT_DURATION1,
- "Music and Sound", SMALL_FONT_ID},
+ "Music and Sound", SMALL_FONT_ID},
{160, 131, 0, CREDIT_DURATION1,
- "Matt Nathan", MEDIUM_FONT_ID},
+ "Matt Nathan", MEDIUM_FONT_ID},
{160, 58, 5000, CREDIT_DURATION1,
- "Directed by", SMALL_FONT_ID},
+ "Directed by", SMALL_FONT_ID},
{160, 70, 0, CREDIT_DURATION1,
- "Talin", MEDIUM_FONT_ID},
+ "Talin", MEDIUM_FONT_ID},
{160, 119, 0, CREDIT_DURATION1,
- "Game Engine Reconstruction", SMALL_FONT_ID},
+ "Game Engine Reconstruction", SMALL_FONT_ID},
{160, 131, 0, CREDIT_DURATION1,
- "Alpha software - Use at your own risk.",
- MEDIUM_FONT_ID}
+ "Alpha software - Use at your own risk.",
+ MEDIUM_FONT_ID}
};
int n_credits = sizeof credits / sizeof credits[0];
switch (param) {
-
case SCENE_BEGIN:
- /* Start 'dissolve' transition to new scene background
- * \*----------------------------------------------------- */
+ // Start 'dissolve' transition to new scene background
event.type = R_CONTINUOUS_EVENT;
event.code = R_TRANSITION_EVENT;
event.op = EVENT_DISSOLVE;
@@ -1059,28 +900,24 @@ int ITE_IntroFairePathProc(int param, R_SCENE_INFO * scene_info)
event_delay = DISSOLVE_DURATION;
- /* Begin title screen background animation
- * \*----------------------------------------------------- */
+ // Begin title screen background animation
ANIM_SetFlag(0, ANIM_LOOP);
ANIM_Play(0, event_delay);
- /* Queue game credits list
- * \*----------------------------------------------------- */
+ // Queue game credits list
text_entry.color = 255;
text_entry.effect_color = 0;
text_entry.flags = FONT_OUTLINE | FONT_CENTERED;
for (i = 0; i < n_credits; i++) {
-
text_entry.string = credits[i].string;
text_entry.font_id = credits[i].font_id;
text_entry.text_x = credits[i].text_x;
text_entry.text_y = credits[i].text_y;
- entry_p = TEXT_AddEntry(scene_info->text_list,
- &text_entry);
+ entry_p = TEXT_AddEntry(scene_info->text_list, &text_entry);
- /* Display text */
+ // Display text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_DISPLAY;
@@ -1089,7 +926,7 @@ int ITE_IntroFairePathProc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Queue(&event);
- /* Remove text */
+ // Remove text
event.type = R_ONESHOT_EVENT;
event.code = R_TEXT_EVENT;
event.op = EVENT_REMOVE;
@@ -1099,46 +936,35 @@ int ITE_IntroFairePathProc(int param, R_SCENE_INFO * scene_info)
q_event = EVENT_Chain(q_event, &event);
}
- /* End scene after credit display
- * \*----------------------------------------------------- */
+ // End scene after credit display
event.type = R_ONESHOT_EVENT;
event.code = R_SCENE_EVENT;
event.op = EVENT_END;
event.time = 1000;
q_event = EVENT_Chain(q_event, &event);
-
break;
-
case SCENE_END:
break;
-
default:
R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
break;
-
}
return 0;
}
-int ITE_IntroFaireTentProc(int param, R_SCENE_INFO * scene_info)
-/*--------------------------------------------------------------------------*\
- * Handles fourth intro credit screen (treehouse view)
-\*--------------------------------------------------------------------------*/
-{
+// Handles fourth intro credit screen (treehouse view)
+int ITE_IntroFaireTentProc(int param, R_SCENE_INFO *scene_info) {
R_EVENT event;
R_EVENT *q_event;
R_EVENT *q_event_start;
-
YS_IGNORE_PARAM(scene_info);
switch (param) {
-
case SCENE_BEGIN:
- /* Start 'dissolve' transition to new scene background
- * \*----------------------------------------------------- */
+ // Start 'dissolve' transition to new scene background
event.type = R_CONTINUOUS_EVENT;
event.code = R_TRANSITION_EVENT;
event.op = EVENT_DISSOLVE;
@@ -1147,25 +973,18 @@ int ITE_IntroFaireTentProc(int param, R_SCENE_INFO * scene_info)
q_event_start = EVENT_Queue(&event);
- /* End scene after momentary pause
- * \*----------------------------------------------------- */
+ // End scene after momentary pause
event.type = R_ONESHOT_EVENT;
event.code = R_SCENE_EVENT;
event.op = EVENT_END;
event.time = 5000;
-
q_event = EVENT_Chain(q_event_start, &event);
-
break;
-
case SCENE_END:
-
break;
-
default:
R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
break;
-
}
return 0;
diff --git a/saga/ite_introproc.h b/saga/ite_introproc.h
index b8a7f07b1d..be259a633a 100644
--- a/saga/ite_introproc.h
+++ b/saga/ite_introproc.h
@@ -20,13 +20,8 @@
* $Header$
*
*/
-/*
- Description:
-
- Intro sequence scene procedures header file
- Notes:
-*/
+// Intro sequence scene procedures header file
#ifndef SAGA_ITE_INTRO_H_
#define SAGA_ITE_INTRO_H_
@@ -47,7 +42,6 @@ namespace Saga {
#define CREDIT_DURATION1 4000
enum R_INTRO_SCENE_DIALOGUE_INFO {
-
INTRO_CAVE1_START = 0,
INTRO_CAVE1_END = 4,
@@ -62,29 +56,23 @@ enum R_INTRO_SCENE_DIALOGUE_INFO {
};
struct R_INTRO_DIALOGUE {
-
uint32 i_voice_rn;
const char *i_cvar_name;
char i_str[R_INTRO_STRMAX];
-
};
struct INTRO_CAPTION {
-
int res_n;
char *caption;
-
};
struct INTRO_CREDIT {
-
int text_x;
int text_y;
int delta_time;
int duration;
const char *string;
int font_id;
-
};
} // End of namespace Saga
diff --git a/saga/ite_introproc_mod.h b/saga/ite_introproc_mod.h
index d90a7783ec..447126145f 100644
--- a/saga/ite_introproc_mod.h
+++ b/saga/ite_introproc_mod.h
@@ -20,13 +20,8 @@
* $Header$
*
*/
-/*
- Description:
-
- Intro sequence scene procedures - public header file
- Notes:
-*/
+// Intro sequence scene procedures - public header file
#ifndef SAGA_ITE_INTROPROC_MOD_H_
#define SAGA_ITE_INTROPROC_MOD_H_
@@ -37,4 +32,4 @@ int ITE_IntroRegisterLang(void);
} // End of namespace Saga
-#endif /* SAGA_ITE_INTROPROC_MOD_H_ */
+#endif
diff --git a/saga/music.cpp b/saga/music.cpp
index e0da366ed1..9993681041 100644
--- a/saga/music.cpp
+++ b/saga/music.cpp
@@ -28,7 +28,7 @@
#include "music.h"
#include "rscfile_mod.h"
#include "game_mod.h"
-#include "sound/mididrv.h"
+#include "sound/mididrv.h"
#include "sound/midiparser.h"
#include "common/config-manager.h"
#include "common/file.h"
@@ -52,22 +52,22 @@ MusicPlayer::MusicPlayer(MidiDriver *driver) : _driver(driver), _looping(false),
memset(_channel, 0, sizeof(_channel));
this->open();
}
-
+
MusicPlayer::~MusicPlayer() {
_driver->setTimerCallback(NULL, NULL);
_parser->unloadMusic();
this->close();
- }
-
+}
+
void MusicPlayer::setVolume(int volume) {
if (volume < 0)
volume = 0;
else if (volume > 255)
volume = 255;
-
+
if (_masterVolume == volume)
return;
-
+
_masterVolume = volume;
for (int i = 0; i < 16; ++i) {
@@ -76,12 +76,12 @@ void MusicPlayer::setVolume(int volume) {
}
}
}
-
+
int MusicPlayer::open() {
// Don't ever call open without first setting the output driver!
if (!_driver)
return 255;
-
+
int ret = _driver->open();
if (ret)
return ret;
@@ -89,14 +89,14 @@ int MusicPlayer::open() {
_driver->setTimerCallback(this, &onTimer);
return 0;
}
-
+
void MusicPlayer::close() {
stopMusic();
if (_driver)
_driver->close();
_driver = 0;
}
-
+
void MusicPlayer::send(uint32 b) {
byte channel = (byte)(b & 0x0F);
if ((b & 0xFFF0) == 0x07B0) {
@@ -107,48 +107,47 @@ void MusicPlayer::send(uint32 b) {
b = (b & 0xFF00FFFF) | (volume << 16);
} else if ((b & 0xF0) == 0xC0 && !_isGM && !_nativeMT32) {
b = (b & 0xFFFF00FF) | mt32_to_gm[(b >> 8) & 0xFF] << 8;
- }
+ }
else if ((b & 0xFFF0) == 0x007BB0) {
//Only respond to All Notes Off if this channel
//has currently been allocated
if (_channel[b & 0x0F])
return;
}
-
+
if (!_channel[channel])
_channel[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
if (_channel[channel])
_channel[channel]->send(b);
}
-
+
void MusicPlayer::metaEvent(byte type, byte *data, uint16 length) {
//Only thing we care about is End of Track.
if (type != 0x2F)
return;
-
- if (_looping)
+
+ if (_looping)
_parser->jumpToTick(0);
else
stopMusic();
}
-
+
void MusicPlayer::onTimer(void *refCon) {
MusicPlayer *music = (MusicPlayer *)refCon;
if (music->_isPlaying)
music->_parser->onTimer();
}
-
+
void MusicPlayer::playMusic() {
_isPlaying = true;
}
-
+
void MusicPlayer::stopMusic() {
_isPlaying = false;
_parser->unloadMusic();
}
-
Music::Music(MidiDriver *driver, int enabled) : _enabled(enabled) {
_player = new MusicPlayer(driver);
_musicInitialized = 1;
@@ -319,7 +318,7 @@ int Music::play(uint32 music_rn, uint16 flags) {
} else {
/* Load XMI resource data */
GAME_GetFileContext(&rsc_ctxt, R_GAME_RESOURCEFILE, 0);
-
+
if (RSC_LoadResource(rsc_ctxt, music_rn, &resource_data,
&resource_size) != R_SUCCESS ) {
R_printf(R_STDERR, "SYSMUSIC_Play(): Resource load failed: %u",
diff --git a/saga/music.h b/saga/music.h
index 201efab566..cf70cc4a29 100644
--- a/saga/music.h
+++ b/saga/music.h
@@ -20,13 +20,8 @@
* $Header$
*
*/
-/*
- Description:
-
- Music class
- Notes:
-*/
+// Music class
#ifndef SAGA_MUSIC_H_
#define SAGA_MUSIC_H_
@@ -39,7 +34,6 @@
namespace Saga {
enum MUSIC_FLAGS {
-
R_MUSIC_LOOP = 0x01
};
@@ -48,25 +42,25 @@ public:
MusicPlayer(MidiDriver *driver);
~MusicPlayer();
void setVolume(int volume);
- int getVolume() { return _masterVolume; }
-
- void hasNativeMT32(bool b) { _nativeMT32 = b; }
+ int getVolume() { return _masterVolume; }
+
+ void hasNativeMT32(bool b) { _nativeMT32 = b; }
void playMusic();
void stopMusic();
- void setLoop(bool loop) { _looping = loop; }
+ void setLoop(bool loop) { _looping = loop; }
+
+ void setGM(bool isGM) { _isGM = isGM; }
- void setGM(bool isGM) { _isGM = isGM; }
-
//MidiDriver interface implementation
int open();
void close();
void send(uint32 b);
-
+
void metaEvent(byte type, byte *data, uint16 length);
-
+
void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { }
uint32 getBaseTempo(void) { return _driver ? _driver->getBaseTempo() : 0; }
-
+
//Channel allocation functions
MidiChannel *allocateChannel() { return 0; }
MidiChannel *getPercussionChannel() { return 0; }
@@ -82,19 +76,19 @@ protected:
byte _channelVolume[16];
bool _nativeMT32;
bool _isGM;
-
+
bool _isPlaying;
bool _looping;
bool _randomLoop;
byte _masterVolume;
-
+
byte *_musicData;
uint16 *_buf;
uint32 _musicDataSize;
};
class Music {
- public:
+public:
Music(MidiDriver *driver, int enabled);
~Music(void);
@@ -105,7 +99,7 @@ class Music {
int resume(void);
int stop(void);
- private:
+private:
SagaEngine *_vm;
SoundMixer *_mixer;
@@ -114,9 +108,8 @@ class Music {
int _musicInitialized;
int _enabled;
-
- };
+};
} // End of namespace Saga
-#endif /* SAGA_MUSIC_H_ */
+#endif
diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp
index 6d912185fd..7fce03bd96 100644
--- a/saga/objectmap.cpp
+++ b/saga/objectmap.cpp
@@ -20,40 +20,25 @@
* $Header$
*
*/
-/*
- Description:
-
- Object map / Object click-area module
- Notes:
+// Object map / Object click-area module
- 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
-*/
+// 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
#include "reinherit.h"
#include "yslib.h"
-/*
- * Uses the following modules:
-\*--------------------------------------------------------------------------*/
#include "cvar_mod.h"
#include "console_mod.h"
#include "gfx_mod.h"
#include "font_mod.h"
-/*
- * Module options
-\*--------------------------------------------------------------------------*/
-
#define R_OBJECTMAP_DEBUG R_DEBUG_INFO
-/*
- * Begin module
-\*--------------------------------------------------------------------------*/
#include "objectmap_mod.h"
#include "objectmap.h"
@@ -61,31 +46,22 @@ namespace Saga {
static R_OBJECTMAP_INFO OMInfo;
-int OBJECTMAP_Register(void)
-{
-
- CVAR_RegisterFunc(CF_object_info,
- "object_info", NULL, R_CVAR_NONE, 0, 0);
+int OBJECTMAP_Register() {
+ CVAR_RegisterFunc(CF_object_info, "object_info", NULL, R_CVAR_NONE, 0, 0);
return R_SUCCESS;
}
-int OBJECTMAP_Init(void)
-/*--------------------------------------------------------------------------*\
- * Initializes the object map module, creates module allocation context
-\*--------------------------------------------------------------------------*/
-{
+// Initializes the object map module, creates module allocation context
+int OBJECTMAP_Init() {
R_printf(R_STDOUT, "OBJECTMAP Module: Initializing...\n");
OMInfo.initialized = 1;
return R_SUCCESS;
}
-int OBJECTMAP_Shutdown(void)
-/*--------------------------------------------------------------------------*\
- * Shuts down the object map module, destroys module allocation context
-\*--------------------------------------------------------------------------*/
-{
+// Shuts down the object map module, destroys module allocation context
+int OBJECTMAP_Shutdown() {
if (!OMInfo.initialized) {
return R_FAILURE;
}
@@ -101,11 +77,8 @@ int OBJECTMAP_Shutdown(void)
return R_SUCCESS;
}
-int OBJECTMAP_Load(const byte * om_res, size_t om_res_len)
-/*--------------------------------------------------------------------------*\
- * Loads an object map resource ( objects ( clickareas ( points ) ) )
-\*--------------------------------------------------------------------------*/
-{
+// Loads an object map resource ( objects ( clickareas ( points ) ) )
+int OBJECTMAP_Load(const byte *om_res, size_t om_res_len) {
const unsigned char *read_p = om_res;
R_OBJECTMAP_ENTRY *object_map;
@@ -117,8 +90,7 @@ int OBJECTMAP_Load(const byte * om_res, size_t om_res_len)
YS_IGNORE_PARAM(om_res_len);
if (!OMInfo.initialized) {
- R_printf(R_STDERR,
- "Error: Object map module not initialized!\n");
+ R_printf(R_STDERR, "Error: Object map module not initialized!\n");
return R_FAILURE;
}
@@ -126,83 +98,63 @@ int OBJECTMAP_Load(const byte * om_res, size_t om_res_len)
OBJECTMAP_Free();
}
- /* Obtain object count N and allocate space for N objects
- * \*------------------------------------------------------------- */
+ // Obtain object count N and allocate space for N objects
OMInfo.n_objects = ys_read_u16_le(read_p, &read_p);
- OMInfo.object_maps =
- (R_OBJECTMAP_ENTRY *)malloc(OMInfo.n_objects * sizeof *OMInfo.object_maps);
+ OMInfo.object_maps = (R_OBJECTMAP_ENTRY *)malloc(OMInfo.n_objects * sizeof *OMInfo.object_maps);
if (OMInfo.object_maps == NULL) {
R_printf(R_STDERR, "Error: Memory allocation failed.\n");
return R_MEM;
}
- /* Load all N objects
- * \*------------------------------------------------------------- */
+ // Load all N objects
for (i = 0; i < OMInfo.n_objects; i++) {
-
object_map = &OMInfo.object_maps[i];
object_map->unknown0 = ys_read_u8(read_p, &read_p);
object_map->n_clickareas = ys_read_u8(read_p, &read_p);
object_map->flags = ys_read_u16_le(read_p, &read_p);
object_map->object_num = ys_read_u16_le(read_p, &read_p);
object_map->script_num = ys_read_u16_le(read_p, &read_p);
-
- object_map->clickareas =
- (R_CLICKAREA *)malloc(object_map->n_clickareas *
- sizeof *(object_map->clickareas));
+ object_map->clickareas = (R_CLICKAREA *)malloc(object_map->n_clickareas * sizeof *(object_map->clickareas));
if (object_map->clickareas == NULL) {
- R_printf(R_STDERR,
- "Error: Memory allocation failed.\n");
+ R_printf(R_STDERR, "Error: Memory allocation failed.\n");
return R_MEM;
}
- /* Load all clickareas for this object */
+ // Load all clickareas for this object
for (k = 0; k < object_map->n_clickareas; k++) {
-
clickarea = &object_map->clickareas[k];
clickarea->n_points = ys_read_u16_le(read_p, &read_p);
assert(clickarea->n_points != 0);
- clickarea->points =
- (R_POINT *)malloc(clickarea->n_points * sizeof *(clickarea->points));
-
+ clickarea->points = (R_POINT *)malloc(clickarea->n_points * sizeof *(clickarea->points));
if (clickarea->points == NULL) {
- R_printf(R_STDERR,
- "Error: Memory allocation failed.\n");
+ R_printf(R_STDERR, "Error: Memory allocation failed.\n");
return R_MEM;
}
- /* Load all points for this clickarea */
+ // Load all points for this clickarea
for (m = 0; m < clickarea->n_points; m++) {
-
point = &clickarea->points[m];
point->x = ys_read_s16_le(read_p, &read_p);
point->y = ys_read_s16_le(read_p, &read_p);
}
+#if R_OBJECTMAP_DEBUG >= R_DEBUG_PARANOID
+ R_printf(R_STDOUT, "OBJECTMAP_Load(): Read %d points for clickarea %d in object %d.\n",
+ clickarea->n_points, k, object_map->object_num);
+#endif
+ }
+ }
-# if R_OBJECTMAP_DEBUG >= R_DEBUG_PARANOID
- R_printf(R_STDOUT,
- "OBJECTMAP_Load(): "
- "Read %d points for clickarea %d in object %d.\n",
- clickarea->n_points, k, object_map->object_num);
-# endif
- } /* End load all clickareas */
- } /* End load all objects */
-
- /*-------------------------------------------------------------*/
OMInfo.objects_loaded = 1;
return R_SUCCESS;
}
-int OBJECTMAP_Free(void)
-/*--------------------------------------------------------------------------*\
- * Frees all storage allocated for the current object map data
-\*--------------------------------------------------------------------------*/
-{
+// Frees all storage allocated for the current object map data
+int OBJECTMAP_Free() {
R_OBJECTMAP_ENTRY *object_map;
R_CLICKAREA *clickarea;
@@ -214,7 +166,6 @@ int OBJECTMAP_Free(void)
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);
@@ -231,11 +182,8 @@ int OBJECTMAP_Free(void)
return R_SUCCESS;
}
-int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len)
-/*--------------------------------------------------------------------------*\
- * Loads an object name list resource
-\*--------------------------------------------------------------------------*/
-{
+// Loads an object name list resource
+int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len) {
const unsigned char *read_p = onl_res;
int table_len;
@@ -256,9 +204,9 @@ int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len)
OMInfo.n_names = n_names;
#if 0
-# if R_OBJECTMAP_DEBUG >= R_DEBUG_INFO
+#if R_OBJECTMAP_DEBUG >= R_DEBUG_INFO
R_printf(R_STDOUT, "OBJECTMAP_LoadNames: Loading %d object names.\n", n_names);
-# endif
+#endif
#endif
OMInfo.names = (const char **)malloc(n_names * sizeof *OMInfo.names);
@@ -271,10 +219,9 @@ int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len)
name_offset = ys_read_u16_le(read_p, &read_p);
OMInfo.names[i] = (const char *)(onl_res + name_offset);
-# if R_OBJECTMAP_DEBUG >= R_DEBUG_VERBOSE
- R_printf(R_STDOUT,
- "Loaded object name string: %s\n", OMInfo.names[i]);
-# endif
+#if R_OBJECTMAP_DEBUG >= R_DEBUG_VERBOSE
+ R_printf(R_STDOUT, "Loaded object name string: %s\n", OMInfo.names[i]);
+#endif
}
OMInfo.names_loaded = 1;
@@ -282,11 +229,8 @@ int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len)
return R_SUCCESS;
}
-int OBJECTMAP_FreeNames(void)
-/*--------------------------------------------------------------------------*\
- * Frees all storage allocated for the current object name list data
-\*--------------------------------------------------------------------------*/
-{
+// Frees all storage allocated for the current object name list data
+int OBJECTMAP_FreeNames() {
if (!OMInfo.names_loaded) {
return R_FAILURE;
}
@@ -299,14 +243,11 @@ int OBJECTMAP_FreeNames(void)
return R_SUCCESS;
}
-int OBJECTMAP_GetName(int object, const char **name)
-/*--------------------------------------------------------------------------*\
- * 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.
-\*--------------------------------------------------------------------------*/
-{
+// 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) {
if (!OMInfo.names_loaded) {
return R_FAILURE;
}
@@ -320,8 +261,7 @@ int OBJECTMAP_GetName(int object, const char **name)
return R_SUCCESS;
}
-int OBJECTMAP_GetFlags(int object, uint16 * flags)
-{
+int OBJECTMAP_GetFlags(int object, uint16 *flags) {
int i;
if (!OMInfo.names_loaded) {
@@ -333,9 +273,7 @@ int OBJECTMAP_GetFlags(int object, uint16 * flags)
}
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;
}
@@ -344,14 +282,11 @@ int OBJECTMAP_GetFlags(int object, uint16 * flags)
return R_FAILURE;
}
-int OBJECTMAP_GetEPNum(int object, int *ep_num)
-/*--------------------------------------------------------------------------*\
- * 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.
-\*--------------------------------------------------------------------------*/
-{
+// 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) {
int i;
if (!OMInfo.names_loaded) {
@@ -374,13 +309,9 @@ int OBJECTMAP_GetEPNum(int object, int *ep_num)
return R_FAILURE;
}
-int OBJECTMAP_Draw(R_SURFACE * ds, R_POINT * imouse_pt, int color, int color2)
-/*--------------------------------------------------------------------------*\
- * Uses GFX_DrawLine to display all clickareas for each object in the
- * currently loaded object map resource.
-\*--------------------------------------------------------------------------*/
-{
-
+// Uses GFX_DrawLine to display all clickareas for each object in the
+// currently loaded object map resource.
+int OBJECTMAP_Draw(R_SURFACE *ds, R_POINT *imouse_pt, int color, int color2) {
R_OBJECTMAP_ENTRY *object_map;
R_CLICKAREA *clickarea;
@@ -402,26 +333,18 @@ int OBJECTMAP_Draw(R_SURFACE * ds, R_POINT * imouse_pt, int color, int color2)
}
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;
-
- 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);
-
+ 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);
draw_txt = 1;
draw_color = color2;
}
@@ -429,44 +352,26 @@ int OBJECTMAP_Draw(R_SURFACE * ds, R_POINT * imouse_pt, int color, int 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) {
-
- /* 2 points represent a box */
- GFX_DrawFrame(ds,
- &clickarea->points[0],
- &clickarea->points[1], draw_color);
+ // 2 points represent a box
+ 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);
-
+ // Otherwise draw a polyline
+ GFX_DrawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
}
-
- } /* end for() clickareas */
- } /* end for() objects */
+ }
+ }
if (draw_txt) {
-
- FONT_Draw(SMALL_FONT_ID,
- ds,
- txt_buf,
- 0,
- 2, 2, SYSGFX_GetWhite(), SYSGFX_GetBlack(), FONT_OUTLINE);
+ FONT_Draw(SMALL_FONT_ID, ds, txt_buf, 0, 2, 2, SYSGFX_GetWhite(), SYSGFX_GetBlack(), FONT_OUTLINE);
}
return R_SUCCESS;
}
-static bool
-MATH_HitTestPoly(R_POINT * points, unsigned int npoints, R_POINT test_point)
-{
+static bool MATH_HitTestPoly(R_POINT *points, unsigned int npoints, R_POINT test_point) {
int yflag0;
int yflag1;
bool inside_flag = false;
@@ -476,17 +381,11 @@ MATH_HitTestPoly(R_POINT * points, unsigned int npoints, R_POINT test_point)
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) >=
- (vtx1->x - test_point.x) * (vtx0->y -
- vtx1->y)) == yflag1) {
-
+ (vtx1->x - test_point.x) * (vtx0->y - vtx1->y)) == yflag1) {
inside_flag = !inside_flag;
}
}
@@ -497,9 +396,7 @@ MATH_HitTestPoly(R_POINT * points, unsigned int npoints, R_POINT test_point)
return inside_flag;
}
-int OBJECTMAP_HitTest(R_POINT * imouse_pt, int *object_num)
-{
-
+int OBJECTMAP_HitTest(R_POINT * imouse_pt, int *object_num) {
R_POINT imouse;
R_OBJECTMAP_ENTRY *object_map;
R_CLICKAREA *clickarea;
@@ -513,50 +410,40 @@ int OBJECTMAP_HitTest(R_POINT * imouse_pt, int *object_num)
imouse.x = imouse_pt->x;
imouse.y = imouse_pt->y;
- /* Loop through all scene objects */
+ // Loop through all scene objects
for (i = 0; i < OMInfo.n_objects; i++) {
-
object_map = &OMInfo.object_maps[i];
- /* Hit-test all clickareas for this object */
+ // Hit-test all clickareas for this object
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) {
- /* 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;
+ // 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;
}
} else if (n_points > 2) {
- /* Hit-test a polygon */
+ // Hit-test a polygon
if (MATH_HitTestPoly(points, n_points, imouse)) {
-
*object_num = object_map->object_num;
-
return R_SUCCESS;
}
}
-
- } /* end for() clickareas */
- } /* end for() objects */
+ }
+ }
*object_num = 0;
return R_FAILURE;
}
-static void CF_object_info(int argc, char *argv[])
-{
+static void CF_object_info(int argc, char *argv[]) {
int i;
YS_IGNORE_PARAM(argc);
@@ -569,16 +456,12 @@ static void CF_object_info(int argc, char *argv[])
CON_Print("%d objects loaded.", OMInfo.n_objects);
for (i = 0; i < OMInfo.n_objects; i++) {
-
CON_Print("%s:", OMInfo.names[i]);
- 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);
-
+ 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);
}
return;
diff --git a/saga/objectmap.h b/saga/objectmap.h
index d95c563bb6..4981b0572b 100644
--- a/saga/objectmap.h
+++ b/saga/objectmap.h
@@ -20,14 +20,8 @@
* $Header$
*
*/
-/*
- Description:
-
- Object map / Object click-area module header file
-
- Notes:
-*/
+// Object map / Object click-area module header file
#ifndef SAGA_OBJECTMAP_H_
#define SAGA_OBJECTMAP_H_
@@ -35,14 +29,11 @@
namespace Saga {
struct R_CLICKAREA {
-
int n_points;
R_POINT *points;
-
};
struct R_OBJECTMAP_ENTRY {
-
int unknown0;
uint16 flags;
@@ -51,11 +42,9 @@ struct R_OBJECTMAP_ENTRY {
int n_clickareas;
R_CLICKAREA *clickareas;
-
};
struct R_OBJECTMAP_INFO {
-
int initialized;
int objects_loaded;
@@ -65,11 +54,10 @@ struct R_OBJECTMAP_INFO {
int names_loaded;
int n_names;
const char **names;
-
};
static void CF_object_info(int argc, char *argv[]);
} // End of namespace Saga
-#endif /* SAGA_OBJECTMAP_H_ */
+#endif
diff --git a/saga/objectmap_mod.h b/saga/objectmap_mod.h
index ac130ab761..cb0d99e87c 100644
--- a/saga/objectmap_mod.h
+++ b/saga/objectmap_mod.h
@@ -20,14 +20,8 @@
* $Header$
*
*/
-/*
- Description:
-
- Object map module public header file
-
- Notes:
-*/
+// Object map module public header file
#ifndef SAGA_OBJECTMAP_MOD_H__
#define SAGA_OBJECTMAP_MOD_H__
@@ -35,36 +29,22 @@
namespace Saga {
enum R_OBJECT_FLAGS {
-
R_OBJECT_NORMAL = 0x02
};
-int OBJECTMAP_Register(void);
-
-int OBJECTMAP_Init(void);
-
-int OBJECTMAP_Shutdown(void);
-
-int OBJECTMAP_Load(const byte * om_res, size_t om_res_len);
-
-int OBJECTMAP_Free(void);
-
-int OBJECTMAP_LoadNames(const byte * onl_res, size_t onl_res_len);
-
-int OBJECTMAP_FreeNames(void);
-
+int OBJECTMAP_Register();
+int OBJECTMAP_Init();
+int OBJECTMAP_Shutdown();
+int OBJECTMAP_Load(const byte *om_res, size_t om_res_len);
+int OBJECTMAP_Free();
+int OBJECTMAP_LoadNames(const byte *onl_res, size_t onl_res_len);
+int OBJECTMAP_FreeNames();
int OBJECTMAP_GetName(int object, const char **name);
-
-int OBJECTMAP_GetFlags(int object, uint16 * flags);
-
+int OBJECTMAP_GetFlags(int object, uint16 *flags);
int OBJECTMAP_GetEPNum(int object, int *ep_num);
-
-int
-OBJECTMAP_Draw(R_SURFACE * draw_surface,
- R_POINT * imouse_pt, int color, int color2);
-
-int OBJECTMAP_HitTest(R_POINT * imouse_pt, int *object_num);
+int OBJECTMAP_Draw(R_SURFACE *draw_surface, R_POINT *imouse_pt, int color, int color2);
+int OBJECTMAP_HitTest(R_POINT *imouse_pt, int *object_num);
} // End of namespace Saga
-#endif /* SAGA_OBJECTMAP_MOD_H__ */
+#endif