Path: blob/main/Scripts/R1/FPlatform.txt
1319 views
//---------------Sonic CD Fall Platform Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Falling6#alias Object.Value1 : Object.Timer7#alias Object.Value2 : Object.YPlayerFloor8#alias Object.Value3 : Object.FallTimer9#alias Object.Value4 : Object.YVelocity10#alias Object.Value5 : Object.YOriginPos1112// States13#alias 0 : FALLPLATFORM_IDLE14#alias 1 : FALLPLATFORM_CRUMBLE15#alias 2 : FALLPLATFORM_FALL16#alias 3 : FALLPLATFORM_RESTORE1718// Property Values19#alias 0 : FALLING_PLATFORM20#alias 1 : STATIC_PLATFORM2122// Priority23#alias 0 : PRIORITY_BOUNDS24#alias 1 : PRIORITY_ACTIVE252627sub ObjectMain28if Object.Falling == true2930if Object.State == FALLPLATFORM_IDLE31Object.State = FALLPLATFORM_CRUMBLE32end if3334if Object.Timer < 1635Object.Timer++3637TempValue0 = Object.Timer38TempValue0 &= 33940if TempValue0 == 341Object.YPlayerFloor = 0x1000042else43Object.YPlayerFloor = 044end if4546else47Object.YPlayerFloor = 048end if4950else51if Object.Timer > 052Object.Timer--5354TempValue0 = Object.Timer55TempValue0 &= 35657if TempValue0 == 358Object.YPlayerFloor = -0x1000059else60Object.YPlayerFloor = 061end if6263else64Object.YPlayerFloor = 065end if6667end if68Object.Falling = false6970if Object.PropertyValue == FALLING_PLATFORM71switch Object.State72case FALLPLATFORM_CRUMBLE73if Object.FallTimer < 3074Object.FallTimer++75else76Object.YVelocity = 077Object.FallTimer = 078Object.State = FALLPLATFORM_FALL79Object.Priority = PRIORITY_ACTIVE80end if81break8283case FALLPLATFORM_FALL84if Object.YVelocity < 0x4000085Object.YVelocity += 0x200086end if87Object.YPlayerFloor += Object.YVelocity88if Object.OutOfBounds == true89Object.YPos = Object.YOriginPos90Object.State = FALLPLATFORM_RESTORE91Object.YVelocity = 092end if93break9495case FALLPLATFORM_RESTORE96if Object.OutOfBounds == true97Object.State = FALLPLATFORM_IDLE98Object.Priority = PRIORITY_BOUNDS99end if100break101end switch102end if103end sub104105106sub ObjectPlayerInteraction107if Object.State < FALLPLATFORM_RESTORE108PlayerObjectCollision(C_PLATFORM, -32, -9, 32, 12)109if CheckResult == true110Object.Falling = true111Player.YPos += Object.YPlayerFloor112end if113end if114end sub115116117sub ObjectDraw118Object.YPos += Object.YPlayerFloor119if Object.State < FALLPLATFORM_RESTORE120DrawSprite(0)121end if122end sub123124125sub ObjectStartup126LoadSpriteSheet("R1/Objects.gif")127128SpriteFrame(-32, -16, 64, 32, 101, 109) // #0 - Fall Platform129130ArrayPos0 = 32131while ArrayPos0 < 1056132if Object[ArrayPos0].Type == TypeName[Fall Platform]133Object[ArrayPos0].YOriginPos = Object[ArrayPos0].YPos134end if135ArrayPos0++136loop137end sub138139140// ========================141// Editor Subs142// ========================143144sub RSDKEdit145if Editor.ReturnVariable == true146switch Editor.VariableID147case EDIT_VAR_PROPVAL // Property Value148CheckResult = Object.PropertyValue149CheckResult &= 1150break151case 0 // type152CheckResult = Object.PropertyValue153CheckResult &= 1154break155end switch156else157switch Editor.VariableID158case EDIT_VAR_PROPVAL // Property Value159Object.PropertyValue = Editor.VariableValue160Object.PropertyValue &= 1161break162case 0 // type163Object.PropertyValue = Editor.VariableValue164Object.PropertyValue &= 1165break166end switch167end if168end sub169170171sub RSDKDraw172DrawSprite(0)173end sub174175176sub RSDKLoad177LoadSpriteSheet("R1/Objects.gif")178SpriteFrame(-32, -16, 64, 32, 101, 109) // #0 - Fall Platform179180AddEditorVariable("type")181SetActiveVariable("type")182AddEnumVariable("Falling Platform", 0)183AddEnumVariable("Static Platform", 1)184end sub185186187