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/EHZ/EggmanWheel.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Eggman Wheel 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.value0 : object.timer
13
private alias object.value1 : object.xOffset
14
private alias object.value2 : object.parent
15
16
// States
17
private alias 0 : EHZEGGMANWHEEL_ATTATCHED
18
private alias 1 : EHZEGGMANWHEEL_IDLE
19
private alias 2 : EHZEGGMANWHEEL_BOUNCE
20
21
// Car Aliases
22
private alias object.value4 : eggmanCar.carPos.y
23
24
// Eggman States
25
private alias 1 : EHZEGGMAN_FLYIN
26
private alias 3 : EHZEGGMAN_STARTCAR
27
28
// Path ID Aliases
29
private alias 0 : PATH_A
30
31
32
// ========================
33
// Events
34
// ========================
35
36
event ObjectUpdate
37
switch object.state
38
case EHZEGGMANWHEEL_ATTATCHED
39
arrayPos0 = object.parent
40
41
object.xpos = object[arrayPos0].xpos
42
if object.direction == FLIP_NONE
43
object.xpos += object.xOffset
44
else
45
object.xpos -= object.xOffset
46
end if
47
48
object.ypos = object[arrayPos0].ypos
49
object.ypos += 0xC0000
50
ObjectTileGrip(CSIDE_FLOOR, 0, 17, PATH_A)
51
52
if object[arrayPos0].state != EHZEGGMAN_FLYIN
53
if object[arrayPos0].state != EHZEGGMAN_STARTCAR
54
object.timer++
55
object.timer &= 3
56
object.frame = object.timer
57
object.frame >>= 1
58
59
if object.xOffset == -0x2C0000
60
object.frame += 2
61
end if
62
end if
63
end if
64
65
if object.xOffset != -0x2C0000
66
eggmanCar[arrayPos0].carPos.y += object.ypos
67
end if
68
break
69
70
case EHZEGGMANWHEEL_IDLE
71
break
72
73
case EHZEGGMANWHEEL_BOUNCE
74
if object.yvel >= 0
75
ObjectTileCollision(CSIDE_FLOOR, 0, 17, PATH_A)
76
if checkResult == true
77
FlipSign(object.yvel)
78
end if
79
end if
80
81
object.xpos += object.xvel
82
object.ypos += object.yvel
83
object.yvel += 0x3800
84
85
if object.outOfBounds == true
86
object.type = TypeName[Blank Object]
87
end if
88
break
89
90
end switch
91
end event
92
93
94
event ObjectDraw
95
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
96
end event
97
98
99
event ObjectStartup
100
CheckCurrentStageFolder("Zone01")
101
if checkResult == true
102
LoadSpriteSheet("EHZ/Objects.gif")
103
104
// Wheel Frames
105
SpriteFrame(-16, -16, 32, 32, 1, 143)
106
SpriteFrame(-16, -16, 32, 32, 34, 143)
107
SpriteFrame(-16, -16, 32, 32, 1, 176)
108
SpriteFrame(-16, -16, 32, 32, 34, 176)
109
else
110
LoadSpriteSheet("MBZ/Objects.gif")
111
112
// Wheel Frames
113
SpriteFrame(-16, -16, 32, 32, 123, 58)
114
SpriteFrame(-16, -16, 32, 32, 156, 58)
115
SpriteFrame(-16, -16, 32, 32, 189, 58)
116
SpriteFrame(-16, -16, 32, 32, 222, 58)
117
end if
118
end event
119
120
121
// ========================
122
// Editor Events
123
// ========================
124
125
event RSDKDraw
126
DrawSprite(0)
127
end event
128
129
130
event RSDKLoad
131
CheckCurrentStageFolder("Zone01")
132
if checkResult == true
133
LoadSpriteSheet("EHZ/Objects.gif")
134
SpriteFrame(-16, -16, 32, 32, 1, 143)
135
else
136
LoadSpriteSheet("MBZ/Objects.gif")
137
SpriteFrame(-16, -16, 32, 32, 123, 58)
138
end if
139
140
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
141
end event
142
143