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/MCZ/EggmanDrill.txt
1488 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Eggman Drill 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 : DRILL_ACTIVE
13
private alias 1 : DRILL_FELLOFF
14
15
16
// ========================
17
// Events
18
// ========================
19
20
event ObjectUpdate
21
if object.state == DRILL_ACTIVE
22
if object.interaction == true
23
// Object is active, check collision with players
24
25
// Backup the object's position since it'll need to be changed for collision checks
26
temp0 = object.xpos
27
temp1 = object.ypos
28
29
// First, check for the hitbox at the base of the drill
30
Sin(object.xpos, object.angle)
31
if object.direction == FLIP_NONE
32
object.xpos *= -0xC00
33
else
34
object.xpos *= 0xC00
35
end if
36
Cos(object.ypos, object.angle)
37
object.ypos *= -0xC00
38
object.xpos += temp0
39
object.ypos += temp1
40
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
41
BoxCollisionTest(C_TOUCH, object.entityPos, -6, -6, 6, 6, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
42
if checkResult == true
43
CallFunction(Player_Hit)
44
end if
45
next
46
47
// Check for the hitbox at the tip of the drill, too
48
Sin(object.xpos, object.angle)
49
if object.direction == FLIP_NONE
50
object.xpos *= -0x1300
51
else
52
object.xpos *= 0x1300
53
end if
54
Cos(object.ypos, object.angle)
55
object.ypos *= -0x1300
56
object.xpos += temp0
57
object.ypos += temp1
58
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
59
BoxCollisionTest(C_TOUCH, object.entityPos, -4, -4, 4, 4, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
60
if checkResult == true
61
CallFunction(Player_Hit)
62
end if
63
next
64
65
// Restore the object's position
66
object.xpos = temp0
67
object.ypos = temp1
68
end if
69
else
70
// Drills falling off after boss is defeated
71
object.xpos += object.xvel
72
object.ypos += object.yvel
73
object.yvel += 0x3800
74
75
if object.outOfBounds == true
76
object.type = TypeName[Blank Object]
77
end if
78
end if
79
end event
80
81
82
event ObjectDraw
83
DrawSpriteFX(object.frame, FX_ROTATE, object.xpos, object.ypos)
84
end event
85
86
87
event ObjectStartup
88
CheckCurrentStageFolder("Zone06")
89
if checkResult == true
90
LoadSpriteSheet("MCZ/Objects.gif")
91
SpriteFrame(-12, -48, 24, 64, 1, 132)
92
SpriteFrame(-12, -48, 24, 64, 26, 132)
93
SpriteFrame(-12, -48, 24, 64, 51, 132)
94
// Mid-turn frame inbetween the two is unused, the sprite is rotated via script FX instead
95
SpriteFrame(-48, -12, 64, 24, 150, 182)
96
SpriteFrame(-48, -12, 64, 24, 150, 207)
97
SpriteFrame(-48, -12, 64, 24, 150, 232)
98
else
99
LoadSpriteSheet("MBZ/Objects.gif")
100
SpriteFrame(-12, -48, 24, 64, 42, 191)
101
SpriteFrame(-12, -48, 24, 64, 67, 191)
102
SpriteFrame(-12, -48, 24, 64, 92, 191)
103
104
SpriteFrame(-48, -12, 64, 24, 117, 181)
105
SpriteFrame(-48, -12, 64, 24, 117, 206)
106
SpriteFrame(-48, -12, 64, 24, 117, 231)
107
end if
108
end event
109
110
111
// ========================
112
// Editor Events
113
// ========================
114
115
event RSDKDraw
116
DrawSprite(0)
117
end event
118
119
120
event RSDKLoad
121
CheckCurrentStageFolder("Zone06")
122
if checkResult == true
123
LoadSpriteSheet("MCZ/Objects.gif")
124
SpriteFrame(-12, -48, 24, 64, 1, 132)
125
else
126
LoadSpriteSheet("MBZ/Objects.gif")
127
SpriteFrame(-12, -48, 24, 64, 42, 191)
128
end if
129
130
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
131
end event
132
133