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

432
Source/help.cpp

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

2
Source/help.h

@ -3,7 +3,7 @@
#define __HELP_H__ #define __HELP_H__
extern int help_select_line; // weak extern int help_select_line; // weak
extern int dword_634494; // weak extern int dword_634494; // weak
extern int helpflag; extern int helpflag;
extern int displayinghelp[22]; extern int displayinghelp[22];
extern int HelpTop; // weak 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 unsigned char progress_bar_colours[3] = { 138u, 43u, 254u };
const int progress_bar_screen_pos[3][2] = { { 53, 37 }, { 53, 421 }, { 53, 37 } }; const int progress_bar_screen_pos[3][2] = { { 53, 37 }, { 53, 421 }, { 53, 37 } };
struct interfac_cpp_init struct interfac_cpp_init {
{ interfac_cpp_init()
interfac_cpp_init() {
{ interfac_cpp_init_value = interfac_inf;
interfac_cpp_init_value = interfac_inf; }
}
} _interfac_cpp_init; } _interfac_cpp_init;
// 47AE40: using guessed type int interfac_inf; // 47AE40: using guessed type int interfac_inf;
void __cdecl interface_msg_pump() 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) ) while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
{ if (Msg.message != WM_QUIT) {
if ( Msg.message != WM_QUIT ) TranslateMessage(&Msg);
{ DispatchMessage(&Msg);
TranslateMessage(&Msg); }
DispatchMessage(&Msg); }
}
}
} }
bool __cdecl IncProgress() bool __cdecl IncProgress()
{ {
interface_msg_pump(); interface_msg_pump();
sgdwProgress += 15; sgdwProgress += 15;
if ( (unsigned int)sgdwProgress > 0x216 ) if ((unsigned int)sgdwProgress > 0x216)
sgdwProgress = 534; sgdwProgress = 534;
if ( sgpBackCel ) if (sgpBackCel)
DrawCutscene(); DrawCutscene();
return (unsigned int)sgdwProgress >= 0x216; return (unsigned int)sgdwProgress >= 0x216;
} }
void __cdecl DrawCutscene() void __cdecl DrawCutscene()
{ {
unsigned int v0; // esi unsigned int v0; // esi
j_lock_buf_priv(1); j_lock_buf_priv(1);
CelDecodeOnly(64, 639, sgpBackCel, 1, 640); CelDecodeOnly(64, 639, sgpBackCel, 1, 640);
v0 = 0; v0 = 0;
if ( sgdwProgress ) if (sgdwProgress) {
{ do
do DrawProgress(
DrawProgress( progress_bar_screen_pos[progress_id][0] + v0++ + 64,
progress_bar_screen_pos[progress_id][0] + v0++ + 64, progress_bar_screen_pos[progress_id][1] + 160,
progress_bar_screen_pos[progress_id][1] + 160, progress_id);
progress_id); while (v0 < sgdwProgress);
while ( v0 < sgdwProgress ); }
} j_unlock_buf_priv(1);
j_unlock_buf_priv(1); drawpanflag = 255;
drawpanflag = 255; scrollrt_draw_game_screen(0);
scrollrt_draw_game_screen(0);
} }
// 52571C: using guessed type int drawpanflag; // 52571C: using guessed type int drawpanflag;
void __fastcall DrawProgress(int screen_x, int screen_y, int progress_id) void __fastcall DrawProgress(int screen_x, int screen_y, int progress_id)
{ {
_BYTE *v3; // eax _BYTE *v3; // eax
signed int v4; // ecx signed int v4; // ecx
v3 = (unsigned char *)gpBuffer + screen_y_times_768[screen_y] + screen_x; v3 = (unsigned char *)gpBuffer + screen_y_times_768[screen_y] + screen_x;
v4 = 22; v4 = 22;
do do {
{ *v3 = progress_bar_colours[progress_id];
*v3 = progress_bar_colours[progress_id]; v3 += 768;
v3 += 768; --v4;
--v4; } while (v4);
}
while ( v4 );
} }
void __fastcall ShowProgress(int uMsg) void __fastcall ShowProgress(int uMsg)
{ {
WNDPROC saveProc; // edi WNDPROC saveProc; // edi
BOOL v3; // cl BOOL v3; // cl
int v4; // eax int v4; // eax
int v5; // edx int v5; // edx
signed int v7; // [esp-4h] [ebp-10h] signed int v7; // [esp-4h] [ebp-10h]
gbSomebodyWonGameKludge = 0; gbSomebodyWonGameKludge = 0;
plrmsg_delay(1); plrmsg_delay(1);
saveProc = SetWindowProc(DisableInputWndProc); saveProc = SetWindowProc(DisableInputWndProc);
interface_msg_pump(); interface_msg_pump();
ClearScreenBuffer(); ClearScreenBuffer();
scrollrt_draw_game_screen(1); scrollrt_draw_game_screen(1);
InitCutscene(uMsg); InitCutscene(uMsg);
BlackPalette(); BlackPalette();
DrawCutscene(); DrawCutscene();
PaletteFadeIn(8); PaletteFadeIn(8);
IncProgress(); IncProgress();
stream_update(); stream_update();
IncProgress(); IncProgress();
switch ( uMsg ) switch (uMsg) {
{ case WM_DIABNEXTLVL:
case WM_DIABNEXTLVL: IncProgress();
IncProgress(); if (gbMaxPlayers == 1)
if ( gbMaxPlayers == 1 ) SaveLevel();
SaveLevel(); else
else DeltaSaveLevel();
DeltaSaveLevel(); FreeGameMem();
FreeGameMem(); v4 = ++currlevel;
v4 = ++currlevel; goto LABEL_38;
goto LABEL_38; case WM_DIABPREVLVL:
case WM_DIABPREVLVL: IncProgress();
IncProgress(); if (gbMaxPlayers == 1)
if ( gbMaxPlayers == 1 ) SaveLevel();
SaveLevel(); else
else DeltaSaveLevel();
DeltaSaveLevel(); IncProgress();
IncProgress(); FreeGameMem();
FreeGameMem(); leveltype = gnLevelTypeTbl[--currlevel];
leveltype = gnLevelTypeTbl[--currlevel]; IncProgress();
IncProgress(); v5 = 1;
v5 = 1; goto LABEL_33;
goto LABEL_33; case WM_DIABRTNLVL:
case WM_DIABRTNLVL: if (gbMaxPlayers == 1)
if ( gbMaxPlayers == 1 ) SaveLevel();
SaveLevel(); else
else DeltaSaveLevel();
DeltaSaveLevel(); setlevel = 0;
setlevel = 0; FreeGameMem();
FreeGameMem(); IncProgress();
IncProgress(); GetReturnLvlPos();
GetReturnLvlPos(); v7 = 3;
v7 = 3; goto LABEL_32;
goto LABEL_32; case WM_DIABSETLVL:
case WM_DIABSETLVL: SetReturnLvlPos();
SetReturnLvlPos(); if (gbMaxPlayers == 1)
if ( gbMaxPlayers == 1 ) SaveLevel();
SaveLevel(); else
else DeltaSaveLevel();
DeltaSaveLevel(); setlevel = 1;
setlevel = 1; leveltype = setlvltype;
leveltype = setlvltype; FreeGameMem();
FreeGameMem(); IncProgress();
IncProgress(); v7 = 2;
v7 = 2; goto LABEL_32;
goto LABEL_32; case WM_DIABWARPLVL:
case WM_DIABWARPLVL: IncProgress();
IncProgress(); if (gbMaxPlayers == 1)
if ( gbMaxPlayers == 1 ) SaveLevel();
SaveLevel(); else
else DeltaSaveLevel();
DeltaSaveLevel(); FreeGameMem();
FreeGameMem(); GetPortalLevel();
GetPortalLevel(); IncProgress();
IncProgress(); v7 = 5;
v7 = 5; goto LABEL_32;
goto LABEL_32; case WM_DIABTOWNWARP:
case WM_DIABTOWNWARP: IncProgress();
IncProgress(); if (gbMaxPlayers == 1)
if ( gbMaxPlayers == 1 ) SaveLevel();
SaveLevel(); else
else DeltaSaveLevel();
DeltaSaveLevel(); FreeGameMem();
FreeGameMem(); currlevel = plr[myplr].plrlevel;
currlevel = plr[myplr].plrlevel; leveltype = gnLevelTypeTbl[currlevel];
leveltype = gnLevelTypeTbl[currlevel]; IncProgress();
IncProgress(); v7 = 6;
v7 = 6; goto LABEL_32;
goto LABEL_32; case WM_DIABTWARPUP:
case WM_DIABTWARPUP: IncProgress();
IncProgress(); if (gbMaxPlayers == 1)
if ( gbMaxPlayers == 1 ) SaveLevel();
SaveLevel(); else
else DeltaSaveLevel();
DeltaSaveLevel(); FreeGameMem();
FreeGameMem(); currlevel = plr[myplr].plrlevel;
currlevel = plr[myplr].plrlevel; leveltype = gnLevelTypeTbl[currlevel];
leveltype = gnLevelTypeTbl[currlevel]; IncProgress();
IncProgress(); v7 = 7;
v7 = 7; LABEL_32:
LABEL_32: v5 = v7;
v5 = v7; LABEL_33:
LABEL_33: v3 = FALSE;
v3 = FALSE; goto LABEL_40;
goto LABEL_40; case WM_DIABRETOWN:
case WM_DIABRETOWN: IncProgress();
IncProgress(); if (gbMaxPlayers == 1)
if ( gbMaxPlayers == 1 ) SaveLevel();
SaveLevel(); else
else DeltaSaveLevel();
DeltaSaveLevel(); FreeGameMem();
FreeGameMem(); currlevel = plr[myplr].plrlevel;
currlevel = plr[myplr].plrlevel; v4 = currlevel;
v4 = currlevel; LABEL_38:
LABEL_38: leveltype = gnLevelTypeTbl[v4];
leveltype = gnLevelTypeTbl[v4]; IncProgress();
IncProgress(); v3 = FALSE;
v3 = FALSE; goto LABEL_39;
goto LABEL_39; case WM_DIABNEWGAME:
case WM_DIABNEWGAME: IncProgress();
IncProgress(); FreeGameMem();
FreeGameMem(); IncProgress();
IncProgress(); pfile_remove_temp_files();
pfile_remove_temp_files(); v3 = TRUE;
v3 = TRUE; LABEL_39:
LABEL_39: v5 = 0;
v5 = 0; LABEL_40:
LABEL_40: LoadGameLevel(v3, v5);
LoadGameLevel(v3, v5); goto LABEL_41;
goto LABEL_41; case WM_DIABLOADGAME:
case WM_DIABLOADGAME: IncProgress();
IncProgress(); LoadGame(TRUE);
LoadGame(TRUE); LABEL_41:
LABEL_41: IncProgress();
IncProgress(); break;
break; default:
default: break;
break; }
} PaletteFadeOut(8);
PaletteFadeOut(8); FreeInterface();
FreeInterface(); SetWindowProc(saveProc);
SetWindowProc(saveProc); NetSendCmdLocParam1(TRUE, CMD_PLAYER_JOINLEVEL, plr[myplr].WorldX, plr[myplr].WorldY, plr[myplr].plrlevel);
NetSendCmdLocParam1(TRUE, CMD_PLAYER_JOINLEVEL, plr[myplr].WorldX, plr[myplr].WorldY, plr[myplr].plrlevel); plrmsg_delay(0);
plrmsg_delay(0); ResetPal();
ResetPal(); if (gbSomebodyWonGameKludge && plr[myplr].plrlevel == 16)
if ( gbSomebodyWonGameKludge && plr[myplr].plrlevel == 16 ) PrepDoEnding();
PrepDoEnding(); gbSomebodyWonGameKludge = 0;
gbSomebodyWonGameKludge = 0;
} }
// 5CF31C: using guessed type char setlvltype; // 5CF31C: using guessed type char setlvltype;
// 5CF31D: using guessed type char setlevel; // 5CF31D: using guessed type char setlevel;
@ -240,142 +233,136 @@ LABEL_41:
void __cdecl FreeInterface() void __cdecl FreeInterface()
{ {
void *v0; // ecx void *v0; // ecx
v0 = sgpBackCel; v0 = sgpBackCel;
sgpBackCel = 0; sgpBackCel = 0;
mem_free_dbg(v0); mem_free_dbg(v0);
} }
void __fastcall InitCutscene(int uMsg) void __fastcall InitCutscene(int uMsg)
{ {
int v1; // eax int v1; // eax
int v2; // eax int v2; // eax
int v3; // eax int v3; // eax
int v4; // eax int v4; // eax
unsigned char *v5; // eax unsigned char *v5; // eax
char *v6; // ecx char *v6; // ecx
int *v7; // eax int *v7; // eax
int v8; // eax int v8; // eax
int v9; // eax int v9; // eax
int v10; // eax int v10; // eax
int v11; // eax int v11; // eax
int v12; // eax int v12; // eax
int v13; // eax int v13; // eax
int v14; // eax int v14; // eax
switch ( uMsg ) switch (uMsg) {
{ case WM_DIABNEXTLVL:
case WM_DIABNEXTLVL: v1 = gnLevelTypeTbl[currlevel];
v1 = gnLevelTypeTbl[currlevel]; if (!v1)
if ( !v1 ) goto LABEL_31;
goto LABEL_31; v2 = v1 - 1;
v2 = v1 - 1; if (!v2)
if ( !v2 ) goto LABEL_10;
goto LABEL_10; v3 = v2 - 1;
v3 = v2 - 1; if (!v3)
if ( !v3 ) goto LABEL_9;
goto LABEL_9; v4 = v3 - 1;
v4 = v3 - 1; if (!v4)
if ( !v4 ) goto LABEL_29;
goto LABEL_29; if (v4 != 1)
if ( v4 != 1 ) goto LABEL_10;
goto LABEL_10; if (currlevel < 0xFu)
if ( currlevel < 0xFu ) goto LABEL_28;
goto LABEL_28; v5 = LoadFileInMem("Gendata\\Cutgate.CEL", 0);
v5 = LoadFileInMem("Gendata\\Cutgate.CEL", 0); v6 = "Gendata\\Cutgate.pal";
v6 = "Gendata\\Cutgate.pal"; goto LABEL_30;
goto LABEL_30; case WM_DIABPREVLVL:
case WM_DIABPREVLVL: v7 = &gnLevelTypeTbl[currlevel];
v7 = &gnLevelTypeTbl[currlevel]; if (!*(v7 - 1))
if ( !*(v7 - 1) ) goto LABEL_31;
goto LABEL_31; v8 = *v7;
v8 = *v7; if (!v8)
if ( !v8 ) goto LABEL_31;
goto LABEL_31; v9 = v8 - 1;
v9 = v8 - 1; if (!v9)
if ( !v9 ) goto LABEL_10;
goto LABEL_10; v10 = v9 - 1;
v10 = v9 - 1; if (!v10) {
if ( !v10 ) LABEL_9:
{ sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0);
LABEL_9: LoadPalette("Gendata\\Cut2.pal");
sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0); progress_id = 2;
LoadPalette("Gendata\\Cut2.pal"); goto LABEL_33;
progress_id = 2; }
goto LABEL_33; v11 = v10 - 1;
} if (!v11)
v11 = v10 - 1; goto LABEL_29;
if ( !v11 ) if (v11 == 1)
goto LABEL_29; goto LABEL_28;
if ( v11 == 1 ) LABEL_10:
goto LABEL_28; sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", 0);
LABEL_10: LoadPalette("Gendata\\Cutl1d.pal");
sgpBackCel = LoadFileInMem("Gendata\\Cutl1d.CEL", 0); progress_id = 0;
LoadPalette("Gendata\\Cutl1d.pal"); goto LABEL_33;
progress_id = 0; case WM_DIABRTNLVL:
goto LABEL_33; case WM_DIABSETLVL:
case WM_DIABRTNLVL: if (setlvlnum == SL_BONECHAMB)
case WM_DIABSETLVL: goto LABEL_21;
if ( setlvlnum == SL_BONECHAMB ) if (setlvlnum != SL_VILEBETRAYER)
goto LABEL_21; goto LABEL_10;
if ( setlvlnum != SL_VILEBETRAYER ) v5 = LoadFileInMem("Gendata\\Cutportr.CEL", 0);
goto LABEL_10; v6 = "Gendata\\Cutportr.pal";
v5 = LoadFileInMem("Gendata\\Cutportr.CEL", 0); goto LABEL_30;
v6 = "Gendata\\Cutportr.pal"; case WM_DIABWARPLVL:
goto LABEL_30; v5 = LoadFileInMem("Gendata\\Cutportl.CEL", 0);
case WM_DIABWARPLVL: v6 = "Gendata\\Cutportl.pal";
v5 = LoadFileInMem("Gendata\\Cutportl.CEL", 0); goto LABEL_30;
v6 = "Gendata\\Cutportl.pal"; case WM_DIABTOWNWARP:
goto LABEL_30; case WM_DIABTWARPUP:
case WM_DIABTOWNWARP: v12 = gnLevelTypeTbl[plr[myplr].plrlevel];
case WM_DIABTWARPUP: if (!v12)
v12 = gnLevelTypeTbl[plr[myplr].plrlevel]; goto LABEL_31;
if ( !v12 ) v13 = v12 - 2;
goto LABEL_31; if (!v13) {
v13 = v12 - 2; LABEL_21:
if ( !v13 ) sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0);
{ LoadPalette("Gendata\\Cut2.pal");
LABEL_21: progress_id = SL_BONECHAMB;
sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0); goto LABEL_33;
LoadPalette("Gendata\\Cut2.pal"); }
progress_id = SL_BONECHAMB; v14 = v13 - 1;
goto LABEL_33; if (v14) {
} if (v14 != 1)
v14 = v13 - 1; goto LABEL_33;
if ( v14 ) LABEL_28:
{ v5 = LoadFileInMem("Gendata\\Cut4.CEL", 0);
if ( v14 != 1 ) v6 = "Gendata\\Cut4.pal";
goto LABEL_33; } else {
LABEL_28: LABEL_29:
v5 = LoadFileInMem("Gendata\\Cut4.CEL", 0); v5 = LoadFileInMem("Gendata\\Cut3.CEL", 0);
v6 = "Gendata\\Cut4.pal"; v6 = "Gendata\\Cut3.pal";
} }
else LABEL_30:
{ sgpBackCel = v5;
LABEL_29: LoadPalette(v6);
v5 = LoadFileInMem("Gendata\\Cut3.CEL", 0); progress_id = 1;
v6 = "Gendata\\Cut3.pal"; LABEL_33:
} sgdwProgress = 0;
LABEL_30: return;
sgpBackCel = v5; case WM_DIABRETOWN:
LoadPalette(v6); LABEL_31:
progress_id = 1; v5 = LoadFileInMem("Gendata\\Cuttt.CEL", 0);
LABEL_33: v6 = "Gendata\\Cuttt.pal";
sgdwProgress = 0; goto LABEL_30;
return; case WM_DIABNEWGAME:
case WM_DIABRETOWN: case WM_DIABLOADGAME:
LABEL_31: v5 = LoadFileInMem("Gendata\\Cutstart.CEL", 0);
v5 = LoadFileInMem("Gendata\\Cuttt.CEL", 0); v6 = "Gendata\\Cutstart.pal";
v6 = "Gendata\\Cuttt.pal"; goto LABEL_30;
goto LABEL_30; default:
case WM_DIABNEWGAME: TermMsg("Unknown progress mode");
case WM_DIABLOADGAME: goto LABEL_33;
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 int qtexty; // weak
char *qtextptr; char *qtextptr;
int qtextSpd; // weak int qtextSpd; // weak
char qtextflag; // weak char qtextflag; // weak
int scrolltexty; // weak int scrolltexty; // weak
int sgLastScroll; // weak int sgLastScroll; // weak
void *pMedTextCels; void *pMedTextCels;
void *pTextBoxCels; void *pTextBoxCels;
const unsigned char mfontframe[127] = 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, 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,
0, 0, 0, 37, 49, 38, 0, 39, 40, 47, 42, 43, 41, 45, 52, 44, 53, 55, 36, 27,
42, 43, 41, 45, 52, 44, 53, 55, 36, 27, 28, 29, 30, 31, 32, 33, 34, 35, 51, 50,
28, 29, 30, 31, 32, 33, 34, 35, 51, 50, 48, 46, 49, 54, 0, 1, 2, 3, 4, 5,
48, 46, 49, 54, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 42, 0, 43, 0, 0, 0, 1, 2, 3,
26, 42, 0, 43, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 48, 0, 49, 0
24, 25, 26, 48, 0, 49, 0
}; };
const unsigned char mfontkern[56] = const unsigned char mfontkern[56] = {
{ 5, 15, 10, 13, 14, 10, 9, 13, 11, 5,
5, 15, 10, 13, 14, 10, 9, 13, 11, 5, 5, 11, 10, 16, 13, 16, 10, 15, 12, 10,
5, 11, 10, 16, 13, 16, 10, 15, 12, 10, 14, 17, 17, 22, 17, 16, 11, 5, 11, 11,
14, 17, 17, 22, 17, 16, 11, 5, 11, 11, 11, 10, 11, 11, 11, 11, 15, 5, 10, 18,
11, 10, 11, 11, 11, 11, 15, 5, 10, 18, 15, 8, 6, 6, 7, 10, 9, 6, 10, 10,
15, 8, 6, 6, 7, 10, 9, 6, 10, 10, 5, 5, 5, 5, 11, 12
5, 5, 5, 5, 11, 12
}; };
/* data */ /* data */
@ -43,41 +41,40 @@ int qscroll_spd_tbl[9] = { 2, 4, 6, 8, 0, -1, -2, -3, -4 };
void __cdecl FreeQuestText() void __cdecl FreeQuestText()
{ {
void *v0; // ecx void *v0; // ecx
void *v1; // ecx void *v1; // ecx
v0 = pMedTextCels; v0 = pMedTextCels;
pMedTextCels = 0; pMedTextCels = 0;
mem_free_dbg(v0); mem_free_dbg(v0);
v1 = pTextBoxCels; v1 = pTextBoxCels;
pTextBoxCels = 0; pTextBoxCels = 0;
mem_free_dbg(v1); mem_free_dbg(v1);
} }
void __cdecl InitQuestText() void __cdecl InitQuestText()
{ {
unsigned char *v0; // eax unsigned char *v0; // eax
pMedTextCels = LoadFileInMem("Data\\MedTextS.CEL", 0); pMedTextCels = LoadFileInMem("Data\\MedTextS.CEL", 0);
v0 = LoadFileInMem("Data\\TextBox.CEL", 0); v0 = LoadFileInMem("Data\\TextBox.CEL", 0);
qtextflag = FALSE; qtextflag = FALSE;
pTextBoxCels = v0; pTextBoxCels = v0;
} }
// 646D00: using guessed type char qtextflag; // 646D00: using guessed type char qtextflag;
void __fastcall InitQTextMsg(int m) void __fastcall InitQTextMsg(int m)
{ {
if ( alltext[m].scrlltxt ) if (alltext[m].scrlltxt) {
{ questlog = 0;
questlog = 0; qtextptr = alltext[m].txtstr;
qtextptr = alltext[m].txtstr; qtextflag = TRUE;
qtextflag = TRUE; qtexty = 500;
qtexty = 500; sgLastScroll = qscroll_spd_tbl[alltext[m].txtspd - 1]; /* double check offset */
sgLastScroll = qscroll_spd_tbl[alltext[m].txtspd - 1]; /* double check offset */ scrolltexty = sgLastScroll;
scrolltexty = sgLastScroll; qtextSpd = GetTickCount();
qtextSpd = GetTickCount(); }
} PlaySFX(alltext[m].sfxnr);
PlaySFX(alltext[m].sfxnr);
} }
// 646CF4: using guessed type int qtexty; // 646CF4: using guessed type int qtexty;
// 646CFC: using guessed type int qtextSpd; // 646CFC: using guessed type int qtextSpd;
@ -88,7 +85,7 @@ void __fastcall InitQTextMsg(int m)
void __cdecl DrawQTextBack() void __cdecl DrawQTextBack()
{ {
CelDecodeOnly(88, 487, pTextBoxCels, 1, 591); CelDecodeOnly(88, 487, pTextBoxCels, 1, 591);
#define TRANS_RECT_X 27 #define TRANS_RECT_X 27
#define TRANS_RECT_Y 28 #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) void __fastcall PrintQTextChr(int screen_x, int screen_y, char *cel_buf, int frame)
{ {
char *v4; // ebx char *v4; // ebx
char *v5; // esi char *v5; // esi
char *v6; // edi char *v6; // edi
int v7; // ebx int v7; // ebx
signed int v8; // edx signed int v8; // edx
unsigned int v9; // eax unsigned int v9; // eax
unsigned int v10; // ecx unsigned int v10; // ecx
char v11; // cf char v11; // cf
unsigned int v12; // ecx unsigned int v12; // ecx
char *v13; // [esp+14h] [ebp-8h] char *v13; // [esp+14h] [ebp-8h]
char *v14; // [esp+18h] [ebp-4h] char *v14; // [esp+18h] [ebp-4h]
v13 = (char *)gpBuffer + screen_y_times_768[209]; v13 = (char *)gpBuffer + screen_y_times_768[209];
v14 = (char *)gpBuffer + screen_y_times_768[469]; v14 = (char *)gpBuffer + screen_y_times_768[469];
v4 = &cel_buf[4 * frame]; v4 = &cel_buf[4 * frame];
v5 = &cel_buf[*(_DWORD *)v4]; v5 = &cel_buf[*(_DWORD *)v4];
v6 = (char *)gpBuffer + screen_y_times_768[screen_y] + screen_x; v6 = (char *)gpBuffer + screen_y_times_768[screen_y] + screen_x;
v7 = (int)&v5[*((_DWORD *)v4 + 1) - *(_DWORD *)v4]; v7 = (int)&v5[*((_DWORD *)v4 + 1) - *(_DWORD *)v4];
do do {
{ v8 = 22;
v8 = 22; do {
do while (1) {
{ v9 = (unsigned char)*v5++;
while ( 1 ) if ((v9 & 0x80u) == 0)
{ break;
v9 = (unsigned char)*v5++; _LOBYTE(v9) = -(char)v9;
if ( (v9 & 0x80u) == 0 ) v6 += v9;
break; v8 -= v9;
_LOBYTE(v9) = -(char)v9; if (!v8)
v6 += v9; goto LABEL_15;
v8 -= v9; }
if ( !v8 ) v8 -= v9;
goto LABEL_15; if (v6 < v13 || v6 > v14) {
} v5 += v9;
v8 -= v9; v6 += v9;
if ( v6 < v13 || v6 > v14 ) } else {
{ v10 = v9 >> 1;
v5 += v9; if (!(v9 & 1) || (*v6 = *v5, ++v5, ++v6, v10)) {
v6 += v9; v11 = v10 & 1;
} v12 = v9 >> 2;
else if (!v11 || (*(_WORD *)v6 = *(_WORD *)v5, v5 += 2, v6 += 2, v12)) {
{ qmemcpy(v6, v5, 4 * v12);
v10 = v9 >> 1; v5 += 4 * v12;
if ( !(v9 & 1) || (*v6 = *v5, ++v5, ++v6, v10) ) v6 += 4 * v12;
{ }
v11 = v10 & 1; }
v12 = v9 >> 2; }
if ( !v11 || (*(_WORD *)v6 = *(_WORD *)v5, v5 += 2, v6 += 2, v12) ) } while (v8);
{ LABEL_15:
qmemcpy(v6, v5, 4 * v12); v6 -= 790;
v5 += 4 * v12; } while ((char *)v7 != v5);
v6 += 4 * v12;
}
}
}
}
while ( v8 );
LABEL_15:
v6 -= 790;
}
while ( (char *)v7 != v5 );
} }
void __cdecl DrawQText() void __cdecl DrawQText()
{ {
char *v0; // edi char *v0; // edi
signed int v1; // edx signed int v1; // edx
int v2; // ecx int v2; // ecx
char *i; // esi char *i; // esi
unsigned char v4; // al unsigned char v4; // al
unsigned char v5; // al unsigned char v5; // al
char v6; // dl char v6; // dl
char *v7; // eax char *v7; // eax
unsigned char v8; // al unsigned char v8; // al
char *v9; // esi char *v9; // esi
unsigned char v10; // bl unsigned char v10; // bl
DWORD v11; // eax DWORD v11; // eax
char qstr[128]; // [esp+8h] [ebp-90h] char qstr[128]; // [esp+8h] [ebp-90h]
char *v13; // [esp+88h] [ebp-10h] char *v13; // [esp+88h] [ebp-10h]
int v14; // [esp+8Ch] [ebp-Ch] int v14; // [esp+8Ch] [ebp-Ch]
int screen_y; // [esp+90h] [ebp-8h] int screen_y; // [esp+90h] [ebp-8h]
int screen_x; // [esp+94h] [ebp-4h] int screen_x; // [esp+94h] [ebp-4h]
DrawQTextBack(); DrawQTextBack();
v0 = qtextptr; v0 = qtextptr;
screen_x = 112; screen_x = 112;
v13 = 0; v13 = 0;
screen_y = qtexty; screen_y = qtexty;
v14 = 0; v14 = 0;
do do {
{ v1 = 0;
v1 = 0; v2 = 0;
v2 = 0; for (i = v0; *i != 10; ++v2) {
for ( i = v0; *i != 10; ++v2 ) if (*i == 124 || v1 >= 543)
{ break;
if ( *i == 124 || v1 >= 543 ) v4 = *i++;
break; v5 = fontidx[v4];
v4 = *i++; if (v5) {
v5 = fontidx[v4]; qstr[v2] = v5;
if ( v5 ) v1 += mfontkern[mfontframe[v5]] + 2;
{ } else {
qstr[v2] = v5; --v2;
v1 += mfontkern[mfontframe[v5]] + 2; }
} }
else v6 = *i;
{ v7 = &qstr[v2];
--v2; qstr[v2] = 0;
} if (v6 == 124) {
} *v7 = 0;
v6 = *i; v14 = 1;
v7 = &qstr[v2]; } else if (v6 != 10) {
qstr[v2] = 0; while (*v7 != 32 && v2 > 0) {
if ( v6 == 124 ) *v7 = 0;
{ v7 = &qstr[--v2];
*v7 = 0; }
v14 = 1; }
} v8 = qstr[0];
else if ( v6 != 10 ) if (qstr[0]) {
{ v9 = qstr;
while ( *v7 != 32 && v2 > 0 ) do {
{ ++v0;
*v7 = 0; v10 = mfontframe[fontidx[v8]];
v7 = &qstr[--v2]; if (*v0 == 10)
} ++v0;
} if (v10)
v8 = qstr[0]; PrintQTextChr(screen_x, screen_y, (char *)pMedTextCels, v10);
if ( qstr[0] ) ++v9;
{ screen_x += mfontkern[v10] + 2;
v9 = qstr; v8 = *v9;
do } while (*v9);
{ }
++v0; if (!v13)
v10 = mfontframe[fontidx[v8]]; v13 = v0;
if ( *v0 == 10 ) screen_y += 38;
++v0; screen_x = 112;
if ( v10 ) if (screen_y > 501)
PrintQTextChr(screen_x, screen_y, (char *)pMedTextCels, v10); v14 = 1;
++v9; } while (!v14);
screen_x += mfontkern[v10] + 2; v11 = GetTickCount();
v8 = *v9; while (1) {
} if (sgLastScroll <= 0) {
while ( *v9 ); qtexty = qtexty + sgLastScroll - 1;
} goto LABEL_33;
if ( !v13 ) }
v13 = v0; if (--scrolltexty) {
screen_y += 38; --qtexty;
screen_x = 112; LABEL_33:
if ( screen_y > 501 ) if (scrolltexty)
v14 = 1; goto LABEL_35;
} }
while ( !v14 ); scrolltexty = sgLastScroll;
v11 = GetTickCount(); LABEL_35:
while ( 1 ) if (qtexty <= 209)
{ break;
if ( sgLastScroll <= 0 ) qtextSpd += 50;
{ if (v11 - qtextSpd >= 0x7FFFFFFF)
qtexty = qtexty + sgLastScroll - 1; return;
goto LABEL_33; }
} qtexty += 38;
if ( --scrolltexty ) qtextptr = v13;
{ if (*v13 == 124)
--qtexty; qtextflag = FALSE;
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; // 646CF4: using guessed type int qtexty;
// 646CFC: using guessed type int qtextSpd; // 646CFC: using guessed type int qtextSpd;

6
Source/minitext.h

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

Loading…
Cancel
Save