aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-04-25 14:42:14 +0000
committerMax Horn2004-04-25 14:42:14 +0000
commitd4f876b37df0fdc772936eedf9b112802987254b (patch)
treec7e782e5846dd153159c574ca9cb2ca250dfd34f
parentf9cd78cedd48371f8aa9d98cbcdeb879fe543fac (diff)
downloadscummvm-rg350-d4f876b37df0fdc772936eedf9b112802987254b.tar.gz
scummvm-rg350-d4f876b37df0fdc772936eedf9b112802987254b.tar.bz2
scummvm-rg350-d4f876b37df0fdc772936eedf9b112802987254b.zip
Fix many warnings; use C++ type system instead of C style typedefs; removed various unused stuff; const correctness; etc.
svn-id: r13622
-rw-r--r--saga/actionmap.h8
-rw-r--r--saga/actor.cpp16
-rw-r--r--saga/actor.h50
-rw-r--r--saga/actor_mod.h2
-rw-r--r--saga/actordata.h4
-rw-r--r--saga/animation.h16
-rw-r--r--saga/console.cpp15
-rw-r--r--saga/console.h20
-rw-r--r--saga/cvar.cpp4
-rw-r--r--saga/cvar.h20
-rw-r--r--saga/cvar_mod.h4
-rw-r--r--saga/events.cpp8
-rw-r--r--saga/events_mod.h8
-rw-r--r--saga/expr.cpp4
-rw-r--r--saga/font.cpp8
-rw-r--r--saga/font.h20
-rw-r--r--saga/game.cpp12
-rw-r--r--saga/game.h16
-rw-r--r--saga/game_mod.h20
-rw-r--r--saga/gfx.cpp16
-rw-r--r--saga/gfx_mod.h4
-rw-r--r--saga/ihnm_introproc.cpp24
-rw-r--r--saga/image.h4
-rw-r--r--saga/interface.h22
-rw-r--r--saga/isomap.h12
-rw-r--r--saga/ite_introproc.cpp28
-rw-r--r--saga/ite_introproc.h16
-rw-r--r--saga/module.mk1
-rw-r--r--saga/objectmap.cpp4
-rw-r--r--saga/objectmap.h14
-rw-r--r--saga/palanim.h8
-rw-r--r--saga/reinherit.h56
-rw-r--r--saga/render.cpp6
-rw-r--r--saga/render.h4
-rw-r--r--saga/render_mod.h4
-rw-r--r--saga/rscfile.h4
-rw-r--r--saga/saga.cpp4
-rw-r--r--saga/scene.cpp2
-rw-r--r--saga/scene.h50
-rw-r--r--saga/scene_mod.h12
-rw-r--r--saga/sceneproc.cpp2
-rw-r--r--saga/script.cpp6
-rw-r--r--saga/script.h36
-rw-r--r--saga/sdata.h4
-rw-r--r--saga/sfuncs.h4
-rw-r--r--saga/sndres.cpp4
-rw-r--r--saga/sndres.h16
-rw-r--r--saga/sprite.cpp4
-rw-r--r--saga/sprite.h12
-rw-r--r--saga/sthread.cpp24
-rw-r--r--saga/sysgfx.h4
-rw-r--r--saga/systimer.h4
-rw-r--r--saga/text_mod.h8
-rw-r--r--saga/x86_32.h41
-rw-r--r--saga/xmidi.cpp10
-rw-r--r--saga/xmidi.h24
-rw-r--r--saga/xmidi_mod.h12
-rw-r--r--saga/ys_binread.cpp24
-rw-r--r--saga/ys_file.cpp63
-rw-r--r--saga/yslib.h14
60 files changed, 377 insertions, 489 deletions
diff --git a/saga/actionmap.h b/saga/actionmap.h
index 5760bf2fb8..f41ec37479 100644
--- a/saga/actionmap.h
+++ b/saga/actionmap.h
@@ -34,7 +34,7 @@
namespace Saga {
-typedef struct R_ACTIONMAP_ENTRY_tag {
+struct R_ACTIONMAP_ENTRY {
int unknown00;
int unknown02;
@@ -44,9 +44,9 @@ typedef struct R_ACTIONMAP_ENTRY_tag {
int pt_count;
R_POINT *pt_tbl;
-} R_ACTIONMAP_ENTRY;
+};
-typedef struct R_ACTIONMAP_INFO_tag {
+struct R_ACTIONMAP_INFO {
int init;
@@ -57,7 +57,7 @@ typedef struct R_ACTIONMAP_INFO_tag {
const uchar *exmap_res;
size_t exmap_res_len;
-} R_ACTIONMAP_INFO;
+};
void CF_action_info(int argc, char *argv[]);
diff --git a/saga/actor.cpp b/saga/actor.cpp
index 1400dcd1a1..c699a63d4a 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -424,7 +424,7 @@ int ACTOR_SkipDialogue(void)
int ACTOR_Create(int actor_id, int x, int y)
{
- R_ACTOR actor = { 0 };
+ R_ACTOR actor;
if (actor_id == 1) {
actor_id = 0;
@@ -554,7 +554,7 @@ int ACTOR_ActorExists(uint actor_id)
return 1;
}
-int ACTOR_Speak(int index, char *d_string, uint d_voice_rn, R_SEMAPHORE * sem)
+int ACTOR_Speak(int index, const char *d_string, uint d_voice_rn, R_SEMAPHORE * sem)
{
YS_DL_NODE *node;
@@ -568,7 +568,7 @@ int ACTOR_Speak(int index, char *d_string, uint d_voice_rn, R_SEMAPHORE * sem)
int use_existing_ai = 0;
- R_ACTORDIALOGUE a_dialogue = { 0 };
+ R_ACTORDIALOGUE a_dialogue;
a_dialogue.d_string = d_string;
a_dialogue.d_voice_rn = d_voice_rn;
@@ -952,10 +952,10 @@ int ACTOR_WalkTo(int id, R_POINT * walk_pt, uint flags, R_SEMAPHORE * sem)
/*--------------------------------------------------------------------------*\
\*--------------------------------------------------------------------------*/
{
- R_ACTORINTENT actor_intent = { 0 };
+ R_ACTORINTENT actor_intent;
R_WALKINTENT *walk_intent;
- R_WALKINTENT zero_intent = { 0 };
+ R_WALKINTENT zero_intent;
YS_DL_NODE *node;
R_ACTOR *actor;
@@ -1302,8 +1302,8 @@ int ACTOR_MoveRelative(int index, R_POINT * move_pt)
int Z_Compare(const void *elem1, const void *elem2)
{
- R_ACTOR *actor1 = (R_ACTOR *) elem1;
- R_ACTOR *actor2 = (R_ACTOR *) elem2;
+ const R_ACTOR *actor1 = (const R_ACTOR *) elem1;
+ const R_ACTOR *actor2 = (const R_ACTOR *) elem2;
if (actor1->a_pt.y == actor2->a_pt.y) {
return 0;
@@ -1334,7 +1334,7 @@ int ACTOR_StoA(R_POINT * actor, const R_POINT * screen)
static void CF_actor_add(int argc, char *argv[])
{
- R_ACTOR actor = { 0 };
+ R_ACTOR actor;
if (argc < 3)
return;
diff --git a/saga/actor.h b/saga/actor.h
index 32942d4a44..1c4fb4b1ba 100644
--- a/saga/actor.h
+++ b/saga/actor.h
@@ -55,20 +55,20 @@ enum R_ACTOR_INTENTS {
INTENT_SPEAK = 2
};
-typedef struct R_ACTORACTIONITEM_tag {
+struct R_ACTORACTIONITEM {
int frame_index;
int frame_count;
-} R_ACTORACTIONITEM;
+};
-typedef struct R_ACTORACTION_tag {
+struct R_ACTORACTION {
R_ACTORACTIONITEM dir[4];
-} R_ACTORACTION;
+};
-typedef struct R_WALKINTENT_tag {
+struct R_WALKINTENT {
int wi_active;
uint wi_flags;
@@ -85,17 +85,19 @@ typedef struct R_WALKINTENT_tag {
int sem_held;
R_SEMAPHORE *sem;
+
+ R_WALKINTENT() { memset(this, 0, sizeof(*this)); }
-} R_WALKINTENT;
+};
-typedef struct R_WALKNODE_tag {
+struct R_WALKNODE {
int calc_flag;
R_POINT node_pt;
-} R_WALKNODE;
+};
-typedef struct R_SPEAKINTENT_tag {
+struct R_SPEAKINTENT {
int si_init;
uint si_flags;
@@ -103,19 +105,21 @@ typedef struct R_SPEAKINTENT_tag {
YS_DL_LIST *si_diaglist; /* Actor dialogue list */
-} R_SPEAKINTENT;
+};
-typedef struct R_ACTORINTENT_tag {
+struct R_ACTORINTENT {
int a_itype;
uint a_iflags;
int a_idone;
void *a_data;
+
+ R_ACTORINTENT() { memset(this, 0, sizeof(*this)); }
-} R_ACTORINTENT;
+};
-typedef struct R_ACTOR_tag {
+struct R_ACTOR {
int id; /* Actor id */
int name_i; /* Actor's index in actor name string list */
@@ -157,29 +161,33 @@ typedef struct R_ACTOR_tag {
int action_ct; /* Number of actions in the action LUT */
YS_DL_NODE *node; /* Actor's node in the actor list */
+
+ R_ACTOR() { memset(this, 0, sizeof(*this)); }
-} R_ACTOR;
+};
-typedef struct R_ACTORDIALOGUE_tag {
+struct R_ACTORDIALOGUE {
int d_playing;
- char *d_string;
+ const char *d_string;
uint d_voice_rn;
long d_time;
int d_sem_held;
R_SEMAPHORE *d_sem;
+
+ R_ACTORDIALOGUE() { memset(this, 0, sizeof(*this)); }
-} R_ACTORDIALOGUE;
+};
-typedef struct R_ACTIONTIMES_tag {
+struct R_ACTIONTIMES {
int action;
int time;
-} R_ACTIONTIMES;
+};
-typedef struct R_ACTOR_MODULE_tag {
+struct R_ACTOR_MODULE {
int init;
@@ -194,7 +202,7 @@ typedef struct R_ACTOR_MODULE_tag {
int err_n;
const char *err_str;
-} R_ACTOR_MODULE;
+};
R_ACTOR *LookupActor(int index);
diff --git a/saga/actor_mod.h b/saga/actor_mod.h
index ebd2881d70..c94cf7ae00 100644
--- a/saga/actor_mod.h
+++ b/saga/actor_mod.h
@@ -85,7 +85,7 @@ int ACTOR_WalkTo(int index, R_POINT * walk_pt, uint flags, R_SEMAPHORE * sem);
int ACTOR_GetActorIndex(uint actor_id);
-int ACTOR_Speak(int index, char *d_string, uint d_voice_rn, R_SEMAPHORE * sem);
+int ACTOR_Speak(int index, const char *d_string, uint d_voice_rn, R_SEMAPHORE * sem);
int ACTOR_SkipDialogue(void);
diff --git a/saga/actordata.h b/saga/actordata.h
index 9fc4c4db41..abf3fb9ced 100644
--- a/saga/actordata.h
+++ b/saga/actordata.h
@@ -33,7 +33,7 @@
namespace Saga {
-typedef struct R_ACTORTABLE_tag {
+struct R_ACTORTABLE {
int name_index;
int unknown1;
@@ -48,7 +48,7 @@ typedef struct R_ACTORTABLE_tag {
unsigned char unknown7;
unsigned char unknown8;
-} R_ACTORTABLE;
+};
#define R_ACTORCOUNT 181
diff --git a/saga/animation.h b/saga/animation.h
index b448f75b10..ca86509017 100644
--- a/saga/animation.h
+++ b/saga/animation.h
@@ -43,7 +43,7 @@ namespace Saga {
* at 0x00, followed by a RLE code stream
\*--------------------------------------------------------------------------*/
-typedef struct R_ANIMATION_HEADER_tag {
+struct R_ANIMATION_HEADER {
uint magic;
@@ -59,13 +59,13 @@ typedef struct R_ANIMATION_HEADER_tag {
uint unknown10;
uint unknown11;
-} R_ANIMATION_HEADER;
+};
/* A byte from the code stream of FRAME_HEADER_MAGIC signifies that a
* FRAME_HEADER structure follows
\*--------------------------------------------------------------------------*/
-typedef struct R_FRAME_HEADER_tag {
+struct R_FRAME_HEADER {
int x_start;
int y_start;
@@ -76,10 +76,10 @@ typedef struct R_FRAME_HEADER_tag {
int width;
int height;
-} R_FRAME_HEADER;
+};
/* Animation info array member */
-typedef struct R_ANIMATION_tag {
+struct R_ANIMATION {
const uchar *resdata;
size_t resdata_len;
@@ -102,9 +102,9 @@ typedef struct R_ANIMATION_tag {
uint flags;
-} R_ANIMATION;
+};
-typedef struct R_ANIMINFO_tag {
+struct R_ANIMINFO {
int initialized;
@@ -113,7 +113,7 @@ typedef struct R_ANIMINFO_tag {
R_ANIMATION *anim_tbl[R_MAX_ANIMATIONS];
-} R_ANIMINFO;
+};
int ANIM_GetNumFrames(const uchar * anim_resource, uint * n_frames);
diff --git a/saga/console.cpp b/saga/console.cpp
index 5310953f31..7bc0272d73 100644
--- a/saga/console.cpp
+++ b/saga/console.cpp
@@ -51,11 +51,16 @@ static R_CONSOLEINFO ConInfo = {
0,
R_CON_DEFAULTPOS,
R_CON_DEFAULTLINES,
- R_CON_DEFAULTCMDS
+ R_CON_DEFAULTCMDS,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ "",
+ 0
};
-static char InputBuf[R_CON_INPUTBUF_LEN];
-
static R_CON_SCROLLBACK ConScrollback;
static R_CON_SCROLLBACK ConHistory;
@@ -158,8 +163,8 @@ int CON_Type(int in_char)
char *rvalue = NULL;
R_CVAR_P con_cvar = NULL;
- char *expr_err;
- char *err_str;
+ const char *expr_err;
+ const char *err_str;
if (ConInfo.y_pos != ConInfo.y_max) {
/* Ignore keypress until console fully down */
diff --git a/saga/console.h b/saga/console.h
index 12a0b7ebf7..02560edb80 100644
--- a/saga/console.h
+++ b/saga/console.h
@@ -39,7 +39,7 @@ namespace Saga {
#define R_CONSOLE_TXTCOLOR 0x00FFFFFFUL
#define R_CONSOLE_TXTSHADOW 0x00202020UL
-typedef struct R_CONSOLEINFO_tag {
+struct R_CONSOLEINFO {
int active;
int y_max;
@@ -53,24 +53,24 @@ typedef struct R_CONSOLEINFO_tag {
char input_buf[R_CON_INPUTBUF_LEN + 1];
int input_pos;
-} R_CONSOLEINFO;
+};
-typedef struct R_CONSOLE_LINE_tag {
+struct R_CONSOLE_LINE {
- struct R_CONSOLE_LINE_tag *next;
- struct R_CONSOLE_LINE_tag *prev;
+ R_CONSOLE_LINE *next;
+ R_CONSOLE_LINE *prev;
char *str_p;
int str_len;
-} R_CONSOLE_LINE;
+};
-typedef struct R_CON_SCROLLBACK_tag {
+struct R_CON_SCROLLBACK {
- struct R_CONSOLE_LINE_tag *head;
- struct R_CONSOLE_LINE_tag *tail;
+ R_CONSOLE_LINE *head;
+ R_CONSOLE_LINE *tail;
int lines;
-} R_CON_SCROLLBACK;
+};
static int
CON_AddLine(R_CON_SCROLLBACK * scroll, int line_max, const char *constr_p);
diff --git a/saga/cvar.cpp b/saga/cvar.cpp
index 5f69faf3a9..41d52f6867 100644
--- a/saga/cvar.cpp
+++ b/saga/cvar.cpp
@@ -48,7 +48,7 @@ namespace Saga {
R_CVAR *CVHashTbl[R_CVAR_HASHLEN];
-char *CVAR_ErrMsg[] = {
+static const char *CVAR_ErrMsg[] = {
"No Error",
"Not implememented.",
@@ -82,7 +82,7 @@ enum CVAR_Errors {
static enum CVAR_Errors CVAR_ErrorState;
-int CVAR_GetError(char **err_str)
+int CVAR_GetError(const char **err_str)
/****************************************************************************\
Returns the appropriate cvar error string
\****************************************************************************/
diff --git a/saga/cvar.h b/saga/cvar.h
index b1009bb21f..4600150c82 100644
--- a/saga/cvar.h
+++ b/saga/cvar.h
@@ -35,45 +35,45 @@ namespace Saga {
#define R_CVAR_HASHLEN 32
-typedef struct R_SUBCVAR_INT_tag {
+struct R_SUBCVAR_INT {
cv_int_t *var_p;
cv_int_t ubound;
cv_int_t lbound;
-} R_SUBCVAR_INT;
+};
-typedef struct R_SUBCVAR_UINT_tag {
+struct R_SUBCVAR_UINT {
cv_uint_t *var_p;
cv_uint_t ubound;
cv_uint_t lbound;
-} R_SUBCVAR_UINT;
+};
-typedef struct R_SUBCVAR_FLOAT_tag {
+struct R_SUBCVAR_FLOAT {
cv_float_t *var_p;
cv_float_t ubound;
cv_float_t lbound;
-} R_SUBCVAR_FLOAT;
+};
-typedef struct R_SUBCVAR_STRING_tag {
+struct R_SUBCVAR_STRING {
cv_char_t *var_str;
int ubound;
-} R_SUBCVAR_STRING;
+};
-typedef struct R_SUBCVAR_FUNC_tag {
+struct R_SUBCVAR_FUNC {
cv_func_t func_p;
const char *func_argstr;
int min_args;
int max_args;
-} R_SUBCVAR_FUNC;
+};
typedef struct R_CVAR_tag {
diff --git a/saga/cvar_mod.h b/saga/cvar_mod.h
index a341ff494e..d410fe68a7 100644
--- a/saga/cvar_mod.h
+++ b/saga/cvar_mod.h
@@ -73,7 +73,7 @@ int CVAR_Shutdown(void);
R_CVAR_P CVAR_Find(const char *var_str);
int CVAR_SetValue(R_CVAR_P cvar, char *r_value);
int CVAR_Print(R_CVAR_P con_cvar);
-int CVAR_GetError(char **err_str);
+int CVAR_GetError(const char **err_str);
int CVAR_IsFunc(R_CVAR_P cvar_func);
int CVAR_Exec(R_CVAR_P cvar_func, char *r_value);
@@ -102,7 +102,7 @@ int EXPR_Parse(const char **exp_pp, int *len, R_CVAR_P * expr_cvar,
char *EXPR_ReadString(const char **string_p, int *len, int term_char);
-int EXPR_GetError(char **err_str);
+int EXPR_GetError(const char **err_str);
int EXPR_GetArgs(char *cmd_str, char ***expr_argv);
diff --git a/saga/events.cpp b/saga/events.cpp
index f822d23b3e..700c9d90f6 100644
--- a/saga/events.cpp
+++ b/saga/events.cpp
@@ -518,8 +518,8 @@ int EVENT_ClearList(void)
YS_DL_NODE *walk_node;
YS_DL_NODE *next_node;
- struct R_EVENT_tag *chain_walk;
- struct R_EVENT_tag *next_chain;
+ R_EVENT *chain_walk;
+ R_EVENT *next_chain;
R_EVENT *event_p;
@@ -556,8 +556,8 @@ int EVENT_FreeList(void)
YS_DL_NODE *walk_node;
YS_DL_NODE *next_node;
- struct R_EVENT_tag *chain_walk;
- struct R_EVENT_tag *next_chain;
+ R_EVENT *chain_walk;
+ R_EVENT *next_chain;
R_EVENT *event_p;
diff --git a/saga/events_mod.h b/saga/events_mod.h
index e086d37c2d..2c7fb134a2 100644
--- a/saga/events_mod.h
+++ b/saga/events_mod.h
@@ -104,7 +104,7 @@ enum R_EVENT_PARAMS {
SET_PALETTE
};
-typedef struct R_EVENT_tag {
+struct R_EVENT {
unsigned int type;
unsigned int code; /* Event operation category & flags */
@@ -119,10 +119,12 @@ typedef struct R_EVENT_tag {
long duration; /* Duration of event */
long d_reserved;
- struct R_EVENT_tag *chain; /* Event chain
+ R_EVENT *chain; /* Event chain
* (For consecutive events) */
-} R_EVENT;
+ R_EVENT() { memset(this, 0, sizeof(*this)); }
+
+};
int EVENT_Init(void);
diff --git a/saga/expr.cpp b/saga/expr.cpp
index 32aca92b7f..386be3d7c0 100644
--- a/saga/expr.cpp
+++ b/saga/expr.cpp
@@ -45,7 +45,7 @@
namespace Saga {
-char *EXPR_ErrMsg[] = {
+static const char *EXPR_ErrMsg[] = {
"Invalid error state.",
"No Error",
@@ -81,7 +81,7 @@ enum EXPR_Errors {
static enum EXPR_Errors EXPR_ErrorState;
-int EXPR_GetError(char **err_str)
+int EXPR_GetError(const char **err_str)
/*--------------------------------------------------------------------------*\
Returns the appropriate expression parser error string given an error code.
\*--------------------------------------------------------------------------*/
diff --git a/saga/font.cpp b/saga/font.cpp
index 18f2aaf276..31394f8b20 100644
--- a/saga/font.cpp
+++ b/saga/font.cpp
@@ -100,7 +100,7 @@ int FONT_Init(void)
int FONT_Shutdown(void)
{
- int i;
+// int i;
R_printf(R_STDOUT, "FONT_Shutdown(): Freeing fonts.\n");
/*
@@ -498,7 +498,7 @@ FONT_GetStringWidth(int font_id,
size_t ct;
int width = 0;
int ch;
- uchar *txt_p;
+ const uchar *txt_p;
if (!FontModule.init) {
return R_FAILURE;
@@ -516,7 +516,7 @@ FONT_GetStringWidth(int font_id,
font = FontModule.fonts[font_id];
assert(font != NULL);
- txt_p = (uchar *) test_str;
+ txt_p = (const uchar *) test_str;
for (ct = test_str_ct;
*txt_p && (!test_str_ct || ct > 0); txt_p++, ct--) {
@@ -623,7 +623,7 @@ FONT_Out(R_FONT_STYLE * draw_font,
return R_SUCCESS;
}
- draw_str_p = (uchar *) draw_str;
+ draw_str_p = (const uchar *) draw_str;
ct = draw_str_ct;
/* Draw string one character at a time, maximum of 'draw_str'_ct
diff --git a/saga/font.h b/saga/font.h
index a72322c804..1fda4f6248 100644
--- a/saga/font.h
+++ b/saga/font.h
@@ -55,15 +55,15 @@ namespace Saga {
#define SAGA_FONT_HEADER_LEN 6
-typedef struct R_FONT_HEADER_tag {
+struct R_FONT_HEADER {
int c_height;
int c_width;
int row_length;
-} R_FONT_HEADER;
+};
-typedef struct FONT_CHAR_ENTRY_TAG {
+struct FONT_CHAR_ENTRY {
int index;
int byte_width;
@@ -71,9 +71,9 @@ typedef struct FONT_CHAR_ENTRY_TAG {
int flag;
int tracking;
-} FONT_CHAR_ENTRY;
+};
-typedef struct R_FONT_STYLE_tag {
+struct R_FONT_STYLE {
R_FONT_HEADER hdr;
FONT_CHAR_ENTRY fce[256];
@@ -81,9 +81,9 @@ typedef struct R_FONT_STYLE_tag {
uchar *font_free_p;
uchar *font_p;
-} R_FONT_STYLE;
+};
-typedef struct R_FONT_tag {
+struct R_FONT {
ulong font_rn;
int font_id;
@@ -96,9 +96,9 @@ typedef struct R_FONT_tag {
uchar *res_data;
size_t res_len;
-} R_FONT;
+};
-typedef struct R_FONT_MODULE_tag {
+struct R_FONT_MODULE {
int init;
@@ -110,7 +110,7 @@ typedef struct R_FONT_MODULE_tag {
int err_n;
const char *err_str;
-} R_FONT_MODULE;
+};
int FONT_Load(ulong font_rn, int font_id);
diff --git a/saga/game.cpp b/saga/game.cpp
index bac6da92bc..ae1113c34e 100644
--- a/saga/game.cpp
+++ b/saga/game.cpp
@@ -73,7 +73,7 @@ R_GAME_FONTDESC ITEDEMO_GameFonts[] = {
R_GAME_SOUNDINFO ITEDEMO_GameSound = {
- R_GAME_SOUND_VOC
+ R_GAME_SOUND_VOC, 0, 0, 0
};
/*--------------------------------------------------------------------------*\
@@ -108,7 +108,7 @@ R_GAME_RESOURCEDESC ITE_Resources = {
R_GAME_SOUNDINFO ITE_GameSound = {
- R_GAME_SOUND_VOC
+ R_GAME_SOUND_VOC, 0, 0, 0
};
/*--------------------------------------------------------------------------*\
@@ -216,7 +216,7 @@ R_GAME_RESOURCEDESC IHNM_Resources[] = {
R_GAME_SOUNDINFO IHNM_GameSound = {
- R_GAME_SOUND_WAV
+ R_GAME_SOUND_WAV, 0, 0, 0
};
R_GAMEDESC GameDescs[] = {
@@ -542,8 +542,6 @@ int GAME_GetFileContext(R_RSCFILE_CONTEXT ** ctxt_p, uint r_type, int param)
int DetectGame(const char *game_dir, uint * game_n_p)
{
- char game_fpath[R_GAME_PATH_LIMIT] = { 0 };
-
uint game_count = YS_NELEMS(GameDescs);
uint game_n;
@@ -554,7 +552,6 @@ int DetectGame(const char *game_dir, uint * game_n_p)
int file_missing = 0;
int found_game = 0;
- int error;
if ((game_dir == NULL) || (game_n_p == NULL)) {
@@ -614,7 +611,6 @@ int LoadGame(const char *game_dir, uint game_n)
uint game_count = YS_NELEMS(GameDescs);
- char game_fpath[R_GAME_PATH_LIMIT] = { 0 };
const char *game_fname;
uint game_filect;
@@ -759,8 +755,6 @@ int Verify_ITEDISK(const char *game_dir)
R_RSCFILE_CONTEXT *test_ctx;
- char fpath[R_GAME_PATH_LIMIT] = { 0 };
-
ulong script_lut_len;
ulong script_lut_rn;
diff --git a/saga/game.h b/saga/game.h
index 1c16b9b5fa..dc6bb47ee1 100644
--- a/saga/game.h
+++ b/saga/game.h
@@ -45,14 +45,14 @@ namespace Saga {
typedef int (*R_GAME_VERIFYFUNC) (const char *);
-typedef struct R_GAME_FILEDESC_tag {
+struct R_GAME_FILEDESC {
const char *gf_fname;
uint gf_type;
-} R_GAME_FILEDESC;
+};
-typedef struct R_GAMEDESC_tag {
+struct R_GAMEDESC {
int gd_game_type;
int gd_game_id;
@@ -79,18 +79,18 @@ typedef struct R_GAMEDESC_tag {
int gd_supported;
-} R_GAMEDESC;
+};
-typedef struct R_GAME_FILEDATA_tag {
+struct R_GAME_FILEDATA {
R_RSCFILE_CONTEXT *file_ctxt;
uint file_types;
uint file_flags;
-} R_GAME_FILEDATA;
+};
-typedef struct R_GAMEMODULE_tag {
+struct R_GAMEMODULE {
int game_init;
int game_number;
@@ -113,7 +113,7 @@ typedef struct R_GAMEMODULE_tag {
int err_n;
const char *err_str;
-} R_GAMEMODULE;
+};
int LoadLanguage(void);
diff --git a/saga/game_mod.h b/saga/game_mod.h
index 1292688b91..880eec1577 100644
--- a/saga/game_mod.h
+++ b/saga/game_mod.h
@@ -76,45 +76,45 @@ enum R_GAME_FONT_IDS {
R_GAME_FONT_LARGE3
};
-typedef struct R_GAME_DISPLAYINFO_tag {
+struct R_GAME_DISPLAYINFO {
int logical_w;
int logical_h;
int scene_h;
-} R_GAME_DISPLAYINFO;
+};
-typedef struct R_GAMESOUND_INFO_tag {
+struct R_GAME_SOUNDINFO {
int res_type;
long freq;
int sample_size;
int stereo;
-} R_GAME_SOUNDINFO;
+};
-typedef struct R_GAMEFONT_DESC_tag {
+struct R_GAME_FONTDESC {
uint font_id;
ulong font_rn;
-} R_GAME_FONTDESC;
+};
-typedef struct R_GAMESCENE_DESC_tag {
+struct R_GAME_SCENEDESC {
ulong scene_lut_rn;
ulong first_scene;
-} R_GAME_SCENEDESC;
+};
-typedef struct R_GAMERESOURCE_DESC_tag {
+struct R_GAME_RESOURCEDESC {
ulong scene_lut_rn;
ulong script_lut_rn;
ulong command_panel_rn;
ulong dialogue_panel_rn;
-} R_GAME_RESOURCEDESC;
+};
int GAME_Register(void);
diff --git a/saga/gfx.cpp b/saga/gfx.cpp
index 7ea6a5f342..5f03cc6341 100644
--- a/saga/gfx.cpp
+++ b/saga/gfx.cpp
@@ -546,11 +546,11 @@ int GFX_DrawCursor(R_SURFACE * ds, R_POINT * p1)
R_RECT cur_rect;
/* Clamp point to surface */
- cur_pt.x = YS_MAX(p1->x, 0);
- cur_pt.y = YS_MAX(p1->y, 0);
+ cur_pt.x = MAX(p1->x, 0);
+ cur_pt.y = MAX(p1->y, 0);
- cur_pt.x = YS_MIN(p1->x, ds->buf_w - 1);
- cur_pt.y = YS_MIN(p1->y, ds->buf_h - 1);
+ cur_pt.x = MIN(p1->x, ds->buf_w - 1);
+ cur_pt.y = MIN(p1->y, ds->buf_h - 1);
cur_pt.x -= R_CURSOR_ORIGIN_X;
cur_pt.y -= R_CURSOR_ORIGIN_Y;
@@ -662,10 +662,10 @@ int GFX_DrawFrame(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color)
x2 = p2->x;
y2 = p2->y;
- min_x = YS_MIN(x1, x2);
- min_y = YS_MIN(y1, y2);
- max_x = YS_MAX(x1, x2);
- max_y = YS_MAX(y1, y2);
+ min_x = MIN(x1, x2);
+ min_y = MIN(y1, y2);
+ max_x = MAX(x1, x2);
+ max_y = MAX(y1, y2);
n_p1.x = min_x;
n_p1.y = min_y;
diff --git a/saga/gfx_mod.h b/saga/gfx_mod.h
index bfb0fc76a5..3804e00368 100644
--- a/saga/gfx_mod.h
+++ b/saga/gfx_mod.h
@@ -33,7 +33,7 @@
namespace Saga {
-typedef struct R_CLIPINFO_tag {
+struct R_CLIPINFO {
/* input members */
const R_RECT *src_rect;
@@ -49,7 +49,7 @@ typedef struct R_CLIPINFO_tag {
int draw_w;
int draw_h;
-} R_CLIPINFO;
+};
int GFX_SimpleBlit(R_SURFACE * dst_s, R_SURFACE * src_s);
diff --git a/saga/ihnm_introproc.cpp b/saga/ihnm_introproc.cpp
index 8656881f14..a87d74ae05 100644
--- a/saga/ihnm_introproc.cpp
+++ b/saga/ihnm_introproc.cpp
@@ -58,9 +58,9 @@ namespace Saga {
R_SCENE_RESLIST IHNM_IntroMovie1RL[] = {
- {30, SAGA_BG_IMAGE}
+ {30, SAGA_BG_IMAGE, 0, 0}
,
- {31, SAGA_ANIM_1}
+ {31, SAGA_ANIM_1, 0, 0}
};
R_SCENE_DESC IHNM_IntroMovie1Desc = {
@@ -73,9 +73,9 @@ R_SCENE_DESC IHNM_IntroMovie1Desc = {
R_SCENE_RESLIST IHNM_IntroMovie2RL[] = {
- {32, SAGA_BG_IMAGE}
+ {32, SAGA_BG_IMAGE, 0, 0}
,
- {33, SAGA_ANIM_1}
+ {33, SAGA_ANIM_1, 0, 0}
};
R_SCENE_DESC IHNM_IntroMovie2Desc = {
@@ -88,9 +88,9 @@ R_SCENE_DESC IHNM_IntroMovie2Desc = {
R_SCENE_RESLIST IHNM_IntroMovie3RL[] = {
- {34, SAGA_BG_IMAGE}
+ {34, SAGA_BG_IMAGE, 0, 0}
,
- {35, SAGA_ANIM_1}
+ {35, SAGA_ANIM_1, 0, 0}
};
R_SCENE_DESC IHNM_IntroMovie3Desc = {
@@ -103,9 +103,9 @@ R_SCENE_DESC IHNM_IntroMovie3Desc = {
R_SCENE_RESLIST IHNM_IntroMovie4RL[] = {
- {1227, SAGA_BG_IMAGE}
+ {1227, SAGA_BG_IMAGE, 0, 0}
,
- {1226, SAGA_ANIM_1}
+ {1226, SAGA_ANIM_1, 0, 0}
};
R_SCENE_DESC IHNM_IntroMovie4Desc = {
@@ -144,7 +144,7 @@ int IHNM_StartProc(void)
int IHNM_IntroMovieProc1(int param, R_SCENE_INFO * scene_info)
{
- R_EVENT event = { 0 };
+ R_EVENT event;
YS_IGNORE_PARAM(scene_info);
@@ -178,7 +178,7 @@ int IHNM_IntroMovieProc1(int param, R_SCENE_INFO * scene_info)
int IHNM_IntroMovieProc2(int param, R_SCENE_INFO * scene_info)
{
- R_EVENT event = { 0 };
+ R_EVENT event;
R_EVENT *q_event;
PALENTRY *pal;
@@ -252,7 +252,7 @@ int IHNM_IntroMovieProc2(int param, R_SCENE_INFO * scene_info)
int IHNM_IntroMovieProc3(int param, R_SCENE_INFO * scene_info)
{
- R_EVENT event = { 0 };
+ R_EVENT event;
R_EVENT *q_event;
PALENTRY *pal;
@@ -325,7 +325,7 @@ int IHNM_IntroMovieProc3(int param, R_SCENE_INFO * scene_info)
int IHNM_HateProc(int param, R_SCENE_INFO * scene_info)
{
- R_EVENT event = { 0 };
+ R_EVENT event;
R_EVENT *q_event;
YS_IGNORE_PARAM(scene_info);
diff --git a/saga/image.h b/saga/image.h
index 95ade8877c..f1ecc7c471 100644
--- a/saga/image.h
+++ b/saga/image.h
@@ -39,14 +39,14 @@ namespace Saga {
#define SAGA_IMAGE_DATA_OFFSET 776
#define SAGA_IMAGE_HEADER_LEN 8
-typedef struct R_IMAGE_HEADER_tag {
+struct R_IMAGE_HEADER {
int width;
int height;
int unknown4;
int unknown6;
-} R_IMAGE_HEADER;
+};
int
DecodeBGImageRLE(const uchar * inbuf,
diff --git a/saga/interface.h b/saga/interface.h
index d8e8e24dbb..6c3ded1a56 100644
--- a/saga/interface.h
+++ b/saga/interface.h
@@ -90,21 +90,21 @@ typedef enum R_BUTTON_FLAGS_tag {
#define BUTTON_VERB ( BUTTON_LABEL | BUTTON_BITMAP | BUTTON_SET )
-typedef struct R_INTERFACE_BUTTON_tag {
+struct R_INTERFACE_BUTTON {
int x1;
int y1;
int x2;
int y2;
- char *label;
+ const char *label;
int inactive_sprite;
int active_sprite;
int flags;
int data;
-} R_INTERFACE_BUTTON;
+};
-typedef struct R_INTERFACE_PANEL_tag {
+struct R_INTERFACE_PANEL {
uchar *res;
size_t res_len;
@@ -119,9 +119,9 @@ typedef struct R_INTERFACE_PANEL_tag {
R_INTERFACE_BUTTON *buttons;
R_SPRITELIST *sprites;
-} R_INTERFACE_PANEL;
+};
-typedef struct R_INTERFACE_DESC_tag {
+struct R_INTERFACE_DESC {
int status_y;
int status_w;
@@ -138,9 +138,9 @@ typedef struct R_INTERFACE_DESC_tag {
int lportrait_x;
int lportrait_y;
-} R_INTERFACE_DESC;
+};
-typedef struct R_INTERFACE_MODULE_tag {
+struct R_INTERFACE_MODULE {
int init;
int active;
@@ -161,7 +161,7 @@ typedef struct R_INTERFACE_MODULE_tag {
R_SCRIPT_THREAD *i_thread;
-} R_INTERFACE_MODULE;
+};
enum INTERFACE_VERBS {
@@ -175,14 +175,14 @@ enum INTERFACE_VERBS {
I_VERB_GIVE
};
-typedef struct R_VERB_DATA_tag {
+struct R_VERB_DATA {
int i_verb;
const char *verb_cvar;
char verb_str[R_VERB_STRLIMIT];
int s_verb;
-} R_VERB_DATA;
+};
int INTERFACE_HitTest(R_POINT * imouse_pt, int *ibutton);
diff --git a/saga/isomap.h b/saga/isomap.h
index dfd9daa33f..f3a3ca7993 100644
--- a/saga/isomap.h
+++ b/saga/isomap.h
@@ -33,7 +33,7 @@
namespace Saga {
-typedef struct R_ISOTILE_ENTRY_tag {
+struct R_ISOTILE_ENTRY {
int tile_h;
int unknown01;
@@ -41,7 +41,7 @@ typedef struct R_ISOTILE_ENTRY_tag {
int unknown04;
int unknown06;
-} R_ISOTILE_ENTRY;
+};
#define SAGA_ISOTILE_ENTRY_LEN 8
#define SAGA_ISOTILE_WIDTH 32
@@ -55,7 +55,7 @@ typedef struct R_ISOTILE_ENTRY_tag {
#define SAGA_METAMAP_H 16
#define SAGA_METAMAP_SIZE 256
-typedef struct R_ISO_METATILE_ENTRY_tag {
+struct R_ISO_METATILE_ENTRY {
int mtile_n;
int unknown02;
@@ -64,11 +64,11 @@ typedef struct R_ISO_METATILE_ENTRY_tag {
int tile_tbl[SAGA_METATILE_SIZE];
-} R_ISO_METATILE_ENTRY;
+};
#define SAGA_METATILE_ENTRY_LEN 136
-typedef struct R_ISOMAP_MODULE_tag {
+struct R_ISOMAP_MODULE {
int init;
@@ -90,7 +90,7 @@ typedef struct R_ISOMAP_MODULE_tag {
const uchar *mm_res_p;
size_t mm_res_len;
-} R_ISOMAP_MODULE;
+};
int ISOMAP_DrawTile(R_SURFACE * dst_s, uint tile_i, int tile_x, int tile_y);
diff --git a/saga/ite_introproc.cpp b/saga/ite_introproc.cpp
index 8190472af9..e1c5bd0b1b 100644
--- a/saga/ite_introproc.cpp
+++ b/saga/ite_introproc.cpp
@@ -252,14 +252,14 @@ int ITE_IntroCave1Proc(int param, R_SCENE_INFO * scene_info)
* Handles first introductory cave painting scene
\*--------------------------------------------------------------------------*/
{
- R_EVENT event = { 0 };
+ R_EVENT event;
R_EVENT *q_event;
int event_time = 0;
int voice_len;
int voice_pad = 50;
- R_TEXTLIST_ENTRY text_entry = { 0 };
+ R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
PALENTRY *pal;
@@ -402,14 +402,14 @@ int ITE_IntroCave2Proc(int param, R_SCENE_INFO * scene_info)
\*--------------------------------------------------------------------------*/
{
- R_EVENT event = { 0 };
+ R_EVENT event;
R_EVENT *q_event;
int event_time = 0;
int voice_len;
int voice_pad = 50;
- R_TEXTLIST_ENTRY text_entry = { 0 };
+ R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
int i;
@@ -520,14 +520,14 @@ int ITE_IntroCave3Proc(int param, R_SCENE_INFO * scene_info)
* Handles third introductory cave painting scene
\*--------------------------------------------------------------------------*/
{
- R_EVENT event = { 0 };
+ R_EVENT event;
R_EVENT *q_event;
int event_time = 0;
int voice_len;
int voice_pad = 50;
- R_TEXTLIST_ENTRY text_entry = { 0 };
+ R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
int i;
@@ -638,14 +638,14 @@ int ITE_IntroCave4Proc(int param, R_SCENE_INFO * scene_info)
* Handles fourth introductory cave painting scene
\*--------------------------------------------------------------------------*/
{
- R_EVENT event = { 0 };
+ R_EVENT event;
R_EVENT *q_event;
int event_time = 0;
int voice_len;
int voice_pad = 50;
- R_TEXTLIST_ENTRY text_entry = { 0 };
+ R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
int i;
@@ -757,7 +757,7 @@ int ITE_IntroValleyProc(int param, R_SCENE_INFO * scene_info)
* Handles intro title scene (valley overlook)
\*--------------------------------------------------------------------------*/
{
- R_TEXTLIST_ENTRY text_entry = { 0 };
+ R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
R_EVENT event;
@@ -879,10 +879,10 @@ int ITE_IntroTreeHouseProc(int param, R_SCENE_INFO * scene_info)
* Handles second intro credit screen (treehouse view)
\*--------------------------------------------------------------------------*/
{
- R_TEXTLIST_ENTRY text_entry = { 0 };
+ R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
- R_EVENT event = { 0 };
+ R_EVENT event;
R_EVENT *q_event;
int i;
@@ -1004,10 +1004,10 @@ int ITE_IntroFairePathProc(int param, R_SCENE_INFO * scene_info)
* Handles third intro credit screen (path to puzzle tent)
\*--------------------------------------------------------------------------*/
{
- R_TEXTLIST_ENTRY text_entry = { 0 };
+ R_TEXTLIST_ENTRY text_entry;
R_TEXTLIST_ENTRY *entry_p;
- R_EVENT event = { 0 };
+ R_EVENT event;
R_EVENT *q_event;
long event_delay = 0;
@@ -1130,7 +1130,7 @@ int ITE_IntroFaireTentProc(int param, R_SCENE_INFO * scene_info)
* Handles fourth intro credit screen (treehouse view)
\*--------------------------------------------------------------------------*/
{
- R_EVENT event = { 0 };
+ R_EVENT event;
R_EVENT *q_event;
R_EVENT *q_event_start;
diff --git a/saga/ite_introproc.h b/saga/ite_introproc.h
index 77c2035280..95c94ef8b1 100644
--- a/saga/ite_introproc.h
+++ b/saga/ite_introproc.h
@@ -61,31 +61,31 @@ enum R_INTRO_SCENE_DIALOGUE_INFO {
INTRO_CAVE4_END = 14
};
-typedef struct R_INTRO_DIALOGUE_tag {
+struct R_INTRO_DIALOGUE {
ulong i_voice_rn;
- char *i_cvar_name;
+ const char *i_cvar_name;
char i_str[R_INTRO_STRMAX];
-} R_INTRO_DIALOGUE;
+};
-typedef struct INTRO_CAPTION_tag {
+struct INTRO_CAPTION {
int res_n;
char *caption;
-} INTRO_CAPTION;
+};
-typedef struct INTRO_CREDIT_tag {
+struct INTRO_CREDIT {
int text_x;
int text_y;
int delta_time;
int duration;
- char *string;
+ const char *string;
int font_id;
-} INTRO_CREDIT;
+};
} // End of namespace Saga
diff --git a/saga/module.mk b/saga/module.mk
index f26b86bbb5..fc6f7d3dbf 100644
--- a/saga/module.mk
+++ b/saga/module.mk
@@ -42,7 +42,6 @@ MODULE_OBJS = \
saga/ys_binread.o \
saga/ys_binwrite.o \
saga/ys_dl_list.o \
- saga/ys_file.o \
saga/sysgfx.o \
saga/sysinput.o \
saga/systimer.o \
diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp
index bd3ec1df8b..a458fa346d 100644
--- a/saga/objectmap.cpp
+++ b/saga/objectmap.cpp
@@ -262,7 +262,7 @@ int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len)
R_printf(R_STDOUT, "%s: Loading %d object names.\n", YS_FUNC, n_names);
# endif
#endif
- OMInfo.names = (char **)malloc(n_names * sizeof *OMInfo.names);
+ OMInfo.names = (const char **)malloc(n_names * sizeof *OMInfo.names);
if (OMInfo.names == NULL) {
R_printf(R_STDERR, "Error: Memory allocation failed.\n");
@@ -271,7 +271,7 @@ int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len)
for (i = 0; i < n_names; i++) {
name_offset = ys_read_u16_le(read_p, &read_p);
- OMInfo.names[i] = (char *)(onl_res + name_offset);
+ OMInfo.names[i] = (const char *)(onl_res + name_offset);
# if R_OBJECTMAP_DEBUG >= R_DEBUG_VERBOSE
R_printf(R_STDOUT,
diff --git a/saga/objectmap.h b/saga/objectmap.h
index f5f1f92b25..12ffd76d28 100644
--- a/saga/objectmap.h
+++ b/saga/objectmap.h
@@ -34,14 +34,14 @@
namespace Saga {
-typedef struct R_CLICKAREA_tag {
+struct R_CLICKAREA {
int n_points;
R_POINT *points;
-} R_CLICKAREA;
+};
-typedef struct R_OBJECTMAP_ENTRY_tag {
+struct R_OBJECTMAP_ENTRY {
int unknown0;
uint flags;
@@ -52,9 +52,9 @@ typedef struct R_OBJECTMAP_ENTRY_tag {
int n_clickareas;
R_CLICKAREA *clickareas;
-} R_OBJECTMAP_ENTRY;
+};
-typedef struct R_OBJECTMAP_INFO_tag {
+struct R_OBJECTMAP_INFO {
int initialized;
@@ -64,9 +64,9 @@ typedef struct R_OBJECTMAP_INFO_tag {
int names_loaded;
int n_names;
- char **names;
+ const char **names;
-} R_OBJECTMAP_INFO;
+};
static void CF_object_info(int argc, char *argv[]);
diff --git a/saga/palanim.h b/saga/palanim.h
index ededaf2449..8fb4a87372 100644
--- a/saga/palanim.h
+++ b/saga/palanim.h
@@ -37,7 +37,7 @@ namespace Saga {
#define PALANIM_CYCLETIME 100
-typedef struct PALANIM_ENTRY_tag {
+struct PALANIM_ENTRY {
uint pal_count;
uint color_count;
@@ -46,16 +46,16 @@ typedef struct PALANIM_ENTRY_tag {
uchar *pal_index;
R_COLOR *colors;
-} PALANIM_ENTRY;
+};
-typedef struct PALANIM_DATA_tag {
+struct PALANIM_DATA {
int loaded;
uint entry_count;
PALANIM_ENTRY *entries;
-} PALANIM_DATA;
+};
} // End of namespace Saga
diff --git a/saga/reinherit.h b/saga/reinherit.h
index b4ae7e8c36..fe049726d8 100644
--- a/saga/reinherit.h
+++ b/saga/reinherit.h
@@ -31,16 +31,12 @@
#ifndef SAGA_REINHERIT_H_
#define SAGA_REINHERIT_H_
-#include "stdafx.h"
+#include "common/stdafx.h"
+#include "common/scummsys.h"
#include "base/engine.h"
/*
- * Architecture conditionals
-\*--------------------------------------------------------------------------*/
-#include "x86_32.h"
-
-/*
* Implementation conditionals
\*--------------------------------------------------------------------------*/
#define R_ENV_LINUX
@@ -82,35 +78,35 @@ typedef unsigned long ulong;
typedef unsigned int uint;
#endif
-typedef struct R_POINT_tag {
+struct R_POINT {
int x;
int y;
-} R_POINT;
+};
-typedef struct R_RECT_tag {
+struct R_RECT {
int x1;
int y1;
int x2;
int y2;
-} R_RECT;
+};
#define R_MAKERECT( rect, x1, y1, x2, y2 ) \
( rect.x1 = x1, rect.y1 = y1, rect.x2 = x2, rect.y2 = y2, &rect )
-typedef struct R_COLOR_tag {
+struct R_COLOR {
int red;
int green;
int blue;
int alpha;
-} R_COLOR;
+};
-typedef struct R_SURFACE_tag {
+struct R_SURFACE {
uchar *buf;
int buf_w;
@@ -123,11 +119,11 @@ typedef struct R_SURFACE_tag {
void *impl_src;
-} R_SURFACE;
+};
-typedef struct R_SOUNDBUFFER_tag {
+struct R_SOUNDBUFFER {
- uchar *res_data;
+ const uchar *res_data;
size_t res_len;
long s_freq;
@@ -135,32 +131,32 @@ typedef struct R_SOUNDBUFFER_tag {
int s_stereo;
int s_signed;
- uchar *s_buf;
+ const uchar *s_buf;
size_t s_buf_len;
-} R_SOUNDBUFFER;
+};
#define R_RGB_RED 0x00FF0000UL
#define R_RGB_GREEN 0x0000FF00UL
#define R_RGB_BLUE 0x000000FFUL
-typedef struct SAGA_COLOR_tag {
+struct SAGA_COLOR {
- R_UINT8 r;
- R_UINT8 g;
- R_UINT8 b;
+ byte r;
+ byte g;
+ byte b;
-} SAGA_COLOR;
+};
#define SAGA_COLOR_LEN 3
-typedef struct PALENTRY_TAG {
+struct PALENTRY {
- R_UINT8 red;
- R_UINT8 green;
- R_UINT8 blue;
+ byte red;
+ byte green;
+ byte blue;
-} PALENTRY;
+};
enum R_ERRORCODE {
@@ -248,7 +244,7 @@ int SYSMUSIC_Stop(void);
\*--------------------------------------------------------------------------*/
#define R_PAL_ENTRIES 256
-typedef struct R_SYSGFX_INIT_tag {
+struct R_SYSGFX_INIT {
int backbuf_w;
int backbuf_h;
@@ -260,7 +256,7 @@ typedef struct R_SYSGFX_INIT_tag {
int fullscreen;
-} R_SYSGFX_INIT;
+};
int SYSGFX_Init(R_SYSGFX_INIT *);
diff --git a/saga/render.cpp b/saga/render.cpp
index 4797659721..70afb0245b 100644
--- a/saga/render.cpp
+++ b/saga/render.cpp
@@ -113,8 +113,8 @@ int RENDER_Register(void)
int RENDER_Init(void)
{
- R_GAME_DISPLAYINFO disp_info = { 0 };
- R_SYSGFX_INIT gfx_init = { 0 };
+ R_GAME_DISPLAYINFO disp_info;
+ R_SYSGFX_INIT gfx_init;
int result;
@@ -223,7 +223,7 @@ int RENDER_DrawScene(void)
R_SURFACE *backbuf_surface;
R_SURFACE *display_surface;
- R_GAME_DISPLAYINFO disp_info = { 0 };
+ R_GAME_DISPLAYINFO disp_info;
R_SCENE_INFO scene_info;
SCENE_BGINFO bg_info;
diff --git a/saga/render.h b/saga/render.h
index f7db7b0fe1..30bf3e8c88 100644
--- a/saga/render.h
+++ b/saga/render.h
@@ -43,7 +43,7 @@ namespace Saga {
#define R_PAUSEGAME_MSG "PAWS GAME"
-typedef struct R_RENDER_MODULE_tag {
+struct R_RENDER_MODULE {
int initialized;
@@ -75,7 +75,7 @@ typedef struct R_RENDER_MODULE_tag {
unsigned int r_flags;
int r_mode;
-} R_RENDER_MODULE;
+};
void RENDER_FpsTimer(unsigned long interval, void *param);
diff --git a/saga/render_mod.h b/saga/render_mod.h
index b3c353f3b5..bc5d83af3e 100644
--- a/saga/render_mod.h
+++ b/saga/render_mod.h
@@ -53,7 +53,7 @@ enum RENDER_MODES {
RM_BILINEAR
};
-typedef struct R_BUFFER_INFO_tag {
+struct R_BUFFER_INFO {
uchar *r_bg_buf;
int r_bg_buf_w;
@@ -63,7 +63,7 @@ typedef struct R_BUFFER_INFO_tag {
int r_tmp_buf_w;
int r_tmp_buf_h;
-} R_BUFFER_INFO;
+};
int RENDER_Register(void);
diff --git a/saga/rscfile.h b/saga/rscfile.h
index ef1bda2e10..51a7a01653 100644
--- a/saga/rscfile.h
+++ b/saga/rscfile.h
@@ -41,14 +41,14 @@ namespace Saga {
#define RSC_MIN_FILESIZE (RSC_TABLEINFO_SIZE + RSC_TABLEENTRY_SIZE + 1)
-typedef struct R_RSCFILE_RESOURCE_tag {
+struct R_RSCFILE_RESOURCE {
int res_type;
size_t res_offset;
size_t res_size;
-} R_RSCFILE_RESOURCE;
+};
struct R_RSCFILE_CONTEXT_tag {
diff --git a/saga/saga.cpp b/saga/saga.cpp
index f5df5fff57..d52ea1ae38 100644
--- a/saga/saga.cpp
+++ b/saga/saga.cpp
@@ -118,12 +118,12 @@ namespace Saga {
#define R_MAX_TIME_DELTA 100
-typedef struct R_MAIN_DATA_tag {
+struct R_MAIN_DATA {
int sound_enabled;
int music_enabled;
-} R_MAIN_DATA;
+};
static void CF_quitfunc(int argc, char *argv[]);
static void CF_testfunc(int argc, char *argv[]);
diff --git a/saga/scene.cpp b/saga/scene.cpp
index 3fc9bda076..a59fdd9ebc 100644
--- a/saga/scene.cpp
+++ b/saga/scene.cpp
@@ -1029,7 +1029,7 @@ int SCENE_Draw(R_SURFACE * dst_s)
GFX_BufToSurface(dst_s,
buf_info.r_bg_buf,
disp_info.logical_w,
- YS_MAX(disp_info.scene_h, SceneModule.bg.h), NULL, &bg_pt);
+ MAX(disp_info.scene_h, SceneModule.bg.h), NULL, &bg_pt);
break;
case R_SCENE_MODE_ISO:
diff --git a/saga/scene.h b/saga/scene.h
index 21478c64c1..06035008e3 100644
--- a/saga/scene.h
+++ b/saga/scene.h
@@ -67,9 +67,21 @@ enum SAGA_RESOURCE_TYPES {
SAGA_PAL_ANIM = 23
};
+#define SAGA_RESLIST_ENTRY_LEN 4
+
+struct R_SCENE_RESLIST {
+
+ ulong res_number;
+ int res_type;
+
+ uchar *res_data;
+ size_t res_data_len;
+
+};
+
#define SAGA_SCENE_DESC_LEN 16
-typedef struct R_SCENE_DESC_tag {
+struct R_SCENE_DESC {
int unknown0;
int res_list_rn;
@@ -80,24 +92,12 @@ typedef struct R_SCENE_DESC_tag {
int start_scriptnum;
int music_rn;
- struct R_SCENE_RESLIST_tag *res_list;
+ R_SCENE_RESLIST *res_list;
size_t res_list_ct;
-} R_SCENE_DESC;
-
-#define SAGA_RESLIST_ENTRY_LEN 4
-
-typedef struct R_SCENE_RESLIST_tag {
-
- ulong res_number;
- int res_type;
-
- uchar *res_data;
- size_t res_data_len;
-
-} R_SCENE_RESLIST;
+};
-typedef struct SCENE_IMAGE_tag {
+struct SCENE_IMAGE {
int loaded;
@@ -113,18 +113,18 @@ typedef struct SCENE_IMAGE_tag {
PALENTRY pal[256];
-} SCENE_IMAGE;
+};
-typedef struct SCENE_ANIMINFO_tag {
+struct SCENE_ANIMINFO {
int anim_res_number;
int anim_handle;
- struct SCENE_ANIMINFO_tag *next;
+ SCENE_ANIMINFO *next;
-} SCENE_ANIMINFO;
+};
-typedef struct R_SCENE_QUEUE_tag {
+struct R_SCENE_QUEUE {
ulong scene_n;
R_SCENE_DESC *scene_desc;
@@ -133,9 +133,9 @@ typedef struct R_SCENE_QUEUE_tag {
R_SCENE_PROC *scene_proc;
int scene_skiptarget;
-} R_SCENE_QUEUE;
+};
-typedef struct R_SCENE_MODULE_tag {
+struct R_SCENE_MODULE {
int init;
@@ -172,14 +172,14 @@ typedef struct R_SCENE_MODULE_tag {
SCENE_IMAGE bg;
SCENE_IMAGE bg_mask;
-} R_SCENE_MODULE;
+};
int SCENE_Queue(R_SCENE_QUEUE * scene_queue);
int SCENE_ClearQueue(void);
int
SCENE_Load(int scene,
- int load_flag, R_SCENE_PROC scene_proc, struct R_SCENE_DESC_tag *);
+ int load_flag, R_SCENE_PROC scene_proc, R_SCENE_DESC *);
int LoadSceneDescriptor(ulong res_number);
diff --git a/saga/scene_mod.h b/saga/scene_mod.h
index 2a8fcc705a..7caaf2abef 100644
--- a/saga/scene_mod.h
+++ b/saga/scene_mod.h
@@ -45,14 +45,14 @@ enum R_SCENE_MODES {
R_SCENE_MODE_ISO
};
-typedef struct SCENE_ZINFO_tag {
+struct SCENE_ZINFO {
int begin_slope;
int end_slope;
-} SCENE_ZINFO;
+};
-typedef struct SCENE_BGINFO_tag {
+struct SCENE_BGINFO {
int bg_x;
int bg_y;
@@ -64,16 +64,16 @@ typedef struct SCENE_BGINFO_tag {
uchar *bg_buf;
size_t bg_buflen;
-} SCENE_BGINFO;
+};
-typedef struct R_SCENE_INFO_tag {
+struct R_SCENE_INFO {
SCENE_ZINFO z_info;
SCENE_BGINFO bg_info;
R_TEXTLIST *text_list;
-} R_SCENE_INFO;
+};
typedef int (R_SCENE_PROC) (int, R_SCENE_INFO *);
diff --git a/saga/sceneproc.cpp b/saga/sceneproc.cpp
index e07c7bc741..ab9cdab517 100644
--- a/saga/sceneproc.cpp
+++ b/saga/sceneproc.cpp
@@ -54,7 +54,7 @@ namespace Saga {
int InitialSceneProc(int param, R_SCENE_INFO * scene_info)
{
- R_EVENT event = { 0 };
+ R_EVENT event;
R_EVENT *q_event;
int delay_time = 0;
diff --git a/saga/script.cpp b/saga/script.cpp
index 4c84a9e069..5c9a0db422 100644
--- a/saga/script.cpp
+++ b/saga/script.cpp
@@ -415,7 +415,7 @@ int SCRIPT_Free(void)
return R_SUCCESS;
}
-R_SCRIPT_BYTECODE *SCRIPT_LoadBytecode(const uchar * bytecode_p,
+R_SCRIPT_BYTECODE *SCRIPT_LoadBytecode(uchar * bytecode_p,
size_t bytecode_len)
/*--------------------------------------------------------------------------*\
* Reads the entrypoint table from a script bytecode resource in memory.
@@ -539,7 +539,7 @@ R_DIALOGUE_LIST *SCRIPT_LoadDialogue(const uchar * dialogue_p,
dialogue_list->n_dialogue = n_dialogue;
/* Allocate table of string pointers */
- dialogue_list->str = (char **)malloc(n_dialogue * sizeof(char *));
+ dialogue_list->str = (const char **)malloc(n_dialogue * sizeof(const char *));
if (dialogue_list->str == NULL) {
free(dialogue_list);
return NULL;
@@ -565,7 +565,7 @@ R_DIALOGUE_LIST *SCRIPT_LoadDialogue(const uchar * dialogue_p,
free(dialogue_list);
return NULL;
}
- dialogue_list->str[i] = (char *)dialogue_p + offset;
+ dialogue_list->str[i] = (const char *)dialogue_p + offset;
dialogue_list->str_off[i] = offset;
}
diff --git a/saga/script.h b/saga/script.h
index bff544e636..961258cd9d 100644
--- a/saga/script.h
+++ b/saga/script.h
@@ -52,14 +52,14 @@ namespace Saga {
#define S_ERROR_PREFIX "SError: "
#define S_WARN_PREFIX "SWarning: "
-typedef struct R_PROC_TBLENTRY_tag {
+struct R_PROC_TBLENTRY {
size_t name_offset;
size_t offset;
-} R_PROC_TBLENTRY;
+};
-typedef struct R_SCRIPT_BYTECODE_tag {
+struct R_SCRIPT_BYTECODE {
unsigned char *bytecode_p;
size_t bytecode_len;
@@ -68,48 +68,48 @@ typedef struct R_SCRIPT_BYTECODE_tag {
unsigned long n_entrypoints;
R_PROC_TBLENTRY *entrypoints;
-} R_SCRIPT_BYTECODE;
+};
-typedef struct R_DIALOGUE_LIST_tag {
+struct R_DIALOGUE_LIST {
unsigned int n_dialogue;
- char **str;
+ const char **str;
size_t *str_off;
-} R_DIALOGUE_LIST;
+};
-typedef struct R_VOICE_LUT_tag {
+struct R_VOICE_LUT {
int n_voices;
int *voices;
-} R_VOICE_LUT;
+};
-typedef struct R_SCRIPTDATA_tag {
+struct R_SCRIPTDATA {
int loaded;
R_SCRIPT_BYTECODE *bytecode;
R_DIALOGUE_LIST *diag;
R_VOICE_LUT *voice;
-} R_SCRIPTDATA;
+};
-typedef struct R_SCRIPT_LUT_ENTRY_tag {
+struct R_SCRIPT_LUT_ENTRY {
int script_rn;
int diag_list_rn;
int voice_lut_rn;
-} R_SCRIPT_LUT_ENTRY;
+};
-typedef struct R_SCRIPT_DATABUF_tag {
+struct R_SCRIPT_DATABUF {
SDataWord_T *data;
int len;
-} R_SCRIPT_DATABUF;
+};
-typedef struct R_SCRIPT_MODULE_tag {
+struct R_SCRIPT_MODULE {
int initialized;
@@ -129,11 +129,11 @@ typedef struct R_SCRIPT_MODULE_tag {
R_SCRIPT_THREAD *dbg_thread;
R_TEXTLIST_ENTRY *dbg_txtentry;
-} R_SCRIPT_MODULE;
+};
extern R_SCRIPT_MODULE ScriptModule;
-R_SCRIPT_BYTECODE *SCRIPT_LoadBytecode(const uchar * bytecode_p,
+R_SCRIPT_BYTECODE *SCRIPT_LoadBytecode(uchar * bytecode_p,
size_t bytecode_len);
R_DIALOGUE_LIST *SCRIPT_LoadDialogue(const uchar * dialogue_p,
diff --git a/saga/sdata.h b/saga/sdata.h
index 3c9805de45..1b6f81d944 100644
--- a/saga/sdata.h
+++ b/saga/sdata.h
@@ -34,8 +34,8 @@
namespace Saga {
-#define R_SCRIPT_DATABUF_NUM 5U
-#define R_SCRIPT_DATABUF_LEN 1024U
+#define R_SCRIPT_DATABUF_NUM 5
+#define R_SCRIPT_DATABUF_LEN 1024
int SDATA_Init(void);
diff --git a/saga/sfuncs.h b/saga/sfuncs.h
index 75d7339420..343618fbb6 100644
--- a/saga/sfuncs.h
+++ b/saga/sfuncs.h
@@ -43,13 +43,13 @@ namespace Saga {
typedef int (*SFunc_T) (R_SCRIPTFUNC_PARAMS);
-typedef struct R_SFUNC_ENTRY_tag {
+struct R_SFUNC_ENTRY {
int sfunc_num;
int sfunc_argc;
SFunc_T sfunc_fp;
-} R_SFUNC_ENTRY;
+};
extern R_SFUNC_ENTRY SFuncList[];
diff --git a/saga/sndres.cpp b/saga/sndres.cpp
index 3592095578..8920053d06 100644
--- a/saga/sndres.cpp
+++ b/saga/sndres.cpp
@@ -230,10 +230,10 @@ LoadVocSound(const uchar * snd_res,
snd_buf_i->s_samplebits = 8;
snd_buf_i->s_freq = byte_rate;
- snd_buf_i->res_data = (uchar *) snd_res;
+ snd_buf_i->res_data = snd_res;
snd_buf_i->res_len = snd_res_len;
- snd_buf_i->s_buf = (uchar *) read_p;
+ snd_buf_i->s_buf = read_p;
snd_buf_i->s_buf_len = read_len - 1; /* -1 for end block */
snd_buf_i->s_signed = 0;
diff --git a/saga/sndres.h b/saga/sndres.h
index 1bdfc577a8..961fd19968 100644
--- a/saga/sndres.h
+++ b/saga/sndres.h
@@ -39,36 +39,36 @@ namespace Saga {
#define R_VOC_FILE_DESC_LEN 20
#define R_VOC_FILE_DESC "Creative Voice File\x1A"
-typedef struct R_VOC_HEADER_BLOCK_tag {
+struct R_VOC_HEADER_BLOCK {
char ft_desc[20]; /* BYTE [20] */
uint db_offset; /* WORD */
uint voc_version; /* WORD */
uint voc_fileid; /* WORD */
-} R_VOC_HEADER_BLOCK;
+};
#define R_VOC_HEADER_BLOCK_LEN 26
-typedef struct R_VOC_GENBLOCK_tag {
+struct R_VOC_GENBLOCK {
int block_id; /* BYTE */
ulong block_len; /* BYTE[3] */
-} R_VOC_GENBLOCK;
+};
#define R_VOC_GENBLOCK_LEN 4
-typedef struct R_VOC_BLOCK1_tag {
+struct R_VOC_BLOCK1 {
int block_id; /* BYTE */
ulong block_len; /* BYTE[3] */
uint time_constant; /* BYTE */
int pack_method; /* BYTE */
-} R_VOC_BLOCK1;
+};
-typedef struct R_SNDRES_MODULE_tag {
+struct R_SNDRES_MODULE {
int init;
@@ -77,7 +77,7 @@ typedef struct R_SNDRES_MODULE_tag {
R_GAME_SOUNDINFO snd_info;
-} R_SNDRES_MODULE;
+};
int
SND_Load(R_RSCFILE_CONTEXT * snd_ctxt,
diff --git a/saga/sprite.cpp b/saga/sprite.cpp
index 975d79ec00..9325a285c2 100644
--- a/saga/sprite.cpp
+++ b/saga/sprite.cpp
@@ -51,7 +51,7 @@
namespace Saga {
-R_SPRITE_MODULE SpriteModule = { 0 };
+static R_SPRITE_MODULE SpriteModule = { 0, 0, 0, 0 };
int SPRITE_Init(void)
{
@@ -428,7 +428,7 @@ SPRITE_DrawOccluded(R_SURFACE * ds,
spr_dst_rect.x1 = 0;
spr_dst_rect.y1 = 0;
spr_dst_rect.x2 = ds->clip_rect.x2;
- spr_dst_rect.y2 = YS_MIN(ds->clip_rect.y2, mask_h - 1);
+ spr_dst_rect.y2 = MIN(ds->clip_rect.y2, mask_h - 1);
spr_pt.x = spr_x + x_align;
spr_pt.y = spr_y + y_align;
diff --git a/saga/sprite.h b/saga/sprite.h
index d90d5e0800..c3c5b445ef 100644
--- a/saga/sprite.h
+++ b/saga/sprite.h
@@ -40,21 +40,21 @@ namespace Saga {
#define R_DECODE_BUF_LEN 64000
-typedef struct R_SPRITELIST_ENTRY_tag {
+struct R_SPRITELIST_ENTRY {
int x_align;
int y_align;
int width;
int height;
-} R_SPRITELIST_ENTRY;
+};
-typedef struct R_SPRITELIST_OFFSET_tag {
+struct R_SPRITELIST_OFFSET {
uint data_idx;
size_t offset;
-} R_SPRITELIST_OFFSET;
+};
struct R_SPRITELIST_tag {
@@ -68,7 +68,7 @@ struct R_SPRITELIST_tag {
};
-typedef struct R_SPRITE_MODULE_tag {
+struct R_SPRITE_MODULE {
int init;
@@ -77,7 +77,7 @@ typedef struct R_SPRITE_MODULE_tag {
uchar *decode_buf;
size_t decode_buf_len;
-} R_SPRITE_MODULE;
+};
int
DecodeRLESprite(const uchar * inbuf,
diff --git a/saga/sthread.cpp b/saga/sthread.cpp
index 04407a1eec..b72d3da07c 100644
--- a/saga/sthread.cpp
+++ b/saga/sthread.cpp
@@ -449,7 +449,7 @@ int STHREAD_Run(R_SCRIPT_THREAD * thread, int instr_limit, int msec)
{
int n_args;
uint func_num;
- int result;
+ int FIXME_SHADOWED_result;
SFunc_T sfunc;
@@ -485,9 +485,9 @@ int STHREAD_Run(R_SCRIPT_THREAD * thread, int instr_limit, int msec)
}
} else {
- result = sfunc(thread);
+ FIXME_SHADOWED_result = sfunc(thread);
- if (result != R_SUCCESS) {
+ if (FIXME_SHADOWED_result != R_SUCCESS) {
CON_Print(S_WARN_PREFIX
"%X: Script function %d failed.\n",
thread->i_offset,
@@ -1059,21 +1059,21 @@ int STHREAD_Run(R_SCRIPT_THREAD * thread, int instr_limit, int msec)
/* (DLGO): Add a dialogue option to interface */
case 0x56:
{
- int param1;
- int param2;
- int param3;
+ int FIXME_SHADOWED_param1;
+ int FIXME_SHADOWED_param2;
+ int FIXME_SHADOWED_param3;
printf("DLGO | ");
- param1 = *read_p++;
- param2 = *read_p++;
+ FIXME_SHADOWED_param1 = *read_p++;
+ FIXME_SHADOWED_param2 = *read_p++;
- printf("%02X %02X ", param1, param2);
+ printf("%02X %02X ", FIXME_SHADOWED_param1, FIXME_SHADOWED_param2);
- if (param2 > 0) {
- param3 =
+ if (FIXME_SHADOWED_param2 > 0) {
+ FIXME_SHADOWED_param3 =
ys_read_u16_le(read_p, &read_p);
- printf("%04X", param3);
+ printf("%04X", FIXME_SHADOWED_param3);
}
}
break;
diff --git a/saga/sysgfx.h b/saga/sysgfx.h
index 3d37e29fdb..d50c6549f0 100644
--- a/saga/sysgfx.h
+++ b/saga/sysgfx.h
@@ -31,7 +31,7 @@ namespace Saga {
#define R_GREEN_WEIGHT 0.587
#define R_BLUE_WEIGHT 0.114
-typedef struct R_SYSGFX_MODULE_tag {
+struct R_SYSGFX_MODULE {
int init;
@@ -44,7 +44,7 @@ typedef struct R_SYSGFX_MODULE_tag {
int white_index;
int black_index;
-} R_SYSGFX_MODULE;
+};
} // End of namespace Saga
diff --git a/saga/systimer.h b/saga/systimer.h
index 19398ba567..d4fd81cdc1 100644
--- a/saga/systimer.h
+++ b/saga/systimer.h
@@ -25,7 +25,7 @@
namespace Saga {
-typedef struct R_SYSTIMER_DATA_tag {
+struct R_SYSTIMER_DATA {
int initialized;
@@ -34,7 +34,7 @@ typedef struct R_SYSTIMER_DATA_tag {
Uint32 t_current_ticks;
Uint32 t_previous_ticks;
-} R_SYSTIMER_DATA;
+};
struct R_SYSTIMER_tag {
diff --git a/saga/text_mod.h b/saga/text_mod.h
index b136a3b34a..27893fda12 100644
--- a/saga/text_mod.h
+++ b/saga/text_mod.h
@@ -37,7 +37,7 @@ enum R_TEXT_FLAGS {
TEXT_TIMEOUT = 0x01
};
-typedef struct R_TEXTLIST_ENTRY_tag {
+struct R_TEXTLIST_ENTRY {
struct R_TEXTLIST_ENTRY_tag *next;
struct R_TEXTLIST_ENTRY_tag *prev;
int display;
@@ -49,8 +49,10 @@ typedef struct R_TEXTLIST_ENTRY_tag {
int flags;
int font_id;
long time;
- char *string;
-} R_TEXTLIST_ENTRY;
+ const char *string;
+
+ R_TEXTLIST_ENTRY() { memset(this, 0, sizeof(*this)); }
+};
typedef struct R_TEXTLIST_tag R_TEXTLIST;
diff --git a/saga/x86_32.h b/saga/x86_32.h
deleted file mode 100644
index 85b5004115..0000000000
--- a/saga/x86_32.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 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$
- *
- */
-#ifndef R_ARCH_H
-#define R_ARCH_H
-
-namespace Saga {
-
-#define R_LITTLE_ENDIAN
-
-typedef unsigned int R_UINT32;
-typedef signed int R_SINT32;
-
-typedef unsigned short R_UINT16;
-typedef signed short R_SINT16;
-
-typedef unsigned char R_UINT8;
-typedef signed char R_SINT8;
-
-} // End of namespace Saga
-
-#endif /* R_ARCH_H */
diff --git a/saga/xmidi.cpp b/saga/xmidi.cpp
index 4767a6b849..f29057e1c1 100644
--- a/saga/xmidi.cpp
+++ b/saga/xmidi.cpp
@@ -229,7 +229,7 @@ int WriteVLQ_DW(char *write_ptr, DWORD value)
int vlq_len = 1;
DWORD pack = value & 0x7F;
- int x;
+ uint x;
while (value >>= 7) {
pack <<= 8;
@@ -471,7 +471,7 @@ XMIDI_ReadEvents(XMIDIEVENT_LIST * event_list,
while (event_bytes_left > 0) {
- vlq_len = ReadVLQ2_DW((char *)event_data_ptr,
+ vlq_len = ReadVLQ2_DW(event_data_ptr,
(DWORD)event_bytes_left, (DWORD *)&new_event_time);
event_time += new_event_time;
@@ -504,7 +504,7 @@ XMIDI_ReadEvents(XMIDIEVENT_LIST * event_list,
event_time, event, channel, 0, op1, op2, 0, 0);
vlq_len =
- ReadVLQ_DW((char *)event_data_ptr, (DWORD)event_bytes_left,
+ ReadVLQ_DW(event_data_ptr, (DWORD)event_bytes_left,
(DWORD *)&event_len);
AddEventToList(event_list, MIDI_NOTE_OFF_LEN,
event_time + event_len, MIDI_NOTE_OFF, channel, 0,
@@ -675,7 +675,7 @@ int GetLengthAsVLQ(DWORD data)
}
-DWORD ReadVLQ_DW(char *data, DWORD bytes_left, DWORD * value)
+DWORD ReadVLQ_DW(const uchar *data, DWORD bytes_left, DWORD * value)
{
BYTE byte;
DWORD vlq_len = 0;
@@ -693,7 +693,7 @@ DWORD ReadVLQ_DW(char *data, DWORD bytes_left, DWORD * value)
return vlq_len;
}
-DWORD ReadVLQ2_DW(char *data, DWORD bytes_left, DWORD * value)
+DWORD ReadVLQ2_DW(const uchar *data, DWORD bytes_left, DWORD * value)
{
BYTE byte;
diff --git a/saga/xmidi.h b/saga/xmidi.h
index a408cfc74e..f40ae21b44 100644
--- a/saga/xmidi.h
+++ b/saga/xmidi.h
@@ -52,29 +52,29 @@ namespace Saga {
/* IFF/XMI Data structures
\*--------------------------------------------------------------------------*/
-typedef struct IFF_ID_CHUNK_tag {
+struct IFF_ID_CHUNK {
char id_4cc[4]; /* 4cc */
ulong chunk_len; /* u32_be */
char desc_4cc[4]; /* 4cc */
-} IFF_ID_CHUNK;
+};
#define IFF_ID_CHUNK_HEADERLEN 12
-typedef struct XMI_INFO_CHUNK_tag {
+struct XMI_INFO_CHUNK {
char id_4cc[4]; /* 4cc */
ulong chunk_len; /* u32_be */
uint n_tracks; /* u16_le */
-} XMI_INFO_CHUNK;
+};
-typedef struct XMI_TIMB_CHUNK_tag {
+struct XMI_TIMB_CHUNK {
char id_4cc[4]; /* 4cc */
ulong chunk_len; /* u32_be */
-} XMI_TIMB_CHUNK;
+};
-typedef struct XMI_EVENT_CHUNK_tag {
+struct XMI_EVENT_CHUNK {
char id_4cc[4]; /* 4cc */
ulong chunk_len; /* u32_be */
-} XMI_EVENT_CHUNK;
+};
typedef struct SMF_HEADER_CHUNK_tag {
char smf_id[4]; /* u8 */
@@ -87,10 +87,10 @@ typedef struct SMF_HEADER_CHUNK_tag {
} time_division;
} SMF_HEADER_CHUNK;
-typedef struct SMF_TRACK_CHUNK_tag {
+struct SMF_TRACK_CHUNK {
char smf_track_id[4];
unsigned int smf_track_len;
-} SMF_TRACK_CHUNK;
+};
#define MIDI_HEADER_LEN 14
#define MIDI_HEADER_CHUNK_LEN 6
@@ -105,8 +105,8 @@ int Print4CC(char *fourcc);
int XMIDI_ReadEvents(XMIDIEVENT_LIST *event_list, const uchar *event_data,
size_t event_data_len, uint n_tracks);
int WriteVLQ_DW(char *write_ptr, DWORD value);
-DWORD ReadVLQ_DW(char *data, DWORD bytes_left, DWORD *value);
-DWORD ReadVLQ2_DW(char *data, DWORD bytes_left, DWORD *value);
+DWORD ReadVLQ_DW(const uchar *data, DWORD bytes_left, DWORD *value);
+DWORD ReadVLQ2_DW(const uchar *data, DWORD bytes_left, DWORD *value);
int GetLengthAsVLQ(DWORD data);
int AddEventToList(XMIDIEVENT_LIST *event_list, int smf_size, int time,
int event, int channel, int sysex_op, int op1, int op2, int op3, int op4);
diff --git a/saga/xmidi_mod.h b/saga/xmidi_mod.h
index 4d093072a7..8743f78c32 100644
--- a/saga/xmidi_mod.h
+++ b/saga/xmidi_mod.h
@@ -83,9 +83,9 @@ enum MIDI_EVENT_LENGTHS {
MIDI_SYSEX_TIMESIG_LEN = 7
};
-typedef struct XMIDIEVENT_tag {
- struct XMIDIEVENT_tag *prev_event;
- struct XMIDIEVENT_tag *next_event;
+struct XMIDIEVENT {
+ XMIDIEVENT *prev_event;
+ XMIDIEVENT *next_event;
size_t smf_size; /* Size of event in SMF format */
@@ -99,13 +99,13 @@ typedef struct XMIDIEVENT_tag {
uchar op3;
uchar op4;
uchar pad;
-} XMIDIEVENT;
+};
-typedef struct XMIDIEVENT_LIST_tag {
+struct XMIDIEVENT_LIST {
XMIDIEVENT *head;
XMIDIEVENT *tail;
int smf_size;
-} XMIDIEVENT_LIST;
+};
int XMIDI_Read(const uchar *XMI_img, XMIDIEVENT_LIST *event_list);
int XMIDI_Free(XMIDIEVENT_LIST *event_list);
diff --git a/saga/ys_binread.cpp b/saga/ys_binread.cpp
index 4f363bbc8f..3712b28011 100644
--- a/saga/ys_binread.cpp
+++ b/saga/ys_binread.cpp
@@ -94,7 +94,7 @@ ys_read_u16_be(const unsigned char *data_p, const unsigned char **data_pp)
unsigned int u16_be = ((unsigned int)data_p[0] << 8) | data_p[1];
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 2);
+ *data_pp = data_p + 2;
}
return u16_be;
@@ -111,7 +111,7 @@ ys_read_u16_le(const unsigned char *data_p, const unsigned char **data_pp)
unsigned int u16_le = ((unsigned int)data_p[1] << 8) | data_p[0];
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 2);
+ *data_pp = data_p + 2;
}
return u16_le;
@@ -136,7 +136,7 @@ int ys_read_s16_be(const unsigned char *data_p, const unsigned char **data_pp)
s16_be = u16_be;
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 2);
+ *data_pp = data_p + 2;
}
return s16_be;
@@ -161,7 +161,7 @@ int ys_read_s16_le(const unsigned char *data_p, const unsigned char **data_pp)
s16_le = u16_le;
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 2);
+ *data_pp = data_p + 2;
}
return s16_le;
@@ -179,7 +179,7 @@ ys_read_u24_be(const unsigned char *data_p, const unsigned char **data_pp)
((unsigned long)data_p[1] << 8) | data_p[2];
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 3);
+ *data_pp = data_p + 3;
}
return u24_be;
@@ -197,7 +197,7 @@ ys_read_u24_le(const unsigned char *data_p, const unsigned char **data_pp)
((unsigned long)data_p[2] << 8) | data_p[0];
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 3);
+ *data_pp = data_p + 3;
}
return u24_le;
@@ -223,7 +223,7 @@ long ys_read_s24_be(const unsigned char *data_p, const unsigned char **data_pp)
s24_be = u24_be;
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 3);
+ *data_pp = data_p + 3;
}
return s24_be;
@@ -249,7 +249,7 @@ long ys_read_s24_le(const unsigned char *data_p, const unsigned char **data_pp)
s24_be = u24_be;
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 3);
+ *data_pp = data_p + 3;
}
return s24_be;
@@ -268,7 +268,7 @@ ys_read_u32_be(const unsigned char *data_p, const unsigned char **data_pp)
((unsigned long)data_p[2] << 8) | data_p[3];
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 4);
+ *data_pp = data_p + 4;
}
return u32_be;
@@ -287,7 +287,7 @@ ys_read_u32_le(const unsigned char *data_p, const unsigned char **data_pp)
((unsigned long)data_p[1] << 8) | data_p[0];
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 4);
+ *data_pp = data_p + 4;
}
return u32_le;
@@ -314,7 +314,7 @@ long ys_read_s32_be(const unsigned char *data_p, const unsigned char **data_pp)
s32_be = u32_be;
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 4);
+ *data_pp = data_p + 4;
}
return s32_be;
@@ -341,7 +341,7 @@ long ys_read_s32_le(const unsigned char *data_p, const unsigned char **data_pp)
s32_le = u32_le;
if (data_pp != NULL) {
- *data_pp = (unsigned char *)(data_p + 4);
+ *data_pp = data_p + 4;
}
return s32_le;
diff --git a/saga/ys_file.cpp b/saga/ys_file.cpp
deleted file mode 100644
index 39cb84cff0..0000000000
--- a/saga/ys_file.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/* 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$
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include "yslib.h"
-
-namespace Saga {
-
-int ys_get_filesize(FILE * file_p, unsigned long *len_p, int *p_errno)
-/*--------------------------------------------------------------------------*\
- * Returns the 'size' of the specified file. The file must be opened in
- * binary mode. Note that not all operating systems support determing the
- * exact end of a binary file stream, so this function is limited in
- * portability.
-\*--------------------------------------------------------------------------*/
-{
- long f_pos;
- long f_len;
-
- f_pos = ftell(file_p);
- if (f_pos == -1) {
- *p_errno = errno;
- return YS_E_FAILURE;
- }
-
- fseek(file_p, 0, SEEK_END);
-
- f_len = ftell(file_p);
- if (f_pos == -1) {
- *p_errno = errno;
- return YS_E_FAILURE;
- }
-
- fseek(file_p, f_pos, SEEK_SET);
-
- *len_p = (unsigned long)f_len;
-
- return YS_E_SUCCESS;;
-}
-
-} // End of namespace Saga
diff --git a/saga/yslib.h b/saga/yslib.h
index b5bc464d2c..82d231606d 100644
--- a/saga/yslib.h
+++ b/saga/yslib.h
@@ -59,16 +59,6 @@ typedef int (YS_COMPARE_FUNC) (const void *, const void *);
#define YS_FLEX_ARRAY
#define YS_FLEX_ARRAY_MOD 0
-/* Minimum and maximum of two values */
-#define YS_MIN(a,b) (((a) < (b)) ? (a) : (b))
-#define YS_MAX(a,b) (((a) > (b)) ? (a) : (b))
-
-/* Minimum and maximum of two objects, convert to lvalue */
-#define YS_LV_MIN(a,b) (*((a) < (b)) ? &(a) : &(b))
-#define YS_LV_MAX(a,b) (*((a) < (b)) ? &(a) : &(b))
-
-#define YS_ABS(n) ((n < 0) ? -n : n)
-
/* ys_binread.c : Binary input functions (buffer oriented)
\*------------------------------------------------------------------*/
@@ -163,10 +153,6 @@ void ys_write_s32_be(long, unsigned char *, unsigned char **);
void ys_write_s32_le(long, unsigned char *, unsigned char **);
-/* ys_file.c : File management functions
-\*------------------------------------------------------------------*/
-int ys_get_filesize(FILE *, unsigned long *, int *);
-
/* Shared declarations for list modules
\*------------------------------------------------------------------*/
enum YS_WALK_DIRECTIONS {