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/Mission/EggmanSignPost.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: EggmanSignPost Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
// Aliases (As Eggman Watcher)
13
private alias object.value0 : object.eggmanID
14
15
// Aliases (As Sign Post)
16
private alias object.value0 : object.spinCount
17
private alias object.value1 : object.spinTimer
18
// value2 is unused
19
private alias object.value3 : object.landingYPos
20
21
// States
22
private alias 0 : EGGMANSIGNPOST_AWAITEGGMAN
23
private alias 1 : EGGMANSIGNPOST_AWAITDEFEAT
24
private alias 2 : EGGMANSIGNPOST_FALLTOGROUND
25
private alias 3 : EGGMANSIGNPOST_SPINNINGONGROUND
26
private alias 4 : EGGMANSIGNPOST_MISSIONCOMPLETE
27
28
// Eggman Aliases
29
private alias 4 : EGGMAN_EXPLODE
30
31
// Reserved Object Slot Aliases
32
private alias 30 : SLOT_ACTFINISH
33
34
35
// ========================
36
// Events
37
// ========================
38
39
event ObjectUpdate
40
switch object.state
41
case EGGMANSIGNPOST_AWAITEGGMAN
42
foreach (TypeName[Eggman], arrayPos0, ACTIVE_ENTITIES)
43
object.eggmanID = arrayPos0
44
object.state = EGGMANSIGNPOST_AWAITDEFEAT
45
next
46
break
47
48
case EGGMANSIGNPOST_AWAITDEFEAT
49
arrayPos0 = object.eggmanID
50
if object[arrayPos0].state == EGGMAN_EXPLODE
51
stage.timeEnabled = false
52
end if
53
54
if object[arrayPos0].type == TypeName[Blank Object]
55
object.frame = 1
56
object.spinCount = 16
57
object.priority = PRIORITY_XBOUNDS
58
object.landingYPos = object.ypos
59
object.ypos = screen.cameraY
60
object.ypos -= screen.ycenter
61
object.ypos -= 32
62
object.ypos <<= 16
63
screen.cameraEnabled = false
64
object.state = EGGMANSIGNPOST_FALLTOGROUND
65
end if
66
break
67
68
case EGGMANSIGNPOST_FALLTOGROUND
69
object.ypos += object.yvel
70
object.yvel += 0xC00
71
if object.ypos >= object.landingYPos
72
object.ypos = object.landingYPos
73
PlaySfx(SfxName[Sliding], false)
74
object.spinCount = 4
75
object.state = EGGMANSIGNPOST_SPINNINGONGROUND
76
end if
77
78
object.spinTimer++
79
if object.spinTimer == 2
80
object.spinTimer = 0
81
object.frame++
82
if object.frame == 5
83
Rand(temp0, 48)
84
temp0 <<= 16
85
temp0 += object.xpos
86
temp0 -= 0x180000
87
Rand(temp1, 32)
88
temp1 <<= 16
89
temp1 += object.ypos
90
temp1 -= 0x140000
91
CreateTempObject(TypeName[Ring Sparkle], 0, temp0, temp1)
92
end if
93
94
if object.frame == 9
95
object.frame = 1
96
Rand(temp0, 48)
97
temp0 <<= 16
98
temp0 += object.xpos
99
temp0 -= 0x180000
100
Rand(temp1, 32)
101
temp1 <<= 16
102
temp1 += object.ypos
103
temp1 -= 0x140000
104
CreateTempObject(TypeName[Ring Sparkle], 0, temp0, temp1)
105
end if
106
end if
107
break
108
109
case EGGMANSIGNPOST_SPINNINGONGROUND
110
music.volume -= 2
111
object.spinTimer++
112
if object.spinTimer == 2
113
object.spinTimer = 0
114
object.frame++
115
if object.frame == 5
116
Rand(temp0, 48)
117
temp0 <<= 16
118
temp0 += object.xpos
119
temp0 -= 0x180000
120
Rand(temp1, 32)
121
temp1 <<= 16
122
temp1 += object.ypos
123
temp1 -= 0x140000
124
CreateTempObject(TypeName[Ring Sparkle], 0, temp0, temp1)
125
end if
126
127
if object.frame == 9
128
object.frame = 1
129
Rand(temp0, 48)
130
temp0 <<= 16
131
temp0 += object.xpos
132
temp0 -= 0x180000
133
Rand(temp1, 32)
134
temp1 <<= 16
135
temp1 += object.ypos
136
temp1 -= 0x140000
137
CreateTempObject(TypeName[Ring Sparkle], 0, temp0, temp1)
138
object.spinCount--
139
if object.spinCount == 0
140
object.frame = 5
141
object.state = EGGMANSIGNPOST_MISSIONCOMPLETE
142
end if
143
end if
144
end if
145
break
146
147
case EGGMANSIGNPOST_MISSIONCOMPLETE
148
CallNativeFunction2(NotifyCallback, NOTIFY_TOUCH_SIGNPOST, 0)
149
object[SLOT_ACTFINISH].type = TypeName[Act Finish]
150
object[SLOT_ACTFINISH].drawOrder = 6
151
object[SLOT_ACTFINISH].priority = PRIORITY_ACTIVE
152
break
153
154
end switch
155
end event
156
157
158
event ObjectDraw
159
if object.state > EGGMANSIGNPOST_AWAITDEFEAT
160
DrawSprite(0)
161
DrawSprite(object.frame)
162
end if
163
end event
164
165
166
event ObjectStartup
167
LoadSpriteSheet("Global/Items2.gif")
168
SpriteFrame(-24, 16, 48, 16, 34, 214)
169
SpriteFrame(-24, -16, 48, 32, 34, 182)
170
SpriteFrame(-16, -16, 32, 32, 1, 150)
171
SpriteFrame(-4, -16, 8, 32, 189, 131)
172
SpriteFrame(-16, -16, 32, 32, 1, 183)
173
SpriteFrame(-24, -16, 48, 32, 34, 83)
174
SpriteFrame(-16, -16, 32, 32, 1, 150)
175
SpriteFrame(-4, -16, 8, 32, 189, 131)
176
SpriteFrame(-16, -16, 32, 32, 1, 183)
177
end event
178
179
180
// ========================
181
// Editor Events
182
// ========================
183
184
event RSDKDraw
185
DrawSprite(0)
186
end event
187
188
189
event RSDKLoad
190
LoadSpriteSheet("Global/Items2.gif")
191
SpriteFrame(-24, 16, 48, 16, 34, 214)
192
SpriteFrame(-24, -16, 48, 32, 34, 182)
193
194
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
195
end event
196
197