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