aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorMax Horn2002-08-04 13:25:06 +0000
committerMax Horn2002-08-04 13:25:06 +0000
commitf166da98fbcca22b9d21dab051fe390ea1bd2257 (patch)
tree0bdfaef8daa79c69ac40305da89a97f73bfd0d33 /simon
parent6e8bc1b98fe4335c5666a248971a36b37a0599c5 (diff)
downloadscummvm-rg350-f166da98fbcca22b9d21dab051fe390ea1bd2257.tar.gz
scummvm-rg350-f166da98fbcca22b9d21dab051fe390ea1bd2257.tar.bz2
scummvm-rg350-f166da98fbcca22b9d21dab051fe390ea1bd2257.zip
Patch #590751: SIMON: FillOrCopyStruct unknowns
svn-id: r4699
Diffstat (limited to 'simon')
-rw-r--r--simon/simon.cpp104
-rw-r--r--simon/simon.h14
-rw-r--r--simon/simonitems.cpp5
-rw-r--r--simon/simonverb.cpp4
4 files changed, 69 insertions, 58 deletions
diff --git a/simon/simon.cpp b/simon/simon.cpp
index c12b3b95b0..39f8c7030e 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -1529,7 +1529,8 @@ void SimonState::startUp_helper_2()
_fcs_unk_1 = 0;
if (_fcs_ptr_array_3[0] != 0) {
_fcs_ptr_1 = _fcs_ptr_array_3[0];
- showmessage_helper_3(_fcs_ptr_1->unk6, _fcs_ptr_1->unk7);
+ showmessage_helper_3(_fcs_ptr_1->textLength,
+ _fcs_ptr_1->textMaxLength);
}
_mortal_flag = false;
}
@@ -2306,22 +2307,25 @@ restart:;
fcs = _fcs_ptr_array_3[5];
- fcs->unk2 = unk132_result;
- fcs->unk1 = 2;
- fcs->unk3 = 2;
- fcs->unk6 = 3;
+ fcs->textRow = unk132_result;
+
+ // init x offset with a 2 character savegame number + a period (18 pix)
+ fcs->textColumn = 2;
+ fcs->textColumnOffset = 2;
+ fcs->textLength = 3;
name = buf + i * 18;
+ // now process entire savegame name to get correct x offset for cursor
name_len = 0;
while (name[name_len]) {
- fcs->unk6++;
- fcs->unk3 += 6;
+ fcs->textLength++;
+ fcs->textColumnOffset += 6;
if (name[name_len] == 'i' || name[name_len] == 'l')
- fcs->unk3 -= 2;
- if (fcs->unk3 >= 8) {
- fcs->unk3 -= 8;
- fcs->unk1++;
+ fcs->textColumnOffset -= 2;
+ if (fcs->textColumnOffset >= 8) {
+ fcs->textColumnOffset -= 8;
+ fcs->textColumn++;
}
name_len++;
}
@@ -2666,7 +2670,7 @@ void SimonState::checkTimerCallback()
-void SimonState::fcs_proc_1(FillOrCopyStruct *fcs, uint value)
+void SimonState::fcs_setTextColor(FillOrCopyStruct *fcs, uint value)
{
fcs->text_color = value;
}
@@ -2746,7 +2750,7 @@ void SimonState::fcs_unk_2(uint a)
startUp_helper_3();
_fcs_ptr_1 = _fcs_ptr_array_3[a];
- showmessage_helper_3(_fcs_ptr_1->unk6, _fcs_ptr_1->unk7);
+ showmessage_helper_3(_fcs_ptr_1->textLength, _fcs_ptr_1->textMaxLength);
}
@@ -2768,10 +2772,10 @@ FillOrCopyStruct *SimonState::fcs_alloc(uint x, uint y, uint w, uint h, uint fla
fcs->flags = flags;
fcs->fill_color = fill_color;
fcs->text_color = unk4;
- fcs->unk1 = 0;
- fcs->unk2 = 0;
- fcs->unk3 = 0;
- fcs->unk7 = fcs->width * 8 / 6;
+ fcs->textColumn = 0;
+ fcs->textRow = 0;
+ fcs->textColumnOffset = 0;
+ fcs->textMaxLength = fcs->width * 8 / 6; // characters are 6 pixels
return fcs;
}
@@ -2897,10 +2901,10 @@ void SimonState::video_fill_or_copy_from_3_to_2(FillOrCopyStruct *fcs)
else
video_erase(fcs);
- fcs->unk1 = 0;
- fcs->unk2 = 0;
- fcs->unk3 = 0;
- fcs->unk6 = 0;
+ fcs->textColumn = 0;
+ fcs->textRow = 0;
+ fcs->textColumnOffset = 0;
+ fcs->textLength = 0;
}
/* ok */
@@ -3163,7 +3167,8 @@ void SimonState::showMessageFormat(const char *s, ...)
showmessage_helper_2();
if (!_showmessage_flag) {
_fcs_ptr_array_3[0] = _fcs_ptr_1;
- showmessage_helper_3(_fcs_ptr_1->unk6, _fcs_ptr_1->unk7);
+ showmessage_helper_3(_fcs_ptr_1->textLength,
+ _fcs_ptr_1->textMaxLength);
}
_showmessage_flag = true;
_fcs_data_1[_fcs_unk_1] = 1;
@@ -3241,47 +3246,48 @@ void SimonState::video_putchar(FillOrCopyStruct *fcs, byte c)
if (c == 0xC) {
video_fill_or_copy_from_3_to_2(fcs);
} else if (c == 0xD || c == 0xA) {
- video_putchar_helper(fcs);
+ video_putchar_newline(fcs);
} else if (c == 8 || c == 1) {
int8 val = (c == 8) ? 6 : 4;
- if (fcs->unk6 != 0) {
- fcs->unk6--;
- fcs->unk3 -= val;
- if ((int8)fcs->unk3 < val) {
- fcs->unk3 += 8;
- fcs->unk1--;
+ if (fcs->textLength != 0) {
+ fcs->textLength--;
+ fcs->textColumnOffset -= val;
+ if ((int8)fcs->textColumnOffset < val) {
+ fcs->textColumnOffset += 8;
+ fcs->textColumn--;
}
}
} else if (c >= 0x20) {
- if (fcs->unk6 == fcs->unk7) {
- video_putchar_helper(fcs);
- } else if (fcs->unk2 == fcs->height) {
- video_putchar_helper(fcs);
- fcs->unk2--;
+ if (fcs->textLength == fcs->textMaxLength) {
+ video_putchar_newline(fcs);
+ } else if (fcs->textRow == fcs->height) {
+ video_putchar_newline(fcs);
+ fcs->textRow--;
}
- video_putchar_helper_2(fcs, fcs->unk1 + fcs->x, fcs->unk2 * 8 + fcs->y, c);
+ video_putchar_drawchar(fcs, fcs->textColumn + fcs->x,
+ fcs->textRow * 8 + fcs->y, c);
- fcs->unk6++;
- fcs->unk3 += 6;
+ fcs->textLength++;
+ fcs->textColumnOffset += 6;
if (c == 'i' || c == 'l')
- fcs->unk3 -= 2;
+ fcs->textColumnOffset -= 2;
- if (fcs->unk3 >= 8) {
- fcs->unk3 -= 8;
- fcs->unk1++;
+ if (fcs->textColumnOffset >= 8) {
+ fcs->textColumnOffset -= 8;
+ fcs->textColumn++;
}
}
}
-void SimonState::video_putchar_helper(FillOrCopyStruct *fcs)
+void SimonState::video_putchar_newline(FillOrCopyStruct *fcs)
{
- fcs->unk3 = 0;
- fcs->unk6 = 0;
- fcs->unk1 = 0;
+ fcs->textColumnOffset = 0;
+ fcs->textLength = 0;
+ fcs->textColumn = 0;
- if (fcs->unk2 != fcs->height)
- fcs->unk2++;
+ if (fcs->textRow != fcs->height)
+ fcs->textRow++;
}
static const byte video_font[] = {
@@ -3385,7 +3391,7 @@ static const byte video_font[] = {
240, 240, 240, 240, 240, 240, 240, 240,
};
-void SimonState::video_putchar_helper_2(FillOrCopyStruct *fcs, uint x, uint y, byte chr)
+void SimonState::video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, byte chr)
{
const byte *src;
byte color, *dst;
@@ -3394,7 +3400,7 @@ void SimonState::video_putchar_helper_2(FillOrCopyStruct *fcs, uint x, uint y, b
_lock_word |= 0x8000;
dst = dx_lock_2();
- dst += y * _dx_surface_pitch + x * 8 + fcs->unk3;
+ dst += y * _dx_surface_pitch + x * 8 + fcs->textColumnOffset;
src = video_font + (chr - 0x20) * 8;
diff --git a/simon/simon.h b/simon/simon.h
index bd341b0e2d..e14ab9eaa8 100644
--- a/simon/simon.h
+++ b/simon/simon.h
@@ -127,10 +127,14 @@ struct FillOrCopyStruct {
byte flags;
uint16 x, y;
uint16 width, height;
- uint16 unk1, unk2;
- uint8 unk3, unk6, unk7, fill_color, text_color, unk5;
+ uint16 textColumn, textRow;
+ uint8 textColumnOffset, textLength, textMaxLength;
+ uint8 fill_color, text_color, unk5;
FillOrCopyData *fcs_data;
};
+// note on text offset:
+// the actual x-coordinate is: textColumn * 8 + textColumnOffset
+// the actual y-coordinate is: textRow * 8
enum {
@@ -943,7 +947,7 @@ public:
bool vc_get_bit(uint bit);
- void fcs_proc_1(FillOrCopyStruct *fcs, uint value);
+ void fcs_setTextColor(FillOrCopyStruct *fcs, uint value);
void video_copy_if_flag_0x8_c(FillOrCopyStruct *fcs);
void delete_hitarea_by_index(uint index);
@@ -1010,8 +1014,8 @@ public:
void showmessage_helper_2();
void print_char_helper_6(uint i);
- void video_putchar_helper(FillOrCopyStruct *fcs);
- void video_putchar_helper_2(FillOrCopyStruct *fcs, uint x, uint y, byte chr);
+ void video_putchar_newline(FillOrCopyStruct *fcs);
+ void video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, byte chr);
void initSound();
void playVoice(uint voice);
diff --git a/simon/simonitems.cpp b/simon/simonitems.cpp
index 04f4c02eb9..82e76cf56a 100644
--- a/simon/simonitems.cpp
+++ b/simon/simonitems.cpp
@@ -1576,7 +1576,7 @@ void SimonState::o_unk_163(uint a)
void SimonState::o_unk_160(uint a)
{
- fcs_proc_1(_fcs_ptr_array_3[_fcs_unk_1], a);
+ fcs_setTextColor(_fcs_ptr_array_3[_fcs_unk_1], a);
}
void SimonState::o_unk_103()
@@ -1621,6 +1621,7 @@ void SimonState::o_unk26_helper(uint a, uint b, uint c, uint d, uint e, uint f,
if (a == _fcs_unk_1) {
_fcs_ptr_1 = _fcs_ptr_array_3[a];
- showmessage_helper_3(_fcs_ptr_1->unk6, _fcs_ptr_1->unk7);
+ showmessage_helper_3(_fcs_ptr_1->textLength,
+ _fcs_ptr_1->textMaxLength);
}
}
diff --git a/simon/simonverb.cpp b/simon/simonverb.cpp
index 3bdb2da014..77065f7a9c 100644
--- a/simon/simonverb.cpp
+++ b/simon/simonverb.cpp
@@ -99,8 +99,8 @@ void SimonState::showActionString(uint x, const byte *string)
if (fcs == NULL || fcs->text_color == 0)
return;
- fcs->unk1 = x >> 3;
- fcs->unk3 = x & 7;
+ fcs->textColumn = x >> 3;
+ fcs->textColumnOffset = x & 7;
for (; *string; string++)
video_putchar(fcs, *string);