Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R3/Eggman.txt
1319 views
1
//------------------Sonic CD Eggman Script--------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.FrameTimer
7
#alias Object.Value1 : Object.Timer
8
9
// Boss Body Aliases
10
#alias Object[+1].Value5 : BossBody.DamageTimer
11
#alias Object[+1].State : BossBody.State
12
13
// States
14
#alias 0 : EGGMAN_IDLE
15
#alias 1 : EGGMAN_HURT
16
#alias 2 : EGGMAN_NERVOUS
17
#alias 3 : EGGMAN_FLEE
18
19
// BossBody Aliases
20
#alias 5 : BOSSBODY_DRAG_EGGMAN_2
21
22
23
sub ObjectMain
24
switch Object.State
25
case EGGMAN_IDLE
26
Object.FrameTimer++
27
Object.FrameTimer %= 40
28
break
29
30
case EGGMAN_HURT
31
if Object.Timer < 41
32
Object.Timer++
33
else
34
Object.Timer = 0
35
Object.FrameTimer = 0
36
if BossBody.State < BOSSBODY_DRAG_EGGMAN_2
37
Object.State = EGGMAN_IDLE
38
else
39
Object.State = EGGMAN_NERVOUS
40
end if
41
end if
42
break
43
44
case EGGMAN_NERVOUS
45
Object.FrameTimer++
46
Object.FrameTimer &= 31
47
break
48
49
case EGGMAN_FLEE
50
Object.FrameTimer++
51
Object.FrameTimer &= 7
52
break
53
54
end switch
55
end sub
56
57
58
sub ObjectDraw
59
switch Object.State
60
case EGGMAN_IDLE
61
DrawSprite(4)
62
63
TempValue0 = Object.FrameTimer
64
TempValue0 /= 10
65
DrawSprite(TempValue0)
66
break
67
68
case EGGMAN_HURT
69
TempValue1 = Object.Timer
70
TempValue1 <<= 8
71
TempValue1 /= 40
72
73
Sin(TempValue0, TempValue1)
74
TempValue0 <<= 11
75
FlipSign(TempValue0)
76
TempValue0 += Object.YPos
77
78
TempValue1 = Object.Timer
79
TempValue1 &= 15
80
TempValue1 >>= 3
81
TempValue1 += 7
82
DrawSpriteXY(TempValue1, Object.XPos, TempValue0)
83
84
TempValue0 = BossBody.DamageTimer
85
TempValue0 &= 1
86
TempValue0 += 4
87
DrawSprite(TempValue0)
88
89
DrawSprite(6)
90
break
91
92
case EGGMAN_NERVOUS
93
TempValue0 = Object.FrameTimer
94
TempValue0 >>= 4
95
TempValue0 += 9
96
DrawSprite(TempValue0)
97
break
98
99
case EGGMAN_FLEE
100
TempValue0 = Object.FrameTimer
101
TempValue0 >>= 2
102
TempValue0 += 11
103
DrawSprite(TempValue0)
104
105
Object.XPos += 0x40000
106
107
if Object.OutOfBounds == true
108
ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)
109
end if
110
break
111
end switch
112
end sub
113
114
115
sub ObjectStartup
116
LoadSpriteSheet("R3/Objects2.gif")
117
118
// Eggman Idle
119
SpriteFrame(-24, -56, 48, 24, 1, 166) // #0 - Eggman Idle Frame 0
120
SpriteFrame(-24, -56, 48, 24, 50, 166) // #1 - Eggman Idle Frame 1
121
SpriteFrame(-24, -56, 48, 24, 148, 174) // #2 - Eggman Idle Frame 2
122
SpriteFrame(-24, -56, 48, 24, 99, 166) // #3 - Eggman Idle Frame 3
123
124
// Egg Tilter Controller
125
SpriteFrame(-24, -32, 48, 16, 148, 107) // #4 - Egg Tilter Controller
126
SpriteFrame(-24, -32, 48, 16, 148, 124) // #5 - Egg Tilter Controller Flicker
127
128
// Egg Mobile window
129
SpriteFrame(-16, -48, 32, 16, 84, 50) // #6 - Egg Mobile Window
130
131
// Eggman Hurt
132
SpriteFrame(-32, -67, 56, 64, 199, 134) // #7 - Eggman Hurt Frame 0
133
SpriteFrame(-23, -67, 56, 64, 199, 69) // #8 - Eggman Hurt Frame 1
134
135
// Eggman Nervous
136
SpriteFrame(-24, -56, 48, 56, 197, 199) // #9 - Eggman Nervous Frame 0
137
SpriteFrame(-24, -56, 48, 56, 147, 199) // #10 - Eggman Nervous Frame 1
138
139
// Eggman Flee
140
SpriteFrame(-16, -56, 72, 64, 1, 191) // #11 - Eggman Flee Frame 0
141
SpriteFrame(-16, -56, 72, 64, 74, 191) // #12 - Eggman Flee Frame 1
142
end sub
143
144
145
// ========================
146
// Editor Subs
147
// ========================
148
149
sub RSDKDraw
150
DrawSprite(0)
151
DrawSprite(1)
152
DrawSprite(2)
153
end sub
154
155
156
sub RSDKLoad
157
LoadSpriteSheet("R3/Objects2.gif")
158
159
// Eggman Idle
160
SpriteFrame(-24, -56, 48, 24, 1, 166) // #0 - Eggman Idle Frame 0
161
162
// Egg Tilter Controller
163
SpriteFrame(-24, -32, 48, 16, 148, 107) // #1 - Egg Tilter Controller
164
// Egg Mobile window
165
SpriteFrame(-16, -48, 32, 16, 84, 50) // #2 - Egg Mobile Window
166
167
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
168
end sub
169
170