diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 13bf7105a..a8b58676d 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -1,8 +1,7 @@ //HEADER_GOES_HERE #include "../types.h" - - +#include "miniwin_sdl.h" #ifndef NO_GLOBALS void *optbar_cel; @@ -12,74 +11,88 @@ TMenuItem *sgpCurrItem; 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 -void * pPentSmall; -void * pTitlqtxtCel; -void * pDiabfrCel ; +void *pPentSmall; +void *pTitlqtxtCel; +void *pDiabfrCel; void *BigTGold_cel; int gdwLogoWidth; int gdwLogoHeight; void *pPcxLogoImage; -void * pTitlgrayCel_sgpBackCel; +void *pTitlgrayCel_sgpBackCel; int gdwTitleWidth; int gdwTitleHeight; void *pPcxTitleImage; - int gdwCursorWidth; int gdwCursorHeight; void *pPcxCursorImage; - int gdwHeroHeight; int gdwHeroWidth; -void * pPcxHeroImage; +void *pPcxHeroImage; int gdwSHeroHeight; int gdwSHeroWidth; -void * pPcxSHeroImage; +void *pPcxSHeroImage; + +void *pPcxGameImage; + + +int gdwFontWidth; +int gdwFontHeight; +void *pPcxFontImage; +unsigned char *pFont; + +int gdwFont2Width; +int gdwFont2Height; +void *pPcxFont2Image; +unsigned char *pFont2; + +int gdwFont3Width; +int gdwFont3Height; +void *pPcxFont3Image; +unsigned char *pFont3; + -void* pPcxGameImage; #endif 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 -}; + { + 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 -}; + { + 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 ) + if (currlevel) RedBack(); - if ( !dword_634480 ) + if (!dword_634480) { light_table_index = 0; gmenu_print_text(316, 336, "Pause"); @@ -89,12 +102,11 @@ void __cdecl gmenu_draw_pause() PALETTEENTRY pcxPal[256]; - void __fastcall LoadPalInMem(PALETTEENTRY *pPal) { int i; // eax - for(i = 0; i < 256; i++) + for (i = 0; i < 256; i++) { orig_palette[i].peFlags = 0; orig_palette[i].peRed = pPal[i].peRed; @@ -105,131 +117,124 @@ void __fastcall LoadPalInMem(PALETTEENTRY *pPal) BOOL __cdecl LoadArtImage(char *pszFile, void **pBuffer, int frames, DWORD *data) { - DWORD width; // [esp+44h] [ebp-8h] - DWORD height; // [esp+48h] [ebp-4h] MAPDST + DWORD width; // [esp+44h] [ebp-8h] + DWORD height; // [esp+48h] [ebp-4h] MAPDST *pBuffer = NULL; - if ( !SBmpLoadImage(pszFile, 0, 0, 0, &width, &height, 0) ) - return 0; - *pBuffer = SMemAlloc(height * width, "U:\\DiabloUI\\Ui\\local.cpp", 88); - if ( !SBmpLoadImage(pszFile, NULL, *pBuffer, height * width, 0, 0, 0) ) - return 0; - if ( pBuffer && data ) - { - data[0] = width; - data[1] = height / frames; - } - return 1; + if (!SBmpLoadImage(pszFile, 0, 0, 0, &width, &height, 0)) + return 0; + *pBuffer = SMemAlloc(height * width, "U:\\DiabloUI\\Ui\\local.cpp", 88); + if (!SBmpLoadImage(pszFile, NULL, *pBuffer, height * width, 0, 0, 0)) + return 0; + if (pBuffer && data) + { + data[0] = width; + data[1] = height / frames; + } + return 1; } - - - - BOOL __cdecl LoadArtWithPal(char *pszFile, void **pBuffer, int frames, DWORD *data) { - DWORD width; // [esp+44h] [ebp-8h] - DWORD height; // [esp+48h] [ebp-4h] MAPDST + DWORD width; // [esp+44h] [ebp-8h] + DWORD height; // [esp+48h] [ebp-4h] MAPDST *pBuffer = NULL; - if ( !SBmpLoadImage(pszFile, 0, 0, 0, &width, &height, 0) ) - return 0; - *pBuffer = SMemAlloc(height * width, "U:\\DiabloUI\\Ui\\local.cpp", 88); - if ( !SBmpLoadImage(pszFile, pcxPal, *pBuffer, height * width, 0, 0, 0) ) - return 0; + if (!SBmpLoadImage(pszFile, 0, 0, 0, &width, &height, 0)) + return 0; + *pBuffer = SMemAlloc(height * width, "U:\\DiabloUI\\Ui\\local.cpp", 88); + if (!SBmpLoadImage(pszFile, pcxPal, *pBuffer, height * width, 0, 0, 0)) + return 0; LoadPalInMem(pcxPal); -// lpDDPalette->SetEntries(0, 0, 256, orig_palette); - - if ( pBuffer && data ) - { - data[0] = width; - data[1] = height / frames; - } - return 1; -} - - + // lpDDPalette->SetEntries(0, 0, 256, orig_palette); + if (pBuffer && data) + { + data[0] = width; + data[1] = height / frames; + } + return 1; +} BOOL __stdcall SBmpLoadImage(const char *pszFileName, PALETTEENTRY *pPalette, void *pBuffer, DWORD dwBuffersize, DWORD *pdwWidth, DWORD *dwHeight, DWORD *pdwBpp) { - char *v7; // ebx - unsigned char *v8; // edi - PALETTEENTRY *v9; // esi - int v10; // esi - signed int v11; // ebx - int v12; // ebp - size_t v13; // ebp - unsigned char *v14; // eax - unsigned char *v15; // edx - int v16; // ebp - unsigned char v17; // cl - unsigned char v18; // al - int v19; // ecx - bool v20; // zf - bool v21; // sf - unsigned char (*v22)[3]; // eax - BYTE v23; // cl - unsigned char *Memory; // [esp+14h] [ebp-38Ch] - HANDLE hFile; // [esp+18h] [ebp-388h] MAPDST - DWORD v28; // [esp+1Ch] [ebp-384h] - PCXHeader pcxhdr; // [esp+20h] [ebp-380h] + char *v7; // ebx + unsigned char *v8; // edi + PALETTEENTRY *v9; // esi + int v10; // esi + signed int v11; // ebx + int v12; // ebp + size_t v13; // ebp + unsigned char *v14; // eax + unsigned char *v15; // edx + int v16; // ebp + unsigned char v17; // cl + unsigned char v18; // al + int v19; // ecx + bool v20; // zf + bool v21; // sf + unsigned char(*v22)[3]; // eax + BYTE v23; // cl + unsigned char *Memory; // [esp+14h] [ebp-38Ch] + HANDLE hFile; // [esp+18h] [ebp-388h] MAPDST + DWORD v28; // [esp+1Ch] [ebp-384h] + PCXHeader pcxhdr; // [esp+20h] [ebp-380h] unsigned char paldata[256][3]; // [esp+A0h] [ebp-300h] int z; - if ( pdwWidth ) + if (pdwWidth) *pdwWidth = 0; - if ( dwHeight ) + if (dwHeight) *dwHeight = 0; - if ( pdwBpp ) + if (pdwBpp) *pdwBpp = 0; v7 = (char *)pszFileName; - if ( pszFileName ) + if (pszFileName) { - if ( *pszFileName ) + if (*pszFileName) { v8 = (unsigned char *)pBuffer; - if ( !pBuffer || dwBuffersize ) + if (!pBuffer || dwBuffersize) { v9 = pPalette; - if ( pPalette || pBuffer || pdwWidth || dwHeight ) + if (pPalette || pBuffer || pdwWidth || dwHeight) { - if ( SFileOpenFile(pszFileName, &hFile) ) + if (SFileOpenFile(pszFileName, &hFile)) { - if ( strchr(pszFileName, 92) ) + if (strchr(pszFileName, 92)) { do v7 = strchr(v7, 92) + 1; - while ( strchr(v7, 92) ); + while (strchr(v7, 92)); } - for ( ; strchr(v7 + 1, 46); v7 = strchr(v7, 46) ) + for (; strchr(v7 + 1, 46); v7 = strchr(v7, 46)) ; - if ( !v7 || _strcmpi(v7, ".pcx") ) // omit all types except PCX + if (!v7 || _strcmpi(v7, ".pcx")) // omit all types except PCX { return 0; //v10 = sub_15001C70(hFile, pPalette, pBuffer, dwBuffersize, pdwWidth, dwHeight, pdwBpp); //goto LABEL_51; } - if ( !SFileReadFile(hFile, &pcxhdr, 128u, 0, 0) ) + if (!SFileReadFile(hFile, &pcxhdr, 128u, 0, 0)) { v10 = 0; -LABEL_51: + LABEL_51: SFileCloseFile(hFile); return v10; } *(_DWORD *)&paldata[0][0] = pcxhdr.xmax - pcxhdr.xmin + 1; v11 = pcxhdr.ymax - pcxhdr.ymin + 1; v28 = pcxhdr.bitsPerPixel; - if ( pdwWidth ) + if (pdwWidth) *pdwWidth = *(_DWORD *)&paldata[0][0]; - if ( dwHeight ) + if (dwHeight) *dwHeight = v11; - if ( pdwBpp ) + if (pdwBpp) *pdwBpp = v28; - if ( !pBuffer ) + if (!pBuffer) { SFileSetFilePointer(hFile, 0, 0, 2); goto LABEL_45; @@ -238,15 +243,15 @@ LABEL_51: v13 = v12 - SFileSetFilePointer(hFile, 0, 0, 1); v14 = (unsigned char *)SMemAlloc(v13, "SBMP.CPP", 171); Memory = v14; - if ( !v14 ) + if (!v14) { -LABEL_45: - if ( pPalette && v28 == 8 ) + LABEL_45: + if (pPalette && v28 == 8) { SFileSetFilePointer(hFile, -768, 0, 1); SFileReadFile(hFile, paldata, 768u, 0, 0); v22 = paldata; - for(z = 0; z < 256; z++) + for (z = 0; z < 256; z++) { v23 = *(_BYTE *)v22; ++v9; @@ -262,14 +267,14 @@ LABEL_45: } SFileReadFile(hFile, v14, v13, 0, 0); v15 = Memory; - if ( v11 <= 0 ) + if (v11 <= 0) goto LABEL_43; -LABEL_33: + LABEL_33: v16 = *(_DWORD *)&paldata[0][0]; - while ( 1 ) + while (1) { v17 = *v15++; - if ( v17 < 0xC0u ) + if (v17 < 0xC0u) { *v8++ = v17; --v16; @@ -279,11 +284,11 @@ LABEL_33: v18 = *v15; v19 = v17 & 0x3F; ++v15; - for ( ; v19; --v16 ) + for (; v19; --v16) { v20 = v16 == 0; v21 = v16 < 0; - if ( !v16 ) + if (!v16) goto LABEL_41; *v8++ = v18; --v19; @@ -291,12 +296,12 @@ LABEL_33: } v20 = v16 == 0; v21 = v16 < 0; -LABEL_41: - if ( v21 || v20 ) + LABEL_41: + if (v21 || v20) { - if ( !--v11 ) + if (!--v11) { -LABEL_43: + LABEL_43: SMemFree(Memory, "SBMP.CPP", 178); goto LABEL_45; } @@ -311,25 +316,23 @@ LABEL_43: return 0; } - - void __fastcall gmenu_print_text(int x, int y, char *pszStr) { - char *v3; // edi - int v4; // ebp - int v5; // esi - unsigned char i; // al + char *v3; // edi + int v4; // ebp + int v5; // esi + unsigned char i; // al unsigned char v7; // bl //printf("X:%d Y: %d \n", x, y ); v3 = pszStr; v4 = y; v5 = x; - for ( i = *pszStr; *v3; i = *v3 ) + for (i = *pszStr; *v3; i = *v3) { ++v3; v7 = lfontframe[fontidx[i]]; - if ( v7 ) + if (v7) CelDecodeLightOnly(v5, v4, (char *)BigTGold_cel, v7, 46); v5 += lfontkern[v7] + 2; } @@ -360,8 +363,6 @@ void __cdecl FreeGMenu() mem_free_dbg(v4); } - - void __cdecl gmenu_init_menu() { DWORD dwData[2]; @@ -372,12 +373,10 @@ void __cdecl gmenu_init_menu() dword_63448C = 0; byte_634464 = 0; - LoadArtImage("ui_art\\cursor.pcx", &pPcxCursorImage, 1, dwData); gdwCursorWidth = dwData[0]; gdwCursorHeight = dwData[1]; - LoadArtWithPal("ui_art\\mainmenu.pcx", &pPcxTitleImage, 1, dwData); gdwTitleWidth = dwData[0]; gdwTitleHeight = dwData[1]; @@ -386,8 +385,6 @@ void __cdecl gmenu_init_menu() gdwLogoWidth = dwData[0]; gdwLogoHeight = dwData[1]; - - LoadArtImage("ui_art\\heros.pcx", &pPcxHeroImage, 4, dwData); gdwHeroWidth = dwData[0]; gdwHeroHeight = dwData[1]; @@ -396,10 +393,28 @@ void __cdecl gmenu_init_menu() gdwSHeroWidth = dwData[0]; gdwSHeroHeight = dwData[1]; - LoadArtImage("ui_art\\selgame.pcx", &pPcxGameImage, 1, dwData); + LoadArtImage("ui_art\\selgame.pcx", &pPcxGameImage, 1, dwData); gdwSHeroWidth = dwData[0]; gdwSHeroHeight = dwData[1]; + LoadArtWithPal("ui_art\\credits.pcx", &pPcxCreditsImage, 1, dwData); + gdwCreditsWidth = dwData[0]; + gdwCreditsHeight = dwData[1]; + + LoadArtImage("ui_art\\font42g.pcx", &pPcxFontImage, 256, dwData); + gdwFontWidth = dwData[0]; + gdwFontHeight = dwData[1]; + pFont = LoadFileInMem("ui_art\\font42.bin", 0); + + LoadArtImage("ui_art\\font16g.pcx", &pPcxFont2Image, 256, dwData); + gdwFont2Width = dwData[0]; + gdwFont2Height = dwData[1]; + pFont2 = LoadFileInMem("ui_art\\font16.bin", 0); + + LoadArtImage("ui_art\\font16s.pcx", &pPcxFont3Image, 256, dwData); + gdwFont3Width = dwData[0]; + gdwFont3Height = dwData[1]; + pFont3 = LoadFileInMem("ui_art\\font16.bin", 0); sgpLogo = LoadFileInMem("Data\\Diabsmal.CEL", 0); BigTGold_cel = LoadFileInMem("Data\\BigTGold.CEL", 0); @@ -411,52 +426,38 @@ void __cdecl gmenu_init_menu() pSTextBoxCels = LoadFileInMem("Data\\TextBox2.CEL", 0); pMedTextCels = LoadFileInMem("Data\\MedTextS.CEL", 0); pDiabfrCel = LoadFileInMem("Data\\Diabsmal.CEL", 0); - - - } // 634464: using guessed type char byte_634464; // 634478: using guessed type char byte_634478; // 63448C: using guessed type int dword_63448C; - - - - - - - - - - - bool __cdecl gmenu_exception() { 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 + 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 ) + if (gmFunc) { gmFunc(); v2 = dword_634480; } v3 = 0; dword_63448C = 0; - if ( v2 ) + if (v2) { v4 = &v2->fnMenu; - while ( *v4 ) + while (*v4) { ++v3; v4 += 3; @@ -473,35 +474,35 @@ void __fastcall gmenu_call_proc(TMenuItem *pItem, void (__cdecl *gmFunc)()) void __fastcall gmenu_up_down(int a1) { TMenuItem *v1; // eax - int v2; // edi + int v2; // edi v1 = sgpCurrItem; - if ( sgpCurrItem ) + if (sgpCurrItem) { byte_634464 = 0; v2 = dword_63448C; - while ( v2 ) + while (v2) { --v2; - if ( a1 ) + if (a1) { ++v1; sgpCurrItem = v1; - if ( v1->fnMenu ) + if (v1->fnMenu) goto LABEL_10; v1 = dword_634480; } else { - if ( v1 == dword_634480 ) + if (v1 == dword_634480) v1 = &dword_634480[dword_63448C]; --v1; } sgpCurrItem = v1; -LABEL_10: - if ( (v1->dwFlags & 0x80000000) != 0 ) + LABEL_10: + if ((v1->dwFlags & 0x80000000) != 0) { - if ( v2 ) + if (v2) PlaySFX(IS_TITLEMOV); return; } @@ -513,25 +514,25 @@ LABEL_10: void __cdecl gmenu_draw() { - int v0; // edi + int v0; // edi TMenuItem *i; // esi - DWORD v2; // eax + DWORD v2; // eax - if ( dword_634480 ) + if (dword_634480) { - if ( dword_63447C ) + if (dword_63447C) dword_63447C(); - CelDecodeOnly(236, 262, sgpLogo, 1, 296); + // CelDecodeOnly(236, 262, sgpLogo, 1, 296); 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; } v2 = GetTickCount(); - if ( (signed int)(v2 - dword_634474) > 25 ) + if ((signed int)(v2 - dword_634474) > 25) { - if ( ++byte_634478 == 9 ) + if (++byte_634478 == 9) byte_634478 = 1; dword_634474 = v2; } @@ -542,31 +543,47 @@ void __cdecl gmenu_draw() 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 + 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 + int v11; // esi + int v12; // eax + int v13; // edi unsigned int v14; // [esp+10h] [ebp-4h] + int diablogo_cel_frame = 1; + + int MyPcxDelay = 60; + int MyPcxFRAME = (SDL_GetTicks() / MyPcxDelay) % 15; + if (++MyPcxFRAME == 15) + { + MyPcxFRAME = 1; + } + + DrawArtWithMask(320 - (gdwLogoWidth / 2), -50, gdwLogoWidth, gdwLogoHeight, MyPcxFRAME, 250, pPcxLogoImage); + + if (++diablogo_cel_frame == 29) + { + diablogo_cel_frame = 1; + } + v2 = a2; v3 = pItem; v4 = gmenu_get_lfont(pItem); v5 = v4; v14 = v4; - if ( v3->dwFlags & 0x40000000 ) + if (v3->dwFlags & 0x40000000) { v6 = (v4 >> 1) + 80; CelDecodeOnly(v6, v2 - 10, optbar_cel, 1, 287); v7 = (v3->dwFlags >> 12) & 0xFFF; - if ( v7 < 2 ) + if (v7 < 2) v7 = 2; v8 = ((v3->dwFlags & 0xFFF) << 8) / v7; v9 = (v5 >> 1) + 82; @@ -580,11 +597,10 @@ void __fastcall gmenu_draw_menu_item(TMenuItem *pItem, int a2) _LOBYTE(v12) = v12 & 0xF1; light_table_index = v12 + 15; 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); CelDecodeOnly(v11 + v5 + 4, v13, PentSpin_cel, (unsigned char)byte_634478, 48); } @@ -594,11 +610,11 @@ void __fastcall gmenu_draw_menu_item(TMenuItem *pItem, int a2) void __fastcall gmenu_clear_buffer(int x, int y, int width, int height) { - int v4; // edi + int v4; // edi char *i; // esi 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); i -= 768; @@ -607,17 +623,17 @@ void __fastcall gmenu_clear_buffer(int x, int y, int width, int height) int __fastcall gmenu_get_lfont(TMenuItem *pItem) { - char *v2; // eax - int i; // edx + char *v2; // eax + int i; // edx unsigned char v4; // cl - if ( pItem->dwFlags & 0x40000000 ) + if (pItem->dwFlags & 0x40000000) return 490; v2 = pItem->pszStr; - for ( i = 0; ; i += lfontkern[lfontframe[fontidx[v4]]] + 2 ) + for (i = 0;; i += lfontkern[lfontframe[fontidx[v4]]] + 2) { v4 = *v2; - if ( !*v2 ) + if (!*v2) break; ++v2; } @@ -629,69 +645,69 @@ int __fastcall gmenu_presskeys(int a1) int v1; // ecx int v2; // ecx - if ( !dword_634480 ) + if (!dword_634480) return 0; - switch ( a1 ) + 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: + case VK_RETURN: + if ((sgpCurrItem->dwFlags & 0x80000000) != 0) + { 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; + ((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 + signed int v1; // edx unsigned int v2; // eax - int v3; // eax + int v3; // eax v1 = sgpCurrItem->dwFlags; - if ( sgpCurrItem->dwFlags & 0x40000000 ) + if (sgpCurrItem->dwFlags & 0x40000000) { v2 = sgpCurrItem->dwFlags & 0xFFF; - if ( a1 ) + if (a1) { - if ( v2 == ((v1 >> 12) & 0xFFF) ) + if (v2 == ((v1 >> 12) & 0xFFF)) return; v3 = v2 + 1; } else { - if ( !(v1 & 0xFFF) ) + if (!(v1 & 0xFFF)) return; v3 = v2 - 1; } _LOWORD(v1) = v1 & 0xF000; sgpCurrItem->dwFlags = v1; sgpCurrItem->dwFlags |= v3; - ((void (__fastcall *)(_DWORD))sgpCurrItem->fnMenu)(0); + ((void(__fastcall *)(_DWORD))sgpCurrItem->fnMenu)(0); } } @@ -701,14 +717,14 @@ int __fastcall gmenu_on_mouse_move(LPARAM lParam) int a1; // [esp+0h] [ebp-4h] a1 = lParam; - if ( !byte_634464 ) + 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); + ((void(__fastcall *)(_DWORD, int))sgpCurrItem->fnMenu)(0, v2); return 1; } // 41A37A: could not find valid save-restore pair for esi @@ -717,12 +733,12 @@ int __fastcall gmenu_on_mouse_move(LPARAM lParam) bool __fastcall gmenu_valid_mouse_pos(int *plOffset) { *plOffset = 282; - if ( MouseX < 282 ) + if (MouseX < 282) { *plOffset = 0; return 0; } - if ( MouseX > 538 ) + if (MouseX > 538) { *plOffset = 256; return 0; @@ -733,40 +749,40 @@ bool __fastcall gmenu_valid_mouse_pos(int *plOffset) int __fastcall gmenu_left_mouse(int a1) { - int result; // eax + int result; // eax unsigned int v2; // eax unsigned int v3; // eax - TMenuItem *v4; // esi + TMenuItem *v4; // esi unsigned int v5; // eax //LPARAM v6; // ecx int a1a; // [esp+4h] [ebp-4h] - if ( a1 ) + if (a1) { - if ( !dword_634480 || MouseY >= 352 ) + if (!dword_634480 || MouseY >= 352) return 0; - if ( MouseY - 117 >= 0 ) + if (MouseY - 117 >= 0) { v2 = (MouseY - 117) / 45; - if ( v2 < dword_63448C ) + if (v2 < dword_63448C) { v3 = v2; v4 = &dword_634480[v3]; - if ( (v4->dwFlags & 0x80000000) != 0 ) + if ((v4->dwFlags & 0x80000000) != 0) { v5 = (unsigned int)gmenu_get_lfont(&dword_634480[v3]) >> 1; - if ( MouseX >= 320 - v5 && MouseX <= v5 + 320 ) + if (MouseX >= 320 - v5 && MouseX <= v5 + 320) { sgpCurrItem = v4; PlaySFX(IS_TITLEMOV); - if ( v4->dwFlags & 0x40000000 ) + 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); + ((void(__fastcall *)(signed int))sgpCurrItem->fnMenu)(1); } } } @@ -776,7 +792,7 @@ int __fastcall gmenu_left_mouse(int a1) else { result = 0; - if ( !byte_634464 ) + if (!byte_634464) return result; byte_634464 = 0; } @@ -787,7 +803,7 @@ int __fastcall gmenu_left_mouse(int a1) void __fastcall gmenu_enable(TMenuItem *pMenuItem, BOOL enable) { - if ( enable ) + if (enable) pMenuItem->dwFlags |= 0x80000000; else pMenuItem->dwFlags &= 0x7F000000; @@ -796,11 +812,11 @@ void __fastcall gmenu_enable(TMenuItem *pMenuItem, BOOL enable) void __fastcall gmenu_slider_1(TMenuItem *pItem, int min, int max, int gamma) { unsigned int v4; // esi - int v5; // eax + int v5; // eax v4 = pItem->dwFlags; v5 = (pItem->dwFlags >> 12) & 0xFFF; - if ( v5 < 2 ) + if (v5 < 2) v5 = 2; _LOWORD(v4) = v4 & 0xF000; pItem->dwFlags = v4 | (v5 * (gamma - min) + (max - min - 1) / 2) / (max - min); @@ -808,12 +824,12 @@ void __fastcall gmenu_slider_1(TMenuItem *pItem, int min, int max, int gamma) int __fastcall gmenu_slider_get(TMenuItem *pItem, int min, int max) { - int v3; // eax + int v3; // eax unsigned int v4; // ecx v3 = (pItem->dwFlags >> 12) & 0xFFF; v4 = pItem->dwFlags & 0xFFF; - if ( v3 < 2 ) + if (v3 < 2) v3 = 2; return min + (v4 * (max - min) + (v3 - 1) / 2) / v3; } diff --git a/Stub/init.cpp b/Stub/init.cpp index 2830570cd..ba21a3ed0 100644 --- a/Stub/init.cpp +++ b/Stub/init.cpp @@ -56,7 +56,6 @@ static std::string find_file_in_std_directories(const char *file) void __fastcall init_create_window(int nCmdShow) { DUMMY(); - init_get_file_info(); @@ -94,7 +93,6 @@ void __cdecl init_archives() SFileOpenArchive(find_file_in_std_directories("prealpha.mpq").c_str(), 1000, 0, &prealpha_mpq); assert(prealpha_mpq); - } void __cdecl init_get_file_info() @@ -103,14 +101,7 @@ void __cdecl init_get_file_info() strcpy(gszProductName, "devil-test"); } -void GetAvailableHeroes(){ - - - - - - -} +void GetAvailableHeroes() {} void LoadCharNamesintoMemory(int start, int end) { @@ -136,7 +127,7 @@ void LoadCharNamesintoMemory(int start, int end) start++; } - //memcpy(shero_names, hero_names, sizeof(hero_names)); + // memcpy(shero_names, hero_names, sizeof(hero_names)); } void HideCursor() @@ -153,54 +144,49 @@ void HideCursor() void SDL_Diablo_UI() // I anticipate to move this later. { - //WNDPROC saveProc; - + // WNDPROC saveProc; + snd_init(0); music_start(5); - - signed int NewHeroNameIndex = 0; int menu = 0; SDL_Event event; int x, y; bool quit = false; int CharsLoaded = 0; - - + printf("Main Menu Init\n"); - //SDL_ShowCursor(SDL_DISABLE);//Doesn't really work... Use HideCursor() instead. + // SDL_ShowCursor(SDL_DISABLE);//Doesn't really work... Use HideCursor() instead. SdlDiabloMainWindow(); - ClearScreenBuffer(); + ClearScreenBuffer(); LoadPalette("Levels\\L3Data\\L3pwater.pal"); - //LoadPalette("Gendata\\Cutstart.pal"); // Doesn't exist.?? - - + // LoadPalette("Gendata\\Cutstart.pal"); // Doesn't exist.?? const Uint8 *state = SDL_GetKeyboardState(NULL); - while (1 && quit == false) { - //DrawMouse(); Doesn't work yet ; Too slow. - PaletteFadeIn(8); + // static std::deque message_queue; + while (1 && quit == false) { + DrawMouse(); + PaletteFadeIn(8); if (menu == 0) { - CreateMainDiabloMenu(); + // CreateMainDiabloMenu(); SDL_RenderDiabloMainPage(); - sdl_present_surface(); - + DrawMouse(); + // sdl_present_surface(); } if (menu == 2) { - + if (CharsLoaded == 0) { LoadCharNamesintoMemory(0, 2); CharsLoaded = 1; } SDL_RenderDiabloSinglePlayerPage(); gbMaxPlayers = 1; - } if (menu == 3) { @@ -213,292 +199,300 @@ void SDL_Diablo_UI() // I anticipate to move this later. /*put stuff*/ } } + if (menu == 10) { + ShowCredts(); + } if (SDL_PollEvent(&event)) { - + // DrawMouse(); //Doesn't work yet ; Too slow. - if (event.type == SDL_QUIT) { + switch (event.type) { + case SDL_KEYDOWN: + printf("Key press detected\n"); + switch( event.key.keysym.sym ){ + case SDLK_ESCAPE: + menu = 0; + break; - quit = true; - SDL_Quit(); - exit(0); // SDL quit doesn't always work. - } + } + break; - if (event.type == SDL_MOUSEMOTION) { - // Get the mouse offsets - x = event.motion.x; - y = event.motion.y; - MouseX = x; - MouseY = y; - - //SDL_GetMouseState(&MouseX, &MouseY); - - + case SDL_KEYUP: + printf("Key release detected\n"); + break; + default: + break; } + - // if (event.type == SDL_KEYDOWN && menu == 4 ){ - // char * keyz = SDL_GetKeyName(event.key.keysym.sym); - // printf("SDLKEY PRESSED %s", keyz); - - // } - - // If a key was pressed - if (event.type == SDL_MOUSEBUTTONDOWN /*&& event.button.clicks == 2*/) { - - if (event.button.button == SDL_BUTTON_LEFT) { - x = event.button.x; - y = event.button.y; - printf("X %d , Y %d\n", x, y); - - if (menu == 0) { - - int ClickListStart = 195; - int sizeOfBox = 60; - int WidthOfBox = 400; - int ClickListEnd = 343; - - - - if ((x > ClickListStart) && (y > ClickListStart) && - (x < ClickListStart + WidthOfBox) && (y < ClickListStart + sizeOfBox)) { // Single clicked - printf("SinglePlayer Diablo\n"); - // effects_play_sound("Sfx\\Items\\Titlslct.wav"); - menu = 2; - } - - if ((x > ClickListStart) && (y > ClickListStart + (sizeOfBox)) && - (x < ClickListStart + WidthOfBox) && - (y < ClickListStart + (sizeOfBox) + sizeOfBox)) { // MultiBox clicked - printf("MultiPlayer Diablo\n"); - - } - if ((x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 2)) && - (x < ClickListStart + WidthOfBox) && - (y < ClickListStart + (sizeOfBox * 2) + sizeOfBox)) { // Reply Intro clicked - printf("Replay Intro\n"); - - } - if ((x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 4)) && - (x < ClickListStart + WidthOfBox) && - (y < ClickListStart + (sizeOfBox * 4) + sizeOfBox)) { // ShowCredits clicked - printf("Show Credits\n"); - // effects_play_sound("Sfx\\Items\\Titlslct.wav"); - //UiCreditsDialog(16); - } - - if ((x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 5)) && - (x < ClickListStart + WidthOfBox) && - (y < ClickListStart + (sizeOfBox * 5) + sizeOfBox)) { // ExitBox clicked - printf("Exiting Diablo\n"); - // effects_play_sound("Sfx\\Items\\Titlslct.wav"); - - quit = true; - SDL_Quit(); - exit(0); - // goto LABEL_16; - } - - } // End of this Menu0 - - if (menu == 2) { - // int x = 440; - // int y = 430; - int ClickListStart = 315; - int sizeOfBox = 30; - int WidthOfBox = 400; - int ClickListEnd = 343; + if (event.type == SDL_QUIT) { + quit = true; + SDL_Quit(); + exit(0); // SDL quit doesn't always work. + } + + if (event.type == SDL_MOUSEMOTION) { + // Get the mouse offsets + x = event.motion.x; + y = event.motion.y; + MouseX = x; + MouseY = y; + + // SDL_GetMouseState(&MouseX, &MouseY); + } + // if (event.type == SDL_KEYDOWN && menu == 4 ){ + // char * keyz = SDL_GetKeyName(event.key.keysym.sym); + // printf("SDLKEY PRESSED %s", keyz); - // Render Clicks - if (TotalPlayers >= 1 && (x > ClickListStart) && (y > ClickListStart) && - (x < ClickListStart + WidthOfBox) && (y < ClickListStart + sizeOfBox)) { // MultiBox clicked -// printf("Player %s\n", hero_names[0]); - //effects_play_sound("Sfx\\Items\\Titlslct.wav"); - strcpy(chr_name_str, hero_names[0]); - printf("Player %s\n", chr_name_str); - //FreeMenuItems(); - break; - + // } + // If a key was pressed + if (event.type == SDL_MOUSEBUTTONDOWN /*&& event.button.clicks == 2*/) { + if (event.button.button == SDL_BUTTON_LEFT) { + x = event.button.x; + y = event.button.y; + printf("X %d , Y %d\n", x, y); - } + if (menu == 0) { + + int ClickListStart = 195; + int sizeOfBox = 60; + int WidthOfBox = 400; + int ClickListEnd = 343; + + if ((x > ClickListStart) && (y > ClickListStart) && (x < ClickListStart + WidthOfBox) && + (y < ClickListStart + sizeOfBox)) { // Single clicked + printf("SinglePlayer Diablo\n"); + // effects_play_sound("Sfx\\Items\\Titlslct.wav"); + menu = 2; + } - if (TotalPlayers >= 2 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox)) && - (x < ClickListStart + WidthOfBox) && - (y < ClickListStart + (sizeOfBox) + sizeOfBox)) { // MultiBox clicked - printf("Player 2 Diablo\n"); + if ((x > ClickListStart) && (y > ClickListStart + (sizeOfBox)) && + (x < ClickListStart + WidthOfBox) && + (y < ClickListStart + (sizeOfBox) + sizeOfBox)) { // MultiBox clicked + printf("MultiPlayer Diablo\n"); + } + if ((x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 2)) && + (x < ClickListStart + WidthOfBox) && + (y < ClickListStart + (sizeOfBox * 2) + sizeOfBox)) { // Reply Intro clicked + printf("Replay Intro\n"); + } + if ((x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 4)) && + (x < ClickListStart + WidthOfBox) && + (y < ClickListStart + (sizeOfBox * 4) + sizeOfBox)) { // ShowCredits clicked + printf("Show Credits\n"); + menu = 10; + // effects_play_sound("Sfx\\Items\\Titlslct.wav"); + // UiCreditsDialog(16); + } + + if ((x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 5)) && + (x < ClickListStart + WidthOfBox) && + (y < ClickListStart + (sizeOfBox * 5) + sizeOfBox)) { // ExitBox clicked + printf("Exiting Diablo\n"); + // effects_play_sound("Sfx\\Items\\Titlslct.wav"); + + quit = true; + SDL_Quit(); + exit(0); + // goto LABEL_16; + } + + } // End of this Menu0 + + if (menu == 2) { + // int x = 440; + // int y = 430; + int ClickListStart = 315; + int sizeOfBox = 30; + int WidthOfBox = 400; + int ClickListEnd = 343; + + // Render Clicks + if (TotalPlayers >= 1 && (x > ClickListStart) && (y > ClickListStart) && + (x < ClickListStart + WidthOfBox) && (y < ClickListStart + sizeOfBox)) { // MultiBox clicked + // printf("Player %s\n", hero_names[0]); + // effects_play_sound("Sfx\\Items\\Titlslct.wav"); + strcpy(chr_name_str, hero_names[0]); + printf("Player %s\n", chr_name_str); + // FreeMenuItems(); + break; + } + + if (TotalPlayers >= 2 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox)) && + (x < ClickListStart + WidthOfBox) && + (y < ClickListStart + (sizeOfBox) + sizeOfBox)) { // MultiBox clicked + printf("Player 2 Diablo\n"); // effects_play_sound("Sfx\\Items\\Titlslct.wav"); - strcpy(chr_name_str, hero_names[1]); - printf("Player %s\n", chr_name_str); - //FreeMenuItems(); - // XStartGame(); - break; - } - if (TotalPlayers >= 3 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 2)) && - (x < ClickListStart + WidthOfBox) && - (y < ClickListStart + (sizeOfBox * 2) + sizeOfBox)) { // MultiBox clicked - printf("Player 3 Diablo\n"); - effects_play_sound("Sfx\\Items\\Titlslct.wav"); - strcpy(chr_name_str, hero_names[2]); - printf("Player %s\n", chr_name_str); - //FreeMenuItems(); - break; - // XStartGame(); - } - if (TotalPlayers >= 4 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 3)) && - (x < ClickListStart + WidthOfBox) && - (y < ClickListStart + (sizeOfBox * 3) + sizeOfBox)) { // MultiBox clicked - printf("Player 4 Diablo\n"); - effects_play_sound("Sfx\\Items\\Titlslct.wav"); - strcpy(chr_name_str, hero_names[3]); - printf("Player %s\n", chr_name_str); + strcpy(chr_name_str, hero_names[1]); + printf("Player %s\n", chr_name_str); + // FreeMenuItems(); + // XStartGame(); + break; + } + if (TotalPlayers >= 3 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 2)) && + (x < ClickListStart + WidthOfBox) && + (y < ClickListStart + (sizeOfBox * 2) + sizeOfBox)) { // MultiBox clicked + printf("Player 3 Diablo\n"); + effects_play_sound("Sfx\\Items\\Titlslct.wav"); + strcpy(chr_name_str, hero_names[2]); + printf("Player %s\n", chr_name_str); + // FreeMenuItems(); + break; + // XStartGame(); + } + if (TotalPlayers >= 4 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 3)) && + (x < ClickListStart + WidthOfBox) && + (y < ClickListStart + (sizeOfBox * 3) + sizeOfBox)) { // MultiBox clicked + printf("Player 4 Diablo\n"); + effects_play_sound("Sfx\\Items\\Titlslct.wav"); + strcpy(chr_name_str, hero_names[3]); + printf("Player %s\n", chr_name_str); // FreeMenuItems(); - break; - // XStartGame(); - } - if (TotalPlayers >= 5 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 4)) && - (x < ClickListStart + WidthOfBox) && - (y < ClickListStart + (sizeOfBox * 4) + sizeOfBox)) { // MultiBox clicked - printf("Player 5 Diablo\n"); - effects_play_sound("Sfx\\Items\\Titlslct.wav"); - strcpy(chr_name_str, hero_names[4]); - printf("Player %s\n", chr_name_str); + break; + // XStartGame(); + } + if (TotalPlayers >= 5 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 4)) && + (x < ClickListStart + WidthOfBox) && + (y < ClickListStart + (sizeOfBox * 4) + sizeOfBox)) { // MultiBox clicked + printf("Player 5 Diablo\n"); + effects_play_sound("Sfx\\Items\\Titlslct.wav"); + strcpy(chr_name_str, hero_names[4]); + printf("Player %s\n", chr_name_str); // FreeMenuItems(); - break; - // XStartGame(); - } - if (TotalPlayers >= 6 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 5)) && - (x < ClickListStart + WidthOfBox) && - (y < ClickListStart + (sizeOfBox * 5) + sizeOfBox)) { // MultiBox clicked - printf("Player 6 Diablo\n"); - effects_play_sound("Sfx\\Items\\Titlslct.wav"); - strcpy(chr_name_str, hero_names[5]); - printf("Player %s\n", chr_name_str); + break; + // XStartGame(); + } + if (TotalPlayers >= 6 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 5)) && + (x < ClickListStart + WidthOfBox) && + (y < ClickListStart + (sizeOfBox * 5) + sizeOfBox)) { // MultiBox clicked + printf("Player 6 Diablo\n"); + effects_play_sound("Sfx\\Items\\Titlslct.wav"); + strcpy(chr_name_str, hero_names[5]); + printf("Player %s\n", chr_name_str); // FreeMenuItems(); - break; - // XStartGame(); - } - - if ((x > SinglePlayerMenuCancelBox.x) && (y > SinglePlayerMenuCancelBox.y) && - (x < SinglePlayerMenuCancelBox.w) && (y < SinglePlayerMenuCancelBox.h)) { // ExitBox clicked - printf("CancelBox Diablo\n"); - effects_play_sound("Sfx\\Items\\Titlslct.wav"); - - menu = 0; - } - if ((x > CreateHeroBox.x) && (y > CreateHeroBox.y) && (x < CreateHeroBox.w) && - (y < CreateHeroBox.h)) { - printf("Clicked Create Hero Box\n"); - menu = 3; - } + break; + // XStartGame(); } - if (menu == 3) { - // SinglePlayerMenuItemsLoaded = 0; - printf("\n\nmenu3 X%d Y%d \n ", x, y); - - int WarriorSelectBoxY = 379; - int WarriorSelectBoxW = 100; - int WarriorSelectBoxS = 100; - - int RogueSelectBoxX = 360; - int RogueSelectBoxY = 345; - int SorcerorSelectBoxX = 383; - int SorcerorSelectBoxY = 365; - int CreateHeroOkBoxX = 330; - int CreateHeroOkBoxY = 441; - int CreateHeroCanBBoxX = 445; - int CreateHeroCanBBoxY = 473; - - SDL_Rect WarriorSelectBox; - WarriorSelectBox.y = 280; - WarriorSelectBox.x = 375; - WarriorSelectBox.w = WarriorSelectBox.x + 100; - WarriorSelectBox.h = WarriorSelectBox.y + 30; - - SDL_Rect RogueSelectBox; - RogueSelectBox.y = 320; - RogueSelectBox.x = 400; - RogueSelectBox.w = RogueSelectBox.x + 100; - RogueSelectBox.h = RogueSelectBox.y + 30; - - SDL_Rect SorcerorSelectBox; - SorcerorSelectBox.y = 360; - SorcerorSelectBox.x = 380; - SorcerorSelectBox.w = SorcerorSelectBox.x + 100; - SorcerorSelectBox.h = SorcerorSelectBox.y + 30; - - SDL_Rect CreateHeroCancelBox; - CreateHeroCancelBox.y = 450; - CreateHeroCancelBox.x = 450; - CreateHeroCancelBox.w = CreateHeroCancelBox.x + 100; - CreateHeroCancelBox.h = CreateHeroCancelBox.y + 30; - - if ((x > WarriorSelectBox.x) && (y > WarriorSelectBox.y) && (x < WarriorSelectBox.w) && - (y < WarriorSelectBox.h)) { - - printf("I was hit\n\n\n"); - WarriorCreateSelected = 1; - RogueCreateSelected = 0; - SorcerorCreateSelected = 0; - menu = 4; - } - if ((x > RogueSelectBox.x) && (y > RogueSelectBox.y) && (x < RogueSelectBox.w) && - (y < RogueSelectBox.h)) { - - printf("I was hit\n\n\n"); - WarriorCreateSelected = 0; - RogueCreateSelected = 1; - SorcerorCreateSelected = 0; - menu = 4; - } - if ((x > SorcerorSelectBox.x) && (y > SorcerorSelectBox.y) && (x < SorcerorSelectBox.w) && - (y < SorcerorSelectBox.h)) { - - printf("I was hit\n\n\n"); - WarriorCreateSelected = 0; - RogueCreateSelected = 0; - SorcerorCreateSelected = 1; - menu = 4; - } - - if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) && - (y < CreateHeroCancelBox.h)) { - - printf("Cancel\n\n\n"); - menu = 2; - } + + if ((x > SinglePlayerMenuCancelBox.x) && (y > SinglePlayerMenuCancelBox.y) && + (x < SinglePlayerMenuCancelBox.w) && (y < SinglePlayerMenuCancelBox.h)) { // ExitBox clicked + printf("CancelBox Diablo\n"); + effects_play_sound("Sfx\\Items\\Titlslct.wav"); + + menu = 0; } - if (menu == 4) { - printf("sozdat geroya"); - - // if (SDL_PollEvent(&event)) { - // if (event.type == SDL_KEYDOWN && menu == 4) { - // char *keyz = SDL_GetKeyName(event.key.keysym.sym); - // printf("SDLKEY PRESSED %s\n", keyz); - // } - // } - - SDL_Rect CreateHeroCancelBox; - CreateHeroCancelBox.y = 450; - CreateHeroCancelBox.x = 450; - CreateHeroCancelBox.w = CreateHeroCancelBox.x + 100; - CreateHeroCancelBox.h = CreateHeroCancelBox.y + 30; - - if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) && - (y < CreateHeroCancelBox.h)) { - - printf("Cancel\n\n\n"); - menu = 3; - } + if ((x > CreateHeroBox.x) && (y > CreateHeroBox.y) && (x < CreateHeroBox.w) && + (y < CreateHeroBox.h)) { + printf("Clicked Create Hero Box\n"); + menu = 3; + } + } + if (menu == 3) { + // SinglePlayerMenuItemsLoaded = 0; + printf("\n\nmenu3 X%d Y%d \n ", x, y); + + int WarriorSelectBoxY = 379; + int WarriorSelectBoxW = 100; + int WarriorSelectBoxS = 100; + + int RogueSelectBoxX = 360; + int RogueSelectBoxY = 345; + int SorcerorSelectBoxX = 383; + int SorcerorSelectBoxY = 365; + int CreateHeroOkBoxX = 330; + int CreateHeroOkBoxY = 441; + int CreateHeroCanBBoxX = 445; + int CreateHeroCanBBoxY = 473; + + SDL_Rect WarriorSelectBox; + WarriorSelectBox.y = 280; + WarriorSelectBox.x = 375; + WarriorSelectBox.w = WarriorSelectBox.x + 100; + WarriorSelectBox.h = WarriorSelectBox.y + 30; + + SDL_Rect RogueSelectBox; + RogueSelectBox.y = 320; + RogueSelectBox.x = 400; + RogueSelectBox.w = RogueSelectBox.x + 100; + RogueSelectBox.h = RogueSelectBox.y + 30; + + SDL_Rect SorcerorSelectBox; + SorcerorSelectBox.y = 360; + SorcerorSelectBox.x = 380; + SorcerorSelectBox.w = SorcerorSelectBox.x + 100; + SorcerorSelectBox.h = SorcerorSelectBox.y + 30; + + SDL_Rect CreateHeroCancelBox; + CreateHeroCancelBox.y = 450; + CreateHeroCancelBox.x = 450; + CreateHeroCancelBox.w = CreateHeroCancelBox.x + 100; + CreateHeroCancelBox.h = CreateHeroCancelBox.y + 30; + + if ((x > WarriorSelectBox.x) && (y > WarriorSelectBox.y) && (x < WarriorSelectBox.w) && + (y < WarriorSelectBox.h)) { + + printf("I was hit\n\n\n"); + WarriorCreateSelected = 1; + RogueCreateSelected = 0; + SorcerorCreateSelected = 0; + menu = 4; + } + if ((x > RogueSelectBox.x) && (y > RogueSelectBox.y) && (x < RogueSelectBox.w) && + (y < RogueSelectBox.h)) { + + printf("I was hit\n\n\n"); + WarriorCreateSelected = 0; + RogueCreateSelected = 1; + SorcerorCreateSelected = 0; + menu = 4; + } + if ((x > SorcerorSelectBox.x) && (y > SorcerorSelectBox.y) && (x < SorcerorSelectBox.w) && + (y < SorcerorSelectBox.h)) { + + printf("I was hit\n\n\n"); + WarriorCreateSelected = 0; + RogueCreateSelected = 0; + SorcerorCreateSelected = 1; + menu = 4; + } + + if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) && + (y < CreateHeroCancelBox.h)) { + + printf("Cancel\n\n\n"); + menu = 2; + } + } + if (menu == 4) { + printf("sozdat geroya"); + + // if (SDL_PollEvent(&event)) { + // if (event.type == SDL_KEYDOWN && menu == 4) { + // char *keyz = SDL_GetKeyName(event.key.keysym.sym); + // printf("SDLKEY PRESSED %s\n", keyz); + // } + // } + + SDL_Rect CreateHeroCancelBox; + CreateHeroCancelBox.y = 450; + CreateHeroCancelBox.x = 450; + CreateHeroCancelBox.w = CreateHeroCancelBox.x + 100; + CreateHeroCancelBox.h = CreateHeroCancelBox.y + 30; + + if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) && + (y < CreateHeroCancelBox.h)) { + + printf("Cancel\n\n\n"); + menu = 3; } } } - } - } - +} } diff --git a/Stub/miniwin.h b/Stub/miniwin.h index 9fdcbd3e7..f418a2d79 100644 --- a/Stub/miniwin.h +++ b/Stub/miniwin.h @@ -6,6 +6,7 @@ #define STATIC static #endif +#include #include #include #include @@ -558,6 +559,9 @@ void srand_miniwin(unsigned int seed); extern void LoadCharNames(); extern void LoadAndPlaySound(char *FilePath, int lVolume, int lPan); +extern void DrawArtWithMask(int SX, int SY, int SW, int SH, int nFrame, BYTE bMask, void *pBuffer); +extern BOOL __cdecl LoadArtWithPal(char *pszFile, void **pBuffer, int frames, DWORD *data); + #include "miniwin_ddraw.h" #include "miniwin_dsound.h" diff --git a/Stub/miniwin_sdl.h b/Stub/miniwin_sdl.h index 00be84026..5f43979b4 100644 --- a/Stub/miniwin_sdl.h +++ b/Stub/miniwin_sdl.h @@ -91,8 +91,21 @@ extern void * pPcxSHeroImage; extern void * pMedTextCels; extern void * pPcxGameImage; +extern void * pPcxCreditsImage; +extern int gdwCreditsWidth; +extern int gdwCreditsHeight; +extern int gdwFont2Width; +extern int gdwFont2Height; +extern void *pPcxFont2Image; +extern unsigned char *pFont2; + +extern int gdwFont3Width; +extern int gdwFont3Height; +extern void *pPcxFont3Image; +extern unsigned char *pFont3; + //Menu2 // Single player menu rects @@ -107,11 +120,15 @@ char *GetWorkingDirectory(); void CreateMainDiabloMenu(); void SDLCreateDiabloCursor(); void SDL_RenderDiabloSinglePlayerPage(); +void ShowCredts(); void RenderCharNames(); void SDL_Diablo_UI(); void FreeMenuItems(); void DrawMouse(); void DrawCursor(int mx, int my); + + + typedef unsigned char BYTE; void DrawArtWithMask(int SX, int SY, int SW, int SH, int nFrame, BYTE bMask, void *pBuffer); \ No newline at end of file diff --git a/Stub/sdlrender.cpp b/Stub/sdlrender.cpp index 4d463f87f..74ac5cdcb 100644 --- a/Stub/sdlrender.cpp +++ b/Stub/sdlrender.cpp @@ -61,7 +61,17 @@ SDL_Surface *CreateHeroDialogSurface; SDL_Surface *CursorImg; SDL_Surface *DiabloTitle; -FC_Font *font; +int bloaded = 0; +void *pPcxCreditsImage; +int gdwCreditsWidth; +int gdwCreditsHeight; + + + + + + + //////////////// //new vars @@ -73,8 +83,491 @@ int the_pcx_frame; - - +char *the_long_credits[] = +{ + "","","","","","","","","","","","", + "$-- Devilution --", + "Reversed by Andi \"GalaXyHaXz\"", + "", + "$-- Meet the Team --", + "seritools", + "mewmew", + "nomdenom", + "AJenbo", + "ApertureSecurity", + "", + "$-- Special Thanks --", + "The Sanctuary preservation project", + "Jarulf's guide to the Devil himself", + "", + "", + "$...The Devil is in the details", + "", + "", + "$Game Design", + "Blizzard North", + "", + "$Senior Designers", + "Erich Schaefer, David Brevik", + "", + "$Additional Design", + "Max Schaefer, Eric Sexton, Kenneth Williams", + "", + "$Lead Programmer", + "David Brevik", + "", + "$Senior Programmers", + "Richard Seis, Doron Gartner,", + "Patrick Wyatt, Mike O'Brien", + "", + "$Programming", + "Peter Brevik, Robin van der Wel, Jon Morin", + "", + "$Special Guest Programmers", + "Collin Murray, Frank Pearce", + "", + "$Battle.net Programming", + "Mike O'Brien, Mike Morhaime, Dan Liebgold", + "", + "$Serial Communications Programming", + "Jeff Strain, Mike O'Brien", + "", + "$Installer Programming", + "Bob Fitch, Patrick Wyatt", + "", + "$Art Directors", + "Erich Schaefer, Samwise Didier", + "", + "$Artwork", + "Michio Okamura, Eric Sexton, Ben Haas, Patrick Tougas,", + "Kelly Johnson, Erich Schaefer, Max Schaefer, Hugh Tom", + "Byrne, Roman Kenney, Samwise Didier, Dave Berggren,", + "Micky Neilson, Eric Flannum, Justin Thavirat, Brian", + "Sousa, Stu Rose, Nick Carpenter, Joeyray Hall", + "", + "$Technical Artwork", + "Christopher Root, Mark Sutherland,", + "Robert Djordjevich, Jeffrey Vaughn", + "", + "$Cinematic Art Directors", + "Duane Stinnett, Matt Samia", + "", + "$3D Cinematic Artwork", + "Duane Stinnett, Matt Samia, Rob McNaughton,", + "Eric Flannum, Dave Pursley, Micky Neilson,", + "Maxx Marshall, Trevor Jacobs, Brian Sousa,", + "Samwise Didier, Ron Smorynski, Ben Haas, Patrick Tougas", + "", + "$Cinematic Technical Artwork", + "Joeyray Hall ", + "", + "$Executive Producer", + "Allen Adham", + "", + "$Producer", + "Bill Roper", + "", + "$Associate Producer", + "James Phinney", + "", + "$Diablo Strike Team", + "Allen Adham, Ron Millar, Mike O'Brien,", + "James Phinney, Bill Roper, Patrick Wyatt", + "", + "$Music", + "Matt Uelmen", + "", + "$Sound Design", + "Matt Uelmen, Glenn Stafford", + "", + "$Cinematic Music & Sound", + "Glenn Stafford, Matt Uelmen", + "", + "$Voice Production, Direction & Casting", + "Mark Schwarz, Glenn Stafford, Bill Roper", + "", + "$Script & Story", + "Erich Schaefer, Eric Sexton,", + "Chris Metzen, Bill Roper", + "", + "$Voice Editing", + "Glenn Stafford", + "", + "$Voices", + "Michael Haley, Glynnis Talken, Michael Gough,", + "Paul Eiding, Lani Minella, Steve Brodie, Bill Roper,", + "Mark Schwarz, Glenn Stafford, Chris Metzen, Max Schaefer", + "", + "$Recording Engineer", + "Robert Koenigsberg", + "", + "$Manual Design & Layout", + "Peter Underwood, Jeffrey Vaughn,", + "Chris Metzen, Bill Roper", + "", + "$Manual Artwork", + "Samwise Didier, Chris Metzen,", + "Roman Kenney, Maxx Marshall", + "", + "$Provisional Director of QA (Lead Tester)", + "Shane Dabiri", + "", + "$QA Assault Team (Testers)", + "Christopher Cross, Mike Givens, Dave Hale,", + "Brian \"Doc\" Love, Hung Nguyen, Dean Shipley,", + "Chris Sigaty, Ian Welke, Jamie Wiggs", + "", + "$QA Special Ops Team (Compatibility Testers)", + "Adam Maxwell, Russell \"Rug\" Miller", + "", + "$QA Artillery Support (Additional Testers) ", + "Rich Alcazar, Mike Jones, Rev. Dan Moore, Matt Morris,", + "Mark Pfeiffer, Harish \"Pepe the Enforcer\" Rao, Chris Millar", + "", + "$QA Counterintelligence", + "Alan Dabiri, Jesse McReynolds, Walter Takata", + "", + "$Order of Network Information Services", + "Robert Bridenbecker, Jason \"Brother Shaggy\" Schmit,", + "Jamie \"Brother Gug\" Steigerwald, Richard Seis ", + "", + "$Customer Support", + "John Schwartz, Vic Larson, Chad Chaudry, Mick Yanko,", + "Brandon Riseling, Kirk Mahony, Tony Hardy, Richard", + "Amtower, Collin Smith, Andrew Edwards, Roger Eberhart", + "", + "$Sales", + "Jorge Rivero, Rob Beatie", + "", + "$Dunsel", + "Alan Dabiri", + "", + "$Mr. Dabiri's Background Vocalists", + "Karin Colenzo, Christina Cade,", + "Kim Farrington, Melissa Edwards", + "", + "$Public Relations", + "Linda Duttenhaver, Susan Wooley", + "", + "$Marketing", + "John Patrick, Steve Huot, Neal Hubbard, Kathy Carter", + "", + "$International Sales", + "Ralph Becker, Chris Yoshimura", + "", + "$U.S. Sales", + "Todd Coyle, Danny Kearns", + "", + "$Manufacturing", + "John Goodman, Tom Bryan", + "", + "$Legal & Business", + "Paula Duffy, Eric Roeder, Paul Sams, Kenneth Williams", + "", + "$Special Thanks To", + "Primenet, Earthlink, AOL, Compuserve, ATI, Matrox, STB, ", + "Creative Labs, Logitech, U.S. Robotics, Gravis, Cyrix", + "", + "$Thanks To", + "Ian Colquhoun, Rod Shean, Brian Fitzgerald, Sharon Schafer, Todd ", + "Schafer, Richard and Sandra Schaefer, Rick Bowles, Greg Bogden, ", + "Cindy Sievert, Brad Mason, Chuck Goldman, Karin Colenzo, Wendy ", + "Brevik, Jennie Brevik, Hanna Carroll, Katie Newell, Karen Weiss, ", + "Kurt Beaver, Stan McDonald, Brian Sexton, Michael Wan, Megan ", + "Williams, Jessica Gensley, Beth Ann Parks, Brian Piltin, Johnathan ", + "Root, Brett Supernaw, Sabeer Bhatia, Mark Rearick, Brad Mason, ", + "Diane Kodama, Bernadette Sexton, Barbara Uhlmann, Patricia", + "McDonald, Kris Kelley, Alissa Vaage, Denise Hernandez, Paula ", + "White, Rachel Marie Hawley, Laura Gaber, Isaac Matarasso,", + "Susan Stafford, Gretchen Witte, Jason Sailor, Eufemia Palomino, ", + "Nathalie Didier, Nicole Welke, Dawn Caddel, Anna-Marcelle ", + "Okamura, Amber Okamura, Megan Okamura Tracey McNaughton, ", + "Trisha Ann Ochoa, Annie Strain, Dr. Gregory T. Street, Ray the Soda ", + "Guy, Sam Raimi, A. Guinness Brewing Co., John Woo, Chow Yun Fat, ", + "Jackie Chan,Proposition 215, Rumiko Takahashi, Bunchy & Mason, ", + "The Friends of Stan, The Zoo Crew, Team Hamro, Brazil 2001, RUSH, ", + "Cornholio, THE BROS., Dar, Emeril Lagasse, Tom Waits, Ice-Cube, ", + "The Strike Team Deflectors, Tony Levin, Big Jim and the Twins, ", + "Jag`rmeister, The Megasphere, Condor, The Allower, The Sunday ", + "Night Group, Gravitar, Steinway Pianos, Round Table Pizza, The Poxy ", + "Boggards, Urban Mystic & Co., Caffeine, Hunter Rose, Marly ", + "mediums in the box, sweet Poteen, Dave Scarpitti, TheByter, Bim ", + "Man, Krissann for color, Patty at Avalon Tattoo, James, Whaleboy, ", + "Dunsel Training Institute, monkeys, Dob Bole, Rootes Group, Porshe, ", + "Bongo, Scarlett, Apollo, The House of Mediocrity, Amelias, The King, ", + "Saag and all the folks at Davidson", + "", + "$In memory of", + "Lawrence and Barbara Williams", + "David A. Hargrave", + "Tony \"Xatre\" Collin", + "Thomas H Sexton", + "", + "$Very Special Thanks to", + "Bob and Jan Davidson", + "Walter Forbes", + "", + "$The Ring of One Thousand", + "Andrew Abernathy, Christopher Abramo, David Adams, David ", + "Adcox, Marko Agterberg, Cory Aiken, Judah Altaras, John ", + "Alvarez, Jose Alvarez, Richard Amable, Alexander Amaral, ", + "Scott Amis, Vincent Amoroso, Mark An, David Andersen, Jason ", + "Andrew Abernathy, Christopher Abramo, David Adams, David ", + "Adcox, Marko Agterberg, Cory Aiken, Judah Altaras, John ", + "Alvarez, Jose Alvarez, Richard Amable, Alexander Amaral, ", + "Scott Amis, Vincent Amoroso, Mark An, David Andersen, Jason ", + "Andersen, Aaron Anderson, George Anderson, Matthew ", + "Anderson, Michael Anderson, Sean Anderson, Robert Andrade, ", + "Cerny Andre, Michael Andreev, Devin Angle, Brian Apple, ", + "Brian Arbuthnot, Billy Arden, Dorian Arnold, Andre Arsenault, ", + "Erik Asplund, Mark Assam, John Athey, Jason Attard, Jeff ", + "Atwood, Ricky Au, Scott Avery, Rand Babcock, Steve Babel, ", + "Raymond Bacalso, Ed Bachta, Steven Back, Scott Baeder, Alex ", + "Baevski, Scott Bailey, Kenneth Baird, Thomas Baker, Todd ", + "Bala, Jan Ball, Greg Baltz, Blake Baltzley, Doug Bambrick, Wes ", + "Bangerter, Paul Barfuss, Chris Barghout, Dave Barnebey, Jon ", + "Barnhart, Terje Barth, Nicole Baskin, Bernard Baylen, Ryan ", + "Bear, Phil Bedard, Todd Belcher, Chip Bell, Erez Ben-Aharon, ", + "Jonathan Bender, Nick Bennett, Ireney Berezniak, Ted Berg, ", + "Gunnar Bergem, Russell Beuker, Ed Bickford, Stephen Biles, ", + "John Billdt, Gerald Binder, John Bird, Hannah Blackerby, Tom ", + "Blackerby, Clayton Blackwell, Thomas Blake, Shawn Blaszak, ", + "Daniel Bliss, Fred Bliss, Jeff Bliss, Jon Blum, Rune Boersjoe, ", + "Andrew Boggs, Dave Boisvenu, Joe Bolt, John Bonds, Jeff ", + "Borenstein, Dorian Borin, Ed Boris, Bartholomew Botta, ", + "Michael Boutin, Michael Boyd, Charles Boyer, Mike ", + "Boyersmith, Michael Boyko, Eric Bradberry, John Brandstetter, ", + "Ryan Breding, Paul Brinkmann, Patrick Briscoe, Scott Brisko, ", + "Jeremy Britton, Adrian Broadhead, Glenn Brouwer, Joe Brown, ", + "Sebastien Brulotte, Darrell Brunsch, William Bryan, Jason ", + "Bucher, Chris Buchinger, Clayton Buckingham, John Buckles, ", + "David Bugay, Ed Bujone, Erik Burgess, Gabriel Burkett, Chris ", + "Burnes, Richard Butler, Jeffrey Bye, Dougall Campbell, Donnie ", + "Cannon, Shane Cantrell, Connor Caple, Daniel Carey, James ", + "Carlton, Michael Carmel, Mike Carpenter, Ronald Carruthers, ", + "Phil Carter, Bryce Cartmill, Eric Cartwright, Anthony Caruso, ", + "Lon Casey, Tim Caster, Aaron Chan, Otto Chan, Gene Chang, ", + "Hsiao-Lung Chang, William Chang, George Chappel, Larry ", + "Charbonneau, Troy Chase, Bruce Chen, Chun Hsien Chen, Sam ", + "Chen, Tzu-Mainn Chen, Mike Cheng, Chris Chiapusio, Damien ", + "Chiesa, Nick Chin, Nim Ching, Jonathan Chinn, Michael Chinn, ", + "Philander Chiu, Thayne Christiansen, Philip Chui, Steve ", + "Cintamani, Richard Ciordia, Colin Clark, Steve Clark, Samuel ", + "Clements, Meredith Clifton, Jeff Cohen, Dale Colton, Dax ", + "Combe, Matt Compton, Jacob Conklin, Richard Conn, Zac ", + "Cook, Tim Coolong, Gregory Coomer, Dennis Cosgrove, Kelly ", + "Couch, Andrew Coulter, Eric Coutinho, David Coutts, James ", + "Craig, John Craig, Kazial Craig, John Crawford, Marcelo ", + "Crespo, Orville Crews, Tim Cristy, Elmer Crosby III, Russell ", + "Cullison, Ryan Cupples, Andrew Dagley, Steve Dallaire, Richard ", + "Dalton, David Dandar, Pro Daulo, Rob Dautermann, Mike ", + "Davies, Kalieb Davis, Marshall Davis, Ronald Davis, Danny De ", + "Bie, Marc De Filippis, Myles Deighton, Kent Dejarnett, Anthony ", + "Delarosa, Neil Dempster, Peter Denitto, Joaquim Dentz, Scott ", + "Dewar, Anish Dhingra, Philip Dhingra, David Diaz, Stewart ", + "Dicks, Brad Dietz, Josh Dietz, Colleen Diggins, Mike Ditchburn, ", + "Eric Dittman, Allen Do, Huy Doan, Matthew Dolman, Antoine ", + "Dongois, Eamonn Donohoe, Bill Dorell, Mark Dorison, Dan ", + "Dorsett, Chris Dorsey, Jim Dose, Willis Doss, Chin Du, William ", + "Dubis, Timothy Duewell, Brandon Dunn, Andrew Durham, Don ", + "Duvall, Kevin Dvojack, Daniel Eaton, Paul Eberting, Eric ", + "Echelbarger, Lance Eddleman, Ben Eggers, David Eggum, John ", + "Ehde, Brian Eikenberry, Patrick Elven, Peter Engdahl, Philip ", + "Engdahl, Michael Ennis, Darren Eslinger, Eric Ezell, Darren ", + "Falslev, Stephen Feather, Tony Fenn, Ben Ferguson, Mike ", + "Fernandez, Gwendal Feuillet, Guy Fietz, Julian Figueroa, Dale ", + "Fillpot, Stan Finchem, Michael Finley, Nick Fisher, William ", + "Fisher, Mark Fitlin, Dave Flatt, Joel J. Flores, John Folkers, ", + "Steven Forgie, Tom Forsythe, Matthew Foster, Scott Francis, ", + "Jim Frank, Paulo Fraser, Glenn French, Kurt Frerichs, Chris ", + "Frey, Mark Friedman, Charles Friedmann, Dan Friend, Kirk ", + "Fry, Aaron Fu, Erik Gaalema, Brandon Gabbard, Phil Gagner, ", + "Tommy Gannon, David Gappmayer, Chris Garrison, Tony ", + "Garrison, David Gasca, Jeremy Gasser, Michael Geist, Michael ", + "Genereux, Daniel Genovese, Josh Gerwin, Paul Gibson, William ", + "Gilchrist, Gabriel Gils Carbo, Chad Glendenin, Ryan Glinski, ", + "Dean Gobrecht, Andrew Goldfinch, David Goodman, Mark ", + "Goodson, Matt Gordon, Frank Gorgenyi, Sean Gould, Perry ", + "Goutsos, Ed Govednik, Michael Grayson, Chris Green, Justin ", + "Grenier, Jeff Greulich, Don Grey, Rob Griesbeck, Don Griffes, ", + "Kimberly Griffeth, Jay Grizzard, Don Gronlund, Joe Gross, ", + "Troy Growden, Greg Guilford, David Gusovsky, Jeremy ", + "Guthrie, Adam Gutierrez, James Guzicki, Matthew Haas, Matt ", + "Hadley, Ryan Hagelstrom, Bobby Hagen, Ben Hall, Brian Hall, ", + "Kris Hall, Calvin Hamilton, Kris Hamilton, Bo Hammil, Dave ", + "Hans, Rick Hansen, Robert Harlan, Travis Harlan, Seth ", + "Harman, Jeff Harris, Shawn Hartford, Adam Hartsell, Neil ", + "Harvey, Ray Hayes, John Hein, Chris Heinonen, Christer ", + "Helsing, Chris Hempel, Dustin Hempel, Mathieu Henaire, Matt ", + "Henry, Chuck Herb, Michael Herron, Sage Herron, Thomas ", + "Herschbach, Cliff Hicks, Nelson Hicks, Paul Hierling, William ", + "Hiers, Mike Higdon, Tim Hildebrand, Casey Hinkle, Ryan ", + "Hitchings, Wes Hix, Alan Ho, Jenson Ho, Alan Hoffman, Jeff ", + "Hoffman, Eleanor Hoffmann, Steve Hogg, Richard Holler, Brian ", + "Homolya, Wade Hone, Joe Horvath, Jeff Howe, Eric Hudson, ", + "Glen Huey, Chris Hufnagel, Joshua Hughes, Melissa Hughes, ", + "Arief Hujaya, Thomas Hulen, Ryan Hupp, Justin Hurst, Rick ", + "Hutchins, Steve Iams, Mike Iarossi, Bjorn Idren, Johan Idren, ", + "Micah Imparato, Joe Ingersoll, David Ingram, Greg Ipp, Rodney ", + "Irvin, Darin Isola, Justin Itoh, Mario Ivan, Fredrik Ivarsson, ", + "Dax Jacobson, Michael Jacques, Stevens Jacques, Duane Jahnke, ", + "William Jambrosek, Daniel Janick, Narciso Jaramillo, Neil ", + "Jariwala, Harvie Jarriell, Scott Javadi, Joe Jenkins, Bart ", + "Jennings, Paul Jennings, Julien Jenny, Jason Jensen, Martin ", + "Jeremy, Mark Jeschke, Andy Johnson, James Johnson, Leigh ", + "Johnson, Mark Johnson, Rupert Johnson, Clyde Jones, Michael ", + "Jones, Tim Jordan, Ben Judy, Michael Kaae, Steve Kaczkowski, ", + "Neville Kadwa, Brian Kaisner, Yoshihisa Kameyama, Michael ", + "Kanemura, Daniel Kao, Eric Karabin, Ben Katz, Christopher ", + "Kawamura, Erick Kayser, Craig Keddie, Kevin Kelley, Bryan ", + "Kemp, Michael Kendrigan, Dan Kerber, Timothy Kerber, Tomi ", + "Keski-Heikkila, Greg Kettering, Nathan Kilber, Howard Kim, ", + "Orrin Kinion, Jon Kirst, David Kitch, John Klingbeil, Neil ", + "Klopfenstein, Kerry Knouse, David Knox, Said Kobeissi, Jeff ", + "Koches, Hades Kong, Jeff Kong, Kevin Konkle, Steve Koon, ", + "David Koontz, Dan Koopmann, Steve Koskela, Kuan Kou, ", + "Cameron Kracke, Jensen Krage, York Kramer, Cedar Kraus, ", + "Jason Kraus, Bobby Krimen, Melissa Krispli, Steven Krispli, ", + "James Kruger, Charles Kubasta, Kimmo Kulonen, Frank ", + "Lackaff, Michael Lacour, Matt Lake, Jason Landry, Hans Erik ", + "Lange, Michael Laramee, Brad Lascelle, Pat Laschinger, Alan ", + "Lau, Sean Laurence, Anthony Lavey, Jr., Gary Le, Huey Le, ", + "Stephane Le Roy Audy, Lim Leandro, Charles Lee, Conroy Lee, ", + "Mike Lee, Shih-Hang Lee, Jonathan Leipert, Jason Lemann, ", + "Ron Lenzi, Mitchell Leon, Stephanie Lesniewski, Brendan ", + "Lewis, Robert Lewis, Sam Liao, Tom Liem, Adam Ligas, Steven ", + "Liggett, Roger Lilley, Benjamin Lim, Jeff Lindholm, Johnson ", + "Linwood, David Litchman, Bruce Lithimane, William Liu, ", + "Wilson Liu, Robert Lobdell, Chris Logan, Razvan Loghin, Jack ", + "Loh, George Loo, Russell Love, Juan Loyola, Ricardo Lozano, ", + "Mike Luban, Tim Luc, Henry Luciano, Dianne Ludwig, Charles ", + "Lueras, Derek Lung, Phong Ly, Scott MacGillivray, Dave Mack, ", + "Alec Mak, Steve Mamayek, Michael Mancini, Daniel Mann, ", + "Michael Mann, Chris Manofsky, Abdullah Marafie, Nicholas ", + "Marcy, Piompino Mariano, Bob Marius, Trey Marshall, Dane ", + "Martin, Gregg Martin, Renard Martin, Rich Martin, Scott ", + "Martin, Thomas Martin, Jon Masters, Christopher Mathews, ", + "Jay Mathis, Marc Matthews, Chris Mazur, Doug McBride, ", + "Mackey McCandlish, Robin McCollum, Steven McCombie, ", + "Andy McConnell, Michael McCourt, Bill McCoy, Doug ", + "McCracken, Michael McDeed, Robert McDonald, Steve ", + "McEachron, Craig McGee, Ryan McKenzie, Michael McKeown, ", + "Daniel McMahon, Colin McMillan, Ian McWilliam, Mark ", + "McWilliams, Khann Mean, Bryan Meason, Kenneth Medley, ", + "Jeff Meek, John Mehr, Christopher Mende, Brian Mendenhall, ", + "Peter Mengel, Michael Mersic, Mike Messom, Don Metcalf, ", + "Gary Metzker, Scott Meyer, Joseph Michaud, Andrew Mielke, ", + "Travis Mikalson, Troy Milburn, Ike Miller, Ronnie Miller, Sean ", + "Miller, Steve Miller, Arthur Min, David Minniti, Brenda ", + "Mirsberger, Bill Misek, David Mitchell, Joseph Mobley, Robert ", + "Mollard, Will Mooar, Curtis Moore, Matthew Moore, Al ", + "Morales, Ryan Moran, Lance Mortensen, Karel Mrazek, Ward ", + "Mullee, William Munoz, Kirk Munro, Craig Murray, Shawn P. ", + "Murray, Travis Murray, Michael Mushrush, Tom Mustaine, ", + "David Myers, Joseph Myett, Morgan Najar, Kenta Nakamura, ", + "Damian Nastri, Joshua Naumann, Nick Navarro, Douglas ", + "Neitzel, Arnold Ng, Anthony Nguyen, Steve Nguyen, Joseph ", + "Nicholas, Charles Nickolaus, Jon Nisbet, Patrick Nomee, David ", + "Norling-Christensen, Bobby Norton, Joseph Nottingham, Frank ", + "O'Connor, Jon Oden, David Oester, Lavern Ogden, Zach ", + "Oglesby, Lucas Oldfield, Toby Olsson, Aaron Ondek, Sean ", + "O'Neill, John Orlando, Samuel Orlando, Donovan Orloski, ", + "David Pai, Nikolas Paldan, David Palek, John Palmieri, Anthony ", + "Palmisano, Sanjay Pandit, Jesse Park, Alex Parker, Jimmy ", + "Pasher, Lukasz Paszek, Andy Patterson, William Pelletier, ", + "Duane Pemberton, Ivan Pemic, Kelly Pendergast, Mike ", + "Penezich, Jon Penk, Willie Penley, Ron Penna, Matthew ", + "Pennington, Kevin Pereira, Ross Perez, Ken Perkins, Brian ", + "Peterik, Kelly Peterson, Chris Phillips, Rod Pickett, Cameron ", + "Pierce, Reuben Pierce, Tim Pilger, Billy Pippin, Brad Plank, ", + "Brian Plant, Craig Platt, David Plunkett, Michael Politi, Albert ", + "Portillo, Brian Powell, David Powell, Franklin Powers Jr., Alan ", + "Precourt, Michael Pronchick, Julian Quintana, Justin Radziej, ", + "Steven Rajewski, Shawn Rawles, Ian Reardon, Marc Reed, Ric ", + "Reichelt, Judd Reiffin, David Reilly, Garry Reisky, Drew ", + "Ressler, Robert Reynolds, Walter Reynolds, Michael Rice, Ian ", + "Richards, James Richards, Raymond Richmond, Dustin Riggs, ", + "Keith Riskey, Brian Ro, Scott Roberts, Jorge Rodriguez, Chad ", + "Rogers, Clint Rogers, Robert Rogers, Steve Rogers, Ethan Roots, ", + "Ron Roque, William Ross, Sebastian Rossi, Jeff Rostis, Ben ", + "Roth, Demar Roth, Rich Rouse, Oleg Rovner, Jonathan Roy, ", + "Drew Rozema, Mike Ruggles, Mathias Russ, James Russell, Jim ", + "Rutledge, James Rutter, Dave Ryder, Chris Salvadras, Anders ", + "Samnerud, Nick Sanders, Jakob Sandgren, Joe Sapinsky, Tyler ", + "Sargent, Jonas Saunders, Mark Savage, Scott Sawyer, Robert ", + "Scanlon, Trevor Schaben, Aaron Schmidt, Chris Schmidt, Greg ", + "Schultz, Nicholas Schumacher, Scott Schumacher, Kevin Scott, ", + "Rastislav Seffer, Robert Seidler, Corey Sellers, Justin Sellers, ", + "Marc Senecal, George Shannon, Ian Sheffield, Anoop Shekar, ", + "Sandeep Shekar, Kevin Shelton, Leon Shephard, Eric Shepperd, ", + "Jeffrey Shneidman, Samuel Shockey, Mark Shoemaker, Mike ", + "Shupe, Sean Sibbet, Brian Sidharta, Jimmy Sieben, Eric ", + "Siemens, William Silva, Jody Simpson, Jatinder Singh, Sonia ", + "Siu, Omar Skarsvaag, Tom Skiba, Carl Skow, David Skuse, ", + "Robert Slifka, Brent Smith, C. Eric Smith, Jared Smith, Jeffrey ", + "Smith, Owen Smith, Shannon Smith, Steven Smith, Edward Smola, ", + "Matthew Sneep, Eric Snow, Brad Sobel, Jean-Pierre Solignac, Rasmus ", + "Sorensen, Andrew Sorg, Poppy Southcott, Ross Specter, Erik Spencer, ", + "Keith Spencer, Chris Springer, Erikson Squier, Dean St. Onge, Stewart ", + "Stanfield, John Stanley, Terrence Staton, Benjamin Stein, James ", + "Steiner, David Steyer, William Stickney, Chris Stiff, James Stofer, ", + "Norm Storch, Patrick Stovall, Brandon Sturgeon, Sean Stutler, Anne ", + "Sukprasert, Jamal Sullivan, Bruce Sully, Jay Sung, Park Sung ", + "Joon, Stein Sunnarvik, Nathan Surginer, Robert Swaringen, Lee ", + "Sweeney, David Szabo, Scott Taft, Christian Takvam, Patrick ", + "Talaska, Tadashi Tamaki, Simon Tan, Mark Taraba, Khon-", + "Whey Tay, John Taylor, Keith Taylor, Donald Temean, Phillip ", + "Tesar, Pete Thao, Brian Thomas, Keith Thomas, Speed Thomas, ", + "Miles Thorpe, Paul Thurrott, Mike Timbol, Nicholas Timmins, ", + "Tom Tobin, Robert Towster, Hien Tran, Timothy Traviss, Toby ", + "Traylor, Tony Treadwell, George Tremoulis, Paul Trinh, Thanh ", + "Trinh, Chris Tristan, Brad Truswell, Jason Tryon, Mike Tu, ", + "Gernel Tuazon, Eric Tuggle, Mike Turnbull, Lyle Ubben, ", + "Amilcar Ubiera, Robert Ulozas, Arie Upton, Mark Van Noy, ", + "Matthew Van Sickler, Jake Vantlin, Tony Vasquez, Brady ", + "Vauclin, Gianpiero Vecchi, Chad Verrall, Chris Vicente, Brett ", + "Vickers, David Vickery, Jonathan Vilante, Simon Vince, Ben ", + "Vinson, David Voelkert, Paul Vogt, Nicholas Voorhies, Robert ", + "Vreeland, Mike Vrooman, Rick Vuong, Brian Wachhaus, Todd ", + "Wachhaus, Caine Wade, Mathew Wadstein, Kenneth Wagenius, ", + "Trevor Wagner, John Wagstaff, Asad Wahid, Richard ", + "Wahlberg, Helio Wakasugui, Richard Walker, Wilkins Walker, ", + "Matthew Wallace, Daniel Walsh, Joel Walters, Andrew Waltz, ", + "Tom Wang, Tony Wang, Jay Ward, Jonathan Ward, John ", + "Warner, Mark Warren, Matt Washer, Mike Watson, Sean ", + "Wattles, Mike Wayne, Christian Wehba, Benjamin Wei, Richard ", + "Weight, Cary Wells, David Wenck, Bill Werring, Leonard ", + "Wesley, Marlon West, Mikael Westerbacka, Brian Wharry, ", + "Chris White, Chris White, Jeremy White, Greg Whitlock, Gary ", + "Widener, Marty Wilfried, Israel Wilkinson, Michael Willams, ", + "Derek Williams, Sean Willson, Nitzan Wilnai, Jim Wilson, ", + "Karsten Wilson, William Wilt, Tim Winn, Brian Winzeler, Matt ", + "Wise, Lee Wissmiller, Brendan Wolfe, Daniel Wolpert, Felix ", + "Wong, Power Wong, Tony Wong, Tim Wood, Timothy Wood, ", + "Jeremy Woods, Michael Woods, Bill Wright, Keith Wright, ", + "Patrick Wu, Gang Xie, Robert Yao, Sun Lim Yap, Stephen Yau, ", + "Erek Yedwabnick, Christopher Yee, Nick Yee, Juan Yip, David ", + "Young, Rob Young, Seth Young, Alex Yu, Terry Zahn, Jia-Ning ", + "Zhang, Eric Zieg, Jordan Zielin, Clint Zimmerman, Matt Zinke ", + "", + "", + "", + "", + "$No souls were sold in the making of this game.", + "", + "", + " ", + " ", + " ", + NULL +}; + + + +int creditline = 0; +int ybase = 0; +int linecount = 24; +int nottheend = 1; ///////////////////////////////////////// @@ -235,6 +728,8 @@ void CreateMainDiabloMenu() + + void DrawArtWithMask(int SX, int SY, int SW, int SH, int nFrame, BYTE bMask, void *pBuffer) { BYTE *src = (BYTE *)pBuffer+(SW * SH * nFrame); @@ -251,6 +746,116 @@ void DrawArtWithMask(int SX, int SY, int SW, int SH, int nFrame, BYTE bMask, voi } +void DrawPCXString(int x, int y, int w, int h, char *str, BYTE *font, void *pBuff) +{ + int i; + int len = 0; + for(i = 0; i < strlen(str); i++) + { + DrawArtWithMask(x+len, y, w, h, str[i], 32, pBuff); + //DrawPCX(x+len, y, str[i], 32); + if(font[str[i]+2]) + len += font[str[i]+2]; + else + len += *font; + } +} + + + + +int __fastcall GetPCXFontWidth(char *str, BYTE *font) +{ + int len; // eax + unsigned __int8 i; // bl + BYTE chr; // bl + int width; // esi + + len = 0; + for ( i = *str; *str; i = *str ) + { + chr = font[i + 2]; + if ( chr ) + width = chr; + else + width = *font; + len += width; + ++str; + } + return len; +} + + + + + + + +void ShowCredts() +{ + ybase += 1; + if(ybase >= pFont2[1]) + { + ybase = 0; + if(!nottheend) + { + linecount--; + creditline++; + } + else if(the_long_credits[creditline+24] == NULL) + { + nottheend = 0; + //linecount--; + } + else + creditline++; + } + + + + DrawArtImage(0, 0, gdwCreditsWidth, gdwCreditsHeight, 0, pPcxCreditsImage); + + + + for(int i = 0; i < linecount; i++) { + + + + // Needs to be slower... + if(*the_long_credits[creditline+i] == '$') + + + DrawPCXString( 320-(GetPCXFontWidth(the_long_credits[creditline+i]+1, pFont2)/2), + 50+(i*pFont2[1])-ybase, + gdwFont2Width, + gdwFont2Height, + the_long_credits[creditline+i]+1, + pFont2, + pPcxFont2Image); + else + DrawPCXString( 320-(GetPCXFontWidth(the_long_credits[creditline+i], pFont3)/2), + 50+(i*pFont3[1])-ybase, + gdwFont3Width, + gdwFont3Height, + the_long_credits[creditline+i], + pFont3, + pPcxFont3Image); + } + +} + + + + + + + + + + + +///////////////////////////Renders + void RenderDiabloLogo() { int diablogo_cel_frame = 1; @@ -298,20 +903,20 @@ void DrawMouse() { int lines = gdwCursorHeight; - // if(MouseY > 480-gdwCursorHeight) - // lines -= (MouseY - (480-gdwCursorHeight)); - // int mx = MouseX; - // if(mx < 0) mx = 0; - // if(mx >639) mx = 639; - // int my = MouseY; - // if(my < 0) my = 0; - // if(my > 480) my = 480; + if(MouseY > 480-gdwCursorHeight) + lines -= (MouseY - (480-gdwCursorHeight)); + int mx = MouseX; + if(mx < 0) mx = 0; + if(mx >639) mx = 639; + int my = MouseY; + if(my < 0) my = 0; + if(my > 480) my = 480; - lock_buf_priv(); +// lock_buf_priv(); DrawArtWithMask(MouseX, MouseY, gdwCursorWidth, lines, 0, 0, pPcxCursorImage); - unlock_buf_priv(); +// unlock_buf_priv(); } diff --git a/Stub/test_menu.cpp b/Stub/test_menu.cpp index fb25f9ef6..b250735d7 100644 --- a/Stub/test_menu.cpp +++ b/Stub/test_menu.cpp @@ -1225,7 +1225,7 @@ int ybase = 0; int linecount = 24; int nottheend = 1; -void pain_credts() +void ShowCredts() { ClearScreenBuffer(); @@ -1441,9 +1441,9 @@ void DrawMouse() if(my < 0) my = 0; if(my > 480) my = 480; - lock_buf_priv(); +// lock_buf_priv(); DrawArtWithMask(mx, my, gdwCursorWidth, lines, 0, 0, pPcxCursorImage); - unlock_buf_priv(); + //unlock_buf_priv(); } int gbStopGame = 0; void __fastcall interface_pump_title_message(HWND hWnd)