Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 1/Scripts/MZ/GrassFireball.txt
1482 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Grass Fireball Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
private alias object.value0 : object.timer
13
private alias object.value1 : object.parentSlot
14
private alias object.value2 : object.platformPos
15
private alias object.value3 : object.parentType
16
private alias object.value4 : object.spawnLimit
17
18
private alias 0 : GRASSFIREBALL_SETUP
19
private alias 1 : GRASSFIREBALL_MOVING
20
private alias 2 : GRASSFIREBALL_IDLE
21
22
// Large Platform Aliases
23
private alias object.value1 : largePlatform.drawPos.y
24
private alias object.value3 : largePlatform.spawnedFireballs
25
26
private alias 0 : LARGEPLATFORM_TYPE_ARCH
27
private alias 1 : LARGEPLATFORM_TYPE_CURVE
28
private alias 2 : LARGEPLATFORM_TYPE_RECT
29
30
// ========================
31
// Static Values
32
// ========================
33
34
// ========================
35
// Tables
36
// ========================
37
38
event ObjectUpdate
39
switch object.state
40
case GRASSFIREBALL_SETUP
41
temp0 = object.platformPos
42
temp0 >>= 1
43
switch object.parentType
44
case LARGEPLATFORM_TYPE_ARCH
45
GetTableValue(object.ypos, temp0, LargePlatform_heightTableArch)
46
object.ypos <<= 16
47
object.spawnLimit = 7
48
break
49
50
case LARGEPLATFORM_TYPE_CURVE
51
GetTableValue(object.ypos, temp0, LargePlatform_heightTableCurved)
52
object.ypos <<= 16
53
object.spawnLimit = 7
54
break
55
56
case LARGEPLATFORM_TYPE_RECT
57
object.ypos = -0x300000
58
object.spawnLimit = 3
59
break
60
61
end switch
62
63
arrayPos0 = object.parentSlot
64
object.ypos += largePlatform[arrayPos0].drawPos.y
65
if object.propertyValue == 0
66
CreateTempObject(TypeName[Grass Fireball], object.propertyValue, object.xpos, object.ypos)
67
object[tempObjectPos].propertyValue++
68
object[tempObjectPos].parentSlot = object.parentSlot
69
object[tempObjectPos].drawOrder = 5
70
object[tempObjectPos].platformPos = object.platformPos
71
object[tempObjectPos].parentType = object.parentType
72
object[tempObjectPos].spawnLimit = object.spawnLimit
73
object[tempObjectPos].state = GRASSFIREBALL_MOVING
74
object[tempObjectPos].animationTimer = object.animationTimer
75
object.animationTimer = 0
76
object.state = GRASSFIREBALL_IDLE
77
PlaySfx(SfxName[Fire Burn], false)
78
else
79
object.state++
80
end if
81
break
82
83
case GRASSFIREBALL_MOVING
84
object.timer++
85
object.xpos += 0x10000
86
object.platformPos++
87
temp0 = object.platformPos
88
temp0 >>= 1
89
switch object.parentType
90
case LARGEPLATFORM_TYPE_ARCH
91
GetTableValue(object.ypos, temp0, LargePlatform_heightTableArch)
92
object.ypos <<= 16
93
break
94
95
case LARGEPLATFORM_TYPE_CURVE
96
GetTableValue(object.ypos, temp0, LargePlatform_heightTableCurved)
97
object.ypos <<= 16
98
break
99
100
case LARGEPLATFORM_TYPE_RECT
101
object.ypos = -0x300000
102
break
103
104
end switch
105
106
arrayPos0 = object.parentSlot
107
object.ypos += largePlatform[arrayPos0].drawPos.y
108
if object.timer == 16
109
object.state++
110
if object.propertyValue < object.spawnLimit
111
CreateTempObject(TypeName[Grass Fireball], object.propertyValue, object.xpos, object.ypos)
112
object[tempObjectPos].propertyValue++
113
object[tempObjectPos].parentSlot = object.parentSlot
114
object[tempObjectPos].drawOrder = 5
115
object[tempObjectPos].platformPos = object.platformPos
116
object[tempObjectPos].parentType = object.parentType
117
object[tempObjectPos].spawnLimit = object.spawnLimit
118
if object.propertyValue == 7
119
object[tempObjectPos].state = GRASSFIREBALL_IDLE
120
else
121
object[tempObjectPos].state = GRASSFIREBALL_MOVING
122
end if
123
object[tempObjectPos].animationTimer = object.animationTimer
124
object.animationTimer = 0
125
PlaySfx(SfxName[Fire Burn], false)
126
end if
127
end if
128
break
129
130
case GRASSFIREBALL_IDLE
131
temp0 = object.platformPos
132
temp0 >>= 1
133
switch object.parentType
134
case LARGEPLATFORM_TYPE_ARCH
135
GetTableValue(object.ypos, temp0, LargePlatform_heightTableArch)
136
object.ypos <<= 16
137
break
138
139
case LARGEPLATFORM_TYPE_CURVE
140
GetTableValue(object.ypos, temp0, LargePlatform_heightTableCurved)
141
object.ypos <<= 16
142
break
143
144
case LARGEPLATFORM_TYPE_RECT
145
object.ypos = -0x300000
146
break
147
148
end switch
149
arrayPos0 = object.parentSlot
150
object.ypos += largePlatform[arrayPos0].drawPos.y
151
break
152
153
end switch
154
155
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
156
BoxCollisionTest(C_TOUCH, object.entityPos, -6, -14, 6, 14, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
157
if checkResult == true
158
CallFunction(Player_FireHit)
159
end if
160
next
161
162
object.frame = object.animationTimer
163
object.frame /= 12
164
object.direction = object.animationTimer
165
object.direction /= 6
166
object.direction &= 1
167
object.animationTimer++
168
object.animationTimer %= 24
169
170
arrayPos0 = object.parentSlot
171
if object[arrayPos0].outOfBounds == true
172
object.type = TypeName[Blank Object]
173
largePlatform[arrayPos0].spawnedFireballs = false
174
end if
175
end event
176
177
178
event ObjectDraw
179
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
180
end event
181
182
183
event ObjectStartup
184
LoadSpriteSheet("MZ/Objects.gif")
185
SpriteFrame(-7, -23, 15, 31, 52, 114)
186
SpriteFrame(-8, -24, 16, 32, 68, 114)
187
end event
188
189
190
event RSDKDraw
191
DrawSprite(0)
192
end event
193
194
195
event RSDKLoad
196
LoadSpriteSheet("MZ/Objects.gif")
197
SpriteFrame(-7, -23, 15, 31, 52, 114)
198
199
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
200
end event
201
202