Browse Source

Merge branch '64bit'

pull/25/head
Xadhoom 7 years ago
parent
commit
1b5aca0c44
  1. 72
      Stub/diabloui.cpp
  2. 265
      Stub/sdlrender.cpp
  3. 23
      Stub/sdlrender.h

72
Stub/diabloui.cpp

@ -112,8 +112,9 @@ void LoadUiGFX()
{ {
DWORD dwData[2]; DWORD dwData[2];
LoadArtImage("ui_art\\focus16.pcx", &MenuPentegram16, 8, dwData); LoadArtImage("ui_art\\focus16.pcx", &MenuPentegram16, 8, NULL);
LoadArtImage("ui_art\\focus42.pcx", &MenuPentegram42, 8, dwData); LoadArtImage("ui_art\\focus.pcx", &MenuPentegram, 8, NULL);
LoadArtImage("ui_art\\focus42.pcx", &MenuPentegram42, 8, NULL);
LoadArtImage("ui_art\\cursor.pcx", &pPcxCursorImage, 1, dwData); LoadArtImage("ui_art\\cursor.pcx", &pPcxCursorImage, 1, dwData);
gdwCursorWidth = dwData[0]; gdwCursorWidth = dwData[0];
@ -175,7 +176,6 @@ void UiInitialize()
SDL_Event event; SDL_Event event;
int x, y; int x, y;
bool quit = false; bool quit = false;
int HeroPortrait = 3;
printf("Main Menu Init\n"); printf("Main Menu Init\n");
if (!window) { if (!window) {
@ -191,40 +191,37 @@ void UiInitialize()
LoadCharNamesintoMemory(); LoadCharNamesintoMemory();
while (!quit) { while (!quit) {
DrawMouse();
PaletteFadeIn(32); PaletteFadeIn(32);
switch (menu) { switch (menu) {
case SPLASH: case SPLASH:
SDL_RenderDiabloSplashPage(); RenderDiabloSplashPage();
break; break;
case MAINMENU: case MAINMENU:
SDL_RenderDiabloMainPage(); RenderDiabloMainPage();
DrawMouse();
break; break;
case SINGLEPLAYER_LOAD: case SINGLEPLAYER_LOAD:
SDL_RenderDiabloSinglePlayerPage(); RenderDiabloSinglePlayerPage();
gbMaxPlayers = 1; gbMaxPlayers = 1;
DrawMouse(); DrawMouse();
break; break;
case SINGLEPLAYER_CLASSES: case SINGLEPLAYER_CLASSES:
CreateHeroMenu(); // TODO crashes CreateHeroMenu();
DrawNewHeroImage(HeroPortrait, 1);
DrawMouse(); DrawMouse();
break; break;
case SINGLEPLAYER_NAME: case SINGLEPLAYER_NAME:
DrawNewHeroImage(HeroPortrait, 0); RenderUndecidedHeroName(HeroChosen);
RenderDefaultStats(HeroPortrait);
RenderUndecidedHeroName();
DrawMouse(); DrawMouse();
break; break;
case MULTIPLAYER_LOBBY: case MULTIPLAYER_LOBBY:
DrawPreGameOptions(HeroPortrait, 1); DrawPreGameOptions(1);
RenderDefaultStats(HeroPortrait); RenderDefaultStats(HeroChosen);
DrawMouse(); DrawMouse();
break; break;
case MULTIPLAYER_DIFFICULTY: case MULTIPLAYER_DIFFICULTY:
DrawPreGameDifficultySelection(HeroPortrait, 1); DrawPreGameDifficultySelection(HeroChosen, 1);
RenderDefaultStats(HeroPortrait); RenderDefaultStats(HeroChosen);
DrawMouse(); DrawMouse();
break; break;
case CREDIT: case CREDIT:
@ -255,7 +252,7 @@ void UiInitialize()
case SDLK_UP: case SDLK_UP:
SelectedItem--; SelectedItem--;
if (SelectedItem < 1) { if (SelectedItem < 1) {
SelectedItem = SelectedItemMax; SelectedItem = SelectedItemMax ? SelectedItemMax : 1;
} }
effects_play_sound("sfx\\items\\titlemov.wav"); effects_play_sound("sfx\\items\\titlemov.wav");
break; break;
@ -291,10 +288,19 @@ void UiInitialize()
} }
break; break;
case SINGLEPLAYER_LOAD: case SINGLEPLAYER_LOAD:
if (SelectedItem == SelectedItemMax) { if (1 || SelectedItem == SelectedItemMax) { // TODO skip to choose class if no valid saves
SetMenu(SINGLEPLAYER_NAME); SetMenu(SINGLEPLAYER_CLASSES);
} }
break; break;
case SINGLEPLAYER_CLASSES:
HeroChosen = SelectedItem - 1;
SetMenu(SINGLEPLAYER_NAME);
break;
case SINGLEPLAYER_NAME:
CreateSinglePlayerChar = 1;
const char *test_name = HeroUndecidedName;
quit = true;
break;
} }
break; break;
@ -343,12 +349,6 @@ void UiInitialize()
int CreateHeroCanBBoxX = 445; int CreateHeroCanBBoxX = 445;
int CreateHeroCanBBoxY = 473; int CreateHeroCanBBoxY = 473;
SDL_Rect SorcerorSelectBox;
SorcerorSelectBox.y = 428;
SorcerorSelectBox.x = 280;
SorcerorSelectBox.w = 100;
SorcerorSelectBox.h = 30;
SDL_Rect CreateHeroCancelBox; SDL_Rect CreateHeroCancelBox;
CreateHeroCancelBox.y = 550; CreateHeroCancelBox.y = 550;
CreateHeroCancelBox.x = 675; CreateHeroCancelBox.x = 675;
@ -423,8 +423,6 @@ void UiInitialize()
SetMenu(MULTIPLAYER_LOBBY); SetMenu(MULTIPLAYER_LOBBY);
// break; // break;
} else if (TotalPlayers >= 6 && IsInsideRect(x, y, CreateHeroCancelBox)) { } else if (TotalPlayers >= 6 && IsInsideRect(x, y, CreateHeroCancelBox)) {
HeroPortrait = 3;
printf("Cancel\n\n\n"); printf("Cancel\n\n\n");
SetMenu(MAINMENU); SetMenu(MAINMENU);
} else if (TotalPlayers >= 6 && IsInside(x, y, CreateHeroX + ItemWidth, CreateHeroY, ItemWidth, ItemHeight)) { } else if (TotalPlayers >= 6 && IsInside(x, y, CreateHeroX + ItemWidth, CreateHeroY, ItemWidth, ItemHeight)) {
@ -433,7 +431,6 @@ void UiInitialize()
} }
break; break;
case SINGLEPLAYER_CLASSES: case SINGLEPLAYER_CLASSES:
// SinglePlayerMenuItemsLoaded = 0;
printf("\n\nmenu3 X%d Y%d \n ", x, y); printf("\n\nmenu3 X%d Y%d \n ", x, y);
int WarriorSelectBoxY = 430; int WarriorSelectBoxY = 430;
@ -445,9 +442,6 @@ void UiInitialize()
int SorcerorSelectBoxX = 383; int SorcerorSelectBoxX = 383;
int SorcerorSelectBoxY = 365; int SorcerorSelectBoxY = 365;
// int x = 280;
// int y = 430;
SDL_Rect WarriorSelectBox; SDL_Rect WarriorSelectBox;
WarriorSelectBox.y = 350; WarriorSelectBox.y = 350;
WarriorSelectBox.x = 280; WarriorSelectBox.x = 280;
@ -459,27 +453,26 @@ void UiInitialize()
RogueSelectBox.x = 280; RogueSelectBox.x = 280;
RogueSelectBox.w = 100; RogueSelectBox.w = 100;
RogueSelectBox.h = 30; RogueSelectBox.h = 30;
// X450 Y 392 ;
// X 447 Y 428 SDL_Rect SorcerorSelectBox;
SorcerorSelectBox.y = 428;
SorcerorSelectBox.x = 280;
SorcerorSelectBox.w = 100;
SorcerorSelectBox.h = 30;
if (IsInsideRect(x, y, WarriorSelectBox)) { if (IsInsideRect(x, y, WarriorSelectBox)) {
printf(" warrior I was hit\n\n\n"); printf(" warrior I was hit\n\n\n");
HeroPortrait = 0;
HeroChosen = 0; HeroChosen = 0;
SetMenu(SINGLEPLAYER_NAME); SetMenu(SINGLEPLAYER_NAME);
} else if (IsInsideRect(x, y, RogueSelectBox)) { } else if (IsInsideRect(x, y, RogueSelectBox)) {
printf(" rogue I was hit\n\n\n"); printf(" rogue I was hit\n\n\n");
HeroPortrait = 1;
HeroChosen = 1; HeroChosen = 1;
SetMenu(SINGLEPLAYER_NAME); SetMenu(SINGLEPLAYER_NAME);
} else if (IsInsideRect(x, y, SorcerorSelectBox)) { } else if (IsInsideRect(x, y, SorcerorSelectBox)) {
HeroPortrait = 2;
printf("sorceror I was hit\n\n\n"); printf("sorceror I was hit\n\n\n");
HeroChosen = 2; HeroChosen = 2;
SetMenu(SINGLEPLAYER_NAME); SetMenu(SINGLEPLAYER_NAME);
} else if (IsInsideRect(x, y, CreateHeroCancelBox)) { } else if (IsInsideRect(x, y, CreateHeroCancelBox)) {
HeroPortrait = 3;
printf("Cancel\n\n\n"); printf("Cancel\n\n\n");
SetMenu(SINGLEPLAYER_CLASSES); SetMenu(SINGLEPLAYER_CLASSES);
} }
@ -499,7 +492,6 @@ void UiInitialize()
NewHeroNameIndex = 0; NewHeroNameIndex = 0;
printf("Cancel\n\n\n"); printf("Cancel\n\n\n");
HeroPortrait = 3;
SetMenu(SINGLEPLAYER_CLASSES); SetMenu(SINGLEPLAYER_CLASSES);
} else if (IsInsideRect(x, y, ClickOkBox)) { } else if (IsInsideRect(x, y, ClickOkBox)) {
printf("Ok\n"); printf("Ok\n");
@ -546,7 +538,6 @@ void UiInitialize()
printf(" Load Game I was hit\n\n\n"); printf(" Load Game I was hit\n\n\n");
break; break;
} else if (IsInsideRect(x, y, CreateHeroCancelBox)) { } else if (IsInsideRect(x, y, CreateHeroCancelBox)) {
HeroPortrait = 3;
timestart = 0; timestart = 0;
cpu_time_used = 0; cpu_time_used = 0;
start = 0; start = 0;
@ -603,7 +594,6 @@ void UiInitialize()
StartNewGame = 1; StartNewGame = 1;
break; break;
} else if (IsInsideRect(x, y, CreateHeroCancelBox)) { } else if (IsInsideRect(x, y, CreateHeroCancelBox)) {
HeroPortrait = 3;
timestart = 0; timestart = 0;
cpu_time_used = 0; cpu_time_used = 0;
start = 0; start = 0;

265
Stub/sdlrender.cpp

@ -62,7 +62,7 @@ unsigned char *pFont16;
int gdwFont24Width; int gdwFont24Width;
int gdwFont24Height; int gdwFont24Height;
void *pPcxFont24sImage; void *pPcxFont24sImage;
void *pPcxFont24gImage; void *pPcxFont24gImage;
unsigned char *pFont24; unsigned char *pFont24;
@ -84,6 +84,7 @@ int GameTitleWidth;
void *TitleMenuText; void *TitleMenuText;
void *MenuPentegram16; void *MenuPentegram16;
void *MenuPentegram;
void *MenuPentegram42; void *MenuPentegram42;
void *pDiabfrCel; void *pDiabfrCel;
@ -833,16 +834,11 @@ void GetWorkingLocationOfFile(char *RelativeFile)
uint32_t XgetTick() uint32_t XgetTick()
{ {
unsigned theTick = 0U; unsigned theTick = 0U;
printf("This is supposed to replace GitTicks()"); printf("This is supposed to replace GitTicks()");
return theTick; return theTick;
} }
void SDLCreateDiabloCursor()
{
}
void SdlDiabloMainWindow() void SdlDiabloMainWindow()
{ {
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
@ -1049,28 +1045,28 @@ void ShowCredts()
} }
} }
///////////////////////////Renders ///////////////////////////Renders
void AnimateDiabloLogo(int t, int w, int h, void *pBuffer) void AnimateDiabloLogo(int t, int w, int h, void *pBuffer)
{ {
int MyPcxDelay = 60; int MyPcxDelay = 60;
int MyPcxFRAME = (SDL_GetTicks() / MyPcxDelay) % 15; int MyPcxFRAME = (SDL_GetTicks() / MyPcxDelay) % 15;
MyPcxFRAME++; MyPcxFRAME++;
if (MyPcxFRAME == 15) { if (MyPcxFRAME == 15) {
MyPcxFRAME = 0; MyPcxFRAME = 0;
} }
DrawArtWithMask(GetCenterOffset(w), t, w, h, MyPcxFRAME, 250, pBuffer); DrawArtWithMask(GetCenterOffset(w), t, w, h, MyPcxFRAME, 250, pBuffer);
} }
void RenderDiabloLogo() void RenderDiabloLogo()
{ {
AnimateDiabloLogo(182, gdwLogoWidth, gdwLogoHeight, pPcxLogoImage); AnimateDiabloLogo(182, gdwLogoWidth, gdwLogoHeight, pPcxLogoImage);
} }
void RenderDiabloLogoSm() void RenderDiabloLogoSm()
{ {
AnimateDiabloLogo(0, gdwLogoSmWidth, gdwLogoSmHeight, pPcxLogoSmImage); AnimateDiabloLogo(0, gdwLogoSmWidth, gdwLogoSmHeight, pPcxLogoSmImage);
} }
void DrawCursor(int mx, int my) void DrawCursor(int mx, int my)
@ -1104,7 +1100,7 @@ void DrawMouse()
// unlock_buf_priv(); // unlock_buf_priv();
} }
void DrawSelector(int x, int y, int width, int padding, int spacing, int swidth, void *pBuffer) void AnimateSelector(int x, int y, int width, int padding, int spacing, int swidth, void *pBuffer)
{ {
int Pentframe = (SDL_GetTicks() / 60) % 8; int Pentframe = (SDL_GetTicks() / 60) % 8;
@ -1112,6 +1108,7 @@ void DrawSelector(int x, int y, int width, int padding, int spacing, int swidth,
if (Pentframe == 8) { if (Pentframe == 8) {
Pentframe = 0; Pentframe = 0;
} }
Pentframe = 0;
width = width ? width : SCREEN_WIDTH; width = width ? width : SCREEN_WIDTH;
x += GetCenterOffset(swidth, width); x += GetCenterOffset(swidth, width);
@ -1123,24 +1120,29 @@ void DrawSelector(int x, int y, int width, int padding, int spacing, int swidth,
void DrawSelector16(int x, int y, int width, int padding, int spacing) void DrawSelector16(int x, int y, int width, int padding, int spacing)
{ {
DrawSelector(x, y, width, padding, spacing, 20, MenuPentegram16); AnimateSelector(x, y, width, padding, spacing, 20, MenuPentegram16);
}
void DrawSelector(int x, int y, int width, int padding, int spacing)
{
AnimateSelector(x, y, width, padding, spacing, 30, MenuPentegram);
} }
void DrawSelector42(int x, int y, int width, int padding, int spacing) void DrawSelector42(int x, int y, int width, int padding, int spacing)
{ {
DrawSelector(x, y, width, padding, spacing, 42, MenuPentegram42); AnimateSelector(x, y, width, padding, spacing, 42, MenuPentegram42);
} }
void SDL_RenderDiabloSplashPage() void RenderDiabloSplashPage()
{ {
LoadTitelArt("ui_art\\title.pcx"); LoadTitelArt("ui_art\\title.pcx");
DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage); DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage);
PrintText24Silver(-1, 410, "Copyright \xA9 1996-2001 Blizzard Entertainment", JustCentre); PrintText24Silver(-1, 410, "Copyright \xA9 1996-2001 Blizzard Entertainment", JustCentre);
RenderDiabloLogo(); RenderDiabloLogo();
} }
void SDL_RenderDiabloMainPage() void RenderDiabloMainPage()
{ {
char *pszFile = "ui_art\\mainmenu.pcx"; char *pszFile = "ui_art\\mainmenu.pcx";
if (false) //DiabloUI_GetSpawned() if (false) //DiabloUI_GetSpawned()
@ -1151,7 +1153,6 @@ void SDL_RenderDiabloMainPage()
// scrollrt_draw_cursor_back_buffer(); // Doesn't work? // scrollrt_draw_cursor_back_buffer(); // Doesn't work?
RenderDiabloLogoSm(); RenderDiabloLogoSm();
int menuTop = 192; int menuTop = 192;
@ -1178,32 +1179,46 @@ void SDL_RenderDiabloMainPage()
//ADD_PlrStringXY(0, 600 - 130, 640, " MaTT Uelman, and The Blizzard North Team ThaT Gave Us A Childhood.", COL_BLUE); //ADD_PlrStringXY(0, 600 - 130, 640, " MaTT Uelman, and The Blizzard North Team ThaT Gave Us A Childhood.", COL_BLUE);
} }
void SDL_RenderDiabloSinglePlayerPage() void RenderStats(char *lvl, char *str, char *mag, char *dex, char *vit)
{
PrintText16Silver(31, 323, "Level:", JustRight, 118);
PrintText16Silver(149, 323, lvl, JustCentre, 61);
PrintText16Silver(31, 358, "Strength:", JustRight, 118);
PrintText16Silver(149, 358, str, JustCentre, 61);
PrintText16Silver(31, 380, "Magic:", JustRight, 118);
PrintText16Silver(149, 380, mag, JustCentre, 61);
PrintText16Silver(31, 401, "Dexterity:", JustRight, 118);
PrintText16Silver(149, 401, dex, JustCentre, 61);
PrintText16Silver(31, 422, "Vitality:", JustRight, 118);
PrintText16Silver(149, 422, vit, JustCentre, 61);
}
void RenderDiabloSinglePlayerPage()
{ {
LoadTitelArt("ui_art\\selhero.pcx"); LoadTitelArt("ui_art\\selhero.pcx");
DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage); DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage);
RenderDiabloLogoSm(); RenderDiabloLogoSm();
DrawArtImage(30, 211, gdwHeroWidth, gdwHeroHeight, 0, pPcxHeroImage); DrawArtImage(30, 211, gdwHeroWidth, gdwHeroHeight, 3, pPcxHeroImage);
PrintText30Silver(-1, 161, "Single Player Characters", JustCentre); PrintText30Silver(-1, 161, "Single Player Characters", JustCentre);
PrintText30Silver(241 - 1, 211, "Select Hero", JustCentre, 369); int w = 369;
int x = 241;
PrintText30Silver(x - 1, 211, "Select Hero", JustCentre, w);
PrintText24Gold(241 - 1, 256, "New Hero", JustCentre, 369); // 26px spacing int selectorTop = 256;
int y = selectorTop;
for (int i = 0; i < 0; i++) {
PrintText24Gold(x - 1, y, "Hero name", JustCentre, w);
y += 26;
}
PrintText24Gold(x - 1, y, "New Hero", JustCentre, w);
DrawSelector16(241, 256 + 3, 369, 32, 26); DrawSelector16(x, selectorTop + 3, w, 32, 26);
PrintText16Silver(31, 323, "Level:", JustRight, 118); RenderStats("-", "-", "-", "-", "-");
PrintText16Silver(149, 323, "1", JustCentre, 61);
PrintText16Silver(31, 358, "Strength:", JustRight, 118);
PrintText16Silver(149, 358, "30", JustCentre, 61);
PrintText16Silver(31, 380, "Magic:", JustRight, 118);
PrintText16Silver(149, 380, "10", JustCentre, 61);
PrintText16Silver(31, 401, "Dexterity:", JustRight, 118);
PrintText16Silver(149, 401, "20", JustCentre, 61);
PrintText16Silver(31, 422, "Vitality:", JustRight, 118);
PrintText16Silver(149, 422, "25", JustCentre, 61);
PrintText30Gold(279, 429, "OK"); PrintText30Gold(279, 429, "OK");
PrintText30Gold(378, 429, "Delete"); PrintText30Gold(378, 429, "Delete");
@ -1257,28 +1272,7 @@ void LoadClickBoxes(int numberofchars)
int LoadedFont = 0; int LoadedFont = 0;
int TotalPlayers = 0; int TotalPlayers = 0;
void DrawNewHeroImage(int image, int ShowClasses) void DrawPreGameOptions(int ShowClasses)
{
LoadTitelArt("ui_art\\selhero.pcx");
DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage);
RenderDiabloLogoSm();
DrawArtImage(30, 211, gdwHeroWidth, gdwHeroHeight, 0, pPcxHeroImage);
char *heroclasses[3] = { "Warrior", "Rogue", "Sorceror" };
// this should not be hard coded.
int x = 280;
int y = 430;
if (ShowClasses == 1) {
for (int i = 0; i < 3; i++) {
y += 40;
PrintText16Silver(x, y, heroclasses[i]);
}
}
}
void DrawPreGameOptions(int image, int ShowClasses)
{ {
LoadTitelArt("ui_art\\selhero.pcx"); LoadTitelArt("ui_art\\selhero.pcx");
DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage); DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage);
@ -1290,7 +1284,7 @@ void DrawPreGameOptions(int image, int ShowClasses)
// this should not be hard coded. // this should not be hard coded.
int x = 280; int x = 280;
int y = 430; int y = 256;
if (ShowClasses == 1) { if (ShowClasses == 1) {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
@ -1300,7 +1294,7 @@ void DrawPreGameOptions(int image, int ShowClasses)
} }
} }
void DrawPreGameDifficultySelection(int image, int ShowClasses) void DrawPreGameDifficultySelection(int HeroClass, int ShowClasses)
{ {
LoadTitelArt("ui_art\\selhero.pcx"); LoadTitelArt("ui_art\\selhero.pcx");
DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage); DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage);
@ -1308,12 +1302,14 @@ void DrawPreGameDifficultySelection(int image, int ShowClasses)
DrawArtImage(30, 211, gdwHeroWidth, gdwHeroHeight, 0, pPcxHeroImage); DrawArtImage(30, 211, gdwHeroWidth, gdwHeroHeight, 0, pPcxHeroImage);
RenderStats("1", "30", "10", "20", "25");
char *GameOptions[3] = { "Normal", "Nightmare", "Hell" }; char *GameOptions[3] = { "Normal", "Nightmare", "Hell" };
// this should not be hard coded. // this should not be hard coded.
int x = 280; int x = 280;
int y = 430; int y = 256;
// DrawArtImage(30, 211, gdwHeroWidth, gdwHeroHeight, image, pPcxHeroImage); DrawArtImage(30, 211, gdwHeroWidth, gdwHeroHeight, HeroClass, pPcxHeroImage);
if (ShowClasses == 1) { if (ShowClasses == 1) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
@ -1323,41 +1319,19 @@ void DrawPreGameDifficultySelection(int image, int ShowClasses)
} }
} }
void RenderDefaultStats(int HeroChosen) void RenderDefaultStats(int HeroClass)
{ {
int x = 80; switch (HeroClass) {
int y = 530; case UI_WARRIOR:
char *WarriorStats[4] = { "Strenght : 30", "Magic : 10", "Dexterity : 20", "Vitality : 25" }; RenderStats("1", "30", "10", "20", "25");
char *RogueStats[4] = { "Strenght : 20", "Magic : 15", "Dexterity : 30", "Vitality : 20" }; break;
char *SorcerorStats[4] = { "Strenght : 15", "Magic : 35", "Dexterity : 15", "Vitality : 20" }; case UI_ROGUE:
RenderStats("1", "20", "15", "30", "20");
if (HeroChosen == 0) { break;
PrintText16Silver(x, y - 20, "Warrior Stats:"); case UI_SORCERER:
for (int i = 0; i < 4; i++) { RenderStats("1", "15", "35", "15", "20");
PrintText16Silver(x, y, WarriorStats[i]); break;
y += 20;
}
}
if (HeroChosen == 1) {
PrintText16Silver(x, y - 20, "Rogue Stats:");
for (int i = 0; i < 4; i++) {
PrintText16Silver(x, y, RogueStats[i]);
y += 20;
}
} }
if (HeroChosen == 2) {
PrintText16Silver(x, y - 20, "Sorceror Stats:");
for (int i = 0; i < 4; i++) {
PrintText16Silver(x, y, SorcerorStats[i]);
y += 20;
}
}
}
void RenderUndecidedHeroName()
{
gmenu_print_text(270, 450, (char *)HeroUndecidedName);
} }
void SetHeroStats(_uiheroinfo *a1) void SetHeroStats(_uiheroinfo *a1)
@ -1370,30 +1344,69 @@ void LoadHeroStats()
pfile_ui_set_hero_infos(SetHeroStats); pfile_ui_set_hero_infos(SetHeroStats);
} }
void DrawHeroStats() // Have this load the function above and then render it in the main menu.
// Cnacel box is also needed.
void CreateHeroMenu()
{ {
LoadTitelArt("ui_art\\selhero.pcx");
DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage);
RenderDiabloLogoSm();
int x = 80; DrawArtImage(30, 211, gdwHeroWidth, gdwHeroHeight, SelectedItem - 1, pPcxHeroImage);
int y = 415;
/* PrintText30Silver(-1, 161, "New Single Player Hero", JustCentre);
Render charactor stats if you want.
*/ int w = 369;
} int x = 241;
int y = 285;
bool LoadCreateHeroDialogImages = 0; PrintText30Silver(x - 1, 211, "Choose Class", JustCentre, w);
bool SorcerorCreateSelected = 0;
bool RogueCreateSelected = 0;
bool WarriorCreateSelected = 1;
void LoadCreateHeroDialogMenu() RenderDefaultStats(SelectedItem - 1);
{
char *heroclasses[3] = { "Warrior", "Rogue", "Sorcerer" };
int selectorTop = y;
for (int i = 0; i < 3; i++) {
if (i > 1) {
y += 1; // "Rouge" and "Sorcerer" has a smaller gap then other items
}
PrintText24Gold(x - 1, y, heroclasses[i], JustCentre, w);
y += 33;
}
if (SelectedItem > 1) {
selectorTop += 1; // "Rouge" and "Sorcerer" has a smaller gap then other items
}
DrawSelector(x, selectorTop - 2, w, 39, 26);
PrintText30Gold(329, 429, "OK");
PrintText30Gold(451, 429, "Cancel");
} }
// Have this load the function above and then render it in the main menu.
// Cnacel box is also needed. void RenderUndecidedHeroName(int HeroClass)
void CreateHeroMenu()
{ {
LoadTitelArt("ui_art\\selhero.pcx");
DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage); DrawArtImage(0, 0, gdwTitleWidth, gdwTitleHeight, 0, pPcxTitleImage);
RenderDiabloLogoSm(); RenderDiabloLogoSm();
DrawArtImage(30, 211, gdwHeroWidth, gdwHeroHeight, HeroClass, pPcxHeroImage);
PrintText30Silver(-1, 161, "New Single Player Hero", JustCentre);
int w = 369;
int x = 241;
int y = 318;
PrintText30Silver(x - 1, 211, "Enter Name", JustCentre, w);
RenderDefaultStats(HeroClass);
DrawSelector(x, y - 2, w, 39, 26);
PrintText24Gold(x + 67, y, (char *)HeroUndecidedName); // todo add blinking "|"
PrintText30Gold(329, 429, "OK");
PrintText30Gold(451, 429, "Cancel");
} }

23
Stub/sdlrender.h

@ -56,11 +56,6 @@ extern int gdwCreditsHeight;
extern bool TitleImageLoaded; extern bool TitleImageLoaded;
//My SDL inclusions //
extern bool SorcerorCreateSelected;
extern bool WarriorCreateSelected;
extern bool RogueCreateSelected;
extern int totalFrames; extern int totalFrames;
//extern SDL_Texture* spriteSheet; //extern SDL_Texture* spriteSheet;
extern SDL_Surface *DiabloTitle; extern SDL_Surface *DiabloTitle;
@ -87,6 +82,7 @@ extern int HeroChosen;
extern void *TitleMenuText; extern void *TitleMenuText;
extern void *MenuPentegram16; extern void *MenuPentegram16;
extern void *MenuPentegram;
extern void *MenuPentegram42; extern void *MenuPentegram42;
extern char HeroUndecidedName[17]; extern char HeroUndecidedName[17];
@ -96,26 +92,23 @@ extern SDL_Rect CreateHeroBox;
void CreateMenuDialogBox(); void CreateMenuDialogBox();
void CreateDiabloMainMenuz(); void CreateDiabloMainMenuz();
void SdlDiabloMainWindow(); void SdlDiabloMainWindow();
void SDL_RenderDiabloSplashPage(); void RenderDiabloSplashPage();
void SDL_RenderDiabloMainPage(); void RenderDiabloMainPage();
char *GetWorkingDirectory(); char *GetWorkingDirectory();
void CreateMainDiabloMenu(); void CreateMainDiabloMenu();
void SDLCreateDiabloCursor(); void RenderDiabloSinglePlayerPage();
void SDL_RenderDiabloSinglePlayerPage();
void ShowCredts(); void ShowCredts();
void RenderCharNames(); void RenderCharNames();
void SDL_Diablo_UI();
void FreeMenuItems(); void FreeMenuItems();
BOOL __cdecl LoadArtImage(char *pszFile, void **pBuffer, int frames, DWORD *data); BOOL __cdecl LoadArtImage(char *pszFile, void **pBuffer, int frames, DWORD *data);
void DrawMouse(); void DrawMouse();
void DrawCursor(int mx, int my); void DrawCursor(int mx, int my);
void CreateHeroMenu(); void CreateHeroMenu();
void DrawNewHeroImage(int image, int ShowClasses); void RenderUndecidedHeroName(int HeroClass);
void RenderUndecidedHeroName();
void LoadHeroStats(); void LoadHeroStats();
void RenderDefaultStats(int HeroChosen); void RenderDefaultStats(int HeroClass);
void DrawPreGameOptions(int image, int ShowClasses); void DrawPreGameOptions(int ShowClasses);
void DrawPreGameDifficultySelection(int image, int ShowClasses); void DrawPreGameDifficultySelection(int HeroClass, int ShowClasses);
int GetCenterOffset(int w, int bw = 0); int GetCenterOffset(int w, int bw = 0);
void DrawPCXString(int x, int y, int w, int h, char *str, BYTE *font, void *pBuff); void DrawPCXString(int x, int y, int w, int h, char *str, BYTE *font, void *pBuff);
void DrawArtWithMask(int SX, int SY, int SW, int SH, int nFrame, BYTE bMask, void *pBuffer); void DrawArtWithMask(int SX, int SY, int SW, int SH, int nFrame, BYTE bMask, void *pBuffer);

Loading…
Cancel
Save