Path: blob/master/Sonic 2/Scripts/CNZ/BossWall.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Boss Wall Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.propertyValue : object.startClosed1213private alias object.value2 : object.startPos.y14private alias object.value3 : object.targetPos.y1516// States17private alias 0 : CNZBOSSWALL_IDLE18private alias 1 : CNZBOSSWALL_APPEAR19private alias 2 : CNZBOSSWALL_ADDWALL20private alias 3 : CNZBOSSWALL_DELWALL21private alias 4 : CNZBOSSWALL_DISAPPEAR222324// ========================25// Static Values26// ========================2728private value BossWall_wallChunkID = 029private value BossWall_blankChunkID = 0303132// ========================33// Events34// ========================3536event ObjectUpdate37switch object.state38case CNZBOSSWALL_IDLE39object.priority = PRIORITY_BOUNDS40break4142case CNZBOSSWALL_APPEAR43object.yvel += 0x600044object.ypos += object.yvel45if object.ypos > object.targetPos.y46object.ypos = object.targetPos.y47object.state++48end if49break5051case CNZBOSSWALL_ADDWALL52temp0 = object.xpos53temp0 >>= 2354temp1 = object.ypos55temp1 >>= 2356SetTileLayerEntry(BossWall_wallChunkID, 0, temp0, temp1)57object.state = CNZBOSSWALL_IDLE58break5960case CNZBOSSWALL_DELWALL61temp0 = object.xpos62temp0 >>= 2363temp1 = object.ypos64temp1 >>= 2365SetTileLayerEntry(BossWall_blankChunkID, 0, temp0, temp1)66object.state++67break6869case CNZBOSSWALL_DISAPPEAR70object.yvel -= 0x600071object.ypos += object.yvel72if object.ypos < object.startPos.y73object.ypos = object.startPos.y74object.state = CNZBOSSWALL_IDLE75end if76break7778end switch79end event808182event ObjectDraw83switch object.state84default85case CNZBOSSWALL_IDLE86case CNZBOSSWALL_DELWALL87break8889case CNZBOSSWALL_APPEAR90case CNZBOSSWALL_ADDWALL91case CNZBOSSWALL_DISAPPEAR92DrawSprite(0)93break9495end switch96end event979899event ObjectStartup100CheckCurrentStageFolder("Zone04")101if checkResult == true102LoadSpriteSheet("CNZ/Objects.gif")103SpriteFrame(-64, -64, 128, 128, 127, 256)104BossWall_wallChunkID = 249105BossWall_blankChunkID = 221106else107LoadSpriteSheet("MBZ/Objects.gif")108SpriteFrame(-64, -64, 128, 128, 716, 358)109BossWall_wallChunkID = 191110BossWall_blankChunkID = 162111end if112113foreach (TypeName[Boss Wall], arrayPos0, ALL_ENTITIES)114object[arrayPos0].drawOrder = 4115object[arrayPos0].startPos.y = object[arrayPos0].ypos116object[arrayPos0].targetPos.y = object[arrayPos0].ypos117object[arrayPos0].targetPos.y += 0x800000118119if object[arrayPos0].startClosed == true120object[arrayPos0].ypos = object[arrayPos0].targetPos.y121temp0 = object[arrayPos0].xpos122temp0 >>= 23123temp1 = object[arrayPos0].ypos124temp1 >>= 23125SetTileLayerEntry(BossWall_wallChunkID, 0, temp0, temp1)126end if127next128end event129130131// ========================132// Editor Events133// ========================134135event RSDKEdit136if editor.returnVariable == true137switch editor.variableID138case EDIT_VAR_PROPVAL // property value139checkResult = object.propertyValue140break141142case 0 // type143checkResult = object.propertyValue144break145146end switch147else148switch editor.variableID149case EDIT_VAR_PROPVAL // property value150object.propertyValue = editor.variableValue151break152153case 0 // type154object.propertyValue = editor.variableValue155break156157end switch158end if159end event160161162event RSDKDraw163DrawSprite(0)164165if editor.showGizmos == true166editor.drawingOverlay = true167168// Draw where the Boss Wall will be when it's in its closed state169170object.inkEffect = INK_BLEND171172temp0 = object.ypos173temp0 += 0x800000174DrawSpriteFX(0, FX_INK, object.xpos, temp0)175176// Draw an arrow to indicate the Wall's movement177object.inkEffect = INK_NONE178DrawArrow(object.xpos, object.ypos, object.xpos, temp0, 255, 255, 0)179180editor.drawingOverlay = false181end if182end event183184185event RSDKLoad186CheckCurrentStageFolder("Zone04")187if checkResult == true188LoadSpriteSheet("CNZ/Objects.gif")189SpriteFrame(-64, -64, 128, 128, 127, 256)190else191LoadSpriteSheet("MBZ/Objects.gif")192SpriteFrame(-64, -64, 128, 128, 716, 358)193end if194195AddEditorVariable("type")196SetActiveVariable("type")197AddEnumVariable("Start Open", 0)198AddEnumVariable("Start Closed", 1)199end event200201202