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
|
//
// Generated By: dol2asm
// Translation Unit: d/d_menu_fmap_map
//
#include "d/d_menu_fmap_map.h"
#include "JSystem/JUtility/JUTTexture.h"
#include "SSystem/SComponent/c_math.h"
#include "d/d_com_inf_game.h"
#include "m_Do/m_Do_graphic.h"
#include "dol2asm.h"
//
// Forward References:
//
extern "C" static void twoValueLineInterpolation__FUcUcf();
extern "C" static void twoColorLineInterporation__FRC8_GXColorRC8_GXColorfR8_GXColor();
extern "C" void init__15renderingFmap_cFPUcUsUsUsUs();
extern "C" void entry__15renderingFmap_cFP23dMenu_Fmap_world_data_cifff();
extern "C" void isSwitchSpecialOff__15renderingFmap_cFi();
extern "C" void isSwitch__15renderingFmap_cFPCQ211dDrawPath_c11group_class();
extern "C" void getPointStagePathInnerNo__15renderingFmap_cFP24dMenu_Fmap_region_data_cffiPiPi();
extern "C" void preDrawPath__15renderingFmap_cFv();
extern "C" bool isDrawPath__15renderingFmap_cFv();
extern "C" void isDrawRoom__15renderingFmap_cFv();
extern "C" void postDrawPath__15renderingFmap_cFv();
extern "C" void postRenderingMap__15renderingFmap_cFv();
extern "C" void roomSetteing__15renderingFmap_cFv();
extern "C" void getFirstRoomPointer__15renderingFmap_cFv();
extern "C" void getFirstRegion__15renderingFmap_cFv();
extern "C" void getFirstStage__15renderingFmap_cFv();
extern "C" void getFirstRoom__15renderingFmap_cFv();
extern "C" void getNextRoom__15renderingFmap_cFv();
extern "C" void getNextStage__15renderingFmap_cFv();
extern "C" void getNextRegion__15renderingFmap_cFv();
extern "C" void getNextRoomPointer__15renderingFmap_cFv();
extern "C" void setFmapPaletteColor__15dMenu_FmapMap_cFQ215renderingFmap_c9palette_eUcUcUcUc();
extern "C" void setFmapPaletteColor__15dMenu_FmapMap_cFQ215renderingFmap_c9palette_eRC8_GXColor();
extern "C" void isFlashRoomNoCheck__15dMenu_FmapMap_cCFi();
extern "C" void setPointColor__15dMenu_FmapMap_cFf();
extern "C" void __ct__15dMenu_FmapMap_cFv();
extern "C" void __dt__15dMenu_FmapMap_cFv();
extern "C" void _create__15dMenu_FmapMap_cFUsUsUsUsPv();
extern "C" void _delete__15dMenu_FmapMap_cFv();
extern "C" void draw__15dMenu_FmapMap_cFv();
extern "C" void rendering__15dMenu_FmapMap_cFPCQ211dDrawPath_c10line_class();
extern "C" void getLineWidth__15dMenu_FmapMap_cFi();
extern "C" void isDrawType__15dMenu_FmapMap_cFi();
extern "C" void setFlashOn__15dMenu_FmapMap_cFiiPUci();
extern "C" void getLineColor__15dMenu_FmapMap_cFii();
extern "C" void getBackColor__15dMenu_FmapMap_cCFv();
extern "C" void getColor__15dMenu_FmapMap_cFi();
extern "C" void setTexture__15dMenu_FmapMap_cFUsUsUsUs();
extern "C" void setRendering__15dMenu_FmapMap_cFP23dMenu_Fmap_world_data_ciffff();
extern "C" void __dt__15renderingFmap_cFv();
extern "C" bool isRenderingFloor__15renderingFmap_cFi();
extern "C" void beforeDrawPath__15renderingFmap_cFv();
extern "C" void afterDrawPath__15renderingFmap_cFv();
extern "C" extern char const* const d_menu_d_menu_fmap_map__stringBase0;
extern "C" u8 m_other__22dMfm_HIO_prm_res_src_s[1 + 3 /* padding */];
//
// External References:
//
extern "C" void mDoMtx_lookAt__FPA4_fPC3VecPC3VecPC3Vecs();
extern "C" void draw__12dDlst_base_cFv();
extern "C" bool isDrawType__11dDrawPath_cFi();
extern "C" void getLineColor__11dDrawPath_cFii();
extern "C" void dComIfGs_isStageSwitch__Fii();
extern "C" void dComIfGp_getNowLevel__Fv();
extern "C" void isSwitch__10dSv_info_cCFii();
extern "C" void rendering__11dDrawPath_cFPCQ211dDrawPath_c10line_class();
extern "C" void rendering__11dDrawPath_cFPCQ211dDrawPath_c10poly_class();
extern "C" void rendering__11dDrawPath_cFPCQ211dDrawPath_c10room_class();
extern "C" void drawPath__11dDrawPath_cFv();
extern "C" void makeResTIMG__15dRenderingMap_cCFP7ResTIMGUsUsPUcPUcUs();
extern "C" void renderingMap__15dRenderingMap_cFv();
extern "C" void preRenderingMap__18dRenderingFDAmap_cFv();
extern "C" void postRenderingMap__18dRenderingFDAmap_cFv();
extern "C" void renderingDecoration__18dRenderingFDAmap_cFPCQ211dDrawPath_c10line_class();
extern "C" void getDecoLineColor__18dRenderingFDAmap_cFii();
extern "C" void getDecorationLineWidth__18dRenderingFDAmap_cFi();
extern "C" void isArrival__22dMenu_Fmap_room_data_cFv();
extern "C" void getPointStagePathInnerNo__24dMenu_Fmap_region_data_cFffiPiPi();
extern "C" void set__12dDlst_list_cFRPP12dDlst_base_cRPP12dDlst_base_cP12dDlst_base_c();
extern "C" void* __nw__FUli();
extern "C" void* __nwa__FUli();
extern "C" void __dl__FPv();
extern "C" void __dla__FPv();
extern "C" void GXClearVtxDesc();
extern "C" void _savegpr_27();
extern "C" void _savegpr_28();
extern "C" void _savegpr_29();
extern "C" void _restgpr_27();
extern "C" void _restgpr_28();
extern "C" void _restgpr_29();
extern "C" extern void* __vt__12dDlst_base_c[3];
extern "C" extern void* __vt__28dDrawPathWithNormalPattern_c[16];
extern "C" extern void* __vt__15dRenderingMap_c[23];
extern "C" extern void* __vt__18dRenderingFDAmap_c[26];
extern "C" extern void* __vt__11dDrawPath_c[16];
extern "C" u8 sincosTable___5JMath[65536];
//
// Declarations:
//
/* ############################################################################################## */
/* 80454178-80454180 002778 0008+00 3/3 0/0 0/0 .sdata2 @3689 */
SECTION_SDATA2 static f64 lit_3689 = 4503599627370496.0 /* cast u32 to float */;
/* 801CE068-801CE0CC 1C89A8 0064+00 1/1 0/0 0/0 .text twoValueLineInterpolation__FUcUcf
*/
static u8 twoValueLineInterpolation(u8 i_value1, u8 i_value2, f32 i_param) {
return (u8)((f32)i_value1 + i_param * ((f32)i_value2 - (f32)i_value1));
}
/* 801CE0CC-801CE15C 1C8A0C 0090+00 2/2 0/0 0/0 .text
* twoColorLineInterporation__FRC8_GXColorRC8_GXColorfR8_GXColor */
static void twoColorLineInterporation(GXColor const& i_color1, GXColor const& i_color2,
f32 i_param, GXColor& o_color) {
o_color.r = twoValueLineInterpolation(i_color1.r, i_color2.r, i_param);
o_color.g = twoValueLineInterpolation(i_color1.g, i_color2.g, i_param);
o_color.b = twoValueLineInterpolation(i_color1.b, i_color2.b, i_param);
o_color.a = twoValueLineInterpolation(i_color1.a, i_color2.a, i_param);
}
/* ############################################################################################## */
/* 80454180-80454184 002780 0004+00 3/3 0/0 0/0 .sdata2 @3703 */
SECTION_SDATA2 static u8 lit_3703[4] = {
0x00,
0x00,
0x00,
0x00,
};
/* 801CE15C-801CE188 1C8A9C 002C+00 1/1 0/0 0/0 .text init__15renderingFmap_cFPUcUsUsUsUs
*/
void renderingFmap_c::init(u8* param_0, u16 i_texWidth, u16 i_texHeight, u16 param_3, u16 param_4) {
field_0x4 = param_0;
mTexWidth = i_texWidth;
mTexHeight = i_texHeight;
field_0x20 = param_3;
field_0x22 = param_4;
mPosX = 0.0f;
mPosZ = 0.0f;
mDrawEnable = false;
}
/* ############################################################################################## */
/* 80454184-80454188 002784 0004+00 3/3 0/0 0/0 .sdata2 @3711 */
SECTION_SDATA2 static f32 lit_3711 = 1.0f;
/* 801CE188-801CE224 1C8AC8 009C+00 1/1 0/0 0/0 .text
* entry__15renderingFmap_cFP23dMenu_Fmap_world_data_cifff */
void renderingFmap_c::entry(dMenu_Fmap_world_data_c* i_worldData, int i_startStageNo,
f32 i_posX, f32 i_posY, f32 i_scale) {
mpWorldData = i_worldData;
mStartStageNo = i_startStageNo;
mPosX = i_posX;
mPosZ = i_posY;
mCmPerTexel = i_scale;
field_0x8 = mCmPerTexel * field_0x20 * mDoGph_gInf_c::getScale();
field_0xc = mCmPerTexel * field_0x22;
dComIfGd_setCopy2D(this);
}
/* 801CE224-801CE288 1C8B64 0064+00 1/1 0/0 0/0 .text isSwitchSpecialOff__15renderingFmap_cFi */
bool renderingFmap_c::isSwitchSpecialOff(int i_swbit) {
return !strcmp(dComIfGp_getStartStageName(), "F_SP121") && i_swbit == 0xb2;
}
/* 801CE288-801CE3C0 1C8BC8 0138+00 2/0 0/0 0/0 .text
* isSwitch__15renderingFmap_cFPCQ211dDrawPath_c11group_class */
bool renderingFmap_c::isSwitch(dDrawPath_c::group_class const* i_group) {
if (i_group->mSwbit == 0xff) {
return true;
}
if (i_group->field_0x1 == 0) {
if (isSwitchSpecialOff(i_group->mSwbit)) {
return true;
}
} else {
if (isSwitchSpecialOff(i_group->mSwbit)) {
return false;
}
}
if (mRegionNo == dComIfGp_getNowLevel() && mStageNo == mStartStageNo) {
if (i_group->field_0x1 == 0) {
return !dComIfGs_isSwitch(i_group->mSwbit, mRoomNo);
} else {
return dComIfGs_isSwitch(i_group->mSwbit, mRoomNo) ? true : false;
}
} else {
if (i_group->mSwbit < 0x80) {
if (i_group->field_0x1 != 0) {
return dComIfGs_isStageSwitch(mSaveTableNo, i_group->mSwbit) ? true : false;
} else {
return !dComIfGs_isStageSwitch(mSaveTableNo, i_group->mSwbit);
}
} else {
return i_group->field_0x1 == 0;
}
}
}
/* 801CE3C0-801CE410 1C8D00 0050+00 0/0 3/3 0/0 .text
* getPointStagePathInnerNo__15renderingFmap_cFP24dMenu_Fmap_region_data_cffiPiPi */
int renderingFmap_c::getPointStagePathInnerNo(dMenu_Fmap_region_data_c* i_regionData,
f32 i_offsetX, f32 i_offsetY, int i_stageNo,
int* o_stageNo, int* o_roomNo) {
return i_regionData->getPointStagePathInnerNo(mPosX + i_offsetX * mCmPerTexel,
mPosZ + i_offsetY * mCmPerTexel,
i_stageNo, o_stageNo, o_roomNo);
}
/* ############################################################################################## */
/* 80454188-8045418C 002788 0004+00 1/1 0/0 0/0 .sdata2 @3769 */
SECTION_SDATA2 static f32 lit_3769 = -5000.0f;
/* 8045418C-80454190 00278C 0004+00 1/1 0/0 0/0 .sdata2 @3770 */
SECTION_SDATA2 static f32 lit_3770 = 5000.0f;
/* 80454190-80454194 002790 0004+00 1/1 0/0 0/0 .sdata2 @3771 */
SECTION_SDATA2 static f32 lit_3771 = -1.0f;
/* 801CE410-801CE4D4 1C8D50 00C4+00 2/0 0/0 0/0 .text preDrawPath__15renderingFmap_cFv */
void renderingFmap_c::preDrawPath() {
mEye.x = mPosX;
mEye.y = mPosZ;
mEye.z = -5000.0f;
mCenter.x = mPosX;
mCenter.y = mPosZ;
mCenter.z = 5000.0f;
mUp.x = 0.0f;
mUp.y = -1.0f;
mUp.z = 0.0f;
mDoMtx_lookAt(mViewMtx, &mEye, &mCenter, &mUp, 0);
GXLoadPosMtxImm(mViewMtx, GX_PNMTX0);
GXClearVtxDesc();
GXSetVtxDesc(GX_VA_POS, GX_INDEX16);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGB, GX_F32, 0);
GXSetMisc(GX_MT_XF_FLUSH, 8);
}
/* 801CE4D4-801CE4DC 1C8E14 0008+00 2/0 0/0 0/0 .text isDrawPath__15renderingFmap_cFv */
bool renderingFmap_c::isDrawPath() {
return true;
}
/* 801CE4DC-801CE560 1C8E1C 0084+00 2/2 0/0 0/0 .text isDrawRoom__15renderingFmap_cFv */
bool renderingFmap_c::isDrawRoom() {
return (bool)((mRegionNo == dComIfGp_getNowLevel() && mStageNo == mStartStageNo
&& mRoomNo == dComIfGp_roomControl_getStayNo())
|| mpRoomData->isArrival());
}
/* 801CE560-801CE5B8 1C8EA0 0058+00 2/0 0/0 0/0 .text postDrawPath__15renderingFmap_cFv
*/
void renderingFmap_c::postDrawPath() {
GXSetMisc(GX_MT_XF_FLUSH, 0);
mDoMtx_lookAt(mViewMtx, &mEye, &mCenter, &mUp, 0);
GXLoadPosMtxImm(mViewMtx, GX_PNMTX0);
}
/* 801CE5B8-801CE5EC 1C8EF8 0034+00 2/0 0/0 0/0 .text postRenderingMap__15renderingFmap_cFv */
void renderingFmap_c::postRenderingMap() {
dRenderingFDAmap_c::postRenderingMap();
mDrawEnable = true;
}
/* 801CE5EC-801CE6A8 1C8F2C 00BC+00 2/2 0/0 0/0 .text roomSetteing__15renderingFmap_cFv
*/
void renderingFmap_c::roomSetteing() {
mRegionOffsetX = mpRegionData->getRegionOffsetX();
mRegionOffsetZ = mpRegionData->getRegionOffsetZ();
mStageOffsetX = mRegionOffsetX + mpStageData->getOffsetX();
mStageOffsetZ = mRegionOffsetZ + mpStageData->getOffsetZ();
f32 offset_z = mStageOffsetZ;
cXyz eye, center;
eye.x = mPosX - mStageOffsetX;
eye.y = mPosZ - offset_z;
eye.z = mEye.z;
center.x = eye.x;
center.y = eye.y;
center.z = mCenter.z;
Mtx viewMtx;
mDoMtx_lookAt(viewMtx, &eye, ¢er, &mUp, 0);
GXLoadPosMtxImm(viewMtx, GX_PNMTX0);
}
/* 801CE6A8-801CE75C 1C8FE8 00B4+00 2/0 0/0 0/0 .text getFirstRoomPointer__15renderingFmap_cFv */
dDrawPath_c::room_class* renderingFmap_c::getFirstRoomPointer() {
dDrawPath_c::room_class* room = NULL;
getFirstRegion();
if (mpRoomData != NULL) {
if (mpFmapData != NULL) {
room = mpFmapData->getMapPath();
}
while (mpRoomData != NULL && (room == NULL || !isDrawRoom())) {
if (mpFmapData != NULL) {
room = getNextRoomPointer();
}
}
if (room != NULL) {
roomSetteing();
}
}
return room;
}
/* 801CE75C-801CE7A8 1C909C 004C+00 1/1 0/0 0/0 .text getFirstRegion__15renderingFmap_cFv
*/
void renderingFmap_c::getFirstRegion() {
mpStageData = NULL;
mpRegionData = mpWorldData->getMenuFmapRegionTop();
if (mpRegionData != NULL) {
mRegionNo = mpRegionData->getRegionNo();
mRegionIndex = 0;
getFirstStage();
}
}
/* 801CE7A8-801CE80C 1C90E8 0064+00 2/2 0/0 0/0 .text getFirstStage__15renderingFmap_cFv
*/
void renderingFmap_c::getFirstStage() {
mpRoomData = NULL;
mpStageData = mpRegionData->getMenuFmapStageDataTop();
if (mpStageData != NULL) {
mpStageArc = mpStageData->getStageArc();
mSaveTableNo = mpStageArc->getSaveTableNo();
mVisitedRoomSaveTableNo = mpStageArc->getVisitedRoomSaveTableNo();
mStageNo = 0;
getFirstRoom();
}
}
/* 801CE80C-801CE84C 1C914C 0040+00 2/2 0/0 0/0 .text getFirstRoom__15renderingFmap_cFv
*/
void renderingFmap_c::getFirstRoom() {
mpFmapData = NULL;
mpRoomData = mpStageData->getFmapRoomDataTop();
if (mpRoomData != NULL) {
mRoomIndex = 0;
mRoomNo = mpRoomData->getRoomNo();
mpFmapData = mpRoomData->getFmapData();
}
}
/* 801CE84C-801CE8B8 1C918C 006C+00 1/1 0/0 0/0 .text getNextRoom__15renderingFmap_cFv */
bool renderingFmap_c::getNextRoom() {
bool ret = false;
mpRoomData = mpRoomData->getNextData();
if (mpRoomData == NULL) {
ret = getNextStage();
} else {
mRoomIndex++;
mpFmapData = mpRoomData->getFmapData();
mRoomNo = mpRoomData->getRoomNo();
}
return ret;
}
/* 801CE8B8-801CE93C 1C91F8 0084+00 1/1 0/0 0/0 .text getNextStage__15renderingFmap_cFv
*/
bool renderingFmap_c::getNextStage() {
bool ret = false;
mpStageData = mpStageData->getNextData();
if (mpStageData == NULL) {
ret = getNextRegion();
} else {
mStageNo++;
mpStageArc = mpStageData->getStageArc();
mSaveTableNo = mpStageArc->getSaveTableNo();
mVisitedRoomSaveTableNo = mpStageArc->getVisitedRoomSaveTableNo();
getFirstRoom();
}
return ret;
}
/* 801CE93C-801CE9A4 1C927C 0068+00 1/1 0/0 0/0 .text getNextRegion__15renderingFmap_cFv
*/
bool renderingFmap_c::getNextRegion() {
bool ret = false;
mpRegionData = mpRegionData->getNextData();
if (mpRegionData == NULL) {
ret = true;
} else {
mRegionIndex++;
mRegionNo = mpRegionData->getRegionNo();
getFirstStage();
}
return ret;
}
/* 801CE9A4-801CEA38 1C92E4 0094+00 2/0 0/0 0/0 .text getNextRoomPointer__15renderingFmap_cFv */
dDrawPath_c::room_class* renderingFmap_c::getNextRoomPointer() {
room_class* room;
do {
room = NULL;
if (getNextRoom()) {
return NULL;
}
if (mpRoomData != NULL) {
room = mpFmapData->getMapPath();
}
} while (mpRoomData != NULL && (room == NULL || !isDrawRoom()));
if (room != NULL) {
roomSetteing();
}
return room;
}
/* 801CEA38-801CEAAC 1C9378 0074+00 1/1 0/0 0/0 .text
* setFmapPaletteColor__15dMenu_FmapMap_cFQ215renderingFmap_c9palette_eUcUcUcUc */
void dMenu_FmapMap_c::setFmapPaletteColor(renderingFmap_c::palette_e i_palette, u8 i_r,
u8 i_g, u8 i_b, u8 i_a) {
int color;
if (i_a >= 0xe0) {
color = ((i_r & 0xf8) << 7) | ((i_g & 0xf8) << 2) | (i_b >> 3) | (1 << 15);
} else {
color = ((i_r & 0xf0) << 4) | (i_g & 0xf0) | (i_b >> 4) | ((i_a & 0xe0) << 7);
}
dMpath_RGB5A3_palDt_s* palette_entry = &m_palette[i_palette];
palette_entry->field_0x0.color = color;
palette_entry->field_0x2.color = color;
palette_entry->field_0x4.color = color;
palette_entry->field_0x6.color = color;
DCStoreRange(&m_palette[i_palette], 8);
}
/* 801CEAAC-801CEAE0 1C93EC 0034+00 2/2 0/0 0/0 .text
* setFmapPaletteColor__15dMenu_FmapMap_cFQ215renderingFmap_c9palette_eRC8_GXColor */
void dMenu_FmapMap_c::setFmapPaletteColor(renderingFmap_c::palette_e i_palette,
GXColor const& i_color) {
setFmapPaletteColor(i_palette, i_color.r, i_color.g, i_color.b, i_color.a);
}
/* 801CEAE0-801CEB1C 1C9420 003C+00 1/1 0/0 0/0 .text isFlashRoomNoCheck__15dMenu_FmapMap_cCFi */
bool dMenu_FmapMap_c::isFlashRoomNoCheck(int i_roomNo) const {
bool ret = false;
u8* ptr = mFlashRooms;
for (int i = 0; i < mFlashRoomCount; ptr++, i++) {
if (*ptr == i_roomNo) {
ret = true;
break;
}
}
return ret;
}
/* 801CEB1C-801CEC24 1C945C 0108+00 1/1 0/0 0/0 .text setPointColor__15dMenu_FmapMap_cFf
*/
void dMenu_FmapMap_c::setPointColor(f32 i_param) {
static const palette_e palNo[8] = {
PALETTE_11,
PALETTE_12,
PALETTE_13,
PALETTE_14,
PALETTE_15,
PALETTE_16,
PALETTE_17,
PALETTE_18,
};
GXColor color;
if (mFlash && mRegionCursor == dComIfGp_getNowLevel() && mStartStageNo == mStageCursor) {
for (int i = 0; i < 8; i++) {
twoColorLineInterporation(m_res->field_0xe8[i], m_res->field_0x108[i], i_param, color);
setFmapPaletteColor(palNo[i], color);
}
} else {
for (int i = 0; i < 8; i++) {
twoColorLineInterporation(m_res->field_0x128[i], m_res->field_0x148[i], i_param, color);
setFmapPaletteColor(palNo[i], color);
}
}
}
extern void* __vt__15dMenu_FmapMap_c[26];
extern void* __vt__15renderingFmap_c[26];
/* 801CEC24-801CED38 1C9564 0114+00 0/0 1/1 0/0 .text __ct__15dMenu_FmapMap_cFv */
dMenu_FmapMap_c::dMenu_FmapMap_c() {
mResTIMG = NULL;
mMapImage_p = NULL;
m_res = NULL;
m_palette = NULL;
field_0xcc = 0;
mZoomRate = 0.0f;
mLineNo = 0;
mFlash = false;
mLastFlash = false;
mStageCursor = 0;
mLastStageCursor = 0;
mRegionCursor = 0;
mFlashTimer = 0;
mFlashRooms = NULL;
mFlashRoomCount = 0;
}
/* 801CED38-801CEDE8 1C9678 00B0+00 1/0 0/0 0/0 .text __dt__15dMenu_FmapMap_cFv */
#ifdef NONMATCHING
// matches once ~renderingFmap_c() is inlined
dMenu_FmapMap_c::~dMenu_FmapMap_c() {
_delete();
}
#else
// dMenu_FmapMap_c::~dMenu_FmapMap_c() {
extern "C" asm void __dt__15dMenu_FmapMap_cFv() {
// NONMATCHING
}
#endif
/* 801CEDE8-801CEE3C 1C9728 0054+00 0/0 1/1 0/0 .text _create__15dMenu_FmapMap_cFUsUsUsUsPv */
void dMenu_FmapMap_c::_create(u16 i_texWidth, u16 i_texHeight, u16 param_2, u16 param_3, void* i_res) {
m_res = (dMfm_prm_res_s*)i_res;
m_palette = m_res->palette_data;
field_0xcc = 0x6c;
mFlash = false;
mStageCursor = 0;
mLastStageCursor = -1;
mLastFlash = mFlash;
mFlashTimer = 0;
setTexture(i_texWidth, i_texHeight, param_2, param_3);
}
/* 801CEE3C-801CEE94 1C977C 0058+00 1/1 1/1 0/0 .text _delete__15dMenu_FmapMap_cFv */
void dMenu_FmapMap_c::_delete() {
if (mResTIMG != NULL) {
delete mResTIMG;
mResTIMG = NULL;
}
if (mMapImage_p != NULL) {
delete[] mMapImage_p;
mMapImage_p = NULL;
}
}
/* ############################################################################################## */
/* 80454194-80454198 002794 0001+03 2/2 0/0 0/0 .sdata2 m_other__22dMfm_HIO_prm_res_src_s
*/
const dMfm_HIO_prm_res_src_s dMfm_HIO_prm_res_src_s::m_other = {30};
/* 80454198-8045419C 002798 0004+00 1/1 0/0 0/0 .sdata2 @4104 */
SECTION_SDATA2 static f32 lit_4104 = 0.5f;
/* 8045419C-804541A0 00279C 0004+00 1/1 0/0 0/0 .sdata2 @4105 */
SECTION_SDATA2 static f32 lit_4105 = 65536.0f;
/* 804541A0-804541A8 0027A0 0004+04 1/1 0/0 0/0 .sdata2 @4106 */
SECTION_SDATA2 static f32 lit_4106[1 + 1 /* padding */] = {
32768.0f,
/* padding */
0.0f,
};
/* 804541A8-804541B0 0027A8 0008+00 2/2 0/0 0/0 .sdata2 @4108 */
SECTION_SDATA2 static f64 lit_4108 = 4503601774854144.0 /* cast s32 to float */;
/* 801CEE94-801CF0B4 1C97D4 0220+00 1/0 0/0 0/0 .text draw__15dMenu_FmapMap_cFv */
#ifdef NONMATCHING
//? regalloc and instructions out of order
void dMenu_FmapMap_c::draw() {
f32 fVar3;
int iVar2 = mFlashTimer;
int iVar1 = dMfm_HIO_prm_res_src_s::m_other.mFlashDuration / 2;
if (iVar2 < iVar1) {
fVar3 = (f32)(iVar1 - iVar2) / (f32)iVar1;
} else {
fVar3 = (f32)(iVar2 - iVar1) / (f32)iVar1;
}
setPointColor(1.0f - fVar3);
GXColor color;
f32 fVar4 = getRateWithFrameCount(m_res->field_0x168);
f32 fVar5 = cM_ssin(fVar4 * 0x10000 - 0x8000) * 0.5f + 0.5f;
twoColorLineInterporation(m_res->field_0xd8, m_res->field_0xdc, fVar5, color);
setFmapPaletteColor(PALETTE_19, color);
f32 fVar6 = getRateWithFrameCount(m_res->field_0x16a);
f32 fVar7 = cM_ssin(fVar6 * 0x10000 - 0x8000) * 0.5f + 0.5f;
twoColorLineInterporation(m_res->field_0xe0, m_res->field_0xe4, fVar7, color);
setFmapPaletteColor(PALETTE_1A, color);
renderingMap();
}
#else
void dMenu_FmapMap_c::draw() {
// NONMATCHING
}
#endif
/* 801CF0B4-801CF12C 1C99F4 0078+00 1/0 0/0 0/0 .text
* rendering__15dMenu_FmapMap_cFPCQ211dDrawPath_c10line_class */
void dMenu_FmapMap_c::rendering(dDrawPath_c::line_class const* i_line) {
if (i_line->field_0x1 == 4) {
for (mLineNo = 0; mLineNo < 2; mLineNo++) {
renderingDecoration(i_line);
}
} else {
dDrawPath_c::rendering(i_line);
}
}
/* ############################################################################################## */
/* 804541B0-804541B8 0027B0 0005+03 1/1 0/0 0/0 .sdata2 l_lineWidthPatData$4134 */
SECTION_SDATA2 static u8 l_lineWidthPatData[5 + 3 /* padding */] = {
0x00,
0x06,
0x0C,
0x00,
0x00,
/* padding */
0x00,
0x00,
0x00,
};
/* 804541B8-804541C0 0027B8 0005+03 1/1 0/0 0/0 .sdata2 l_lineWidthPatData2$4135 */
SECTION_SDATA2 static u8 l_lineWidthPatData2[5 + 3 /* padding */] = {
0x00,
0x00,
0x06,
0x00,
0x00,
/* padding */
0x00,
0x00,
0x00,
};
/* 804541C0-804541C4 0027C0 0004+00 1/1 0/0 0/0 .sdata2 @4152 */
SECTION_SDATA2 static f32 lit_4152 = 1.5f;
/* 801CF12C-801CF1D4 1C9A6C 00A8+00 1/0 0/0 0/0 .text getLineWidth__15dMenu_FmapMap_cFi
*/
int dMenu_FmapMap_c::getLineWidth(int param_0) {
static u8 const l_lineWidthPatData[5] = {0, 6, 12, 0, 0};
static u8 const l_lineWidthPatData2[5] = {0, 0, 6, 0, 0};
int iVar2 = 0;
if (param_0 == 4) {
switch (mLineNo) {
case 0:
case 1:
iVar2 = m_res->field_0x16d;
}
if (mZoomRate > 1.0f) {
return (int)((f32)iVar2 * (mZoomRate - 1.0f));
} else {
return 0;
}
} else if (mZoomRate > 1.5f) {
return l_lineWidthPatData[param_0];
} else {
return l_lineWidthPatData2[param_0];
}
}
/* 801CF1D4-801CF1E0 1C9B14 000C+00 1/0 0/0 0/0 .text isDrawType__15dMenu_FmapMap_cFi */
bool dMenu_FmapMap_c::isDrawType(int param_0) {
return (param_0 >> 6) & 1 ? false : true;
}
/* 801CF1E0-801CF208 1C9B20 0028+00 0/0 1/1 0/0 .text setFlashOn__15dMenu_FmapMap_cFiiPUci */
void dMenu_FmapMap_c::setFlashOn(int i_regionNo, int i_stageNo, u8* i_rooms, int i_roomCount) {
mLastFlash = mFlash;
mFlash = true;
mRegionCursor = i_regionNo;
mStageCursor = (u8)i_stageNo;
mFlashRooms = i_rooms;
mFlashRoomCount = i_roomCount;
}
/* 801CF208-801CF298 1C9B48 0090+00 1/0 0/0 0/0 .text getLineColor__15dMenu_FmapMap_cFii
*/
const GXColor* dMenu_FmapMap_c::getLineColor(int param_0, int param_1) {
static GXColor black = {0, 0, 0, 0};
static const GXColor borderColor0 = {0x64, 0, 0, 0};
static const GXColor borderColor1 = {0x68, 0, 0, 0};
GXColor* color = &black;
if (param_1 == 4) {
switch (mLineNo) {
case 0:
return &borderColor0;
case 1:
return &borderColor1;
}
} else {
*color = *getColor(param_0);
}
return color;
}
/* 801CF298-801CF2A0 1C9BD8 0008+00 1/0 0/0 0/0 .text getBackColor__15dMenu_FmapMap_cCFv
*/
const GXColor* dMenu_FmapMap_c::getBackColor() const {
static const GXColor l_mapBaseColor = {0, 0, 0, 0};
return &l_mapBaseColor;
}
/* 801CF2A0-801CF394 1C9BE0 00F4+00 1/0 0/0 0/0 .text getColor__15dMenu_FmapMap_cFi */
const GXColor* dMenu_FmapMap_c::getColor(int param_0) {
static const GXColor l_dungeon_onColor[9] = {
{0x04, 0, 0, 0},
{0x08, 0, 0, 0},
{0x0C, 0, 0, 0},
{0x00, 0, 0, 0},
{0x10, 0, 0, 0},
{0x14, 0, 0, 0},
{0x18, 0, 0, 0},
{0x1C, 0, 0, 0},
{0x20, 0, 0, 0},
};
static const GXColor l_dungeon_stayColor[9] = {
{0x24, 0, 0, 0},
{0x28, 0, 0, 0},
{0x2C, 0, 0, 0},
{0x00, 0, 0, 0},
{0x30, 0, 0, 0},
{0x34, 0, 0, 0},
{0x38, 0, 0, 0},
{0x3C, 0, 0, 0},
{0x40, 0, 0, 0},
};
static const GXColor l_dungeon_pointColor[9] = {
{0x44, 0, 0, 0},
{0x48, 0, 0, 0},
{0x4C, 0, 0, 0},
{0x00, 0, 0, 0},
{0x50, 0, 0, 0},
{0x54, 0, 0, 0},
{0x58, 0, 0, 0},
{0x5C, 0, 0, 0},
{0x60, 0, 0, 0},
};
const GXColor* list = l_dungeon_onColor;
if (mFlash && mRegionCursor == getNowDrawRegionNo() && mStageNo == mStageCursor) {
if (mFlashRooms == NULL) {
list = l_dungeon_pointColor;
} else if (isFlashRoomNoCheck(mRoomNo)) {
list = l_dungeon_pointColor;
} else if (getNowDrawRegionNo() == dComIfGp_getNowLevel() && mStageNo == mStartStageNo) {
list = l_dungeon_stayColor;
}
} else {
if (getNowDrawRegionNo() == dComIfGp_getNowLevel() && mStageNo == mStartStageNo) {
list = l_dungeon_stayColor;
}
}
return &list[param_0];
}
/* 801CF394-801CF450 1C9CD4 00BC+00 1/1 0/0 0/0 .text setTexture__15dMenu_FmapMap_cFUsUsUsUs */
void dMenu_FmapMap_c::setTexture(u16 i_width, u16 i_height, u16 param_2, u16 param_3) {
mMapImage_p = NULL;
mResTIMG = NULL;
int size = GXGetTexBufferSize(i_width, i_height, GX_TF_CI14, 0, 0);
mMapImage_p = new (0x20) u8[size];
init(mMapImage_p, i_width, i_height, param_2, param_3);
mResTIMG = new (0x20) ResTIMG();
makeResTIMG(mResTIMG, i_width, i_height, mMapImage_p, (u8*)m_palette, 0x1b);
}
/* 801CF450-801CF4D0 1C9D90 0080+00 0/0 1/1 0/0 .text
* setRendering__15dMenu_FmapMap_cFP23dMenu_Fmap_world_data_ciffff */
void dMenu_FmapMap_c::setRendering(dMenu_Fmap_world_data_c* i_worldData, int i_startStageNo,
f32 i_posX, f32 i_posY, f32 i_scale, f32 i_zoomRate) {
mZoomRate = i_zoomRate;
if (mFlash != mLastFlash || mStageCursor != mLastStageCursor) {
mFlashTimer = dMfm_HIO_prm_res_src_s::m_other.mFlashDuration;
mLastFlash = mFlash;
mLastStageCursor = mStageCursor;
} else {
if (mFlashTimer != 0) {
mFlashTimer--;
} else {
mFlashTimer = dMfm_HIO_prm_res_src_s::m_other.mFlashDuration;
}
}
entry(i_worldData, i_startStageNo, i_posX, i_posY, i_scale);
}
/* 801CF4D0-801CF55C 1C9E10 008C+00 1/0 0/0 0/0 .text __dt__15renderingFmap_cFv */
renderingFmap_c::~renderingFmap_c() {
/* empty function */
}
/* 801CF55C-801CF564 1C9E9C 0008+00 2/0 0/0 0/0 .text isRenderingFloor__15renderingFmap_cFi */
bool renderingFmap_c::isRenderingFloor(int param_0) {
return true;
}
/* 801CF564-801CF568 1C9EA4 0004+00 2/0 0/0 0/0 .text beforeDrawPath__15renderingFmap_cFv
*/
void renderingFmap_c::beforeDrawPath() {
/* empty function */
}
/* 801CF568-801CF56C 1C9EA8 0004+00 2/0 0/0 0/0 .text afterDrawPath__15renderingFmap_cFv
*/
void renderingFmap_c::afterDrawPath() {
/* empty function */
}
/* ############################################################################################## */
/* 803BD680-803BD6E8 01A7A0 0068+00 2/2 0/0 0/0 .data __vt__15dMenu_FmapMap_c */
SECTION_DATA extern void* __vt__15dMenu_FmapMap_c[26] = {
(void*)NULL /* RTTI */,
(void*)NULL,
(void*)draw__15dMenu_FmapMap_cFv,
(void*)__dt__15dMenu_FmapMap_cFv,
(void*)isDrawType__15dMenu_FmapMap_cFi,
(void*)getColor__15dMenu_FmapMap_cFi,
(void*)getLineColor__15dMenu_FmapMap_cFii,
(void*)getLineWidth__15dMenu_FmapMap_cFi,
(void*)isSwitch__15renderingFmap_cFPCQ211dDrawPath_c11group_class,
(void*)isRenderingFloor__15renderingFmap_cFi,
(void*)getFirstRoomPointer__15renderingFmap_cFv,
(void*)getNextRoomPointer__15renderingFmap_cFv,
(void*)drawPath__11dDrawPath_cFv,
(void*)rendering__15dMenu_FmapMap_cFPCQ211dDrawPath_c10line_class,
(void*)rendering__11dDrawPath_cFPCQ211dDrawPath_c10poly_class,
(void*)rendering__11dDrawPath_cFPCQ211dDrawPath_c10room_class,
(void*)beforeDrawPath__15renderingFmap_cFv,
(void*)afterDrawPath__15renderingFmap_cFv,
(void*)preDrawPath__15renderingFmap_cFv,
(void*)postDrawPath__15renderingFmap_cFv,
(void*)isDrawPath__15renderingFmap_cFv,
(void*)preRenderingMap__18dRenderingFDAmap_cFv,
(void*)postRenderingMap__15renderingFmap_cFv,
(void*)getBackColor__15dMenu_FmapMap_cCFv,
(void*)getDecoLineColor__18dRenderingFDAmap_cFii,
(void*)getDecorationLineWidth__18dRenderingFDAmap_cFi,
};
|