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
|
#include "m_select.h"
#include "overlays/gamestates/ovl_play/m_play.h"
#include "m_debug.h"
#include "6B81C0.h"
#include "6BA500.h"
#include "libu64/gfxprint.h"
#include "m_scene_table.h"
#include "macros.h"
#include "libc/alloca.h"
#include "m_rcp.h"
#include "audio.h"
#include "m_time.h"
#define nf_str(s0, s1) (s0 GFXPRINT_KATAKANA_MODE s1)
NameFunction nf_tbl[SCENE_NUM] = {
{ nf_str(" 1:", "フィールド コース1"), game_next_play, SCENE_TEST1 },
{ nf_str(" 2:", "フィールド コース2"), game_next_play, SCENE_TEST2 },
{ nf_str(" 3:", "フィールデ コース3"), game_next_play, SCENE_TEST3 },
{ nf_str(" 4:", "オミズテスト コース"), game_next_play, SCENE_WATER_TEST },
{ nf_str(" 5:", "アシアトテストコース"), game_next_play, SCENE_FOOTPRINT_TEST },
{ nf_str(" 6:", "npc テストコース"), game_next_play, SCENE_NPC_TEST },
{ nf_str(" 7:", "NPCアレンジルーム"), game_next_play, SCENE_NPC_HOUSE },
{ nf_str(" 8:", "NPCランダムコース"), game_next_play, SCENE_FG },
{ nf_str(" 9:", "FGツール フィールドヨウ"), game_next_play, SCENE_RANDOM_NPC_TEST },
{ nf_str("10:", "オミセ"), game_next_play, SCENE_SHOP0 },
{ nf_str("11:", "BGプレビュー カワナシ"), game_next_play, SCENE_BG_TEST_NO_RIVER },
{ nf_str("12:", "BGプレビュー カワアリ"), game_next_play, SCENE_BG_TEST_RIVER },
{ nf_str("13:", "ヤミブローカーノ オミセ"), game_next_play, SCENE_BROKER_SHOP },
{ nf_str("14:", "FGツール ヘヤノナカヨウ"), game_next_play, SCENE_FIELD_TOOL_INSIDE },
{ nf_str("15:", "ユウビンキョク"), game_next_play, SCENE_POST_OFFICE },
{ nf_str("16:", "start demo 1"), game_next_play, SCENE_START_DEMO },
{ nf_str("17:", "start demo 2"), game_next_play, SCENE_START_DEMO2 },
{ nf_str("18:", "コウバン"), game_next_play, SCENE_POLICE_BOX },
{ nf_str("19:", "ホロバシャ"), game_next_play, SCENE_BUGGY },
{ nf_str("20:", "プレーヤー セレクト"), game_next_play, SCENE_PLAYERSELECT },
{ nf_str("21:", "マイルーム size S"), game_next_play, SCENE_MY_ROOM_S },
{ nf_str("22:", "マイルーム size M"), game_next_play, SCENE_MY_ROOM_M },
{ nf_str("23:", "マイルーム size L"), game_next_play, SCENE_MY_ROOM_L },
{ nf_str("24:", "コンビニ"), game_next_play, SCENE_CONVENI },
{ nf_str("25:", "スーパー"), game_next_play, SCENE_SUPER },
{ nf_str("26:", "デパート1F"), game_next_play, SCENE_DEPART },
{ nf_str("27:", "テストコース 5"), game_next_play, SCENE_TEST5 },
{ nf_str("28:", "プレーヤー セレクト 2"), game_next_play, SCENE_PLAYERSELECT_2 },
{ nf_str("29:", "プレーヤー セレクト 3"), game_next_play, SCENE_PLAYERSELECT_3 },
{ nf_str("30:", "デパート2F"), game_next_play, SCENE_DEPART_2 },
{ nf_str("31:", "イベント コクチ"), game_next_play, SCENE_EVENT_ANNOUNCEMENT },
{ nf_str("32:", "カマクラ"), game_next_play, SCENE_KAMAKURA },
{ nf_str("33:", "for field tool"), game_next_play, SCENE_FIELD_TOOL },
{ nf_str("34:", "キャクマチ デモ"), game_next_play, SCENE_TITLE_DEMO },
{ nf_str("35:", "プレーヤー セレクト 4"), game_next_play, SCENE_PLAYERSELECT_SAVE },
};
void game_next_play(Game* game, s32 scene) {
common_data.save.sceneNo = scene;
STOP_GAMESTATE(game);
SET_NEXT_GAMESTATE(game, play_init, sizeof(Game_Play));
mHm_SetNowHome();
common_data.doorData.nextSceneId = 0;
func_800968C0_jp();
common_data.unk_10140 = 1;
}
char data2fcode(char data) {
char fcode = ' ';
if (data != 0) {
fcode = data + 0x90;
}
return fcode;
}
char fcode2data(char fcode) {
char data = 0;
if (fcode != ' ') {
data = fcode - 0x90;
}
return data;
}
void select_pass(Game_Select* select) {
lbRTC_time_c* rtc = &common_data.time.rtcTime;
NameFunction* nfPtr;
s32 scene = common_data.sceneFromTitleDemo;
common_data.time.nowSec = mTM_TIME_TO_SEC(rtc->hour, rtc->min, rtc->sec);
nfPtr = &nf_tbl[scene];
if (nfPtr->nextProc != NULL) {
(*nfPtr->nextProc)((Game*)select, nfPtr->sceneNo);
}
common_data.sceneFromTitleDemo = -1;
}
s32 select_start_proc(Game_Select* select) {
NameFunction* nfPtr;
s32 i;
common_data.time.nowSec =
mTM_TIME_TO_SEC(common_data.time.rtcTime.hour, common_data.time.rtcTime.min, common_data.time.rtcTime.sec);
nfPtr = &nf_tbl[select->selectedScene];
if (nfPtr->nextProc != NULL) {
(*nfPtr->nextProc)((Game*)select, nfPtr->sceneNo);
}
DORO(80) = select->selectedScene;
DORO(81) = select->topScene;
if (common_data.time.rtcTime.min == 0) {
common_data.time.timeSignal = 1;
}
for (i = 0; i < PLAYER_NAME_LEN; i++) {
common_data.privateInfo->playerId.playerName[i] = data2fcode(select->name[i]);
}
return 1;
}
s32 select_check_start(Game_Select* select) {
if (select->status == 0) {
if (chkTrigger(START_BUTTON) || chkTrigger(A_BUTTON)) {
return select_start_proc(select);
}
} else if (chkTrigger(START_BUTTON)) {
return select_start_proc(select);
}
return 0;
}
s32 select_check_A_button_rtc(UNUSED Game_Select* select) {
return FALSE;
}
s32 select_check_A_button_time(UNUSED Game_Select* select) {
return FALSE;
}
s32 select_check_A_buttonStep(UNUSED Game_Select* select) {
return FALSE;
}
s32 select_check_A_button_weather(UNUSED Game_Select* select) {
s32 weather = common_data.weather;
weather++;
if (weather >= 5 || weather < 0) {
weather = 0;
}
common_data.weather = weather;
common_data.weatherIntensity = 3;
{
u8 saved;
saved = weather;
saved = weather << 4;
common_data.save.saveWeather = saved | 3;
}
return 0;
}
s32 select_check_A_button_sex(UNUSED Game_Select* select) {
s32 sex = common_data.privateInfo->gender;
sex++;
sex %= mPr_SEX_NUM;
common_data.privateInfo->gender = sex;
return FALSE;
}
s32 select_check_A_button_face_type(UNUSED Game_Select* select) {
s32 face_type = common_data.privateInfo->face;
face_type++;
face_type %= mPr_FACE_TYPE_NUM;
common_data.privateInfo->face = face_type;
return FALSE;
}
s32 select_check_A_button_swell(UNUSED Game_Select* select) {
s32 sting;
sting = common_data.beeStingFlag;
if (sting != 0) {
sting = 0;
} else {
sting = 1;
}
common_data.beeStingFlag = sting;
return FALSE;
}
s32 select_check_A_button_decoy(UNUSED Game_Select* select) {
s32 decoy;
decoy = common_data.playerDecoyFlag;
if (decoy != 0) {
decoy = 0;
} else {
decoy = 1;
}
common_data.playerDecoyFlag = decoy;
return FALSE;
}
s32 select_check_A_button_cloth(UNUSED Game_Select* select) {
return FALSE;
}
s32 select_check_A_button_event(UNUSED Game_Select* select) {
return FALSE;
}
typedef s32 (*SelectCheckProc)(Game_Select*);
s32 select_check_A_button(Game_Select* select) {
static SelectCheckProc process[] = {
&select_check_A_button_rtc, &select_check_A_button_time, &select_check_A_buttonStep,
&select_check_A_button_weather, &select_check_A_button_sex, &select_check_A_button_face_type,
&select_check_A_button_swell, &select_check_A_button_decoy, &select_check_A_button_cloth,
&select_check_A_button_event,
};
if (chkTrigger(A_BUTTON)) {
return (*process[select->cursorY])(select);
} else {
return FALSE;
}
}
s32 select_move_cursol(Game_Select* select) {
if (chkTrigger(L_JPAD)) {
select->status = 0;
return TRUE;
} else if (chkTrigger(U_JPAD)) {
if (select->cursorY == 0) {
select->cursorY = SELECT_CHECK_A_BUTTON_NUM - 1;
} else {
select->cursorY--;
}
} else if (chkTrigger(D_JPAD)) {
select->cursorY = (select->cursorY + 1) % SELECT_CHECK_A_BUTTON_NUM;
}
return FALSE;
}
s32 select_course_step_sub(s32 course) {
if (course < 0) {
course += 0x23;
} else if (course >= 0x23) {
course -= 0x23;
}
return course;
}
void select_adjust_top_no(Game_Select* select, s32 course, s32 adjust) {
s32 top = select->topScene;
s32 newTop = (select->topScene + 0xE) % 0x23;
if (top < newTop) {
if (course <= top || course >= newTop) {
top = select_course_step_sub(top + adjust);
}
} else if (course <= top && course >= newTop) {
top = select_course_step_sub(top + adjust);
}
select->topScene = top;
}
void select_course_step(Game_Select* select, s32 addend) {
s32 step = select->step + addend;
if (ABS(step) >= 32) {
s32 course = select->selectedScene;
sAdo_SysTrgStart(1);
if (step > 0) {
step = 0;
course = select_course_step_sub(course + 1);
select_adjust_top_no(select, course, 1);
} else {
step = 0;
course = select_course_step_sub(course - 1);
select_adjust_top_no(select, course, -1);
}
select->stepAdd = 6;
select->selectedScene = course;
}
select->step = step;
}
void select_course(Game_Select* select) {
if (chkTrigger(U_JPAD)) {
if (select->step > 0) {
select->step = 0;
}
select_course_step(select, -32);
select->stepAdd = 1;
} else if (chkButton(U_JPAD)) {
select_course_step(select, -select->stepAdd);
} else if (chkTrigger(D_JPAD)) {
if (select->step < 0) {
select->step = 0;
}
select_course_step(select, 32);
select->stepAdd = 1;
} else if (chkButton(D_JPAD)) {
select_course_step(select, select->stepAdd);
}
}
void select_move_main(Game_Select* select) {
if (select_check_start(select) != TRUE) {
if (chkTrigger(R_JPAD)) {
select->status = 1;
} else {
select_course(select);
}
}
}
void select_move_setup(Game_Select* select) {
if (select_check_start(select) != TRUE && select_move_cursol(select) != TRUE) {
if (select_check_A_button(select) == TRUE) {}
}
}
void select_move_time_year_set(s32 adjust) {
s32 year = common_data.time.rtcTime.year;
year += adjust;
if (year > lbRTC_YEAR_MAX) {
year -= ((lbRTC_YEAR_MAX - lbRTC_YEAR_MIN) + 1);
} else if (year < lbRTC_YEAR_MIN) {
year = lbRTC_YEAR_MAX - ((lbRTC_YEAR_MIN - 1) - year);
}
common_data.time.rtcTime.year = year;
}
void select_move_time_month_set(s32 adjust) {
static s32 season_table[] = {
SPRING, WINTER, WINTER, SPRING, SPRING, SPRING, SUMMER, SUMMER, SUMMER, FALL, FALL, FALL, WINTER,
};
s32 month;
month = common_data.time.rtcTime.month;
month = (month + adjust);
month %= (lbRTC_MONTHS_MAX + 1);
if (month == 0) {
month = (adjust > 0) ? 1 : 12;
}
common_data.time.rtcTime.month = month;
{
u8 save = lbRTC_GetDaysByMonth(common_data.time.rtcTime.year, common_data.time.rtcTime.month);
if (common_data.time.rtcTime.day > save) {
common_data.time.rtcTime.day = save;
}
}
common_data.time.season = season_table[month];
}
void select_move_time_day_set(s32 adjust) {
u8 max_day = lbRTC_GetDaysByMonth(common_data.time.rtcTime.year, common_data.time.rtcTime.month);
s32 day = common_data.time.rtcTime.day;
day = (day + adjust) % (max_day + 1);
if (day == 0) {
day = (adjust > 0) ? 1 : max_day;
}
common_data.time.rtcTime.day = day;
}
void select_move_time_hour_set(s32 adjust) {
s32 hour = common_data.time.rtcTime.hour;
if (hour == 0 && adjust < 0) {
hour = lbRTC_HOURS_PER_DAY - 1;
} else {
hour = (hour + adjust) % lbRTC_HOURS_PER_DAY;
}
common_data.time.rtcTime.hour = hour;
}
void select_move_time_min_set(s32 adjust) {
s32 min = common_data.time.rtcTime.min;
if (min == 0 && adjust < 0) {
min = lbRTC_MINUTES_PER_HOUR - 1;
} else {
min = (min + adjust) % lbRTC_MINUTES_PER_HOUR;
}
common_data.time.rtcTime.min = min;
}
void select_move_time_week_set(s32 adjust) {
static lbRTC_time_c base = {
0,
0,
0, // 00:00:00
1,
lbRTC_SATURDAY,
lbRTC_JANUARY, // Sunday Jan 1st
2000,
};
if (adjust != 0) {
u32 interval = lbRTC_IntervalTime(&common_data.time.rtcTime, &base);
interval = interval / (lbRTC_HOURS_PER_DAY * lbRTC_MINUTES_PER_HOUR) + (lbRTC_WEEK - 1);
common_data.time.rtcTime.weekday = interval % lbRTC_WEEK;
}
}
typedef void (*SelectMoveTimeProc)(s32);
void select_move_time_set(Game_Select* select) {
if (chkTrigger(A_BUTTON) || chkTrigger(START_BUTTON)) {
select->status = 1;
if (common_data.time.rtcEnabled == TRUE) {
lbRTC_SetTime(&common_data.time.rtcTime);
}
} else if (chkTrigger(L_JPAD)) {
if (select->cursorX == 0) {
select->cursorX = 4;
} else {
select->cursorX--;
}
} else if (chkTrigger(R_JPAD)) {
select->cursorX = (select->cursorX + 1) % 5;
} else {
int adjust = 0;
if (chkButton(D_JPAD)) {
if (chkTrigger(D_JPAD)) {
select->buttonStep = -16;
adjust = -1;
}
select->buttonStep++;
if (select->buttonStep == 6) {
select->buttonStep = 0;
adjust = -1;
}
}
if (chkButton(U_JPAD)) {
if (chkTrigger(U_JPAD)) {
select->buttonStep = 16;
adjust = 1;
}
select->buttonStep--;
if (select->buttonStep == -6) {
select->buttonStep = 0;
adjust = 1;
}
}
if (chkButton(B_BUTTON)) {
adjust *= 10;
}
{
static SelectMoveTimeProc process[5] = {
&select_move_time_year_set, &select_move_time_month_set, &select_move_time_day_set,
&select_move_time_hour_set, &select_move_time_min_set,
};
int i;
for (i = 0; i < 5; i++) {
if (i == select->cursorX) {
(*process[i])(adjust);
select_move_time_week_set(adjust);
}
}
if (adjust != 0 && common_data.time.rtcEnabled == TRUE) {
lbRTC_SetTime(&common_data.time.rtcTime);
}
}
}
}
void select_move_cloth_sel(Game_Select* select) {
if (chkTrigger(A_BUTTON) || chkTrigger(START_BUTTON)) {
select->status = 1;
} else {
int cloth = common_data.privateInfo->cloth.item - 0x2401; // shouldn't this be CLOTH000?
int adjust = (chkButton(B_BUTTON)) ? 10 : 1;
if (chkButton(D_JPAD)) {
if (chkTrigger(D_JPAD)) {
select->buttonStep = -16;
cloth += adjust;
}
select->buttonStep++;
if (select->buttonStep == 6) {
select->buttonStep = 0;
cloth += adjust;
}
}
if (chkButton(U_JPAD)) {
if (chkTrigger(U_JPAD)) {
select->buttonStep = 16;
cloth -= adjust;
}
select->buttonStep--;
if (select->buttonStep == -6) {
select->buttonStep = 0;
cloth -= adjust;
}
}
while (cloth < 0) {
cloth += 255;
}
while (cloth > 255 - 1) {
cloth -= 255;
}
common_data.privateInfo->cloth.item = 0x2401 + cloth;
}
}
typedef void (*SelectMoveProc)(Game_Select*);
void select_move(Game_Select* select) {
static SelectMoveProc process[] = {
&select_move_main,
&select_move_setup,
&select_move_time_set,
&select_move_cloth_sel,
};
if (common_data.sceneFromTitleDemo >= 0) {
select_pass(select);
} else {
(*process[select->status])(select);
}
}
void select_print_wait(gfxprint* gfxprint) {
static const char* msgs[12] = {
GFXPRINT_HIRAGANA_MODE "シバラクオマチクダサイ", /* (しばらくお待ち下さい) "Please wait for a bit" */
GFXPRINT_HIRAGANA_MODE "チョット マッテネ", /* (ちょっと 待ってね) "Wait a minute" */
GFXPRINT_KATAKANA_MODE "ウェイト ア モーメント", /* "Wait a moment" */
GFXPRINT_KATAKANA_MODE "ロード" GFXPRINT_HIRAGANA_MODE "チュウ", /* (ロード中) "Loading" */
GFXPRINT_HIRAGANA_MODE "ナウ ワーキング", /* "Now working" */
GFXPRINT_HIRAGANA_MODE "イマ ツクッテマス", /* (今つくってます) "Now making" */
GFXPRINT_HIRAGANA_MODE "コショウジャナイヨ", /* (故障じゃないよ) "It's not faulty" */
GFXPRINT_KATAKANA_MODE "コーヒー ブレイク", /* "coffee break" */
GFXPRINT_KATAKANA_MODE "Bメンヲセットシテクダサイ", /* (Bメンヲ セットしてください) "Please set the B menu" */
GFXPRINT_HIRAGANA_MODE "ジット" GFXPRINT_KATAKANA_MODE "ガマン" GFXPRINT_HIRAGANA_MODE "ノ" GFXPRINT_KATAKANA_MODE
"コ" GFXPRINT_HIRAGANA_MODE "デアッタ", /* (ジっと我慢のこであった) "I am patient" */
GFXPRINT_HIRAGANA_MODE "イマシバラクオマチクダサイ", /* (今しばらくお待ちください) "Please wait a moment now" */
GFXPRINT_HIRAGANA_MODE "アワテナイアワテナイ。ヒトヤスミヒトヤスミ。", /* (あわてないあわてない。 ひとやすみひとやすみ。) "Don't rush,
don't rush. Take a break, take a break." */
};
s32 msg;
gfxprint_locate8x8(gfxprint, 10, 15);
gfxprint_color(gfxprint, 255, 255, 255, 255);
msg = RANDOM(12.0f);
gfxprint_printf(gfxprint, "%s", msgs[msg]);
}
void select_print_course_name(Game_Select* select, gfxprint* gfxprint) {
const char* name;
s32 i;
s32 course;
gfxprint_color(gfxprint, 255, 155, 150, 255);
gfxprint_locate8x8(gfxprint, 12, 2);
gfxprint_printf(gfxprint, "FOREST MAP SELECT");
gfxprint_color(gfxprint, 255, 255, 255, 255);
for (i = 0; i < 15; i++) {
gfxprint_locate8x8(gfxprint, 5, i + 4);
course = (select->topScene + i + 35) % 35;
if (course == select->selectedScene) {
if (select->status != 0) {
gfxprint_color(gfxprint, 255, 120, 120, 255);
} else {
gfxprint_color(gfxprint, 255, 20, 20, 255);
}
} else {
gfxprint_color(gfxprint, 200, 200, 55, 255);
}
name = nf_tbl[course].name;
if (name == NULL) {
name = "**Null**";
}
gfxprint_printf(gfxprint, "%s", name);
}
}
void select_print_rtc(gfxprint* gfxprint, UNUSED Game_Select* select) {
gfxprint_locate8x8(gfxprint, 23, 6);
gfxprint_printf(gfxprint, "RTC Z:USE");
}
void select_print_time_sub(gfxprint* gfxprint, Game_Select* select, lbRTC_time_c* time) {
const char* weekday_name;
gfxprint_locate8x8(gfxprint, 23, 7);
gfxprint_printf(gfxprint, "%04d/%02d/%02d", time->year, time->month, time->day);
gfxprint_locate8x8(gfxprint, 33, 7);
switch (time->weekday) {
case lbRTC_SUNDAY:
weekday_name = "SUN";
break;
case lbRTC_MONDAY:
weekday_name = "MON";
break;
case lbRTC_TUESDAY:
weekday_name = "TUE";
break;
case lbRTC_WEDNESDAY:
weekday_name = "WED";
break;
case lbRTC_THURSDAY:
weekday_name = "THU";
break;
case lbRTC_FRIDAY:
weekday_name = "FRI";
break;
case lbRTC_SATURDAY:
weekday_name = "SAT";
break;
default:
weekday_name = "---";
break;
}
gfxprint_printf(gfxprint, "<%s>", weekday_name);
gfxprint_locate8x8(gfxprint, 28, 8);
gfxprint_printf(gfxprint, "%02d:%02d", time->hour, time->min);
if (select->status == 2) {
gfxprint_color(gfxprint, 255, 180, 180, 255);
switch (select->cursorX) {
case 0: {
gfxprint_locate8x8(gfxprint, 23, 7);
gfxprint_printf(gfxprint, "%04d", time->year);
break;
}
case 1: {
gfxprint_locate8x8(gfxprint, 28, 7);
gfxprint_printf(gfxprint, "%02d", time->month);
break;
}
case 2: {
gfxprint_locate8x8(gfxprint, 31, 7);
gfxprint_printf(gfxprint, "%02d", time->day);
break;
}
case 3: {
gfxprint_locate8x8(gfxprint, 28, 8);
gfxprint_printf(gfxprint, "%02d", time->hour);
break;
}
case 4: {
gfxprint_locate8x8(gfxprint, 31, 8);
gfxprint_printf(gfxprint, "%02d", time->min);
break;
}
}
}
}
void select_print_time(gfxprint* gfxprint, Game_Select* select) {
lbRTC_time_c time;
lbRTC_GetTime(&time);
select_print_time_sub(gfxprint, select, &time);
}
void select_print_step_sub2(gfxprint* gfxprint) {
gfxprint_locate8x8(gfxprint, 23, 9);
gfxprint_printf(gfxprint, GFXPRINT_KATAKANA_MODE "ステップ :**m**s");
}
void select_print_step(gfxprint* gfxprint, UNUSED Game_Select* select) {
select_print_step_sub2(gfxprint);
}
void select_print_weather(gfxprint* gfxprint, UNUSED Game_Select* select) {
static const char* Weather_type[] = {
GFXPRINT_HIRAGANA_MODE "ハレ", // 晴れ (clear/fine)
GFXPRINT_HIRAGANA_MODE "アメ", // 雨 (rain)
GFXPRINT_HIRAGANA_MODE "ユキ", // 雪 (snow)
GFXPRINT_HIRAGANA_MODE "サクラ", // 桜 (cherry blossoms)
GFXPRINT_HIRAGANA_MODE "ランダム" // "random" (should be leaves seen in K.K. Slider demo)
};
gfxprint_locate8x8(gfxprint, 23, 10);
gfxprint_printf(gfxprint, GFXPRINT_HIRAGANA_MODE "テンキ :%s", Weather_type[common_data.weather]);
}
void select_print_sex(gfxprint* gfxprint, UNUSED Game_Select* select) {
static const char* Distinction[mPr_SEX_NUM] = {
GFXPRINT_HIRAGANA_MODE "オトコノコ", // 男の子 (boy)
GFXPRINT_HIRAGANA_MODE "オンナノコ" // 女の子 (girl)
};
gfxprint_locate8x8(gfxprint, 23, 11);
gfxprint_printf(gfxprint, "セイベツ :%s", Distinction[common_data.privateInfo->gender]);
}
void select_print_cloth(gfxprint* gfxprint, Game_Select* select) {
gfxprint_locate8x8(gfxprint, 23, 15);
if (select->status == 3) {
gfxprint_color(gfxprint, 255, 180, 180, 255);
}
gfxprint_printf(gfxprint, "フク :%03d", common_data.privateInfo->cloth.item - 0x2400);
}
void select_print_swell(gfxprint* gfxprint, UNUSED Game_Select* select) {
s32 swell = common_data.beeStingFlag;
gfxprint_locate8x8(gfxprint, 23, 13);
if (swell == FALSE) {
gfxprint_printf(gfxprint, "ムシササレ :イタクナイ"); // 虫刺され: 痛くない (sting: painless)
} else {
gfxprint_printf(gfxprint, "ムシササレ :イタソウ"); // 虫刺され: 痛そう (sting: painful)
}
}
void select_print_decoy(gfxprint* gfxprint, UNUSED Game_Select* select) {
s32 decoy = common_data.playerDecoyFlag;
gfxprint_locate8x8(gfxprint, 23, 14);
if (decoy == FALSE) {
gfxprint_printf(gfxprint, "データ :モノホン"); // (data: genuine)
} else {
gfxprint_printf(gfxprint, "データ :カゲムシャ"); // (data: double) [double meaning body double/puppet master]
}
}
void select_print_face_type(gfxprint* gfxprint, UNUSED Game_Select* select) {
static const char* Distinction[] = { GFXPRINT_HIRAGANA_MODE "タイプ1", GFXPRINT_HIRAGANA_MODE "タイプ2",
GFXPRINT_HIRAGANA_MODE "タイプ3", GFXPRINT_HIRAGANA_MODE "タイプ4",
GFXPRINT_HIRAGANA_MODE "タイプ5", GFXPRINT_HIRAGANA_MODE "タイプ6",
GFXPRINT_HIRAGANA_MODE "タイプ7", GFXPRINT_HIRAGANA_MODE "タイプ8" };
gfxprint_locate8x8(gfxprint, 23, 12);
gfxprint_printf(gfxprint, "カオ :%s", Distinction[common_data.privateInfo->face]);
}
void select_print_event(gfxprint* gfxprint, UNUSED Game_Select* select) {
static const char* event_kind[] = {
GFXPRINT_KATAKANA_MODE "---",
GFXPRINT_KATAKANA_MODE "ザッカヤ", // (雑貨屋) (general store/shop)
GFXPRINT_KATAKANA_MODE "デザイナ-", // designer
GFXPRINT_KATAKANA_MODE "ブロ-カ-", // broker
GFXPRINT_KATAKANA_MODE "ガハク", // (画伯) artist
GFXPRINT_KATAKANA_MODE "ジュウタン", // (絨毯) carpet
GFXPRINT_KATAKANA_MODE "クロヒョウ" // (黒豹) black panther
};
gfxprint_locate8x8(gfxprint, 23, 16);
gfxprint_printf(gfxprint, GFXPRINT_KATAKANA_MODE "イベント :%s", event_kind[0]);
}
typedef void (*SelectPrintProc)(gfxprint*, Game_Select*);
void select_draw_main(Game_Select* select) {
static SelectPrintProc print_process[] = {
&select_print_rtc, &select_print_time, &select_print_step, &select_print_weather, &select_print_sex,
&select_print_face_type, &select_print_swell, &select_print_decoy, &select_print_cloth, &select_print_event,
};
GraphicsContext* graph = select->state.gfxCtx;
s32 i;
OPEN_DISPS(graph);
gSPSegment(POLY_OPA_DISP++, 0, 0);
DisplayList_initialize(graph, 0, 0, 0, NULL);
SET_FULLSCREEN_VIEWPORT(&select->view);
showView(&select->view, 15);
rect_moji(graph);
{
gfxprint* gfxprint_p;
gfxprint_p = alloca(sizeof(gfxprint));
gfxprint_init(gfxprint_p);
gfxprint_open(gfxprint_p, POLY_OPA_DISP);
select_print_course_name(select, gfxprint_p);
gfxprint_color(gfxprint_p, 200, 200, 55, 255);
gfxprint_locate8x8(gfxprint_p, 26, 4);
gfxprint_printf(gfxprint_p, GFXPRINT_HIRAGANA_MODE "-セッテイ-"); // -settings-
for (i = 0; i < 10; i++) {
if (select->cursorY == i) {
if (select->status == 0) {
gfxprint_color(gfxprint_p, 180, 180, 255, 255);
} else {
gfxprint_color(gfxprint_p, 120, 120, 255, 255);
}
} else {
gfxprint_color(gfxprint_p, 255, 255, 55, 255);
}
(*print_process[i])(gfxprint_p, select);
}
POLY_OPA_DISP = (gfxprint_close(gfxprint_p));
gfxprint_cleanup(gfxprint_p);
}
CLOSE_DISPS(graph);
}
void select_draw_wait(Game_Select* select) {
GraphicsContext* graph = select->state.gfxCtx;
gfxprint* gfxprint_p;
OPEN_DISPS(graph);
gSPSegment(POLY_OPA_DISP++, 0, 0);
DisplayList_initialize(graph, 0, 0, 0, NULL);
SET_FULLSCREEN_VIEWPORT(&select->view);
showView(&select->view, 15);
rect_moji(graph);
{
gfxprint_p = alloca(sizeof(gfxprint));
gfxprint_init(gfxprint_p);
gfxprint_open(gfxprint_p, POLY_OPA_DISP);
select_print_wait(gfxprint_p);
POLY_OPA_DISP = (gfxprint_close(gfxprint_p));
gfxprint_cleanup(gfxprint_p);
}
CLOSE_DISPS(graph);
}
void select_draw(Game_Select* select) {
GraphicsContext* graph = select->state.gfxCtx;
OPEN_DISPS(graph);
gSPSegment(POLY_OPA_DISP++, 0, 0);
DisplayList_initialize(graph, 0, 0, 0, NULL);
CLOSE_DISPS(graph);
SET_FULLSCREEN_VIEWPORT(&select->view);
showView(&select->view, 15);
if (select->state.running == FALSE) {
select_draw_wait(select);
} else {
select_draw_main(select);
}
}
void select_main(Game* game) {
Game_Select* select = (Game_Select*)game;
select_move(select);
select_draw(select);
{
GraphicsContext* graph = game->gfxCtx;
game_debug_draw_last(game, graph);
game_draw_last(graph);
}
}
void select_cleanup(UNUSED Game* game) {
}
void select_init(Game* game) {
Game_Select* select = (Game_Select*)game;
s32 i;
game->main = &select_main;
game->destroy = &select_cleanup;
select->status = 0;
select->cursorY = 9;
select->step = 0;
select->stepAdd = 0;
select->topScene = 0;
select->selectedScene = 0;
initView(&select->view, game->gfxCtx);
select->view.flag = 10;
select->unk_234 = 0;
select->unk_238 = 0;
select->unk_23C = 0;
for (i = 0; i < PLAYER_NAME_LEN; i++) {
select->name[i] = fcode2data(common_data.privateInfo->playerId.playerName[i]);
}
if ((DORO(80) >= 0) && (DORO(80) < 0x23)) {
select->selectedScene = DORO(80);
select->topScene = DORO(81);
}
SetGameFrame(1);
common_data.unk_10004 = common_data.save.sceneNo;
common_data.unk_104AD = 0;
common_data.privateInfo->inventory.loan = 1000;
mNpc_ClearEventNpc();
}
|