Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R7/R7Spring.txt
1319 views
1
//-----------------Sonic CD R7 Spring Script------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Timer
7
8
9
sub ObjectDraw
10
if Object.Timer == 0
11
// Inactive spring, draw whatever the normal frame should be
12
DrawSpriteFX(Object.PropertyValue, FX_FLIP, Object.XPos, Object.YPos)
13
else
14
Object.Timer++
15
16
TempValue0 = Object.Timer
17
TempValue0 >>= 1
18
19
switch TempValue0
20
case 0
21
case 1
22
// Display the normal frame
23
DrawSpriteFX(Object.PropertyValue, FX_FLIP, Object.XPos, Object.YPos)
24
break
25
26
case 2
27
case 6
28
// Display the recoil frame
29
TempValue1 = Object.PropertyValue
30
TempValue1 += 8
31
DrawSpriteFX(TempValue1, FX_FLIP, Object.XPos, Object.YPos)
32
break
33
34
case 3
35
case 4
36
case 5
37
// Display the launch frame
38
TempValue1 = Object.PropertyValue
39
TempValue1 += 16
40
DrawSpriteFX(TempValue1, FX_FLIP, Object.XPos, Object.YPos)
41
break
42
43
end switch
44
45
if Object.Timer > 12
46
// Only 12 frames of animation, go back to normal after that
47
Object.Timer = 0
48
end if
49
end if
50
51
end sub
52
53
54
sub ObjectStartup
55
56
// Load the normal Springs Items sheet
57
LoadSpriteSheet("Global/Items.gif")
58
59
// Spring Frames
60
// They're the same as the normal Red Spring sprites, just with different offsets
61
62
// Idle Frames
63
SpriteFrame(-16, -16, 32, 16, 84, 1)
64
SpriteFrame(0, -16, 16, 32, 117, 1)
65
SpriteFrame(-16, -16, 16, 32, 175, 1)
66
SpriteFrame(-16, 0, 32, 16, 84, 59)
67
SpriteFrame(-8, -24, 32, 32, 84, 117)
68
SpriteFrame(-24, -24, 32, 32, 117, 165)
69
SpriteFrame(-8, -24, 32, 32, 84, 117)
70
SpriteFrame(-24, -24, 32, 32, 117, 165)
71
72
// Recoil Frames
73
SpriteFrame(-16, -8, 32, 8, 84, 1)
74
SpriteFrame(0, -16, 8, 32, 125, 1)
75
SpriteFrame(-8, -16, 8, 32, 175, 1)
76
SpriteFrame(-16, 0, 32, 8, 84, 67)
77
SpriteFrame(-8, -24, 32, 32, 84, 150)
78
SpriteFrame(-24, -24, 32, 32, 150, 165)
79
SpriteFrame(-8, -24, 32, 32, 84, 150)
80
SpriteFrame(-24, -24, 32, 32, 150, 165)
81
82
// Launch Frames
83
SpriteFrame(-16, -40, 32, 40, 84, 18)
84
SpriteFrame(0, -16, 40, 32, 134, 1)
85
SpriteFrame(-24, -16, 40, 32, 192, 1)
86
SpriteFrame(-16, 0, 32, 40, 84, 76)
87
SpriteFrame(-8, -40, 48, 48, 117, 34)
88
SpriteFrame(-40, -40, 48, 48, 166, 34)
89
SpriteFrame(-8, -40, 48, 48, 117, 34)
90
SpriteFrame(-40, -40, 48, 48, 166, 34)
91
92
end sub
93
94
95
// ========================
96
// Editor Subs
97
// ========================
98
99
sub RSDKDraw
100
TempValue0 = 0
101
102
// If the last object is a Spring Cage, then try and match its direction
103
// TODO: change this to "Spring Cage" once GetObjectType works with spaces
104
GetObjectType(TempValue1, "SpringCage")
105
if Object[-1].Type == TempValue1
106
switch Object[-1].PropertyValue
107
case 0
108
TempValue0 = 0; break
109
case 1
110
TempValue0 = 2; break
111
case 3
112
TempValue0 = 4; break
113
case 2 // shouldn't be here, but just in case
114
case 4
115
TempValue0 = 0; break
116
case 5
117
TempValue0 = 5; break
118
case 6
119
TempValue0 = 1; break
120
end switch
121
end if
122
123
DrawSprite(TempValue0)
124
end sub
125
126
127
sub RSDKLoad
128
LoadSpriteSheet("Global/Items.gif")
129
SpriteFrame(-16, -16, 32, 16, 84, 1)
130
SpriteFrame(0, -16, 16, 32, 117, 1)
131
SpriteFrame(-16, -16, 16, 32, 175, 1)
132
SpriteFrame(-16, 0, 32, 16, 84, 59)
133
SpriteFrame(-8, -24, 32, 32, 84, 117)
134
SpriteFrame(-24, -24, 32, 32, 117, 165)
135
SpriteFrame(-8, -24, 32, 32, 84, 117)
136
SpriteFrame(-24, -24, 32, 32, 117, 165)
137
138
// Although used by the object, it shouldn't be used here
139
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
140
end sub
141
142