Path: blob/main/Scripts/R4/GrabPole.txt
1319 views
//----------------Sonic CD Grab Pole Script-------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.BreakTimer67// HUD alias8#alias Object[24].PropertyValue : HUD.CurrentTimePeriod910// States11#alias 0 : GRABPOLE_IDLE12#alias 1 : GRABPOLE_HANGING13#alias 2 : GRABPOLE_BROKEN1415// Players16#alias 0 : PLAYER_SONIC_A1718// Time Periods19#alias 0 : TIME_PRESENT20#alias 1 : TIME_PAST21#alias 2 : TIME_GOOD_FUTURE22#alias 3 : TIME_BAD_FUTURE232425sub ObjectMain26if Object.State == GRABPOLE_HANGING27if Player.State == Player_State_Death28Object.State = GRABPOLE_IDLE29end if30if Player.State == Player_State_Drown31Object.State = GRABPOLE_IDLE32end if3334if Object.State > GRABPOLE_IDLE35if Object.BreakTimer < 18036Object.BreakTimer++37Player.XPos = Object.XPos38Player.Direction = FACING_RIGHT39if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins40Player.XPos += 0x14000041else42Player.XPos += 0x10000043end if44else45Object.Frame = 146Object.State = GRABPOLE_BROKEN4748#platform: Use_Origins49Player.State = Player_State_Air_NoDropDash50#endplatform5152#platform: Use_Standalone53Player.State = Player_State_Air54#endplatform5556end if57end if58end if59end sub606162sub ObjectPlayerInteraction63switch Object.State64case GRABPOLE_IDLE65PlayerObjectCollision(C_TOUCH, 16, -28, 32, 28)66if CheckResult == true67Object.State = GRABPOLE_HANGING68Player.State = Player_State_Static6970Player.Animation = ANI_CLINGING71Player.Direction = FACING_RIGHT7273Player.Speed = 074Player.XVelocity = 075Player.YVelocity = 076end if77break7879case GRABPOLE_HANGING80if Player.Up == true81Player.YPos -= 0x1000082end if8384if Player.Down == true85Player.YPos += 0x1000086end if8788if Player.JumpPress == true89Object.Frame = 190Object.State = GRABPOLE_BROKEN9192#platform: Use_Origins93Player.State = Player_State_Air_NoDropDash94#endplatform9596#platform: Use_Standalone97Player.State = Player_State_Air98#endplatform99100end if101102PlayerObjectCollision(C_BOX, 0, -64, 32, -46)103PlayerObjectCollision(C_BOX, 0, 46, 32, 64)104break105end switch106end sub107108109sub ObjectDraw110DrawSprite(Object.Frame)111end sub112113114sub ObjectStartup115LoadSpriteSheet("R4/Objects3.gif")116117if HUD.CurrentTimePeriod < 3 // Present Past or Good Future118SpriteFrame(-4, -46, 8, 92, 134, 46) // #0 - Pole119SpriteFrame(-4, -46, 16, 92, 117, 46) // #1 - Broken Pole120else121SpriteFrame(-4, -46, 8, 92, 51, 163) // #0 - Pole122SpriteFrame(-4, -46, 16, 92, 34, 163) // #1 - Broken Pole123end if124end sub125126127// ========================128// Editor Subs129// ========================130131sub RSDKDraw132DrawSprite(0)133end sub134135136sub RSDKLoad137LoadSpriteSheet("R4/Objects3.gif")138139CallFunction(EditorHelpers_FindTimePeriod)140if CheckResult < 3 // Present Past or Good Future141SpriteFrame(-4, -46, 8, 92, 134, 46) // #0 - Pole142SpriteFrame(-4, -46, 16, 92, 117, 46) // #1 - Broken Pole143else144SpriteFrame(-4, -46, 8, 92, 51, 163) // #0 - Pole145SpriteFrame(-4, -46, 16, 92, 34, 163) // #1 - Broken Pole146end if147148SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")149end sub150151152