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/MPZ/BeltActivation.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Belt Activation 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
arrayPos0++
38
loop
39
end event
40
41
42
event ObjectStartup
43
foreach (TypeName[Belt Activation], arrayPos0, ALL_ENTITIES)
44
object[arrayPos0].priority = PRIORITY_XBOUNDS
45
arrayPos1 = arrayPos0
46
object[arrayPos0].endSlot = object[arrayPos0].propertyValue
47
48
temp0 = false
49
while temp0 == false
50
if object[arrayPos1].type == TypeName[Belt Platform]
51
object[arrayPos0].startSlot = arrayPos1
52
temp0 = true
53
else
54
arrayPos1++
55
if arrayPos1 >= 0x420
56
// Hit the temp object list, break
57
temp0 = true
58
end if
59
end if
60
loop
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
arrayPos0 = object.entityPos
77
78
GetObjectType(temp0, "Belt Platform")
79
80
checkResult = true
81
while checkResult == true
82
checkNotEqual(object[arrayPos0].type, temp0)
83
arrayPos0 += checkResult
84
85
if arrayPos0 >= 0x420
86
checkResult = false
87
end if
88
loop
89
90
arrayPos1 = arrayPos0
91
arrayPos1 += object.propertyValue
92
93
while arrayPos0 < arrayPos1
94
DrawLine(object.xpos, object.ypos, object[arrayPos0].xpos, object[arrayPos0].ypos, 0xFF, 0xFF, 0x00)
95
arrayPos0++
96
loop
97
98
editor.drawingOverlay = false
99
end if
100
end event
101
102
103
event RSDKLoad
104
LoadSpriteSheet("Global/Display.gif")
105
SpriteFrame(-8, -8, 16, 16, 168, 18) // "trigger" - #0
106
107
SetVariableAlias(ALIAS_VAR_PROPVAL, "activateCount")
108
end event
109
110