Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R5/R5AGlowEffect.txt
1319 views
1
//----------------Sonic CD Glow Effect Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Timer
7
8
// Layer Aliases
9
#alias 1 : LAYER_INSIDE
10
11
// Priority
12
#alias 1 : PRIORITY_ACTIVE
13
14
15
sub ObjectDraw
16
17
// Only animate when the currently active BG is the Cave
18
if Stage.ActiveLayer[0] == LAYER_INSIDE
19
20
// Get the Palette Animation Frame to use
21
TempValue0 = Object.Timer
22
TempValue0 /= 6
23
24
// From this Frame, jump as needed to the Palette ID needed
25
switch TempValue0
26
case 0
27
// Cases 0/3 are all the same and could probably be combined,
28
// akin to 4/8 or 5/7, but I suppose they just didn't feel like doing that...
29
SetActivePalette(0, 0, Screen.YSize)
30
break
31
case 1
32
SetActivePalette(0, 0, Screen.YSize)
33
break
34
case 2
35
SetActivePalette(0, 0, Screen.YSize)
36
break
37
case 3
38
SetActivePalette(0, 0, Screen.YSize)
39
break
40
case 4
41
case 8
42
SetActivePalette(1, 0, Screen.YSize)
43
break
44
case 5
45
case 7
46
SetActivePalette(2, 0, Screen.YSize)
47
break
48
case 6
49
SetActivePalette(3, 0, Screen.YSize)
50
break
51
end switch
52
53
// Animate as needed
54
Object.Timer++
55
Object.Timer %= 54
56
57
end if
58
59
end sub
60
61
62
sub ObjectStartup
63
64
// This object is only for when Software rendering is active
65
// That's because both this and the Conveyors use palette effects, and due to how the HW render works only one can be active at a time
66
// The Conveyors take precedence since they're part of the actual gameplay, these BG rocks are just a visual effect so they're stuffed in the BG and left unanimated in that case
67
#platform: SW_Rendering
68
69
// Place a Glow Effect Object into the level
70
Object[21].Type = TypeName[Glow Effect]
71
72
// Make it active, since BG rocks should always glow throughout the stage
73
Object[21].Priority = PRIORITY_ACTIVE
74
75
// Give it the lowest Draw Order possible, so that it only effects the BG Rocks
76
// This Draw Order is intentionally set to be lower than the Conveyor Belt Object,
77
// which is Draw Order 1 and does Palette trickery too
78
Object[21].DrawOrder = 0
79
80
// Setup all the Palettes
81
82
// There's no need to copy palette bank 0 into all the others,
83
// because that's already been done by the Conveyor Belt Object, which comes before this one
84
85
TempValue0 = 0
86
TempValue1 = 0
87
TempValue2 = 16
88
while TempValue0 < 5
89
LoadPalette("R5A_GlowEffect.act", TempValue0, 176, TempValue1, TempValue2)
90
TempValue1 += 16
91
TempValue2 += 16
92
93
TempValue0++
94
loop
95
96
#endplatform
97
98
end sub
99
100
101
// ========================
102
// Editor Subs
103
// ========================
104
105
sub RSDKDraw
106
DrawSprite(0)
107
end sub
108
109
110
sub RSDKLoad
111
LoadSpriteSheet("Global/Display.gif")
112
SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon
113
114
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
115
end sub
116
117