diff options
author | Max Horn | 2004-04-25 15:14:46 +0000 |
---|---|---|
committer | Max Horn | 2004-04-25 15:14:46 +0000 |
commit | ae1b03a1f555bad80b82d5ea07fd665cb56973a3 (patch) | |
tree | 0c6da88faf0e08ea4afca9d88ad433686bad66c4 /saga | |
parent | f6a4ed1cff00d813c297f59f9ad2c586da011739 (diff) | |
download | scummvm-rg350-ae1b03a1f555bad80b82d5ea07fd665cb56973a3.tar.gz scummvm-rg350-ae1b03a1f555bad80b82d5ea07fd665cb56973a3.tar.bz2 scummvm-rg350-ae1b03a1f555bad80b82d5ea07fd665cb56973a3.zip |
More ScummVMification
svn-id: r13624
Diffstat (limited to 'saga')
-rw-r--r-- | saga/console.cpp | 8 | ||||
-rw-r--r-- | saga/game.cpp | 22 | ||||
-rw-r--r-- | saga/gfx.cpp | 190 | ||||
-rw-r--r-- | saga/gfx.h | 9 | ||||
-rw-r--r-- | saga/ihnm_introproc.cpp | 10 | ||||
-rw-r--r-- | saga/interface.cpp | 22 | ||||
-rw-r--r-- | saga/isomap.cpp | 6 | ||||
-rw-r--r-- | saga/ite_introproc.cpp | 6 | ||||
-rw-r--r-- | saga/objectmap.cpp | 3 | ||||
-rw-r--r-- | saga/reinherit.h | 21 | ||||
-rw-r--r-- | saga/sprite.cpp | 18 | ||||
-rw-r--r-- | saga/sysgfx.cpp | 32 | ||||
-rw-r--r-- | saga/yslib.h | 11 |
13 files changed, 159 insertions, 199 deletions
diff --git a/saga/console.cpp b/saga/console.cpp index 7bc0272d73..de4b66af12 100644 --- a/saga/console.cpp +++ b/saga/console.cpp @@ -258,11 +258,11 @@ int CON_Draw(R_SURFACE * ds) ConInfo.y_pos = CV_ConResize; } - fill_rect.x1 = 0; - fill_rect.y1 = 0; + fill_rect.top = 0; + fill_rect.left = 0; - fill_rect.x2 = ds->buf_w - 1; - fill_rect.y2 = ConInfo.y_pos; + fill_rect.bottom = ConInfo.y_pos; + fill_rect.right = ds->buf_w - 1; GFX_DrawRect(ds, &fill_rect, SYSGFX_MatchColor(R_CONSOLE_BGCOLOR)); diff --git a/saga/game.cpp b/saga/game.cpp index ae1113c34e..94f9375abe 100644 --- a/saga/game.cpp +++ b/saga/game.cpp @@ -234,10 +234,10 @@ R_GAMEDESC GameDescs[] = { &ITE_Resources, - YS_NELEMS(ITEDEMO_GameFiles), /* Game datafiles */ + ARRAYSIZE(ITEDEMO_GameFiles), /* Game datafiles */ ITEDEMO_GameFiles, - YS_NELEMS(ITEDEMO_GameFonts), + ARRAYSIZE(ITEDEMO_GameFonts), ITEDEMO_GameFonts, &ITEDEMO_GameSound, @@ -260,10 +260,10 @@ R_GAMEDESC GameDescs[] = { &ITE_Resources, - YS_NELEMS(ITEDISK_GameFiles), + ARRAYSIZE(ITEDISK_GameFiles), ITEDISK_GameFiles, - YS_NELEMS(ITEDISK_GameFonts), + ARRAYSIZE(ITEDISK_GameFonts), ITEDISK_GameFonts, &ITE_GameSound, @@ -285,10 +285,10 @@ R_GAMEDESC GameDescs[] = { &ITE_Resources, - YS_NELEMS(ITECD_GameFiles), + ARRAYSIZE(ITECD_GameFiles), ITECD_GameFiles, - YS_NELEMS(ITECD_GameFonts), + ARRAYSIZE(ITECD_GameFonts), ITECD_GameFonts, &ITECD_GameSound, @@ -310,7 +310,7 @@ R_GAMEDESC GameDescs[] = { IHNM_Resources, - YS_NELEMS(IHNMDEMO_GameFiles), + ARRAYSIZE(IHNMDEMO_GameFiles), IHNMDEMO_GameFiles, 0, @@ -335,10 +335,10 @@ R_GAMEDESC GameDescs[] = { IHNM_Resources, - YS_NELEMS(IHNMCD_GameFiles), + ARRAYSIZE(IHNMCD_GameFiles), IHNMCD_GameFiles, - YS_NELEMS(IHNMCD_GameFonts), + ARRAYSIZE(IHNMCD_GameFonts), IHNMCD_GameFonts, &IHNM_GameSound, @@ -542,7 +542,7 @@ int GAME_GetFileContext(R_RSCFILE_CONTEXT ** ctxt_p, uint r_type, int param) int DetectGame(const char *game_dir, uint * game_n_p) { - uint game_count = YS_NELEMS(GameDescs); + uint game_count = ARRAYSIZE(GameDescs); uint game_n; uint file_count; @@ -609,7 +609,7 @@ int LoadGame(const char *game_dir, uint game_n) R_RSCFILE_CONTEXT *load_ctxt; - uint game_count = YS_NELEMS(GameDescs); + uint game_count = ARRAYSIZE(GameDescs); const char *game_fname; uint game_filect; diff --git a/saga/gfx.cpp b/saga/gfx.cpp index 5f03cc6341..00f649a099 100644 --- a/saga/gfx.cpp +++ b/saga/gfx.cpp @@ -87,13 +87,13 @@ int GFX_DrawPalette(R_SURFACE * dst_s) for (y = 0; y < 16; y++) { - pal_rect.y1 = (y * 8) + 4; - pal_rect.y2 = pal_rect.y1 + 8; + pal_rect.top = (y * 8) + 4; + pal_rect.bottom = pal_rect.top + 8; for (x = 0; x < 16; x++) { - pal_rect.x1 = (x * 8) + 4; - pal_rect.x2 = pal_rect.x1 + 8; + pal_rect.left = (x * 8) + 4; + pal_rect.right = pal_rect.left + 8; GFX_DrawRect(dst_s, &pal_rect, color); color++; @@ -267,12 +267,12 @@ GFX_BufToSurface(R_SURFACE * ds, * \*------------------------------------------------------------- */ if (src_rect != NULL) { - R_CLAMP_RECT(src_rect, 0, (src_w - 1), 0, (src_h - 1)); + src_rect->clip(src_w - 1, src_h - 1); - s_x1 = src_rect->x1; - s_y1 = src_rect->y1; - s_x2 = src_rect->x2; - s_y2 = src_rect->y2; + s_x1 = src_rect->left; + s_y1 = src_rect->top; + s_x2 = src_rect->right; + s_y2 = src_rect->bottom; if ((s_x1 >= s_x2) || (s_y1 >= s_y2)) { /* Empty or negative region */ @@ -295,10 +295,10 @@ GFX_BufToSurface(R_SURFACE * ds, d_y = 0; } - clip_x1 = ds->clip_rect.x1; - clip_y1 = ds->clip_rect.y1; - clip_x2 = ds->clip_rect.x2; - clip_y2 = ds->clip_rect.y2; + clip_x1 = ds->clip_rect.left; + clip_y1 = ds->clip_rect.top; + clip_x2 = ds->clip_rect.right; + clip_y2 = ds->clip_rect.bottom; if (clip_x1 == clip_x2) { clip_x1 = 0; @@ -413,12 +413,12 @@ GFX_BufToBuffer(uchar * dst_buf, * \*------------------------------------------------------------- */ if (src_rect != NULL) { - R_CLAMP_RECT(src_rect, 0, (src_w - 1), 0, (src_h - 1)); + src_rect->clip(src_w - 1, src_h - 1); - s_x1 = src_rect->x1; - s_y1 = src_rect->y1; - s_x2 = src_rect->x2; - s_y2 = src_rect->y2; + s_x1 = src_rect->left; + s_y1 = src_rect->top; + s_x2 = src_rect->right; + s_y2 = src_rect->bottom; if ((s_x1 >= s_x2) || (s_y1 >= s_y2)) { /* Empty or negative region */ @@ -546,21 +546,21 @@ int GFX_DrawCursor(R_SURFACE * ds, R_POINT * p1) R_RECT cur_rect; /* Clamp point to surface */ - cur_pt.x = MAX(p1->x, 0); - cur_pt.y = MAX(p1->y, 0); + cur_pt.x = MAX(p1->x, (int16)0); + cur_pt.y = MAX(p1->y, (int16)0); - cur_pt.x = MIN(p1->x, ds->buf_w - 1); - cur_pt.y = MIN(p1->y, ds->buf_h - 1); + cur_pt.x = MIN(p1->x, (int16)(ds->buf_w - 1)); + cur_pt.y = MIN(p1->y, (int16)(ds->buf_h - 1)); cur_pt.x -= R_CURSOR_ORIGIN_X; cur_pt.y -= R_CURSOR_ORIGIN_Y; /* Clip cursor to surface */ - cur_rect.x1 = 0; - cur_rect.y1 = 0; - cur_rect.x2 = R_CURSOR_W - 1; - cur_rect.y2 = R_CURSOR_H - 1; + cur_rect.left = 0; + cur_rect.top = 0; + cur_rect.right = R_CURSOR_W - 1; + cur_rect.bottom = R_CURSOR_H - 1; ci.dst_rect = &ds->clip_rect; ci.src_rect = &cur_rect; @@ -606,32 +606,32 @@ int GFX_DrawRect(R_SURFACE * ds, R_RECT * dst_rect, int color) int h; int row; - int x1, y1, x2, y2; + int left, top, right, bottom; if (dst_rect != NULL) { - R_CLAMP_RECT(dst_rect, 0, (ds->buf_w - 1), 0, (ds->buf_h - 1)); + dst_rect->clip(ds->buf_w - 1, ds->buf_h - 1); - x1 = dst_rect->x1; - y1 = dst_rect->y1; - x2 = dst_rect->x2; - y2 = dst_rect->y2; + left = dst_rect->left; + top = dst_rect->top; + right = dst_rect->right; + bottom = dst_rect->bottom; - if ((x1 >= x2) || (y1 >= y2)) { + if ((left >= right) || (top >= bottom)) { /* Empty or negative region */ return R_FAILURE; } } else { - x1 = 0; - y1 = 0; - x2 = ds->buf_w - 1; - y2 = ds->buf_h - 1; + left = 0; + top = 0; + right = ds->buf_w - 1; + bottom = ds->buf_h - 1; } - w = (x2 - x1) + 1; - h = (y2 - y1) + 1; + w = (right - left) + 1; + h = (bottom - top) + 1; - write_p = ds->buf + (ds->buf_pitch * y1) + x1; + write_p = ds->buf + (ds->buf_pitch * top) + left; for (row = 0; row < h; row++) { memset(write_p, color, w); @@ -643,7 +643,7 @@ int GFX_DrawRect(R_SURFACE * ds, R_RECT * dst_rect, int color) int GFX_DrawFrame(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color) { - int x1, y1, x2, y2; + int left, top, right, bottom; int min_x; int max_x; @@ -657,15 +657,15 @@ int GFX_DrawFrame(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color) assert((ds != NULL) && (p1 != NULL) && (p2 != NULL)); - x1 = p1->x; - y1 = p1->y; - x2 = p2->x; - y2 = p2->y; + left = p1->x; + top = p1->y; + right = p2->x; + bottom = p2->y; - min_x = MIN(x1, x2); - min_y = MIN(y1, y2); - max_x = MAX(x1, x2); - max_y = MAX(y1, y2); + min_x = MIN(left, right); + min_y = MIN(top, bottom); + max_x = MAX(left, right); + max_y = MAX(top, bottom); n_p1.x = min_x; n_p1.y = min_y; @@ -728,15 +728,15 @@ int GFX_GetClipInfo(R_CLIPINFO * clipinfo) d_y = 0; } - s_x1 = clipinfo->src_rect->x1; - s_y1 = clipinfo->src_rect->y1; - s_x2 = clipinfo->src_rect->x2; - s_y2 = clipinfo->src_rect->y2; + s_x1 = clipinfo->src_rect->left; + s_y1 = clipinfo->src_rect->top; + s_x2 = clipinfo->src_rect->right; + s_y2 = clipinfo->src_rect->bottom; - clip_x1 = clipinfo->dst_rect->x1; - clip_y1 = clipinfo->dst_rect->y1; - clip_x2 = clipinfo->dst_rect->x2; - clip_y2 = clipinfo->dst_rect->y2; + clip_x1 = clipinfo->dst_rect->left; + clip_y1 = clipinfo->dst_rect->top; + clip_x2 = clipinfo->dst_rect->right; + clip_y2 = clipinfo->dst_rect->bottom; /* Clip source rectangle to destination surface * \*------------------------------------------------------------- */ @@ -820,16 +820,16 @@ GFX_ClipLine(R_SURFACE * ds, const R_POINT *n_p2; int clip_x1, clip_y1, clip_x2, clip_y2; - int x1, y1, x2, y2; + int left, top, right, bottom; int dx, dy; float m; int y_icpt_l, y_icpt_r; - clip_x1 = ds->clip_rect.x1; - clip_y1 = ds->clip_rect.y1; - clip_x2 = ds->clip_rect.x2; - clip_y2 = ds->clip_rect.y2; + clip_x1 = ds->clip_rect.left; + clip_y1 = ds->clip_rect.top; + clip_x2 = ds->clip_rect.right; + clip_y2 = ds->clip_rect.bottom; /* Normalize points by x */ if (src_p1->x < src_p2->x) { @@ -846,40 +846,40 @@ GFX_ClipLine(R_SURFACE * ds, dst_p2->x = n_p2->x; dst_p2->y = n_p2->y; - x1 = n_p1->x; - y1 = n_p1->y; + left = n_p1->x; + top = n_p1->y; - x2 = n_p2->x; - y2 = n_p2->y; + right = n_p2->x; + bottom = n_p2->y; - dx = x2 - x1; - dy = y2 - y1; + dx = right - left; + dy = bottom - top; - if (x1 < 0) { + if (left < 0) { - if (x2 < 0) { + if (right < 0) { /* Line completely off left edge */ return -1; } /* Clip to left edge */ - m = ((float)y2 - y1) / (x2 - x1); - y_icpt_l = (int)(y1 - (x1 * m) + 0.5f); + m = ((float)bottom - top) / (right - left); + y_icpt_l = (int)(top - (left * m) + 0.5f); dst_p1->x = 0; dst_p1->y = y_icpt_l; } - if (y2 > clip_x2) { + if (bottom > clip_x2) { - if (x1 > clip_x2) { + if (left > clip_x2) { /* Line completely off right edge */ return -1; } /* Clip to right edge */ - m = ((float)y1 - y2) / (x2 - x1); - y_icpt_r = (int)(y1 - ((clip_x2 - x1) * m) + 0.5f); + m = ((float)top - bottom) / (right - left); + y_icpt_r = (int)(top - ((clip_x2 - left) * m) + 0.5f); dst_p1->y = y_icpt_r; dst_p2->x = clip_x2; @@ -916,7 +916,7 @@ void GFX_DrawLine(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color) int end_run; R_POINT clip_p1, clip_p2; - int x1, y1, x2, y2; + int left, top, right, bottom; int i, k; clip_result = GFX_ClipLine(ds, p1, p2, &clip_p1, &clip_p2); @@ -925,38 +925,38 @@ void GFX_DrawLine(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color) return; } - x1 = clip_p1.x; - y1 = clip_p1.y; + left = clip_p1.x; + top = clip_p1.y; - x2 = clip_p2.x; - y2 = clip_p2.y; + right = clip_p2.x; + bottom = clip_p2.y; - if ((x1 < ds->clip_rect.x1) || (x2 < ds->clip_rect.x1) || - (x1 > ds->clip_rect.x2) || (x2 > ds->clip_rect.x2)) { + if ((left < ds->clip_rect.left) || (right < ds->clip_rect.left) || + (left > ds->clip_rect.right) || (right > ds->clip_rect.right)) { return; } - if ((y1 < ds->clip_rect.y1) || (y2 < ds->clip_rect.y1) || - (y1 > ds->clip_rect.y2) || (y2 > ds->clip_rect.y2)) { + if ((top < ds->clip_rect.top) || (bottom < ds->clip_rect.top) || + (top > ds->clip_rect.bottom) || (bottom > ds->clip_rect.bottom)) { return; } - if (y1 > y2) { + if (top > bottom) { - temp = y1; - y1 = y2; - y2 = temp; + temp = top; + top = bottom; + bottom = temp; - temp = x1; - x1 = x2; - x2 = temp; + temp = left; + left = right; + right = temp; } - write_p = ds->buf + (y1 * ds->buf_pitch) + x1; + write_p = ds->buf + (top * ds->buf_pitch) + left; - dx = x2 - x1; + dx = right - left; if (dx < 0) { x_vector = -1; @@ -965,7 +965,7 @@ void GFX_DrawLine(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color) x_vector = 1; } - dy = y2 - y1; + dy = bottom - top; if (dx == 0) { for (i = 0; i <= dy; i++) { diff --git a/saga/gfx.h b/saga/gfx.h index 99389e91d2..26d3fbdb3a 100644 --- a/saga/gfx.h +++ b/saga/gfx.h @@ -39,15 +39,6 @@ namespace Saga { #define R_CURSOR_ORIGIN_X 4 #define R_CURSOR_ORIGIN_Y 4 -#define R_CLAMP(a, min, max) \ - (a = (a < (min)) ? (min) : ((a > max) ? (max) : a )) - -#define R_CLAMP_RECT( rect, xmin, xmax, ymin, ymax ) \ - R_CLAMP( rect->x1, xmin, xmax ); \ - R_CLAMP( rect->x2, xmin, xmax ); \ - R_CLAMP( rect->y1, ymin, ymax ); \ - R_CLAMP( rect->y2, ymin, ymax ) - } // End of namespace Saga #endif /* R_GFX_H_ */ diff --git a/saga/ihnm_introproc.cpp b/saga/ihnm_introproc.cpp index a87d74ae05..24fe2f82ba 100644 --- a/saga/ihnm_introproc.cpp +++ b/saga/ihnm_introproc.cpp @@ -67,7 +67,7 @@ R_SCENE_DESC IHNM_IntroMovie1Desc = { 0, 0, 0, 0, 0, 0, 0, 0, IHNM_IntroMovie1RL, - YS_NELEMS(IHNM_IntroMovie1RL) + ARRAYSIZE(IHNM_IntroMovie1RL) }; @@ -82,7 +82,7 @@ R_SCENE_DESC IHNM_IntroMovie2Desc = { 0, 0, 0, 0, 0, 0, 0, 0, IHNM_IntroMovie2RL, - YS_NELEMS(IHNM_IntroMovie2RL) + ARRAYSIZE(IHNM_IntroMovie2RL) }; @@ -97,7 +97,7 @@ R_SCENE_DESC IHNM_IntroMovie3Desc = { 0, 0, 0, 0, 0, 0, 0, 0, IHNM_IntroMovie3RL, - YS_NELEMS(IHNM_IntroMovie3RL) + ARRAYSIZE(IHNM_IntroMovie3RL) }; @@ -112,7 +112,7 @@ R_SCENE_DESC IHNM_IntroMovie4Desc = { 0, 0, 0, 0, 0, 0, 0, 0, IHNM_IntroMovie4RL, - YS_NELEMS(IHNM_IntroMovie4RL) + ARRAYSIZE(IHNM_IntroMovie4RL) }; @@ -131,7 +131,7 @@ int IHNM_StartProc(void) size_t n_introscenes; size_t i; - n_introscenes = YS_NELEMS(IHNM_IntroList); + n_introscenes = ARRAYSIZE(IHNM_IntroList); for (i = 0; i < n_introscenes; i++) { diff --git a/saga/interface.cpp b/saga/interface.cpp index 22b02db58a..2d7bb99688 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -141,7 +141,7 @@ int INTERFACE_RegisterLang(void) { size_t i; - for (i = 0; i < YS_NELEMS(I_VerbData); i++) { + for (i = 0; i < ARRAYSIZE(I_VerbData); i++) { if (CVAR_Register_S(I_VerbData[i].verb_str, I_VerbData[i].verb_cvar, @@ -196,14 +196,14 @@ int INTERFACE_Init(void) /* Load Inherit the Earth interface desc */ IfModule.c_panel.buttons = ITE_c_buttons; - IfModule.c_panel.nbuttons = YS_NELEMS(ITE_c_buttons); + IfModule.c_panel.nbuttons = ARRAYSIZE(ITE_c_buttons); IfModule.i_desc = ITE_interface; } else if (game_type == R_GAMETYPE_IHNM) { /* Load I Have No Mouth interface desc */ IfModule.c_panel.buttons = IHNM_c_buttons; - IfModule.c_panel.nbuttons = YS_NELEMS(IHNM_c_buttons); + IfModule.c_panel.nbuttons = ARRAYSIZE(IHNM_c_buttons); IfModule.i_desc = IHNM_interface; } else { @@ -318,11 +318,11 @@ int INTERFACE_Draw(void) /* Erase background of status bar * \*------------------------------------------------------------- */ - rect.x1 = 0; - rect.y1 = IfModule.i_desc.status_y; + rect.left = 0; + rect.top = IfModule.i_desc.status_y; - rect.x2 = g_di.logical_w - 1; - rect.y2 = IfModule.i_desc.status_h - 1; + rect.right = g_di.logical_w - 1; + rect.bottom = IfModule.i_desc.status_h - 1; GFX_DrawRect(back_buf, &rect, IfModule.i_desc.status_bgcol); @@ -435,10 +435,10 @@ int DrawStatusBar(R_SURFACE * ds) /* Erase background of status bar * \*------------------------------------------------------------- */ - rect.x1 = 0; - rect.y1 = IfModule.i_desc.status_y; - rect.x2 = g_di.logical_w - 1; - rect.y2 = IfModule.i_desc.status_y + IfModule.i_desc.status_h - 1; + rect.left = 0; + rect.top = IfModule.i_desc.status_y; + rect.right = g_di.logical_w - 1; + rect.bottom = IfModule.i_desc.status_y + IfModule.i_desc.status_h - 1; GFX_DrawRect(ds, &rect, IfModule.i_desc.status_bgcol); diff --git a/saga/isomap.cpp b/saga/isomap.cpp index 0f895b8082..12228efa54 100644 --- a/saga/isomap.cpp +++ b/saga/isomap.cpp @@ -176,14 +176,10 @@ int ISOMAP_Draw(R_SURFACE * dst_s) { R_GAME_DISPLAYINFO disp_info; - R_RECT iso_rect; GAME_GetDisplayInfo(&disp_info); - iso_rect.x1 = 0; - iso_rect.y1 = 0; - iso_rect.x2 = disp_info.logical_w - 1; - iso_rect.y2 = disp_info.scene_h - 1; + R_RECT iso_rect(disp_info.logical_w - 1, disp_info.scene_h - 1); GFX_DrawRect(dst_s, &iso_rect, 0); diff --git a/saga/ite_introproc.cpp b/saga/ite_introproc.cpp index e1c5bd0b1b..7aa485009c 100644 --- a/saga/ite_introproc.cpp +++ b/saga/ite_introproc.cpp @@ -136,7 +136,7 @@ int ITE_StartProc(void) R_SCENE_QUEUE first_scene; R_GAME_SCENEDESC gs_desc; - n_introscenes = YS_NELEMS(ITE_IntroList); + n_introscenes = ARRAYSIZE(ITE_IntroList); for (i = 0; i < n_introscenes; i++) { @@ -160,7 +160,7 @@ int ITE_IntroRegisterLang(void) size_t i; - for (i = 0; i < YS_NELEMS(IntroDiag); i++) { + for (i = 0; i < ARRAYSIZE(IntroDiag); i++) { if (CVAR_Register_S(IntroDiag[i].i_str, IntroDiag[i].i_cvar_name, @@ -914,7 +914,7 @@ int ITE_IntroTreeHouseProc(int param, R_SCENE_INFO * scene_info) "Allison Hershey", MEDIUM_FONT_ID} }; - int n_credits = YS_NELEMS(credits); + int n_credits = ARRAYSIZE(credits); int event_delay = 0; diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp index a458fa346d..c19891179a 100644 --- a/saga/objectmap.cpp +++ b/saga/objectmap.cpp @@ -237,7 +237,6 @@ int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len) * Loads an object name list resource \*--------------------------------------------------------------------------*/ { - YS_REG_FUNC(OBJECTMAP_LoadNames); const unsigned char *read_p = onl_res; int table_len; @@ -259,7 +258,7 @@ int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len) #if 0 # if R_OBJECTMAP_DEBUG >= R_DEBUG_INFO - R_printf(R_STDOUT, "%s: Loading %d object names.\n", YS_FUNC, n_names); + R_printf(R_STDOUT, "OBJECTMAP_LoadNames: Loading %d object names.\n", n_names); # endif #endif OMInfo.names = (const char **)malloc(n_names * sizeof *OMInfo.names); diff --git a/saga/reinherit.h b/saga/reinherit.h index fe049726d8..2790da77f4 100644 --- a/saga/reinherit.h +++ b/saga/reinherit.h @@ -33,6 +33,7 @@ #include "common/stdafx.h" #include "common/scummsys.h" +#include "common/rect.h" #include "base/engine.h" @@ -78,24 +79,9 @@ typedef unsigned long ulong; typedef unsigned int uint; #endif -struct R_POINT { +typedef Common::Point R_POINT; +typedef Common::Rect R_RECT; - int x; - int y; - -}; - -struct R_RECT { - - int x1; - int y1; - int x2; - int y2; - -}; - -#define R_MAKERECT( rect, x1, y1, x2, y2 ) \ - ( rect.x1 = x1, rect.y1 = y1, rect.x2 = x2, rect.y2 = y2, &rect ) struct R_COLOR { @@ -171,7 +157,6 @@ enum R_ERRORCODE { /* * r_main.c \*--------------------------------------------------------------------------*/ -int main(int argc, char *argv[]); void R_Shutdown(int param); diff --git a/saga/sprite.cpp b/saga/sprite.cpp index 9325a285c2..9eec66e78b 100644 --- a/saga/sprite.cpp +++ b/saga/sprite.cpp @@ -420,15 +420,15 @@ SPRITE_DrawOccluded(R_SURFACE * ds, SCENE_GetBGMaskInfo(&mask_w, &mask_h, &mask_buf, &mask_buf_len); - spr_src_rect.x1 = 0; - spr_src_rect.y1 = 0; - spr_src_rect.x2 = s_width - 1; - spr_src_rect.y2 = s_height - 1; - - spr_dst_rect.x1 = 0; - spr_dst_rect.y1 = 0; - spr_dst_rect.x2 = ds->clip_rect.x2; - spr_dst_rect.y2 = MIN(ds->clip_rect.y2, mask_h - 1); + spr_src_rect.left = 0; + spr_src_rect.top = 0; + spr_src_rect.right = s_width - 1; + spr_src_rect.bottom = s_height - 1; + + spr_dst_rect.left = 0; + spr_dst_rect.top = 0; + spr_dst_rect.right = ds->clip_rect.right; + spr_dst_rect.bottom = MIN(ds->clip_rect.bottom, (int16)(mask_h - 1)); spr_pt.x = spr_x + x_align; spr_pt.y = spr_y + y_align; diff --git a/saga/sysgfx.cpp b/saga/sysgfx.cpp index bcdcd6dc6d..ecc7a335e8 100644 --- a/saga/sysgfx.cpp +++ b/saga/sysgfx.cpp @@ -96,10 +96,10 @@ int SYSGFX_Init(R_SYSGFX_INIT * gfx_init) r_screen.buf_pitch = sdl_screen->pitch; r_screen.bpp = gfx_init->screen_bpp; - r_screen.clip_rect.x1 = 0; - r_screen.clip_rect.y1 = 0; - r_screen.clip_rect.x2 = sdl_screen->w - 1; - r_screen.clip_rect.y2 = sdl_screen->h - 1; + r_screen.clip_rect.left = 0; + r_screen.clip_rect.top = 0; + r_screen.clip_rect.right = sdl_screen->w - 1; + r_screen.clip_rect.bottom = sdl_screen->h - 1; r_screen.impl_src = sdl_screen; @@ -128,10 +128,10 @@ int SYSGFX_Init(R_SYSGFX_INIT * gfx_init) r_back_buf.buf_pitch = sdl_back_buf->pitch; r_back_buf.bpp = gfx_init->backbuf_bpp; - r_back_buf.clip_rect.x1 = 0; - r_back_buf.clip_rect.y1 = 0; - r_back_buf.clip_rect.x2 = sdl_back_buf->w - 1; - r_back_buf.clip_rect.y2 = sdl_back_buf->h - 1; + r_back_buf.clip_rect.left = 0; + r_back_buf.clip_rect.top = 0; + r_back_buf.clip_rect.right = sdl_back_buf->w - 1; + r_back_buf.clip_rect.bottom = sdl_back_buf->h - 1; r_back_buf.impl_src = sdl_back_buf; @@ -199,10 +199,10 @@ R_SURFACE *SYSGFX_FormatToDisplay(R_SURFACE * surface) new_r_surface->buf_pitch = new_sdl_surface->pitch; new_r_surface->bpp = new_sdl_surface->format->BitsPerPixel; - new_r_surface->clip_rect.x1 = 0; - new_r_surface->clip_rect.y1 = 0; - new_r_surface->clip_rect.x2 = new_sdl_surface->w - 1; - new_r_surface->clip_rect.y2 = new_sdl_surface->h - 1; + new_r_surface->clip_rect.left = 0; + new_r_surface->clip_rect.top = 0; + new_r_surface->clip_rect.right = new_sdl_surface->w - 1; + new_r_surface->clip_rect.bottom = new_sdl_surface->h - 1; new_r_surface->impl_src = new_sdl_surface; @@ -235,10 +235,10 @@ R_SURFACE *SYSGFX_CreateSurface(int w, int h, int bpp) new_surface->buf_pitch = new_sdl_surface->pitch; new_surface->bpp = new_sdl_surface->format->BitsPerPixel; - new_surface->clip_rect.x1 = 0; - new_surface->clip_rect.y1 = 0; - new_surface->clip_rect.x2 = w - 1; - new_surface->clip_rect.y2 = h - 1; + new_surface->clip_rect.left = 0; + new_surface->clip_rect.top = 0; + new_surface->clip_rect.right = w - 1; + new_surface->clip_rect.bottom = h - 1; new_surface->impl_src = new_sdl_surface; diff --git a/saga/yslib.h b/saga/yslib.h index 82d231606d..ca1e4926fa 100644 --- a/saga/yslib.h +++ b/saga/yslib.h @@ -48,17 +48,6 @@ typedef int (YS_COMPARE_FUNC) (const void *, const void *); /* Ignore a parameter (Supress warnings) */ #define YS_IGNORE_PARAM( param ) ( void )( param ) -/* Calculate the number of elements in an array */ -#define YS_NELEMS( arr ) (( sizeof arr ) / ( sizeof *arr )) - -#define YS_DUMMY_DECL /* C99 permits statements before declarations */ - -#define YS_REG_FUNC( arr ) YS_DUMMY_DECL -#define YS_FUNC __func__ - -#define YS_FLEX_ARRAY -#define YS_FLEX_ARRAY_MOD 0 - /* ys_binread.c : Binary input functions (buffer oriented) \*------------------------------------------------------------------*/ |