Path: blob/main/Scripts/R6/BossFloorControl.txt
1319 views
//---------------Sonic CD Floor Control Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer6#alias Object.Value1 : Object.XVelocity7#alias Object.Value3 : Object.RubbleTimer8#alias Object.Value4 : Object.RubbleYPos9#alias Object.Value5 : Object.TargetFloor10#alias Object.Value6 : Object.CurrentFloor11#alias Object.Value7 : Object.PlatformTimer12#alias Object.Scale : Object.SpikeAmount1314#alias Object[-7].YPos : BossCamera.YPos15#alias Object[-6].YPos : FirstElectrode.YPos16#alias Object[-1].XPos : Boss.XPos17#alias Object[-1].YPos : Boss.YPos181920#alias Object.YPos : BossPlat.YPos21#alias Object.Value2 : BossPlat.YVelocity22#alias Object.Value3 : BossPlat.FallSpeed23#alias Object.Value5 : BossPlat.FCEntityNo2425#alias Object.XPos : FloorRubble.XPos26#alias Object.Value1 : FloorRubble.XVelocity27#alias Object.Value2 : FloorRubble.YVelocity28#alias Object.Value3 : FloorRubble.FallSpeed2930// HUD Alias31#alias Object[24].PropertyValue : HUD.CurrentTimePeriod3233// States34#alias 0 : FLOORCONTROL_INACTIVE35#alias 1 : FLOORCONTROL_SETUP_CRUMBLE36#alias 2 : FLOORCONTROL_SPAWN_FALL_OBJS37#alias 3 : FLOORCONTROL_ELEC_ARC38#alias 4 : FLOORCONTROL_TILE_SWAP39#alias 5 : FLOORCONTROL_COOLDOWN4041// Stage SFX42#alias 1 : SFX_S_ELECTRICITY43#alias 12 : SFX_S_CRUMBLE4445// Time Periods46#alias 2 : TIME_GOOD_FUTURE474849// Function declarations50#function FloorControl_SpawnRubble51#function FloorControl_SpawnPlatFarLeft52#function FloorControl_SpawnPlatLeft53#function FloorControl_SpawnPlatRight54#function FloorControl_SpawnPlatFarRight555657function FloorControl_SpawnRubble58CreateTempObject(TypeName[Floor Rubble], 0, Boss.XPos, Object.RubbleYPos)59Rand(FloorRubble[TempObjectPos].XPos, 160)60FloorRubble[TempObjectPos].XPos -= 8061FloorRubble[TempObjectPos].XPos <<= 1662FloorRubble[TempObjectPos].XPos += Boss.XPos6364Rand(FloorRubble[TempObjectPos].XVelocity, 0x500)65TempValue0 = FloorRubble[TempObjectPos].XVelocity66FloorRubble[TempObjectPos].XVelocity -= 0x28067FloorRubble[TempObjectPos].XVelocity <<= 86869FloorRubble[TempObjectPos].YVelocity = 0x100007071FloorRubble[TempObjectPos].FallSpeed = 204872TempValue0 &= 409573FloorRubble[TempObjectPos].FallSpeed += TempValue074end function757677function FloorControl_SpawnPlatFarLeft78switch Object.TargetFloor79case 080ArrayPos0 = 281break8283case 184ArrayPos0 = 585break8687case 288ArrayPos0 = 1189break90end switch9192Object[+ArrayPos0].Type = TypeName[Boss Platform]93BossPlat[+ArrayPos0].YPos = Object.RubbleYPos94BossPlat[+ArrayPos0].YVelocity = 095BossPlat[+ArrayPos0].FallSpeed = 281696BossPlat[+ArrayPos0].FCEntityNo = Object.EntityNo97end function9899100function FloorControl_SpawnPlatLeft101switch Object.TargetFloor102case 0103ArrayPos0 = 3104break105106case 1107ArrayPos0 = 6108break109110case 2111ArrayPos0 = 12112break113end switch114115Object[+ArrayPos0].Type = TypeName[Boss Platform]116BossPlat[+ArrayPos0].YPos = Object.RubbleYPos117BossPlat[+ArrayPos0].YVelocity = 0118BossPlat[+ArrayPos0].FallSpeed = 2816119BossPlat[+ArrayPos0].FCEntityNo = Object.EntityNo120end function121122123function FloorControl_SpawnPlatRight124switch Object.TargetFloor125case 0126ArrayPos0 = 1127break128129case 1130ArrayPos0 = 7131break132133case 2134ArrayPos0 = 10135break136end switch137138Object[+ArrayPos0].Type = TypeName[Boss Platform]139BossPlat[+ArrayPos0].YPos = Object.RubbleYPos140BossPlat[+ArrayPos0].YVelocity = 0141BossPlat[+ArrayPos0].FallSpeed = 2816142BossPlat[+ArrayPos0].FCEntityNo = Object.EntityNo143end function144145146function FloorControl_SpawnPlatFarRight147switch Object.TargetFloor148case 0149ArrayPos0 = 4150break151152case 1153ArrayPos0 = 8154break155156case 2157ArrayPos0 = 9158break159end switch160161Object[+ArrayPos0].Type = TypeName[Boss Platform]162BossPlat[+ArrayPos0].YPos = Object.RubbleYPos163BossPlat[+ArrayPos0].YVelocity = 0164BossPlat[+ArrayPos0].FallSpeed = 2816165BossPlat[+ArrayPos0].FCEntityNo = Object.EntityNo166end function167168169sub ObjectMain170if Player.State == Player_State_Fly171if Player.Timer < 360172Player.Timer = 360173end if174end if175TempValue0 = BossCamera.YPos176TempValue0 += 0x800000177TempValue0 -= Player.YPos178TempValue0 >>= 25179180if TempValue0 < Object.CurrentFloor181//Restore the chunks to their turned off versions182switch Object.TargetFloor183case 0184SetTileLayerEntry(500, 0, 20, 9)185SetTileLayerEntry(501, 0, 21, 9)186SetTileLayerEntry(506, 0, 22, 9)187case 1188SetTileLayerEntry(500, 0, 20, 5)189SetTileLayerEntry(501, 0, 21, 5)190SetTileLayerEntry(502, 0, 22, 5)191break192end switch193Object.CurrentFloor = Object.TargetFloor194end if195196switch Object.State197case FLOORCONTROL_SETUP_CRUMBLE198if Object.Timer < 90199Object.Timer++200else201Object.TargetFloor = BossCamera.YPos202Object.TargetFloor -= Boss.YPos203Object.TargetFloor >>= 25204205switch Object.TargetFloor206case 0207Object.RubbleYPos = 0x58C0000208Object.SpikeAmount = 0209break210case 1211Object.RubbleYPos = 0x38C0000212Object.SpikeAmount = 0213break214case 2215Object.RubbleYPos = 0x18C0000216Object.SpikeAmount = 6217if Player.XPos > Boss.XPos218Object.XVelocity = 0xA00000219else220Object.XVelocity = -0xA00000221end if222break223224end switch225226PlayStageSfx(SFX_S_CRUMBLE, false)227228#platform: Use_Haptics229HapticEffect(77, 0, 0, 0)230#endplatform231232Object.Timer = 0233Object.RubbleTimer = 24234Object.PlatformTimer = 0235236Object.State++237end if238break239240case FLOORCONTROL_SPAWN_FALL_OBJS241Object.PlatformTimer++242if Object.PlatformTimer == 128243CallFunction(FloorControl_SpawnPlatFarLeft)244end if245246if Object.PlatformTimer == 148247CallFunction(FloorControl_SpawnPlatLeft)248end if249250if Object.PlatformTimer == 168251CallFunction(FloorControl_SpawnPlatRight)252end if253254if Object.PlatformTimer == 188255CallFunction(FloorControl_SpawnPlatFarRight)256end if257258TempValue0 = Object.PlatformTimer259TempValue0 &= 3260if TempValue0 == 0261Screen.ShakeY = 2262end if263264if Object.SpikeAmount > 0265TempValue0 = Object.PlatformTimer266TempValue0 %= 35267if TempValue0 == 0268Object.SpikeAmount--269CreateTempObject(TypeName[Boss Spike], 0, 0xAC00000, Object.RubbleYPos)270Object[TempObjectPos].XPos += Object.XVelocity271if Object.XVelocity > 0272Object.XVelocity -= 0x200000273else274Object.XVelocity += 0x200000275end if276end if277end if278279Object.Timer++280if Object.Timer == 16281Object.Timer = 0282CallFunction(FloorControl_SpawnRubble)283if Object.RubbleTimer > 0284Object.RubbleTimer--285else286Object.State++287end if288end if289break290291case FLOORCONTROL_ELEC_ARC292if Object.Timer == 30293PlayStageSfx(SFX_S_ELECTRICITY, false)294Object.TargetFloor = BossCamera.YPos295Object.TargetFloor -= Player.YPos296Object.TargetFloor >>= 25297if Object.CurrentFloor < Object.TargetFloor298Object.CurrentFloor = Object.TargetFloor299CreateTempObject(TypeName[Electric Arc], 0, Boss.XPos, FirstElectrode.YPos)300TempValue0 = Object.TargetFloor301TempValue0 <<= 25302TempValue0 += 0x20000303Object[TempObjectPos].YPos -= TempValue0304Object[TempObjectPos].Direction = FACING_LEFT305Object[TempObjectPos].DrawOrder = 4306end if307end if308309Object.Timer++310if Object.Timer == 60311Object.Timer = 0312Object.State++313end if314break315316case FLOORCONTROL_TILE_SWAP317Object.Timer++318if Object.Timer == 60319Object.Timer = 0320Object.State++321if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE322Copy16x16Tile(739, 827)323else324Copy16x16Tile(810, 863)325end if326else327TempValue0 = Object.Timer328TempValue0 >>= 1329TempValue0 %= 5330if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE331TempValue0 += 826332Copy16x16Tile(739, TempValue0)333else334TempValue0 += 862335Copy16x16Tile(810, TempValue0)336end if337end if338break339340case FLOORCONTROL_COOLDOWN341Object.Timer++342if Object.Timer == 420343Object.Timer = 0344Object.State = FLOORCONTROL_ELEC_ARC345end if346break347348end switch349end sub350351352// ========================353// Editor Subs354// ========================355356sub RSDKDraw357DrawSprite(0)358end sub359360361sub RSDKLoad362LoadSpriteSheet("Global/Display.gif")363SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon364365SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")366end sub367368369