aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorTravis Howell2003-12-16 05:04:39 +0000
committerTravis Howell2003-12-16 05:04:39 +0000
commit0b61a4c3a86e0583a74f6a53835e90c484a196e0 (patch)
treeea8b67a9ba97a3a6f8ac6a3dccd9cfab4fae21d1 /simon
parente2843f3e07b9774c7cd85a2d69bdd1746bd86648 (diff)
downloadscummvm-rg350-0b61a4c3a86e0583a74f6a53835e90c484a196e0.tar.gz
scummvm-rg350-0b61a4c3a86e0583a74f6a53835e90c484a196e0.tar.bz2
scummvm-rg350-0b61a4c3a86e0583a74f6a53835e90c484a196e0.zip
Add some additional simon1 amiga code from tsuteiuQ, not working right yet.
svn-id: r11670
Diffstat (limited to 'simon')
-rw-r--r--simon/charset.cpp91
-rw-r--r--simon/simon.cpp7
-rw-r--r--simon/simon.h1
3 files changed, 98 insertions, 1 deletions
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);