Browse Source

refixed user char select problems

pull/18/head
aperturesecurity 7 years ago
parent
commit
03bf74625e
  1. 2
      Stub/diabloui.cpp
  2. 11
      Stub/init.cpp
  3. 3
      Stub/miniwin_sdl.h
  4. 149
      Stub/sdlrender.cpp
  5. 2
      Stub/storm.cpp
  6. 2
      Stub/stubs.h

2
Stub/diabloui.cpp

@ -39,7 +39,7 @@ BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf
// If a hero is available, load it, otherwise create a new one
if (!hero_infos.empty()) {
const char *hero_name = hero_infos[0].name;
const char *hero_name = chr_name_str;
DUMMY_PRINT("use hero: %s", hero_name);
strcpy(name, hero_name);

11
Stub/init.cpp

@ -262,6 +262,7 @@ void SDL_Diablo_UI() // I anticipate to move this later.
effects_play_sound("Sfx\\Items\\Titlslct.wav");
strcpy(chr_name_str, hero_names[0]);
printf("Player %s\n", chr_name_str);
FreeMenuItems();
break;
}
@ -272,6 +273,7 @@ void SDL_Diablo_UI() // I anticipate to move this later.
effects_play_sound("Sfx\\Items\\Titlslct.wav");
strcpy(chr_name_str, hero_names[1]);
printf("Player %s\n", chr_name_str);
FreeMenuItems();
// XStartGame();
break;
}
@ -282,6 +284,7 @@ void SDL_Diablo_UI() // I anticipate to move this later.
effects_play_sound("Sfx\\Items\\Titlslct.wav");
strcpy(chr_name_str, hero_names[2]);
printf("Player %s\n", chr_name_str);
FreeMenuItems();
break;
// XStartGame();
}
@ -292,6 +295,7 @@ void SDL_Diablo_UI() // I anticipate to move this later.
effects_play_sound("Sfx\\Items\\Titlslct.wav");
strcpy(chr_name_str, hero_names[3]);
printf("Player %s\n", chr_name_str);
FreeMenuItems();
break;
// XStartGame();
}
@ -302,7 +306,7 @@ void SDL_Diablo_UI() // I anticipate to move this later.
effects_play_sound("Sfx\\Items\\Titlslct.wav");
strcpy(chr_name_str, hero_names[4]);
printf("Player %s\n", chr_name_str);
FreeMenuItems();
break;
// XStartGame();
}
@ -313,6 +317,7 @@ void SDL_Diablo_UI() // I anticipate to move this later.
effects_play_sound("Sfx\\Items\\Titlslct.wav");
strcpy(chr_name_str, hero_names[5]);
printf("Player %s\n", chr_name_str);
FreeMenuItems();
break;
// XStartGame();
}
@ -321,9 +326,7 @@ void SDL_Diablo_UI() // I anticipate to move this later.
(x < SinglePlayerMenuCancelBox.w) && (y < SinglePlayerMenuCancelBox.h)) { // ExitBox clicked
printf("CancelBox Diablo\n");
effects_play_sound("Sfx\\Items\\Titlslct.wav");
// quit = true;
// goto LABEL_16;
menu = 0;
}
if ((x > CreateHeroBox.x) && (y > CreateHeroBox.y) && (x < CreateHeroBox.w) &&

3
Stub/miniwin_sdl.h

@ -69,4 +69,5 @@ void CreateMainDiabloMenu();
void SDLCreateDiabloCursor();
void SDL_RenderDiabloSinglePlayerPage();
void RenderCharNames();
void SDL_Diablo_UI();
void SDL_Diablo_UI();
void FreeMenuItems();

149
Stub/sdlrender.cpp

@ -13,8 +13,7 @@ int SCREEN_HEIGHT = 500;
int LogoWidth;
int LogoHeight;
SDL_Texture *DiablologoAnimT;
FC_Font *font;
SDL_Rect textureRect;
SDL_Rect windowRect;
@ -26,24 +25,80 @@ SDL_Rect ReplayIntroBox;
SDL_Rect ShowCreditsBox;
SDL_Rect ExitBox;
SDL_Surface *DiabloTitle;
// DiabloMenu Items
SDL_Rect MainMenuItemsWRect;
SDL_Rect MainMenuItemsTRect;
SDL_Rect CreateHeroBox;
SDL_Rect SinglePlayerMenuCancelBox;
SDL_Event input;
SDL_Texture *CursorTexture;
bool SinglePlayerMenuItemsLoaded = 0;
bool DiabloImageLoaded = 0;
bool DiabloMainMenuListLoaded = 0;
SDL_Texture *MenuSelectNewHeroTexture;
SDL_Rect SinglePlayerMenuCancelBox;
struct timespec ts;
// DiabloMenu Items
SDL_Surface *MainMenuItemsSurface;
SDL_Texture *MainMenuItemsTexture;
SDL_Rect MainMenuItemsWRect;
SDL_Rect MainMenuItemsTRect;
SDL_Rect CreateHeroBox;
//////////////////////////////////////
// things I need to unload...
int FontLoaded = 0;
FC_Font * Subfont = FC_CreateFont();
SDL_Texture * MainMenuItemsTexture;
SDL_Texture * DiablologoAnimT;
SDL_Texture * CursorTexture;
SDL_Texture * MenuSelectNewHeroTexture;
SDL_Texture * CreateHeroDialogTextureW;
SDL_Texture * CreateHeroDialogTextureR;
SDL_Texture * CreateHeroDialogTextureS;
SDL_Surface * MainMenuItemsSurface;
SDL_Surface * MenuSelectNewHeroSurface;
SDL_Surface * CreateHeroDialogSurface;
SDL_Surface * CursorImg ;
SDL_Surface * DiabloTitle;
FC_Font * font;
/////////////////////////////////////////
void FreeMenuItems(){
SDL_FreeSurface(MainMenuItemsSurface);
SDL_FreeSurface(MenuSelectNewHeroSurface);
SDL_FreeSurface(CreateHeroDialogSurface);
SDL_FreeSurface(CreateHeroDialogSurface);
SDL_FreeSurface(CursorImg);
SDL_FreeSurface(DiabloTitle);
SDL_DestroyTexture(MainMenuItemsTexture);
SDL_DestroyTexture(DiablologoAnimT);
SDL_DestroyTexture(CursorTexture);
SDL_DestroyTexture(MenuSelectNewHeroTexture);
SDL_DestroyTexture(CreateHeroDialogTextureW);
SDL_DestroyTexture(CreateHeroDialogTextureR);
SDL_DestroyTexture(CreateHeroDialogTextureS);
}
char gLDirectory[FILENAME_MAX];
void GetWorkingLocationOfFile(char *RelativeFile)
@ -54,15 +109,18 @@ void GetWorkingLocationOfFile(char *RelativeFile)
uint32_t XgetTick()
{
// struct timespec ts;
unsigned theTick = 0U;
printf("This is supposed to replace GitTicks()");
// if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
// error
// }
return theTick;
}
void SDLCreateDiabloCursor()
{
int x, y;
@ -74,34 +132,19 @@ void SDLCreateDiabloCursor()
CusorLocation.w = 33;
GetWorkingLocationOfFile("/Xresources/cursor.png");
SDL_Surface *CursorImg = IMG_Load(gLDirectory);
CursorImg = IMG_Load(gLDirectory);
CursorTexture = SDL_CreateTextureFromSurface(renderer, CursorImg);
SDL_UpdateWindowSurface(window);
}
void SDL_MAGICAL_RENDER(int x, int y, int w, int h)
{
printf("SDL_MAGICAL RENDER I Am Not Implemented\n");
// if (window != 0) {
// int depth = 12;
// SDL_Surface * image = SDL_CreateRGBSurfaceFrom(destmemarea, SCREEN_WIDTH / 2, SCREEN_HEIGHT, depth,
// SCREEN_WIDTH, 0, 0, 0, 0); SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, image);
// SDL_RenderCopy(renderer, texture, NULL, NULL);
// SDL_RenderPresent(renderer);
// SDL_UpdateWindowSurface(window);
// }
}
void SdlDiabloMainWindow()
{
SDL_Init(SDL_INIT_EVERYTHING);
IMG_Init(IMG_INIT_PNG);
window = SDL_CreateWindow("Diablo", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT,
SDL_WINDOW_SHOWN);
window = SDL_CreateWindow("Diablo", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
renderer = SDL_CreateRenderer(window, -1, 0);
printf("Window And Renderer Created!\n");
}
@ -112,7 +155,7 @@ void LoadDiabloMenuLogoImage()
int LogoHeight;
GetWorkingLocationOfFile("/Xresources/Diablo_Logo.png");
DiabloTitle = IMG_Load(gLDirectory);
DiabloTitle = IMG_Load(gLDirectory);
DiablologoAnimT = SDL_CreateTextureFromSurface(renderer, DiabloTitle);
// SDL_QueryTexture() method gets the width and height of the texture
@ -122,6 +165,9 @@ void LoadDiabloMenuLogoImage()
SDL_FreeSurface(DiabloTitle);
}
void DiabloMainMenuItemsLoaded()
{
@ -155,9 +201,7 @@ void CreateMainDiabloMenu()
DiabloImageLoaded = 1;
}
// font = FC_CreateFont();
// FC_LoadFont(font, renderer, "C:/Users/Krash/Desktop/devilutionX/fonts/Exocet.ttf", 40, FC_MakeColor(112, 106,
// 70, 255), TTF_STYLE_NORMAL);
// get the width of a frame by dividing with 4
textureRect.w /= totalFrames;
@ -201,8 +245,7 @@ void RenderDiabloLogo()
// SDL_RenderCopy(renderer, MainMenuItemsTexture, &MainMenuItemsWRect, &MainMenuItemsTRect);
}
int FontLoaded = 0;
FC_Font *Subfont = FC_CreateFont();
void SDL_RenderDiabloMainPage()
{
@ -259,8 +302,7 @@ void SDL_RenderDiabloMainPage()
printf("LoadFont\n\n");
FontLoaded = 1;
}
FC_Draw(Subfont, renderer, 10, SCREEN_HEIGHT - 40,
"DedicaTed To David Brevik, Erich Schaefer, Max Schaefer, MaTT Uelman and");
FC_Draw(Subfont, renderer, 10, SCREEN_HEIGHT - 40, "DedicaTed To David Brevik, Erich Schaefer, Max Schaefer, MaTT Uelman and");
FC_Draw(Subfont, renderer, 10, SCREEN_HEIGHT - 25, "The Blizzard North Team ThaT Gave Us A Childhood.");
SDL_RenderPresent(renderer);
@ -268,13 +310,16 @@ void SDL_RenderDiabloMainPage()
void CreateNewHeroClickBox() {}
void LoadSinglePlayerMenuItems()
{
CreateNewHeroClickBox();
GetWorkingLocationOfFile("/Xresources/MenuSelectNewHero.png");
SDL_Surface *MenuSelectNewHeroSurface = IMG_Load(gLDirectory);
MenuSelectNewHeroSurface = IMG_Load(gLDirectory);
MenuSelectNewHeroTexture = SDL_CreateTextureFromSurface(renderer, MenuSelectNewHeroSurface);
SinglePlayerMenuItemsLoaded = 1;
}
@ -298,12 +343,6 @@ void SDL_RenderDiabloSinglePlayerPage()
LoadSinglePlayerMenuItems();
}
/*
X 520 , Y 454
X 615 , Y 471
*/
SinglePlayerMenuCancelBox.x = 520;
SinglePlayerMenuCancelBox.y = 454;
SinglePlayerMenuCancelBox.w = 640;
@ -421,19 +460,17 @@ void RenderCharNames()
SDL_RenderPresent(renderer);
}
bool LoadCreateHeroDialogImages = 0;
SDL_Texture * CreateHeroDialogTextureW;
SDL_Texture * CreateHeroDialogTextureR;
SDL_Texture * CreateHeroDialogTextureS;
bool SorcerorCreateSelected = 0;
bool RogueCreateSelected = 0;
bool WarriorCreateSelected = 1;
bool LoadCreateHeroDialogImages = 0;
bool SorcerorCreateSelected = 0;
bool RogueCreateSelected = 0;
bool WarriorCreateSelected = 1;
void LoadCreateHeroDialogMenu(){
GetWorkingLocationOfFile("/Xresources/warriorcreate.bmp");
SDL_Surface *CreateHeroDialogSurface = IMG_Load(gLDirectory);
CreateHeroDialogSurface = IMG_Load(gLDirectory);
CreateHeroDialogTextureW = SDL_CreateTextureFromSurface(renderer, CreateHeroDialogSurface);
GetWorkingLocationOfFile("/Xresources/roguecreate.bmp");

2
Stub/storm.cpp

@ -133,7 +133,7 @@ BOOL STORMAPI SFileOpenFile(const char *filename, HANDLE *phFile)
}
if (!result || !*phFile) {
eprintf("%s: Not found: %s\n", __FUNCTION__, filename);
/*eprintf("%s: Not found: %s\n", __FUNCTION__, filename);*/
}
return result;
}

2
Stub/stubs.h

@ -18,7 +18,7 @@
abort(); \
}
#define DUMMY() eprintf("DUMMY: %s @ %s:%d\n", __FUNCTION__, __FILE__, __LINE__)
#define DUMMY() /*eprintf("DUMMY: %s @ %s:%d\n", __FUNCTION__, __FILE__, __LINE__)*/
#define DUMMY_ONCE() \
{ \

Loading…
Cancel
Save