Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Special/WaterSplash.txt
1319 views
1
//----------------Sonic CD WaterSplash Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
7
// HUD Alias
8
#alias Object.Value7 : HUD.WaterTimer
9
10
// Player Alises
11
#alias Player.XPos : SSSonic.XPos
12
#alias Player.YPos : SSSonic.YPos
13
#alias Object.Value0 : SSSonic.ZPos
14
15
// Stage SFX
16
#alias 1 : SFX_S_WATERSPLASH
17
18
// Tile Info
19
#alias 6 : TILEINFO_ANGLEA
20
21
22
sub ObjectDraw
23
if SSSonic.YPos > 0
24
// If Sonic's in the air, he certainly isn't splashing around anymore so unload
25
ResetObjectEntity(3, TypeName[Blank Object], 0, 0, 0)
26
else
27
28
// Find the player's truncated X and Z pos
29
30
TempValue0 = SSSonic.XPos
31
TempValue0 >>= 16
32
33
TempValue1 = SSSonic[-1].ZPos
34
TempValue1 >>= 16
35
36
// Get the tile type Sonic's currently standing on
37
Get16x16TileInfo(CheckResult, TempValue0, TempValue1, TILEINFO_ANGLEA)
38
39
// Is it a water tile?
40
if CheckResult == 2
41
42
if Object.Frame == 0
43
PlayStageSfx(SFX_S_WATERSPLASH, false)
44
45
if Stage.TimeEnabled == true
46
HUD[4].WaterTimer = 40
47
end if
48
end if
49
50
// Animate the object
51
Object.Frame++
52
if Object.Frame == 40
53
Object.Frame = 28
54
end if
55
56
// Get the frame it should draw
57
TempValue0 = Object.Frame
58
TempValue0 >>= 2
59
60
// Draw the sprite around the center of the screen
61
DrawSpriteScreenXY(TempValue0, Screen.CenterX, 224)
62
63
else
64
// Sonic's not on a water tile, erase the Water Splash object
65
ResetObjectEntity(3, TypeName[Blank Object], 0, 0, 0)
66
HUD[4].WaterTimer = 0
67
end if
68
end if
69
70
end sub
71
72
73
sub ObjectStartup
74
75
LoadSpriteSheet("Special/Objects.gif")
76
77
// Water Splash Frames
78
SpriteFrame(-20, -32, 40, 32, 1, 84)
79
SpriteFrame(-20, -32, 40, 32, 42, 84)
80
SpriteFrame(-20, -32, 40, 32, 83, 84)
81
SpriteFrame(-20, -48, 40, 48, 124, 58)
82
SpriteFrame(-20, -64, 40, 64, 165, 58)
83
SpriteFrame(-20, -8, 40, 8, 124, 107)
84
SpriteFrame(-20, -8, 40, 8, 124, 116)
85
SpriteFrame(-20, -32, 40, 32, 42, 84)
86
SpriteFrame(-20, -32, 40, 32, 83, 84)
87
SpriteFrame(-20, -32, 40, 32, 1, 84)
88
89
end sub
90
91
92
// ========================
93
// Editor Subs
94
// ========================
95
96
sub RSDKDraw
97
DrawSprite(0)
98
end sub
99
100
101
sub RSDKLoad
102
LoadSpriteSheet("Special/Objects.gif")
103
SpriteFrame(-20, -32, 40, 32, 42, 84)
104
105
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
106
end sub
107
108