Path: blob/main/Scripts/R5/RisePlatform2.txt
1319 views
//--------------Sonic CD Rise Platform 2 Script---------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Pressed6#alias Object.Value1 : Object.PlatformY7#alias Object.Value2 : Object.ChangeY8#alias Object.Value3 : Object.YVelocity9#alias Object.Value4 : Object.StartPosY10#alias Object.Value5 : Object.Timer1112// States13#alias 0 : RISEPLATFORM2_AWAITPLAYER14#alias 1 : RISEPLATFORM2_PRELAUNCH15#alias 2 : RISEPLATFORM2_LAUNCH16#alias 3 : RISEPLATFORM2_RISE17#alias 4 : RISEPLATFORM2_HALT18#alias 5 : RISEPLATFORM2_ARRIVED1920// Priority21#alias 1 : PRIORITY_ACTIVE22#alias 3 : PRIORITY_XBOUNDS232425sub ObjectMain2627switch Object.State28case RISEPLATFORM2_AWAITPLAYER29// Waiting for the Player to step on it to Launch3031Object.ChangeY = 03233if Object.Pressed == true34// If the Player's stepped onto the Platform, then get ready to launch35Object.State = RISEPLATFORM2_PRELAUNCH3637Object.Priority = PRIORITY_ACTIVE3839Object.YVelocity = 040Object.Timer = 041end if42break4344case RISEPLATFORM2_PRELAUNCH45// Pausing for a moment before Launching4647Object.ChangeY = Object.YVelocity4849if Object.Timer < 850Object.Timer++51else52Object.Timer = 053Object.State++54end if55break5657case RISEPLATFORM2_LAUNCH5859// If the Object hasn't yet reached a speed of 4px per frame, then make it go faster by 0.0625 more per frame60if Object.YVelocity > -0x4000061Object.YVelocity -= 0x100062else63// Sufficient speed reached, go to the next timer-based State64Object.State++65end if6667Object.ChangeY = Object.YVelocity68break6970case RISEPLATFORM2_RISE71// Just rise for a brief moment7273if Object.Timer < 1474Object.Timer++75else76// Time's up, start slowing down...77Object.Timer = 078Object.State++79end if8081Object.ChangeY = Object.YVelocity82break8384case RISEPLATFORM2_HALT8586// Until the Object is fully stopped, decelerate it at a speed of 0.0625 pixels per frame87if Object.YVelocity < 088Object.YVelocity += 0x100089else90// Special Delivery!91Object.State++92end if9394Object.ChangeY = Object.YVelocity95break9697case RISEPLATFORM2_ARRIVED98// Now, the Object just acts as a standard Platform99100if Object.Pressed == true101if Object.PlatformY < 16102Object.PlatformY++103TempValue0 = Object.PlatformY104TempValue0 &= 3105if TempValue0 == 3106Object.ChangeY = 0x10000107else108Object.ChangeY = 0109end if110else111Object.ChangeY = 0112end if113else114if Object.PlatformY > 0115Object.PlatformY--116TempValue0 = Object.PlatformY117TempValue0 &= 3118if TempValue0 == 3119Object.ChangeY = -0x10000120else121Object.ChangeY = 0122end if123else124Object.ChangeY = 0125end if126end if127break128129end switch130131// If the Object is Out Of Bounds, check to see if it's origin Position is OOB too before moving it back132if Object.OutOfBounds == true133134TempValue0 = Object.YPos135Object.YPos = Object.StartPosY136137if Object.OutOfBounds == true138Object.PlatformY = 0139Object.State = RISEPLATFORM2_AWAITPLAYER140else141Object.YPos = TempValue0142end if143144end if145146Object.Pressed = false147148end sub149150151sub ObjectPlayerInteraction152153PlayerObjectCollision(C_PLATFORM, -48, -16, 48, 12)154155if CheckResult == true156Object.Pressed = true157Player.YPos += Object.ChangeY158end if159160end sub161162163sub ObjectDraw164165Object.YPos += Object.ChangeY166DrawSprite(0)167168end sub169170171sub ObjectStartup172173LoadSpriteSheet("R5/Objects.gif")174175// Large Platform Frame176SpriteFrame(-48, -16, 96, 32, 1, 84)177178// Cycle through every Rise Platform 2 Object in the Scene179ArrayPos0 = 32180while ArrayPos0 < 1056181if Object[ArrayPos0].Type == TypeName[Rise Platform 2]182183// Store the Object's Starting Position184Object[ArrayPos0].StartPosY = Object[ArrayPos0].YPos185186Object[ArrayPos0].Priority = PRIORITY_XBOUNDS187188end if189190ArrayPos0++191loop192193end sub194195196// ========================197// Editor Subs198// ========================199200sub RSDKDraw201DrawSprite(0)202203if Editor.ShowGizmos == true204// Draw the Platform's destination205206TempValue0 = Object.YPos207TempValue0 -= 20971520208209Editor.DrawingOverlay = true210211DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, 255, 255)212213Editor.DrawingOverlay = false214end if215end sub216217218sub RSDKLoad219LoadSpriteSheet("R5/Objects.gif")220SpriteFrame(-48, -16, 96, 32, 1, 84)221222SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")223end sub224225226