Path: blob/master/Sonic 1/Scripts/SLZ/BreakWall.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Breakable Wall Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------678// Player Aliases9private alias object.state : player.state10private alias object.xpos : player.xpos11private alias object.speed : player.speed12private alias object.direction : player.direction13private alias object.animation : player.animation14private alias object.value40 : player.hitboxLeft15private alias object.value38 : player.hitboxTop16private alias object.value41 : player.hitboxRight17private alias object.value39 : player.hitboxBottom18private alias object.value16 : player.isSidekick1920// Super States21private alias 1 : SUPERSTATE_SUPER222324// ========================25// Function Declarations26// ========================2728reserve function BreakableWall_DebugDraw29reserve function BreakableWall_DebugSpawn303132// ========================33// Function Definitions34// ========================3536private function BreakableWall_DebugDraw37DrawSprite(0)38end function394041private function BreakableWall_DebugSpawn42CreateTempObject(TypeName[Breakable Wall], false, object.xpos, object.ypos)43object[tempObjectPos].propertyValue = false44object[tempObjectPos].drawOrder = 445end function464748// ========================49// Events50// ========================5152event ObjectUpdate53if object.propertyValue == true54object.xpos += object.xvel55object.ypos += object.yvel56object.yvel += 0x700057if object.outOfBounds == true58object.type = TypeName[Blank Object]59end if60else61foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)62checkResult = false6364if player[currentPlayer].state == Player_State_Roll65if player[currentPlayer].speed >= 0x4800066checkResult = true67end if68if player[currentPlayer].speed <= -0x4800069checkResult = true70end if71end if7273if stage.playerListPos == PLAYER_KNUCKLES_A74checkResult = true75end if7677if Player_superState == SUPERSTATE_SUPER78checkResult = true79end if80#platform: USE_STANDALONE81if checkResult == true82BoxCollisionTest(C_TOUCH, object.entityPos, -17, -32, 17, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)83#endplatform8485#platform: USE_ORIGINS86if stage.playerListPos == PLAYER_AMY87if player[currentPlayer].isSidekick == false88if player[currentPlayer].animation == ANI_HAMMER_JUMP89checkResult = 290end if91if player[currentPlayer].animation == ANI_HAMMER_DASH92checkResult = 293end if94end if95end if96if checkResult != 097switch checkResult98case 199BoxCollisionTest(C_TOUCH, object.entityPos, -17, -32, 17, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)100break101case 2102BoxCollisionTest(C_TOUCH, object.entityPos, -17, -32, 17, 32, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)103break104end switch105#endplatform106if checkResult == true107object.type = TypeName[Blank Object]108PlaySfx(SfxName[Block Break], false)109temp2 = object.xpos110temp2 -= 0x80000111temp3 = object.xpos112temp3 += 0x80000113temp4 = object.ypos114temp4 -= 0x180000115if player[currentPlayer].xpos < object.xpos116CreateTempObject(TypeName[Breakable Wall], true, temp2, temp4)117object[tempObjectPos].xvel = -0x60000118object[tempObjectPos].yvel = -0x60000119object[tempObjectPos].drawOrder = 4120121CreateTempObject(TypeName[Breakable Wall], true, temp3, temp4)122object[tempObjectPos].xvel = -0x40000123object[tempObjectPos].yvel = -0x50000124object[tempObjectPos].drawOrder = 4125temp4 += 0x100000126127CreateTempObject(TypeName[Breakable Wall], true, temp2, temp4)128object[tempObjectPos].xvel = -0x80000129object[tempObjectPos].yvel = -0x20000130object[tempObjectPos].drawOrder = 4131132CreateTempObject(TypeName[Breakable Wall], true, temp3, temp4)133object[tempObjectPos].xvel = -0x60000134object[tempObjectPos].yvel = -0x10000135object[tempObjectPos].drawOrder = 4136temp4 += 0x100000137138CreateTempObject(TypeName[Breakable Wall], true, temp2, temp4)139object[tempObjectPos].xvel = -0x80000140object[tempObjectPos].yvel = 0x20000141object[tempObjectPos].drawOrder = 4142143CreateTempObject(TypeName[Breakable Wall], true, temp3, temp4)144object[tempObjectPos].xvel = -0x60000145object[tempObjectPos].yvel = 0x10000146object[tempObjectPos].drawOrder = 4147temp4 += 0x100000148149CreateTempObject(TypeName[Breakable Wall], true, temp2, temp4)150object[tempObjectPos].xvel = -0x60000151object[tempObjectPos].yvel = 0x60000152object[tempObjectPos].drawOrder = 4153154CreateTempObject(TypeName[Breakable Wall], true, temp3, temp4)155object[tempObjectPos].xvel = -0x40000156object[tempObjectPos].yvel = 0x50000157object[tempObjectPos].drawOrder = 4158else159CreateTempObject(TypeName[Breakable Wall], true, temp2, temp4)160object[tempObjectPos].xvel = 0x40000161object[tempObjectPos].yvel = -0x50000162object[tempObjectPos].drawOrder = 4163164CreateTempObject(TypeName[Breakable Wall], true, temp3, temp4)165object[tempObjectPos].xvel = 0x60000166object[tempObjectPos].yvel = -0x60000167object[tempObjectPos].drawOrder = 4168temp4 += 0x100000169170CreateTempObject(TypeName[Breakable Wall], true, temp2, temp4)171object[tempObjectPos].xvel = 0x60000172object[tempObjectPos].yvel = -0x10000173object[tempObjectPos].drawOrder = 4174175CreateTempObject(TypeName[Breakable Wall], true, temp3, temp4)176object[tempObjectPos].xvel = 0x80000177object[tempObjectPos].yvel = -0x20000178object[tempObjectPos].drawOrder = 4179temp4 += 0x100000180181CreateTempObject(TypeName[Breakable Wall], true, temp2, temp4)182object[tempObjectPos].xvel = 0x60000183object[tempObjectPos].yvel = 0x10000184object[tempObjectPos].drawOrder = 4185186CreateTempObject(TypeName[Breakable Wall], true, temp3, temp4)187object[tempObjectPos].xvel = 0x80000188object[tempObjectPos].yvel = 0x20000189object[tempObjectPos].drawOrder = 4190temp4 += 0x100000191192CreateTempObject(TypeName[Breakable Wall], true, temp2, temp4)193object[tempObjectPos].xvel = 0x40000194object[tempObjectPos].yvel = 0x50000195object[tempObjectPos].drawOrder = 4196197CreateTempObject(TypeName[Breakable Wall], true, temp3, temp4)198object[tempObjectPos].xvel = 0x60000199object[tempObjectPos].yvel = 0x60000200object[tempObjectPos].drawOrder = 4201end if202203if player[currentPlayer].animation == ANI_GLIDING204player[currentPlayer].animation = ANI_GLIDING_DROP205player[currentPlayer].state = Player_State_GlideDrop206if player[currentPlayer].direction == 1207FlipSign(player[currentPlayer].speed)208end if209end if210end if211else212BoxCollisionTest(C_SOLID, object.entityPos, -16, -32, 16, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)213end if214next215end if216end event217218219event ObjectDraw220DrawSprite(object.propertyValue)221end event222223224event ObjectStartup225LoadSpriteSheet("SLZ/Objects.gif")226227arrayPos0 = 32228while arrayPos0 < 0x420229if object[arrayPos0].type == TypeName[Breakable Wall]230// LOL its forced to 0 to make sure you dont spawn tiles accidently231object[arrayPos0].propertyValue = false232object[arrayPos0].drawOrder = 4233end if234arrayPos0++235loop236237SpriteFrame(-16, -32, 32, 64, 34, 26)238SpriteFrame(-8, -8, 16, 16, 34, 26)239240SetTableValue(TypeName[Breakable Wall], DebugMode_ObjCount, DebugMode_TypesTable)241SetTableValue(BreakableWall_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)242SetTableValue(BreakableWall_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)243DebugMode_ObjCount++244end event245246247// ========================248// Editor Events249// ========================250251event RSDKDraw252DrawSprite(0)253end event254255256event RSDKLoad257LoadSpriteSheet("SLZ/Objects.gif")258SpriteFrame(-16, -32, 32, 64, 34, 26)259260// I think it actually uses the same values as the GHZ one, but its always "middle", so idc261SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")262end event263264265