diff options
-rw-r--r-- | engines/sci/engine/kevent.cpp | 15 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 39 | ||||
-rw-r--r-- | engines/sci/engine/kmenu.cpp | 27 | ||||
-rw-r--r-- | engines/sci/engine/sci_graphics.h | 45 |
4 files changed, 28 insertions, 98 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 451d49c413..20724236fc 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -29,7 +29,7 @@ namespace Sci { -int stop_on_event; +int stop_on_event = 0; #define SCI_VARIABLE_GAME_SPEED 3 @@ -85,7 +85,7 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { quit_vm(); break; - case SCI_EVT_KEYBOARD: { + case SCI_EVT_KEYBOARD: if ((e.buckybits & SCI_EVM_LSHIFT) && (e.buckybits & SCI_EVM_RSHIFT) && (e.data == '-')) { sciprintf("Debug mode activated\n"); script_debug_flag = 1; // Enter debug mode @@ -106,8 +106,7 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { // character PUT_SEL32V(obj, modifiers, e.buckybits&modifier_mask); } - } - break; + break; case SCI_EVT_MOUSE_RELEASE: case SCI_EVT_MOUSE_PRESS: { @@ -129,13 +128,12 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { PUT_SEL32V(obj, modifiers, (e.buckybits | extra_bits)&modifier_mask); s->r_acc = make_reg(0, 1); } + break; } - break; - default: { + default: s->r_acc = NULL_REG; // Unknown or no event } - } if ((s->r_acc.offset) && (stop_on_event)) { stop_on_event = 0; @@ -187,7 +185,8 @@ reg_t kMapKeyToDir(EngineState *s, int funct_nr, int argc, reg_t *argv) { PUT_SEL32V(obj, type, SCI_EVT_JOYSTICK); PUT_SEL32V(obj, message, mover); return make_reg(0, 1); - } else return NULL_REG; + } else + return NULL_REG; } return s->r_acc; diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 75b989e0c4..f062ac78b9 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -29,13 +29,15 @@ #include "sci/include/engine.h" #include "sci/gfx/sci_widgets.h" #include "sci/gfx/gfx_widgets.h" -#include "sci/engine/sci_graphics.h" #include "sci/engine/kernel.h" namespace Sci { #undef DEBUG_LSRECT +// This is the real width of a text with a specified width of 0 +#define MAX_TEXT_WIDTH_MAGIC_VALUE 192 + // Graph subfunctions #define K_GRAPH_GET_COLORS_NR 2 #define K_GRAPH_DRAW_LINE 4 @@ -486,9 +488,9 @@ void _k_graph_rebuild_port_with_color(EngineState *s, gfx_color_t newbgcolor) { port->widfree(GFXW(port)); } -static int activated_icon_bar; -static int port_origin_x; -static int port_origin_y; +static int activated_icon_bar = 0; +static int port_origin_x = 0; +static int port_origin_y = 0; reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) { rect_t area; @@ -730,11 +732,7 @@ reg_t kDirLoop(EngineState *s, int funct_nr, int argc, reg_t *argv) { #define GASEOUS_VIEW_MASK_ACTIVE (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_IGNORE_ACTOR) #define GASEOUS_VIEW_MASK_PASSIVE (_K_VIEW_SIG_FLAG_NO_UPDATE | _K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_IGNORE_ACTOR) -abs_rect_t set_base(EngineState *s, reg_t object); - -inline abs_rect_t get_nsrect(EngineState *s, reg_t object, byte clip); - -static inline abs_rect_t nsrect_clip(EngineState *s, int y, abs_rect_t retval, int priority); +static abs_rect_t nsrect_clip(EngineState *s, int y, abs_rect_t retval, int priority); static int collides_with(EngineState *s, abs_rect_t area, reg_t other_obj, int use_nsrect, int view_mask, int funct_nr, int argc, reg_t *argv) { int other_signal = GET_SEL32V(other_obj, signal); @@ -1171,7 +1169,7 @@ reg_t kBaseSetter(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } // kBaseSetter -static inline abs_rect_t nsrect_clip(EngineState *s, int y, abs_rect_t retval, int priority) { +static abs_rect_t nsrect_clip(EngineState *s, int y, abs_rect_t retval, int priority) { int pri_top; if (priority == -1) @@ -1189,7 +1187,7 @@ static inline abs_rect_t nsrect_clip(EngineState *s, int y, abs_rect_t retval, i return retval; } -inline abs_rect_t calculate_nsrect(EngineState *s, int x, int y, int view, int loop, int cel) { +static abs_rect_t calculate_nsrect(EngineState *s, int x, int y, int view, int loop, int cel) { int xbase, ybase, xend, yend, xsize, ysize; int xmod = 0, ymod = 0; abs_rect_t retval = {0, 0, 0, 0}; @@ -1218,7 +1216,7 @@ inline abs_rect_t calculate_nsrect(EngineState *s, int x, int y, int view, int l return retval; } -inline abs_rect_t get_nsrect(EngineState *s, reg_t object, byte clip) { +abs_rect_t get_nsrect(EngineState *s, reg_t object, byte clip) { int x, y, z; int view, loop, cel; abs_rect_t retval; @@ -1266,7 +1264,7 @@ reg_t kSetNowSeen(EngineState *s, int funct_nr, int argc, reg_t *argv) { _k_set_now_seen(s, object); return s->r_acc; -} // kSetNowSeen +} reg_t kPalette(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (UKPV(0)) { @@ -2367,17 +2365,6 @@ reg_t kSetPort(EngineState *s, int funct_nr, int argc, reg_t *argv) { return NULL_REG; } -static inline void add_to_chrono(EngineState *s, gfxw_widget_t *widget) { - gfxw_port_t *chrono_port; - gfxw_list_t *tw; - - chrono_port = gfxw_get_chrono_port(s->visual, &tw, 0); - tw->add(GFXWC(tw), widget); - - if (!chrono_port->parent) - ADD_TO_CURRENT_PORT(chrono_port); -} - reg_t kDrawCel(EngineState *s, int funct_nr, int argc, reg_t *argv) { int view = SKPV(0); int loop = SKPV(1); @@ -2404,11 +2391,7 @@ reg_t kDrawCel(EngineState *s, int funct_nr, int argc, reg_t *argv) { new_view = gfxw_new_view(s->gfx_state, Common::Point(x, y), view, loop, cel, 0, priority, -1, ALIGN_LEFT, ALIGN_TOP, GFXW_VIEW_FLAG_DONT_MODIFY_OFFSET); -#if 0 - add_to_chrono(s, GFXW(new_view)); -#else ADD_TO_CURRENT_PICTURE_PORT(GFXW(new_view)); -#endif FULL_REDRAW(); return s->r_acc; diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp index 300a762e76..061c90e18c 100644 --- a/engines/sci/engine/kmenu.cpp +++ b/engines/sci/engine/kmenu.cpp @@ -31,8 +31,7 @@ namespace Sci { -reg_t -kAddMenu(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kAddMenu(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *name = kernel_dereference_char_pointer(s, argv[0], 0); char *contents = kernel_dereference_char_pointer(s, argv[1], 0); @@ -44,8 +43,7 @@ kAddMenu(EngineState *s, int funct_nr, int argc, reg_t *argv) { } -reg_t -kSetMenu(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSetMenu(EngineState *s, int funct_nr, int argc, reg_t *argv) { int index = UKPV(0); int i = 2; @@ -57,16 +55,14 @@ kSetMenu(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t -kGetMenu(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGetMenu(EngineState *s, int funct_nr, int argc, reg_t *argv) { int index = UKPV(0); return menubar_get_attribute(s, (index >> 8) - 1, (index & 0xff) - 1, UKPV(1)); } -reg_t -kDrawStatus(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDrawStatus(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t text = argv[0]; int fgcolor = SKPV_OR_ALT(1, s->status_bar_foreground); int bgcolor = SKPV_OR_ALT(2, s->status_bar_background); @@ -95,8 +91,7 @@ kDrawStatus(EngineState *s, int funct_nr, int argc, reg_t *argv) { } -reg_t -kDrawMenuBar(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDrawMenuBar(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (SKPV(0)) sciw_set_menubar(s, s->titlebar_port, s->menubar, -1); @@ -204,8 +199,7 @@ static struct { }; -void -about_freesci(EngineState *s) { +void about_freesci(EngineState *s) { int page; gfxw_port_t *port; int bodyfont, titlefont; @@ -288,8 +282,7 @@ about_freesci(EngineState *s) { } -static inline int -_menu_go_down(EngineState *s, int menu_nr, int item_nr) { +static int _menu_go_down(EngineState *s, int menu_nr, int item_nr) { int seeker, max = s->menubar->menus[menu_nr].items_nr; seeker = item_nr + 1; @@ -298,7 +291,8 @@ _menu_go_down(EngineState *s, int menu_nr, int item_nr) { if (seeker != max) return seeker; - else return item_nr; + else + return item_nr; } #define FULL_REDRAW \ @@ -306,8 +300,7 @@ _menu_go_down(EngineState *s, int menu_nr, int item_nr) { gfxop_update(s->gfx_state); -reg_t -kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t event = argv[0]; /*int pause_sound = UKPV_OR_ALT(1, 1);*/ /* FIXME: Do this eventually */ int claimed = 0; diff --git a/engines/sci/engine/sci_graphics.h b/engines/sci/engine/sci_graphics.h deleted file mode 100644 index bdccbe2929..0000000000 --- a/engines/sci/engine/sci_graphics.h +++ /dev/null @@ -1,45 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -// SCI constants and definitions - -#ifndef SCI_ENGINE_SCI_GRAPHICS_H -#define SCI_ENGINE_SCI_GRAPHICS_H - -namespace Sci { - -#define MAX_TEXT_WIDTH_MAGIC_VALUE 192 -// This is the real width of a text with a specified width of 0 - -#define SELECTOR_STATE_SELECTABLE 1 -#define SELECTOR_STATE_FRAMED 2 -#define SELECTOR_STATE_DISABLED 4 -#define SELECTOR_STATE_SELECTED 8 -// Internal states -#define SELECTOR_STATE_DITHER_FRAMED 0x1000 - -} // End of namespace Sci - -#endif // SCI_ENGINE_SCI_GRAPHICS_H |