diff options
author | Paweł Kołodziejski | 2004-05-01 13:19:15 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2004-05-01 13:19:15 +0000 |
commit | d46b68d7fe563303089567e8f092856d4108ad07 (patch) | |
tree | 35fe91cb0d76405f9440163eb9a1611df8793b99 /saga | |
parent | 72568a8b435dd0f91db564b564977790095f9c94 (diff) | |
download | scummvm-rg350-d46b68d7fe563303089567e8f092856d4108ad07.tar.gz scummvm-rg350-d46b68d7fe563303089567e8f092856d4108ad07.tar.bz2 scummvm-rg350-d46b68d7fe563303089567e8f092856d4108ad07.zip |
indent
svn-id: r13708
Diffstat (limited to 'saga')
-rw-r--r-- | saga/palanim.cpp | 96 | ||||
-rw-r--r-- | saga/palanim.h | 13 | ||||
-rw-r--r-- | saga/palanim_mod.h | 17 | ||||
-rw-r--r-- | saga/reinherit.h | 69 | ||||
-rw-r--r-- | saga/resnames.h | 24 | ||||
-rw-r--r-- | saga/rscfile.cpp | 73 | ||||
-rw-r--r-- | saga/rscfile.h | 21 | ||||
-rw-r--r-- | saga/rscfile_mod.h | 20 | ||||
-rw-r--r-- | saga/saga.cpp | 90 | ||||
-rw-r--r-- | saga/saga.h | 8 |
10 files changed, 111 insertions, 320 deletions
diff --git a/saga/palanim.cpp b/saga/palanim.cpp index 9d36a32b3d..693a846eca 100644 --- a/saga/palanim.cpp +++ b/saga/palanim.cpp @@ -20,27 +20,16 @@ * $Header$ * */ -/* - Description: - - Palette animation module - Notes: -*/ +// Palette animation module #include "reinherit.h" #include "yslib.h" -/* - * Uses the following modules: -\*--------------------------------------------------------------------------*/ #include "events_mod.h" #include "game_mod.h" -/* - * Begin module: -\*--------------------------------------------------------------------------*/ #include "palanim_mod.h" #include "palanim.h" @@ -48,8 +37,7 @@ namespace Saga { static PALANIM_DATA PAnimData; -int PALANIM_Load(const byte * resdata, size_t resdata_len) -{ +int PALANIM_Load(const byte *resdata, size_t resdata_len) { const byte *read_p = resdata; void *test_p; @@ -71,9 +59,7 @@ int PALANIM_Load(const byte * resdata, size_t resdata_len) PAnimData.entry_count = ys_read_u16_le(read_p, &read_p); - R_printf(R_STDOUT, - "PALANIM_Load(): Loading %d PALANIM entries.\n", - PAnimData.entry_count); + R_printf(R_STDOUT, "PALANIM_Load(): Loading %d PALANIM entries.\n", PAnimData.entry_count); test_p = calloc(PAnimData.entry_count, sizeof(PALANIM_ENTRY)); if (test_p == NULL) { @@ -84,7 +70,6 @@ int PALANIM_Load(const byte * resdata, size_t resdata_len) PAnimData.entries = (PALANIM_ENTRY *)test_p; for (i = 0; i < PAnimData.entry_count; i++) { - int color_count; int pal_count; int p, c; @@ -95,61 +80,46 @@ int PALANIM_Load(const byte * resdata, size_t resdata_len) PAnimData.entries[i].pal_count = pal_count; PAnimData.entries[i].color_count = color_count; -# if 0 - R_printf(R_STDOUT, - "PALANIM_Load(): Entry %d: Loading %d palette indices.\n", - i, pal_count); +#if 0 + R_printf(R_STDOUT, "PALANIM_Load(): Entry %d: Loading %d palette indices.\n", i, pal_count); #endif test_p = calloc(1, sizeof(char) * pal_count); if (test_p == NULL) { - R_printf(R_STDERR, - "PALANIM_Load(): Allocation failure.\n"); + R_printf(R_STDERR, "PALANIM_Load(): Allocation failure.\n"); return R_MEM; } PAnimData.entries[i].pal_index = (byte *)test_p; -# if 0 - R_printf(R_STDOUT, - "PALANIM_Load(): Entry %d: Loading %d SAGA_COLOR " - "structures.\n", i, color_count); -# endif +#if 0 + R_printf(R_STDOUT, "PALANIM_Load(): Entry %d: Loading %d SAGA_COLOR structures.\n", i, color_count); +#endif test_p = calloc(1, sizeof(R_COLOR) * color_count); if (test_p == NULL) { - R_printf(R_STDERR, - "PALANIM_Load(): Allocation failure.\n"); + R_printf(R_STDERR, "PALANIM_Load(): Allocation failure.\n"); return R_MEM; } PAnimData.entries[i].colors = (R_COLOR *)test_p; for (p = 0; p < pal_count; p++) { - PAnimData.entries[i].pal_index[p] = - (byte) ys_read_u8(read_p, &read_p); + PAnimData.entries[i].pal_index[p] = (byte) ys_read_u8(read_p, &read_p); } for (c = 0; c < color_count; c++) { - PAnimData.entries[i].colors[c].red = - (byte) ys_read_u8(read_p, &read_p); - - PAnimData.entries[i].colors[c].green = - (byte) ys_read_u8(read_p, &read_p); - - PAnimData.entries[i].colors[c].blue = - (byte) ys_read_u8(read_p, &read_p); + PAnimData.entries[i].colors[c].red = (byte) ys_read_u8(read_p, &read_p); + PAnimData.entries[i].colors[c].green = (byte) ys_read_u8(read_p, &read_p); + PAnimData.entries[i].colors[c].blue = (byte) ys_read_u8(read_p, &read_p); } } PAnimData.loaded = 1; return R_SUCCESS; - } -int PALANIM_CycleStart(void) -{ - +int PALANIM_CycleStart() { R_EVENT event; if (!PAnimData.loaded) { @@ -164,11 +134,9 @@ int PALANIM_CycleStart(void) EVENT_Queue(&event); return R_SUCCESS; - } -int PALANIM_CycleStep(int vectortime) -{ +int PALANIM_CycleStep(int vectortime) { R_SURFACE *back_buf; static PALENTRY pal[256]; @@ -189,26 +157,14 @@ int PALANIM_CycleStep(int vectortime) back_buf = SYSGFX_GetBackBuffer(); for (i = 0; i < PAnimData.entry_count; i++) { - cycle = PAnimData.entries[i].cycle; cycle_limit = PAnimData.entries[i].color_count; - for (j = 0; j < PAnimData.entries[i].pal_count; j++) { - - pal_index = - (unsigned char)PAnimData.entries[i].pal_index[j]; + pal_index = (unsigned char)PAnimData.entries[i].pal_index[j]; col_index = (cycle + j) % cycle_limit; - - pal[pal_index].red = - (byte) PAnimData.entries[i].colors[col_index].red; - - pal[pal_index].green = - (byte) PAnimData.entries[i].colors[col_index]. - green; - - pal[pal_index].blue = - (byte) PAnimData.entries[i].colors[col_index]. - blue; + pal[pal_index].red = (byte) PAnimData.entries[i].colors[col_index].red; + pal[pal_index].green = (byte) PAnimData.entries[i].colors[col_index].green; + pal[pal_index].blue = (byte) PAnimData.entries[i].colors[col_index].blue; } PAnimData.entries[i].cycle++; @@ -228,12 +184,9 @@ int PALANIM_CycleStep(int vectortime) EVENT_Queue(&event); return R_SUCCESS; - } -int PALANIM_Free(void) -{ - +int PALANIM_Free() { uint16 i; if (!PAnimData.loaded) { @@ -242,16 +195,13 @@ int PALANIM_Free(void) for (i = 0; i < PAnimData.entry_count; i++) { #if 0 - R_printf(R_STDOUT, - "PALANIM_Free(): Entry %d: Freeing colors.\n", i); + R_printf(R_STDOUT, "PALANIM_Free(): Entry %d: Freeing colors.\n", i); #endif free(PAnimData.entries[i].colors); #if 0 - R_printf(R_STDOUT, - "PALANIM_Free(): Entry %d: Freeing indices.\n", i); + R_printf(R_STDOUT, "PALANIM_Free(): Entry %d: Freeing indices.\n", i); #endif free(PAnimData.entries[i].pal_index); - } R_printf(R_STDOUT, "PALANIM_Free(): Freeing entries.\n"); diff --git a/saga/palanim.h b/saga/palanim.h index b8e7a44c42..9638fbdf5e 100644 --- a/saga/palanim.h +++ b/saga/palanim.h @@ -20,13 +20,8 @@ * $Header$ * */ -/* - Description: - - Palette animation module header file - Notes: -*/ +// Palette animation module header file #ifndef SAGA_PALANIM_H #define SAGA_PALANIM_H @@ -38,23 +33,17 @@ namespace Saga { #define PALANIM_CYCLETIME 100 struct PALANIM_ENTRY { - uint16 pal_count; uint16 color_count; uint16 cycle; - byte *pal_index; R_COLOR *colors; - }; struct PALANIM_DATA { - int loaded; uint16 entry_count; - PALANIM_ENTRY *entries; - }; } // End of namespace Saga diff --git a/saga/palanim_mod.h b/saga/palanim_mod.h index da7a9ba186..3dcd416d30 100644 --- a/saga/palanim_mod.h +++ b/saga/palanim_mod.h @@ -20,13 +20,9 @@ * $Header$ * */ -/* - Description: - - Palette animation module public header file - Notes: -*/ +// Palette animation module public header file + #ifndef SAGA_PALANIM_MOD_H__ #define SAGA_PALANIM_MOD_H__ @@ -34,13 +30,10 @@ namespace Saga { int PALANIM_Load(const byte *, size_t); - -int PALANIM_CycleStart(void); - +int PALANIM_CycleStart(); int PALANIM_CycleStep(int vectortime); - -int PALANIM_Free(void); +int PALANIM_Free(); } // End of namespace Saga -#endif /* SAGA_PALANIM_MOD_H__ */ +#endif diff --git a/saga/reinherit.h b/saga/reinherit.h index 5687c4db34..be8903832c 100644 --- a/saga/reinherit.h +++ b/saga/reinherit.h @@ -20,13 +20,8 @@ * $Header$ * */ -/* - Description: - - Main Header File - Notes: -*/ +// Main Header File #ifndef SAGA_REINHERIT_H_ #define SAGA_REINHERIT_H_ @@ -37,9 +32,6 @@ #include "base/engine.h" -/* - * Implementation conditionals -\*--------------------------------------------------------------------------*/ #define R_ENV_LINUX #include "sys_interface.h" @@ -47,7 +39,7 @@ namespace Saga { #define R_MAXPATH 512 -/* For debug message processing */ +// For debug message processing #define R_DEBUG_NONE 0 #define R_DEBUG_INFO 1 #define R_DEBUG_VERBOSE 2 @@ -55,24 +47,19 @@ namespace Saga { #define R_MEMFAIL_MSG "Memory allocation error." -/* - * Define opaque types -\*--------------------------------------------------------------------------*/ +// Define opaque types -/* r_rscfile */ +// r_rscfile typedef struct R_RSCFILE_CONTEXT_tag R_RSCFILE_CONTEXT; -/* r_script */ +// r_script typedef struct R_SEMAPHORE_tag R_SEMAPHORE; -/* - * Define common data types -\*--------------------------------------------------------------------------*/ +// Define common data types typedef Common::Point R_POINT; typedef Common::Rect R_RECT; - struct R_COLOR { int red; int green; @@ -85,11 +72,8 @@ struct R_SURFACE { int buf_w; int buf_h; int buf_pitch; - int bpp; - R_RECT clip_rect; - void *impl_src; }; @@ -118,64 +102,47 @@ enum R_ERRORCODE { R_SUCCESS = 0 }; +// r_transitions.c +int TRANSITION_Dissolve(byte *dst_img, int dst_w, int dst_h, + int dst_p, const byte *src_img, int src_p, int flags, double percent); -/* - * r_transitions.c -\*--------------------------------------------------------------------------*/ -int TRANSITION_Dissolve(byte *dst_img, - int dst_w, - int dst_h, - int dst_p, const byte *src_img, int src_p, int flags, double percent); - -/*--------------------------------------------------------------------------*\ - * System specific routines -\*--------------------------------------------------------------------------*/ +// System specific routines -/* - * System : Graphics -\*--------------------------------------------------------------------------*/ +// System : Graphics #define R_PAL_ENTRIES 256 struct R_SYSGFX_INIT { int backbuf_w; int backbuf_h; int backbuf_bpp; - int screen_w; int screen_h; int screen_bpp; }; int SYSGFX_Init(R_SYSGFX_INIT *); - -R_SURFACE *SYSGFX_GetScreenSurface(void); -R_SURFACE *SYSGFX_GetBackBuffer(void); - +R_SURFACE *SYSGFX_GetScreenSurface(); +R_SURFACE *SYSGFX_GetBackBuffer(); int SYSGFX_LockSurface(R_SURFACE *surface); int SYSGFX_UnlockSurface(R_SURFACE *surface); - -int SYSGFX_GetWhite(void); -int SYSGFX_GetBlack(void); +int SYSGFX_GetWhite(); +int SYSGFX_GetBlack(); int SYSGFX_MatchColor(unsigned long colormask); int SYSGFX_SetPalette(R_SURFACE *surface, PALENTRY *pal); int SYSGFX_GetCurrentPal(PALENTRY *src_pal); - int SYSGFX_PalToBlack(R_SURFACE *surface, PALENTRY *src_pal, double percent); - int SYSGFX_BlackToPal(R_SURFACE *surface, PALENTRY *src_pal, double percent); -/* - * System : Input -\*--------------------------------------------------------------------------*/ +// System : Input int SYSINPUT_Init(void); int SYSINPUT_ProcessInput(void); int SYSINPUT_GetMousePos(int *mouse_x, int *mouse_y); int SYSINPUT_HideMouse(void); int SYSINPUT_ShowMouse(void); -/*** sys_signal.c ***/ +// sys_signal.c int ITESYS_CheckSignal(void); } // End of namespace Saga -#endif /* SAGA_REINHERIT_H_ */ +#endif diff --git a/saga/resnames.h b/saga/resnames.h index 01304b94e4..321853fe73 100644 --- a/saga/resnames.h +++ b/saga/resnames.h @@ -20,36 +20,30 @@ * $Header$ * */ -/* - Description: - - Descriptive names for game resource numbers - - Notes: -*/ +// Descriptive names for game resource numbers #ifndef SAGA_RESOURCENAMES_H_ #define SAGA_RESOURCENAMES_H_ namespace Saga { -/* Lookup tables */ +// Lookup tables #define ITE_SCENE_LUT 1806 #define ITE_SCRIPT_LUT 216 #define IHNM_SCENE_LUT 1272 #define IHNM_SCRIPT_LUT 0 -/* SCENES */ +// SCENES #define ITE_DEFAULT_SCENE 32 -/* FONTS */ +// FONTS #define RN_MEDIUM_FONT 0 #define RN_BIG_FONT 1 #define RN_SMALL_FONT 2 -/* INTERFACE IMAGES */ +// INTERFACE IMAGES #define ITE_COMMAND_PANEL 3 #define ITE_DIALOGUE_PANEL 4 @@ -60,7 +54,7 @@ namespace Saga { #define ITE_COMMAND_BUTTONSPRITES 7 #define ITE_DEFAULT_PORTRAITS 125 -/* ITE Scene resource numbers */ +// ITE Scene resource numbers #define ITE_INTRO_ANIM_SCENE 1538 #define ITE_CAVE_SCENE_1 1542 #define ITE_CAVE_SCENE_2 1545 @@ -92,7 +86,7 @@ namespace Saga { #define INTRO_IMG_3 1561 #define INTRO_IMG_4 1565 -/* ITE_VOICES */ +// ITE_VOICES #define CAVE_VOICE_0 0 #define CAVE_VOICE_1 1 #define CAVE_VOICE_2 2 @@ -108,7 +102,7 @@ namespace Saga { #define CAVE_VOICE_12 12 #define CAVE_VOICE_13 13 -/* MUSIC */ +// MUSIC #define MUSIC_1 9 #define MUSIC_2 10 #define MUSIC_3 11 @@ -138,4 +132,4 @@ namespace Saga { } // End of namespace Saga -#endif /* SAGA_RESOURCENAMES_H_ */ +#endif diff --git a/saga/rscfile.cpp b/saga/rscfile.cpp index 712707237d..7110af0be3 100644 --- a/saga/rscfile.cpp +++ b/saga/rscfile.cpp @@ -20,33 +20,19 @@ * $Header$ * */ -/* - Description: - - RSC Resource file management module - - Notes: -*/ +// RSC Resource file management module #include "reinherit.h" #include "yslib.h" -/* - * Uses the following modules: -\*--------------------------------------------------------------------------*/ - -/* - * Begin module -\*--------------------------------------------------------------------------*/ #include "rscfile_mod.h" #include "rscfile.h" namespace Saga { -R_RSCFILE_CONTEXT *RSC_CreateContext(void) -{ +R_RSCFILE_CONTEXT *RSC_CreateContext() { R_RSCFILE_CONTEXT empty_context; empty_context.rc_file_fspec = NULL; empty_context.rc_file_loaded = 0; @@ -64,14 +50,12 @@ R_RSCFILE_CONTEXT *RSC_CreateContext(void) return new_context; } -int RSC_OpenContext(R_RSCFILE_CONTEXT *rsc_context, const char *fspec) -{ +int RSC_OpenContext(R_RSCFILE_CONTEXT *rsc_context, const char *fspec) { if (rsc_context->rc_file.isOpen()) { return R_FAILURE; } if (!rsc_context->rc_file.open(fspec)) { - return R_FAILURE; } @@ -86,8 +70,7 @@ int RSC_OpenContext(R_RSCFILE_CONTEXT *rsc_context, const char *fspec) return R_SUCCESS; } -int RSC_CloseContext(R_RSCFILE_CONTEXT * rsc_context) -{ +int RSC_CloseContext(R_RSCFILE_CONTEXT *rsc_context) { if (rsc_context->rc_file.isOpen()) { rsc_context->rc_file.close(); } @@ -99,8 +82,7 @@ int RSC_CloseContext(R_RSCFILE_CONTEXT * rsc_context) return R_SUCCESS; } -int RSC_DestroyContext(R_RSCFILE_CONTEXT * rsc_context) -{ +int RSC_DestroyContext(R_RSCFILE_CONTEXT *rsc_context) { RSC_CloseContext(rsc_context); if (rsc_context->rc_file_loaded) { @@ -112,8 +94,7 @@ int RSC_DestroyContext(R_RSCFILE_CONTEXT * rsc_context) return R_SUCCESS; } -int RSC_LoadRSC(R_RSCFILE_CONTEXT * rsc) -{ +int RSC_LoadRSC(R_RSCFILE_CONTEXT *rsc) { uint32 res_tbl_ct; uint32 res_tbl_offset; @@ -132,8 +113,7 @@ int RSC_LoadRSC(R_RSCFILE_CONTEXT * rsc) return R_FAILURE; } - /* Read resource table info from the rear end of file - * \*------------------------------------------------------------- */ + // Read resource table info from the rear end of file rsc->rc_file.seek((long)(rsc->rc_file.size() - 8), SEEK_SET); if (rsc->rc_file.read(tblinfo_buf, RSC_TABLEINFO_SIZE) != RSC_TABLEINFO_SIZE) { @@ -143,16 +123,13 @@ int RSC_LoadRSC(R_RSCFILE_CONTEXT * rsc) res_tbl_offset = ys_read_u32_le(read_p, &read_p); res_tbl_ct = ys_read_u32_le(read_p, NULL); - /* Check for sane table offset - * \*------------------------------------------------------------- */ - if (res_tbl_offset != rsc->rc_file.size() - RSC_TABLEINFO_SIZE - - RSC_TABLEENTRY_SIZE * res_tbl_ct) { + // Check for sane table offset + if (res_tbl_offset != rsc->rc_file.size() - RSC_TABLEINFO_SIZE - RSC_TABLEENTRY_SIZE * res_tbl_ct) { return R_FAILURE; } - /* Load resource table - * \*------------------------------------------------------------- */ + // Load resource table tbl_len = RSC_TABLEENTRY_SIZE * res_tbl_ct; tbl_buf = (byte *)malloc(tbl_len); @@ -176,13 +153,9 @@ int RSC_LoadRSC(R_RSCFILE_CONTEXT * rsc) read_p = tbl_buf; for (i = 0; i < res_tbl_ct; i++) { - rsc_restbl[i].res_offset = ys_read_u32_le(read_p, &read_p); rsc_restbl[i].res_size = ys_read_u32_le(read_p, &read_p); - - if ((rsc_restbl[i].res_offset > rsc->rc_file.size()) || - (rsc_restbl[i].res_size > rsc->rc_file.size())) { - + if ((rsc_restbl[i].res_offset > rsc->rc_file.size()) || (rsc_restbl[i].res_size > rsc->rc_file.size())) { free(tbl_buf); free(rsc_restbl); return R_FAILURE; @@ -197,8 +170,7 @@ int RSC_LoadRSC(R_RSCFILE_CONTEXT * rsc) return R_SUCCESS; } -int RSC_FreeRSC(R_RSCFILE_CONTEXT * rsc) -{ +int RSC_FreeRSC(R_RSCFILE_CONTEXT *rsc) { if (!rsc->rc_file_loaded) { return R_FAILURE; } @@ -208,14 +180,11 @@ int RSC_FreeRSC(R_RSCFILE_CONTEXT * rsc) return R_SUCCESS; } -uint32 RSC_GetResourceCount(R_RSCFILE_CONTEXT * rsc) -{ +uint32 RSC_GetResourceCount(R_RSCFILE_CONTEXT *rsc) { return (rsc == NULL) ? 0 : rsc->rc_res_ct; } -int -RSC_GetResourceSize(R_RSCFILE_CONTEXT * rsc, uint32 res_num, uint32 * res_size) -{ +int RSC_GetResourceSize(R_RSCFILE_CONTEXT *rsc, uint32 res_num, uint32 *res_size) { if ((rsc == NULL) || (res_size == NULL)) { return R_FAILURE; } @@ -229,10 +198,7 @@ RSC_GetResourceSize(R_RSCFILE_CONTEXT * rsc, uint32 res_num, uint32 * res_size) return R_SUCCESS; } -int -RSC_GetResourceOffset(R_RSCFILE_CONTEXT * rsc, - uint32 res_num, uint32 * res_offset) -{ +int RSC_GetResourceOffset(R_RSCFILE_CONTEXT *rsc, uint32 res_num, uint32 *res_offset) { if ((rsc == NULL) || (res_offset == NULL)) { return R_FAILURE; } @@ -246,10 +212,7 @@ RSC_GetResourceOffset(R_RSCFILE_CONTEXT * rsc, return R_SUCCESS; } -int -RSC_LoadResource(R_RSCFILE_CONTEXT * rsc, - uint32 res_num, byte ** res_p, size_t * res_size_p) -{ +int RSC_LoadResource(R_RSCFILE_CONTEXT *rsc, uint32 res_num, byte **res_p, size_t *res_size_p) { uint32 res_offset; size_t res_size; byte *res_buf; @@ -286,9 +249,7 @@ RSC_LoadResource(R_RSCFILE_CONTEXT * rsc, return R_SUCCESS; } -int RSC_FreeResource(byte * resource_ptr) -{ - +int RSC_FreeResource(byte *resource_ptr) { free(resource_ptr); return R_SUCCESS; diff --git a/saga/rscfile.h b/saga/rscfile.h index 51a7a01653..2f85ec10fe 100644 --- a/saga/rscfile.h +++ b/saga/rscfile.h @@ -20,14 +20,8 @@ * $Header$ * */ -/* - Description: - - RSC Resource file management header file - - Notes: -*/ +// RSC Resource file management header file #ifndef SAGA_RSCFILE_H__ #define SAGA_RSCFILE_H__ @@ -42,29 +36,22 @@ namespace Saga { #define RSC_MIN_FILESIZE (RSC_TABLEINFO_SIZE + RSC_TABLEENTRY_SIZE + 1) struct R_RSCFILE_RESOURCE { - int res_type; - size_t res_offset; size_t res_size; - }; struct R_RSCFILE_CONTEXT_tag { - const char *rc_file_fspec; File rc_file; - int rc_file_loaded; R_RSCFILE_RESOURCE *rc_res_table; size_t rc_res_ct; - }; -int RSC_LoadRSC(R_RSCFILE_CONTEXT * rsc_context); - -int RSC_FreeRSC(R_RSCFILE_CONTEXT * rsc); +int RSC_LoadRSC(R_RSCFILE_CONTEXT *rsc_context); +int RSC_FreeRSC(R_RSCFILE_CONTEXT *rsc); } // End of namespace Saga -#endif /* SAGA_RSCFILE_H__ */ +#endif diff --git a/saga/rscfile_mod.h b/saga/rscfile_mod.h index 47d56cc744..f3cb2de485 100644 --- a/saga/rscfile_mod.h +++ b/saga/rscfile_mod.h @@ -20,14 +20,8 @@ * $Header$ * */ -/* - Description: - - RSC Resource file management module public header file - - Notes: -*/ +// RSC Resource file management module public header file #ifndef SAGA_RSCFILE_MOD_H__ #define SAGA_RSCFILE_MOD_H__ @@ -36,24 +30,16 @@ namespace Saga { -R_RSCFILE_CONTEXT *RSC_CreateContext(void); - +R_RSCFILE_CONTEXT *RSC_CreateContext(); int RSC_DestroyContext(R_RSCFILE_CONTEXT *); - int RSC_OpenContext(R_RSCFILE_CONTEXT *, const char *); - int RSC_CloseContext(R_RSCFILE_CONTEXT *); - uint32 RSC_GetResourceCount(R_RSCFILE_CONTEXT *); - int RSC_GetResourceSize(R_RSCFILE_CONTEXT *, uint32, uint32 *); - int RSC_GetResourceOffset(R_RSCFILE_CONTEXT *, uint32, uint32 *); - int RSC_LoadResource(R_RSCFILE_CONTEXT *, uint32, byte **, size_t *); - int RSC_FreeResource(byte *); } // End of namespace Saga -#endif /* SAGA_RSCFILE_MOD_H__ */ +#endif diff --git a/saga/saga.cpp b/saga/saga.cpp index 9e25f8b623..101d3a07ad 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -71,7 +71,7 @@ struct SAGAGameSettings { static const SAGAGameSettings saga_settings[] = { /* Inherit the Earth - Original floppy version */ - { "ite", "Inherit the Earth (DOS)", Saga::GID_ITE, + { "ite", "Inherit the Earth (DOS)", Saga::GID_ITE, MDT_ADLIB, "ite.rsc" }, /* Inherit the Earth - CD version */ { "itecd", "Inherit the Earth (DOS CD Version)", Saga::GID_ITECD, @@ -96,7 +96,7 @@ GameList Engine_SAGA_gameList() { DetectedGameList Engine_SAGA_detectGames(const FSList &fslist) { DetectedGameList detectedGames; const SAGAGameSettings *g; - + for (g = saga_settings; g->name; ++g) { // Iterate over all files in the given directory for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { @@ -123,10 +123,8 @@ namespace Saga { #define R_MAX_TIME_DELTA 100 struct R_MAIN_DATA { - int sound_enabled; int music_enabled; - }; static void CF_quitfunc(int argc, char *argv[]); @@ -152,7 +150,6 @@ SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst) } SagaEngine::~SagaEngine() { - } void SagaEngine::errorString(const char *buf1, char *buf2) { @@ -162,9 +159,8 @@ void SagaEngine::errorString(const char *buf1, char *buf2) { void SagaEngine::go() { int msec = 0; - /* Register engine modules - * \*------------------------------------------------------------- */ - CON_Register(); /* Register console cvars first */ + // Register engine modules + CON_Register(); // Register console cvars first RENDER_Register(); GAME_Register(); @@ -179,19 +175,15 @@ void SagaEngine::go() { MainData.sound_enabled = 1; MainData.music_enabled = 1; - CVAR_RegisterFunc(CF_testfunc, - "testfunc", "foo [ optional foo ]", R_CVAR_NONE, 0, -1); + CVAR_RegisterFunc(CF_testfunc, "testfunc", "foo [ optional foo ]", R_CVAR_NONE, 0, -1); - CVAR_Register_I(&MainData.sound_enabled, - "sound", NULL, R_CVAR_CFG, 0, 1); + CVAR_Register_I(&MainData.sound_enabled, "sound", NULL, R_CVAR_CFG, 0, 1); - CVAR_Register_I(&MainData.music_enabled, - "music", NULL, R_CVAR_CFG, 0, 1); + CVAR_Register_I(&MainData.music_enabled, "music", NULL, R_CVAR_CFG, 0, 1); CVAR_RegisterFunc(CF_quitfunc, "quit", NULL, R_CVAR_NONE, 0, 0); - /* Process config file - * \*------------------------------------------------------------- */ + // Process config file // FIXME /* if (CFG_Read(NULL) != R_SUCCESS) { @@ -199,21 +191,15 @@ void SagaEngine::go() { } */ - /* Process command line - * \*------------------------------------------------------------- */ + // Process command line - /* Detect game and open resource files - * \*------------------------------------------------------------- */ + // Detect game and open resource files if (GAME_Init() != R_SUCCESS) { - - R_printf(R_STDERR, - "Couldn't start the game: %s\n", GAME_GetErrS()); - + R_printf(R_STDERR, "Couldn't start the game: %s\n", GAME_GetErrS()); return; } - /* Initialize engine modules - * \*------------------------------------------------------------- */ + // Initialize engine modules _sndRes = new SndRes(this); EVENT_Init(); FONT_Init(); @@ -223,27 +209,24 @@ void SagaEngine::go() { OBJECTMAP_Init(); ISOMAP_Init(); SCRIPT_Init(); - INTERFACE_Init(); /* requires script module */ + INTERFACE_Init(); // requires script module ACTOR_Init(); if (SCENE_Init() != R_SUCCESS) { - R_printf(R_STDERR, "Couldn't initialize scene module.\n"); return; } - /* System initialization - * \*------------------------------------------------------------- */ + // System initialization - /* Must initialize system timer module first */ + // Must initialize system timer module first if (SYSTIMER_InitMSCounter() != R_SUCCESS) { - return; } - /* On some platforms, graphics initialization also initializes sound - * ( Win32 DirectX )... Music must be initialized before sound for - * native midi support */ + // On some platforms, graphics initialization also initializes sound + // ( Win32 DirectX )... Music must be initialized before sound for + // native midi support MidiDriver *driver = GameDetector::createMidi(GameDetector::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE)); if (!driver) driver = MidiDriver_ADLIB_create(_mixer); @@ -257,12 +240,12 @@ void SagaEngine::go() { R_printf(R_STDOUT, "Music disabled.\n"); } - /* Initialize graphics */ + // Initialize graphics if (RENDER_Init() != R_SUCCESS) { return; } - /* Initialize system specific sound */ + // Initialize system specific sound _sound = new Sound(this, _mixer, MainData.sound_enabled); if (!MainData.sound_enabled) { R_printf(R_STDOUT, "Sound disabled.\n"); @@ -272,44 +255,32 @@ void SagaEngine::go() { SYSTIMER_ResetMSCounter(); - /* Begin Main Engine Loop - * \*------------------------------------------------------------- */ + // Begin Main Engine Loop SCENE_Start(); for (;;) { - #ifdef R_USE_CUSTOM_WININIT - if (ITESYS_CheckSignal()) { break; } #endif - if (RENDER_GetFlags() & RF_RENDERPAUSE) { - /* Freeze time while paused */ + // Freeze time while paused SYSTIMER_ResetMSCounter(); } else { msec = SYSTIMER_ReadMSCounter(); - if (msec > R_MAX_TIME_DELTA) { msec = R_MAX_TIME_DELTA; } - ACTOR_Direct(msec); EVENT_HandleEvents(msec); STHREAD_ExecThreads(msec); } - - /* Per frame processing - * \*--------------------------------------------------------- */ + // Per frame processing RENDER_DrawScene(); - SYSTIMER_Sleep(0); - - } /* end main game engine loop */ - - return; + } } void SagaEngine::shutdown() { @@ -319,30 +290,25 @@ void SagaEngine::shutdown() { ANIM_Shutdown(); SPRITE_Shutdown(); OBJECTMAP_Shutdown(); - FONT_Shutdown(); - CON_Shutdown(); CVAR_Shutdown(); EVENT_Shutdown(); delete _sndRes; - - /* Shutdown system modules */ + // Shutdown system modules */ delete _music; delete _sound; _system->quit(); } -static void CF_quitfunc(int argc, char *argv[]) -{ +static void CF_quitfunc(int argc, char *argv[]) { _vm->shutdown(); exit(0); } -static void CF_testfunc(int argc, char *argv[]) -{ +static void CF_testfunc(int argc, char *argv[]) { int i; CON_Print("Test function invoked: Got %d arguments.", argc); @@ -350,8 +316,6 @@ static void CF_testfunc(int argc, char *argv[]) for (i = 0; i < argc; i++) { CON_Print("Arg %d: %s", i, argv[i]); } - - return; } } // End of namespace Saga diff --git a/saga/saga.h b/saga/saga.h index 2221fd433d..7343ff3c06 100644 --- a/saga/saga.h +++ b/saga/saga.h @@ -49,18 +49,18 @@ enum SAGAGameId { class SagaEngine:public Engine { void errorString(const char *buf_input, char *buf_output); - protected: +protected: void go(); - public: +public: SagaEngine(GameDetector * detector, OSystem * syst); virtual ~SagaEngine(); void shutdown(); SndRes *_sndRes; - Sound *_sound; - Music *_music; + Sound *_sound; + Music *_music; }; // FIXME: Global var. We use it until everything will be turned into objects |