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/ARZ/VPlatform.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: V Platform 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.centerPos.y
13
private alias object.value1 : object.collisionOffset.y
14
15
// Player Aliases
16
private alias object.ypos : player.ypos
17
18
19
// ========================
20
// Function Declarations
21
// ========================
22
23
reserve function VPlatform_DebugDraw
24
reserve function VPlatform_DebugSpawn
25
26
27
// ========================
28
// Function Definitions
29
// ========================
30
31
private function VPlatform_DebugDraw
32
DrawSprite(0)
33
end function
34
35
36
private function VPlatform_DebugSpawn
37
CreateTempObject(TypeName[V Platform], 0, object.xpos, object.ypos)
38
object[tempObjectPos].centerPos.y = object.ypos
39
object[tempObjectPos].propertyValue = object.direction
40
end function
41
42
43
// ========================
44
// Events
45
// ========================
46
47
event ObjectUpdate
48
temp7 = object.ypos
49
50
GetTableValue(temp0, 12, StageSetup_oscillationTable)
51
if object.propertyValue == 1
52
FlipSign(temp0)
53
temp0 += 0x4000
54
else
55
temp0 -= 0x4000
56
end if
57
temp0 <<= 8
58
59
object.ypos = object.centerPos.y
60
object.ypos -= temp0
61
62
temp1 = object.ypos
63
temp7 &= 0xFFFF0000
64
object.collisionOffset.y = object.ypos
65
object.collisionOffset.y &= 0xFFFF0000
66
object.collisionOffset.y -= temp7
67
68
object.ypos = temp7
69
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
70
BoxCollisionTest(C_PLATFORM, object.entityPos, -32, -8, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
71
if checkResult == true
72
player[currentPlayer].ypos += object.collisionOffset.y
73
end if
74
next
75
object.ypos = temp1
76
end event
77
78
79
event ObjectDraw
80
DrawSprite(0)
81
end event
82
83
84
event ObjectStartup
85
LoadSpriteSheet("ARZ/Objects.gif")
86
SpriteFrame(-32, -13, 64, 45, 126, 145)
87
88
foreach (TypeName[V Platform], arrayPos0, ALL_ENTITIES)
89
object[arrayPos0].centerPos.y = object[arrayPos0].ypos
90
next
91
92
SetTableValue(TypeName[V Platform], DebugMode_ObjCount, DebugMode_TypesTable)
93
SetTableValue(VPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
94
SetTableValue(VPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
95
DebugMode_ObjCount++
96
end event
97
98
99
// ========================
100
// Editor Events
101
// ========================
102
103
event RSDKEdit
104
if editor.returnVariable == true
105
switch editor.variableID
106
case EDIT_VAR_PROPVAL // property value
107
checkResult = object.propertyValue
108
break
109
110
case 0 // startDir
111
checkResult = object.propertyValue
112
break
113
end switch
114
else
115
switch editor.variableID
116
case EDIT_VAR_PROPVAL // property value
117
object.propertyValue = editor.variableValue
118
break
119
120
case 0 // startDir
121
object.propertyValue = editor.variableValue
122
break
123
end switch
124
end if
125
end event
126
127
128
event RSDKDraw
129
DrawSprite(0)
130
end event
131
132
133
event RSDKLoad
134
LoadSpriteSheet("ARZ/Objects.gif")
135
SpriteFrame(-32, -13, 64, 45, 126, 145)
136
137
AddEditorVariable("startDir")
138
SetActiveVariable("startDir")
139
AddEnumVariable("Up", 0)
140
AddEnumVariable("Down", 1)
141
end event
142
143