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/Special/Background.txt
1482 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Special BG 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.value1 : object.viewRotation
13
14
// Halfpipe Aliases
15
private alias object.value7 : halfpipe.halfpipeRotation.x
16
private alias object.value8 : halfpipe.halfpipeRotation.y
17
private alias object.value9 : halfpipe.halfpipeRotation.z
18
19
20
// ========================
21
// Events
22
// ========================
23
24
event ObjectDraw
25
temp2 = halfpipe[0].halfpipeRotation.y
26
temp2 += 0x40
27
temp2 &= 0x1FF
28
temp2 >>= 7
29
switch temp2
30
case 0
31
temp0 = halfpipe[0].halfpipeRotation.y
32
temp1 = halfpipe[0].halfpipeRotation.x
33
FlipSign(temp1)
34
object.rotation = halfpipe[0].halfpipeRotation.z
35
break
36
37
case 1
38
temp0 = halfpipe[0].halfpipeRotation.y
39
temp1 = halfpipe[0].halfpipeRotation.z
40
FlipSign(temp1)
41
object.rotation = halfpipe[0].halfpipeRotation.x
42
FlipSign(object.rotation)
43
break
44
45
case 2
46
temp0 = halfpipe[0].halfpipeRotation.y
47
temp1 = halfpipe[0].halfpipeRotation.x
48
object.rotation = halfpipe[0].halfpipeRotation.z
49
FlipSign(object.rotation)
50
break
51
52
case 3
53
temp0 = halfpipe[0].halfpipeRotation.y
54
temp1 = halfpipe[0].halfpipeRotation.z
55
object.rotation = halfpipe[0].halfpipeRotation.x
56
FlipSign(object.rotation)
57
break
58
59
end switch
60
61
temp0 <<= 1
62
temp0 &= 0xFF
63
temp1 <<= 1
64
temp1 &= 0xFF
65
object.rotation &= 0x1FF
66
67
temp2 = halfpipe[0].halfpipeRotation.x
68
temp2 += halfpipe[0].halfpipeRotation.y
69
temp2 += halfpipe[0].halfpipeRotation.z
70
temp2 &= 0x7F
71
if temp2 == 0
72
Sin256(object.viewRotation, object.angle)
73
object.angle += 8
74
object.angle &= 0xFF
75
else
76
object.angle = 0
77
object.viewRotation >>= 1
78
end if
79
80
temp2 = object.viewRotation
81
temp2 *= 3
82
temp2 >>= 9
83
temp1 += temp2
84
if object.rotation == 0
85
temp0 += screen.xcenter
86
temp1 += screen.ycenter
87
DrawSpriteScreenXY(0, temp0, temp1)
88
DrawSpriteScreenXY(1, temp0, temp1)
89
DrawSpriteScreenXY(2, temp0, temp1)
90
DrawSpriteScreenXY(3, temp0, temp1)
91
DrawSpriteScreenXY(4, temp0, temp1)
92
DrawSpriteScreenXY(5, temp0, temp1)
93
DrawSpriteScreenXY(6, temp0, temp1)
94
DrawSpriteScreenXY(7, temp0, temp1)
95
DrawSpriteScreenXY(8, temp0, temp1)
96
DrawSpriteScreenXY(9, temp0, temp1)
97
DrawSpriteScreenXY(10, temp0, temp1)
98
DrawSpriteScreenXY(11, temp0, temp1)
99
else
100
temp0 += screen.xcenter
101
temp1 += screen.ycenter
102
DrawSpriteScreenFX(1, FX_ROTATE, temp0, temp1)
103
DrawSpriteScreenFX(2, FX_ROTATE, temp0, temp1)
104
DrawSpriteScreenFX(3, FX_ROTATE, temp0, temp1)
105
DrawSpriteScreenFX(5, FX_ROTATE, temp0, temp1)
106
DrawSpriteScreenFX(6, FX_ROTATE, temp0, temp1)
107
DrawSpriteScreenFX(7, FX_ROTATE, temp0, temp1)
108
DrawSpriteScreenFX(8, FX_ROTATE, temp0, temp1)
109
DrawSpriteScreenFX(9, FX_ROTATE, temp0, temp1)
110
DrawSpriteScreenFX(10, FX_ROTATE, temp0, temp1)
111
end if
112
end event
113
114
115
event ObjectStartup
116
LoadSpriteSheet("Special/Background.gif")
117
118
SpriteFrame(-640, -128, 256, 256, 0, 0)
119
SpriteFrame(-128, -128, 256, 256, 0, 0)
120
SpriteFrame(-384, -128, 256, 256, 0, 0)
121
SpriteFrame(128, -128, 256, 256, 0, 0)
122
SpriteFrame(-640, -384, 256, 256, 0, 0)
123
SpriteFrame(-128, -384, 256, 256, 0, 0)
124
SpriteFrame(-384, -384, 256, 256, 0, 0)
125
SpriteFrame(128, -384, 256, 256, 0, 0)
126
SpriteFrame(-128, -128, 256, 256, 0, 0)
127
SpriteFrame(-128, 128, 256, 256, 0, 0)
128
SpriteFrame(-384, 128, 256, 256, 0, 0)
129
SpriteFrame(128, 128, 256, 256, 0, 0)
130
131
object[1].type = TypeName[Special BG]
132
object[1].priority = PRIORITY_ACTIVE
133
object[1].drawOrder = 0
134
end event
135
136
137
// ========================
138
// Editor Events
139
// ========================
140
141
event RSDKDraw
142
DrawSprite(0)
143
end event
144
145
146
event RSDKLoad
147
LoadSpriteSheet("Special/Background.gif")
148
SpriteFrame(-128, -128, 256, 256, 0, 0)
149
150
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
151
end event
152
153