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/MissionBlockCollisionM040.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: MBC_M040 Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
// Player Aliases
13
private alias object.pushing : player.pushing
14
15
// Octus Aliases
16
private alias object.value0 : object.timer
17
18
private alias 0 : OCTUS_SETUP
19
private alias 4 : OCTUS_FALL
20
21
22
// ========================
23
// Events
24
// ========================
25
26
event ObjectUpdate
27
temp0 = false
28
29
// Check collision between every MissionBlock and Octus
30
foreach (TypeName[MissionBlock], arrayPos0, ACTIVE_ENTITIES)
31
foreach (TypeName[Octus], arrayPos1, ACTIVE_ENTITIES)
32
BoxCollisionTest(C_SOLID, arrayPos0, -16, -16, 16, 16, arrayPos1, -21, -12, 21, 13)
33
if checkResult == COL_TOP
34
if object[arrayPos1].state == OCTUS_FALL
35
object[arrayPos1].timer = 0
36
object[arrayPos1].yvel = 0
37
object[arrayPos1].animationTimer = 0
38
object[arrayPos1].state = OCTUS_SETUP
39
end if
40
end if
41
next
42
43
// Huh? A Mission Block's value0 is never referenced or used at all beyond here, what's this supposed to mean?
44
temp0 |= object[arrayPos0].value0
45
next
46
47
if temp0 == false
48
// If that flag was not set, then reset Player 1's pushing value
49
// (but like, why?? these are Octuses, the player doesn't matter here...
50
// this mission is in SCZ where pushing shouldn't be done anyway, but i still don't see why this exists at all)
51
player[0].pushing = 0
52
end if
53
end event
54
55
56
event ObjectDraw
57
// This object doesn't even load a sheet, nor does it set up any Sprite Frames, and yet it tries to draw with... something
58
59
DrawSprite(0)
60
end event
61
62
63
event ObjectStartup
64
// Not sure why checkResult isn't just looked at directly here, though this object seems to be based off the M027 version of the MBC so it may come from editing off that
65
// This object is only used in the Mission_Zone10 folder at all anyway, this is kinda redundant...
66
CheckCurrentStageFolder("Mission_Zone10")
67
temp0 = checkResult
68
if temp0 == true
69
foreach (TypeName[MBC_M040], arrayPos0, ALL_ENTITIES)
70
object[arrayPos0].priority = PRIORITY_ACTIVE
71
next
72
else
73
foreach (TypeName[MBC_M040], arrayPos0, ALL_ENTITIES)
74
object[arrayPos0].type = TypeName[Blank Object]
75
next
76
end if
77
end event
78
79
80
// ========================
81
// Editor Events
82
// ========================
83
84
event RSDKDraw
85
DrawSprite(0)
86
end event
87
88
89
event RSDKLoad
90
LoadSpriteSheet("Global/Display.gif")
91
SpriteFrame(-16, -16, 32, 32, 1, 143)
92
93
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
94
end event
95
96