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/DEZ/DEZSetup.txt
1482 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: DEZ Setup Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
private alias object.value0 : object.aniTileTimer
13
private alias object.value14 : object.palTimer
14
private alias object.value15 : object.bgTowerLightPalIndex
15
private alias object.value16 : object.rainbowLightPalIndex
16
private alias object.value17 : object.chemLiquidPalIndex1
17
private alias object.value18 : object.chemLiquidPalIndex2
18
private alias object.value19 : object.chemLiquidPalIndex3
19
20
// Player Aliases
21
private alias object.type : player.type
22
23
// Reserved object slots
24
private alias 10 : SLOT_ZONESETUP
25
26
// Tracks
27
private alias 0 : TRACK_STAGE
28
29
// Music Loops
30
private alias 1 : MUSIC_LOOP_DEZ
31
32
33
// ========================
34
// Tables
35
// ========================
36
37
private table DEZSetup_bgTowerLightPalTable
38
0xE00000, 0xC00000, 0xA00000, 0x800000, 0x600000, 0x400000, 0x200000, 0x400000
39
0x600000, 0x800000, 0xA00000, 0xC00000, 0xE00000, 0xE02000, 0xE04000, 0xE02000
40
end table
41
42
private table DEZSetup_rainbowLightPalTable
43
0x00E000, 0x20C000, 0x40A000, 0x608000, 0x806000, 0xA04000, 0xC02000
44
0xE00000, 0xC00020, 0xA00040, 0x800060, 0x600080, 0x4000A0, 0x2000C0
45
0x0000E0, 0x0020C0, 0x0040A0, 0x006080, 0x008060, 0x00A040, 0x00C020
46
end table
47
48
private table DEZSetup_chemLiquidPalTable
49
0x0040E0, 0x0000C0, 0x0000C0
50
0x0060E0, 0x0020C0, 0x0000C0
51
0x0040E0, 0x0040E0, 0x0000C0
52
0x0020C0, 0x0060E0, 0x0020C0
53
0x0000C0, 0x0040E0, 0x0040C0
54
0x0000C0, 0x0020C0, 0x0040E0
55
0x0000C0, 0x0000C0, 0x0060E0
56
0x0020C0, 0x0000C0, 0x0040E0
57
0x0020E0, 0x0000C0, 0x0020C0
58
end table
59
60
// Unused palette table, also found in CPZSetup and EndSetup and even Mania's CPZ!
61
// These are actually colors for one of WFZ's palette cycles
62
// However, you won't find this in WFZSetup because in this 2013 remake, WFZ only uses 1 of the 3 palette cycles it had in the original game,
63
// this one being among the 2 that were cut
64
// Why they were cut, I have no idea, but at the very least, it's certainly a mystery how one of them ended up here of all places...
65
private table DEZSetup_unusedPalette
66
0x00E000, 0x00A000, 0x006000, 0x002000, 0x000000, 0x000020, 0x000060, 0x0020A0
67
0x0060E0, 0x0020A0, 0x000060, 0x000020, 0x000000, 0x200000, 0x600000, 0xA00000
68
0xE00000, 0xE04000, 0xE00000, 0xA00000, 0x600000, 0x200000, 0x000000, 0x202000
69
0x606000, 0xA0A000, 0xE0E000, 0xA0A000, 0x606000, 0x202000, 0x000000, 0x002000
70
0x006000, 0x00A000
71
end table
72
73
74
// ========================
75
// Events
76
// ========================
77
78
event ObjectUpdate
79
// Animate the converyor belts in the background
80
object.aniTileTimer++
81
if object.aniTileTimer == 5
82
object.aniTileTimer = 0
83
object.frame++
84
object.frame &= 7
85
86
temp0 = object.frame
87
temp0 += 768
88
Copy16x16Tile(767, temp0)
89
end if
90
91
// Manage the various cycling palettes throughout the stage
92
object.palTimer++
93
if object.palTimer == 8
94
object.palTimer = 0
95
96
object.bgTowerLightPalIndex++
97
object.bgTowerLightPalIndex &= 15
98
GetTableValue(temp0, object.bgTowerLightPalIndex, DEZSetup_bgTowerLightPalTable)
99
SetPaletteEntry(0, 175, temp0)
100
101
object.rainbowLightPalIndex++
102
object.rainbowLightPalIndex %= 21
103
GetTableValue(temp0, object.rainbowLightPalIndex, DEZSetup_rainbowLightPalTable)
104
SetPaletteEntry(0, 191, temp0)
105
106
object.chemLiquidPalIndex1 += 3
107
object.chemLiquidPalIndex1 %= 27
108
GetTableValue(temp0, object.chemLiquidPalIndex1, DEZSetup_chemLiquidPalTable)
109
SetPaletteEntry(0, 188, temp0)
110
111
object.chemLiquidPalIndex2 += 3
112
object.chemLiquidPalIndex2 %= 27
113
GetTableValue(temp0, object.chemLiquidPalIndex2, DEZSetup_chemLiquidPalTable)
114
SetPaletteEntry(0, 189, temp0)
115
116
object.chemLiquidPalIndex3 += 3
117
object.chemLiquidPalIndex3 %= 27
118
GetTableValue(temp0, object.chemLiquidPalIndex3, DEZSetup_chemLiquidPalTable)
119
SetPaletteEntry(0, 190, temp0)
120
end if
121
end event
122
123
124
event ObjectStartup
125
// Set the stage music
126
SetMusicTrack("DeathEgg.ogg", TRACK_STAGE, MUSIC_LOOP_DEZ)
127
128
// No speed up/slow down functions need to be set since Speed Shoes shouldn't exist in DEZ at all
129
130
// Reset the boss flash color to be black
131
SetPaletteEntry(0, 192, 0x000000)
132
133
// Start the Conveyor Belt tiles, set them to frame 1
134
Copy16x16Tile(767, 768)
135
136
// There shouldn't be any animals in DEZ, reset them
137
// (though, since there aren't any they could just go left unchanged...)
138
animalType1 = TypeName[Blank Object]
139
animalType2 = TypeName[Blank Object]
140
141
// Remove player 2, only P1 should be active here
142
player[1].type = TypeName[Blank Object]
143
playerCount = 1
144
145
// Place a DEZ object into the scene
146
object[SLOT_ZONESETUP].type = TypeName[DEZ Setup]
147
object[SLOT_ZONESETUP].priority = PRIORITY_ACTIVE
148
object[SLOT_ZONESETUP].drawOrder = 0 // This is just a leftover from this script being copied from CPZSetup, it doesn't actually do anything since this object doesn't have an ObjectDraw event
149
object[SLOT_ZONESETUP].chemLiquidPalIndex2 = 1
150
object[SLOT_ZONESETUP].chemLiquidPalIndex3 = 2
151
152
// Set stage bounds
153
temp0 = stage.curYBoundary2
154
temp0 -= screen.ysize
155
stage.newYBoundary1 = temp0
156
end event
157
158
159
// ========================
160
// Editor Events
161
// ========================
162
163
event RSDKDraw
164
DrawSprite(0)
165
end event
166
167
168
event RSDKLoad
169
LoadSpriteSheet("Global/Display.gif")
170
SpriteFrame(-16, -16, 32, 32, 1, 143)
171
172
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
173
end event
174
175