summaryrefslogtreecommitdiff
path: root/src/JSystem/JParticle/JPADrawVisitor.cpp
blob: 43f85bb0077ca08384f687e6ae918d36d9846544 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
//
// Generated by dtk
// Translation Unit: JPADrawVisitor.cpp
//

#include "JSystem/JSystem.h" // IWYU pragma: keep

#include "JSystem/JParticle/JPADrawVisitor.h"
#include "JSystem/JParticle/JPABaseShape.h"
#include "JSystem/JParticle/JPAEmitter.h"
#include "JSystem/JParticle/JPAExtraShape.h"
#include "JSystem/JParticle/JPAParticle.h"
#include "JSystem/JParticle/JPAResourceManager.h"
#include "JSystem/JParticle/JPASweepShape.h"
#include "JSystem/JMath/JMATrigonometric.h"
#include "JSystem/JGeometry.h"
#include "dolphin/gx/GX.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/mtx/mtxvec.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JParticle/JPAExTexShape.h"

static inline u32 JPA_U8_THRE(u32 a, u32 b) {
    return ((a * (b + 1)) * 0x10000) >> 24;
}

JPADrawClipBoard* JPADrawContext::pcb;

/* 8025F960-8025FBE4       .text exec__20JPADrawExecLoadExTexFPC14JPADrawContext */
void JPADrawExecLoadExTex::exec(const JPADrawContext* pDC) {
    JUT_ASSERT(50, pDC->pTexIdx);

    u16 texIdx;
    GXTexCoordID coord = GX_TEXCOORD1;
    switch (pDC->petx->getIndTexMode()) {
    case 1:
        GXSetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
        GXEnableTexOffsets(GX_TEXCOORD1, GX_TRUE, GX_TRUE);
        texIdx = pDC->pTexIdx[pDC->petx->getIndTextureID()];
        pDC->mpTextureResource->pTexResArray[texIdx]->load(GX_TEXMAP5);
        coord = GX_TEXCOORD2;
        break;
    case 2:
        GXSetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
        GXSetTexCoordGen(GX_TEXCOORD2, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
        GXEnableTexOffsets(GX_TEXCOORD1, GX_TRUE, GX_TRUE);
        GXEnableTexOffsets(GX_TEXCOORD2, GX_TRUE, GX_TRUE);
        texIdx = pDC->pTexIdx[pDC->petx->getIndTextureID()];
        pDC->mpTextureResource->pTexResArray[texIdx]->load(GX_TEXMAP5);
        texIdx = pDC->pTexIdx[pDC->petx->getSubTextureID()];
        pDC->mpTextureResource->pTexResArray[texIdx]->load(GX_TEXMAP6);
        coord = GX_TEXCOORD3;
        break;
    }

    if (pDC->petx->isEnableSecondTex()) {
        GXSetTexCoordGen(coord, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
        GXEnableTexOffsets(coord, GX_TRUE, GX_TRUE);
        texIdx = pDC->pTexIdx[pDC->petx->getSecondTexIndex()];
        pDC->mpTextureResource->pTexResArray[texIdx]->load(GX_TEXMAP7);
    }
}

/* 8025FBE4-8025FC78       .text exec__20JPADrawExecGenPrjMtxFPC14JPADrawContext */
void JPADrawExecGenPrjMtx::exec(const JPADrawContext* pDC) {
    Mtx mtx;
    f32 aspect = JPABaseEmitter::getAspect();
    f32 fovy = JPABaseEmitter::getFovy();
    C_MTXLightPerspective(mtx, fovy, aspect, 0.5f, -0.5f, 0.5f, 0.5f);
    MTXConcat(mtx, JPADrawContext::pcb->mDrawMtx, mtx);
    GXLoadTexMtxImm(mtx, GX_TEXMTX0, GX_MTX3x4);
    GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_POS, GX_TEXMTX0);
    GXEnableTexOffsets(GX_TEXCOORD0, GX_TRUE, GX_TRUE);
}

/* 8025FC78-8025FF20       .text exec__23JPADrawExecGenPrjTexMtxFPC14JPADrawContext */
void JPADrawExecGenPrjTexMtx::exec(const JPADrawContext* pDC) {
    Mtx projMtx;
    f32 aspect = JPABaseEmitter::getAspect();
    f32 fovy = JPABaseEmitter::getFovy();
    C_MTXLightPerspective(projMtx, fovy, aspect, 0.5f, -0.5f, 0.5f, 0.5f);

    f32 tick = pDC->pbe->getFrame();
    f32 transX = tick * pDC->pbsp->getTexScrollTransX() + pDC->pbsp->getTexStaticTransX();
    f32 transY = tick * pDC->pbsp->getTexScrollTransY() + pDC->pbsp->getTexStaticTransY();
    f32 scaleX = tick * pDC->pbsp->getTexScrollScaleX() + pDC->pbsp->getTexStaticScaleX();
    f32 scaleY = tick * pDC->pbsp->getTexScrollScaleY() + pDC->pbsp->getTexStaticScaleY();
    s32 angle = 0x8000 * (tick * pDC->pbsp->getTexScrollRotate());
    f32 sin = JMASSin(angle);
    f32 cos = JMASCos(angle);

    Mtx mtx;
    mtx[0][0] = scaleX * cos;
    mtx[0][1] = -scaleX * sin;
    mtx[0][2] = scaleX * (sin * (transY + 0.5f) - cos * (transX + 0.5f)) + 0.5f;
    mtx[0][3] = 0.0f;

    mtx[1][0] = scaleY * sin;
    mtx[1][1] = scaleY * cos;
    mtx[1][2] = -scaleY * (sin * (transX + 0.5f) + cos * (transY + 0.5f)) + 0.5f;
    mtx[1][3] = 0.0f;

    mtx[2][0] = 0.0f;
    mtx[2][1] = 0.0f;
    mtx[2][2] = 1.0f;
    mtx[2][3] = 0.0f;

    MTXConcat(mtx, projMtx, projMtx);
    MTXConcat(projMtx, JPADrawContext::pcb->mDrawMtx, mtx);
    GXLoadTexMtxImm(mtx, GX_TEXMTX0, GX_MTX3x4);
    GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_POS, GX_TEXMTX0);
    GXEnableTexOffsets(GX_TEXCOORD0, GX_TRUE, GX_TRUE);
}

/* 8025FF20-8025FF68       .text exec__21JPADrawExecGenTexMtx0FPC14JPADrawContext */
void JPADrawExecGenTexMtx0::exec(const JPADrawContext* pDC) {
    GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_TEXMTX0);
    GXEnableTexOffsets(GX_TEXCOORD0, GX_TRUE, GX_TRUE);
}

/* 8025FF68-8025FFB0       .text exec__20JPADrawExecGenIdtMtxFPC14JPADrawContext */
void JPADrawExecGenIdtMtx::exec(const JPADrawContext* pDC) {
    GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
    GXEnableTexOffsets(GX_TEXCOORD0, GX_TRUE, GX_TRUE);
}

/* 8025FFB0-802602F0       .text exec__20JPADrawExecSetTexMtxFPC14JPADrawContext */
void JPADrawExecSetTexMtx::exec(const JPADrawContext* pDC) {
    s32 tick = pDC->pbe->getFrame();
    f32 tilingX = 0.5f * pDC->pbsp->getTilingX();
    f32 tilingY = 0.5f * pDC->pbsp->getTilingY();
    f32 transX = tick * pDC->pbsp->getTexScrollTransX() + pDC->pbsp->getTexStaticTransX();
    f32 transY = tick * pDC->pbsp->getTexScrollTransY() + pDC->pbsp->getTexStaticTransY();
    f32 scaleX = tick * pDC->pbsp->getTexScrollScaleX() + pDC->pbsp->getTexStaticScaleX();
    f32 scaleY = tick * pDC->pbsp->getTexScrollScaleY() + pDC->pbsp->getTexStaticScaleY();
    s32 angle = 0x8000 * (tick * pDC->pbsp->getTexScrollRotate());
    f32 sin = JMASSin(angle);
    f32 cos = JMASCos(angle);

    Mtx mtx;
    mtx[0][0] = scaleX * cos;
    mtx[0][1] = -scaleX * sin;
    mtx[0][2] = 0.0f;
    mtx[0][3] = tilingX + scaleX * (sin * (tilingY + transY) - cos * (tilingX + transX));

    mtx[1][0] = scaleY * sin;
    mtx[1][1] = scaleY * cos;
    mtx[1][2] = 0.0f;
    mtx[1][3] = tilingY + -scaleY * (sin * (tilingX + transX) + cos * (tilingY + transY));

    mtx[2][0] = 0.0f;
    mtx[2][1] = 0.0f;
    mtx[2][2] = 1.0f;
    mtx[2][3] = 0.0f;

    GXLoadTexMtxImm(mtx, GX_TEXMTX0, GX_MTX2x4);
    GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_TEXMTX0);
    GXEnableTexOffsets(GX_TEXCOORD0, GX_TRUE, GX_TRUE);
}

/* 802602F0-8026031C       .text exec__29JPADrawExecLoadDefaultTextureFPC14JPADrawContext */
void JPADrawExecLoadDefaultTexture::exec(const JPADrawContext* pDC) {
    pDC->mpTextureResource->loadDefaultTexture(GX_TEXMAP0);
}

/* 8026031C-80260364       .text exec__22JPADrawExecLoadTextureFPC14JPADrawContext */
void JPADrawExecLoadTexture::exec(const JPADrawContext* pDC) {
    pDC->mpTextureResource->load(pDC->mpDraw->mTexIdx, GX_TEXMAP0);
}

/* 80260364-802603A4       .text exec__23JPADrawExecSetPointSizeFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecSetPointSize::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    GXSetPointSize(JPADrawContext::pcb->mGlobalScaleX * params->mScaleX, GX_TO_ONE);
}

/* 802603A4-802603E4       .text exec__23JPADrawExecSetLineWidthFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecSetLineWidth::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    GXSetLineWidth(JPADrawContext::pcb->mGlobalScaleX * params->mScaleX, GX_TO_ONE);
}

/* 802603E4-802604AC       .text exec__30JPADrawExecRegisterPrmColorAnmFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecRegisterPrmColorAnm::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    GXColor prm = params->mPrmColor;
    prm.r = JPA_U8_THRE(prm.r, JPADrawContext::pcb->mPrmColor.r);
    prm.g = JPA_U8_THRE(prm.g, JPADrawContext::pcb->mPrmColor.g);
    prm.b = JPA_U8_THRE(prm.b, JPADrawContext::pcb->mPrmColor.b);
    u8 a  = JPA_U8_THRE(prm.a, JPADrawContext::pcb->mPrmColor.a);
    prm.a = params->mAlphaOut * a;
    GXSetTevColor(GX_TEVREG0, prm);
}

/* 802604AC-80260578       .text exec__30JPADrawExecRegisterPrmAlphaAnmFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecRegisterPrmAlphaAnm::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    GXColor prm = pDC->mpDraw->mPrmColor;
    prm.r = JPA_U8_THRE(prm.r, JPADrawContext::pcb->mPrmColor.r);
    prm.g = JPA_U8_THRE(prm.g, JPADrawContext::pcb->mPrmColor.g);
    prm.b = JPA_U8_THRE(prm.b, JPADrawContext::pcb->mPrmColor.b);
    u8 a  = JPA_U8_THRE(prm.a, JPADrawContext::pcb->mPrmColor.a);
    prm.a = params->mAlphaOut * a;
    GXSetTevColor(GX_TEVREG0, prm);
}

/* 80260578-802605FC       .text exec__30JPADrawExecRegisterEnvColorAnmFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecRegisterEnvColorAnm::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    GXColor env = params->mEnvColor;
    env.r = JPA_U8_THRE(env.r, JPADrawContext::pcb->mEnvColor.r);
    env.g = JPA_U8_THRE(env.g, JPADrawContext::pcb->mEnvColor.g);
    env.b = JPA_U8_THRE(env.b, JPADrawContext::pcb->mEnvColor.b);
    GXSetTevColor(GX_TEVREG1, env);
}

/* 802605FC-80260728       .text exec__26JPADrawExecRegisterPrmCEnvFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecRegisterPrmCEnv::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    GXColor prm = params->mPrmColor;
    GXColor env = params->mEnvColor;
    prm.r = JPA_U8_THRE(prm.r, JPADrawContext::pcb->mPrmColor.r);
    prm.g = JPA_U8_THRE(prm.g, JPADrawContext::pcb->mPrmColor.g);
    prm.b = JPA_U8_THRE(prm.b, JPADrawContext::pcb->mPrmColor.b);
    u8 a  = JPA_U8_THRE(prm.a, JPADrawContext::pcb->mPrmColor.a);
    prm.a = params->mAlphaOut * a;
    env.r = JPA_U8_THRE(env.r, JPADrawContext::pcb->mEnvColor.r);
    env.g = JPA_U8_THRE(env.g, JPADrawContext::pcb->mEnvColor.g);
    env.b = JPA_U8_THRE(env.b, JPADrawContext::pcb->mEnvColor.b);
    GXSetTevColor(GX_TEVREG0, prm);
    GXSetTevColor(GX_TEVREG1, env);
}

/* 80260728-80260858       .text exec__26JPADrawExecRegisterPrmAEnvFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecRegisterPrmAEnv::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    GXColor prm = pDC->mpDraw->mPrmColor;
    GXColor env = params->mEnvColor;
    prm.r = JPA_U8_THRE(prm.r, JPADrawContext::pcb->mPrmColor.r);
    prm.g = JPA_U8_THRE(prm.g, JPADrawContext::pcb->mPrmColor.g);
    prm.b = JPA_U8_THRE(prm.b, JPADrawContext::pcb->mPrmColor.b);
    u8 a  = JPA_U8_THRE(prm.a, JPADrawContext::pcb->mPrmColor.a);
    prm.a = params->mAlphaOut * a;
    env.r = JPA_U8_THRE(env.r, JPADrawContext::pcb->mEnvColor.r);
    env.g = JPA_U8_THRE(env.g, JPADrawContext::pcb->mEnvColor.g);
    env.b = JPA_U8_THRE(env.b, JPADrawContext::pcb->mEnvColor.b);
    GXSetTevColor(GX_TEVREG0, prm);
    GXSetTevColor(GX_TEVREG1, env);
}

/* 80260858-80260B68       .text exec__20JPADrawExecSetTexMtxFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecSetTexMtx::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    s32 tick = ptcl->getAge();
    f32 tilingX = 0.5f * pDC->pbsp->getTilingX();
    f32 tilingY = 0.5f * pDC->pbsp->getTilingY();
    f32 transX = tick * pDC->pbsp->getTexScrollTransX() + pDC->pbsp->getTexStaticTransX();
    f32 transY = tick * pDC->pbsp->getTexScrollTransY() + pDC->pbsp->getTexStaticTransY();
    f32 scaleX = tick * pDC->pbsp->getTexScrollScaleX() + pDC->pbsp->getTexStaticScaleX();
    f32 scaleY = tick * pDC->pbsp->getTexScrollScaleY() + pDC->pbsp->getTexStaticScaleY();
    s32 angle = 0x8000 * (tick * pDC->pbsp->getTexScrollRotate());
    f32 sin = JMASSin(angle);
    f32 cos = JMASCos(angle);

    Mtx mtx;
    mtx[0][0] = scaleX * cos;
    mtx[0][1] = -scaleX * sin;
    mtx[0][2] = 0.0f;
    mtx[0][3] = tilingX + (scaleX * ((sin * (tilingY + transY)) - (cos * (tilingX + transX))));

    mtx[1][0] = scaleY * sin;
    mtx[1][1] = scaleY * cos;
    mtx[1][2] = 0.0f;
    mtx[1][3] = tilingY + (-scaleY * ((sin * (tilingX + transX)) + (cos * (tilingY + transY))));

    mtx[2][0] = 0.0f;
    mtx[2][1] = 0.0f;
    mtx[2][2] = 1.0f;
    mtx[2][3] = 0.0f;

    GXLoadTexMtxImm(mtx, GX_TEXMTX0, GX_MTX2x4);
}

/* 80260B68-80260BAC       .text exec__22JPADrawExecLoadTextureFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecLoadTexture::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    pDC->mpTextureResource->load(params->mTexIdx, GX_TEXMAP0);
}

/* 80260BAC-80260D24       .text exec__20JPADrawExecBillBoardFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    if (ptcl->isInvisibleParticle())
        return;

    JPADrawParams* params = ptcl->getDrawParamPPtr();
    f32 scaleX = params->mScaleX;
    f32 scaleY = params->mScaleY;

    f32 x0 = scaleX * (JPADrawContext::pcb->mGlobalScaleX - JPADrawContext::pcb->mPivotX);
    f32 y0 = scaleY * (JPADrawContext::pcb->mGlobalScaleY - JPADrawContext::pcb->mPivotY);
    scaleX *= (JPADrawContext::pcb->mGlobalScaleX + JPADrawContext::pcb->mPivotX);
    scaleY *= (JPADrawContext::pcb->mGlobalScaleY + JPADrawContext::pcb->mPivotY);

    JGeometry::TVec3<f32> pt;
    ptcl->getGlobalPosition(pt);
    MTXMultVec(JPADrawContext::pcb->mDrawMtxPtr, pt, &pt);

    GXBegin(GX_QUADS, GX_VTXFMT0, 4);
    GXPosition3f32(-scaleX + pt.x, +scaleY + pt.y, pt.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[0].x, JPADrawContext::pcb->mTexCoordPt[0].y);
    GXPosition3f32(+x0 + pt.x, +scaleY + pt.y, pt.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[1].x, JPADrawContext::pcb->mTexCoordPt[1].y);
    GXPosition3f32(+x0 + pt.x, -y0 + pt.y, pt.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[2].x, JPADrawContext::pcb->mTexCoordPt[2].y);
    GXPosition3f32(-scaleX + pt.x, -y0 + pt.y, pt.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[3].x, JPADrawContext::pcb->mTexCoordPt[3].y);
    GXEnd();
}

/* 80260D24-80260F2C       .text exec__23JPADrawExecRotBillBoardFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecRotBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    /* Nonmatching */
    if (ptcl->isInvisibleParticle())
        return;

    JPADrawParams* params = ptcl->getDrawParamPPtr();
    f32 sin = JMASSin(params->mRotateAngle);
    f32 cos = JMASCos(params->mRotateAngle);

    f32 scaleX = params->mScaleX;
    f32 scaleY = params->mScaleY;

    f32 x0 = -params->mScaleX * (JPADrawContext::pcb->mGlobalScaleX + JPADrawContext::pcb->mPivotX);
    f32 y0 = +params->mScaleY * (JPADrawContext::pcb->mGlobalScaleY + JPADrawContext::pcb->mPivotY);
    f32 x1 = +params->mScaleX * (JPADrawContext::pcb->mGlobalScaleX - JPADrawContext::pcb->mPivotX);
    f32 y1 = -params->mScaleY * (JPADrawContext::pcb->mGlobalScaleY - JPADrawContext::pcb->mPivotY);

    JGeometry::TVec3<f32> pt;
    ptcl->getGlobalPosition(pt);
    MTXMultVec(JPADrawContext::pcb->mDrawMtxPtr, pt, &pt);

    GXBegin(GX_QUADS, GX_VTXFMT0, 4);
    GXPosition3f32((x0 * cos - y0 * sin) + pt.x, (x0 * sin + y0 * cos) + pt.y, pt.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[0].x, JPADrawContext::pcb->mTexCoordPt[0].y);
    GXPosition3f32((x1 * cos - y0 * sin) + pt.x, (x1 * sin + y0 * cos) + pt.y, pt.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[1].x, JPADrawContext::pcb->mTexCoordPt[1].y);
    GXPosition3f32((x1 * cos - y1 * sin) + pt.x, (x1 * sin + y1 * cos) + pt.y, pt.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[2].x, JPADrawContext::pcb->mTexCoordPt[2].y);
    GXPosition3f32((x0 * cos - y1 * sin) + pt.x, (x0 * sin + y1 * cos) + pt.y, pt.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[3].x, JPADrawContext::pcb->mTexCoordPt[3].y);
    GXEnd();
}

/* 80260F2C-8026110C       .text exec__21JPADrawExecYBillBoardFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecYBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    /* Nonmatching */
}

/* 8026110C-8026134C       .text exec__24JPADrawExecRotYBillBoardFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecRotYBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    /* Nonmatching */
}

/* 8026134C-80261368       .text dirTypeVel__FP15JPABaseParticleP14JPABaseEmitterRQ29JGeometry8TVec3<f> */
void dirTypeVel(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec3<f32>& out) {
    ptcl->getVelVec(out);
}

/* 80261368-80261384       .text dirTypePos__FP15JPABaseParticleP14JPABaseEmitterRQ29JGeometry8TVec3<f> */
void dirTypePos(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec3<f32>& out) {
    ptcl->getLocalPosition(out);
}

/* 80261384-802613C4       .text dirTypePosInv__FP15JPABaseParticleP14JPABaseEmitterRQ29JGeometry8TVec3<f> */
void dirTypePosInv(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec3<f32>& out) {
    ptcl->getLocalPosition(out);
    out.negate();
}

/* 802613C4-802613E8       .text dirTypeEmtrDir__FP15JPABaseParticleP14JPABaseEmitterRQ29JGeometry8TVec3<f> */
void dirTypeEmtrDir(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec3<f32>& out) {
    out.set(JPABaseEmitter::emtrInfo.mgReRDir);
}

/* 802613E8-802614A8       .text dirTypePrevPtcl__FP15JPABaseParticleP14JPABaseEmitterRQ29JGeometry8TVec3<f> */
void dirTypePrevPtcl(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec3<f32>& out) {
    JGeometry::TVec3<f32> pos;
    ptcl->getGlobalPosition(pos);
    JSULink<JPABaseParticle>* prev = ptcl->getLinkBufferPtr()->getPrev();
    if (prev != NULL) {
        prev->getObject()->getGlobalPosition(out);
    } else {
        emtr->calcEmitterGlobalPosition(out);
    }
    out.x -= pos.x;
    out.y -= pos.y;
    out.z -= pos.z;
}

/* 802614A8-802614E8       .text rotTypeY__FffRA3_A4_f */
void rotTypeY(f32 sin, f32 cos, Mtx& out) {
    out[0][0] = cos;
    out[0][1] = 0.0f;
    out[0][2] = -sin;
    out[0][3] = 0.0f;

    out[1][0] = 0.0f;
    out[1][1] = 1.0f;
    out[1][2] = 0.0f;
    out[1][3] = 0.0f;

    out[2][0] = sin;
    out[2][1] = 0.0f;
    out[2][2] = cos;
    out[2][3] = 0.0f;
}

/* 802614E8-80261528       .text rotTypeX__FffRA3_A4_f */
void rotTypeX(f32 sin, f32 cos, Mtx& out) {
    out[0][0] = 1.0f;
    out[0][1] = 0.0f;
    out[0][2] = 0.0f;
    out[0][3] = 0.0f;

    out[1][0] = 0.0f;
    out[1][1] = cos;
    out[1][2] = -sin;
    out[1][3] = 0.0f;

    out[2][0] = 0.0f;
    out[2][1] = sin;
    out[2][2] = cos;
    out[2][3] = 0.0f;
}

/* 80261528-80261568       .text rotTypeZ__FffRA3_A4_f */
void rotTypeZ(f32 sin, f32 cos, Mtx& out) {
    out[0][0] = cos;
    out[0][1] = -sin;
    out[0][2] = 0.0f;
    out[0][3] = 0.0f;

    out[1][0] = sin;
    out[1][1] = cos;
    out[1][2] = 0.0f;
    out[1][3] = 0.0f;

    out[2][0] = 0.0f;
    out[2][1] = 0.0f;
    out[2][2] = 1.0f;
    out[2][3] = 0.0f;
}

/* 80261568-802615C4       .text rotTypeXYZ__FffRA3_A4_f */
void rotTypeXYZ(f32 sin, f32 cos, Mtx& out) {
    f32 a, b, c;
    a = (1.0f - cos) * 0.333333f;
    c = a + (0.57735f * sin);
    b = a - (0.57735f * sin);
    a = a + cos;

    out[0][0] = a;
    out[0][1] = b;
    out[0][2] = c;
    out[0][3] = 0.0f;

    out[1][0] = c;
    out[1][1] = a;
    out[1][2] = b;
    out[1][3] = 0.0f;

    out[2][0] = b;
    out[2][1] = c;
    out[2][2] = a;
    out[2][3] = 0.0f;
}

/* 802615C4-8026161C       .text rotTypeYJiggle__FffRA3_A4_f */
void rotTypeYJiggle(f32 sin, f32 cos, Mtx& out) {
    out[0][0] = cos;
    out[0][1] = -sin * 0.207912f;
    out[0][2] = -sin * 0.978148f;
    out[0][3] = 0.0f;

    out[1][0] = 0.0f;
    out[1][1] = 0.978148f;
    out[1][2] = -0.207912f;
    out[1][3] = 0.0f;

    out[2][0] = sin;
    out[2][1] = cos * 0.207912f;
    out[2][2] = cos * 0.978148f;
    out[2][3] = 0.0f;
}

/* 8026161C-80261654       .text basePlaneTypeXY__FffffPQ29JGeometry8TVec3<f> */
void basePlaneTypeXY(f32 x0, f32 x1, f32 y0, f32 y1, JGeometry::TVec3<f32>* out) {
    out[0].set(x0, y0, 0.0f);
    out[1].set(x1, y0, 0.0f);
    out[2].set(x1, y1, 0.0f);
    out[3].set(x0, y1, 0.0f);
}

/* 80261654-8026168C       .text basePlaneTypeXZ__FffffPQ29JGeometry8TVec3<f> */
void basePlaneTypeXZ(f32 x0, f32 x1, f32 y0, f32 y1, JGeometry::TVec3<f32>* out) {
    out[0].set(x0, 0.0f, y1);
    out[1].set(x1, 0.0f, y1);
    out[2].set(x1, 0.0f, y0);
    out[3].set(x0, 0.0f, y0);
}

/* 8026168C-80261AD0       .text exec__22JPADrawExecDirectionalFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecDirectional::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    /* Nonmatching */
}

/* 80261AD0-80261F60       .text exec__25JPADrawExecRotDirectionalFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecRotDirectional::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    /* Nonmatching */
}

/* 80261F60-802624D4       .text exec__27JPADrawExecDirectionalCrossFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecDirectionalCross::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    /* Nonmatching */
}

/* 802624D4-80262A98       .text exec__30JPADrawExecRotDirectionalCrossFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecRotDirectionalCross::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    /* Nonmatching */
}

/* 80262A98-80262DC0       .text exec__23JPADrawExecDirBillBoardFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecDirBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    /* Nonmatching */
}

/* 80262DC0-80262FBC       .text exec__19JPADrawExecRotationFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecRotation::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    if (ptcl->isInvisibleParticle())
        return;

    JPADrawParams* params = ptcl->getDrawParamPPtr();
    f32 sin = JMASSin(params->mRotateAngle);
    f32 cos = JMASCos(params->mRotateAngle);

    Mtx rotMtx;
    JGeometry::TVec3<f32> pt[4];
    JPADrawContext::pcb->mBasePlaneTypeFunc(
        -params->mScaleX * (JPADrawContext::pcb->mGlobalScaleX + JPADrawContext::pcb->mPivotX),
        +params->mScaleX * (JPADrawContext::pcb->mGlobalScaleX - JPADrawContext::pcb->mPivotX),
        +params->mScaleY * (JPADrawContext::pcb->mGlobalScaleY + JPADrawContext::pcb->mPivotY),
        -params->mScaleY * (JPADrawContext::pcb->mGlobalScaleY - JPADrawContext::pcb->mPivotY),
        pt
    );
    JPADrawContext::pcb->mRotTypeFunc(sin, cos, rotMtx);

    MTXMultVecArray(rotMtx, pt, pt, ARRAY_SIZE(pt));
    JGeometry::TVec3<f32> pos;
    ptcl->getGlobalPosition(pos);

    GXBegin(GX_QUADS, GX_VTXFMT0, 4);
    GXPosition3f32(pt[0].x + pos.x, pt[0].y + pos.y, pt[0].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[0].x, JPADrawContext::pcb->mTexCoordPt[0].y);
    GXPosition3f32(pt[1].x + pos.x, pt[1].y + pos.y, pt[1].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[1].x, JPADrawContext::pcb->mTexCoordPt[1].y);
    GXPosition3f32(pt[2].x + pos.x, pt[2].y + pos.y, pt[2].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[2].x, JPADrawContext::pcb->mTexCoordPt[2].y);
    GXPosition3f32(pt[3].x + pos.x, pt[3].y + pos.y, pt[3].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[3].x, JPADrawContext::pcb->mTexCoordPt[3].y);
    GXEnd();
}

/* 80262FBC-802632EC       .text exec__24JPADrawExecRotationCrossFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecRotationCross::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    /* Nonmatching */
    if (ptcl->isInvisibleParticle())
        return;

    JPADrawParams* params = ptcl->getDrawParamPPtr();
    f32 sin = JMASSin(params->mRotateAngle);
    f32 cos = JMASCos(params->mRotateAngle);

    f32 x0 = -params->mScaleX * (JPADrawContext::pcb->mGlobalScaleX + JPADrawContext::pcb->mPivotX);
    f32 y0 = +params->mScaleY * (JPADrawContext::pcb->mGlobalScaleY + JPADrawContext::pcb->mPivotY);
    f32 x1 = +params->mScaleX * (JPADrawContext::pcb->mGlobalScaleX - JPADrawContext::pcb->mPivotX);
    f32 y1 = -params->mScaleY * (JPADrawContext::pcb->mGlobalScaleY - JPADrawContext::pcb->mPivotY);

    JGeometry::TVec3<f32> pt[8];
    pt[0].set(x0, y0, 0.0f);
    pt[1].set(x1, y0, 0.0f);
    pt[2].set(x1, y1, 0.0f);
    pt[3].set(x0, y1, 0.0f);

    f32 x2 = (x1 + x0) * 0.5f;
    f32 z0 = (x1 - x0) * 0.5f;
    f32 z1 = (x0 - x1) * 0.5f;
    pt[4].set(x2, y0, z0);
    pt[5].set(x2, y0, z1);
    pt[6].set(x2, y1, z1);
    pt[7].set(x2, y1, z0);

    Mtx rotMtx;
    JPADrawContext::pcb->mRotTypeFunc(sin, cos, rotMtx);

    MTXMultVecArray(rotMtx, pt, pt, ARRAY_SIZE(pt));
    JGeometry::TVec3<f32> pos;
    ptcl->getGlobalPosition(pos);

    GXBegin(GX_QUADS, GX_VTXFMT0, 8);
    GXPosition3f32(pt[0].x + pos.x, pt[0].y + pos.y, pt[0].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[0].x, JPADrawContext::pcb->mTexCoordPt[0].y);
    GXPosition3f32(pt[1].x + pos.x, pt[1].y + pos.y, pt[1].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[1].x, JPADrawContext::pcb->mTexCoordPt[1].y);
    GXPosition3f32(pt[2].x + pos.x, pt[2].y + pos.y, pt[2].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[2].x, JPADrawContext::pcb->mTexCoordPt[2].y);
    GXPosition3f32(pt[3].x + pos.x, pt[3].y + pos.y, pt[3].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[3].x, JPADrawContext::pcb->mTexCoordPt[3].y);
    GXPosition3f32(pt[4].x + pos.x, pt[4].y + pos.y, pt[4].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[0].x, JPADrawContext::pcb->mTexCoordPt[0].y);
    GXPosition3f32(pt[5].x + pos.x, pt[5].y + pos.y, pt[5].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[1].x, JPADrawContext::pcb->mTexCoordPt[1].y);
    GXPosition3f32(pt[6].x + pos.x, pt[6].y + pos.y, pt[6].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[2].x, JPADrawContext::pcb->mTexCoordPt[2].y);
    GXPosition3f32(pt[7].x + pos.x, pt[7].y + pos.y, pt[7].z + pos.z);
    GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[3].x, JPADrawContext::pcb->mTexCoordPt[3].y);
    GXEnd();
}

/* 802632EC-80263380       .text exec__16JPADrawExecPointFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecPoint::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    if (ptcl->isInvisibleParticle())
        return;

    JGeometry::TVec3<f32> pos;
    ptcl->getGlobalPosition(pos);
    GXBegin(GX_POINTS, GX_VTXFMT0, 1);
    GXPosition3f32(pos.x, pos.y, pos.z);
    GXTexCoord2f32(0.0f, 0.0f);
    GXEnd();
}

/* 80263380-80263508       .text exec__15JPADrawExecLineFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecLine::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    if (ptcl->isInvisibleParticle())
        return;

    JPADrawParams* params = ptcl->getDrawParamPPtr();
    JGeometry::TVec3<f32> pt0;
    JGeometry::TVec3<f32> vel;

    ptcl->getGlobalPosition(pt0);
    ptcl->getVelVec(vel);
    if (!vel.isZero()) {
        vel.normalize();

        f32 size = JPADrawContext::pcb->mGlobalScaleY * params->mScaleY;
        vel.scale(size);
        JGeometry::TVec3<f32> pt1;
        pt1.sub(pt0, vel);

        GXBegin(GX_LINES, GX_VTXFMT0, 2);
        GXPosition3f32(pt0.x, pt0.y, pt0.z);
        GXTexCoord2f32(0.0f, 0.0f);
        GXPosition3f32(pt1.x, pt1.y, pt1.z);
        GXTexCoord2f32(0.0f, 1.0f);
        GXEnd();
    }
}

/* 80263508-80263510       .text stripeGetNext__FP26JSULink<15JPABaseParticle> */
JSULink<JPABaseParticle>* stripeGetNext(JSULink<JPABaseParticle>* link) {
    return link->getNext();
}

/* 80263510-80263518       .text stripeGetPrev__FP26JSULink<15JPABaseParticle> */
JSULink<JPABaseParticle>* stripeGetPrev(JSULink<JPABaseParticle>* link) {
    return link->getPrev();
}

/* 80263518-80263A68       .text exec__17JPADrawExecStripeFPC14JPADrawContext */
void JPADrawExecStripe::exec(const JPADrawContext* pDC) {
    /* Nonmatching */
}

/* 80263A68-802643B0       .text exec__22JPADrawExecStripeCrossFPC14JPADrawContext */
void JPADrawExecStripeCross::exec(const JPADrawContext* pDC) {
    /* Nonmatching */
}

/* 802643B0-802644B4       .text exec__33JPADrawExecRegisterColorEmitterPEFPC14JPADrawContext */
void JPADrawExecRegisterColorEmitterPE::exec(const JPADrawContext* pDC) {
    GXColor prm = pDC->mpDraw->mPrmColor;
    GXColor env = pDC->mpDraw->mEnvColor;
    prm.r = JPA_U8_THRE(prm.r, JPADrawContext::pcb->mPrmColor.r);
    prm.g = JPA_U8_THRE(prm.g, JPADrawContext::pcb->mPrmColor.g);
    prm.b = JPA_U8_THRE(prm.b, JPADrawContext::pcb->mPrmColor.b);
    prm.a = JPA_U8_THRE(prm.a, JPADrawContext::pcb->mPrmColor.a);
    env.r = JPA_U8_THRE(env.r, JPADrawContext::pcb->mEnvColor.r);
    env.g = JPA_U8_THRE(env.g, JPADrawContext::pcb->mEnvColor.g);
    env.b = JPA_U8_THRE(env.b, JPADrawContext::pcb->mEnvColor.b);
    GXSetTevColor(GX_TEVREG0, prm);
    GXSetTevColor(GX_TEVREG1, env);
}

/* 802644B4-80264554       .text exec__32JPADrawExecRegisterColorEmitterPFPC14JPADrawContext */
void JPADrawExecRegisterColorEmitterP::exec(const JPADrawContext* pDC) {
    GXColor prm = pDC->mpDraw->mPrmColor;
    prm.r = JPA_U8_THRE(prm.r, JPADrawContext::pcb->mPrmColor.r);
    prm.g = JPA_U8_THRE(prm.g, JPADrawContext::pcb->mPrmColor.g);
    prm.b = JPA_U8_THRE(prm.b, JPADrawContext::pcb->mPrmColor.b);
    prm.a = JPA_U8_THRE(prm.a, JPADrawContext::pcb->mPrmColor.a);
    GXSetTevColor(GX_TEVREG0, prm);
}

/* 80264554-802645DC       .text exec__32JPADrawExecRegisterColorEmitterEFPC14JPADrawContext */
void JPADrawExecRegisterColorEmitterE::exec(const JPADrawContext* pDC) {
    GXColor env = pDC->mpDraw->mEnvColor;
    env.r = JPA_U8_THRE(env.r, JPADrawContext::pcb->mEnvColor.r);
    env.g = JPA_U8_THRE(env.g, JPADrawContext::pcb->mEnvColor.g);
    env.b = JPA_U8_THRE(env.b, JPADrawContext::pcb->mEnvColor.b);
    GXSetTevColor(GX_TEVREG1, env);
}

/* 802645DC-80264708       .text exec__31JPADrawExecRegisterColorChildPEFPC14JPADrawContext */
void JPADrawExecRegisterColorChildPE::exec(const JPADrawContext* pDC) {
    GXColor prm = pDC->pssp->getPrm();
    GXColor env = pDC->pssp->getEnv();
    prm.r = JPA_U8_THRE(prm.r, JPADrawContext::pcb->mPrmColor.r);
    prm.g = JPA_U8_THRE(prm.g, JPADrawContext::pcb->mPrmColor.g);
    prm.b = JPA_U8_THRE(prm.b, JPADrawContext::pcb->mPrmColor.b);
    prm.a = JPA_U8_THRE(prm.a, JPADrawContext::pcb->mPrmColor.a);
    env.r = JPA_U8_THRE(env.r, JPADrawContext::pcb->mEnvColor.r);
    env.g = JPA_U8_THRE(env.g, JPADrawContext::pcb->mEnvColor.g);
    env.b = JPA_U8_THRE(env.b, JPADrawContext::pcb->mEnvColor.b);
    GXSetTevColor(GX_TEVREG0, prm);
    GXSetTevColor(GX_TEVREG1, env);
}

/* 80264708-80264774       .text calc__19JPADrawCalcColorPrmFPC14JPADrawContext */
void JPADrawCalcColorPrm::calc(const JPADrawContext* pDC) {
    pDC->mpDraw->mPrmColor = pDC->pbsp->getPrmColor(JPADrawContext::pcb->mColorAnmFrame);
}

/* 80264774-802647E0       .text calc__19JPADrawCalcColorEnvFPC14JPADrawContext */
void JPADrawCalcColorEnv::calc(const JPADrawContext* pDC) {
    pDC->mpDraw->mEnvColor = pDC->pbsp->getEnvColor(JPADrawContext::pcb->mColorAnmFrame);
}

/* 802647E0-8026486C       .text calc__30JPADrawCalcColorAnmFrameNormalFPC14JPADrawContext */
void JPADrawCalcColorAnmFrameNormal::calc(const JPADrawContext* pDC) {
    s32 tick = pDC->pbe->getFrame();
    s32 frame = (tick < pDC->pbsp->getColorRegAnmMaxFrm()) ? tick : pDC->pbsp->getColorRegAnmMaxFrm();
    JPADrawContext::pcb->mColorAnmFrame = frame;
}

/* 8026486C-802648E0       .text calc__30JPADrawCalcColorAnmFrameRepeatFPC14JPADrawContext */
void JPADrawCalcColorAnmFrameRepeat::calc(const JPADrawContext* pDC) {
    f32 tick = pDC->pbe->getFrame();
    s32 frame = ((u32)tick) % (pDC->pbsp->getColorRegAnmMaxFrm() + 1);
    JPADrawContext::pcb->mColorAnmFrame = frame;
}

/* 802648E0-8026495C       .text calc__31JPADrawCalcColorAnmFrameReverseFPC14JPADrawContext */
void JPADrawCalcColorAnmFrameReverse::calc(const JPADrawContext* pDC) {
    s32 tick = pDC->pbe->getFrame();
    s32 maxFrame = pDC->pbsp->getColorRegAnmMaxFrm();
    s32 odd = (tick / maxFrame) & 1; // whether we're on an even or odd loop
    s32 frame = tick % maxFrame;
    JPADrawContext::pcb->mColorAnmFrame = frame + (odd * maxFrame) - 2 * (odd * frame);
}

/* 8026495C-8026496C       .text calc__29JPADrawCalcColorAnmFrameMergeFPC14JPADrawContext */
void JPADrawCalcColorAnmFrameMerge::calc(const JPADrawContext* pDC) {
    JPADrawContext::pcb->mColorAnmFrame = 0;
}

/* 8026496C-8026497C       .text calc__30JPADrawCalcColorAnmFrameRandomFPC14JPADrawContext */
void JPADrawCalcColorAnmFrameRandom::calc(const JPADrawContext* pDC) {
    JPADrawContext::pcb->mColorAnmFrame = 0;
}

/* 8026497C-80264A34       .text calc__32JPADrawCalcTextureAnmIndexNormalFPC14JPADrawContext */
void JPADrawCalcTextureAnmIndexNormal::calc(const JPADrawContext* pDC) {
    s32 tick = pDC->pbe->getFrame();
    s32 idx = ((pDC->pbsp->getTextureAnmKeyNum() - 1) < tick) ? pDC->pbsp->getTextureAnmKeyNum() - 1 : tick;
    pDC->mpDraw->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(idx)];
}

/* 80264A34-80264AD0       .text calc__32JPADrawCalcTextureAnmIndexRepeatFPC14JPADrawContext */
void JPADrawCalcTextureAnmIndexRepeat::calc(const JPADrawContext* pDC) {
    s32 tick = pDC->pbe->getFrame();
    pDC->mpDraw->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(tick % pDC->pbsp->getTextureAnmKeyNum())];
}

/* 80264AD0-80264B80       .text calc__33JPADrawCalcTextureAnmIndexReverseFPC14JPADrawContext */
void JPADrawCalcTextureAnmIndexReverse::calc(const JPADrawContext* pDC) {
    s32 tick = pDC->pbe->getFrame();
    s32 maxFrame = pDC->pbsp->getTextureAnmKeyNum() - 1;
    s32 odd = (tick / maxFrame) & 1; // whether we're on an even or odd loop
    s32 frame = tick % maxFrame;
    pDC->mpDraw->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(frame + (odd * maxFrame) - 2 * (odd * frame))];
}

/* 80264B80-80264BC8       .text calc__31JPADrawCalcTextureAnmIndexMergeFPC14JPADrawContext */
void JPADrawCalcTextureAnmIndexMerge::calc(const JPADrawContext* pDC) {
    pDC->mpDraw->mTexIdx = pDC->pbsp->getTextureIndex();
}

/* 80264BC8-80264C10       .text calc__32JPADrawCalcTextureAnmIndexRandomFPC14JPADrawContext */
void JPADrawCalcTextureAnmIndexRandom::calc(const JPADrawContext* pDC) {
    pDC->mpDraw->mTexIdx = pDC->pbsp->getTextureIndex();
}

/* 80264C10-80264C4C       .text exec__19JPADrawExecCallBackFPC14JPADrawContext */
void JPADrawExecCallBack::exec(const JPADrawContext* pDC) {
    if (pDC->pbe->mpEmitterCallBack != NULL)
        pDC->pbe->mpEmitterCallBack->draw(pDC->pbe);
}

/* 80264C4C-80264C88       .text exec__19JPADrawExecCallBackFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecCallBack::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPABaseEmitter* pbe = pDC->pbe;
    ptcl->drawCB(pbe);
}

/* 80264C88-80264DB8       .text calc__17JPADrawCalcScaleXFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcScaleX::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    if (JPADrawContext::pcb->mScaleAnmTiming < pDC->pesp->getScaleInTiming()) {
        params->mScaleX = params->mScaleOut * ((pDC->pesp->getIncreaseRateX() * JPADrawContext::pcb->mScaleAnmTiming) + pDC->pesp->getScaleInValueX());
    } else if (JPADrawContext::pcb->mScaleAnmTiming > pDC->pesp->getScaleOutTiming()) {
        params->mScaleX = params->mScaleOut * ((pDC->pesp->getDecreaseRateX() * (JPADrawContext::pcb->mScaleAnmTiming - pDC->pesp->getScaleOutTiming())) + 1.0f);
    } else {
        params->mScaleX = params->mScaleOut;
    }
}

/* 80264DB8-80264EE8       .text calc__17JPADrawCalcScaleYFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcScaleY::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    if (JPADrawContext::pcb->mScaleAnmTiming < pDC->pesp->getScaleInTiming()) {
        params->mScaleY = params->mScaleOut * ((pDC->pesp->getIncreaseRateY() * JPADrawContext::pcb->mScaleAnmTiming) + pDC->pesp->getScaleInValueY());
    } else if (JPADrawContext::pcb->mScaleAnmTiming > pDC->pesp->getScaleOutTiming()) {
        params->mScaleY = params->mScaleOut * ((pDC->pesp->getDecreaseRateY() * (JPADrawContext::pcb->mScaleAnmTiming - pDC->pesp->getScaleOutTiming())) + 1.0f);
    } else {
        params->mScaleY = params->mScaleOut;
    }
}

/* 80264EE8-802650B8       .text calc__24JPADrawCalcScaleXBySpeedFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcScaleXBySpeed::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    JGeometry::TVec3<f32> vel;
    ptcl->getVelVec(vel);
    if (JPADrawContext::pcb->mScaleAnmTiming < pDC->pesp->getScaleInTiming()) {
        params->mScaleX = params->mScaleOut * ((pDC->pesp->getIncreaseRateX() * JPADrawContext::pcb->mScaleAnmTiming) + pDC->pesp->getScaleInValueX());
    } else if (JPADrawContext::pcb->mScaleAnmTiming > pDC->pesp->getScaleOutTiming()) {
        params->mScaleX = params->mScaleOut * ((pDC->pesp->getDecreaseRateX() * (JPADrawContext::pcb->mScaleAnmTiming - pDC->pesp->getScaleOutTiming())) + 1.0f);
    } else {
        params->mScaleX = params->mScaleOut;
    }
    params->mScaleX *= vel.length() * 0.01f;
}

/* 802650B8-80265288       .text calc__24JPADrawCalcScaleYBySpeedFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcScaleYBySpeed::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    JGeometry::TVec3<f32> vel;
    ptcl->getVelVec(vel);
    if (JPADrawContext::pcb->mScaleAnmTiming < pDC->pesp->getScaleInTiming()) {
        params->mScaleY = params->mScaleOut * ((pDC->pesp->getIncreaseRateY() * JPADrawContext::pcb->mScaleAnmTiming) + pDC->pesp->getScaleInValueY());
    } else if (JPADrawContext::pcb->mScaleAnmTiming > pDC->pesp->getScaleOutTiming()) {
        params->mScaleY = params->mScaleOut * ((pDC->pesp->getDecreaseRateY() * (JPADrawContext::pcb->mScaleAnmTiming - pDC->pesp->getScaleOutTiming())) + 1.0f);
    } else {
        params->mScaleY = params->mScaleOut;
    }
    params->mScaleY *= vel.length() * 0.01f;
}

/* 80265288-80265294       .text calc__23JPADrawCalcScaleCopyX2YFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcScaleCopyX2Y::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    params->mScaleY = params->mScaleX;
}

/* 80265294-802652A4       .text calc__31JPADrawCalcScaleAnmTimingNormalFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcScaleAnmTimingNormal::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawContext::pcb->mScaleAnmTiming = ptcl->mCurNormTime;
}

/* 802652A4-80265374       .text calc__32JPADrawCalcScaleAnmTimingRepeatXFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcScaleAnmTimingRepeatX::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawContext::pcb->mScaleAnmTiming = (ptcl->getAge() % pDC->pesp->getAnmCycleX()) / (f32)pDC->pesp->getAnmCycleX();
}

/* 80265374-80265444       .text calc__32JPADrawCalcScaleAnmTimingRepeatYFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcScaleAnmTimingRepeatY::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawContext::pcb->mScaleAnmTiming = (ptcl->getAge() % pDC->pesp->getAnmCycleY()) / (f32)pDC->pesp->getAnmCycleY();
}

/* 80265444-80265588       .text calc__33JPADrawCalcScaleAnmTimingReverseXFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcScaleAnmTimingReverseX::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    f32 odd = (ptcl->getAge() / pDC->pesp->getAnmCycleX()) & 1; // whether we're on an even or odd loop
    f32 frame = (f32)(ptcl->getAge() % pDC->pesp->getAnmCycleX()) / pDC->pesp->getAnmCycleX();
    JPADrawContext::pcb->mScaleAnmTiming = odd + (frame - odd * 2.0f * frame);
}

/* 80265588-802656CC       .text calc__33JPADrawCalcScaleAnmTimingReverseYFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcScaleAnmTimingReverseY::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    f32 odd = (ptcl->getAge() / pDC->pesp->getAnmCycleY()) & 1; // whether we're on an even or odd loop
    f32 frame = (f32)(ptcl->getAge() % pDC->pesp->getAnmCycleY()) / pDC->pesp->getAnmCycleY();
    JPADrawContext::pcb->mScaleAnmTiming = odd + (frame - odd * 2.0f * frame);
}

/* 802656CC-80265734       .text calc__19JPADrawCalcColorPrmFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorPrm::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    params->mPrmColor = pDC->pbsp->getPrmColor(JPADrawContext::pcb->mColorAnmFrame);
}

/* 80265734-8026579C       .text calc__19JPADrawCalcColorEnvFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorEnv::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    params->mEnvColor = pDC->pbsp->getEnvColor(JPADrawContext::pcb->mColorAnmFrame);
}

/* 8026579C-802657E8       .text calc__31JPADrawCalcColorCopyFromEmitterFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorCopyFromEmitter::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    params->mPrmColor = pDC->mpDraw->mPrmColor;
    params->mEnvColor = pDC->mpDraw->mEnvColor;
}

/* 802657E8-80265880       .text calc__30JPADrawCalcColorAnmFrameNormalFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorAnmFrameNormal::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    s32 frame = (ptcl->getAge() < pDC->pbsp->getColorRegAnmMaxFrm()) ? ptcl->getAge() : pDC->pbsp->getColorRegAnmMaxFrm();
    JPADrawContext::pcb->mColorAnmFrame = frame;
}

/* 80265880-80265918       .text calc__30JPADrawCalcColorAnmFrameRepeatFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorAnmFrameRepeat::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    s32 tick = ptcl->getAge();
    s32 frame = ((params->mLoopOffset & pDC->pbsp->getColLoopOffset()) + tick) % (pDC->pbsp->getColorRegAnmMaxFrm() + 1);
    JPADrawContext::pcb->mColorAnmFrame = frame;
}

/* 80265918-802659C4       .text calc__31JPADrawCalcColorAnmFrameReverseFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorAnmFrameReverse::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    s32 loopOffset = pDC->pbsp->getColLoopOffset();
    loopOffset = params->mLoopOffset & loopOffset;
    s32 maxFrame = pDC->pbsp->getColorRegAnmMaxFrm();
    s32 t = loopOffset + ptcl->getAge();
    s32 odd = (t / maxFrame) & 1;
    s32 frame = t % maxFrame;
    JPADrawContext::pcb->mColorAnmFrame = frame + (odd * maxFrame) - 2 * (odd * frame);
}

/* 802659C4-80265A90       .text calc__29JPADrawCalcColorAnmFrameMergeFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorAnmFrameMerge::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    s32 start = params->mLoopOffset & pDC->pbsp->getColLoopOffset();
    s32 maxFrame = pDC->pbsp->getColorRegAnmMaxFrm() + 1;
    s32 frame = (s32)(start + maxFrame * ptcl->mCurNormTime) % maxFrame;
    JPADrawContext::pcb->mColorAnmFrame = frame;
}

/* 80265A90-80265B14       .text calc__30JPADrawCalcColorAnmFrameRandomFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorAnmFrameRandom::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    s32 frame = (params->mLoopOffset & pDC->pbsp->getColLoopOffset()) % (pDC->pbsp->getColorRegAnmMaxFrm() + 1);
    JPADrawContext::pcb->mColorAnmFrame = frame;
}

/* 80265B14-80265C40       .text calc__16JPADrawCalcAlphaFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcAlpha::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    f32 time = ptcl->mCurNormTime;
    f32 alpha;
    if (time < pDC->pesp->getAlphaInTiming()) {
        alpha = time * pDC->pesp->getAlphaIncreaseRate() + pDC->pesp->getAlphaInValue();
    } else if (time > pDC->pesp->getAlphaOutTiming()) {
        alpha = pDC->pesp->getAlphaBaseValue() + pDC->pesp->getAlphaDecreaseRate() * (time - pDC->pesp->getAlphaOutTiming());
    } else {
        alpha = pDC->pesp->getAlphaBaseValue();
    }
    params->mAlphaOut = alpha;
}

/* 80265C40-80265D54       .text calc__27JPADrawCalcAlphaFlickNrmSinFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcAlphaFlickNrmSin::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    f32 sin = JMASSin((ptcl->getAge() * 0x4000) * params->mAlphaWaveRandom * (1.0f - pDC->pesp->getAlphaWaveParam1()));
    params->mAlphaOut *= params->mAlphaWaveRandom * (((sin - 1.0f) * 0.5f) * pDC->pesp->getAlphaWaveParam3()) + 1.0f;
    if (params->mAlphaOut < 0.0f)
        params->mAlphaOut = 0.0f;
}

/* 80265D54-80265EC4       .text calc__27JPADrawCalcAlphaFlickAddSinFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcAlphaFlickAddSin::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    /* Nonmatching - operand swap */
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    f32 theta = (ptcl->getAge() * 0x4000) * params->mAlphaWaveRandom;
    f32 sin2 = JMASSin(theta * (1.0f - pDC->pesp->getAlphaWaveParam2()));
    f32 sin1 = JMASSin(theta * (1.0f - pDC->pesp->getAlphaWaveParam1()));
    params->mAlphaOut *= (params->mAlphaWaveRandom * ((((sin1 + sin2) - 2.0f) * 0.5f) * pDC->pesp->getAlphaWaveParam3()) + 2.0f) * 0.5f;
    if (params->mAlphaOut < 0.0f)
        params->mAlphaOut = 0.0f;
}

/* 80265EC4-80266048       .text calc__28JPADrawCalcAlphaFlickMultSinFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcAlphaFlickMultSin::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    f32 theta = (ptcl->getAge() * 0x4000) * params->mAlphaWaveRandom;
    f32 mul3 = (pDC->pesp->getAlphaWaveParam3() * 0.5f) * params->mAlphaWaveRandom;
    f32 sin2 = JMASSin(theta * (1.0f - pDC->pesp->getAlphaWaveParam2()));
    f32 sin1 = JMASSin(theta * (1.0f - pDC->pesp->getAlphaWaveParam1()));
    params->mAlphaOut *= ((mul3 * (sin1 - 1.0f)) + 1.0f) * ((mul3 * (sin2 - 1.0f)) + 1.0f);
    if (params->mAlphaOut < 0.0f)
        params->mAlphaOut = 0.0f;
}

/* 80266048-80266100       .text calc__32JPADrawCalcTextureAnmIndexNormalFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcTextureAnmIndexNormal::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    s32 idx = ((pDC->pbsp->getTextureAnmKeyNum() - 1) < (s32)ptcl->getAge()) ? (pDC->pbsp->getTextureAnmKeyNum() - 1) : ptcl->getAge();
    params->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(idx)];
}

/* 80266100-802661B4       .text calc__32JPADrawCalcTextureAnmIndexRepeatFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcTextureAnmIndexRepeat::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    s32 tick = ptcl->getAge();
    params->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(((params->mLoopOffset & pDC->pbsp->getTexLoopOffset()) + tick) % pDC->pbsp->getTextureAnmKeyNum())];
}

/* 802661B4-80266284       .text calc__33JPADrawCalcTextureAnmIndexReverseFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcTextureAnmIndexReverse::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    s32 loopOffset = pDC->pbsp->getTexLoopOffset();
    loopOffset = params->mLoopOffset & loopOffset;
    s32 maxFrame = pDC->pbsp->getTextureAnmKeyNum() - 1;
    s32 t = loopOffset + ptcl->getAge();
    s32 odd = (t / maxFrame) & 1;
    s32 frame = t % maxFrame;
    params->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(frame + (odd * maxFrame) - 2 * (odd * frame))];
}

/* 80266284-8026636C       .text calc__31JPADrawCalcTextureAnmIndexMergeFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcTextureAnmIndexMerge::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    s32 maxFrame = pDC->pbsp->getTextureAnmKeyNum();
    s32 start = params->mLoopOffset & pDC->pbsp->getTexLoopOffset();
    s32 frame = (s32)(start + maxFrame * ptcl->mCurNormTime) % maxFrame;
    params->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(frame)];
}

/* 8026636C-8026640C       .text calc__32JPADrawCalcTextureAnmIndexRandomFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcTextureAnmIndexRandom::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    s32 start = params->mLoopOffset & pDC->pbsp->getTexLoopOffset();
    params->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(start % pDC->pbsp->getTextureAnmKeyNum())];
}

/* 8026640C-80266420       .text calc__24JPADrawCalcChildAlphaOutFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcChildAlphaOut::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    params->mAlphaOut = 1.0f - ptcl->mCurNormTime;
}

/* 80266420-80266450       .text calc__24JPADrawCalcChildScaleOutFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcChildScaleOut::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
    JPADrawParams* params = ptcl->getDrawParamPPtr();
    params->mScaleX = params->mScaleOut * (1.0f - ptcl->mCurNormTime);
    params->mScaleY = params->mAlphaWaveRandom * (1.0f - ptcl->mCurNormTime);
}