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/Ending/Emeralds.txt
1481 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Emeralds 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.radius
14
15
// States
16
private alias 0 : EMERALDS_ASCEND
17
private alias 1 : EMERALDS_SPIN
18
19
// Ending Pose Aliases
20
private alias 9 : ENDINGPOSE_EMERALDSFLASH_B
21
22
23
// ========================
24
// Tables
25
// ========================
26
27
private table Emeralds_throwAngles6
28
0
29
0, 85, 171, 256, 341, 427
30
end table
31
32
private table Emeralds_throwAngles7
33
0
34
0, 73, 146, 219, 293, 365, 438
35
end table
36
37
38
// ========================
39
// Events
40
// ========================
41
42
event ObjectUpdate
43
switch object.state
44
case EMERALDS_ASCEND
45
object.ypos -= 0x10000
46
object.timer++
47
if object.timer == 112
48
object.timer = 0
49
object.state++
50
end if
51
break
52
53
case EMERALDS_SPIN
54
if object.speed == 512
55
// Increase P1's Ending Pose state to what should hopefully be ENDINGPOSE_EMERALDSFLASH_A
56
object[0].state++
57
end if
58
59
// Once the screen is completely white, take that time to unload the object
60
if object[0].state == ENDINGPOSE_EMERALDSFLASH_B
61
object.type = TypeName[Blank Object]
62
end if
63
break
64
65
end switch
66
67
if object.radius < 0x1000
68
object.radius += 16
69
end if
70
71
if object.speed < 0x400
72
object.speed += 2
73
end if
74
75
object.angle += object.speed
76
object.rotation = object.angle
77
object.rotation >>= 4
78
end event
79
80
81
event ObjectDraw
82
if specialStage.emeralds == 0x3F // If the Player has 6 emeralds
83
temp0 = 6
84
else
85
temp0 = 7
86
end if
87
88
while temp0 > 0
89
if specialStage.emeralds == 0x3F // (Six emeralds check again)
90
GetTableValue(temp3, temp0, Emeralds_throwAngles6)
91
else
92
GetTableValue(temp3, temp0, Emeralds_throwAngles7)
93
end if
94
temp3 += object.rotation
95
96
Cos(temp1, temp3)
97
temp1 *= object.radius
98
temp1 += object.xpos
99
100
Sin(temp2, temp3)
101
temp2 *= object.radius
102
temp2 += object.ypos
103
104
DrawSpriteXY(temp0, temp1, temp2)
105
temp0--
106
loop
107
end event
108
109
110
event ObjectStartup
111
LoadSpriteSheet("Ending/Objects.gif")
112
113
SpriteFrame(-6, -6, 12, 12, 1, 1) // 0 - White emerald flash frame
114
115
SpriteFrame(-6, -6, 12, 12, 14, 1) // 1 - Blue emerald
116
SpriteFrame(-6, -6, 12, 12, 27, 1) // 2 - Orange emerald
117
118
if options.superStates == false
119
SpriteFrame(-6, -6, 12, 12, 40, 1) // 3 - Pink emerald
120
else
121
SpriteFrame(-6, -6, 12, 12, 105, 1) // 3 - Purple emerald
122
end if
123
124
SpriteFrame(-6, -6, 12, 12, 53, 1) // 4 - Green emerald
125
SpriteFrame(-6, -6, 12, 12, 66, 1) // 5 - Red emerald
126
SpriteFrame(-6, -6, 12, 12, 79, 1) // 6 - Grey emerald
127
SpriteFrame(-6, -6, 12, 12, 92, 1) // 7 - Light blue emerald
128
129
// The dark orange emerald at (118, 1) is unused
130
end event
131
132
133
// ========================
134
// Editor Events
135
// ========================
136
137
event RSDKDraw
138
DrawSprite(0)
139
end event
140
141
142
event RSDKLoad
143
LoadSpriteSheet("Ending/Objects.gif")
144
SpriteFrame(-6, -6, 12, 12, 1, 1)
145
146
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
147
end event
148
149