summaryrefslogtreecommitdiff
path: root/src/d/d_map.cpp
blob: a54129de518e33c31e6d45462b921c331b7224da (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
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
/**
 * d_map.cpp
 *
 */

#define NO_INLINE_DLSTBASE_DRAW

#include "d/d_map.h"
#include "JSystem/JUtility/JUTTexture.h"
#include "SSystem/SComponent/c_counter.h"
#include "SSystem/SComponent/c_math.h"
#include "d/d_com_inf_game.h"

/* 800284BC-800284D0 022DFC 0014+00 2/0 0/0 0/0 .text            getIconSize__15renderingAmap_cCFUc
 */
f32 renderingAmap_c::getIconSize(u8 i_icon) const {
    static f32 const l_iconSize[] = {
        0.12f, 0.12f, 0.08f, 0.12f, 0.08f, 0.16f, 0.12f, 0.0f,  0.12f,
        0.08f, 0.08f, 0.08f, 0.08f, 0.08f, 0.08f, 0.08f, 0.08f,
    };

    return l_iconSize[i_icon];
}

/* 80450D80-80450D88 000280 0004+04 10/10 0/0 0/0 .sbss            m_res__22dMap_HIO_prm_res_dst_s
 */
dMap_prm_res_s* dMap_HIO_prm_res_dst_s::m_res;

inline u8 twoValueLineInterpolation(u8 param_0, u8 param_1, f32 param_2) {
    return ((f32)param_0 + (param_2 * ((f32)param_1 - (f32)param_0)));
}

/* 800284D0-800288C4 022E10 03F4+00 2/0 0/0 0/0 .text            draw__15renderingAmap_cFv */
void renderingAmap_c::draw() {
    f32 tmp = ((f32)(g_Counter.mCounter0 % dMap_HIO_prm_res_dst_s::m_res->field_0x1aa) /
               (f32)dMap_HIO_prm_res_dst_s::m_res->field_0x1aa);
    tmp = tmp;

    f32 temp_f1 = 0.5f + ((0.5f * cM_ssin(65536.0f * tmp - 32768.0f)));
    u8 temp_r31 = twoValueLineInterpolation(dMap_HIO_prm_res_dst_s::m_res->field_0x198,
                                            dMap_HIO_prm_res_dst_s::m_res->field_0x19c, temp_f1);
    u8 temp_r30 = twoValueLineInterpolation(dMap_HIO_prm_res_dst_s::m_res->field_0x199,
                                            dMap_HIO_prm_res_dst_s::m_res->field_0x19d, temp_f1);
    u8 temp_r29 = twoValueLineInterpolation(dMap_HIO_prm_res_dst_s::m_res->field_0x19a,
                                            dMap_HIO_prm_res_dst_s::m_res->field_0x19e, temp_f1);
    u8 temp_r28 = twoValueLineInterpolation(dMap_HIO_prm_res_dst_s::m_res->field_0x19b,
                                            dMap_HIO_prm_res_dst_s::m_res->field_0x19f, temp_f1);
    setAmapPaletteColor(0x2D, temp_r31, temp_r30, temp_r29, temp_r28);

    f32 tmp2 = (f32)(g_Counter.mCounter0 % dMap_HIO_prm_res_dst_s::m_res->field_0x1ac) /
               (f32)dMap_HIO_prm_res_dst_s::m_res->field_0x1ac;
    tmp2 = tmp2;

    f32 temp_f1_2 = 0.5f + (0.5f * cM_ssin(65536.0f * tmp2 - 32768.0f));
    u8 temp_r31_2 =
        twoValueLineInterpolation(dMap_HIO_prm_res_dst_s::m_res->field_0x1a0,
                                  dMap_HIO_prm_res_dst_s::m_res->field_0x1a4, temp_f1_2);
    u8 temp_r30_2 =
        twoValueLineInterpolation(dMap_HIO_prm_res_dst_s::m_res->field_0x1a1,
                                  dMap_HIO_prm_res_dst_s::m_res->field_0x1a5, temp_f1_2);
    u8 temp_r29_2 =
        twoValueLineInterpolation(dMap_HIO_prm_res_dst_s::m_res->field_0x1a2,
                                  dMap_HIO_prm_res_dst_s::m_res->field_0x1a6, temp_f1_2);
    u8 temp_r28_2 =
        twoValueLineInterpolation(dMap_HIO_prm_res_dst_s::m_res->field_0x1a3,
                                  dMap_HIO_prm_res_dst_s::m_res->field_0x1a7, temp_f1_2);
    setAmapPaletteColor(0x2E, temp_r31_2, temp_r30_2, temp_r29_2, temp_r28_2);

    renderingDAmap_c::draw();
}

/* 800288C4-80028960 023204 009C+00 7/6 0/0 0/0 .text            getDispType__15renderingAmap_cCFv
 */
int renderingAmap_c::getDispType() const {
    int disp_type;

    switch (dStage_stagInfo_GetUpButton(dComIfGp_getStage()->getStagInfo())) {
    case 7:
        disp_type = 1;
        break;
    case 0:
    case 5:
        disp_type = 0;
        break;
    case 1:
        disp_type = 1;
        break;
    case 2:
        disp_type = 2;
        break;
    case 3:
        disp_type = 3;
        break;
    case 4:
        disp_type = 4;
        break;
    case 6:
        disp_type = 5;
        break;
    default:
        JUT_ASSERT(0, 0);
        break;
    }

    return disp_type;
}

/* 80028960-800289D0 0232A0 0070+00 2/0 0/0 0/0 .text            beforeDrawPath__15renderingAmap_cFv
 */
void renderingAmap_c::beforeDrawPath() {
    if (isDrawOutSideTrim()) {
        field_0x38 = 0;
        getOutSideBlackLineNumber();

        do {
            drawPath();
        } while (isOutSideBlackLine());

        field_0x38 = 2;
    }
}

/* 800289D0-800289F0 023310 0020+00 2/0 0/0 0/0 .text            afterDrawPath__15renderingAmap_cFv
 */
void renderingAmap_c::afterDrawPath() {
    renderingPlusDoorAndCursor_c::afterDrawPath();
}

/* 800289F0-80028A10 023330 0020+00 2/0 0/0 0/0 .text
 * rendering__15renderingAmap_cFPCQ211dDrawPath_c10room_class   */
void renderingAmap_c::rendering(dDrawPath_c::room_class const* i_room) {
    dDrawPath_c::rendering(i_room);
}

/* 80028A10-80028A30 023350 0020+00 2/0 0/0 0/0 .text            drawPath__15renderingAmap_cFv */
void renderingAmap_c::drawPath() {
    dDrawPath_c::drawPath();
}

/* 80028A30-80028B04 023370 00D4+00 2/0 0/0 0/0 .text
 * rendering__15renderingAmap_cFPCQ211dDrawPath_c10line_class   */
void renderingAmap_c::rendering(dDrawPath_c::line_class const* i_line) {
    if (isDrawType(i_line->field_0x0)) {
        if (isDrawOutSideTrim() && field_0x38 != 2) {
            if (i_line->field_0x1 == 2) {
                renderingDecoration(i_line);
            }
        } else if (i_line->field_0x1 == 4) {
            field_0x3c = 0;

            while (field_0x3c < 2) {
                renderingDecoration(i_line);
                field_0x3c++;
            }
        } else {
            dDrawPath_c::rendering(i_line);
        }
    }
}

/* 80028B04-80028B10 023444 000C+00 2/0 0/0 0/0 .text getPlayerCursorSize__15renderingAmap_cFv */
f32 renderingAmap_c::getPlayerCursorSize() {
    return dMap_HIO_prm_res_dst_s::m_res->cursor_size;
}

/* 80028B10-80028B3C 023450 002C+00 2/0 0/0 0/0 .text getRestartCursorSize__15renderingAmap_cFv */
f32 renderingAmap_c::getRestartCursorSize() {
    return getPlayerCursorSize();
}

/* 80028B3C-80028BB4 02347C 0078+00 2/0 0/0 0/0 .text
 * rendering__15renderingAmap_cFPCQ211dDrawPath_c10poly_class   */
void renderingAmap_c::rendering(dDrawPath_c::poly_class const* i_poly) {
    if (isDrawType(i_poly->field_0x0) && (!isDrawOutSideTrim() || field_0x38 == 2)) {
        dDrawPath_c::rendering(i_poly);
    }
}

/* 80028BB4-80028C4C 0234F4 0098+00 4/4 0/0 0/0 .text isDrawOutSideTrim__15renderingAmap_cFv */
bool renderingAmap_c::isDrawOutSideTrim() {
    bool rt = false;

    if (getDispType() == 0 || getDispType() == 4 || getDispType() == 3 || getDispType() == 2 ||
        getDispType() == 5)
    {
        rt = dMap_HIO_prm_res_dst_s::m_res->field_0x1ae > 0;
    }

    return rt;
}

/* 80028C4C-80028C60 02358C 0014+00 1/1 0/0 0/0 .text
 * getOutSideBlackLineNumber__15renderingAmap_cFv               */
int renderingAmap_c::getOutSideBlackLineNumber() {
    m_outSideBlackLineCnt = 0;
    return dMap_HIO_prm_res_dst_s::m_res->field_0x1ae;
}

/* 80028C60-80028C90 0235A0 0030+00 1/1 0/0 0/0 .text isOutSideBlackLine__15renderingAmap_cFv */
bool renderingAmap_c::isOutSideBlackLine() {
    bool rt = false;
    m_outSideBlackLineCnt++;

    if (m_outSideBlackLineCnt < dMap_HIO_prm_res_dst_s::m_res->field_0x1ae) {
        rt = true;
    }

    return rt;
}

/* 80028C90-80028CF4 0235D0 0064+00 2/2 0/0 0/0 .text getLineWidthSub__15renderingAmap_cFi */
int renderingAmap_c::getLineWidthSub(int i_no) {
    static const u8 l_lineWidthPatOff[] = {0x00, 0x00, 0x06, 0x00, 0x00};
    static const u8 l_lineWidthPatOn[] = {0x06, 0x06, 0x06, 0x00, 0x00};
    static const u8 l_lineWidthPatStay[] = {0x06, 0x06, 0x0C, 0x00, 0x00};

    const u8* pat = l_lineWidthPatOff;

    if (mRoomNo == mRoomNoSingle) {
        pat = l_lineWidthPatStay;
    } else if (dMapInfo_n::isVisitedRoom(mRoomNo)) {
        pat = l_lineWidthPatOn;
    }

    return pat[i_no];
}

/* 80028CF4-80028DD4 023634 00E0+00 2/0 0/0 0/0 .text getDecorationLineWidth__15renderingAmap_cFi
 */
s32 renderingAmap_c::getDecorationLineWidth(int param_0) {
    int var_r31 = 0;

    if (param_0 == 4) {
        switch (field_0x3c) {
        case 0:
            var_r31 = dMap_HIO_prm_res_dst_s::m_res->field_0x1a8;
            break;
        case 1:
            var_r31 = dMap_HIO_prm_res_dst_s::m_res->field_0x1a9;
            break;
        }

        return var_r31;
    }

    switch (m_outSideBlackLineCnt) {
    case 0:
        var_r31 = dMap_HIO_prm_res_dst_s::m_res->field_0x1b0;
        break;
    case 1:
        var_r31 = dMap_HIO_prm_res_dst_s::m_res->field_0x1b2;
        break;
    case 2:
        var_r31 = dMap_HIO_prm_res_dst_s::m_res->field_0x1b4;
        break;
    case 3:
        var_r31 = dMap_HIO_prm_res_dst_s::m_res->field_0x1b6;
        break;
    }

    if (var_r31 > 0) {
        var_r31 += getLineWidthSub(param_0);

        if (var_r31 > 0xFF) {
            var_r31 = 0xFF;
        }
    }

    return var_r31;
}

/* 80028DD4-80028DF4 023714 0020+00 2/0 0/0 0/0 .text            getLineWidth__15renderingAmap_cFi
 */
int renderingAmap_c::getLineWidth(int i_no) {
    return getLineWidthSub(i_no);
}

/* 80028DF4-80028EE4 023734 00F0+00 1/0 0/0 0/0 .text            getColor__6dMap_cFi */
const GXColor* dMap_c::getColor(int i_no) {
    static GXColor const l_dungeon_offColor[] = {
        {0x08, 0x00, 0x00, 0x00}, {0x0C, 0x00, 0x00, 0x00}, {0x10, 0x00, 0x00, 0x00},
        {0x04, 0x00, 0x00, 0x00}, {0x14, 0x00, 0x00, 0x00}, {0x18, 0x00, 0x00, 0x00},
        {0x1C, 0x00, 0x00, 0x00}, {0x20, 0x00, 0x00, 0x00}, {0x24, 0x00, 0x00, 0x00},
    };

    static GXColor const l_dungeon_onColor[] = {
        {0x28, 0x00, 0x00, 0x00}, {0x2C, 0x00, 0x00, 0x00}, {0x30, 0x00, 0x00, 0x00},
        {0x04, 0x00, 0x00, 0x00}, {0x34, 0x00, 0x00, 0x00}, {0x38, 0x00, 0x00, 0x00},
        {0x3C, 0x00, 0x00, 0x00}, {0x40, 0x00, 0x00, 0x00}, {0x44, 0x00, 0x00, 0x00},
    };

    static GXColor const l_dungeon_stayColor[] = {
        {0x48, 0x00, 0x00, 0x00}, {0x4C, 0x00, 0x00, 0x00}, {0x50, 0x00, 0x00, 0x00},
        {0x04, 0x00, 0x00, 0x00}, {0x54, 0x00, 0x00, 0x00}, {0x58, 0x00, 0x00, 0x00},
        {0x5C, 0x00, 0x00, 0x00}, {0x60, 0x00, 0x00, 0x00}, {0x64, 0x00, 0x00, 0x00},
    };

    const GXColor* color_tbl = l_dungeon_offColor;

    if (field_0x8e == 2 && field_0x8f != 0 && field_0x8f < 6) {
        if (mRoomNoSingle == field_0x88) {
            if (mRoomNo == field_0x88) {
                color_tbl = l_dungeon_stayColor;
            } else if (mRoomNo == field_0x84) {
                color_tbl = l_dungeon_onColor;
            }
        } else if (mRoomNo == field_0x88) {
            color_tbl = l_dungeon_onColor;
        } else if (mRoomNo == field_0x84) {
            color_tbl = l_dungeon_stayColor;
        }
    } else if (mRoomNo == mRoomNoSingle) {
        color_tbl = l_dungeon_stayColor;
    } else if (dMapInfo_n::isVisitedRoom(mRoomNo)) {
        color_tbl = l_dungeon_onColor;
    }

    return &color_tbl[i_no];
}

/* 80028EE4-80028FB4 023824 00D0+00 2/0 0/0 0/0 .text            getLineColor__15renderingAmap_cFii
 */
GXColor* renderingAmap_c::getLineColor(int param_0, int param_1) {
    static GXColor backColor = {0x04, 0x00, 0x00, 0x00};
    static const GXColor borderColor0 = {0xB4, 0x00, 0x00, 0x00};
    static const GXColor borderColor1 = {0xB8, 0x00, 0x00, 0x00};

    GXColor* color = &backColor;

    if (param_1 == 4) {
        switch (field_0x3c) {
        case 0:
            *color = borderColor0;
            break;
        case 1:
            *color = borderColor1;
            break;
        default:
            JUT_ASSERT(0, 0);
            break;
        }
    } else {
        *color = *getColor(param_0);
    }

    return color;
}

/* 80028FB4-80029038 0238F4 0084+00 2/0 0/0 0/0 .text getDecoLineColor__15renderingAmap_cFii */
const GXColor* renderingAmap_c::getDecoLineColor(int param_0, int param_1) {
    static GXColor const colorTable[] = {
        {0xBC, 0x00, 0x00, 0x00},
        {0xC0, 0x00, 0x00, 0x00},
        {0xC4, 0x00, 0x00, 0x00},
        {0xC8, 0x00, 0x00, 0x00},
    };

    const GXColor* color;
    if (isDrawOutSideTrim() && field_0x38 != 2) {
        JUT_ASSERT(0, m_outSideBlackLineCnt < (sizeof(colorTable) / sizeof(colorTable[0])));
        color = &colorTable[m_outSideBlackLineCnt];
    } else {
        color = getLineColor(param_0, param_1);
    }

    return color;
}

/* 80029038-80029058 023978 0020+00 1/0 0/0 0/0 .text
 * getIconPosition__6dMap_cCFPQ27dTres_c15typeGroupData_c       */
const Vec* dMap_c::getIconPosition(dTres_c::typeGroupData_c* i_data) const {
    return renderingPlusDoorAndCursor_c::getIconPosition(i_data);
}

/* 80029058-80029078 023998 0020+00 2/0 0/0 0/0 .text getIconGroupNumber__15renderingAmap_cCFUc */
int renderingAmap_c::getIconGroupNumber(u8 param_0) const {
    return renderingDAmap_c::getIconGroupNumber(param_0);
}

/* 80029078-800290C0 0239B8 0048+00 2/0 0/0 0/0 .text            hasMap__15renderingAmap_cCFv */
bool renderingAmap_c::hasMap() const {
    int stay_type = getStayType();

    return stay_type == 1 && dMapInfo_n::chkGetMap();
}

/* 800290C0-80029104 023A00 0044+00 2/0 0/0 0/0 .text            isRendDoor__15renderingAmap_cCFv */
bool renderingAmap_c::isRendDoor() const {
    int disp_type = getDispType();
    return disp_type == 1 || disp_type == 2;
}

/* 80029104-8002910C 023A44 0008+00 2/0 0/0 0/0 .text            isCheckFloor__15renderingAmap_cCFv
 */
bool renderingAmap_c::isCheckFloor() const {
    return true;
}

/* 8002910C-80029114 023A4C 0008+00 2/0 0/0 0/0 .text            isRendRestart__15renderingAmap_cCFv
 */
bool renderingAmap_c::isRendRestart() const {
    return true;
}

/* 80029114-8002911C 023A54 0008+00 2/0 0/0 0/0 .text            isRendCursor__15renderingAmap_cCFv
 */
bool renderingAmap_c::isRendCursor() const {
    return true;
}

/* 8002911C-80029160 023A5C 0044+00 3/2 0/0 0/0 .text            isRendAllRoom__15renderingAmap_cCFv
 */
bool renderingAmap_c::isRendAllRoom() const {
    int disp_type = getDispType();
    return disp_type != 2 && disp_type != 3 && disp_type != 5;
}

/* 80029160-80029190 023AA0 0030+00 7/7 0/0 0/0 .text            getStayType__15renderingAmap_cCFv
 */
int renderingAmap_c::getStayType() const {
    static int const l_stayType[] = {0, 1, 0, 0, 0, 0, 0};

    return l_stayType[getDispType()];
}

/* 80029190-800296EC 023AD0 055C+00 3/0 0/0 0/0 .text
 * isDrawIconSingle2__15renderingAmap_cCFPCQ27dTres_c6data_sbbi */
bool renderingAmap_c::isDrawIconSingle2(dTres_c::data_s const* i_data, bool param_1, bool param_2,
                                        int param_3) const {
    JUT_ASSERT(0, i_data != 0);

    bool var_r31 = false;
    int disp_type = getDispType();
    int stay_type = getStayType();
    int group_no = dTres_c::getTypeToTypeGroupNo(i_data->mType);
    bool has_map = hasMap();

    bool var_r23 = false;
    if (stay_type == 1 && dMapInfo_n::chkGetCompass()) {
        var_r23 = true;
    }

    switch (group_no) {
    case 0:
        if (stay_type == 1) {
            JUT_ASSERT(0, i_data->mNo != 255);

            if (var_r23 && i_data->mNo != 255 && !dComIfGs_isTbox(i_data->mNo) && param_1) {
                var_r31 = true;
            }
        }
        break;
    case 1:
    case 8:
        if (stay_type == 1) {
            if ((has_map || param_2) && param_1) {
                var_r31 = true;
            }
        } else if (param_2) {
            if ((i_data->mSwBit == 255 ||
                 (i_data->mSwBit != 255 && dComIfGs_isSwitch(i_data->mSwBit, i_data->mRoomNo))) &&
                param_1)
            {
                var_r31 = true;
            }
        }
        break;
    case 2:
        if (stay_type == 1) {
            if (var_r23 && !dComIfGs_isTbox(i_data->mNo) && param_1) {
                var_r31 = true;
            }
        }
        break;
    case 4:
        if (stay_type == 0) {
            bool temp_r23_2 = false;

            if (dComIfGp_isLightDropMapVisible()) {
                if (dComIfGp_getStartStageDarkArea() == 2) {
                    int temp_r3 = i_data->mNo;
                    if (temp_r3 == 0x33 || temp_r3 == 0x34 || temp_r3 == 0x35) {
                        if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[119])) {
                            temp_r23_2 = true;
                        }
                    } else {
                        temp_r23_2 = true;
                    }
                } else {
                    temp_r23_2 = true;
                }
            }

            if (temp_r23_2) {
                JUT_ASSERT(0, i_data->mNo != 255);
                bool temp_r23_3 = false;
                if (i_data->mNo != 255 && !dComIfGs_isTbox(i_data->mNo)) {
                    temp_r23_3 = true;
                }

                if (temp_r23_3) {
                    if (disp_type == 3) {
                        if (i_data->mRoomNo == param_3 && param_1) {
                            var_r31 = true;
                        }
                    } else if (disp_type == 4) {
                        if (param_1) {
                            var_r31 = true;
                        }
                    } else if (disp_type == 5) {
                        if (i_data->mRoomNo == param_3) {
                            var_r31 = true;
                        }
                    } else {
                        var_r31 = true;
                    }
                }
            }
        }
        break;
    case 5:
        if (((i_data->mNo == 255 || (i_data->mNo != 255 && !dComIfGs_isTbox(i_data->mNo))) &&
             (i_data->mSwBit == 255 ||
              (i_data->mSwBit != 255 && dComIfGs_isSwitch(i_data->mSwBit, i_data->mRoomNo)))) &&
            param_1)
        {
            var_r31 = true;
        }
        break;
    case 3:
        if (stay_type == 1 && var_r23) {
            if ((i_data->mSwBit == 255 ||
                 (i_data->mSwBit != 255 && dComIfGs_isSwitch(i_data->mSwBit, i_data->mRoomNo))) &&
                !dComIfGs_isStageBossEnemy() && param_1)
            {
                var_r31 = true;
            }
        }
        break;
    case 9:
        if (stay_type == 1 && var_r23) {
            if ((i_data->mNo == 255 || (i_data->mNo != 255 && !dComIfGs_isTbox(i_data->mNo))) &&
                param_1)
            {
                var_r31 = true;
            }
        }
        break;
    case 10:
        if (stay_type == 0 && i_data->mNo != 0xFF && dComIfGs_isTbox(i_data->mNo) && param_1) {
            var_r31 = true;
        }
        break;
    case 11:
        if (stay_type == 1 && var_r23 && param_1) {
            var_r31 = true;
        }
        break;
    case 12:
        if (stay_type == 1 && var_r23) {
            if ((i_data->mNo == 255 || (i_data->mNo != 255 && !dComIfGs_isTbox(i_data->mNo))) &&
                param_1)
            {
                var_r31 = true;
            }
        }
        break;
    case 13:
    case 14:
        if (stay_type == 0) {
            if (i_data->mSwBit == 255 ||
                (i_data->mSwBit != 255 && dComIfGs_isSwitch(i_data->mSwBit, i_data->mRoomNo)))
            {
                var_r31 = true;
            }
        }
        break;
    case 15:
        if (stay_type == 1 && var_r23) {
            if ((i_data->mNo == 255 || (i_data->mNo != 255 && dComIfGs_isTbox(i_data->mNo))) &&
                param_1)
            {
                var_r31 = true;
            }
        }
        break;
    case 16:
        if (stay_type == 1 && !dComIfGs_isStageBossEnemy() && i_data->mNo != 255 &&
            !dComIfGs_isTbox(i_data->mNo) && var_r23 && param_1)
        {
            var_r31 = true;
        }
        break;
    default:
        JUT_ASSERT(0, 0);
        break;
    }

    return var_r31;
}

/* 800296EC-800296F8 02402C 000C+00 1/0 0/0 0/0 .text            isDrawType__6dMap_cFi */
bool dMap_c::isDrawType(int param_0) {
    return (param_0 & 0x80) == 0;
}

/* 800296F8-80029744 024038 004C+00 1/0 0/0 0/0 .text            isRendAllRoom__6dMap_cCFv */
bool dMap_c::isRendAllRoom() const {
    bool rt = renderingAmap_c::isRendAllRoom();
    if (field_0x8e == 2 && field_0x8f >= 3 && field_0x8f <= 3) {
        rt = true;
    }

    return rt;
}

/* 80029744-8002974C 024084 0008+00 1/0 0/0 0/0 .text            isSpecialOutline__6dMap_cFv */
bool dMap_c::isSpecialOutline() {
    return false;
}

/* 8002974C-800297A8 02408C 005C+00 1/1 0/0 0/0 .text            copyPalette__6dMap_cFv */
void dMap_c::copyPalette() {
    JUT_ASSERT(0, m_res != 0);

    cLib_memCpy(m_res, m_res_src, sizeof(dMap_HIO_prm_res_dst_s::m_res->palette_data));
    if (getStayType() == 0) {
        copyPalette(1, 0x2C, 1.0f);
    }
}

/* 800297A8-80029818 0240E8 0070+00 1/1 0/0 0/0 .text setMapPaletteColorAlphaPer__6dMap_cFiif */
void dMap_c::setMapPaletteColorAlphaPer(int param_0, int param_1, f32 param_2) {
    int temp_r28 = (param_1 - param_0) + 1;
    int temp_r30 = param_0;

    for (int i = 0; i < temp_r28; i++) {
        setMapPaletteColorAlphaPer(temp_r30, param_2);
        temp_r30++;
    }
}

/* 80029818-80029874 024158 005C+00 1/1 0/0 0/0 .text            resCopy__6dMap_cFv */
void dMap_c::resCopy() {
    cLib_memCpy(m_res, m_res_src, sizeof(dMap_prm_res_s));
    if (getStayType() == 0) {
        copyPalette(1, 0x2C, 1.0f);
    }
}

/* 80029874-80029A1C 0241B4 01A8+00 0/0 1/1 0/0 .text            __ct__6dMap_cFiiii */
dMap_c::dMap_c(int param_0, int param_1, int param_2, int param_3) {
    m_res_src = NULL;
    m_res = NULL;
    mResTIMG = NULL;
    mImage_p = NULL;

    mCenterX = 0.0f;
    mCenterZ = 0.0f;
    field_0x58 = 1.0f;
    mPackX = 0.0f;
    mPackZ = 0.0f;
    field_0x64 = 0.0f;
    mPackPlusZ = 0.0f;
    mRightEdgePlus = 0.0f;
    mTopEdgePlus = 0.0f;

    field_0x74 = 0;
    mTexSizeX = 0;
    mTexSizeY = 0;
    mStayRoomNo = -1;
    field_0x80 = -1;
    field_0x84 = -1;
    field_0x88 = -1;

    field_0x8c = 0;
    field_0x8d = 0;
    field_0x8e = 0;
    field_0x8f = 0;
    field_0x90 = 0;

    m_res = new (0x20) dMap_prm_res_s;
    JUT_ASSERT(0, m_res != 0);

    dMap_HIO_prm_res_dst_s::m_res = m_res;

    m_res_src = (dMap_prm_res_s*)dComIfG_getObjectRes("Always", 0x45);
    resCopy();

    mTexSizeX = param_0;
    mTexSizeY = param_1;

    if (dMap_HIO_prm_res_dst_s::m_res->field_0x1ae > 0) {
        field_0x74 = dMap_HIO_prm_res_dst_s::m_res->field_0x1b0 / 6;
    }

    int buffer_size = GXGetTexBufferSize(param_2, param_3, 9, GX_FALSE, 0);
    mImage_p = new (0x20) u8[buffer_size];
    JUT_ASSERT(0, mImage_p != 0);

    renderingDAmap_c::init(mImage_p, mTexSizeX, mTexSizeY, mTexSizeX, mTexSizeY);

    mResTIMG = new (0x20) ResTIMG;
    JUT_ASSERT(0, mResTIMG != 0);

    makeResTIMG(mResTIMG, mTexSizeX, mTexSizeY, mImage_p, (u8*)m_res, 0x33);
}

/* 80029A1C-80029A8C 02435C 0070+00 1/1 0/0 0/0 .text            _remove__6dMap_cFv */
void dMap_c::_remove() {
    if (mImage_p != NULL) {
        delete[] mImage_p;
        mImage_p = NULL;
    }

    if (mResTIMG != NULL) {
        delete mResTIMG;
        mResTIMG = NULL;
    }

    if (m_res != NULL) {
        delete m_res;
        m_res = NULL;
    }
}

/* 80029A8C-80029C10 0243CC 0184+00 3/3 0/0 0/0 .text            getMapMinMaxXZ__6dMap_cFiPfPfPfPf
 */
void dMap_c::getMapMinMaxXZ(int i_roomNo, f32* param_1, f32* param_2, f32* param_3, f32* param_4) {
    f32 var_f0 = 0.0f;
    f32 var_f1 = 0.0f;
    f32 var_f2 = 0.0f;
    f32 var_f3 = 0.0f;

    JUT_ASSERT(0, i_roomNo >= 0);

    if (i_roomNo >= 0) {
        f32 temp_f31 = dMpath_c::getMinX();
        f32 temp_f30 = dMpath_c::getMinZ();
        f32 temp_f29 = dMpath_c::getMaxX();
        f32 temp_f28 = dMpath_c::getMaxZ();

        f32 sp14 = 0.0f;
        f32 sp10 = 0.0f;
        f32 spC = 0.0f;
        f32 sp8 = 0.0f;

        dStage_FileList2_dt_c* fileList2_p = dStage_roomControl_c::getFileList2(i_roomNo);
        JUT_ASSERT(0, fileList2_p != 0);

        if (fileList2_p != NULL) {
            dMapInfo_n::getRoomMinMaxXZ(i_roomNo, &sp14, &sp10, &spC, &sp8);
        }

        switch (getDispType()) {
        default:
            JUT_ASSERT(0, 0);
        case 4:
        case 0:
            var_f0 = temp_f31;
            var_f1 = temp_f30;
            var_f2 = temp_f29;
            var_f3 = temp_f28;
            break;
        case 1:
            var_f0 = sp14;
            var_f1 = sp10;
            var_f2 = spC;
            var_f3 = sp8;
            break;
        case 5:
        case 2:
        case 3:
            var_f0 = sp14;
            var_f1 = sp10;
            var_f2 = spC;
            var_f3 = sp8;
        }
    }

    if (param_1 != NULL) {
        *param_1 = var_f0;
    }

    if (param_2 != NULL) {
        *param_2 = var_f1;
    }

    if (param_3 != NULL) {
        *param_3 = var_f2;
    }

    if (param_4 != NULL) {
        *param_4 = var_f3;
    }
}

/* 80029C10-80029D78 024550 0168+00 1/1 0/0 0/0 .text            getPack__6dMap_cFiPfPf */
void dMap_c::getPack(int param_0, f32* param_1, f32* param_2) {
    f32 var_f31 = 0.0f;
    f32 var_f30 = 0.0f;

    if (getStayType() == 0) {
        f32 sp14 = 0.0f;
        f32 sp10 = 0.0f;
        f32 spC = 0.0f;
        f32 sp8 = 0.0f;
        getMapMinMaxXZ(param_0, &sp14, &sp10, &spC, &sp8);

        f32 temp_f1 = (field_0x58 * (f32)(field_0x74 + 4)) * 0.5f;
        sp14 -= temp_f1;
        sp10 -= temp_f1;
        spC += temp_f1;
        sp8 += temp_f1;

        f32 temp_f6 = spC - sp14;
        f32 temp_f7 = sp8 - sp10;
        f32 temp_f8 = (spC + sp14) * 0.5f;
        f32 temp_f3_2 = (sp8 + sp10) * 0.5f;

        if (temp_f6 > temp_f7) {
            var_f31 = (temp_f6 * 0.5f) - (temp_f8 - sp14);
            var_f30 = (temp_f6 * 0.5f) - (sp8 - temp_f3_2);
        } else {
            var_f31 = (temp_f7 * 0.5f) - (temp_f8 - sp14);
            var_f30 = (temp_f7 * 0.5f) - (sp8 - temp_f3_2);
        }
    }

    if (param_1 != NULL) {
        *param_1 = var_f31;
    }

    if (param_2 != NULL) {
        *param_2 = var_f30;
    }
}

/* 80029D78-80029E1C 0246B8 00A4+00 1/1 0/0 0/0 .text            calcMapCenterXZ__6dMap_cFiPfPf */
void dMap_c::calcMapCenterXZ(int i_roomNo, f32* param_1, f32* param_2) {
    f32 var_f31 = 0.0f;
    f32 var_f30 = 0.0f;

    JUT_ASSERT(0, i_roomNo >= 0);

    if (i_roomNo >= 0) {
        f32 sp14 = 0.0f;
        f32 sp10 = 0.0f;
        f32 spC = 0.0f;
        f32 sp8 = 0.0f;
        getMapMinMaxXZ(i_roomNo, &sp14, &sp10, &spC, &sp8);

        var_f31 = (spC + sp14) * 0.5f;
        var_f30 = (sp8 + sp10) * 0.5f;
    }

    if (param_1 != NULL) {
        *param_1 = var_f31;
    }

    if (param_2 != NULL) {
        *param_2 = var_f30;
    }
}

/* 80029E1C-80029F84 02475C 0168+00 1/1 0/0 0/0 .text            calcMapCmPerTexel__6dMap_cFiPf */
void dMap_c::calcMapCmPerTexel(int i_roomNo, f32* ip_cmPerTexel) {
    JUT_ASSERT(0, i_roomNo >= 0);
    JUT_ASSERT(0, ip_cmPerTexel != 0);

    f32 cmPerTexel = 0.0f;
    JUT_ASSERT(0, mTexSizeY != 0);

    if (i_roomNo >= 0) {
        if (getStayType() == 0) {
            f32 sp14 = 0.0f;
            f32 sp10 = 0.0f;
            f32 spC = 0.0f;
            f32 sp8 = 0.0f;
            getMapMinMaxXZ(i_roomNo, &sp14, &sp10, &spC, &sp8);

            f32 temp_f2 = spC - sp14;
            f32 temp_f0 = sp8 - sp10;
            f32 var_f3;
            if (temp_f2 >= temp_f0) {
                var_f3 = temp_f2;
            } else {
                var_f3 = temp_f0;
            }

            cmPerTexel = var_f3 / ((f32)mTexSizeY - (f32)(field_0x74 + 4));
        } else {
            f32 var_f31 = 0.0f;

            stage_stag_info_class* pstag = dComIfGp_getStage()->getStagInfo();
            JUT_ASSERT(0, pstag != 0);

            if (pstag != NULL) {
                var_f31 = pstag->field_0x20;
            }

            if (var_f31 == 0.0f) {
                var_f31 = 10800.0f;
            }

            cmPerTexel = var_f31 / (f32)mTexSizeY;
        }
    }

    JUT_ASSERT(0, cmPerTexel != 0.0f);

    if (ip_cmPerTexel != NULL) {
        *ip_cmPerTexel = cmPerTexel;
    }
}

inline void getRGBA_RGB5A3(const dMpath_RGB5A3_palDt_s& palette, u8& r, u8& g, u8& b, u8& a) {
    u16 temp_r0;
    int t_r;
    int t_g;
    int t_b;
    int t_a;

    temp_r0 = palette.field_0x0.color;
    if (temp_r0 & 0x8000) {
        t_r = ((temp_r0 >> 7) & 0xF8) | (r >> 5);
        t_g = ((temp_r0 >> 2) & 0xF8) | (g >> 5);
        t_b = ((temp_r0 << 3) & 0xF8) | (b >> 5);
        t_a = 0xFF;
    } else {
        t_r = ((temp_r0 >> 4) & 0xF0) | (r >> 4);
        t_g = ((temp_r0 >> 0) & 0xF0) | (g >> 4);
        t_b = ((temp_r0 << 4) & 0xF0) | (b >> 4);
        t_a = ((temp_r0 >> 7) & 0xE0) | (a >> 3) | (a >> 6);
    }

    r = t_r;
    g = t_g;
    b = t_b;
    a = t_a;
}

/* 80029F84-8002A064 0248C4 00E0+00 1/1 0/0 0/0 .text setMapPaletteColorAlphaPer__6dMap_cFif */
void dMap_c::setMapPaletteColorAlphaPer(int i_paletteNo, f32 param_1) {
    JUT_ASSERT(0, i_paletteNo < renderingAmap_c::PALETTE_NUMBER);

    int pixel;
    u8 scaled_a = 0;
    u8 r = 0;
    u8 g = 0;
    u8 b = 0;
    u8 a = 0;
    dMpath_RGB5A3_palDt_s& temp_r31 = dMap_HIO_prm_res_dst_s::m_res->palette_data[i_paletteNo];
    getRGBA_RGB5A3(m_res_src->palette_data[i_paletteNo], r, g, b, a);

    scaled_a = a * param_1;
    if (scaled_a >= 0xE0) {
        pixel = ((r & 0xF8) << 7) | ((g & 0xF8) << 2) | ((b & 0xF8) >> 3) | 0x8000;
    } else {
        pixel = ((r & 0xF0) << 4) | (g & 0xF0) | ((b & 0xF0) >> 4) | ((scaled_a & 0xE0) << 7);
    }

    temp_r31.field_0x0.color = pixel;
    temp_r31.field_0x2.color = pixel;
    temp_r31.field_0x4.color = pixel;
    temp_r31.field_0x6.color = pixel;
    DCStoreRange(&dMap_HIO_prm_res_dst_s::m_res->palette_data[i_paletteNo],
                 sizeof(dMpath_RGB5A3_palDt_s));
}

/* 8002A064-8002A148 0249A4 00E4+00 2/2 0/0 0/0 .text            copyPalette__6dMap_cFiif */
void dMap_c::copyPalette(int i_dstPaletteNo, int i_srcPaletteNo, f32 param_2) {
    JUT_ASSERT(0, i_dstPaletteNo < renderingAmap_c::PALETTE_NUMBER);
    JUT_ASSERT(0, i_srcPaletteNo < renderingAmap_c::PALETTE_NUMBER);

    int pixel;
    u8 scaled_a = 0;
    u8 r = 0;
    u8 g = 0;
    u8 b = 0;
    u8 a = 0;
    dMpath_RGB5A3_palDt_s& temp_r31 = dMap_HIO_prm_res_dst_s::m_res->palette_data[i_dstPaletteNo];
    getRGBA_RGB5A3(m_res_src->palette_data[i_srcPaletteNo], r, g, b, a);

    scaled_a = a * param_2;
    if (scaled_a >= 0xE0) {
        pixel = ((r & 0xF8) << 7) | ((g & 0xF8) << 2) | ((b & 0xF8) >> 3) | 0x8000;
    } else {
        pixel = ((r & 0xF0) << 4) | (g & 0xF0) | ((b & 0xF0) >> 4) | ((scaled_a & 0xE0) << 7);
    }

    temp_r31.field_0x0.color = pixel;
    temp_r31.field_0x2.color = pixel;
    temp_r31.field_0x4.color = pixel;
    temp_r31.field_0x6.color = pixel;
    DCStoreRange(&dMap_HIO_prm_res_dst_s::m_res->palette_data[i_dstPaletteNo],
                 sizeof(dMpath_RGB5A3_palDt_s));
}

/* 8002A148-8002A1BC 024A88 0074+00 1/0 0/0 0/0 .text setAmapPaletteColor__6dMap_cFiUcUcUcUc */
void dMap_c::setAmapPaletteColor(int i_paletteNo, u8 i_r, u8 i_g, u8 i_b, u8 i_scaledA) {
    JUT_ASSERT(0, i_paletteNo < renderingAmap_c::PALETTE_NUMBER);

    int pixel;
    if (i_scaledA >= 0xE0) {
        pixel = ((i_r & 0xF8) << 7) | ((i_g & 0xF8) << 2) | ((i_b & 0xF8) >> 3) | 0x8000;
    } else {
        pixel =
            ((i_r & 0xF0) << 4) | (i_g & 0xF0) | ((i_b & 0xF0) >> 4) | ((i_scaledA & 0xE0) << 7);
    }

    dMpath_RGB5A3_palDt_s& temp_r31 = dMap_HIO_prm_res_dst_s::m_res->palette_data[i_paletteNo];
    temp_r31.field_0x0.color = pixel;
    temp_r31.field_0x2.color = pixel;
    temp_r31.field_0x4.color = pixel;
    temp_r31.field_0x6.color = pixel;
    DCStoreRange(&dMap_HIO_prm_res_dst_s::m_res->palette_data[i_paletteNo],
                 sizeof(dMpath_RGB5A3_palDt_s));
}

/* 8002A1BC-8002A1DC 024AFC 0020+00 2/2 0/0 0/0 .text            getDispType__6dMap_cCFv */
int dMap_c::getDispType() const {
    return renderingAmap_c::getDispType();
}

/* 8002A1DC-8002A254 024B1C 0078+00 1/0 0/0 0/0 .text            isDrawRoom__6dMap_cCFii */
bool dMap_c::isDrawRoom(int param_0, int param_1) const {
    if (field_0x8e == 2) {
        if (field_0x8f >= 3 && field_0x8f <= 3) {
            return param_0 == field_0x84 || param_0 == field_0x88;
        } else {
            return param_0 == field_0x80;
        }
    } else {
        return renderingDAmap_c::isDrawRoom(param_0, param_1);
    }
}

/* 8002A254-8002A294 024B94 0040+00 1/0 0/0 0/0 .text            getRoomNoSingle__6dMap_cFv */
int dMap_c::getRoomNoSingle() {
    if (field_0x8e == 2 && field_0x8f <= 6) {
        return field_0x80;
    } else {
        return renderingDAmap_c::getRoomNoSingle();
    }
}

/* 8002A294-8002A32C 024BD4 0098+00 1/0 0/0 0/0 .text            isDrawRoomIcon__6dMap_cCFii */
bool dMap_c::isDrawRoomIcon(int param_0, int param_1) const {
    bool var_r30 = hasMap() || param_0 == param_1;
    if (renderingAmap_c::isRendAllRoom()) {
        var_r30 = var_r30 || dMapInfo_n::isVisitedRoom(param_0);
    }

    return var_r30;
}

/* 8002A32C-8002AB54 024C6C 0828+00 1/0 1/1 0/0 .text            _move__6dMap_cFffif */
void dMap_c::_move(f32 i_centerX, f32 i_centerZ, int i_roomNo, f32 param_3) {
    if (mStayRoomNo == -1) {
        mStayRoomNo = i_roomNo;
        field_0x80 = mStayRoomNo;
        field_0x84 = mStayRoomNo;
        dMapInfo_c::setNextRoomNoForMapPat0(mStayRoomNo);

        field_0x8e = 0;
        field_0x8f = 0;
        field_0x90 = 0;
        mCenterX = i_centerX;
        mCenterZ = i_centerZ;

        calcMapCenterXZ(field_0x80, &mCenterX, &mCenterZ);
        calcMapCmPerTexel(field_0x80, &field_0x58);
        getPack(field_0x80, &mPackX, &mPackZ);

        mCenterX += mPackX;
        mCenterZ -= mPackZ;
        mCenterX += field_0x64;
        mCenterZ += mPackPlusZ;
    }

    if (getStayType() == 0 && dComIfGs_isSaveDunSwitch(0x32) &&
        strcmp(dComIfGp_getStartStageName(), "F_SP121") == 0)
    {
        field_0x64 = 0.0f;
        mPackPlusZ = -3710.0f;

        f32 temp = (field_0x58 * (f32)(field_0x74 + 4)) * 0.5f;
        mRightEdgePlus = 0.0f;
        mTopEdgePlus = ((-22397.0f - dMpath_c::getMinZ()) - temp) / field_0x58;
    } else {
        mRightEdgePlus = 0.0f;
        mTopEdgePlus = 0.0f;
    }

    int temp_r29 = mStayRoomNo;
    mStayRoomNo = i_roomNo;

    dMapInfo_c::move(mStayRoomNo, param_3);
    field_0x8e = 0;

    switch (getDispType()) {
    default:
    case 0:
        JUT_ASSERT(0, 0);
        break;
    case 5:
        field_0x8e = 2;
        break;
    case 1:
        field_0x8e = 1;
        break;
    }

    switch (field_0x8e) {
    case 0:
        if (mStayRoomNo != temp_r29) {
            field_0x80 = mStayRoomNo;
            field_0x84 = mStayRoomNo;
            field_0x88 = mStayRoomNo;

            calcMapCenterXZ(field_0x80, &mCenterX, &mCenterZ);
            calcMapCmPerTexel(field_0x80, &field_0x58);
            getPack(field_0x80, &mPackX, &mPackZ);

            mCenterX += mPackX;
            mCenterZ -= mPackZ;
        }
        break;
    case 1:
        switch (field_0x8f) {
        case 0:
            if (field_0x80 != dMapInfo_c::getNextRoomNoForMapPat0()) {
                field_0x8f = 1;
                field_0x90 = 60;
                field_0x84 = (s8)dMapInfo_c::getNextRoomNoForMapPat0();
                field_0x88 = field_0x80;
            }
            break;
        case 1:
            field_0x90--;
            if (field_0x90 == 0) {
                field_0x8f = 0;
                field_0x80 = field_0x84;
                calcMapCenterXZ(field_0x80, &mCenterX, &mCenterZ);
            }
            break;
        }
        break;
    case 2:
        switch (field_0x8f) {
        case 0:
            if (field_0x80 != dMapInfo_c::getNextRoomNoForMapPat0()) {
                field_0x84 = (s8)dMapInfo_c::getNextRoomNoForMapPat0();
                field_0x88 = field_0x80;
                field_0x90 = 30;
                field_0x8f = 1;
                field_0x90 = 30;
            }
            break;
        case 1:
            if (field_0x90 != 0) {
                field_0x90--;
            }

            if (field_0x90 == 0 && mStayRoomNo != field_0x88) {
                field_0x8f = 2;
                field_0x90 = 5;
            }
            break;
        case 2:
            field_0x90--;
            if (field_0x90 == 0) {
                field_0x8f = 3;
                field_0x90 = 20;
            }
            break;
        case 3:
            field_0x90--;
            if (field_0x90 == 0) {
                field_0x80 = field_0x84;

                calcMapCenterXZ(field_0x80, &mCenterX, &mCenterZ);
                calcMapCmPerTexel(field_0x80, &field_0x58);
                getPack(field_0x80, &mPackX, &mPackZ);

                mCenterX += mPackX;
                mCenterZ -= mPackZ;
                field_0x8f = 4;
                field_0x90 = 5;
            }
            break;
        case 4:
            field_0x90--;
            if (field_0x90 == 0) {
                field_0x8f = 5;
            }
            break;
        case 5:
            if (field_0x84 == mStayRoomNo) {
                field_0x8f = 6;
            }
            break;
        case 6:
            field_0x8f = 0;
            break;
        }
        break;
    }

    switch (field_0x8e) {
    case 0:
        break;
    case 1:
        switch (field_0x8f) {
        case 0:
            break;
        case 1:
            calcMapCenterXZ(field_0x88, &mCenterX, &mCenterZ);
            f32 sp2C, sp28;
            calcMapCenterXZ(field_0x84, &sp2C, &sp28);

            f32 temp_f2 = 1.0f - ((f32)field_0x90 / 60.0f);
            mCenterX += temp_f2 * (sp2C - mCenterX);
            mCenterZ += temp_f2 * (sp28 - mCenterZ);
            break;
        }
        break;
    case 2:
        switch (field_0x8f) {
        case 2:
            f32 temp_f31 = (f32)field_0x90 / 5.0f;
            setMapPaletteColorAlphaPer(0x2F, 0x32, temp_f31);
            setMapPaletteColorAlphaPer(0x21, 0x2B, temp_f31);
            break;
        case 3:
            calcMapCenterXZ(field_0x88, &mCenterX, &mCenterZ);
            f32 sp24, sp20;
            calcMapCenterXZ(field_0x84, &sp24, &sp20);

            f32 temp_f31_2 = 1.0f - ((f32)field_0x90 / 20.0f);
            mCenterX += temp_f31_2 * (sp24 - mCenterX);
            mCenterZ += temp_f31_2 * (sp20 - mCenterZ);

            if (mStayRoomNo == field_0x88) {
                setMapPaletteColorAlphaPer(0xA, 0x11, temp_f31_2);
                setMapPaletteColorAlphaPer(0x12, 0x19, 1.0f - temp_f31_2);
            } else {
                setMapPaletteColorAlphaPer(0xA, 0x11, 1.0f - temp_f31_2);
                setMapPaletteColorAlphaPer(0x12, 0x19, temp_f31_2);
            }

            f32 sp1C, sp18;
            calcMapCmPerTexel(field_0x88, &sp1C);
            calcMapCmPerTexel(field_0x84, &sp18);
            field_0x58 = sp1C + (temp_f31_2 * (sp18 - sp1C));

            f32 sp14, sp10, spC, sp8;
            getPack(field_0x88, &sp14, &sp10);
            getPack(field_0x84, &spC, &sp8);

            sp14 += temp_f31_2 * (spC - sp14);
            sp10 += temp_f31_2 * (sp8 - sp10);
            mCenterX += sp14;
            mCenterZ -= sp10;
            break;
        case 4:
            f32 temp_f31_3 = 1.0f - ((f32)field_0x90 / 5.0f);
            setMapPaletteColorAlphaPer(0x2F, 0x32, temp_f31_3);
            setMapPaletteColorAlphaPer(0x21, 0x2B, temp_f31_3);
            break;
        case 6:
            copyPalette();
            break;
        }
        break;
    }

    field_0x8d = 1;
}

/* 8002AB54-8002ABAC 025494 0058+00 0/0 1/1 0/0 .text            _draw__6dMap_cFv */
void dMap_c::_draw() {
    if (mStayRoomNo >= 0 && field_0x8d != 0) {
        s8 floor_no = dMapInfo_c::getNowStayFloorNo();
        entry(mCenterX, mCenterZ, field_0x58, mStayRoomNo, floor_no);
    }
}

/* 8002ABAC-8002ABCC 0254EC 0020+00 1/0 0/0 0/0 .text            getFirstData__6dMap_cFUc */
dTres_c::typeGroupData_c* dMap_c::getFirstData(u8 param_0) {
    return renderingPlusDoorAndCursor_c::getFirstData(param_0);
}

/* 8002ABCC-8002ABEC 02550C 0020+00 1/0 0/0 0/0 .text
 * getNextData__6dMap_cFPQ27dTres_c15typeGroupData_c            */
dTres_c::typeGroupData_c* dMap_c::getNextData(dTres_c::typeGroupData_c* param_0) {
    return renderingPlusDoorAndCursor_c::getNextData(param_0);
}

// TODO: this is supposed to be auto-generated, but its not getting put in the right order
void dDlst_base_c::draw() {
    /* empty function */
}