Path: blob/main/Scripts/R4/BGEffectsB2.txt
1319 views
//------------------Sonic CD BG Effects Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer6#alias Object.Value1 : Object.CurrentPal7#alias Object.Value2 : Object.PalDelay89// Priority10#alias 1 : PRIORITY_ACTIVE1112// Deformation Layer13#alias 3 : DEFORM_BG_WATER1415// Function declarations16#function BGEffects_Deform_Left17#function BGEffects_Deform_Right181920function BGEffects_Deform_Left21Stage[ArrayPos0].DeformationData1 = 122ArrayPos0++23Stage[ArrayPos0].DeformationData1 = 124ArrayPos0++25Stage[ArrayPos0].DeformationData1 = 226ArrayPos0++27Stage[ArrayPos0].DeformationData1 = 228ArrayPos0++29Stage[ArrayPos0].DeformationData1 = 330ArrayPos0++31Stage[ArrayPos0].DeformationData1 = 332ArrayPos0++33Stage[ArrayPos0].DeformationData1 = 334ArrayPos0++35Stage[ArrayPos0].DeformationData1 = 336ArrayPos0++37Stage[ArrayPos0].DeformationData1 = 238ArrayPos0++39Stage[ArrayPos0].DeformationData1 = 240ArrayPos0++41Stage[ArrayPos0].DeformationData1 = 142ArrayPos0++43Stage[ArrayPos0].DeformationData1 = 144ArrayPos0++45end function464748function BGEffects_Deform_Right49Stage[ArrayPos0].DeformationData1 = -150ArrayPos0++51Stage[ArrayPos0].DeformationData1 = -152ArrayPos0++53Stage[ArrayPos0].DeformationData1 = -254ArrayPos0++55Stage[ArrayPos0].DeformationData1 = -256ArrayPos0++57Stage[ArrayPos0].DeformationData1 = -358ArrayPos0++59Stage[ArrayPos0].DeformationData1 = -360ArrayPos0++61Stage[ArrayPos0].DeformationData1 = -362ArrayPos0++63Stage[ArrayPos0].DeformationData1 = -364ArrayPos0++65Stage[ArrayPos0].DeformationData1 = -266ArrayPos0++67Stage[ArrayPos0].DeformationData1 = -268ArrayPos0++69Stage[ArrayPos0].DeformationData1 = -170ArrayPos0++71Stage[ArrayPos0].DeformationData1 = -172ArrayPos0++73end function747576sub ObjectDraw77Object.Timer++78if Object.Timer > 179TileLayer[0].DeformationOffsetW++80TileLayer[1].DeformationOffsetW++81Object.Timer = 082end if8384Object.PalDelay++85if Object.PalDelay == 386Object.PalDelay = 087Object.CurrentPal++88Object.CurrentPal %= 389end if9091TempValue0 = Stage.WaterLevel92TempValue0 -= Screen.YOffset93if TempValue0 < 094TempValue0 = 095end if9697if TempValue0 > Screen.YSize98TempValue0 = Screen.YSize99end if100101#platform: SW_Rendering102SetActivePalette(Object.CurrentPal, 0, TempValue0)103SetActivePalette(7, TempValue0, Screen.YSize)104#endplatform105106#platform: HW_Rendering107SetActivePalette(Object.CurrentPal, 0, Screen.YSize)108DrawRect(0, TempValue0, Screen.XSize, Screen.YSize, 8, 0, 8, 96)109#endplatform110end sub111112113sub ObjectStartup114ArrayPos0 = 32115while ArrayPos0 < 1056116if Object[ArrayPos0].Type == TypeName[BGEffects]117Object[ArrayPos0].Priority = PRIORITY_ACTIVE118Object[ArrayPos0].DrawOrder = 5119// This looks dumb, and is dumb, but it's like that120#platform: HW_Rendering121Object[ArrayPos0].DrawOrder = 5122#endplatform123#platform: SW_Rendering124Object[ArrayPos0].DrawOrder = 0125#endplatform126end if127ArrayPos0++128loop129130#platform: SW_Rendering131ArrayPos0 = 0132CallFunction(BGEffects_Deform_Left)133134ArrayPos0 = 128135CallFunction(BGEffects_Deform_Left)136137ArrayPos0 = 160138CallFunction(BGEffects_Deform_Right)139140ArrayPos0 = 256141while ArrayPos0 < 576142ArrayPos1 = ArrayPos0143ArrayPos1 -= 256144Stage[ArrayPos0].DeformationData1 = Stage[ArrayPos1].DeformationData1145ArrayPos0++146loop147#endplatform148149SetLayerDeformation(DEFORM_BG_WATER, 128, 4, 0, 0, 0)150151LoadPalette("R4B_WaterPal.act", 7, 0, 0, 256)152CopyPalette(0, 1)153CopyPalette(0, 2)154CopyPalette(0, 3)155156TempValue0 = 0157TempValue1 = 0158TempValue2 = 16159while TempValue0 < 4160LoadPalette("R4B_PalCycle.act", TempValue0, 176, TempValue1, TempValue2)161TempValue1 += 16162TempValue2 += 16163TempValue0++164loop165end sub166167168// ========================169// Editor Subs170// ========================171172sub RSDKDraw173DrawSprite(0)174end sub175176177sub RSDKLoad178LoadSpriteSheet("Global/Display.gif")179SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon180181SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")182end sub183184185186