forked from Isotarge/ScriptHawk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmash64.lua
More file actions
1407 lines (1296 loc) · 54.1 KB
/
smash64.lua
File metadata and controls
1407 lines (1296 loc) · 54.1 KB
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
--local ScriptHawk = require 'ScriptHawk'
--neural net implementation current episode
episode_count = 0
current_episode_state_count = 0
s = { self_deaths, self_percent, self_x, self_y, self_xvel, self_yvel,
enemy_deaths, enemy_percent, enemy_x, enemy_y, enemy_xvel, enemy_yvel, enemy_name}
E = {}
r = nil
oldS = nil
if type(ScriptHawk) ~= "table" then
print("This script is not designed to run by itself");
print("Please run ScriptHawk.lua from the parent directory instead");
print("Thanks for using ScriptHawk :)");
return;
end
local Game = {
speedy_speeds = { .1, 1, 5, 10, 20, 35, 50, 75, 100 };
speedy_index = 6;
max_rot_units = 4,
squish_memory_table = true,
Memory = { -- Versions: Japan, Australia, Europe, USA, iQue
music = {0x98BD3, 0x99833, 0xA2E63, 0x99113, 0x92993},
unlocked_stuff = {0xA28F4, 0xA5074, 0xAD194, 0xA4934, 0xA4988}, -- TODO: iQue doesn't seem to work
match_settings_pointer = {0xA30A8, 0xA5828, 0xAD948, 0xA50E8, 0xA5C68},
hurtbox_color_RG = {nil, nil, nil, 0xF2786, nil},
hurtbox_color_BA = {nil, nil, nil, 0xF279E, nil},
red_hitbox_patch = {nil, nil, nil, 0xF33BC, nil}, -- 2400
purple_hurtbox_patch = {nil, nil, nil, 0xF2FD0, nil}, -- 2400
player_list_pointer = {0x12E914, 0x131594, 0x139A74, 0x130D84, 0x130F04},
item_list_pointer = {0x466F0, 0x46E20, 0x46E60, 0x46700, 0x98450},
item_hitbox_offset = {0x370, nil, nil, 0x374, 0x374}, -- TODO: I don't think this exists on PAL versions, should look into it at some point
},
characters = {
[0x00] = "Mario",
[0x01] = "Fox",
[0x02] = "DK",
[0x03] = "Samus",
[0x04] = "Luigi",
[0x05] = "Link",
[0x06] = "Yoshi",
[0x07] = "Falcon",
[0x08] = "Kirby",
[0x09] = "Pikachu",
[0x0A] = "Jigglypuff",
[0x0B] = "Ness",
[0x0C] = "Master Hand",
[0x0D] = "Metal Mario",
[0x0E] = "Polygon Mario",
[0x0F] = "Polygon Fox",
[0x10] = "Polygon DK",
[0x11] = "Polygon Samus",
[0x12] = "Polygon Luigi",
[0x13] = "Polygon Link",
[0x14] = "Polygon Yoshi",
[0x15] = "Polygon Falcon",
[0x16] = "Polygon Kirby",
[0x17] = "Polygon Pikachu",
[0x18] = "Polygon Jigglypuff",
[0x19] = "Polygon Ness",
[0x1A] = "Giant DK",
--[0x1B] = "Crash",
[0x1C] = "None", -- No character selected
},
maps = {
"Peach's Castle", -- 0x00
"Sector Z",
"Kongo Jungle",
"Planet Zebes",
"Hyrule Castle",
"Yoshi's Island",
"Dream Land",
"Saffron City",
"Mushroom Kingdom",
"Dream Land Beta 1",
"Dream Land Beta 2",
"Demo Stage",
"Yoshi's Island no clouds",
"Metal Mario",
"Polygon Team",
"Race to the Finish!",
"Final Destination", -- 0x10
"Targets - Mario",
"Targets - Fox",
"Targets - DK",
"Targets - Samus",
"Targets - Luigi",
"Targets - Link",
"Targets - Yoshi",
"Targets - Falcon",
"Targets - Kirby",
"Targets - Pikachu",
"Targets - Jigglypuff",
"Targets - Ness",
"Platforms - Mario",
"Platforms - Fox",
"Platforms - DK",
"Platforms - Samus", -- 0x20
"Platforms - Luigi",
"Platforms - Link",
"Platforms - Yoshi",
"Platforms - Falcon",
"Platforms - Kirby",
"Platforms - Pikachu",
"Platforms - Jigglypuff",
"Platforms - Ness", -- 0x28
},
music = {
"Dream Land", -- 0x00
"Planet Zebes",
"Mushroom Kingdom",
"Mushroom Kingdom (Fast)",
"Sector Z",
"Kongo Jungle",
"Peach's Castle",
"Saffron City",
"Yoshi's Island",
"Hyrule Castle",
"Character Select",
"Beta Fanfare",
"Mario/Luigi Wins",
"Samus Wins",
"DK Wins",
"Kirby Wins",
"Fox Wins", -- 0x10
"Ness Wins",
"Yoshi Wins",
"Captain Falcon Wins",
"Pikachu/Jigglypuff Wins",
"Link Wins",
"Results Screen",
"Pre-Master Hand",
"Pre-Master Hand #2",
"Master Hand Battle",
"Bonus Stage",
"Stage Clear",
"Bonus Stage Clear",
"Master Hand Clear",
"Bonus Stage Failure",
"Continue?",
"Game Over", -- 0x20
"Intro",
"How to Play",
"Pre-1P Battle",
"Fighting Polygon Team",
"Metal Mario Stage",
"Game Complete",
"Credits",
"Found a Secret!",
"Hidden Character",
"Training Mode",
"VS Record",
"Main Menu",
"Hammer",
"Invincibility", -- 0x2E
},
};
local playerColors = {
[1] = colors.red,
[2] = colors.blue,
[3] = colors.yellow,
[4] = colors.green,
};
local match_settings = {
map = 0x01, -- Byte
match_type = 0x03, -- Byte (bitfield?) Values: 0x01 = time, 0x02 = stock, 0x03 = timed stock match
time = 0x06, -- Byte
stock = 0x07, -- Byte
player_base = {
[1] = 0x20,
[2] = 0x94,
[3] = 0x108,
[4] = 0x17C,
},
player_data = { -- Relative to player_base[player]
controlled_by = 0x02, -- Byte: 0 Human, 1 AI, 2 None
character = 0x03, -- Byte
damage = 0x4C, -- u32_be, Only applies to the UI, real damage is stored in the player object
},
};
local player_fields = {
Character = 0x0B, -- Byte?
Costume = 0x10, -- Byte?
MovementFrame = 0x1C, -- u32_be
MovementState = 0x26, -- u16_be
--0x2C = Health (2 Bytes)
ShieldSize = 0x34, -- s32_be
FacingDirection = 0x44, -- s32_be -- -1 = left, 1 = right
XVelocity = 0x48, -- Float
YVelocity = 0x4C, -- Float
ZVelocity = 0x50, -- Float
XAcceleration = 0x60, -- Float
YAcceleration = 0x64, -- Float
ZAcceleration = 0x68, -- Float
PositionDataPointer = 0x78, -- Pointer
PositionData = {
XPosition = 0x00, -- Float
YPosition = 0x04, -- Float
ZPosition = 0x08, -- Float
},
JumpCounter = 0x148, -- Byte
Grounded = 0x14C, -- Byte
ControllerInputPointer = 0x1B0,
ShieldBreakerRecoveryTimer = 0x26C, -- s32_be
--0x39C = Something to do with Attack Hitbox (4 Bytes)
InvinvibilityState = 0x5AC, -- u16_be
hurtbox_lower_Stomach = 0x5BC,
hurtbox_head = 0x5E8,
hurtbox_upper_right_arm = 0x614, -- TODO: Which one is correct?
hurtbox_upper_right_arm = 0x640, -- TODO: Which one is correct?
hurtbox_upper_left_arm = 0x66C,
hurtbox_lower_right_arm = 0x698,
hurtbox_lower_left_arm = 0x6C4,
hurtbox_upper_right_leg = 0x6F0,
hurtbox_upper_left_leg = 0x71C,
hurtbox_lower_right_leg = 0x748,
hurtbox_lower_left_leg = 0x774,
hurtbox = {
state = 0x00, -- 4 bytes
id = 0x04, -- 4 bytes
pointer = 0x08, -- 4 bytes
x_position = 0x14, -- Float
y_position = 0x18, -- Float
z_position = 0x1C, -- Float
width = 0x20, -- Float
length = 0x24, -- Float
height = 0x28, -- Float
},
CharacterConstantsPointer = 0x9C8,
CharacterConstants = {
BodySizeMultiplier = 0x00, -- Float
--0x04 = Unknown Float
--0x08 = Unknown Float
--0x0C = Unknown Float
--0x1C = Unknown Float
WalkSpeedMultiplier = 0x20, -- Float [Usually Multiplies with 80]
BrakeForce = 0x24, -- Float
InitialDashSpeed = 0x28, -- Float
DashDeceleration = 0x2C, -- Float
RunningSpeed = 0x30, -- Float
JumpFrameDelay = 0x34, -- Float
--0x38 = Starting X-Air Velocity Multiplier after moving before 1st jump (Multiplied by 80)
JumpHeightMultiplier = 0x3C, -- Float
JumpHeight = 0x40, -- Float
--0x44 = Starting X-Air Velocity Multiplier after moving before 2nd jump (Multiplied by 80)
SecondJumpMultiplier = 0x48, -- Float
XAirAcceleration = 0x4C, -- Float
XAirMaximumSpeed = 0x50, -- Float
XAirResistance = 0x54, -- Float
YFallAcceleration = 0x58, -- Float
TerminalVelocity = 0x5C, -- Float
TerminalVelocity_FastFall = 0x60, -- Float
NumberOfJumps = 0x64,
Weight = 0x68, -- Float
SmallComboConnection = 0x6C, -- Float
DashToRunConnection = 0x70, -- Float
ShieldRadius = 0x74, -- Float
},
CameraZoom = 0x864, -- Float
-- 0xA28 = Flash State Pointer? (Pointer)
-- 0xA2B = Flash State Index? (Byte)
FlashColour = 0xA68, -- u32_be, RGBA
FlashColourR = 0xA68, -- Byte
FlashColourG = 0xA69, -- Byte
FlashColourB = 0xA6A, -- Byte
FlashColourA = 0xA6B, -- Byte
BoomerangPointer = 0xADC, -- Pointer
ShieldJump_FrameDelayCounter = 0xB1C, -- 4 Bytes
ShowHitbox = 0xB4C, -- u32_be
};
local movement_states = {
[0x00] = "Dying (Down)", [0x01] = "Dying (Side)", [0x02] = "Dying (Up far)", [0x03] = "Dying (Up near)", [0x05] = "Appearing",
[0x07] = "Reviving", [0x08] = "Spawning", [0x09] = "Standing on Spawning Platform",
[0x0A] = "Standing", [0x0B] = "Walking slowly", [0x0C] = "Walking", [0x0D] = "Walking quickly",
[0x0F] = "Initial Dash", [0x10] = "Running", [0x11] = "Running (End)",
[0x12] = "Switching direction", [0x13] = "Switching Running direction",
[0x14] = "Jumping (Start)", [0x15] = "Shield Jumping", [0x16] = "Jumping +YVel",
[0x17] = "Jumping Backwards", [0x18] = "Air Jumping", [0x19] = "Air Jumping Backwards",
[0x1A] = "Jumping -YVel", [0x1B] = "Air Jumping while -YVel",
[0x1C] = "Crouching (Start)", [0x1D] = "Crouching", [0x1E] = "Crouching (End)",
[0x1F] = "Landing", [0x20] = "Landing hardly",
[0x21] = "Dropping through platform", [0x22] = "Shield Dropping through platform",
[0x23] = "Teeter", [0x24] = "Teeter (Start)",
[0x25] = "Damaged (No Down)", [0x26] = "Damaged (No Down)", [0x27] = "Damaged (No Down)",
[0x28] = "Damaged (No Down)", [0x29] = "Damaged (No Down)", [0x2A] = "Damaged (No Down)",
[0x2B] = "Damaged", [0x2C] = "Damaged", [0x2D] = "Damaged", [0x2E] = "Damaged", [0x2F] = "Damaged",
[0x30] = "Damaged", [0x31] = "Damaged", [0x32] = "Damaged", [0x33] = "Damaged", [0x34] = "Damaged",
[0x35] = "Damaged", [0x36] = "Damaged", [0x37] = "Damaged", [0x38] = "Damaged",
[0x39] = "End of Stun",
[0x3A] = "Falling After Up-Special (Aerial)", [0x3B] = "Landing after Up-Special (Aerial)",
[0x3C] = "Damaged (Tornado)", [0x3D] = "Getting into the Barrel",
[0x3E] = "Entering the Pipe", [0x3F] = "Moving inside the Pipe", [0x40] = "Coming out of the Pipe", [0x41] = "Coming out of the Abyth",
[0x42] = "Bonk Ceiling",
[0x43] = "Facedown N Down", [0x44] = "Faceup N Down", [0x45] = "Facedown Downed", [0x46] = "Faceup Downed",
[0x47] = "Getting Recovery from Facedown Down", [0x48] = "Getting Recovery from Faceup Down",
[0x49] = "Forwards Teching", [0x4A] = "Backwards Teching",
[0x4B] = "Rolling Forwards from Facedown Down", [0x4C] = "Rolling Forwards from Faceup Down",
[0x4D] = "Rolling Backwards from Faceup Down", [0x4E] = "Rolling Backwards from Faceup Down",
[0x4F] = "Attack from Facedown Down", [0x50] = "Attack from Faceup Down", [0x51] = "Teching",
[0x54] = "Grabbing Edge (Start)", [0x55] = "Grabbing Edge",
[0x56] = "Rising Edge (Start)", [0x57] = "Rising Edge", [0x58] = "Rising Edge (End)",
[0x59] = "Rising Edge (100%) (Start)", [0x5A] = "Rising Edge (100%)", [0x5B] = "Rising Edge (100%) (End)",
[0x5C] = "Edge Attack (Start)", [0x5D] = "Edge Attack",
[0x5E] = "Edge Attack (100%) (Start)", [0x5F] = "Edge Attack (100%)",
[0x60] = "Edge Rolling (Start)", [0x61] = "Edge Rolling",
[0x62] = "Edge Rolling (100%) (Start)", [0x63] = "Edge Rolling (100%)", [0x64] = "Getting an Item",
[0x65] = "Picking up an Item", [0x66] = "Holding an Item", [0x67] = "Switching Direction During Holding an Item",
[0x68] = "Throw", [0x69] = "Dash Throw", [0x6A] = "Forward Throw", [0x6B] = "Back Throw", [0x6C] = "Up Throw", [0x6D] = "Down Throw",
[0x6E] = "Forward Throw(Smash)", [0x6F] = "Back Throw(Smash)", [0x70] = "Up Throw (Smash)", [0x71] = "Down Throw (Smash)",
[0x72] = "Throw-Air", [0x73] = "Back Throw-Air", [0x74] = "Up Throw-Air", [0x75] = "Down Throw-Air",
[0x76] = "Throw-Air (Smash)", [0x77] = "Back Throw-Air (Smash)", [0x78] = "Up Throw-Air (Smash)", [0x79] = "Down Throw-Air (Smash)",
[0x7E] = "Beam Sword (Jab)", [0x7F] = "Beam Sword (Tilt)", [0x80] = "Beam Sword (Smash)", [0x81] = "Beam Sword (Dash)",
[0x7A] = "Crate Throw", [0x7B] = "Reverse Crate Throw", [0x7C] = "Crate Throw (Smash)", [0x7D] = "Reverse Crate Throw (Smash)",
[0x82] = "Home-Run Bat (Jab)", [0x83] = "Home-Run Bat (Tilt)", [0x84] = "Home-Run Bat (Smash)", [0x85] = "Home-Run Bat (Dash)",
[0x86] = "Harisen (Jab)", [0x87] = "Harisen (Tilt)", [0x88] = "Harisen (Smash)", [0x89] = "Harisen (Dash)",
[0x8A] = "Star Rod (Jab)", [0x8B] = "Star Rod (Tilt)", [0x8C] = "Star Rod (Smash)", [0x8D] = "Star Rod (Dash)",
[0x8E] = "Ray Gun", [0x8F] = "Ray Gun (Aerial)", [0x90] = "Fire Flower", [0x91] = "Fire Flower (Aerial)",
[0x92] = "Hammer (Stand)", [0x93] = "Hammer (Walk)", [0x94] = "Hammer (Switch)",
[0x95] = "Hammer (Jump)", [0x96] = "Hammer (Air)", [0x97] = "Hammer (Land)",
[0x98] = "Shield (Start)", [0x99] = "Shield", [0x9A] = "Shield (End)",
[0x9B] = "Stunned During Shield",
[0x9C] = "Rolling Forwards", [0x9D] = "Rolling Backwards",
[0x9E] = "Shield Breaking",
[0xA1] = "SB Downed", [0xA3] = "SB Stunned (Start)", [0xA4] = "SB Stunned", [0xA5] = "Sleeping",
[0xA6] = "Grab", [0xA7] = "Grabbing (Start)", [0xA8] = "Grabbing", [0xA9] = "Throwing", [0xAA] = "Back Throwing",
[0xAB] = "Getting Grabbed (Start)", [0xAC] = "Getting Grabbed",
[0xAD] = "Getting Vacuumed", [0xAE] = "Getting Stuffed", [0xAF] = "Getting Spat", [0xB0] = "Getting Copied",
[0xB1] = "Getting Tongue", [0xB2] = "Being Egg",
[0xB3] = "Getting FalconDive",
[0xB5] = "Getting Mounted (Start)", [0xB8] = "Getting Mounted",
[0xBA] = "Getting Grabbed (End)", [0xBB] = "Getting Grabbed (End)",
[0xBD] = "Taunt", [0xBE] = "Jab 1", [0xBF] = "Jab 2",
[0xC0] = "Dash Attack",
[0xC1] = "Forward Tilt (high)", [0xC2] = "Forward Tilt (mid-high)", [0xC3] = "Forward Tilt", [0xC4] = "Forward Tilt (mid-low)", [0xC5] = "Forward Tilt (low)",
[0xC7] = "Up Tilt", [0xC9] = "Down Tilt",
[0xCA] = "Forward Smash (high)", [0xCB] = "Forward Smash (mid-high)", [0xCC] = "Forward Smash", [0xCD] = "Forward Smash (mid-low)", [0xCE] = "Forward Smash (low)",
[0xCF] = "Up Smash", [0xD0] = "Down Smash",
[0xD1] = "Neutral Air", [0xD2] = "Forward Air", [0xD3] = "Back Air", [0xD4] = "Up Air", [0xD5] = "Down Air",
[0xD7] = "Forward Air Landing", [0xD8] = "Backward Air Landing", [0xD9] = "Miss Landing",
[0xDA] = "Miss Landing hardly", [0xDB] = "Miss Landing softly",
};
local character_states = {
[0x00] = { -- Mario
[0xDC] = "Jab 3",
[0xDE] = "Appearing",
[0xDF] = "Fireball", [0xE0] = "Fireball (Aerial)",
[0xE1] = "Up-Special", [0xE2] = "Up-Special (Aerial)",
[0xE3] = "Down-Special", [0xE4] = "Down-Special (Aerial)",
},
[0x01] = { -- Fox
[0xDC] = "Jab Loop (Start)", [0xDD] = "Jab Loop", [0xDE] = "Jab Loop (End)",
[0xDF] = "Appearing", [0xE0] = "Arwing",
[0xE1] = "Laser", [0xE2] = "Laser (Aerial)",
[0xE3] = "Fire Fox (Start)", [0xE4] = "Fire Fox (Aerial) (Start)",
[0xE5] = "Readying Fire Fox", [0xE6] = "Readying Fire Fox (Aerial)",
[0xE7] = "Fire Fox", [0xE8] = "Fire Fox (Aerial)",
[0xE9] = "Fire Fox (End)", [0xEA] = "Fire Fox (Aerial) (End)",
[0xEB] = "Landing while Fire Fox (Aerial)",
[0xEC] = "Shine (Start)", [0xED] = "Reflecting", [0xEE] = "Shine (End)", [0xEF] = "Shine",
[0xF0] = "Switching Direction Shine",
[0xF1] = "Shine (Aerial) (Start)", [0xF3] = "Shine (Aerial) (End)", [0xF4] = "Shine (Aerial)",
[0xF5] = "Switching Direction Shine (Aerial)",
},
[0x02] = { -- DK
[0xDD] = "Appearing",
[0xDE] = "Charge (Start)", [0xDF] = "Charge (Aerial) (Start)",
[0xE0] = "Charging", [0xE1] = "Charging (Aerial)",
[0xE2] = "Punching", [0xE3] = "Punching (Aerial)",
[0xE4] = "Maximum Punching", [0xE5] = "Maximum Punching (Aerial)",
[0xE6] = "Up-Special", [0xE7] = "Up-Special (Aerial)",
[0xE8] = "Down-Special (Start)", [0xE9] = "Down-Special", [0xEA] = "Down-Special (End)",
[0xEB] = "Standing (Mounting)",
[0xEC] = "Walking slowly (Mounting)", [0xED] = "Walking (Mounting)", [0xEE] = "Walking quickly (Mounting)",
[0xEF] = "Switching direction (Mounting)",
[0xF0] = "Jump (Mounting) (Start)", [0xF1] = "Jumping (Mounting)", [0xF2] = "Landing (Mounting)",
[0xF4] = "After Throw (Mounting)", [0xF5] = "Throw (Mounting)",
},
[0x03] = { -- Samus
[0xDD] = "Appearing",
[0xDE] = "Starting Charge Shot", [0xDF] = "Charging", [0xE0] = "Shooting",
[0xE1] = "Starting Charge Shot (Aerial)", [0xE2] = "Shooting (Aerial)",
[0xE3] = "Screw Attack", [0xE4] = "Screw Attack (Aerial)",
[0xE5] = "Bomb", [0xE6] = "Bomb (Aerial)",
},
[0x04] = { -- Luigi
[0xDC] = "Jab 3",
[0xDE] = "Appearing",
[0xDF] = "Fireball", [0xE0] = "Fireball (Aerial)",
[0xE1] = "Up-Special", [0xE2] = "Up-Special (Aerial)",
[0xE3] = "Down-Special", [0xE4] = "Down-Special (Aerial)",
},
[0x05] = { -- Link
[0xDC] = "Jab 3", [0xDD] = "Jab Loop (Start)", [0xDE] = "Jab Loop", [0xDF] = "Jab Loop (End)",
[0xE0] = "Appearing", [0xE1] = "Appearing",
[0xE2] = "Up-Special", [0xE3] = "Up-Special (End)", [0xE4] = "Up-Special (Aerial)",
[0xE5] = "Boomerang", [0xE6] = "Catching Boomerang", [0xE7] = "Missing Boomerang",
[0xE8] = "Boomerang (Aerial)", [0xE9] = "Catching Boomerang (Aerial)", [0xEA] = "Missing Boomerang (Aerial)",
[0xEB] = "Bomb", [0xEC] = "Bomb (Aerial)",
},
[0x06] = { -- Yoshi
[0xDD] = "Appearing",
[0xDE] = "Up-Special", [0xDF] = "Up-Special (Aerial)",
[0xE0] = "Start Down-Special", [0xE1] = "Landing while Down-Special",
[0xE2] = "Start Down-Special(Aerial)", [0xE3] = "Falling while Down-Special",
[0xE4] = "N-Special", [0xE5] = "Succeeding N-Special", [0xE6] = "N-Special (End)",
[0xE7] = "N-Special (Aerial)", [0xE8] = "Succeeding N-Special (Aerial)", [0xE9] = "N-Special (Aerial) (End)",
},
[0x07] = { -- Captain Falcon
[0xDC] = "Jab 3", [0xDD] = "Jab Loop (Start)", [0xDE] = "Jab Loop", [0xDF] = "Jab Loop (End)",
[0xE0] = "Appearing", [0xE1] = "Appearing (Aerial)", [0xE2] = "Blue Falcon", [0xE3] = "Blue Falcon",
[0xE4] = "Falcon Punch", [0xE5] = "Falcon Punch (Aerial)",
[0xE6] = "Down-Special", [0xE7] = "Velocity X Down-Special (Aerial)",
[0xE8] = "Landing while Down-Special", [0xE9] = "Down-Special (Aerial)", [0xEA] = "Bumping while Down-Special",
[0xEB] = "Falcon Dive", [0xEC] = "Cathing Enemy while F Dive", [0xED] = "Falcon Dive (End)",
[0xEE] = "Falcon Dive (Aerial)",
},
[0x08] = { -- Kirby
[0xFA] = "Staring", [0xFB] = "Staring",
[0xDC] = "Jab Loop (Start)", [0xDD] = "Jab Loop", [0xDE] = "Jab Loop (End)",
[0xDF] = "Jumping (Aerial) [4]", [0xE0] = "Jumping (Aerial) [3]",
[0xE1] = "Jumping (Aerial) [2]", [0xE2] = "Jumping (Aerial) [1]", [0xE3] = "Jumping (Aerial) [0]",
-- Mario
[0xE7] = "Fireball", [0xE8] = "Fireball (Aerial)",
-- Luigi
[0xE9] = "Fireball", [0xEA] = "Fireball (Aerial)",
-- Fox
[0xEB] = "Laser", [0xEC] = "Laser (Aerial)",
-- Samus
[0xED] = "Charge Shot (Start)", [0xEE] = "Charging", [0xEF] = "Shooting",
[0xF0] = "Charge Shot (Aerial) (Start)", [0xF1] = "Shooting (Aerial)",
-- DK
[0xF2] = "Charge (Start)", [0xF3] = "Charge (Aerial) (Start)",
[0xF4] = "Charging", [0xF5] = "Charging (Aerial)",
[0xF6] = "Punching", [0xF7] = "Punching (Aerial)",
[0xF8] = "Maximum Punching", [0xF9] = "Maximum Punching (Aerial)",
-- Pikachu
[0xFC] = "Lightning", [0xFD] = "Lightning (Aerial)",
-- Ness
[0xFE] = "PK Fire", [0xFF] = "PK Fire (Aerial)",
[0x100] = "Up-Special", [0x101] = "Landing while Up-Special",
[0x102] = "Up-Special (Aerial)", [0x103] = "Falling while Up-Special",
[0x104] = "Down-Special (Start)", [0x106] = "Down-Special", [0x107] = "Canceling Down-Special",
[0x108] = "Down-Special (Aerial) (Start)", [0x109] = "Falling while Down-Special (Aerial)",
[0x10A] = "Landing while Down-Special", [0x10B] = "Falling while Down-Special", [0x10C] = "Cancelling Down-Special (Aerial)",
[0x10D] = "N-Special (Start)", [0x10E] = "N-Special", [0x10F] = "N-Special (End)",
[0x110] = "Inhaling while N-Special (Start)", [0x111] = "Inhaling while N-Special",
[0x112] = "Spitting while N-Special",
[0x113] = "Stuffing while N-Special", [0x114] = "Switching Direction while Stuffing while N-Special",
[0x115] = "Copying",
[0x116] = "N-Special (Aerial) (Start)", [0x117] = "N-Special (Aerial)", [0x118] = "N-Special (Aerial) (End)",
[0x119] = "Inhaling while N-Special (Aerial) (Start)", [0x11A] = "Inhaling while N-Special (Aerial)",
[0x11C] = "Spitting while N-Special", [0x11D] = "Stuffing while N-Special (Aerial)", [0x11E] = "Copying (Aerial)",
-- Link
[0x11F] = "Boomerang", [0x120] = "Catching Boomerang", [0x121] = "Missing Boomerang",
[0x122] = "Boomerang (Aerial)", [0x123] = "Catching Boomerang (Aerial)", [0x124] = "Missing Boomerang (Aerial)",
-- Jigglypuff
[0x125] = "Pound", [0x126] = "Pound (Aerial)",
-- Captain Falcon
[0x127] = "Falcon Punch", [0x128] = "Falcon Punch (Aerial)",
-- Yoshi
[0x129] = "N-Special", [0x12A] = "Succeeding N-Special", [0x12B] = "N-Special (End)",
[0x12C] = "N-Special (Aerial)", [0x12D] = "Succeeding N-Special (Aerial)", [0x12E] = "N-Special (Aerial) (End)",
},
[0x09] = { -- Pikachu
[0xDD] = "Appearing",
[0xDE] = "N-Special", [0xDF] = "N-Special (Aerial)",
[0xE0] = "Down-Special (Start)", [0xE1] = "Down-Special", [0xE2] = "Getting Thundered", [0xE3] = "Down-Special (End)",
[0xE4] = "Down-Special (Aerial) (Start)", [0xE5] = "Down-Special (Aerial)", [0xE6] = "Getting Thundered (Aerial)", [0xE7] = "Down-Special (Aerial) (End)",
[0xE8] = "Up-Special (Start)", [0xE9] = "Up-Special", [0xEA] = "Up-Special (End)",
[0xEB] = "Up-Special (Aerial) (Start)", [0xEC] = "Up-Special (Aerial)", [0xED] = "Up-Special (Aerial) (End)",
},
[0x0A] = { -- Jigglypuff
[0xDF] = "Jumping (Aerial) [4]", [0xE0] = "Jumping (Aerial) [3]",
[0xE1] = "Jumping (Aerial) [2]", [0xE2] = "Jumping (Aerial) [1]", [0xE3] = "Jumping (Aerial) [0]",
[0xE4] = "Appearing", [0xE5] = "Appearing",
[0xE6] = "Pound", [0xE7] = "Pound (Aerial)",
[0xE8] = "Sing", [0xE9] = "Sing (Aerial)",
[0xEA] = "Rest", [0xEB] = "Rest (Aerial)",
},
[0x0B] = { -- Ness
[0xDC] = "Jab 3",
[0xDE] = "Appearing", [0xDF] = "Appearing", [0xE1] = "Appearing",
[0xE2] = "PK Fire", [0xE3] = "PK Fire (Aerial)",
[0xE4] = "PK Thunder (Start)", [0xE5] = "PK Thunder", [0xE6] = "PK Thunder (End)", [0xE7] = "PKTA",
[0xE8] = "PK Thunder (Aerial) (Start)", [0xE9] = "PK Thunder (Aerial)", [0xEA] = "PK Thunder (Aerial) (End)",
[0xEB] = "Clashing during PKTA", [0xEC] = "PKTA (Aerial)",
[0xED] = "Down-Special (Start)", [0xEE] = "Down-Special", [0xEF] = "Cureing", [0xF0] = "Down-Special (End)",
[0xF1] = "Down-Special (Aerial) (Start)", [0xF2] = "Down-Special (Aerial)", [0xF3] = "Cureing (Aerial)", [0xF4] = "Down-Special (Aerial) (End)",
},
[0x0C] = { -- Master Hand
[0xDD] = "Idle", [0xDE] = "Selecting Move",
[0xDF] = "Slapping",
[0xE0] = "Shooing",
[0xE1] = "Launching", [0xE2] = "Flying", [0xE3] = "Landing",
[0xE4] = "Walking (Start)", [0xE5] = "Walking", [0xE7] = "Flicking",
[0xE8] = "Charging (Start)", [0xE9] = "Charging", [0xEA] = "Landing", [0xEB] = "Punching",
[0xEC] = "Pointing (Start)", [0xED] = "Poking", [0xEE] = "Pointing",
[0xEF] = "Drilling",
[0xF0] = "Punching",
[0xF1] = "Pulling Gun", [0xF2] = "Shooting Gun", [0xF3] = "Aiming Gun",
[0xF4] = "Punching (Start)", [0xF5] = "Punching", [0xF6] = "Punching (End)",
[0xF7] = "Slamming", [0xF8] = "Slamming (Start)",
[0xF9] = "Dying (Start)", [0xFA] = "Dying",
[0xFC] = "Appearing",
},
[0x0D] = { -- Metal Mario
[0xDC] = "Jab 3",
[0xDE] = "Appearing",
[0xDF] = "Fireball", [0xE0] = "Fireball (Aerial)",
[0xE1] = "Up-Special", [0xE2] = "Up-Special (Aerial)",
[0xE3] = "Down-Special", [0xE4] = "Down-Special (Aerial)",
},
[0x1A] = { -- Giant DK
[0xDD] = "Appearing",
[0xDE] = "Charge (Start)", [0xDF] = "Charge (Aerial) (Start)",
[0xE0] = "Charging", [0xE1] = "Charging (Aerial)",
[0xE2] = "Punching", [0xE3] = "Punching (Aerial)",
[0xE4] = "Maximum Punching", [0xE5] = "Maximum Punching (Aerial)",
[0xE6] = "Up-Special", [0xE7] = "Up-Special (Aerial)",
[0xE8] = "Down-Special (Start)", [0xE9] = "Down-Special", [0xEA] = "Down-Special (End)",
[0xEB] = "Standing (Mounting)",
[0xEC] = "Walking slowly (Mounting)", [0xED] = "Walking (Mounting)", [0xEE] = "Walking quickly (Mounting)",
[0xEF] = "Switching direction (Mounting)",
[0xF0] = "Jump (Mounting) (Start)", [0xF1] = "Jumping (Mounting)", [0xF2] = "Landing (Mounting)",
[0xF4] = "After Throw (Mounting)", [0xF5] = "Throw (Mounting)",
},
};
function Game.setMap(index)
local matchSettings = dereferencePointer(Game.Memory.match_settings_pointer);
if isRDRAM(matchSettings) then
mainmemory.writebyte(matchSettings + match_settings.map, index - 1);
end
end
function Game.getMatchSettings()
local matchSettings = dereferencePointer(Game.Memory.match_settings_pointer);
if isRDRAM(matchSettings) then
return toHexString(matchSettings);
end
return "Unknown";
end
function Game.getPlayer(player)
if type(player) ~= "number" or player == 1 then
return dereferencePointer(Game.Memory.player_list_pointer);
end
local playerList = dereferencePointer(Game.Memory.player_list_pointer);
if isRDRAM(playerList) then
return playerList + (player - 1) * 0xB50;
end
end
function Game.getScore(player)
return score_points
end
function Game.getPercent(player)
return mainmemory.read_s32_be(0x0A4D74)
end
function Game.getCharacter(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
return mainmemory.readbyte(playerActor + player_fields.Character);
end
return 0x1C; -- Default to none selected
end
function Game.setCharacter(character, player)
--local playerActor = Game.getPlayer(player);
--if isRDRAM(playerActor) then
--mainmemory.writebyte(playerActor + player_fields.Character, character);
--end
local matchSettings = dereferencePointer(Game.Memory.match_settings_pointer);
if isRDRAM(matchSettings) then
if type(player) ~= "number" or player < 1 or player > 4 then
player = 1;
end
mainmemory.writebyte(matchSettings + match_settings.player_base[player] + match_settings.player_data.character, character);
end
end
function Game.getMovementState(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
return mainmemory.read_u16_be(playerActor + player_fields.MovementState);
end
return 0;
end
function Game.setMovementState(value, player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
mainmemory.write_u16_be(playerActor + player_fields.MovementState, value);
mainmemory.write_u32_be(playerActor + player_fields.MovementFrame, 0);
end
end
function Game.getMovementString(player)
local movementState = Game.getMovementState(player);
if type(movement_states[movementState]) == "string" then
return movement_states[movementState];
else
local characterIndex = Game.getCharacter(player);
if type(character_states[characterIndex]) == "table" and type(character_states[characterIndex][movementState]) == "string" then
return character_states[characterIndex][movementState];
end
end
return "Unknown "..toHexString(movementState);
end
function Game.colorMovementState(player)
local state = Game.getMovementString(player);
if string.contains(state, "Unknown") then
return colors.red;
elseif string.contains(state, "Damaged") then
return colors.yellow;
elseif string.contains(state, "Missed") then
return colors.yellow;
end
end
function Game.getMovementFrame(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
return mainmemory.read_u32_be(playerActor + player_fields.MovementFrame);
end
return 0;
end
function Game.getJumpCounter(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
return mainmemory.readbyte(playerActor + player_fields.JumpCounter);
end
return 0;
end
function Game.setJumpCounter(value, player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
mainmemory.writebyte(playerActor + player_fields.JumpCounter, value);
end
end
function Game.getShieldSize(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
return mainmemory.read_s32_be(playerActor + player_fields.ShieldSize);
end
return 0;
end
function Game.getPlayerOSD(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
local positionData = dereferencePointer(playerActor + player_fields.PositionDataPointer);
local character = Game.getCharacter(player);
character = Game.characters[character] or "Unknown ("..toHexString(character)..")";
if isRDRAM(positionData) then
return toHexString(playerActor).."->"..toHexString(positionData)..": "..character;
end
return toHexString(playerActor)..": "..character;
end
return "Not Found";
end
function Game.getXPosition(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
local positionData = dereferencePointer(playerActor + player_fields.PositionDataPointer);
if isRDRAM(positionData) then
return mainmemory.readfloat(positionData + player_fields.PositionData.XPosition, true);
end
end
return 0;
end
function Game.getYPosition(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
local positionData = dereferencePointer(playerActor + player_fields.PositionDataPointer);
if isRDRAM(positionData) then
return mainmemory.readfloat(positionData + player_fields.PositionData.YPosition, true);
end
end
return 0;
end
function Game.getZPosition(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
local positionData = dereferencePointer(playerActor + player_fields.PositionDataPointer);
if isRDRAM(positionData) then
return mainmemory.readfloat(positionData + player_fields.PositionData.ZPosition, true);
end
end
return 0;
end
function Game.setXPosition(value, player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
local positionData = dereferencePointer(playerActor + player_fields.PositionDataPointer);
if isRDRAM(positionData) then
mainmemory.writefloat(positionData + player_fields.PositionData.XPosition, value, true);
end
end
end
function Game.setYPosition(value, player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
Game.setYVelocity(0, player);
local positionData = dereferencePointer(playerActor + player_fields.PositionDataPointer);
if isRDRAM(positionData) then
mainmemory.writefloat(positionData + player_fields.PositionData.YPosition, value, true);
end
end
end
function Game.setZPosition(value, player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
local positionData = dereferencePointer(playerActor + player_fields.PositionDataPointer);
if isRDRAM(positionData) then
mainmemory.writefloat(positionData + player_fields.PositionData.ZPosition, value, true);
end
end
end
function Game.getYRotation(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
return mainmemory.read_s32_be(playerActor + player_fields.FacingDirection) + 1; -- Plus 1 here to make ScriptHawk display 0 and 180 degrees
end
return 0;
end
function Game.getXVelocity(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
return mainmemory.readfloat(playerActor + player_fields.XVelocity, true);
end
return 0;
end
function Game.getYVelocity(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
return mainmemory.readfloat(playerActor + player_fields.YVelocity, true);
end
return 0;
end
function Game.setYVelocity(value, player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
mainmemory.writefloat(playerActor + player_fields.YVelocity, value, true);
end
end
function Game.getBoomerang(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
local projectileObject = dereferencePointer(playerActor + player_fields.BoomerangPointer);
if isRDRAM(projectileObject) then
projectileObject = dereferencePointer(projectileObject + 0x84);
if isRDRAM(projectileObject) then
return dereferencePointer(projectileObject + 0x2C);
end
end
end
end
function Game.getBoomerangOSD(player)
local projectileObject, projectileObject2;
local positionObject = nil;
local timer1 = 0;
local timer2 = 0;
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
projectileObject = dereferencePointer(playerActor + player_fields.BoomerangPointer);
if isRDRAM(projectileObject) then
projectileObject2 = dereferencePointer(projectileObject + 0x84);
if isRDRAM(projectileObject2) then
timer1 = mainmemory.readbyte(projectileObject2 + 0x29D);
timer2 = mainmemory.readbyte(projectileObject2 + 0x29F);
positionObject = dereferencePointer(projectileObject2 + 0x2C);
end
end
end
--return toHexString(projectileObject).."->"..toHexString(projectileObject2).."->"..toHexString(positionObject).." ("..timer1..", "..timer2..")";
return toHexString(positionObject).." ("..timer1..", "..timer2..")";
end
local boomerangState = {
{ prev_position = {x = 0, y = 0}, d = {x = 0, y = 0} },
{ prev_position = {x = 0, y = 0}, d = {x = 0, y = 0} },
{ prev_position = {x = 0, y = 0}, d = {x = 0, y = 0} },
{ prev_position = {x = 0, y = 0}, d = {x = 0, y = 0} },
};
function Game.getBoomerangX(player)
local boomerang = Game.getBoomerang(player);
if isRDRAM(boomerang) then
return mainmemory.readfloat(boomerang + 0x00, true);
end
return 0;
end
function Game.getBoomerangY(player)
local boomerang = Game.getBoomerang(player);
if isRDRAM(boomerang) then
return mainmemory.readfloat(boomerang + 0x04, true);
end
return 0;
end
function Game.getBoomerangDX(player)
if type(player) ~= "number" or player < 1 or player > 4 then
player = 1;
end
return boomerangState[player].d.x;
end
function Game.getBoomerangDY(player)
if type(player) ~= "number" or player < 1 or player > 4 then
player = 1;
end
return boomerangState[player].d.y;
end
local prev_x_vel = 0;
local prev_y_vel = 0;
function Game.colorDX()
local dx = math.abs(ScriptHawk.getDX());
if dx < prev_x_vel then
return colors.red;
elseif dx > prev_x_vel then
return colors.green;
end
prev_x_vel = math.abs(Game.getXVelocity());
end
function Game.colorDY()
local dy = math.abs(ScriptHawk.getDY());
if dy < prev_y_vel then
return colors.red;
elseif dy > prev_y_vel then
return colors.green;
end
prev_y_vel = math.abs(Game.getYVelocity());
end
function Game.unlockEverything()
local value = mainmemory.readbyte(Game.Memory.unlocked_stuff + 3);
value = bit.set(value, 0); -- Luigi Unlock Battle Completed
value = bit.set(value, 1); -- Ness Unlock Battle Completed
value = bit.set(value, 2); -- Captain Falcon Unlock Battle Completed
value = bit.set(value, 3); -- Jigglypuff Unlock Battle Completed
value = bit.set(value, 4); -- Mushroom Kingdom Available
value = bit.set(value, 5); -- Sound Test Unlocked
value = bit.set(value, 6); -- Item Switch Unlocked
mainmemory.writebyte(Game.Memory.unlocked_stuff + 3, value);
value = mainmemory.readbyte(Game.Memory.unlocked_stuff + 4);
value = bit.set(value, 2); -- Jigglypuff Selectable
value = bit.set(value, 3); -- Ness Selectable
mainmemory.writebyte(Game.Memory.unlocked_stuff + 4, value);
value = mainmemory.readbyte(Game.Memory.unlocked_stuff + 5);
value = bit.set(value, 4); -- Luigi Selectable
value = bit.set(value, 7); -- Captain Falcon Selectable
mainmemory.writebyte(Game.Memory.unlocked_stuff + 5, value);
end
function Game.showHitbox(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
mainmemory.write_u32_be(playerActor + player_fields.ShowHitbox, 1);
end
end
function Game.hideHitbox(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
mainmemory.write_u32_be(playerActor + player_fields.ShowHitbox, 0);
end
end
function Game.toggleItemHitboxes(value)
if Game.version == 2 or Game.version == 3 then
return;
end
local firstObj = dereferencePointer(Game.Memory.item_list_pointer);
while isRDRAM(firstObj) do
local secondObj = dereferencePointer(firstObj + 0x84);
if isRDRAM(secondObj) then
mainmemory.write_u32_be(secondObj + Game.Memory.item_hitbox_offset, value);
end
firstObj = dereferencePointer(firstObj + 0x04);
end
end
function Game.dumpObjects()
local firstObj = dereferencePointer(Game.Memory.item_list_pointer);
local i = 0;
while isRDRAM(firstObj) do
local secondObj = dereferencePointer(firstObj + 0x84);
if isRDRAM(secondObj) then
local positionObj = dereferencePointer(secondObj + 0x38);
if isRDRAM(positionObj) then
local objX = mainmemory.readfloat(positionObj + 0, true);
local objY = mainmemory.readfloat(positionObj + 4, true);
dprint(i..": "..toHexString(firstObj).." -> "..toHexString(secondObj).." -> "..toHexString(positionObj).." X: "..objX.." Y: "..objY);
end
end
i = i + 1;
firstObj = dereferencePointer(firstObj + 0x04);
end
if i > 0 then
print_deferred();
end
end
function Game.showHitboxes()
Game.showHitbox(1);
Game.showHitbox(2);
Game.showHitbox(3);
Game.showHitbox(4);
Game.toggleItemHitboxes(1);
end
function Game.hideHitboxes()
Game.hideHitbox(1);
Game.hideHitbox(2);
Game.hideHitbox(3);
Game.hideHitbox(4);
Game.toggleItemHitboxes(0);
end
function Game.setMusic(value)
mainmemory.writebyte(Game.Memory.music, value);
end
function Game.initUI()
if not TASSafe then
-- Unlock Everything Button
ScriptHawk.UI.button(10, 0, {4, 10}, nil, nil, "Unlock Everything", Game.unlockEverything);
-- Hitbox Toggle
ScriptHawk.UI.checkbox(10, 1, "toggle_hitboxes", "Hitboxes");
-- Music
ScriptHawk.UI.form_controls["Music Dropdown"] = forms.dropdown(ScriptHawk.UI.options_form, Game.music, ScriptHawk.UI.col(0) + ScriptHawk.UI.dropdown_offset, ScriptHawk.UI.row(6) + ScriptHawk.UI.dropdown_offset, ScriptHawk.UI.col(9) + 8, ScriptHawk.UI.button_height);
ScriptHawk.UI.checkbox(0, 7, "Music Checkbox", "Set Music");
end
end
function dumpCharacterConstants(player)
local playerActor = Game.getPlayer(player);
if isRDRAM(playerActor) then
local characterConstants = dereferencePointer(playerActor + player_fields.CharacterConstantsPointer);
if isRDRAM(characterConstants) then
local constants = {
CharacterName = Game.characters[Game.getCharacter(player)],
CharacterAddress = toHexString(playerActor),
CharacterConstantsAddress = toHexString(characterConstants),
--
BodySizeMultiplier = mainmemory.readfloat(characterConstants + player_fields.CharacterConstants.BodySizeMultiplier, true),
["UnknownFloat_0x04"] = mainmemory.readfloat(characterConstants + 0x04, true),
["UnknownFloat_0x08"] = mainmemory.readfloat(characterConstants + 0x08, true),
["UnknownFloat_0x0C"] = mainmemory.readfloat(characterConstants + 0x0C, true),
["UnknownFloat_0x1C"] = mainmemory.readfloat(characterConstants + 0x1C, true),
WalkSpeedMultiplier = mainmemory.readfloat(characterConstants + player_fields.CharacterConstants.WalkSpeedMultiplier, true),
BrakeForce = mainmemory.readfloat(characterConstants + player_fields.CharacterConstants.BrakeForce, true),
InitialDashSpeed = mainmemory.readfloat(characterConstants + player_fields.CharacterConstants.InitialDashSpeed, true),
DashDeceleration = mainmemory.readfloat(characterConstants + player_fields.CharacterConstants.DashDeceleration, true),
RunningSpeed = mainmemory.readfloat(characterConstants + player_fields.CharacterConstants.RunningSpeed, true),
JumpFrameDelay = mainmemory.readfloat(characterConstants + player_fields.CharacterConstants.JumpFrameDelay, true),
--0x38 = Starting X-Air Velocity Multiplier after moving before 1st jump (Multiplied by 80)
JumpHeightMultiplier = mainmemory.readfloat(characterConstants + player_fields.CharacterConstants.JumpHeightMultiplier, true),
JumpHeight = mainmemory.readfloat(characterConstants + player_fields.CharacterConstants.JumpHeight, true),
--0x44 = Starting X-Air Velocity Multiplier after moving before 2nd jump (Multiplied by 80)
SecondJumpMultiplier = mainmemory.readfloat(characterConstants + player_fields.CharacterConstants.SecondJumpMultiplier, true),
XAirAcceleration = mainmemory.readfloat(characterConstants + player_fields.CharacterConstants.XAirAcceleration, true),