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/Global/YBoundAdjust.txt
1482 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Y Bound Adjust 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.leftBoundary
13
14
// Player Aliases
15
private alias object.xpos : player.xpos
16
private alias object.ypos : player.ypos
17
18
19
// ========================
20
// Events
21
// ========================
22
23
event ObjectUpdate
24
if object.propertyValue == 0
25
temp0 = player[0].xpos
26
temp0 -= object.xpos
27
Abs(temp0)
28
if temp0 < 0x200000
29
stage.newYBoundary1 = 0
30
stage.newYBoundary2 = object.iypos
31
stage.deathBoundary = object.ypos
32
end if
33
else
34
if player[0].ypos < object.ypos
35
if player[0].ypos > object[+1].ypos
36
temp0 = player[0].xpos
37
temp0 -= object.xpos
38
Abs(temp0)
39
if temp0 < 0x200000
40
stage.newYBoundary2 = object.iypos
41
stage.deathBoundary = object.ypos
42
if object.leftBoundary > 0
43
stage.newXBoundary1 = object.leftBoundary
44
object.leftBoundary = 0
45
end if
46
end if
47
end if
48
end if
49
end if
50
end event
51
52
53
event ObjectStartup
54
foreach (TypeName[Y Bound Adjust], arrayPos0, ALL_ENTITIES)
55
if options.vsMode == false
56
if object[arrayPos0].propertyValue == 0
57
object[arrayPos0].priority = PRIORITY_XBOUNDS
58
temp0 = player[0].xpos
59
temp0 -= object[arrayPos0].xpos
60
Abs(temp0)
61
if temp0 < 0x200000
62
stage.curYBoundary2 = object[arrayPos0].iypos
63
stage.deathBoundary = object[arrayPos0].ypos
64
end if
65
else
66
object[arrayPos0].priority = PRIORITY_XBOUNDS
67
arrayPos1 = arrayPos0
68
arrayPos1++
69
if player[0].ypos < object[arrayPos0].ypos
70
if player[0].ypos > object[arrayPos1].ypos
71
temp0 = player[0].xpos
72
temp0 -= object[arrayPos0].xpos
73
Abs(temp0)
74
if temp0 < 0x200000
75
stage.curYBoundary2 = object[arrayPos0].iypos
76
stage.deathBoundary = object[arrayPos0].ypos
77
end if
78
end if
79
end if
80
end if
81
else
82
object[arrayPos0].type = TypeName[Blank Object]
83
end if
84
next
85
end event
86
87
88
// ========================
89
// Editor Events
90
// ========================
91
92
event RSDKEdit
93
if editor.returnVariable == true
94
switch editor.variableID
95
case EDIT_VAR_PROPVAL // property value
96
case 0 // type
97
checkResult = object.propertyValue
98
break
99
100
end switch
101
else
102
switch editor.variableID
103
case EDIT_VAR_PROPVAL // property value
104
case 0 // type
105
object.propertyValue = editor.variableValue
106
break
107
108
end switch
109
end if
110
end event
111
112
113
event RSDKDraw
114
if editor.showGizmos == true
115
temp0 = object.xpos
116
temp0 -= 0x180000
117
temp1 = object.xpos
118
temp1 += 0x180000
119
DrawLine(temp0, object.ypos, temp1, object.ypos, 0xFF, 0xFF, 0x00) // No specific reason for using yellow, I just think it looks nice
120
end if
121
122
// Draw the Y sprite ontop of the line
123
DrawSprite(0)
124
end event
125
126
127
event RSDKLoad
128
LoadSpriteSheet("Global/Display.gif")
129
SpriteFrame(-8, -8, 16, 16, 134, 18)
130
131
AddEditorVariable("type")
132
SetActiveVariable("type")
133
AddEnumVariable("Regular Adjust", 0) // adjusts to this YPos
134
AddEnumVariable("Box Adjust", 1) // adjusts to this YPos, if the player is below this YPos and above the next object slots' YPos
135
136
SetVariableAlias(ALIAS_VAR_VAL0, "leftBoundary") // only works on box adjust types
137
end event
138
139