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/WatchLoseRing.txt
1482 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: WatchLoseRing 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.targetRing
13
14
// TODO: primitive names
15
private alias 0 : WATCHLOSERING_AWAITHURT
16
private alias 1 : WATCHLOSERING_FINDRING
17
private alias 2 : WATCHLOSERING_WATCHRING
18
19
// Player Aliases
20
private alias object.state : player.state
21
22
23
// ========================
24
// Events
25
// ========================
26
27
event ObjectUpdate
28
switch object.state
29
case WATCHLOSERING_AWAITHURT
30
if player[0].state == Player_State_GotHit
31
object.state = WATCHLOSERING_FINDRING
32
end if
33
break
34
35
case WATCHLOSERING_FINDRING
36
foreach (TypeName[Lose Ring], arrayPos0, ACTIVE_ENTITIES)
37
object.targetRing = arrayPos0
38
next
39
40
if object.targetRing != 0
41
object.state = WATCHLOSERING_WATCHRING
42
end if
43
break
44
45
case WATCHLOSERING_WATCHRING
46
arrayPos0 = object.targetRing
47
if object[arrayPos0].type == TypeName[Ring Sparkle]
48
// The Player grabbed the ring, now find the next ring
49
object.targetRing = 0
50
object.state = WATCHLOSERING_FINDRING
51
else
52
if object[arrayPos0].type == TypeName[Blank Object]
53
// The Player wasn't fast enough and the Ring despawned, kill the Player
54
object.targetRing = 0
55
object.state = WATCHLOSERING_FINDRING
56
57
game.forceKillPlayer = true
58
end if
59
end if
60
break
61
62
end switch
63
end event
64
65
66
event ObjectStartup
67
// Normally I'd say like "Cycle through all WatchLoseRing Objects in the stage and set them to active" but like...
68
foreach (TypeName[WatchLoseRing], arrayPos0, ALL_ENTITIES)
69
object[arrayPos0].priority = PRIORITY_ACTIVE
70
end if // ???pardon? an end if??? It's supposed to be a `next` instead...
71
72
// As it is now, it seems like this foreach only really finds the first WatchLoseRing Object and then just stops after that...
73
// It doesn't matter too much though, as only one (or none) should ever be placed into a scene
74
end event
75
76
77
// ========================
78
// Editor Events
79
// ========================
80
81
event RSDKDraw
82
DrawSprite(0)
83
end event
84
85
86
event RSDKLoad
87
LoadSpriteSheet("Global/Items.gif")
88
SpriteFrame(-8, -8, 16, 16, 1, 1)
89
90
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
91
end event
92
93