diff options
author | Max Horn | 2009-02-21 21:16:41 +0000 |
---|---|---|
committer | Max Horn | 2009-02-21 21:16:41 +0000 |
commit | ff17899d8ef0a9bf82334819444646b4c323b29e (patch) | |
tree | 06289cbe5b36c014ea52dc2eb376431d6fc2c9ba /engines/sci/engine | |
parent | 2acb44d1574abb831c99e11f52f6f956d40b6d8b (diff) | |
download | scummvm-rg350-ff17899d8ef0a9bf82334819444646b4c323b29e.tar.gz scummvm-rg350-ff17899d8ef0a9bf82334819444646b4c323b29e.tar.bz2 scummvm-rg350-ff17899d8ef0a9bf82334819444646b4c323b29e.zip |
SCI: Got rid of include/scitypes.h
svn-id: r38746
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/heap.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/heap.h | 2 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 22 | ||||
-rw-r--r-- | engines/sci/engine/kmath.cpp | 20 | ||||
-rw-r--r-- | engines/sci/engine/kmovement.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/kscripts.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/ksound.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/kstring.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cfsml | 12 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 12 | ||||
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.cpp | 32 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.h | 12 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 46 |
14 files changed, 93 insertions, 93 deletions
diff --git a/engines/sci/engine/heap.cpp b/engines/sci/engine/heap.cpp index 159d003c56..7ea0f41c2b 100644 --- a/engines/sci/engine/heap.cpp +++ b/engines/sci/engine/heap.cpp @@ -46,12 +46,12 @@ static void set_next(heap_t *h, int block_pos, int next) { static unsigned int get_size(heap_t *h, int block_pos) { assert_in_range(block_pos); - return (guint16)getInt16(h->start + block_pos); + return (uint16)getInt16(h->start + block_pos); } static unsigned int get_next(heap_t *h, int block_pos) { assert_in_range(block_pos); - return (guint16)getInt16(h->start + block_pos + 2); + return (uint16)getInt16(h->start + block_pos + 2); } // Allocates a new heap diff --git a/engines/sci/engine/heap.h b/engines/sci/engine/heap.h index 37a7134517..b89d03a684 100644 --- a/engines/sci/engine/heap.h +++ b/engines/sci/engine/heap.h @@ -32,7 +32,7 @@ namespace Sci { #define SCI_HEAP_SIZE 0x10000 -typedef guint16 heap_ptr; +typedef uint16 heap_ptr; typedef struct { byte *start; diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 540dfd3cf2..1974ff9084 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -675,7 +675,7 @@ reg_t kPriCoord(EngineState *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, PRIORITY_BAND_FIRST(priority)); } -void _k_dirloop(reg_t obj, word angle, EngineState *s, int funct_nr, int argc, reg_t *argv) { +void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int funct_nr, int argc, reg_t *argv) { int view = GET_SEL32V(obj, view); int signal = GET_SEL32V(obj, signal); int loop; @@ -780,13 +780,13 @@ reg_t kCanBeHere(EngineState *s, int funct_nr, int argc, reg_t * argv) { reg_t cliplist_ref = KP_ALT(1, NULL_REG); list_t *cliplist = NULL; gfxw_port_t *port = s->picture_port; - word signal; + uint16 signal; int retval; abs_rect_t abs_zone; rect_t zone; - word edgehit; - word illegal_bits; + uint16 edgehit; + uint16 illegal_bits; abs_zone.x = GET_SEL32SV(obj, brLeft); abs_zone.xend = GET_SEL32SV(obj, brRight); @@ -1362,7 +1362,7 @@ reg_t kEditControl(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t event = argv[1]; if (obj.segment) { - word ct_type = GET_SEL32V(obj, type); + uint16 ct_type = GET_SEL32V(obj, type); switch (ct_type) { case 0: @@ -1564,7 +1564,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { case K_CONTROL_BUTTON: SCIkdebug(SCIkGRAPHICS, "drawing button "PREG" to %d,%d\n", PRINT_REG(obj), x, y); ADD_TO_CURRENT_BG_WIDGETS(sciw_new_button_control(s->port, obj, area, text, font_nr, - (gint8)(state & CONTROL_STATE_FRAMED), (gint8)inverse, (gint8)(state & CONTROL_STATE_GRAY))); + (int8)(state & CONTROL_STATE_FRAMED), (int8)inverse, (int8)(state & CONTROL_STATE_GRAY))); break; case K_CONTROL_TEXT: @@ -1573,7 +1573,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { SCIkdebug(SCIkGRAPHICS, "drawing text "PREG" to %d,%d, mode=%d\n", PRINT_REG(obj), x, y, mode); ADD_TO_CURRENT_BG_WIDGETS(sciw_new_text_control(s->port, obj, area, text, font_nr, mode, - (gint8)(!!(state & CONTROL_STATE_DITHER_FRAMED)), (gint8)inverse)); + (int8)(!!(state & CONTROL_STATE_DITHER_FRAMED)), (int8)inverse)); break; case K_CONTROL_EDIT: @@ -1589,7 +1589,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { update_cursor_limits(&s->save_dir_edit_offset, &cursor, max); update_cursor_limits(&s->save_dir_edit_offset, &cursor, max); - ADD_TO_CURRENT_BG_WIDGETS(sciw_new_edit_control(s->port, obj, area, text, font_nr, (unsigned)cursor, (gint8)inverse)); + ADD_TO_CURRENT_BG_WIDGETS(sciw_new_edit_control(s->port, obj, area, text, font_nr, (unsigned)cursor, (int8)inverse)); break; case K_CONTROL_ICON: @@ -1597,7 +1597,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { SCIkdebug(SCIkGRAPHICS, "drawing icon control "PREG" to %d,%d\n", PRINT_REG(obj), x, y - 1); ADD_TO_CURRENT_BG_WIDGETS(sciw_new_icon_control(s->port, obj, area, view, loop, cel, - (gint8)(state & CONTROL_STATE_FRAMED), (gint8)inverse)); + (int8)(state & CONTROL_STATE_FRAMED), (int8)inverse)); break; case K_CONTROL_CONTROL: @@ -1635,7 +1635,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { } ADD_TO_CURRENT_BG_WIDGETS(sciw_new_list_control(s->port, obj, area, font_nr, entries_list, entries_nr, - list_top, selection, (gint8)inverse)); + list_top, selection, (int8)inverse)); if (entries_nr) free(entries_list); } @@ -2213,7 +2213,7 @@ void _k_draw_view_list(EngineState *s, gfxw_list_t *list, int flags) { widget = gfxw_picviewize_dynview(widget); if (GFXW_IS_DYN_VIEW(widget) && widget->ID) { - word signal = (flags & _K_DRAW_VIEW_LIST_USE_SIGNAL) ? ((reg_t *)(widget->signalp))->offset : 0; + uint16 signal = (flags & _K_DRAW_VIEW_LIST_USE_SIGNAL) ? ((reg_t *)(widget->signalp))->offset : 0; if (signal & _K_VIEW_SIG_FLAG_HIDDEN) gfxw_hide_widget(GFXW(widget)); diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp index d0695cb0e1..2183b60eff 100644 --- a/engines/sci/engine/kmath.cpp +++ b/engines/sci/engine/kmath.cpp @@ -39,7 +39,7 @@ reg_t kAbs(EngineState *s, int funct_nr, int argc, reg_t *argv) { } reg_t kSqrt(EngineState *s, int funct_nr, int argc, reg_t *argv) { - return make_reg(0, (gint16) sqrt((float) abs(SKPV(0)))); + return make_reg(0, (int16) sqrt((float) abs(SKPV(0)))); } int get_angle(int xrel, int yrel) { @@ -103,7 +103,7 @@ reg_t kGetDistance(EngineState *s, int funct_nr, int argc, reg_t *argv) { int xrel = (int)(((float) SKPV(1) - SKPV_OR_ALT(3, 0)) / cos(SKPV_OR_ALT(5, 0) * PI / 180.0)); // This works because cos(0)==1 int yrel = SKPV(0) - SKPV_OR_ALT(2, 0); - return make_reg(0, (gint16)sqrt((float) xrel*xrel + yrel*yrel)); + return make_reg(0, (int16)sqrt((float) xrel*xrel + yrel*yrel)); } reg_t kTimesSin(EngineState *s, int funct_nr, int argc, reg_t *argv) { @@ -127,9 +127,9 @@ reg_t kCosDiv(EngineState *s, int funct_nr, int argc, reg_t *argv) { if ((cosval < 0.0001) && (cosval > 0.0001)) { warning("Attepted division by zero"); - return make_reg(0, (gint16)0x8000); + return make_reg(0, (int16)0x8000); } else - return make_reg(0, (gint16)(value / cosval)); + return make_reg(0, (int16)(value / cosval)); } reg_t kSinDiv(EngineState *s, int funct_nr, int argc, reg_t *argv) { @@ -139,9 +139,9 @@ reg_t kSinDiv(EngineState *s, int funct_nr, int argc, reg_t *argv) { if ((sinval < 0.0001) && (sinval > 0.0001)) { warning("Attepted division by zero"); - return make_reg(0, (gint16)0x8000); + return make_reg(0, (int16)0x8000); } else - return make_reg(0, (gint16)(value / sinval)); + return make_reg(0, (int16)(value / sinval)); } reg_t kTimesTan(EngineState *s, int funct_nr, int argc, reg_t *argv) { @@ -151,9 +151,9 @@ reg_t kTimesTan(EngineState *s, int funct_nr, int argc, reg_t *argv) { param -= 90; if ((param % 90) == 0) { warning("Attempted tan(pi/2)"); - return make_reg(0, (gint16)0x8000); + return make_reg(0, (int16)0x8000); } else - return make_reg(0, (gint16) - (tan(param * PI / 180.0) * scale)); + return make_reg(0, (int16) - (tan(param * PI / 180.0) * scale)); } reg_t kTimesCot(EngineState *s, int funct_nr, int argc, reg_t *argv) { @@ -162,9 +162,9 @@ reg_t kTimesCot(EngineState *s, int funct_nr, int argc, reg_t *argv) { if ((param % 90) == 0) { warning("Attempted tan(pi/2)"); - return make_reg(0, (gint16)0x8000); + return make_reg(0, (int16)0x8000); } else - return make_reg(0, (gint16)(tan(param * PI / 180.0) * scale)); + return make_reg(0, (int16)(tan(param * PI / 180.0) * scale)); } } // End of namespace Sci diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 69030491e9..c9a7718f9c 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -286,7 +286,7 @@ reg_t kDoBresen(EngineState *s, int funct_nr, int argc, reg_t *argv) { int x = GET_SEL32SV(client, x); int y = GET_SEL32SV(client, y); int oldx, oldy, destx, desty, dx, dy, bdi, bi1, bi2, movcnt, bdelta, axis; - word signal = GET_SEL32V(client, signal); + uint16 signal = GET_SEL32V(client, signal); int completed = 0; int max_movcnt = GET_SEL32V(client, moveSpeed); @@ -384,7 +384,7 @@ reg_t kDoBresen(EngineState *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, completed); } -extern void _k_dirloop(reg_t obj, word angle, EngineState *s, int funct_nr, int argc, reg_t *argv); +extern void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int funct_nr, int argc, reg_t *argv); int is_heap_object(EngineState *s, reg_t pos); extern int get_angle(int xrel, int yrel); @@ -505,7 +505,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } else { // No looper? Fall back to DirLoop - _k_dirloop(client, (word)angle, s, funct_nr, argc, argv); + _k_dirloop(client, (uint16)angle, s, funct_nr, argc, argv); } } diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index 7e37aa28cc..df36d41708 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -195,7 +195,7 @@ extern void _k_view_list_mark_free(EngineState *s, reg_t off); reg_t kDisposeClone(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t victim_addr = argv[0]; clone_t *victim_obj = obj_get(s, victim_addr); - word underBits; + uint16 underBits; if (!victim_obj) { SCIkwarn(SCIkERROR, "Attempt to dispose non-class/object at "PREG"\n", diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 02b3a21dca..f103631bbe 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -176,7 +176,7 @@ process_sound_events(EngineState *s) { /* Get all sound events, apply their chan reg_t kDoSound_SCI0(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = KP_ALT(1, NULL_REG); - word command = UKPV(0); + uint16 command = UKPV(0); song_handle_t handle = FROBNICATE_HANDLE(obj); int number = obj.segment ? GET_SEL32V(obj, number) : @@ -367,7 +367,7 @@ sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel, reg_t kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { - word command = UKPV(0); + uint16 command = UKPV(0); reg_t obj = KP_ALT(1, NULL_REG); song_handle_t handle = FROBNICATE_HANDLE(obj); int number = obj.segment ? @@ -672,7 +672,7 @@ sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel, reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { - word command = UKPV(0); + uint16 command = UKPV(0); reg_t obj = KP_ALT(1, NULL_REG); song_handle_t handle = FROBNICATE_HANDLE(obj); int number = obj.segment ? diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 8ef4f55ed9..55a86fcdda 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -451,9 +451,9 @@ reg_t kReadNumber(EngineState *s, int funct_nr, int argc, reg_t *argv) { source++; /* Skip whitespace */ if (*source == '$') /* SCI uses this for hex numbers */ - return make_reg(0, (gint16)strtol(source + 1, NULL, 16)); /* Hex */ + return make_reg(0, (int16)strtol(source + 1, NULL, 16)); /* Hex */ else - return make_reg(0, (gint16)strtol(source, NULL, 10)); /* Force decimal */ + return make_reg(0, (int16)strtol(source, NULL, 10)); /* Force decimal */ } diff --git a/engines/sci/engine/savegame.cfsml b/engines/sci/engine/savegame.cfsml index 275eb43bf5..a52a102c77 100644 --- a/engines/sci/engine/savegame.cfsml +++ b/engines/sci/engine/savegame.cfsml @@ -216,7 +216,7 @@ typedef mem_obj_t *mem_obj_ptr; // Unused types /* TYPE long "long" LIKE int; -TYPE gint16 "gint16" LIKE int; +TYPE int16 "int16" LIKE int; RECORD synonym_t "synonym_t" { int replaceant; @@ -845,7 +845,7 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) { load_script(s, i); scr->locals_block = scr->locals_segment == 0 ? NULL : &s->seg_manager.heap[scr->locals_segment]->data.locals; - scr->export_table = (guint16 *) find_unique_script_block(s, scr->buf, sci_obj_exports); + scr->export_table = (uint16 *) find_unique_script_block(s, scr->buf, sci_obj_exports); scr->synonyms = find_unique_script_block(s, scr->buf, sci_obj_synonyms); scr->code = NULL; scr->code_blocks_nr = 0; @@ -877,8 +877,8 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) { byte *data = scr->buf + scr->objects[j].pos.offset; if (self->sci1_1) { - guint16 *funct_area = (guint16 *) (scr->buf + getUInt16( data + 6 )); - guint16 *prop_area = (guint16 *) (scr->buf + getUInt16( data + 4 )); + uint16 *funct_area = (uint16 *) (scr->buf + getUInt16( data + 6 )); + uint16 *prop_area = (uint16 *) (scr->buf + getUInt16( data + 4 )); scr->objects[j].base_method = funct_area; scr->objects[j].base_vars = prop_area; @@ -896,8 +896,8 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) { scr->objects[j].variable_names_nr = base_obj->variables_nr; scr->objects[j].base_obj = base_obj->base_obj; - scr->objects[j].base_method = (guint16 *) (data + funct_area); - scr->objects[j].base_vars = (guint16 *) (data + scr->objects[j].variable_names_nr * 2 + SCRIPT_SELECTOR_OFFSET); + scr->objects[j].base_method = (uint16 *) (data + funct_area); + scr->objects[j].base_vars = (uint16 *) (data + scr->objects[j].variable_names_nr * 2 + SCRIPT_SELECTOR_OFFSET); } } } diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index dd546145bc..c8ce52f141 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -216,7 +216,7 @@ typedef mem_obj_t *mem_obj_ptr; // Unused types /* TYPE long "long" LIKE int; -TYPE gint16 "gint16" LIKE int; +TYPE int16 "int16" LIKE int; RECORD synonym_t "synonym_t" { int replaceant; @@ -4796,7 +4796,7 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) { load_script(s, i); scr->locals_block = scr->locals_segment == 0 ? NULL : &s->seg_manager.heap[scr->locals_segment]->data.locals; - scr->export_table = (guint16 *) find_unique_script_block(s, scr->buf, sci_obj_exports); + scr->export_table = (uint16 *) find_unique_script_block(s, scr->buf, sci_obj_exports); scr->synonyms = find_unique_script_block(s, scr->buf, sci_obj_synonyms); scr->code = NULL; scr->code_blocks_nr = 0; @@ -4828,8 +4828,8 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) { byte *data = scr->buf + scr->objects[j].pos.offset; if (self->sci1_1) { - guint16 *funct_area = (guint16 *) (scr->buf + getUInt16( data + 6 )); - guint16 *prop_area = (guint16 *) (scr->buf + getUInt16( data + 4 )); + uint16 *funct_area = (uint16 *) (scr->buf + getUInt16( data + 6 )); + uint16 *prop_area = (uint16 *) (scr->buf + getUInt16( data + 4 )); scr->objects[j].base_method = funct_area; scr->objects[j].base_vars = prop_area; @@ -4847,8 +4847,8 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) { scr->objects[j].variable_names_nr = base_obj->variables_nr; scr->objects[j].base_obj = base_obj->base_obj; - scr->objects[j].base_method = (guint16 *) (data + funct_area); - scr->objects[j].base_vars = (guint16 *) (data + scr->objects[j].variable_names_nr * 2 + SCRIPT_SELECTOR_OFFSET); + scr->objects[j].base_method = (uint16 *) (data + funct_area); + scr->objects[j].base_vars = (uint16 *) (data + scr->objects[j].variable_names_nr * 2 + SCRIPT_SELECTOR_OFFSET); } } } diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index e23463ec19..27a5b98229 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -634,7 +634,7 @@ static int c_vr(EngineState *s) { break; case KSIG_ARITHMETIC: - sciprintf("arithmetic value\n %d (%04x)\n", (gint16) reg.offset, reg.offset); + sciprintf("arithmetic value\n %d (%04x)\n", (int16) reg.offset, reg.offset); break; default: @@ -1244,7 +1244,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod byte *scr; int scr_size; reg_t retval = make_reg(pos.segment, pos.offset + 1); - word param_value; + uint16 param_value; int opsize; int opcode; int bytecount = 1; @@ -1428,7 +1428,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod int restmod = *p_restadjust; int stackframe = (scr[pos.offset + 1] >> 1) + restmod; reg_t *sb = *p_sp; - word selector; + uint16 selector; reg_t *val_ref; reg_t fun_ref; diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index 652135754c..ed9d6461a7 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -528,7 +528,7 @@ static void sm_mcpy_out_in(SegManager *self, void *dst, const int src, size_t n, } #endif -gint16 sm_get_heap(SegManager *self, reg_t reg) { +int16 sm_get_heap(SegManager *self, reg_t reg) { mem_obj_t *mem_obj; mem_obj_enum mem_type; @@ -538,7 +538,7 @@ gint16 sm_get_heap(SegManager *self, reg_t reg) { switch (mem_type) { case MEM_OBJ_SCRIPT: - VERIFY(reg.offset + 1 < (guint16)mem_obj->data.script.buf_size, "invalid offset\n"); + VERIFY(reg.offset + 1 < (uint16)mem_obj->data.script.buf_size, "invalid offset\n"); return (mem_obj->data.script.buf[reg.offset] | (mem_obj->data.script.buf[reg.offset+1]) << 8); case MEM_OBJ_CLONES: sciprintf("memcpy for clones hasn't been implemented yet\n"); @@ -550,7 +550,7 @@ gint16 sm_get_heap(SegManager *self, reg_t reg) { return 0; // never get here } -void sm_put_heap(SegManager *self, reg_t reg, gint16 value) { +void sm_put_heap(SegManager *self, reg_t reg, int16 value) { mem_obj_t *mem_obj; mem_obj_enum mem_type; @@ -560,7 +560,7 @@ void sm_put_heap(SegManager *self, reg_t reg, gint16 value) { switch (mem_type) { case MEM_OBJ_SCRIPT: - VERIFY(reg.offset + 1 < (guint16)mem_obj->data.script.buf_size, "invalid offset"); + VERIFY(reg.offset + 1 < (uint16)mem_obj->data.script.buf_size, "invalid offset"); mem_obj->data.script.buf[reg.offset] = value & 0xff; mem_obj->data.script.buf[reg.offset + 1] = value >> 8; break; @@ -636,7 +636,7 @@ void sm_set_export_table_offset(SegManager *self, int offset, int id, id_flag fl GET_SEGID(); if (offset) { - scr->export_table = (guint16 *)(scr->buf + offset + 2); + scr->export_table = (uint16 *)(scr->buf + offset + 2); scr->exports_nr = getUInt16((byte *)(scr->export_table - 1)); } else { scr->export_table = NULL; @@ -668,7 +668,7 @@ void sm_set_export_width(SegManager *self, int flag) { #if 0 // Unreferenced - removed -static guint16 *sm_get_export_table_offset(SegManager *self, int id, int flag, int *max) { +static uint16 *sm_get_export_table_offset(SegManager *self, int id, int flag, int *max) { GET_SEGID(); if (max) *max = self->heap[id]->data.script.exports_nr; @@ -785,7 +785,7 @@ void sm_script_relocate(SegManager *self, reg_t block) { scr = &(mobj->data.script); - VERIFY(block.offset < (guint16)scr->buf_size && getUInt16(scr->buf + block.offset) * 2 + block.offset < (guint16)scr->buf_size, + VERIFY(block.offset < (uint16)scr->buf_size && getUInt16(scr->buf + block.offset) * 2 + block.offset < (uint16)scr->buf_size, "Relocation block outside of script\n"); count = getUInt16(scr->buf + block.offset); @@ -837,7 +837,7 @@ void sm_heap_relocate(SegManager *self, EngineState *s, reg_t block) { scr = &(mobj->data.script); - VERIFY(block.offset < (guint16)scr->heap_size && getUInt16(scr->heap_start + block.offset) * 2 + block.offset < (guint16)scr->buf_size, + VERIFY(block.offset < (uint16)scr->heap_size && getUInt16(scr->heap_start + block.offset) * 2 + block.offset < (uint16)scr->buf_size, "Relocation block outside of script\n"); if (scr->relocated) @@ -934,7 +934,7 @@ static object_t *sm_script_obj_init0(SegManager *self, EngineState *s, reg_t obj obj->methods_nr = functions_nr; obj->base = scr->buf; obj->base_obj = data; - obj->base_method = (guint16 *)(data + funct_area); + obj->base_method = (uint16 *)(data + funct_area); obj->base_vars = NULL; for (i = 0; i < variables_nr; i++) @@ -955,7 +955,7 @@ static object_t *sm_script_obj_init11(SegManager *self, EngineState *s, reg_t ob scr = &(mobj->data.script); - VERIFY(base < (guint16)scr->buf_size, "Attempt to initialize object beyond end of script\n"); + VERIFY(base < (uint16)scr->buf_size, "Attempt to initialize object beyond end of script\n"); if (!scr->objects) { scr->objects_allocated = DEFAULT_OBJECTS; @@ -971,12 +971,12 @@ static object_t *sm_script_obj_init11(SegManager *self, EngineState *s, reg_t ob obj = scr->objects + id; - VERIFY(base + SCRIPT_FUNCTAREAPTR_OFFSET < (guint16)scr->buf_size, "Function area pointer stored beyond end of script\n"); + VERIFY(base + SCRIPT_FUNCTAREAPTR_OFFSET < (uint16)scr->buf_size, "Function area pointer stored beyond end of script\n"); { byte *data = (byte *)(scr->buf + base); - guint16 *funct_area = (guint16 *)(scr->buf + getUInt16(data + 6)); - guint16 *prop_area = (guint16 *)(scr->buf + getUInt16(data + 4)); + uint16 *funct_area = (uint16 *)(scr->buf + getUInt16(data + 6)); + uint16 *prop_area = (uint16 *)(scr->buf + getUInt16(data + 4)); int variables_nr; int functions_nr; int is_class; @@ -1067,7 +1067,7 @@ void sm_script_initialise_locals(SegManager *self, reg_t location) { scr = &(mobj->data.script); - VERIFY(location.offset + 1 < (guint16)scr->buf_size, "Locals beyond end of script\n"); + VERIFY(location.offset + 1 < (uint16)scr->buf_size, "Locals beyond end of script\n"); if (self->sci1_1) count = getUInt16(scr->buf + location.offset - 2); @@ -1228,9 +1228,9 @@ seg_id_t sm_allocate_reserved_segment(SegManager *self, char *src_name) { return segid; } -guint16 sm_validate_export_func(SegManager* self, int pubfunct, int seg) { +uint16 sm_validate_export_func(SegManager* self, int pubfunct, int seg) { script_t* script; - guint16 offset; + uint16 offset; VERIFY(sm_check(self, seg), "invalid seg id"); VERIFY(self->heap[seg]->type == MEM_OBJ_SCRIPT, "Can only validate exports on scripts"); diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h index e75ec76277..42d9dfc809 100644 --- a/engines/sci/engine/seg_manager.h +++ b/engines/sci/engine/seg_manager.h @@ -140,11 +140,11 @@ int sm_script_is_loaded(SegManager* self, int id, id_flag flag); // by its segment (SEG_ID). SEG_ID is faster than SCRIPT_ID, // but less convenient. -guint16 sm_validate_export_func(SegManager* self, int pubfunct, int seg); +uint16 sm_validate_export_func(SegManager* self, int pubfunct, int seg); // Validate whether the specified public function is exported by the script in the specified segment // Parameters: (int) pubfunct: Index of the function to validate // (int) seg: Segment ID of the script the check is to be performed for -// Returns : (guint16) 0 if the public function is invalid, its offset into the script's segment +// Returns : (uint16) 0 if the public function is invalid, its offset into the script's segment // otherwise int sm_seg_get(SegManager* self, int script_nr); @@ -329,16 +329,16 @@ void sm_free_clone(SegManager *self, reg_t addr); // Not all of these functions are fully operational for clones ATM -gint16 sm_get_heap(SegManager* self, reg_t reg); +int16 sm_get_heap(SegManager* self, reg_t reg); // Retrieves a 16 bit value from within a script's heap representation // Parameters: (reg_t) reg: The address to read from -// Returns : (gint16) The value read from the specified location +// Returns : (int16) The value read from the specified location -void sm_put_heap(SegManager *self, reg_t reg, gint16 value); +void sm_put_heap(SegManager *self, reg_t reg, int16 value); // Writes a 16 bit value into a script's heap representation // Parameters: (reg_t) reg: The address to write to -// (gint16) value: The value to write +// (int16) value: The value to write void sm_mcpy_in_out(SegManager* self, int dst, const void *src, size_t n, int id, int flag); diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index b92335cb8b..ca94438d10 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -245,10 +245,10 @@ reg_t get_class_address(EngineState *s, int classnr, int lock, reg_t caller) { #define POP32() (*(validate_stack_addr(s, --(xs->sp)))) // Getting instruction parameters -#define GET_OP_BYTE() ((guint8)code_buf[(xs->addr.pc.offset)++]) +#define GET_OP_BYTE() ((uint8)code_buf[(xs->addr.pc.offset)++]) #define GET_OP_WORD() (getUInt16(code_buf + ((xs->addr.pc.offset) += 2) - 2)) #define GET_OP_FLEX() ((opcode & 1)? GET_OP_BYTE() : GET_OP_WORD()) -#define GET_OP_SIGNED_BYTE() ((gint8)(code_buf[(xs->addr.pc.offset)++])) +#define GET_OP_SIGNED_BYTE() ((int8)(code_buf[(xs->addr.pc.offset)++])) #define GET_OP_SIGNED_WORD() ((getInt16(code_buf + ((xs->addr.pc.offset) += 2) - 2))) #define GET_OP_SIGNED_FLEX() ((opcode & 1)? GET_OP_SIGNED_BYTE() : GET_OP_SIGNED_WORD()) @@ -259,9 +259,9 @@ reg_t get_class_address(EngineState *s, int classnr, int lock, reg_t caller) { #define OBJ_SUPERCLASS(s, reg) SEG_GET_HEAP(s, make_reg(reg.segment, reg.offset + SCRIPT_SUPERCLASS_OFFSET)) // Returns an object's superclass -inline exec_stack_t *execute_method(EngineState *s, word script, word pubfunct, stack_ptr_t sp, reg_t calling_obj, word argc, stack_ptr_t argp) { +inline exec_stack_t *execute_method(EngineState *s, uint16 script, uint16 pubfunct, stack_ptr_t sp, reg_t calling_obj, uint16 argc, stack_ptr_t argp) { int seg; - guint16 temp; + uint16 temp; if (!sm_script_is_loaded(&s->seg_manager, script, SCRIPT_ID)) // Script not present yet? script_instantiate(s, script); @@ -281,7 +281,7 @@ inline exec_stack_t *execute_method(EngineState *s, word script, word pubfunct, // Check if a breakpoint is set on this method if (s->have_bp & BREAK_EXPORT) { breakpoint_t *bp; - guint32 bpaddress; + uint32 bpaddress; bpaddress = (script << 16 | pubfunct); @@ -598,10 +598,10 @@ void run_vm(EngineState *s, int restoring) { unsigned int code_buf_size = 0 ; // (Avoid spurious warning) #endif int temp; - gint16 aux_acc; // Auxiliary 16 bit accumulator + int16 aux_acc; // Auxiliary 16 bit accumulator reg_t r_temp; // Temporary register stack_ptr_t s_temp; // Temporary stack pointer - gint16 opparams[4]; // opcode parameters + int16 opparams[4]; // opcode parameters int restadjust = s->r_amp_rest; // &rest adjusts the parameter count by this value @@ -861,27 +861,27 @@ void run_vm(EngineState *s, int restoring) { break; case 0x03: // mul - s->r_acc = ACC_ARITHMETIC_L(((gint16)POP()) * (gint16)/*acc*/); + s->r_acc = ACC_ARITHMETIC_L(((int16)POP()) * (int16)/*acc*/); break; case 0x04: // div ACC_AUX_LOAD(); - aux_acc = aux_acc != 0 ? ((gint16)POP()) / aux_acc : 0; + aux_acc = aux_acc != 0 ? ((int16)POP()) / aux_acc : 0; ACC_AUX_STORE(); break; case 0x05: // mod ACC_AUX_LOAD(); - aux_acc = aux_acc != 0 ? ((gint16)POP()) % aux_acc : 0; + aux_acc = aux_acc != 0 ? ((int16)POP()) % aux_acc : 0; ACC_AUX_STORE(); break; case 0x06: // shr - s->r_acc = ACC_ARITHMETIC_L(((guint16) POP()) >> /*acc*/); + s->r_acc = ACC_ARITHMETIC_L(((uint16) POP()) >> /*acc*/); break; case 0x07: // shl - s->r_acc = ACC_ARITHMETIC_L(((guint16)POP()) << /*acc*/); + s->r_acc = ACC_ARITHMETIC_L(((uint16)POP()) << /*acc*/); break; case 0x08: // xor @@ -921,22 +921,22 @@ void run_vm(EngineState *s, int restoring) { case 0x0f: // gt? s->r_prev = s->r_acc; - s->r_acc = ACC_ARITHMETIC_L((gint16)POP() > (gint16)/*acc*/); + s->r_acc = ACC_ARITHMETIC_L((int16)POP() > (int16)/*acc*/); break; case 0x10: // ge? s->r_prev = s->r_acc; - s->r_acc = ACC_ARITHMETIC_L((gint16)POP() >= (gint16)/*acc*/); + s->r_acc = ACC_ARITHMETIC_L((int16)POP() >= (int16)/*acc*/); break; case 0x11: // lt? s->r_prev = s->r_acc; - s->r_acc = ACC_ARITHMETIC_L((gint16)POP() < (gint16)/*acc*/); + s->r_acc = ACC_ARITHMETIC_L((int16)POP() < (int16)/*acc*/); break; case 0x12: // le? s->r_prev = s->r_acc; - s->r_acc = ACC_ARITHMETIC_L((gint16)POP() <= (gint16)/*acc*/); + s->r_acc = ACC_ARITHMETIC_L((int16)POP() <= (int16)/*acc*/); break; case 0x13: // ugt? @@ -1134,7 +1134,7 @@ void run_vm(EngineState *s, int restoring) { xs->sp -= ((opparams[0] >> 1) + restadjust); // Adjust stack xs->sp[1].offset += restadjust; - xs_new = send_selector(s, s->r_acc, s->r_acc, s_temp, (int)(opparams[0] >> 1) + (word)restadjust, xs->sp); + xs_new = send_selector(s, s->r_acc, s->r_acc, s_temp, (int)(opparams[0] >> 1) + (uint16)restadjust, xs->sp); if (xs_new && xs_new != xs) s->execution_stack_pos_changed = 1; @@ -1152,7 +1152,7 @@ void run_vm(EngineState *s, int restoring) { xs->sp -= ((opparams[0] >> 1) + restadjust); // Adjust stack xs->sp[1].offset += restadjust; - xs_new = send_selector(s, xs->objp, xs->objp, s_temp, (int)(opparams[0] >> 1) + (word)restadjust, xs->sp); + xs_new = send_selector(s, xs->objp, xs->objp, s_temp, (int)(opparams[0] >> 1) + (uint16)restadjust, xs->sp); if (xs_new && xs_new != xs) s->execution_stack_pos_changed = 1; @@ -1170,7 +1170,7 @@ void run_vm(EngineState *s, int restoring) { xs->sp -= ((opparams[1] >> 1) + restadjust); // Adjust stack xs->sp[1].offset += restadjust; - xs_new = send_selector(s, r_temp, xs->objp, s_temp, (int)(opparams[1] >> 1) + (word)restadjust, xs->sp); + xs_new = send_selector(s, r_temp, xs->objp, s_temp, (int)(opparams[1] >> 1) + (uint16)restadjust, xs->sp); if (xs_new && xs_new != xs) s->execution_stack_pos_changed = 1; @@ -1181,7 +1181,7 @@ void run_vm(EngineState *s, int restoring) { break; case 0x2c: // &rest - temp = (guint16) opparams[0]; // First argument + temp = (uint16) opparams[0]; // First argument restadjust = xs->argc - temp + 1; // +1 because temp counts the paramcount while argc doesn't if (restadjust < 0) restadjust = 0; @@ -1192,7 +1192,7 @@ void run_vm(EngineState *s, int restoring) { break; case 0x2d: // lea - temp = (guint16) opparams[0] >> 1; + temp = (uint16) opparams[0] >> 1; var_number = temp & 0x03; // Get variable type // Get variable block offset @@ -1500,7 +1500,7 @@ static inline int _obj_locate_varselector(EngineState *s, object_t *obj, selecto int i; byte *buf = obj->base_obj + selector_name_offset; - obj->base_vars = (guint16 *) buf; + obj->base_vars = (uint16 *) buf; for (i = 0; i < varnum; i++) if (getUInt16(buf + (i << 1)) == slc) // Found it? @@ -2034,7 +2034,7 @@ void script_uninstantiate(EngineState *s, int script_nr) { } static void _init_stack_base_with_selector(EngineState *s, selector_t selector) { - s->stack_base[0] = make_reg(0, (word)selector); + s->stack_base[0] = make_reg(0, (uint16)selector); s->stack_base[1] = NULL_REG; } |