Path: blob/main/Scripts/Mission/IcdBlockCollision.txt
1319 views
//------------Sonic CD Ice Block Collision Script-------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//3//----------Used on Mission "M086 - Twinkle Toes"-------------//45// Aliases6#alias Object.Value0 : Object.IceBlockEntity78// Aliases9#alias Object.Value1 : Object.XVelocity10#alias Object.Value2 : Object.YVelocity1112// States13#alias 0 : ICEBLOCK_FALLING14#alias 1 : ICEBLOCK_BREAKICE1516// Property Values17#alias 0 : CHARACTER_ICEBLOCK1819// Priority20#alias 0 : PRIORITY_BOUNDS21#alias 1 : PRIORITY_ACTIVE2223// Stage SFX24#alias 4 : SFX_S_GLASSSMASH252627sub ObjectMain28if Object.IceBlockEntity == 029// Search through Temp objects30ArrayPos0 = 105631while ArrayPos0 < 118432CheckEqual(Object[ArrayPos0].Type, TypeName[Ice Block])33TempValue0 = CheckResult34CheckEqual(Object[ArrayPos0].PropertyValue, CHARACTER_ICEBLOCK)35TempValue0 &= CheckResult36CheckEqual(Object[ArrayPos0].State, ICEBLOCK_FALLING)37TempValue0 &= CheckResult38if TempValue0 == true39Object.IceBlockEntity = ArrayPos040Object.Priority = PRIORITY_ACTIVE41ArrayPos0 = 1000042end if43ArrayPos0++44loop45end if4647if Object.IceBlockEntity != 048ArrayPos1 = Object.IceBlockEntity49ArrayPos0 = 3250if Object[ArrayPos1].State == ICEBLOCK_BREAKICE51Object.IceBlockEntity = 052Object.Priority = PRIORITY_BOUNDS53ArrayPos0 = 1000054end if5556while ArrayPos0 < 105657CheckEqual(Object[ArrayPos0].Type, TypeName[MissionBlock])58TempValue0 = CheckResult59CheckEqual(Object[ArrayPos0].Type, TypeName[Moving Blocks])60TempValue0 |= CheckResult61if TempValue0 == true62TempValue1 = Object[ArrayPos0].YPos63TempValue1 -= Object[ArrayPos1].YPos64// Check vertical distance between mission/moving blocks and the ice block65CheckLower(TempValue1, 0x280000)66TempValue0 = CheckResult67CheckGreater(TempValue1, -0x200000)68TempValue0 &= CheckResult69if TempValue0 == true70TempValue1 = Object[ArrayPos0].XPos71TempValue1 -= Object[ArrayPos1].XPos72// Check horizontal distance between mission/moving blocks and the ice block73CheckLower(TempValue1, 0x200000)74TempValue0 = CheckResult75CheckGreater(TempValue1, -0x200000)76TempValue0 &= CheckResult77if TempValue0 == true78// Turns out you collided with a block, must hurt79Object[ArrayPos1].YPos = Object[ArrayPos0].YPos80Object[ArrayPos1].YPos -= 0x28000081Object[ArrayPos1].State = ICEBLOCK_BREAKICE82Object[ArrayPos1].YVelocity = 08384PlayStageSfx(SFX_S_GLASSSMASH,0)85Object.IceBlockEntity = 086Object.Priority = PRIORITY_BOUNDS87ArrayPos0 = 1000088end if89end if90end if91ArrayPos0++92loop93end if94end sub959697// ========================98// Editor Subs99// ========================100101sub RSDKDraw102DrawSprite(0)103end sub104105106sub RSDKLoad107LoadSpriteSheet("Global/Display.gif")108SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon109110SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")111end sub112113114115116