Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R3/Blade.txt
1319 views
1
//--------------Sonic CD Kama Kama Blade Script---------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.XVelocity
7
#alias Object.Value1 : Object.YVelocity
8
#alias Object.Value2 : Object.KamaKamaEntityNo
9
#alias Object.PropertyValue : Object.LaunchTimer
10
11
// States
12
#alias 0 : BLADE_LAUNCH
13
#alias 1 : BLADE_BLANK
14
#alias 2 : BLADE_DEFLECTED
15
16
// Stage SFX
17
#alias 5 : SFX_S_BLADES
18
19
20
sub ObjectMain
21
Object.XPos += Object.XVelocity
22
Object.YPos += Object.YVelocity
23
24
Object.Frame++
25
Object.Frame %= 24
26
27
switch Object.State
28
case BLADE_LAUNCH
29
ArrayPos0 = Object.KamaKamaEntityNo
30
// if the Kama Kama that launched this is destroyed, destroy the blade
31
if Object[ArrayPos0].Type != TypeName[Kama Kama]
32
Object.Type = TypeName[Blank Object]
33
end if
34
35
if Object.LaunchTimer > 0
36
Object.LaunchTimer--
37
else
38
Object.State = BLADE_BLANK
39
PlayStageSfx(SFX_S_BLADES, false)
40
if Object.Direction == FACING_RIGHT
41
Object.XVelocity = -0x30000
42
else
43
Object.XVelocity = 0x30000
44
end if
45
end if
46
break
47
48
case BLADE_DEFLECTED
49
Object.YVelocity += 0x3000
50
break
51
52
end switch
53
54
if Object.OutOfBounds == true
55
Object.Type = TypeName[Blank Object]
56
else
57
TempValue0 = Screen.YOffset
58
TempValue0 -= 8
59
TempValue0 <<= 16
60
if Object.YPos < TempValue0
61
Object.Type = TypeName[Blank Object]
62
end if
63
64
end if
65
end sub
66
67
68
sub ObjectPlayerInteraction
69
if Object.State == BLADE_BLANK
70
PlayerObjectCollision(C_TOUCH, -8, -6, 8, 6)
71
if CheckResult == true
72
// Check if the blades will bounce on the player
73
CheckEqual(Player.Animation, ANI_JUMPING)
74
TempValue0 = CheckResult
75
CheckEqual(Player.Animation, ANI_SPINDASH)
76
TempValue0 |= CheckResult
77
78
if TempValue0 == true
79
Object.State = BLADE_DEFLECTED
80
81
Object.YVelocity = -0x80000
82
if Object.Direction == FACING_RIGHT
83
if Player.XVelocity > 0x8000
84
FlipSign(Object.XVelocity)
85
end if
86
else
87
if Player.XVelocity < -0x8000
88
FlipSign(Object.XVelocity)
89
end if
90
end if
91
else
92
CallFunction(Player_Hit)
93
end if
94
end if
95
end if
96
end sub
97
98
99
sub ObjectDraw
100
TempValue0 = Object.Frame
101
TempValue0 >>= 2
102
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
103
end sub
104
105
106
sub ObjectStartup
107
LoadSpriteSheet("R3/Objects.gif")
108
109
SpriteFrame(-8, -8, 16, 16, 198, 68) // #0 - Blade Frame 0
110
SpriteFrame(-8, -8, 16, 16, 215, 68) // #1 - Blade Frame 1
111
SpriteFrame(-8, -8, 16, 16, 232, 68) // #2 - Blade Frame 2
112
SpriteFrame(-8, -8, 16, 16, 198, 85) // #3 - Blade Frame 3
113
SpriteFrame(-8, -8, 16, 16, 215, 85) // #4 - Blade Frame 4
114
SpriteFrame(-8, -8, 16, 16, 232, 85) // #5 - Blade Frame 5
115
end sub
116
117
118
// ========================
119
// Editor Subs
120
// ========================
121
122
sub RSDKDraw
123
DrawSprite(0)
124
end sub
125
126
127
sub RSDKLoad
128
LoadSpriteSheet("R3/Objects.gif")
129
130
SpriteFrame(-8, -8, 16, 16, 198, 68) // #0 - Blade
131
132
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
133
end sub
134
135