Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Animals/R6_Bird.txt
1319 views
1
//----------------Sonic CD Flying Bird 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
#alias Object.Value1 : Object.Angle
8
9
// HUD alias
10
#alias Object[24].PropertyValue : HUD.CurrentTimePeriod
11
12
// States
13
#alias 0 : FLYINGBIRD_FLYRIGHT
14
#alias 1 : FLYINGBIRD_FLYLEFT
15
16
// Time Period Aliases
17
#alias 2 : TIME_GOOD_FUTURE
18
19
20
sub ObjectMain
21
switch Object.State
22
case FLYINGBIRD_FLYRIGHT
23
if Object.Angle > 0
24
Object.Angle -= 2
25
else
26
// Apex reached, turn around
27
28
Object.State = FLYINGBIRD_FLYLEFT
29
Object.Direction = FACING_LEFT
30
end if
31
break
32
33
case FLYINGBIRD_FLYLEFT
34
if Object.Angle < 256
35
Object.Angle += 2
36
else
37
// Crest of the path reached, turn right back around again
38
39
Object.State = FLYINGBIRD_FLYRIGHT
40
Object.Direction = FACING_RIGHT
41
end if
42
break
43
44
end switch
45
46
// Animate the Bird
47
Object.Timer++
48
if Object.Timer > 19
49
Object.Timer = 0
50
51
Object.Frame++
52
Object.Frame &= 1
53
end if
54
55
end sub
56
57
58
sub ObjectDraw
59
if MetalSonic_Destroyed == true
60
Cos(TempValue0, Object.Angle)
61
TempValue0 <<= 14
62
TempValue0 += Object.XPos
63
64
Sin(TempValue1, Object.Angle)
65
TempValue1 <<= 14
66
TempValue1 += Object.YPos
67
68
DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, TempValue1)
69
else
70
if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE
71
Cos(TempValue0, Object.Angle)
72
TempValue0 <<= 14
73
TempValue0 += Object.XPos
74
75
Sin(TempValue1, Object.Angle)
76
TempValue1 <<= 14
77
TempValue1 += Object.YPos
78
79
DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, TempValue1)
80
end if
81
end if
82
83
end sub
84
85
86
sub ObjectStartup
87
88
LoadSpriteSheet("R6/Objects.gif")
89
90
SpriteFrame(-12, -8, 24, 16, 197, 34)
91
SpriteFrame(-12, -8, 24, 16, 197, 51)
92
93
// Find and setup all Flying Bird Objects in the Level
94
ArrayPos0 = 32
95
while ArrayPos0 < 1056
96
if Object[ArrayPos0].Type == TypeName[Flying Bird]
97
98
// Make all Flying Birds draw ontop of other objects & level tiles
99
Object[ArrayPos0].DrawOrder = 5
100
101
end if
102
103
ArrayPos0++
104
loop
105
106
end sub
107
108
109
// ========================
110
// Editor Subs
111
// ========================
112
113
sub RSDKDraw
114
DrawSprite(0)
115
end sub
116
117
118
sub RSDKLoad
119
LoadSpriteSheet("R6/Objects.gif")
120
SpriteFrame(-12, -8, 24, 16, 197, 34)
121
122
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
123
end sub
124
125