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
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
|
/**
* d_s_play.cpp
* Main Gameplay Scene
*/
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/d_s_play.h"
#include "JSystem/JUtility/JUTConsole.h"
#include "JSystem/JUtility/JUTGamePad.h"
#include "SSystem/SComponent/c_counter.h"
#include "c/c_dylink.h"
#include "d/actor/d_a_player.h"
#include "d/d_demo.h"
#include "d/d_eye_hl.h"
#include "d/d_item.h"
#include "d/d_model.h"
#include "d/d_map_path_dmap.h"
#include "d/d_meter2_info.h"
#include "d/d_msg_object.h"
#include "d/d_save_HIO.h"
#include "f_op/f_op_draw_iter.h"
#include "f_op/f_op_msg_mng.h"
#include "f_op/f_op_overlap_mng.h"
#include "m_Do/m_Do_Reset.h"
#include "m_Do/m_Do_graphic.h"
#include "d/actor/d_a_suspend.h"
#include "d/actor/d_a_ykgr.h"
#include "JSystem/JHostIO/JORFile.h"
#include "JSystem/JHostIO/JORServer.h"
#include "JSystem/JKernel/JKRExpHeap.h"
#include "JSystem/JFramework/JFWSystem.h"
#include "f_ap/f_ap_game.h"
#include "d/d_bg_parts.h"
#include "f_op/f_op_kankyo_mng.h"
#include "d/actor/d_a_alink.h"
#include "d/actor/d_a_midna.h"
#include "JSystem/JKernel/JKRAram.h"
#include "JSystem/JKernel/JKRAramArchive.h"
#if DEBUG
#include "d/d_s_menu.h"
#include "d/d_debug_pad.h"
#include "d/d_jpreviewer.h"
#include "d/d_jcam_editor.h"
#include "d/d_a_obj.h"
#include "d/d_debug_viewer.h"
#endif
#include <cstring>
#if PLATFORM_WII
#include "d/d_cursor_mng.h"
#endif
static int dScnPly_Create(scene_class*);
static int dScnPly_Delete(dScnPly_c*);
static int dScnPly_IsDelete(dScnPly_c);
static int dScnPly_Execute(dScnPly_c*);
static int dScnPly_Draw(dScnPly_c*);
static int phase_00(dScnPly_c*);
static int phase_00(dScnPly_c*);
static int phase_1(dScnPly_c*);
static int phase_1_0(dScnPly_c*);
static int phase_01(dScnPly_c*);
static int phase_0(dScnPly_c*);
static int phase_2(dScnPly_c*);
static int phase_3(dScnPly_c*);
static int phase_4(dScnPly_c*);
static int phase_5(dScnPly_c*);
static int phase_6(dScnPly_c*);
static int phase_compleate(void*);
static request_of_phase_process_class resPhase[1];
static request_of_phase_process_class dylPhase[1];
#if DEBUG
static OSTime dylPreLoadTime0;
#endif
static OSTime dylPreLoadTime1;
static OSTime resPreLoadTime0;
static OSTime resPreLoadTime1;
static dScnPly_preLoad_HIO_c g_preLoadHIO;
s8 dScnPly_c::pauseTimer;
s8 dScnPly_c::nextPauseTimer;
#if DEBUG
u8 dScnPly_c::debugPause;
#endif
static const s16 T_JOINT_dylKeyTbl[1] = {
fpcNm_COW_e,
};
static const char* T_JOINT_resName[1] = {"Always"};
struct PreLoadInfo {
const char* stageName;
const s16* profNameTbl;
const char** resNameTbl;
u8 dylKeyTblNum;
u8 resNameNum;
};
static PreLoadInfo const PreLoadInfoT[1] = {
{
"T_JOINT",
T_JOINT_dylKeyTbl,
T_JOINT_resName,
ARRAY_SIZE(T_JOINT_dylKeyTbl),
ARRAY_SIZE(T_JOINT_resName),
},
};
static s8 preLoadNo = -1;
static u8 doPreLoad = 1;
#if DEBUG
void dScnPly_preLoad_HIO_c::genMessage(JORMContext* mctx) {
mctx->startComboBox("プリロード", &doPreLoad);
mctx->genComboBoxItem("しない", 0);
mctx->genComboBoxItem("する", 1);
mctx->endComboBox();
}
#endif
s8 dScnPly_c::calcPauseTimer() {
if (nextPauseTimer != 0) {
pauseTimer = nextPauseTimer;
nextPauseTimer = 0;
return pauseTimer;
} else {
return cLib_calcTimer<s8>(&pauseTimer);
}
}
#if DEBUG
dScnPly_reg_childHIO_c::dScnPly_reg_childHIO_c() {
for (int i = 0; i < 30; i++) {
mFloatReg[i] = 0.0f;
}
for (int i = 0; i < 10; i++) {
mShortReg[i] = 0;
}
}
void dScnPly_reg_childHIO_c::genMessage(JORMContext* mctx) {
char textbuf[8];
for (int i = 0; i < 20; i++) {
sprintf(textbuf, " F(%02d)", i);
mctx->genSlider(textbuf, &mFloatReg[i], -100000.0f, 100000.0f);
}
for (int i = 20; i < 25; i++) {
sprintf(textbuf, " F(%02d)", i);
mctx->genSlider(textbuf, &mFloatReg[i], 0.0f, 1.0f);
}
for (int i = 25; i < 30; i++) {
sprintf(textbuf, " F(%02d)", i);
mctx->genSlider(textbuf, &mFloatReg[i], -1.0f, 1.0f);
}
for (int i = 0; i < 10; i++) {
sprintf(textbuf, " S(%02d)", i);
mctx->genSlider(textbuf, &mShortReg[i], -0x8000, 0x7FFF);
}
}
void dScnPly_reg_HIO_c::genMessage(JORMContext* mctx) {
static const char l_nodeName[][20] = {
"森田(T)",
"まつたに(D)",
"イワワキ(I)",
"ささ(S)",
"うめみや(U)",
"おがわ(O)",
"坂口(Y)",
"さかい(K)",
"ハラ(B)",
"すみよし(M)",
"(空)-たけした(A)",
"吉田茂樹(P)",
"(空)-のま(N)",
"(空)-にしわき(W)",
"(空)-榊原政郎(J)",
"はやかわ(H)",
"(空)-定本(V)",
"(空)-西川(X)",
"(空)-鈴木(ゆ)(Z)",
"なかにし(n)",
"くわじま(k)",
"おかじま(o)",
"山崎(y)",
"芦田(a)",
"岡田(h)",
"高橋(t)",
};
// "Example usage"
mctx->genLabel("使い方例", 0);
mctx->genLabel("R_HS(00-09) ... はやかわレジスタ -32768 - +32767(short)", 0);
mctx->genLabel("R_HF(00-19) ... はやかわレジスタ -100000.0 - +100000.0", 0);
mctx->genLabel("R_HF(20-24) ... はやかわレジスタ 0.0f - 1.0f", 0);
mctx->genLabel("R_HF(25-29) ... はやかわレジスタ -1.0f - 1.0f", 0);
for (int i = 0; i < 26; i++) {
mctx->genNode(l_nodeName[i], &mChildReg[i], 0, 0);
}
}
dScnPly_preset_HIO_c::dScnPly_preset_HIO_c() {
field_0x5 = 0;
memset(mPresetData, 0, sizeof(mPresetData));
memset(filename_buf, 0, sizeof(filename_buf));
field_0x2716 = 0;
field_0x2717 = 0;
}
void dScnPly_preset_HIO_c::exePreset() {
JORFile file;
if (g_presetHIO.filename_buf[0] != 0) {
if (file.open((char*)filename_buf, 1, "", NULL, NULL, NULL)) {
memset(mPresetData, 0, sizeof(mPresetData));
field_0x2716 = 0;
field_0x2717 = 1;
file.readData(mPresetData, 0);
file.close();
if (dSm_read_stageset(mPresetData)) {
field_0x2717 = 2;
}
} else {
// "\nLoading error loop"
OS_REPORT("\n読み込みしっぱいのまきまき");
}
g_presetHIO.filename_buf[0] = 0;
}
}
void dScnPly_preset_HIO_c::genMessage(JORMContext* mctx) {
// "Load situation file"
mctx->genLabel("【状況ファイルを読みこみ】", 0x80000001);
// "Items and Status can be set in a file"
mctx->genLabel(" アイテムやステータスの状態をファイルで指定することが出来ます。", 0x80000001);
mctx->genLabel("", 0x80000001);
// "Click here to select a file to load!"
mctx->genButton("ここを押して読込ファイルを指定して下さい!", 0x40000001);
mctx->genLabel("", 0x80000001);
// "- Loading during gameplay will automatically return you to the debug menu."
mctx->genLabel("・ゲーム中に読み込むと自動的にデバッグメニューへ戻ります。", 0x80000001);
// "- When loading a file from the debug menu,"
mctx->genLabel("・デバッグメニューでファイルを読み込んだ際", 0x80000001);
// " if a stage command exists the game will temporarily load then return to the menu."
mctx->genLabel(" stage命令がある場合は一旦ゲームに入りメニューへと戻ります。", 0x80000001);
// " (To position the cursor)"
mctx->genLabel(" (カーソルを合わせる為)", 0x80000001);
mctx->genLabel("", 0x80000001);
// "Reset state to before loading situation file"
mctx->genButton("状況ファイルを読み込んでいない状態に戻す", 0x40000003);
mctx->genLabel("", 0x80000001);
mctx->genLabel("", 0x80000001);
// "Click here for the situation file location!"
mctx->genButton("状況ファイルの格納場所はコチラを押下!", 0x40000005);
mctx->genLabel("\\\\10.121.2.9\\zelda$\\JMAP_FOLDER\\situation", 0x80000001);
// "For details about the situation file contents, please refer to Nakamura-san's website"
mctx->genLabel("ファイルの内容については中村さんのHPをご参照ください", 0x80000001);
// "Click here to launch browser and view webpage."
mctx->genButton("ここを押すとブラウザが起動し表示されます。", 0x40000004);
mctx->genLabel("http://www-ead/~nakamuh/gc-zelda_2/misc/spec-situation_file.html", 0x80000001);
}
void dScnPly_preset_HIO_c::listenPropertyEvent(const JORPropertyEvent* event) {
JORReflexible::listenPropertyEvent(event);
JORFile file;
switch ((int)event->id) {
case 0x40000001:
if (file.open(1, "すべてのファイル(*.*)\0*.*", NULL, NULL, NULL)) {
memset(mPresetData, 0, sizeof(mPresetData));
field_0x2716 = 0;
field_0x2717 = 1;
file.readData(mPresetData, 0);
file.close();
if (dSm_read_stageset(mPresetData)) {
field_0x2717 = 2;
}
}
break;
case 0x40000003:
memset(mPresetData, 0, sizeof(mPresetData));
break;
case 0x40000004:
JORShellExecute(NULL, "http://www-ead/~nakamuh/gc-zelda_2/misc/spec-situation_file.html", NULL, NULL, 1);
break;
case 0x40000005:
JORShellExecute(NULL, "\\\\10.121.2.9\\zelda$\\ZELDA2_JMAP_FOLDER\\situation", NULL, NULL, 1);
break;
}
}
#endif
dScnPly_env_otherHIO_c::dScnPly_env_otherHIO_c() {
mShadowDensity = 255.0f;
mAdjustLODBias = TRUE;
mDisplayTransparentCyl = FALSE;
#if DEBUG
mAdjustCullFar = FALSE;
mCullFarValue = 4000.0f;
mDisplayShadows = TRUE;
mDisplayShadowImage = FALSE;
mDisplayShadowPoly = FALSE;
mDisplayCullBox = FALSE;
mLoadAllRooms = FALSE;
mDepthOfField = TRUE;
mRailSize = 5.0f;
mRailColorR = 0x50;
mRailColorG = 0x50;
mRailColorB = 0x50;
field_0x1a = 0xFF;
mDisplayParticleInfo = 0;
field_0x4e = 0;
field_0x4f = 0;
for (int i = 0; i < 20; i++) {
field_0x1c[i] = -1;
}
#endif
}
void dScnPly_env_otherHIO_c::genMessage(JORMContext* mctx) {
#if DEBUG
mctx->genCheckBox("影表示", &mDisplayShadows, 1);
mctx->genSlider("影濃さ", &mShadowDensity, 0.0f, 255.0f);
mctx->genCheckBox("被写界深度", &mDepthOfField, 1);
mctx->genCheckBox("LODバイアス変更", &mAdjustLODBias, 1);
mctx->genCheckBox("カリングFar変更", &mAdjustCullFar, 1);
mctx->genSlider("カリングFar値", &mCullFarValue, 0.0f, 50000.0f);
mctx->genCheckBox("影イメージ表示", &mDisplayShadowImage, 1);
mctx->genCheckBox("影ポリゴン表示", &mDisplayShadowPoly, 1);
mctx->genCheckBox("透明円柱表示", &mDisplayTransparentCyl, 1);
mctx->genCheckBox("カリングボックス表示", &mDisplayCullBox, 1);
mctx->genCheckBox("パーティクル情報表示", &mDisplayParticleInfo, 1);
mctx->genButton("パーティクル履歴", 0x4000003);
mctx->genCheckBox("全部屋読み込み", &mLoadAllRooms, 1);
mctx->genButton("部屋メモリ", 0x4000001);
mctx->genButton("草、花、低木本数", 0x4000002);
mctx->genSlider("レールサイズ", &mRailSize, 0.0f, 100.0f);
mctx->genSlider("レールカラー(R)", &mRailColorR, 0, 0xff);
mctx->genSlider("レールカラー(G)", &mRailColorG, 0, 0xff);
mctx->genSlider("レールカラー(B)", &mRailColorB, 0, 0xff);
#endif
}
#if DEBUG
void dScnPly_env_otherHIO_c::listenPropertyEvent(const JORPropertyEvent* event) {
JORReflexible::listenPropertyEvent(event);
JORFile file;
switch ((int)event->id) {
case 0x4000001:
OS_REPORT("#############################################\n");
break;
case 0x4000002:
break;
case 0x4000003:
g_envHIO.mOther.field_0x4e = 1;
break;
}
}
void dScnPly_env_otherHIO_c::printParticle() {
dDbVw_Report(20, 100, "Emitter Num <%d> X=<%d>", dComIfGp_particle_getEmitterNum(), dComIfGp_particle_getHeapSize());
dDbVw_Report(20, 120, "Particle Num <%d> Y=<%d>", dComIfGp_particle_getParticleNum(), dComIfGp_particle_getSceneHeapSize() - 0x180000);
int var_r26 = 0xA0;
int var_r28 = field_0x4f;
if (field_0x4e != 0) {
OS_REPORT("Particle Error !!\n");
for (int i = 0; i < 20; i++) {
var_r28--;
if (var_r28 < 0) {
var_r28= 19;
}
if (field_0x1c[var_r28] != 0xFFFF) {
OS_REPORT(" <ID=%d : %s>\n", field_0x1c[var_r28], dPa_name::getName(field_0x1c[var_r28]));
}
var_r26 += 20;
}
field_0x4e = 0;
}
}
#endif
dScnPly_env_debugHIO_c::dScnPly_env_debugHIO_c() {
mBoxCullMinSize.set(-100.0f, -100.0f, -100.0f);
mBoxCullMaxSize.set(100.0f, 100.0f, 100.0f);
mSphereCullCenter.set(0.0f, 0.0f, 0.0f);
mSphereCullRadius = 100.0f;
}
void dScnPly_env_debugHIO_c::genMessage(JORMContext* mctx) {
#if DEBUG
mctx->genLabel("【ボックスカリング(CULLSIZE_DEBUG)サイズ】", 0x80000001);
mctx->genSlider("最小X", &mBoxCullMinSize.x, -10000.0f, 10000.0f);
mctx->genSlider("最小Y", &mBoxCullMinSize.y, -10000.0f, 10000.0f);
mctx->genSlider("最小Z", &mBoxCullMinSize.z, -10000.0f, 10000.0f);
mctx->genSlider("最大X", &mBoxCullMaxSize.x, -10000.0f, 10000.0f);
mctx->genSlider("最大Y", &mBoxCullMaxSize.y, -10000.0f, 10000.0f);
mctx->genSlider("最大Z", &mBoxCullMaxSize.z, -10000.0f, 10000.0f);
mctx->genLabel("【球カリング(CULLSIZE_Q_DEBUG)サイズ】", 0x80000001);
mctx->genSlider("中心X", &mSphereCullCenter.x, -10000.0f, 10000.0f);
mctx->genSlider("中心Y", &mSphereCullCenter.y, -10000.0f, 10000.0f);
mctx->genSlider("中心Z", &mSphereCullCenter.z, -10000.0f, 10000.0f);
mctx->genSlider("半径", &mSphereCullRadius, -10000.0f, 10000.0f);
#endif
}
#if DEBUG
void dScnPly_env_debugHIO_c::listenPropertyEvent(const JORPropertyEvent* event) {
JORReflexible::listenPropertyEvent(event);
l_cullSizeBox[fopAc_CULLBOX_14_e].min = mBoxCullMinSize;
l_cullSizeBox[fopAc_CULLBOX_14_e].max = mBoxCullMaxSize;
l_cullSizeSphere[fopAc_CULLSPHERE_8_e - fopAc_CULLSPHERE_0_e].center = mSphereCullCenter;
l_cullSizeSphere[fopAc_CULLSPHERE_8_e - fopAc_CULLSPHERE_0_e].radius = mSphereCullRadius;
}
void dScnPly_env_HIO_c::genMessage(JORMContext* mctx) {
mctx->genNode("デバッグ用", &mDebug, 0, 0);
mctx->genNode("その他", &mOther, 0, 0);
}
static u32 l_usedMemoryBlockSize = 0xFFFFFFFF;
static int checkObjectSize(void* i_process, void* i_data) {
s16 profname = fpcM_GetProfName(i_process);
if (profname == fpcNm_BG_e) {
fopAc_ac_c* actor = (fopAc_ac_c*)i_process;
*((u32*)i_data) += ((l_usedMemoryBlockSize != 0 && actor->heap == NULL) ? 0 : actor->heap->getHeapSize()) + actor->base.base.profile->process_size;
} else if (profname == fpcNm_PLAY_SCENE_e || profname == fpcNm_ROOM_SCENE_e) {
*((u32*)i_data) += ((base_process_class*)i_process)->profile->process_size;
} else if (fopKyM_IsKy(i_process)) {
*((u32*)i_data + 1) += ((base_process_class*)i_process)->profile->process_size;
} else if (fopAcM_IsActor(i_process)) {
fopAc_ac_c* actor = (fopAc_ac_c*)i_process;
*((u32*)i_data + 1) += (actor->heap == NULL ? 0 : actor->heap->getHeapSize()) + actor->base.base.profile->process_size;
if (profname == fpcNm_ALINK_e) {
daAlink_c* alink = (daAlink_c*)actor;
*((u32*)i_data + 1) += alink->getOtherHeapSize();
} else if (profname == fpcNm_MIDNA_e) {
daMidna_c* midna = (daMidna_c*)actor;
*((u32*)i_data + 1) += midna->getOtherHeapSize();
}
}
return 1;
}
static void initUsedHeapSize() {
l_usedMemoryBlockSize = 0;
for (int i = 0; i < 19; i++) {
JKRHeap* heap = dStage_roomControl_c::getMemoryBlockHeap(i);
if (heap != NULL) {
l_usedMemoryBlockSize += heap->getHeapSize();
}
}
}
static bool lbl_8074CADB;
static void drawUsedHeapSize() {
if (mDoCPd_c::getHoldL(PAD_3) && mDoCPd_c::getHoldR(PAD_3) && mDoCPd_c::getTrigZ(PAD_3)) {
lbl_8074CADB = !lbl_8074CADB;
}
if (lbl_8074CADB) {
int gameSize = mDoExt_getSafeGameHeapSize() - mDoExt_getGameHeap()->getTotalFreeSize();
int zeldaSize = mDoExt_getSafeZeldaHeapSize() - mDoExt_getZeldaHeap()->getTotalFreeSize();
int archiveSize = mDoExt_getSafeArchiveHeapSize() - mDoExt_getArchiveHeap()->getTotalFreeSize();
int j2dSize = mDoExt_getSafeJ2dHeapSize() - mDoExt_getJ2dHeap()->getTotalFreeSize();
u32 sizes[2];
sizes[0] = dComIfG_getStageAllSize();
sizes[1] = dComIfG_getObjectAllSize() - (dComIfG_getObjectSize("CamParam")
+ dComIfG_getObjectSize("Event")
+ dComIfG_getObjectSize("Always")
+ dComIfG_getObjectSize("Alink")
+ dComIfG_getObjectSize("Midna"));
fpcLyIt_All(checkObjectSize, sizes);
if (l_usedMemoryBlockSize != 0) {
sizes[0] = l_usedMemoryBlockSize + dComIfG_getStageSize("Stg_00") + dComIfG_getStageSize("Xtg_00");
}
int var_r25 = JKRGetAramFreeSize() / 1024;
JUTReport(380, 300, "Stage : %d(K)", (sizes[0] + 0x3FF) / 1024);
JUTReport(380, 316, "Obj : %d(K)", (sizes[1] + 0x3FF) / 1024);
JUTReport(380, 332, "C-ARAM : %d(K)", var_r25);
JUTReport(380, 348, ">Game : %d(K)", (gameSize + 0x3FF) / 1024);
JUTReport(380, 364, ">Zelda : %d(K)", (zeldaSize + 0x3FF) / 1024);
JUTReport(380, 380, ">Archive : %d(K)", (archiveSize + 0x3FF) / 1024);
JUTReport(380, 380, ">J2d : %d(K)", (j2dSize + 0x3FF) / 1024);
}
}
#endif
static int dScnPly_Draw(dScnPly_c* i_this) {
static s16 l_wipeType[] = {
0, 0, 17, 2, 2, 1, 3, 1, 4, 4, 5, 5, 6, 7, 0, 0, 2, 2, 2, 2, 2, 8, 8,
};
#if DEBUG
fapGm_HIO_c::startCpuTimer();
fpc_ProcID id = fpcM_GetID(i_this);
drawUsedHeapSize();
dStage_DebugDisp();
#endif
dComIfG_Ccsp()->Move();
dComIfG_Bgsp().ClrMoveFlag();
if (!fopOvlpM_IsPeek() && !dComIfG_resetToOpening(i_this)) {
if (dComIfGp_isEnableNextStage()
#if DEBUG
&& !dScnMenu_c::isAutoSelect()
#endif
) {
JUT_ASSERT(1019, dComIfGp_getNextStageWipe() < ARRAY_SIZEU(l_wipeType));
u8 wipe = dComIfGp_getNextStageWipe();
#if DEBUG
if (g_kankyoHIO.navy.wipe_test_ON != 0xFF) {
wipe = g_kankyoHIO.navy.wipe_test_ON;
}
#endif
int rt = fopScnM_ChangeReq(i_this, fpcNm_PLAY_SCENE_e, l_wipeType[wipe], 5);
int hour = dKy_getdaytime_hour();
BOOL isDaytime = (hour >= 6 && hour < 18) ? FALSE : TRUE;
if (wipe == 1 || wipe == 2 || wipe == 7 || wipe == 17 || wipe == 21 ||
((wipe == 8 || wipe == 10 || wipe == 18) && isDaytime) ||
((wipe == 9 || wipe == 11 || wipe == 19) && !isDaytime))
{
mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&g_saftyWhiteColor);
} else if (wipe == 14 || wipe == 20) {
GXColor color = {0x2A, 0x1E, 0x46, 0xFF};
if (dKy_darkworld_check()) {
color.r = 0xFF;
color.g = 0xCF;
color.b = 0xB4;
}
mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&color);
} else {
mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&g_blackColor);
}
}
}
dMdl_mng_c::reset();
if (!dComIfGp_isPauseFlag() && !dScnPly_c::isPause()
#if DEBUG
&& !fapGm_HIO_c::isCaptureScreen()
#endif
) {
if (fpcM_GetName(i_this) == fpcNm_PLAY_SCENE_e) {
dComIfGp_getVibration().Run();
}
daSus_c::execute();
dComIfG_Bgsp().Move();
#if VERSION == VERSION_SHIELD_DEBUG
dPath_Move();
#endif
dComIfGp_particle_calc3D();
dComIfGp_particle_calc2D();
cCt_execCounter();
} else {
dPa_control_c::onStatus(1);
if (!dScnPly_c::isPause()) {
dPa_control_c::onStatus(2);
}
if (dScnPly_c::pauseTimer == 0) {
dComIfGp_getVibration().Pause();
}
}
#if DEBUG
if (fopOvlpM_IsDoingReq() != TRUE) {
if (dScnMenu_c::isAutoSelect() || dComIfG_isSceneResetButton() || g_presetHIO.field_0x2717 != 0) {
if (g_presetHIO.field_0x2717 != 0) {
dSm_read_stageset(g_presetHIO.mPresetData);
g_presetHIO.field_0x2717 = 0;
}
s16 spA = 0;
if (dDemo_c::getMode() == 1) {
dDemo_c::end();
spA = 7;
}
fopScnM_ChangeReq(i_this, fpcNm_MENU_SCENE_e, spA, 5);
mDoAud_bgmStop(30);
if (fpcM_GetName(i_this) != fpcNm_PLAY_SCENE_e) {
dComIfG_playerStatusD();
}
}
}
dDebugPad.Update();
fapGm_HIO_c::printCpuTimer("");
fapGm_HIO_c::stopCpuTimer("ゲーム管理(計算処理2)");
fapGm_HIO_c::printCpuTimer("");
#endif
for (create_tag_class* i = fopDwIt_Begin(); i != NULL; i = fopDwIt_Next(i)) {
void* process = i->mpTagData;
fpcM_Draw(process);
}
#if DEBUG
fapGm_HIO_c::startCpuTimer();
#endif
if (!dComIfGp_isPauseFlag()) {
dEyeHL_mng_c::update();
#if VERSION == VERSION_SHIELD_DEBUG
dBgp_c::drawShare();
#endif
#if DEBUG
daSus_c::draw();
#endif
dComIfG_Ccsp()->Draw();
#if DEBUG
dComIfG_Bgsp().Draw();
dPath_Draw();
#endif
dAttention_c* attention = dComIfGp_getAttention();
attention->Draw();
}
#if DEBUG
if (g_envHIO.mOther.mDisplayParticleInfo) {
g_envHIO.mOther.printParticle();
}
fapGm_HIO_c::printCpuTimer("");
fapGm_HIO_c::stopCpuTimer("ゲーム管理(描画処理)");
#endif
return 1;
}
#if DEBUG
static BOOL l_pause;
static f32 l_pauseFrame;
static u8 lbl_8074CAE4;
static u32 l_sceneChangeStartTick;
#endif
static int dScnPly_Execute(dScnPly_c* i_this) {
#if DEBUG
fapGm_HIO_c::startCpuTimer();
#endif
i_this->offReset();
#if DEBUG
if (lbl_8074CAE4) {
u32 var_r27 = OSGetTick() - l_sceneChangeStartTick;
OS_REPORT("\x1b[33m");
// "Scene transition time: %f seconds\n"
OS_REPORT("シーン切り替え時間 %f秒\n\x1B[m", (f32)OSTicksToMicroseconds(var_r27) / 1000000.0f);
lbl_8074CAE4 = 0;
initUsedHeapSize();
OS_REPORT("Game Heap <%d,%d,%d>\n", mDoExt_getGameHeap()->getTotalUsedSize(), mDoExt_getGameHeap()->getTotalFreeSize(), mDoExt_getGameHeap()->getFreeSize());
OS_REPORT("Zelda Heap <%d,%d,%d>\n", mDoExt_getZeldaHeap()->getTotalUsedSize(), mDoExt_getZeldaHeap()->getTotalFreeSize(), mDoExt_getZeldaHeap()->getFreeSize());
OS_REPORT("Archive Heap <%d,%d,%d>\n", mDoExt_getArchiveHeap()->getTotalUsedSize(), mDoExt_getArchiveHeap()->getTotalFreeSize(), mDoExt_getArchiveHeap()->getFreeSize());
OS_REPORT("最終残り %d(%fM)\n", JFWSystem::getRootHeap()->getTotalFreeSize(), (f32)JFWSystem::getRootHeap()->getTotalFreeSize() / (f32)0x100000);
OS_REPORT("拡張最終残り %d(%fM)\n", JKRGetRootHeap2()->getTotalFreeSize(), (f32)JKRGetRootHeap2()->getTotalFreeSize() / (f32)0x100000);
OS_REPORT("\x1b[m");
}
#endif
BOOL comboTrig = FALSE;
dStage_roomControl_c::offNoChangeRoom();
dStage_roomControl_c::setRoomReadId(0xFF);
if (!fopOvlpM_IsPeek()) {
if (mDoAud_zelAudio_c::isBgmSet()) {
mDoAud_sceneBgmStart();
mDoAud_load2ndDynamicWave();
mDoAud_zelAudio_c::offBgmSet();
}
if (i_this->calcPauseTimer() != 0) {
return 1;
}
}
dKy_itudemo_se();
#if DEBUG
if (mDoCPd_c::isConnect(PAD_3)) {
if (mDoCPd_c::getTrigStart(PAD_1) && !fapGmHIO_get2Ddraw()) {
comboTrig = TRUE;
} else if (mDoCPd_c::getHoldR(PAD_2) && mDoCPd_c::getTrigStart(PAD_2)) {
comboTrig = TRUE;
}
if (comboTrig == TRUE) {
if (l_pause) {
l_pause = FALSE;
} else {
l_pause = TRUE;
l_pauseFrame = 0.0f;
}
}
if (l_pause) {
l_pauseFrame += mDoCPd_c::getAnalogR(PAD_2);
if (!mDoCPd_c::getTrigZ(PAD_2) && l_pauseFrame < 1.0f) {
i_this->onDebugPause();
return 1;
}
l_pauseFrame -= 1.0f;
}
i_this->offDebugPause();
}
#endif
if (!dComIfGp_isPauseFlag()) {
#if DEBUG
dJprev_c::get()->update();
#endif
dDemo_c::update();
#if DEBUG
dJcame_c::get()->update();
#endif
#if VERSION == VERSION_SHIELD_DEBUG
dBgp_c::executeShare();
#endif
dComIfGp_getEvent()->Step();
dComIfGp_getAttention()->Run();
}
#if DEBUG
fapGm_HIO_c::printCpuTimer("");
fapGm_HIO_c::stopCpuTimer("ゲーム管理(計算処理1)");
fapGm_HIO_c::printCpuTimer("");
#endif
return 1;
}
static int dScnPly_IsDelete(dScnPly_c i_this) {
dComIfGp_particle_cleanup();
return 1;
}
static int dScnPly_Delete(dScnPly_c* i_this) {
UNUSED(i_this);
#if VERSION == VERSION_SHIELD_DEBUG
for (int i = 0; i < 32; i++) {
char* bank = dStage_roomControl_c::getArcBank(i);
if (strcmp(bank, "") != 0) {
int rt = dComIfG_syncObjectRes(bank);
if (rt > 0) {
return 0;
}
}
}
#endif
daSus_c::reset();
dMpath_c::remove();
dTres_c::remove();
dAttention_c* attention = dComIfGp_getAttention();
attention->~dAttention_c();
dComIfGp_getVibration().Remove();
dComIfG_Bgsp().Dt();
dComIfG_Ccsp()->Dt();
#if VERSION == VERSION_SHIELD_DEBUG
dPath_Dt();
#endif
dStage_Delete();
dComIfGp_event_remove();
dComIfGp_particle_removeScene(0);
dComIfGp_getMsgDtArchive(1)->removeResourceAll();
JKRUnmountArchive(dComIfGp_getMsgDtArchive(1));
#if DEBUG
dJcame_c::remove();
dJprev_c::remove();
#endif
dDemo_c::remove();
fopMsgM_destroyExpHeap(dComIfGp_getExpHeap2D());
dComIfGp_setExpHeap2D(NULL);
fopMsgM_destroyExpHeap(dComIfGp_getMsgExpHeap());
dComIfGp_setMsgExpHeap(NULL);
dComIfGp_deleteSimpleModel();
dMdl_mng_c::remove();
mDoGph_gInf_c::getBloom()->remove();
#if VERSION == VERSION_SHIELD_DEBUG
dBgp_c::removeShare();
#endif
dComIfGs_offPlayerFieldLastStayFieldDataExistFlag();
#if DEBUG
daObj::HioObj_c::clean();
mDoHIO_deleteChild(g_envHIO.field_0x4);
mDoHIO_deleteChild(g_save_bit_HIO.field_0x4);
g_preLoadHIO.removeHIO();
#endif
dComIfGp_setWindowNum(0);
dComIfGd_setView(NULL);
if (preLoadNo >= 0) {
OS_REPORT("\x1b[32mプリロード解放\n\x1b[m");
const char** resname_table = PreLoadInfoT[preLoadNo].resNameTbl;
int res_num = PreLoadInfoT[preLoadNo].resNameNum;
if (resname_table != NULL && (*resname_table != NULL)) {
for (int i = 0; i < res_num; i++) {
dComIfG_resDelete(&resPhase[i], resname_table[i]);
}
}
const s16* profname_table = PreLoadInfoT[preLoadNo].profNameTbl;
int prof_num = PreLoadInfoT[preLoadNo].dylKeyTblNum;
if (profname_table != NULL && *profname_table != 0) {
for (int i = 0; i < prof_num; i++) {
cDylPhs::Unlink(&dylPhase[i], profname_table[i]);
}
}
}
dComIfGp_init();
#if PLATFORM_WII
data_8053a730 = 0;
#endif
JUTAssertion::setMessageCount(0);
return 1;
}
#if DEBUG
static u32 getArchiveHeapSize(JKRHeap* i_heap, dRes_info_c* i_resInfo) {
if (i_resInfo == NULL) {
return 0;
}
u32 size = 0;
int var_r29;
JKRArchive* archive = i_resInfo->getArchive();
if (archive != NULL) {
var_r29 = i_heap->getSize(archive);
if (var_r29 > 0) {
size += var_r29 + 0x10;
}
var_r29 = i_heap->getSize(((JKRAramArchive*)archive)->mBlock);
if (var_r29 > 0) {
size += var_r29 + 0x10;
}
}
JKRSolidHeap* dataHeap = i_resInfo->getDataHeap();
if (dataHeap != NULL) {
int var_r26 = i_heap->getSize(dataHeap);
if (var_r26 > 0) {
size += var_r26 + 0x10;
}
}
return size;
}
static u32 getArchiveBankHeapSize(JKRHeap* i_heap) {
u32 size = 0;
for (int i = 0; i < 32; i++) {
char* bank = dStage_roomControl_c::getArcBank(i);
if (strcmp(bank, "") != 0) {
size += getArchiveHeapSize(i_heap, dComIfG_getObjectResInfo(bank));
}
}
return size;
}
static u32 getStageHeapSize(JKRHeap* i_heap) {
u32 size = 0;
for (int i = 0; i < 19; i++) {
JKRHeap* heap = dStage_roomControl_c::getMemoryBlockHeap(i);
if (heap != NULL) {
int var_r26 = i_heap->getSize(heap);
if (var_r26 > 0) {
size += var_r26 + 0x10;
}
}
}
if (size == 0) {
for (int i = 0; i < 64; i++) {
size += getArchiveHeapSize(i_heap, dComIfG_getStageResInfo(dComIfG_getRoomArcName(i)));
}
}
size += getArchiveHeapSize(i_heap, dComIfG_getStageResInfo("Stg_00")) + getArchiveHeapSize(i_heap, dComIfG_getStageResInfo("Xtg_00"));
return size;
}
static BOOL heapSizeCheck(const char* i_label, JKRExpHeap* i_heap, s32 i_base, BOOL param_3) {
s32 free = i_heap->getFreeSize();
s32 total = i_heap->getTotalUsedSize();
if (param_3) {
total -= getArchiveBankHeapSize(i_heap);
total -= getStageHeapSize(i_heap);
}
s32 archiveHeapSize = mDoExt_getSafeArchiveHeapSize();
f32 totalRatio = (f32)total / (f32)archiveHeapSize;
f32 freeRatio = (f32)free / (f32)total;
OS_REPORT("%s Free<%d> Total<%d> Base<%d> TotalRatio<%f> FreeRatio<%f>\n",
i_label,
free,
total,
i_base,
totalRatio,
freeRatio
);
int var_r30 = std::abs(total - i_base);
if (var_r30 > 64) {
// "%d (0x%x) byte difference!\n"
OS_REPORT("%d (0x%x) バイトの差があります!\n", var_r30, var_r30);
i_heap->dump();
return FALSE;
}
return TRUE;
}
static BOOL heapSizeCheck() {
return heapSizeCheck("ArchiveHeap", mDoExt_getArchiveHeap(), mDoExt_getSafeArchiveHeapSize(), TRUE)
&& heapSizeCheck("J2dHeap", mDoExt_getJ2dHeap(), mDoExt_getSafeJ2dHeapSize(), FALSE)
&& heapSizeCheck("GameHeap", mDoExt_getGameHeap(), mDoExt_getSafeGameHeapSize(), TRUE)
&& heapSizeCheck("ZeldaHeap", mDoExt_getZeldaHeap(), mDoExt_getSafeZeldaHeapSize(), FALSE)
&& heapSizeCheck("CommandHeap", mDoExt_getCommandHeap(), mDoExt_getSafeCommandHeapSize(), FALSE);
}
#endif
bool dScnPly_c::resetGame() {
if (fpcM_GetName(this) == fpcNm_OPENING_SCENE_e) {
if (!dStage_roomControl_c::resetArchiveBank(0)) {
return false;
}
if (!mDoAud_resetRecover()) {
return false;
}
if (mDoRst::isReset()) {
field_0x1d4 = 1;
}
} else {
#if VERSION != VERSION_SHIELD_DEBUG
if (dComIfGp_getNextStagePoint() == -4 || (dComIfGs_getLastSceneMode() & 0xF) == 0xC ||
!strcmp(dComIfGp_getNextStageName(), "F_SP109") ||
(!strcmp(dComIfGp_getNextStageName(), "F_SP116") &&
dComIfGp_getNextStageRoomNo() == 1 && dComIfGp_getNextStageLayer() == 9))
{
if (!dStage_roomControl_c::resetArchiveBank(0)) {
return false;
}
}
#endif
}
dComIfG_setBrightness(255);
mDoGph_gInf_c::offFade();
dDlst_list_c::offWipe();
return true;
}
void dScnPly_c::offReset() {
if (field_0x1d4 != 0 && !fopOvlpM_IsPeek()) {
mDoRst::offReset();
mDoRst::offResetPrepare();
#if VERSION != VERSION_SHIELD_DEBUG
JUTGamePad::C3ButtonReset::sResetOccurred = false;
JUTGamePad::setResetCallback(mDoRst_resetCallBack, NULL);
#endif
field_0x1d4 = 0;
}
}
static int phase_00(dScnPly_c* i_this) {
if (!i_this->resetGame()) {
return cPhs_INIT_e;
}
#if PLATFORM_WII
data_8053a730 = 1;
#endif
#if DEBUG
l_sceneChangeStartTick = OSGetTick();
lbl_8074CAE4 = 1;
mDoExt_setSafeGameHeapSize();
mDoExt_setSafeZeldaHeapSize();
mDoExt_setSafeCommandHeapSize();
mDoExt_setSafeArchiveHeapSize();
mDoExt_setSafeJ2dHeapSize();
#endif
mDoGph_gInf_c::offBlure();
#if DEBUG
if (!heapSizeCheck()) {
BOOL isDispWarning = mDoCPd_c::isConnect(PAD_3);
if (isDispWarning) {
JUT_WARN(2046, "%s", "Memory Danger !!");
}
}
#endif
return cPhs_NEXT_e;
}
static int phase_01(dScnPly_c* i_this) {
mDoAud_setHour(dKy_getdaytime_hour());
mDoAud_setMinute(dKy_getdaytime_minute());
mDoAud_setWeekday(dKy_get_dayofweek());
if (dKy_darkworld_check()) {
mDoAud_setInDarkness(true);
} else {
mDoAud_setInDarkness(false);
}
mDoAud_setSceneName(dComIfGp_getStartStageName(),
dComIfGp_getStartStageRoomNo(),
dComIfG_play_c::getLayerNo_common(dComIfGp_getStartStageName(), dComIfGp_getStartStageRoomNo(),
dComIfGp_getStartStageLayer()));
if (!mDoAud_load1stDynamicWave()) {
return cPhs_INIT_e;
} else {
return cPhs_NEXT_e;
}
}
static int phase_0(dScnPly_c* i_this) {
return cPhs_NEXT_e;
}
static int phase_1(dScnPly_c* i_this) {
dStage_roomControl_c::setProcID(fopScnM_GetID(i_this));
dComIfGp_setStartStage(dComIfGp_getNextStartStage());
if (dComIfGp_getStartStageLayer() < 0 && daPy_py_c::checkRoomRestartStart()) {
int layer = dComIfG_play_c::getLayerNo_common_common(dComIfGp_getStartStageName(), dComIfGp_getStartStageRoomNo(), dComIfGp_getStartStageLayer());
if (layer < 0) {
dComIfGp_setStartStageLayer(dComIfGp_getLayerOld());
}
}
dComIfGp_offEnableNextStage();
// Stage: Faron Woods, Room: Faron Spring
if (!strcmp(dComIfGp_getStartStageName(), "F_SP108") && dComIfGp_getStartStageRoomNo() == 1 &&
dComIfGp_getStartStagePoint() == 3)
{
dComIfGs_onDarkClearLV(0);
execItemGet(dItemNo_WEAR_KOKIRI_e);
}
// Stage: Kakariko Village, Room: Kakariko Village
else if (!strcmp(dComIfGp_getStartStageName(), "F_SP109") &&
dComIfGp_getStartStageRoomNo() == 0 && dComIfGp_getStartStagePoint() == 30)
{
dComIfGs_onDarkClearLV(1);
}
// Stage: Lake Hylia, Room: Fountain
else if (!strcmp(dComIfGp_getStartStageName(), "F_SP115") &&
dComIfGp_getStartStageRoomNo() == 1 && dComIfGp_getStartStagePoint() == 20)
{
dComIfGs_onDarkClearLV(2);
}
// Stage: Sacred Grove, Room: Lost Woods
else if (!strcmp(dComIfGp_getStartStageName(), "F_SP117") &&
dComIfGp_getStartStageRoomNo() == 1 && dComIfGp_getStartStagePoint() == 99)
{
dComIfGs_onDarkClearLV(3);
}
// Stage: Ordon Spring, Room: Ordon Spring
if (!strcmp(dComIfGp_getStartStageName(), "F_SP104") && dComIfGp_getStartStageRoomNo() == 1 &&
dComIfGp_getStartStagePoint() == 23 && dComIfGp_getStartStageLayer() == 12)
{
dComIfGs_onItemFirstBit(dItemNo_HORSE_FLUTE_e);
dComIfGs_setItem(SLOT_21, dItemNo_HORSE_FLUTE_e);
}
if ((u8)dKy_darkworld_stage_check(dComIfGp_getStartStageName(),
dComIfGp_getStartStageRoomNo()) == TRUE)
{
dComIfGp_world_dark_set(1);
} else if ((u8)dKy_darkworld_spot_check(dComIfGp_getStartStageName(),
dComIfGp_getStartStageRoomNo()) == TRUE)
{
dComIfGp_world_dark_set(2);
} else {
dComIfGp_world_dark_set(0);
}
#if DEBUG
if (dKy_darkworld_check()) {
if (dComIfGp_getStartStageLayer() != -1 && dComIfGp_getStartStageLayer() < 10 && dComIfG_play_c::getLayerNo(0) < 10) {
if (strcmp(dComIfGp_getStartStageName(), "D_MN08") != 0) {
// "Twilight layer spec error! sasaki"
OSReport_Error("\nトワイライトのレイヤー指定異常です! sasaki");
// "(If loaded from the debug menu, you can directly specify layers, so I can't tell if it's invalid.)"
OSReport_Error("\n(デバグメニューからの場合はレイヤー直指定できるので危険なのかは予測つきません。)");
OSReport_Error("\nstage[%s]", dComIfGp_getStartStageName());
OSReport_Error("\nroom[%d]", dComIfGp_getStartStageRoomNo());
OSReport_Error("\nlayer[%d]", dComIfG_play_c::getLayerNo(0));
OSReport_Error("\nTW1[%d]", dComIfGs_isDarkClearLV(0));
OSReport_Error("\nTW2[%d]", dComIfGs_isDarkClearLV(1));
OSReport_Error("\nTW3[%d]", dComIfGs_isDarkClearLV(2));
OSReport_Error("\nTW4[%d]", dComIfGs_isDarkClearLV(3));
}
}
}
#endif
// Stage: Lake Hylia, Room: Fountain
if (!strcmp(dComIfGp_getStartStageName(), "F_SP115") && dComIfGp_getStartStageRoomNo() == 1 &&
dComIfGp_getStartStageLayer() < 0)
{
if (dComIfG_play_c::getLayerNo_common(dComIfGp_getStartStageName(), dComIfGp_getStartStageRoomNo(), dComIfGp_getStartStageLayer()) == 9) {
dComIfGp_setStartStageLayer(9);
}
}
// Stage: Faron Woods, Room: South Faron
// Stage: Faron Woods Cave
// Stage: Kakariko Village, Room: Kakariko Village
// Stage: Lake Hylia, Room: Fountain
if ((!strcmp(dComIfGp_getStartStageName(), "F_SP108") && dComIfGp_getStartStageRoomNo() == 0 &&
dComIfGp_getStartStageLayer() == 7) ||
(!strcmp(dComIfGp_getStartStageName(), "D_SB10") && dComIfG_play_c::getLayerNo(0) == 14) ||
(!strcmp(dComIfGp_getStartStageName(), "F_SP109") && dComIfGp_getStartStageRoomNo() == 0 &&
dComIfGp_getStartStageLayer() == 8) ||
(!strcmp(dComIfGp_getStartStageName(), "F_SP115") && dComIfGp_getStartStageRoomNo() == 1 &&
dComIfGp_getStartStageLayer() == 8) ||
(!strcmp(dComIfGp_getStartStageName(), "F_SP115") && dComIfGp_getStartStageRoomNo() == 1 &&
dComIfGp_getStartStageLayer() == 9))
{
dComIfGp_world_dark_set(1);
}
// Stage: Zant Boss Fight, Room: Throne Room
if (!strcmp(dComIfGp_getStartStageName(), "D_MN08D") && dComIfGp_getStartStageRoomNo() == 50 &&
dComIfGp_getStartStagePoint() == 20)
{
dComIfGs_onSaveDunSwitch(30);
}
#if DEBUG
if (!strcmp(dComIfGp_getStartStageName(), "NPC_GND") && dComIfGp_getStartStageRoomNo() == 0 &&
dComIfGp_getStartStageLayer() >= 12)
{
dComIfGp_world_dark_set(1);
}
#endif
dKy_darkworld_Area_set(dComIfGp_getStartStageName(), dComIfGp_getStartStageRoomNo());
// Stage: Hyrule Castle Sewers, Room: Prison Cell
if (!strcmp(dComIfGp_getStartStageName(), "R_SP107") && dComIfGp_getStartStageRoomNo() == 0 &&
(dComIfGp_getStartStagePoint() == 24 || dComIfGp_getStartStagePoint() == 0))
{
dComIfGs_onTransformLV(0);
}
// Stage: Hyrule Field, Room: Eldin Gorge south entrance
else if (!strcmp(dComIfGp_getStartStageName(), "F_SP121") &&
dComIfGp_getStartStageRoomNo() == 2 && dComIfGp_getStartStagePoint() == 10)
{
dComIfGs_onTransformLV(1);
}
// Stage: Hyrule Field, Room: Lanayru Field north entrance
else if (!strcmp(dComIfGp_getStartStageName(), "F_SP121") &&
dComIfGp_getStartStageRoomNo() == 9 && dComIfGp_getStartStagePoint() == 10)
{
dComIfGs_onTransformLV(2);
}
// Stage: Hyrule Field, Room: Lanayru Field
else if (!strcmp(dComIfGp_getStartStageName(), "F_SP121") &&
dComIfGp_getStartStageRoomNo() == 10 &&
(dComIfGp_getStartStagePoint() == 23 || dComIfGp_getStartStagePoint() == 20))
{
dComIfGs_onTransformLV(3);
}
// Stage: Fishing Pond, Room: Fishing Pond
if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") && dComIfGp_getStartStageRoomNo() == 0 &&
dComIfGp_getStartStagePoint() == 2)
{
g_env_light.fishing_hole_season++;
if (g_env_light.fishing_hole_season > 4) {
g_env_light.fishing_hole_season = 1;
}
}
dComIfGs_BossLife_public_Set(0xFF);
#if DEBUG
if (g_env_light.light_mask_type & 0xF0) {
g_env_light.light_mask_type = g_env_light.light_mask_type & 0xF;
} else {
g_env_light.light_mask_type = 0;
}
#else
g_env_light.light_mask_type = 0;
#endif
JUTReportConsole_f("Start StageName:RoomNo [%s:%d]\n", dComIfGp_getStartStageName(),
dComIfGp_getStartStageRoomNo());
dComIfGp_setStatus(0);
if (dComIfG_syncStageRes("Stg_00") < 0) {
int rt = dComIfG_setStageRes("Stg_00", NULL);
JUT_ASSERT(2442, rt == 1);
}
return cPhs_NEXT_e;
}
static int phase_1_0(dScnPly_c* i_this) {
static char camparamarc[10] = "CamParam";
int rt = dComIfG_syncStageRes("Stg_00");
JUT_ASSERT(2469, rt >= 0);
if (rt != 0) {
return cPhs_INIT_e;
} else {
dStage_infoCreate();
dComIfG_setObjectRes("Event", (u8)0, NULL);
dComIfGp_setCameraParamFileName(0, camparamarc);
dComIfG_setObjectRes("CamParam", (u8)0, NULL);
return cPhs_NEXT_e;
}
}
static int phase_2(dScnPly_c* i_this) {
int rt = dComIfG_syncAllObjectRes();
if (rt >= 0 && rt != 0) {
return cPhs_INIT_e;
}
u8 particle_no = dStage_stagInfo_GetParticleNo(dComIfGp_getStage()->getStagInfo(),
dComIfG_play_c::getLayerNo(0));
if (particle_no == 255) {
particle_no = dStage_stagInfo_GetParticleNo(dComIfGp_getStage()->getStagInfo());
}
#if DEBUG
if (fapGm_HIO_c::mParticle254Fix) {
particle_no = 0xFE;
}
#endif
OS_REPORT("============== sceneParticleNo=%d\n", particle_no);
dComIfGp_particle_readScene(particle_no, &i_this->sceneCommand);
dMsgObject_readMessageGroup(&i_this->field_0x1d0);
return cPhs_NEXT_e;
}
static int phase_3(dScnPly_c* i_this) {
if ((i_this->sceneCommand != NULL && !i_this->sceneCommand->sync()) || mDoAud_check1stDynamicWave()) {
return cPhs_INIT_e;
}
if (i_this->field_0x1d0 != NULL && !i_this->field_0x1d0->sync()) {
return cPhs_INIT_e;
}
#if VERSION == VERSION_SHIELD_DEBUG
dBgp_c::createShare();
#endif
return cPhs_NEXT_e;
}
dScnPly_reg_HIO_c g_regHIO;
dScnPly_env_HIO_c g_envHIO;
#if DEBUG
dScnPly_preset_HIO_c g_presetHIO;
#endif
static int phase_4(dScnPly_c* i_this) {
#if VERSION == VERSION_SHIELD_DEBUG
if (!dBgp_c::executeShare()) {
return cPhs_INIT_e;
}
#endif
if (i_this->sceneCommand) {
JUT_ASSERT(2610, i_this->sceneCommand->getMemAddress() != NULL);
dComIfGp_particle_createScene(i_this->sceneCommand->getMemAddress());
delete i_this->sceneCommand;
} else {
dComIfGp_particle_createScene(NULL);
}
if (i_this->field_0x1d0 != NULL) {
dComIfGp_setMsgDtArchive(1, i_this->field_0x1d0->getArchive());
i_this->field_0x1d0->destroy();
}
dComIfGp_calcNowRegion();
#if DEBUG
dComIfG_initStopwatch();
#endif
dComIfG_Bgsp().Ct();
fopAcM_lc_c::getLineCheck()->ClearPi();
fopAcM_gc_c::getGroundCheck()->ClearPi();
fopAcM_rc_c::getRoofCheck()->ClearPi();
fopAcM_wt_c::getWaterCheck()->ClearPi();
dComIfG_Ccsp()->Ct();
#if VERSION == VERSION_SHIELD_DEBUG
dPath_Ct();
#endif
dDemo_c::create();
dEyeHL_mng_c::create();
#if DEBUG
dJcame_c::create(dDemo_c::getSystem(), 0.03333334f, *mDoCPd_c::getGamePad(PAD_4));
dJprev_c::create((JStudio::TControl*)dDemo_c::getControl(), *mDoCPd_c::getGamePad(PAD_4));
#endif
dComIfGp_setPlayerInfo(0, NULL, 0);
for (int i = 0; i < 2; i++) {
dComIfGp_setPlayerPtr(i, NULL);
}
dComIfGp_setWindow(0, 0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f, 0, 2);
dComIfGp_setCameraInfo(0, NULL, 0, 0, -1);
dComIfGd_setWindow(NULL);
dComIfGd_setViewport(NULL);
dComIfGd_setView(NULL);
JKRExpHeap* heap = fopMsgM_createExpHeap(0xBB800, NULL);
JUT_ASSERT(2704, heap != NULL);
dComIfGp_setExpHeap2D(heap);
JKRExpHeap* heap2 = fopMsgM_createExpHeap(0xA800, NULL);
JUT_ASSERT(2709, heap2 != NULL);
dComIfGp_setMsgExpHeap(heap2);
if (fpcM_GetName(i_this) == fpcNm_OPENING_SCENE_e) {
fopAcM_create(fpcNm_TITLE_e, 0, NULL, -1, NULL, NULL, -1);
#if DEBUG
g_playerKind = 0;
#endif
dComIfGs_init();
dComIfGs_setOptPointer(0);
dComIfGs_setLife(12);
dMeter2Info_setCloth(dItemNo_WEAR_KOKIRI_e, false);
dMeter2Info_setSword(dItemNo_SWORD_e, false);
dMeter2Info_setShield(dItemNo_HYLIA_SHIELD_e, false);
dComIfGs_onEventBit(0x0601); // Epona Tamed
}
dMpath_c::create();
dTres_c::create();
dStage_Create();
dComIfGp_createSimpleModel();
dMdl_mng_c::create();
mDoGph_gInf_c::setTickRate(OS_TIMER_CLOCK / 30);
#if DEBUG
g_preLoadHIO.entryHIO("プリロード制御");
#endif
g_envHIO.field_0x4 = mDoHIO_CREATE_CHILD("描画設定", &g_envHIO);
g_save_bit_HIO.field_0x4 = mDoHIO_CREATE_CHILD("記録ビット", &g_save_bit_HIO);
#if DEBUG
daObj::HioObj_c::init();
#endif
dAttention_c* attention = dComIfGp_getAttention();
new (attention) dAttention_c(dComIfGp_getPlayer(0), 0);
dComIfGp_getVibration().Init();
daYkgr_c::init();
dComIfG_setBrightness(255);
mDoGph_gInf_c::offFade();
mDoAud_zelAudio_c::onBgmSet();
dScnPly_c::pauseTimer = 0;
dScnPly_c::nextPauseTimer = 0;
preLoadNo = -1;
if (doPreLoad != 0) {
const char* stageName = dComIfGp_getStartStageName();
OS_REPORT("stageName=%s\n", stageName);
for (u32 i = 0; i < 1; i++) {
if (strcmp(stageName, PreLoadInfoT[i].stageName) == 0) {
preLoadNo = i;
}
}
}
if (preLoadNo < 0) {
return cPhs_COMPLEATE_e;
}
OS_REPORT("\x1b[32mプリロードやります\n\x1b[m");
resPreLoadTime0 = OSGetTime();
return cPhs_NEXT_e;
}
static int phase_5(dScnPly_c* i_this) {
if (preLoadNo >= 0) {
int phase_state = cPhs_NEXT_e;
int goodLoads = 0;
int loadNum = 0;
const char** resNames = PreLoadInfoT[preLoadNo].resNameTbl;
s32 resNameNum = PreLoadInfoT[preLoadNo].resNameNum;
if (resNames != NULL && *resNames != NULL) {
JUT_ASSERT(2830, resNameNum <= ARRAY_SIZEU(resPhase));
for (int i = 0; i < resNameNum; i++) {
int load_phase = dComIfG_resLoad(&resPhase[i], resNames[i]);
if (load_phase != cPhs_COMPLEATE_e) {
phase_state = cPhs_INIT_e;
} else {
goodLoads++;
}
loadNum++;
}
OS_REPORT("\x1b[32mリソースプリロード %d/%d\n\x1b[m", goodLoads, loadNum);
}
if (phase_state == cPhs_COMPLEATE_e) {
resPreLoadTime1 = OSGetTime();
OS_REPORT("\x1b[32mリソースプリロード %lld ms\n\x1b[m", OSTicksToMilliseconds(resPreLoadTime1 - resPreLoadTime0));
}
return phase_state;
}
return cPhs_NEXT_e;
}
static int phase_6(dScnPly_c* i_this) {
if (preLoadNo >= 0) {
int phase_state = cPhs_NEXT_e;
int goodLoads = 0;
int loadNum = 0;
const s16* dylKeyTbl = PreLoadInfoT[preLoadNo].profNameTbl;
s32 dylKeyTblNum = PreLoadInfoT[preLoadNo].dylKeyTblNum;
if (dylKeyTbl != NULL && *dylKeyTbl != 0) {
JUT_ASSERT(2864, dylKeyTblNum <= ARRAY_SIZEU(dylPhase));
for (int i = 0; i < dylKeyTblNum; i++) {
int load_phase = cDylPhs::Link(&dylPhase[i], dylKeyTbl[i]);
if (load_phase != cPhs_COMPLEATE_e) {
phase_state = cPhs_INIT_e;
} else {
goodLoads++;
}
loadNum++;
}
OS_REPORT("\x1b[32mダイナミックリンクプリロード %d/%d\n\x1b[m", goodLoads, loadNum);
}
if (phase_state == cPhs_COMPLEATE_e) {
dylPreLoadTime1 = OSGetTime();
OS_REPORT("\x1b[32mダイナミックリンクプリロード %lld ms\n\x1b[m", OSTicksToMilliseconds(dylPreLoadTime1 - dylPreLoadTime0));
}
return phase_state;
}
return cPhs_NEXT_e;
}
static int phase_compleate(void* i_this) {
return cPhs_COMPLEATE_e;
}
static int dScnPly_Create(scene_class* i_this) {
static request_of_phase_process_fn l_method[] = {
(request_of_phase_process_fn)phase_00,
(request_of_phase_process_fn)phase_1,
(request_of_phase_process_fn)phase_1_0,
(request_of_phase_process_fn)phase_01,
(request_of_phase_process_fn)phase_0,
(request_of_phase_process_fn)phase_2,
(request_of_phase_process_fn)phase_3,
(request_of_phase_process_fn)phase_4,
(request_of_phase_process_fn)phase_5,
(request_of_phase_process_fn)phase_6,
(request_of_phase_process_fn)phase_compleate,
};
dScnPly_c* a_this = (dScnPly_c*)i_this;
int phase_state = dComLbG_PhaseHandler(&a_this->field_0x1c4, l_method, a_this);
return phase_state;
}
static scene_method_class l_dScnPly_Method = {
(process_method_func)dScnPly_Create, (process_method_func)dScnPly_Delete,
(process_method_func)dScnPly_Execute, (process_method_func)dScnPly_IsDelete,
(process_method_func)dScnPly_Draw,
};
scene_process_profile_definition g_profile_PLAY_SCENE = {
/* Layer ID */ fpcLy_ROOT_e,
/* List ID */ 1,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_PLAY_SCENE_e,
/* Proc SubMtd */ &g_fpcNd_Method.base,
/* Size */ sizeof(dScnPly_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopScn_Method.base,
/* Scene SubMtd */ &l_dScnPly_Method,
};
scene_process_profile_definition g_profile_OPENING_SCENE = {
/* Layer ID */ fpcLy_ROOT_e,
/* List ID */ 1,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_OPENING_SCENE_e,
/* Proc SubMtd */ &g_fpcNd_Method.base,
/* Size */ sizeof(dScnPly_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopScn_Method.base,
/* Scene SubMtd */ &l_dScnPly_Method,
};
|