Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R1/TileTriggerH.txt
1319 views
1
//---------------Sonic CD Tile Trigger H 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.HitboxLeft
9
#alias Object.Value1 : Object.HitboxRight
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
// Helper aliases
19
#alias Object.PropertyValue : Helper.StoredChunk // This is a blank object
20
21
// Property Values
22
#alias 0 : STARTUP_CHUNK
23
#alias 1 : NEXT_CHUNK
24
25
26
sub ObjectPlayerInteraction
27
PlayerObjectCollision(C_TOUCH, Object.HitboxLeft, -12, Object.HitboxRight, 12)
28
if CheckResult == true
29
30
if Helper[+1].StoredChunk == STARTUP_CHUNK
31
TempValue0 = Object.StartupChunk
32
else
33
TempValue0 = Object.NextChunk
34
end if
35
SetTileLayerEntry(TempValue0, 0, Object.ChunkX, Object.ChunkY)
36
TempValue0++
37
38
SetTileLayerEntry(TempValue0, 0, Object.NextChunkX, Object.ChunkY)
39
TempValue0++
40
41
SetTileLayerEntry(TempValue0, 0, Object.ChunkX, Object.NextChunkY)
42
TempValue0++
43
44
SetTileLayerEntry(TempValue0, 0, Object.NextChunkX, Object.NextChunkY)
45
TempValue0++
46
end if
47
end sub
48
49
50
sub ObjectStartup
51
ArrayPos0 = 32
52
while ArrayPos0 < 1056
53
if Object[ArrayPos0].Type == TypeName[Tile Trigger H]
54
ArrayPos1 = ArrayPos0
55
ArrayPos1++ // This should always be a blank object
56
Object[ArrayPos0].HitboxLeft = Object[ArrayPos0].Size
57
Object[ArrayPos0].HitboxLeft <<= 3
58
Object[ArrayPos0].HitboxRight = Object[ArrayPos0].HitboxLeft
59
FlipSign(Object[ArrayPos0].HitboxLeft)
60
Object[ArrayPos0].HitboxLeft -= 8
61
Object[ArrayPos0].HitboxRight += 8
62
63
Object[ArrayPos0].ChunkX = Object[ArrayPos1].iXPos
64
Object[ArrayPos0].ChunkX >>= 7
65
66
Object[ArrayPos0].NextChunkX = Object[ArrayPos0].ChunkX
67
Object[ArrayPos0].NextChunkX++
68
69
Object[ArrayPos0].ChunkY = Object[ArrayPos1].iYPos
70
Object[ArrayPos0].ChunkY >>= 7
71
72
Object[ArrayPos0].NextChunkY = Object[ArrayPos0].ChunkY
73
Object[ArrayPos0].NextChunkY++
74
75
GetTileLayerEntry(Object[ArrayPos0].StartupChunk, 0, Object[ArrayPos0].ChunkX, Object[ArrayPos0].ChunkY)
76
77
Object[ArrayPos0].NextChunk = Object[ArrayPos0].StartupChunk
78
Object[ArrayPos0].NextChunk += 4
79
end if
80
ArrayPos0++
81
loop
82
end sub
83
84
85
// ========================
86
// Editor Subs
87
// ========================
88
89
sub RSDKDraw
90
// size
91
TempValue0 = Object.PropertyValue
92
TempValue0 <<= 19
93
FlipSign(TempValue0)
94
TempValue0 += Object.XPos
95
TempValue0 += 0x80000
96
97
TempValue4 = 0
98
while TempValue4 < Object.PropertyValue
99
DrawSpriteXY(0, TempValue0, Object.YPos)
100
TempValue0 += 0x100000
101
TempValue4++
102
loop
103
104
if Object.PropertyValue == 0
105
DrawSprite(0)
106
end if
107
108
if Editor.ShowGizmos == true
109
DrawArrow(Object.XPos, Object.YPos, Object[+1].XPos, Object[+1].YPos, 255, 255, 0)
110
end if
111
end sub
112
113
114
sub RSDKLoad
115
LoadSpriteSheet("Global/Display.gif")
116
SpriteFrame(-8, -8, 16, 16, 173, 67) // #0 - "T" Icon
117
118
SetVariableAlias(ALIAS_VAR_PROPVAL, "size")
119
end sub
120
121