Path: blob/main/Scripts/R8/BossCurtain.txt
1319 views
//---------------Sonic CD Boss Curtain 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.LeftCurtainTile7#alias Object.Value2 : Object.RightCurtainTile89// Boss Wing Alias10#alias Object.Value7 : BossWing.EggMobileEntity1112// Egg Mobile Alias13#alias Object[-3].Value4 : EggMobile.WingOffset1415// Helper 1 Aliases16#alias Object[-2].Value0 : Helper1.BossHealth17#alias Object[-2].Value1 : Helper1.Controller18#alias Object[-2].Value4 : Helper1.LeftBound19#alias Object[-2].Value5 : Helper1.RightBound20#alias Object[-2].Value6 : Helper1.CenterBound2122// Helper 2 Alias23#alias Object[-1].Value6 : Helper2.CutsceneRightBound2425// R8 Setup Alias26#alias Object[19].Value1 : R8Setup.CurrentPalette2728// HUD Alias29#alias Object[24].PropertyValue : HUD.CurrentTimePeriod3031// States32#alias 0 : BOSSCURTAIN_WAIT_PLAYER33#alias 1 : BOSSCURTAIN_SPAWN_BOSS34#alias 2 : BOSSCURTAIN_SET_BOUNDS3536// Time Periods37#alias 1 : TIME_PAST3839// Soundtrack40#alias 0 : OST_JP4142// Tile Info43#alias 0 : TILEINFO_INDEX4445// Fade Music Property Values46#alias 0 : FADEMUSIC_TO_BOSS474849sub ObjectMain50switch Object.State51case BOSSCURTAIN_WAIT_PLAYER52if Player.XPos > Object.XPos53// This check doesn't make sense54// is a boss stage, you're already forced to be in the future55if HUD.CurrentTimePeriod > 156if Options.Soundtrack == OST_JP57SetMusicTrack("JP/FinalBoss.ogg", 4, true)58else59SetMusicTrack("US/FinalBoss.ogg", 4, true)60end if61end if6263Object.State++64end if65break6667case BOSSCURTAIN_SPAWN_BOSS68if Object.Timer < 24069Object.Timer++7071if Object.Timer == 14072CreateTempObject(TypeName[Fade Music], FADEMUSIC_TO_BOSS, Object.XPos, Object.YPos)73end if74else75Object.Timer = 076R8Setup.CurrentPalette = 077ArrayPos0 = Object.EntityNo78ArrayPos0 -= 379Object[-3].Type = TypeName[Egg Mobile]8081Object[-7].Type = TypeName[Boss Wing]82BossWing[-7].EggMobileEntity = ArrayPos08384Object[-6].Type = TypeName[Boss Wing]85BossWing[-6].EggMobileEntity = ArrayPos08687Object[-5].Type = TypeName[Boss Wing]88BossWing[-5].EggMobileEntity = ArrayPos08990Object[-4].Type = TypeName[Boss Wing]91BossWing[-4].EggMobileEntity = ArrayPos09293Helper1.BossHealth = 494Helper1.CenterBound = Object.XPos9596Helper1.LeftBound = Object.XPos97Helper1.LeftBound -= 0x7C00009899Helper1.RightBound = Object.XPos100Helper1.RightBound += 0x7C0000101102EggMobile.WingOffset = 0x1000103104Helper1.Controller = Helper1Controller_FourWings105106Helper2.CutsceneRightBound = Stage.XBoundary2107Object.State++108end if109break110111case BOSSCURTAIN_SET_BOUNDS112if Object.Alpha > 0113Object.Alpha -= 4114end if115116Object.LeftCurtainTile -= 0x20000117Object.RightCurtainTile += 0x20000118119TempValue1 = Object.LeftCurtainTile120TempValue1 >>= 16121TempValue1 += 7122123TempValue3 = Object.RightCurtainTile124TempValue3 >>= 16125TempValue3 -= 7126127TempValue2 = Object.iYPos128TempValue2 -= 92129130TempValue0 = 0131while TempValue0 < 12132// Swap tiles to fake motion on the curtain background133Set16x16TileInfo(0, TempValue1, TempValue2, TILEINFO_INDEX)134TempValue1 -= 16135Set16x16TileInfo(395, TempValue1, TempValue2, TILEINFO_INDEX)136TempValue1 += 16137Set16x16TileInfo(0, TempValue3, TempValue2, TILEINFO_INDEX)138TempValue3 += 16139Set16x16TileInfo(395, TempValue3, TempValue2, TILEINFO_INDEX)140TempValue3 -= 16141TempValue2 += 16142TempValue0++143loop144145if Object.Timer < 120146Object.Timer++147else148Object.Timer = 0149Object.State++150// Wide resolutions get forced to fight in a 320px wide area151if Screen.XSize > 320152ResetObjectEntity(Object.EntityNo, TypeName[Forcefield], 240, Object.XPos, Object.YPos)153else154ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, Object.XPos, Object.YPos)155end if156end if157break158end switch159end sub160161162sub ObjectPlayerInteraction163// Player Right Bound164TempValue0 = Player.CollisionRight165TempValue0 <<= 16166TempValue0 += Player.XPos167168// Stage Bound169TempValue1 = Stage.XBoundary2170TempValue1 <<= 16171172// Stop the player from advancing if the player right bound pos is after the stage bound pos173if TempValue0 > TempValue1174Player.XVelocity = 0175Player.Speed = 0176Player.XPos = TempValue1177178TempValue0 = Player.CollisionRight179TempValue0 <<= 16180Player.XPos -= TempValue0181end if182end sub183184185sub ObjectDraw186if Object.DrawOrder == 2187DrawRect(0, 0, Screen.XSize, Screen.YSize, 0, 0, 0, Object.Alpha)188SetDrawListEntityRef(Object.EntityNo, 3, Screen[3].DrawListSize)189Screen[3].DrawListSize++190Object.DrawOrder = 3191else192TempValue0 = 0193while TempValue0 < 6194DrawSpriteXY(TempValue0, Object.LeftCurtainTile, Object.YPos)195DrawSpriteFX(TempValue0, FX_FLIP, Object.RightCurtainTile, Object.YPos)196TempValue0++197loop198Object.DrawOrder = 2199end if200end sub201202203sub ObjectStartup204LoadSpriteSheet("R8/Objects2.gif")205206SpriteFrame(-8, -96, 16, 32, 134, 187) // #0 - Curtain Center Section 1207SpriteFrame(-8, -64, 16, 32, 134, 187) // #1 - Curtain Center Section 2208SpriteFrame(-8, -32, 16, 32, 134, 187) // #2 - Curtain Center Section 3209SpriteFrame(-8, 0, 16, 32, 134, 187) // #3 - Curtain Center Section 4210SpriteFrame(-8, 32, 16, 32, 134, 187) // #4 - Curtain Center Section 5211SpriteFrame(-8, 64, 16, 32, 134, 187) // #5 - Curtain Center Section 6212213ArrayPos0 = 32214while ArrayPos0 < 1056215if Object[ArrayPos0].Type == TypeName[Boss Curtain]216Object[ArrayPos0].Direction = FACING_LEFT217Object[ArrayPos0].DrawOrder = 2218Object[ArrayPos0].Alpha = 224219220Object[ArrayPos0].LeftCurtainTile = Object[ArrayPos0].XPos221Object[ArrayPos0].LeftCurtainTile -= 0x80000222223Object[ArrayPos0].RightCurtainTile = Object[ArrayPos0].XPos224Object[ArrayPos0].RightCurtainTile += 0x80000225end if226ArrayPos0++227loop228end sub229230231// ========================232// Editor Subs233// ========================234235sub RSDKDraw236Object.Direction = FACING_LEFT237238TempValue1 = Object.XPos239TempValue1 -= 0x80000240TempValue2 = Object.XPos241TempValue2 += 0x80000242243TempValue0 = 0244while TempValue0 < 6245DrawSpriteXY(TempValue0, TempValue1, Object.YPos)246DrawSpriteFX(TempValue0, FX_FLIP, TempValue2, Object.YPos)247TempValue0++248loop249Object.DrawOrder = 2250end sub251252253sub RSDKLoad254LoadSpriteSheet("R8/Objects2.gif")255256SpriteFrame(-8, -96, 16, 32, 134, 187) // #0 - Curtain Center Section 1257SpriteFrame(-8, -64, 16, 32, 134, 187) // #1 - Curtain Center Section 2258SpriteFrame(-8, -32, 16, 32, 134, 187) // #2 - Curtain Center Section 3259SpriteFrame(-8, 0, 16, 32, 134, 187) // #3 - Curtain Center Section 4260SpriteFrame(-8, 32, 16, 32, 134, 187) // #4 - Curtain Center Section 5261SpriteFrame(-8, 64, 16, 32, 134, 187) // #5 - Curtain Center Section 6262263SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")264end sub265266267