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/VPlatform2.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: V Platform 2 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
private alias object.gravity : player.gravity
18
19
20
// ========================
21
// Function Declarations
22
// ========================
23
24
reserve function VPlatform2_DebugDraw
25
reserve function VPlatform2_DebugSpawn
26
27
28
// ========================
29
// Function Definitions
30
// ========================
31
32
private function VPlatform2_DebugDraw
33
DrawSprite(0)
34
end function
35
36
37
private function VPlatform2_DebugSpawn
38
CreateTempObject(TypeName[V Platform 2], 0, object.xpos, object.ypos)
39
object[tempObjectPos].centerPos.y = object.ypos
40
object[tempObjectPos].propertyValue = object.direction
41
end function
42
43
44
// ========================
45
// Events
46
// ========================
47
48
event ObjectUpdate
49
temp7 = object.ypos
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 <<= 7
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_SOLID, object.entityPos, -32, -41, 32, 39, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
71
if checkResult == COL_TOP
72
player[currentPlayer].ypos += object.collisionOffset.y
73
end if
74
75
if checkResult == COL_BOTTOM
76
if player[currentPlayer].gravity == GRAVITY_GROUND
77
CallFunction(Player_Kill)
78
end if
79
end if
80
next
81
object.ypos = temp1
82
end event
83
84
85
event ObjectDraw
86
DrawSprite(0)
87
end event
88
89
90
event ObjectStartup
91
LoadSpriteSheet("ARZ/Objects.gif")
92
SpriteFrame(-32, -45, 64, 85, 191, 170)
93
94
foreach (TypeName[V Platform 2], arrayPos0, ALL_ENTITIES)
95
object[arrayPos0].centerPos.y = object[arrayPos0].ypos
96
next
97
98
SetTableValue(TypeName[V Platform 2], DebugMode_ObjCount, DebugMode_TypesTable)
99
SetTableValue(VPlatform2_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
100
SetTableValue(VPlatform2_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
101
DebugMode_ObjCount++
102
end event
103
104
105
// ========================
106
// Editor Events
107
// ========================
108
109
event RSDKEdit
110
if editor.returnVariable == true
111
switch editor.variableID
112
case EDIT_VAR_PROPVAL // property value
113
checkResult = object.propertyValue
114
break
115
116
case 0 // startDir
117
checkResult = object.propertyValue
118
break
119
end switch
120
else
121
switch editor.variableID
122
case EDIT_VAR_PROPVAL // property value
123
object.propertyValue = editor.variableValue
124
break
125
126
case 0 // startDir
127
object.propertyValue = editor.variableValue
128
break
129
end switch
130
end if
131
end event
132
133
134
event RSDKDraw
135
DrawSprite(0)
136
end event
137
138
139
event RSDKLoad
140
LoadSpriteSheet("ARZ/Objects.gif")
141
SpriteFrame(-32, -45, 64, 85, 191, 170)
142
143
AddEditorVariable("startDir")
144
SetActiveVariable("startDir")
145
AddEnumVariable("Up", 0)
146
AddEnumVariable("Down", 1)
147
end event
148
149