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/WFZ/TiltPlatformH.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Tilt Platform H 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.timer
13
14
// States
15
private alias 0 : TILTPLATFORM_H_IDLE
16
private alias 1 : TILTPLATFORM_H_FLIPPING
17
private alias 2 : TILTPLATFORM_H_FLIPPED
18
private alias 3 : TILTPLATFORM_H_REVERT
19
20
21
// ========================
22
// Function Declarations
23
// ========================
24
25
reserve function TiltPlatformH_DebugDraw
26
reserve function TiltPlatformH_DebugSpawn
27
28
29
// ========================
30
// Function Definitions
31
// ========================
32
33
private function TiltPlatformH_DebugDraw
34
DrawSprite(0)
35
end function
36
37
38
private function TiltPlatformH_DebugSpawn
39
CreateTempObject(TypeName[Tilt Platform H], 0, object.xpos, object.ypos)
40
object[tempObjectPos].direction = object.direction
41
end function
42
43
44
// ========================
45
// Events
46
// ========================
47
48
event ObjectUpdate
49
switch object.state
50
case TILTPLATFORM_H_IDLE
51
temp0 = oscillation
52
temp0 &= 0xF0
53
if temp0 == object.propertyValue
54
object.priority = PRIORITY_ACTIVE
55
object.animationTimer = 0
56
object.frame = 1
57
object.state = TILTPLATFORM_H_FLIPPING
58
end if
59
break
60
61
case TILTPLATFORM_H_FLIPPING
62
object.animationTimer++
63
if object.animationTimer == 4
64
object.frame = 2
65
object.timer = 74
66
object.state = TILTPLATFORM_H_FLIPPED
67
end if
68
break
69
70
case TILTPLATFORM_H_FLIPPED
71
object.timer--
72
if object.timer == 0
73
object.animationTimer = 0
74
object.frame = 1
75
object.state = TILTPLATFORM_H_REVERT
76
end if
77
break
78
79
case TILTPLATFORM_H_REVERT
80
object.animationTimer++
81
if object.animationTimer == 4
82
object.frame = 0
83
object.state = TILTPLATFORM_H_IDLE
84
end if
85
break
86
87
end switch
88
89
if object.frame == 0
90
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
91
BoxCollisionTest(C_SOLID, object.entityPos, -24, -2, 24, 6, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
92
next
93
end if
94
95
if object.outOfBounds == true
96
object.frame = 0
97
object.state = TILTPLATFORM_H_IDLE
98
object.priority = PRIORITY_BOUNDS
99
end if
100
end event
101
102
103
event ObjectDraw
104
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
105
end event
106
107
108
event ObjectStartup
109
LoadSpriteSheet("SCZ/Objects.gif")
110
SpriteFrame(-24, -4, 48, 8, 320, 99) // Flat (H) - #0
111
SpriteFrame(-16, -16, 32, 32, 320, 108) // Diagonal (Down Right) - #1
112
SpriteFrame(-4, -24, 8, 48, 311, 99) // Diagonal (Down Left) - #2
113
SpriteFrame(-16, -16, 32, 32, 353, 108) // Flat (V) - #3
114
115
SetTableValue(TypeName[Tilt Platform H], DebugMode_ObjCount, DebugMode_TypesTable)
116
SetTableValue(TiltPlatformH_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
117
SetTableValue(TiltPlatformH_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
118
DebugMode_ObjCount++
119
end event
120
121
122
// ========================
123
// Editor Events
124
// ========================
125
126
event RSDKDraw
127
DrawSprite(0)
128
end event
129
130
131
event RSDKLoad
132
LoadSpriteSheet("SCZ/Objects.gif")
133
SpriteFrame(-24, -4, 48, 8, 320, 99) // Flat (H)
134
135
SetVariableAlias(ALIAS_VAR_PROPVAL, "intervalOffset")
136
end event
137
138