Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R8/SpinningPlatform.txt
1319 views
1
//-------------Sonic CD Spinning Platform Script--------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Alias
6
#alias Object[19].Rotation : R8Setup.Rotation
7
8
9
sub ObjectMain
10
// All Spinning Platforms are synced together, via the Object in slot 19 which
11
// should be the R8 Setup Object
12
Object.Rotation = R8Setup.Rotation
13
14
// And then bump that rotation as needed
15
Object.Rotation += Object.PropertyValue
16
17
// Keep the rotation limited to 143, as with the R8 Setup's rotation value as well
18
Object.Rotation %= 144
19
20
end sub
21
22
23
sub ObjectPlayerInteraction
24
// Only check for Collision when the Platform is in its normal position
25
if Object.Rotation < 121
26
PlayerObjectCollision(C_PLATFORM, -16, -5, 16, 11)
27
end if
28
29
end sub
30
31
32
sub ObjectDraw
33
if Object.Rotation < 121
34
// Draw the normal Platform frame
35
DrawSprite(0)
36
else
37
38
// Use different drawing routines for the Platform's different possible angles
39
40
TempValue0 = Object.Rotation
41
TempValue0 -= 120
42
TempValue0 >>= 1
43
44
switch TempValue0
45
case 0
46
case 6
47
DrawSprite(1)
48
break
49
50
case 1
51
case 7
52
DrawSprite(2)
53
break
54
55
case 2
56
case 8
57
DrawSprite(3)
58
break
59
60
case 3
61
case 9
62
Object.Direction = FACING_LEFT
63
DrawSpriteFX(4, FX_FLIP, Object.XPos, Object.YPos)
64
break
65
66
case 4
67
case 10
68
Object.Direction = FACING_LEFT
69
DrawSpriteFX(5, FX_FLIP, Object.XPos, Object.YPos)
70
break
71
72
case 5
73
case 11
74
DrawSprite(0)
75
break
76
77
end switch
78
end if
79
80
end sub
81
82
83
sub ObjectStartup
84
LoadSpriteSheet("R8/Objects.gif")
85
86
SpriteFrame(-16, -8, 32, 16, 107, 98) // #0 - Platform Horizontal
87
SpriteFrame(-16, -12, 32, 24, 107, 115) // #1 - Platform Tilted frame 0
88
SpriteFrame(-12, -16, 24, 32, 230, 34) // #2 - Platform Tilted frame 1
89
90
SpriteFrame(-8, -16, 16, 32, 239, 212) // #3 - Platform Vertical
91
SpriteFrame(-12, -16, 24, 32, 230, 34) // #4 - Platform Tilted frame 0
92
SpriteFrame(-16, -12, 32, 24, 107, 115) // #5 - Platform Tilted frame 1
93
94
end sub
95
96
97
// ========================
98
// Editor Subs
99
// ========================
100
101
sub RSDKDraw
102
DrawSprite(0)
103
end sub
104
105
106
sub RSDKLoad
107
LoadSpriteSheet("R8/Objects.gif")
108
SpriteFrame(-16, -8, 32, 16, 107, 98)
109
110
SetVariableAlias(ALIAS_VAR_PROPVAL, "SpinOffset")
111
end sub
112
113