Path: blob/master/Sonic 2/Scripts/MCZ/MovingCrates.txt
1482 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Moving Crates Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011// Each box is pretty much its own mini-object12// Note: positions are relative values to the base object's position1314// This object got a major rewrite in Origins Plus, likely to prevent the crush death bug from happening with it15// (It should be noted they did not actually fix the root cause of the bug LOL)16// For the sake of preservation, both the original and Origins Plus versions of the object are included here1718// Standalone Aliases19private alias object.value15 : object.box1.state20private alias object.value1 : object.box1.x21private alias object.value2 : object.box1.y22private alias object.value7 : object.box1.xvel23private alias object.value8 : object.box1.yvel24private alias object.value18 : object.box1.crushTimer2526private alias object.value16 : object.box2.state27private alias object.value3 : object.box2.x28private alias object.value4 : object.box2.y29private alias object.value9 : object.box2.xvel30private alias object.value10 : object.box2.yvel31private alias object.value19 : object.box2.crushTimer3233private alias object.value17 : object.box3.state34private alias object.value5 : object.box3.x35private alias object.value6 : object.box3.y36private alias object.value11 : object.box3.xvel37private alias object.value12 : object.box3.yvel38private alias object.value20 : object.box3.crushTimer3940// Origins Plus Aliases41private alias object.value30 : object.boxUpdate42private alias object.value31 : object.box.x.store43private alias object.value32 : object.box.y.store44private alias object.value33 : object.box.xvel.store45private alias object.value34 : object.box.yvel.store46private alias object.value35 : object.box.state.store47private alias object.value36 : object.box.crushTimer.store48private alias object.value37 : object.xpos.store49private alias object.value38 : object.ypos.store5051// values 13 and 14 are unused5253// Object states54// Clockwise and counter-clockwise versions have separate states55private alias 0 : MOVINGCRATE_CW_RIGHT56private alias 1 : MOVINGCRATE_CW_DOWN57private alias 2 : MOVINGCRATE_CW_LEFT58private alias 3 : MOVINGCRATE_CW_UP5960private alias 4 : MOVINGCRATE_CCW_LEFT61private alias 5 : MOVINGCRATE_CCW_DOWN62private alias 6 : MOVINGCRATE_CCW_RIGHT63private alias 7 : MOVINGCRATE_CCW_UP6465// Crate Numbers66private alias 1 : MOVINGCRATE_167private alias 2 : MOVINGCRATE_268private alias 3 : MOVINGCRATE_36970// Player Aliases71private alias object.state : player.state72private alias object.xpos : player.xpos73private alias object.ypos : player.ypos74private alias object.gravity : player.gravity75private alias object.animation : player.animation76private alias object.value1 : player.timer777879// ========================80// Function Declarations81// ========================8283reserve function MovingCrates_DebugDraw84reserve function MovingCrates_DebugSpawn8586reserve function MovingCrates_UpdateCrate187reserve function MovingCrates_UpdateCrate288reserve function MovingCrates_UpdateCrate3899091// ========================92// Function Definitions93// ========================9495private function MovingCrates_DebugDraw96// Only draw the first box97DrawSprite(0)98end function99100101private function MovingCrates_DebugSpawn102// Spawn a Moving Crates object and init its values for the three crates103CreateTempObject(TypeName[Moving Crates], 0, object.xpos, object.ypos)104if object.direction == FLIP_NONE105// Clockwise rotating version106object[tempObjectPos].box1.x = 0x000000107object[tempObjectPos].box1.y = 0x000000108object[tempObjectPos].box1.xvel = 0x10000109object[tempObjectPos].box1.yvel = 0x00000110111object[tempObjectPos].box2.x = 0x400000112object[tempObjectPos].box2.y = 0x400000113object[tempObjectPos].box2.xvel = -0x10000114object[tempObjectPos].box2.yvel = 0x00000115116object[tempObjectPos].box3.x = -0x400000117object[tempObjectPos].box3.y = 0x400000118object[tempObjectPos].box3.xvel = 0x00000119object[tempObjectPos].box3.yvel = -0x10000120121object[tempObjectPos].box1.state = MOVINGCRATE_CW_RIGHT122object[tempObjectPos].box2.state = MOVINGCRATE_CW_LEFT123object[tempObjectPos].box3.state = MOVINGCRATE_CW_UP124else125// Counter-clockwise rotating version126object[tempObjectPos].box1.x = 0x000000127object[tempObjectPos].box1.y = 0x000000128object[tempObjectPos].box1.xvel = -0x10000129object[tempObjectPos].box1.yvel = 0x00000130131object[tempObjectPos].box2.x = 0x400000132object[tempObjectPos].box2.y = 0x400000133object[tempObjectPos].box2.xvel = 0x00000134object[tempObjectPos].box2.yvel = -0x10000135136object[tempObjectPos].box3.x = -0x400000137object[tempObjectPos].box3.y = 0x400000138object[tempObjectPos].box3.xvel = 0x10000139object[tempObjectPos].box3.yvel = 0x00000140141object[tempObjectPos].box1.state = MOVINGCRATE_CCW_LEFT142object[tempObjectPos].box2.state = MOVINGCRATE_CCW_UP143object[tempObjectPos].box3.state = MOVINGCRATE_CCW_RIGHT144end if145end function146147148private function MovingCrates_UpdateCrate1149#platform: USE_STANDALONE150temp0 = object.xpos151temp1 = object.ypos152object.xpos += object.box1.x153object.ypos += object.box1.y154foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)155BoxCollisionTest(C_SOLID, object.entityPos, -32, -32, 32, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)156switch checkResult157case COL_TOP158player[currentPlayer].xpos += object.box1.xvel159player[currentPlayer].ypos += object.box1.yvel160break161162case COL_LEFT163case COL_RIGHT164// If the player attempts to climb on these, block them from doing so and make them drop off165if player[currentPlayer].state == Player_State_Climb166player[currentPlayer].timer = 0167player[currentPlayer].animation = ANI_GLIDING_DROP168player[currentPlayer].state = Player_State_GlideDrop169end if170break171172case COL_BOTTOM173if player[currentPlayer].gravity == GRAVITY_GROUND174if object.box1.yvel > 0175object.box1.crushTimer++176if object.box1.crushTimer > 9177CallFunction(Player_Kill)178end if179end if180end if181break182end switch183next184185object.xpos = temp0186object.ypos = temp1187object.box1.x += object.box1.xvel188object.box1.y += object.box1.yvel189switch object.box1.state190case MOVINGCRATE_CW_RIGHT191if object.box1.x >= 0x400000192object.box1.state++193object.box1.x = 0x400000194object.box1.xvel = 0195object.box1.yvel = 0x10000196end if197break198199case MOVINGCRATE_CW_DOWN200if object.box1.y >= 0x400000201object.box1.state++202object.box1.y = 0x400000203object.box1.xvel = -0x10000204object.box1.yvel = 0205end if206break207208case MOVINGCRATE_CW_LEFT209if object.box1.x <= -0x400000210object.box1.state++211object.box1.x = -0x400000212object.box1.xvel = 0213object.box1.yvel = -0x10000214end if215break216217case MOVINGCRATE_CW_UP218if object.box1.y <= 0219object.box1.state = MOVINGCRATE_CW_RIGHT220object.box1.y = 0221object.box1.xvel = 0x10000222object.box1.yvel = 0223object.box1.crushTimer = 0224end if225break226227// Counter-clockwise states228229case MOVINGCRATE_CCW_LEFT230if object.box1.x <= -0x400000231object.box1.state++232object.box1.x = -0x400000233object.box1.xvel = 0234object.box1.yvel = 0x10000235end if236break237238case MOVINGCRATE_CCW_DOWN239if object.box1.y >= 0x400000240object.box1.state++241object.box1.y = 0x400000242object.box1.xvel = 0x10000243object.box1.yvel = 0244end if245break246247case MOVINGCRATE_CCW_RIGHT248if object.box1.x >= 0x400000249object.box1.state++250object.box1.x = 0x400000251object.box1.xvel = 0252object.box1.yvel = -0x10000253end if254break255256case MOVINGCRATE_CCW_UP257if object.box1.y <= 0258object.box1.state = MOVINGCRATE_CCW_LEFT259object.box1.y = 0260object.box1.xvel = -0x10000261object.box1.yvel = 0262object.box1.crushTimer = 0263end if264break265end switch266#endplatform267268#platform: USE_ORIGINS269switch object.boxUpdate270case MOVINGCRATE_1271object.box.x.store = object.box1.x272object.box.y.store = object.box1.y273object.box.xvel.store = object.box1.xvel274object.box.yvel.store = object.box1.yvel275object.box.state.store = object.box1.state276object.box.crushTimer.store = object.box1.crushTimer277break278279case MOVINGCRATE_2280object.box.x.store = object.box2.x281object.box.y.store = object.box2.y282object.box.xvel.store = object.box2.xvel283object.box.yvel.store = object.box2.yvel284object.box.state.store = object.box2.state285object.box.crushTimer.store = object.box2.crushTimer286break287288case MOVINGCRATE_3289object.box.x.store = object.box3.x290object.box.y.store = object.box3.y291object.box.xvel.store = object.box3.xvel292object.box.yvel.store = object.box3.yvel293object.box.state.store = object.box3.state294object.box.crushTimer.store = object.box3.crushTimer295break296end switch297#endplatform298end function299300301private function MovingCrates_UpdateCrate2302#platform: USE_STANDALONE303temp0 = object.xpos304temp1 = object.ypos305object.xpos += object.box2.x306object.ypos += object.box2.y307foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)308BoxCollisionTest(C_SOLID, object.entityPos, -32, -32, 32, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)309switch checkResult310case COL_TOP311player[currentPlayer].xpos += object.box2.xvel312player[currentPlayer].ypos += object.box2.yvel313break314315case COL_LEFT316case COL_RIGHT317// If the player attempts to climb on these, block them from doing so and make them drop off318if player[currentPlayer].state == Player_State_Climb319player[currentPlayer].timer = 0320player[currentPlayer].animation = ANI_GLIDING_DROP321player[currentPlayer].state = Player_State_GlideDrop322end if323break324325case COL_BOTTOM326if player[currentPlayer].gravity == GRAVITY_GROUND327if object.box2.yvel > 0328object.box2.crushTimer++329if object.box2.crushTimer > 9330CallFunction(Player_Kill)331end if332end if333end if334break335end switch336next337338object.xpos = temp0339object.ypos = temp1340object.box2.x += object.box2.xvel341object.box2.y += object.box2.yvel342switch object.box2.state343case MOVINGCRATE_CW_RIGHT344if object.box2.x >= 0x400000345object.box2.state++346object.box2.x = 0x400000347object.box2.xvel = 0348object.box2.yvel = 0x10000349end if350break351352case MOVINGCRATE_CW_DOWN353if object.box2.y >= 0x400000354object.box2.state++355object.box2.y = 0x400000356object.box2.xvel = -0x10000357object.box2.yvel = 0358end if359break360361case MOVINGCRATE_CW_LEFT362if object.box2.x <= -0x400000363object.box2.state++364object.box2.x = -0x400000365object.box2.xvel = 0366object.box2.yvel = -0x10000367end if368break369370case MOVINGCRATE_CW_UP371if object.box2.y <= 0372object.box2.state = MOVINGCRATE_CW_RIGHT373object.box2.y = 0374object.box2.xvel = 0x10000375object.box2.yvel = 0376object.box2.crushTimer = 0377end if378break379380// Counter-clockwise states381382case MOVINGCRATE_CCW_LEFT383if object.box2.x <= -0x400000384object.box2.state++385object.box2.x = -0x400000386object.box2.xvel = 0387object.box2.yvel = 0x10000388end if389break390391case MOVINGCRATE_CCW_DOWN392if object.box2.y >= 0x400000393object.box2.state++394object.box2.y = 0x400000395object.box2.xvel = 0x10000396object.box2.yvel = 0397end if398break399400case MOVINGCRATE_CCW_RIGHT401if object.box2.x >= 0x400000402object.box2.state++403object.box2.x = 0x400000404object.box2.xvel = 0405object.box2.yvel = -0x10000406end if407break408409case MOVINGCRATE_CCW_UP410if object.box2.y <= 0411object.box2.state = MOVINGCRATE_CCW_LEFT412object.box2.y = 0413object.box2.xvel = -0x10000414object.box2.yvel = 0415object.box2.crushTimer = 0416end if417break418end switch419#endplatform420421#platform: USE_ORIGINS422switch object.boxUpdate423case MOVINGCRATE_1424object.box1.x = object.box.x.store425object.box1.y = object.box.y.store426object.box1.xvel = object.box.xvel.store427object.box1.yvel = object.box.yvel.store428object.box1.state = object.box.state.store429object.box1.crushTimer = object.box.crushTimer.store430break431432case MOVINGCRATE_2433object.box2.x = object.box.x.store434object.box2.y = object.box.y.store435object.box2.xvel = object.box.xvel.store436object.box2.yvel = object.box.yvel.store437object.box2.state = object.box.state.store438object.box2.crushTimer = object.box.crushTimer.store439break440441case MOVINGCRATE_3442object.box3.x = object.box.x.store443object.box3.y = object.box.y.store444object.box3.xvel = object.box.xvel.store445object.box3.yvel = object.box.yvel.store446object.box3.state = object.box.state.store447object.box3.crushTimer = object.box.crushTimer.store448break449end switch450#endplatform451end function452453454private function MovingCrates_UpdateCrate3455#platform: USE_STANDALONE456temp0 = object.xpos457temp1 = object.ypos458object.xpos += object.box3.x459object.ypos += object.box3.y460foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)461BoxCollisionTest(C_SOLID, object.entityPos, -32, -32, 32, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)462switch checkResult463case COL_TOP464player[currentPlayer].xpos += object.box3.xvel465player[currentPlayer].ypos += object.box3.yvel466break467468case COL_LEFT469case COL_RIGHT470// If the player attempts to climb on these, block them from doing so and make them drop off471if player[currentPlayer].state == Player_State_Climb472player[currentPlayer].timer = 0473player[currentPlayer].animation = ANI_GLIDING_DROP474player[currentPlayer].state = Player_State_GlideDrop475end if476break477478case COL_BOTTOM479if player[currentPlayer].gravity == GRAVITY_GROUND480if object.box3.yvel > 0481object.box3.crushTimer++482if object.box3.crushTimer > 9483CallFunction(Player_Kill)484end if485end if486end if487break488end switch489next490491object.xpos = temp0492object.ypos = temp1493object.box3.x += object.box3.xvel494object.box3.y += object.box3.yvel495switch object.box3.state496case MOVINGCRATE_CW_RIGHT497if object.box3.x >= 0x400000498object.box3.state++499object.box3.x = 0x400000500object.box3.xvel = 0501object.box3.yvel = 0x10000502end if503break504505case MOVINGCRATE_CW_DOWN506if object.box3.y >= 0x400000507object.box3.state++508object.box3.y = 0x400000509object.box3.xvel = -0x10000510object.box3.yvel = 0511end if512break513514case MOVINGCRATE_CW_LEFT515if object.box3.x <= -0x400000516object.box3.state++517object.box3.x = -0x400000518object.box3.xvel = 0519object.box3.yvel = -0x10000520end if521break522523case MOVINGCRATE_CW_UP524if object.box3.y <= 0525object.box3.state = MOVINGCRATE_CW_RIGHT526object.box3.y = 0527object.box3.xvel = 0x10000528object.box3.yvel = 0529object.box3.crushTimer = 0530end if531break532533// Counter-clockwise states534535case MOVINGCRATE_CCW_LEFT536if object.box3.x <= -0x400000537object.box3.state++538object.box3.x = -0x400000539object.box3.xvel = 0540object.box3.yvel = 0x10000541end if542break543544case MOVINGCRATE_CCW_DOWN545if object.box3.y >= 0x400000546object.box3.state++547object.box3.y = 0x400000548object.box3.xvel = 0x10000549object.box3.yvel = 0550end if551break552553case MOVINGCRATE_CCW_RIGHT554if object.box3.x >= 0x400000555object.box3.state++556object.box3.x = 0x400000557object.box3.xvel = 0558object.box3.yvel = -0x10000559end if560break561562case MOVINGCRATE_CCW_UP563if object.box3.y <= 0564object.box3.state = MOVINGCRATE_CCW_LEFT565object.box3.y = 0566object.box3.xvel = -0x10000567object.box3.yvel = 0568object.box3.crushTimer = 0569end if570break571end switch572#endplatform573574#platform: USE_ORIGINS575CallFunction(MovingCrates_UpdateCrate1)576object.xpos.store = object.xpos577object.ypos.store = object.ypos578object.xpos += object.box.x.store579object.ypos += object.box.y.store580foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)581BoxCollisionTest(C_SOLID, object.entityPos, -32, -32, 32, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)582switch checkResult583case COL_TOP584player[currentPlayer].xpos += object.box.xvel.store585player[currentPlayer].ypos += object.box.yvel.store586break587588case COL_LEFT589case COL_RIGHT590// If the player attempts to climb on these, block them from doing so and make them drop off591if player[currentPlayer].state == Player_State_Climb592player[currentPlayer].timer = 0593player[currentPlayer].animation = ANI_GLIDING_DROP594player[currentPlayer].state = Player_State_GlideDrop595end if596break597598case COL_BOTTOM599if player[currentPlayer].gravity == GRAVITY_GROUND600if object.box.yvel.store > 0601object.box.crushTimer.store++602if object.box.crushTimer.store > 9603CallFunction(Player_Kill)604end if605end if606end if607break608end switch609next610611object.xpos = object.xpos.store612object.ypos = object.ypos.store613object.box.x.store += object.box.xvel.store614object.box.y.store += object.box.yvel.store615switch object.box.state.store616case MOVINGCRATE_CW_RIGHT617if object.box.x.store >= 0x400000618object.box.state.store++619object.box.x.store = 0x400000620object.box.xvel.store = 0621object.box.yvel.store = 0x10000622end if623break624625case MOVINGCRATE_CW_DOWN626if object.box.y.store >= 0x400000627object.box.state.store++628object.box.y.store = 0x400000629object.box.xvel.store = -0x10000630object.box.yvel.store = 0631end if632break633634case MOVINGCRATE_CW_LEFT635if object.box.x.store <= -0x400000636object.box.state.store++637object.box.x.store = -0x400000638object.box.xvel.store = 0639object.box.yvel.store = -0x10000640end if641break642643case MOVINGCRATE_CW_UP644if object.box.y.store <= 0645object.box.state.store = 0646object.box.y.store = 0647object.box.xvel.store = 0x10000648object.box.yvel.store = 0649object.box.crushTimer.store = 0650end if651break652653// Counter-clockwise states654655case MOVINGCRATE_CCW_LEFT656if object.box.x.store <= -0x400000657object.box.state.store++658object.box.x.store = -0x400000659object.box.xvel.store = 0660object.box.yvel.store = 0x10000661end if662break663664case MOVINGCRATE_CCW_DOWN665if object.box.y.store >= 0x400000666object.box.state.store++667object.box.y.store = 0x400000668object.box.xvel.store = 0x10000669object.box.yvel.store = 0670end if671break672673case MOVINGCRATE_CCW_RIGHT674if object.box.x.store >= 0x400000675object.box.state.store++676object.box.x.store = 0x400000677object.box.xvel.store = 0678object.box.yvel.store = -0x10000679end if680break681682case MOVINGCRATE_CCW_UP683if object.box.y.store <= 0684object.box.state.store = 4685object.box.y.store = 0686object.box.xvel.store = -0x10000687object.box.yvel.store = 0688object.box.crushTimer.store = 0689end if690break691end switch692693CallFunction(MovingCrates_UpdateCrate2)694#endplatform695end function696697698// ========================699// Events700// ========================701702event ObjectUpdate703#platform: USE_STANDALONE704// Update the three crates individually705// These are all the same function, just using different variables706// If it existed at the time Get/SetObjectValue could've been used in a cool way here, but alas Sonic 2 was created in a pre-GetObjectValue world.707CallFunction(MovingCrates_UpdateCrate1)708CallFunction(MovingCrates_UpdateCrate2)709CallFunction(MovingCrates_UpdateCrate3)710#endplatform711712#platform: USE_ORIGINS713object.boxUpdate = 1714while object.boxUpdate <= 3715CallFunction(MovingCrates_UpdateCrate3)716object.boxUpdate++717loop718#endplatform719end event720721722event ObjectDraw723// Draw box 1724temp0 = object.xpos725temp1 = object.ypos726temp0 += object.box1.x727temp1 += object.box1.y728DrawSpriteXY(0, temp0, temp1)729730// Then box 2731temp0 = object.xpos732temp1 = object.ypos733temp0 += object.box2.x734temp1 += object.box2.y735DrawSpriteXY(0, temp0, temp1)736737// And finally, box 3738temp0 = object.xpos739temp1 = object.ypos740temp0 += object.box3.x741temp1 += object.box3.y742DrawSpriteXY(0, temp0, temp1)743end event744745746event ObjectStartup747CheckCurrentStageFolder("Zone06")748if checkResult == true749LoadSpriteSheet("MCZ/Objects.gif")750SpriteFrame(-32, -32, 64, 64, 136, 1)751else752LoadSpriteSheet("MBZ/Objects.gif")753SpriteFrame(-32, -32, 64, 64, 797, 697)754end if755756// Initialise all Moving Crates757foreach (TypeName[Moving Crates], arrayPos0, ALL_ENTITIES)758if object[arrayPos0].propertyValue == 0759// Clockwise rotating version760761object[arrayPos0].box1.x = 0x000000762object[arrayPos0].box1.y = 0x000000763object[arrayPos0].box1.xvel = 0x10000764object[arrayPos0].box1.yvel = 0x00000765766object[arrayPos0].box2.x = 0x400000767object[arrayPos0].box2.y = 0x400000768object[arrayPos0].box2.xvel = -0x10000769object[arrayPos0].box2.yvel = 0x00000770771object[arrayPos0].box3.x = -0x400000772object[arrayPos0].box3.y = 0x400000773object[arrayPos0].box3.xvel = 0x00000774object[arrayPos0].box3.yvel = -0x10000775776object[arrayPos0].box1.state = MOVINGCRATE_CW_RIGHT777object[arrayPos0].box2.state = MOVINGCRATE_CW_LEFT778object[arrayPos0].box3.state = MOVINGCRATE_CW_UP779else780// Counter-clockwise rotating version781782object[arrayPos0].box1.x = 0x000000783object[arrayPos0].box1.y = 0x000000784object[arrayPos0].box1.xvel = -0x10000785object[arrayPos0].box1.yvel = 0x00000786787object[arrayPos0].box2.x = 0x400000788object[arrayPos0].box2.y = 0x400000789object[arrayPos0].box2.xvel = 0x00000790object[arrayPos0].box2.yvel = -0x10000791792object[arrayPos0].box3.x = -0x400000793object[arrayPos0].box3.y = 0x400000794object[arrayPos0].box3.xvel = 0x10000795object[arrayPos0].box3.yvel = 0x00000796797object[arrayPos0].box1.state = MOVINGCRATE_CCW_LEFT798object[arrayPos0].box2.state = MOVINGCRATE_CCW_UP799object[arrayPos0].box3.state = MOVINGCRATE_CCW_RIGHT800end if801next802803SetTableValue(TypeName[Moving Crates], DebugMode_ObjCount, DebugMode_TypesTable)804SetTableValue(MovingCrates_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)805SetTableValue(MovingCrates_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)806DebugMode_ObjCount++807end event808809810// ========================811// Editor Events812// ========================813814event RSDKEdit815if editor.returnVariable == true816switch editor.variableID817case EDIT_VAR_PROPVAL // property value818checkResult = object.propertyValue819break820821case 0 // rotateDir822checkResult = object.propertyValue823break824825end switch826else827switch editor.variableID828case EDIT_VAR_PROPVAL // property value829object.propertyValue = editor.variableValue830break831832case 0 // rotateDir833object.propertyValue = editor.variableValue834break835836end switch837end if838end event839840841event RSDKDraw842// Draw box 1843temp0 = object.xpos844temp1 = object.ypos845temp0 += 0x000000 // object.box1.x846temp1 += 0x000000 // object.box1.y847DrawSpriteXY(0, temp0, temp1)848849// Then box 2850temp0 = object.xpos851temp1 = object.ypos852temp0 += 0x400000 // object.box2.x853temp1 += 0x400000 // object.box2.y854DrawSpriteXY(0, temp0, temp1)855856// And finally, box 3857temp0 = object.xpos858temp1 = object.ypos859temp0 -= 0x400000 // object.box3.x860temp1 += 0x400000 // object.box3.y861DrawSpriteXY(0, temp0, temp1)862863if editor.showGizmos == true864// Draw arrows to show movement direction865if object.propertyValue == 0866// Clockwise867temp0 = object.xpos868temp1 = object.ypos869temp0 += 0x000000 // object.box1.x870temp1 += 0x000000 // object.box1.y871temp2 = temp0872temp2 += 0x400000 // To the right873DrawArrow(temp0, temp1, temp2, temp1, 0xFF, 0xFF, 0xFF)874875temp0 = object.xpos876temp1 = object.ypos877temp0 += 0x400000 // object.box2.x878temp1 += 0x400000 // object.box2.y879temp2 = temp0880temp2 -= 0x400000 // To the left881DrawArrow(temp0, temp1, temp2, temp1, 0xFF, 0xFF, 0xFF)882883temp0 = object.xpos884temp1 = object.ypos885temp0 -= 0x400000 // object.box3.x886temp1 += 0x400000 // object.box3.y887temp2 = temp1888temp2 -= 0x400000 // Upwards889DrawArrow(temp0, temp1, temp0, temp2, 0xFF, 0xFF, 0xFF)890break891else892// CCW893temp0 = object.xpos894temp1 = object.ypos895temp0 += 0x000000 // object.box1.x896temp1 += 0x000000 // object.box1.y897temp2 = temp0898temp2 -= 0x400000 // To the left899DrawArrow(temp0, temp1, temp2, temp1, 0xFF, 0xFF, 0xFF)900901temp0 = object.xpos902temp1 = object.ypos903temp0 += 0x400000 // object.box2.x904temp1 += 0x400000 // object.box2.y905temp2 = temp1906temp2 -= 0x400000 // Upwards907DrawArrow(temp0, temp1, temp0, temp2, 0xFF, 0xFF, 0xFF)908909temp0 = object.xpos910temp1 = object.ypos911temp0 -= 0x400000 // object.box3.x912temp1 += 0x400000 // object.box3.y913temp2 = temp0914temp2 += 0x400000 // To the right915DrawArrow(temp0, temp1, temp2, temp1, 0xFF, 0xFF, 0xFF)916end if917end if918end event919920921event RSDKLoad922CheckCurrentStageFolder("Zone06")923if checkResult == true924LoadSpriteSheet("MCZ/Objects.gif")925SpriteFrame(-32, -32, 64, 64, 136, 1)926else927LoadSpriteSheet("MBZ/Objects.gif")928SpriteFrame(-32, -32, 64, 64, 797, 697)929end if930931AddEditorVariable("rotateDir")932SetActiveVariable("rotateDir")933AddEnumVariable("Clockwise", 0)934AddEnumVariable("Counter-Clockwise", 1)935936// A few crates have their direction attribute set too, reflecting how it was in the original Sonic 2,937// but that value doesn't matter in this remake938end event939940941