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/DEZ/EggmanWindow.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Eggman Window 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 0 : EGGMANWINDOWANI_WINDOWCLOSED
13
private alias 1 : EGGMANWINDOWANI_OPENWINDOW
14
private alias 2 : EGGMANWINDOWANI_IDLE
15
private alias 3 : EGGMANWINDOWANI_LAUGH
16
private alias 4 : EGGMANWINDOWANI_STUNNED
17
private alias 5 : EGGMANWINDOWANI_CLOSEWINDOW
18
19
// Player Aliases
20
private alias object.animation : player.animation
21
22
23
// ========================
24
// Events
25
// ========================
26
27
event ObjectUpdate
28
// This event exists in the code, but it's empty...
29
30
// Perhaps animation was originally done here, before being moved to ObjectDraw instead?
31
// Normally you wouldn't want animation in an ObjectDraw, but it seems to be intentional here so that Eggman keeps laughing after Sonic dies
32
end event
33
34
35
event ObjectDraw
36
switch object.animation
37
case EGGMANWINDOWANI_WINDOWCLOSED
38
DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)
39
break
40
41
case EGGMANWINDOWANI_OPENWINDOW
42
object.animationTimer++
43
if object.animationTimer == 4
44
object.animationTimer = 0
45
object.frame++
46
if object.frame == 4
47
object.animation = EGGMANWINDOWANI_IDLE
48
end if
49
end if
50
51
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
52
break
53
54
case EGGMANWINDOWANI_IDLE
55
DrawSpriteFX(4, FX_FLIP, object.xpos, object.ypos)
56
break
57
58
case EGGMANWINDOWANI_LAUGH
59
temp0 = object.animationTimer
60
temp0 &= 15
61
temp0 >>= 3
62
temp0 += 5
63
object.animationTimer++
64
if object.animationTimer == 50
65
object.animationTimer = 0
66
if player[0].animation != ANI_DYING
67
object.animation = EGGMANWINDOWANI_IDLE
68
end if
69
end if
70
71
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
72
break
73
74
case EGGMANWINDOWANI_STUNNED
75
temp0 = object.animationTimer
76
object.animationTimer++
77
if object.animationTimer == 50
78
object.animationTimer = 0
79
object.animation = EGGMANWINDOWANI_IDLE
80
end if
81
82
DrawSpriteFX(7, FX_FLIP, object.xpos, object.ypos)
83
break
84
85
case EGGMANWINDOWANI_CLOSEWINDOW
86
object.animationTimer++
87
if object.animationTimer == 4
88
object.animationTimer = 0
89
object.frame--
90
if object.frame == 0
91
object.animation = EGGMANWINDOWANI_WINDOWCLOSED
92
end if
93
end if
94
95
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
96
break
97
98
end switch
99
end event
100
101
102
event ObjectStartup
103
CheckCurrentStageFolder("Zone12")
104
if checkResult == true
105
LoadSpriteSheet("DEZ/Objects.gif")
106
107
// 0 - 3: Opening Window Frames (played in reverse order for closing)
108
SpriteFrame(-16, -12, 32, 24, 133, 114)
109
SpriteFrame(-16, -12, 32, 24, 100, 114)
110
SpriteFrame(-16, -12, 32, 24, 67, 114)
111
SpriteFrame(-16, -12, 32, 24, 34, 114)
112
113
// 4: Normal Frame
114
SpriteFrame(-16, -12, 32, 24, 1, 114)
115
116
// 5 - 6: Laughing Frames
117
SpriteFrame(-16, -12, 32, 24, 166, 114)
118
SpriteFrame(-16, -12, 32, 24, 199, 114)
119
120
// 7: Stunned Frame
121
SpriteFrame(-16, -12, 32, 24, 232, 114)
122
else
123
LoadSpriteSheet("MBZ/Objects.gif")
124
125
// 0 - 3: Opening Window Frames (played in reverse order for closing)
126
SpriteFrame(-16, -12, 32, 24, 645, 114)
127
SpriteFrame(-16, -12, 32, 24, 612, 114)
128
SpriteFrame(-16, -12, 32, 24, 579, 114)
129
SpriteFrame(-16, -12, 32, 24, 546, 114)
130
131
// 4: Normal Frame
132
SpriteFrame(-16, -12, 32, 24, 513, 114)
133
134
// 5 - 6: Laughing Frames
135
SpriteFrame(-16, -12, 32, 24, 678, 114)
136
SpriteFrame(-16, -12, 32, 24, 711, 114)
137
138
// 7: Stunned Frame
139
SpriteFrame(-16, -12, 32, 24, 744, 114)
140
end if
141
end event
142
143
144
// ========================
145
// Editor Events
146
// ========================
147
148
event RSDKDraw
149
DrawSprite(0)
150
end event
151
152
153
event RSDKLoad
154
CheckCurrentStageFolder("Zone12")
155
if checkResult == true
156
LoadSpriteSheet("DEZ/Objects.gif")
157
SpriteFrame(-16, -12, 32, 24, 133, 114) // peekin'
158
else
159
LoadSpriteSheet("MBZ/Objects.gif")
160
SpriteFrame(-16, -12, 32, 24, 645, 114)
161
end if
162
163
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
164
end event
165
166