Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R4/BossWaterTrigger.txt
1319 views
1
//-------------Sonic CD Boss Water Trigger Script-------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.WaterEntity
7
#alias Object.YPos : Water.YPos
8
9
// Property Values
10
#alias 0 : BOSSWATERTRIGGER_RAISE_WATER
11
#alias 1 : BOSSWATERTRIGGER_SET_Y_BOUNDS
12
13
14
sub ObjectMain
15
switch Object.PropertyValue
16
case BOSSWATERTRIGGER_RAISE_WATER
17
if Player.XPos > Object.XPos
18
// Y - 1172 in map coords
19
if Stage.NewWaterLevel > 0x4940000
20
Stage.NewWaterLevel = 0x4940000
21
22
ArrayPos0 = Object.WaterEntity
23
24
Water[ArrayPos0].YPos = Screen.YOffset
25
Water[ArrayPos0].YPos += 256
26
Water[ArrayPos0].YPos <<= 16
27
28
Stage.YBoundary2 = 1496
29
end if
30
else
31
// Y - 3072 in map coords
32
if Stage.NewWaterLevel < 0xC000000
33
Stage.NewWaterLevel = 0xC000000
34
Stage.NewYBoundary2 = 2304
35
end if
36
37
ArrayPos0 = Object.WaterEntity
38
39
TempValue0 = Screen.YOffset
40
TempValue0 += 256
41
TempValue0 <<= 16
42
if Water[ArrayPos0].YPos >= TempValue0
43
Water[ArrayPos0].YPos = 0xC000000
44
end if
45
end if
46
break
47
48
case BOSSWATERTRIGGER_SET_Y_BOUNDS
49
if Player.XPos > Object.XPos
50
Stage.NewYBoundary2 = 1448
51
else
52
Stage.NewYBoundary2 = 1496
53
end if
54
break
55
end switch
56
end sub
57
58
59
sub ObjectStartup
60
ArrayPos0 = 32
61
while ArrayPos0 < 1056
62
if Object[ArrayPos0].Type == TypeName[Water]
63
TempValue0 = ArrayPos0
64
end if
65
ArrayPos0++
66
loop
67
68
ArrayPos0 = 32
69
while ArrayPos0 < 1056
70
if Object[ArrayPos0].Type == TypeName[BossWaterTrigger]
71
Object[ArrayPos0].WaterEntity = TempValue0
72
end if
73
ArrayPos0++
74
loop
75
end sub
76
77
78
// ========================
79
// Editor Subs
80
// ========================
81
82
sub RSDKDraw
83
DrawSprite(0)
84
end sub
85
86
87
sub RSDKLoad
88
LoadSpriteSheet("Global/Display.gif")
89
SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon
90
91
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
92
end sub
93
94