Browse Source

changing menu items

pull/18/head
aperturesecurity 7 years ago
parent
commit
a33593c05c
  1. 34
      .vscode/settings.json
  2. 2
      README.md
  3. 26
      Source/gmenu.cpp
  4. 1
      Source/gmenu.h
  5. 33
      Stub/diabloui.cpp
  6. 604
      Stub/init.cpp
  7. 2
      Stub/miniwin.h
  8. 13
      Stub/miniwin_sdl.h
  9. 1511
      Stub/sdlrender.cpp
  10. 10
      Stub/storm.cpp
  11. 1
      types.h

34
.vscode/settings.json vendored

@ -5,6 +5,38 @@
"initializer_list": "cpp",
"utility": "cpp",
"*.tcc": "cpp",
"typeinfo": "cpp"
"typeinfo": "cpp",
"deque": "cpp",
"vector": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"list": "cpp",
"unordered_map": "cpp",
"exception": "cpp",
"fstream": "cpp",
"functional": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"ostream": "cpp",
"numeric": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"system_error": "cpp",
"cinttypes": "cpp",
"type_traits": "cpp",
"tuple": "cpp",
"algorithm": "cpp"
}
}

2
README.md

@ -65,7 +65,7 @@ set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_tt
Copy the "diablodat.mpq" from your Diablo CD to the Diablo Directory and make sure it is LOWERCASE.
Copy the Xresources and fonts file to your Diablo Directory.
COPY THE *prealpha.mpq* from this directory TO YOUR DIABLO DIRECTORY.
Keep in mind please that this is still being worked on and is missing parts of UI and SoundEffects are not properly playing now.

26
Source/gmenu.cpp

@ -21,6 +21,10 @@ void *pPentSmall;
void *pTitlqtxtCel;
void *pDiabfrCel;
void *BigTGold_cel;
//int gb_Lfont_pix_width;
//int gb_Lfont_str_len;
int gdwLogoWidth;
int gdwLogoHeight;
void *pPcxLogoImage;
@ -61,6 +65,10 @@ void *pPcxFont3Image;
unsigned char *pFont3;
void *GameTitle;
int GameTitleHeight;
int GameTitleWidth;
#endif
@ -100,6 +108,7 @@ void __cdecl gmenu_draw_pause()
}
// 69BEF8: using guessed type int light_table_index;
PALETTEENTRY pcxPal[256];
void __fastcall LoadPalInMem(PALETTEENTRY *pPal)
@ -149,6 +158,10 @@ BOOL __cdecl LoadArtWithPal(char *pszFile, void **pBuffer, int frames, DWORD *da
return 0;
LoadPalInMem(pcxPal);
// lpDDPalette->SetEntries(0, 0, 256, orig_palette);
if (pBuffer && data)
@ -373,9 +386,12 @@ 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];
// LoadArtImage("ui_art\\cursor.pcx", &pPcxCursorImage, 1, dwData);
// gdwCursorWidth = dwData[0];
// gdwCursorHeight = dwData[1];
// printf("%d\n",gdwCursorWidth);
LoadArtWithPal("ui_art\\mainmenu.pcx", &pPcxTitleImage, 1, dwData);
gdwTitleWidth = dwData[0];
@ -416,6 +432,10 @@ void __cdecl gmenu_init_menu()
gdwFont3Height = dwData[1];
pFont3 = LoadFileInMem("ui_art\\font16.bin", 0);
//pPcxCursorImage = LoadFileInMem("data\\inv\\objcurs.cel",0);
GameTitle= LoadFileInMem("Gendata\\Diabfr.CEL",0);
sgpLogo = LoadFileInMem("Data\\Diabsmal.CEL", 0);
BigTGold_cel = LoadFileInMem("Data\\BigTGold.CEL", 0);
PentSpin_cel = LoadFileInMem("Data\\PentSpin.CEL", 0);

1
Source/gmenu.h

@ -7,6 +7,7 @@ extern bool byte_634464; // weak
extern void *PentSpin_cel;
extern TMenuItem *sgpCurrItem;
extern void *BigTGold_cel;
extern void *GameTitle;
extern int dword_634474; // weak
extern char byte_634478; // weak
extern void (__cdecl *dword_63447C)();

33
Stub/diabloui.cpp

@ -37,24 +37,33 @@ BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf
hero_infos.clear();
fninfo(&ui_add_hero_info);
if (CreateSinglePlayerChar) {
const char *test_name = HeroUndecidedName;
DUMMY_PRINT("create hero: %s", test_name);
strcpy(name, test_name);
_uiheroinfo hero_info = {1 };
strcpy(hero_info.name, test_name);
hero_info.heroclass = HeroChosen;
fncreate(&hero_info);
}
// If a hero is available, load it, otherwise create a new one
if (!hero_infos.empty()) {
//if (!hero_infos.empty()) {
else {
const char *hero_name = chr_name_str;
DUMMY_PRINT("use hero: %s", hero_name);
strcpy(name, hero_name);
*dlgresult = 2;
} else {
const char *test_name = "tester";
DUMMY_PRINT("create hero: %s", test_name);
strcpy(name, test_name);
_uiheroinfo hero_info = {0};
strcpy(hero_info.name, test_name);
hero_info.heroclass = PC_SORCERER;
fncreate(&hero_info);
}
return TRUE;

604
Stub/init.cpp

@ -16,6 +16,9 @@ int gbActive;
char gszVersionNumber[260];
char gszProductName[260];
char HeroUndecidedName[17] = {0};
bool CreateSinglePlayerChar;
int HeroChosen = 0;
/**
* Case insensitive search for a file name in a directory.
@ -45,7 +48,9 @@ static std::string find_file_in_std_directories(const char *file)
{
for (auto dir : {".", "..", "../.."}) {
auto path = find_file_in_directory(dir, file);
if (!path.empty()) {
printf("%s \n", path.c_str());
return path;
}
}
@ -90,7 +95,7 @@ void __cdecl init_archives()
SFileOpenArchive(find_file_in_std_directories("patch_rt.mpq").c_str(), 1000, 0, &patch_rt_mpq);
assert(patch_rt_mpq);
// I don' think this works, like I would intend.
SFileOpenArchive(find_file_in_std_directories("prealpha.mpq").c_str(), 1000, 0, &prealpha_mpq);
assert(prealpha_mpq);
}
@ -117,6 +122,7 @@ void LoadCharNamesintoMemory(int start, int end)
if (CharFile) {
if (pfile_read_hero(CharFile, &pkplr)) {
strcpy(p_hero_names, pkplr.pName);
printf("Player Strength %d\n", (int)pkplr.pBaseStr);
UnPackPlayer(&pkplr, 0, 0);
pfile_archive_contains_game(CharFile);
}
@ -150,349 +156,387 @@ void SDL_Diablo_UI() // I anticipate to move this later.
music_start(5);
signed int NewHeroNameIndex = 0;
int menu = 0;
SDL_Event event;
int x, y;
bool quit = false;
int CharsLoaded = 0;
int HeroPortrait = 3;
printf("Main Menu Init\n");
// SDL_ShowCursor(SDL_DISABLE);//Doesn't really work... Use HideCursor() instead.
SdlDiabloMainWindow();
ClearScreenBuffer();
LoadPalette("Levels\\L3Data\\L3pwater.pal");
// LoadPalette("Gendata\\Cutstart.pal"); // Doesn't exist.??
//LoadPalette("gendata\\charscrn.pal"); // Uncomenting this fixes the the PCXs...
LoadPalette("Gendata\\Title.pal");
const Uint8 *state = SDL_GetKeyboardState(NULL);
// static std::deque<MSG> message_queue;
while (1 && quit == false) {
DrawMouse();
// DrawMouse();
PaletteFadeIn(8);
if (menu == 0) {
// CreateMainDiabloMenu();
SDL_RenderDiabloMainPage();
DrawMouse();
// sdl_present_surface();
}
if (menu == 2) {
if (CharsLoaded == 0) {
LoadCharNamesintoMemory(0, 2);
LoadCharNamesintoMemory(0, 7);
// LoadHeroStats();
CharsLoaded = 1;
}
SDL_RenderDiabloSinglePlayerPage();
gbMaxPlayers = 1;
DrawMouse(); // Not accurate for some reason. It adds too much and I am not sure why.
ConstantButtons();
}
if (menu == 3) {
// HeroPortrait = 3;
CreateHeroMenu();
CreateMenuDialogBox();
DrawNewHeroKartinka(HeroPortrait, 1);
ConstantButtons();
DrawMouse();
}
int m4Loaded = 0;
if (menu == 4) {
SDL_RenderDiabloSinglePlayerPage();
if (event.type == SDL_KEYDOWN && NewHeroNameIndex < 17) {
/*put stuff*/
}
DrawNewHeroKartinka(HeroPortrait, 0);
RenderDefaultStats(HeroPortrait);
RenderUndecidedHeroName();
ConstantButtons();
DrawMouse();
}
if (menu == 10) {
ShowCredts();
}
if (SDL_PollEvent(&event)) {
// DrawMouse(); //Doesn't work yet ; Too slow.
if (SDL_PollEvent(&event)) { // Technically if this is a while look then it would probably work fine...
// but my code above wouldnt escape
switch (event.type) {
case SDL_KEYDOWN:
printf("Key press detected\n");
switch( event.key.keysym.sym ){
case SDLK_ESCAPE:
menu = 0;
break;
switch (event.key.keysym.sym) {
case SDLK_ESCAPE:
menu = 0;
break;
case SDLK_BACKSPACE:
if (NewHeroNameIndex > 0) {
HeroUndecidedName[NewHeroNameIndex - 1] = 0;
--NewHeroNameIndex;
}
break;
case SDLK_RETURN:
default:
char letter = event.key.keysym.sym; // This is just a way to ensure alpha keys are pressed only
//printf("%d", event.key.keysym.sym);
if (int(letter) > 96 && int(letter) < 123 || int(letter) == 32)
if (NewHeroNameIndex < 17) {
HeroUndecidedName[NewHeroNameIndex] = letter;
NewHeroNameIndex++;
// printf("%s\n ", HeroUndecidedName);
}
break;
}
break;
case SDL_KEYUP:
printf("Key release detected\n");
//printf("Key release detected\n");
break;
default:
// printf("%c", event.key.keysym.sym);
break;
}
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);
if (event.type == SDL_QUIT) {
// }
// 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");
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);
// 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);
// 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);
// FreeMenuItems();
break;
// XStartGame();
}
quit = true;
SDL_Quit();
exit(0); // SDL quit doesn't always work.
}
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");
if (event.type == SDL_MOUSEMOTION) {
// Get the mouse offsets
x = event.motion.x;
y = event.motion.y;
MouseX = x;
MouseY = y;
}
menu = 0;
}
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 (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");
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) { // 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;
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
strcpy(chr_name_str, hero_names[0]);
printf("Player %s\n", chr_name_str);
break;
}
if (TotalPlayers >= 2 && (x > ClickListStart) && (y > ClickListStart + (sizeOfBox)) &&
(x < ClickListStart + WidthOfBox) &&
(y < ClickListStart + (sizeOfBox) + sizeOfBox)) { // MultiBox clicked
printf("Player 2 Diablo\n");
strcpy(chr_name_str, hero_names[1]);
printf("Player %s\n", chr_name_str);
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);
break;
}
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);
break;
}
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;
}
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;
}
if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) &&
(y < CreateHeroCancelBox.h)) {
HeroPortrait = 3;
printf("Cancel\n\n\n");
menu = 0;
}
if ((x > CreateHeroX) && (y > CreateHeroY) && (x < CreateHeroX + WidthOfBox) &&
(y < CreateHeroY + sizeOfBox)) {
printf("Clicked Create Hero Box\n");
menu = 3;
}
}
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 (menu == 3) {
// SinglePlayerMenuItemsLoaded = 0;
printf("\n\nmenu3 X%d Y%d \n ", x, y);
int WarriorSelectBoxY = 430;
int WarriorSelectBoxW = 100;
int WarriorSelectBoxS = 100;
int RogueSelectBoxX = 450;
int RogueSelectBoxY = 392;
int SorcerorSelectBoxX = 383;
int SorcerorSelectBoxY = 365;
int CreateHeroOkBoxX = 330;
int CreateHeroOkBoxY = 441;
int CreateHeroCanBBoxX = 445;
int CreateHeroCanBBoxY = 473;
SDL_Rect WarriorSelectBox;
WarriorSelectBox.y = 350;
WarriorSelectBox.x = 450;
WarriorSelectBox.w = WarriorSelectBox.x + 100;
WarriorSelectBox.h = WarriorSelectBox.y + 30;
SDL_Rect RogueSelectBox;
RogueSelectBox.y = 392;
RogueSelectBox.x = 450;
RogueSelectBox.w = RogueSelectBox.x + 100;
RogueSelectBox.h = RogueSelectBox.y + 30;
// X450 Y 392 ;
SDL_Rect SorcerorSelectBox;
SorcerorSelectBox.y = 428;
SorcerorSelectBox.x = 450;
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)) {
printf(" warrior I was hit\n\n\n");
HeroPortrait = 0;
HeroChosen = 0;
menu = 4;
}
if ((x > RogueSelectBox.x) && (y > RogueSelectBox.y) && (x < RogueSelectBox.w) &&
(y < RogueSelectBox.h)) {
printf(" rogue I was hit\n\n\n");
HeroPortrait = 1;
HeroChosen = 1;
menu = 4;
}
if ((x > SorcerorSelectBox.x) && (y > SorcerorSelectBox.y) && (x < SorcerorSelectBox.w) &&
(y < SorcerorSelectBox.h)) {
HeroPortrait = 2;
printf("sorceror I was hit\n\n\n");
HeroChosen = 2;
menu = 4;
}
if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) &&
(y < CreateHeroCancelBox.h)) {
HeroPortrait = 3;
printf("Cancel\n\n\n");
--menu;
}
}
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;
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;
// X 549 , Y 551
SDL_Rect ClickOkBox;
ClickOkBox.y = 550;
ClickOkBox.x = 550;
ClickOkBox.w = ClickOkBox.x + 30;
ClickOkBox.h = ClickOkBox.y + 30;
if ((x > CreateHeroCancelBox.x) && (y > CreateHeroCancelBox.y) && (x < CreateHeroCancelBox.w) &&
(y < CreateHeroCancelBox.h)) {
memset(HeroUndecidedName, 0, 17);
printf("Cancel\n\n\n");
HeroPortrait = 3;
menu = 3;
}
if ((x > ClickOkBox.x) && (y > ClickOkBox.y) && (x < ClickOkBox.w) && (y < ClickOkBox.h)) {
printf("Ok\n");
CreateSinglePlayerChar = 1;
const char *test_name = HeroUndecidedName;
printf("%s\n", test_name);
break;
}
}
}
}
}
}
}
}

2
Stub/miniwin.h

@ -44,6 +44,8 @@
#define VOID void
extern void *prealpha_mpq;
typedef char CHAR;
typedef uint16_t SHORT;
typedef int32_t LONG;

13
Stub/miniwin_sdl.h

@ -106,7 +106,9 @@ extern int gdwFont3Height;
extern void *pPcxFont3Image;
extern unsigned char *pFont3;
extern char HeroUndecidedName[17];
extern bool CreateSinglePlayerChar;
extern int HeroChosen;
//Menu2 // Single player menu rects
//extern static std::vector<_uiheroinfo> hero_infos;
@ -126,9 +128,12 @@ void SDL_Diablo_UI();
void FreeMenuItems();
void DrawMouse();
void DrawCursor(int mx, int my);
void CreateHeroMenu();
void DrawNewHeroKartinka(int image , int ShowClasses);
void ConstantButtons();
void RenderUndecidedHeroName();
void LoadHeroStats();
void RenderDefaultStats(int HeroChosen);
typedef unsigned char BYTE;
void DrawArtWithMask(int SX, int SY, int SW, int SH, int nFrame, BYTE bMask, void *pBuffer);

1511
Stub/sdlrender.cpp

File diff suppressed because it is too large Load Diff

10
Stub/storm.cpp

@ -126,10 +126,18 @@ BOOL STORMAPI SFileOpenFile(const char *filename, HANDLE *phFile)
{
BOOL result;
//eprintf("%s: %s\n", __FUNCTION__, filename);
result = SFileOpenFileEx((HANDLE)patch_rt_mpq, filename, 0, phFile);
if (!result) {
result = SFileOpenFileEx((HANDLE)diabdat_mpq, filename, 0, phFile);
result = SFileOpenFileEx((HANDLE)prealpha_mpq, filename, 0, phFile);
if(!result){
result = SFileOpenFileEx((HANDLE)diabdat_mpq, filename, 0, phFile);
}
}
if (!result || !*phFile) {

1
types.h

@ -9,6 +9,7 @@
#ifdef MINIWIN
#include "miniwin.h"
#else
#define WIN32_LEAN_AND_MEAN

Loading…
Cancel
Save