-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path18190.rascript
658 lines (605 loc) · 20.4 KB
/
18190.rascript
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
// Where is my Heart?
// #ID = 18190
// $9E6538 - [32-bit] Orange Rotating World
// 0x00000000 = Not Rotating
// 0x00000001 = Rotating
function OrangePowerupRotating() => dword( 0x009e6538 )
// $A43A40 - [32-bit] Key Pressed
function KeyPressed() => dword( 0x00a43a40 )
// $B16038 - [32-bit] Game Pointer
// Notes: Anything other than 0x00000000 is an address to the currently playing chapters data
// 0x00000000 = In Main Menu
// (use & value 0x01ffffff)
// +0x88
// .+0x0
// ..+0x14
// ...+0x08 = Current Chapter Score
// ...+0x0c = Hearts Collected
// ...+0x10 = Dark Hearts Collected
// ...+0x14 = Hearts Available
// +0x244 = Current Character 0x00000000 = Brown, 0x00000001 = Orange, 0x00000002 = Black
// +0x284 = Current Chapter Timer
function GamePointer() => dword( 0x00b16038 )
function GamePointer2() => dword( ( GamePointer() & 0x01ffffff ) + 0x88 )
// The character currently being used in game 0x00000000 = Brown, 0x00000001 = Orange, 0x00000002 = Black
function Character() => dword( ( GamePointer() & 0x01ffffff ) + 0x244 )
// The Current Chapter Timer
function CurrentChapterTimer() => dword( ( GamePointer() & 0x01ffffff ) + 0x284 )
function GamePointer3() => dword( GamePointer2() & 0x01ffffff )
function GamePointer4() => dword( ( GamePointer3() & 0x01ffffff ) + 0x14 )
function CurrentChapterScore() => dword( ( GamePointer4() & 0x01ffffff ) + 0x08 )
function HeartsCollected() => dword( ( GamePointer4() & 0x01ffffff ) + 0x0c )
function DarkHeartsCollected() => dword( ( GamePointer4() & 0x01ffffff ) + 0x10 )
// This can be inaccurate, I think this was ported and the available hearts may have been miscounted on a few levels
function AvailableHearts() => dword( ( GamePointer4() & 0x01ffffff ) + 0x14 )
// $B16044 - [32-bit] Game State
// 0x00000000 = Playing Chapter
// 0x00000001 = In Start Menu
function GameState() => dword( 0x00b16044 )
function Chapter() => dword( 0x00b160d4 )
// I think its 60 frames * 10 for miliseconds
function ChapterTimer() => dword( 0x00b160e4 )
// $E679C8 - [32-bit] Brown State
// 0x00000000 = Idle
// 0x00000001 = Left or Right
// 0x00000002 = Jumping
// 0x00000003 = Falling
// 0x00000004 = End Jump
// 0x00000006 = Entering End Chapter Tree
// 0x00000007 = Inside End Chapter Tree
// 0x00000008 = Powered Up (if entering End Tree powereed up it stays this value)
function BrownState() => dword( 0x00e679c8 )
function BrownPoweredUpState() => dword( 0x00b17f18 )
// $E67EC8 - [32-bit] Orange State
// 0x00000000 = Idle
// 0x00000001 = Left or Right
// 0x00000002 = Jumping
// 0x00000003 = Falling
// 0x00000004 = End Jump
// 0x00000006 = Entering End Chapter Tree
// 0x00000007 = Inside End Chapter Tree
// 0x00000008 = Powered Up (if entering End Tree powereed up it stays this value)
function OrangeState() => dword( 0x00e67ec8 )
function OrangePoweredUpState() => dword( 0x00e7b9c8 )
// $B1F0F8 - [32-bit] Black State
// 0x00000000 = Idle
// 0x00000001 = Left or Right
// 0x00000002 = Jumping
// 0x00000003 = Falling
// 0x00000004 = End Jump
// 0x00000006 = Entering End Chapter Tree
// 0x00000007 = Inside End Chapter Tree
// 0x00000008 = Powered Up (if entering End Tree powered up it stays this value)
function BlackState() => dword( 0x00b1f0f8 )
function BlackPoweredUpState() => dword( 0x00b23d78 )
// 0x00 = not double Jumping
// 0x01 = double jumping
function BrownDoubleJump() => byte( 0x00b17f71 )
function AnimationCounter() => dword( 0x009e7130 )
function LeftBumperButton() => bit0( 0x00a43a41 )
function RightBumperButton() => bit1( 0x00a43a41 )
CHAPTER1 = 0x0000001b
CHAPTER2 = 0x00000000
CHAPTER3 = 0x00000003
CHAPTER4 = 0x00000004
CHAPTER5 = 0x00000005
CHAPTER6 = 0x00000008
CHAPTER7 = 0x0000000a
CHAPTER8 = 0x00000016
CHAPTER9 = 0x00000006
CHAPTER10 = 0x00000013
CHAPTER11 = 0x0000000b
CHAPTER12 = 0x00000007
// Brown: We are a family of monsters.
// Rainbow Spirit: I can reach the stars and find a way home.
// Antler Ancestor: Hop, hey and farewell!
chapterConfigs = [
{
"id": 0x0000001b,
"description": "The Heart Tree",
"hearts": 2,
"brownPowerUp": false,
"orangePowerUp": false,
"blackPowerUp": false,
"progressionGroup": 1,
"hasLeaderboard": true
},
{
"id": 0x00000000,
"description": "We're on our Way",
"hearts": 1,
"brownPowerUp": false,
"orangePowerUp": false,
"blackPowerUp": false,
"progressionGroup": 1,
"hasLeaderboard": true
},
{
"id": 0x00000003,
"description": "Wilderness",
"hearts": 3,
"brownPowerUp": false,
"orangePowerUp": false,
"blackPowerUp": false,
"progressionGroup": 1,
"hasLeaderboard": true
},
{
"id": 0x00000004,
"description": "A Little Cave",
"hearts": 3,
"brownPowerUp": false,
"orangePowerUp": false,
"blackPowerUp": false,
"progressionGroup": 2,
"hasLeaderboard": true
},
{
"id": 0x00000005,
"description": "Antler Ancestor",
"hearts": 3,
"brownPowerUp": true,
"orangePowerUp": false,
"blackPowerUp": false,
"progressionGroup": 2,
"hasLeaderboard": true
},
{
"id": 0x00000008,
"description": "Rainbow Spirit",
"hearts": 2,
"brownPowerUp": false,
"orangePowerUp": true,
"blackPowerUp": false,
"progressionGroup": 2,
"hasLeaderboard": true
},
{
"id": 0x0000000a,
"description": "Wall in the Meadow",
"hearts": 1,
"brownPowerUp": false,
"orangePowerUp": true,
"blackPowerUp": false,
"progressionGroup": 2,
"hasLeaderboard": true
},
{
"id": 0x00000016,
"description": "Bridge",
"hearts": 4,
"brownPowerUp": false,
"orangePowerUp": true,
"blackPowerUp": false,
"progressionGroup": 2,
"hasLeaderboard": true
},
{
"id": 0x00000006,
"description": "Islands",
"hearts": 5,
"brownPowerUp": true,
"orangePowerUp": false,
"blackPowerUp": false,
"progressionGroup": 2,
"hasLeaderboard": true
},
{
"id": 0x00000013,
"description": "Serpentine",
"hearts": 7,
"brownPowerUp": true,
"orangePowerUp": false,
"blackPowerUp": false,
"progressionGroup": 2,
"hasLeaderboard": true
},
{
"id": 0x0000000b,
"description": "Flying Rocks",
"hearts": 8,
"brownPowerUp": false,
"orangePowerUp": true,
"blackPowerUp": false,
"progressionGroup": 2,
"hasLeaderboard": true
},
{
"id": 0x00000007,
"description": "Little Fern Track",
"hearts": 12,
"brownPowerUp": true,
"orangePowerUp": false,
"blackPowerUp": false,
"progressionGroup": 2,
"hasLeaderboard": true
}
]
function CharacterJumps( hasBrownPowerUp, hasOrangePowerUp, hasBlackPowerUp ) {
conditions = [
( prev( BrownState() ) != 0x00000002 && BrownState() == 0x00000002 ),
( prev( OrangeState() ) != 0x00000002 && OrangeState() == 0x00000002 ),
( prev( BlackState() ) != 0x00000002 && BlackState() == 0x00000002 )
]
if( hasBrownPowerUp ) {
array_push( conditions, ( prev(BrownPoweredUpState() ) != 0x00000002 && BrownPoweredUpState() == 0x00000002 ) )
}
if( hasOrangePowerUp ) {
array_push( conditions, ( prev(OrangePoweredUpState() ) != 0x00000002 && OrangePoweredUpState() == 0x00000002 ) )
}
if( hasBlackPowerUp ) {
array_push( conditions, ( prev(BlackPoweredUpState() ) != 0x00000002 && BlackPoweredUpState() == 0x00000002 ) )
}
return conditions
}
function AntlerDoubleJumps() {
return (
BrownState() == 0x00000008 &&
prev( BrownDoubleJump() ) == 0x00 &&
BrownDoubleJump() == 0x01
)
}
function InGame() {
return (
GamePointer() != 0x00000000
)
}
function UpgradeChapter( isChallenge, hasBrownPowerUp, hasOrangePowerUp, hasBlackPowerUp ) {
brown = prev( BrownState() ) != 0x00000007 && BrownState() == 0x00000007 && OrangeState() == 0x00000007 && BlackState() == 0x00000007
orange = BrownState() == 0x00000007 && prev( OrangeState() ) != 0x00000007 && OrangeState() == 0x00000007 && BlackState() == 0x00000007
black = BrownState() == 0x00000007 && OrangeState() == 0x00000007 && prev( BlackState() ) != 0x00000007 && BlackState() == 0x00000007
if( isChallenge ) {
brown = trigger_when( brown )
orange = trigger_when( orange )
black = trigger_when( black )
}
conds = ( brown ) || ( orange ) || ( black )
if( hasBrownPowerUp ) {
// Ideally we would check for browns state to be 0x00000008 but level 10 defaults browns state to 0x00000000 so we need to loosen the requirements
brownPowerUp = prev( BrownPoweredUpState() ) != 0x00000007 && BrownPoweredUpState() == 0x00000007
if( isChallenge ) {
brownPowerUp = trigger_when( brownPowerUp )
}
conds = conds || ( brownPowerUp )
}
if( hasOrangePowerUp ) {
orangeNewBrown = prev( BrownState() ) != 0x00000007 && BrownState() == 0x00000007 && OrangeState() == 0x00000008 && OrangePoweredUpState() == 0x00000007 && BlackState() == 0x00000007
orangeNewOrange = BrownState() == 0x00000007 && OrangeState() == 0x00000008 && prev( OrangePoweredUpState() ) != 0x00000007 && OrangePoweredUpState() == 0x00000007 && BlackState() == 0x00000007
orangeNewBlack = BrownState() == 0x00000007 && OrangeState() == 0x00000008 && OrangePoweredUpState() == 0x00000007 && prev( BlackState() ) != 0x00000007 && BlackState() == 0x00000007
if( isChallenge ) {
orangeNewBrown = trigger_when( orangeNewBrown )
orangeNewOrange = trigger_when( orangeNewOrange )
orangeNewBlack = trigger_when( orangeNewBlack )
}
conds = conds || ( orangeNewBrown ) || ( orangeNewOrange ) || ( orangeNewBlack )
}
if( hasBlackPowerUp ) {
blackNewBrown = prev( BrownState() ) != 0x00000007 && BrownState() == 0x00000007 && OrangeState() == 0x00000007 && BlackState() == 0x00000008 && BlackPoweredUpState() == 0x00000007
blackNewOrange = BrownState() == 0x00000007 && prev( OrangeState() ) != 0x00000007 && OrangeState() == 0x00000007 && BlackState() == 0x00000008 && BlackPoweredUpState() == 0x00000007
blackNewBlack = BrownState() == 0x00000007 && OrangeState() == 0x00000007 && BlackState() == 0x00000008 && prev( BlackPoweredUpState() ) != 0x00000007 && BlackPoweredUpState() == 0x00000007
if( isChallenge ) {
blackNewBrown = trigger_when( blackNewBrown )
blackNewOrange = trigger_when( blackNewOrange )
blackNewBlack = trigger_when( blackNewBlack )
}
conds = conds || ( blackNewBrown ) || ( blackNewOrange ) || ( blackNewBlack )
}
return conds
}
function OrangeRotating() {
return (
OrangeState() == 0x00000008 &&
OrangePoweredUpState() != 0x00000008 &&
(
LeftBumperButton() == 1 ||
RightBumperButton() == 1
) &&
prev( AnimationCounter() ) != AnimationCounter()
)
}
rich_presence_conditional_display(
InGame(),
"Hearts: {0}/{1}, Dark Hearts: {2}, Character: {3} TOTAL COLLECTED: {4}",
rich_presence_value( "valueFormat", CurrentChapterScore(), "VALUE" ),
rich_presence_value( "valueFormat", AvailableHearts(), "VALUE" ),
rich_presence_value( "valueFormat", DarkHeartsCollected(), "VALUE" ),
rich_presence_value( "valueFormat", Character(), "VALUE" ),
rich_presence_value( "valueFormat", HeartsCollected(), "VALUE" )
)
rich_presence_display("In Menus")
function Test( chapter ) {
return (
Chapter() == chapter &&
BrownState() == 0x00000007 &&
OrangeState() == 0x00000007 &&
prev( HeartsCollected() ) == HeartsCollected() - 1
)
}
function CollectHeartsUsingCharacter( hearts, character ) {
status = BrownState() != 0x00000007 && OrangeState() == 0x00000007 && BlackState() == 0x00000007
if character == "orange" {
status = BrownState() == 0x00000007 && OrangeState() != 0x00000007 && BlackState() == 0x00000007
}
if character == "black" {
status = BrownState() == 0x00000007 && OrangeState() == 0x00000007 && BlackState() != 0x00000007
}
return repeated( hearts, status && prev( HeartsCollected() ) == HeartsCollected() - 1 )
}
function GameReset() {
return (
HeartsCollected() == 0x00 &&
CurrentChapterScore() == 0x00 &&
DarkHeartsCollected() == 0x00 && (
(
prev( GamePointer() ) != GamePointer()
) || (
prev( ChapterTimer() ) > ChapterTimer()
)
)
)
}
function InSeconds( time ) {
return time * 1000
}
achievement(
title = "Totem Spirit",
description = "Complete chapter 1 in no more than 15 jumps",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER1 &&
UpgradeChapter( true, false, false, false )
) &&
disable_when(
tally(
16,
CharacterJumps( false, false, false )
),
until = GameReset()
),
type = "missable"
)
achievement(
title = "Gotta Go Fast",
description = "Complete chapter 2 in under 11 seconds",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER2 &&
UpgradeChapter( true, false, false, false )
) &&
disable_when(
Chapter() == CHAPTER2 &&
prev( ChapterTimer() ) < InSeconds( 11 ) &&
ChapterTimer() >= InSeconds( 11 ),
until = GameReset()
),
type = "missable"
)
achievement(
title = "Mind The Gap",
description = "With both orange and black inside the end tree, use brown to collect one heart then complete chapter 3",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER3 &&
CollectHeartsUsingCharacter( 1, "brown" ) &&
UpgradeChapter( true, false, false, false ) &&
never( GameReset() )
),
type = "missable"
)
achievement(
title = "Rock Tunnel",
description = "Without dying collect 3 hearts in no more than 14 jumps then complete chapter 4",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER4 &&
HeartsCollected() >= 3 &&
UpgradeChapter( true, false, false, false )
) &&
disable_when(
tally(
15,
CharacterJumps( false, false, false )
),
until = GameReset()
) &&
disable_when(
DarkHeartsCollected() - prev( DarkHeartsCollected() ) == 1,
until = GameReset()
),
type = "missable"
)
achievement(
title = "Gallup Jingle",
description = "Collect 3 hearts in no more than 3 double jumps then complete chapter 5",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER5 &&
HeartsCollected() >= 3 &&
UpgradeChapter( true, true, false, false )
) &&
disable_when(
tally(
4,
AntlerDoubleJumps()
),
until = GameReset()
),
type = "missable"
)
achievement(
title = "A Slight Breeze",
description = "Collect 2 hearts in no more than 1 world rotation then complete chapter 6",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER6 &&
HeartsCollected() >= 2 &&
UpgradeChapter( true, false, true, false )
) &&
disable_when(
tally(
2,
OrangeRotating()
),
until = GameReset()
),
type = "missable"
)
achievement(
title = "Great Wall",
description = "With both orange and brown inside the end tree, use black to collect one heart then complete chapter 7",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER7 &&
CollectHeartsUsingCharacter( 1, "black" ) &&
UpgradeChapter( true, false, true, false ) &&
never( GameReset() )
),
type = "missable"
)
achievement(
title = "Rainbow Bridge",
description = "Without dying collect 4 hearts in no more than 1 world rotation then complete chapter 8",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER8 &&
HeartsCollected() >= 4 &&
UpgradeChapter( true, false, true, false )
) &&
disable_when(
tally(
2,
OrangeRotating()
),
until = GameReset()
) &&
disable_when(
DarkHeartsCollected() - prev( DarkHeartsCollected() ) == 1,
until = GameReset()
),
type = "missable"
)
achievement(
title = "Island Hopping",
description = "Collect 5 hearts in no more than 4 double jumps then complete chapter 9",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER9 &&
HeartsCollected() >= 5 &&
UpgradeChapter( true, true, false, false )
) &&
disable_when(
tally(
5,
AntlerDoubleJumps()
),
until = GameReset()
),
type = "missable"
)
achievement(
title = "Zig Zag",
description = "Collect 7 hearts and complete chapter 10 in under 20 seconds",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER10 &&
HeartsCollected() >= 7 &&
UpgradeChapter( true, true, false, false )
) &&
disable_when(
Chapter() == CHAPTER10 &&
prev( ChapterTimer() ) < InSeconds( 20 ) &&
ChapterTimer() >= InSeconds( 20 ),
until = GameReset()
),
type = "missable"
)
achievement(
title = "Rock of Terror",
description = "Without dying collect 8 hearts in no more than 6 world rotation then complete chapter 11",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER11 &&
HeartsCollected() >= 8 &&
UpgradeChapter( true, false, true, false )
) &&
disable_when(
tally(
7,
OrangeRotating()
),
until = GameReset()
) &&
disable_when(
DarkHeartsCollected() - prev( DarkHeartsCollected() ) == 1,
until = GameReset()
),
type = "missable"
)
achievement(
title = "Glowing Fern",
description = "Without dying collect 12 hearts in no more than 3 double jumps then complete chapter 12",
points = 5,
trigger = (
InGame() &&
Chapter() == CHAPTER12 &&
HeartsCollected() >= 12 &&
UpgradeChapter( true, true, false, false )
) &&
disable_when(
tally(
4,
AntlerDoubleJumps()
),
until = GameReset()
) &&
disable_when(
DarkHeartsCollected() - prev( DarkHeartsCollected() ) == 1,
until = GameReset()
),
type = "missable"
)
for index in range( 1, length( chapterConfigs ) ) {
chapter = chapterConfigs[index - 1]
leaderboardID = index
if dictionary_contains_key( chapter, "leaderboardID" ) {
leaderboardID = chapter["leaderboardID"]
}
if chapter["hasLeaderboard"] {
leaderboard(
id = leaderboardID,
title = format("Speedrun Chapter {0}", index),
description = format("Finish chapter {0} as fast as possible", index),
start = (
Chapter() == chapter["id"] &&
GameReset()
),
cancel = (
(
prev( ChapterTimer() ) < 0xffffffff &&
ChapterTimer() == 0xffffffff
) || (
prev( Chapter() ) == chapter["id"] &&
Chapter() != chapter["id"]
) || (
prev( GamePointer() ) != 0x00000000 &&
GamePointer() == 0x00000000
)
),
submit = UpgradeChapter( false, chapter["brownPowerUp"], chapter["orangePowerUp"], chapter["blackPowerUp"] ),
value = ChapterTimer() / 0x0a,
format = "MILLISECS",
lower_is_better = true
)
}
}