Browse Source

Format menu related fiels

pull/25/head
Anders Jenbo 8 years ago
parent
commit
355ae33a1e
  1. 752
      Source/gmenu.cpp
  2. 4
      Source/gmenu.h
  3. 432
      Source/help.cpp
  4. 2
      Source/help.h
  5. 641
      Source/interfac.cpp
  6. 417
      Source/minitext.cpp
  7. 6
      Source/minitext.h

752
Source/gmenu.cpp

@ -9,109 +9,105 @@ TMenuItem *sgpCurrItem;
void *BigTGold_cel;
int dword_634474; // weak
char byte_634478; // weak
void (__cdecl *dword_63447C)();
void(__cdecl *dword_63447C)();
TMenuItem *dword_634480; // idb
void *option_cel;
void *sgpLogo;
int dword_63448C; // weak
const unsigned char lfontframe[127] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 37, 49, 38, 0, 39, 40, 47,
42, 43, 41, 45, 52, 44, 53, 55, 36, 27,
28, 29, 30, 31, 32, 33, 34, 35, 51, 50,
0, 46, 0, 54, 0, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 42, 0, 43, 0, 0, 0, 1, 2, 3,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 20, 0, 21, 0
const unsigned char lfontframe[127] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 37, 49, 38, 0, 39, 40, 47,
42, 43, 41, 45, 52, 44, 53, 55, 36, 27,
28, 29, 30, 31, 32, 33, 34, 35, 51, 50,
0, 46, 0, 54, 0, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 42, 0, 43, 0, 0, 0, 1, 2, 3,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 20, 0, 21, 0
};
const unsigned char lfontkern[56] =
{
18, 33, 21, 26, 28, 19, 19, 26, 25, 11,
12, 25, 19, 34, 28, 32, 20, 32, 28, 20,
28, 36, 35, 46, 33, 33, 24, 11, 23, 22,
22, 21, 22, 21, 21, 21, 32, 10, 20, 36,
31, 17, 13, 12, 13, 18, 16, 11, 20, 21,
11, 10, 12, 11, 21, 23
const unsigned char lfontkern[56] = {
18, 33, 21, 26, 28, 19, 19, 26, 25, 11,
12, 25, 19, 34, 28, 32, 20, 32, 28, 20,
28, 36, 35, 46, 33, 33, 24, 11, 23, 22,
22, 21, 22, 21, 21, 21, 32, 10, 20, 36,
31, 17, 13, 12, 13, 18, 16, 11, 20, 21,
11, 10, 12, 11, 21, 23
};
void __cdecl gmenu_draw_pause()
{
if ( currlevel )
RedBack();
if ( !dword_634480 )
{
light_table_index = 0;
gmenu_print_text(316, 336, "Pause");
}
if (currlevel)
RedBack();
if (!dword_634480) {
light_table_index = 0;
gmenu_print_text(316, 336, "Pause");
}
}
// 69BEF8: using guessed type int light_table_index;
void __fastcall gmenu_print_text(int x, int y, char *pszStr)
{
char *v3; // edi
int v4; // ebp
int v5; // esi
unsigned char i; // al
unsigned char v7; // bl
v3 = pszStr;
v4 = y;
v5 = x;
for ( i = *pszStr; *v3; i = *v3 )
{
++v3;
v7 = lfontframe[fontidx[i]];
if ( v7 )
CelDecodeLightOnly(v5, v4, (char *)BigTGold_cel, v7, 46);
v5 += lfontkern[v7] + 2;
}
char *v3; // edi
int v4; // ebp
int v5; // esi
unsigned char i; // al
unsigned char v7; // bl
v3 = pszStr;
v4 = y;
v5 = x;
for (i = *pszStr; *v3; i = *v3) {
++v3;
v7 = lfontframe[fontidx[i]];
if (v7)
CelDecodeLightOnly(v5, v4, (char *)BigTGold_cel, v7, 46);
v5 += lfontkern[v7] + 2;
}
}
void __cdecl FreeGMenu()
{
void *v0; // ecx
void *v1; // ecx
void *v2; // ecx
void *v3; // ecx
void *v4; // ecx
v0 = sgpLogo;
sgpLogo = 0;
mem_free_dbg(v0);
v1 = BigTGold_cel;
BigTGold_cel = 0;
mem_free_dbg(v1);
v2 = PentSpin_cel;
PentSpin_cel = 0;
mem_free_dbg(v2);
v3 = option_cel;
option_cel = 0;
mem_free_dbg(v3);
v4 = optbar_cel;
optbar_cel = 0;
mem_free_dbg(v4);
void *v0; // ecx
void *v1; // ecx
void *v2; // ecx
void *v3; // ecx
void *v4; // ecx
v0 = sgpLogo;
sgpLogo = 0;
mem_free_dbg(v0);
v1 = BigTGold_cel;
BigTGold_cel = 0;
mem_free_dbg(v1);
v2 = PentSpin_cel;
PentSpin_cel = 0;
mem_free_dbg(v2);
v3 = option_cel;
option_cel = 0;
mem_free_dbg(v3);
v4 = optbar_cel;
optbar_cel = 0;
mem_free_dbg(v4);
}
void __cdecl gmenu_init_menu()
{
byte_634478 = 1;
dword_634480 = 0;
sgpCurrItem = 0;
dword_63447C = 0;
dword_63448C = 0;
byte_634464 = 0;
sgpLogo = LoadFileInMem("Data\\Diabsmal.CEL", 0);
BigTGold_cel = LoadFileInMem("Data\\BigTGold.CEL", 0);
PentSpin_cel = LoadFileInMem("Data\\PentSpin.CEL", 0);
option_cel = LoadFileInMem("Data\\option.CEL", 0);
optbar_cel = LoadFileInMem("Data\\optbar.CEL", 0);
byte_634478 = 1;
dword_634480 = 0;
sgpCurrItem = 0;
dword_63447C = 0;
dword_63448C = 0;
byte_634464 = 0;
sgpLogo = LoadFileInMem("Data\\Diabsmal.CEL", 0);
BigTGold_cel = LoadFileInMem("Data\\BigTGold.CEL", 0);
PentSpin_cel = LoadFileInMem("Data\\PentSpin.CEL", 0);
option_cel = LoadFileInMem("Data\\option.CEL", 0);
optbar_cel = LoadFileInMem("Data\\optbar.CEL", 0);
}
// 634464: using guessed type char byte_634464;
// 634478: using guessed type char byte_634478;
@ -119,39 +115,36 @@ void __cdecl gmenu_init_menu()
BOOL __cdecl gmenu_exception()
{
return dword_634480 != 0;
return dword_634480 != 0;
}
void __fastcall gmenu_call_proc(TMenuItem *pItem, void (__cdecl *gmFunc)())
void __fastcall gmenu_call_proc(TMenuItem *pItem, void(__cdecl *gmFunc)())
{
TMenuItem *v2; // eax
int v3; // ecx
void (__cdecl **v4)(); // edx
PauseMode = 0;
byte_634464 = 0;
v2 = pItem;
dword_63447C = gmFunc;
dword_634480 = pItem;
if ( gmFunc )
{
gmFunc();
v2 = dword_634480;
}
v3 = 0;
dword_63448C = 0;
if ( v2 )
{
v4 = &v2->fnMenu;
while ( *v4 )
{
++v3;
v4 += 3;
dword_63448C = v3;
}
}
sgpCurrItem = &v2[v3 - 1];
gmenu_up_down(1);
TMenuItem *v2; // eax
int v3; // ecx
void(__cdecl * *v4)(); // edx
PauseMode = 0;
byte_634464 = 0;
v2 = pItem;
dword_63447C = gmFunc;
dword_634480 = pItem;
if (gmFunc) {
gmFunc();
v2 = dword_634480;
}
v3 = 0;
dword_63448C = 0;
if (v2) {
v4 = &v2->fnMenu;
while (*v4) {
++v3;
v4 += 3;
dword_63448C = v3;
}
}
sgpCurrItem = &v2[v3 - 1];
gmenu_up_down(1);
}
// 525740: using guessed type int PauseMode;
// 634464: using guessed type char byte_634464;
@ -159,351 +152,320 @@ void __fastcall gmenu_call_proc(TMenuItem *pItem, void (__cdecl *gmFunc)())
void __fastcall gmenu_up_down(int a1)
{
TMenuItem *v1; // eax
int v2; // edi
v1 = sgpCurrItem;
if ( sgpCurrItem )
{
byte_634464 = 0;
v2 = dword_63448C;
while ( v2 )
{
--v2;
if ( a1 )
{
++v1;
sgpCurrItem = v1;
if ( v1->fnMenu )
goto LABEL_10;
v1 = dword_634480;
}
else
{
if ( v1 == dword_634480 )
v1 = &dword_634480[dword_63448C];
--v1;
}
sgpCurrItem = v1;
LABEL_10:
if ( (v1->dwFlags & 0x80000000) != 0 )
{
if ( v2 )
PlaySFX(IS_TITLEMOV);
return;
}
}
}
TMenuItem *v1; // eax
int v2; // edi
v1 = sgpCurrItem;
if (sgpCurrItem) {
byte_634464 = 0;
v2 = dword_63448C;
while (v2) {
--v2;
if (a1) {
++v1;
sgpCurrItem = v1;
if (v1->fnMenu)
goto LABEL_10;
v1 = dword_634480;
} else {
if (v1 == dword_634480)
v1 = &dword_634480[dword_63448C];
--v1;
}
sgpCurrItem = v1;
LABEL_10:
if ((v1->dwFlags & 0x80000000) != 0) {
if (v2)
PlaySFX(IS_TITLEMOV);
return;
}
}
}
}
// 634464: using guessed type char byte_634464;
// 63448C: using guessed type int dword_63448C;
void __cdecl gmenu_draw()
{
int v0; // edi
TMenuItem *i; // esi
DWORD v2; // eax
if ( dword_634480 )
{
if ( dword_63447C )
dword_63447C();
CelDecodeOnly(236, 262, sgpLogo, 1, 296);
v0 = 320;
for ( i = dword_634480; i->fnMenu; v0 += 45 )
{
gmenu_draw_menu_item(i, v0);
++i;
}
v2 = GetTickCount();
if ( (signed int)(v2 - dword_634474) > 25 )
{
if ( ++byte_634478 == 9 )
byte_634478 = 1;
dword_634474 = v2;
}
}
int v0; // edi
TMenuItem *i; // esi
DWORD v2; // eax
if (dword_634480) {
if (dword_63447C)
dword_63447C();
CelDecodeOnly(236, 262, sgpLogo, 1, 296);
v0 = 320;
for (i = dword_634480; i->fnMenu; v0 += 45) {
gmenu_draw_menu_item(i, v0);
++i;
}
v2 = GetTickCount();
if ((signed int)(v2 - dword_634474) > 25) {
if (++byte_634478 == 9)
byte_634478 = 1;
dword_634474 = v2;
}
}
}
// 634474: using guessed type int dword_634474;
// 634478: using guessed type char byte_634478;
void __fastcall gmenu_draw_menu_item(TMenuItem *pItem, int a2)
{
int v2; // edi
TMenuItem *v3; // ebx
unsigned int v4; // eax
unsigned int v5; // ebp
int v6; // esi
unsigned int v7; // ecx
unsigned int v8; // eax
int v9; // ecx
unsigned int v10; // ebp
int v11; // esi
int v12; // eax
int v13; // edi
unsigned int v14; // [esp+10h] [ebp-4h]
v2 = a2;
v3 = pItem;
v4 = gmenu_get_lfont(pItem);
v5 = v4;
v14 = v4;
if ( v3->dwFlags & 0x40000000 )
{
v6 = (v4 >> 1) + 80;
CelDecodeOnly(v6, v2 - 10, optbar_cel, 1, 287);
v7 = (v3->dwFlags >> 12) & 0xFFF;
if ( v7 < 2 )
v7 = 2;
v8 = ((v3->dwFlags & 0xFFF) << 8) / v7;
v9 = (v5 >> 1) + 82;
v10 = v8;
gmenu_clear_buffer(v9, v2 - 12, v8 + 13, 28);
CelDecodeOnly(v6 + v10 + 2, v2 - 12, option_cel, 1, 27);
v5 = v14;
}
v11 = 384 - (v5 >> 1);
v12 = -((v3->dwFlags & 0x80000000) != 0);
_LOBYTE(v12) = v12 & 0xF1;
light_table_index = v12 + 15;
gmenu_print_text(384 - (v5 >> 1), v2, v3->pszStr);
if ( v3 == sgpCurrItem )
{
v13 = v2 + 1;
CelDecodeOnly(v11 - 54, v13, PentSpin_cel, (unsigned char)byte_634478, 48);
CelDecodeOnly(v11 + v5 + 4, v13, PentSpin_cel, (unsigned char)byte_634478, 48);
}
int v2; // edi
TMenuItem *v3; // ebx
unsigned int v4; // eax
unsigned int v5; // ebp
int v6; // esi
unsigned int v7; // ecx
unsigned int v8; // eax
int v9; // ecx
unsigned int v10; // ebp
int v11; // esi
int v12; // eax
int v13; // edi
unsigned int v14; // [esp+10h] [ebp-4h]
v2 = a2;
v3 = pItem;
v4 = gmenu_get_lfont(pItem);
v5 = v4;
v14 = v4;
if (v3->dwFlags & 0x40000000) {
v6 = (v4 >> 1) + 80;
CelDecodeOnly(v6, v2 - 10, optbar_cel, 1, 287);
v7 = (v3->dwFlags >> 12) & 0xFFF;
if (v7 < 2)
v7 = 2;
v8 = ((v3->dwFlags & 0xFFF) << 8) / v7;
v9 = (v5 >> 1) + 82;
v10 = v8;
gmenu_clear_buffer(v9, v2 - 12, v8 + 13, 28);
CelDecodeOnly(v6 + v10 + 2, v2 - 12, option_cel, 1, 27);
v5 = v14;
}
v11 = 384 - (v5 >> 1);
v12 = -((v3->dwFlags & 0x80000000) != 0);
_LOBYTE(v12) = v12 & 0xF1;
light_table_index = v12 + 15;
gmenu_print_text(384 - (v5 >> 1), v2, v3->pszStr);
if (v3 == sgpCurrItem) {
v13 = v2 + 1;
CelDecodeOnly(v11 - 54, v13, PentSpin_cel, (unsigned char)byte_634478, 48);
CelDecodeOnly(v11 + v5 + 4, v13, PentSpin_cel, (unsigned char)byte_634478, 48);
}
}
// 634478: using guessed type char byte_634478;
// 69BEF8: using guessed type int light_table_index;
void __fastcall gmenu_clear_buffer(int x, int y, int width, int height)
{
int v4; // edi
char *i; // esi
v4 = height;
for ( i = (char *)gpBuffer + screen_y_times_768[y] + x; v4; --v4 )
{
memset(i, 205, width);
i -= 768;
}
int v4; // edi
char *i; // esi
v4 = height;
for (i = (char *)gpBuffer + screen_y_times_768[y] + x; v4; --v4) {
memset(i, 205, width);
i -= 768;
}
}
int __fastcall gmenu_get_lfont(TMenuItem *pItem)
{
char *v2; // eax
int i; // edx
unsigned char v4; // cl
if ( pItem->dwFlags & 0x40000000 )
return 490;
v2 = pItem->pszStr;
for ( i = 0; ; i += lfontkern[lfontframe[fontidx[v4]]] + 2 )
{
v4 = *v2;
if ( !*v2 )
break;
++v2;
}
return i - 2;
char *v2; // eax
int i; // edx
unsigned char v4; // cl
if (pItem->dwFlags & 0x40000000)
return 490;
v2 = pItem->pszStr;
for (i = 0;; i += lfontkern[lfontframe[fontidx[v4]]] + 2) {
v4 = *v2;
if (!*v2)
break;
++v2;
}
return i - 2;
}
int __fastcall gmenu_presskeys(int a1)
{
int v1; // ecx
int v2; // ecx
if ( !dword_634480 )
return 0;
switch ( a1 )
{
case VK_RETURN:
if ( (sgpCurrItem->dwFlags & 0x80000000) != 0 )
{
PlaySFX(IS_TITLEMOV);
((void (__fastcall *)(signed int))sgpCurrItem->fnMenu)(1);
}
return 1;
case VK_ESCAPE:
PlaySFX(IS_TITLEMOV);
gmenu_call_proc(0, 0);
return 1;
case VK_SPACE:
return 0;
case VK_LEFT:
v2 = 0;
goto LABEL_12;
case VK_UP:
v1 = 0;
goto LABEL_10;
case VK_RIGHT:
v2 = 1;
LABEL_12:
gmenu_left_right(v2);
return 1;
case VK_DOWN:
v1 = 1;
LABEL_10:
gmenu_up_down(v1);
break;
}
return 1;
int v1; // ecx
int v2; // ecx
if (!dword_634480)
return 0;
switch (a1) {
case VK_RETURN:
if ((sgpCurrItem->dwFlags & 0x80000000) != 0) {
PlaySFX(IS_TITLEMOV);
((void(__fastcall *)(signed int))sgpCurrItem->fnMenu)(1);
}
return 1;
case VK_ESCAPE:
PlaySFX(IS_TITLEMOV);
gmenu_call_proc(0, 0);
return 1;
case VK_SPACE:
return 0;
case VK_LEFT:
v2 = 0;
goto LABEL_12;
case VK_UP:
v1 = 0;
goto LABEL_10;
case VK_RIGHT:
v2 = 1;
LABEL_12:
gmenu_left_right(v2);
return 1;
case VK_DOWN:
v1 = 1;
LABEL_10:
gmenu_up_down(v1);
break;
}
return 1;
}
void __fastcall gmenu_left_right(int a1)
{
signed int v1; // edx
unsigned int v2; // eax
int v3; // eax
v1 = sgpCurrItem->dwFlags;
if ( sgpCurrItem->dwFlags & 0x40000000 )
{
v2 = sgpCurrItem->dwFlags & 0xFFF;
if ( a1 )
{
if ( v2 == ((v1 >> 12) & 0xFFF) )
return;
v3 = v2 + 1;
}
else
{
if ( !(v1 & 0xFFF) )
return;
v3 = v2 - 1;
}
_LOWORD(v1) = v1 & 0xF000;
sgpCurrItem->dwFlags = v1;
sgpCurrItem->dwFlags |= v3;
((void (__fastcall *)(_DWORD))sgpCurrItem->fnMenu)(0);
}
signed int v1; // edx
unsigned int v2; // eax
int v3; // eax
v1 = sgpCurrItem->dwFlags;
if (sgpCurrItem->dwFlags & 0x40000000) {
v2 = sgpCurrItem->dwFlags & 0xFFF;
if (a1) {
if (v2 == ((v1 >> 12) & 0xFFF))
return;
v3 = v2 + 1;
} else {
if (!(v1 & 0xFFF))
return;
v3 = v2 - 1;
}
_LOWORD(v1) = v1 & 0xF000;
sgpCurrItem->dwFlags = v1;
sgpCurrItem->dwFlags |= v3;
((void(__fastcall *)(_DWORD))sgpCurrItem->fnMenu)(0);
}
}
int __fastcall gmenu_on_mouse_move(LPARAM lParam)
{
int v2; // edx
int a1; // [esp+0h] [ebp-4h]
a1 = lParam;
if ( !byte_634464 )
return 0;
gmenu_valid_mouse_pos(&a1);
v2 = a1 * ((sgpCurrItem->dwFlags >> 12) & 0xFFF) % 256;
a1 = a1 * ((sgpCurrItem->dwFlags >> 12) & 0xFFF) / 256;
_LOWORD(sgpCurrItem->dwFlags) &= 0xF000u;
sgpCurrItem->dwFlags |= a1;
((void (__fastcall *)(_DWORD, int))sgpCurrItem->fnMenu)(0, v2);
return 1;
int v2; // edx
int a1; // [esp+0h] [ebp-4h]
a1 = lParam;
if (!byte_634464)
return 0;
gmenu_valid_mouse_pos(&a1);
v2 = a1 * ((sgpCurrItem->dwFlags >> 12) & 0xFFF) % 256;
a1 = a1 * ((sgpCurrItem->dwFlags >> 12) & 0xFFF) / 256;
_LOWORD(sgpCurrItem->dwFlags) &= 0xF000u;
sgpCurrItem->dwFlags |= a1;
((void(__fastcall *)(_DWORD, int))sgpCurrItem->fnMenu)(0, v2);
return 1;
}
// 41A37A: could not find valid save-restore pair for esi
// 634464: using guessed type char byte_634464;
bool __fastcall gmenu_valid_mouse_pos(int *plOffset)
{
*plOffset = 282;
if ( MouseX < 282 )
{
*plOffset = 0;
return 0;
}
if ( MouseX > 538 )
{
*plOffset = 256;
return 0;
}
*plOffset = MouseX - 282;
return 1;
*plOffset = 282;
if (MouseX < 282) {
*plOffset = 0;
return 0;
}
if (MouseX > 538) {
*plOffset = 256;
return 0;
}
*plOffset = MouseX - 282;
return 1;
}
int __fastcall gmenu_left_mouse(int a1)
{
int result; // eax
unsigned int v2; // eax
unsigned int v3; // eax
TMenuItem *v4; // esi
unsigned int v5; // eax
//LPARAM v6; // ecx
int a1a; // [esp+4h] [ebp-4h]
if ( a1 )
{
if ( !dword_634480 || MouseY >= 352 )
return 0;
if ( MouseY - 117 >= 0 )
{
v2 = (MouseY - 117) / 45;
if ( v2 < dword_63448C )
{
v3 = v2;
v4 = &dword_634480[v3];
if ( (v4->dwFlags & 0x80000000) != 0 )
{
v5 = (unsigned int)gmenu_get_lfont(&dword_634480[v3]) >> 1;
if ( MouseX >= 320 - v5 && MouseX <= v5 + 320 )
{
sgpCurrItem = v4;
PlaySFX(IS_TITLEMOV);
if ( v4->dwFlags & 0x40000000 )
{
byte_634464 = gmenu_valid_mouse_pos(&a1a);
gmenu_on_mouse_move(a1); /* v6 */
}
else
{
((void (__fastcall *)(signed int))sgpCurrItem->fnMenu)(1);
}
}
}
}
}
}
else
{
result = 0;
if ( !byte_634464 )
return result;
byte_634464 = 0;
}
return 1;
int result; // eax
unsigned int v2; // eax
unsigned int v3; // eax
TMenuItem *v4; // esi
unsigned int v5; // eax
//LPARAM v6; // ecx
int a1a; // [esp+4h] [ebp-4h]
if (a1) {
if (!dword_634480 || MouseY >= 352)
return 0;
if (MouseY - 117 >= 0) {
v2 = (MouseY - 117) / 45;
if (v2 < dword_63448C) {
v3 = v2;
v4 = &dword_634480[v3];
if ((v4->dwFlags & 0x80000000) != 0) {
v5 = (unsigned int)gmenu_get_lfont(&dword_634480[v3]) >> 1;
if (MouseX >= 320 - v5 && MouseX <= v5 + 320) {
sgpCurrItem = v4;
PlaySFX(IS_TITLEMOV);
if (v4->dwFlags & 0x40000000) {
byte_634464 = gmenu_valid_mouse_pos(&a1a);
gmenu_on_mouse_move(a1); /* v6 */
} else {
((void(__fastcall *)(signed int))sgpCurrItem->fnMenu)(1);
}
}
}
}
}
} else {
result = 0;
if (!byte_634464)
return result;
byte_634464 = 0;
}
return 1;
}
// 634464: using guessed type char byte_634464;
// 63448C: using guessed type int dword_63448C;
void __fastcall gmenu_enable(TMenuItem *pMenuItem, BOOL enable)
{
if ( enable )
pMenuItem->dwFlags |= 0x80000000;
else
pMenuItem->dwFlags &= 0x7F000000;
if (enable)
pMenuItem->dwFlags |= 0x80000000;
else
pMenuItem->dwFlags &= 0x7F000000;
}
void __fastcall gmenu_slider_1(TMenuItem *pItem, int min, int max, int gamma)
{
unsigned int v4; // esi
int v5; // eax
v4 = pItem->dwFlags;
v5 = (pItem->dwFlags >> 12) & 0xFFF;
if ( v5 < 2 )
v5 = 2;
_LOWORD(v4) = v4 & 0xF000;
pItem->dwFlags = v4 | (v5 * (gamma - min) + (max - min - 1) / 2) / (max - min);
unsigned int v4; // esi
int v5; // eax
v4 = pItem->dwFlags;
v5 = (pItem->dwFlags >> 12) & 0xFFF;
if (v5 < 2)
v5 = 2;
_LOWORD(v4) = v4 & 0xF000;
pItem->dwFlags = v4 | (v5 * (gamma - min) + (max - min - 1) / 2) / (max - min);
}
int __fastcall gmenu_slider_get(TMenuItem *pItem, int min, int max)
{
int v3; // eax
unsigned int v4; // ecx
v3 = (pItem->dwFlags >> 12) & 0xFFF;
v4 = pItem->dwFlags & 0xFFF;
if ( v3 < 2 )
v3 = 2;
return min + (v4 * (max - min) + (v3 - 1) / 2) / v3;
int v3; // eax
unsigned int v4; // ecx
v3 = (pItem->dwFlags >> 12) & 0xFFF;
v4 = pItem->dwFlags & 0xFFF;
if (v3 < 2)
v3 = 2;
return min + (v4 * (max - min) + (v3 - 1) / 2) / v3;
}
void __fastcall gmenu_slider_3(TMenuItem *pItem, int dwTicks)
{
pItem->dwFlags ^= (pItem->dwFlags ^ (dwTicks << 12)) & 0xFFF000;
pItem->dwFlags ^= (pItem->dwFlags ^ (dwTicks << 12)) & 0xFFF000;
}

4
Source/gmenu.h

@ -9,7 +9,7 @@ extern TMenuItem *sgpCurrItem;
extern void *BigTGold_cel;
extern int dword_634474; // weak
extern char byte_634478; // weak
extern void (__cdecl *dword_63447C)();
extern void(__cdecl *dword_63447C)();
extern TMenuItem *dword_634480; // idb
extern void *option_cel;
extern void *sgpLogo;
@ -20,7 +20,7 @@ void __fastcall gmenu_print_text(int x, int y, char *pszStr);
void __cdecl FreeGMenu();
void __cdecl gmenu_init_menu();
BOOL __cdecl gmenu_exception();
void __fastcall gmenu_call_proc(TMenuItem *pItem, void (__cdecl *gmFunc)());
void __fastcall gmenu_call_proc(TMenuItem *pItem, void(__cdecl *gmFunc)());
void __fastcall gmenu_up_down(int a1);
void __cdecl gmenu_draw();
void __fastcall gmenu_draw_menu_item(TMenuItem *pItem, int a2);

432
Source/help.cpp

@ -3,268 +3,246 @@
#include "../types.h"
int help_select_line; // weak
int dword_634494; // weak
int dword_634494; // weak
int helpflag;
int displayinghelp[22]; /* check, does nothing? */
int HelpTop; // weak
int HelpTop; // weak
const char gszHelpText[] =
{
"$Keyboard Shortcuts:|"
"F1: Open Help Screen|"
"Esc: Display Main Menu|"
"Tab: Display Auto-map|"
"Space: Hide all info screens|"
"S: Open Speedbook|"
"B: Open Spellbook|"
"I: Open Inventory screen|"
"C: Open Character screen|"
"Q: Open Quest log|"
"F: Reduce screen brightness|"
"G: Increase screen brightness|"
"Z: Zoom Game Screen|"
"+ / -: Zoom Automap|"
"1 - 8: Use Belt item|"
"F5, F6, F7, F8: Set hot key for skill or spell|"
"Shift + Left Click: Attack without moving|"
"|"
"$Movement:|"
"If you hold the mouse button down while moving, the character "
"will continue to move in that direction.|"
"|"
"$Combat:|"
"Holding down the shift key and then left-clicking allows the "
"character to attack without moving.|"
"|"
"$Auto-map:|"
"To access the auto-map, click the 'MAP' button on the "
"Information Bar or press 'TAB' on the keyboard. Zooming in and "
"out of the map is done with the + and - keys. Scrolling the map "
"uses the arrow keys.|"
"|"
"$Picking up Objects:|"
"Useable items that are small in size, such as potions or scrolls, "
"are automatically placed in your 'belt' located at the top of "
"the Interface bar . When an item is placed in the belt, a small "
"number appears in that box. Items may be used by either pressing "
"the corresponding number or right-clicking on the item.|"
"|"
"$Gold|"
"You can select a specific amount of gold to drop by right "
"clicking on a pile of gold in your inventory.|"
"|"
"$Skills & Spells:|"
"You can access your list of skills and spells by left-clicking on "
"the 'SPELLS' button in the interface bar. Memorized spells and "
"those available through staffs are listed here. Left-clicking on "
"the spell you wish to cast will ready the spell. A readied spell "
"may be cast by simply right-clicking in the play area.|"
"|"
"$Using the Speedbook for Spells|"
"Left-clicking on the 'readied spell' button will open the 'Speedbook' "
"which allows you to select a skill or spell for immediate use. "
"To use a readied skill or spell, simply right-click in the main play "
"area.|"
"|"
"$Setting Spell Hotkeys|"
"You can assign up to four Hot Keys for skills, spells or scrolls. "
"Start by opening the 'speedbook' as described in the section above. "
"Press the F5, F6, F7 or F8 keys after highlighting the spell you "
"wish to assign.|"
"|"
"$Spell Books|"
"Reading more than one book increases your knowledge of that "
"spell, allowing you to cast the spell more effectively.|"
"&"
const char gszHelpText[] = {
"$Keyboard Shortcuts:|"
"F1: Open Help Screen|"
"Esc: Display Main Menu|"
"Tab: Display Auto-map|"
"Space: Hide all info screens|"
"S: Open Speedbook|"
"B: Open Spellbook|"
"I: Open Inventory screen|"
"C: Open Character screen|"
"Q: Open Quest log|"
"F: Reduce screen brightness|"
"G: Increase screen brightness|"
"Z: Zoom Game Screen|"
"+ / -: Zoom Automap|"
"1 - 8: Use Belt item|"
"F5, F6, F7, F8: Set hot key for skill or spell|"
"Shift + Left Click: Attack without moving|"
"|"
"$Movement:|"
"If you hold the mouse button down while moving, the character "
"will continue to move in that direction.|"
"|"
"$Combat:|"
"Holding down the shift key and then left-clicking allows the "
"character to attack without moving.|"
"|"
"$Auto-map:|"
"To access the auto-map, click the 'MAP' button on the "
"Information Bar or press 'TAB' on the keyboard. Zooming in and "
"out of the map is done with the + and - keys. Scrolling the map "
"uses the arrow keys.|"
"|"
"$Picking up Objects:|"
"Useable items that are small in size, such as potions or scrolls, "
"are automatically placed in your 'belt' located at the top of "
"the Interface bar . When an item is placed in the belt, a small "
"number appears in that box. Items may be used by either pressing "
"the corresponding number or right-clicking on the item.|"
"|"
"$Gold|"
"You can select a specific amount of gold to drop by right "
"clicking on a pile of gold in your inventory.|"
"|"
"$Skills & Spells:|"
"You can access your list of skills and spells by left-clicking on "
"the 'SPELLS' button in the interface bar. Memorized spells and "
"those available through staffs are listed here. Left-clicking on "
"the spell you wish to cast will ready the spell. A readied spell "
"may be cast by simply right-clicking in the play area.|"
"|"
"$Using the Speedbook for Spells|"
"Left-clicking on the 'readied spell' button will open the 'Speedbook' "
"which allows you to select a skill or spell for immediate use. "
"To use a readied skill or spell, simply right-click in the main play "
"area.|"
"|"
"$Setting Spell Hotkeys|"
"You can assign up to four Hot Keys for skills, spells or scrolls. "
"Start by opening the 'speedbook' as described in the section above. "
"Press the F5, F6, F7 or F8 keys after highlighting the spell you "
"wish to assign.|"
"|"
"$Spell Books|"
"Reading more than one book increases your knowledge of that "
"spell, allowing you to cast the spell more effectively.|"
"&"
};
void __cdecl InitHelp()
{
helpflag = 0;
dword_634494 = 0;
displayinghelp[0] = 0;
helpflag = 0;
dword_634494 = 0;
displayinghelp[0] = 0;
}
// 634494: using guessed type int dword_634494;
void __cdecl DrawHelp()
{
int v0; // edi
const char *v1; // esi
int v2; // edx
signed int v3; // ecx
char v4; // al
unsigned char v5; // al
_BYTE *i; // eax
int v7; // eax
signed int v8; // edx
char v9; // cl
unsigned char v10; // cl
text_color color; // [esp+Ch] [ebp-8h]
int help_line_nr; // [esp+10h] [ebp-4h]
signed int help_line_nra; // [esp+10h] [ebp-4h]
int v0; // edi
const char *v1; // esi
int v2; // edx
signed int v3; // ecx
char v4; // al
unsigned char v5; // al
_BYTE *i; // eax
int v7; // eax
signed int v8; // edx
char v9; // cl
unsigned char v10; // cl
text_color color; // [esp+Ch] [ebp-8h]
int help_line_nr; // [esp+10h] [ebp-4h]
signed int help_line_nra; // [esp+10h] [ebp-4h]
DrawSTextHelp();
DrawQTextBack();
PrintSString(0, 2, 1u, "Diablo Help", COL_GOLD, 0);
DrawSLine(5);
v0 = help_select_line;
v1 = gszHelpText;
if ( help_select_line > 0 )
{
help_line_nr = help_select_line;
do
{
v2 = 0;
v3 = 0;
while ( !*v1 )
++v1;
if ( *v1 == '$' )
++v1;
v4 = *v1;
if ( *v1 != '&' )
{
if ( v4 == ('|') )
goto LABEL_47;
while ( v3 < 577 )
{
if ( !v4 )
{
do
++v1;
while ( !*v1 );
}
v5 = *v1;
tempstr[v2++] = *v1++;
v3 += fontkern[fontframe[fontidx[v5]]] + 1;
v4 = *v1;
if ( *v1 == ('|') )
{
if ( v3 < 577 )
goto LABEL_18;
break;
}
}
for ( i = (unsigned char *)&tempstr[v2]-1; *i != ' '; --i )
--v1;
LABEL_18:
if ( *v1 == ('|') )
LABEL_47:
++v1;
}
--help_line_nr;
}
while ( help_line_nr );
}
help_line_nra = 7;
do
{
v7 = 0;
v8 = 0;
while ( !*v1 )
++v1;
if ( *v1 == '$' )
{
++v1;
_LOBYTE(color) = COL_RED;
}
else
{
_LOBYTE(color) = COL_WHITE;
}
v9 = *v1;
if ( *v1 == '&' )
{
HelpTop = v0;
}
else
{
if ( v9 == ('|') )
goto LABEL_48;
while ( v8 < 577 )
{
if ( !v9 )
{
do
++v1;
while ( !*v1 );
}
v10 = *v1;
tempstr[v7++] = *v1++;
v8 += fontkern[fontframe[fontidx[v10]]] + 1;
v9 = *v1;
if ( *v1 == ('|') )
{
if ( v8 < 577 )
goto LABEL_39;
break;
}
}
while ( tempstr[--v7] != ' ' )
--v1;
LABEL_39:
if ( v7 )
{
tempstr[v7] = 0;
DrawHelpLine(0, help_line_nra, tempstr, color);
v0 = help_select_line;
}
if ( *v1 == ('|') )
LABEL_48:
++v1;
}
++help_line_nra;
}
while ( help_line_nra < 22 );
PrintSString(0, 23, 1u, "Press ESC to end or the arrow keys to scroll.", COL_GOLD, 0);
DrawSTextHelp();
DrawQTextBack();
PrintSString(0, 2, 1u, "Diablo Help", COL_GOLD, 0);
DrawSLine(5);
v0 = help_select_line;
v1 = gszHelpText;
if (help_select_line > 0) {
help_line_nr = help_select_line;
do {
v2 = 0;
v3 = 0;
while (!*v1)
++v1;
if (*v1 == '$')
++v1;
v4 = *v1;
if (*v1 != '&') {
if (v4 == ('|'))
goto LABEL_47;
while (v3 < 577) {
if (!v4) {
do
++v1;
while (!*v1);
}
v5 = *v1;
tempstr[v2++] = *v1++;
v3 += fontkern[fontframe[fontidx[v5]]] + 1;
v4 = *v1;
if (*v1 == ('|')) {
if (v3 < 577)
goto LABEL_18;
break;
}
}
for (i = (unsigned char *)&tempstr[v2] - 1; *i != ' '; --i)
--v1;
LABEL_18:
if (*v1 == ('|'))
LABEL_47:
++v1;
}
--help_line_nr;
} while (help_line_nr);
}
help_line_nra = 7;
do {
v7 = 0;
v8 = 0;
while (!*v1)
++v1;
if (*v1 == '$') {
++v1;
_LOBYTE(color) = COL_RED;
} else {
_LOBYTE(color) = COL_WHITE;
}
v9 = *v1;
if (*v1 == '&') {
HelpTop = v0;
} else {
if (v9 == ('|'))
goto LABEL_48;
while (v8 < 577) {
if (!v9) {
do
++v1;
while (!*v1);
}
v10 = *v1;
tempstr[v7++] = *v1++;
v8 += fontkern[fontframe[fontidx[v10]]] + 1;
v9 = *v1;
if (*v1 == ('|')) {
if (v8 < 577)
goto LABEL_39;
break;
}
}
while (tempstr[--v7] != ' ')
--v1;
LABEL_39:
if (v7) {
tempstr[v7] = 0;
DrawHelpLine(0, help_line_nra, tempstr, color);
v0 = help_select_line;
}
if (*v1 == ('|'))
LABEL_48:
++v1;
}
++help_line_nra;
} while (help_line_nra < 22);
PrintSString(0, 23, 1u, "Press ESC to end or the arrow keys to scroll.", COL_GOLD, 0);
}
// 634490: using guessed type int help_select_line;
// 634960: using guessed type int HelpTop;
void __fastcall DrawHelpLine(int always_0, int help_line_nr, char *text, text_color color)
{
signed int v4; // ebx
int v5; // edi
unsigned char i; // al
unsigned char v7; // al
int v8; // esi
signed int v4; // ebx
int v5; // edi
unsigned char i; // al
unsigned char v7; // al
int v8; // esi
v4 = 0;
v5 = screen_y_times_768[SStringY[help_line_nr] + 204] + always_0 + 96;
for ( i = *text; *text; i = *text )
{
++text;
v7 = fontframe[fontidx[i]];
v8 = v7;
v4 += fontkern[v7] + 1;
if ( v7 )
{
if ( v4 <= 577 )
CPrintString(v5, v7, color);
}
v5 += fontkern[v8] + 1;
}
v4 = 0;
v5 = screen_y_times_768[SStringY[help_line_nr] + 204] + always_0 + 96;
for (i = *text; *text; i = *text) {
++text;
v7 = fontframe[fontidx[i]];
v8 = v7;
v4 += fontkern[v7] + 1;
if (v7) {
if (v4 <= 577)
CPrintString(v5, v7, color);
}
v5 += fontkern[v8] + 1;
}
}
void __cdecl DisplayHelp()
{
help_select_line = 0;
helpflag = 1;
HelpTop = 5000;
help_select_line = 0;
helpflag = 1;
HelpTop = 5000;
}
// 634490: using guessed type int help_select_line;
// 634960: using guessed type int HelpTop;
void __cdecl HelpScrollUp()
{
if ( help_select_line > 0 )
--help_select_line;
if (help_select_line > 0)
--help_select_line;
}
// 634490: using guessed type int help_select_line;
void __cdecl HelpScrollDown()
{
if ( help_select_line < HelpTop )
++help_select_line;
if (help_select_line < HelpTop)
++help_select_line;
}
// 634490: using guessed type int help_select_line;
// 634960: using guessed type int HelpTop;

2
Source/help.h

@ -3,7 +3,7 @@
#define __HELP_H__
extern int help_select_line; // weak
extern int dword_634494; // weak
extern int dword_634494; // weak
extern int helpflag;
extern int displayinghelp[22];
extern int HelpTop; // weak

641
Source/interfac.cpp

@ -11,227 +11,220 @@ const int interfac_inf = 0x7F800000; // weak
const unsigned char progress_bar_colours[3] = { 138u, 43u, 254u };
const int progress_bar_screen_pos[3][2] = { { 53, 37 }, { 53, 421 }, { 53, 37 } };
struct interfac_cpp_init
{
interfac_cpp_init()
{
interfac_cpp_init_value = interfac_inf;
}
struct interfac_cpp_init {
interfac_cpp_init()
{
interfac_cpp_init_value = interfac_inf;
}
} _interfac_cpp_init;
// 47AE40: using guessed type int interfac_inf;
void __cdecl interface_msg_pump()
{
MSG Msg; // [esp+8h] [ebp-1Ch]
MSG Msg; // [esp+8h] [ebp-1Ch]
while ( PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE) )
{
if ( Msg.message != WM_QUIT )
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
if (Msg.message != WM_QUIT) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
}
bool __cdecl IncProgress()
{
interface_msg_pump();
sgdwProgress += 15;
if ( (unsigned int)sgdwProgress > 0x216 )
sgdwProgress = 534;
if ( sgpBackCel )
DrawCutscene();
return (unsigned int)sgdwProgress >= 0x216;
interface_msg_pump();
sgdwProgress += 15;
if ((unsigned int)sgdwProgress > 0x216)
sgdwProgress = 534;
if (sgpBackCel)
DrawCutscene();
return (unsigned int)sgdwProgress >= 0x216;
}
void __cdecl DrawCutscene()
{
unsigned int v0; // esi
unsigned int v0; // esi
j_lock_buf_priv(1);
CelDecodeOnly(64, 639, sgpBackCel, 1, 640);
v0 = 0;
if ( sgdwProgress )
{
do
DrawProgress(
progress_bar_screen_pos[progress_id][0] + v0++ + 64,
progress_bar_screen_pos[progress_id][1] + 160,
progress_id);
while ( v0 < sgdwProgress );
}
j_unlock_buf_priv(1);
drawpanflag = 255;
scrollrt_draw_game_screen(0);
j_lock_buf_priv(1);
CelDecodeOnly(64, 639, sgpBackCel, 1, 640);
v0 = 0;
if (sgdwProgress) {
do
DrawProgress(
progress_bar_screen_pos[progress_id][0] + v0++ + 64,
progress_bar_screen_pos[progress_id][1] + 160,
progress_id);
while (v0 < sgdwProgress);
}
j_unlock_buf_priv(1);
drawpanflag = 255;
scrollrt_draw_game_screen(0);
}
// 52571C: using guessed type int drawpanflag;
void __fastcall DrawProgress(int screen_x, int screen_y, int progress_id)
{
_BYTE *v3; // eax
signed int v4; // ecx
_BYTE *v3; // eax
signed int v4; // ecx
v3 = (unsigned char *)gpBuffer + screen_y_times_768[screen_y] + screen_x;
v4 = 22;
do
{
*v3 = progress_bar_colours[progress_id];
v3 += 768;
--v4;
}
while ( v4 );
v3 = (unsigned char *)gpBuffer + screen_y_times_768[screen_y] + screen_x;
v4 = 22;
do {
*v3 = progress_bar_colours[progress_id];
v3 += 768;
--v4;
} while (v4);
}
void __fastcall ShowProgress(int uMsg)
{
WNDPROC saveProc; // edi
BOOL v3; // cl
int v4; // eax
int v5; // edx
signed int v7; // [esp-4h] [ebp-10h]
WNDPROC saveProc; // edi
BOOL v3; // cl
int v4; // eax
int v5; // edx
signed int v7; // [esp-4h] [ebp-10h]
gbSomebodyWonGameKludge = 0;
plrmsg_delay(1);
saveProc = SetWindowProc(DisableInputWndProc);
interface_msg_pump();
ClearScreenBuffer();
scrollrt_draw_game_screen(1);
InitCutscene(uMsg);
BlackPalette();
DrawCutscene();
PaletteFadeIn(8);
IncProgress();
stream_update();
IncProgress();
switch ( uMsg )
{
case WM_DIABNEXTLVL:
IncProgress();
if ( gbMaxPlayers == 1 )
SaveLevel();
else
DeltaSaveLevel();
FreeGameMem();
v4 = ++currlevel;
goto LABEL_38;
case WM_DIABPREVLVL:
IncProgress();
if ( gbMaxPlayers == 1 )
SaveLevel();
else
DeltaSaveLevel();
IncProgress();
FreeGameMem();
leveltype = gnLevelTypeTbl[--currlevel];
IncProgress();
v5 = 1;
goto LABEL_33;
case WM_DIABRTNLVL:
if ( gbMaxPlayers == 1 )
SaveLevel();
else
DeltaSaveLevel();
setlevel = 0;
FreeGameMem();
IncProgress();
GetReturnLvlPos();
v7 = 3;
goto LABEL_32;
case WM_DIABSETLVL:
SetReturnLvlPos();
if ( gbMaxPlayers == 1 )
SaveLevel();
else
DeltaSaveLevel();
setlevel = 1;
leveltype = setlvltype;
FreeGameMem();
IncProgress();
v7 = 2;
goto LABEL_32;
case WM_DIABWARPLVL:
IncProgress();
if ( gbMaxPlayers == 1 )
SaveLevel();
else
DeltaSaveLevel();
FreeGameMem();
GetPortalLevel();
IncProgress();
v7 = 5;
goto LABEL_32;
case WM_DIABTOWNWARP:
IncProgress();
if ( gbMaxPlayers == 1 )
SaveLevel();
else
DeltaSaveLevel();
FreeGameMem();
currlevel = plr[myplr].plrlevel;
leveltype = gnLevelTypeTbl[currlevel];
IncProgress();
v7 = 6;
goto LABEL_32;
case WM_DIABTWARPUP:
IncProgress();
if ( gbMaxPlayers == 1 )
SaveLevel();
else
DeltaSaveLevel();
FreeGameMem();
currlevel = plr[myplr].plrlevel;
leveltype = gnLevelTypeTbl[currlevel];
IncProgress();
v7 = 7;
LABEL_32:
v5 = v7;
LABEL_33:
v3 = FALSE;
goto LABEL_40;
case WM_DIABRETOWN:
IncProgress();
if ( gbMaxPlayers == 1 )
SaveLevel();
else
DeltaSaveLevel();
FreeGameMem();
currlevel = plr[myplr].plrlevel;
v4 = currlevel;
LABEL_38:
leveltype = gnLevelTypeTbl[v4];
IncProgress();
v3 = FALSE;
goto LABEL_39;
case WM_DIABNEWGAME:
IncProgress();
FreeGameMem();
IncProgress();
pfile_remove_temp_files();
v3 = TRUE;
LABEL_39:
v5 = 0;
LABEL_40:
LoadGameLevel(v3, v5);
goto LABEL_41;
case WM_DIABLOADGAME:
IncProgress();
LoadGame(TRUE);
LABEL_41:
IncProgress();
break;
default:
break;
}
PaletteFadeOut(8);
FreeInterface();
SetWindowProc(saveProc);
NetSendCmdLocParam1(TRUE, CMD_PLAYER_JOINLEVEL, plr[myplr].WorldX, plr[myplr].WorldY, plr[myplr].plrlevel);
plrmsg_delay(0);
ResetPal();
if ( gbSomebodyWonGameKludge && plr[myplr].plrlevel == 16 )
PrepDoEnding();
gbSomebodyWonGameKludge = 0;
gbSomebodyWonGameKludge = 0;
plrmsg_delay(1);
saveProc = SetWindowProc(DisableInputWndProc);
interface_msg_pump();
ClearScreenBuffer();
scrollrt_draw_game_screen(1);
InitCutscene(uMsg);
BlackPalette();
DrawCutscene();
PaletteFadeIn(8);
IncProgress();
stream_update();
IncProgress();
switch (uMsg) {
case WM_DIABNEXTLVL:
IncProgress();
if (gbMaxPlayers == 1)
SaveLevel();
else
DeltaSaveLevel();
FreeGameMem();
v4 = ++currlevel;
goto LABEL_38;
case WM_DIABPREVLVL:
IncProgress();
if (gbMaxPlayers == 1)
SaveLevel();
else
DeltaSaveLevel();
IncProgress();
FreeGameMem();
leveltype = gnLevelTypeTbl[--currlevel];
IncProgress();
v5 = 1;
goto LABEL_33;
case WM_DIABRTNLVL:
if (gbMaxPlayers == 1)
SaveLevel();
else
DeltaSaveLevel();
setlevel = 0;
FreeGameMem();
IncProgress();
GetReturnLvlPos();
v7 = 3;
goto LABEL_32;
case WM_DIABSETLVL:
SetReturnLvlPos();
if (gbMaxPlayers == 1)
SaveLevel();
else
DeltaSaveLevel();
setlevel = 1;
leveltype = setlvltype;
FreeGameMem();
IncProgress();
v7 = 2;
goto LABEL_32;
case WM_DIABWARPLVL:
IncProgress();
if (gbMaxPlayers == 1)
SaveLevel();
else
DeltaSaveLevel();
FreeGameMem();
GetPortalLevel();
IncProgress();
v7 = 5;
goto LABEL_32;
case WM_DIABTOWNWARP:
IncProgress();
if (gbMaxPlayers == 1)
SaveLevel();
else
DeltaSaveLevel();
FreeGameMem();
currlevel = plr[myplr].plrlevel;
leveltype = gnLevelTypeTbl[currlevel];
IncProgress();
v7 = 6;
goto LABEL_32;
case WM_DIABTWARPUP:
IncProgress();
if (gbMaxPlayers == 1)
SaveLevel();
else
DeltaSaveLevel();
FreeGameMem();
currlevel = plr[myplr].plrlevel;
leveltype = gnLevelTypeTbl[currlevel];
IncProgress();
v7 = 7;
LABEL_32:
v5 = v7;
LABEL_33:
v3 = FALSE;
goto LABEL_40;
case WM_DIABRETOWN:
IncProgress();
if (gbMaxPlayers == 1)
SaveLevel();
else
DeltaSaveLevel();
FreeGameMem();
currlevel = plr[myplr].plrlevel;
v4 = currlevel;
LABEL_38:
leveltype = gnLevelTypeTbl[v4];
IncProgress();
v3 = FALSE;
goto LABEL_39;
case WM_DIABNEWGAME:
IncProgress();
FreeGameMem();
IncProgress();
pfile_remove_temp_files();
v3 = TRUE;
LABEL_39:
v5 = 0;
LABEL_40:
LoadGameLevel(v3, v5);
goto LABEL_41;
case WM_DIABLOADGAME:
IncProgress();
LoadGame(TRUE);
LABEL_41:
IncProgress();
break;
default:
break;
}
PaletteFadeOut(8);
FreeInterface();
SetWindowProc(saveProc);
NetSendCmdLocParam1(TRUE, CMD_PLAYER_JOINLEVEL, plr[myplr].WorldX, plr[myplr].WorldY, plr[myplr].plrlevel);
plrmsg_delay(0);
ResetPal();
if (gbSomebodyWonGameKludge && plr[myplr].plrlevel == 16)
PrepDoEnding();
gbSomebodyWonGameKludge = 0;
}
// 5CF31C: using guessed type char setlvltype;
// 5CF31D: using guessed type char setlevel;
@ -240,142 +233,136 @@ LABEL_41:
void __cdecl FreeInterface()
{
void *v0; // ecx
void *v0; // ecx
v0 = sgpBackCel;
sgpBackCel = 0;
mem_free_dbg(v0);
v0 = sgpBackCel;
sgpBackCel = 0;
mem_free_dbg(v0);
}
void __fastcall InitCutscene(int uMsg)
{
int v1; // eax
int v2; // eax
int v3; // eax
int v4; // eax
unsigned char *v5; // eax
char *v6; // ecx
int *v7; // eax
int v8; // eax
int v9; // eax
int v10; // eax
int v11; // eax
int v12; // eax
int v13; // eax
int v14; // eax
int v1; // eax
int v2; // eax
int v3; // eax
int v4; // eax
unsigned char *v5; // eax
char *v6; // ecx
int *v7; // eax
int v8; // eax
int v9; // eax
int v10; // eax
int v11; // eax
int v12; // eax
int v13; // eax
int v14; // eax
switch ( uMsg )
{
case WM_DIABNEXTLVL:
v1 = gnLevelTypeTbl[currlevel];
if ( !v1 )
goto LABEL_31;
v2 = v1 - 1;
if ( !v2 )
goto LABEL_10;
v3 = v2 - 1;
if ( !v3 )
goto LABEL_9;
v4 = v3 - 1;
if ( !v4 )
goto LABEL_29;
if ( v4 != 1 )
goto LABEL_10;
if ( currlevel < 0xFu )
goto LABEL_28;
v5 = LoadFileInMem("Gendata\\Cutgate.CEL", 0);
v6 = "Gendata\\Cutgate.pal";
goto LABEL_30;
case WM_DIABPREVLVL:
v7 = &gnLevelTypeTbl[currlevel];
if ( !*(v7 - 1) )
goto LABEL_31;
v8 = *v7;
if ( !v8 )
goto LABEL_31;
v9 = v8 - 1;
if ( !v9 )
goto LABEL_10;
v10 = v9 - 1;
if ( !v10 )
{
LABEL_9:
sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0);
LoadPalette("Gendata\\Cut2.pal");
progress_id = 2;
goto LABEL_33;
}
v11 = v10 - 1;
if ( !v11 )
goto LABEL_29;
if ( v11 == 1 )
goto LABEL_28;
LABEL_10:
sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", 0);
LoadPalette("Gendata\\Cutl1d.pal");
progress_id = 0;
goto LABEL_33;
case WM_DIABRTNLVL:
case WM_DIABSETLVL:
if ( setlvlnum == SL_BONECHAMB )
goto LABEL_21;
if ( setlvlnum != SL_VILEBETRAYER )
goto LABEL_10;
v5 = LoadFileInMem("Gendata\\Cutportr.CEL", 0);
v6 = "Gendata\\Cutportr.pal";
goto LABEL_30;
case WM_DIABWARPLVL:
v5 = LoadFileInMem("Gendata\\Cutportl.CEL", 0);
v6 = "Gendata\\Cutportl.pal";
goto LABEL_30;
case WM_DIABTOWNWARP:
case WM_DIABTWARPUP:
v12 = gnLevelTypeTbl[plr[myplr].plrlevel];
if ( !v12 )
goto LABEL_31;
v13 = v12 - 2;
if ( !v13 )
{
LABEL_21:
sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0);
LoadPalette("Gendata\\Cut2.pal");
progress_id = SL_BONECHAMB;
goto LABEL_33;
}
v14 = v13 - 1;
if ( v14 )
{
if ( v14 != 1 )
goto LABEL_33;
LABEL_28:
v5 = LoadFileInMem("Gendata\\Cut4.CEL", 0);
v6 = "Gendata\\Cut4.pal";
}
else
{
LABEL_29:
v5 = LoadFileInMem("Gendata\\Cut3.CEL", 0);
v6 = "Gendata\\Cut3.pal";
}
LABEL_30:
sgpBackCel = v5;
LoadPalette(v6);
progress_id = 1;
LABEL_33:
sgdwProgress = 0;
return;
case WM_DIABRETOWN:
LABEL_31:
v5 = LoadFileInMem("Gendata\\Cuttt.CEL", 0);
v6 = "Gendata\\Cuttt.pal";
goto LABEL_30;
case WM_DIABNEWGAME:
case WM_DIABLOADGAME:
v5 = LoadFileInMem("Gendata\\Cutstart.CEL", 0);
v6 = "Gendata\\Cutstart.pal";
goto LABEL_30;
default:
TermMsg("Unknown progress mode");
goto LABEL_33;
}
switch (uMsg) {
case WM_DIABNEXTLVL:
v1 = gnLevelTypeTbl[currlevel];
if (!v1)
goto LABEL_31;
v2 = v1 - 1;
if (!v2)
goto LABEL_10;
v3 = v2 - 1;
if (!v3)
goto LABEL_9;
v4 = v3 - 1;
if (!v4)
goto LABEL_29;
if (v4 != 1)
goto LABEL_10;
if (currlevel < 0xFu)
goto LABEL_28;
v5 = LoadFileInMem("Gendata\\Cutgate.CEL", 0);
v6 = "Gendata\\Cutgate.pal";
goto LABEL_30;
case WM_DIABPREVLVL:
v7 = &gnLevelTypeTbl[currlevel];
if (!*(v7 - 1))
goto LABEL_31;
v8 = *v7;
if (!v8)
goto LABEL_31;
v9 = v8 - 1;
if (!v9)
goto LABEL_10;
v10 = v9 - 1;
if (!v10) {
LABEL_9:
sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0);
LoadPalette("Gendata\\Cut2.pal");
progress_id = 2;
goto LABEL_33;
}
v11 = v10 - 1;
if (!v11)
goto LABEL_29;
if (v11 == 1)
goto LABEL_28;
LABEL_10:
sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", 0);
LoadPalette("Gendata\\Cutl1d.pal");
progress_id = 0;
goto LABEL_33;
case WM_DIABRTNLVL:
case WM_DIABSETLVL:
if (setlvlnum == SL_BONECHAMB)
goto LABEL_21;
if (setlvlnum != SL_VILEBETRAYER)
goto LABEL_10;
v5 = LoadFileInMem("Gendata\\Cutportr.CEL", 0);
v6 = "Gendata\\Cutportr.pal";
goto LABEL_30;
case WM_DIABWARPLVL:
v5 = LoadFileInMem("Gendata\\Cutportl.CEL", 0);
v6 = "Gendata\\Cutportl.pal";
goto LABEL_30;
case WM_DIABTOWNWARP:
case WM_DIABTWARPUP:
v12 = gnLevelTypeTbl[plr[myplr].plrlevel];
if (!v12)
goto LABEL_31;
v13 = v12 - 2;
if (!v13) {
LABEL_21:
sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0);
LoadPalette("Gendata\\Cut2.pal");
progress_id = SL_BONECHAMB;
goto LABEL_33;
}
v14 = v13 - 1;
if (v14) {
if (v14 != 1)
goto LABEL_33;
LABEL_28:
v5 = LoadFileInMem("Gendata\\Cut4.CEL", 0);
v6 = "Gendata\\Cut4.pal";
} else {
LABEL_29:
v5 = LoadFileInMem("Gendata\\Cut3.CEL", 0);
v6 = "Gendata\\Cut3.pal";
}
LABEL_30:
sgpBackCel = v5;
LoadPalette(v6);
progress_id = 1;
LABEL_33:
sgdwProgress = 0;
return;
case WM_DIABRETOWN:
LABEL_31:
v5 = LoadFileInMem("Gendata\\Cuttt.CEL", 0);
v6 = "Gendata\\Cuttt.pal";
goto LABEL_30;
case WM_DIABNEWGAME:
case WM_DIABLOADGAME:
v5 = LoadFileInMem("Gendata\\Cutstart.CEL", 0);
v6 = "Gendata\\Cutstart.pal";
goto LABEL_30;
default:
TermMsg("Unknown progress mode");
goto LABEL_33;
}
}

417
Source/minitext.cpp

@ -4,37 +4,35 @@
int qtexty; // weak
char *qtextptr;
int qtextSpd; // weak
char qtextflag; // weak
int scrolltexty; // weak
int qtextSpd; // weak
char qtextflag; // weak
int scrolltexty; // weak
int sgLastScroll; // weak
void *pMedTextCels;
void *pTextBoxCels;
const unsigned char mfontframe[127] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 37, 49, 38, 0, 39, 40, 47,
42, 43, 41, 45, 52, 44, 53, 55, 36, 27,
28, 29, 30, 31, 32, 33, 34, 35, 51, 50,
48, 46, 49, 54, 0, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 42, 0, 43, 0, 0, 0, 1, 2, 3,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 48, 0, 49, 0
const unsigned char mfontframe[127] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 37, 49, 38, 0, 39, 40, 47,
42, 43, 41, 45, 52, 44, 53, 55, 36, 27,
28, 29, 30, 31, 32, 33, 34, 35, 51, 50,
48, 46, 49, 54, 0, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 42, 0, 43, 0, 0, 0, 1, 2, 3,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 48, 0, 49, 0
};
const unsigned char mfontkern[56] =
{
5, 15, 10, 13, 14, 10, 9, 13, 11, 5,
5, 11, 10, 16, 13, 16, 10, 15, 12, 10,
14, 17, 17, 22, 17, 16, 11, 5, 11, 11,
11, 10, 11, 11, 11, 11, 15, 5, 10, 18,
15, 8, 6, 6, 7, 10, 9, 6, 10, 10,
5, 5, 5, 5, 11, 12
const unsigned char mfontkern[56] = {
5, 15, 10, 13, 14, 10, 9, 13, 11, 5,
5, 11, 10, 16, 13, 16, 10, 15, 12, 10,
14, 17, 17, 22, 17, 16, 11, 5, 11, 11,
11, 10, 11, 11, 11, 11, 15, 5, 10, 18,
15, 8, 6, 6, 7, 10, 9, 6, 10, 10,
5, 5, 5, 5, 11, 12
};
/* data */
@ -43,41 +41,40 @@ int qscroll_spd_tbl[9] = { 2, 4, 6, 8, 0, -1, -2, -3, -4 };
void __cdecl FreeQuestText()
{
void *v0; // ecx
void *v1; // ecx
void *v0; // ecx
void *v1; // ecx
v0 = pMedTextCels;
pMedTextCels = 0;
mem_free_dbg(v0);
v1 = pTextBoxCels;
pTextBoxCels = 0;
mem_free_dbg(v1);
v0 = pMedTextCels;
pMedTextCels = 0;
mem_free_dbg(v0);
v1 = pTextBoxCels;
pTextBoxCels = 0;
mem_free_dbg(v1);
}
void __cdecl InitQuestText()
{
unsigned char *v0; // eax
unsigned char *v0; // eax
pMedTextCels = LoadFileInMem("Data\\MedTextS.CEL", 0);
v0 = LoadFileInMem("Data\\TextBox.CEL", 0);
qtextflag = FALSE;
pTextBoxCels = v0;
pMedTextCels = LoadFileInMem("Data\\MedTextS.CEL", 0);
v0 = LoadFileInMem("Data\\TextBox.CEL", 0);
qtextflag = FALSE;
pTextBoxCels = v0;
}
// 646D00: using guessed type char qtextflag;
void __fastcall InitQTextMsg(int m)
{
if ( alltext[m].scrlltxt )
{
questlog = 0;
qtextptr = alltext[m].txtstr;
qtextflag = TRUE;
qtexty = 500;
sgLastScroll = qscroll_spd_tbl[alltext[m].txtspd - 1]; /* double check offset */
scrolltexty = sgLastScroll;
qtextSpd = GetTickCount();
}
PlaySFX(alltext[m].sfxnr);
if (alltext[m].scrlltxt) {
questlog = 0;
qtextptr = alltext[m].txtstr;
qtextflag = TRUE;
qtexty = 500;
sgLastScroll = qscroll_spd_tbl[alltext[m].txtspd - 1]; /* double check offset */
scrolltexty = sgLastScroll;
qtextSpd = GetTickCount();
}
PlaySFX(alltext[m].sfxnr);
}
// 646CF4: using guessed type int qtexty;
// 646CFC: using guessed type int qtextSpd;
@ -88,7 +85,7 @@ void __fastcall InitQTextMsg(int m)
void __cdecl DrawQTextBack()
{
CelDecodeOnly(88, 487, pTextBoxCels, 1, 591);
CelDecodeOnly(88, 487, pTextBoxCels, 1, 591);
#define TRANS_RECT_X 27
#define TRANS_RECT_Y 28
@ -99,184 +96,158 @@ void __cdecl DrawQTextBack()
void __fastcall PrintQTextChr(int screen_x, int screen_y, char *cel_buf, int frame)
{
char *v4; // ebx
char *v5; // esi
char *v6; // edi
int v7; // ebx
signed int v8; // edx
unsigned int v9; // eax
unsigned int v10; // ecx
char v11; // cf
unsigned int v12; // ecx
char *v13; // [esp+14h] [ebp-8h]
char *v14; // [esp+18h] [ebp-4h]
char *v4; // ebx
char *v5; // esi
char *v6; // edi
int v7; // ebx
signed int v8; // edx
unsigned int v9; // eax
unsigned int v10; // ecx
char v11; // cf
unsigned int v12; // ecx
char *v13; // [esp+14h] [ebp-8h]
char *v14; // [esp+18h] [ebp-4h]
v13 = (char *)gpBuffer + screen_y_times_768[209];
v14 = (char *)gpBuffer + screen_y_times_768[469];
v4 = &cel_buf[4 * frame];
v5 = &cel_buf[*(_DWORD *)v4];
v6 = (char *)gpBuffer + screen_y_times_768[screen_y] + screen_x;
v7 = (int)&v5[*((_DWORD *)v4 + 1) - *(_DWORD *)v4];
do
{
v8 = 22;
do
{
while ( 1 )
{
v9 = (unsigned char)*v5++;
if ( (v9 & 0x80u) == 0 )
break;
_LOBYTE(v9) = -(char)v9;
v6 += v9;
v8 -= v9;
if ( !v8 )
goto LABEL_15;
}
v8 -= v9;
if ( v6 < v13 || v6 > v14 )
{
v5 += v9;
v6 += v9;
}
else
{
v10 = v9 >> 1;
if ( !(v9 & 1) || (*v6 = *v5, ++v5, ++v6, v10) )
{
v11 = v10 & 1;
v12 = v9 >> 2;
if ( !v11 || (*(_WORD *)v6 = *(_WORD *)v5, v5 += 2, v6 += 2, v12) )
{
qmemcpy(v6, v5, 4 * v12);
v5 += 4 * v12;
v6 += 4 * v12;
}
}
}
}
while ( v8 );
LABEL_15:
v6 -= 790;
}
while ( (char *)v7 != v5 );
v13 = (char *)gpBuffer + screen_y_times_768[209];
v14 = (char *)gpBuffer + screen_y_times_768[469];
v4 = &cel_buf[4 * frame];
v5 = &cel_buf[*(_DWORD *)v4];
v6 = (char *)gpBuffer + screen_y_times_768[screen_y] + screen_x;
v7 = (int)&v5[*((_DWORD *)v4 + 1) - *(_DWORD *)v4];
do {
v8 = 22;
do {
while (1) {
v9 = (unsigned char)*v5++;
if ((v9 & 0x80u) == 0)
break;
_LOBYTE(v9) = -(char)v9;
v6 += v9;
v8 -= v9;
if (!v8)
goto LABEL_15;
}
v8 -= v9;
if (v6 < v13 || v6 > v14) {
v5 += v9;
v6 += v9;
} else {
v10 = v9 >> 1;
if (!(v9 & 1) || (*v6 = *v5, ++v5, ++v6, v10)) {
v11 = v10 & 1;
v12 = v9 >> 2;
if (!v11 || (*(_WORD *)v6 = *(_WORD *)v5, v5 += 2, v6 += 2, v12)) {
qmemcpy(v6, v5, 4 * v12);
v5 += 4 * v12;
v6 += 4 * v12;
}
}
}
} while (v8);
LABEL_15:
v6 -= 790;
} while ((char *)v7 != v5);
}
void __cdecl DrawQText()
{
char *v0; // edi
signed int v1; // edx
int v2; // ecx
char *i; // esi
unsigned char v4; // al
unsigned char v5; // al
char v6; // dl
char *v7; // eax
unsigned char v8; // al
char *v9; // esi
unsigned char v10; // bl
DWORD v11; // eax
char qstr[128]; // [esp+8h] [ebp-90h]
char *v13; // [esp+88h] [ebp-10h]
int v14; // [esp+8Ch] [ebp-Ch]
int screen_y; // [esp+90h] [ebp-8h]
int screen_x; // [esp+94h] [ebp-4h]
char *v0; // edi
signed int v1; // edx
int v2; // ecx
char *i; // esi
unsigned char v4; // al
unsigned char v5; // al
char v6; // dl
char *v7; // eax
unsigned char v8; // al
char *v9; // esi
unsigned char v10; // bl
DWORD v11; // eax
char qstr[128]; // [esp+8h] [ebp-90h]
char *v13; // [esp+88h] [ebp-10h]
int v14; // [esp+8Ch] [ebp-Ch]
int screen_y; // [esp+90h] [ebp-8h]
int screen_x; // [esp+94h] [ebp-4h]
DrawQTextBack();
v0 = qtextptr;
screen_x = 112;
v13 = 0;
screen_y = qtexty;
v14 = 0;
do
{
v1 = 0;
v2 = 0;
for ( i = v0; *i != 10; ++v2 )
{
if ( *i == 124 || v1 >= 543 )
break;
v4 = *i++;
v5 = fontidx[v4];
if ( v5 )
{
qstr[v2] = v5;
v1 += mfontkern[mfontframe[v5]] + 2;
}
else
{
--v2;
}
}
v6 = *i;
v7 = &qstr[v2];
qstr[v2] = 0;
if ( v6 == 124 )
{
*v7 = 0;
v14 = 1;
}
else if ( v6 != 10 )
{
while ( *v7 != 32 && v2 > 0 )
{
*v7 = 0;
v7 = &qstr[--v2];
}
}
v8 = qstr[0];
if ( qstr[0] )
{
v9 = qstr;
do
{
++v0;
v10 = mfontframe[fontidx[v8]];
if ( *v0 == 10 )
++v0;
if ( v10 )
PrintQTextChr(screen_x, screen_y, (char *)pMedTextCels, v10);
++v9;
screen_x += mfontkern[v10] + 2;
v8 = *v9;
}
while ( *v9 );
}
if ( !v13 )
v13 = v0;
screen_y += 38;
screen_x = 112;
if ( screen_y > 501 )
v14 = 1;
}
while ( !v14 );
v11 = GetTickCount();
while ( 1 )
{
if ( sgLastScroll <= 0 )
{
qtexty = qtexty + sgLastScroll - 1;
goto LABEL_33;
}
if ( --scrolltexty )
{
--qtexty;
LABEL_33:
if ( scrolltexty )
goto LABEL_35;
}
scrolltexty = sgLastScroll;
LABEL_35:
if ( qtexty <= 209 )
break;
qtextSpd += 50;
if ( v11 - qtextSpd >= 0x7FFFFFFF )
return;
}
qtexty += 38;
qtextptr = v13;
if ( *v13 == 124 )
qtextflag = FALSE;
DrawQTextBack();
v0 = qtextptr;
screen_x = 112;
v13 = 0;
screen_y = qtexty;
v14 = 0;
do {
v1 = 0;
v2 = 0;
for (i = v0; *i != 10; ++v2) {
if (*i == 124 || v1 >= 543)
break;
v4 = *i++;
v5 = fontidx[v4];
if (v5) {
qstr[v2] = v5;
v1 += mfontkern[mfontframe[v5]] + 2;
} else {
--v2;
}
}
v6 = *i;
v7 = &qstr[v2];
qstr[v2] = 0;
if (v6 == 124) {
*v7 = 0;
v14 = 1;
} else if (v6 != 10) {
while (*v7 != 32 && v2 > 0) {
*v7 = 0;
v7 = &qstr[--v2];
}
}
v8 = qstr[0];
if (qstr[0]) {
v9 = qstr;
do {
++v0;
v10 = mfontframe[fontidx[v8]];
if (*v0 == 10)
++v0;
if (v10)
PrintQTextChr(screen_x, screen_y, (char *)pMedTextCels, v10);
++v9;
screen_x += mfontkern[v10] + 2;
v8 = *v9;
} while (*v9);
}
if (!v13)
v13 = v0;
screen_y += 38;
screen_x = 112;
if (screen_y > 501)
v14 = 1;
} while (!v14);
v11 = GetTickCount();
while (1) {
if (sgLastScroll <= 0) {
qtexty = qtexty + sgLastScroll - 1;
goto LABEL_33;
}
if (--scrolltexty) {
--qtexty;
LABEL_33:
if (scrolltexty)
goto LABEL_35;
}
scrolltexty = sgLastScroll;
LABEL_35:
if (qtexty <= 209)
break;
qtextSpd += 50;
if (v11 - qtextSpd >= 0x7FFFFFFF)
return;
}
qtexty += 38;
qtextptr = v13;
if (*v13 == 124)
qtextflag = FALSE;
}
// 646CF4: using guessed type int qtexty;
// 646CFC: using guessed type int qtextSpd;

6
Source/minitext.h

@ -4,9 +4,9 @@
extern int qtexty; // weak
extern char *qtextptr;
extern int qtextSpd; // weak
extern char qtextflag; // weak
extern int scrolltexty; // weak
extern int qtextSpd; // weak
extern char qtextflag; // weak
extern int scrolltexty; // weak
extern int sgLastScroll; // weak
extern void *pMedTextCels;
extern void *pTextBoxCels;

Loading…
Cancel
Save