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 | |
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')
46 files changed, 301 insertions, 360 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; } diff --git a/engines/sci/gfx/gfx_resource.cpp b/engines/sci/gfx/gfx_resource.cpp index 678f74ce83..463c3e378e 100644 --- a/engines/sci/gfx/gfx_resource.cpp +++ b/engines/sci/gfx/gfx_resource.cpp @@ -206,7 +206,7 @@ gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) { // Now construct the pixmap scaling functions #define EXTRA_BYTE_OFFSET 0 -#define SIZETYPE guint8 +#define SIZETYPE uint8 #define FUNCNAME _gfx_xlate_pixmap_unfiltered_1 #define FUNCNAME_LINEAR _gfx_xlate_pixmap_linear_1 #define FUNCNAME_TRILINEAR _gfx_xlate_pixmap_trilinear_1 @@ -214,7 +214,7 @@ gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) { #include "gfx_pixmap_scale.cpp" #undef COPY_BYTES -#define SIZETYPE guint16 +#define SIZETYPE uint16 #define FUNCNAME _gfx_xlate_pixmap_unfiltered_2 #define FUNCNAME_LINEAR _gfx_xlate_pixmap_linear_2 #define FUNCNAME_TRILINEAR _gfx_xlate_pixmap_trilinear_2 @@ -226,7 +226,7 @@ gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) { # undef EXTRA_BYTE_OFFSET # define EXTRA_BYTE_OFFSET 1 #endif // SCUMM_BIG_ENDIAN -#define SIZETYPE guint32 +#define SIZETYPE uint32 #define FUNCNAME _gfx_xlate_pixmap_unfiltered_3 #define FUNCNAME_LINEAR _gfx_xlate_pixmap_linear_3 #define FUNCNAME_TRILINEAR _gfx_xlate_pixmap_trilinear_3 @@ -238,7 +238,7 @@ gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) { # define EXTRA_BYTE_OFFSET 0 #endif // SCUMM_BIG_ENDIAN -#define SIZETYPE guint32 +#define SIZETYPE uint32 #define FUNCNAME _gfx_xlate_pixmap_unfiltered_4 #define FUNCNAME_LINEAR _gfx_xlate_pixmap_linear_4 #define FUNCNAME_TRILINEAR _gfx_xlate_pixmap_trilinear_4 diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index 6aa2b98d2b..911a4dde97 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -114,13 +114,13 @@ struct gfx_mode_t { /** Pixmap-specific color entries */ struct gfx_pixmap_color_t{ int global_index; /* Global index color or GFX_COLOR_INDEX_UNMAPPED. */ - guint8 r, g, b; /* Real color */ + uint8 r, g, b; /* Real color */ }; /** Full color */ struct gfx_color_t { gfx_pixmap_color_t visual; - guint8 alpha; /* transparency = (1-opacity) */ + uint8 alpha; /* transparency = (1-opacity) */ signed char priority, control; byte mask; /* see mask values below */ }; diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index c4d6a9f471..4be7009c33 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -1182,17 +1182,17 @@ int gfxop_draw_box(gfx_state_t *state, rect_t box, gfx_color_t color1, gfx_color draw_color1.priority = draw_color2.priority = color1.priority; if (draw_color1.mask & GFX_MASK_VISUAL) { - draw_color1.visual.r = (guint8) COLOR_MIX(visual.r, mod_offset); - draw_color1.visual.g = (guint8) COLOR_MIX(visual.g, mod_offset); - draw_color1.visual.b = (guint8) COLOR_MIX(visual.b, mod_offset); - draw_color1.alpha = (guint8) COLOR_MIX(alpha, mod_offset); + draw_color1.visual.r = (uint8) COLOR_MIX(visual.r, mod_offset); + draw_color1.visual.g = (uint8) COLOR_MIX(visual.g, mod_offset); + draw_color1.visual.b = (uint8) COLOR_MIX(visual.b, mod_offset); + draw_color1.alpha = (uint8) COLOR_MIX(alpha, mod_offset); mod_offset += mod_breadth; - draw_color2.visual.r = (guint8) COLOR_MIX(visual.r, mod_offset); - draw_color2.visual.g = (guint8) COLOR_MIX(visual.g, mod_offset); - draw_color2.visual.b = (guint8) COLOR_MIX(visual.b, mod_offset); - draw_color2.alpha = (guint8) COLOR_MIX(alpha, mod_offset); + draw_color2.visual.r = (uint8) COLOR_MIX(visual.r, mod_offset); + draw_color2.visual.g = (uint8) COLOR_MIX(visual.g, mod_offset); + draw_color2.visual.b = (uint8) COLOR_MIX(visual.b, mod_offset); + draw_color2.alpha = (uint8) COLOR_MIX(alpha, mod_offset); } if (reverse) return drv->draw_filled_rect(drv, new_box, draw_color2, draw_color1, driver_shade_type); diff --git a/engines/sci/gfx/resource/sci_view_1.cpp b/engines/sci/gfx/resource/sci_view_1.cpp index 6da617c7ec..7af584bcfe 100644 --- a/engines/sci/gfx/resource/sci_view_1.cpp +++ b/engines/sci/gfx/resource/sci_view_1.cpp @@ -230,8 +230,8 @@ static int decompress_sci_view_amiga(int id, int loop, int cel, byte *resource, gfx_pixmap_t *gfxr_draw_cel1(int id, int loop, int cel, int mirrored, byte *resource, int size, gfxr_view_t *view, int amiga_game) { int xl = get_int_16(resource); int yl = get_int_16(resource + 2); - int xhot = (gint8) resource[4]; - int yhot = (guint8) resource[5]; + int xhot = (int8) resource[4]; + int yhot = (uint8) resource[5]; int pos = 8; int pixmap_size = xl * yl; gfx_pixmap_t *retval = gfx_pixmap_alloc_index_data(gfx_new_pixmap(xl, yl, id, loop, cel)); diff --git a/engines/sci/include/kernel.h b/engines/sci/include/kernel.h index e8b7c39ca4..906e864522 100644 --- a/engines/sci/include/kernel.h +++ b/engines/sci/include/kernel.h @@ -57,11 +57,11 @@ typedef struct { #define GET_SEL32(_o_, _slc_) read_selector(s, _o_, s->selector_map._slc_, __FILE__, __LINE__) #define GET_SEL32V(_o_, _slc_) (GET_SEL32(_o_, _slc_).offset) -#define GET_SEL32SV(_o_, _slc_) ((gint16)(GET_SEL32(_o_, _slc_).offset)) +#define GET_SEL32SV(_o_, _slc_) ((int16)(GET_SEL32(_o_, _slc_).offset)) /* Retrieves a selector from an object ** Parameters: (reg_t) object: The address of the object which the selector should be read from ** (selector_name) selector: The selector to read -** Returns : (gint16/guint16/reg_t) The selector value +** Returns : (int16/uint16/reg_t) The selector value ** This macro halts on error. 'selector' must be a selector name registered in vm.h's ** selector_map_t and mapped in script.c. */ @@ -71,7 +71,7 @@ typedef struct { /* Writes a selector value to an object ** Parameters: (reg_t) object: The address of the object which the selector should be written to ** (selector_name) selector: The selector to read -** (gint16) value: The value to write +** (int16) value: The value to write ** Returns : (void) ** This macro halts on error. 'selector' must be a selector name registered in vm.h's ** selector_map_t and mapped in script.c. @@ -140,8 +140,8 @@ bool is_object(EngineState *s, reg_t obj); #define KP_ALT(x, alt) ((x < argc)? argv[x] : (alt)) -#define KP_UINT(x) ((guint16) x.offset) -#define KP_SINT(x) ((gint16) x.offset) +#define KP_UINT(x) ((uint16) x.offset) +#define KP_SINT(x) ((int16) x.offset) #define SKPV(x) KP_SINT(argv[x]) diff --git a/engines/sci/include/sciresource.h b/engines/sci/include/sciresource.h index 1dd35b5d8d..37af0ec695 100644 --- a/engines/sci/include/sciresource.h +++ b/engines/sci/include/sciresource.h @@ -35,8 +35,6 @@ namespace Common { class ReadStream; } -#include "sci/include/scitypes.h" - namespace Sci { /** The maximum allowed size for a compressed or decompressed resource */ @@ -145,7 +143,7 @@ struct resource_t { unsigned short number; unsigned short type; - guint16 id; /* contains number and type */ + uint16 id; /* contains number and type */ unsigned int size; @@ -376,11 +374,11 @@ int decompress11(resource_t *result, Common::ReadStream &stream, int sci_version */ -int decrypt2(guint8* dest, guint8* src, int length, int complength); +int decrypt2(uint8* dest, uint8* src, int length, int complength); /* Huffman token decryptor - defined in decompress0.c and used in decompress01.c */ -int decrypt4(guint8* dest, guint8* src, int length, int complength); +int decrypt4(uint8* dest, uint8* src, int length, int complength); /* DCL inflate- implemented in decompress1.c */ diff --git a/engines/sci/include/scitypes.h b/engines/sci/include/scitypes.h deleted file mode 100644 index f7bd150d02..0000000000 --- a/engines/sci/include/scitypes.h +++ /dev/null @@ -1,50 +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$ - * - */ - -#ifndef SCI_TYPES -#define SCI_TYPES - -#include "common/scummsys.h" - -namespace Sci { - -typedef int8 gint8; -typedef uint8 guint8; - -typedef int16 gint16; -typedef uint16 guint16; - -typedef int32 gint32; -typedef uint32 guint32; - -#undef byte - -typedef gint8 sbyte; -typedef guint8 byte; -typedef guint16 word; - -} // End of namespace Sci - -#endif /* !SCI_TYPES */ diff --git a/engines/sci/include/versions.h b/engines/sci/include/versions.h index da06f3f2c8..2fdf61ac7a 100644 --- a/engines/sci/include/versions.h +++ b/engines/sci/include/versions.h @@ -28,8 +28,6 @@ #ifndef _SCI_VERSIONS_H_ #define _SCI_VERSIONS_H_ -#include "sci/include/scitypes.h" - namespace Sci { #define SCI_VERSION(_major_, _minor_, _patchlevel_) (((_major_)<<20) | ((_minor_)<<10) | _patchlevel_) diff --git a/engines/sci/include/vm.h b/engines/sci/include/vm.h index 690c29dbdc..67561b76ed 100644 --- a/engines/sci/include/vm.h +++ b/engines/sci/include/vm.h @@ -145,8 +145,8 @@ typedef struct { int methods_nr; byte *base; /* Points to a buffer all relative references (code, strings) point to */ byte *base_obj; /* base + object offset within base */ - guint16 *base_method; /* Pointer to the method selector area for this object */ - guint16 *base_vars; /* Pointer to the varselector area for this object */ + uint16 *base_method; /* Pointer to the method selector area for this object */ + uint16 *base_vars; /* Pointer to the varselector area for this object */ reg_t *variables; } object_t; @@ -189,7 +189,7 @@ typedef struct { byte *synonyms; /* Synonyms block or 0 if not present*/ byte *heap_start; /* Start of heap if SCI1.1, NULL otherwise */ - guint16 *export_table; /* Abs. offset of the export table or 0 if not present */ + uint16 *export_table; /* Abs. offset of the export table or 0 if not present */ int_hash_map_t *obj_indices; @@ -397,7 +397,7 @@ typedef struct { typedef struct _breakpoint { int type; union { - guint32 address; /* Breakpoints on exports */ + uint32 address; /* Breakpoints on exports */ char *name; /* Breakpoints on selector names */ } data; struct _breakpoint *next; @@ -450,15 +450,15 @@ extern kernel_function* kfuncs[]; extern int max_instance; /*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); +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); /* Executes function pubfunct of the specified script. ** Parameters: (EngineState *) s: The state which is to be executed with -** (word) script: The script which is called -** (word) pubfunct: The exported script function which is to be called +** (uint16) script: The script which is called +** (uint16) pubfunct: The exported script function which is to be called ** (stack_ptr_t) sp: Stack pointer position ** (reg_t) calling_obj: The heap address of the object which executed the call -** (word) argc: Number of arguments supplied +** (uint16) argc: Number of arguments supplied ** (stack_ptr_t) argp: Pointer to the first supplied argument ** Returns : (exec_stack_t *): A pointer to the new exec stack TOS entry */ diff --git a/engines/sci/include/vm_types.h b/engines/sci/include/vm_types.h index 5bf0d8114e..64fe330189 100644 --- a/engines/sci/include/vm_types.h +++ b/engines/sci/include/vm_types.h @@ -26,7 +26,7 @@ #ifndef _SCI_VM_TYPES_H_ #define _SCI_VM_TYPES_H_ -#include "sci/include/scitypes.h" +#include "common/scummsys.h" namespace Sci { diff --git a/engines/sci/scicore/decompress0.cpp b/engines/sci/scicore/decompress0.cpp index e74aa65c86..b7d9e4780a 100644 --- a/engines/sci/scicore/decompress0.cpp +++ b/engines/sci/scicore/decompress0.cpp @@ -38,7 +38,7 @@ namespace Sci { //#define _SCI_DECOMPRESS_DEBUG // 9-12 bit LZW encoding -int decrypt1(guint8 *dest, guint8 *src, int length, int complength) { +int decrypt1(uint8 *dest, uint8 *src, int length, int complength) { // Doesn't do length checking yet /* Theory: Considering the input as a bit stream, we get a series of ** 9 bit elements in the beginning. Every one of them is a 'token' @@ -56,24 +56,24 @@ int decrypt1(guint8 *dest, guint8 *src, int length, int complength) { ** be faster than the recursive approach. */ - guint16 bitlen = 9; // no. of bits to read (max. 12) - guint16 bitmask = 0x01ff; - guint16 bitctr = 0; // current bit position - guint16 bytectr = 0; // current byte position - guint16 token; // The last received value - guint16 maxtoken = 0x200; // The biggest token + uint16 bitlen = 9; // no. of bits to read (max. 12) + uint16 bitmask = 0x01ff; + uint16 bitctr = 0; // current bit position + uint16 bytectr = 0; // current byte position + uint16 token; // The last received value + uint16 maxtoken = 0x200; // The biggest token - guint16 tokenlist[4096]; // pointers to dest[] - guint16 tokenlengthlist[4096]; // char length of each token - guint16 tokenctr = 0x102; // no. of registered tokens (starts here) + uint16 tokenlist[4096]; // pointers to dest[] + uint16 tokenlengthlist[4096]; // char length of each token + uint16 tokenctr = 0x102; // no. of registered tokens (starts here) - guint16 tokenlastlength = 0; + uint16 tokenlastlength = 0; - guint16 destctr = 0; + uint16 destctr = 0; while (bytectr < complength) { - guint32 tokenmaker = src[bytectr++] >> bitctr; + uint32 tokenmaker = src[bytectr++] >> bitctr; if (bytectr < complength) tokenmaker |= (src[bytectr] << (8 - bitctr)); if (bytectr + 1 < complength) @@ -161,11 +161,11 @@ int decrypt1(guint8 *dest, guint8 *src, int length, int complength) { /***************************************************************************/ // decrypt2 helper function -gint16 getc2(guint8 *node, guint8 *src, guint16 *bytectr, guint16 *bitctr, int complength) { - guint16 next; +int16 getc2(uint8 *node, uint8 *src, uint16 *bytectr, uint16 *bitctr, int complength) { + uint16 next; while (node[1] != 0) { - gint16 value = (src[*bytectr] << (*bitctr)); + int16 value = (src[*bytectr] << (*bitctr)); (*bitctr)++; if (*bitctr == 8) { (*bitctr) = 0; @@ -175,7 +175,7 @@ gint16 getc2(guint8 *node, guint8 *src, guint16 *bytectr, guint16 *bitctr, int c if (value & 0x80) { next = node[1] & 0x0f; // low 4 bits if (next == 0) { - guint16 result = (src[*bytectr] << (*bitctr)); + uint16 result = (src[*bytectr] << (*bitctr)); if (++(*bytectr) > complength) return -1; @@ -195,12 +195,12 @@ gint16 getc2(guint8 *node, guint8 *src, guint16 *bytectr, guint16 *bitctr, int c } // Huffman token decryptor -int decrypt2(guint8* dest, guint8* src, int length, int complength) { +int decrypt2(uint8* dest, uint8* src, int length, int complength) { // no complength checking atm */ - guint8 numnodes, terminator; - guint8 *nodes; - gint16 c; - guint16 bitctr = 0, bytectr; + uint8 numnodes, terminator; + uint8 *nodes; + int16 c; + uint16 bitctr = 0, bytectr; numnodes = src[0]; terminator = src[1]; @@ -211,7 +211,7 @@ int decrypt2(guint8* dest, guint8* src, int length, int complength) { if (length-- == 0) return SCI_ERROR_DECOMPRESSION_OVERFLOW; - *dest = (guint8)c; + *dest = (uint8)c; dest++; } @@ -222,7 +222,7 @@ int decrypt2(guint8* dest, guint8* src, int length, int complength) { // Carl Muckenhoupt's decompression code ends here int sci0_get_compression_method(Common::ReadStream &stream) { - guint16 compressionMethod; + uint16 compressionMethod; stream.readUint16LE(); stream.readUint16LE(); @@ -267,7 +267,7 @@ int decompress0(resource_t *result, Common::ReadStream &stream, int sci_version) return SCI_ERROR_EMPTY_OBJECT; } - buffer = (guint8*)sci_malloc(compressedLength); + buffer = (uint8*)sci_malloc(compressedLength); result->data = (unsigned char *)sci_malloc(result->size); if (stream.read(buffer, compressedLength) != compressedLength) { diff --git a/engines/sci/scicore/decompress01.cpp b/engines/sci/scicore/decompress01.cpp index 352a4478ee..2ae70aaddd 100644 --- a/engines/sci/scicore/decompress01.cpp +++ b/engines/sci/scicore/decompress01.cpp @@ -39,17 +39,17 @@ namespace Sci { // TODO: Clean up, re-organize, improve speed-wise */ struct tokenlist { - guint8 data; - gint16 next; + uint8 data; + int16 next; } tokens[0x1004]; -static gint8 stak[0x1014] = {0}; -static gint8 lastchar = 0; -static gint16 stakptr = 0; -static guint16 s_numbits, s_bitstring, lastbits, decryptstart; -static gint16 curtoken, endtoken; +static int8 stak[0x1014] = {0}; +static int8 lastchar = 0; +static int16 stakptr = 0; +static uint16 s_numbits, s_bitstring, lastbits, decryptstart; +static int16 curtoken, endtoken; -uint32 gbits(int numbits, guint8 * data, int dlen); +uint32 gbits(int numbits, uint8 * data, int dlen); void decryptinit3() { int i; @@ -67,8 +67,8 @@ void decryptinit3() { } } -int decrypt3(guint8 *dest, guint8 *src, int length, int complength) { - static gint16 token; +int decrypt3(uint8 *dest, uint8 *src, int length, int complength) { + static int16 token; while (length != 0) { switch (decryptstart) { case 0: @@ -133,10 +133,10 @@ int decrypt3(guint8 *dest, guint8 *src, int length, int complength) { return 0; } -guint32 gbits(int numbits, guint8 * data, int dlen) { +uint32 gbits(int numbits, uint8 * data, int dlen) { int place; // indicates location within byte - guint32 bitstring; - static guint32 whichbit = 0; + uint32 bitstring; + static uint32 whichbit = 0; int i; if (numbits == 0) { @@ -526,7 +526,7 @@ int decompress01(resource_t *result, Common::ReadStream &stream, int sci_version return SCI_ERROR_EMPTY_OBJECT; } - buffer = (guint8 *)sci_malloc(compressedLength); + buffer = (uint8 *)sci_malloc(compressedLength); result->data = (unsigned char *)sci_malloc(result->size); if (stream.read(buffer, compressedLength) != compressedLength) { diff --git a/engines/sci/scicore/decompress1.cpp b/engines/sci/scicore/decompress1.cpp index b1daad7b5d..2936b722bc 100644 --- a/engines/sci/scicore/decompress1.cpp +++ b/engines/sci/scicore/decompress1.cpp @@ -253,7 +253,7 @@ static int decrypt4_hdyn(byte *dest, int length, struct bit_read_struct *reader) return 0; } -int decrypt4(guint8* dest, guint8* src, int length, int complength) { +int decrypt4(uint8* dest, uint8* src, int length, int complength) { struct bit_read_struct reader; reader.length = complength; @@ -265,7 +265,7 @@ int decrypt4(guint8* dest, guint8* src, int length, int complength) { } void decryptinit3(); -int decrypt3(guint8* dest, guint8* src, int length, int complength); +int decrypt3(uint8* dest, uint8* src, int length, int complength); int decompress1(resource_t *result, Common::ReadStream &stream, int sci_version) { uint16 compressedLength; @@ -314,7 +314,7 @@ int decompress1(resource_t *result, Common::ReadStream &stream, int sci_version) return SCI_ERROR_EMPTY_OBJECT; } - buffer = (guint8 *)sci_malloc(compressedLength); + buffer = (uint8 *)sci_malloc(compressedLength); result->data = (unsigned char *)sci_malloc(result->size); if (stream.read(buffer, compressedLength) != compressedLength) { diff --git a/engines/sci/scicore/decompress11.cpp b/engines/sci/scicore/decompress11.cpp index ec1e7ce444..4f7a74b20e 100644 --- a/engines/sci/scicore/decompress11.cpp +++ b/engines/sci/scicore/decompress11.cpp @@ -35,13 +35,13 @@ namespace Sci { #define DDEBUG if (0) printf void decryptinit3(); -int decrypt3(guint8* dest, guint8* src, int length, int complength); -int decrypt4(guint8* dest, guint8* src, int length, int complength); +int decrypt3(uint8* dest, uint8* src, int length, int complength); +int decrypt4(uint8* dest, uint8* src, int length, int complength); int decompress11(resource_t *result, Common::ReadStream &stream, int sci_version) { - guint16 compressedLength; - guint16 compressionMethod; - guint8 *buffer; + uint16 compressedLength; + uint16 compressionMethod; + uint8 *buffer; DDEBUG("d1"); @@ -75,7 +75,7 @@ int decompress11(resource_t *result, Common::ReadStream &stream, int sci_version return SCI_ERROR_EMPTY_OBJECT; } - buffer = (guint8*)sci_malloc(compressedLength); + buffer = (uint8*)sci_malloc(compressedLength); result->data = (unsigned char*)sci_malloc(result->size); if (stream.read(buffer, compressedLength) != compressedLength) { diff --git a/engines/sci/scicore/resource_patch.cpp b/engines/sci/scicore/resource_patch.cpp index 783dda4845..7681d009c7 100644 --- a/engines/sci/scicore/resource_patch.cpp +++ b/engines/sci/scicore/resource_patch.cpp @@ -51,7 +51,7 @@ static void process_patch(ResourceSource *source, if (!file.open(member.createReadStream(), member.getName())) perror("""__FILE__"": (""__LINE__""): failed to open"); else { - guint8 filehdr[2]; + uint8 filehdr[2]; resource_t *newrsc = _scir_find_resource_unsorted(*resource_p, *resource_nr_p, restype, resnumber); int fsize = file.size(); if (fsize < 3) { diff --git a/engines/sci/scicore/sci_memory.cpp b/engines/sci/scicore/sci_memory.cpp index 2b27a1c3c7..446c1bb1a9 100644 --- a/engines/sci/scicore/sci_memory.cpp +++ b/engines/sci/scicore/sci_memory.cpp @@ -87,20 +87,20 @@ char *sci_strndup(const char *src, size_t length) { //-------- Refcounting ---------- -#define REFCOUNT_OVERHEAD (sizeof(guint32) * 3) +#define REFCOUNT_OVERHEAD (sizeof(uint32) * 3) #define REFCOUNT_MAGIC_LIVE_1 0xebdc1741 #define REFCOUNT_MAGIC_LIVE_2 0x17015ac9 #define REFCOUNT_MAGIC_DEAD_1 0x11dead11 #define REFCOUNT_MAGIC_DEAD_2 0x22dead22 -#define REFCOUNT_CHECK(p) ((((guint32 *)(p))[-3] == REFCOUNT_MAGIC_LIVE_2) && (((guint32 *)(p))[-1] == REFCOUNT_MAGIC_LIVE_1)) +#define REFCOUNT_CHECK(p) ((((uint32 *)(p))[-3] == REFCOUNT_MAGIC_LIVE_2) && (((uint32 *)(p))[-1] == REFCOUNT_MAGIC_LIVE_1)) -#define REFCOUNT(p) (((guint32 *)p)[-2]) +#define REFCOUNT(p) (((uint32 *)p)[-2]) #undef TRACE_REFCOUNT extern void *sci_refcount_alloc(size_t length) { - guint32 *data = (guint32 *)sci_malloc(REFCOUNT_OVERHEAD + length); + uint32 *data = (uint32 *)sci_malloc(REFCOUNT_OVERHEAD + length); #ifdef TRACE_REFCOUNT fprintf(stderr, "[] REF: Real-alloc at %p\n", data); #endif @@ -136,7 +136,7 @@ extern void sci_refcount_decref(void *data) { if (!REFCOUNT_CHECK(data)) { BREAKPOINT(); } else if (--REFCOUNT(data) == 0) { - guint32 *fdata = (guint32 *)data; + uint32 *fdata = (uint32 *)data; fdata[-1] = REFCOUNT_MAGIC_DEAD_1; fdata[-3] = REFCOUNT_MAGIC_DEAD_2; diff --git a/engines/sci/sfx/adlib.cpp b/engines/sci/sfx/adlib.cpp index 8b19d3060c..0c5ecb000d 100644 --- a/engines/sci/sfx/adlib.cpp +++ b/engines/sci/sfx/adlib.cpp @@ -29,7 +29,7 @@ namespace Sci { adlib_instr adlib_sbi[96]; -void make_sbi(adlib_def *one, guint8 *buffer) { +void make_sbi(adlib_def *one, uint8 *buffer) { memset(buffer, 0, sizeof(adlib_instr)); #if 0 diff --git a/engines/sci/sfx/adlib.h b/engines/sci/sfx/adlib.h index 7fb34006d9..ff2a3b2687 100644 --- a/engines/sci/sfx/adlib.h +++ b/engines/sci/sfx/adlib.h @@ -34,34 +34,34 @@ namespace Sci { #define ADLIB_VOICES 12 typedef struct _sci_adlib_def { - guint8 keyscale1; /* 0-3 !*/ - guint8 freqmod1; /* 0-15 !*/ - guint8 feedback1; /* 0-7 !*/ - guint8 attackrate1; /* 0-15 !*/ - guint8 sustainvol1; /* 0-15 !*/ - guint8 envelope1; /* t/f !*/ - guint8 decayrate1; /* 0-15 !*/ - guint8 releaserate1; /* 0-15 !*/ - guint8 volume1; /* 0-63 !*/ - guint8 ampmod1; /* t/f !*/ - guint8 vibrato1; /* t/f !*/ - guint8 keybdscale1; /* t/f !*/ - guint8 algorithm1; /* 0,1 REVERSED */ - guint8 keyscale2; /* 0-3 !*/ - guint8 freqmod2; /* 0-15 !*/ - guint8 feedback2; /* 0-7 UNUSED */ - guint8 attackrate2; /* 0-15 !*/ - guint8 sustainvol2; /* 0-15 !*/ - guint8 envelope2; /* t/f !*/ - guint8 decayrate2; /* 0-15 !*/ - guint8 releaserate2; /* 0-15 !*/ - guint8 volume2; /* 0-63 !*/ - guint8 ampmod2; /* t/f !*/ - guint8 vibrato2; /* t/f !*/ - guint8 keybdscale2; /* t/f !*/ - guint8 algorithm2; /* 0,1 UNUSED */ - guint8 waveform1; /* 0-3 !*/ - guint8 waveform2; /* 0-3 !*/ + uint8 keyscale1; /* 0-3 !*/ + uint8 freqmod1; /* 0-15 !*/ + uint8 feedback1; /* 0-7 !*/ + uint8 attackrate1; /* 0-15 !*/ + uint8 sustainvol1; /* 0-15 !*/ + uint8 envelope1; /* t/f !*/ + uint8 decayrate1; /* 0-15 !*/ + uint8 releaserate1; /* 0-15 !*/ + uint8 volume1; /* 0-63 !*/ + uint8 ampmod1; /* t/f !*/ + uint8 vibrato1; /* t/f !*/ + uint8 keybdscale1; /* t/f !*/ + uint8 algorithm1; /* 0,1 REVERSED */ + uint8 keyscale2; /* 0-3 !*/ + uint8 freqmod2; /* 0-15 !*/ + uint8 feedback2; /* 0-7 UNUSED */ + uint8 attackrate2; /* 0-15 !*/ + uint8 sustainvol2; /* 0-15 !*/ + uint8 envelope2; /* t/f !*/ + uint8 decayrate2; /* 0-15 !*/ + uint8 releaserate2; /* 0-15 !*/ + uint8 volume2; /* 0-63 !*/ + uint8 ampmod2; /* t/f !*/ + uint8 vibrato2; /* t/f !*/ + uint8 keybdscale2; /* t/f !*/ + uint8 algorithm2; /* 0,1 UNUSED */ + uint8 waveform1; /* 0-3 !*/ + uint8 waveform2; /* 0-3 !*/ } adlib_def; typedef unsigned char adlib_instr[12]; @@ -69,7 +69,7 @@ typedef unsigned char adlib_instr[12]; extern adlib_instr adlib_sbi[96]; /** Converts a raw SCI adlib instrument into the adlib register format. */ -void make_sbi(adlib_def *one, guint8 *buffer); +void make_sbi(adlib_def *one, uint8 *buffer); } // End of namespace Sci diff --git a/engines/sci/sfx/mixer/soft.cpp b/engines/sci/sfx/mixer/soft.cpp index db991b5332..e0450e578f 100644 --- a/engines/sci/sfx/mixer/soft.cpp +++ b/engines/sci/sfx/mixer/soft.cpp @@ -58,7 +58,7 @@ struct mixer_private { sfx_timestamp_t outbuf_timestamp; /* Timestamp associated with the output buffer */ int have_outbuf_timestamp; /* Whether we really _have_ an associated timestamp */ byte *writebuf; /* Buffer we're supposed to write to */ - gint32 *compbuf_l, *compbuf_r; /* Intermediate buffers for computation */ + int32 *compbuf_l, *compbuf_r; /* Intermediate buffers for computation */ int lastbuf_len; /* Number of frames stored in the last buffer */ long skew; /* Millisecond relative to which we compute time. This is the millisecond @@ -81,8 +81,8 @@ static int mix_init(sfx_pcm_mixer_t *self, sfx_pcm_device_t *device) { self->private_bits = new mixer_private(); P->outbuf = P->writebuf = NULL; P->lastbuf_len = 0; - P->compbuf_l = (gint32*)sci_malloc(sizeof(gint32) * device->buf_size); - P->compbuf_r = (gint32*)sci_malloc(sizeof(gint32) * device->buf_size); + P->compbuf_l = (int32*)sci_malloc(sizeof(int32) * device->buf_size); + P->compbuf_r = (int32*)sci_malloc(sizeof(int32) * device->buf_size); P->played_this_second = 0; P->paused = 0; #ifdef DEBUG @@ -263,8 +263,8 @@ static inline void mix_compute_output(sfx_pcm_mixer_t *self, int outplen) { byte *lchan, *rchan = NULL; /* Don't see how this could possibly wind up being ** used w/o initialisation, but you never know... */ - gint32 *lsrc = P->compbuf_l; - gint32 *rsrc = P->compbuf_r; + int32 *lsrc = P->compbuf_l; + int32 *rsrc = P->compbuf_r; int frame_size = SFX_PCM_FRAME_SIZE(conf); @@ -523,8 +523,8 @@ static void mix_compute_input_linear(sfx_pcm_mixer_t *self, int add_result, sfx_pcm_feed_t *f = fs->feed; sfx_pcm_config_t conf = f->conf; int use_16 = conf.format & SFX_PCM_FORMAT_16; - gint32 *lchan = P->compbuf_l; - gint32 *rchan = P->compbuf_r; + int32 *lchan = P->compbuf_l; + int32 *rchan = P->compbuf_r; int frame_size = f->frame_size; byte *wr_dest = fs->buf + (frame_size * fs->frame_bufstart); byte *lsrc = fs->buf; @@ -601,8 +601,8 @@ static void mix_compute_input_linear(sfx_pcm_mixer_t *self, int add_result, case PCM_FEED_IDLE: /* Clear audio buffer, if neccessary, and return */ if (!add_result) { - memset(P->compbuf_l, 0, sizeof(gint32) * len); - memset(P->compbuf_r, 0, sizeof(gint32) * len); + memset(P->compbuf_l, 0, sizeof(int32) * len); + memset(P->compbuf_r, 0, sizeof(int32) * len); } return; @@ -632,8 +632,8 @@ static void mix_compute_input_linear(sfx_pcm_mixer_t *self, int add_result, /* Skip at the beginning: */ if (delay_frames) { if (!add_result) { - memset(lchan, 0, sizeof(gint32) * delay_frames); - memset(rchan, 0, sizeof(gint32) * delay_frames); + memset(lchan, 0, sizeof(int32) * delay_frames); + memset(rchan, 0, sizeof(int32) * delay_frames); } lchan += delay_frames; rchan += delay_frames; @@ -747,8 +747,8 @@ static void mix_compute_input_linear(sfx_pcm_mixer_t *self, int add_result, /* If neccessary, zero out the rest */ if (write_offset < len && !add_result) { - memset(lchan, 0, sizeof(gint32) * (len - write_offset)); - memset(rchan, 0, sizeof(gint32) * (len - write_offset)); + memset(lchan, 0, sizeof(int32) * (len - write_offset)); + memset(rchan, 0, sizeof(int32) * (len - write_offset)); } /* Save whether we have a partial frame still stored */ @@ -869,8 +869,8 @@ static int mix_process_linear(sfx_pcm_mixer_t *self) { } while (frames_skip >= 0); } else { /* Zero it out */ - memset(P->compbuf_l, 0, sizeof(gint32) * buflen); - memset(P->compbuf_r, 0, sizeof(gint32) * buflen); + memset(P->compbuf_l, 0, sizeof(int32) * buflen); + memset(P->compbuf_r, 0, sizeof(int32) * buflen); } #if (DEBUG >= 1) diff --git a/engines/sci/sfx/seq/gm.cpp b/engines/sci/sfx/seq/gm.cpp index 13520b2eec..896c521007 100644 --- a/engines/sci/sfx/seq/gm.cpp +++ b/engines/sci/sfx/seq/gm.cpp @@ -94,7 +94,7 @@ midi_gm_reset_timer(GTimeVal ts) { #define MIDI_MASTER_VOLUME_LEN 8 static int -midi_gm_volume(guint8 volume) { +midi_gm_volume(uint8 volume) { byte data[MIDI_MASTER_VOLUME_LEN] = { 0xf0, 0x7f, diff --git a/engines/sci/sfx/seq/map-mt32-to-gm.cpp b/engines/sci/sfx/seq/map-mt32-to-gm.cpp index bc472935d4..10ba4bdbc5 100644 --- a/engines/sci/sfx/seq/map-mt32-to-gm.cpp +++ b/engines/sci/sfx/seq/map-mt32-to-gm.cpp @@ -228,8 +228,8 @@ static const char static struct { const char *name; - gint8 gm_instr; - gint8 gm_rhythm_key; + int8 gm_instr; + int8 gm_rhythm_key; } MT32_PresetTimbreMaps[] = { /*000*/ {"AcouPiano1", 0, SFX_UNMAPPED}, /*001*/ {"AcouPiano2", 1, SFX_UNMAPPED}, @@ -363,8 +363,8 @@ static struct { static struct { const char *name; - gint8 gm_instr; - gint8 gm_rhythmkey; + int8 gm_instr; + int8 gm_rhythmkey; } MT32_RhythmTimbreMaps[] = { /*00*/ {"Acou BD ", SFX_MAPPED_TO_RHYTHM, 34}, /*01*/ {"Acou SD ", SFX_MAPPED_TO_RHYTHM, 37}, @@ -398,7 +398,7 @@ static struct { /*29*/ {"OpenHiHat2", SFX_MAPPED_TO_RHYTHM, 43} }; -static gint8 +static int8 MT32_PresetRhythmKeymap[] = { SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, @@ -424,8 +424,8 @@ MT32_PresetRhythmKeymap[] = { R - Rhythm... */ static struct { const char *name; - gint8 gm_instr; - gint8 gm_rhythm_key; + int8 gm_instr; + int8 gm_rhythm_key; } MT32_MemoryTimbreMaps[] = { {"AccPnoKA2 ", 1, SFX_UNMAPPED}, /* ++ (KQ1) */ {"Acou BD ", SFX_MAPPED_TO_RHYTHM, 34}, /* R (PQ2) */ @@ -560,7 +560,7 @@ static struct { {0, 0, 0} }; -static gint8 +static int8 lookup_instrument(const char *iname) { int i = 0; @@ -572,7 +572,7 @@ lookup_instrument(const char *iname) { return SFX_UNMAPPED; } -static gint8 +static int8 lookup_rhythm_key(const char *iname) { int i = 0; @@ -675,9 +675,9 @@ print_map_rhythm_mem(int sci, int rhythm, char *mt32) { sfx_instrument_map_t * sfx_instrument_map_mt32_to_gm(byte *data, size_t size) { int memtimbres, patches; - guint8 group, number, keyshift, finetune, bender_range; - guint8 *patchpointer; - guint32 pos; + uint8 group, number, keyshift, finetune, bender_range; + uint8 *patchpointer; + uint32 pos; sfx_instrument_map_t * map; int i; int type; diff --git a/engines/sci/sfx/seq/oss-adlib.cpp b/engines/sci/sfx/seq/oss-adlib.cpp index be12033efb..24f936e089 100644 --- a/engines/sci/sfx/seq/oss-adlib.cpp +++ b/engines/sci/sfx/seq/oss-adlib.cpp @@ -50,7 +50,7 @@ extern int _seqbufptr; extern int seqfd; #endif -static guint8 instr[MIDI_CHANNELS]; +static uint8 instr[MIDI_CHANNELS]; static int dev; static int free_voices = ADLIB_VOICES; static long note_time[ADLIB_VOICES]; @@ -267,8 +267,8 @@ midi_adlib_reverb(int param) { } static inline int -midi_adlib_event1(guint8 command, guint8 note, guint8 velocity) { - guint8 channel, oper; +midi_adlib_event1(uint8 command, uint8 note, uint8 velocity) { + uint8 channel, oper; channel = command & 0x0f; oper = command & 0xf0; @@ -301,9 +301,9 @@ midi_adlib_event1(guint8 command, guint8 note, guint8 velocity) { } static inline int -midi_adlib_event2(guint8 command, guint8 param) { - guint8 channel; - guint8 oper; +midi_adlib_event2(uint8 command, uint8 param) { + uint8 channel; + uint8 oper; channel = command & 0x0f; oper = command & 0xf0; diff --git a/engines/sci/sfx/sequencer.h b/engines/sci/sfx/sequencer.h index 803b731449..4c25e8bd46 100644 --- a/engines/sci/sfx/sequencer.h +++ b/engines/sci/sfx/sequencer.h @@ -32,7 +32,6 @@ #include "sci/tools.h" // For GTimeVal #include "sci/sfx/sfx_core.h" #include "sci/sfx/device.h" -#include "sci/include/scitypes.h" namespace Sci { @@ -101,7 +100,7 @@ typedef struct _sfx_sequencer { ** Returns : SFX_OK on success, SFX_ERROR otherwise */ - int (*volume)(guint8 volume); /* OPTIONAL -- can be NULL */ + int (*volume)(uint8 volume); /* OPTIONAL -- can be NULL */ /* Sets the sequencer volume ** Parameters; (byte) volume: The volume to set, with 0 being mute and 127 full volume ** Returns : SFX_OK on success, SFX_ERROR otherwise @@ -115,7 +114,7 @@ typedef struct _sfx_sequencer { int patchfile, patchfile2; /* Patch resources to pass into the call to open(), ** if present, or SFX_SEQ_PATCHFILE_NONE */ - guint8 playmask; /* SCI 'playflag' mask to determine which SCI song channels + uint8 playmask; /* SCI 'playflag' mask to determine which SCI song channels ** this sequencer should play */ /* 0x01 -- MT-32 ** 0x02 -- Yamaha FB-01 @@ -124,8 +123,8 @@ typedef struct _sfx_sequencer { ** 0x10 -- Tandy 3-voice ** 0x20 -- PC speaker */ - guint8 play_rhythm; /* Plays the rhythm channel? */ - gint8 polyphony; /* Device polyphony (# of voices) */ + uint8 play_rhythm; /* Plays the rhythm channel? */ + int8 polyphony; /* Device polyphony (# of voices) */ int min_write_ahead_ms; /* Minimal write-ahead, in milliseconds */ /* Note that write-ahead is tuned automatically; this enforces a lower limit */ diff --git a/engines/sci/sfx/sfx_iterator.h b/engines/sci/sfx/sfx_iterator.h index 9dc1f3a3b3..623206bd20 100644 --- a/engines/sci/sfx/sfx_iterator.h +++ b/engines/sci/sfx/sfx_iterator.h @@ -108,7 +108,7 @@ typedef struct { #define INHERITS_SONG_ITERATOR \ songit_id_t ID; \ - guint16 channel_mask; \ + uint16 channel_mask; \ fade_params_t fade; \ unsigned int flags; \ int priority; \ @@ -126,7 +126,7 @@ typedef struct { typedef struct _song_iterator { songit_id_t ID; - guint16 channel_mask; /* Bitmask of all channels this iterator will use */ + uint16 channel_mask; /* Bitmask of all channels this iterator will use */ fade_params_t fade; unsigned int flags; int priority; diff --git a/engines/sci/sfx/sfx_pcm.h b/engines/sci/sfx/sfx_pcm.h index abb1704741..726399cf6d 100644 --- a/engines/sci/sfx/sfx_pcm.h +++ b/engines/sci/sfx/sfx_pcm.h @@ -29,7 +29,6 @@ #include "sci/sfx/sfx_core.h" #include "sci/sfx/sfx_timer.h" #include "sci/sfx/sfx_time.h" -#include "sci/include/scitypes.h" namespace Sci { diff --git a/engines/sci/sfx/sfx_songlib.h b/engines/sci/sfx/sfx_songlib.h index 6b968bbe08..da619b3777 100644 --- a/engines/sci/sfx/sfx_songlib.h +++ b/engines/sci/sfx/sfx_songlib.h @@ -31,7 +31,6 @@ #include "common/scummsys.h" #include "sci/tools.h" // For GTimeVal -#include "sci/include/scitypes.h" #include "sci/sfx/sfx_iterator.h" namespace Sci { diff --git a/engines/sci/sfx/softseq/SN76496.cpp b/engines/sci/sfx/softseq/SN76496.cpp index 3f9c076a43..2295eceb7b 100644 --- a/engines/sci/sfx/softseq/SN76496.cpp +++ b/engines/sci/sfx/softseq/SN76496.cpp @@ -158,7 +158,7 @@ static inline int get_freq(int note) { void SN76496_poll(sfx_softseq_t *self, byte *dest, int len) { - gint16 *buf = (gint16 *) dest; + int16 *buf = (int16 *) dest; int i; int chan; int freq[CHANNELS_NR]; diff --git a/engines/sci/sfx/softseq/amiga.cpp b/engines/sci/sfx/softseq/amiga.cpp index 643d3092bd..95b82d586f 100644 --- a/engines/sci/sfx/softseq/amiga.cpp +++ b/engines/sci/sfx/softseq/amiga.cpp @@ -71,8 +71,8 @@ typedef struct instrument { int transpose; /* Envelope */ envelope_t envelope[4]; - sbyte *samples; - sbyte *loop; + int8 *samples; + int8 *loop; } instrument_t; typedef struct bank { @@ -141,14 +141,14 @@ static void set_envelope(channel_t *channel, envelope_t *envelope, int phase) { channel->velocity = envelope[phase - 1].target; } -static inline int interpolate(sbyte *samples, frac_t offset) { +static inline int interpolate(int8 *samples, frac_t offset) { int x = fracToInt(offset); int diff = (samples[x + 1] - samples[x]) << 8; return (samples[x] << 8) + fracToInt(diff * (offset & FRAC_LO_MASK)); } -static void play_instrument(gint16 *dest, channel_t *channel, int count) { +static void play_instrument(int16 *dest, channel_t *channel, int count) { int index = 0; int vol = hw_channels[channel->hw_channel].volume; instrument_t *instrument = bank.instruments[channel->instrument]; @@ -157,7 +157,7 @@ static void play_instrument(gint16 *dest, channel_t *channel, int count) { /* Available source samples until end of segment */ frac_t lin_avail; int seg_end, rem, i, amount; - sbyte *samples; + int8 *samples; if (channel->looping) { samples = instrument->loop; @@ -352,11 +352,11 @@ static void start_note(int ch, int note, int velocity) { channels[channel].looping = 0; } -static gint16 read_int16(byte *data) { +static int16 read_int16(byte *data) { return (data[0] << 8) | data[1]; } -static gint32 read_int32(byte *data) { +static int32 read_int32(byte *data) { return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; } @@ -380,15 +380,15 @@ static instrument_t *read_instrument(FILE *file, int *id) { seg_size[2] = read_int16(header + 47) * 2; instrument->mode = header[33]; - instrument->transpose = (gint8) header[34]; + instrument->transpose = (int8) header[34]; for (i = 0; i < 4; i++) { - int length = (gint8) header[49 + i]; + int length = (int8) header[49 + i]; if (length == 0 && i > 0) length = 256; instrument->envelope[i].length = length * FREQUENCY / 60; - instrument->envelope[i].delta = (gint8) header[53 + i]; + instrument->envelope[i].delta = (int8) header[53 + i]; instrument->envelope[i].target = header[57 + i]; } /* Final target must be 0 */ @@ -410,7 +410,7 @@ static instrument_t *read_instrument(FILE *file, int *id) { sciprintf(" Segment sizes: %i %i %i\n", seg_size[0], seg_size[1], seg_size[2]); sciprintf(" Segment offsets: 0 %i %i\n", loop_offset, read_int32(header + 43)); #endif - instrument->samples = (sbyte *) sci_malloc(size + 1); + instrument->samples = (int8 *) sci_malloc(size + 1); if (fread(instrument->samples, 1, size, file) < (unsigned int)size) { sciprintf("[sfx:seq:amiga] Error: failed to read instrument samples\n"); return NULL; @@ -433,7 +433,7 @@ static instrument_t *read_instrument(FILE *file, int *id) { instrument->size = seg_size[0]; instrument->loop_size = seg_size[1]; - instrument->loop = (sbyte*)sci_malloc(instrument->loop_size + 1); + instrument->loop = (int8*)sci_malloc(instrument->loop_size + 1); memcpy(instrument->loop, instrument->samples + loop_offset, instrument->loop_size); instrument->samples[instrument->size] = instrument->loop[0]; @@ -569,8 +569,8 @@ static void ami_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { void ami_poll(sfx_softseq_t *self, byte *dest, int len) { int i, j; - gint16 *buf = (gint16 *) dest; - gint16 *buffers = (gint16*)malloc(len * 2 * CHANNELS_NR); + int16 *buf = (int16 *) dest; + int16 *buffers = (int16*)malloc(len * 2 * CHANNELS_NR); memset(buffers, 0, len * 2 * CHANNELS_NR); memset(dest, 0, len * 4); diff --git a/engines/sci/sfx/softseq/fluidsynth.cpp b/engines/sci/sfx/softseq/fluidsynth.cpp index 05e99c5738..17fcef34ba 100644 --- a/engines/sci/sfx/softseq/fluidsynth.cpp +++ b/engines/sci/sfx/softseq/fluidsynth.cpp @@ -41,7 +41,7 @@ namespace Sci { static sfx_sequencer_t *gmseq; static fluid_settings_t* settings; static fluid_synth_t* synth; -static guint8 status; +static uint8 status; static char *soundfont = "/etc/midi/8MBGMSFX.SF2"; static int rpn[16]; @@ -65,7 +65,7 @@ fluidsynth_midi_write(struct _midi_writer *self, unsigned char *buf, int len) { if (buf[0] == 0xf0) sciprintf("FluidSynth: Skipping sysex message.\n"); else if (len == 2) { - guint8 command, channel; + uint8 command, channel; command = buf[0] & 0xf0; channel = buf[0] & 0x0f; @@ -78,7 +78,7 @@ fluidsynth_midi_write(struct _midi_writer *self, unsigned char *buf, int len) { printf("FluidSynth: MIDI command [%02x %02x] not supported\n", buf[0], buf[1]); } } else if (len == 3) { - guint8 command, channel; + uint8 command, channel; command = buf[0] & 0xf0; channel = buf[0] & 0x0f; diff --git a/engines/sci/sfx/softseq/opl2.cpp b/engines/sci/sfx/softseq/opl2.cpp index 81a0d13fc3..1229000283 100644 --- a/engines/sci/sfx/softseq/opl2.cpp +++ b/engines/sci/sfx/softseq/opl2.cpp @@ -99,28 +99,28 @@ static int ym3812_note[13] = { 0x2ae }; -static guint8 sci_adlib_vol_base[16] = { +static uint8 sci_adlib_vol_base[16] = { 0x00, 0x11, 0x15, 0x19, 0x1D, 0x22, 0x26, 0x2A, 0x2E, 0x23, 0x37, 0x3B, 0x3F, 0x3F, 0x3F, 0x3F }; -static guint8 sci_adlib_vol_tables[16][64]; +static uint8 sci_adlib_vol_tables[16][64]; /* back to your regularly scheduled definitions */ -static guint8 instr[MIDI_CHANNELS]; -static guint16 pitch[MIDI_CHANNELS]; -static guint8 vol[MIDI_CHANNELS]; -static guint8 pan[MIDI_CHANNELS]; +static uint8 instr[MIDI_CHANNELS]; +static uint16 pitch[MIDI_CHANNELS]; +static uint8 vol[MIDI_CHANNELS]; +static uint8 pan[MIDI_CHANNELS]; static int free_voices = ADLIB_VOICES; -static guint8 oper_note[ADLIB_VOICES]; -static guint8 oper_chn[ADLIB_VOICES]; +static uint8 oper_note[ADLIB_VOICES]; +static uint8 oper_chn[ADLIB_VOICES]; static FM_OPL *ym3812_L = NULL; static FM_OPL *ym3812_R = NULL; -static guint8 adlib_reg_L[256]; -static guint8 adlib_reg_R[256]; -static guint8 adlib_master; +static uint8 adlib_reg_L[256]; +static uint8 adlib_reg_R[256]; +static uint8 adlib_master; /* initialise note/operator lists, etc. */ @@ -131,7 +131,7 @@ void adlibemu_init_lists() { for (i = 0 ; i < 16 ; i++) { for (j = 0; j < 64 ; j++) { - sci_adlib_vol_tables[i][j] = ((guint16)sci_adlib_vol_base[i]) * j / 63; + sci_adlib_vol_tables[i][j] = ((uint16)sci_adlib_vol_base[i]) * j / 63; } } @@ -171,14 +171,14 @@ static inline int opl_write(int a, int v) { } /* -static inline guint8 opl_read (int a) +static inline uint8 opl_read (int a) { OPLWrite (ym3812_L, 0x388, a); return OPLRead (ym3812_L, 0x389); } */ -void synth_setpatch(int voice, guint8 *data) { +void synth_setpatch(int voice, uint8 *data) { int i; opl_write(0xBD, 0); @@ -201,7 +201,7 @@ void synth_setpatch(int voice, guint8 *data) { } void synth_setvolume_L(int voice, int volume) { - gint8 level1, level2; + int8 level1, level2; level1 = ~adlib_reg_L[register_base[2] + register_offset[voice]] & 0x3f; level2 = ~adlib_reg_L[register_base[3] + register_offset[voice]] & 0x3f; @@ -227,17 +227,17 @@ void synth_setvolume_L(int voice, int volume) { /* algorithm-dependent; we may need to set both operators. */ if (adlib_reg_L[register_base[10] + voice] & 1) opl_write_L(register_base[2] + register_offset[voice], - (guint8)((~level1 &0x3f) | + (uint8)((~level1 &0x3f) | (adlib_reg_L[register_base[2] + register_offset[voice]]&0xc0))); opl_write_L(register_base[3] + register_offset[voice], - (guint8)((~level2 &0x3f) | + (uint8)((~level2 &0x3f) | (adlib_reg_L[register_base[3] + register_offset[voice]]&0xc0))); } void synth_setvolume_R(int voice, int volume) { - gint8 level1, level2; + int8 level1, level2; level1 = ~adlib_reg_R[register_base[2] + register_offset[voice]] & 0x3f; level2 = ~adlib_reg_R[register_base[3] + register_offset[voice]] & 0x3f; @@ -263,11 +263,11 @@ void synth_setvolume_R(int voice, int volume) { /* now for the other side. */ if (adlib_reg_R[register_base[10] + voice] & 1) opl_write_R(register_base[2] + register_offset[voice], - (guint8)((~level1 &0x3f) | + (uint8)((~level1 &0x3f) | (adlib_reg_R[register_base[2] + register_offset[voice]]&0xc0))); opl_write_R(register_base[3] + register_offset[voice], - (guint8)((~level2 &0x3f) | + (uint8)((~level2 &0x3f) | (adlib_reg_R[register_base[3] + register_offset[voice]]&0xc0))); } @@ -423,9 +423,9 @@ void test_adlib() { int voice = 0; #if 0 - guint8 data[] = { 0x25, 0x21, 0x48, 0x48, 0xf0, 0xf2, 0xf0, 0xa5, 0x00, 0x00, 0x06 }; + uint8 data[] = { 0x25, 0x21, 0x48, 0x48, 0xf0, 0xf2, 0xf0, 0xa5, 0x00, 0x00, 0x06 }; #else - guint8 *data = adlib_sbi[0x0a]; + uint8 *data = adlib_sbi[0x0a]; #endif #if 1 @@ -469,8 +469,8 @@ void test_adlib() { We assume 16-bit stereo frames (ie 4 bytes) */ static void opl2_poll(sfx_softseq_t *self, byte *dest, int count) { - gint16 *buffer = (gint16 *) dest; - gint16 *ptr = buffer; + int16 *buffer = (int16 *) dest; + int16 *ptr = buffer; if (!ready) { error("synth_mixer(): !ready \n"); @@ -580,8 +580,8 @@ int midi_adlibemu_reverb(short param) { return 0; } -int midi_adlibemu_event(guint8 command, guint8 note, guint8 velocity, guint32 delta) { - guint8 channel, oper; +int midi_adlibemu_event(uint8 command, uint8 note, uint8 velocity, uint32 delta) { + uint8 channel, oper; channel = command & 0x0f; oper = command & 0xf0; @@ -628,9 +628,9 @@ int midi_adlibemu_event(guint8 command, guint8 note, guint8 velocity, guint32 de return 0; } -int midi_adlibemu_event2(guint8 command, guint8 param, guint32 delta) { - guint8 channel; - guint8 oper; +int midi_adlibemu_event2(uint8 command, uint8 param, uint32 delta) { + uint8 channel; + uint8 oper; channel = command & 0x0f; oper = command & 0xf0; @@ -649,9 +649,9 @@ int midi_adlibemu_event2(guint8 command, guint8 param, guint32 delta) { } static void opl2_volume(sfx_softseq_t *self, int volume) { - guint8 i; + uint8 i; - i = (guint8)volume * 15 / 100; + i = (uint8)volume * 15 / 100; adlib_master = i; diff --git a/engines/sci/sfx/softseq/pcspeaker.cpp b/engines/sci/sfx/softseq/pcspeaker.cpp index 2b5bea3fbe..8d9b6e3da8 100644 --- a/engines/sci/sfx/softseq/pcspeaker.cpp +++ b/engines/sci/sfx/softseq/pcspeaker.cpp @@ -110,7 +110,7 @@ void sps_poll(sfx_softseq_t *self, byte *dest, int len) { int oct_diff = ((halftone_delta + BASE_OCTAVE * 12) / 12) - BASE_OCTAVE; int halftone_index = (halftone_delta + (12 * 100)) % 12 ; int freq = (!note) ? 0 : freq_table[halftone_index] / (1 << (-oct_diff)); - gint16 *buf = (gint16 *) dest; + int16 *buf = (int16 *) dest; int i; for (i = 0; i < len; i++) { diff --git a/engines/sci/tools.h b/engines/sci/tools.h index d0122dc089..c4ae2fc98c 100644 --- a/engines/sci/tools.h +++ b/engines/sci/tools.h @@ -54,8 +54,6 @@ #endif #define VERSION "0.6.4" -#include "sci/include/scitypes.h" - // FIXME: Mostly for close() in lots of places. Get rid of this! #ifndef _MSC_VER #include <unistd.h> |