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/OOZ/SpikesActivator.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Spikes Activator 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.endSlot
13
private alias object.value1 : object.startSlot
14
15
16
// ========================
17
// Events
18
// ========================
19
20
event ObjectUpdate
21
arrayPos0 = object.startSlot
22
while arrayPos0 < object.endSlot
23
object[arrayPos0].priority = PRIORITY_ACTIVE
24
arrayPos0++
25
loop
26
end event
27
28
29
event ObjectDraw
30
arrayPos0 = object.startSlot
31
while arrayPos0 < object.endSlot
32
if stage.state == STAGE_RUNNING
33
object[arrayPos0].priority = PRIORITY_INACTIVE
34
else
35
object[arrayPos0].priority = PRIORITY_ACTIVE
36
end if
37
38
arrayPos0++
39
loop
40
end event
41
42
43
event ObjectStartup
44
foreach (TypeName[Spikes Activator], arrayPos0, ALL_ENTITIES)
45
arrayPos1 = arrayPos0
46
object[arrayPos0].endSlot = object[arrayPos0].propertyValue
47
48
temp0 = false
49
while temp0 == false
50
if object[arrayPos1].type == TypeName[Moving Spikes]
51
object[arrayPos0].startSlot = arrayPos1
52
temp0 = true
53
else
54
arrayPos1++
55
if arrayPos1 >= 0x420
56
temp0 = true
57
end if
58
end if
59
loop
60
61
object[arrayPos0].endSlot += object[arrayPos0].startSlot
62
next
63
end event
64
65
66
// ========================
67
// Editor Events
68
// ========================
69
70
event RSDKDraw
71
DrawSprite(0)
72
73
if editor.showGizmos == true
74
editor.drawingOverlay = true
75
76
object.endSlot = object.propertyValue
77
78
GetObjectType(temp1, "Moving Spikes")
79
80
temp0 = false
81
arrayPos0 = object.entityPos
82
while temp0 == false
83
if object[arrayPos0].type == temp1
84
object.startSlot = arrayPos0
85
temp0 = true
86
else
87
arrayPos0++
88
if arrayPos0 >= 0x420
89
editor.drawingOverlay = false
90
return
91
end if
92
end if
93
loop
94
95
object.endSlot += object.startSlot
96
97
arrayPos0 = object.startSlot
98
while arrayPos0 < object.endSlot
99
DrawArrow(object.xpos, object.ypos, object[arrayPos0].xpos, object[arrayPos0].ypos, 0xE0, 0xE0, 0xE0)
100
loop
101
102
editor.drawingOverlay = false
103
end if
104
end event
105
106
107
event RSDKLoad
108
LoadSpriteSheet("Global/Display.gif")
109
SpriteFrame(-8, -8, 16, 16, 168, 18) // "Trigger" - #0
110
111
SetVariableAlias(ALIAS_VAR_PROPVAL, "activateSlot")
112
end event
113
114