Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R1/TileTriggerL.txt
1319 views
1
//---------------Sonic CD Tile Trigger L Script---------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// This is a chunk swapper for loops
6
7
// Aliases
8
#alias Object.Value0 : Object.HitboxTop
9
#alias Object.Value1 : Object.HitboxBottom
10
#alias Object.Value2 : Object.ChunkX
11
#alias Object.Value3 : Object.ChunkY
12
#alias Object.Value4 : Object.NextChunkX
13
#alias Object.Value5 : Object.NextChunkY
14
#alias Object.Value6 : Object.StartupChunk
15
#alias Object.Value7 : Object.NextChunk
16
#alias Object.PropertyValue : Object.Size
17
18
// Gravity
19
#alias 0 : GRAVITY_GROUND
20
21
22
sub ObjectPlayerInteraction
23
if Player.Gravity == GRAVITY_GROUND
24
PlayerObjectCollision(C_TOUCH, -12, Object.HitboxTop, 12, Object.HitboxBottom)
25
if CheckResult == true
26
if Player.Speed > 0
27
TempValue0 = Object.NextChunk
28
else
29
TempValue0 = Object.StartupChunk
30
end if
31
SetTileLayerEntry(TempValue0, 0, Object.ChunkX, Object.ChunkY)
32
TempValue0++
33
34
SetTileLayerEntry(TempValue0, 0, Object.NextChunkX, Object.ChunkY)
35
TempValue0++
36
37
SetTileLayerEntry(TempValue0, 0, Object.ChunkX, Object.NextChunkY)
38
TempValue0++
39
40
SetTileLayerEntry(TempValue0, 0, Object.NextChunkX, Object.NextChunkY)
41
TempValue0++
42
end if
43
end if
44
end sub
45
46
47
sub ObjectStartup
48
ArrayPos0 = 32
49
while ArrayPos0 < 1056
50
if Object[ArrayPos0].Type == TypeName[Tile Trigger L]
51
ArrayPos1 = ArrayPos0
52
ArrayPos1++ // This should always be a blank object
53
Object[ArrayPos0].HitboxTop = Object[ArrayPos0].Size
54
Object[ArrayPos0].HitboxTop <<= 3
55
Object[ArrayPos0].HitboxBottom = Object[ArrayPos0].HitboxTop
56
FlipSign(Object[ArrayPos0].HitboxTop)
57
Object[ArrayPos0].HitboxTop -= 8
58
Object[ArrayPos0].HitboxBottom += 8
59
60
Object[ArrayPos0].ChunkX = Object[ArrayPos1].iXPos
61
Object[ArrayPos0].ChunkX >>= 7
62
63
Object[ArrayPos0].NextChunkX = Object[ArrayPos0].ChunkX
64
Object[ArrayPos0].NextChunkX++
65
66
Object[ArrayPos0].ChunkY = Object[ArrayPos1].iYPos
67
Object[ArrayPos0].ChunkY >>= 7
68
69
Object[ArrayPos0].NextChunkY = Object[ArrayPos0].ChunkY
70
Object[ArrayPos0].NextChunkY++
71
72
GetTileLayerEntry(Object[ArrayPos0].StartupChunk, 0, Object[ArrayPos0].ChunkX, Object[ArrayPos0].ChunkY)
73
74
Object[ArrayPos0].NextChunk = Object[ArrayPos0].StartupChunk
75
Object[ArrayPos0].NextChunk += 4
76
end if
77
ArrayPos0++
78
loop
79
end sub
80
81
82
// ========================
83
// Editor Subs
84
// ========================
85
86
sub RSDKDraw
87
TempValue0 = Object.PropertyValue
88
TempValue0 <<= 19
89
FlipSign(TempValue0)
90
TempValue0 += Object.YPos
91
TempValue0 += 0x80000
92
93
TempValue4 = 0
94
while TempValue4 < Object.PropertyValue
95
DrawSpriteXY(0, Object.XPos, TempValue0)
96
TempValue0 += 0x100000
97
TempValue4++
98
loop
99
100
if Object.PropertyValue == 0
101
DrawSprite(0)
102
end if
103
104
if Editor.ShowGizmos == true
105
Editor.DrawingOverlay = true
106
DrawArrow(Object.XPos, Object.YPos, Object[+1].XPos, Object[+1].YPos, 255, 255, 0)
107
Editor.DrawingOverlay = false
108
end if
109
end sub
110
111
112
sub RSDKLoad
113
LoadSpriteSheet("Global/Display.gif")
114
SpriteFrame(-8, -8, 16, 16, 156, 67) // #0 - "L" Icon
115
116
SetVariableAlias(ALIAS_VAR_PROPVAL, "size")
117
end sub
118
119