forked from LemonHaze420/UEFAStriker96
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPRESET.C
308 lines (218 loc) · 6.84 KB
/
PRESET.C
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
/****************************************************
* *
* *
* Stadium select ( from icon wheel ) *
* *
* *
****************************************************/
#include "incs.h"
#ifdef PSX
#include "sprite.h"
#include "frontend.h"
#include "gadget.h"
#include "font.h"
#include "pad.h"
#include "anim.def"
#include "shell.h"
#include "options.h"
#include "teamsel.h"
#include "memcard.h"
#include "hwcard.h"
#include "config.h"
#endif
/****************************************************
* *
* Defines *
* *
****************************************************/
/****************************************************
* *
* Structs *
* *
****************************************************/
/****************************************************
* *
* Prototypes *
* *
****************************************************/
/****************************************************
* *
* Vars *
* *
****************************************************/
BYTE *preset_buffer;
BYTE *preset_button_name[]={
"Preset",
};
//Button_gadget preset_button;
Rdb_gadget preset_rdb[2];
BYTE *textline;
WORD preset_y_gap_store;
UWORD preset_buts[]= { SHELL_NEXT, SHELL_QUIT, 0 };
UWORD preset_save_buts[]= { SHELL_YES, SHELL_NO, 0 };
WORD pr_current_preset;
WORD pr_yes_no_req_list[]= { SHELL_YES, SHELL_NO, 0 };
void init_preset_once()
{
WORD cnt;
for ( cnt=0;cnt<TOTAL_PRESETS;cnt++ )
{
config->preset_data[ cnt ].init = NO;
}
}
void init_preset_bootup()
{
pr_current_preset=0;
}
void init_preset()
{
WORD cnt,y;
push(0);
preset_buffer = allocate_mem( 0,2048 );
textline = allocate_mem( 0,256 );
//*** Adjust y gap size ****
preset_y_gap_store = resident_fonts[MILFORD_FONT]->font_data->y_gap_size;
resident_fonts[MILFORD_FONT]->font_data->y_gap_size = 28*2;
set_rdb_gadget( 0, &preset_rdb[0], -472, -332, 472*2, 504, -1 );
set_rdb_gadget( 0, &preset_rdb[1], -160, 216-16, 324, 60, 0 );
if ( share->game_type == FRIENDLY_SAVE )
{
shell->force_master_option_active_off = YES; /** Dont start on bottom buttons **/
set_shell_bottom_buttons( preset_save_buts, 0 );
set_title_lolly( preset_save_lolly_text[config->language], game_types_text[ config->language ][ share->game_type ] );
}
else
{
set_shell_bottom_buttons( preset_buts,-1 );
set_title_lolly( preset_choose_lolly_text[config->language], game_types_text[ config->language ][ share->game_type ] );
/** Point preset to 1st initialised preset **/
pr_current_preset=0;
for(cnt=0;cnt<8;cnt++)
{
if ( config->preset_data[ cnt ].init == YES )
{
pr_current_preset = cnt;
break;
}
}
}
}
void update_preset()
{
WORD cnt;
BYTE *text, *text1, *text2;
WORD option;
WORD y;
BYTE *ptr;
modify_current_item ( 1 );
if ( shell->master_option_active == NO )
{
modify_word( &pr_current_preset , 0,7 );
}
//** Print 1st preset team **
if ( config->preset_data[ pr_current_preset ].init == NO )
{
shell->disable_button[ SHELL_NEXT ] = YES; // can't exit this screen if user choose an empty slot
}
else
shell->disable_button[ SHELL_NEXT ] = NO;
cnt=0;
if ( config->preset_data[ pr_current_preset ].init )
{
text1 = get_team_name( config->preset_data[ pr_current_preset ].teams[ 0 ]);
text2 = get_team_name( config->preset_data[ pr_current_preset ].teams[ 1 ]);
sprintf ( preset_buffer, "%s vs %s\n",text1,text2 );
}
else
sprintf( preset_buffer, "\n\n\n\n%s", empty_text[ config->language ] );
//*** Print team names ***
add_text_string ( tslot_poses[MAIN_TSLOT]+TOTAL_PRESETS+cnt , preset_buffer , MILFORD_FONT, milford_font_logic, 0, -336, FONT_XC, -2, 0, 8,32,0 );
preset_buffer[0]=0;
cnt=2;
for ( y=0; y< TOTAL_OPTIONS; y++ )
{
if ( config->preset_data[ pr_current_preset ].init )
{
option = config->preset_data[ pr_current_preset ].option_preset[ y ];
text1 = opt_txts[config->language][y];
text2 = *((opt_button_content_lists[y])+option);
/** Copy option description, ignoring Newline \n **/
ptr = text_buffer;
while( *text2 )
{
*ptr = *text2;
if ( *ptr == '\n' )
*ptr = ' ';
ptr++;
text2++;
}
*ptr=0;
sprintf( textline, "%s : %s\n",text1, text_buffer );
}
else
strcpy( textline, " " );
strcat ( preset_buffer, textline );
}
/*** Print big box of preset data ***/
add_text_string ( tslot_poses[MAIN_TSLOT]+TOTAL_PRESETS+cnt , preset_buffer , MILFORD_FONT, milford_font_logic, 0, -260, FONT_XC, -2, 0, 0,0,0 );
/*** print 'preset x ***/
sprintf( text_buffer, "%s %d", preset_button_name[config->language], pr_current_preset+1 );
add_text_string ( tslot_poses[MAIN_TSLOT]+3 , text_buffer , MILFORD_FONT, milford_font_logic, 0, 200-24, FONT_XC, 0, 0, 0,0,0 );
if ( shell->current_button == SHELL_NO )
shell->module_abort=YES;
}
void kill_preset()
{
Preset_data *pd;
WORD cnt;
shell->disable_button[ SHELL_NEXT ] = NO;
pop(0);
resident_fonts[MILFORD_FONT]->font_data->y_gap_size = preset_y_gap_store;
kill_rdb_gadget( preset_rdb[0].gadget );
kill_rdb_gadget( preset_rdb[1].gadget );
// pd = &config->preset_data[ pr_current_preset ];
// share->team1 = pd->teams[0];
// share->team2 = pd->teams[1];
if ( (share->game_type == FRIENDLY_SAVE ) && (shell->current_button == SHELL_YES ) )
{
sprintf(text_buffer, preset_save_request[config->language],pr_current_preset+1 );
if ( do_request( text_buffer, pr_yes_no_req_list, -20*4, SHELL_NO ) == SHELL_YES )
{
/** Store current friendly options in config file **/
for( cnt=0; cnt<TOTAL_OPTIONS; cnt++ )
{
config->preset_data[ pr_current_preset ].option_preset[ cnt ]=share->options_presets[ cnt ];
config->preset_data[ pr_current_preset ].init = YES;
config->preset_data[ pr_current_preset ].teams[0] = share->team1;
config->preset_data[ pr_current_preset ].teams[1] = share->team2;
config->team1_cpu = share->team1_cpu;
config->team2_cpu = share->team2_cpu;
}
}
}
if ( (share->game_type == FRIENDLY) && (shell->current_button == SHELL_NEXT) )
{
for( cnt=0; cnt<TOTAL_OPTIONS; cnt++ )
share->options_presets[ cnt ] = config->preset_data[ pr_current_preset ].option_preset[ cnt ];
share->team1 = config->preset_data[ pr_current_preset ].teams[0];
share->team2 = config->preset_data[ pr_current_preset ].teams[1];
share->team1_cpu = config->team1_cpu;
share->team2_cpu = config->team2_cpu;
}
}
void preset()
{
exec_shell( init_preset, update_preset, kill_preset );
}
WORD check_for_a_preset()
{
/** Check to see if a preset friendly is available to the user **/
WORD cnt;
for(cnt=0;cnt<TOTAL_PRESETS;cnt++)
{
if ( config->preset_data[ cnt ].init )
return YES;
}
return NO;
}