Path: blob/main/Scripts/Special/BGEffects_S2.txt
1319 views
//-----------------Sonic CD BGEffects Script------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5// Values 0-1 are unused...6#alias Object.Value2 : Object.PrevAngle7#alias Object.Value3 : Object.FansTimer8#alias Object.Value4 : Object.CrunchersTimer9#alias Object.Value5 : Object.FansSprite10#alias Object.Value6 : Object.CrunchersSprite1112// Priority13#alias 1 : PRIORITY_ACTIVE141516sub ObjectDraw17// Animate the Fans18Object.FansTimer++19if Object.FansTimer > 220Object.FansTimer = 021Object.FansSprite++22Object.FansSprite %= 323switch Object.FansSprite24case 025// Fans are 4x4 tiles, with 8 unique tiles in them, so26// 8 tiles need to be updated to change the entire sprite27Copy16x16Tile(122, 428)28Copy16x16Tile(123, 429)29Copy16x16Tile(124, 430)30Copy16x16Tile(125, 431)31Copy16x16Tile(126, 432)32Copy16x16Tile(127, 433)33Copy16x16Tile(128, 434)34Copy16x16Tile(129, 435)35break3637case 138Copy16x16Tile(122, 436)39Copy16x16Tile(123, 437)40Copy16x16Tile(124, 438)41Copy16x16Tile(125, 439)42Copy16x16Tile(126, 440)43Copy16x16Tile(127, 441)44Copy16x16Tile(128, 442)45Copy16x16Tile(129, 443)46break4748case 249Copy16x16Tile(122, 444)50Copy16x16Tile(123, 445)51Copy16x16Tile(124, 446)52Copy16x16Tile(125, 447)53Copy16x16Tile(126, 448)54Copy16x16Tile(127, 449)55Copy16x16Tile(128, 450)56Copy16x16Tile(129, 451)57break5859end switch60end if6162// Animate the Crunchers63Object.CrunchersTimer++64if Object.CrunchersTimer > 565Object.CrunchersTimer = 066Object.CrunchersSprite++67Object.CrunchersSprite &= 368switch Object.CrunchersSprite69case 070Copy16x16Tile(157, 452)71Copy16x16Tile(158, 453)72Copy16x16Tile(159, 456)73Copy16x16Tile(160, 457)74break7576case 177Copy16x16Tile(157, 454)78Copy16x16Tile(158, 455)79Copy16x16Tile(159, 458)80Copy16x16Tile(160, 459)81break8283case 284Copy16x16Tile(157, 460)85Copy16x16Tile(158, 461)86Copy16x16Tile(159, 464)87Copy16x16Tile(160, 465)88break8990case 391Copy16x16Tile(157, 462)92Copy16x16Tile(158, 463)93Copy16x16Tile(159, 466)94Copy16x16Tile(160, 467)95break9697end switch98end if99100// Find the difference between the current scroll and last scroll pos101TempValue1 = Object.PrevAngle102TempValue2 = TileLayer[0].Angle103if TempValue1 < TempValue2104TempValue3 = TempValue2105TempValue3 -= TempValue1106if TempValue3 > 256107// Account for looping108TempValue1 += 512109end if110else111TempValue3 = TempValue1112TempValue3 -= TempValue2113if TempValue3 > 256114// Account for looping115TempValue2 += 512116end if117end if118119TempValue0 = TempValue1120TempValue0 -= TempValue2121122// Store the current angle for use next frame123Object.PrevAngle = TileLayer[0].Angle124125// Move all the other BG layers in accordance with the difference from last frame126TempValue1 = 0x20000127TempValue2 = 0x10000128129TempValue1 *= TempValue0130TempValue2 *= TempValue0131132HParallax[0].ScrollPos += TempValue1133HParallax[1].ScrollPos += TempValue2134135end sub136137138sub ObjectStartup139140// Set stage bounds141Stage.XBoundary1 = 0x3800000 // 896 pixels to the left142Stage.XBoundary2 = 0xC800000 // 3200 pixels to the right143Stage.YBoundary1 = 0x3800000 // 896 pixels upwards144Stage.YBoundary2 = 0xC800000 // 3200 pixels downwards145146#platform: HW_Rendering147// Load the stage map if using the hardware render148149LoadSpriteSheet("Special/SSMap2.gif")150#endplatform151152// Setup all BGEffect objects present in the level153ArrayPos0 = 32154while ArrayPos0 < 1056155if Object[ArrayPos0].Type == TypeName[BGEffects]156157// Set the object to always be active158Object[ArrayPos0].Priority = PRIORITY_ACTIVE159160// Place the object among the first to be drawn161Object[ArrayPos0].DrawOrder = 0162163// And set its starting angle, assuming that Sonic is facing left164Object[ArrayPos0].PrevAngle = 368165166end if167168ArrayPos0++169loop170171end sub172173174// ========================175// Editor Subs176// ========================177178sub RSDKDraw179DrawSprite(0)180end sub181182183sub RSDKLoad184LoadSpriteSheet("Special/SSMap2.gif")185SpriteFrame(-256, -256, 512, 512, 0, 0)186187SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")188end sub189190191