-
Notifications
You must be signed in to change notification settings - Fork 1
/
doax3-xp-grin-v0.6.gpc
871 lines (713 loc) · 29.1 KB
/
doax3-xp-grin-v0.6.gpc
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
/*
____ ___ _ __ _______
| _ \ / _ \ / \ \ \/ /___ /
| | | | | | |/ _ \ \ / |_ \
| |_| | |_| / ___ \ / \ ___) |
|____/ \___/_/ \_\/_/\_\____/
____ _ __ ______
/ ___|_ __(_)_ __ \ \/ / _ \
| | _| '__| | '_ \ \ /| |_) |
| |_| | | | | | | | / \| __/
\____|_| |_|_| |_| /_/\_\_| V0.6
___________________________________________________________________________
Licence : MIT
Author : jinkou
Credits : Huge thanks to contributors: Zaykho; Morganite
Total byte size: 2566 bytes (62.65%)
/*-------------------------*/
/* Quick start */
/*--------------------------/----------------------------------------------
1) Important : Make sure the gifts inventories of your selected characters
---------- are empty.
2) Before starting the script, just change the character/swimsuit/Ticket
in the config paragraph below (§Config)
3) Start the script :
a) with Triangle if you are at the beginning of the game.
(Screen "Press a button")
You can Pause/Play the script too with triangle.
b) with R2 if you are at the beginning of the day.
4) Stop the script with R1.
If the script broke, manually move the game to the beginning of the next day
and press R2 to restart it. (don't forget to clear zack's gift).
Note: You may have to resynchronise the day number by pressing several L1
(look at TRACE_4 which displays the day number)
5) Normal Ending of script: Led is BLUE and the ending screen is
Character's excitement screen (with maybe notifications).
Otherwise : look at Troubleshooting.
Color Led:
----------
- BLUE : Script is Stopped
Only L1/Triangle/R2 are possible
- GREEN : Script is Playing
R1 to stop and Triangle to pause.
Troubleshooting:
----------------
Script doing wrong things:
--------------------------
- If you find the script sitting in the closet, it's because you didn't
clear the gift inventory before you started.
- If you find your girl at the pool doing relax movie, it's because you
didn't synchronise the day number. you are at day 1 in the script.
Look below to increment the day number
Logging and tracing:
--------------------
- TRACE_1 displays the index of the step inside §DataSet (PS4_CIRCLE, 20)
- TRACE_3 displays the state where the script is.
Look at §State_Definition for the matching state
- TRACE_4 displays the day number. If the script is stuck or if something
goes wrong, stop the script, manually move the game to the next day
then adjust the day number inside TRACE_4 by pressing L1.
- Press R3 to test a whole State or a combo
- if you want to test a whole state, write this where needed
if (State == S_Debug) run_State(COMBO_TORUN, 0, NEXT_STATE_TOGO);
- if you want to test just a combo just do this
if (State == S_Debug) run_State(COMBO_TOTEST, 0, S_IDLE);
/*----------------------------------------------------------------------------*/
/*-----------------------*/
/* Backlog */
/*------------------------/-------------------------------------------------
V0.6 New Feature:
- Characters to level up are selectable
Now you can tell which characters to level up and the script will
loop from every characters at each vacation.
Important : Make sure the gifts inventories of your selected
----------- characters are empty.
A new parameter for optionnal S+ Movie is in config. Set it to TRUE
if you think your girl will end with this movie. Personnally i never
got it since this script never take a partner. So i let it to False.
The Pause feature has been removed to get some bytes. I never used it.
v 0.5.1 Huge boost in time thanks to Zaykho
v 0.5 New Feature: Buy any item in the owner shop.
v0.4.2 Time adjustment at beginning, and at clearing notifications.
v0.4.1 You can choose a different wrapping paper for each vacations.
v0.4 New Feature: Paper Wrapping: you can select paper wrapping color.
v0.3.1 fine tuning time inside menu, 5xFaster
v0.3 You can buy swimsuits/ticket
v0.1 First version
---------------------------------------------------------------------------*/
/*-----------------------*/
/* Variable used */
/*------------------------/-------------------------------------------------
+---------+-----------------+
| TRACE | Used For |
+---------+-----------------+
| TRACE_1 | combo step |
| TRACE_2 | Vacation number |
| TRACE_3 | State |
| TRACE_4 | Num Day |
| TRACE_5 | Free for debug |
| TRACE_6 | Free for debug |
+---------+-----------------+
---------------------------------------------------------------------------*/
/*-----------------------*/
/* Characters */
/*-----------------------*/
define Kasumi = 0;
define Momiji = 2;
define Hitomi = 4;
define Helena = 6;
define MarieRose = 8;
define Ayane = 12;
define Kokoro = 14;
define NyoTengu = 16;
define Honoka = 18;
// Paper wrapping
define paper_Silver = 0;
define paper_Kasumi = 1;
define paper_Honoka = 2;
define paper_MarieRose = 3;
define paper_Ayane = 4;
define paper_NyoTengu = 5;
define paper_Kokoro = 6;
define paper_Hitomi = 7;
define paper_Momiji = 8;
define paper_Helena = 9;
define paper_Premium = 10;
/*-------------------------*/
/* List of Items */
/*-------------------------*/
// tab 0
define MummyA = 2;
define MummyI = -6;
define PeaceD = 8;
define PeaceH = 6;
define AsariA = -7;
define AsariI = -15;
define EelE = 18;
define DecupleI = 21;
define SandwichA = -16;
define SandwichI = -24;
// tab 1
define Sidecar = 2;
//tab2
define Dangerous = 0;
define Tempting = 1;
define Forbidden = 2;
define Secret = -1;
define MoebieusSlow = 3;
define HardGelEx = -6;
define All = 255;
/*------------------------------------*/
/* Configuration (§Config) */
/*-------------------------------------/-----------------------------*/
// number of Vacation to loop
// --------------------------
define Nb_Vacations = 25;
// will try to buy at every X vacations
// You can switch off buying if you put a greater value than Nb_Vacation (50).
define Buy_At_X = 2;
// Characters to Level up
// ----------------------
// Select one or several Characters to level up,
// comment / uncomment the characters you want
// Important : Make sure the gifts inventories of your
// ---------- selected characters are empty.
int CharacterToPlay // Don't touch this one
int Character0 = Kasumi;
//int Character1 = Momiji;
//int Character2 = Hitomi;
int Character3 = Helena;
//int Character4 = MarieRose;
//int Character5 = Honoka;
//int Character6 = NyoTengu;
int Character7 = Kokoro;
int Character8 = Ayane;
int EndOfChars = 255 // Don't touch this one
// Items you want to collect
// -------------------------
// It's a range like
// [MummyA, ...., MummyH] for Helena
// [Ticket1 ...Ticket3] for All
// [Pose ticket] for honoka
// Possible values are pre-define Values (see above: list of item)
// or negative/positive numbers (see example below)
int Items;// dont' touch this one.
// comment/uncomment / modify / add what you want
// take all Asari in silver
//int Tab0 = 0, FromRow0 = AsariaA, ToRow0 = AsariI, Paper0 = paper_Silver;
// only one for Helena
//int Tab1 = 0, FromRow1 = MummyA, ToRow1 = MummyI, Paper1 = paper_Helena;
// a range of tickets
//int Tab3 = 2, FromRow3 = Dangerous, ToRow3 = Tempting, Paper3 = paper_Honoka;
// anything at tab 1 from 7 to 18 to all,for instance godfather...
//int Tab4 = 1, FromRow4 = 7, ToRow4 = 18, Paper4 = All;
//other items like pose tickets
//int Tab5 = 2, FromRow5 = -3, ToRow5 = 3, Paper_5 = paper_Hitomi;
//int Tab5 = 2, FromRow5 = -3, ToRow5 = 3, Paper_5 = All;
// perso
//int Tab0 = 0, FromRow0 = -13, ToRow0 = AsariI, Paper0 = paper_Silver;
int Tab1 = 0, FromRow1 = SandwichA, ToRow1 = SandwichI, Paper1 = paper_Silver;
int EndofItems = 255;// dont' touch this one.
int optionalSMovie = FALSE; // put it to TRUE if you suspect that your
// character will end in S+ optionnal movie.
// FIXME: Is it really needed ?
/*------------- End of configuration ---------------------------------------------*/
/*-----------------------*/
/* Definition */
/*-----------------------*/
define Nb_Events = 3; // Morning, Afternoon, Evening
define Nb_Days = 14;
define Nb_Notifs = 20;
/*---------------------------------------*/
/* States (§State_Definition) */
/*---------------------------------------*/
define S_Play_Combo = 1;
define S_Start_Intro = 10;
define S_Select_Char = 11;
define S_Start_Vacation = 12;
define S_End_Vacation = 13;
define S_Return_Title = 14;
define S_Exit_Mission = 15;
define S_Start_Day = 20;
define S_End_Day = 21;
define S_Start_Stage = 22;
define S_Start_RockPlay = 23;
define S_Hotel = 24;
define S_Throw_Gift = 25;
define S_Go_Bed = 26;
define S_Owner_Shop = 27;
define S_Select_Item = 28;
define S_Buy_Item = 29;
define S_Select_Tab = 30;
define S_Select_Paper = 34;
define S_Wrap = 35;
define S_Exit_Shop = 36;
define S_Clear_Event = 50;
define S_Clear_Vacation = 51;
define S_S_Movie = 52;
define S_Clear_Movie = 53;
define S_Start_Game = 80;
define S_End_Game = 81;
define S_Debug = 90;
define S_IDLE = 100;
// indices used for the data structure
// -----------------------------------
define cb_intro = 1;
define cb_left_char = 5;
define cb_right_char = 10;
define cb_start_vacation = 15;
define cb_quit_mission = 21;
define cb_select_rock_stage = 25;
define cb_abort_rock_play = 30;
define cb_hotel = 35;
define cb_throw_gift = 40;
define cb_owner_shop = 42;
define cb_buy_item = 44;
define cb_paper = 45;
define cb_go_bed = 47;
define cb_end_vacation = 50;
define cb_return_title = 55;
// End Flags. 254 and 255 should never be used in the
// data segment for other purposes.
//-----------------------------------------------------
define EOC = 254; // End of combo
define EOD = 255; // End of Data Segment
//-----------------------------------------------------
// LED Colors
// ----------------
define GREEN = 1;
define BLUE = 2;
define RED_BLINK = 3;
//-----------------------------------------------------
/*-----------------------*/
/* Variables */
/*------------------------*/
// State variables
// ---------------
int State = S_IDLE;
int Next_State = S_Start_Game;
int Play = FALSE;
//
// Items Swimsuit and characters
//------------------------------
int index_char;
int Selected_Char;
int index_item = 1;
int Item_Tab;
int CurrentItem;
int ItemToRow;
int ItemPaper;
int stepRow;
// Days and loop vacation
//-----------------------
int NumDay = 1;
int loop_event = Nb_Events; // Morning , Afternoon, Evening
int loop_vacation = 1;
int loop_notif = 1;
int loop_button = 0;
int wait_time; // time used between repeating button
// combo
// -----
int idx_step; // to circulate thru the data structure
int i,v;
int PressButton;
//-----------------------------------------------------
/*--------------------------------------*/
/* Data Structure (§DataSet) */
/*--------------------------------------*/
// EOC represents the end of an event
// 255, or 254 a value reserved, don't use them
// Idx, Button, Wait(x50ms), Event
//---------------------------------------------------------------
// Introduction
data(
cb_intro,
PS4_CIRCLE, 50, // Travel to zack island
PS4_CIRCLE, 100, //
PS4_OPTIONS, 10, // skip intro video
PS4_OPTIONS, 100, //
EOC,
// ...
// Select Character
// Left Side of Marie Rose
cb_left_char,
PS4_LEFT, 1, // Kasumi
PS4_LEFT, 1, // Momiji
PS4_LEFT, 1, // Hitomi
PS4_LEFT, 1, // Helena
PS4_CIRCLE, 150, // Confirm choice
EOC,
// Right Side of Marie Rose
cb_right_char,
PS4_RIGHT, 1, // Ayane
PS4_RIGHT, 1, // Kokoro
PS4_RIGHT, 1, // NyoTengu
PS4_RIGHT, 1, // Honoka
PS4_CIRCLE, 150, // Confirm choice
EOC,
// Start Vacation
cb_start_vacation,
PS4_OPTIONS, 20, // skip character intro
PS4_OPTIONS, 240, // skip character intro
PS4_OPTIONS, 50, // wait longer
PS4_LEFT, 5, // don't take a partner // TODO : Will try with a partner
PS4_CIRCLE, 240, //
EOC,
cb_quit_mission,
PS4_LEFT, 1, // from Rock stage
PS4_LEFT, 1, // offset from day 1
PS4_LEFT, 1, //
PS4_CIRCLE, 50, // Select Pool
PS4_TOUCH, 10, // Owner mode
PS4_UP, 2, // Select mission
PS4_UP, 2,
PS4_CIRCLE, 50, // Kill ?
PS4_RIGHT, 10, // Yes
PS4_CIRCLE, 50,
PS4_TOUCH, 2, // exit Owner mode
PS4_CROSS, 50, // exit menu
PS4_LEFT, 1, // Go to Rock Stage
PS4_LEFT, 1, //
PS4_LEFT, 1, //
EOC,
// One Day event
cb_select_rock_stage,
PS4_CIRCLE, 30, // greetings
PS4_LEFT, 1, // Go to Rock Stage
PS4_LEFT, 1, //
PS4_LEFT, 1, //
EOC,
cb_abort_rock_play,
PS4_CIRCLE, 15, // Select Rock Stage
PS4_DOWN, 1, //
PS4_CIRCLE, 80, // Select Rock Game
PS4_OPTIONS, 1, // Abort Mission
PS4_UP, 1, //
PS4_CIRCLE, 1, //
PS4_LEFT, 1, //
PS4_CIRCLE, 150, // Mission Aborted
EOC,
cb_hotel,
PS4_CIRCLE, 60, // End Of Day
PS4_SQUARE, 50, // End Of Dialogue
PS4_SQUARE, 50, // Start of Zack Gift
PS4_SQUARE, 150, // clear optional notification
PS4_SQUARE, 100, // it will eventually enter inventory
EOC,
cb_throw_gift,
PS4_SQUARE, 70, // Open girl's closet
PS4_LEFT, 5, //
PS4_LEFT, 2, //
PS4_LEFT, 2, //
PS4_CIRCLE, 10, // select gift
PS4_LEFT, 2, //
PS4_CIRCLE, 5, //
PS4_LEFT, 2, //
PS4_CIRCLE, 5, // throw gift away
PS4_CROSS, 50, // exit girl's closet
EOC,
// Buy swimsuit / Ticket
cb_owner_shop,
PS4_CIRCLE, 60, // End Of Day
PS4_SQUARE, 50, // End Of Dialogue
PS4_SQUARE, 100, // Start of Zack Gift
PS4_SQUARE, 150, // clear optional notification
PS4_SQUARE, 120, // it will eventually enter inventory
PS4_CROSS, 100, // exit inventory
PS4_TRIANGLE, 70, // Enter Owner shop
EOC,
cb_buy_item,
PS4_CIRCLE, 10, // buy
EOC,
cb_paper,
PS4_CIRCLE, 10, // Paper select
PS4_CIRCLE, 10, //
PS4_CIRCLE, 10, // yes / no ?
PS4_SQUARE, 10, // easy clear notif
PS4_SQUARE, 10, // not enough ? or ok
PS4_CROSS, 10, // cancel
PS4_CROSS, 15, // exit
PS4_CROSS, 50, // exit
PS4_TOUCH, 50, // exit Owner mode
EOC,
// Bed Time
cb_go_bed,
PS4_DOWN, 1, // Start go to bed
PS4_DOWN, 1, //
PS4_CIRCLE, 200, // waiting for end of girl's speach
PS4_CIRCLE, 200, // go to new morning
EOC,
// End Vacation
cb_end_vacation,
PS4_CIRCLE, 50, //
PS4_OPTIONS, 20, //
PS4_OPTIONS, 100, //
PS4_CIRCLE, 50, //
EOC,
cb_return_title,
PS4_CIRCLE, 250, // return to title
EOC,
// End of Data
EOD
); // end of combo2
//-----------------------------------------------------
/*----------------------------*/
/* Main and Init */
/*----------------------------*/
init {
SwitchLED(BLUE);
Item_Tab = Items[1];
CurrentItem = Items[2];
ItemToRow = Items[3];
if (Items[4]== All) ItemPaper = 1;
else ItemPaper = Items[4];
index_char = 0; // StartGame() will ++ it
}
main {
// Set script commands
//---------------------
//Press Triangle to pause/play the script.
if(event_press(PS4_TRIANGLE)) {
Play = !Play;
SwitchLED(GREEN);
State = Next_State; //Start or restart where we were.
}
// Press R1 to Stop the script
if(event_press(PS4_R1)) {
State = S_IDLE;
Next_State = S_Start_Game; // restart game
Play = FALSE;
if (combo_running(cb_Send_Input)) combo_stop (cb_Send_Input);
SwitchLED(BLUE);
}
// If the script is stopped,
if (State == S_IDLE) {
set_val(TRACE_3,State); // Look at the state definition to know where the automata is stuck
// pressing R2
// will restart it at the beginning of the day
if (event_press(PS4_R2)) {
loop_event = Nb_Events; // correction from Morganite
Play = TRUE;
State = S_Start_Day;
SwitchLED(GREEN);
}
// Press L2
// for debug test . Use it if you want to test a specific combo
if (event_press(PS4_L2)) DebugCombo (cb_end_vacation, 0); // test a combe
// R3 to test a whole State
if (event_press(PS4_R3)) {Play = TRUE;State = S_Debug;} // test a whole state
// L1 to adjust the numday (look at TRACE_4)
if (event_press(PS4_L1)) {
NumDay = NumDay % 15 + 1 ;// adjust the numDay if script is stopped
set_val(TRACE_4,NumDay); // Trace 4 will display the # day
}
/* if (event_press(PS4_UP)) {
loop_vacation = loop_vacation % Nb_Vacations + 1 ;
set_val(TRACE_2,loop_vacation);
}
*/
}
// Main Loop of the State automata
// -------------------------------
if (Play) {
// intro States
if (State == S_Start_Game) State = StartGame();
if (State == S_Start_Intro) run_State(cb_intro, 0, S_Select_Char);
if (State == S_Select_Char) run_State(cb_left_char, Selected_Char, S_Start_Vacation);
if (State == S_Start_Vacation) run_State(cb_start_vacation, 0, S_Exit_Mission);
// Day States
if (State == S_Exit_Mission) {
if (NumDay == 1 && loop_event == 2) run_State(cb_quit_mission,2,S_Start_RockPlay);
else run_State(cb_quit_mission,0,S_Start_RockPlay);
}
if (State == S_Start_Day) run_State(cb_select_rock_stage, 0, S_Start_RockPlay);
if (State == S_Start_RockPlay)
{
loop_event = loop_event - 1;
if (NumDay==1){
if (loop_event != 0) run_State(cb_abort_rock_play, 0, S_Exit_Mission);
if (loop_event == 0) {loop_event = Nb_Events; run_State(cb_abort_rock_play, 0, S_Hotel);}
}
else {
if (loop_event == 2) run_State(cb_abort_rock_play, 0, S_Start_RockPlay);
if (loop_event == 1) run_State(cb_abort_rock_play, 0, S_Exit_Mission);
if (loop_event == 0) {loop_event = Nb_Events; run_State(cb_abort_rock_play, 0, S_Hotel);}
}
}
//if (State == S_Clear_Event) Repeat_ThenGoto(PS4_SQUARE,Nb_Notifs, S_Hotel);
// At the Hotel
if (State == S_Hotel) {
if ((NumDay == 1) && !(loop_vacation % Buy_At_X)) State = S_Owner_Shop;
else run_State(cb_hotel, 0, S_Throw_Gift);
}
// Shopping Items at X vacations
if (State == S_Owner_Shop) run_State(cb_owner_shop, 0, S_Select_Tab);
if (State == S_Debug) run_State(cb_owner_shop, 12, S_Select_Tab); //uncomment this to test items to buy
if (State == S_Select_Tab) Repeat_ThenGoto(PS4_RIGHT, Item_Tab, 2, S_Select_Item);
if (State == S_Select_Item) select_Item_ThenGoto(S_Buy_Item);
if (State == S_Buy_Item) run_State(cb_buy_item, 0, S_Select_Paper);
if (State == S_Select_Paper) Repeat_ThenGoto(PS4_RIGHT, ItemPaper, 2, S_Wrap);
if (State == S_Wrap) run_State(cb_paper, 0, S_Exit_Shop);
if (State == S_Exit_Shop) exit_Shop_ThenGoto(S_Throw_Gift); //comment this to test items to buy
//if (State == S_Exit_Shop) exit_Shop_ThenGoto(S_Debug); // uncomment this to test items to buy
// End of hotel
if (State == S_Throw_Gift) run_State(cb_throw_gift, 0, S_Go_Bed);
if (State == S_Go_Bed) run_State(cb_go_bed, 0, S_End_Day);
if (State == S_End_Day) State = EndDay();
// End Vacation States
if (State == S_Clear_Movie) Repeat_ThenGoto(PS4_SQUARE,Nb_Notifs, 4, S_S_Movie); // FIXME : really needed ?
if (State == S_S_Movie) run_State(cb_end_vacation, 0, S_End_Vacation);
if (State == S_End_Vacation) {
loop_vacation = loop_vacation + 1;
set_val(TRACE_2,loop_vacation);
if (loop_vacation < Nb_Vacations) run_State(cb_end_vacation, 0, S_Clear_Vacation);
else run_State(cb_end_vacation, 0, S_End_Game);
}
if (State == S_Clear_Vacation) Repeat_ThenGoto(PS4_CIRCLE,Nb_Notifs, 4, S_Return_Title);
if (State == S_Return_Title) run_State(cb_return_title, 0, S_Start_Game);
// End of vacation loop
if (State == S_End_Game) {
loop_vacation = 1;
NumDay = 1;
Play = FALSE;
State = S_IDLE;
SwitchLED(BLUE);
}
//-----------------------------------------------------------------------------------
// State called by each states with the function runState
if (State == S_Play_Combo)
{ // combo playing
// Execute the combo step-by-step
if(!combo_running(cb_Send_Input)){
set_val(TRACE_1,idx_step);
if (dbyte(idx_step) != EOC) combo_restart(cb_Send_Input);
else State = Next_State;
}
}
} // end of State automata
}
/*-----------------------*/
/* Combos */
/*-----------------------*/
combo cb_Send_Input{
set_val(dbyte(idx_step),100);
wait(100);
set_val(dbyte(idx_step),0);
wait(dbyte(idx_step + 1) * 50);
idx_step = idx_step + 2;
}
combo cb_Repeat_Button{
set_val(PressButton,100);
wait(80);
wait(wait_time);
loop_button = loop_button + 1;
}
/*-----------------------*/
/* Functions */
/*------------------------*/
function SwitchLED(Color){
if (Color==GREEN) {
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1);
}
else if (Color==BLUE){
set_led(LED_1, 1);
set_led(LED_2, 0);
set_led(LED_3, 0);
}
else if (Color==RED_BLINK){
set_led(LED_1, 0);
set_led(LED_2, 1);
set_led(LED_3, 0);
}
return;
}
// Returns the starting index of a combo
function get_combo_index(combo_id) {
i = 0;
while(TRUE) {//-----------------------
v = dbyte(i);
if(v == combo_id) {
return(i + 1);
} else {//====================
while(v != EOC && v != EOD) {//#
i = i + 1;
v = dbyte(i);
}//#
if(v == EOD) break;
else i = i + 1;
}//=============================
}//=============================
return(-1);
}//-----------------------------------
function StartGame(){
loop_event = Nb_Events - 1; // only Afternoon & evening
index_char = index_char + 1;
if (CharacterToPlay[index_char] == EndOfChars) index_char = 1;
Selected_Char = CharacterToPlay[index_char];
return (S_Start_Intro);
}
function EndDay() {
NumDay = NumDay + 1;
set_val(TRACE_4,NumDay); // Trace 4 will display the # day
if (NumDay > Nb_Days) {
NumDay = 1;
if (optionalSMovie == TRUE) return (S_Clear_Movie);
else return (S_End_Vacation);
}
else {
set_val(TRACE_4,NumDay);
return (S_Start_Day);
}
}
function run_State(combo_to_run,offset,next) {
set_val(TRACE_3,State); // Look at the state definition to know where the automata is stuck
idx_step = get_combo_index(combo_to_run) + offset;
State = S_Play_Combo;
Next_State = next;
return;
}
function select_Item_ThenGoto (next){
if (CurrentItem >= 0)PressButton = PS4_UP;
else PressButton = PS4_DOWN;
Repeat_ThenGoto(PressButton, abs(CurrentItem), 2, next);
return;
}
function exit_Shop_ThenGoto(next){
if (Items[index_item + 3] == All) {
if (ItemPaper%10 == 0){
ItemPaper = 1;
next_Item();
}
else ItemPaper = ItemPaper % 10 + 1;
}
else next_Item();
State = next;
return;
}
function next_Item(){
if (abs(CurrentItem - ItemToRow) != 0) {
if (CurrentItem <= ItemToRow) stepRow = 1; // next item is above
else stepRow = -1;
CurrentItem = CurrentItem + stepRow;
}
else {
index_item = index_item + 4;
if (Items[index_item] == EndofItems) index_item = 1;
Item_Tab = Items[index_item];
CurrentItem = Items[index_item + 1];
ItemToRow = Items[index_item + 2];
ItemPaper = Items[index_item + 3];
if (ItemPaper == All) ItemPaper = 1;
else ItemPaper = Items[index_item + 3];
}
return;
}
function Repeat_ThenGoto(button, times, speed, next) {
PressButton = button;
wait_time = speed * 50; // x * 50 ms of waiting
if (abs(loop_button) < times ) {
if (!combo_running(cb_Repeat_Button)) combo_restart (cb_Repeat_Button);
}
else {
loop_button = 0;
State = next;
}
return;
}
function DebugCombo(combo_to_run,offset){
Play = TRUE;
run_State (combo_to_run,offset,S_IDLE);
return;
}