forked from LemonHaze420/UEFAStriker96
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOLDTEMED.C
1772 lines (1209 loc) · 36.8 KB
/
OLDTEMED.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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/****************************************************
* *
* *
* Team and player edit *
* *
* *
****************************************************/
#include "incs.h"
#ifdef PSX
#include "\global\s01.h"
#include "sprite.h"
#include "frontend.h"
#include "gadget.h"
#include "shell.h"
#include "pad.h"
#include "anim.def"
#include "font.h"
#include "hardware.h"
#include "render.h"
#include "datafile.h"
#include "skindraw.h"
#include "sod.h"
#include "scene.h"
#include "anim.h"
#include "..\..\striker\frontend\mod.def"
#include "text.h"
#include "entname.h"
#endif
void show_selected_swatch();
void draw_skin_player();
LONG sfx_handle;
BYTE pl_ed_text_buffer[64];
UWORD pl_ed_shell_buttons[]={ SHELL_PREV,SHELL_TE_ED, 0};
UWORD te_ed_shell_buttons[]={ SHELL_PREV,SHELL_PL_ED, 0};
WORD te_old_ci;
/****************************************************
* *
* Defines *
* *
****************************************************/
#define PLAYER_EDITOR 0
#define TEAM_EDITOR 1
#define NORMAL_PLAYER 0
#define GOALKEEPER 1 // MUST BE = 1 !!!!!!!!!
#define MAX_PL_FACE_TSIZE 120000 // player edit face/hair/facehair textures was 200000
#define MAX_TE_STRIP_TSIZE 126000 // team strip textures
#define MAX_TE_PL_NUMS_TSIZE 46000 // num textures for back of shirt
#define TE_YM (8*4)
#define FACES_PER_SKIN 6
#define FACE_TSIZE (32*64) // size of face texture
#define HAIR_TSIZE (32*64) // size of head hair texture
#define FACE_HAIR_TSIZE (32*64) // size of head hair texture
#define SHIRT_NUM_TSIZE (32*64) // size of shirt digit texture
#define HEAD_HAIRS 12
#define FACE_HAIRS 10
#define FACE_TSTART 0
#define HAIR_TSTART (FACE_TSTART + (FACE_TSIZE*6*FACES_PER_SKIN))
#define FACE_HAIR_TSTART (HAIR_TSTART + (HAIR_TSIZE*HEAD_HAIRS))
#define THIGH_TSTART (FACE_HAIR_TSTART + (FACE_HAIR_TSIZE*10))
#define TE_TOTAL_SHIRTS 16 // including goalkeeper shirts
#define TE_SHIRTS 12
#define TE_SHORTS 5
#define TE_SOCKS 5
#define TE_SLEEVES 5
#define SHIRT_FSIZE (52*64)
#define SHIRT_BSIZE (32*64)
#define SLEEVE_SIZE (32*32)
#define SHORT_SIZE (48*64)
#define SOCK_SIZE (32*32)
#define SHIRT_FSTART 0
#define SHIRT_BSTART ( TE_TOTAL_SHIRTS * SHIRT_FSIZE)
#define ARM_TEX_SIZE ( 44*64 )
#define GOALIE_SHIRT_FSTART (SHIRT_FSTART + (SHIRT_FSIZE*TE_SHIRTS ))
#define GOALIE_SHIRT_BSTART (SHIRT_BSTART + (SHIRT_BSIZE*TE_SHIRTS ))
#define SLEEVE_START SHIRT_BSTART + ( TE_TOTAL_SHIRTS * SHIRT_BSIZE)
#define SHORT_START SLEEVE_START + ( TE_SLEEVES * SLEEVE_SIZE)
#define SOCK_START SHORT_START + ( TE_SHORTS * SHORT_SIZE)
#define GOALIE_SLEEVE_START SOCK_START + ( TE_SOCKS * SOCK_SIZE )
//** textures for player from 'PLAYER_FACE_TEXTURES' file
#define Face_pals (0*128) // used on face only
#define Hair_pals (6*128)
#define Skin_pals (15*128) // used on arms and legs
/****************************************************
* *
* Structs *
* *
****************************************************/
/****************************************************
* *
* Prototypes *
* *
****************************************************/
void glow_upd( Sprite *sprite );
void control_team_edit_crsr();
void do_bloke_shadow();
void kill_player_edit();
void update_player_textures( WORD editor );
void kill_team_edit();
void update_te_ed_name();
void update_pl_ed_number();
void pl_ed_select();
void update_kit_textures();
WORD set_te_player_type();
void update_home_team_tv_kit();
void update_away_team_tv_kit();
void download_kit_to_vram( WORD team );
void scale_vector( VECTOR *sv1, VECTOR *sv2, VECTOR *dest_sv, WORD percent );
void scale_svector( SVECTOR *sv1, SVECTOR *sv2, SVECTOR *dest_sv, WORD percent );
void set_ed_zoom_pos();
void set_te_clip_sprites();
void kill_te_clip_sprites();
/****************************************************
* *
* Vars *
* *
****************************************************/
WORD shirt_num, shirt_color1, shirt_color2;
WORD short_num, short_color1, short_color2;
WORD sock_num, sock_color1, sock_color2;
WORD sleeve_num, sleeve_color1, sleeve_color2;
WORD skin_num, face_num, hair_num, hair_color, face_hair_num, shirt_digit, boot_color;
WORD call_enter_name;
WORD te_anim_timer;
WORD pl_ed_current_player;
WORD pl_ed_current_team;
WORD te_player_type,te_player_type_store;
Skin_obj sk_obj;
Skin_header_src *sk_header_src;
//Textstring_gadget pl_ed_ts_gad;
WORD player_tex_update;
//BYTE pl_ed_name_buffer[64];
WORD te_clip_sprites_active = YES;
Rdb_gadget pl_ed_rdbs[9];
VECTOR man_pos1,man_pos2;
SVECTOR man_rot1, man_rot2;
WORD ed_zoom_pos;
Sprite *te_clip_sp1;
Sprite *te_clip_sp2;
Sprite *bloke_spr;
RECT te_clip_rect={ 340,40,140,153 };
BYTE *te_ed_player_name_ptr;
Sprite *glow_spr;
UBYTE *pl_ed_pal_bank;
UBYTE *pl_textures, *pl_textures_pak;
UBYTE *pl_num_textures, *pl_num_textures_pak;
UBYTE *te_textures, *te_textures_pak;
UBYTE *te_pal_bank;
UBYTE *te_pals;
WORD pl_ed_old_item;
void init_player_edit_bootup()
{
BYTE *byte_addr;
LONG lcnt;
//** called every time frontend is booted **
call_enter_name=NO;
face_num = face_hair_num = skin_num = hair_num = boot_color = hair_color = -1;
pl_ed_current_player = 0;
pl_ed_current_team = 0;
pl_textures_pak = (UBYTE *)read_datafile_alloc( PLAYER_TEXTURES );
pl_ed_pal_bank = (UBYTE *)read_datafile_alloc( PLAYER_EDIT_PAL_BANK );
pl_num_textures_pak = (UBYTE *)read_datafile_alloc( PLAYER_EDIT_NUMS );
//*** Setup skinned player, but don't make visible ***
load_skin_file( PLAYER_TEST_SKD, &sk_obj ); /** Load file and set up sk_obj struct **/
sk_obj.active=NO;
sk_obj.pos2.vz = -150;
// bloke zoomed up position
man_pos1.vx = 1100;
man_pos1.vy = 3000;
man_pos1.vz = 2000;
man_rot1.vx = 0;
man_rot1.vy = 2500;
man_rot1.vz = 0;
man_pos1.vx = 1200;
man_pos1.vy = 3000;
man_pos1.vz = 2000;
man_rot1.vx = 0;
man_rot1.vy = 300;
man_rot1.vz = 0;
//bloke normal position
man_pos2.vx = 4000; // normal sized bloke
man_pos2.vy = 1600;
man_pos2.vz = 7500;
man_rot2.vx = 0;
man_rot2.vy = 0;
man_rot2.vz = 0;
ed_zoom_pos = 100;
}
void init_player_edit_once()
{
//** called ONCE only... **
WORD player,team;
Player_detail *pl;
pl_ed_current_player = 0;
pl_ed_current_team = 0;
for ( team=0;team<MAX_USER_TEAMS;team++ )
{
for ( player=0;player<MAX_USER_PLAYERS_PER_TEAM;player++ )
{
config->player_detail[ team ] [ player ] = custom_players[team][player];
}
}
te_player_type = set_te_player_type();
// player_tex_update=YES;
// update_kit_textures();
}
void init_player_edit()
{
WORD cnt;
SOD *sod;
Player_detail *pl;
WORD x,y;
Gadget *gad;
ed_zoom_pos = 100;
te_player_type_store = te_player_type; // STORE this var ( restore at kill_player_edit )
te_player_type = set_te_player_type(); // goalie or normal player
//** called every time player edit is selected from wheel **
te_clip_sprites_active = NO;
/** UNPACK textures to ram **/
// push(0);
pl_textures = allocate_mem( 0, MAX_PL_FACE_TSIZE ); // alloc 200k
unpropak( pl_textures_pak, pl_textures );
te_textures = allocate_mem( 0, MAX_TE_STRIP_TSIZE ); // alloc 100k
unpropak( te_textures_pak, te_textures );
pl_num_textures = allocate_mem( 0, MAX_TE_PL_NUMS_TSIZE ); // alloc 50k
unpropak( pl_num_textures_pak, pl_num_textures );
pl = &config->player_detail[ pl_ed_current_team ][ pl_ed_current_player ];
download_kit_to_vram( pl_ed_current_team );
update_pl_ed_number();
//*** Setup Player name button ***
#if 0
y=0;
cnt=7;
set_rdb_gadget( 0, &pl_ed_rdbs[cnt], (-200+40-(548/2))-24, (-(64*4)+(y*21*4)+10)+100-92, 548,(14*4), cnt );
//*** Set up 6 buttons for face type, skin color etc ***
cnt=0;
for(y=1;y<4;y++ )
{
for(x=0;x<2;x++ )
{
set_rdb_gadget( 0, &pl_ed_rdbs[cnt], -340+( x*70*4)+40-(268/2)-24, -(65*4)+(y*21*4)+100+16-92, 268, (14*4), cnt );
cnt++;
}
}
cnt=6;
set_rdb_gadget( 0, &pl_ed_rdbs[cnt], -200+40-(548/2)-24, -(65*4)+(y*21*4)+100+16-92, 548,(14*4), cnt );
#endif
cnt=0;
gad=set_rdb_gadget( 0, &pl_ed_rdbs[0], -460, -304, 924, 572, cnt );
gad->rdb_gadget->depth = FURTHEST_DEPTH-1;
pl_ed_old_item = 4;
// Make skinned player visible...
sk_obj.active=YES;
player_tex_update = YES; // update all player's textures once
update_player_textures( PLAYER_EDITOR );
set_te_clip_sprites();
set_title_lolly( edit_player_txt[config->language] ,game_types_text[config->language][share->game_type] );
if ( call_enter_name == 0 )
set_shell_bottom_buttons( pl_ed_shell_buttons,SHELL_TE_ED );
else
{
shell->current_item = 0;
call_enter_name=NO;
}
}
void update_pl_ed_number()
{
Player_detail *pl;
te_player_type = set_te_player_type(); // goalie or normal player
pl = &config->player_detail[ pl_ed_current_team ][ pl_ed_current_player ];
if ( te_player_type == GOALKEEPER )
{
//*** print " GOALKEEPER : JOE BLOGGS" ***
sprintf(pl_ed_text_buffer, "%s : %s\n",pl_ed_player_words[te_player_type][config->language], pl->name );
}
else
{
//*** print " PLAYER x : JOE BLOGGS" ***
sprintf(pl_ed_text_buffer, "%s %d : %s\n",pl_ed_player_words[te_player_type][config->language], pl_ed_current_player+1, pl->name );
}
download_kit_to_vram( pl_ed_current_team );
}
void update_player_edit()
{
Player_detail *pl;
WORD x,y, cnt;
set_ed_zoom_pos();
te_player_type = set_te_player_type(); // goalie or normal player
pl_ed_select();
pl = &config->player_detail[ pl_ed_current_team ][ pl_ed_current_player ];
te_player_type = set_te_player_type(); // goalie or normal player
if ( shell->keyboard_active == NO )
{
if ( cjoy->c & PAD_L1 )
sk_obj.rot2.vy += 60;
if ( cjoy->c & PAD_L2 )
sk_obj.rot2.vy -= 60;
sk_obj.current_anim_frame = 259;
//*** Show team selected for player edit ***
//add_text_string ( tslot_poses[MAIN_TSLOT]+10 , te_ed_player_name_ptr, MILFORD_FONT, milford_font_logic, -320, -240, FONT_XC, -1, 0, 128, 0,0 );
update_player_textures( PLAYER_EDITOR );
/* Player name */
y=0;
cnt=7;
add_text_string ( tslot_poses[MAIN_TSLOT]+30+cnt , pl_ed_text_buffer, MILFORD_FONT, milford_font_logic, ((-96*4)+120)/2, -(65*4)+(y*21*4)+0, FONT_XC, 7, 0, 128, 0,0 );
/*** 6 buttons for face type, skin color etc ***/
cnt=0;
for(y=1;y<4;y++ )
{
for(x=0;x<2;x++ )
{
add_text_string ( tslot_poses[MAIN_TSLOT]+30+cnt , pl_ed_button_names[config->language][cnt], MILFORD_FONT, milford_font_logic, (-(170*4)+( x*140*4)+120)/2, -(65*4)+(y*21*4)+0, FONT_XC, cnt, 0, 128, 0,0 );
cnt++;
}
}
/** Boot color **/
cnt=6;
add_text_string ( tslot_poses[MAIN_TSLOT]+30+cnt , pl_ed_button_names[config->language][cnt], MILFORD_FONT, milford_font_logic, (-(170*4)+( 70*4)+120)/2, -(65*4)+(y*21*4)+0, FONT_XC, 6, 0, 128, 0,0 );
}
}
void pl_ed_select()
{
Player_detail *pl;
//*** Modify buttons ***
if ( shell->keyboard_active == NO )
{
if ( (shell->master_option_active == YES) && ( cjoy->db & PAD_UP ) )
{
sfxSpot( HIT1, 30 );
shell->current_item = 6;
shell->master_option_active = NO;
return;
}
if ( (shell->current_item == 0) || (shell->current_item == 1) )
{
if ( cjoy->db & PAD_UP )
{
sfxSpot( HIT1, 30 );
pl_ed_old_item = shell->current_item;
shell->current_item = 7;
return;
}
}
if ( (shell->current_item == 4) || (shell->current_item == 5) )
{
if ( cjoy->db & PAD_DN )
{
sfxSpot( HIT1, 30 );
pl_ed_old_item = shell->current_item;
shell->current_item = 6;
return;
}
}
if ( shell->current_item == 7 )
{
}
else
{
if ( shell->current_item <= 5 )
{
modify_current_item_array ( 0, 2, 3 );
}
else
{
if ( shell->current_item == 6 )
{
if ( cjoy->db & PAD_UP )
{
sfxSpot( HIT1, 30 );
shell->current_item = pl_ed_old_item;
return;
}
if ( cjoy->db & PAD_DN )
{
goto_shell_buttons(-1);
}
}
}
}
if ( ( shell->current_item == 0 ) && ( cjoy->db & PAD_X ) )
{
//user wants to change player name...
//sfxSpot( BUTVOC, 30 );
//kill_player_edit();
pl = &config->player_detail[ pl_ed_current_team ][ pl_ed_current_player ];
//strcpy( text_buffer, pl->name );
entname_text = pl->name;
shell->module_abort=YES;
call_enter_name=YES;
}
}
}
void kill_player_edit()
{
WORD cnt;
Player_detail *pl;
// pop(0); // restore mem allocated for player edit
// Make skinned player invisible
sk_obj.active=NO;
// for ( cnt=0;cnt<8;cnt++ )
// {
cnt=0;
kill_rdb_gadget( pl_ed_rdbs[ cnt ].gadget );
// }
kill_te_clip_sprites();
te_player_type = te_player_type_store;
}
void update_player_textures( WORD editor )
{
BYTE *face_texture, *hair_texture, *face_hair_texture, *num_texture,*shirt_btexture;
Player_detail *pl;
BYTE *thigh_texture;
if ( editor == PLAYER_EDITOR )
{
if ( shell->current_item == 7 )
{
if ( cjoy->db & PAD_DN )
{
shell->current_item = pl_ed_old_item;
sfxSpot( HIT1, 30 );
}
if ( modify_word( &pl_ed_current_player, 0, MAX_USER_PLAYERS_PER_TEAM-1 ) )
{
player_tex_update=YES;
}
}
}
pl = &config->player_detail[ pl_ed_current_team ] [ pl_ed_current_player ];
if ( editor == PLAYER_EDITOR )
{
if ( shell->current_item == 1 )
modify_byte( &pl->face_type, 0, 5 );
if ( shell->current_item == 2 )
{
modify_byte( &pl->face_hair_style, 0, 9 );
}
if ( shell->current_item == 3 )
{
modify_byte( &pl->skin_color, 0, 5 );
if ( cjoy->db & PAD_UP )
{
pl_ed_old_item = shell->current_item;
}
}
if ( shell->current_item == 4 )
{
modify_byte( &pl->head_hair_style, 0, 11 );
if ( cjoy->db & PAD_UP )
{
pl_ed_old_item = shell->current_item;
}
}
if ( shell->current_item == 5 )
{
modify_byte( &pl->hair_color, 0, 8 );
if ( cjoy->db & PAD_UP )
{
pl_ed_old_item = shell->current_item;
}
}
if ( shell->current_item == 6 )
{
modify_byte( &pl->boot_color, 0, 3 );
}
}
else
{
//te_player_type = set_te_player_type(); // goalie or normal player
player_tex_update = YES;
}
//** face type **
if ( face_num != pl->face_type )
player_tex_update=YES;
if ( face_hair_num != pl->face_hair_style )
player_tex_update=YES;
if ( skin_num != pl->skin_color )
player_tex_update=YES;
if ( hair_num != pl->head_hair_style )
player_tex_update=YES;
if ( hair_color != pl->hair_color )
player_tex_update=YES;
if ( boot_color != pl->boot_color )
player_tex_update=YES;
face_num=pl->face_type;
face_hair_num=pl->face_hair_style;
skin_num=pl->skin_color;
hair_num=pl->head_hair_style;
hair_color=pl->hair_color;
boot_color=pl->boot_color;
if ( player_tex_update )
{
update_pl_ed_number();
face_texture = pl_textures + FACE_TSTART + ((( skin_num * FACES_PER_SKIN)+face_num ) * FACE_TSIZE);
hair_texture = pl_textures + HAIR_TSTART + ( hair_num * HAIR_TSIZE );
face_hair_texture = pl_textures + FACE_HAIR_TSTART + ( face_hair_num * FACE_HAIR_TSIZE);
thigh_texture = pl_textures + THIGH_TSTART;
overlay_textures( face_texture, hair_texture, face_hair_texture, TED_PLAYER_FACE );
download_clut( (BYTE *)pl_ed_pal_bank, TED_PLAYER_FACE, Face_pals + (skin_num*128),0, 128 );
download_clut( (BYTE *)pl_ed_pal_bank, TED_PLAYER_FACE, Hair_pals +( 128*hair_color),128,128 );
download_clut( (BYTE *)pl_ed_pal_bank, TED_PLAYER_ARMS, Skin_pals + (skin_num*128),0, 128 );
download_clut( (BYTE *)pl_ed_pal_bank, TED_PLAYER_LEGS, Skin_pals + (skin_num*128),0, 128 );
// download_clut( (BYTE *)te_pals, TED_BOOT, (boot_color+15)*32,192,32 );
download_clut( (BYTE *)te_pals, TED_BOOT, (boot_color+15)*32,0,32 );
}
player_tex_update=NO;
}
/****************************************************************************
* *
* *
* T E A M E D I T O R *
* *
* *
****************************************************************************/
BYTE *te_pl_type_name;
BYTE te_pl_type_name_buff[64];
//WORD shirt_pre[3]={0,0,0}; //preset store of style,color1,color2
//WORD short_pre[3]={0,0,0};
//WORD sock_pre[3]={0,0,0};
//WORD old_shirt_pre[3]={0,0,0};
//WORD old_short_pre[3]={0,0,0};
//WORD old_sock_pre[3]={0,0,0};
BYTE te_ed_name_buffer[64];
//BYTE te_ed_num_buffer[64];
Rdb_gadget te_ed_bigbox_rdb;
Rdb_gadget te_ed_rdbs[ 7 ];
WORD te_ed_old_item;
Sprite *te_swatches[4][2];
Sprite *te_outer_swatches[4][2];
UWORD swatch_col[4][2];
void init_team_edit_bootup()
{
pl_ed_current_player = 0;
pl_ed_current_team = 0;
te_textures_pak = (UBYTE *)read_datafile_alloc( KIT_TEXTURES );
te_pals = (UBYTE *)read_datafile_alloc( KIT_PALS );
player_tex_update=YES;
push(1);
pl_textures = allocate_mem( 1,MAX_PL_FACE_TSIZE ); // alloc 200k
unpropak( pl_textures_pak, pl_textures );
pop(1);
push(1);
te_textures = allocate_mem( 1,MAX_TE_STRIP_TSIZE ); // alloc 100k
unpropak( te_textures_pak, te_textures );
pop(1);
push(1);
pl_num_textures = allocate_mem( 1,MAX_TE_PL_NUMS_TSIZE ); // alloc 50k
unpropak( pl_num_textures_pak, pl_num_textures );
pop(1);
call_enter_name=NO;
}
void init_team_edit_once()
{
Team_detail *te;
WORD cnt;
te = config->team_detail;
for(cnt=0;cnt<MAX_USER_TEAMS;cnt++)
config->team_detail[cnt] = custom_teams[cnt];
}
void init_team_edit()
{
Team_detail *te;
WORD cnt,x,y;
Player_detail *pl;
Gadget *gad;
WORD xposes[]={ -360, -108, -8 };
te_anim_timer=0;
/** UNPACK textures to ram **/
ed_zoom_pos = 100;
te_ed_old_item = 3;
pl = &config->player_detail[ pl_ed_current_team ][ pl_ed_current_player ];
/** Color swatches for shirt , sleeves colors ***/
for ( y=0; y<4; y++ )
{
for ( x=0; x<2; x++ )
{
spawn_sprite( -1 );
te_swatches[y][x] = sprite;
sprite->gouraud = YES;
sprite->untextured_frame.w = 62;
sprite->untextured_frame.h = 40;
sprite->depth = NEAREST_DEPTH+2;
sprite->transp_rate = -1;
sprite->group_num = 4 + ( y*3 ) + x;
sprite->x.w.hi = -58*2 + ( 100*(x) );
sprite->y.w.hi = -6*4 + ( (y)*21*4 ) - TE_YM;
spawn_sprite( SWATCH );
te_outer_swatches[y][x] = sprite;
sprite->x.w.hi = -54*2 + ( 100*(x) )-22;
sprite->y.w.hi = -5*4 + ( (y)*21*4 )-16 - TE_YM;
sprite->group_num = 4 + ( y*3 ) + x;
// sprite->frame = 6;
sprite->depth = NEAREST_DEPTH+1;
}
}
glow_spr = spawn_sprite( GLOW );
sprite->upd_rtn = (void *)glow_upd;
sprite->display=NO;
sprite->transp_rate=1;
sprite->depth = NEAREST_DEPTH;
// push(0);
push(1);
te_textures = allocate_mem( 0, MAX_TE_STRIP_TSIZE ); // alloc 100k
unpropak( te_textures_pak, te_textures );
pop(1);
pl_num_textures = allocate_mem( 0, MAX_TE_PL_NUMS_TSIZE ); // alloc 50k
unpropak( pl_num_textures_pak, pl_num_textures );
//***** Decompress and download skin textures for player *****
push(1);
pl_textures = allocate_mem( 1,MAX_PL_FACE_TSIZE ); // alloc 200k
unpropak( pl_textures_pak, pl_textures );
pop(1);
player_tex_update=YES;
update_player_textures(TEAM_EDITOR);
set_ed_zoom_pos(); // set bloke pos
//*** Enable skined player ***
sk_obj.active=YES;
te = &config->team_detail[ pl_ed_current_team ];
te_ed_player_name_ptr = te->name;
//update_te_ed_name();
//*** print 'team x : blahblah' ***
cnt=0;
y=0;
gad=set_rdb_gadget( 0, &te_ed_rdbs[cnt], -424, -(60*4) + (y*21*4)-(11*4)-TE_YM,568, (14*4), cnt );
gad->rdb_gadget->max_tint = 40;
gad->rdb_gadget->group = cnt;
gad=set_rdb_gadget( 0, &te_ed_rdbs[1], -424, -244, 568, 512, 1 );
gad->rdb_gadget->max_tint = 40;
#if 0
//*** Change name ***
cnt=1;
y=1;
gad=set_rdb_gadget( 0, &te_ed_rdbs[cnt], -84*4, -(60*4) + (y*21*4)-(11*4)-TE_YM,352, (14*4), cnt );
gad->rdb_gadget->max_tint = 40;
gad->rdb_gadget->group = cnt;
cnt=2;
y=2;
gad=set_rdb_gadget( 0, &te_ed_rdbs[cnt], -84*4, -(60*4) + (y*21*4)-(11*4)-TE_YM,352, (14*4),cnt );
gad->rdb_gadget->max_tint = 40;
gad->rdb_gadget->group = cnt;
//*** print other button gadgets ***
cnt=3;
for ( y=3;y<7; y++ )
{
gad=set_rdb_gadget( 0, &te_ed_rdbs[cnt], -(360),-(60*4) + (y*21*4)-(11*4)-TE_YM,216, (14*4), cnt );
gad->rdb_gadget->max_tint = 40;
gad->rdb_gadget->group = cnt;
cnt++;
}
#endif
player_tex_update = YES;
update_kit_textures();
show_selected_swatch();
set_title_lolly( edit_team_txt[config->language], game_types_text[config->language][share->game_type] );
if ( call_enter_name == 0 )
set_shell_bottom_buttons( te_ed_shell_buttons, SHELL_PL_ED );
else
{
shell->current_item = 1;
call_enter_name=NO;
}
}
void update_team_edit()
{
BYTE *text;
WORD index;
Team_detail *te;
WORD y;
if ( (shell->keyboard_active == NO) )
{
control_team_edit_crsr();
if ( te_anim_timer == 0 )
{
sfx_handle=sfxScriptOn( (WORD*)&sfxAnimPlayer );
// FntPrint("script on\n");
}
te_anim_timer++;
te_anim_timer %= 257;
}