diff options
author | Max Horn | 2003-06-14 18:52:30 +0000 |
---|---|---|
committer | Max Horn | 2003-06-14 18:52:30 +0000 |
commit | f7a8cbf7c73479ff086276ef04b0fea15085a13a (patch) | |
tree | 681f750d30d6e128bdeee471df0472a8d3cb6be3 /simon | |
parent | 9658dd6ea367ce71e1928003236c1801c5e3b1ee (diff) | |
download | scummvm-rg350-f7a8cbf7c73479ff086276ef04b0fea15085a13a.tar.gz scummvm-rg350-f7a8cbf7c73479ff086276ef04b0fea15085a13a.tar.bz2 scummvm-rg350-f7a8cbf7c73479ff086276ef04b0fea15085a13a.zip |
Patch #754151: Removed READ_*_UNALIGNED and always read stuff bytewise; augmented by some more changes of mine
svn-id: r8482
Diffstat (limited to 'simon')
-rw-r--r-- | simon/charset.cpp | 2 | ||||
-rw-r--r-- | simon/debug.cpp | 34 | ||||
-rw-r--r-- | simon/simon.cpp | 50 | ||||
-rw-r--r-- | simon/vga.cpp | 44 |
4 files changed, 65 insertions, 65 deletions
diff --git a/simon/charset.cpp b/simon/charset.cpp index ab405fea13..48023dbbce 100644 --- a/simon/charset.cpp +++ b/simon/charset.cpp @@ -79,7 +79,7 @@ void SimonEngine::render_string(uint num_1, uint color, uint width, uint height, *(uint16 *)(p + 4) = TO_BE_16(height); *(uint16 *)(p + 6) = TO_BE_16(width); - dst += READ_BE_UINT32_UNALIGNED(p); + dst += READ_BE_UINT32(p); memset(dst, 0, count); diff --git a/simon/debug.cpp b/simon/debug.cpp index e0c189b90a..62b3b03431 100644 --- a/simon/debug.cpp +++ b/simon/debug.cpp @@ -175,7 +175,7 @@ void SimonEngine::dump_video_script(byte *src, bool one_opcode_only) { do { if (!(_game & GF_SIMON2)) { - opcode = READ_BE_UINT16_UNALIGNED(src); + opcode = READ_BE_UINT16(src); src += 2; } else { opcode = *src++; @@ -205,21 +205,21 @@ void SimonEngine::dump_video_script(byte *src, bool one_opcode_only) { fprintf(_dump_file, "%d ", *src++); break; case 'd': - fprintf(_dump_file, "%d ", READ_BE_UINT16_UNALIGNED(src)); + fprintf(_dump_file, "%d ", READ_BE_UINT16(src)); src += 2; break; case 'v': - fprintf(_dump_file, "[%d] ", READ_BE_UINT16_UNALIGNED(src)); + fprintf(_dump_file, "[%d] ", READ_BE_UINT16(src)); src += 2; break; case 'i': - fprintf(_dump_file, "%d ", (int16)READ_BE_UINT16_UNALIGNED(src)); + fprintf(_dump_file, "%d ", (int16)READ_BE_UINT16(src)); src += 2; break; case 'q': - while (READ_BE_UINT16_UNALIGNED(src) != 999) { - fprintf(_dump_file, "(%d,%d) ", READ_BE_UINT16_UNALIGNED(src), - READ_BE_UINT16_UNALIGNED(src + 2)); + while (READ_BE_UINT16(src) != 999) { + fprintf(_dump_file, "(%d,%d) ", READ_BE_UINT16(src), + READ_BE_UINT16(src + 2)); src += 4; } src++; @@ -240,13 +240,13 @@ void SimonEngine::dump_vga_file(byte *vga) { int count; pp = vga; - p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) pp)->hdr2_start); - count = READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) p)->id_count); - p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) p)->id_table); + p = pp + READ_BE_UINT16(&((VgaFile1Header *) pp)->hdr2_start); + count = READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_count); + p = pp + READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_table); while (--count >= 0) { - int id = READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->id); + int id = READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->id); - dump_vga_script_always(vga + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->script_offs), id / 100, id); + dump_vga_script_always(vga + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), id / 100, id); p += sizeof(VgaFile1Struct0x6); } } @@ -256,14 +256,14 @@ void SimonEngine::dump_vga_file(byte *vga) { int c; bb = vga; - b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) bb)->hdr2_start); - c = READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) b)->unk1); - b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) b)->unk2_offs); + b = bb + READ_BE_UINT16(&((VgaFile1Header *) bb)->hdr2_start); + c = READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk1); + b = bb + READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk2_offs); while (--c >= 0) { - int id = READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->id); + int id = READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->id); - dump_vga_script_always(vga + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->script_offs), id / 100, id); + dump_vga_script_always(vga + READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->script_offs), id / 100, id); b += sizeof(VgaFile1Struct0x8); } } diff --git a/simon/simon.cpp b/simon/simon.cpp index 592575af9c..046f41bf66 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -2248,11 +2248,11 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { // ensure flipping complete bb = _cur_vga_file_1; - b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) bb)->hdr2_start); - c = READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) b)->unk1); - b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) b)->unk2_offs); + b = bb + READ_BE_UINT16(&((VgaFile1Header *) bb)->hdr2_start); + c = READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk1); + b = bb + READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk2_offs); - while (READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->id) != vga_res_id) + while (READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->id) != vga_res_id) b += sizeof(VgaFile1Struct0x8); if (!(_game & GF_SIMON2)) { @@ -2272,7 +2272,7 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { vc_ptr_org = _vc_ptr; - _vc_ptr = _cur_vga_file_1 + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->script_offs); + _vc_ptr = _cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->script_offs); //dump_vga_script(_vc_ptr, num, vga_res_id); run_vga_script(); _vc_ptr = vc_ptr_org; @@ -2795,15 +2795,15 @@ void SimonEngine::timer_vga_sprites() { _video_palette_mode = vsp->unk6; _vga_cur_sprite_id = vsp->id; - params[0] = READ_BE_UINT16_UNALIGNED(&vsp->image); - params[1] = READ_BE_UINT16_UNALIGNED(&vsp->base_color); - params[2] = READ_BE_UINT16_UNALIGNED(&vsp->x); - params[3] = READ_BE_UINT16_UNALIGNED(&vsp->y); + params[0] = READ_BE_UINT16(&vsp->image); + params[1] = READ_BE_UINT16(&vsp->base_color); + params[2] = READ_BE_UINT16(&vsp->x); + params[3] = READ_BE_UINT16(&vsp->y); if (_game & GF_SIMON2) { *(byte *)(¶ms[4]) = (byte)vsp->unk4; } else { - params[4] = READ_BE_UINT16_UNALIGNED(&vsp->unk4); + params[4] = READ_BE_UINT16(&vsp->unk4); } _vc_ptr = (byte *)params; @@ -2837,7 +2837,7 @@ void SimonEngine::timer_vga_sprites_helper() { } src = _vga_var7 + x * 4; - decodeStripA(dst, src + READ_BE_UINT32_UNALIGNED(&*((uint32 *)src)), _vga_var5); + decodeStripA(dst, src + READ_BE_UINT32(&*((uint32 *)src)), _vga_var5); dx_unlock_2(); @@ -2875,11 +2875,11 @@ void SimonEngine::timer_vga_sprites_2() { if (vsp->image) fprintf(_dump_file, "id:%5d image:%3d base-color:%3d x:%3d y:%3d flags:%x\n", vsp->id, vsp->image, vsp->base_color, vsp->x, vsp->y, vsp->unk4); - params[0] = READ_BE_UINT16_UNALIGNED(&vsp->image); - params[1] = READ_BE_UINT16_UNALIGNED(&vsp->base_color); - params[2] = READ_BE_UINT16_UNALIGNED(&vsp->x); - params[3] = READ_BE_UINT16_UNALIGNED(&vsp->y); - params[4] = READ_BE_UINT16_UNALIGNED(&vsp->unk4); + params[0] = READ_BE_UINT16(&vsp->image); + params[1] = READ_BE_UINT16(&vsp->base_color); + params[2] = READ_BE_UINT16(&vsp->x); + params[3] = READ_BE_UINT16(&vsp->y); + params[4] = READ_BE_UINT16(&vsp->unk4); _vc_ptr = (byte *)params; vc_10_draw(); @@ -3108,9 +3108,9 @@ void SimonEngine::o_pathfind(int x, int y, uint var_1, uint var_2) { p = (uint16 *)_pathfind_array[20 - i]; if (!p) continue; - for (j = 0; READ_BE_UINT16_UNALIGNED(&p[0]) != 999; j++, p += 2) { // 0xE703 = byteswapped 999 - x_diff = abs((int)(READ_BE_UINT16_UNALIGNED(&p[0]) - x)); - y_diff = abs((int)(READ_BE_UINT16_UNALIGNED(&p[1]) - 12 - y)); + for (j = 0; READ_BE_UINT16(&p[0]) != 999; j++, p += 2) { // 0xE703 = byteswapped 999 + x_diff = abs((int)(READ_BE_UINT16(&p[0]) - x)); + y_diff = abs((int)(READ_BE_UINT16(&p[1]) - 12 - y)); if (x_diff < y_diff) { x_diff >>= 2; @@ -3714,17 +3714,17 @@ void SimonEngine::start_vga_code(uint b, uint vga_res, uint vga_struct_id, uint } pp = _cur_vga_file_1; - p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) pp)->hdr2_start); + p = pp + READ_BE_UINT16(&((VgaFile1Header *) pp)->hdr2_start); - count = READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) p)->id_count); - p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) p)->id_table); + count = READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_count); + p = pp + READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_table); for (;;) { - if (READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->id) == vga_struct_id) { + if (READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->id) == vga_struct_id) { - //dump_vga_script(pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6*)p)->script_offs), vga_res, vga_struct_id); + //dump_vga_script(pp + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), vga_res, vga_struct_id); - add_vga_timer(gss->VGA_DELAY_BASE, pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->script_offs), vga_struct_id, vga_res); + add_vga_timer(gss->VGA_DELAY_BASE, pp + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_struct_id, vga_res); break; } p += sizeof(VgaFile1Struct0x6); diff --git a/simon/vga.cpp b/simon/vga.cpp index 6a0769d61e..528e87abef 100644 --- a/simon/vga.cpp +++ b/simon/vga.cpp @@ -120,7 +120,7 @@ void SimonEngine::run_vga_script() { } if (!(_game & GF_SIMON2)) { - opcode = READ_BE_UINT16_UNALIGNED(_vc_ptr); + opcode = READ_BE_UINT16(_vc_ptr); _vc_ptr += 2; } else { opcode = *_vc_ptr++; @@ -144,7 +144,7 @@ int SimonEngine::vc_read_var_or_word() { } uint SimonEngine::vc_read_next_word() { - uint a = READ_BE_UINT16_UNALIGNED(_vc_ptr); + uint a = READ_BE_UINT16(_vc_ptr); _vc_ptr += 2; return a; } @@ -245,15 +245,15 @@ void SimonEngine::vc_2_call() { bb = _cur_vga_file_1; - b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) bb)->hdr2_start); - b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) b)->unk2_offs); + b = bb + READ_BE_UINT16(&((VgaFile1Header *) bb)->hdr2_start); + b = bb + READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk2_offs); - while (READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->id) != num) + while (READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->id) != num) b += sizeof(VgaFile1Struct0x8); vc_ptr_org = _vc_ptr; - _vc_ptr = _cur_vga_file_1 + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->script_offs); + _vc_ptr = _cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->script_offs); //dump_vga_script(_vc_ptr, res, num); run_vga_script(); @@ -317,10 +317,10 @@ void SimonEngine::vc_3_new_sprite() { } pp = _cur_vga_file_1; - p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) pp)->hdr2_start); - p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) p)->id_table); + p = pp + READ_BE_UINT16(&((VgaFile1Header *) pp)->hdr2_start); + p = pp + READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_table); - while (READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->id) != b) + while (READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->id) != b) p += sizeof(VgaFile1Struct0x6); #ifdef DUMP_FILE_NR @@ -343,9 +343,9 @@ void SimonEngine::vc_3_new_sprite() { } #endif - //dump_vga_script(_cur_vga_file_1 + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6*)p)->script_offs), res, b); + //dump_vga_script(_cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), res, b); - add_vga_timer(gss->VGA_DELAY_BASE, _cur_vga_file_1 + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->script_offs), b, res); + add_vga_timer(gss->VGA_DELAY_BASE, _cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), b, res); } void SimonEngine::vc_4_dummy_op() { @@ -599,9 +599,9 @@ void SimonEngine::vc_10_draw() { state.image = vc_read_var(-state.image); p2 = _cur_vga_file_2 + state.image * 8; - state.depack_src = _cur_vga_file_2 + READ_BE_UINT32_UNALIGNED(&*(uint32 *)p2); + state.depack_src = _cur_vga_file_2 + READ_BE_UINT32(p2); - width = READ_BE_UINT16_UNALIGNED(p2 + 6) >> 4; + width = READ_BE_UINT16(p2 + 6) >> 4; height = p2[5]; flags = p2[4]; @@ -640,7 +640,7 @@ void SimonEngine::vc_10_draw() { src = state.depack_src + _x_scroll * 4; for (w = 0; w < 40; w++) { - decodeStripA(dst, src + READ_BE_UINT32_UNALIGNED(&*(uint32 *)src), height); + decodeStripA(dst, src + READ_BE_UINT32(src), height); dst += 8; src += 4; } @@ -1031,7 +1031,7 @@ void SimonEngine::vc_16_sleep_on_id() { void SimonEngine::vc_17_set_pathfind_item() { uint a = vc_read_next_word(); _pathfind_array[a - 1] = (uint16 *)_vc_ptr; - while (READ_BE_UINT16_UNALIGNED(_vc_ptr) != 999) + while (READ_BE_UINT16(_vc_ptr) != 999) _vc_ptr += 4; _vc_ptr += 2; } @@ -1483,9 +1483,9 @@ void SimonEngine::vc_48() { vp = &_variableArray[20]; do { - y2 = READ_BE_UINT16_UNALIGNED(p); + y2 = READ_BE_UINT16(p); p += step; - y1 = READ_BE_UINT16_UNALIGNED(p) - y2; + y1 = READ_BE_UINT16(p) - y2; vp[0] = y1 >> 1; vp[1] = y1 - (y1 >> 1); @@ -1738,11 +1738,11 @@ void SimonEngine::vc_62_palette_thing() { _cur_vga_file_2 = vpe->vgaFile2; _video_palette_mode = vsp->unk6; - params[0] = READ_BE_UINT16_UNALIGNED(&vsp->image); - params[1] = READ_BE_UINT16_UNALIGNED(&vsp->base_color); - params[2] = READ_BE_UINT16_UNALIGNED(&vsp->x); - params[3] = READ_BE_UINT16_UNALIGNED(&vsp->y); - params[4] = READ_BE_UINT16_UNALIGNED(&vsp->unk4); + params[0] = READ_BE_UINT16(&vsp->image); + params[1] = READ_BE_UINT16(&vsp->base_color); + params[2] = READ_BE_UINT16(&vsp->x); + params[3] = READ_BE_UINT16(&vsp->y); + params[4] = READ_BE_UINT16(&vsp->unk4); _vc_ptr = (byte *)params; vc_10_draw(); |