Path: blob/main/Scripts/R6/MovingBlocks.txt
1319 views
//----------------Sonic CD Moving Blocks Script---------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.BlockXPos_16#alias Object.Value1 : Object.BlockYPos_17#alias Object.Value2 : Object.BlockXPos_28#alias Object.Value3 : Object.BlockYPos_29#alias Object.Value4 : Object.BlockXPos_310#alias Object.Value5 : Object.BlockYPos_311#alias Object.Value6 : Object.BlockXPos_412#alias Object.Value7 : Object.BlockYPos_413#alias Object.Direction : Object.BlockState14#alias Object.Rotation : Object.MovePattern15#alias Object.InkEffect : Object.CrushCheck1617#alias 0 : FORMATION_L_AND_LINES18#alias 1 : FORMATION_TETROMINOS_LEFT19#alias 3 : FORMATION_L_AND_LINES_CCW20#alias 4 : FORMATION_TETROMINOS_RIGHT2122// States23#alias 0 : MOVINGBLOCKS_MOVE24#alias 1 : MOVINGBLOCKS_CHANGE_PATTERN2526// Player Collision27#alias 1 : PLAYER_COL_FLOOR28#alias 2 : PLAYER_COL_LWALL29#alias 3 : PLAYER_COL_RWALL30#alias 4 : PLAYER_COL_ROOF3132#alias 0 : GRAVITY_GROUND3334// Function declarations35#function MovingBlocks_MoveType_136#function MovingBlocks_MoveType_237#function MovingBlocks_MoveType_338#function MovingBlocks_MoveType_439#function MovingBlocks_CrushCheck40#function MovingBlocks_CrushCheckTop414243function MovingBlocks_MoveType_144switch Object.BlockState45case 046Object.BlockYPos_1 -= 0x800047#platform: Use_Origins48TempValue2 = 149TempValue3 = 150#endplatform51if Object.AnimationTimer == 6452Object.BlockYPos_2 = Object.BlockYPos_153end if54break5556case 157Object.BlockYPos_1 -= 0x800058#platform: Use_Origins59TempValue2 = 160TempValue3 = 161#endplatform62if Object.AnimationTimer == 6463Object.BlockYPos_3 = Object.BlockYPos_164end if65break6667case 268Object.BlockYPos_1 -= 0x800069#platform: Use_Origins70TempValue2 = 171TempValue3 = 172#endplatform73if Object.AnimationTimer == 6474Object.BlockYPos_4 = Object.BlockYPos_175Object.BlockYPos_1 = Object.YPos76end if77break7879case 380Object.BlockXPos_1 += 0x800081Object.BlockYPos_4 += 0x800082#platform: Use_Origins83TempValue2 = 184TempValue3 = 385#endplatform86if Object.AnimationTimer == 6487Object.BlockXPos_3 = Object.BlockXPos_188Object.BlockYPos_3 = Object.BlockYPos_189end if90break9192case 493Object.BlockXPos_1 += 0x800094Object.BlockYPos_4 += 0x800095#platform: Use_Origins96TempValue2 = 197TempValue3 = 398#endplatform99if Object.AnimationTimer == 64100Object.BlockXPos_2 = Object.BlockXPos_1101Object.BlockYPos_2 = Object.BlockYPos_1102end if103break104105case 5106Object.BlockXPos_1 += 0x8000107Object.BlockYPos_4 += 0x8000108#platform: Use_Origins109TempValue2 = 1110TempValue3 = 3111#endplatform112if Object.AnimationTimer == 64113Object.BlockXPos_4 = Object.BlockXPos_1114Object.BlockXPos_1 = Object.XPos115end if116break117118case 6119Object.BlockYPos_1 += 0x8000120Object.BlockXPos_4 -= 0x8000121#platform: Use_Origins122TempValue2 = 1123TempValue3 = 4124#endplatform125if Object.AnimationTimer == 64126Object.BlockXPos_2 = Object.BlockXPos_1127Object.BlockYPos_2 = Object.BlockYPos_1128end if129break130131case 7132Object.BlockYPos_1 += 0x8000133Object.BlockXPos_4 -= 0x8000134#platform: Use_Origins135TempValue2 = 1136TempValue3 = 4137#endplatform138if Object.AnimationTimer == 64139Object.BlockXPos_3 = Object.BlockXPos_1140Object.BlockYPos_3 = Object.BlockYPos_1141end if142break143144case 8145Object.BlockYPos_1 += 0x8000146Object.BlockXPos_4 -= 0x8000147#platform: Use_Origins148TempValue2 = 1149TempValue3 = 4150#endplatform151if Object.AnimationTimer == 64152Object.BlockYPos_4 = Object.BlockYPos_1153Object.BlockYPos_1 = Object.YPos154end if155break156157case 9158Object.BlockXPos_1 -= 0x8000159Object.BlockYPos_4 -= 0x8000160#platform: Use_Origins161TempValue2 = 1162TempValue3 = 2163#endplatform164if Object.AnimationTimer == 64165Object.BlockXPos_3 = Object.BlockXPos_1166Object.BlockYPos_3 = Object.BlockYPos_1167end if168break169170case 10171Object.BlockXPos_1 -= 0x8000172Object.BlockYPos_4 -= 0x8000173#platform: Use_Origins174TempValue2 = 1175TempValue3 = 2176#endplatform177if Object.AnimationTimer == 64178Object.BlockXPos_2 = Object.BlockXPos_1179Object.BlockYPos_2 = Object.BlockYPos_1180end if181break182183case 11184Object.BlockXPos_1 -= 0x8000185Object.BlockYPos_4 -= 0x8000186#platform: Use_Origins187TempValue2 = 1188TempValue3 = 2189#endplatform190if Object.AnimationTimer == 64191Object.BlockXPos_4 = Object.BlockXPos_1192Object.BlockYPos_4 = Object.BlockYPos_1193Object.BlockXPos_1 = Object.XPos194end if195break196197case 12198Object.BlockYPos_1 -= 0x8000199Object.BlockXPos_4 += 0x8000200#platform: Use_Origins201TempValue2 = 1202TempValue3 = 1203#endplatform204if Object.AnimationTimer == 64205Object.BlockXPos_2 = Object.BlockXPos_1206Object.BlockYPos_2 = Object.BlockYPos_1207end if208break209210case 13211Object.BlockYPos_1 -= 0x8000212Object.BlockXPos_4 += 0x8000213#platform: Use_Origins214TempValue2 = 1215TempValue3 = 1216#endplatform217if Object.AnimationTimer == 64218Object.BlockXPos_3 = Object.BlockXPos_1219Object.BlockYPos_3 = Object.BlockYPos_1220end if221break222223case 14224Object.BlockYPos_1 -= 0x8000225Object.BlockXPos_4 += 0x8000226#platform: Use_Origins227TempValue2 = 1228TempValue3 = 1229#endplatform230if Object.AnimationTimer == 64231Object.BlockYPos_4 = Object.BlockYPos_1232Object.BlockYPos_1 = Object.YPos233end if234break235end switch236end function237238239function MovingBlocks_MoveType_2240switch Object.Direction241case 0242Object.BlockYPos_1 -= 0x8000243#platform: Use_Origins244TempValue2 = 1245TempValue3 = 1246#endplatform247if Object.AnimationTimer == 64248Object.BlockYPos_2 = Object.BlockYPos_1249end if250break251252case 1253Object.BlockYPos_1 -= 0x8000254#platform: Use_Origins255TempValue2 = 1256TempValue3 = 1257#endplatform258if Object.AnimationTimer == 64259Object.BlockYPos_3 = Object.BlockYPos_1260end if261break262263case 2264Object.BlockYPos_1 -= 0x8000265#platform: Use_Origins266TempValue2 = 1267TempValue3 = 1268#endplatform269if Object.AnimationTimer == 64270Object.BlockYPos_4 = Object.BlockYPos_1271Object.BlockYPos_1 = Object.YPos272end if273break274case 3275Object.BlockXPos_1 -= 0x8000276Object.BlockYPos_4 += 0x8000277#platform: Use_Origins278TempValue2 = 1279TempValue3 = 2280#endplatform281if Object.AnimationTimer == 64282Object.BlockXPos_3 = Object.BlockXPos_1283Object.BlockYPos_3 = Object.BlockYPos_1284end if285break286287case 4288Object.BlockXPos_1 -= 0x8000289Object.BlockYPos_4 += 0x8000290#platform: Use_Origins291TempValue2 = 1292TempValue3 = 2293#endplatform294if Object.AnimationTimer == 64295Object.BlockXPos_2 = Object.BlockXPos_1296Object.BlockYPos_2 = Object.BlockYPos_1297end if298break299300case 5301Object.BlockXPos_1 -= 0x8000302Object.BlockYPos_4 += 0x8000303#platform: Use_Origins304TempValue2 = 1305TempValue3 = 2306#endplatform307if Object.AnimationTimer == 64308Object.BlockXPos_4 = Object.BlockXPos_1309Object.BlockYPos_4 = Object.BlockYPos_1310Object.BlockXPos_1 = Object.XPos311end if312break313314case 6315Object.BlockYPos_1 += 0x8000316Object.BlockXPos_4 += 0x8000317#platform: Use_Origins318TempValue2 = 1319TempValue3 = 4320#endplatform321if Object.AnimationTimer == 64322Object.BlockXPos_2 = Object.BlockXPos_1323Object.BlockYPos_2 = Object.BlockYPos_1324end if325break326327case 7328Object.BlockYPos_1 += 0x8000329Object.BlockXPos_4 += 0x8000330#platform: Use_Origins331TempValue2 = 1332TempValue3 = 4333#endplatform334if Object.AnimationTimer == 64335Object.BlockXPos_3 = Object.BlockXPos_1336Object.BlockYPos_3 = Object.BlockYPos_1337end if338break339340case 8341Object.BlockYPos_1 += 0x8000342Object.BlockXPos_4 += 0x8000343#platform: Use_Origins344TempValue2 = 1345TempValue3 = 4346#endplatform347if Object.AnimationTimer == 64348Object.BlockYPos_4 = Object.BlockYPos_1349Object.BlockYPos_1 = Object.YPos350end if351break352353case 9354Object.BlockXPos_1 += 0x8000355Object.BlockYPos_4 -= 0x8000356#platform: Use_Origins357TempValue2 = 1358TempValue3 = 3359#endplatform360if Object.AnimationTimer == 64361Object.BlockXPos_3 = Object.BlockXPos_1362Object.BlockYPos_3 = Object.BlockYPos_1363end if364break365366case 10367Object.BlockXPos_1 += 0x8000368Object.BlockYPos_4 -= 0x8000369#platform: Use_Origins370TempValue2 = 1371TempValue3 = 3372#endplatform373if Object.AnimationTimer == 64374Object.BlockXPos_2 = Object.BlockXPos_1375Object.BlockYPos_2 = Object.BlockYPos_1376end if377break378379case 11380Object.BlockXPos_1 += 0x8000381Object.BlockYPos_4 -= 0x8000382#platform: Use_Origins383TempValue2 = 1384TempValue3 = 3385#endplatform386if Object.AnimationTimer == 64387Object.BlockXPos_4 = Object.BlockXPos_1388Object.BlockXPos_1 = Object.XPos389end if390break391392case 12393Object.BlockYPos_1 -= 0x8000394Object.BlockXPos_4 -= 0x8000395#platform: Use_Origins396TempValue2 = 1397TempValue3 = 3398#endplatform399if Object.AnimationTimer == 64400Object.BlockXPos_2 = Object.BlockXPos_1401Object.BlockYPos_2 = Object.BlockYPos_1402end if403break404405case 13406Object.BlockYPos_1 -= 0x8000407Object.BlockXPos_4 -= 0x8000408#platform: Use_Origins409TempValue2 = 1410TempValue3 = 1411#endplatform412if Object.AnimationTimer == 64413Object.BlockXPos_3 = Object.BlockXPos_1414Object.BlockYPos_3 = Object.BlockYPos_1415end if416break417418case 14419Object.BlockYPos_1 -= 0x8000420Object.BlockXPos_4 -= 0x8000421#platform: Use_Origins422TempValue2 = 1423TempValue3 = 1424#endplatform425if Object.AnimationTimer == 64426Object.BlockYPos_4 = Object.BlockYPos_1427Object.BlockYPos_1 = Object.YPos428end if429break430end switch431end function432433434function MovingBlocks_MoveType_3435switch Object.Direction436case 0437Object.BlockYPos_1 -= 0x8000438#platform: Use_Origins439TempValue2 = 1440TempValue3 = 1441#endplatform442if Object.AnimationTimer == 64443Object.BlockYPos_2 = Object.BlockYPos_1444end if445break446447case 1448Object.BlockYPos_1 -= 0x8000449#platform: Use_Origins450TempValue2 = 1451TempValue3 = 1452#endplatform453if Object.AnimationTimer == 64454Object.BlockYPos_3 = Object.BlockYPos_1455end if456break457458case 2459Object.BlockXPos_1 += 0x8000460#platform: Use_Origins461TempValue2 = 1462TempValue3 = 3463#endplatform464break465466case 3467Object.BlockXPos_1 -= 0x8000468Object.BlockXPos_4 += 0x8000469#platform: Use_Origins470TempValue2 = 4471TempValue3 = 3472#endplatform473if Object.AnimationTimer == 64474Object.BlockXPos_3 = Object.BlockXPos_4475Object.BlockYPos_3 = Object.BlockYPos_4476end if477break478479case 4480Object.BlockYPos_1 += 0x8000481Object.BlockYPos_4 -= 0x8000482#platform: Use_Origins483TempValue2 = 4484TempValue3 = 1485#endplatform486if Object.AnimationTimer == 64487Object.BlockXPos_2 = Object.BlockXPos_4488Object.BlockYPos_2 = Object.BlockYPos_4489end if490break491492case 5493Object.BlockYPos_1 += 0x8000494Object.BlockXPos_4 += 0x8000495#platform: Use_Origins496TempValue2 = 1497TempValue3 = 4498#endplatform499break500501case 6502Object.BlockYPos_1 += 0x8000503Object.BlockXPos_4 -= 0x8000504#platform: Use_Origins505TempValue2 = 1506TempValue3 = 4507#endplatform508if Object.AnimationTimer == 64509Object.BlockXPos_2 = Object.BlockXPos_1510Object.BlockYPos_2 = Object.BlockYPos_1511end if512break513514case 7515Object.BlockYPos_1 += 0x8000516Object.BlockYPos_4 += 0x8000517#platform: Use_Origins518TempValue2 = 1519TempValue3 = 4520#endplatform521if Object.AnimationTimer == 64522Object.BlockXPos_3 = Object.BlockXPos_1523Object.BlockYPos_3 = Object.BlockYPos_1524end if525break526527case 8528Object.BlockXPos_1 += 0x8000529Object.BlockXPos_4 -= 0x8000530#platform: Use_Origins531TempValue2 = 1532TempValue3 = 3533#endplatform534break535536case 9537Object.BlockXPos_1 -= 0x8000538Object.BlockXPos_4 -= 0x8000539#platform: Use_Origins540TempValue2 = 4541TempValue3 = 2542#endplatform543if Object.AnimationTimer == 64544Object.BlockXPos_3 = Object.BlockXPos_4545Object.BlockYPos_3 = Object.BlockYPos_4546end if547break548549case 10550Object.BlockYPos_1 -= 0x8000551Object.BlockXPos_4 -= 0x8000552#platform: Use_Origins553TempValue2 = 4554TempValue3 = 2555#endplatform556if Object.AnimationTimer == 64557Object.BlockXPos_2 = Object.BlockXPos_4558Object.BlockYPos_2 = Object.BlockYPos_4559end if560break561562case 11563Object.BlockYPos_1 -= 0x8000564Object.BlockXPos_4 -= 0x8000565#platform: Use_Origins566TempValue2 = 4567TempValue3 = 2568#endplatform569break570571case 12572Object.BlockYPos_1 -= 0x8000573Object.BlockXPos_4 += 0x8000574#platform: Use_Origins575TempValue2 = 1576TempValue3 = 1577#endplatform578if Object.AnimationTimer == 64579Object.BlockXPos_2 = Object.BlockXPos_1580Object.BlockYPos_2 = Object.BlockYPos_1581end if582break583584case 13585Object.BlockYPos_1 -= 0x8000586Object.BlockXPos_4 += 0x8000587#platform: Use_Origins588TempValue2 = 1589TempValue3 = 1590#endplatform591if Object.AnimationTimer == 64592Object.BlockXPos_3 = Object.BlockXPos_1593Object.BlockYPos_3 = Object.BlockYPos_1594end if595break596597case 14598Object.BlockXPos_1 += 0x8000599Object.BlockXPos_4 += 0x8000600#platform: Use_Origins601TempValue2 = 1602TempValue3 = 3603#endplatform604break605end switch606end function607608609function MovingBlocks_MoveType_4610switch Object.Direction611case 0612Object.BlockXPos_1 += 0x8000613#platform: Use_Origins614TempValue2 = 1615TempValue3 = 3616#endplatform617if Object.AnimationTimer == 64618Object.BlockXPos_2 = Object.BlockXPos_1619end if620break621622case 1623Object.BlockXPos_1 += 0x8000624#platform: Use_Origins625TempValue2 = 1626TempValue3 = 3627#endplatform628if Object.AnimationTimer == 64629Object.BlockXPos_3 = Object.BlockXPos_1630end if631break632633case 2634Object.BlockYPos_1 -= 0x8000635#platform: Use_Origins636TempValue2 = 1637TempValue3 = 1638#endplatform639break640case 3641Object.BlockYPos_1 += 0x8000642Object.BlockYPos_4 += 0x8000643#platform: Use_Origins644TempValue2 = 4645TempValue3 = 4646#endplatform647if Object.AnimationTimer == 64648Object.BlockXPos_3 = Object.BlockXPos_4649Object.BlockYPos_3 = Object.BlockYPos_4650end if651break652653case 4654Object.BlockXPos_1 -= 0x8000655Object.BlockXPos_4 -= 0x8000656#platform: Use_Origins657TempValue2 = 4658TempValue3 = 2659#endplatform660if Object.AnimationTimer == 64661Object.BlockXPos_2 = Object.BlockXPos_4662Object.BlockYPos_2 = Object.BlockYPos_4663end if664break665666case 5667Object.BlockXPos_1 -= 0x8000668Object.BlockXPos_4 -= 0x8000669#platform: Use_Origins670TempValue2 = 4671TempValue3 = 2672#endplatform673break674675case 6676Object.BlockXPos_1 -= 0x8000677Object.BlockXPos_4 += 0x8000678#platform: Use_Origins679TempValue2 = 1680TempValue3 = 2681#endplatform682if Object.AnimationTimer == 64683Object.BlockXPos_2 = Object.BlockXPos_1684Object.BlockYPos_2 = Object.BlockYPos_1685end if686break687688case 7689Object.BlockYPos_1 -= 0x8000690Object.BlockXPos_4 += 0x8000691#platform: Use_Origins692TempValue2 = 1693TempValue3 = 1694#endplatform695if Object.AnimationTimer == 64696Object.BlockXPos_3 = Object.BlockXPos_1697Object.BlockYPos_3 = Object.BlockYPos_1698end if699break700701case 8702Object.BlockXPos_1 -= 0x8000703Object.BlockYPos_4 -= 0x8000704#platform: Use_Origins705TempValue2 = 1706TempValue3 = 2707#endplatform708break709710case 9711Object.BlockXPos_1 += 0x8000712Object.BlockYPos_4 -= 0x8000713#platform: Use_Origins714TempValue2 = 4715TempValue3 = 1716#endplatform717if Object.AnimationTimer == 64718Object.BlockXPos_3 = Object.BlockXPos_4719Object.BlockYPos_3 = Object.BlockYPos_4720end if721break722723case 10724Object.BlockYPos_1 += 0x8000725Object.BlockXPos_4 += 0x8000726#platform: Use_Origins727TempValue2 = 4728TempValue3 = 3729#endplatform730if Object.AnimationTimer == 64731Object.BlockXPos_2 = Object.BlockXPos_4732Object.BlockYPos_2 = Object.BlockYPos_4733end if734break735736case 11737Object.BlockXPos_1 += 0x8000738Object.BlockYPos_4 -= 0x8000739#platform: Use_Origins740TempValue2 = 4741TempValue3 = 1742#endplatform743break744745case 12746Object.BlockXPos_1 += 0x8000747Object.BlockYPos_4 += 0x8000748#platform: Use_Origins749TempValue2 = 1750TempValue3 = 3751#endplatform752if Object.AnimationTimer == 64753Object.BlockXPos_2 = Object.BlockXPos_1754Object.BlockYPos_2 = Object.BlockYPos_1755end if756break757758case 13759Object.BlockXPos_1 += 0x8000760Object.BlockXPos_4 -= 0x8000761#platform: Use_Origins762TempValue2 = 1763TempValue3 = 3764#endplatform765if Object.AnimationTimer == 64766Object.BlockXPos_3 = Object.BlockXPos_1767Object.BlockYPos_3 = Object.BlockYPos_1768end if769break770771case 14772Object.BlockYPos_1 -= 0x8000773Object.BlockYPos_4 += 0x8000774#platform: Use_Origins775TempValue2 = 1776TempValue3 = 1777#endplatform778break779end switch780end function781782783function MovingBlocks_CrushCheck784#platform: Use_Origins785if TempValue3 == 4786if Player.Gravity == GRAVITY_GROUND787Player.XPos = TempValue4788Player.YPos = TempValue5789PlayerObjectCollision(C_BOX, -8, -17, 8, 8)790if CheckResult == PLAYER_COL_ROOF791CallFunction(Player_Kill)792end if793end if794end if795ArrayPos0 = 0796TempValue6 = 0797while ArrayPos0 < 1056798if Object[ArrayPos0].Type == TypeName[MovingBlocks]799if ArrayPos0 != Object.EntityNo800if Object[ArrayPos0].CrushCheck > 0801TempValue6 = Object[ArrayPos0].CrushCheck802end if803end if804end if805ArrayPos0++806loop807808if TempValue6 > 0809GetBit(CheckResult, TempValue6, 2)810if CheckResult == true811if TempValue3 == 3812Player.XPos = TempValue4813Player.YPos = TempValue5814PlayerObjectCollision(C_BOX, -16, -9, 14, 8)815if CheckResult == PLAYER_COL_RWALL816CallFunction(Player_Kill)817end if818end if819end if820821GetBit(CheckResult, TempValue6, 3)822if CheckResult == true823if TempValue3 == 2824Player.XPos = TempValue4825Player.YPos = TempValue5826PlayerObjectCollision(C_BOX, -14, -9, 16, 8)827if CheckResult == PLAYER_COL_LWALL828CallFunction(Player_Kill)829end if830end if831end if832833GetBit(CheckResult, TempValue6, 1)834if CheckResult == true835if TempValue3 == 4836Player.XPos = TempValue4837Player.YPos = TempValue5838PlayerObjectCollision(C_BOX, -8, -16, 8, 4)839if CheckResult == PLAYER_COL_ROOF840CallFunction(Player_Kill)841end if842end if843end if844845if TempValue3 == 1846SetBit(Object.CrushCheck, 0, 1)847end if848end if849PlayerObjectCollision(C_BOX, -16, -17, 16, 16)850TempValue4 = Player.XPos851TempValue5 = Player.YPos852#endplatform853end function854855856function MovingBlocks_CrushCheckTop857#platform: Use_Origins858Player.XPos = TempValue4859Player.YPos = TempValue5860PlayerObjectCollision(C_BOX, -16, -17, 16, 4)861if CheckResult == PLAYER_COL_ROOF862ArrayPos0 = 0863TempValue6 = 0864while ArrayPos0 < 1056865if Object[ArrayPos0].Type == TypeName[MovingBlocks]866if ArrayPos0 != Object.EntityNo867GetBit(CheckResult, Object[ArrayPos0].CrushCheck, 0)868if CheckResult == true869TempValue6 = Object[ArrayPos0].CrushCheck870end if871end if872end if873ArrayPos0++874loop875876if TempValue6 > 0877GetBit(CheckResult, TempValue6, 1)878if CheckResult == true879CallFunction(Player_Kill)880end if881end if882end if883#endplatform884end function885886887sub ObjectMain888if Object.State == MOVINGBLOCKS_MOVE889if Object.AnimationTimer < 64890Object.AnimationTimer++891CallFunction(Object.MovePattern)892else893Object.AnimationTimer = 0894Object.State = MOVINGBLOCKS_CHANGE_PATTERN895Object.BlockState++896if Object.BlockState > 14897Object.BlockState = 3898end if899end if900else901if Object.AnimationTimer < 30902Object.AnimationTimer++903else904Object.AnimationTimer = 0905Object.State = MOVINGBLOCKS_MOVE906end if907end if908end sub909910911sub ObjectPlayerInteraction912#platform: Use_Origins913Object.CrushCheck = 0914TempValue4 = Player.XPos915TempValue5 = Player.YPos916#endplatform917918TempValue0 = Object.XPos919TempValue1 = Object.YPos920921Object.XPos = Object.BlockXPos_1922Object.YPos = Object.BlockYPos_1923PlayerObjectCollision(C_BOX, -16, -17, 16, 16)924if CheckResult == PLAYER_COL_FLOOR925Player.YPos += 0x10000926#platform: Use_Origins927TempValue5 = Player.YPos928#endplatform929end if930#platform: Use_Origins931if CheckResult > 0932SetBit(Object.CrushCheck, CheckResult, 1)933if TempValue2 == 1934CallFunction(MovingBlocks_CrushCheck)935else936if CheckResult == PLAYER_COL_ROOF937CallFunction(MovingBlocks_CrushCheckTop)938end if939end if940end if941TempValue4 = Player.XPos942TempValue5 = Player.YPos943#endplatform944945Object.XPos = Object.BlockXPos_2946Object.YPos = Object.BlockYPos_2947PlayerObjectCollision(C_BOX, -16, -17, 16, 16)948if CheckResult == PLAYER_COL_FLOOR949Player.YPos += 0x10000950#platform: Use_Origins951TempValue5 = Player.YPos952#endplatform953end if954955#platform: Use_Origins956if CheckResult > 0957SetBit(Object.CrushCheck, CheckResult, 1)958if TempValue2 == 2959CallFunction(MovingBlocks_CrushCheck)960else961if CheckResult == PLAYER_COL_ROOF962CallFunction(MovingBlocks_CrushCheckTop)963end if964end if965end if966TempValue4 = Player.XPos967TempValue5 = Player.YPos968#endplatform969970Object.XPos = Object.BlockXPos_3971Object.YPos = Object.BlockYPos_3972PlayerObjectCollision(C_BOX, -16, -17, 16, 16)973if CheckResult == PLAYER_COL_FLOOR974Player.YPos += 0x10000975#platform: Use_Origins976TempValue5 = Player.YPos977#endplatform978end if979980#platform: Use_Origins981if CheckResult > 0982SetBit(Object.CrushCheck, CheckResult, 1)983if TempValue2 == 3984CallFunction(MovingBlocks_CrushCheck)985else986if CheckResult == PLAYER_COL_ROOF987CallFunction(MovingBlocks_CrushCheckTop)988end if989end if990end if991#endplatform992993Object.XPos = Object.BlockXPos_4994Object.YPos = Object.BlockYPos_4995PlayerObjectCollision(C_BOX, -16, -17, 16, 16)996if CheckResult == PLAYER_COL_FLOOR997Player.YPos += 0x10000998#platform: Use_Origins999TempValue5 = Player.YPos1000#endplatform1001end if10021003#platform: Use_Origins1004if CheckResult > 01005SetBit(Object.CrushCheck, CheckResult, 1)1006if TempValue2 == 41007CallFunction(MovingBlocks_CrushCheck)1008else1009if CheckResult == PLAYER_COL_ROOF1010CallFunction(MovingBlocks_CrushCheckTop)1011end if1012end if1013end if1014#endplatform1015Object.XPos = TempValue01016Object.YPos = TempValue11017PlayerObjectCollision(C_BOX, -16, -16, 16, 16)1018#platform: Use_Origins1019if CheckResult > 01020SetBit(Object.CrushCheck, CheckResult, 1)1021if CheckResult == PLAYER_COL_ROOF1022CallFunction(MovingBlocks_CrushCheckTop)1023end if1024end if1025TempValue2 = 01026TempValue3 = 01027#endplatform1028end sub102910301031sub ObjectDraw1032DrawSpriteXY(0, Object.BlockXPos_1, Object.BlockYPos_1)1033DrawSpriteXY(0, Object.BlockXPos_4, Object.BlockYPos_4)1034DrawSpriteXY(0, Object.BlockXPos_2, Object.BlockYPos_2)1035DrawSpriteXY(0, Object.BlockXPos_3, Object.BlockYPos_3)10361037DrawSprite(0)1038end sub103910401041sub ObjectStartup1042LoadSpriteSheet("R6/Objects.gif")10431044SpriteFrame(-16, -16, 32, 32, 173, 1) // #0 - Block10451046ArrayPos0 = 321047while ArrayPos0 < 10561048if Object[ArrayPos0].Type == TypeName[Moving Blocks]1049Object[ArrayPos0].BlockXPos_1 = Object[ArrayPos0].XPos1050Object[ArrayPos0].BlockYPos_1 = Object[ArrayPos0].YPos1051Object[ArrayPos0].BlockXPos_2 = Object[ArrayPos0].XPos1052Object[ArrayPos0].BlockYPos_2 = Object[ArrayPos0].YPos1053Object[ArrayPos0].BlockXPos_3 = Object[ArrayPos0].XPos1054Object[ArrayPos0].BlockYPos_3 = Object[ArrayPos0].YPos1055Object[ArrayPos0].BlockXPos_4 = Object[ArrayPos0].XPos1056Object[ArrayPos0].BlockYPos_4 = Object[ArrayPos0].YPos10571058switch Object[ArrayPos0].PropertyValue1059case FORMATION_L_AND_LINES1060Object[ArrayPos0].MovePattern = MovingBlocks_MoveType_11061break1062case FORMATION_TETROMINOS_LEFT1063Object[ArrayPos0].MovePattern = MovingBlocks_MoveType_41064break1065case FORMATION_L_AND_LINES_CCW1066Object[ArrayPos0].MovePattern = MovingBlocks_MoveType_21067break1068case FORMATION_TETROMINOS_RIGHT1069Object[ArrayPos0].MovePattern = MovingBlocks_MoveType_31070break1071end switch1072end if1073ArrayPos0++1074loop1075end sub107610771078// ========================1079// Editor Subs1080// ========================10811082sub RSDKEdit1083if Editor.ReturnVariable == true1084switch Editor.VariableID1085case EDIT_VAR_PROPVAL // Property Value1086CheckResult = Object.PropertyValue1087break1088case 0 // movementPattern1089CheckResult = Object.PropertyValue1090CheckResult &= 31091break1092end switch1093else1094switch Editor.VariableID1095case EDIT_VAR_PROPVAL // Property Value1096Object.PropertyValue = Editor.VariableValue1097break1098case 0 // movementPattern1099Object.PropertyValue = Editor.VariableValue1100Object.PropertyValue &= 31101break1102end switch1103end if1104end sub11051106sub RSDKDraw1107TempValue0 = Object.YPos1108TempValue0 -= 0x1000001109TempValue1 = Object.XPos1110TempValue1 -= 0x1000001111switch Object.PropertyValue1112case FORMATION_L_AND_LINES1113case FORMATION_L_AND_LINES_CCW1114if Editor.ShowGizmos == true1115Editor.DrawingOverlay = true1116TempValue0 -= 0x2000001117DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1118DrawArrow(Object.XPos,Object.YPos,Object.XPos,TempValue0, 255, 0, 0)1119TempValue0 -= 0x2000001120DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1121TempValue0 -= 0x2000001122DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1123if object.PropertyValue == FORMATION_L_AND_LINES1124TempValue1 += 0x2000001125else1126TempValue1 -= 0x2000001127end if1128TempValue0 = Object.YPos1129TempValue0 -= 0x1000001130DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1131Editor.DrawingOverlay = false1132end if1133break11341135case FORMATION_TETROMINOS_LEFT1136if Editor.ShowGizmos == true1137Editor.DrawingOverlay = true1138TempValue1 += 0x2000001139DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1140TempValue1 += 0x2000001141DrawArrow(Object.XPos,Object.YPos,TempValue1,Object.YPos, 255, 0, 0)1142DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1143TempValue0 -= 0x2000001144DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1145TempValue0 = Object.YPos1146TempValue0 -= 0x1000001147DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1148Editor.DrawingOverlay = false1149end if1150break11511152case FORMATION_TETROMINOS_RIGHT1153if Editor.ShowGizmos == true1154Editor.DrawingOverlay = true1155TempValue0 -= 0x2000001156DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1157DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, 0, 0)1158TempValue0 -= 0x2000001159DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1160TempValue1 += 0x2000001161DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1162TempValue1 -= 0x2000001163DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)1164Editor.DrawingOverlay = false1165end if1166break1167end switch1168DrawSprite(0)1169end sub117011711172sub RSDKLoad1173LoadSpriteSheet("R6/Objects.gif")11741175SpriteFrame(-16, -16, 32, 32, 173, 1) // #0 - Block11761177AddEditorVariable("movementPattern")1178SetActiveVariable("movementPattern")1179AddEnumVariable("L and Lines", FORMATION_L_AND_LINES)1180AddEnumVariable("Tetrominos (left)", FORMATION_TETROMINOS_LEFT)1181AddEnumVariable("L and Lines, counter-clockwise", FORMATION_L_AND_LINES_CCW)1182AddEnumVariable("Tetrominos (right)", FORMATION_TETROMINOS_RIGHT)1183end sub118411851186