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/LZ/BeltActivation.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
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.propertyValue : object.beltCount
13
14
private alias object.value0 : object.endSlot
15
private alias object.value1 : object.startSlot
16
17
18
// ========================
19
// Events
20
// ========================
21
22
event ObjectUpdate
23
arrayPos0 = object.startSlot
24
while arrayPos0 < object.endSlot
25
object[arrayPos0].priority = PRIORITY_ACTIVE
26
arrayPos0++
27
loop
28
end event
29
30
31
event ObjectDraw
32
// Even if it's a "Draw" event, there's not really much drawing that actually happens here
33
// Instead, it just does some more managing of priorities
34
// (Keep in mind, when the player's dead Updates aren't ran anymore but Draws are)
35
36
arrayPos0 = object.startSlot
37
while arrayPos0 < object.endSlot
38
if stage.state == STAGE_RUNNING
39
object[arrayPos0].priority = PRIORITY_INACTIVE
40
else
41
object[arrayPos0].priority = PRIORITY_ACTIVE
42
end if
43
44
arrayPos0++
45
loop
46
end event
47
48
49
event ObjectStartup
50
foreach (TypeName[Belt Activation], arrayPos0, ALL_ENTITIES)
51
object[arrayPos0].priority = PRIORITY_XBOUNDS
52
arrayPos1 = arrayPos0
53
object[arrayPos0].endSlot = object[arrayPos0].beltCount
54
55
temp0 = false
56
while temp0 == false
57
if object[arrayPos1].type == TypeName[Belt Platform]
58
object[arrayPos0].startSlot = arrayPos1
59
temp0 = true
60
else
61
arrayPos1++
62
if arrayPos1 >= 0x420
63
temp0 = true
64
end if
65
end if
66
loop
67
68
object[arrayPos0].endSlot += object[arrayPos0].startSlot
69
next
70
end event
71
72
73
// ========================
74
// Editor Events
75
// ========================
76
77
event RSDKDraw
78
DrawSprite(0)
79
80
if editor.showGizmos == true
81
editor.drawingOverlay = true
82
83
arrayPos0 = object.entityPos
84
85
GetObjectType(temp0, "Belt Platform")
86
87
checkResult = true
88
while checkResult == true
89
checkNotEqual(object[arrayPos0].type, temp0)
90
arrayPos0 += checkResult
91
92
if arrayPos0 >= 0x420
93
checkResult = false
94
end if
95
loop
96
97
arrayPos1 = arrayPos0
98
arrayPos1 += object.beltCount
99
100
while arrayPos0 < arrayPos1
101
DrawLine(object.xpos, object.ypos, object[arrayPos0].xpos, object[arrayPos0].ypos, 0xFF, 0xFF, 0x00)
102
arrayPos0++
103
loop
104
105
editor.drawingOverlay = false
106
end if
107
end event
108
109
110
event RSDKLoad
111
LoadSpriteSheet("Global/Display.gif")
112
SpriteFrame(-8, -8, 16, 16, 239, 239) // "Trigger" - #0
113
114
SetVariableAlias(ALIAS_VAR_PROPVAL, "beltCount")
115
end event
116
117