Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/WFZ/Eggman.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Eggman 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.setLBounds
13
14
private alias object.value0 : object.timer
15
16
// States
17
private alias 0 : WFZEGGMAN_AWAITPLAYER
18
private alias 1 : WFZEGGMAN_WATCHFIGHT
19
private alias 2 : WFZEGGMAN_ESCAPE
20
21
// Player Aliases
22
private alias object.xpos : player.xpos
23
24
// Music Events
25
private alias 26 : SLOT_MUSICEVENT_BOSS
26
27
private alias 0 : MUSICEVENT_FADETOBOSS
28
private alias 1 : MUSICEVENT_FADETOSTAGE
29
30
31
// ========================
32
// Static Values
33
// ========================
34
35
private value WFZEggman_laserType = 0
36
37
38
// ========================
39
// Events
40
// ========================
41
42
event ObjectUpdate
43
switch object.state
44
case WFZEGGMAN_AWAITPLAYER
45
temp0 = object.xpos
46
temp0 -= 0x200000
47
if player[0].xpos > temp0
48
temp0 = stage.newYBoundary2
49
temp0 -= screen.ysize
50
stage.newYBoundary1 = temp0
51
52
if object.setLBounds == true
53
temp0 = object.ixpos
54
temp0 -= 212 // (screen.xcenter with the standard screen width of 424)
55
stage.newXBoundary1 = temp0
56
end if
57
object.xpos += 0xE00000
58
59
// Left barrier
60
object[+1].type = TypeName[Eggman Barrier]
61
object[+1].inkEffect = INK_ADD
62
63
// Right barrier
64
object[+2].type = TypeName[Eggman Barrier]
65
object[+2].propertyValue = 1
66
object[+2].inkEffect = INK_ADD
67
68
object[+4].type = WFZEggman_laserType
69
70
ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOBOSS, 0, 0)
71
object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE
72
73
object.priority = PRIORITY_ACTIVE
74
object.state = WFZEGGMAN_WATCHFIGHT
75
end if
76
break
77
78
case WFZEGGMAN_WATCHFIGHT
79
break
80
81
case WFZEGGMAN_ESCAPE
82
object.ypos += 0x10000
83
object.timer++
84
if object.timer == 240
85
stage.newYBoundary1 = 0
86
object.type = TypeName[Blank Object]
87
ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOSTAGE, 0, 0)
88
object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE
89
end if
90
break
91
92
end switch
93
94
object.animationTimer++
95
if object.animationTimer >= 6
96
object.animationTimer = 0
97
object.frame ^= 1
98
end if
99
end event
100
101
102
event ObjectDraw
103
if object.state > 0
104
DrawSprite(object.frame)
105
DrawSprite(2)
106
end if
107
end event
108
109
110
event ObjectStartup
111
CheckCurrentStageFolder("Zone11")
112
if checkResult == true
113
LoadSpriteSheet("SCZ/Objects.gif")
114
SpriteFrame(-16, -28, 32, 52, 398, 203)
115
SpriteFrame(-16, -27, 32, 51, 431, 204)
116
SpriteFrame(-32, 24, 64, 24, 1, 146)
117
WFZEggman_laserType = TypeName[Eggman Laser]
118
else
119
LoadSpriteSheet("MBZ/Objects.gif")
120
SpriteFrame(-16, -28, 32, 52, 737, 58)
121
SpriteFrame(-16, -27, 32, 51, 770, 58)
122
SpriteFrame(-32, 24, 64, 24, 464, 999)
123
WFZEggman_laserType = TypeName[Eggman Laser 3]
124
end if
125
end event
126
127
128
// ========================
129
// Editor Events
130
// ========================
131
132
event RSDKEdit
133
if editor.returnVariable == true
134
switch editor.variableID
135
case EDIT_VAR_PROPVAL // property value
136
checkResult = object.propertyValue
137
break
138
139
case 0 // setLBounds
140
checkResult = object.propertyValue
141
break
142
143
end switch
144
else
145
switch editor.variableID
146
case EDIT_VAR_PROPVAL // property value
147
object.propertyValue = editor.variableValue
148
break
149
150
case 0 // setLBounds
151
object.propertyValue = editor.variableValue
152
break
153
154
end switch
155
end if
156
end event
157
158
159
event RSDKDraw
160
DrawSprite(0)
161
end event
162
163
164
event RSDKLoad
165
CheckCurrentStageFolder("Zone11")
166
if checkResult == true
167
LoadSpriteSheet("SCZ/Objects.gif")
168
SpriteFrame(-16, -28, 32, 52, 398, 203)
169
else
170
LoadSpriteSheet("MBZ/Objects.gif")
171
SpriteFrame(-16, -28, 32, 52, 737, 58)
172
end if
173
174
AddEditorVariable("setLBounds")
175
SetActiveVariable("setLBounds")
176
AddEnumVariable("false", false)
177
AddEnumVariable("true", true)
178
end event
179
180