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/Global/FireShield.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Fire Shield 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.value18 : object.sortedDrawOrder
14
15
private alias -1 : DRAWORDER_PLAYER
16
17
private alias object.state : player.state
18
private alias object.xpos : player.xpos
19
private alias object.ypos : player.ypos
20
21
// Flame shield states
22
private alias 0 : FIRESHIELD_IDLE_SETUP
23
private alias 1 : FIRESHIELD_IDLE
24
private alias 2 : FIRESHIELD_DASH_SETUP
25
private alias 3 : FIRESHIELD_DASH
26
27
// Super States
28
private alias 1 : SUPERSTATE_SUPER
29
30
31
// ========================
32
// Tables
33
// ========================
34
35
// Passive/idle ver - just staying around the player normally
36
private table FireShield_idleFrameTable
37
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1
38
end table
39
40
// Active - During flame dash
41
private table FireShield_dashFrameTable
42
10, 11, 12, 10, 12, 13, 10, 11, 12, 10, 12, 13, 0
43
end table
44
45
46
// ========================
47
// Events
48
// ========================
49
50
event ObjectUpdate
51
object.drawOrder = DRAWORDER_PLAYER
52
53
// Unload if the player shouldn't have a shield
54
if player[-playerCount].state == Player_State_Death
55
object.type = TypeName[Blank Object]
56
end if
57
if player[-playerCount].state == Player_State_Drown
58
object.type = TypeName[Blank Object]
59
end if
60
61
switch object.state
62
case FIRESHIELD_IDLE_SETUP
63
object.animationTimer = 0
64
object.timer = 0
65
object.sortedDrawOrder = 0
66
object.direction = FACING_RIGHT
67
GetTableValue(object.frame, object.timer, FireShield_idleFrameTable)
68
object.state++
69
// [Fallthrough]
70
case FIRESHIELD_IDLE
71
object.animationTimer++
72
73
if object.animationTimer >= 3
74
object.animationTimer = 1
75
object.timer++
76
object.sortedDrawOrder ^= 1
77
78
if object.timer >= 10
79
object.direction = FLIP_Y
80
81
if object.timer >= 18
82
object.timer = 0
83
object.direction = FACING_RIGHT
84
end if
85
end if
86
87
GetTableValue(object.frame, object.timer, FireShield_idleFrameTable)
88
end if
89
break
90
91
case FIRESHIELD_DASH_SETUP
92
object.animationTimer = 0
93
object.timer = 0
94
object.sortedDrawOrder = 0
95
GetTableValue(object.frame, object.timer, FireShield_dashFrameTable)
96
object.state++
97
// [Fallthrough]
98
case FIRESHIELD_DASH
99
object.animationTimer++
100
101
if object.animationTimer >= 3
102
object.animationTimer = 1
103
object.timer++
104
105
if object.timer >= 12
106
object.state = FIRESHIELD_IDLE_SETUP
107
end if
108
109
GetTableValue(object.frame, object.timer, FireShield_dashFrameTable)
110
end if
111
break
112
113
end switch
114
end event
115
116
117
event ObjectDraw
118
if Player_superState != SUPERSTATE_SUPER
119
DrawSpriteFX(object.frame, FX_FLIP, player[-playerCount].xpos, player[-playerCount].ypos)
120
end if
121
end event
122
123
124
event ObjectStartup
125
LoadSpriteSheet("Global/Items3.gif")
126
127
// Flame shield frames
128
SpriteFrame(-16, 9, 37, 15, 131, 52)
129
SpriteFrame(-20, -24, 39, 15, 131, 68)
130
SpriteFrame(-20, 3, 40, 21, 148, 101)
131
SpriteFrame(-23, -24, 47, 23, 189, 101)
132
SpriteFrame(-24, -9, 48, 29, 148, 125)
133
SpriteFrame(-24, -19, 48, 27, 197, 125)
134
SpriteFrame(-24, -15, 48, 28, 1, 132)
135
SpriteFrame(-24, -21, 48, 34, 50, 140)
136
SpriteFrame(-23, -17, 46, 32, 99, 140)
137
SpriteFrame(-24, -22, 48, 42, 1, 161)
138
SpriteFrame(-4, -21, 20, 43, 64, 175)
139
SpriteFrame(-24, -23, 48, 46, 85, 175)
140
SpriteFrame(-32, -19, 56, 38, 135, 175)
141
SpriteFrame(-40, -24, 63, 47, 192, 166)
142
SpriteFrame(0, 0, 1, 1, 1, 1) // (Empty)
143
end event
144
145
146
// ========================
147
// Editor Events
148
// ========================
149
150
event RSDKDraw
151
DrawSprite(0)
152
end event
153
154
155
event RSDKLoad
156
LoadSpriteSheet("Global/Display.gif")
157
SpriteFrame(-16, -16, 32, 32, 1, 143)
158
159
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
160
end event
161
162