Path: blob/main/Scripts/R3/VPlatform.txt
1319 views
//-------------Sonic CD Vertical Platform Script--------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value1 : Object.YCollisionOffset6#alias Object.Value2 : Object.YVelocity7#alias Object.Value3 : Object.Angle89// Property Values10#alias 0 : START_MOVING_DOWN11#alias 1 : START_MOVING_UP1213// Collision14#alias 1 : PLAYER_COL_FLOOR151617sub ObjectMain18Object.Angle = Oscillation19Object.Angle *= 320if Object.PropertyValue == START_MOVING_UP21Object.Angle += 25622end if2324Sin(Object.YVelocity, Object.Angle)25Object.YVelocity *= 0x270026Object.YVelocity += Object.YPos27Object.YVelocity &= 0xFFFF0000 // Truncate the value28Object.YVelocity -= Object.YCollisionOffset29end sub303132sub ObjectPlayerInteraction33TempValue0 = Object.YPos34Object.YPos = Object.YCollisionOffset35PlayerObjectCollision(C_PLATFORM, -32, -16, 32, 12)36if CheckResult == PLAYER_COL_FLOOR37Player.YPos += Object.YVelocity38end if39Object.YPos = TempValue040end sub414243sub ObjectDraw44Sin(Object.YCollisionOffset, Object.Angle)45Object.YCollisionOffset *= 0x270046Object.YCollisionOffset += Object.YPos47Object.YCollisionOffset &= 0xFFFF0000 // Truncate the value48DrawSpriteXY(0, Object.XPos, Object.YCollisionOffset)49end sub505152sub ObjectStartup53LoadSpriteSheet("R3/Objects.gif")5455SpriteFrame(-32, -16, 64, 32, 100, 1) // #0 - Vertical Platform56end sub575859// ========================60// Editor Subs61// ========================6263sub RSDKEdit64if Editor.ReturnVariable == true65switch Editor.VariableID66case EDIT_VAR_PROPVAL // Property Value67CheckResult = Object.PropertyValue68CheckResult &= 169break70case 0 // Type71CheckResult = Object.PropertyValue72CheckResult &= 173break74end switch75else76switch Editor.VariableID77case EDIT_VAR_PROPVAL // Property Value78Object.PropertyValue = Editor.VariableValue79Object.PropertyValue &= 180break81case 0 // Type82Object.PropertyValue = Editor.VariableValue83Object.PropertyValue &= 184break85end switch86end if87end sub8889sub RSDKDraw9091DrawSprite(0)9293switch Object.PropertyValue94case START_MOVING_DOWN95TempValue1 = 25596TempValue2 = 25597TempValue3 = 12898TempValue4 = 099break100case START_MOVING_UP101TempValue1 = 128102TempValue2 = 0103TempValue3 = 255104TempValue4 = 255105break106end switch107108TempValue0 = Object.YPos109TempValue0 -= 0x620000110TempValue5 = Object.XPos111TempValue5 -= 0x200000112if object.PropertyValue == START_MOVING_DOWN113if Editor.ShowGizmos == true114Editor.DrawingOverlay = true115DrawRectOutline(TempValue5, TempValue0, 0x40, 0xC4, 255, 255, 255, 255)116DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, TempValue1, TempValue2, 0)117Editor.DrawingOverlay = false118end if119else120DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, TempValue1, TempValue2, 0)121end if122123TempValue0 = Object.YPos124TempValue0 += 0x620000125if object.PropertyValue == START_MOVING_UP126if Editor.ShowGizmos == true127Editor.DrawingOverlay = true128DrawRectOutline(TempValue5, TempValue0, 0x40, 0xC4, 255, 255, 255, 255)129DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, TempValue3, TempValue4, 0)130Editor.DrawingOverlay = false131end if132else133DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, TempValue3, TempValue4, 0)134end if135end sub136137138sub RSDKLoad139LoadSpriteSheet("R3/Objects.gif")140141SpriteFrame(-32, -16, 64, 32, 100, 1) // #0 - Vertical Platform142143AddEditorVariable("startDir")144SetActiveVariable("startDir")145146AddEnumVariable("Down", START_MOVING_DOWN)147AddEnumVariable("Up", START_MOVING_UP)148end sub149150151