Path: blob/main/Scripts/R3/FlatBumper.txt
1319 views
//-----------------Sonic CD Flat Bumper Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer67// HUD Alias8#alias Object[24].PropertyValue : HUD.CurrentTimePeriod910// States11#alias 0 : FLATBUMPER_MOVE_R_OR_U12#alias 1 : FLATBUMPER_MOVE_L_OR_D1314// Time Periods15#alias 0 : TIME_PRESENT16#alias 1 : TIME_PAST17#alias 2 : TIME_GOOD_FUTURE18#alias 3 : TIME_BAD_FUTURE1920// Gravity21#alias 1 : GRAVITY_AIR2223// Collision24#alias 1 : PLAYER_COL_FLOOR25#alias 4 : PLAYER_COL_ROOF2627// Stage SFX28#alias 1 : SFX_S_BUMPER22930// Property Values31#alias 0 : MOVE_HORIZONTALLY32#alias 1 : MOVE_VERTICALLY333435sub ObjectMain36switch Object.State37case FLATBUMPER_MOVE_R_OR_U38if Object.Timer < 9639Object.Timer++40if Object.PropertyValue == MOVE_HORIZONTALLY41Object.XPos += 0x1000042else43Object.YPos += 0x1000044end if45else46Object.State = FLATBUMPER_MOVE_L_OR_D47end if4849break5051case FLATBUMPER_MOVE_L_OR_D52if Object.Timer > -9653Object.Timer--54if Object.PropertyValue == MOVE_HORIZONTALLY55Object.XPos -= 0x1000056else57Object.YPos -= 0x1000058end if59else60Object.State = FLATBUMPER_MOVE_R_OR_U61end if6263break6465end switch66end sub676869sub ObjectPlayerInteraction70TempValue0 = false71PlayerObjectCollision(C_TOUCH, -34, -16, -28, 16) // Left72TempValue1 = CheckResult73PlayerObjectCollision(C_TOUCH, 28, -16, 34, 16) // Right74TempValue2 = CheckResult75PlayerObjectCollision(C_BOX, -32, -14, 32, 14) // Check if you touched the bumper76switch CheckResult77case PLAYER_COL_FLOOR78if Player.State == Player_State_Fly79Player.YVelocity = -0x4000080else81Player.YVelocity = -0x7000082Player.Timer = 083end if84Player.Gravity = GRAVITY_AIR85TempValue0 = true86break8788case PLAYER_COL_ROOF89if Player.State == Player_State_Fly90Player.YVelocity = 0x4000091else92Player.YVelocity = 0x7000093Player.Timer = 094end if95Player.Timer = 096Player.Gravity = GRAVITY_AIR97TempValue0 = true98break99100end switch101102if TempValue1 == true // Check if you collided with the left side of the bumper103Player.Speed = -0x70000104Player.XVelocity = -0x70000105TempValue0 = true106end if107108if TempValue2 == true // Check if you collided with the right side of the bumper109Player.Speed = 0x70000110Player.XVelocity = 0x70000111TempValue0 = true112end if113114PlayerObjectCollision(C_TOUCH, -16, -14, 16, 0) // Check if you collided with the center from the top115if CheckResult == true116if Player.State == Player_State_Fly117Player.YVelocity = -0x40000118else119Player.YVelocity = -0x70000120Player.Timer = 0121end if122Player.Gravity = GRAVITY_AIR123TempValue0 = true124end if125126PlayerObjectCollision(C_TOUCH, -16, 0, 16, 14) // Check if you collided with the center from the bottom127if CheckResult == true128if Player.State == Player_State_Fly129Player.YVelocity = 0x40000130else131Player.YVelocity = 0x70000132Player.Timer = 0133end if134Player.Gravity = GRAVITY_AIR135TempValue0 = true136end if137138if TempValue0 == true139PlayStageSfx(SFX_S_BUMPER2, false)140141#platform: Use_Haptics142HapticEffect(10, 0, 0, 0)143#endplatform144145end if146end sub147148149sub ObjectDraw150DrawSprite(0)151end sub152153154sub ObjectStartup155switch HUD.CurrentTimePeriod156case TIME_PRESENT157case TIME_PAST158LoadSpriteSheet("R3/Objects.gif")159160SpriteFrame(-32, -16, 64, 32, 1, 75)161break162163case TIME_GOOD_FUTURE164LoadSpriteSheet("R3/Objects3.gif")165166SpriteFrame(-32, -16, 64, 32, 132, 67)167break168169case TIME_BAD_FUTURE170LoadSpriteSheet("R3/Objects3.gif")171172SpriteFrame(-32, -16, 64, 32, 132, 100)173break174end switch175end sub176177178// ========================179// Editor Subs180// ========================181182sub RSDKEdit183if Editor.ReturnVariable == true184switch Editor.VariableID185case EDIT_VAR_PROPVAL // Property Value186case 0 // Type187CheckResult = Object.PropertyValue188CheckResult &= 1189break190end switch191else192switch Editor.VariableID193case EDIT_VAR_PROPVAL // Property Value194case 0 // Type195Object.PropertyValue = Editor.VariableValue196Object.PropertyValue &= 1197break198end switch199end if200end sub201202203sub RSDKDraw204DrawSprite(0)205if object.PropertyValue == MOVE_HORIZONTALLY206TempValue0 = Object.XPos207TempValue0 += 0x600000208209TempValue1 = Object.XPos210TempValue1 -= 0x600000211212TempValue2 = Object.YPos213TempValue2 -= 0x100000214215if Editor.ShowGizmos == true216Editor.DrawingOverlay = true217DrawRectOutline(TempValue1, TempValue2, 0xC0, 32, 255, 255, 0, 255)218DrawArrow(Object.XPos, Object.YPos, TempValue1, Object.YPos, 255, 255, 255, 0)219Editor.DrawingOverlay = false220end if221222DrawArrow(Object.XPos, Object.YPos, TempValue0, Object.YPos, 255, 128, 0, 0)223else224TempValue0 = Object.YPos225TempValue0 += 0x600000226227TempValue1 = Object.YPos228TempValue1 -= 0x600000229230TempValue2 = Object.XPos231TempValue2 -= 0x100000232233if Editor.ShowGizmos == true234Editor.DrawingOverlay = true235DrawRectOutline(TempValue2, TempValue1, 0x32, 0xC0, 255, 255, 0, 255)236DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, 255, 255, 0)237Editor.DrawingOverlay = false238end if239240DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue1, 255, 128, 0, 0)241end if242end sub243244245sub RSDKLoad246CallFunction(EditorHelpers_FindTimePeriod)247switch CheckResult248case TIME_PRESENT249case TIME_PAST250LoadSpriteSheet("R3/Objects.gif")251SpriteFrame(-32, -16, 64, 32, 1, 75)252break253case TIME_GOOD_FUTURE254LoadSpriteSheet("R3/Objects3.gif")255SpriteFrame(-32, -16, 64, 32, 132, 67)256break257case TIME_BAD_FUTURE258LoadSpriteSheet("R3/Objects3.gif")259SpriteFrame(-32, -16, 64, 32, 132, 100)260break261end switch262263AddEditorVariable("Type")264SetActiveVariable("Type")265AddEnumVariable("Horizontal", MOVE_HORIZONTALLY)266AddEnumVariable("Vertical", MOVE_VERTICALLY)267end sub268269270