diff --git a/3rdParty/Storm/Source/storm.cpp b/3rdParty/Storm/Source/storm.cpp index 70a4f60bd..77d37d5f7 100644 --- a/3rdParty/Storm/Source/storm.cpp +++ b/3rdParty/Storm/Source/storm.cpp @@ -243,3 +243,5 @@ void __stdcall SDlgBeginPaint(HWND hWnd, char *a2) rVoid; void __stdcall SDlgEndPaint(HWND hWnd, char *a2) rVoid; void __stdcall SDlgSetSystemCursor(BYTE *a1, BYTE *a2, int *a3, int a4) rVoid; void __stdcall SDlgSetCursor(HWND hWnd, HCURSOR a2, int a3, int *a4) rVoid; +BOOL __stdcall SDlgSetTimer(int a1, int a2, int a3, void (__stdcall *a4)(int)) rBool; +BOOL __stdcall SDlgKillTimer(int a1, int a2) rBool; diff --git a/3rdParty/Storm/Source/storm.def b/3rdParty/Storm/Source/storm.def index 1088a35af..f45652b04 100644 --- a/3rdParty/Storm/Source/storm.def +++ b/3rdParty/Storm/Source/storm.def @@ -63,13 +63,13 @@ EXPORTS ;SDlgDrawBitmap @210 NONAME SDlgEndDialog @211 NONAME SDlgEndPaint @212 NONAME - ;SDlgKillTimer @213 NONAME + SDlgKillTimer @213 NONAME ;SDlgSetBaseFont @214 NONAME SDlgSetBitmapI @215 NONAME SDlgSetControlBitmaps @216 NONAME SDlgSetCursor @217 NONAME SDlgSetSystemCursor @218 NONAME - ;SDlgSetTimer @219 NONAME + SDlgSetTimer @219 NONAME ;SDlgUpdateCursor @220 NONAME SDlgBltToWindowE @221 NONAME SDlgSetBitmapE @222 NONAME diff --git a/3rdParty/Storm/Source/storm.h b/3rdParty/Storm/Source/storm.h index 6051e5471..26506ec84 100644 --- a/3rdParty/Storm/Source/storm.h +++ b/3rdParty/Storm/Source/storm.h @@ -1306,6 +1306,8 @@ void __stdcall SDlgBeginPaint(HWND hWnd, char *a2); void __stdcall SDlgEndPaint(HWND hWnd, char *a2); void __stdcall SDlgSetSystemCursor(BYTE *a1, BYTE *a2, int *a3, int a4); void __stdcall SDlgSetCursor(HWND hWnd, HCURSOR a2, int a3, int *a4); +BOOL __stdcall SDlgSetTimer(int a1, int a2, int a3, void (__stdcall *a4)(int)); +BOOL __stdcall SDlgKillTimer(int a1, int a2); #ifdef __GNUC__ } diff --git a/3rdParty/Storm/Source/storm_gcc.def b/3rdParty/Storm/Source/storm_gcc.def index a7c1a05a2..f25c16241 100644 --- a/3rdParty/Storm/Source/storm_gcc.def +++ b/3rdParty/Storm/Source/storm_gcc.def @@ -83,7 +83,8 @@ EXPORTS SDlgEndDialog @211 NONAME SDlgEndPaint @212 NONAME SDlgEndPaint@8 @212 NONAME - ;SDlgKillTimer @213 NONAME + SDlgKillTimer @213 NONAME + SDlgKillTimer@8 @213 NONAME ;SDlgSetBaseFont @214 NONAME SDlgSetBitmapI @215 NONAME SDlgSetBitmapI@40 @215 NONAME @@ -92,7 +93,8 @@ EXPORTS SDlgSetCursor@16 @217 NONAME SDlgSetSystemCursor @218 NONAME SDlgSetSystemCursor@16 @218 NONAME - ;SDlgSetTimer @219 NONAME + SDlgSetTimer @219 NONAME + SDlgSetTimer@16 @219 NONAME ;SDlgUpdateCursor @220 NONAME SDlgBltToWindowE @221 NONAME SDlgSetBitmapE @222 NONAME diff --git a/DiabloUI/_temp_data.cpp b/DiabloUI/_temp_data.cpp index 6f3156d0d..e9c0b9e75 100644 --- a/DiabloUI/_temp_data.cpp +++ b/DiabloUI/_temp_data.cpp @@ -8,6 +8,7 @@ ProfileStruct bnprofiles[4] = }; int profilemsg1[6] = { 1125, 1127, 1129, 1131, 1133, 0 }; int profilemsg2[6] = { 1126, 1128, 1130, 1132, 1134, 0 }; +int fade_cpp_float_value = 2139095040; // weak int local_cpp_float_value = 2139095040; // weak int dword_10022258 = 4; // weak ProfFntStruct proffnts[4] = @@ -210,10 +211,10 @@ LPSTR dword_10029858; // idb int dword_1002985C; // weak int dword_10029860; // weak LPSTR dword_10029864; // idb -int dword_10029868; // weak -int dword_1002986C; // weak +int fade_cpp_float; // weak +int sgbFadeRange; // idb tagPALETTEENTRY fadepal[256]; -int dword_10029C70; // weak +int sgbIsFading; // weak HANDLE dword_10029C78; // idb int dword_10029C98; // weak int dword_10029C9C; // weak diff --git a/DiabloUI/_temp_funcs.h b/DiabloUI/_temp_funcs.h index 3f6850d5f..fbd8d3d59 100644 --- a/DiabloUI/_temp_funcs.h +++ b/DiabloUI/_temp_funcs.h @@ -228,15 +228,16 @@ void __fastcall EntName_100071ED(HWND hWnd, unsigned int a2, int a3); signed int EntName_10007220(); -int __fastcall Fade_1000722B(int a1, int a2); -int __fastcall Fade_100072BE(int a1); -signed int Fade_1000739F(); -signed int Fade_100073B4(); -void __fastcall Fade_100073C5(HWND hWnd, int a2); -BOOL UNKCALL Fade_100073EF(HWND hWnd); -int __fastcall Fade_100073FD(int a1, int a2, int a3); -int __stdcall Fade_10007420(int a1, int a2, int a3, int a4); -signed int Fade_1000744D(); +void __fastcall Fade_ApplyPaletteRange(int range1, int range2); +void __fastcall Fade_UpdatePaletteRange(int range); +BOOL __cdecl Fade_CheckRange5(); +void __cdecl Fade_Range5SetZero(); +void __fastcall Fade_NoInputAndArt(HWND hWnd, BOOL bShowCurs); +void __fastcall Fade_SetInputWindow(HWND hWnd); +void __fastcall Fade_SetFadeTimer(int nTime); +void __stdcall Fade_TimerFunctionDlg(int a1); +void __cdecl j_Fade_cpp_init(); +void __cdecl Fade_cpp_init(); int (__stdcall *UNKCALL Focus_10007458(void *arg))(_DWORD); diff --git a/DiabloUI/fade.cpp b/DiabloUI/fade.cpp index b4d14dbb5..d14c581eb 100644 --- a/DiabloUI/fade.cpp +++ b/DiabloUI/fade.cpp @@ -1,186 +1,157 @@ // ref: 0x1000722B -int __fastcall Fade_1000722B(int a1, int a2) { return 0; } -/* { - int v2; // ebx - int v3; // edi - char *v4; // eax - char *v5; // ecx +void __fastcall Fade_ApplyPaletteRange(int range1, int range2) +{ + tagPALETTEENTRY *v4; // eax MAPDST BYTE *v6; // esi BYTE v7; // al - v2 = a1; - v3 = a2; - v4 = local_10007895(0); - v5 = v4; - if ( v2 == v3 ) + v4 = local_GetArtPalEntry(0); + if ( range1 == range2 ) { - memcpy(&pPalEntries, v4, 0x400u); + memcpy(fadepal, v4, 0x400u); } - else if ( v3 ) + else if ( range2 ) { - v6 = &pPalEntries.peGreen; + v6 = &fadepal[0].peGreen; do { - v7 = v3 * (unsigned char)*v5 / v2; - v5 += 4; + v7 = range2 * v4->peRed / range1; + ++v4; *(v6 - 1) = v7; - *v6 = v3 * (unsigned char)*(v5 - 3) / v2; + *v6 = range2 * v4[-1].peGreen / range1; v6 += 4; - *(v6 - 3) = v3 * (unsigned char)*(v5 - 2) / v2; + *(v6 - 3) = range2 * v4[-1].peBlue / range1; } - while ( (signed int)v6 < (signed int)&dword_10029C70 + 1 ); + while ( (signed int)v6 < (signed int)&fadepal[256].peGreen ); } else { - memcpy(&pPalEntries, v4, 0x400u); - local_1000789D((char *)&pPalEntries); + memcpy(fadepal, v4, 0x400u); + local_ClearPalette(fadepal); } - return SDrawUpdatePalette(0, 256, &pPalEntries, 1); -} */ -// 100103FA: using guessed type int __stdcall SDrawUpdatePalette(_DWORD, _DWORD, _DWORD, _DWORD); -// 10029C70: using guessed type int dword_10029C70; + SDrawUpdatePalette(0, 0x100u, fadepal, 1); +} // ref: 0x100072BE -int __fastcall Fade_100072BE(int a1) { return 0; } -/* { - int v1; // ebx - char *v2; // eax - char *v3; // edi +void __fastcall Fade_UpdatePaletteRange(int range) +{ + tagPALETTEENTRY *v2; // eax + tagPALETTEENTRY *v3; // edi BYTE *v4; // ecx - char v5; // al + BYTE v5; // al HPALETTE v6; // ebx - int v8; // [esp+10h] [ebp-4h] + int v7; // [esp+10h] [ebp-4h] - v1 = a1; - v2 = local_10007895(0); - memcpy(&pPalEntries, v2, 0x400u); - if ( v1 > 0 ) + v2 = local_GetArtPalEntry(0); + memcpy(fadepal, v2, 0x400u); + if ( range > 0 ) { - v8 = v1; + v7 = range; do { - v3 = local_10007895(0); - v4 = &pPalEntries.peGreen; + v3 = local_GetArtPalEntry(0); + v4 = &fadepal[0].peGreen; do { - v5 = (unsigned char)*v3 / v1; - v3 += 4; + v5 = v3->peRed / range; + ++v3; *(v4 - 1) -= v5; - *v4 -= (unsigned char)*(v3 - 3) / v1; + *v4 -= v3[-1].peGreen / range; v4 += 4; - *(v4 - 3) -= (unsigned char)*(v3 - 2) / v1; + *(v4 - 3) -= v3[-1].peBlue / range; } - while ( (signed int)v4 < (signed int)&dword_10029C70 + 1 ); - SDrawUpdatePalette(0, 256, &pPalEntries, 1); - --v8; + while ( (signed int)v4 < (signed int)&fadepal[256].peGreen ); + SDrawUpdatePalette(0, 0x100u, fadepal, 1); + --v7; } - while ( v8 ); + while ( v7 ); } - local_1000789D((char *)&pPalEntries); - SDrawUpdatePalette(0, 256, &pPalEntries, 1); - local_1000811B(); - SDrawClearSurface(); + local_ClearPalette(fadepal); + SDrawUpdatePalette(0, 0x100u, fadepal, 1); + local_SetCursorDefault(); + SDrawClearSurface(0); v6 = (HPALETTE)GetStockObject(15); - GetPaletteEntries(v6, 0, 0xAu, &pPalEntries); - GetPaletteEntries(v6, 0xAu, 0xAu, &stru_10029C48); - return SDrawUpdatePalette(0, 256, &pPalEntries, 1); -} */ -// 100103FA: using guessed type int __stdcall SDrawUpdatePalette(_DWORD, _DWORD, _DWORD, _DWORD); -// 1001043C: using guessed type _DWORD __stdcall SDrawClearSurface(); -// 10029C70: using guessed type int dword_10029C70; + GetPaletteEntries(v6, 0, 0xAu, fadepal); + GetPaletteEntries(v6, 0xAu, 0xAu, &fadepal[246]); + SDrawUpdatePalette(0, 0x100u, fadepal, 1); +} +// 1001043C: using guessed type int __stdcall SDrawClearSurface(_DWORD); // ref: 0x1000739F -signed int Fade_1000739F() { return 0; } -/* { - signed int result; // eax +BOOL __cdecl Fade_CheckRange5() +{ + BOOL result; // eax result = 0; - if ( dword_10029C70 ) + if ( sgbIsFading ) { - if ( dword_1002986C <= 5 ) + if ( sgbFadeRange <= 5 ) result = 1; } return result; -} */ -// 1002986C: using guessed type int dword_1002986C; -// 10029C70: using guessed type int dword_10029C70; +} +// 10029C70: using guessed type int sgbIsFading; // ref: 0x100073B4 -signed int Fade_100073B4() { return 0; } -/* { - signed int result; // eax - - result = Fade_1000739F(); - if ( result ) - dword_10029C70 = 0; - return result; -} */ -// 10029C70: using guessed type int dword_10029C70; +void __cdecl Fade_Range5SetZero() +{ + if ( Fade_CheckRange5() ) + sgbIsFading = 0; +} +// 10029C70: using guessed type int sgbIsFading; // ref: 0x100073C5 -void __fastcall Fade_100073C5(HWND hWnd, int a2) { return; } -/* { - int v2; // esi +void __fastcall Fade_NoInputAndArt(HWND hWnd, BOOL bShowCurs) +{ HWND v3; // eax - int result; // eax - v2 = a2; v3 = GetParent(hWnd); - result = local_10007F04(v3); - if ( v2 ) - result = local_100080F1(); - dword_10029C70 = 0; - dword_1002986C = 0; - return result; -} */ -// 1002986C: using guessed type int dword_1002986C; -// 10029C70: using guessed type int dword_10029C70; + local_DisableKeyWaitMouse(v3); + if ( bShowCurs ) + local_SetCursorArt(); + sgbIsFading = 0; + sgbFadeRange = 0; +} +// 10029C70: using guessed type int sgbIsFading; // ref: 0x100073EF -BOOL UNKCALL Fade_100073EF(HWND hWnd) { return 0; } -/* { +void __fastcall Fade_SetInputWindow(HWND hWnd) +{ HWND v1; // eax v1 = GetParent(hWnd); - return local_10007F04(v1); -} */ + local_DisableKeyWaitMouse(v1); +} // ref: 0x100073FD -int UNKCALL Fade_100073FD(void *arg, int a2) { return 0; } -/* { - int result; // eax - - if ( !dword_10029C70 ) +void __fastcall Fade_SetFadeTimer(int nTime) +{ + if ( !sgbIsFading ) { - result = SDlgSetTimer(arg, 16, 50, Fade_10007420); - dword_10029C70 = 1; + SDlgSetTimer(nTime, 16, 50, Fade_TimerFunctionDlg); + sgbIsFading = 1; } - return result; -} */ -// 10010412: using guessed type int __stdcall SDlgSetTimer(_DWORD, _DWORD, _DWORD, _DWORD); -// 10029C70: using guessed type int dword_10029C70; +} +// 10029C70: using guessed type int sgbIsFading; // ref: 0x10007420 -int __stdcall Fade_10007420(int a1, int a2, int a3, int a4) { return 0; } -/* { - int result; // eax - - if ( dword_1002986C > 5 ) - return SDlgKillTimer(a1, 16); - result = Fade_1000722B(5, dword_1002986C); - ++dword_1002986C; - return result; -} */ -// 10010418: using guessed type int __stdcall SDlgKillTimer(_DWORD, _DWORD); -// 1002986C: using guessed type int dword_1002986C; +void __stdcall Fade_TimerFunctionDlg(int a1) +{ + if ( sgbFadeRange > 5 ) + { + SDlgKillTimer(a1, 16); + } + else + { + Fade_ApplyPaletteRange(5, sgbFadeRange); + ++sgbFadeRange; + } +} // ref: 0x1000744D -signed int Fade_1000744D() { return 0; } -/* { - signed int result; // eax - - result = 2139095040; - dword_10029868 = 2139095040; - return result; -} */ -// 10029868: using guessed type int dword_10029868; +void __cdecl Fade_cpp_init() +{ + fade_cpp_float = fade_cpp_float_value; +} +// 1001F428: using guessed type int fade_cpp_float_value; +// 10029868: using guessed type int fade_cpp_float;