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/Mission/MissionAreaBL.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: MissionAreaBL 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.state : object.setBounds
13
14
// Player Aliases
15
private alias object.xpos : player.xpos
16
private alias object.ypos : player.ypos
17
private alias object.xvel : player.xvel
18
private alias object.yvel : player.yvel
19
private alias object.speed : player.speed
20
21
// Priority Aliases
22
private alias 1 : PRIORITY_ACTIVE
23
private alias 5 : PRIORITY_INACTIVE
24
25
26
// ========================
27
// Events
28
// ========================
29
30
event ObjectUpdate
31
if object.setBounds == false
32
stage.newXBoundary1 = object.xpos
33
stage.newXBoundary1 >>= 16
34
stage.newXBoundary1 -= 16
35
36
stage.newYBoundary2 = object.ypos
37
stage.newYBoundary2 >>= 16
38
stage.newYBoundary2 += 16
39
40
object.setBounds = true
41
end if
42
43
if stage.state == STAGE_RUNNING
44
// Make sure Sonic doesn't go lower than this Object
45
if player[0].ypos > object.ypos
46
player[0].yvel = 0
47
player[0].speed = 0
48
player[0].ypos = object.ypos
49
50
game.forceKillPlayer = true
51
object.priority = PRIORITY_INACTIVE // This Object's job is done, we don't need to be here anymore
52
end if
53
54
// Make sure Sonic doesn't go before this Object, either
55
if player[0].xpos < object.xpos
56
player[0].xvel = 0
57
player[0].speed = 0
58
player[0].xpos = object.xpos
59
60
// In this case though, we aren't gonna unload because we're only enforcing normal walls, not death bounds
61
end if
62
end if
63
end event
64
65
66
event ObjectDraw
67
// A whole event exists here, and yet nothing's in it...
68
end event
69
70
71
event ObjectStartup
72
// Cycle through all MissionAreaBL objects in the level and make them active
73
foreach (TypeName[MissionAreaBL], arrayPos0, ALL_ENTITIES)
74
object[arrayPos0].priority = PRIORITY_ACTIVE
75
next
76
end event
77
78
79
// ========================
80
// Editor Events
81
// ========================
82
83
event RSDKDraw
84
DrawSprite(0)
85
86
editor.drawingOverlay = true
87
88
temp0 = object.xpos
89
temp0 -= 0x100000
90
91
temp1 = object.ypos
92
temp1 += 0x100000
93
94
temp2 = temp0
95
temp2 += 0x380000
96
97
temp3 = temp1
98
temp3 -= 0x380000
99
100
// draw some long corners
101
// TODO: i don't think this works, ask for a render
102
DrawLine(temp0, temp1, temp0, temp3, 255, 0, 255)
103
DrawLine(temp0, temp1, temp2, temp1, 255, 0, 255)
104
105
editor.drawingOverlay = false
106
end event
107
108
109
event RSDKLoad
110
LoadSpriteSheet("Global/Display.gif")
111
SpriteFrame(-16, -16, 32, 32, 1, 143)
112
113
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
114
end event
115
116