Path: blob/main/Scripts/Special/BGEffects_S7.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 fans in the level18Object.FansTimer++19if Object.FansTimer > 220Object.FansTimer = 021Object.FansSprite++22Object.FansSprite %= 323switch Object.FansSprite24case 025Copy16x16Tile(269, 484)26Copy16x16Tile(270, 485)27Copy16x16Tile(271, 486)28Copy16x16Tile(272, 487)29Copy16x16Tile(273, 488)30Copy16x16Tile(274, 489)31Copy16x16Tile(275, 490)32Copy16x16Tile(276, 491)33break3435case 136Copy16x16Tile(269, 492)37Copy16x16Tile(270, 493)38Copy16x16Tile(271, 494)39Copy16x16Tile(272, 495)40Copy16x16Tile(273, 496)41Copy16x16Tile(274, 497)42Copy16x16Tile(275, 498)43Copy16x16Tile(276, 499)44break4546case 247Copy16x16Tile(269, 500)48Copy16x16Tile(270, 501)49Copy16x16Tile(271, 502)50Copy16x16Tile(272, 503)51Copy16x16Tile(273, 504)52Copy16x16Tile(274, 505)53Copy16x16Tile(275, 506)54Copy16x16Tile(276, 507)55break5657end switch58end if5960// Animate the crunchers in the level61Object.CrunchersTimer++62if Object.CrunchersTimer > 563Object.CrunchersTimer = 064Object.CrunchersSprite++65Object.CrunchersSprite &= 366switch Object.CrunchersSprite67case 068Copy16x16Tile(129, 508)69Copy16x16Tile(130, 509)70Copy16x16Tile(134, 512)71Copy16x16Tile(135, 513)72break7374case 175Copy16x16Tile(129, 510)76Copy16x16Tile(130, 511)77Copy16x16Tile(134, 514)78Copy16x16Tile(135, 515)79break8081case 282Copy16x16Tile(129, 516)83Copy16x16Tile(130, 517)84Copy16x16Tile(134, 520)85Copy16x16Tile(135, 521)86break8788case 389Copy16x16Tile(129, 518)90Copy16x16Tile(130, 519)91Copy16x16Tile(134, 522)92Copy16x16Tile(135, 523)93break9495end switch96end if9798// Move all the BG layers based on the scroll difference from last frame99100TempValue1 = Object.PrevAngle101TempValue2 = TileLayer[0].Angle102if TempValue1 < TempValue2103TempValue3 = TempValue2104TempValue3 -= TempValue1105if TempValue3 > 256106TempValue1 += 512107end if108else109TempValue3 = TempValue1110TempValue3 -= TempValue2111if TempValue3 > 256112TempValue2 += 512113end if114end if115116TempValue0 = TempValue1117TempValue0 -= TempValue2118119// Store the current angle so that the same thing can be done next frame120Object.PrevAngle = TileLayer[0].Angle121122TempValue1 = 0x10000123TempValue2 = 0x20000124TempValue3 = 0x30000125126TempValue1 *= TempValue0127TempValue2 *= TempValue0128TempValue3 *= TempValue0129130HParallax[0].ScrollPos += TempValue1131HParallax[1].ScrollPos += TempValue2132HParallax[2].ScrollPos += TempValue3133134end sub135136137sub ObjectStartup138139Stage.XBoundary1 = 0x2800000 // left bounds of 640 pixels140Stage.XBoundary2 = 0xD800000 // right bounds of 3456 pixels141Stage.YBoundary1 = 0x2800000 // upper bounds of 640 pixels142Stage.YBoundary2 = 0xD800000 // lower bounds of 3456 pixels143144#platform: HW_Rendering145// Load the Sprite version of the stage map if needed146147LoadSpriteSheet("Special/SSMap7.gif")148#endplatform149150// Set the initial BG positions, offset by 128 pixels151HParallax[0].ScrollPos += 0x800000152HParallax[2].ScrollPos -= 0x800000153154// Setup any and all BGEffects objects that may be present in the level155// Though, there should only ever be one156157ArrayPos0 = 32158while ArrayPos0 < 1056159if Object[ArrayPos0].Type == TypeName[BGEffects]160161// Set the object to always active162Object[ArrayPos0].Priority = PRIORITY_ACTIVE163164// Give it a low draw order165Object[ArrayPos0].DrawOrder = 0166167// And set its starting angle168// But all other stages use 368... why is this one different?169Object[ArrayPos0].Value2 = 256170171end if172173ArrayPos0++174loop175176end sub177178179// ========================180// Editor Subs181// ========================182183sub RSDKDraw184DrawSprite(0)185end sub186187188sub RSDKLoad189LoadSpriteSheet("Special/SSMap7.gif")190SpriteFrame(-256, -256, 512, 512, 0, 0)191192SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")193end sub194195196