Path: blob/main/Scripts/R8/Seesaw.txt
1319 views
//------------------Sonic CD Seesaw Script--------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer6#alias Object.Value1 : Object.YVelocity7#alias Object.Value2 : Object.YCollisionOffset8#alias Object.Value3 : Object.SpikeBallYPos9#alias Object.Value4 : Object.SpikeBallFrame10#alias Object.Value5 : Object.SeesawFrame11#alias Object.Value6 : Object.OnObject1213// States14#alias 0 : SEESAW_IDLE15#alias 1 : SEESAW_SWING_DOWN16#alias 2 : SEESAW_SWING_UP17#alias 3 : SEESAW_SPIKEBALL_LAND1819// Priority20#alias 0 : PRIORITY_BOUNDS21#alias 1 : PRIORITY_ACTIVE222324sub ObjectMain25switch Object.State26case SEESAW_SWING_DOWN27switch Object.SeesawFrame28case 029if Object.Timer < 230Object.Timer++31else32Object.Timer = 033Object.SeesawFrame++34Object.YCollisionOffset = 0x10000035end if36break37case 138if Object.Timer < 639Object.Timer++40Object.Frame = 141else42Object.Timer = 043Object.SeesawFrame++44Object.YCollisionOffset = 0x10000045end if46break47case 248if Object.Timer < 649Object.Timer++50Object.Frame = 251else52Object.Timer = 053Object.SeesawFrame++54Object.YCollisionOffset = 0x18000055end if56break57case 358if Object.Timer < 659Object.Timer++60Object.Frame = 361else62Object.Timer = 063Object.SeesawFrame++64Object.YCollisionOffset = 0x10000065end if66break67case 468if Object.Timer < 1169Object.Timer++70Object.Frame = 471else72Object.Timer = 073Object.SeesawFrame++74end if75break76case 577if Object.OnObject == false78Object.State = SEESAW_SWING_UP79Object.SeesawFrame = 080end if81break82end switch8384Object.SpikeBallYPos += Object.YVelocity85Object.YVelocity += 0x40008687TempValue0 = Object.YPos88TempValue0 += 0x4000089if Object.SpikeBallYPos > TempValue090Object.SpikeBallYPos = TempValue091Object.Frame = 492Object.State = SEESAW_SPIKEBALL_LAND93end if9495if Object.YVelocity > 096Object.SpikeBallFrame = 1297else98if Object.YVelocity > -0x9000099Object.SpikeBallFrame = 11100end if101end if102break103104case SEESAW_SWING_UP105switch Object.SeesawFrame106case 0107if Object.Timer < 11108Object.Frame = 3109Object.Timer++110else111Object.Timer = 0112Object.SeesawFrame++113end if114break115case 1116if Object.Timer < 11117Object.Frame = 2118Object.Timer++119else120Object.Timer = 0121Object.SeesawFrame++122end if123break124case 2125if Object.Timer < 11126Object.Frame = 1127Object.Timer++128else129Object.Timer = 0130Object.SeesawFrame++131end if132break133case 3134if Object.Timer < 11135Object.Frame = 2136Object.Timer++137else138Object.Timer = 0139Object.SeesawFrame = 0140end if141break142end switch143144Object.SpikeBallYPos += Object.YVelocity145Object.YVelocity += 0x4000146TempValue0 = Object.YPos147TempValue0 += 0x40000148if Object.SpikeBallYPos > TempValue0149Object.SpikeBallYPos = TempValue0150Object.Frame = 4151Object.State = SEESAW_SPIKEBALL_LAND152end if153154if Object.YVelocity > 0155Object.SpikeBallFrame = 12156else157if Object.YVelocity > -0x90000158Object.SpikeBallFrame = 11159end if160end if161if Object.OnObject == true162Object.State = SEESAW_SWING_DOWN163Object.Timer = 0164Object.SeesawFrame = Object.Frame165end if166break167end switch168169Object.OnObject = false170if Object.OutOfBounds == true171Object.State = SEESAW_IDLE172Object.SpikeBallYPos = Object.YPos173Object.SpikeBallFrame = 10174Object.Frame = 0175Object.Timer = 0176Object.SeesawFrame = 0177Object.YCollisionOffset = 0178Object.Priority = PRIORITY_BOUNDS179end if180end sub181182183sub ObjectPlayerInteraction184if Object.State == SEESAW_IDLE185PlayerObjectCollision(C_PLATFORM, -40, -56, 40, -36)186if CheckResult == true187Object.State = SEESAW_SWING_DOWN188Object.Priority = PRIORITY_ACTIVE189Object.YVelocity = -0xC0000190end if191else192switch Object.Frame193case 0194PlayerObjectCollision(C_PLATFORM, -40, -56, 40, -36)195break196case 1197PlayerObjectCollision(C_PLATFORM, -40, -40, 40, -20)198break199case 2200PlayerObjectCollision(C_PLATFORM, -40, -24, 40, -4)201break202case 3203PlayerObjectCollision(C_PLATFORM, -40, 0, 40, 20)204break205case 4206PlayerObjectCollision(C_PLATFORM, -40, 16, 40, 36)207break208end switch209if Object.State < SEESAW_SPIKEBALL_LAND210if CheckResult == true211Object.OnObject = true212if Object.YCollisionOffset > 0213Player.YPos += Object.YCollisionOffset214Object.YCollisionOffset = 0215Object.Frame++216end if217end if218end if219if Object.SpikeBallFrame > 11220TempValue0 = Object.YPos221Object.YPos = Object.SpikeBallYPos222PlayerObjectCollision(C_TOUCH, -24, -24, 24, 24)223if CheckResult == true224CallFunction(Player_Hit)225end if226Object.YPos = TempValue0227end if228end if229end sub230231232sub ObjectDraw233if Object.DrawOrder == 3234if Object.SpikeBallFrame < 11235DrawSpriteXY(Object.SpikeBallFrame, Object.XPos, Object.SpikeBallYPos)236DrawSprite(Object.Frame)237DrawSpriteFX(Object.Frame, FX_FLIP, Object.XPos, Object.YPos)238else239DrawSprite(Object.Frame)240DrawSpriteFX(Object.Frame, FX_FLIP, Object.XPos, Object.YPos)241DrawSpriteXY(Object.SpikeBallFrame, Object.XPos, Object.SpikeBallYPos)242end if243SetDrawListEntityRef(Object.EntityNo, 4, Screen[4].DrawListSize)244Screen[4].DrawListSize++245Object.DrawOrder = 4246else247TempValue0 = Object.Frame248TempValue0 += 5249DrawSprite(TempValue0)250Object.DrawOrder = 3251end if252end sub253254255sub ObjectStartup256LoadSpriteSheet("R8/Objects.gif")257258SpriteFrame(-40, -56, 40, 112, 66, 1) // #0 - SeeSaw259SpriteFrame(-40, -40, 40, 96, 107, 1) // #1 - SeeSaw BG move frame 0260SpriteFrame(-24, -24, 24, 80, 123, 17) // #2 - SeeSaw BG move frame 1261SpriteFrame(-40, -32, 40, 88, 148, 1) // #3 - SeeSaw BG move frame 2262SpriteFrame(-40, -40, 40, 96, 189, 1) // #4 - SeeSaw BG move frame 3263264SpriteFrame(-40, -56, 80, 24, 175, 98) // #5 - SeeSaw front platform Top265SpriteFrame(-40, -40, 80, 24, 175, 98) // #6 - SeeSaw front platform Middle Top266SpriteFrame(-40, -24, 80, 24, 175, 98) // #7 - SeeSaw front platform Middle267SpriteFrame(-40, 0, 80, 24, 175, 98) // #8 - SeeSaw front platform Middle Bottom268SpriteFrame(-40, 16, 80, 24, 175, 98) // #9 - SeeSaw front platform Bottom269270SpriteFrame(-16, -16, 32, 32, 1, 213) // #10 - SpikeBall BG271SpriteFrame(-24, -24, 48, 48, 1, 164) // #11 - SpikeBall halfway272SpriteFrame(-28, -32, 56, 64, 1, 99) // #12 - SpikeBall FG273274ArrayPos0 = 32275while ArrayPos0 < 1056276if Object[ArrayPos0].Type == TypeName[Seesaw]277Object[ArrayPos0].Direction = FACING_LEFT278Object[ArrayPos0].SpikeBallYPos = Object[ArrayPos0].YPos279Object[ArrayPos0].SpikeBallFrame = 10280end if281ArrayPos0++282loop283end sub284285286// ========================287// Editor Subs288// ========================289290sub RSDKDraw291Object.Direction = FACING_LEFT292DrawSpriteXY(2, Object.XPos, Object.YPos)293DrawSprite(0)294DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)295DrawSprite(1)296end sub297298299sub RSDKLoad300LoadSpriteSheet("R8/Objects.gif")301302SpriteFrame(-40, -56, 40, 112, 66, 1) // #0 - SeeSaw303SpriteFrame(-40, -56, 80, 24, 175, 98) // #1 - SeeSaw front platform Top304SpriteFrame(-16, -16, 32, 32, 1, 213) // #2 - SpikeBall BG305306SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")307end sub308309310