Path: blob/main/Scripts/Global/BrokenMonitor.txt
1319 views
//---------------Sonic CD Broken Monitor Script---------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.PowerUpPos6#alias Object.Value1 : Object.Timer78// Player Aliases9#alias Player.Value0 : Player.Rings10#alias Player.Value3 : Player.SpeedShoesTimer11#alias Player.Value4 : Player.InvincibleTimer12#alias Player.Value5 : Player.BlinkTimer1314// States15#alias 0 : BROKENMONITOR_SPAWN_POWERUP16#alias 1 : BROKENMONITOR_FADE_POWERUP17#alias 2 : BROKENMONITOR_BLANK1819// Player20#alias 0 : PLAYER_SONIC_A2122// Soundtrack23#alias 0 : OST_JP2425// Priority26#alias 0 : PRIORITY_BOUNDS27#alias 1 : PRIORITY_ACTIVE2829// Ink Effects30#alias 2 : INK_ALPHA3132// Panning33#alias 0 : PAN_RIGHT34#alias 1 : PAN_LEFT3536// Global SFX37#alias 10 : SFX_G_BLUESHIELD38#alias 20 : SFX_G_1UP39#alias 21 : SFX_G_ACHIEVEMENT4041// Property Values42#alias 0 : MONITOR_BLANK43#alias 1 : MONITOR_RINGS44#alias 2 : MONITOR_SHIELD45#alias 3 : MONITOR_INVINCIBILITY46#alias 4 : MONITOR_POWER_SNEAKERS47#alias 5 : MONITOR_SONIC1UP48#alias 6 : MONITOR_TIME49#alias 7 : MONITOR_TAILS1UP50#alias 8 : MONITOR_SUPER5152// Origins Exclusive53#alias 9 : MONITOR_KNUCKLES1UP54#alias 10 : MONITOR_AMY1UP5556// Game Mode Aliases57#alias 2 : MODE_TIMEATTACK5859// Blue Shield possesion Property Value60#alias 1 : ACTIVE_SHIELD6162sub ObjectMain63switch Object.State64case BROKENMONITOR_SPAWN_POWERUP65if Object.Timer < 066Object.PowerUpPos += Object.Timer67Object.Timer += 0x180068else69Object.Timer = 070end if7172if Object.Timer == 073Object.State = BROKENMONITOR_FADE_POWERUP74Object.InkEffect = INK_ALPHA75switch Object.PropertyValue76case MONITOR_RINGS77Player.Rings += 1078if Ring.Pan == PAN_RIGHT79SetSfxAttributes(1, -1, -100)80Ring.Pan = PAN_LEFT81else82SetSfxAttributes(2, -1, 100)83Ring.Pan = PAN_RIGHT84end if8586if Player.Rings > 99987Player.Rings = 99988end if8990if Player.Rings >= Ring.ExtraLife91if Options.GameMode != MODE_TIMEATTACK9293#platform: Use_Origins94if game.coinMode == false95Player.Lives++96else97game.callbackParam0 = 1 // Set the amount of coins to add98EngineCallback(NOTIFY_ADD_COIN)99end if100#endplatform101102#platform: Use_Standalone103Player.Lives++104#endplatform105106if Stage.PlayerListPos == PLAYER_SONIC_A107PlaySfx(SFX_G_1UP, false)108else109PlaySfx(SFX_G_ACHIEVEMENT, false)110end if111112end if113114Ring.ExtraLife += 100115if Ring.ExtraLife > 300116Ring.ExtraLife = 1000117end if118119// King of the Rings Unlock Criteria120if Player.Rings >= 200121if Stage.PlayerListPos == PLAYER_SONIC_A122if Stage.DebugMode == false123SetAchievement(4, 100)124end if125end if126end if127end if128break129130case MONITOR_SHIELD131PlaySfx(SFX_G_BLUESHIELD, false)132Object[2].PropertyValue = ACTIVE_SHIELD133if Object[2].Type != TypeName[Invincibility]134Object[2].Type = TypeName[Blue Shield]135Object[2].Priority = PRIORITY_ACTIVE136Object[2].DrawOrder = 4137Object[2].InkEffect = INK_ALPHA138Object[2].Alpha = 160139Object[2].XPos = Player.XPos140Object[2].YPos = Player.YPos141end if142break143144case MONITOR_INVINCIBILITY145Object[2].Type = TypeName[Invincibility]146Object[2].Priority = PRIORITY_ACTIVE147Object[2].DrawOrder = 4148Object[2].XPos = Player.XPos149Object[2].YPos = Player.YPos150151if Options.Soundtrack == OST_JP152Player.InvincibleTimer = 0x4EC153else154Player.InvincibleTimer = 0x528155end if156157Player.BlinkTimer = 0158Player.Visible = true159PlayMusic(2)160break161162case MONITOR_POWER_SNEAKERS163PlayMusic(3)164Player.Acceleration = 0x1800165Player.AirAcceleration = 0x3000166Player.TopSpeed = 0xC0000167Player.SpeedShoesTimer = 0x528168break169170case MONITOR_SONIC1UP171#platform: Use_Origins172// Bug Details (kinda):173// For some reason, Knuckles and Amy use the Sonic monitor's switch case code, meaning 1Up.wav will play instead of Achievement.wav174// This doesn't matter in the context of Origins since both files point to the same sound effect in HE2's RFL parameters, but175// in a standalone program such as the decomps, hearing Sonic's voice while playing as another character is pretty freaky176case MONITOR_KNUCKLES1UP177case MONITOR_AMY1UP178if game.coinMode == false179Player.Lives++180else181game.callbackParam0 = 1 // Set the amount of coins to add182EngineCallback(NOTIFY_ADD_COIN)183end if184#endplatform185186#platform: Use_Standalone187Player.Lives++188#endplatform189190PlaySfx(SFX_G_1UP, false)191break192193case MONITOR_TIME194// Earlier in development, this monitor behaved like an Eggman monitor, hurting the player when broken195// This was likely a leftover from Sonic Nexus, where Eggman monitors had the same property value (6)196break197198case MONITOR_TAILS1UP199#platform: Use_Origins200if game.coinMode == false201Player.Lives++202else203game.callbackParam0 = 1 // Set the amount of coins to add204EngineCallback(NOTIFY_ADD_COIN)205end if206#endplatform207208#platform: Use_Standalone209Player.Lives++210#endplatform211212PlaySfx(SFX_G_ACHIEVEMENT, false)213break214215case MONITOR_SUPER216Object[2].Type = TypeName[Invincibility]217Object[2].Priority = PRIORITY_ACTIVE218Object[2].DrawOrder = 4219Object[2].XPos = Player.XPos220Object[2].YPos = Player.YPos221222Player.InvincibleTimer = 0x528223Player.BlinkTimer = 0224Player.Visible = true225Player.Acceleration = 0x1800226Player.AirAcceleration = 0x3000227Player.TopSpeed = 0xC0000228Player.SpeedShoesTimer = 0x528229break230231end switch232end if233break234235case BROKENMONITOR_FADE_POWERUP236Object.Timer++237if Object.Timer == 30238Object.Timer = 0239Object.State = BROKENMONITOR_BLANK240241Object.PropertyValue = MONITOR_BLANK242Object.Priority = PRIORITY_BOUNDS243else244if Object.Timer > 14245Object.Alpha -= 16246end if247end if248break249250case BROKENMONITOR_BLANK251break252end switch253end sub254255256sub ObjectDraw257DrawSprite(0)258259if Object.PropertyValue > 0260DrawSpriteFX(Object.PropertyValue, FX_INK, Object.XPos, Object.PowerUpPos)261end if262end sub263264265sub ObjectStartup266267LoadSpriteSheet("Global/Items.gif")268269// 0 - Broken Monitor Frame270SpriteFrame(-16, 0, 32, 16, 51, 166)271272// 1-8 - Icons273SpriteFrame(-8, -8, 16, 16, 26, 7) // #1 - Ring274SpriteFrame(-8, -8, 16, 16, 26, 40) // #2 - Blue Shield275SpriteFrame(-8, -8, 16, 16, 26, 73) // #3 - Invincibility276SpriteFrame(-8, -8, 16, 16, 26, 106) // #4 - Power Sneakers277278#platform: Use_Origins279if game.coinMode == false280SpriteFrame(-8, -8, 16, 16, 26, 139) // #5 - Sonic281else282SpriteFrame(-8, -8, 16, 16, 92, 206) // #5 - Coins283end if284#endplatform285286#platform: Use_Standalone287SpriteFrame(-8, -8, 16, 16, 26, 139) // #5 - Sonic288#endplatform289290SpriteFrame(-8, -8, 16, 16, 26, 172) // #6 - Time291292#platform: Use_Origins293if game.coinMode == false294SpriteFrame(-8, -8, 16, 16, 59, 106) // #7 - Tails295else296SpriteFrame(-8, -8, 16, 16, 92, 206) // #7 - Coins297end if298#endplatform299300#platform: Use_Standalone301SpriteFrame(-8, -8, 16, 16, 59, 106) // #7 - Tails302#endplatform303304SpriteFrame(-8, -8, 16, 16, 59, 139) // #8 - S305306#platform: Use_Origins307if game.coinMode == false308SpriteFrame(-8, -8, 16, 16, 42, 262) // #9 - Knuckles309else310SpriteFrame(-8, -8, 16, 16, 92, 206) // #9 - Coins311end if312if game.coinMode == false313SpriteFrame(-8, -8, 16, 16, 9, 262) // #10 - Amy314else315SpriteFrame(-8, -8, 16, 16, 92, 206) // #10 - Coins316end if317#endplatform318end sub319320321// ========================322// Editor Subs323// ========================324325sub RSDKDraw326DrawSprite(0)327end sub328329330sub RSDKLoad331LoadSpriteSheet("Global/Items.gif")332SpriteFrame(-16, 0, 32, 16, 51, 166) // Broken Monitor333334// Not to be used in-editor335SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")336end sub337338339