Path: blob/main/Scripts/R8/BossWing.txt
1319 views
//----------------Sonic CD Boss Wing 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.Value2 : Object.YVelocity8#alias Object.Value3 : Object.RotDrawXPos9#alias Object.Value4 : Object.RotDrawYPos10#alias Object.Value5 : Object.Attached // Used by Egg Mobile11#alias Object.Value6 : Object.VisibleFrame12#alias Object.Value7 : Object.EggMobileEntity1314// States15#alias 0 : BOSSWING_BLANK // State used while attached on the Egg Mobile16#alias 1 : BOSSWING_DETACH17#alias 2 : BOSSWING_FALL_VERTICAL18#alias 3 : BOSSWING_DROP_GROUNDED19#alias 4 : BOSSWING_VANISH20#alias 5 : BOSSWING_FALL_DIAGONAL2122// Eggman Animations23#alias 2 : EGGANI_LAUGH2425// Collision Sides26#alias 0 : CSIDE_FLOOR2728// Stage SFX29#alias 8 : SFX_S_IMPACT13031// Priority32#alias 0 : PRIORITY_BOUNDS333435sub ObjectMain36switch Object.State37case BOSSWING_DETACH38Object.YPos -= Object.YVelocity39break4041case BOSSWING_FALL_VERTICAL42Object.YPos += Object.YVelocity43if Object.Timer < 3044Object.Timer++45Object.XPos += Object.XVelocity46else47if Object.Rotation == 048ObjectTileCollision(CSIDE_FLOOR, 0, 32, 0)49else50ObjectTileCollision(CSIDE_FLOOR, 0, 16, 0)51end if52if CheckResult == true53Object.State = BOSSWING_DROP_GROUNDED54Object.Timer = 055PlayStageSfx(SFX_S_IMPACT1, false)5657#platform: Use_Haptics58HapticEffect(100, 0, 0, 0)59#endplatform6061else62Object.XPos += Object.XVelocity63end if64end if65break6667case BOSSWING_DROP_GROUNDED68if Object.Timer < 3069Object.Timer++70else71Object.Timer = 072Object.VisibleFrame = Object.Frame73Object.State++74end if75break7677case BOSSWING_VANISH78if Object.Timer < 6079Object.Timer++80else81Object.Timer = 082Object.State = BOSSWING_BLANK83Object.Type = TypeName[Blank Object]84end if85TempValue0 = Object.Timer86TempValue0 &= 187if TempValue0 == 088Object.Frame = 589else90Object.Frame = Object.VisibleFrame91end if92break9394case BOSSWING_FALL_DIAGONAL95Object.XPos += Object.XVelocity96Object.YPos += Object.YVelocity9798Object.Rotation += 50899Object.Rotation &= 511100101Object.YVelocity += 0x3000102103if Object.Timer < 120104Object.Timer++105else106Object.Priority = PRIORITY_BOUNDS107Object.Timer = 0108Object.State = BOSSWING_BLANK109Object.Type = TypeName[Blank Object]110end if111112TempValue0 = Object.Timer113TempValue0 &= 1114if TempValue0 == 0115Object.Frame = 5116else117Object.Frame = 0118end if119break120end switch121end sub122123124sub ObjectPlayerInteraction125if Object.State < BOSSWING_VANISH126TempValue0 = 0127TempValue1 = Object.XPos128TempValue2 = Object.YPos129PlayerObjectCollision(C_TOUCH, -12, -12, 12, 12)130TempValue0 = CheckResult131132Sin(Object.XPos, Object.Rotation)133Object.XPos *= -0x100000134Object.XPos >>= 9135Object.XPos += TempValue1136137Cos(Object.YPos, Object.Rotation)138Object.YPos *= 0x100000139Object.YPos >>= 9140Object.YPos += TempValue2141142PlayerObjectCollision(C_TOUCH, -10, -10, 10, 10)143TempValue0 |= CheckResult144145Sin(Object.XPos, Object.Rotation)146Object.XPos *= 0x100000147Object.XPos >>= 9148Object.XPos += TempValue1149150Cos(Object.YPos, Object.Rotation)151Object.YPos *= -0x100000152Object.YPos >>= 9153Object.YPos += TempValue2154155PlayerObjectCollision(C_TOUCH, -15, -15, 15, 15)156TempValue0 |= CheckResult157158Object.XPos = TempValue1159Object.YPos = TempValue2160161if TempValue0 == true162CallFunction(Player_Hit)163if Player.State == Player_State_GotHit164ArrayPos0 = Object.EggMobileEntity165Object[ArrayPos0].Animation = EGGANI_LAUGH166end if167end if168end if169end sub170171172sub ObjectDraw173TempValue6 = Object.XPos174TempValue7 = Object.YPos175176if Object.Rotation == 256177TempValue6 -= 0x10000178end if179180if Object.Rotation == 384181TempValue7 -= 0x10000182end if183184switch Object.Frame185case 0186case 1187case 2188DrawSpriteFX(Object.Frame, FX_ROTATE, TempValue6, TempValue7)189190Sin(Object.RotDrawXPos, Object.Rotation)191Object.RotDrawXPos *= -0x200000192Object.RotDrawXPos >>= 9193Object.RotDrawXPos += Object.XPos194195Cos(Object.RotDrawYPos, Object.Rotation)196Object.RotDrawYPos *= 0x200000197Object.RotDrawYPos >>= 9198Object.RotDrawYPos += Object.YPos199200DrawSpriteXY(3, Object.RotDrawXPos, Object.RotDrawYPos)201break202203case 3 // Set by EggMobile204DrawSpriteFX(0, FX_ROTATE, TempValue6, TempValue7)205break206207case 4 // Set by EggMobile208DrawSpriteFX(2, FX_ROTATE, TempValue6, TempValue7)209break210211end switch212end sub213214215sub ObjectStartup216LoadSpriteSheet("R8/Objects3.gif")217218SpriteFrame(-24, -32, 48, 64, 156, 1) // #0 - Boss Wing facing front219SpriteFrame(-16, -32, 32, 64, 205, 1) // #1 - Boss Wing facing 45°220SpriteFrame(-8, -32, 16, 64, 238, 1) // #2 - Boss Wing facing side221222SpriteFrame(-8, -8, 16, 16, 90, 18) // #3 - Boss Wing body attachment223end sub224225226// ========================227// Editor Subs228// ========================229230sub RSDKDraw231TempValue6 = Object.XPos232TempValue7 = Object.YPos233234if Object.Rotation == 256235TempValue6 -= 0x10000236end if237238if Object.Rotation == 384239TempValue7 -= 0x10000240end if241DrawSpriteXY(0, Object.XPos, Object.YPos)242243Sin(TempValue0, 0)244TempValue0 *= -0x200000245TempValue0 >>= 9246TempValue0 += Object.XPos247248Cos(TempValue1, 0)249TempValue1 *= 0x200000250TempValue1 >>= 9251TempValue1 += Object.YPos252253DrawSpriteXY(1, Object.XPos, Object.YPos)254end sub255256257sub RSDKLoad258LoadSpriteSheet("R8/Objects3.gif")259260SpriteFrame(-24, -32, 48, 64, 156, 1) // #0 - Boss Wing facing front261SpriteFrame(-8, -8, 16, 16, 90, 18) // #1 - Boss Wing body attachment262263SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")264end sub265266267