Path: blob/main/Scripts/Global/TimeWarpFix.txt
1319 views
//---------------Sonic CD Time Warp Fix Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer67// Property Values8#alias 0 : TIMEWARPFIX_ERASE_TOUCH // Touch this while trying to warp, no more time travel for you9#alias 1 : TIMEWARPFIX_ERASE_AREA // Get past this, no more warp for you10#alias 2 : TIMEWARPFIX_SAVE_POINT // Sets your position to the next object after time-travelling11#alias 3 : TIMEWARPFIX_SAVE_POINT_AIR // Sets your position to the next object after time-travelling, but in the air12#alias 4 : TIMEWARPFIX_FORCE_ERASE_TOUCH // Touch this, no more time travel for you (introduced in Origins Plus)1314// Gravity15#alias 1 : GRAVITY_AIR1617// Warp Destination18#alias 0 : WARP_NONE192021sub ObjectMain22switch Object.PropertyValue23case TIMEWARPFIX_ERASE_TOUCH24PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)25if CheckResult == true26if Warp.Destination > WARP_NONE27if Warp.Timer > 9928if Warp.Timer < 220 // They forgot to fix the warp timer here29Warp.Destination = WARP_NONE30end if31end if3233Warp.Timer = 034end if35end if36break3738case TIMEWARPFIX_ERASE_AREA39if Player.XPos < Object.XPos40Warp.Destination = WARP_NONE41Warp.Timer = 042end if43break4445case TIMEWARPFIX_SAVE_POINT46PlayerObjectCollision(C_TOUCH, -48, -48, 48, 48)47if CheckResult == true48Object.Type = TypeName[Blank Object]49Player.XPos = Object[+1].XPos50Player.YPos = Object[+1].YPos51end if5253Object.Timer++54if Object.Timer == 255Object.Type = TypeName[Blank Object]56end if57break5859case TIMEWARPFIX_SAVE_POINT_AIR60PlayerObjectCollision(C_TOUCH, -96, -96, 96, 96)61if CheckResult == true62Object.Type = TypeName[Blank Object]63Player.XPos = Object[+1].XPos64Player.YPos = Object[+1].YPos65Player.Gravity = GRAVITY_AIR66end if6768Object.Timer++69if Object.Timer == 270Object.Type = TypeName[Blank Object]71end if72break7374case TIMEWARPFIX_FORCE_ERASE_TOUCH75#platform: Use_Origins76PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)77if CheckResult == true78if Warp.Destination > WARP_NONE79Warp.Destination = WARP_NONE80Warp.Timer = 081end if82end if83#endplatform84break8586end switch87end sub888990sub ObjectPlayerInteraction9192// Check some interaction with the Player... but don't do anything with it93PlayerObjectCollision(C_TOUCH, -14, -15, 14, 16)9495// All the actual interaction is handled in ObjectMain instead, which is certainly quite the risky business..9697end sub9899100sub ObjectStartup101102// Well this event exists in the object's ByteCode, but there's not actually any code within it...103104end sub105106107// ========================108// Editor Subs109// ========================110111sub RSDKEdit112if Editor.ReturnVariable == true113switch Editor.VariableID114case EDIT_VAR_PROPVAL // Property Value115CheckResult = Object.PropertyValue116break117case 0 // Type118CheckResult = Object.PropertyValue119CheckResult &= 3120break121end switch122else123switch Editor.VariableID124case EDIT_VAR_PROPVAL // Property Value125Object.PropertyValue = Editor.VariableValue126break127case 0 // Type128Object.PropertyValue = Editor.VariableValue129Object.PropertyValue &= 3130break131end switch132end if133end sub134135136sub RSDKDraw137DrawSprite(0)138139if Editor.ShowGizmos == true140Editor.DrawingOverlay = true141142TempValue0 = -1143144switch Object.PropertyValue145case TIMEWARPFIX_ERASE_TOUCH146case TIMEWARPFIX_FORCE_ERASE_TOUCH147TempValue0 = 16; TempValue1 = 16; TempValue2 = 16; TempValue3 = 16;148break149150case TIMEWARPFIX_ERASE_AREA151// Draw a rightward arrow, should convey what this object does well enough152TempValue1 = Object.XPos153TempValue1 += 0x380000154DrawArrow(Object.XPos, Object.YPos, TempValue1, Object.YPos, 0, 0, 255)155break156157case TIMEWARPFIX_SAVE_POINT158TempValue0 = 48; TempValue1 = 48; TempValue2 = 48; TempValue3 = 48;159160// Draw an arrow to where the player will be sent161DrawArrow(Object.XPos, Object.YPos, Object[+1].XPos, Object[+1].YPos, 255, 255, 0)162break163164case TIMEWARPFIX_SAVE_POINT_AIR165TempValue0 = 96; TempValue1 = 96; TempValue2 = 96; TempValue3 = 96;166167// Draw an arrow to where the player will be sent168DrawArrow(Object.XPos, Object.YPos, Object[+1].XPos, Object[+1].YPos, 255, 255, 0)169break170171end switch172173if TempValue0 != -1174CallFunction(EditorHelpers_DrawHitbox)175end if176177Editor.DrawingOverlay = false178end if179end sub180181182sub RSDKLoad183LoadSpriteSheet("Global/Display.gif")184SpriteFrame(-8, -8, 16, 16, 173, 67) // "T" (rigger) Icon185186AddEditorVariable("Type")187SetActiveVariable("Type")188AddEnumVariable("Erase Time Warp on Touch", 0)189AddEnumVariable("Erase Time Warp on Pass", 1)190AddEnumVariable("Set Time Warp Pos (Ground)", 2)191AddEnumVariable("Set Time Warp Pos (Air)", 3)192AddEnumVariable("Erase Time Warp on Touch", 4)193end sub194195196