Path: blob/main/Scripts/R6/HPlatform.txt
1319 views
//------------Sonic CD Horizontal Platform Script-------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value1 : Object.OffSetXPos6#alias Object.Value2 : Object.XVelocity7#alias Object.Value3 : Object.Angle89// Property Values10// This property values only cover the starting position11#alias 0 : START_MOVING_LEFT12#alias 1 : START_MOVING_RIGHT131415sub ObjectMain16Object.Angle = Oscillation17Object.Angle <<= 11819if Object.PropertyValue == START_MOVING_RIGHT20Object.Angle += 25621end if2223Sin(Object.XVelocity, Object.Angle)24Object.XVelocity <<= 1325Object.XVelocity += Object.XPos26Object.XVelocity &= 0xFFFF0000 // Truncate the value27Object.XVelocity -= Object.OffSetXPos28end sub293031sub ObjectPlayerInteraction32TempValue0 = Object.XPos33Object.XPos = Object.OffSetXPos3435PlayerObjectCollision(C_PLATFORM, -24, -12, 24, 8)36if CheckResult == true37Player.XPos += Object.XVelocity38if Player.State == Player_State_SpinningTop39Player.State = Player_State_Ground40end if41end if42Object.XPos = TempValue043end sub444546sub ObjectDraw47Sin(Object.OffSetXPos, Object.Angle)48Object.OffSetXPos <<= 1349Object.OffSetXPos += Object.XPos50Object.OffSetXPos &= 0xFFFF0000 // Truncate the value5152DrawSpriteXY(0, Object.OffSetXPos, Object.YPos)53DrawSpriteXY(1, Object.OffSetXPos, Object.YPos)54end sub555657sub ObjectStartup58LoadSpriteSheet("R6/Objects.gif")5960SpriteFrame(-24, -16, 48, 32, 1, 84) // #0 - Horizontal Platform61SpriteFrame(-8, 16, 16, 16, 35, 117) // #1 - Platform Light6263ArrayPos0 = 3264while ArrayPos0 < 105665if Object[ArrayPos0].Type == TypeName[H Platform]66Object[ArrayPos0].DrawOrder = 467end if68ArrayPos0++69loop70end sub717273// ========================74// Editor Subs75// ========================7677sub RSDKEdit78if Editor.ReturnVariable == true79switch Editor.VariableID80case EDIT_VAR_PROPVAL // Property Value81CheckResult = Object.PropertyValue82CheckResult &= 183break84case 0 // startDir85CheckResult = Object.PropertyValue86CheckResult &= 187break88end switch89else90switch Editor.VariableID91case EDIT_VAR_PROPVAL // Property Value92Object.PropertyValue = Editor.VariableValue93Object.PropertyValue &= 194break95case 0 // startDir96Object.PropertyValue = Editor.VariableValue97Object.PropertyValue &= 198break99end switch100end if101end sub102103104sub RSDKDraw105DrawSprite(0)106DrawSprite(1)107switch Object.PropertyValue108case START_MOVING_LEFT109TempValue1 = 255110TempValue2 = 255111TempValue3 = 128112TempValue4 = 0113break114case START_MOVING_RIGHT115TempValue1 = 128116TempValue2 = 0117TempValue3 = 255118TempValue4 = 255119break120end switch121TempValue0 = Object.XPos122TempValue0 -= 0x490000123TempValue5 = Object.YPos124TempValue5 -= 0x100000125if object.PropertyValue == START_MOVING_LEFT126DrawArrow(Object.XPos, Object.YPos, TempValue0, Object.YPos, 255, TempValue3, TempValue4, 0)127if Editor.ShowGizmos == true128Editor.DrawingOverlay = true129DrawRectOutline(TempValue0, TempValue5, 0x90, 0x30, 255, 255, 255, 255)130TempValue0 = Object.XPos131TempValue0 += 0x490000132DrawArrow(Object.XPos, Object.YPos, TempValue0, Object.YPos, 255, TempValue1, TempValue2, 0)133Editor.DrawingOverlay = false134end if135else136TempValue0 = Object.XPos137TempValue0 += 0x490000138DrawArrow(Object.XPos, Object.YPos, TempValue0, Object.YPos, 255, TempValue1, TempValue2, 0)139if Editor.ShowGizmos == true140Editor.DrawingOverlay = true141TempValue0 = Object.XPos142TempValue0 -= 0x490000143DrawRectOutline(TempValue0, TempValue5, 0x90, 0x30, 255, 255, 255, 255)144DrawArrow(Object.XPos, Object.YPos, TempValue0, Object.YPos, 255, TempValue3, TempValue4, 0)145Editor.DrawingOverlay = false146end if147end if148149end sub150151152sub RSDKLoad153LoadSpriteSheet("R6/Objects.gif")154SpriteFrame(-24, -16, 48, 32, 1, 84) // #0 - Horizontal Spin Platform frame 0155SpriteFrame(-8, 16, 16, 16, 35, 117) // #1 - Spin Platform Light156157AddEditorVariable("startDir")158SetActiveVariable("startDir")159AddEnumVariable("Left", START_MOVING_LEFT)160AddEnumVariable("Right", START_MOVING_RIGHT)161end sub162163