Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/Continue/Continue.txt
1479 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Continue Screen 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.timerSeconds
13
private alias object.value1 : object.timerFrames
14
15
private alias 1 : STATE_COUNTING
16
17
// Continue Setup states
18
private alias 2 : CONTINUE_DISPLAY
19
private alias 4 : CONTINUE_RUN
20
private alias 6 : CONTINUE_TIMEDOUT
21
22
23
// ========================
24
// Events
25
// ========================
26
27
event ObjectUpdate
28
if object.state == STATE_COUNTING
29
object.timerFrames--
30
31
if object.timerFrames <= 0
32
if object.timerSeconds == 0
33
// Make this object stop counting
34
object.state++
35
36
// Tell the main object that time is up
37
object[+1].state = CONTINUE_TIMEDOUT
38
else
39
// Time's not up yet, progress to the next second
40
object.timerSeconds--
41
object.timerFrames = 60
42
end if
43
end if
44
end if
45
end event
46
47
48
event ObjectDraw
49
// Draw the constant sprites ("Continue" & stars)
50
DrawSprite(0)
51
DrawSprite(1)
52
53
// Draw the countdown
54
temp0 = object.xpos
55
temp0 >>= 16
56
DrawNumbers(2, temp0, 126, object.timerSeconds, 2, 8, true)
57
58
// Draw the continue line of mini-Sonics
59
60
// First find the base X pos to draw them at
61
temp0 = player.continues
62
temp1 = temp0
63
temp0 -= 2
64
temp0 *= 21
65
temp0 >>= 1
66
FlipSign(temp0)
67
temp0 += screen.xcenter
68
69
// Then get the sprite to use
70
GetBit(object.frame, oscillation, 4)
71
object.frame += 12
72
73
temp3 = true
74
75
// (temp1 is number of mini-Sonics to draw)
76
while temp1 > 1
77
temp2 = true
78
79
if temp3 == true
80
temp3 = false
81
if object[+1].state >= CONTINUE_RUN
82
if object[+1].state != CONTINUE_TIMEDOUT
83
// Don't draw
84
temp2 = false
85
end if
86
else
87
if object[+1].state > CONTINUE_DISPLAY
88
// Flash
89
GetBit(temp2, oscillation, 0)
90
end if
91
end if
92
end if
93
94
if temp2 == true
95
DrawSpriteScreenXY(object.frame, temp0, 100)
96
end if
97
98
temp0 += 21
99
temp1--
100
loop
101
end event
102
103
104
event ObjectStartup
105
LoadSpriteSheet("Continue/Objects.gif")
106
107
// #0 - "CONTINUE" text
108
SpriteFrame(-59, 64, 119, 16, 1, 1)
109
110
// #1 - Stars
111
SpriteFrame(-21, 128, 41, 9, 1, 42)
112
113
// #2 -> #11 - Numbers
114
SpriteFrame(0, 0, 8, 11, 1, 52)
115
SpriteFrame(0, 0, 8, 11, 10, 52)
116
SpriteFrame(0, 0, 8, 11, 19, 52)
117
SpriteFrame(0, 0, 8, 11, 28, 52)
118
SpriteFrame(0, 0, 8, 11, 37, 52)
119
SpriteFrame(0, 0, 8, 11, 46, 52)
120
SpriteFrame(0, 0, 8, 11, 55, 52)
121
SpriteFrame(0, 0, 8, 11, 64, 52)
122
SpriteFrame(0, 0, 8, 11, 73, 52)
123
SpriteFrame(0, 0, 8, 11, 82, 52)
124
125
// Character icons are dependant on the main player
126
switch stage.playerListPos
127
case PLAYER_SONIC_A
128
case PLAYER_SONIC_TAILS_A
129
// #12 -> #13 - Sonic foot tapping
130
SpriteFrame(-8, -11, 16, 23, 1, 18)
131
SpriteFrame(-8, -11, 16, 23, 18, 18)
132
break
133
134
case PLAYER_TAILS_A
135
// #12 -> #13 - Tails tapping his foot
136
SpriteFrame(-8, -11, 16, 23, 35, 18)
137
SpriteFrame(-8, -11, 16, 23, 52, 18)
138
break
139
140
case PLAYER_KNUCKLES_A
141
#platform: USE_ORIGINS
142
case PLAYER_KNUCKLES_TAILS_A
143
#endplatform
144
// #12 -> #13 - Knuckles tapping his foot (he has a hole in his feet!)
145
SpriteFrame(-8, -11, 16, 23, 69, 18)
146
SpriteFrame(-8, -11, 16, 23, 86, 18)
147
break
148
149
#platform: USE_ORIGINS
150
case PLAYER_AMY_A
151
case PLAYER_AMY_TAILS_A
152
// #12 -> #13 - Amy tapping her foot
153
SpriteFrame(-8, -11, 17, 22, 103, 18)
154
SpriteFrame(-8, -11, 17, 22, 103, 41)
155
break
156
#endplatform
157
end switch
158
159
foreach (TypeName[Continue Screen], arrayPos0, ALL_ENTITIES)
160
object[arrayPos0].drawOrder = 5
161
object[arrayPos0].xpos = screen.xcenter
162
object[arrayPos0].xpos <<= 16
163
object[arrayPos0].ypos = 0
164
object[arrayPos0].timerSeconds = 10
165
object[arrayPos0].timerFrames = 60
166
next
167
end event
168
169
170
// ========================
171
// Editor Events
172
// ========================
173
174
event RSDKDraw
175
DrawSprite(0)
176
end event
177
178
179
event RSDKLoad
180
LoadSpriteSheet("Continue/Objects.gif")
181
SpriteFrame(-59, 64, 119, 16, 1, 1)
182
183
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
184
end event
185
186