diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index c93773dad..afe9dc719 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -2,6 +2,7 @@ #include "../types.h" #include "miniwin_sdl.h" +#include "sdlrender.h" #ifndef NO_GLOBALS bool byte_634464; // weak @@ -495,7 +496,7 @@ void __fastcall gmenu_draw_menu_item(TMenuItem *pItem, int a2) MyPcxFRAME = 0; } - DrawArtWithMask(320 - (gdwLogoWidth / 2), -50, gdwLogoWidth, gdwLogoHeight, MyPcxFRAME, 250, pPcxLogoImage); + DrawArtWithMask(GetCenterOffset(gdwLogoWidth), -50, gdwLogoWidth, gdwLogoHeight, MyPcxFRAME, 250, pPcxLogoImage); v2 = a2; v3 = pItem; diff --git a/Stub/diabloui.cpp b/Stub/diabloui.cpp index b6d1a0981..9958352ba 100644 --- a/Stub/diabloui.cpp +++ b/Stub/diabloui.cpp @@ -1,6 +1,7 @@ #include #include "../types.h" +#include "sdlrender.h" #include "stubs.h" int menu = 0; int SelectedItem = 0; @@ -62,11 +63,23 @@ void SetMenu(int MenuId) void ExitDiablo() { - printf("Exiting Diablo\n"); + effects_play_sound("sfx\\items\\titlslct.wav"); + Sleep(250); // Wait for soudn to play + SDL_Quit(); exit(0); } +BOOL IsInside(int x, int y, int ItemLeft, int ItemTop, int ItemWidth, int ItemHeight) +{ + return x > ItemLeft && x < ItemLeft + ItemWidth && y > ItemTop && y < ItemTop + ItemHeight; +} + +BOOL IsInsideRect(int x, int y, SDL_Rect rect) +{ + return IsInside(x, y, rect.x, rect.y, rect.w, rect.h); +} + void UiInitialize() // I anticipate to move this later. { SDL_SetRelativeMouseMode(SDL_TRUE); @@ -103,9 +116,7 @@ void UiInitialize() // I anticipate to move this later. if (menu == 0) { SDL_RenderDiabloMainPage(); - } - - if (menu == 2) { + } else if (menu == 2) { if (CharsLoaded == 0) { LoadCharNamesintoMemory(0, 7); // LoadHeroStats(); @@ -115,9 +126,7 @@ void UiInitialize() // I anticipate to move this later. gbMaxPlayers = 1; DrawMouse(); ConstantButtons(); - } - - if (menu == 3) { + } else if (menu == 3) { CreateHeroMenu(); DrawNewHeroKartinka(HeroPortrait, 1); ConstantButtons(); @@ -165,14 +174,14 @@ void UiInitialize() // I anticipate to move this later. case SDLK_BACKSPACE: if (NewHeroNameIndex > 0) { HeroUndecidedName[NewHeroNameIndex - 1] = 0; - --NewHeroNameIndex; + NewHeroNameIndex--; } break; case SDLK_UP: SelectedItem--; if (SelectedItem < 0) { - SelectedItem = 0; + SelectedItem = SelectedItemMax; } effects_play_sound("sfx\\items\\titlemov.wav"); break; @@ -180,12 +189,31 @@ void UiInitialize() // I anticipate to move this later. case SDLK_DOWN: SelectedItem++; if (SelectedItem > SelectedItemMax) { - SelectedItem = SelectedItemMax; + SelectedItem = 0; } effects_play_sound("sfx\\items\\titlemov.wav"); break; case SDLK_RETURN: + switch (SelectedItem) { + case 0: + SetMenu(2); + break; + case 1: + printf("Multi Player\n"); + break; + case 2: + printf("Replay Intro\n"); + break; + case 3: + SetMenu(10); + break; + case 4: + quit = true; + ExitDiablo(); + break; + } + break; default: char letter = event.key.keysym.sym; @@ -225,109 +253,106 @@ void UiInitialize() // I anticipate to move this later. y = event.button.y; printf("X %d , Y %d\n", x, y); - if (menu == 0) { + int ItemLeft; + int ItemTop; + int ItemHeight; + int ItemWidth; - int ClickListStart = 230; - int sizeOfBox = 72; - int WidthOfBox = 430; - int ClickListEnd = 343; + int CreateHeroOkBoxX = 330; + int CreateHeroOkBoxY = 441; + int CreateHeroCanBBoxX = 445; + int CreateHeroCanBBoxY = 473; - if ((x > ClickListStart) && (y > ClickListStart) && (x < ClickListStart + WidthOfBox) && (y < ClickListStart + sizeOfBox)) { // Single clicked - printf("SinglePlayer Diablo\n"); - SetMenu(2); - } + SDL_Rect SorcerorSelectBox; + SorcerorSelectBox.y = 428; + SorcerorSelectBox.x = 280; + SorcerorSelectBox.w = SorcerorSelectBox.x + 100; + SorcerorSelectBox.h = SorcerorSelectBox.y + 30; - 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("Credits\n"); + SDL_Rect CreateHeroCancelBox; + CreateHeroCancelBox.y = 550; + CreateHeroCancelBox.x = 675; + CreateHeroCancelBox.w = CreateHeroCancelBox.x + 100; + CreateHeroCancelBox.h = CreateHeroCancelBox.y + 30; + + clock_t start, end; + double cpu_time_used; + + switch (menu) { + case 0: + ItemTop = 191; + ItemHeight = 42; + ItemWidth = 515; + ItemLeft = GetCenterOffset(ItemWidth); + if (IsInside(x, y, ItemLeft, ItemTop, ItemWidth, ItemHeight)) { + SetMenu(2); + } else if (IsInside(x, y, ItemLeft, ItemTop + ItemHeight + 1, ItemWidth, ItemHeight)) { + printf("Multi Player\n"); + } else if (IsInside(x, y, ItemLeft, ItemTop + ItemHeight * 2 + 1, ItemWidth, ItemHeight)) { + printf("Replay Intro\n"); + } else if (IsInside(x, y, ItemLeft, ItemTop + ItemHeight * 3 + 2, ItemWidth, ItemHeight)) { SetMenu(10); - } - if ((x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 4)) && (x < ClickListStart + WidthOfBox) && (y < ClickListStart + (sizeOfBox * 4) + sizeOfBox)) { // ShowCredits clicked + } else if (IsInside(x, y, ItemLeft, ItemTop + ItemHeight * 4 + 3, ItemWidth, ItemHeight)) { quit = true; ExitDiablo(); } - - } // End of this Menu0 - - if (menu == 2) { // Yes, I know. Skipped 1 and I going to hell for it. - // int x = 440; - // int y = 430; - int ClickListStart = 315; - int sizeOfBox = 30; - int WidthOfBox = 400; - int ClickListEnd = 343; + break; + case 2: + ItemLeft = 440; + ItemTop = 315; + ItemHeight = 30; + ItemWidth = 400; int CreateHeroY = 555; int CreateHeroX = 305; - SDL_Rect CreateHeroCancelBox; - CreateHeroCancelBox.y = 550; - CreateHeroCancelBox.x = 675; - CreateHeroCancelBox.w = CreateHeroCancelBox.x + 100; - CreateHeroCancelBox.h = CreateHeroCancelBox.y + 30; - // Render Clicks - if (TotalPlayers >= 1 && (x > ClickListStart) && (y > ClickListStart) && (x < ClickListStart + WidthOfBox) && (y < ClickListStart + sizeOfBox)) { // MultiBox clicked + if (TotalPlayers >= 1 && IsInside(x, y, ItemLeft, ItemTop, ItemWidth, ItemHeight)) { strcpy(chr_name_str, hero_names[0]); printf("Player %s\n", chr_name_str); SetMenu(5); // break; - } - - if (TotalPlayers >= 2 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox)) && (x < ClickListStart + WidthOfBox) && (y < ClickListStart + (sizeOfBox) + sizeOfBox)) { // MultiBox clicked + } else if (TotalPlayers >= 2 && IsInside(x, y, ItemLeft, ItemTop + ItemHeight, ItemWidth, ItemHeight)) { printf("Player 2 Diablo\n"); strcpy(chr_name_str, hero_names[1]); printf("Player %s\n", chr_name_str); SetMenu(5); // break; - } - - if (TotalPlayers >= 3 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 2)) && (x < ClickListStart + WidthOfBox) && (y < ClickListStart + (sizeOfBox * 2) + sizeOfBox)) { // MultiBox clicked + } else if (TotalPlayers >= 3 && IsInside(x, y, ItemLeft, ItemTop + ItemHeight * 2, ItemWidth, ItemHeight)) { printf("Player 3 Diablo\n"); strcpy(chr_name_str, hero_names[2]); printf("Player %s\n", chr_name_str); SetMenu(5); // break; - } - - if (TotalPlayers >= 4 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 3)) && (x < ClickListStart + WidthOfBox) && (y < ClickListStart + (sizeOfBox * 3) + sizeOfBox)) { // MultiBox clicked + } else if (TotalPlayers >= 4 && IsInside(x, y, ItemLeft, ItemTop + ItemHeight * 3, ItemWidth, ItemHeight)) { printf("Player 4 Diablo\n"); strcpy(chr_name_str, hero_names[3]); printf("Player %s\n", chr_name_str); SetMenu(5); // break; - } - - if (TotalPlayers >= 5 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 4)) && (x < ClickListStart + WidthOfBox) && (y < ClickListStart + (sizeOfBox * 4) + sizeOfBox)) { // MultiBox clicked + } else if (TotalPlayers >= 5 && IsInside(x, y, ItemLeft, ItemTop + ItemHeight * 4, ItemWidth, ItemHeight)) { printf("Player 5 Diablo\n"); strcpy(chr_name_str, hero_names[4]); printf("Player %s\n", chr_name_str); SetMenu(5); // break; - } - - if (TotalPlayers >= 6 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox * 5)) && (x < ClickListStart + WidthOfBox) && (y < ClickListStart + (sizeOfBox * 5) + sizeOfBox)) { // MultiBox clicked + } else if (TotalPlayers >= 6 && IsInside(x, y, ItemLeft, ItemTop + ItemHeight * 5, ItemWidth, ItemHeight)) { printf("Player 6 Diablo\n"); strcpy(chr_name_str, hero_names[5]); printf("Player %s\n", chr_name_str); SetMenu(5); // break; - } - - if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) && (y < CreateHeroCancelBox.h)) { + } else if (TotalPlayers >= 6 && IsInsideRect(x, y, CreateHeroCancelBox)) { HeroPortrait = 3; printf("Cancel\n\n\n"); SetMenu(0); - } - if ((x > CreateHeroX) && (y > CreateHeroY) && (x < CreateHeroX + WidthOfBox) && (y < CreateHeroY + sizeOfBox)) { + } else if (TotalPlayers >= 6 && IsInside(x, y, CreateHeroX + ItemWidth, CreateHeroY, ItemWidth, ItemHeight)) { printf("Clicked Create Hero Box\n"); SetMenu(3); } - } - if (menu == 3) { + break; + case 3: // SinglePlayerMenuItemsLoaded = 0; printf("\n\nmenu3 X%d Y%d \n ", x, y); @@ -339,10 +364,6 @@ void UiInitialize() // I anticipate to move this later. int RogueSelectBoxY = 392; int SorcerorSelectBoxX = 383; int SorcerorSelectBoxY = 365; - int CreateHeroOkBoxX = 330; - int CreateHeroOkBoxY = 441; - int CreateHeroCanBBoxX = 445; - int CreateHeroCanBBoxY = 473; // int x = 280; // int y = 430; @@ -359,55 +380,32 @@ void UiInitialize() // I anticipate to move this later. RogueSelectBox.w = RogueSelectBox.x + 100; RogueSelectBox.h = RogueSelectBox.y + 30; // X450 Y 392 ; - - SDL_Rect SorcerorSelectBox; - SorcerorSelectBox.y = 428; - SorcerorSelectBox.x = 280; - SorcerorSelectBox.w = SorcerorSelectBox.x + 100; - SorcerorSelectBox.h = SorcerorSelectBox.y + 30; // X 447 Y 428 - SDL_Rect CreateHeroCancelBox; - CreateHeroCancelBox.y = 550; - CreateHeroCancelBox.x = 675; - CreateHeroCancelBox.w = CreateHeroCancelBox.x + 100; - CreateHeroCancelBox.h = CreateHeroCancelBox.y + 30; - - if ((x > WarriorSelectBox.x) && (y > WarriorSelectBox.y) && (x < WarriorSelectBox.w) && (y < WarriorSelectBox.h)) { - + if (IsInsideRect(x, y, WarriorSelectBox)) { printf(" warrior I was hit\n\n\n"); HeroPortrait = 0; HeroChosen = 0; SetMenu(4); - } - if ((x > RogueSelectBox.x) && (y > RogueSelectBox.y) && (x < RogueSelectBox.w) && (y < RogueSelectBox.h)) { - + } else if (IsInsideRect(x, y, RogueSelectBox)) { printf(" rogue I was hit\n\n\n"); HeroPortrait = 1; HeroChosen = 1; SetMenu(4); - } - if ((x > SorcerorSelectBox.x) && (y > SorcerorSelectBox.y) && (x < SorcerorSelectBox.w) && (y < SorcerorSelectBox.h)) { + } else if (IsInsideRect(x, y, SorcerorSelectBox)) { HeroPortrait = 2; printf("sorceror I was hit\n\n\n"); HeroChosen = 2; SetMenu(4); - } - - if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) && (y < CreateHeroCancelBox.h)) { + } else if (IsInsideRect(x, y, CreateHeroCancelBox)) { HeroPortrait = 3; printf("Cancel\n\n\n"); - --menu; + SetMenu(3); } - } - if (menu == 4) { - printf("sozdat geroya"); - SDL_Rect CreateHeroCancelBox; - CreateHeroCancelBox.y = 550; - CreateHeroCancelBox.x = 675; - CreateHeroCancelBox.w = CreateHeroCancelBox.x + 100; - CreateHeroCancelBox.h = CreateHeroCancelBox.y + 30; + break; + case 4: + printf("Create hero"); // X 549 , Y 551 SDL_Rect ClickOkBox; @@ -416,7 +414,7 @@ void UiInitialize() // I anticipate to move this later. ClickOkBox.w = ClickOkBox.x + 30; ClickOkBox.h = ClickOkBox.y + 30; - if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) && (y < CreateHeroCancelBox.h)) { + if (IsInsideRect(x, y, CreateHeroCancelBox)) { memset(HeroUndecidedName, 0, 17); NewHeroNameIndex = 0; @@ -424,22 +422,15 @@ void UiInitialize() // I anticipate to move this later. printf("Cancel\n\n\n"); HeroPortrait = 3; SetMenu(3); - } - - if ((x > ClickOkBox.x) && (y > ClickOkBox.y) && (x < ClickOkBox.w) && (y < ClickOkBox.h)) { - + } else if (IsInsideRect(x, y, ClickOkBox)) { printf("Ok\n"); CreateSinglePlayerChar = 1; const char *test_name = HeroUndecidedName; printf("%s\n", test_name); break; } - } - - clock_t start, end; - double cpu_time_used; - - if (menu == 5) { + break; + case 5: if (timestart == 0) { start = clock(); timestart = 1; @@ -451,11 +442,6 @@ void UiInitialize() // I anticipate to move this later. printf("TIEM DELAY %f\n", cpu_time_used); - int CreateHeroOkBoxX = 330; - int CreateHeroOkBoxY = 441; - int CreateHeroCanBBoxX = 445; - int CreateHeroCanBBoxY = 473; - SDL_Rect NewGameBox; NewGameBox.y = 350; NewGameBox.x = 280; @@ -468,35 +454,19 @@ void UiInitialize() // I anticipate to move this later. LoadGameBox.w = LoadGameBox.x + 300; LoadGameBox.h = LoadGameBox.y + 30; // X450 Y 392 ; - - SDL_Rect SorcerorSelectBox; - SorcerorSelectBox.y = 428; - SorcerorSelectBox.x = 280; - SorcerorSelectBox.w = SorcerorSelectBox.x + 100; - SorcerorSelectBox.h = SorcerorSelectBox.y + 30; // X 447 Y 428 - SDL_Rect CreateHeroCancelBox; - CreateHeroCancelBox.y = 550; - CreateHeroCancelBox.x = 675; - CreateHeroCancelBox.w = CreateHeroCancelBox.x + 100; - CreateHeroCancelBox.h = CreateHeroCancelBox.y + 30; - - if (cpu_time_used > 0.5 && (x > NewGameBox.x) && (y > NewGameBox.y) && (x < NewGameBox.w) && (y < NewGameBox.h)) { - + if (cpu_time_used > 0.5 && IsInsideRect(x, y, NewGameBox)) { printf(" New Game I was hit\n\n\n"); SetMenu(6); cpu_time_used = 0; timestart = 0; start = 0; - } - if (cpu_time_used > 0.5 && (x > LoadGameBox.x) && (y > LoadGameBox.y) && (x < LoadGameBox.w) && (y < LoadGameBox.h)) { + } else if (cpu_time_used > 0.5 && IsInsideRect(x, y, LoadGameBox)) { printf(" Load Game I was hit\n\n\n"); break; - } - - if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) && (y < CreateHeroCancelBox.h)) { + } else if (IsInsideRect(x, y, CreateHeroCancelBox)) { HeroPortrait = 3; timestart = 0; cpu_time_used = 0; @@ -508,9 +478,8 @@ void UiInitialize() // I anticipate to move this later. SetMenu(2); // Return back to select hero menu. } - } - - if (menu == 6) { + break; + case 6: // Choose difficulty if (timestart == 0) { @@ -521,11 +490,6 @@ void UiInitialize() // I anticipate to move this later. end = clock(); cpu_time_used = ((double)(end - start)) / CLOCKS_PER_SEC; - int CreateHeroOkBoxX = 330; - int CreateHeroOkBoxY = 441; - int CreateHeroCanBBoxX = 445; - int CreateHeroCanBBoxY = 473; - // int x = 280; // int y = 430; @@ -549,29 +513,19 @@ void UiInitialize() // I anticipate to move this later. HellSelectBox.h = HellSelectBox.y + 30; // X 447 Y 428 - SDL_Rect CreateHeroCancelBox; - CreateHeroCancelBox.y = 550; - CreateHeroCancelBox.x = 675; - CreateHeroCancelBox.w = CreateHeroCancelBox.x + 100; - CreateHeroCancelBox.h = CreateHeroCancelBox.y + 30; - - if (cpu_time_used > 0.5 && (x > NormalSelectBox.x) && (y > NormalSelectBox.y) && (x < NormalSelectBox.w) && (y < NormalSelectBox.h)) { + if (cpu_time_used > 0.5 && IsInsideRect(x, y, NormalSelectBox)) { StartNewGame = 1; gnDifficulty = DIFF_NORMAL; break; - } - if (cpu_time_used > 0.5 && (x > NightmareSelectBox.x) && (y > NightmareSelectBox.y) && (x < NightmareSelectBox.w) && (y < NightmareSelectBox.h)) { + } else if (cpu_time_used > 0.5 && IsInsideRect(x, y, NightmareSelectBox)) { StartNewGame = 1; gnDifficulty = DIFF_NIGHTMARE; break; - } - if (cpu_time_used > 1 && (x > HellSelectBox.x) && (y > HellSelectBox.y) && (x < HellSelectBox.w) && (y < HellSelectBox.h)) { + } else if (cpu_time_used > 1 && IsInsideRect(x, y, HellSelectBox)) { gnDifficulty = DIFF_HELL; StartNewGame = 1; break; - } - - if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) && (y < CreateHeroCancelBox.h)) { + } else if (IsInsideRect(x, y, CreateHeroCancelBox)) { HeroPortrait = 3; timestart = 0; cpu_time_used = 0; @@ -580,8 +534,9 @@ void UiInitialize() // I anticipate to move this later. cpu_time_used = 0; printf("Cancel\n\n\n"); - --menu; + SetMenu(5); } + break; } } } @@ -598,9 +553,9 @@ static BOOL __stdcall ui_add_hero_info(_uiheroinfo *info) } BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), - BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), - BOOL(__stdcall *fnstats)(int, _uidefaultstats *), int *dlgresult, char *name, - int *difficulty) + BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), + BOOL(__stdcall *fnstats)(int, _uidefaultstats *), int *dlgresult, char *name, + int *difficulty) { DUMMY(); @@ -613,7 +568,7 @@ BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf strcpy(name, test_name); - _uiheroinfo hero_info = {1}; + _uiheroinfo hero_info = { 1 }; strcpy(hero_info.name, test_name); hero_info.heroclass = HeroChosen; @@ -624,18 +579,16 @@ BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf // if (!hero_infos.empty()) { else { - // Yes, I undestand that this means new players can start a hell game. - // I like this. - - *difficulty = gnDifficulty ; + // Yes, I undestand that this means new players can start a hell game. + // I like this. + *difficulty = gnDifficulty; if (StartNewGame) { const char *hero_name = chr_name_str; DUMMY_PRINT("New Game use hero: %s\n", hero_name); strcpy(name, hero_name); - printf("Difficulty : %d \n",* difficulty); - + printf("Difficulty : %d \n", *difficulty); } else { const char *hero_name = chr_name_str; @@ -643,8 +596,7 @@ BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf strcpy(name, hero_name); *dlgresult = 2; // This means load game - printf("Difficulty : %d \n",* difficulty); - + printf("Difficulty : %d \n", *difficulty); } } @@ -691,9 +643,9 @@ int __stdcall UiProgressDialog(HWND window, char *msg, int a3, void *fnfunc, int } BOOL __stdcall UiSelHeroMultDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninfofunc)(_uiheroinfo *)), - BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), - BOOL(__stdcall *fnstats)(int, _uidefaultstats *), int *dlgresult, int *a6, - char *name) + BOOL(__stdcall *fncreate)(_uiheroinfo *), BOOL(__stdcall *fnremove)(_uiheroinfo *), + BOOL(__stdcall *fnstats)(int, _uidefaultstats *), int *dlgresult, int *a6, + char *name) { UNIMPLEMENTED(); } @@ -739,7 +691,7 @@ void __stdcall UiMessageBoxCallback(HWND hWnd, char *lpText, LPCSTR lpCaption, U } BOOL __stdcall UiDrawDescCallback(int arg0, COLORREF color, LPCSTR lpString, char *a4, int a5, UINT align, time_t a7, - HDC *a8) + HDC *a8) { UNIMPLEMENTED(); } @@ -750,19 +702,19 @@ BOOL __stdcall UiCreateGameCallback(int a1, int a2, int a3, int a4, int a5, int } BOOL __stdcall UiArtCallback(int game_type, unsigned int art_code, PALETTEENTRY *pPalette, void *pBuffer, - DWORD dwBuffersize, DWORD *pdwWidth, DWORD *pdwHeight, DWORD *pdwBpp) + DWORD dwBuffersize, DWORD *pdwWidth, DWORD *pdwHeight, DWORD *pdwBpp) { UNIMPLEMENTED(); } int __stdcall UiSelectGame(int a1, _SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, - _SNETVERSIONDATA *file_info, int *a6) + _SNETVERSIONDATA *file_info, int *a6) { UNIMPLEMENTED(); } int __stdcall UiSelectProvider(int a1, _SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, - _SNETVERSIONDATA *file_info, int *type) + _SNETVERSIONDATA *file_info, int *type) { UNIMPLEMENTED(); } diff --git a/Stub/sdlrender.cpp b/Stub/sdlrender.cpp index 51c05cdd6..f669268b4 100644 --- a/Stub/sdlrender.cpp +++ b/Stub/sdlrender.cpp @@ -707,7 +707,7 @@ void DrawArtWithMask(int SX, int SY, int SW, int SH, int nFrame, BYTE bMask, voi } } -int GetCenter(int w) +int GetCenterOffset(int w) { return SCREEN_WIDTH / 2 - w / 2; } @@ -778,11 +778,11 @@ void ShowCredts() for (int i = 0; i < linecount; i++) { // Needs to be slower... if (*the_long_credits[creditline + i] == '$') { - DrawPCXString(GetCenter(GetPCXFontWidth(the_long_credits[creditline + i] + 1, pFont16)), + DrawPCXString(GetCenterOffset(GetPCXFontWidth(the_long_credits[creditline + i] + 1, pFont16)), 50 + (i * pFont16[1]) - ybase, gdwFont2Width, gdwFont2Height, the_long_credits[creditline + i] + 1, pFont16, pPcxFont2Image); } else { - DrawPCXString(GetCenter(GetPCXFontWidth(the_long_credits[creditline + i], pFont16)), + DrawPCXString(GetCenterOffset(GetPCXFontWidth(the_long_credits[creditline + i], pFont16)), 50 + (i * pFont16[1]) - ybase, gdwFont3Width, gdwFont3Height, the_long_credits[creditline + i], pFont16, pPcxFont2Image); } @@ -800,7 +800,7 @@ void RenderDiabloLogo() MyPcxFRAME = 0; } - DrawArtWithMask(GetCenter(gdwLogoWidth), 0, gdwLogoWidth, gdwLogoHeight, MyPcxFRAME, 250, pPcxLogoImage); + DrawArtWithMask(GetCenterOffset(gdwLogoWidth), 0, gdwLogoWidth, gdwLogoHeight, MyPcxFRAME, 250, pPcxLogoImage); } void DrawCursor(int mx, int my) @@ -854,7 +854,7 @@ void SDL_RenderDiabloMainPage() int menuTop = 192; - int PentPositionX = GetCenter(42); + int PentPositionX = GetCenterOffset(42); int PentPositionY = menuTop + SelectedItem * 43; if (SelectedItem > 1) { PentPositionY -= 1; // "Multi Player" and "Replay Intro" has a smaller gap then other items @@ -869,7 +869,7 @@ void SDL_RenderDiabloMainPage() RenderDiabloLogo(); for (int i = 0; i < 5; i++) { - int x = GetCenter(GetPCXFontWidth(MENIITEMS[i], pFont)) - 1; + int x = GetCenterOffset(GetPCXFontWidth(MENIITEMS[i], pFont)) - 1; int y = menuTop + i * 43; if (i == 1) { y -= 1; // "Multi Player" and "Replay Intro" has a smaller gap then other items diff --git a/Stub/sdlrender.h b/Stub/sdlrender.h index fc183bf91..603cca07d 100644 --- a/Stub/sdlrender.h +++ b/Stub/sdlrender.h @@ -1,5 +1,6 @@ #pragma once +int GetCenterOffset(int w); /* extern int totalFrames; @@ -36,4 +37,4 @@ void SDLCreateDiabloCursor(); void SDL_RenderDiabloSinglePlayerPage(); void RenderCharNames(); -*/ \ No newline at end of file +*/