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/Special/BlueBlock.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Blue Block 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.propertyValue : object.colorChangeOffset
13
14
15
// ========================
16
// Function Declarations
17
// ========================
18
19
reserve function BlueBlock_DebugDraw
20
reserve function BlueBlock_DebugSpawn
21
22
23
// ========================
24
// Function Definitions
25
// ========================
26
27
private function BlueBlock_DebugDraw
28
DrawSprite(0)
29
DrawSprite(1)
30
DrawSprite(2)
31
end function
32
33
34
private function BlueBlock_DebugSpawn
35
temp5 = TypeName[Blue Block]
36
temp4 = 0
37
CallFunction(DebugMode_PlaceBlock)
38
object[arrayPos0].drawOrder = 4
39
object[arrayPos0].groupID = GROUP_BLOCKS
40
end function
41
42
43
// ========================
44
// Events
45
// ========================
46
47
event ObjectUpdate
48
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
49
CallFunction(SpecialSetup_PlayerBlockCol)
50
next
51
end event
52
53
54
event ObjectDraw
55
if object.colorChangeOffset > 0
56
temp0 = SpecialSetup_blockTimer
57
temp0 >>= 3
58
temp1 = object.colorChangeOffset
59
temp1 -= temp0
60
switch temp1
61
case 1
62
case 3
63
object.type = TypeName[Yellow Block]
64
break
65
66
default
67
break
68
end switch
69
end if
70
71
CallFunction(SpecialSetup_GetBlockPos)
72
DrawSpriteFX(0, FX_ROTATE, temp0, temp1)
73
DrawSpriteXY(1, temp0, temp1)
74
75
temp2 = object.rotation
76
temp2 >>= 3
77
temp2 += 2
78
DrawSpriteFX(temp2, FX_ROTATE, temp0, temp1)
79
80
object.type = TypeName[Blue Block]
81
end event
82
83
84
event ObjectStartup
85
LoadSpriteSheet("Special/Objects.gif")
86
87
// Sprite frames
88
SpriteFrame(-12, -12, 24, 24, 126, 76)
89
SpriteFrame(-10, -8, 20, 16, 151, 76)
90
temp0 = 1
91
temp1 = 1
92
while temp1 < 100
93
temp0 = 1
94
while temp0 < 500
95
SpriteFrame(-12, -12, 24, 24, temp0, temp1)
96
temp0 += 25
97
loop
98
temp1 += 25
99
loop
100
101
// Add it to the blocks group
102
foreach (TypeName[Blue Block], arrayPos0, ALL_ENTITIES)
103
object[arrayPos0].groupID = GROUP_BLOCKS
104
next
105
106
// Add this object to the stage's debug mode list
107
SetTableValue(TypeName[Blue Block], DebugMode_ObjCount, DebugMode_TypeTable)
108
SetTableValue(BlueBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
109
SetTableValue(BlueBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
110
DebugMode_ObjCount++
111
end event
112
113
114
// ========================
115
// Editor Events
116
// ========================
117
118
event RSDKEdit
119
if editor.returnVariable == true
120
switch editor.variableID
121
case EDIT_VAR_PROPVAL // property value
122
checkResult = object.propertyValue
123
checkResult &= 7
124
break
125
126
case 0 // colorChangeOffset
127
checkResult = object.propertyValue
128
checkResult &= 7
129
break
130
131
end switch
132
else
133
switch editor.variableID
134
case EDIT_VAR_PROPVAL // property value
135
object.propertyValue = editor.variableValue
136
object.propertyValue &= 7
137
break
138
139
case 0 // colorChangeOffset
140
object.propertyValue = editor.variableValue
141
object.propertyValue &= 7
142
break
143
144
end switch
145
end if
146
end event
147
148
149
event RSDKDraw
150
DrawSprite(0)
151
DrawSprite(1)
152
DrawSprite(2)
153
end event
154
155
156
event RSDKLoad
157
LoadSpriteSheet("Special/Objects.gif")
158
SpriteFrame(-12, -12, 24, 24, 126, 76)
159
SpriteFrame(-10, -8, 20, 16, 151, 76)
160
SpriteFrame(-12, -12, 24, 24, 1, 1)
161
162
AddEditorVariable("colorChangeOffset")
163
SetActiveVariable("colorChangeOffset")
164
AddEnumVariable("Frame 0", 0)
165
AddEnumVariable("Frame 1", 1)
166
AddEnumVariable("Frame 2", 2)
167
AddEnumVariable("Frame 3", 3)
168
AddEnumVariable("Frame 4", 4)
169
AddEnumVariable("Frame 5", 5)
170
AddEnumVariable("Frame 6", 6)
171
AddEnumVariable("Frame 7", 7)
172
end event
173
174