Path: blob/main/Scripts/Mission/Hotaru2.txt
1319 views
//------------------Sonic CD Hotaru 2 Script------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//3//-------Used on Mission "M110 - Extreme! Gotta Go Fast"------//45// Aliases6#alias Object.Value0 : Object.Timer7#alias Object.Value1 : Object.XVelocity8#alias Object.Value2 : Object.YVelocity9#alias Object.Value3 : Object.XOriginPos10#alias Object.Value4 : Object.YOriginPos11#alias Object.Value5 : Object.LeftBound12#alias Object.Value6 : Object.RightBound13#alias Object.Value7 : Object.CheckBounds1415// Hotaru Laser alias16#alias Object.Value2 : Object.HotaruEntity1718// HUD Alias19#alias Object[24].PropertyValue : HUD.CurrentTimePeriod2021// One Way Door Alias22#alias Object[+5].State : OneWayDoor.State2324// Hotaru Spawner States25#alias 0 : HOTARU2_SPAWNER_CHECK_BOUNDS26#alias 1 : HOTARU2_SPAWNER_SPAWN_CHILD_127#alias 2 : HOTARU2_SPAWNER_CHECK_CHILD_128#alias 3 : HOTARU2_SPAWNER_SPAWN_CHILD_229#alias 4 : HOTARU2_SPAWNER_CHECK_CHILD_230#alias 5 : HOTARU2_SPAWNER_OPEN_DOORS3132// Hotaru States33#alias 0 : HOTARU2_FADE_IN34#alias 1 : HOTARU2_MOVE35#alias 2 : HOTARU2_CHARGE_LASER36#alias 3 : HOTARU2_SHOT_LASER37#alias 4 : HOTARU2_SET_NEW_DESTINATION3839// One Way Door States40#alias 1 : ONEWAYDOOR_OPEN4142// Property Values43#alias 0 : PARENT_OBJECT44#alias 1 : CHILD_OBJECT4546// Time Periods47#alias 0 : TIME_PRESENT48#alias 1 : TIME_PAST49#alias 2 : TIME_GOOD_FUTURE50#alias 3 : TIME_BAD_FUTURE5152// Ink Effects53#alias 2 : INK_ALPHA5455// Priority56#alias 1 : PRIORITY_ACTIVE5758// Stage SFX59#alias 4 : SFX_S_HLASER6061// Function declarations62#function Hotaru2_Set_Destination6364function Hotaru2_Set_Destination65if Object.CheckBounds == false66TempValue0 = true67else68TempValue1 = Player.XPos69TempValue1 >>= 1670TempValue1 &= 0x7FF87172CheckLower(TempValue1, Object.LeftBound)73TempValue0 = CheckResult7475CheckGreater(TempValue1, Object.RightBound)76TempValue0 |= CheckResult77end if7879if TempValue0 == true80TempValue2 = Oscillation81TempValue2 &= 12782TempValue2 += Object.XOriginPos83TempValue2 -= 648485TempValue3 = Player.XPos86TempValue3 >>= 1687TempValue3 *= 588TempValue3 &= 3189TempValue3 += Object.YOriginPos90else91TempValue2 = TempValue19293TempValue3 = Object.YOriginPos94TempValue3 -= 895end if96Object.XVelocity = TempValue297Object.XVelocity -= Object.iXPos98Object.XVelocity <<= 1299100Object.YVelocity = TempValue3101Object.YVelocity -= Object.iYPos102Object.YVelocity <<= 12103104Object.CheckBounds++105Object.CheckBounds &= 1106end function107108109sub ObjectMain110if game.playMode == BOOT_PLAYMODE_BOSSRUSH111Object.Type = TypeName[Blank Object]112else113if Object.PropertyValue == PARENT_OBJECT114switch Object.State115case HOTARU2_SPAWNER_CHECK_BOUNDS116TempValue0 = Object.XPos117TempValue0 -= 0x300000118119if Player.XPos > TempValue0120Object.State++121end if122break123124case HOTARU2_SPAWNER_SPAWN_CHILD_1125if Object.Timer < 60126Object.Timer++127else128Object.Timer = 0129130Object[+1].Type = TypeName[Hotaru2]131Object[+1].XPos = Object.XPos132Object[+1].XPos -= 0x500000133Object[+1].YPos = Object.YPos134Object[+1].YPos += 0x300000135Object.State++136end if137break138139case HOTARU2_SPAWNER_CHECK_CHILD_1140// Check if the first Hotaru got destroyed141if Object[+1].Type != TypeName[Hotaru2]142Object.State++143else144if Object[+1].State < HOTARU2_CHARGE_LASER145TempValue0 = 176146else147TempValue0 = 0148end if149TempValue0 -= Object.Alpha150TempValue0 >>= 3151Object.Alpha += TempValue0152end if153break154155case HOTARU2_SPAWNER_SPAWN_CHILD_2156if Object.Timer < 60157Object.Timer++158else159Object.Timer = 0160Object[+2].Type = TypeName[Hotaru2]161Object[+2].CheckBounds = true162163Object[+2].XPos = Object.XPos164Object[+2].XPos -= 0x500000165166Object[+2].YPos = Object.YPos167Object[+2].YPos += 0x280000168169Object[+3].Type = TypeName[Hotaru2]170Object[+3].CheckBounds = false171172Object[+3].XPos = Object.XPos173Object[+3].XPos += 0x500000174175Object[+3].YPos = Object.YPos176Object[+3].YPos += 0x280000177Object.State++178end if179break180181case HOTARU2_SPAWNER_CHECK_CHILD_2182if Object[+2].Type != TypeName[Hotaru]183if Object[+3].Type != TypeName[Hotaru]184ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)185else186if Object[+3].State < HOTARU2_CHARGE_LASER187TempValue0 = 176188else189TempValue0 = 0190end if191TempValue0 -= Object.Alpha192TempValue0 >>= 3193Object.Alpha += TempValue0194end if195else196if Object[+2].State < HOTARU2_CHARGE_LASER197TempValue0 = 176198else199TempValue0 = 0200end if201TempValue0 -= Object.Alpha202TempValue0 >>= 3203Object.Alpha += TempValue0204end if205break206207case HOTARU2_SPAWNER_OPEN_DOORS208if Object[+2].State > HOTARU2_MOVE209if Object[+3].State > HOTARU2_MOVE210OneWayDoor.State = ONEWAYDOOR_OPEN211end if212end if213214if HUD.CurrentTimePeriod == TIME_BAD_FUTURE215if Object.Alpha < 176216Object.Alpha++217end if218else219if Object.Alpha > 0220Object.Alpha--221end if222end if223224PlayerObjectCollision(C_TOUCH, -192, -256, 420, 256)225if CheckResult == false226ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)227end if228break229end switch230else231switch Object.State232case HOTARU2_FADE_IN233if Object.Timer < 30234Object.Timer++235else236Object.Timer = 16237CallFunction(Hotaru2_Set_Destination)238Object.State++239end if240Object.Alpha = Object.Timer241Object.Alpha <<= 2242break243244case HOTARU2_MOVE245Object.XPos += Object.XVelocity246Object.YPos += Object.YVelocity247248TempValue0 = Object.Timer249TempValue0 &= 1250if TempValue0 == 0251CreateTempObject(TypeName[Hotaru Trail], 0, Object.XPos, Object.YPos)252Object[TempObjectPos].InkEffect = INK_ALPHA253Object[TempObjectPos].Alpha = 248254end if255256Object.Timer--257if Object.Timer == 0258Object.State++259end if260break261262case HOTARU2_CHARGE_LASER263Object.Timer++264if Object.Timer == 16265Object.Timer = 0266Object.State++267PlayStageSfx(SFX_S_HLASER, false)268end if269break270271case HOTARU2_SHOT_LASER272TempValue0 = Object.Timer273TempValue0 &= 1274if TempValue0 == 0275CreateTempObject(TypeName[Blank Object], 0, Object.XPos, Object.YPos)276Object[TempObjectPos].HotaruEntity = Object.EntityNo277end if278Object.Timer++279if Object.Timer == 10280Object.Timer = 0281Object.State++282end if283break284285case HOTARU2_SET_NEW_DESTINATION286Object.Timer++287if Object.Timer == 8288Object.Timer = 16289CallFunction(Hotaru2_Set_Destination)290Object.State = HOTARU2_MOVE291end if292break293end switch294end if295end if296end sub297298299sub ObjectPlayerInteraction300if Object.PropertyValue == CHILD_OBJECT301if Object.State == HOTARU2_SHOT_LASER302if Object.Timer > 1303PlayerObjectCollision(C_ENEMY, -5, -5, 5, 5)304if CheckResult == true305CallFunction(Player_BadnikBreak)306end if307end if308end if309end if310end sub311312313sub ObjectDraw314315if Object.PropertyValue == CHILD_OBJECT316switch Object.State317case HOTARU2_FADE_IN318DrawSpriteFX(2, FX_INK, Object.XPos, Object.YPos)319break320321case HOTARU2_MOVE322DrawSprite(2)323break324325case HOTARU2_CHARGE_LASER326TempValue0 = Object.Timer327TempValue0 &= 3328TempValue0 >>= 1329if TempValue0 == 0330DrawSprite(3)331else332DrawSprite(0)333end if334break335336case HOTARU2_SHOT_LASER337TempValue0 = Object.Timer338TempValue0 &= 7339TempValue0 >>= 2340DrawSprite(TempValue0)341DrawSprite(3)342break343344case HOTARU2_SET_NEW_DESTINATION345TempValue0 = Object.Timer346TempValue0 &= 3347TempValue0 >>= 1348if TempValue0 == 0349DrawSprite(3)350else351DrawSprite(0)352end if353break354end switch355end if356end sub357358359sub ObjectStartup360LoadSpriteSheet("R8/Objects3.gif")361362SpriteFrame(-12, -24, 24, 40, 96, 133) // #0 - Hotaru Idle frame 0363SpriteFrame(-12, -24, 24, 40, 121, 133) // #1 - Hotaru Idle frame 1364365SpriteFrame(-12, -10, 24, 24, 146, 133) // #2 - Hotaru Bulb frame 0366SpriteFrame(-12, -10, 24, 24, 171, 133) // #3 - Hotaru Bulb frame 1367368ArrayPos0 = 32369while ArrayPos0 < 1056370if Object[ArrayPos0].Type == TypeName[Hotaru]371Object[ArrayPos0].Type = TypeName[Hotaru2]372end if373374if Object[ArrayPos0].Type == TypeName[Hotaru2]375Object[ArrayPos0].Alpha = 0376Object[ArrayPos0].InkEffect = INK_ALPHA377378if HUD.CurrentTimePeriod == TIME_BAD_FUTURE379Object[ArrayPos0].DrawOrder = 2380end if381382ArrayPos1 = ArrayPos0383ArrayPos1++384TempValue0 = 0385while TempValue0 < 3386// Setups the next 3 blank objects387Object[ArrayPos1].PropertyValue = CHILD_OBJECT388Object[ArrayPos1].DrawOrder = 4389Object[ArrayPos1].InkEffect = INK_ALPHA390391Object[ArrayPos1].XOriginPos = Object[ArrayPos0].iXPos392Object[ArrayPos1].YOriginPos = Object[ArrayPos0].iYPos393394Object[ArrayPos1].LeftBound = Object[ArrayPos0].iXPos395Object[ArrayPos1].LeftBound -= 112396397Object[ArrayPos1].RightBound = Object[ArrayPos0].iXPos398Object[ArrayPos1].RightBound += 112399TempValue0++400ArrayPos1++401loop402ArrayPos0 += 3403end if404ArrayPos0++405loop406end sub407408409// ========================410// Editor Subs411// ========================412413sub RSDKDraw414DrawSprite(0)415end sub416417418sub RSDKLoad419LoadSpriteSheet("R8/Objects3.gif")420421SpriteFrame(-12, -24, 24, 40, 96, 133) // #0 - Hotaru Idle frame 0422423SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")424end sub425426427428429