Path: blob/main/Scripts/R8/BigBomb.txt
1319 views
//----------------Sonic CD Big Bomb Script--------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer6#alias Object.Value3 : Object.LeftBound7#alias Object.Value4 : Object.RightBound8#alias Object.Value5 : Object.SavedYPos910// Big Bomb Fireball aliases11#alias Object.Value1 : BBFireBall.XVelocity12#alias Object.Value2 : BBFireBall.YVelocity1314// State15#alias 0 : BIGBOMB_SETUP16#alias 1 : BIGBOMB_MOVE_LEFT17#alias 2 : BIGBOMB_MOVE_RIGHT18#alias 3 : BIGBOMB_WAIT_PLAYER19#alias 4 : BIGBOMB_PREPARE_FUSE20#alias 5 : BIGBOMB_START_FUSE21#alias 6 : BIGBOMB_EXPLODE2223// Animations24#alias 0 : BOMBANI_IDLE25#alias 1 : BOMBANI_WALKING26#alias 2 : BOMBANI_SPOTTED27#alias 3 : BOMBANI_EXPLOSION2829// Stage SFX30#alias 5 : SFX_S_BOMB3132// Collision Sides33#alias 0 : CSIDE_FLOOR3435// Priority36#alias 1 : PRIORITY_ACTIVE3738// Collision Planes39#alias 0 : COLLISION_PLANE_A4041// Property Values42#alias 0 : MOVING_BOMB43#alias 1 : STATIC_BOMB444546sub ObjectMain47switch Object.State48case BIGBOMB_SETUP49Object.Priority = PRIORITY_ACTIVE50ObjectTileCollision(CSIDE_FLOOR, 0, 27, 0)51if CheckResult == true52if Object.PropertyValue == STATIC_BOMB53Object.State = BIGBOMB_WAIT_PLAYER5455Object.Direction = FACING_LEFT5657Object.Animation = BOMBANI_IDLE58else59Object.State = BIGBOMB_MOVE_LEFT60Object.Animation = BOMBANI_WALKING6162Object.LeftBound = Object.XPos63Object.LeftBound -= 0xC00006465Object.RightBound = Object.XPos66Object.RightBound += 0xC000067end if68else69Object.YPos += 0x1000070end if71break7273case BIGBOMB_MOVE_LEFT74Object.XPos -= 0xA00075if Object.XPos < Object.LeftBound76Object.Direction = FACING_LEFT77Object.State = BIGBOMB_MOVE_RIGHT78end if7980ObjectTileGrip(CSIDE_FLOOR, 0, 27, 0)81PlayerObjectCollision(C_TOUCH, -96, -128, 96, 27)82if CheckResult == true83Object.State = BIGBOMB_START_FUSE84Object.Animation = BOMBANI_SPOTTED85end if86break8788case BIGBOMB_MOVE_RIGHT89Object.XPos += 0xA00090if Object.XPos > Object.RightBound91Object.Direction = FACING_RIGHT92Object.State = BIGBOMB_MOVE_LEFT93end if9495ObjectTileGrip(CSIDE_FLOOR, 0, 27, 0)96PlayerObjectCollision(C_TOUCH, -96, -128, 96, 27)97if CheckResult == true98Object.State = BIGBOMB_START_FUSE99Object.Animation = BOMBANI_SPOTTED100end if101break102103case BIGBOMB_WAIT_PLAYER104PlayerObjectCollision(C_TOUCH, -96, -128, 96, 27)105if CheckResult == true106Object.Animation = BOMBANI_WALKING107Object.State++108end if109break110111case BIGBOMB_PREPARE_FUSE112Object.XPos += 0x20000113ObjectTileGrip(CSIDE_FLOOR, 24, 27, 0)114if CheckResult == false115Object.State = BIGBOMB_START_FUSE116Object.Animation = BOMBANI_SPOTTED117end if118break119120case BIGBOMB_START_FUSE121if Object.Timer < 30122Object.Timer++123else124Object.Timer = 0125Object.Animation = BOMBANI_EXPLOSION126Object.AnimationTimer = 0127Object.SavedYPos = Object.YPos128Object.State++129end if130break131132case BIGBOMB_EXPLODE133if Object.Timer < 120134Object.Timer++135Object.SavedYPos += 0x4000136else137CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)138BBFireBall[TempObjectPos].XVelocity = -0x30000139BBFireBall[TempObjectPos].YVelocity = -0x62000140141CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)142BBFireBall[TempObjectPos].XVelocity = -0x20000143BBFireBall[TempObjectPos].YVelocity = -0x52000144145CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)146BBFireBall[TempObjectPos].XVelocity = -0x10000147BBFireBall[TempObjectPos].YVelocity = -0x42000148149CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)150BBFireBall[TempObjectPos].XVelocity = 0151BBFireBall[TempObjectPos].YVelocity = -0x32000152153CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)154BBFireBall[TempObjectPos].XVelocity = 0x10000155BBFireBall[TempObjectPos].YVelocity = -0x42000156157CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)158BBFireBall[TempObjectPos].XVelocity = 0x20000159BBFireBall[TempObjectPos].YVelocity = -0x52000160161CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)162BBFireBall[TempObjectPos].XVelocity = 0x30000163BBFireBall[TempObjectPos].YVelocity = -0x62000164165CreateTempObject(TypeName[Explosion], 0, Object.XPos, Object.YPos)166ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)167168PlayStageSfx(SFX_S_BOMB, false)169170#platform: Use_Haptics171HapticEffect(77, 0, 0, 0)172#endplatform173174end if175break176end switch177end sub178179180sub ObjectPlayerInteraction181if Player.CollisionPlane == COLLISION_PLANE_A182PlayerObjectCollision(C_TOUCH, -18, -18, 18, 18)183if CheckResult == true184CallFunction(Player_Hit)185end if186end if187end sub188189190sub ObjectDraw191switch Object.Animation192case BOMBANI_IDLE193DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)194DrawSpriteFX(1, FX_FLIP, Object.XPos, Object.YPos)195DrawSpriteFX(2, FX_FLIP, Object.XPos, Object.YPos)196break197198case BOMBANI_WALKING199TempValue0 = Object.AnimationTimer200TempValue0 /= 20201TempValue0 *= 3202TempValue0 += 3203DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)204TempValue0++205DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)206TempValue0++207DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)208Object.AnimationTimer++209Object.AnimationTimer %= 80210break211212case BOMBANI_SPOTTED213TempValue0 = Object.AnimationTimer214TempValue0 /= 20215TempValue0 *= 3216TempValue0 += 3217DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)218TempValue0++219DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)220TempValue0++221DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)222break223224case BOMBANI_EXPLOSION225TempValue0 = Object.AnimationTimer226TempValue0 /= 3227TempValue0 += 15228DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.SavedYPos)229Object.AnimationTimer++230Object.AnimationTimer %= 6231DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)232DrawSpriteFX(1, FX_FLIP, Object.XPos, Object.YPos)233break234end switch235end sub236237238sub ObjectStartup239LoadSpriteSheet("R8/Objects2.gif")240241// Walking frames242SpriteFrame(-20, -20, 40, 40, 67, 82) // #0 - Big Bomb body frame 0243SpriteFrame(-27, 3, 48, 24, 109, 35) // #1 - Big Bomb legs frame 0244SpriteFrame(-4, -44, 8, 24, 176, 18) // #2 - Big Bomb fuse frame 0245246SpriteFrame(-20, -22, 40, 40, 67, 82) // #3 - Big Bomb body frame 1247SpriteFrame(-12, 3, 32, 24, 150, 85) // #4 - Big Bomb legs frame 1248SpriteFrame(-4, -46, 8, 24, 176, 18) // #5 - Big Bomb fuse frame 1249250SpriteFrame(-20, -20, 40, 40, 67, 82) // #6 - Big Bomb body frame 2251SpriteFrame(-27, 3, 48, 24, 109, 35) // #7 - Big Bomb legs frame 2252SpriteFrame(-4, -44, 8, 24, 176, 18) // #8 - Big Bomb fuse frame 2253254SpriteFrame(-20, -22, 40, 40, 67, 82) // #9 - Big Bomb body frame 3255SpriteFrame(-20, 3, 48, 24, 109, 60) // #10 - Big Bomb legs frame 3256SpriteFrame(-4, -46, 8, 24, 176, 18) // #11 - Big Bomb fuse frame 3257258// Explosion charge259SpriteFrame(-20, -20, 40, 40, 67, 82) // #12 - Big Bomb body frame 4260SpriteFrame(-20, 3, 40, 24, 109, 85) // #13 - Big Bomb legs frame 4261262SpriteFrame(-4, -44, 8, 24, 176, 18) // #14 - Big Bomb active fuse frame 0263SpriteFrame(-4, -44, 8, 24, 158, 18) // #15 - Big Bomb active fuse frame 1264SpriteFrame(-4, -44, 8, 24, 167, 18) // #16 - Big Bomb active fuse frame 2265266ArrayPos0 = 32267while ArrayPos0 < 1056268if Object[ArrayPos0].Type == TypeName[BigBomb] // um....?269// Allan please add missing code270end if271ArrayPos0++272loop273end sub274275276// ========================277// Editor Subs278// ========================279280sub RSDKEdit281if Editor.ReturnVariable == true282switch Editor.VariableID283case EDIT_VAR_PROPVAL // Property Value284case 0 // Type285CheckResult = Object.PropertyValue286CheckResult &= 1287break288end switch289else290switch Editor.VariableID291case EDIT_VAR_PROPVAL // Property Value292case 0 // Type293Object.PropertyValue = Editor.VariableValue294Object.PropertyValue &= 1295break296end switch297end if298end sub299300301sub RSDKDraw302DrawSprite(0)303DrawSprite(1)304DrawSprite(2)305end sub306307308sub RSDKLoad309LoadSpriteSheet("R8/Objects2.gif")310311// Walking frames312SpriteFrame(-20, -20, 40, 40, 67, 82) // #0 - Big Bomb body frame 0313SpriteFrame(-27, 3, 48, 24, 109, 35) // #1 - Big Bomb legs frame 0314SpriteFrame(-4, -44, 8, 24, 176, 18) // #2 - Big Bomb fuse frame 0315316AddEditorVariable("Type")317SetActiveVariable("Type")318AddEnumVariable("Moving Bomb", 0)319AddEnumVariable("Static Bomb", 1)320end sub321322323