-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathcode_80057C60.c
6941 lines (6503 loc) · 266 KB
/
code_80057C60.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
/**
* @file code_80057C60.c
* @warning there are too many variables here
*/
#include <ultra64.h>
#include <macros.h>
#include <PR/gbi.h>
#include <mk64.h>
#include <course.h>
#include "camera.h"
#include "code_80057C60.h"
#include "main.h"
#include "actors.h"
#include "code_800029B0.h"
#include "racing/memory.h"
#include <defines.h>
#include "math_util.h"
#include "math_util_2.h"
#include "code_80005FD0.h"
#include "render_player.h"
#include "render_objects.h"
#include "code_8006E9C0.h"
#include "update_objects.h"
#include "code_80086E70.h"
#include "effects.h"
#include <assets/data_800E8700.h>
#include "skybox_and_splitscreen.h"
#include <assets/common_data.h>
#include "audio/external.h"
#include "objects.h"
#include "bomb_kart.h"
#include "menus.h"
#include "data/other_textures.h"
#include "spawn_players.h"
#include "sounds.h"
#include "data/some_data.h"
//! @warning this macro is undef'd at the end of this file
#define MAKE_RGB(r, g, b) (((r) << 0x10) | ((g) << 0x08) | (b << 0x00))
s32 D_80165590;
s32 D_80165594;
s32 D_80165598;
s32 D_8016559C;
UNUSED s32 D_801655A0;
s32 D_801655A4;
UNUSED s32 D_801655A8;
s32 D_801655AC;
UNUSED s32 D_801655B0;
s32 D_801655B4;
UNUSED s32 D_801655B8;
s32 D_801655BC;
s32 D_801655C0;
s32 D_801655C4;
s32 D_801655C8;
s32 D_801655CC;
UNUSED s32 D_801655D0[2];
s32 D_801655D8;
UNUSED s32 D_801655DC[2];
s32 D_801655E8;
UNUSED s32 D_801655EC;
s32 D_801655F0;
UNUSED s32 D_801655F4;
s32 D_801655F8;
UNUSED s32 D_80165600[2];
s32 D_80165608;
UNUSED s32 D_80165610[2];
s32 D_80165618;
UNUSED s32 D_80165620[2];
s32 D_80165628;
UNUSED s32 D_80165630[2];
u32 D_80165638;
UNUSED s32 D_80165640[2];
u32 D_80165648;
UNUSED u32 D_80165650[2];
u32 D_80165658[8];
s32 D_80165678;
UNUSED s32 D_80165680[12];
u16 D_801656B0;
UNUSED s32 D_801656B8[2];
u16 D_801656C0;
UNUSED s32 D_801656C8[2];
u16 D_801656D0;
UNUSED s32 D_801656D8[2];
u16 D_801656E0;
UNUSED s32 D_801656E8[2];
s16 D_801656F0;
UNUSED s32 D_801656F8[4];
s16 D_80165708;
UNUSED s32 D_8016570C;
s16 D_80165710;
UNUSED s32 D_80165714;
s16 D_80165718;
UNUSED s32 D_8016571C;
s16 D_80165720;
UNUSED s32 D_80165724;
s16 D_80165728;
UNUSED s32 D_8016572C;
s16 D_80165730;
UNUSED s32 D_80165734;
//! Tracking a count of some object type, don't know what object type yet
s16 D_80165738;
UNUSED s32 D_8016573C;
s16 D_80165740;
UNUSED s32 D_80165744;
s16 D_80165748;
UNUSED s32 D_8016574C;
s16 gNumActiveThwomps;
s32 D_80165754;
ThwompSpawn* gThowmpSpawnList;
Vec4s D_80165760;
UNUSED s16 D_80165768;
s8 D_8016576A;
Vec4s D_80165770;
UNUSED s32 D_80165778;
Vec4s D_80165780;
UNUSED s32 D_80165788;
s16 D_8016578C;
UNUSED s16 D_8016578E;
s16 D_80165790;
UNUSED s16 D_80165792;
s16 D_80165794;
UNUSED s32 D_80165798;
s8 D_8016579C;
u16 D_8016579E;
UNUSED s16 D_801657A0;
//! Something related to the rotation(?) of ice in Sherbet Land
u16 D_801657A2;
UNUSED s32 D_801657A4;
UNUSED s16 D_801657A8[3];
s8 D_801657AE;
UNUSED s8 D_801657AF;
//! HUD related
s8 gHUDDisable;
UNUSED s8 D_801657B1;
s8 D_801657B2;
UNUSED s8 D_801657B3;
s8 D_801657B4;
s8 D_801657B8[16];
s8 D_801657C8;
s8 D_801657D0[8];
s8 D_801657D8;
UNUSED s16 D_801657DA[2];
UNUSED s8 D_801657E0;
s8 D_801657E1;
s8 D_801657E2;
s8 D_801657E3;
s8 D_801657E4;
s8 D_801657E5;
bool8 D_801657E6;
u8 D_801657E7;
bool8 D_801657E8;
UNUSED s32 D_801657EC;
bool8 D_801657F0;
UNUSED s32 D_801657F4;
bool8 D_801657F8;
s32 D_801657FC;
s8 D_80165800[2];
s32 D_80165804;
s8 D_80165808;
s32 D_8016580C;
bool8 D_80165810;
s32 D_80165814;
bool8 D_80165818;
s32 D_8016581C;
s8 D_80165820;
UNUSED s32 D_80165824;
s8 D_80165828;
Vec3su D_8016582C;
s8 D_80165832[2];
Vec3su D_80165834;
UNUSED s32 D_8016583A;
s8 D_80165840[3];
UNUSED s32 D_80165848[6];
s32 D_80165860;
UNUSED s32 D_80165864;
UNUSED s32 D_80165868;
s32 D_8016586C;
UNUSED s32 D_80165870[2];
s32 D_80165878;
s32 D_8016587C;
u8* D_80165880;
UNUSED s32 D_80165884;
s8 D_80165888;
UNUSED s32 D_8016588C;
s8 D_80165890;
UNUSED s32 D_80165894;
s8 D_80165898;
s32 D_8016589C;
UNUSED s32 D_801658A0[2];
s8 D_801658A8;
UNUSED s32 D_801658B0[3];
s8 D_801658BC;
UNUSED s32 D_801658C0;
UNUSED s16 D_801658C4;
s8 D_801658C6;
UNUSED s32 D_801658C8;
UNUSED s16 D_801658CC;
s8 D_801658CE;
UNUSED s32 D_801658D0;
UNUSED s16 D_801658D4;
s8 D_801658D6;
UNUSED s32 D_801658D8;
s8 D_801658DC;
UNUSED s32 D_801658E0;
s8 D_801658E4;
UNUSED s32 D_801658E8;
s8 D_801658EC;
UNUSED s32 D_801658F0;
s8 D_801658F4;
UNUSED s32 D_801658F8;
UNUSED s8 D_801658FC;
u8 sRandomItemIndex;
s8 D_801658FE;
u8 gControllerRandom;
s16 D_80165900;
UNUSED s32 D_80165904;
s8 D_80165908;
UNUSED s32 D_80165910[96];
s8 D_80165A90;
UNUSED s32 D_80165AA0[95];
UNUSED s32 D_80165C14;
Object gObjectList[OBJECT_LIST_SIZE];
UNUSED s32 D_80183D58;
s32 objectListSize;
Mtx D_80183D60;
/**
* Use unknown. An object is reserved and its index is saved to
* this variable, but it appears to go unreferenced
**/
s32 D_80183DA0;
f32 D_80183DA8[4];
//! Lakitu?
s32 gIndexLakituList[4];
f32 D_80183DC8[4];
//! Indexes for the objects associated with the Bomb Karts
s32 gIndexObjectBombKart[NUM_BOMB_KARTS_MAX];
UNUSED s32 D_80183DF8[16];
//! Next free spot in gObjectParticle1? Wraps back around to 0 if it gets bigger than gObjectParticle1_SIZE
s32 gNextFreeObjectParticle1;
Vec3f D_80183E40;
//! Next free spot in gObjectParticle2? Wraps back around to 0 if it gets bigger than gObjectParticle2_SIZE
s32 gNextFreeObjectParticle2;
Vec3f D_80183E50;
//! Next free spot in gObjectParticle3?
s32 gNextFreeObjectParticle3;
UNUSED s32 D_80183E60[3];
//! Next free spot in gObjectParticle4? Wraps back around to 0 if it gets bigger than gObjectParticle4_SIZE
s32 gNextFreeObjectParticle4;
Vec3f D_80183E70;
//! Next free spot in gLeafParticle? Wraps back around to 0 if it gets bigger than gLeafParticle_SIZE
s32 gNextFreeLeafParticle;
Vec3su D_80183E80;
//! Appears to be a list of object list indices for the Item Window part of the HUD
s32 gItemWindowObjectByPlayerId[4];
Vec3su D_80183E98;
/**
* Snowmen bodies in FrappeSnowland
* Crabs in Koopa Troopa Beach
* Hot air balloon in Luigi Raceway?
* Neon signs in Rainbow Road?
* Thwomps in Bower's Castle?
* Penguins in Sherbet Land?
* Flag Poles in Yoshi Valley?
*/
s32 indexObjectList1[32];
UNUSED s32 D_80183F20[2];
/**
* Snowmen heads in Frappe Snowland
* Chain Chomps in RaindbowRoad?
* Trophy in award ceremony?
* Seagulls in Koopa Troopa Beach?
* Hedgehogs in Yoshi Valley?
* Spawn for big fire breath in Bowser's Castle
*/
s32 indexObjectList2[32];
/**
* Seemingly a list of textures for Lakitu
* Never explicitly given data, data appears to be placed here
* via some type of DMA.
* I'm also not certain about its dimensions
* I think the entires in this array are way over-sized
*/
u8 D_80183FA8[4][0x2000];
/**
* Boos in Banshee Boardwalk
* Spawners for the 4 small fire breaths inside Bowser's Castle
*/
s32 indexObjectList3[32];
//! Seemingly a pointer to Lakitu texture(s)
u8* gLakituTexturePtr;
/**
* Unused list of object indices
*/
s32 indexObjectList4[32];
//! Array of (4) Collisions?
Collision D_8018C0B0[4];
/**
* List of object list indices used for:
* Moles in Moo Moo Farm
* Snow flakes in Frappe Snowland
* Segments of the fire breath from the statues in Bowser's Castle
* Potentially other things
*/
s32 gObjectParticle1[gObjectParticle2_SIZE];
Collision D_8018C3B0;
/**
* List of object list indices used for:
* - Bats in Banshee's Boardwalk (but only 1 player mode?)
* - Train index 0 smoke in Kalimari Desert
* - Ferry index 0 smoke in DK Jungle
*/
s32 gObjectParticle2[gObjectParticle2_SIZE];
// Maybe some unused Collision?
UNUSED Collision D_8018C5F0;
/**
* List of object list indices used for:
* - Train index 1 smoke in Kalimari Desert
* - Ferry index 1 smoke in DK Jungle
*/
s32 gObjectParticle3[gObjectParticle3_SIZE];
Collision D_8018C830;
/**
* List of object list indices. Used both for the fires in the DK Jungle cave
* and, seemingly for the trail that shells leave behind them.
* I think they're using the same texture, which would explain the dual use
*/
s32 gObjectParticle4[gObjectParticle4_SIZE];
/**
* Seemingly a list of object list indices used for the leaves that sometimes fall
* trees when you bonk into them
*/
s32 gLeafParticle[gLeafParticle_SIZE];
hud_player playerHUD[4];
/**
* List of object list indices used by the clouds and stars in some stages
* Also used for snowflakes like gObjectParticle1? Not sure what's up with that
*/
s32 D_8018CC80[D_8018CC80_SIZE];
struct_D_8018CE10 D_8018CE10[8];
//! Unknown object index, only set for Kalimari Desert, never read
s32 D_8018CF10;
Camera* D_8018CF14;
s16 D_8018CF18;
Player* D_8018CF1C;
s16 D_8018CF20;
UNUSED s32 D_8018CF24;
Player* D_8018CF28[8];
s16 D_8018CF48;
s16 D_8018CF50[8];
s16 D_8018CF60;
//! This may be a list of tilemap flags on a per-camera basis
s16 D_8018CF68[8];
s16 D_8018CF78;
/**
* List of half-word character IDs indicating each character's
* place in the current Grand Prix race's standings
*/
s16 gGPCurrentRaceCharacterIdByRank[8];
s16 D_8018CF90;
s16 D_8018CF98[8];
s16 D_8018CFA8;
s8 D_8018CFAC[4];
s16 D_8018CFB0;
s8 D_8018CFB4[4];
s16 D_8018CFB8;
s8 D_8018CFBC[4];
s16 D_8018CFC0;
s8 D_8018CFC4[4];
s16 D_8018CFC8;
f32 D_8018CFCC;
s16 D_8018CFD0;
f32 D_8018CFD4;
s16 D_8018CFD8;
s16 D_800E4730[] = { 0x00ff, 0x0000, 0x0000, 0x00ff, 0x00ff, 0x0000, 0x0000, 0x00ff, 0x0000, 0x0032, 0x00ff, 0x00ff,
0x0000, 0x0000, 0x00ff, 0x00ff, 0x0032, 0x00ff, 0x00ff, 0x0028, 0x0028, 0x0032, 0x00ff, 0x0064,
0x0082, 0x000f, 0x00ff, 0x0000, 0x0000, 0x0000,
// I'm not convinced these aren't just padding, but stuff doesn't match
// without them :/
0x0000 };
u8** D_800E4770[] = {
&D_8018D420, &D_8018D424, &D_8018D428, &D_8018D428, &D_8018D42C, &D_8018D42C,
&D_8018D430, &D_8018D430, &D_8018D434, &D_8018D434, &D_8018D434, &D_8018D434,
};
u8** D_800E47A0[] = {
&D_8018D438, &D_8018D43C, &D_8018D440, &D_8018D444, &D_8018D448, &D_8018D44C, &D_8018D450, &D_8018D454,
&D_8018D458, &D_8018D45C, &D_8018D460, &D_8018D464, &D_8018D468, &D_8018D46C, &D_8018D470,
};
s32 D_800E47DC[] = {
MAKE_RGB(0xFB, 0xFF, 0xFB), MAKE_RGB(0xA0, 0x60, 0x11), MAKE_RGB(0xE0, 0xC0, 0x90), MAKE_RGB(0xD0, 0xB0, 0x80),
MAKE_RGB(0x90, 0x70, 0x40), MAKE_RGB(0xC0, 0x70, 0x10), MAKE_RGB(0xD0, 0xF0, 0xFF), MAKE_RGB(0xE0, 0x90, 0x30),
MAKE_RGB(0xC0, 0x90, 0x30), MAKE_RGB(0x60, 0x40, 0x20), MAKE_RGB(0xF0, 0xD0, 0xB0), MAKE_RGB(0xA0, 0x80, 0x30),
};
s32 D_800E480C[] = {
MAKE_RGB(0xB0, 0xB0, 0xB0), MAKE_RGB(0x80, 0x40, 0x11), MAKE_RGB(0xB0, 0x80, 0x50), MAKE_RGB(0xA0, 0x70, 0x40),
MAKE_RGB(0x60, 0x30, 0x11), MAKE_RGB(0x80, 0x40, 0x10), MAKE_RGB(0x70, 0x90, 0xA0), MAKE_RGB(0xA0, 0x60, 0x30),
MAKE_RGB(0xA0, 0x70, 0x10), MAKE_RGB(0x30, 0x10, 0x11), MAKE_RGB(0xB0, 0xA0, 0x80), MAKE_RGB(0x80, 0x60, 0x10),
};
// UI Code?
void func_80057C60(void) {
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(D_802B8880));
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&D_80183D60), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
}
void func_80057CE4(void) {
switch (D_8018D21C) {
case 0:
func_802A3730(D_800DC5EC);
break;
case 1:
func_802A3730(D_800DC5EC);
break;
case 2:
func_802A3730(D_800DC5F0);
break;
case 3:
func_802A3730(D_800DC5EC);
break;
case 4:
func_802A3730(D_800DC5F0);
break;
case 8:
func_802A3730(D_800DC5EC);
break;
case 9:
func_802A3730(D_800DC5F0);
break;
case 10:
func_802A3730(D_800DC5F4);
break;
case 11:
func_802A3730(D_800DC5F8);
break;
}
}
void func_80057DD0(void) {
if (D_801657B2 != 0) {
func_8004C024(0xF, 0xB, 0x122, 0, 0xFF, 0, 0xFF);
func_8004C148(0x131, 0xB, 0xDA, 0, 0xFF, 0, 0xFF);
func_8004C024(0xF, 0xE5, 0x122, 0, 0xFF, 0, 0xFF);
func_8004C148(0xF, 0xB, 0xDA, 0, 0xFF, 0, 0xFF);
func_8004C024(0x16, 0x10, 0x114, 0xFF, 0, 0, 0xFF);
func_8004C148(0x12A, 0x10, 0xD0, 0xFF, 0, 0, 0xFF);
func_8004C024(0x16, 0xE0, 0x114, 0xFF, 0, 0, 0xFF);
func_8004C148(0x16, 0x10, 0xD0, 0xFF, 0, 0, 0xFF);
func_8004C024(0x18, 0x15, 0x110, 0, 0, 0xFF, 0xFF);
func_8004C148(0x128, 0x15, 0xC4, 0, 0, 0xFF, 0xFF);
func_8004C024(0x18, 0xDB, 0x110, 0, 0, 0xFF, 0xFF);
func_8004C148(0x18, 0x15, 0xC4, 0, 0, 0xFF, 0xFF);
}
}
void func_80057FC4(u32 arg0) {
UNUSED Gfx* temp_v1;
if ((gHUDDisable != 0)) {
return;
}
gSPDisplayList(gDisplayListHead++, &D_0D0076F8);
set_matrix_hud_screen();
if ((D_801657C8 != 0)) {
return;
}
switch (arg0) {
case 0:
func_80051EBC();
break;
case 1:
func_80051EF8();
break;
case 2:
func_80051F9C();
break;
case 3:
func_80052044();
break;
case 4:
func_80052080();
break;
}
}
void render_object(u32 arg0) {
UNUSED Gfx* temp_v1;
if (gHUDDisable != 0) {
return;
}
gSPDisplayList(gDisplayListHead++, &D_0D0076F8);
if (D_8018D22C != 0) {
return;
}
switch (arg0) {
case RENDER_SCREEN_MODE_1P_PLAYER_ONE:
render_object_p1();
break;
case RENDER_SCREEN_MODE_2P_HORIZONTAL_PLAYER_ONE:
render_object_p1();
break;
case RENDER_SCREEN_MODE_2P_HORIZONTAL_PLAYER_TWO:
render_object_p2();
break;
case RENDER_SCREEN_MODE_2P_VERTICAL_PLAYER_ONE:
render_object_p1();
break;
case RENDER_SCREEN_MODE_2P_VERTICAL_PLAYER_TWO:
render_object_p2();
break;
case 5:
render_object_p1();
break;
case 6:
render_object_p2();
break;
case 7:
render_object_p3();
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_ONE:
render_object_p1();
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_TWO:
render_object_p2();
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_THREE:
render_object_p3();
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_FOUR:
render_object_p4();
break;
}
}
void render_object_p1(void) {
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[0]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[0]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
func_8001C3C4(PLAYER_ONE);
if (gGamestate == ENDING) {
func_80055F48(PLAYER_ONE);
func_80056160(PLAYER_ONE);
func_8005217C(PLAYER_ONE);
func_80054BE8(PLAYER_ONE);
return;
}
if (!gDemoMode) {
render_lakitu(PLAYER_ONE);
}
render_object_for_player(PLAYER_ONE);
}
void render_object_p2(void) {
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[1]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[1]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
func_8001C3C4(PLAYER_TWO);
if (!gDemoMode) {
render_lakitu(PLAYER_TWO);
}
render_object_for_player(PLAYER_TWO);
}
void render_object_p3(void) {
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[2]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[2]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
func_8001C3C4(PLAYER_THREE);
if (!gDemoMode) {
render_lakitu(PLAYER_THREE);
}
render_object_for_player(PLAYER_THREE);
}
void render_object_p4(void) {
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[3]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[3]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
func_8001C3C4(PLAYER_FOUR);
if ((!gDemoMode) && (gPlayerCountSelection1 == 4)) {
render_lakitu(PLAYER_FOUR);
}
render_object_for_player(PLAYER_FOUR);
}
void render_player_snow_effect(u32 arg0) {
UNUSED Gfx* temp_v1;
if (gHUDDisable != 0) {
return;
}
gSPDisplayList(gDisplayListHead++, &D_0D0076F8);
if (D_8018D22C != 0) {
return;
}
switch (arg0) {
case RENDER_SCREEN_MODE_1P_PLAYER_ONE:
render_player_snow_effect_one();
break;
case RENDER_SCREEN_MODE_2P_HORIZONTAL_PLAYER_ONE:
render_player_snow_effect_one();
break;
case RENDER_SCREEN_MODE_2P_HORIZONTAL_PLAYER_TWO:
render_player_snow_effect_two();
break;
case RENDER_SCREEN_MODE_2P_VERTICAL_PLAYER_ONE:
render_player_snow_effect_one();
break;
case RENDER_SCREEN_MODE_2P_VERTICAL_PLAYER_TWO:
render_player_snow_effect_two();
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_ONE:
render_player_snow_effect_one();
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_TWO:
render_player_snow_effect_two();
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_THREE:
render_player_snow_effect_three();
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_FOUR:
render_player_snow_effect_four();
break;
}
}
void render_player_snow_effect_one(void) {
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[0]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[0]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
if (gGamestate != ENDING) {
render_snowing_effect(PLAYER_ONE);
}
}
void render_player_snow_effect_two(void) {
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[1]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[1]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
render_snowing_effect(PLAYER_TWO);
}
void render_player_snow_effect_three(void) {
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[2]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[2]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
render_snowing_effect(PLAYER_THREE);
}
void render_player_snow_effect_four(void) {
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[3]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[3]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
render_snowing_effect(PLAYER_FOUR);
}
void render_object_for_player(s32 cameraId) {
#if !ENABLE_CUSTOM_COURSE_ENGINE
switch (gCurrentCourseId) {
case COURSE_MARIO_RACEWAY:
break;
case COURSE_CHOCO_MOUNTAIN:
break;
case COURSE_BOWSER_CASTLE:
render_object_thwomps(cameraId);
render_object_bowser_flame(cameraId);
break;
case COURSE_BANSHEE_BOARDWALK:
if (gGamestate != CREDITS_SEQUENCE) {
render_object_trash_bin(cameraId);
render_object_bat(cameraId);
func_8005217C(cameraId);
render_object_boos(cameraId);
}
break;
case COURSE_YOSHI_VALLEY:
func_80055228(cameraId);
if (gGamestate != CREDITS_SEQUENCE) {
render_object_hedgehogs(cameraId);
}
break;
case COURSE_FRAPPE_SNOWLAND:
if (gGamestate != CREDITS_SEQUENCE) {
render_object_snowmans(cameraId);
}
break;
case COURSE_KOOPA_BEACH:
if (gGamestate != CREDITS_SEQUENCE) {
render_object_crabs(cameraId);
}
if (gGamestate != CREDITS_SEQUENCE) {
if ((gPlayerCount == 1) || (gPlayerCount == 2)) {
render_object_seagulls(cameraId);
}
} else {
render_object_seagulls(cameraId);
}
break;
case COURSE_ROYAL_RACEWAY:
break;
case COURSE_LUIGI_RACEWAY:
if (D_80165898 != 0) {
render_object_hot_air_balloon(cameraId);
}
break;
case COURSE_MOO_MOO_FARM:
if (gGamestate != CREDITS_SEQUENCE) {
render_object_moles(cameraId);
}
break;
case COURSE_TOADS_TURNPIKE:
break;
case COURSE_KALAMARI_DESERT:
render_object_trains_smoke_particles(cameraId);
break;
case COURSE_SHERBET_LAND:
if (gGamestate != CREDITS_SEQUENCE) {
func_80052E30(cameraId);
}
render_object_train_penguins(cameraId);
break;
case COURSE_RAINBOW_ROAD:
if (gGamestate != CREDITS_SEQUENCE) {
render_object_neon(cameraId);
render_object_chain_chomps(cameraId);
}
break;
case COURSE_WARIO_STADIUM:
break;
case COURSE_BLOCK_FORT:
break;
case COURSE_SKYSCRAPER:
break;
case COURSE_DOUBLE_DECK:
break;
case COURSE_DK_JUNGLE:
if (gGamestate != CREDITS_SEQUENCE) {
render_object_paddle_boat_smoke_particles(cameraId);
}
break;
}
#else
#endif
render_object_smoke_particles(cameraId);
render_object_leaf_particle(cameraId);
if (D_80165730 != 0) {
func_80053E6C(cameraId);
}
if (gModeSelection == BATTLE) {
render_object_bomb_kart(cameraId);
}
}
void render_snowing_effect(s32 arg0) {
switch (gCurrentCourseId) {
case COURSE_FRAPPE_SNOWLAND:
if (gGamestate != 9) {
if ((D_8015F894 == 0) && (gPlayerCountSelection1 == 1)) {
render_object_snowflakes_particles();
}
} else {
render_object_snowflakes_particles();
}
break;
case COURSE_SHERBET_LAND:
render_ice_block(arg0);
break;
}
}
void func_80058BF4(void) {
gSPDisplayList(gDisplayListHead++, &D_0D0076F8);
}
void func_80058C20(u32 arg0) {
D_8018D21C = arg0;
gSPDisplayList(gDisplayListHead++, &D_0D0076F8);
if (D_8018D22C == 0) {
switch (arg0) {
case RENDER_SCREEN_MODE_1P_PLAYER_ONE:
func_80058F48();
break;
case RENDER_SCREEN_MODE_2P_HORIZONTAL_PLAYER_ONE:
if (!gDemoMode) {
func_80059358();
break;
}
break;
case RENDER_SCREEN_MODE_2P_HORIZONTAL_PLAYER_TWO:
if (!gDemoMode) {
func_800593F0();
break;
}
break;
case RENDER_SCREEN_MODE_2P_VERTICAL_PLAYER_ONE:
if (!gDemoMode) {
func_800594F0();
break;
}
break;
case RENDER_SCREEN_MODE_2P_VERTICAL_PLAYER_TWO:
if (!gDemoMode) {
func_80059528();
break;
}
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_ONE:
if (!gDemoMode) {
func_800596A8();
break;
}
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_TWO:
if (!gDemoMode) {
func_80059710();
break;
}
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_THREE:
if (!gDemoMode) {
func_80059750();
break;
}
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_FOUR:
if ((!gDemoMode) && (gPlayerCountSelection1 == 4)) {
func_800597B8();
}
break;
}
}
}
void render_hud(u32 arg0) {
D_8018D21C = arg0;
gSPDisplayList(gDisplayListHead++, &D_0D0076F8);
if (D_8018D22C == 0) {
switch (arg0) {
case RENDER_SCREEN_MODE_1P_PLAYER_ONE:
func_80058F78();
break;
case RENDER_SCREEN_MODE_2P_HORIZONTAL_PLAYER_ONE:
if (!gDemoMode) {
render_hud_2p_horizontal_player_two_horizontal_player_one();
break;
}
break;
case RENDER_SCREEN_MODE_2P_HORIZONTAL_PLAYER_TWO:
if (!gDemoMode) {
render_hud_2p_horizontal_player_two();
break;
}
break;
case RENDER_SCREEN_MODE_2P_VERTICAL_PLAYER_ONE:
if (!gDemoMode) {
render_hud_2p_vertical_player_one();
break;
}
break;
case RENDER_SCREEN_MODE_2P_VERTICAL_PLAYER_TWO:
if (!gDemoMode) {
render_hud_2p_vertical_player_two();
break;
}
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_ONE:
if (!gDemoMode) {
render_hud_1p_multi();
break;
}
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_TWO:
if (!gDemoMode) {
render_hud_2p_multi();
break;
}
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_THREE:
if (!gDemoMode) {
render_hud_3p_multi();
break;
}
break;
case RENDER_SCREEN_MODE_3P_4P_PLAYER_FOUR:
if ((!gDemoMode) && (gPlayerCountSelection1 == 4)) {
render_hud_4p_multi();
}
break;
}
}
}
void func_80058F48(void) {
if (gHUDDisable == 0) {
set_matrix_hud_screen();
}
}
void func_80058F78(void) {
if (gHUDDisable == 0) {
set_matrix_hud_screen();
if ((!gDemoMode) && (gIsHUDVisible != 0) && (D_801657D8 == 0)) {
draw_item_window(PLAYER_ONE);
if (D_801657E4 != 2) {
render_hud_timer(PLAYER_ONE);
draw_simplified_lap_count(PLAYER_ONE);
func_8004EB38(0);
if (D_801657E6 != false) {
func_8004ED40(0);
}
}
}
}
}
void func_80059024(void) {
}
void func_8005902C(void) {
if (D_8018D2AC != 0) {
switch (gPlayerCountSelection1) {
case 2:
func_8004EB30(PLAYER_ONE);
func_8004EB30(PLAYER_TWO);
break;
case 3:
func_8004EB30(PLAYER_ONE);
func_8004EB30(PLAYER_TWO);
func_8004EB30(PLAYER_THREE);
break;
case 4:
func_8004EB30(PLAYER_ONE);
func_8004EB30(PLAYER_TWO);
func_8004EB30(PLAYER_THREE);
func_8004EB30(PLAYER_FOUR);
break;
}
}
}
void func_800590D4(void) {