Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R3/NoGripArea.txt
1319 views
1
//----------------Sonic CD No Grip Area Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// ========================
6
// Aliases
7
// ========================
8
9
#alias Object.Value0 : Object.PrevActive // (If this object was active last frame)
10
11
// Ink Effect Aliases
12
#alias 2 : INK_ALPHA
13
14
15
// ========================
16
// Subs
17
// ========================
18
19
sub ObjectPlayerInteraction
20
if Object.PrevActive == false
21
PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)
22
if CheckResult == true
23
if Player.Animation == ANI_CLIMBING
24
// If Knuckles is already climbing, let's make him drop from the wall
25
CallFunction(Player_Unstick)
26
end if
27
28
if Player.Animation == ANI_GLIDING
29
// On the other hand, if he's gliding instead, then let's make sure he isn't going to be able to climb here
30
Object.PrevActive = true
31
CallFunction(Player_ForceNoGrip)
32
end if
33
end if
34
else
35
PlayerObjectCollision(C_TOUCH, -16, -16, 16, 32) // (note the larger hitbox downwards, compared to the normal version)
36
if CheckResult == false
37
Object.PrevActive = false
38
39
// Before allowing Knuckles to climb again, let's make sure he isn't interacting with any other NoGripAreas, either
40
TempValue0 = false
41
ArrayPos0 = 32
42
while ArrayPos0 < 1056
43
if Object[ArrayPos0].Type == TypeName[NoGripArea]
44
if Object[ArrayPos0].PrevActive == true
45
TempValue0 = true
46
end if
47
end if
48
49
ArrayPos0++
50
loop
51
52
if TempValue0 == false
53
CallFunction(Player_ForceGrip)
54
end if
55
end if
56
end if
57
end sub
58
59
60
sub ObjectDraw
61
// They included a debug vis for this object, how cool!
62
if Stage.DebugMode == true
63
TempValue0 = Object.iXPos
64
TempValue0 -= 16
65
TempValue0 -= Screen.XOffset
66
TempValue1 = Object.iYPos
67
TempValue1 -= 16
68
TempValue1 -= Screen.YOffset
69
if Object.PrevActive == true
70
DrawRect(TempValue0, TempValue1, 32, 48, 0, 96, 48, 255)
71
else
72
DrawRect(TempValue0, TempValue1, 32, 32, 0, 96, 48, 255)
73
end if
74
end if
75
end sub
76
77
// ========================
78
// Editor Subs
79
// ========================
80
81
sub RSDKDraw
82
TempValue0 = Object.XPos
83
TempValue0 -= 0x100000
84
TempValue1 = Object.YPos
85
TempValue1 -= 0x100000
86
87
// In the actual game, the object draws in debug mode as a solid color rectangle
88
// Here, let's have an Alpha of 128 in the editor so you can see through it
89
DrawRectWorld(TempValue0, TempValue1, 32, 32, 0, 96, 48, 128)
90
91
Object.InkEffect = INK_ALPHA
92
Object.Alpha = 1
93
DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)
94
end sub
95
96
sub RSDKLoad
97
LoadSpriteSheet("Global/Display.gif")
98
SpriteFrame(-16, -16, 32, 32, 1, 143)
99
100
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
101
end sub
102
103