Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Mission/MissionBlock.txt
1319 views
1
//---------------Sonic CD Mission Block Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.PropertyValue : Object.BlocksNo
7
8
9
sub ObjectPlayerInteraction
10
11
if Object.BlocksNo <= 1
12
13
// If the Block count for this Object is 0 or 1, then it's only a single block
14
// From here, check Collision as such
15
PlayerObjectCollision(C_BOX, -16, -16, 16, 16)
16
else
17
18
// This Object is meant to represent several blocks
19
20
// Base block width is 32
21
TempValue0 = 32
22
23
// From here, multiply that width by how many blocks there are
24
TempValue0 *= Object.BlocksNo
25
26
// Because the left box is already 16 wide, we can shve 16 off from the right
27
TempValue0 -= 16
28
29
// And now, check collision against all those blocks
30
PlayerObjectCollision(C_BOX, -16, -16, TempValue0, 16)
31
32
end if
33
34
end sub
35
36
37
sub ObjectDraw
38
39
if Object.BlocksNo <= 1
40
// If a single block, then just draw a single sprite
41
42
DrawSprite(0)
43
else
44
// This Object is several blocks, so more has to be done
45
46
// Use of values here
47
// - TempValue0 is the X Position of the current block
48
// - TempValue1 is the Y Position of the current block, this stays the same throughout the whole process
49
// - TempValue2 is the current block number, starting from 0
50
51
TempValue0 = Object.XPos
52
TempValue1 = Object.YPos
53
TempValue2 = 0
54
55
while TempValue2 < Object.BlocksNo
56
// First, draw the Sprite
57
// -> This is done first so that the first Block is displayed correctly
58
DrawSpriteXY(0, TempValue0, TempValue1)
59
60
// Move 32 pixels to the right
61
TempValue0 += 0x200000
62
63
// Next block!
64
TempValue2++
65
loop
66
end if
67
68
end sub
69
70
71
sub ObjectStartup
72
73
// Loading the Labrynth Zone sheet...
74
LoadSpriteSheet("Mission/Objects.gif")
75
76
// Well, it's a Mission Block!
77
SpriteFrame(-16, -16, 32, 32, 1, 1)
78
79
end sub
80
81
82
// ========================
83
// Editor Subs
84
// ========================
85
86
sub RSDKDraw
87
if Object.PropertyValue < 2
88
DrawSprite(0)
89
else
90
TempValue0 = 0
91
TempValue1 = Object.XPos
92
93
while TempValue0 < Object.PropertyValue
94
DrawSpriteXY(0, TempValue1, Object.YPos)
95
96
TempValue1 += 0x200000
97
TempValue0++
98
loop
99
end if
100
end sub
101
102
103
sub RSDKLoad
104
LoadSpriteSheet("Mission/Objects.gif")
105
SpriteFrame(-16, -16, 32, 32, 1, 1)
106
107
SetVariableAlias(ALIAS_VAR_PROPVAL, "BlocksNo")
108
end sub
109
110
111
112