Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 1/Scripts/SYZ/VerticalDoor.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Vertical Door 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.movePos.y
13
14
private alias 0 : VERTICALDOOR_IDLE
15
private alias 1 : VERTICALDOOR_OPENING
16
private alias 2 : VERTICALDOOR_OPENED
17
18
// PushButton aliases
19
private alias object.propertyValue : pushButton.stood
20
21
22
// ========================
23
// Function Declarations
24
// ========================
25
26
reserve function VerticalDoor_DebugDraw
27
reserve function VerticalDoor_DebugSpawn
28
29
30
// ========================
31
// Tables
32
// ========================
33
34
private function VerticalDoor_DebugDraw
35
DrawSprite(0)
36
end function
37
38
39
private function VerticalDoor_DebugSpawn
40
CreateTempObject(TypeName[Vertical Door], 0, object.xpos, object.ypos)
41
end function
42
43
44
// ========================
45
// Events
46
// ========================
47
48
event ObjectUpdate
49
switch object.state
50
case VERTICALDOOR_IDLE
51
if pushButton[-1].stood == true
52
object.state = VERTICALDOOR_OPENING
53
end if
54
break
55
56
case VERTICALDOOR_OPENING
57
if object.movePos.y < 0x400000
58
object.movePos.y += 0x20000
59
object.ypos -= 0x20000
60
else
61
object.state++
62
end if
63
break
64
65
case VERTICALDOOR_OPENED
66
break
67
68
end switch
69
70
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
71
BoxCollisionTest(C_SOLID, object.entityPos, -16, -32, 16, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
72
next
73
end event
74
75
76
event ObjectDraw
77
DrawSprite(0)
78
end event
79
80
81
event ObjectStartup
82
LoadSpriteSheet("SYZ/Objects.gif")
83
SpriteFrame(-16, -32, 32, 64, 119, 34)
84
85
SetTableValue(TypeName[Vertical Door], DebugMode_ObjCount, DebugMode_TypesTable)
86
SetTableValue(VerticalDoor_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
87
SetTableValue(VerticalDoor_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
88
DebugMode_ObjCount++
89
end event
90
91
92
// ========================
93
// Editor Events
94
// ========================
95
96
event RSDKDraw
97
DrawSprite(0)
98
99
if editor.showGizmos == true
100
editor.drawingOverlay = true
101
102
// Draw an arrow from this object's activator button
103
DrawArrow(object[-1].xpos, object[-1].ypos, object.xpos, object.ypos, 255, 255, 255)
104
105
// Draw the door's destination
106
temp0 = object.xpos; temp0 -= 0x100000
107
temp1 = object.ypos; temp1 -= 0x500000
108
DrawRectOutline(temp0, temp1, 0x200000, 0x400000, 255, 255, 255, 255)
109
110
editor.drawingOverlay = false
111
end if
112
end event
113
114
115
event RSDKLoad
116
LoadSpriteSheet("SYZ/Objects.gif")
117
SpriteFrame(-16, -32, 32, 64, 119, 34)
118
119
// set to 160 once in syz3 for some reason, only to never be seen again...
120
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
121
end event
122
123