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/LZ/Gargoyle.txt
1481 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Gargoyle 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
private alias object.value1 : object.interval
14
15
16
// ========================
17
// Function Declarations
18
// ========================
19
20
reserve function Gargoyle_DebugDraw
21
reserve function Gargoyle_DebugSpawn
22
23
24
// ========================
25
// Function Definitions
26
// ========================
27
28
private function Gargoyle_DebugDraw
29
DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)
30
end function
31
32
33
private function Gargoyle_DebugSpawn
34
CreateTempObject(TypeName[Gargoyle], 0, object.xpos, object.ypos)
35
object[tempObjectPos].direction = object.direction
36
object[tempObjectPos].interval = 60
37
object[tempObjectPos].timer = 60
38
end function
39
40
41
// ========================
42
// Events
43
// ========================
44
45
event ObjectUpdate
46
temp0 = object.ixpos
47
temp0 -= camera[0].xpos
48
Abs(temp0)
49
if temp0 < screen.xcenter
50
temp0 = object.iypos
51
temp0 -= camera[0].ypos
52
Abs(temp0)
53
if temp0 < screen.ycenter
54
55
object.timer--
56
if object.timer <= 0
57
PlaySfx(SfxName[Small Fireball], false)
58
CreateTempObject(TypeName[Gargoyle Shot], 0, object.xpos, object.ypos)
59
object[tempObjectPos].drawOrder = 2
60
if object.direction == FLIP_NONE
61
object[tempObjectPos].xvel = -0x20000
62
else
63
object[tempObjectPos].xvel = 0x20000
64
end if
65
object[tempObjectPos].ypos += 0x80000
66
object[tempObjectPos].direction = object.direction
67
object.timer = object.interval
68
end if
69
end if
70
end if
71
end event
72
73
74
event ObjectDraw
75
DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)
76
end event
77
78
79
event ObjectStartup
80
LoadSpriteSheet("LZ/Objects.gif")
81
SpriteFrame(-16, -15, 32, 31, 93, 128)
82
83
foreach (TypeName[Gargoyle], arrayPos0, ALL_ENTITIES)
84
object[arrayPos0].interval = object[arrayPos0].propertyValue
85
object[arrayPos0].interval++
86
object[arrayPos0].interval *= 30
87
object[arrayPos0].timer = object[arrayPos0].interval
88
next
89
90
SetTableValue(TypeName[Gargoyle], DebugMode_ObjCount, DebugMode_TypesTable)
91
SetTableValue(Gargoyle_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
92
SetTableValue(Gargoyle_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
93
DebugMode_ObjCount++
94
end event
95
96
97
// ========================
98
// Editor Events
99
// ========================
100
101
event RSDKEdit
102
if editor.returnVariable == true
103
switch editor.variableID
104
case EDIT_VAR_PROPVAL // property value
105
checkResult = object.propertyValue
106
break
107
108
case 0 // interval
109
checkResult = object.propertyValue
110
break
111
112
end switch
113
else
114
switch editor.variableID
115
case EDIT_VAR_PROPVAL // property value
116
object.propertyValue = editor.variableValue
117
break
118
119
case 0 // interval
120
object.propertyValue = editor.variableValue
121
break
122
123
end switch
124
end if
125
end event
126
127
128
event RSDKDraw
129
DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)
130
end event
131
132
133
event RSDKLoad
134
LoadSpriteSheet("LZ/Objects.gif")
135
SpriteFrame(-16, -15, 32, 31, 93, 128)
136
137
AddEditorVariable("interval")
138
SetActiveVariable("interval")
139
end event
140
141