forked from diasurgical/devilution
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainmenu.cpp
More file actions
188 lines (169 loc) · 3.67 KB
/
mainmenu.cpp
File metadata and controls
188 lines (169 loc) · 3.67 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
//HEADER_GOES_HERE
#include "../types.h"
int mainmenu_cpp_init_value; // weak
char chr_name_str[16];
const int mainmenu_inf = 0x7F800000; // weak
/* data */
int menu_music_track_id = 5; // idb
struct mainmenu_cpp_init
{
mainmenu_cpp_init()
{
mainmenu_cpp_init_value = mainmenu_inf;
}
} _mainmenu_cpp_init;
// 47F074: using guessed type int mainmenu_inf;
// 646CE0: using guessed type int mainmenu_cpp_init_value;
void __cdecl mainmenu_refresh_music()
{
int v0; // eax
music_start(menu_music_track_id);
v0 = menu_music_track_id;
do
{
if ( ++v0 == 6 )
v0 = 0;
}
while ( !v0 || v0 == 1 );
menu_music_track_id = v0;
}
void __stdcall mainmenu_create_hero(char *a1, char *a2)
{
// char *v2; // [esp-14h] [ebp-14h]
if ( UiValidPlayerName(a1) ) /* v2 */
pfile_create_save_file(a1, a2);
}
int __stdcall mainmenu_select_hero_dialog(int u1, int u2, int u3, int u4, int mode, char *cname, int clen, char *cdesc, int cdlen, int *multi) /* fix args */
{
int v10; // eax
int a6; // [esp+8h] [ebp-8h]
int a5; // [esp+Ch] [ebp-4h]
a6 = 1;
a5 = 0;
if ( gbMaxPlayers == 1 )
{
if ( !UiSelHeroSingDialog(
pfile_ui_set_hero_infos,
pfile_ui_save_create,
pfile_delete_save,
pfile_ui_set_class_stats,
&a5,
chr_name_str,
&gnDifficulty) )
TermMsg("Unable to display SelHeroSing");
if ( a5 == 2 )
{
dword_5256E8 = 1;
goto LABEL_6;
}
dword_5256E8 = 0;
}
else if ( !UiSelHeroMultDialog(
pfile_ui_set_hero_infos,
pfile_ui_save_create,
pfile_delete_save,
pfile_ui_set_class_stats,
&a5,
&a6,
chr_name_str) )
{
TermMsg("Can't load multiplayer dialog");
}
if ( a5 == 4 )
{
SErrSetLastError(1223);
return 0;
}
LABEL_6:
pfile_create_player_description(cdesc, cdlen);
if ( multi )
{
if ( mode == 'BNET' )
v10 = a6 || !plr[myplr].pBattleNet;
else
v10 = a6;
*multi = v10;
}
if ( cname )
{
if ( clen )
SStrCopy(cname, chr_name_str, clen);
}
return 1;
}
// 5256E8: using guessed type int dword_5256E8;
// 679660: using guessed type char gbMaxPlayers;
void __fastcall mainmenu_action(int option)
{
int v1; // eax
int a2; // [esp+0h] [ebp-4h]
a2 = option;
mainmenu_refresh_music();
do
{
while ( 1 )
{
a2 = 0;
if ( !UiMainMenuDialog("Diablo v1.09", &a2, effects_play_sound, 30) )
TermMsg("Unable to display mainmenu");
if ( a2 == 1 )
break;
switch ( a2 )
{
case MAINMENU_MULTIPLAYER:
v1 = mainmenu_multi_player();
goto LABEL_15;
case MAINMENU_REPLAY_INTRO:
goto LABEL_10;
case MAINMENU_SHOW_CREDITS:
UiCreditsDialog(16);
break;
case MAINMENU_EXIT_DIABLO:
goto LABEL_16;
case MAINMENU_ATTRACT_MODE:
LABEL_10:
if ( gbActive )
mainmenu_play_intro();
break;
}
}
v1 = mainmenu_single_player();
LABEL_15:
;
}
while ( v1 );
LABEL_16:
music_stop();
}
// 634980: using guessed type int gbActive;
int __cdecl mainmenu_single_player()
{
gbMaxPlayers = 1;
return mainmenu_init_menu(1);
}
// 679660: using guessed type char gbMaxPlayers;
int __fastcall mainmenu_init_menu(int a1)
{
int v1; // esi
int v3; // esi
v1 = a1;
if ( a1 == 4 )
return 1;
music_stop();
v3 = diablo_init_menu(v1 != 2, v1 != 3);
if ( v3 )
mainmenu_refresh_music();
return v3;
}
int __cdecl mainmenu_multi_player()
{
gbMaxPlayers = 4;
return mainmenu_init_menu(3);
}
// 679660: using guessed type char gbMaxPlayers;
void __cdecl mainmenu_play_intro()
{
music_stop();
play_movie("gendata\\diablo1.smk", 1);
mainmenu_refresh_music();
}