-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
5226 lines (4865 loc) · 172 KB
/
main.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
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#include <time.h>
#include <string.h>
// Declare Window Size and Frames
static const int width = 1000;
static const int height = 600;
static const int FPS = 60;
int frametime = 0;
int frametimea = 0;
int frametimeb = 0;
int avoidLag = 0;
int number1,number2;
int damagep1, damagep2, damage;
// Declare Window and Renderer
SDL_Window *window;
SDL_Renderer *renderer;
// Declare Flash drive scanner
bool driveE;
bool driveF;
bool driveG;
int user1 = 0;
int user2 = 0;
int UserRegistered1 = 0;
int UserRegistered2 = 0;
FILE *scanUSM1;
FILE *scanUSM2;
FILE *scanUSM3;
FILE *scanUserUSM1;
FILE *scanUserUSM2;
FILE *scanUserUSM3;
// Declare Registration
FILE *registerUSM;
FILE *loginUSM;
// Declare Loading Screen
SDL_Surface *loadingText;
SDL_Texture *loadingText_texture;
SDL_Surface *loadingText2;
SDL_Texture *loadingText2_texture;
SDL_Surface *loadingText3;
SDL_Texture *loadingText3_texture;
// Declare Loading Screen Positions
SDL_Rect loadingtext_position;
// Declare Title Screen
SDL_Surface *background;
SDL_Texture *background_texture;
SDL_Surface *titleScreen1;
SDL_Texture *titleScreen1_texture;
SDL_Surface *titleScreen2;
SDL_Texture *titleScreen2_texture;
SDL_Surface *pressAny;
SDL_Texture *pressAny_texture;
SDL_Surface *mainTitle;
SDL_Texture *mainTitle_texture;
SDL_Surface *gameDecide;
SDL_Texture *gameDecide_texture;
SDL_Surface *controls;
SDL_Texture *controls_texture;
// Declare Title Screen Positions
SDL_Rect background_position;
SDL_Rect titlescreen_position;
SDL_Rect pressany_position;
SDL_Rect mainTitle_position;
SDL_Rect gameDecide_position;
SDL_Rect controls_position;
// Declare Main Screen Selection & Cursor
SDL_Surface *choices;
SDL_Texture *choices_texture;
SDL_Surface *select;
SDL_Texture *select_texture;
SDL_Surface *gameChoice;
SDL_Texture *gameChoice_texture;
SDL_Surface *singleCursor;
SDL_Texture *singleCursor_texture;
SDL_Surface *cursorGenerator;
SDL_Texture *cursorGenerator_texture;
SDL_Surface *credit;
SDL_Texture *credit_texture;
// Declare Main Screen Selection & Cursor Position
SDL_Rect choices_position;
SDL_Rect select_position;
SDL_Rect gameChoice_position;
SDL_Rect singleCursor_position;
SDL_Rect cursorDecide_position;
SDL_Rect cursorGenerator_position;
SDL_Rect credit_position;
// Chansey (Main Menu)
SDL_Surface *chansey;
SDL_Texture *chansey_texture;
int chanseywidth, chanseyheight, cwidth, cheight;
SDL_Rect chansey_properties;
SDL_Rect chansey_position;
SDL_Rect chansey_b_position;
SDL_Rect chansey2_b_position;
// For Blaziken Front
SDL_Surface *blaziken;
SDL_Texture *blaziken_texture;
int blazikenwidth, blazikenheight, bwidth, bheight;
SDL_Rect blaziken_properties;
SDL_Rect blaziken_position;
// For Blaziken Back
SDL_Surface *blazikenb;
SDL_Texture *blazikenb_texture;
int blazikenbwidth, blazikenbheight, bbwidth, bbheight;
SDL_Rect blazikenb_properties;
SDL_Rect blazikenb_position;
// For Buizel Front
SDL_Surface *buizel;
SDL_Texture *buizel_texture;
int buizelwidth, buizelheight, buwidth, buheight;
SDL_Rect buizel_properties;
SDL_Rect buizel_position;
SDL_Rect buizelmid_position;
// For Buizel Back
SDL_Surface *buizelb;
SDL_Texture *buizelb_texture;
int buizelbwidth, buizelbheight, bubwidth, bubheight;
SDL_Rect buizelb_properties;
SDL_Rect buizelb_position;
// For Bulbasaur Front
SDL_Surface *bulbasaur;
SDL_Texture *bulbasaur_texture;
int bulbasaurwidth, bulbasaurheight, bulwidth, bulheight;
SDL_Rect bulbasaur_properties;
SDL_Rect bulbasaur_position;
SDL_Rect bulbasaurmid_position;
// For Bulbasaur Back
SDL_Surface *bulbasaurb;
SDL_Texture *bulbasaurb_texture;
int bulbasaurbwidth, bulbasaurbheight, bulbwidth, bulbheight;
SDL_Rect bulbasaurb_properties;
SDL_Rect bulbasaurb_position;
// For Celebi Front
SDL_Surface *celebi;
SDL_Texture *celebi_texture;
int celebiwidth, celebiheight, cwidth, cheight;
SDL_Rect celebi_properties;
SDL_Rect celebi_position;
SDL_Rect celebimid_position;
// For Celebi Back
SDL_Surface *celebib;
SDL_Texture *celebib_texture;
int celebibwidth, celebibheight, cbwidth, cbheight;
SDL_Rect celebib_properties;
SDL_Rect celebib_position;
// For Flareon Front
SDL_Surface *flareon;
SDL_Texture *flareon_texture;
int flareonwidth, flareonheight, fwidth, fheight;
SDL_Rect flareon_properties;
SDL_Rect flareon_position;
SDL_Rect flareonmid_position;
// For Flareon Back
SDL_Surface *flareonb;
SDL_Texture *flareonb_texture;
int flareonbwidth, flareonbheight, fbwidth, fbheight;
SDL_Rect flareonb_properties;
SDL_Rect flareonb_position;
// For Electrivire Front
SDL_Surface *electrivire;
SDL_Texture *electrivire_texture;
int electrivirewidth, electrivireheight, ewidth, eheight;
SDL_Rect electrivire_properties;
SDL_Rect electrivire_position;
SDL_Rect electriviremid_position;
// For Electrivire Back
SDL_Surface *electrivireb;
SDL_Texture *electrivireb_texture;
int electrivirebwidth, electrivirebheight, ebwidth, ebheight;
SDL_Rect electrivireb_properties;
SDL_Rect electrivireb_position;
// For Golem Front
SDL_Surface *golem;
SDL_Texture *golem_texture;
int golemwidth, golemheight, gwidth, gheight;
SDL_Rect golem_properties;
SDL_Rect golem_position;
SDL_Rect golemmid_position;
// For Golem Back
SDL_Surface *golemb;
SDL_Texture *golemb_texture;
int golembwidth, golembheight, gbwidth, gbheight;
SDL_Rect golemb_properties;
SDL_Rect golemb_position;
// For Greninja Front
SDL_Surface *greninja;
SDL_Texture *greninja_texture;
int greninjawidth, greninjaheight, grwidth, grheight;
SDL_Rect greninja_properties;
SDL_Rect greninja_position;
SDL_Rect greninjamid_position;
// For Greninja Back
SDL_Surface *greninjab;
SDL_Texture *greninjab_texture;
int greninjabwidth, greninjabheight, grbwidth, grbheight;
SDL_Rect greninjab_properties;
SDL_Rect greninjab_position;
// For Grotle Back
SDL_Surface *grotleb;
SDL_Texture *grotleb_texture;
int grotlebwidth, grotlebheight, grotbwidth, grotbheight;
SDL_Rect grotleb_properties;
SDL_Rect grotleb_position;
// For Grovyle Front
SDL_Surface *grovyle;
SDL_Texture *grovyle_texture;
int grovylewidth, grovyleheight, grovwidth, grovheight;
SDL_Rect grovyle_properties;
SDL_Rect grovyle_position;
SDL_Rect grovylemid_position;
// For Grovyle Back
SDL_Surface *grovyleb;
SDL_Texture *grovyleb_texture;
int grovylebwidth, grovylebheight, grovbwidth, grovbheight;
SDL_Rect grovyleb_properties;
SDL_Rect grovyleb_position;
// For Infernape Front
SDL_Surface *infernape;
SDL_Texture *infernape_texture;
int infernapewidth, infernapeheight, iwidth, iheight;
SDL_Rect infernape_properties;
SDL_Rect infernape_position;
SDL_Rect infernapemid_position;
// For Infernape Back
SDL_Surface *infernapeb;
SDL_Texture *infernapeb_texture;
int infernapebwidth, infernapebheight, ibwidth, ibheight;
SDL_Rect infernapeb_properties;
SDL_Rect infernapeb_position;
// For Jolteon Front
SDL_Surface *jolteon;
SDL_Texture *jolteon_texture;
int jolteonwidth, jolteonheight, jwidth, jheight;
SDL_Rect jolteon_properties;
SDL_Rect jolteon_position;
SDL_Rect jolteonmid_position;
// For Jolteon Back
SDL_Surface *jolteonb;
SDL_Texture *jolteonb_texture;
int jolteonbwidth, jolteonbheight, jbwidth, jbheight;
SDL_Rect jolteonb_properties;
SDL_Rect jolteonb_position;
// For Suicune Front
SDL_Surface *suicune;
SDL_Texture *suicune_texture;
int suicunewidth, suicuneheight, suwidth, suheight;
SDL_Rect suicune_properties;
SDL_Rect suicune_position;
SDL_Rect suicunemid_position;
// For Suicune Back
SDL_Surface *suicuneb;
SDL_Texture *suicuneb_texture;
int suicunebwidth, suicunebheight, subwidth, subheight;
SDL_Rect suicuneb_properties;
SDL_Rect suicuneb_position;
// For Luxray Front
SDL_Surface *luxray;
SDL_Texture *luxray_texture;
int luxraywidth, luxrayheight, lwidth, lheight;
SDL_Rect luxray_properties;
SDL_Rect luxray_position;
SDL_Rect luxraymid_position;
// For Luxray Back
SDL_Surface *luxrayb;
SDL_Texture *luxrayb_texture;
int luxraybwidth, luxraybheight, lbwidth, lbheight;
SDL_Rect luxrayb_properties;
SDL_Rect luxrayb_position;
// For Manectric Front
SDL_Surface *manectric;
SDL_Texture *manectric_texture;
int manectricwidth, manectricheight, mawidth, maheight;
SDL_Rect manectric_properties;
SDL_Rect manectric_position;
SDL_Rect manectricmid_position;
// For Manectric Back
SDL_Surface *manectricb;
SDL_Texture *manectricb_texture;
int manectricbwidth, manectricbheight, mabwidth, mabheight;
SDL_Rect manectricb_properties;
SDL_Rect manectricb_position;
// For Meganium Front
SDL_Surface *meganium;
SDL_Texture *meganium_texture;
int meganiumwidth, meganiumheight, mewidth, meheight;
SDL_Rect meganium_properties;
SDL_Rect meganium_position;
SDL_Rect meganiummid_position;
// For Meganium Back
SDL_Surface *meganiumb;
SDL_Texture *meganiumb_texture;
int meganiumbwidth, meganiumbheight, mebwidth, mebheight;
SDL_Rect meganiumb_properties;
SDL_Rect meganiumb_position;
// For Onix Front
SDL_Surface *onix;
SDL_Texture *onix_texture;
int onixwidth, onixheight, owidth, oheight;
SDL_Rect onix_properties;
SDL_Rect onix_position;
SDL_Rect onixmid_position;
// For Onix Back
SDL_Surface *onixb;
SDL_Texture *onixb_texture;
int onixbwidth, onixbheight, obwidth, obheight;
SDL_Rect onixb_properties;
SDL_Rect onixb_position;
// For Pikachu Front
SDL_Surface *pikachu;
SDL_Texture *pikachu_texture;
int pikachuwidth, pikachuheight, pwidth, pheight;
SDL_Rect pikachu_properties;
SDL_Rect pikachu_position;
SDL_Rect pikachumid_position;
// For Pikachu Back
SDL_Surface *pikachub;
SDL_Texture *pikachub_texture;
int pikachubwidth, pikachubheight, pbwidth, pbheight;
SDL_Rect pikachub_properties;
SDL_Rect pikachub_position;
// For Poliwrath Front
SDL_Surface *poliwrath;
SDL_Texture *poliwrath_texture;
int poliwrathwidth, poliwrathheight, powidth, poheight;
SDL_Rect poliwrath_properties;
SDL_Rect poliwrath_position;
SDL_Rect poliwrathmid_position;
// For Poliwrath Back
SDL_Surface *poliwrathb;
SDL_Texture *poliwrathb_texture;
int poliwrathbwidth, poliwrathbheight, pobwidth, pobheight;
SDL_Rect poliwrathb_properties;
SDL_Rect poliwrathb_position;
// For Raikou Front
SDL_Surface *raikou;
SDL_Texture *raikou_texture;
int raikouwidth, raikouheight, rwidth, rheight;
SDL_Rect raikou_properties;
SDL_Rect raikou_position;
SDL_Rect raikoumid_position;
// For Raikou Back
SDL_Surface *raikoub;
SDL_Texture *raikoub_texture;
int raikoubwidth, raikoubheight, rbwidth, rbheight;
SDL_Rect raikoub_properties;
SDL_Rect raikoub_position;
// For Regirock Front
SDL_Surface *regirock;
SDL_Texture *regirock_texture;
int regirockwidth, regirockheight, rewidth, reheight;
SDL_Rect regirock_properties;
SDL_Rect regirock_position;
SDL_Rect regirockmid_position;
// For Regirock Back
SDL_Surface *regirockb;
SDL_Texture *regirockb_texture;
int regirockbwidth, regirockbheight, rebwidth, rebheight;
SDL_Rect regirockb_properties;
SDL_Rect regirockb_position;
// For Rhydon Front
SDL_Surface *rhydon;
SDL_Texture *rhydon_texture;
int rhydonwidth, rhydonheight, rhwidth, rhheight;
SDL_Rect rhydon_properties;
SDL_Rect rhydon_position;
SDL_Rect rhydonmid_position;
// For Rhydon Back
SDL_Surface *rhydonb;
SDL_Texture *rhydonb_texture;
int rhydonbwidth, rhydonbheight, rhbwidth, rhbheight;
SDL_Rect rhydonb_properties;
SDL_Rect rhydonb_position;
// For Sandslash Front
SDL_Surface *sandslash;
SDL_Texture *sandslash_texture;
int sandslashwidth, sandslashheight, swidth, sheight;
SDL_Rect sandslash_properties;
SDL_Rect sandslash_position;
SDL_Rect sandslashmid_position;
// For Sandslash Back
SDL_Surface *sandslashb;
SDL_Texture *sandslashb_texture;
int sandslashbwidth, sandslashbheight, sbwidth, sbheight;
SDL_Rect sandslashb_properties;
SDL_Rect sandslashb_position;
// Declare Texts
SDL_Surface *textSurface;
SDL_Texture *startgamemessage;
SDL_Surface *text2Surface;
SDL_Texture *tutorialmessage;
SDL_Surface *text3Surface;
SDL_Texture *optionmessage;
SDL_Surface *text4Surface;
SDL_Texture *quitmessage;
SDL_Surface *text5Surface;
SDL_Texture *fdwarning;
// Declare Texts Positions
SDL_Rect mainScreenText;
SDL_Rect fdwarningposition;
// Load Guest Play
SDL_Surface *demoPlat;
SDL_Texture *demoPlat_texture;
SDL_Surface *demoBack;
SDL_Texture *demoBack_texture;
// Load Guest Play Positions
SDL_Rect demoPlat_position;
SDL_Rect demoBack_position;
// Load Monster Generate
SDL_Surface *generatePlat;
SDL_Texture *generatePlat_texture;
SDL_Surface *restart;
SDL_Texture *restart_texture;
// Load Monster Generate
SDL_Rect generatePlat_position;
SDL_Rect restart_position;
// Player 1 / 2 Win
SDL_Surface *player1w;
SDL_Texture *player1w_texture;
SDL_Surface *player2w;
SDL_Texture *player2w_texture;
SDL_Rect player1w_position;
SDL_Rect player2w_position;
// Declare Events
SDL_Event load;
SDL_Event premenuscreen;
SDL_Event mainmenu;
SDL_Event startgamechoice;
SDL_Event guestplay;
SDL_Event userregister;
SDL_Event usergenmons;
SDL_Event userplay;
SDL_Event tutorial;
SDL_Event showmonster;
SDL_Event credits;
SDL_Event registersuccess;
SDL_Event winp1;
SDL_Event winp2;
// Bool Declarations (Default Set to False)
bool mainGame = true;
bool loadingScreen = false;
bool menu = false;
bool premenu = false;
bool startGame = false;
bool guestP = false;
bool userReg = false;
bool generateMons = false;
bool userP = false;
bool tutScreen = false;
bool credScreen = false;
bool showmons = false;
bool regsuccess = false;
bool p1win = false;
bool p2win = false;
// Declare Music
Mix_Music *music;
Mix_Music *music_1;
Mix_Music *music_2;
Mix_Music *music_2_bg;
Mix_Music *music_3;
Mix_Music *select_1;
Mix_Music *select_2;
// Declare Monster Shadows
SDL_Surface *shadow;
SDL_Texture *shadow_texture;
SDL_Rect shadow_position_mainmenu;
SDL_Rect shadow_monsgen_position;
SDL_Rect p1_shadow_b_position;
SDL_Rect p2_shadow_b_position;
// Declare Monster Encounter Messages
SDL_Surface *buizelenc;
SDL_Texture *buizelenc_texture;
SDL_Surface *bulbasaurenc;
SDL_Texture *bulbasaurenc_texture;
SDL_Surface *celebienc;
SDL_Texture *celebienc_texture;
SDL_Surface *flareonenc;
SDL_Texture *flareonenc_texture;
SDL_Surface *electrivireenc;
SDL_Texture *electrivireenc_texture;
SDL_Surface *golemenc;
SDL_Texture *golemenc_texture;
SDL_Surface *greninjaenc;
SDL_Texture *greninjaenc_texture;
SDL_Surface *grovyleenc;
SDL_Texture *grovyleenc_texture;
SDL_Surface *infernapeenc;
SDL_Texture *infernapeenc_texture;
SDL_Surface *jolteonenc;
SDL_Texture *jolteonenc_texture;
SDL_Surface *suicuneenc;
SDL_Texture *suicuneenc_texture;
SDL_Surface *luxrayenc;
SDL_Texture *luxrayenc_texture;
SDL_Surface *manectricenc;
SDL_Texture *manectricenc_texture;
SDL_Surface *meganiumenc;
SDL_Texture *meganiumenc_texture;
SDL_Surface *onixenc;
SDL_Texture *onixenc_texture;
SDL_Surface *pikachuenc;
SDL_Texture *pikachuenc_texture;
SDL_Surface *poliwrathenc;
SDL_Texture *poliwrathenc_texture;
SDL_Surface *raikouenc;
SDL_Texture *raikouenc_texture;
SDL_Surface *regirockenc;
SDL_Texture *regirockenc_texture;
SDL_Surface *rhydonenc;
SDL_Texture *rhydonenc_texture;
SDL_Surface *sandslashenc;
SDL_Texture *sandslashenc_texture;
// Declare Bacground UI
SDL_Texture *Waterp1_texture;
SDL_Surface *Waterp1;
SDL_Rect Waterp1_position;
SDL_Texture *Waterp2_texture;
SDL_Surface *Waterp2;
SDL_Rect Waterp2_position;
SDL_Texture *Grassp1_texture;
SDL_Surface *Grassp1;
SDL_Rect Grassp1_position;
SDL_Texture *Grassp2_texture;
SDL_Surface *Grassp2;
SDL_Rect Grassp2_position;
SDL_Texture *Firep1_texture;
SDL_Surface *Firep1;
SDL_Rect Firep1_position;
SDL_Texture *Firep2_texture;
SDL_Surface *Firep2;
SDL_Rect Firep2_position;
SDL_Texture *Grass2p1_texture;
SDL_Surface *Grass2p1;
SDL_Rect Grass2p1_position;
SDL_Texture *Grass2p2_texture;
SDL_Surface *Grass2p2;
SDL_Rect Grass2p2_position;
SDL_Texture *Electricp1_texture;
SDL_Surface *Electricp1;
SDL_Rect Electricp1_position;
SDL_Texture *Electricp2_texture;
SDL_Surface *Electricp2;
SDL_Rect Electricp2_position;
SDL_Texture *Rockp1_texture;
SDL_Surface *Rockp1;
SDL_Rect Rockp1_position;
SDL_Texture *Rockp2_texture;
SDL_Surface *Rockp2;
SDL_Rect Rockp2_position;
SDL_Rect encountermessage_position;
// Declare TTF for Guest Play
SDL_Surface *player1health;
SDL_Texture *player1health_texture;
SDL_Surface *player2health;
SDL_Texture *player2health_texture;
SDL_Surface *p1damage;
SDL_Texture *p1damage_texture;
SDL_Surface *p2damage;
SDL_Texture *p2damage_texture;
SDL_Rect p1healthpos;
SDL_Rect p2healthpos;
SDL_Rect p1damagepos;
SDL_Rect p2damagepos;
TTF_Font *bitfont;
SDL_Color black = {0,0,0};
SDL_Color white = {255,255,255};
// Function for Text
void initText()
{
TTF_Init();
bitfont = TTF_OpenFont("resource/fonts/8-bit_pusab.ttf", 25);
player1health = TTF_RenderText_Solid(bitfont, "200" , white);
player1health_texture = SDL_CreateTextureFromSurface(renderer, player1health);
player2health = TTF_RenderText_Solid(bitfont, "200" , white);
player2health_texture = SDL_CreateTextureFromSurface(renderer, player2health);
p1damage = TTF_RenderText_Solid(bitfont, "0" , white);
p1damage_texture = SDL_CreateTextureFromSurface(renderer, p1damage);
p2damage = TTF_RenderText_Solid(bitfont, "0" , white);
p2damage_texture = SDL_CreateTextureFromSurface(renderer, p2damage);
SDL_QueryTexture(player1health_texture, NULL, NULL, &p1healthpos.w, &p1healthpos.h);
SDL_QueryTexture(player2health_texture, NULL, NULL, &p2healthpos.w, &p2healthpos.h);
SDL_QueryTexture(p1damage_texture, NULL, NULL, &p1damagepos.w, &p1damagepos.h);
SDL_QueryTexture(p2damage_texture, NULL, NULL, &p2damagepos.w, &p2damagepos.h);
p1healthpos.x = 790;
p1healthpos.y = 45;
p2healthpos.x = 50;
p2healthpos.y = 510;
p1damagepos.x = 50;
p1damagepos.y = 425;
p2damagepos.x = 855;
p2damagepos.y = 130;
}
// Declare BG UI
void wp1()
{
Waterp1 = IMG_Load("resource/Skills/wp1.png");
Waterp1_texture = SDL_CreateTextureFromSurface(renderer, Waterp1);
Waterp1_position.x = 0;
Waterp1_position.y = 0;
Waterp1_position.h = 600;
Waterp1_position.w = 1000;
}
void wp2 ()
{
Waterp2 = IMG_Load("resource/Skills/wp2.png");
Waterp2_texture = SDL_CreateTextureFromSurface(renderer, Waterp2);
Waterp2_position.x = 0;
Waterp2_position.y = 0;
Waterp2_position.h = 600;
Waterp2_position.w = 1000;
}
void gp1()
{
Grassp1 = IMG_Load("resource/Skills/gp1.png");
Grassp1_texture = SDL_CreateTextureFromSurface(renderer, Grassp1);
Grassp1_position.x = 0;
Grassp1_position.y = 0;
Grassp1_position.h = 600;
Grassp1_position.w = 1000;
}
void gp2()
{
Grassp2 = IMG_Load("resource/Skills/gp2.png");
Grassp2_texture = SDL_CreateTextureFromSurface(renderer, Grassp2);
Grassp2_position.x = 0;
Grassp2_position.y = 0;
Grassp2_position.h = 600;
Grassp2_position.w = 1000;
}
void g2p1()
{
Grass2p1 = IMG_Load("resource/Skills/g2p1.png");
Grass2p1_texture = SDL_CreateTextureFromSurface(renderer, Grass2p1);
Grass2p1_position.x = 0;
Grass2p1_position.y = 0;
Grass2p1_position.h = 600;
Grass2p1_position.w = 1000;
}
void g2p2()
{
Grass2p2 = IMG_Load("resource/Skills/g2p2.png");
Grass2p2_texture = SDL_CreateTextureFromSurface(renderer, Grass2p2);
Grass2p2_position.x = 0;
Grass2p2_position.y = 0;
Grass2p2_position.h = 600;
Grass2p2_position.w = 1000;
}
void fp1()
{
Firep1 = IMG_Load("resource/Skills/fp1.png");
Firep1_texture = SDL_CreateTextureFromSurface(renderer, Firep1);
Firep1_position.x = 0;
Firep1_position.y = 0;
Firep1_position.h = 600;
Firep1_position.w = 1000;
}
void fp2()
{
Firep2 = IMG_Load("resource/Skills/fp2.png");
Firep2_texture = SDL_CreateTextureFromSurface(renderer, Firep2);
Firep2_position.x = 0;
Firep2_position.y = 0;
Firep2_position.h = 600;
Firep2_position.w = 1000;
}
void ep1()
{
Electricp1 = IMG_Load("resource/Skills/ep1.png");
Electricp1_texture = SDL_CreateTextureFromSurface(renderer, Electricp1);
Electricp1_position.x = 0;
Electricp1_position.y = 0;
Electricp1_position.h = 600;
Electricp1_position.w = 1000;
}
void ep2()
{
Electricp2 = IMG_Load("resource/Skills/ep2.png");
Electricp2_texture = SDL_CreateTextureFromSurface(renderer, Electricp2);
Electricp2_position.x = 0;
Electricp2_position.y = 0;
Electricp2_position.h = 600;
Electricp2_position.w = 1000;
}
void rp1()
{
Rockp1 = IMG_Load("resource/Skills/earthp1.png");
Rockp1_texture = SDL_CreateTextureFromSurface(renderer, Rockp1);
Rockp1_position.x = 0;
Rockp1_position.y = 0;
Rockp1_position.h = 600;
Rockp1_position.w = 1000;
}
void rp2()
{
Rockp2 = IMG_Load("resource/Skills/earthp2.png");
Rockp2_texture = SDL_CreateTextureFromSurface(renderer, Rockp2);
Rockp2_position.x = 0;
Rockp2_position.y = 0;
Rockp2_position.h = 600;
Rockp2_position.w = 1000;
}
// Declare Pokemon Animation
void animationBuizelp1()
{
frametimea++;
if(FPS/frametimea == 20)
{
frametimea = 0;
buizelb_properties.x += bubwidth;
if (buizelb_properties.x >= buizelbwidth)
{
buizelb_properties.x = 0;
buizelb_properties.y += bubheight;
if (buizelb_properties.y >= buizelbheight)
{
buizelb_properties.y = 0;
}
}
SDL_RenderCopy(renderer , buizelb_texture, &buizelb_properties, &buizelb_position);
}
}
void animationBuizelp2()
{
frametimeb++;
if(FPS/frametimeb == 10)
{
frametimeb = 0;
buizel_properties.x += buwidth;
if (buizel_properties.x >= buizelwidth)
{
buizel_properties.x = 0;
buizel_properties.y += buheight;
if (buizel_properties.y >= buizelheight)
{
buizel_properties.y = 0;
}
}
SDL_RenderCopy(renderer , buizel_texture, &buizel_properties, &buizel_position);
SDL_RenderPresent(renderer);
}
}
void animationBulbasaurp1()
{
frametimea++;
if(FPS/frametimea == 10)
{
frametimea = 0;
bulbasaurb_properties.x += bulbwidth;
if (bulbasaurb_properties.x >= bulbasaurbwidth)
{
bulbasaurb_properties.x = 0;
bulbasaurb_properties.y += bulbheight;
if (bulbasaurb_properties.y >= bulbasaurbheight)
{
bulbasaurb_properties.y = 0;
}
}
SDL_RenderCopy(renderer , bulbasaurb_texture, &bulbasaurb_properties, &bulbasaurb_position);
}
}
void animationBulbasaurp2()
{
frametimeb++;
if(FPS/frametimeb == 10)
{
frametimeb = 0;
bulbasaur_properties.x += bulwidth;
if (bulbasaur_properties.x >= bulbasaurwidth)
{
bulbasaur_properties.x = 0;
bulbasaur_properties.y += bulheight;
if (bulbasaur_properties.y >= bulbasaurheight)
{
bulbasaur_properties.y = 0;
}
}
SDL_RenderCopy(renderer, bulbasaur_texture, &bulbasaur_properties, &bulbasaur_position);
SDL_RenderPresent(renderer);
}
}
void animationCelebip1()
{
frametimea++;
if(FPS/frametimea == 10)
{
frametimea = 0;
celebib_properties.x += cbwidth;
if (celebib_properties.x >= celebibwidth)
{
celebib_properties.x = 0;
celebib_properties.y += cbheight;
if (celebib_properties.y >= celebibheight)
{
celebib_properties.y = 0;
}
}
SDL_RenderCopy(renderer, celebib_texture, &celebib_properties, &celebib_position);
}
}
void animationCelebip2()
{
frametimeb++;
if(FPS/frametimeb == 10)
{
frametimeb = 0;
celebi_properties.x += cwidth;
if (celebi_properties.x >= celebiwidth)
{
celebi_properties.x = 0;
celebi_properties.y += cheight;
if (celebi_properties.y >= celebiheight)
{
celebi_properties.y = 0;
}
}
SDL_RenderCopy(renderer, celebi_texture, &celebi_properties, &celebi_position);
SDL_RenderPresent(renderer);
}
}
void animationFlareonp1()
{
frametimea++;
if(FPS/frametimea == 10)
{
frametimea = 0;
flareonb_properties.x += fbwidth;
if (flareonb_properties.x >= flareonbwidth)
{
flareonb_properties.x = 0;
flareonb_properties.y += fbheight;
if (flareonb_properties.y >= flareonbheight)
{
flareonb_properties.y = 0;
}
}
SDL_RenderCopy(renderer , flareonb_texture, &flareonb_properties, &flareonb_position);
}
}
void animationFlareonp2()
{
frametimeb++;
if(FPS/frametimeb == 10)
{
frametimeb = 0;
flareon_properties.x += fwidth;
if (flareon_properties.x >= flareonwidth)
{
flareon_properties.x = 0;
flareon_properties.y += fheight;
if (flareon_properties.y >= flareonheight)
{
flareon_properties.y = 0;
}
}
SDL_RenderCopy(renderer , flareon_texture, &flareon_properties, &flareon_position);
SDL_RenderPresent(renderer);
}
}
void animationElectrivirep1()
{
frametimea++;
if(FPS/frametimea == 10)
{
frametimea = 0;
electrivireb_properties.x += ebwidth;
if (electrivireb_properties.x >= electrivirebwidth)
{
electrivireb_properties.x = 0;
electrivireb_properties.y += ebheight;
if (electrivireb_properties.y >= electrivirebheight)
{
electrivireb_properties.y = 0;
}
}
SDL_RenderCopy(renderer , electrivireb_texture, &electrivireb_properties, &electrivireb_position);
}
}
void animationElectrivirep2()
{
frametimeb++;
if(FPS/frametimeb == 10)
{
frametimeb = 0;
electrivire_properties.x += ewidth;