Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Global/ObjectScore.txt
1319 views
1
//----------------Sonic CD Object Score Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.BadnikBonus // Used this way by Object[26]
7
#alias Object.Value0 : Object.Timer // Used this way by temp spawned objects
8
#alias Object.Value1 : Object.Gravity // (Stores the Player's gravity, this object itself doesn't move or need gravity or anything)
9
10
// States
11
#alias 0 : OBJECTSCORE_SCORE // Temp object spawned after destroying a badnik
12
#alias 1 : OBJECTSCORE_CONTROL // Object[26], keeping track of the Player's Badnik Bonus
13
14
// Priority
15
#alias 1 : PRIORITY_ACTIVE
16
17
sub ObjectDraw
18
if Object.State == OBJECTSCORE_SCORE
19
#platform: Use_Origins
20
if game.playMode == BOOT_PLAYMODE_MIRRORING
21
Object.Direction = FACING_LEFT
22
DrawSpriteFX(Object.PropertyValue, FX_FLIP, Object.XPos, Object.YPos)
23
else
24
DrawSprite(Object.PropertyValue)
25
end if
26
#endplatform
27
28
#platform: Use_Standalone
29
DrawSprite(Object.PropertyValue)
30
#endplatform
31
32
Object.YPos -= 0x20000
33
34
Object.Timer++
35
// Note:
36
// the way that CD 2011 / Origins has implemented this object & the incrementation system is inaccurate to the 1993 release.
37
// This check below only increments the combo bonus when the object despawns.
38
// -> if there is more than one Object Score on screen, it will not count up the combo bonus until they despawn.
39
if Object.Timer == 24
40
Object.Type = TypeName[Blank Object]
41
if Object[26].Type == TypeName[Object Score] // Do we already have a chain going?
42
// small note: Sonic CD 1993 *does* actually have the proper 16-hit combo bonus, but it wasn't included in the remake.
43
if Object[26].BadnikBonus < 3 // If the hit combo is less than 3 (4-hit combo bonus)...
44
Object[26].BadnikBonus++ // Increase the count!
45
end if
46
else
47
Object[26].Type = TypeName[Object Score]
48
Object[26].BadnikBonus = 1
49
end if
50
51
Object[26].State = OBJECTSCORE_CONTROL
52
Object[26].Gravity = Player.Gravity
53
Object[26].Priority = PRIORITY_ACTIVE
54
end if
55
else
56
// Bug Details:
57
// This checks the Score Object's stored gravity against the Player's, and while this technically works here for resetting most of the time
58
// -> it actually causes an issue where it resets upon jumping, making the player unable to continue the combo bonus.
59
// -> Sonic CD 1993 acts more like S1 where you can continue the combo bonus after rolling, then jumping from a stand-still or from the roll.
60
// -> The only difference is that you can preserve your combo bonus in the original MCD release by standing on objects (which is a bug of that version).
61
if Object.Gravity != Player.Gravity
62
ResetObjectEntity(26, TypeName[Blank Object], 0, 0, 0)
63
end if
64
end if
65
end sub
66
67
68
sub ObjectStartup
69
LoadSpriteSheet("Global/Items3.gif")
70
71
SpriteFrame(-6, -4, 12, 8, 0, 246) // #0 - 100
72
SpriteFrame(-7, -4, 13, 8, 20, 246) // #1 - 200
73
SpriteFrame(-7, -4, 13, 8, 33, 246) // #2 - 500
74
SpriteFrame(-8, -4, 16, 8, 0, 246) // #3 - 1000
75
end sub
76
77
78
// ========================
79
// Editor Subs
80
// ========================
81
82
sub RSDKDraw
83
DrawSprite(0)
84
end sub
85
86
87
sub RSDKLoad
88
LoadSpriteSheet("Global/Items3.gif")
89
SpriteFrame(-6, -4, 12, 8, 0, 246) // #0 - 100
90
91
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
92
end sub
93
94