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/MissionBlockCollisionM027.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: MBC_M027 Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
// Octus Aliases
13
private alias object.value0 : object.timer
14
15
private alias 0 : OCTUS_SETUP
16
private alias 4 : OCTUS_FALL
17
18
19
// ========================
20
// Events
21
// ========================
22
23
event ObjectUpdate
24
foreach (TypeName[MissionBlock], arrayPos0, ACTIVE_ENTITIES)
25
foreach (TypeName[Octus], arrayPos1, ACTIVE_ENTITIES)
26
// Have each Mission Block in the level check against collision for each Octus in the level
27
BoxCollisionTest(C_SOLID, arrayPos0, -16, -16, 16, 16, arrayPos1, -21, -12, 21, 13)
28
if checkResult == COL_TOP
29
if object[arrayPos1].state == OCTUS_FALL
30
// If the Octus is falling, then make it assume the Mission Block is normal ground
31
object[arrayPos1].timer = 0
32
object[arrayPos1].yvel = 0
33
object[arrayPos1].animationTimer = 0
34
object[arrayPos1].state = OCTUS_SETUP
35
end if
36
end if
37
next
38
next
39
end event
40
41
42
event ObjectDraw
43
// huh?
44
// This object doesn't have a sheet loaded, nor any Sprite Frames, so what's this doing here...?
45
// And because the object is PRIORITY_ACTIVE, this is *always* getting drawn, at all times offscreen
46
DrawSprite(0)
47
end event
48
49
50
event ObjectStartup
51
// See if we're in the OOZ Mission folder and in act 1
52
CheckCurrentStageFolder("Mission_Zone07")
53
temp0 = checkResult
54
CheckEqual(stage.actNum, 1)
55
temp0 &= checkResult
56
if temp0 == true
57
// If we are, then make each Mission Block Collision for Mission 27 Object active
58
foreach (TypeName[MBC_M027], arrayPos0, ALL_ENTITIES)
59
object[arrayPos0].priority = PRIORITY_ACTIVE
60
next
61
else
62
// If we aren't, then delete each Mission Block Collision for Mission 27 Object in the scene
63
// Quite the mouthful, isn't it?
64
foreach (TypeName[MBC_M027], arrayPos0, ALL_ENTITIES)
65
object[arrayPos0].type = TypeName[Blank Object]
66
next
67
end if
68
end event
69
70
71
// ========================
72
// Editor Events
73
// ========================
74
75
event RSDKDraw
76
DrawSprite(0)
77
end event
78
79
80
event RSDKLoad
81
LoadSpriteSheet("Global/Display.gif")
82
SpriteFrame(-16, -16, 32, 32, 1, 143)
83
84
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
85
end event
86
87