Path: blob/main/Scripts/R3/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.Value0 : Object.OnObject6#alias Object.Value1 : Object.Timer7#alias Object.Value2 : Object.YVelocity8#alias Object.Value3 : Object.XCollisionOffset9#alias Object.Value4 : Object.XVelocity10#alias Object.Value5 : Object.Angle1112// Property Values13#alias 0 : START_MOVING_LEFT14#alias 1 : START_MOVING_RIGHT151617sub ObjectMain18Object.Angle = Oscillation19Object.Angle *= 32021if Object.PropertyValue == START_MOVING_RIGHT22Object.Angle += 25623end if2425Cos(Object.XVelocity, Object.Angle)26Object.XVelocity *= 0x270027Object.XVelocity += Object.XPos28Object.XVelocity &= 0xFFFF0000 // Truncate the value29Object.XVelocity -= Object.XCollisionOffset3031if Object.OnObject == true32if Object.Timer < 1633Object.Timer++34TempValue0 = Object.Timer35TempValue0 &= 33637if TempValue0 == 338Object.YVelocity = 0x1000039else40Object.YVelocity = 041end if4243else44Object.YVelocity = 045end if46else47if Object.Timer > 048Object.Timer--49TempValue0 = Object.Timer50TempValue0 &= 351if TempValue0 == 352Object.YVelocity = -0x1000053else54Object.YVelocity = 055end if56else57Object.YVelocity = 058end if59end if60Object.OnObject = true61end sub626364sub ObjectPlayerInteraction65TempValue0 = Object.XPos66Object.XPos = Object.XCollisionOffset67PlayerObjectCollision(C_PLATFORM, -32, -16, 32, 12)68if CheckResult == true69Object.OnObject = true70Player.XPos += Object.XVelocity71Player.YPos += Object.YVelocity72end if73Object.XPos = TempValue074end sub757677sub ObjectDraw78Cos(Object.XCollisionOffset, Object.Angle)79Object.XCollisionOffset *= 0x270080Object.XCollisionOffset += Object.XPos81Object.XCollisionOffset &= 0xFFFF0000 // Truncate the value8283Object.YPos += Object.YVelocity84DrawSpriteXY(0, Object.XCollisionOffset, Object.YPos)85end sub868788sub ObjectStartup89LoadSpriteSheet("R3/Objects.gif")9091SpriteFrame(-32, -16, 64, 32, 100, 1) // #0 - Horizontal Platform92end sub939495// ========================96// Editor Subs97// ========================9899sub RSDKEdit100if Editor.ReturnVariable == true101switch Editor.VariableID102case EDIT_VAR_PROPVAL // Property Value103CheckResult = Object.PropertyValue104CheckResult &= 1105break106case 0 // type107CheckResult = Object.PropertyValue108CheckResult &= 1109break110end switch111else112switch Editor.VariableID113case EDIT_VAR_PROPVAL // Property Value114Object.PropertyValue = Editor.VariableValue115Object.PropertyValue &= 1116break117case 0 // type118Object.PropertyValue = Editor.VariableValue119Object.PropertyValue &= 1120break121end switch122end if123end sub124125126sub RSDKDraw127DrawSprite(0)128switch Object.PropertyValue129case START_MOVING_LEFT130TempValue1 = 255131TempValue2 = 255132TempValue3 = 128133TempValue4 = 0134break135case START_MOVING_RIGHT136TempValue1 = 128137TempValue2 = 0138TempValue3 = 255139TempValue4 = 255140break141end switch142143TempValue0 = Object.XPos144TempValue0 -= 0x620000145TempValue5 = Object.YPos146TempValue5 -= 0x100000147if object.PropertyValue == START_MOVING_LEFT148if Editor.ShowGizmos == true149Editor.DrawingOverlay = true150DrawRectOutline(TempValue0, TempValue5, 0xC4, 0x20, 255, 255, 255, 255)151DrawArrow(Object.XPos, Object.YPos, TempValue0, Object.YPos, 255, TempValue1, TempValue2, 0)152Editor.DrawingOverlay = false153end if154else155DrawArrow(Object.XPos, Object.YPos, TempValue0, Object.YPos, 255, TempValue1, TempValue2, 0)156end if157158TempValue0 = Object.XPos159TempValue0 += 0x620000160if object.PropertyValue == START_MOVING_RIGHT161if Editor.ShowGizmos == true162Editor.DrawingOverlay = true163DrawRectOutline(TempValue0, TempValue5, 0xC4, 0x20, 255, 255, 255, 255)164DrawArrow(Object.XPos, Object.YPos, TempValue0, Object.YPos, 255, TempValue3, TempValue4, 0)165Editor.DrawingOverlay = false166end if167else168DrawArrow(Object.XPos, Object.YPos, TempValue0, Object.YPos, 255, TempValue3, TempValue4, 0)169end if170end sub171172173sub RSDKLoad174LoadSpriteSheet("R3/Objects.gif")175176SpriteFrame(-32, -16, 64, 32, 100, 1) // #0 - Horizontal Platform177178AddEditorVariable("startDir")179SetActiveVariable("startDir")180AddEnumVariable("Left", START_MOVING_LEFT)181AddEnumVariable("Right", START_MOVING_RIGHT)182end sub183184185