Path: blob/main/Scripts/R4/LBlocks.txt
1319 views
//------------------Sonic CD L Blocks 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.Rotation78// States9#alias 0 : LBLOCKS_INACTIVE10#alias 1 : LBLOCKS_STEP_LEFT11#alias 2 : LBLOCKS_STEP_RIGHT12#alias 3 : LBLOCKS_ROTATE_LEFT13#alias 4 : LBLOCKS_ROTATE_RIGHT1415// Player Collision16#alias 1 : PLAYER_COL_FLOOR1718// Stage SFX19#alias 8 : SFX_S_SWITCH202122sub ObjectMain23switch Object.State24case LBLOCKS_STEP_LEFT25if Object.Timer < 1426Object.Timer++27else28Object.Timer = 029Object.State = LBLOCKS_ROTATE_LEFT30PlayStageSfx(SFX_S_SWITCH, false)31end if32break3334case LBLOCKS_STEP_RIGHT35if Object.Timer < 1436Object.Timer++37else38Object.Timer = 039Object.State = LBLOCKS_ROTATE_RIGHT40PlayStageSfx(SFX_S_SWITCH, false)41end if42break4344case LBLOCKS_ROTATE_LEFT45if Object.Timer < 846Object.Timer++47Object.Rotation++48else49Object.Timer = 050Object.State = LBLOCKS_INACTIVE51PlayStageSfx(SFX_S_SWITCH, false)52end if53break5455case LBLOCKS_ROTATE_RIGHT56if Object.Timer < 857Object.Timer++58Object.Rotation--59else60Object.Timer = 061Object.State = LBLOCKS_INACTIVE62PlayStageSfx(SFX_S_SWITCH, false)63end if64break65end switch66end sub676869sub ObjectPlayerInteraction70PlayerObjectCollision(C_BOX, -16, -16, 16, 16)7172if Object.State == LBLOCKS_INACTIVE73TempValue1 = CheckResult74else75TempValue1 = 176end if7778if Object.State < LBLOCKS_ROTATE_LEFT79TempValue0 = Object.Rotation80TempValue0 >>= 381switch TempValue082case 083PlayerObjectCollision(C_BOX, -16, -48, 16, -16)84PlayerObjectCollision(C_BOX, -48, -16, -16, 16)85if CheckResult == PLAYER_COL_FLOOR86if TempValue1 == 087Object.State = LBLOCKS_STEP_LEFT88end if89end if90break9192case 193PlayerObjectCollision(C_BOX, -16, 16, 16, 48)94PlayerObjectCollision(C_BOX, -48, -16, -16, 16)95if CheckResult == PLAYER_COL_FLOOR96if TempValue1 == 097Object.State = LBLOCKS_STEP_LEFT98end if99end if100break101102case 2103PlayerObjectCollision(C_BOX, -16, 16, 16, 48)104PlayerObjectCollision(C_BOX, 16, -16, 48, 16)105if CheckResult == PLAYER_COL_FLOOR106if TempValue1 == 0107Object.State = LBLOCKS_STEP_RIGHT108end if109end if110break111112case 3113PlayerObjectCollision(C_BOX, -16, -48, 16, -16)114PlayerObjectCollision(C_BOX, 16, -16, 48, 16)115if CheckResult == PLAYER_COL_FLOOR116if TempValue1 == 0117Object.State = LBLOCKS_STEP_RIGHT118end if119end if120break121122end switch123end if124end sub125126127sub ObjectDraw128TempValue0 = Object.Rotation129if Object.State == LBLOCKS_ROTATE_RIGHT130TempValue0 += 3131end if132133TempValue0 >>= 2134TempValue0 *= 3135136TempValue0++137DrawSprite(TempValue0)138139TempValue0++140DrawSprite(TempValue0)141142TempValue0++143DrawSprite(TempValue0)144145DrawSprite(0)146end sub147148149sub ObjectStartup150LoadSpriteSheet("R4/Objects3.gif")151152SpriteFrame(-8, -8, 16, 16, 67, 46) // #0 - LBlock Center153// Rotation Set 1154SpriteFrame(-16, -16, 32, 32, 34, 34) // #1 - LBlock 1155SpriteFrame(-48, -16, 32, 32, 1, 34) // #2 - LBlock 2156SpriteFrame(-16, -48, 32, 32, 34, 1) // #3 - LBlock 3157SpriteFrame(-22, -22, 44, 44, 157, 1) // #4 - LBlock Diagonal 1158SpriteFrame(-44, -44, 44, 44, 112, 1) // #5 - LBlock Diagonal 2159SpriteFrame(-44, 0, 44, 44, 202, 1) // #6 - LBlock Diagonal 3160// Rotation Set 2161SpriteFrame(-16, -16, 32, 32, 34, 1) // #7 - LBlock 1162SpriteFrame(-48, -16, 32, 32, 1, 1) // #8 - LBlock 2163SpriteFrame(-16, 16, 32, 32, 34, 34) // #9 - LBlock 3164SpriteFrame(-22, -22, 44, 44, 112, 1) // #10 - LBlock Diagonal 1165SpriteFrame(-44, 0, 44, 44, 67, 1) // #11 - LBlock Diagonal 2166SpriteFrame(0, 0, 44, 44, 157, 1) // #12 - LBlock Diagonal 3167// Rotation Set 3168SpriteFrame(-16, -16, 32, 32, 1, 1) // #13 - LBlock 1169SpriteFrame(-16, 16, 32, 32, 1, 34) // #14 - LBlock 2170SpriteFrame(16, -16, 32, 32, 34, 1) // #15 - LBlock 3171SpriteFrame(-22, -22, 44, 44, 67, 1) // #16 - LBlock Diagonal 1172SpriteFrame(0, -44, 44, 44, 112, 1) // #17 - LBlock Diagonal 2173SpriteFrame(0, 0, 44, 44, 202, 1) // #18 - LBlock Diagonal 3174// Rotation Set 4175SpriteFrame(-16, -16, 32, 32, 1, 34) // #19 - LBlock 1176SpriteFrame(-16, -48, 32, 32, 1, 1) // #20 - LBlock 2177SpriteFrame(16, -16, 32, 32, 34, 34) // #21 - LBlock 3178SpriteFrame(-22, -22, 44, 44, 202, 1) // #22 - LBlock Diagonal 1179SpriteFrame(-44, -44, 44, 44, 67, 1) // #23 - LBlock Diagonal 2180SpriteFrame(0, -44, 44, 44, 157, 1) // #24 - LBlock Diagonal 3181182ArrayPos0 = 32183while ArrayPos0 < 1056184if Object[ArrayPos0].Type == TypeName[L Blocks]185Object[ArrayPos0].Rotation = Object[ArrayPos0].PropertyValue186Object[ArrayPos0].Rotation <<= 3187end if188ArrayPos0++189loop190end sub191192193// ========================194// Editor Subs195// ========================196197sub RSDKDraw198TempValue0 = Object.PropertyValue199TempValue0 <<= 3200201TempValue0 >>= 2202TempValue0 *= 3203204TempValue0++205DrawSprite(TempValue0)206207TempValue0++208DrawSprite(TempValue0)209210TempValue0++211DrawSprite(TempValue0)212213DrawSprite(0)214end sub215216217sub RSDKLoad218LoadSpriteSheet("R4/Objects3.gif")219220SpriteFrame(-8, -8, 16, 16, 67, 46) // #0 - LBlock Center221// Rotation Set 1222SpriteFrame(-16, -16, 32, 32, 34, 34) // #1 - LBlock 1223SpriteFrame(-48, -16, 32, 32, 1, 34) // #2 - LBlock 2224SpriteFrame(-16, -48, 32, 32, 34, 1) // #3 - LBlock 3225SpriteFrame(-22, -22, 44, 44, 157, 1) // #4 - LBlock Diagonal 1226SpriteFrame(-44, -44, 44, 44, 112, 1) // #5 - LBlock Diagonal 2227SpriteFrame(-44, 0, 44, 44, 202, 1) // #6 - LBlock Diagonal 3228// Rotation Set 2229SpriteFrame(-16, -16, 32, 32, 34, 1) // #7 - LBlock 1230SpriteFrame(-48, -16, 32, 32, 1, 1) // #8 - LBlock 2231SpriteFrame(-16, 16, 32, 32, 34, 34) // #9 - LBlock 3232SpriteFrame(-22, -22, 44, 44, 112, 1) // #10 - LBlock Diagonal 1233SpriteFrame(-44, 0, 44, 44, 67, 1) // #11 - LBlock Diagonal 2234SpriteFrame(0, 0, 44, 44, 157, 1) // #12 - LBlock Diagonal 3235// Rotation Set 3236SpriteFrame(-16, -16, 32, 32, 1, 1) // #13 - LBlock 1237SpriteFrame(-16, 16, 32, 32, 1, 34) // #14 - LBlock 2238SpriteFrame(16, -16, 32, 32, 34, 1) // #15 - LBlock 3239SpriteFrame(-22, -22, 44, 44, 67, 1) // #16 - LBlock Diagonal 1240SpriteFrame(0, -44, 44, 44, 112, 1) // #17 - LBlock Diagonal 2241SpriteFrame(0, 0, 44, 44, 202, 1) // #18 - LBlock Diagonal 3242// Rotation Set 4243SpriteFrame(-16, -16, 32, 32, 1, 34) // #19 - LBlock 1244SpriteFrame(-16, -48, 32, 32, 1, 1) // #20 - LBlock 2245SpriteFrame(16, -16, 32, 32, 34, 34) // #21 - LBlock 3246SpriteFrame(-22, -22, 44, 44, 202, 1) // #22 - LBlock Diagonal 1247SpriteFrame(-44, -44, 44, 44, 67, 1) // #23 - LBlock Diagonal 2248SpriteFrame(0, -44, 44, 44, 157, 1) // #24 - LBlock Diagonal 3249250AddEditorVariable("block set")251SetActiveVariable("block set")252AddEnumVariable("Set 1", 0)253AddEnumVariable("Set 2", 1)254AddEnumVariable("Set 3", 2)255AddEnumVariable("Set 4", 3)256end sub257258259