Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 1/Scripts/LevelSelect/BGAnimation.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: BG Animation 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.bgTimer
13
14
// Priority
15
public alias 0 : PRIORITY_BOUNDS
16
public alias 1 : PRIORITY_ACTIVE
17
public alias 2 : PRIORITY_ALWAYS
18
public alias 3 : PRIORITY_XBOUNDS
19
public alias 4 : PRIORITY_XBOUNDS_DESTROY
20
public alias 5 : PRIORITY_INACTIVE
21
public alias 6 : PRIORITY_BOUNDS_SMALL
22
public alias 7 : PRIORITY_ACTIVE_SMALL
23
24
// Ink Effects
25
public alias 0 : INK_NONE
26
public alias 1 : INK_BLEND
27
public alias 2 : INK_ALPHA
28
public alias 3 : INK_ADD
29
public alias 4 : INK_SUB
30
31
// Flip Directions
32
public alias 0 : FLIP_NONE
33
public alias 1 : FLIP_X
34
public alias 2 : FLIP_Y
35
public alias 3 : FLIP_XY
36
37
38
// ========================
39
// Static Values
40
// ========================
41
42
public value BGAnimation_currentPreview = 0
43
44
45
// ========================
46
// Events
47
// ========================
48
49
event ObjectUpdate
50
object.bgTimer++
51
object.bgTimer &= 0x1FF
52
Sin(temp0, object.bgTimer)
53
54
// The background is all chunks and tiles in the level so "animating" it is actually just moving the camera around
55
if temp0 > 0
56
if temp0 < 32
57
// Second frame
58
screen.yoffset = 256
59
else
60
// First frame
61
screen.yoffset = 0
62
end if
63
else
64
if temp0 > -32
65
// Third frame
66
screen.yoffset = 512
67
else
68
// Fourth frame
69
screen.yoffset = 768
70
end if
71
end if
72
end event
73
74
75
event ObjectDraw
76
if stage.actNum == 1
77
// If in the Level Select scene, then draw the zone preview too
78
79
temp0 = screen.xcenter
80
81
// Frame
82
DrawSpriteScreenXY(9, temp0, 198)
83
84
// Zone preview
85
DrawSpriteScreenXY(BGAnimation_currentPreview, temp0, 198)
86
end if
87
end event
88
89
90
event ObjectStartup
91
LoadSpriteSheet("LevelSelect/Icons.gif")
92
93
// Set all BG Animation objects to be active
94
foreach (TypeName[BG Animation], arrayPos0, ALL_ENTITIES)
95
// Set all BG Animation objects to be active
96
object[arrayPos0].priority = PRIORITY_ACTIVE
97
next
98
99
// Preview frames
100
SpriteFrame(56, -12, 32, 24, 0, 50) // Sonic vibin'
101
SpriteFrame(56, -12, 32, 24, 1, 85) // GHZ
102
SpriteFrame(56, -12, 32, 24, 34, 85) // MZ
103
SpriteFrame(56, -12, 32, 24, 67, 85) // SYZ
104
SpriteFrame(56, -12, 32, 24, 100, 85) // LZ
105
SpriteFrame(56, -12, 32, 24, 133, 85) // SLZ
106
SpriteFrame(56, -12, 32, 24, 166, 85) // SBZ
107
SpriteFrame(56, -12, 32, 24, 199, 85) // FZ
108
SpriteFrame(56, -12, 32, 24, 180, 60) // Special Stage
109
110
// Frame
111
SpriteFrame(32, -24, 80, 50, 0, 0)
112
113
// Set the preview to GHZ by default
114
BGAnimation_currentPreview = 1
115
end event
116
117
118
// ========================
119
// Editor Events
120
// ========================
121
122
event RSDKDraw
123
DrawSprite(1)
124
DrawSprite(0)
125
end event
126
127
128
event RSDKLoad
129
LoadSpriteSheet("LevelSelect/Icons.gif")
130
SpriteFrame(56, -12, 32, 24, 0, 50)
131
SpriteFrame(32, -24, 80, 50, 0, 0)
132
133
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
134
end event
135
136