-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdoax3-xp-grin-v0.2.gpc
612 lines (500 loc) · 18.5 KB
/
doax3-xp-grin-v0.2.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
/*
____ ___ _ __ _______
| _ \ / _ \ / \ \ \/ /___ /
| | | | | | |/ _ \ \ / |_ \
| |_| | |_| / ___ \ / \ ___) |
|____/ \___/_/ \_\/_/\_\____/
____ _ __ ______
/ ___|_ __(_)_ __ \ \/ / _ \
| | _| '__| | '_ \ \ /| |_) |
| |_| | | | | | | | / \| __/
\____|_| |_|_| |_| /_/\_\_| V0.2
____________________________________________________________________________
Licence : MIT
Author : jinkou
Total byte size: 1925 bytes (47.00%)
/*-------------------------*/
/* Quick start */
/*--------------------------/----------------------------------------------
1) Before starting the script, just change the character/swimsuit/Ticket
in the config paragraph below (§Config)
2) Important : Make sure the inventory of your selected character is empty.
3) Start the script :
a) with Triangle if you are at the beginning of the game. (Travel to Zack)
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.
Note: You may have to resynchronise the day number by pressing several L1
(look at TRACE_4 which displays the day number)
Color Led:
----------
- BLUE : Script is Stopped
- RED : Script is Paused
- GREEN : Script is Playing
Troubleshooting:
---------
- 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.
- If you want to test a specific set of Data, use the function DebugCombo
and press L2.
- Press R3 to test a whole State
/*-------------------------------------------------------------------------*/
/*-----------------------*/
/* Characters */
/*-----------------------*/
define Kasumi = 0;
define Momiji = 2;
define Hitomi = 4;
define Helena = 6;
define MarieRose = 8;
define Honoka = 12;
define NyoTengu = 14;
define Kokoro = 16;
define Ayane = 18;
/*-------------------------*/
/* Items to collect */
/*-------------------------*/
define Swimsuit = 0;
define Ticket = 1;
/*-------------------------------------*/
/* Configuration (§Config) */
/*-------------------------------------*/
define CharacterToPlay = Hitomi;// select a character to grin XP
define Nb_Vacations = 3; // number of Vacation to loop
define Item_To_Buy = Ticket;// select between Ticket or Swimsuit to buy every 2 / 3 holidays
define Index_Swimsuit = 3; // if swimsuit is selected buy this swimsuit index
define Index_Ticket = 1; // if Ticket is selected , select from 1 to 4 (dangerous, ...)
/*-----------------------*/
/* 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_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_Swimsuit = 28;
define S_Buy_Swimsuit = 29;
define S_Select_Ticket = 30;
define S_Select_Ticket_Tab = 31;
define S_Buy_Ticket = 32;
define S_Clear_Event = 50;
define S_Clear_Vacation = 51;
define S_Start_Game = 80;
define S_End_Game = 81;
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_greeting = 20;
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_swimsuit = 44;
define cb_select_ticket_tab = 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_IDLE;
int Play = FALSE;
// 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 = 1;
// Debug
//------
int debug = FALSE;
// combo
// -----
int idx_step; // to circulate thru the data structure
int i,v;
int PressButton;
//-----------------------------------------------------
/*----------------------------*/
/* Data Structure */
/*----------------------------*/
// EOC represents the end of an event
// Idx, Button, Wait(x50ms), Event
//---------------------------------------------------------------
// Introduction
data(
cb_intro,
PS4_CIRCLE, 80, // 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, 5, // Kasumi
PS4_LEFT, 5, // Momiji
PS4_LEFT, 5, // Hitomi
PS4_LEFT, 5, // Helena
PS4_CIRCLE, 150, // Confirm choice
EOC,
// Right Side of Marie Rose
cb_right_char,
PS4_RIGHT, 5, // Honoka
PS4_RIGHT, 5, // NyoTengu
PS4_RIGHT, 5, // Kokoro
PS4_RIGHT, 5, // Ayane
PS4_CIRCLE, 150, // Confirm choice
EOC,
// Start Vacation
cb_start_vacation,
PS4_OPTIONS, 20, // skip character intro
PS4_OPTIONS, 240, //
PS4_LEFT, 5, // don't take a partner
PS4_CIRCLE, 240, //
PS4_RIGHT, 5, // Go to Rock Stage
EOC,
// One Day event
cb_greeting,
PS4_CIRCLE, 30, // greetings
EOC,
cb_select_rock_stage,
PS4_LEFT, 10, // Go to Rock Stage
PS4_LEFT, 10, //
PS4_LEFT, 10, //
EOC,
cb_abort_rock_play,
PS4_CIRCLE, 15, // Select Rock Stage
PS4_DOWN, 10, //
PS4_CIRCLE, 80, // Select Rock Game
PS4_OPTIONS, 5, // Abort Mission
PS4_UP, 5, //
PS4_CIRCLE, 5, //
PS4_LEFT, 5, //
PS4_CIRCLE, 80, // Mission Aborted
EOC,
cb_hotel,
PS4_CIRCLE, 60, // End Of Day
PS4_CIRCLE, 100, // End Of Dialogue
PS4_CIRCLE, 100, // Start of Zack Gift
EOC,
cb_throw_gift,
PS4_SQUARE, 70, // Open girl's closet
PS4_LEFT, 5, //
PS4_LEFT, 5, //
PS4_LEFT, 5, //
PS4_CIRCLE, 10, // select gift
PS4_LEFT, 5, //
PS4_CIRCLE, 5, //
PS4_LEFT, 5, //
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_CIRCLE, 100, // End Of Dialogue
PS4_CIRCLE, 100, // spam circle for notif
PS4_TRIANGLE, 70, // Enter Owner shop
EOC,
cb_buy_swimsuit,
PS4_CIRCLE, 10, // buy
PS4_CIRCLE, 10, //
PS4_CIRCLE, 10, // Paper select silver
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,
cb_select_ticket_tab,
PS4_RIGHT, 10,
PS4_RIGHT, 10,
PS4_UP, 10,
PS4_UP, 10,
EOC,
// Bed Time
cb_go_bed,
PS4_DOWN, 5, // Start go to bed
PS4_DOWN, 5, //
PS4_CIRCLE, 150, //
PS4_CIRCLE, 120, // go to new morning
EOC,
// End Vacation
cb_end_vacation,
PS4_CIRCLE, 100, //
PS4_OPTIONS, 50, //
PS4_OPTIONS, 100, //
PS4_CIRCLE, 50, //
EOC,
cb_return_title,
PS4_CIRCLE, 150, // return to title
PS4_CIRCLE, 150, // return to title
EOC,
// End of Data
EOD
); // end of combo2
//-----------------------------------------------------
/*----------------------------*/
/* Main and Init */
/*----------------------------*/
init {
SwitchLED(BLUE);
State = S_IDLE;
Play = FALSE;
}
main {
set_val(TRACE_4,NumDay); // Trace 4 will display the # day
//Press Triangle to pause/play the script.
if(event_press(PS4_TRIANGLE)) {
Play = !Play;
if (Play) {
SwitchLED(GREEN);
State = S_Start_Game;
}
else SwitchLED(RED_BLINK);
}
// Press R1 to Stop the script
if(event_press(PS4_R1)) {
State = S_IDLE;
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)) {
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
if (event_press(PS4_R3)) {Play = TRUE;State = S_Select_Ticket_Tab;} // test a whole state
if (event_press(PS4_L1)) {
if (NumDay>14) NumDay = 1;
else NumDay = NumDay + 1; // adjust the numDay if script is stopped
}
}
if (debug) {
SwitchLED(GREEN);
debug = FALSE;
Play = TRUE;
State = S_Start_Intro;
}
// Main Loop of the State automata
// -------------------------------
if (Play) {
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, CharacterToPlay, S_Start_Vacation);
if (State == S_Start_Vacation) run_State(cb_start_vacation,0, S_Start_RockPlay);
if (State == S_Start_Day) run_State(cb_greeting,0, S_Start_Stage);
if (State == S_Start_Stage) run_State(cb_select_rock_stage, 0, S_Start_RockPlay);
if (State == S_Start_RockPlay)
{
loop_event = loop_event - 1;
if (loop_event != 0) run_State(cb_abort_rock_play, 0, S_Start_RockPlay);
else {loop_event = Nb_Events; run_State(cb_abort_rock_play, 0, S_Clear_Event);}
}
if (State == S_Clear_Event) Repeat_ThenGoto(PS4_SQUARE,Nb_Notifs, S_Hotel);
if (State == S_Hotel) {
if (NumDay == 1) State = S_Owner_Shop;
else run_State(cb_hotel, 0, S_Throw_Gift);
}
if (State == S_Owner_Shop) {
if (Item_To_Buy == Swimsuit) run_State(cb_owner_shop, 0, S_Select_Swimsuit);
else if (Item_To_Buy == Ticket)run_State(cb_owner_shop, 0, S_Select_Ticket_Tab);
}
if (State == S_Select_Swimsuit) Repeat_ThenGoto(PS4_UP, Index_Swimsuit, S_Buy_Swimsuit);
if (State == S_Buy_Swimsuit) run_State(cb_buy_swimsuit, 0, S_Throw_Gift);
if (State == S_Select_Ticket_Tab) run_State(cb_select_ticket_tab, 0, S_Select_Ticket);
if (State == S_Select_Ticket) Repeat_ThenGoto(PS4_DOWN, Index_Ticket, S_Buy_Ticket);
if (State == S_Buy_Ticket) run_State(cb_buy_swimsuit, 0, S_Throw_Gift);
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();
if (State == S_End_Vacation)
{
loop_vacation = loop_vacation + 1;
if (loop_vacation < Nb_Vacations) run_State(cb_end_vacation, 0, S_Clear_Vacation);
else { loop_vacation = 1 ; run_State(cb_end_vacation, 0, S_IDLE);}
}
if (State == S_Clear_Vacation) Repeat_ThenGoto(PS4_CIRCLE,Nb_Notifs, S_Return_Title);
if (State == S_Return_Title) run_State(cb_return_title, 0, S_Start_Game);
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_Clear_Notif{
set_val(PressButton,100);
wait(80);
set_val(PressButton,0);
wait(200);
}
/*-----------------------*/
/* 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
return (S_Start_Intro);
}
function EndDay() {
NumDay = NumDay + 1;
if (NumDay > Nb_Days) {
NumDay = 1;
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 Repeat_ThenGoto(button, times, next) {
PressButton = button;
if (loop_button < times) {
if (!combo_running(cb_Clear_Notif))
{
loop_button = loop_button + 1;
combo_restart (cb_Clear_Notif);
}
}
else
{
set_val(TRACE_5,loop_button); // Look at the state definition to know where the automata is stuck
loop_button = 1;
State = next;
}
return;
}
/*
function ClearNotif_ThenGoto(button, next) {
PressButton = button;
if (loop_notif < Nb_Notifs) {
if (!combo_running(cb_Clear_Notif))
{
loop_notif = loop_notif + 1;
combo_restart (cb_Clear_Notif);
}
}
else
{
set_val(TRACE_5,loop_notif); // Look at the state definition to know where the automata is stuck
loop_notif = 1;
State = next;
}
return;
}
*/
function DebugCombo(combo_to_run,offset){
Play = TRUE;
run_State (combo_to_run,offset,S_IDLE);
return;
}