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/HPZ/HPZFall.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: HPZ Fall 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.targetPlayer
13
14
private alias 0 : HPZFALL_STAGE
15
private alias 1 : HPZFALL_SPAWNED
16
17
// Player Aliases
18
private alias object.state : player.state
19
private alias object.animation : player.animation
20
private alias object.direction : player.direction
21
private alias object.gravity : player.gravity
22
private alias object.value26 : player.flightVelocity
23
24
25
// ========================
26
// Events
27
// ========================
28
29
event ObjectUpdate
30
if object.state == HPZFALL_STAGE
31
// Object as placed in level
32
33
if recAnimation != 0
34
temp0 = recAnimation
35
else
36
temp0 = ANI_WATERSLIDE
37
temp0 <<= 16
38
temp0 |= ANI_WATERSLIDE
39
temp0 <<= 8
40
end if
41
42
// Cycle through each player
43
currentPlayer = 0
44
while currentPlayer < playerCount
45
46
// Create a personalized HPZFall object for the current player
47
CreateTempObject(TypeName[HPZ Fall], 0, object.xpos, object.ypos)
48
49
object[tempObjectPos].state = HPZFALL_SPAWNED
50
51
object[tempObjectPos].targetPlayer = currentPlayer
52
53
object[tempObjectPos].direction = temp0
54
object[tempObjectPos].direction &= 0xFF
55
temp0 >>= 8
56
57
object[tempObjectPos].animation = temp0
58
object[tempObjectPos].animation &= 0xFF
59
temp0 >>= 8
60
61
currentPlayer++
62
loop
63
64
// Erase this object
65
object.type = TypeName[Blank Object]
66
else
67
currentPlayer = object.targetPlayer
68
69
// If the player has landed, then reset this object
70
if player[currentPlayer].gravity == GRAVITY_GROUND
71
object.type = TypeName[Blank Object]
72
else
73
player[currentPlayer].direction = object.direction
74
player[currentPlayer].animation = object.animation
75
76
// Below animation checks should never be true, but they are here just in case
77
78
if player[currentPlayer].animation == ANI_JUMPING
79
#platform: USE_STANDALONE
80
player[currentPlayer].state = Player_State_Air
81
#endplatform
82
#platform: USE_ORIGINS
83
player[currentPlayer].state = Player_State_Air_NoDropDash
84
#endplatform
85
object.type = TypeName[Blank Object]
86
end if
87
88
if player[currentPlayer].animation == ANI_FLYING
89
player[currentPlayer].state = Player_State_Fly
90
player[currentPlayer].flightVelocity = 0x800
91
92
object.type = TypeName[Blank Object]
93
end if
94
95
if player[currentPlayer].animation == ANI_GLIDING
96
if player[currentPlayer].direction == FACING_LEFT
97
player[currentPlayer].state = Player_State_GlideLeft
98
else
99
player[currentPlayer].state = Player_State_GlideRight
100
end if
101
102
object.type = TypeName[Blank Object]
103
end if
104
105
if player[currentPlayer].animation == ANI_GLIDING_DROP
106
player[currentPlayer].state = Player_State_GlideDrop
107
108
object.type = TypeName[Blank Object]
109
end if
110
end if
111
end if
112
end event
113
114
115
// ========================
116
// Editor Events
117
// ========================
118
119
event RSDKDraw
120
DrawSprite(0)
121
end event
122
123
124
event RSDKLoad
125
LoadSpriteSheet("Global/Display.gif")
126
SpriteFrame(-16, -16, 32, 32, 1, 143)
127
128
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
129
end event
130
131