From 0b61a4c3a86e0583a74f6a53835e90c484a196e0 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 16 Dec 2003 05:04:39 +0000 Subject: Add some additional simon1 amiga code from tsuteiuQ, not working right yet. svn-id: r11670 --- simon/charset.cpp | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ simon/simon.cpp | 7 ++++- simon/simon.h | 1 + 3 files changed, 98 insertions(+), 1 deletion(-) diff --git a/simon/charset.cpp b/simon/charset.cpp index 6f078acb92..575039ddf3 100644 --- a/simon/charset.cpp +++ b/simon/charset.cpp @@ -61,6 +61,97 @@ void SimonEngine::print_char_helper_6(uint i) { } } +void SimonEngine::render_string_amiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) { + VgaPointersEntry *vpe = &_vga_buffer_pointers[2]; + byte *src, *dst, *dst_org, chr; + uint count; + + if (vga_sprite_id >= 100) { + vga_sprite_id -= 100; + vpe++; + } + + src = dst = vpe->vgaFile2; + + count = 499; + if (vga_sprite_id == 1) + count *= 2; + + src += vga_sprite_id * 8; + dst += READ_BE_UINT32(src); + *(uint16 *)(dst + 4) = TO_BE_16(height); + *(uint16 *)(dst + 6) = TO_BE_16(width); + + uint charsize = width/8 * height; + memset(dst, 0, count); + dst_org = dst; + int delta = 0; + while ((chr = *txt++) != 0) { + int tmp = chr; + if (chr == 10) { + dst_org += width * 10; + dst = dst_org; + delta = 0; + } else if ((tmp -= '!') < 0) { + delta += 6; + if (delta > 8) + { + delta -= 8; + dst_org++; + } + } else { + byte *img = src + chr * 41; + int CTR = img[40]; + int D3 = 8 - delta; + for (int D2 = 9; D2 != 0; D2--) + { + byte *cur_dst = dst_org; + for (int D7 = 2; D7 != 0; D7--) + { + chr = *img >> delta; + if (chr) + { + if (color & 1) *(cur_dst + charsize * 0) |= chr; + if (color & 2) *(cur_dst + charsize * 1) |= chr; + if (color & 4) *(cur_dst + charsize * 2) |= chr; + if (color & 8) *(cur_dst + charsize * 3) |= chr; + } + if ((D3 >= CTR) && (chr = *img++ << (D3))) + { + if (color & 1) *(cur_dst + charsize * 0) |= chr; + if (color & 2) *(cur_dst + charsize * 1) |= chr; + if (color & 4) *(cur_dst + charsize * 2) |= chr; + if (color & 8) *(cur_dst + charsize * 3) |= chr; + } + color++; + } + chr = *img >> delta; + if (chr) + { + *(cur_dst + charsize * 0) |= chr; + *(cur_dst + charsize * 1) |= chr; + *(cur_dst + charsize * 2) |= chr; + *(cur_dst + charsize * 3) |= chr; + } + if ((D3 >= CTR) && (chr = *img++ << (D3))) + { + *(cur_dst + charsize * 0) |= chr; + *(cur_dst + charsize * 1) |= chr; + *(cur_dst + charsize * 2) |= chr; + *(cur_dst + charsize * 3) |= chr; + } + cur_dst += width/8; + } + delta += CTR; + if (delta > 8) + { + delta -= 8; + dst_org++; + } + } + } +} + void SimonEngine::render_string(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) { VgaPointersEntry *vpe = &_vga_buffer_pointers[2]; byte *src, *dst, *p, *dst_org, chr; diff --git a/simon/simon.cpp b/simon/simon.cpp index f8dbde8881..f18b5f4888 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -4289,7 +4289,12 @@ void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *str } color = color * 3 + 192; - render_string(vga_sprite_id, color, width, height, print_str_buf); + if (_game & GF_AMIGA) + render_string_amiga(vga_sprite_id, color, width, height, print_str_buf); + else + render_string(vga_sprite_id, color, width, height, print_str_buf); + + num_of_rows = 4; if (!(_bit_array[8] & 0x20)) num_of_rows = 3; diff --git a/simon/simon.h b/simon/simon.h index 3366fe0178..172f043c49 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -596,6 +596,7 @@ protected: void talk_with_text(uint vga_sprite_id, uint color, const char *string_ptr, uint threeval_a, int threeval_b, uint width); FillOrCopyStruct *fcs_alloc(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint unk4); + void render_string_amiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt); void render_string(uint vga_sprite_id, uint color, uint width, uint height, const char *txt); void setup_hit_areas(FillOrCopyStruct *fcs, uint fcs_index); -- cgit v1.2.3