//---------------Sonic CD Tile Trigger L Script---------------//
//--------Scripted by Christian Whitehead 'The Taxman'--------//
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
// This is a chunk swapper for loops
// Aliases
#alias Object.Value0 : Object.HitboxTop
#alias Object.Value1 : Object.HitboxBottom
#alias Object.Value2 : Object.ChunkX
#alias Object.Value3 : Object.ChunkY
#alias Object.Value4 : Object.NextChunkX
#alias Object.Value5 : Object.NextChunkY
#alias Object.Value6 : Object.StartupChunk
#alias Object.Value7 : Object.NextChunk
#alias Object.PropertyValue : Object.Size
// Gravity
#alias 0 : GRAVITY_GROUND
sub ObjectPlayerInteraction
if Player.Gravity == GRAVITY_GROUND
PlayerObjectCollision(C_TOUCH, -12, Object.HitboxTop, 12,
Object.HitboxBottom)
if CheckResult == true
if Player.Speed > 0
TempValue0 = Object.NextChunk
else
TempValue0 = Object.StartupChunk
end if
SetTileLayerEntry(TempValue0, 0, Object.ChunkX, Object.ChunkY)
TempValue0++
SetTileLayerEntry(TempValue0, 0, Object.NextChunkX,
Object.ChunkY)
TempValue0++
SetTileLayerEntry(TempValue0, 0, Object.ChunkX,
Object.NextChunkY)
TempValue0++
SetTileLayerEntry(TempValue0, 0, Object.NextChunkX,
Object.NextChunkY)
TempValue0++
end if
end if
end sub
sub ObjectStartup
ArrayPos0 = 32
while ArrayPos0 < 1056
if Object[ArrayPos0].Type == TypeName[Tile Trigger L]
ArrayPos1 = ArrayPos0
ArrayPos1++ // This should always be a blank object
Object[ArrayPos0].HitboxTop = Object[ArrayPos0].Size
Object[ArrayPos0].HitboxTop <<= 3
Object[ArrayPos0].HitboxBottom = Object[ArrayPos0].HitboxTop
FlipSign(Object[ArrayPos0].HitboxTop)
Object[ArrayPos0].HitboxTop -= 8
Object[ArrayPos0].HitboxBottom += 8
Object[ArrayPos0].ChunkX = Object[ArrayPos1].iXPos
Object[ArrayPos0].ChunkX >>= 7
Object[ArrayPos0].NextChunkX = Object[ArrayPos0].ChunkX
Object[ArrayPos0].NextChunkX++
Object[ArrayPos0].ChunkY = Object[ArrayPos1].iYPos
Object[ArrayPos0].ChunkY >>= 7
Object[ArrayPos0].NextChunkY = Object[ArrayPos0].ChunkY
Object[ArrayPos0].NextChunkY++
GetTileLayerEntry(Object[ArrayPos0].StartupChunk, 0,
Object[ArrayPos0].ChunkX, Object[ArrayPos0].ChunkY)
Object[ArrayPos0].NextChunk = Object[ArrayPos0].StartupChunk
Object[ArrayPos0].NextChunk += 4
end if
ArrayPos0++
loop
end sub
// ========================
// Editor Subs
// ========================
sub RSDKDraw
TempValue0 = Object.PropertyValue
TempValue0 <<= 19
FlipSign(TempValue0)
TempValue0 += Object.YPos
TempValue0 += 0x80000
TempValue4 = 0
while TempValue4 < Object.PropertyValue
DrawSpriteXY(0, Object.XPos, TempValue0)
TempValue0 += 0x100000
TempValue4++
loop
if Object.PropertyValue == 0
DrawSprite(0)
end if
if Editor.ShowGizmos == true
Editor.DrawingOverlay = true
DrawArrow(Object.XPos, Object.YPos, Object[+1].XPos, Object[+1].YPos,
255, 255, 0)
Editor.DrawingOverlay = false
end if
end sub
sub RSDKLoad
LoadSpriteSheet("Global/Display.gif")
SpriteFrame(-8, -8, 16, 16, 156, 67) // #0 - "L" Icon
SetVariableAlias(ALIAS_VAR_PROPVAL, "size")
end sub