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/Title/KLogo.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: K Logo 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.frame : object.knuxFrame
13
14
private alias object.value0 : object.timer
15
private alias object.value1 : object.knuxPos.x
16
private alias object.value2 : object.knuxPos.y
17
private alias object.value3 : object.levelSelectCheatPos // not used in this script, used in "STLogo_CheckButtonCheatCodes"
18
private alias object.value4 : object.regionSwitchCheatPos // not used in this script, used in "STLogo_CheckButtonCheatCodes"
19
private alias object.value5 : object.handFrame
20
private alias object.value6 : object.handPos.x
21
private alias object.value7 : object.handPos.y
22
private alias object.value8 : object.knuxInPos.y
23
24
// States
25
private alias 0 : KLOGO_SETUP
26
private alias 1 : KLOGO_FADEIN
27
private alias 2 : KLOGO_SHOWEMBLEM
28
private alias 3 : KLOGO_ENTERKNUX
29
private alias 4 : KLOGO_KNUXANIMATE
30
private alias 5 : KLOGO_ENTERHAND
31
private alias 6 : KLOGO_HANDANIMATE
32
private alias 7 : KLOGO_FINISHHANDANIM
33
private alias 8 : KLOGO_MOVEKNUXINTOPLACE
34
private alias 9 : KLOGO_MOVEHAND2
35
private alias 10 : KLOGO_HANDANIMATE2
36
private alias 11 : KLOGO_FINISHHANDANIM2
37
private alias 12 : KLOGO_ENTERKNUXIN
38
private alias 13 : KLOGO_FINISHEDANIMS
39
40
// ShootingStar Aliases
41
private alias object.value0 : shootingStar.delay
42
43
// Game Modes
44
private alias 0 : MODE_NOSAVE
45
46
47
// ========================
48
// Events
49
// ========================
50
51
event ObjectUpdate
52
if options.gameMode == MODE_NOSAVE
53
if object.state > KLOGO_SHOWEMBLEM
54
CallFunction(STLogo_CheckButtonCheatCodes)
55
end if
56
end if
57
58
switch object.state
59
case KLOGO_SETUP
60
if object.timer == 30
61
object[+1].type = TypeName[Twinkle Stars]
62
object[+1].priority = PRIORITY_ACTIVE
63
end if
64
65
if object.timer < 60
66
object.timer++
67
else
68
object.timer = 0
69
object.alpha = 256
70
stage.player2Enabled = false
71
object.state++
72
end if
73
break
74
75
case KLOGO_FADEIN
76
if object.alpha > 0
77
object.alpha -= 8
78
else
79
object.state++
80
end if
81
break
82
83
case KLOGO_SHOWEMBLEM
84
if object.timer < 32
85
object.timer++
86
else
87
object.timer = 0
88
object.knuxPos.x = -0x2C0000
89
object.knuxPos.x += object.xpos
90
object.knuxPos.y = -0x160000
91
object.knuxPos.y += object.ypos
92
object.knuxFrame = 2
93
PlayMusic(0)
94
object.state++
95
end if
96
break
97
98
case KLOGO_ENTERKNUX
99
object.knuxPos.y -= 0x80000
100
if object.knuxPos.y <= 0x1A0000
101
object.state++
102
end if
103
104
if object.knuxPos.y == 0x3A0000
105
object.knuxFrame++
106
object.handFrame = 8
107
object.handPos.x = -0x2C0000
108
object.handPos.x += object.xpos
109
object.handPos.y = -0x2E0000
110
object.handPos.y += object.ypos
111
end if
112
break
113
114
case KLOGO_KNUXANIMATE
115
object.timer++
116
if object.timer == 8
117
object.knuxFrame++
118
if object.knuxFrame >= 7
119
object.knuxFrame = 7
120
object.state++
121
end if
122
object.timer = 0
123
end if
124
break
125
126
case KLOGO_ENTERHAND
127
object.handPos.y -= 0x10000
128
object.timer++
129
if object.timer == 4
130
object.timer = 0
131
object.state++
132
end if
133
break
134
135
case KLOGO_HANDANIMATE
136
object.timer++
137
if object.timer == 4
138
object.timer = 0
139
object.handFrame++
140
if object.handFrame == 13
141
object.handFrame = 8
142
object.state++
143
end if
144
end if
145
break
146
147
case KLOGO_FINISHHANDANIM
148
object.handPos.y += 0x10000
149
150
object.timer++
151
if object.timer == 4
152
object.timer = 0
153
object.state++
154
end if
155
break
156
157
case KLOGO_MOVEKNUXINTOPLACE
158
object.yvel += 0x4000
159
object.ypos += object.yvel
160
161
object.knuxPos.y += object.yvel
162
object.handPos.y += object.yvel
163
if object.yvel > 0
164
if object.ypos >= 0x900000
165
object.yvel >>= 1
166
temp0 = object.yvel
167
temp0 >>= 1
168
object.yvel += temp0
169
object.timer++
170
if object.timer != 3
171
FlipSign(object.yvel)
172
else
173
object.timer = 0
174
object.yvel = 0
175
stage.activeLayer[0] = 2 // Show Title BG
176
object.alpha = 0x100
177
object.state++
178
end if
179
end if
180
end if
181
break
182
183
case KLOGO_MOVEHAND2
184
object.handPos.y -= 0x10000
185
186
object.timer++
187
if object.timer == 4
188
object.timer = 0
189
object.state++
190
end if
191
192
if object.alpha > 0
193
object.alpha -= 12
194
end if
195
break
196
197
case KLOGO_HANDANIMATE2
198
object.timer++
199
if object.timer == 4
200
object.timer = 0
201
object.handFrame++
202
if object.handFrame == 13
203
object.handFrame = 8
204
object.state++
205
end if
206
end if
207
208
if object.alpha > 0
209
object.alpha -= 12
210
end if
211
break
212
213
case KLOGO_FINISHHANDANIM2
214
if object.timer < 4
215
object.handPos.y += 0x10000
216
217
object.timer++
218
if object.alpha > 0
219
object.alpha -= 12
220
end if
221
else
222
if object.alpha > 0
223
object.alpha -= 12
224
else
225
object.timer = 0
226
object.state++
227
228
object[+1].type = TypeName[Start Message]
229
object[+1].priority = PRIORITY_ACTIVE
230
object[+1].xpos = screen.xcenter
231
object[+1].ypos = 200
232
233
CreateTempObject(TypeName[Shooting Star], 0, object.xpos, object.ypos)
234
object[tempObjectPos].drawOrder = 2
235
object[tempObjectPos].xpos += 0x1600000
236
object[tempObjectPos].ypos -= 0x1000000
237
shootingStar[tempObjectPos].delay = 150
238
end if
239
end if
240
break
241
242
case KLOGO_ENTERKNUXIN
243
object.yvel += 0x4000
244
object.knuxInPos.y += object.yvel
245
246
if object.yvel > 0
247
if object.knuxInPos.y >= 0x5A0000
248
object.yvel >>= 2
249
temp0 = object.yvel
250
temp0 >>= 1
251
object.yvel += temp0
252
object.timer++
253
if object.timer != 2
254
FlipSign(object.yvel)
255
else
256
object.timer = 0
257
object.yvel = 0
258
object.state++
259
end if
260
end if
261
end if
262
263
object.animationTimer++
264
if object.animationTimer > 7
265
tileLayer[2].deformationOffset++
266
object.animationTimer = 0
267
end if
268
break
269
270
case KLOGO_FINISHEDANIMS
271
object.animationTimer++
272
if object.animationTimer > 7
273
tileLayer[2].deformationOffset++
274
object.animationTimer = 0
275
end if
276
break
277
278
end switch
279
280
temp0 = screen.xcenter
281
FlipSign(temp0)
282
temp0 += 256
283
screen.xoffset = temp0
284
end event
285
286
287
event ObjectDraw
288
switch object.state
289
case KLOGO_SETUP
290
ClearScreen(1)
291
break
292
293
case KLOGO_FADEIN
294
ClearScreen(1)
295
296
// Draw Emblem (Top)
297
DrawSprite(0)
298
299
// Draw Emblem (Bottom)
300
DrawSprite(1)
301
302
DrawRect(0, 0, screen.xsize, screen.ysize, 0x00, 0x00, 0x00, object.alpha)
303
break
304
305
case KLOGO_SHOWEMBLEM
306
ClearScreen(1)
307
308
// Draw Emblem (Top)
309
DrawSprite(0)
310
311
// Draw Emblem (Bottom)
312
DrawSprite(1)
313
break
314
315
case KLOGO_ENTERKNUX
316
ClearScreen(1)
317
318
// Draw Emblem (Top)
319
DrawSprite(0)
320
321
// Draw Knux
322
DrawSpriteXY(object.knuxFrame, object.knuxPos.x, object.knuxPos.y)
323
324
// Draw Emblem (Bottom)
325
DrawSprite(1)
326
break
327
328
case KLOGO_KNUXANIMATE
329
ClearScreen(1)
330
331
// Draw Emblem (Top)
332
DrawSprite(0)
333
334
// Draw Knux
335
DrawSpriteXY(object.knuxFrame, object.knuxPos.x, object.knuxPos.y)
336
if object.knuxFrame >= 7
337
DrawSpriteXY(object.handFrame, object.handPos.x, object.handPos.y)
338
end if
339
340
// Draw Emblem (Bottom)
341
DrawSprite(1)
342
break
343
344
case KLOGO_ENTERHAND
345
case KLOGO_HANDANIMATE
346
case KLOGO_FINISHHANDANIM
347
case KLOGO_MOVEKNUXINTOPLACE
348
ClearScreen(1)
349
350
// Draw Emblem (Top)
351
DrawSprite(0)
352
353
// Draw Knux
354
DrawSpriteXY(object.knuxFrame, object.knuxPos.x, object.knuxPos.y)
355
DrawSpriteXY(object.handFrame, object.handPos.x, object.handPos.y)
356
357
// Draw Emblem (Bottom)
358
DrawSprite(1)
359
break
360
361
case KLOGO_MOVEHAND2
362
case KLOGO_HANDANIMATE2
363
case KLOGO_FINISHHANDANIM2
364
DrawRect(0, 0, screen.xsize, screen.ysize, 0xE0, 0xE0, 0xE0, object.alpha)
365
366
// Draw Emblem (Top)
367
DrawSprite(0)
368
369
// Draw Knux
370
DrawSpriteXY(object.knuxFrame, object.knuxPos.x, object.knuxPos.y)
371
DrawSpriteXY(object.handFrame, object.handPos.x, object.handPos.y)
372
373
// Draw Emblem (Bottom)
374
DrawSprite(1)
375
376
temp0 = screen.xsize
377
temp0 -= 96
378
DrawSpriteScreenXY(15, temp0, 216)
379
break
380
381
case KLOGO_ENTERKNUXIN
382
case KLOGO_FINISHEDANIMS
383
// Draw Emblem (Top)
384
DrawSprite(0)
385
386
// Draw Knux
387
DrawSpriteXY(object.knuxFrame, object.knuxPos.x, object.knuxPos.y)
388
DrawSpriteXY(object.handFrame, object.handPos.x, object.handPos.y)
389
390
// Draw Emblem (Bottom)
391
DrawSprite(1)
392
393
// Knux In
394
DrawSpriteXY(14, object.xpos, object.knuxInPos.y)
395
396
// Copyright
397
temp0 = screen.xsize
398
temp0 -= 96
399
DrawSpriteScreenXY(15, temp0, 216)
400
break
401
402
end switch
403
end event
404
405
406
event ObjectStartup
407
LoadSpriteSheet("Title/Title.gif")
408
SpriteFrame(-128, -78, 256, 82, 255, 67) // Emblem (Top) - #0
409
SpriteFrame(-128, -8, 256, 87, 255, 150) // Emblem (Bottom) - #1
410
SpriteFrame(3, 15, 101, 47, 1, 438) // Knux - Frame 1 - #2
411
SpriteFrame(3, 15, 101, 73, 1, 438) // Knux - Frame 2 - #3
412
SpriteFrame(0, 9, 95, 79, 103, 432) // Knux - Frame 3 - #4
413
SpriteFrame(1, 6, 105, 82, 199, 429) // Knux - Frame 4 - #5
414
SpriteFrame(1, 4, 102, 84, 305, 427) // Knux - Frame 5 - #6
415
SpriteFrame(5, 2, 91, 86, 408, 425) // Knux - Frame 6 - #7
416
SpriteFrame(8, 5, 42, 43, 180, 138) // Knux Hand - Frame 1 - #8
417
SpriteFrame(8, 3, 40, 53, 465, 1) // Knux Hand - Frame 2 - #9
418
SpriteFrame(8, 8, 40, 39, 149, 182) // Knux Hand - Frame 3 - #10
419
SpriteFrame(8, 8, 40, 39, 149, 182) // Knux Hand - Frame 4 - #11
420
SpriteFrame(8, 3, 40, 53, 465, 1) // Knux Hand - Frame 5 - #12
421
SpriteFrame(8, 5, 42, 43, 180, 138) // Knux Hand - Frame 6 - #13
422
SpriteFrame(-124, -66, 248, 65, 263, 359) // Knux IN - #14
423
SpriteFrame(0, 0, 88, 16, 1, 421) // Copyright - #15
424
end event
425
426
427
// ========================
428
// Editor Events
429
// ========================
430
431
event RSDKDraw
432
DrawSprite(0)
433
DrawSprite(1)
434
end event
435
436
437
event RSDKLoad
438
LoadSpriteSheet("Title/Title.gif")
439
SpriteFrame(-128, -78, 256, 82, 255, 67) // Emblem (Top) - #0
440
SpriteFrame(-128, -8, 256, 87, 255, 150) // Emblem (Bottom) - #1
441
442
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
443
end event
444
445