From 9c647b4dbe7c377831007c464bda238ed5815fa0 Mon Sep 17 00:00:00 2001 From: Oliver Kiehl Date: Sun, 14 Mar 2004 17:50:40 +0000 Subject: cleanup svn-id: r13277 --- simon/items.cpp | 18 +++++++++--------- simon/simon.cpp | 45 +++++++++++++++++++++++---------------------- simon/simon.h | 12 ++++++------ 3 files changed, 38 insertions(+), 37 deletions(-) (limited to 'simon') diff --git a/simon/items.cpp b/simon/items.cpp index 32ec73de41..d945f6ba76 100644 --- a/simon/items.cpp +++ b/simon/items.cpp @@ -888,11 +888,11 @@ int SimonEngine::runScript() { break; case 161:{ /* setup text */ - ThreeValues *tv = getThreeValues(getVarOrByte()); + TextLocation *tl = getTextLocation(getVarOrByte()); - tv->a = getVarOrWord(); - tv->b = getVarOrByte(); - tv->c = getVarOrWord(); + tl->x = getVarOrWord(); + tl->y = getVarOrByte(); + tl->width = getVarOrWord(); } break; @@ -974,14 +974,14 @@ int SimonEngine::runScript() { uint speech_id = 0; const char *string_ptr = (const char *)getStringPtrByID(_stringid_array_3[string_id]); - ThreeValues *tv = getThreeValues(vga_sprite_id); + TextLocation *tl = getTextLocation(vga_sprite_id); if (_game & GF_TALKIE) speech_id = _speechid_array_4[string_id]; if (_speech && speech_id != 0) talk_with_speech(speech_id, vga_sprite_id); if (string_ptr != NULL && _subtitles) - talk_with_text(vga_sprite_id, color, string_ptr, tv->a, tv->b, tv->c); + talk_with_text(vga_sprite_id, color, string_ptr, tl->x, tl->y, tl->width); } break; @@ -1211,13 +1211,13 @@ void SimonEngine::o_inventory_descriptions() { uint vga_sprite_id = getVarOrByte(); uint color = getVarOrByte(); const char *string_ptr = NULL; - ThreeValues *tv = NULL; + TextLocation *tl = NULL; char buf[256]; Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2); if (child != NULL && child->avail_props & 1) { string_ptr = (const char *)getStringPtrByID(child->array[0]); - tv = getThreeValues(vga_sprite_id); + tl = getTextLocation(vga_sprite_id); } if ((_game & GF_SIMON2) && (_game & GF_TALKIE)) { @@ -1288,7 +1288,7 @@ void SimonEngine::o_inventory_descriptions() { string_ptr = buf; } if (string_ptr != NULL) - talk_with_text(vga_sprite_id, color, string_ptr, tv->a, tv->b, tv->c); + talk_with_text(vga_sprite_id, color, string_ptr, tl->x, tl->y, tl->width); } } diff --git a/simon/simon.cpp b/simon/simon.cpp index 982e9ae8ff..49afef9876 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -2157,18 +2157,16 @@ void SimonEngine::handle_verb_clicked(uint verb) { startUp_helper_2(); } -ThreeValues *SimonEngine::getThreeValues(uint a) { +TextLocation *SimonEngine::getTextLocation(uint a) { switch (a) { case 1: - return &_threevalues_1; + return &_textlocation_1; case 2: - return &_threevalues_2; + return &_textlocation_2; case 101: - return &_threevalues_3; - break; + return &_textlocation_3; case 102: - return &_threevalues_4; - break; + return &_textlocation_4; default: error("text, invalid value %d", a); } @@ -2180,7 +2178,7 @@ void SimonEngine::o_print_str() { uint string_id = getNextStringID(); const byte *string_ptr = NULL; uint speech_id = 0; - ThreeValues *tv; + TextLocation *tl; if (string_id != 0xFFFF) string_ptr = getStringPtrByID(string_id); @@ -2188,7 +2186,7 @@ void SimonEngine::o_print_str() { if (_game & GF_TALKIE) speech_id = (uint16)getNextWord(); - tv = getThreeValues(vga_sprite_id); + tl = getTextLocation(vga_sprite_id); if (_speech && speech_id != 0) talk_with_speech(speech_id, vga_sprite_id); @@ -2196,7 +2194,7 @@ void SimonEngine::o_print_str() { o_kill_sprite_simon2(2, vga_sprite_id + 2); if (string_ptr != NULL && (speech_id == 0 || _subtitles)) - talk_with_text(vga_sprite_id, color, (const char *)string_ptr, tv->a, tv->b, tv->c); + talk_with_text(vga_sprite_id, color, (const char *)string_ptr, tl->x, tl->y, tl->width); } @@ -3001,6 +2999,7 @@ void SimonEngine::timer_vga_sprites() { } vsp = _vga_sprites; + while (vsp->id != 0) { vsp->unk6 &= 0x7FFF; @@ -4073,7 +4072,7 @@ void SimonEngine::talk_with_speech(uint speech_id, uint vga_sprite_id) { } } -void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *string_ptr, uint threeval_a, int threeval_b, uint width) { +void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width) { char print_str_buf[0x140]; char *char_buf; const char *string_ptr_2, *string_ptr_3; @@ -4127,7 +4126,7 @@ void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *str *char_buf++ = 10; height += 10; - threeval_b -= 10; + y -= 10; j = -1; } else { // else_1 @@ -4182,7 +4181,7 @@ void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *str char_buf += m; *char_buf++ = 10; height += 20; - threeval_b -= 20; + y -= 20; j = -1; } else { // else_6 @@ -4255,7 +4254,7 @@ void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *str char_buf += m; *char_buf++ = '\n'; height += 30; - threeval_b -= 30; + y -= 30; j = -1; } else { // else_15 @@ -4297,7 +4296,7 @@ void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *str char_buf += m; *char_buf++ = 10; height += 10; - threeval_b -= 10; + y -= 10; string_ptr = string_ptr_2; } } @@ -4322,17 +4321,19 @@ void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *str render_string(vga_sprite_id, color, width, height, print_str_buf); - num_of_rows = 4; - if (!(_bit_array[8] & 0x20)) - num_of_rows = 3; + uint b; + if (_bit_array[8] & 0x20) + b = 4; + else + b = 3; - if (threeval_b < 2) - threeval_b = 2; + if (y < 2) + y = 2; if (!(_game & GF_SIMON2)) { - start_vga_code(num_of_rows, 2, 199 + vga_sprite_id, threeval_a >> 3, threeval_b, 12); + start_vga_code(b, 2, 199 + vga_sprite_id, x >> 3, y, 12); } else { - start_vga_code(num_of_rows, 2, vga_sprite_id, threeval_a >> 3, threeval_b, 12); + start_vga_code(b, 2, vga_sprite_id, x >> 3, y, 12); } } diff --git a/simon/simon.h b/simon/simon.h index adfceeef33..2acb1877cf 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -50,9 +50,9 @@ struct Subroutine; struct SubroutineLine; struct TimeEvent; -struct ThreeValues { - int16 a, b, c; - ThreeValues() { memset(this, 0, sizeof(*this)); } +struct TextLocation { + int16 x, y, width; + TextLocation() { memset(this, 0, sizeof(*this)); } }; struct HitArea { @@ -311,7 +311,7 @@ protected: byte _fcs_data_1[8]; bool _fcs_data_2[8]; - ThreeValues _threevalues_1, _threevalues_2, _threevalues_3, _threevalues_4; + TextLocation _textlocation_1, _textlocation_2, _textlocation_3, _textlocation_4; int _free_string_slot; @@ -509,7 +509,7 @@ protected: void o_unk_186(); void o_fade_to_black(); - ThreeValues *getThreeValues(uint a); + TextLocation *getTextLocation(uint a); void o_print_str(); void o_setup_cond_c(); void setup_cond_c_helper(); @@ -597,7 +597,7 @@ protected: void start_vga_code(uint b, uint vga_res, uint vga_sprite_id, uint x, uint y, uint base_color); void o_unk26_helper(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h); void talk_with_speech(uint speech_id, uint vga_sprite_id); - void talk_with_text(uint vga_sprite_id, uint color, const char *string_ptr, uint threeval_a, int threeval_b, uint width); + void talk_with_text(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 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); -- cgit v1.2.3