Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Title/Background.txt
1319 views
1
//-----------------Sonic CD Background Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.LPlanetYOffset
7
#alias Object.Value1 : Object.Unused
8
9
10
sub ObjectDraw
11
// Draw the solid background color
12
TempValue0 = Screen.CenterX
13
TempValue0 <<= 1
14
DrawRect(0, 0, TempValue0, 100, 0, 0, 96, 255)
15
16
#platform: Use_Decomp
17
// Draw a small blue rectangle extension again
18
// -> This fixes the gray rectangle that appears when the screen is too wide
19
DrawRect(0, 0, TempValue0, 180, 0, 0, 96, 255)
20
#endplatform
21
22
// Little Planet Movement
23
Sin(TempValue0, Object.LPlanetYOffset)
24
TempValue0 >>= 7
25
TempValue0 -= 16
26
27
DrawSpriteScreenXY(2, 280, TempValue0)
28
Object.LPlanetYOffset++
29
Object.LPlanetYOffset &= 511
30
31
// Water Movement
32
TempValue0 = 3
33
TempValue1 = 16
34
ArrayPos0 = 40
35
while TempValue0 < 39
36
Object[ArrayPos0].XPos += TempValue1
37
if Object[ArrayPos0].XPos > 0x2000000
38
// Wrap the water 512 pixels back
39
Object[ArrayPos0].XPos -= 0x2000000
40
end if
41
42
TempValue2 = Object[ArrayPos0].XPos
43
TempValue2 >>= 16
44
ArrayPos0++
45
46
DrawSpriteScreenXY(TempValue0, TempValue2, 0)
47
TempValue0++
48
DrawSpriteScreenXY(TempValue0, TempValue2, 0)
49
TempValue0++
50
51
TempValue1 += 0x2000
52
loop
53
54
// Unknown use, this Value's never referenced anywhere else...
55
Object.Unused++
56
Object.Unused &= 511
57
end sub
58
59
60
sub ObjectStartup
61
LoadSpriteSheet("Title/Title.gif")
62
63
// Note: this three sprite frames are not actually used, the actual mountains are in Logo
64
SpriteFrame(0, 0, 176, 68, 256, 4) // #0 - Left Mountain
65
66
// SpriteFrame(-124, 0, 124, 68, 256, 77) // #1 - Steam/Blit version location of Right Mountain
67
68
SpriteFrame(-144, 0, 144, 68, 257, 251) // #1 - Right Mountain
69
70
SpriteFrame(0, 0, 120, 104, 257, 146) // #2 - Little Planet
71
72
// #4 - #20 rows of water sprites, from back to front
73
TempValue0 = 447
74
TempValue1 = 168
75
while TempValue0 < 511
76
SpriteFrame(0, TempValue1, 512, 4, 0, TempValue0)
77
SpriteFrame(-512, TempValue1, 512, 4, 0, TempValue0)
78
TempValue0 += 4
79
TempValue1 += 4
80
loop
81
82
// #21 - #22 rows of water sprites, from back to front
83
TempValue0 -= 16
84
while TempValue1 < 240
85
SpriteFrame(0, TempValue1, 512, 4, 0, TempValue0)
86
SpriteFrame(-512, TempValue1, 512, 4, 0, TempValue0)
87
TempValue0 += 4
88
TempValue1 += 4
89
loop
90
end sub
91
92
93
// ========================
94
// Editor Subs
95
// ========================
96
97
sub RSDKDraw
98
DrawSprite(0)
99
end sub
100
101
102
sub RSDKLoad
103
LoadSpriteSheet("Title/Title.gif")
104
SpriteFrame(0, 0, 120, 104, 257, 146)
105
106
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
107
end sub
108
109