Path: blob/main/Scripts/R8/InvisiblePlatform.txt
1319 views
//------------Sonic CD Invisible Platform Script--------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.FirstPlatTimer6#alias Object.Value1 : Object.FirstPlatMaxTimer78#alias Object.Value2 : Object.SecondPlatTimer9#alias Object.Value3 : Object.SecondPlatMaxTimer10#alias Object.Value4 : Object.SecondPlatFrame1112#alias Object.Value5 : Object.ThirdPlatTimer13#alias Object.Value6 : Object.ThirdPlatMaxTimer14#alias Object.Value7 : Object.ThirdPlatFrame1516// Property Values17#alias 0 : ONE_BLOCK18#alias 1 : TWO_BLOCKS // Seems unused in the game19#alias 2 : THREE_BLOCK_STAIR2021// Function declarations22#function InvPlatform_SetMaxTimer2324function InvPlatform_SetMaxTimer25switch TempValue026case 027TempValue1 = 6028break29case 130case 331case 532case 733case 934case 1135case 1436case 1637case 1838case 2039case 2240case 2441TempValue1 = 542break43case 244case 445case 646case 847case 1048case 1249case 1550case 1751case 1952case 2153case 2354case 2555TempValue1 = 356break57case 1358TempValue1 = 16059break60end switch61end function626364sub ObjectMain65if Object.FirstPlatTimer < Object.FirstPlatMaxTimer66Object.FirstPlatTimer++67else68Object.FirstPlatTimer = 069Object.Frame++70Object.Frame %= 2671TempValue0 = Object.Frame72CallFunction(InvPlatform_SetMaxTimer)73Object.FirstPlatMaxTimer = TempValue174end if7576if Object.PropertyValue == THREE_BLOCK_STAIR77if Object.SecondPlatTimer < Object.SecondPlatMaxTimer78Object.SecondPlatTimer++79else80Object.SecondPlatTimer = 081Object.SecondPlatFrame++82Object.SecondPlatFrame %= 2683TempValue0 = Object.SecondPlatFrame84CallFunction(InvPlatform_SetMaxTimer)85Object.SecondPlatMaxTimer = TempValue186end if8788if Object.ThirdPlatTimer < Object.ThirdPlatMaxTimer89Object.ThirdPlatTimer++90else91Object.ThirdPlatTimer = 092Object.ThirdPlatFrame++93Object.ThirdPlatFrame %= 2694TempValue0 = Object.ThirdPlatFrame95CallFunction(InvPlatform_SetMaxTimer)96Object.ThirdPlatMaxTimer = TempValue197end if98end if99end sub100101102sub ObjectPlayerInteraction103switch Object.PropertyValue104case ONE_BLOCK105if Object.Frame == 13106PlayerObjectCollision(C_PLATFORM, -16, -16, 16, 0)107end if108break109case TWO_BLOCKS110if Object.Frame == 13111PlayerObjectCollision(C_PLATFORM, -16, -16, 48, 0)112end if113break114case THREE_BLOCK_STAIR115if Object.Frame == 13116PlayerObjectCollision(C_PLATFORM, -16, -16, 16, 0)117end if118if Object.SecondPlatFrame == 13119PlayerObjectCollision(C_PLATFORM, 16, 0, 48, 16)120end if121if Object.ThirdPlatFrame == 13122PlayerObjectCollision(C_PLATFORM, 48, 16, 80, 32)123end if124break125end switch126end sub127128129sub ObjectDraw130switch Object.PropertyValue131case ONE_BLOCK132DrawSprite(Object.Frame)133break134case TWO_BLOCKS135TempValue0 = Object.XPos136DrawSpriteXY(Object.Frame, TempValue0, Object.YPos)137TempValue0 += 0x200000138DrawSpriteXY(Object.Frame, TempValue0, Object.YPos)139break140case THREE_BLOCK_STAIR141TempValue0 = Object.XPos142TempValue1 = Object.YPos143DrawSpriteXY(Object.Frame, TempValue0, TempValue1)144TempValue0 += 0x200000145TempValue1 += 0x100000146DrawSpriteXY(Object.SecondPlatFrame, TempValue0, TempValue1)147TempValue0 += 0x200000148TempValue1 += 0x100000149DrawSpriteXY(Object.ThirdPlatFrame, TempValue0, TempValue1)150break151end switch152end sub153154155sub ObjectStartup156LoadSpriteSheet("R8/Objects2.gif")157158SpriteFrame(-4, -16, 0, 0, 190, 223) // #0 - Blank159160// 1/3 width161SpriteFrame(-4, -16, 8, 32, 190, 223) // #1 - Vanishing Platform162SpriteFrame(-4, -16, 8, 32, 223, 223) // #2 - Solid Platform163SpriteFrame(-4, -16, 8, 32, 190, 223) // #3 - Vanishing Platform164SpriteFrame(-4, -16, 8, 32, 223, 223) // #4 - Solid Platform165166// 2/3 width167SpriteFrame(-8, -16, 16, 32, 190, 223) // #5 - Vanishing Platform168SpriteFrame(-8, -16, 16, 32, 223, 223) // #6 - Solid Platform169SpriteFrame(-8, -16, 16, 32, 190, 223) // #7 - Vanishing Platform170SpriteFrame(-8, -16, 16, 32, 223, 223) // #8 - Solid Platform171172// Full width173SpriteFrame(-16, -16, 32, 32, 190, 223) // #9 - Vanishing Platform174SpriteFrame(-16, -16, 32, 32, 223, 223) // #10 - Solid Platform175SpriteFrame(-16, -16, 32, 32, 190, 223) // #11 - Vanishing Platform176SpriteFrame(-16, -16, 32, 32, 223, 223) // #12 - Solid Platform177SpriteFrame(-16, -16, 32, 32, 223, 223) // #13 - Solid Platform178SpriteFrame(-16, -16, 32, 32, 190, 223) // #14 - Vanishing Platform179SpriteFrame(-16, -16, 32, 32, 223, 223) // #15 - Solid Platform180SpriteFrame(-16, -16, 32, 32, 190, 223) // #16 - Vanishing Platform181SpriteFrame(-16, -16, 32, 32, 223, 223) // #17 - Solid Platform182183// 2/3 width184SpriteFrame(-8, -16, 16, 32, 190, 223) // #18 - Vanishing Platform185SpriteFrame(-8, -16, 16, 32, 223, 223) // #19 - Solid Platform186SpriteFrame(-8, -16, 16, 32, 190, 223) // #20 - Vanishing Platform187SpriteFrame(-8, -16, 16, 32, 223, 223) // #21 - Solid Platform188189// 1/3 width190SpriteFrame(-4, -16, 8, 32, 190, 223) // #22 - Vanishing Platform191SpriteFrame(-4, -16, 8, 32, 223, 223) // #23 - Solid Platform192SpriteFrame(-4, -16, 8, 32, 190, 223) // #24 - Vanishing Platform193SpriteFrame(-4, -16, 8, 32, 223, 223) // #25 - Solid Platform194195ArrayPos0 = 32196while ArrayPos0 < 1056197if Object[ArrayPos0].Type == TypeName[Inv Platform]198switch Object[ArrayPos0].PropertyValue199case ONE_BLOCK200case TWO_BLOCKS201Object[ArrayPos0].FirstPlatMaxTimer = 60202break203case THREE_BLOCK_STAIR204Object[ArrayPos0].FirstPlatMaxTimer = 60205Object[ArrayPos0].SecondPlatMaxTimer = 108206Object[ArrayPos0].ThirdPlatMaxTimer = 156207break208end switch209end if210ArrayPos0++211loop212end sub213214215// ========================216// Editor Subs217// ========================218219sub RSDKEdit220if Editor.ReturnVariable == true221switch Editor.VariableID222case EDIT_VAR_PROPVAL // Property Value223CheckResult = Object.PropertyValue224CheckResult %= 3225break226case 0 // type227CheckResult = Object.PropertyValue228CheckResult %= 3229break230end switch231else232switch Editor.VariableID233case EDIT_VAR_PROPVAL // Property Value234Object.PropertyValue = Editor.VariableValue235Object.PropertyValue %= 3236break237case 0 // type238Object.PropertyValue = Editor.VariableValue239Object.PropertyValue %= 3240break241end switch242end if243end sub244245sub RSDKDraw246switch Object.PropertyValue247case ONE_BLOCK248DrawSprite(9)249break250case TWO_BLOCKS251TempValue0 = Object.XPos252DrawSpriteXY(9, TempValue0, Object.YPos)253TempValue0 += 0x200000254DrawSpriteXY(9, TempValue0, Object.YPos)255break256case THREE_BLOCK_STAIR257TempValue0 = Object.XPos258TempValue1 = Object.YPos259DrawSpriteXY(9, TempValue0, TempValue1)260TempValue0 += 0x200000261TempValue1 += 0x100000262DrawSpriteXY(9, TempValue0, TempValue1)263TempValue0 += 0x200000264TempValue1 += 0x100000265DrawSpriteXY(9, TempValue0, TempValue1)266break267end switch268end sub269270271sub RSDKLoad272LoadSpriteSheet("R8/Objects2.gif")273274SpriteFrame(-4, -16, 0, 0, 190, 223) // #0 - Blank275276// 1/3 width277SpriteFrame(-4, -16, 8, 32, 190, 223) // #1 - Vanishing Platform278SpriteFrame(-4, -16, 8, 32, 223, 223) // #2 - Solid Platform279SpriteFrame(-4, -16, 8, 32, 190, 223) // #3 - Vanishing Platform280SpriteFrame(-4, -16, 8, 32, 223, 223) // #4 - Solid Platform281282// 2/3 width283SpriteFrame(-8, -16, 16, 32, 190, 223) // #5 - Vanishing Platform284SpriteFrame(-8, -16, 16, 32, 223, 223) // #6 - Solid Platform285SpriteFrame(-8, -16, 16, 32, 190, 223) // #7 - Vanishing Platform286SpriteFrame(-8, -16, 16, 32, 223, 223) // #8 - Solid Platform287288// Full width289SpriteFrame(-16, -16, 32, 32, 190, 223) // #9 - Vanishing Platform290SpriteFrame(-16, -16, 32, 32, 223, 223) // #10 - Solid Platform291SpriteFrame(-16, -16, 32, 32, 190, 223) // #11 - Vanishing Platform292SpriteFrame(-16, -16, 32, 32, 223, 223) // #12 - Solid Platform293SpriteFrame(-16, -16, 32, 32, 223, 223) // #13 - Solid Platform294SpriteFrame(-16, -16, 32, 32, 190, 223) // #14 - Vanishing Platform295SpriteFrame(-16, -16, 32, 32, 223, 223) // #15 - Solid Platform296SpriteFrame(-16, -16, 32, 32, 190, 223) // #16 - Vanishing Platform297SpriteFrame(-16, -16, 32, 32, 223, 223) // #17 - Solid Platform298299// 2/3 width300SpriteFrame(-8, -16, 16, 32, 190, 223) // #18 - Vanishing Platform301SpriteFrame(-8, -16, 16, 32, 223, 223) // #19 - Solid Platform302SpriteFrame(-8, -16, 16, 32, 190, 223) // #20 - Vanishing Platform303SpriteFrame(-8, -16, 16, 32, 223, 223) // #21 - Solid Platform304305// 1/3 width306SpriteFrame(-4, -16, 8, 32, 190, 223) // #22 - Vanishing Platform307SpriteFrame(-4, -16, 8, 32, 223, 223) // #23 - Solid Platform308SpriteFrame(-4, -16, 8, 32, 190, 223) // #24 - Vanishing Platform309SpriteFrame(-4, -16, 8, 32, 223, 223) // #25 - Solid Platform310311AddEditorVariable("type")312SetActiveVariable("type")313AddEnumVariable("1 Block", ONE_BLOCK)314AddEnumVariable("2 Blocks", TWO_BLOCKS)315AddEnumVariable("3-Block Stair", THREE_BLOCK_STAIR)316end sub317318319