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/GHZ/BridgeEnd.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Bridge End Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Function Declarations
10
// ========================
11
12
reserve function BridgeEnd_DebugDraw
13
reserve function BridgeEnd_DebugSpawn
14
15
16
// ========================
17
// Function Definitions
18
// ========================
19
20
private function BridgeEnd_DebugDraw
21
temp0 = object.direction
22
temp0 &= 1
23
DrawSprite(temp0)
24
end function
25
26
27
private function BridgeEnd_DebugSpawn
28
CreateTempObject(TypeName[Bridge End], 0, object.xpos, object.ypos)
29
object[tempObjectPos].drawOrder = 4
30
object[tempObjectPos].propertyValue = object.direction
31
object[tempObjectPos].propertyValue &= 1
32
end function
33
34
35
// ========================
36
// Events
37
// ========================
38
39
event ObjectDraw
40
DrawSprite(object.propertyValue)
41
end event
42
43
44
event ObjectStartup
45
LoadSpriteSheet("GHZ/Objects.gif")
46
47
// Sprite frames
48
SpriteFrame(-16, -8, 32, 16, 18, 1)
49
SpriteFrame(-16, -8, 32, 16, 51, 1)
50
51
// Set all Bridge End objects to have a drawOrder of 4, one above the standard of 3
52
// (This object was made while v4 spec was still being developed, foreaches didn't exist back when this object was made so a v3-styled loop is used instead)
53
arrayPos0 = 32
54
while arrayPos0 < 0x420
55
if object[arrayPos0].type == TypeName[Bridge End]
56
object[arrayPos0].drawOrder = 4
57
end if
58
59
arrayPos0++
60
loop
61
62
// Add this object to the debug mode list
63
SetTableValue(TypeName[Bridge End], DebugMode_ObjCount, DebugMode_TypesTable)
64
SetTableValue(BridgeEnd_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
65
SetTableValue(BridgeEnd_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
66
DebugMode_ObjCount++
67
end event
68
69
70
// ========================
71
// Editor Events
72
// ========================
73
74
event RSDKEdit
75
if editor.returnVariable == true
76
switch editor.variableID
77
case EDIT_VAR_PROPVAL // property value
78
checkResult = object.propertyValue
79
checkResult &= 1
80
break
81
82
case 0 // direction
83
checkResult = object.propertyValue
84
checkResult &= 1
85
break
86
87
end switch
88
else
89
switch editor.variableID
90
case EDIT_VAR_PROPVAL // property value
91
object.propertyValue = editor.variableValue
92
object.propertyValue &= 1
93
break
94
95
case 0 // direction
96
object.propertyValue = editor.variableValue
97
object.propertyValue &= 1
98
break
99
100
end switch
101
end if
102
end event
103
104
105
event RSDKDraw
106
DrawSprite(object.propertyValue)
107
end event
108
109
110
event RSDKLoad
111
LoadSpriteSheet("GHZ/Objects.gif")
112
SpriteFrame(-16, -8, 32, 16, 18, 1)
113
SpriteFrame(-16, -8, 32, 16, 51, 1)
114
115
AddEditorVariable("direction")
116
SetActiveVariable("direction")
117
AddEnumVariable("Left", 0)
118
AddEnumVariable("Right", 1)
119
end event
120
121