diff options
-rw-r--r-- | saga/gfx.cpp | 132 | ||||
-rw-r--r-- | saga/interface.cpp | 137 | ||||
-rw-r--r-- | saga/reinherit.h | 32 |
3 files changed, 74 insertions, 227 deletions
diff --git a/saga/gfx.cpp b/saga/gfx.cpp index 7743f5e7ec..13034d161c 100644 --- a/saga/gfx.cpp +++ b/saga/gfx.cpp @@ -49,9 +49,7 @@ namespace Saga { -int GFX_ClearSurface(char *buf, int w, int h, int p) -{ - +int GFX_ClearSurface(char *buf, int w, int h, int p) { int y; for (y = 0; y < h; y++) { @@ -62,9 +60,7 @@ int GFX_ClearSurface(char *buf, int w, int h, int p) return R_SUCCESS; } -int GFX_ClearSurface16(char *buf, int w, int h, int p) -{ - +int GFX_ClearSurface16(char *buf, int w, int h, int p) { int y; w <<= 1; @@ -76,8 +72,7 @@ int GFX_ClearSurface16(char *buf, int w, int h, int p) return R_SUCCESS; } -int GFX_DrawPalette(R_SURFACE * dst_s) -{ +int GFX_DrawPalette(R_SURFACE *dst_s) { int x; int y; @@ -86,12 +81,10 @@ int GFX_DrawPalette(R_SURFACE * dst_s) R_RECT pal_rect; for (y = 0; y < 16; y++) { - pal_rect.top = (y * 8) + 4; pal_rect.bottom = pal_rect.top + 8; for (x = 0; x < 16; x++) { - pal_rect.left = (x * 8) + 4; pal_rect.right = pal_rect.left + 8; @@ -103,8 +96,7 @@ int GFX_DrawPalette(R_SURFACE * dst_s) return 0; } -int GFX_SimpleBlit(R_SURFACE * dst_s, R_SURFACE * src_s) -{ +int GFX_SimpleBlit(R_SURFACE *dst_s, R_SURFACE *src_s) { uchar *src_p; uchar *dst_p; int y, w, p; @@ -120,7 +112,6 @@ int GFX_SimpleBlit(R_SURFACE * dst_s, R_SURFACE * src_s) p = src_s->buf_pitch; for (y = 0; y < src_s->buf_h; y++) { - memcpy(dst_p, src_p, w); dst_p += p; @@ -130,14 +121,11 @@ int GFX_SimpleBlit(R_SURFACE * dst_s, R_SURFACE * src_s) return R_SUCCESS; } -int GFX_Scale2x(R_SURFACE * dst_s, R_SURFACE * src_s) -{ - +int GFX_Scale2x(R_SURFACE *dst_s, R_SURFACE *src_s) { assert((dst_s != NULL) && (src_s != NULL)); assert((dst_s->bpp == src_s->bpp)); switch (dst_s->bpp) { - case 8: return GFX_Scale2x8(dst_s, src_s); break; @@ -154,9 +142,7 @@ int GFX_Scale2x(R_SURFACE * dst_s, R_SURFACE * src_s) return R_FAILURE; } -int GFX_Scale2x8(R_SURFACE * dst_s, R_SURFACE * src_s) -{ - +int GFX_Scale2x8(R_SURFACE *dst_s, R_SURFACE *src_s) { int y, x; int src_skip = src_s->buf_pitch - src_s->buf_w; @@ -172,7 +158,6 @@ int GFX_Scale2x8(R_SURFACE * dst_s, R_SURFACE * src_s) assert(dst_s->buf_h == (src_s->buf_h * 2)); for (y = 0; y < src_s->buf_h; y++) { - src_row = src_ptr; dst_row = dst_ptr; @@ -192,8 +177,7 @@ int GFX_Scale2x8(R_SURFACE * dst_s, R_SURFACE * src_s) return R_SUCCESS; } -int GFX_Scale2x16(R_SURFACE * dst_s, R_SURFACE * src_s) -{ +int GFX_Scale2x16(R_SURFACE *dst_s, R_SURFACE *src_s) { int y, x; int src_skip; @@ -211,7 +195,6 @@ int GFX_Scale2x16(R_SURFACE * dst_s, R_SURFACE * src_s) dest_skip = (dst_s->buf_pitch - dst_s->buf_w) / sizeof(short); for (y = 0; y < src_s->buf_h; y++) { - src_row = (short *)src_ptr; dest_row = (short *)dest_ptr; @@ -232,10 +215,6 @@ int GFX_Scale2x16(R_SURFACE * dst_s, R_SURFACE * src_s) return R_SUCCESS; } -int -GFX_BufToSurface(R_SURFACE * ds, - const uchar * src, - int src_w, int src_h, R_RECT * src_rect, R_POINT * dst_pt) /*--------------------------------------------------------------------------*\ * Copies a rectangle from a raw 8 bit pixel buffer to the specified surface. * The buffer is of width 'src_w' and height 'src_h'. The rectangle to be @@ -247,8 +226,8 @@ GFX_BufToSurface(R_SURFACE * ds, * - The surface must match the logical dimensions of the buffer exactly. * - Returns R_FAILURE on error \*--------------------------------------------------------------------------*/ -{ - +int GFX_BufToSurface(R_SURFACE *ds, const uchar *src, int src_w, int src_h, + R_RECT *src_rect, R_POINT *dst_pt) { const uchar *read_p; uchar *write_p; @@ -263,10 +242,8 @@ GFX_BufToSurface(R_SURFACE * ds, int src_off_x, src_off_y; int src_draw_w, src_draw_h; - /* Clamp source rectangle to source buffer - * \*------------------------------------------------------------- */ + /* Clamp source rectangle to source buffer */ if (src_rect != NULL) { - src_rect->clip(src_w - 1, src_h - 1); s = *src_rect; @@ -282,8 +259,7 @@ GFX_BufToSurface(R_SURFACE * ds, s.bottom = src_h - 1; } - /* Get destination origin and clip rectangle - * \*------------------------------------------------------------- */ + /* Get destination origin and clip rectangle */ if (dst_pt != NULL) { d_x = dst_pt->x; d_y = dst_pt->y; @@ -304,8 +280,7 @@ GFX_BufToSurface(R_SURFACE * ds, clip.bottom = ds->buf_h - 1; } - /* Clip source rectangle to destination surface - * \*------------------------------------------------------------- */ + /* Clip source rectangle to destination surface */ dst_off_x = d_x; dst_off_y = d_y; src_off_x = s.left; @@ -363,13 +338,11 @@ GFX_BufToSurface(R_SURFACE * ds, src_draw_h -= (clip.bottom - (d_y + src_draw_h - 1)); } - /* Transfer buffer data to surface - * \*------------------------------------------------------------- */ + /* Transfer buffer data to surface */ read_p = (src + src_off_x) + (src_w * src_off_y); write_p = (ds->buf + dst_off_x) + (ds->buf_pitch * dst_off_y); for (row = 0; row < src_draw_h; row++) { - memcpy(write_p, read_p, src_draw_w); write_p += ds->buf_pitch; @@ -379,16 +352,8 @@ GFX_BufToSurface(R_SURFACE * ds, return R_SUCCESS; } -int -GFX_BufToBuffer(uchar * dst_buf, - int dst_w, - int dst_h, - const uchar * src, - int src_w, int src_h, R_RECT * src_rect, R_POINT * dst_pt) -/*--------------------------------------------------------------------------*\ -\*--------------------------------------------------------------------------*/ -{ - +int GFX_BufToBuffer(uchar *dst_buf, int dst_w, int dst_h, const uchar *src, + int src_w, int src_h, R_RECT *src_rect, R_POINT *dst_pt) { const uchar *read_p; uchar *write_p; @@ -403,10 +368,8 @@ GFX_BufToBuffer(uchar * dst_buf, int src_off_x, src_off_y; int src_draw_w, src_draw_h; - /* Clamp source rectangle to source buffer - * \*------------------------------------------------------------- */ + /* Clamp source rectangle to source buffer */ if (src_rect != NULL) { - src_rect->clip(src_w - 1, src_h - 1); s.left = src_rect->left; @@ -425,8 +388,7 @@ GFX_BufToBuffer(uchar * dst_buf, s.bottom = src_h - 1; } - /* Get destination origin and clip rectangle - * \*------------------------------------------------------------- */ + /* Get destination origin and clip rectangle */ if (dst_pt != NULL) { d_x = dst_pt->x; d_y = dst_pt->y; @@ -440,8 +402,7 @@ GFX_BufToBuffer(uchar * dst_buf, clip.right = dst_w - 1; clip.bottom = dst_h - 1; - /* Clip source rectangle to destination surface - * \*------------------------------------------------------------- */ + /* Clip source rectangle to destination surface */ dst_off_x = d_x; dst_off_y = d_y; src_off_x = s.left; @@ -499,13 +460,11 @@ GFX_BufToBuffer(uchar * dst_buf, src_draw_h -= (clip.bottom - (d_y + src_draw_h - 1)); } - /* Transfer buffer data to surface - * \*------------------------------------------------------------- */ + /* Transfer buffer data to surface */ read_p = (src + src_off_x) + (src_w * src_off_y); write_p = (dst_buf + dst_off_x) + (dst_w * dst_off_y); for (row = 0; row < src_draw_h; row++) { - memcpy(write_p, read_p, src_draw_w); write_p += dst_w; @@ -515,18 +474,15 @@ GFX_BufToBuffer(uchar * dst_buf, return R_SUCCESS; } -int GFX_DrawCursor(R_SURFACE * ds, R_POINT * p1) -{ - +int GFX_DrawCursor(R_SURFACE *ds, R_POINT *p1) { static uchar cursor_img[R_CURSOR_W * R_CURSOR_H] = { - - 0, 0, 0, 255, 0, 0, 0, - 0, 0, 0, 255, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, - 255, 255, 0, 0, 0, 255, 255, - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 0, 0, 0, - 0, 0, 0, 255, 0, 0, 0 + 0, 0, 0, 255, 0, 0, 0, + 0, 0, 0, 255, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 255, 255, 0, 0, 0, 255, 255, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 255, 0, 0, 0, + 0, 0, 0, 255, 0, 0, 0 }; R_CLIPINFO ci; @@ -569,9 +525,7 @@ int GFX_DrawCursor(R_SURFACE * ds, R_POINT * p1) dst_skip = ds->buf_pitch - ci.draw_w; for (y = 0; y < ci.draw_h; y++) { - for (x = 0; x < ci.draw_w; x++) { - if (*src_p != 0) { *dst_p = *src_p; } @@ -588,12 +542,11 @@ int GFX_DrawCursor(R_SURFACE * ds, R_POINT * p1) } -int GFX_DrawRect(R_SURFACE * ds, R_RECT * dst_rect, int color) /*--------------------------------------------------------------------------*\ * Fills a rectangle in the surface ds from point 'p1' to point 'p2' using * the specified color. \*--------------------------------------------------------------------------*/ -{ +int GFX_DrawRect(R_SURFACE *ds, R_RECT *dst_rect, int color) { uchar *write_p; int w; @@ -603,7 +556,6 @@ int GFX_DrawRect(R_SURFACE * ds, R_RECT * dst_rect, int color) int left, top, right, bottom; if (dst_rect != NULL) { - dst_rect->clip(ds->buf_w - 1, ds->buf_h - 1); left = dst_rect->left; @@ -635,8 +587,7 @@ int GFX_DrawRect(R_SURFACE * ds, R_RECT * dst_rect, int color) return R_SUCCESS; } -int GFX_DrawFrame(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color) -{ +int GFX_DrawFrame(R_SURFACE *ds, R_POINT *p1, R_POINT *p2, int color) { int left, top, right, bottom; int min_x; @@ -678,9 +629,7 @@ int GFX_DrawFrame(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color) return R_SUCCESS; } -int GFX_DrawPolyLine(R_SURFACE * ds, R_POINT * pts, int pt_ct, int draw_color) -{ - +int GFX_DrawPolyLine(R_SURFACE *ds, R_POINT *pts, int pt_ct, int draw_color) { R_POINT *first_pt = pts; int last_i = 1; int i; @@ -702,9 +651,7 @@ int GFX_DrawPolyLine(R_SURFACE * ds, R_POINT * pts, int pt_ct, int draw_color) return R_SUCCESS; } -int GFX_GetClipInfo(R_CLIPINFO * clipinfo) -{ - +int GFX_GetClipInfo(R_CLIPINFO *clipinfo) { Common::Rect s; int d_x, d_y; @@ -726,8 +673,7 @@ int GFX_GetClipInfo(R_CLIPINFO * clipinfo) clip = *clipinfo->dst_rect; - /* Clip source rectangle to destination surface - * \*------------------------------------------------------------- */ + /* Clip source rectangle to destination surface */ clipinfo->dst_draw_x = d_x; clipinfo->dst_draw_y = d_y; clipinfo->src_draw_x = s.left; @@ -798,12 +744,8 @@ int GFX_GetClipInfo(R_CLIPINFO * clipinfo) return R_SUCCESS; } -int -GFX_ClipLine(R_SURFACE * ds, - const R_POINT * src_p1, - const R_POINT * src_p2, R_POINT * dst_p1, R_POINT * dst_p2) -{ - +int GFX_ClipLine(R_SURFACE *ds, const R_POINT *src_p1, const R_POINT *src_p2, + R_POINT *dst_p1, R_POINT *dst_p2) { const R_POINT *n_p1; const R_POINT *n_p2; @@ -841,7 +783,6 @@ GFX_ClipLine(R_SURFACE * ds, dy = bottom - top; if (left < 0) { - if (right < 0) { /* Line completely off left edge */ return -1; @@ -856,7 +797,6 @@ GFX_ClipLine(R_SURFACE * ds, } if (bottom > clip.right) { - if (left > clip.right) { /* Line completely off right edge */ return -1; @@ -873,7 +813,6 @@ GFX_ClipLine(R_SURFACE * ds, return 1; } -void GFX_DrawLine(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color) /*--------------------------------------------------------------------------*\ * Utilizes Bresenham's run-length slice algorithm described in * "Michael Abrash's Graphics Programming Black Book", @@ -881,8 +820,7 @@ void GFX_DrawLine(R_SURFACE * ds, R_POINT * p1, R_POINT * p2, int color) * * Performs no clipping \*--------------------------------------------------------------------------*/ -{ - +void GFX_DrawLine(R_SURFACE *ds, R_POINT *p1, R_POINT *p2, int color) { uchar *write_p; int clip_result; diff --git a/saga/interface.cpp b/saga/interface.cpp index 2d7bb99688..b9b96ed064 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -58,7 +58,6 @@ namespace Saga { static R_INTERFACE_MODULE IfModule; static R_VERB_DATA I_VerbData[] = { - {I_VERB_WALKTO, "verb_walkto", "Walk to", S_VERB_WALKTO}, {I_VERB_LOOKAT, "verb_lookat", "Look at", S_VERB_LOOKAT}, {I_VERB_PICKUP, "verb_pickup", "Pick up", S_VERB_PICKUP}, @@ -70,7 +69,6 @@ static R_VERB_DATA I_VerbData[] = { }; static R_INTERFACE_DESC ITE_interface = { - ITE_STATUS_Y, ITE_STATUS_W, ITE_STATUS_H, @@ -89,7 +87,6 @@ static R_INTERFACE_DESC ITE_interface = { }; static R_INTERFACE_BUTTON ITE_c_buttons[] = { - {5, 4, 46, 47, "Portrait", 0, 0, BUTTON_NONE, 0}, /* "Walk To" and "Talk To" share button sprites */ {52, 4, 109, 14, "Walk To", 1, 2, BUTTON_VERB, I_VERB_WALKTO}, @@ -114,7 +111,6 @@ static R_INTERFACE_BUTTON ITE_c_buttons[] = { }; static R_INTERFACE_DESC IHNM_interface = { - IHNM_STATUS_Y, IHNM_STATUS_W, IHNM_STATUS_H, @@ -133,16 +129,13 @@ static R_INTERFACE_DESC IHNM_interface = { }; static R_INTERFACE_BUTTON IHNM_c_buttons[] = { - {5, 4, 46, 47, "Portrait", 0, 0, 0, 0} }; -int INTERFACE_RegisterLang(void) -{ +int INTERFACE_RegisterLang(void) { size_t i; for (i = 0; i < ARRAYSIZE(I_VerbData); i++) { - if (CVAR_Register_S(I_VerbData[i].verb_str, I_VerbData[i].verb_cvar, NULL, R_CVAR_CFG, R_VERB_STRLIMIT) != R_SUCCESS) { @@ -156,9 +149,7 @@ int INTERFACE_RegisterLang(void) return R_SUCCESS; } -int INTERFACE_Init(void) -{ - +int INTERFACE_Init(void) { R_GAME_RESOURCEDESC g_resdesc; int game_type; @@ -170,7 +161,6 @@ int INTERFACE_Init(void) IfModule.i_thread = STHREAD_Create(); if (IfModule.i_thread == NULL) { - R_printf(R_STDERR, "Error creating script thread for game interface " "module.\n"); @@ -178,8 +168,7 @@ int INTERFACE_Init(void) return R_FAILURE; } - /* Load interface module resource file context - * \*------------------------------------------------------------- */ + /* Load interface module resource file context */ result = GAME_GetFileContext(&IfModule.i_file_ctxt, R_GAME_RESOURCEFILE, 0); if (result != R_SUCCESS) { @@ -187,20 +176,16 @@ int INTERFACE_Init(void) return R_FAILURE; } - /* Initialize interface data by game type - * \*------------------------------------------------------------- */ + /* Initialize interface data by game type */ game_type = GAME_GetGameType(); if (game_type == R_GAMETYPE_ITE) { - /* Load Inherit the Earth interface desc */ - IfModule.c_panel.buttons = 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 = ARRAYSIZE(IHNM_c_buttons); @@ -210,8 +195,7 @@ int INTERFACE_Init(void) return R_FAILURE; } - /* Load interface resources - * \*------------------------------------------------------------- */ + /* Load interface resources */ GAME_GetResourceInfo(&g_resdesc); /* Load command panel resource */ @@ -264,26 +248,20 @@ int INTERFACE_Init(void) return R_SUCCESS; } -int INTERFACE_Activate(void) -{ - +int INTERFACE_Activate(void) { IfModule.active = 1; INTERFACE_Draw(); return R_SUCCESS; } -int INTERFACE_Deactivate(void) -{ - +int INTERFACE_Deactivate(void) { IfModule.active = 0; return R_SUCCESS; } -int INTERFACE_SetStatusText(const char *new_txt) -{ - +int INTERFACE_SetStatusText(const char *new_txt) { assert(new_txt != NULL); strncpy(IfModule.status_txt, new_txt, R_STATUS_TEXT_LEN); @@ -291,9 +269,7 @@ int INTERFACE_SetStatusText(const char *new_txt) return R_SUCCESS; } -int INTERFACE_Draw(void) -{ - +int INTERFACE_Draw(void) { R_GAME_DISPLAYINFO g_di; R_SURFACE *back_buf; @@ -312,24 +288,20 @@ int INTERFACE_Draw(void) return R_SUCCESS; } - /* Get game display info - * \*------------------------------------------------------------- */ + /* Get game display info */ GAME_GetDisplayInfo(&g_di); - /* Erase background of status bar - * \*------------------------------------------------------------- */ + /* Erase background of status bar */ rect.left = 0; - rect.top = IfModule.i_desc.status_y; + rect.top = IfModule.i_desc.status_h - 1; rect.right = g_di.logical_w - 1; - rect.bottom = IfModule.i_desc.status_h - 1; + rect.bottom = IfModule.i_desc.status_y; GFX_DrawRect(back_buf, &rect, IfModule.i_desc.status_bgcol); - /* Draw command panel background - * \*------------------------------------------------------------- */ + /* Draw command panel background */ if (IfModule.panel_mode == PANEL_COMMAND) { - xbase = IfModule.c_panel.x; ybase = IfModule.c_panel.y; @@ -341,7 +313,6 @@ int INTERFACE_Draw(void) IfModule.c_panel.img_w, IfModule.c_panel.img_h, NULL, &origin); } else { - xbase = IfModule.d_panel.x; ybase = IfModule.d_panel.y; @@ -354,8 +325,7 @@ int INTERFACE_Draw(void) IfModule.d_panel.img_h, NULL, &origin); } - /* Draw character portrait - * \*------------------------------------------------------------- */ + /* Draw character portrait */ lportrait_x = xbase + IfModule.i_desc.lportrait_x; lportrait_y = ybase + IfModule.i_desc.lportrait_y; @@ -366,9 +336,7 @@ int INTERFACE_Draw(void) return R_SUCCESS; } -int INTERFACE_Update(R_POINT * imouse_pt, int update_flag) -{ - +int INTERFACE_Update(R_POINT *imouse_pt, int update_flag) { R_GAME_DISPLAYINFO g_di; R_SURFACE *back_buf; @@ -386,33 +354,23 @@ int INTERFACE_Update(R_POINT * imouse_pt, int update_flag) back_buf = SYSGFX_GetBackBuffer(); - /* Get game display info - * \*------------------------------------------------------------- */ + /* Get game display info */ GAME_GetDisplayInfo(&g_di); - /* Update playfield space ( only if cursor is inside ) - * \*------------------------------------------------------------- */ + /* Update playfield space ( only if cursor is inside ) */ if (imouse_y < g_di.scene_h) { - /* Mouse is in playfield space */ - if (update_flag == UPDATE_MOUSEMOVE) { - HandlePlayfieldUpdate(back_buf, imouse_pt); } else if (update_flag == UPDATE_MOUSECLICK) { - HandlePlayfieldClick(back_buf, imouse_pt); } } - /* Update command space - * \*------------------------------------------------------------- */ - + /* Update command space */ if (update_flag == UPDATE_MOUSEMOVE) { - HandleCommandUpdate(back_buf, imouse_pt); } else if (update_flag == UPDATE_MOUSECLICK) { - HandleCommandClick(back_buf, imouse_pt); } @@ -421,20 +379,16 @@ int INTERFACE_Update(R_POINT * imouse_pt, int update_flag) return R_SUCCESS; } -int DrawStatusBar(R_SURFACE * ds) -{ - +int DrawStatusBar(R_SURFACE *ds) { R_GAME_DISPLAYINFO g_di; R_RECT rect; int string_w; - /* Get game display info - * \*------------------------------------------------------------- */ + /* Get game display info */ GAME_GetDisplayInfo(&g_di); - /* Erase background of status bar - * \*------------------------------------------------------------- */ + /* Erase background of status bar */ rect.left = 0; rect.top = IfModule.i_desc.status_y; rect.right = g_di.logical_w - 1; @@ -457,9 +411,7 @@ int DrawStatusBar(R_SURFACE * ds) } -int HandleCommandClick(R_SURFACE * ds, R_POINT * imouse_pt) -{ - +int HandleCommandClick(R_SURFACE *ds, R_POINT *imouse_pt) { int hit_button; int ibutton_num; @@ -474,7 +426,6 @@ int HandleCommandClick(R_SURFACE * ds, R_POINT * imouse_pt) hit_button = INTERFACE_HitTest(imouse_pt, &ibutton_num); if (hit_button != R_SUCCESS) { - /* Clicking somewhere other than a button doesn't do anything */ return R_SUCCESS; } @@ -483,19 +434,16 @@ int HandleCommandClick(R_SURFACE * ds, R_POINT * imouse_pt) y_base = IfModule.c_panel.y; if (IfModule.c_panel.buttons[ibutton_num].flags & BUTTON_SET) { - old_set_button = IfModule.c_panel.set_button; set_button = ibutton_num; IfModule.c_panel.set_button = set_button; if (IfModule.c_panel.buttons[set_button].flags & BUTTON_VERB) { - IfModule.active_verb = IfModule.c_panel.buttons[ibutton_num].data; } if (IfModule.c_panel.buttons[set_button].flags & BUTTON_BITMAP) { - button_x = x_base + IfModule.c_panel.buttons[set_button].x1; button_y = @@ -527,9 +475,7 @@ int HandleCommandClick(R_SURFACE * ds, R_POINT * imouse_pt) return R_SUCCESS; } -int HandleCommandUpdate(R_SURFACE * ds, R_POINT * imouse_pt) -{ - +int HandleCommandUpdate(R_SURFACE *ds, R_POINT *imouse_pt) { int hit_button; int ibutton_num; @@ -545,15 +491,14 @@ int HandleCommandUpdate(R_SURFACE * ds, R_POINT * imouse_pt) int i; hit_button = INTERFACE_HitTest(imouse_pt, &ibutton_num); - if (hit_button == R_SUCCESS) { + if (hit_button == R_SUCCESS) { /* Hovering over a command panel button */ INTERFACE_SetStatusText(I_VerbData[IfModule.active_verb]. verb_str); } for (i = 0; i < IfModule.c_panel.nbuttons; i++) { - if (!(IfModule.c_panel.buttons[i].flags & BUTTON_LABEL)) { continue; } @@ -596,9 +541,7 @@ int HandleCommandUpdate(R_SURFACE * ds, R_POINT * imouse_pt) return R_SUCCESS; } -int HandlePlayfieldClick(R_SURFACE * ds, R_POINT * imouse_pt) -{ - +int HandlePlayfieldClick(R_SURFACE *ds, R_POINT *imouse_pt) { int hit_object; int object_num; uint object_flags = 0; @@ -609,9 +552,7 @@ int HandlePlayfieldClick(R_SURFACE * ds, R_POINT * imouse_pt) hit_object = OBJECTMAP_HitTest(imouse_pt, &object_num); if (hit_object != R_SUCCESS) { - /* Player clicked on empty spot - walk here regardless of verb */ - ACTOR_StoA(&iactor_pt, imouse_pt); ACTOR_WalkTo(0, &iactor_pt, 0, NULL); @@ -619,16 +560,13 @@ int HandlePlayfieldClick(R_SURFACE * ds, R_POINT * imouse_pt) } if (OBJECTMAP_GetFlags(object_num, &object_flags) != R_SUCCESS) { - CON_Print("Invalid object number: %d\n", object_num); return R_FAILURE; } if (object_flags & R_OBJECT_NORMAL) { - if (OBJECTMAP_GetEPNum(object_num, &script_num) == R_SUCCESS) { - /* Set active verb in script module */ SDATA_PutWord(4, 4, I_VerbData[IfModule.active_verb].s_verb); @@ -639,20 +577,15 @@ int HandlePlayfieldClick(R_SURFACE * ds, R_POINT * imouse_pt) } } } else { - /* Not a normal scene object - walk to it as if it weren't there */ - ACTOR_StoA(&iactor_pt, imouse_pt); ACTOR_WalkTo(0, &iactor_pt, 0, NULL); - } return R_SUCCESS; } -int HandlePlayfieldUpdate(R_SURFACE * ds, R_POINT * imouse_pt) -{ - +int HandlePlayfieldUpdate(R_SURFACE *ds, R_POINT *imouse_pt) { const char *object_name; int object_num; uint object_flags = 0; @@ -666,7 +599,6 @@ int HandlePlayfieldUpdate(R_SURFACE * ds, R_POINT * imouse_pt) hit_object = OBJECTMAP_HitTest(imouse_pt, &object_num); if (hit_object != R_SUCCESS) { - /* Cursor over nothing - just display current verb */ INTERFACE_SetStatusText(I_VerbData[IfModule.active_verb]. verb_str); @@ -675,7 +607,6 @@ int HandlePlayfieldUpdate(R_SURFACE * ds, R_POINT * imouse_pt) } if (OBJECTMAP_GetFlags(object_num, &object_flags) != R_SUCCESS) { - CON_Print("Invalid object number: %d\n", object_num); return R_FAILURE; @@ -684,18 +615,14 @@ int HandlePlayfieldUpdate(R_SURFACE * ds, R_POINT * imouse_pt) OBJECTMAP_GetName(object_num, &object_name); if (object_flags & R_OBJECT_NORMAL) { - /* Normal scene object - display as subject of verb */ - snprintf(new_status, R_STATUS_TEXT_LEN, "%s %s", I_VerbData[IfModule.active_verb].verb_str, object_name); } else { - /* Not normal scene object - override verb as we can only * walk to this object */ - snprintf(new_status, R_STATUS_TEXT_LEN, "%s %s", I_VerbData[I_VERB_WALKTO].verb_str, object_name); @@ -706,9 +633,7 @@ int HandlePlayfieldUpdate(R_SURFACE * ds, R_POINT * imouse_pt) return R_SUCCESS; } -int INTERFACE_HitTest(R_POINT * imouse_pt, int *ibutton) -{ - +int INTERFACE_HitTest(R_POINT *imouse_pt, int *ibutton) { R_INTERFACE_BUTTON *buttons; int nbuttons; @@ -724,7 +649,6 @@ int INTERFACE_HitTest(R_POINT * imouse_pt, int *ibutton) ybase = IfModule.c_panel.y; for (i = 0; i < nbuttons; i++) { - if ((imouse_pt->x >= (xbase + buttons[i].x1)) && (imouse_pt->x < (xbase + buttons[i].x2)) && (imouse_pt->y >= (ybase + buttons[i].y1)) && @@ -740,11 +664,8 @@ int INTERFACE_HitTest(R_POINT * imouse_pt, int *ibutton) return R_FAILURE; } -int INTERFACE_Shutdown(void) -{ - +int INTERFACE_Shutdown(void) { if (!IfModule.init) { - return R_FAILURE; } diff --git a/saga/reinherit.h b/saga/reinherit.h index bb48402dcd..8b7690b0b0 100644 --- a/saga/reinherit.h +++ b/saga/reinherit.h @@ -84,16 +84,13 @@ typedef Common::Rect R_RECT; struct R_COLOR { - int red; int green; int blue; int alpha; - }; struct R_SURFACE { - uchar *buf; int buf_w; int buf_h; @@ -104,11 +101,9 @@ struct R_SURFACE { R_RECT clip_rect; void *impl_src; - }; struct R_SOUNDBUFFER { - const uchar *res_data; size_t res_len; @@ -119,7 +114,6 @@ struct R_SOUNDBUFFER { const uchar *s_buf; size_t s_buf_len; - }; #define R_RGB_RED 0x00FF0000UL @@ -127,30 +121,24 @@ struct R_SOUNDBUFFER { #define R_RGB_BLUE 0x000000FFUL struct SAGA_COLOR { - byte r; byte g; byte b; - }; #define SAGA_COLOR_LEN 3 struct PALENTRY { - byte red; byte green; byte blue; - }; enum R_ERRORCODE { - R_STOP = -3, R_MEM = -2, R_FAILURE = -1, R_SUCCESS = 0 - }; @@ -163,10 +151,10 @@ void R_Shutdown(int param); /* * r_transitions.c \*--------------------------------------------------------------------------*/ -int TRANSITION_Dissolve(uchar * dst_img, +int TRANSITION_Dissolve(uchar *dst_img, int dst_w, int dst_h, - int dst_p, const uchar * src_img, int src_p, int flags, double percent); + int dst_p, const uchar *src_img, int src_p, int flags, double percent); /*--------------------------------------------------------------------------*\ * System specific routines @@ -228,22 +216,22 @@ int SYSGFX_Init(R_SYSGFX_INIT *); R_SURFACE *SYSGFX_GetScreenSurface(void); R_SURFACE *SYSGFX_GetBackBuffer(void); -int SYSGFX_LockSurface(R_SURFACE * surface); -int SYSGFX_UnlockSurface(R_SURFACE * surface); +int SYSGFX_LockSurface(R_SURFACE *surface); +int SYSGFX_UnlockSurface(R_SURFACE *surface); R_SURFACE *SYSGFX_CreateSurface(int w, int h, int bpp); -R_SURFACE *SYSGFX_FormatToDisplay(R_SURFACE * surface); -int SYSGFX_DestroySurface(R_SURFACE * surface); +R_SURFACE *SYSGFX_FormatToDisplay(R_SURFACE *surface); +int SYSGFX_DestroySurface(R_SURFACE *surface); int SYSGFX_GetWhite(void); int SYSGFX_GetBlack(void); int SYSGFX_MatchColor(unsigned long colormask); -int SYSGFX_SetPalette(R_SURFACE * surface, PALENTRY * pal); -int SYSGFX_GetCurrentPal(PALENTRY * src_pal); +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_PalToBlack(R_SURFACE *surface, PALENTRY *src_pal, double percent); -int SYSGFX_BlackToPal(R_SURFACE * surface, PALENTRY * src_pal, double percent); +int SYSGFX_BlackToPal(R_SURFACE *surface, PALENTRY *src_pal, double percent); /* * System : Input |