Path: blob/master/Sonic 1/Scripts/Mission/MissionBlock.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: MissionBlock Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.propertyValue : object.disableCrush1213private alias object.value0 : object.ledgePullFlag // set from editor - determines if knuckles is able to pull himself up onto a block1415// Player Aliases16private alias object.state : player.state17private alias object.speed : player.speed18private alias object.xvel : player.xvel19private alias object.yvel : player.yvel20private alias object.gravity : player.gravity21private alias object.animation : player.animation22private alias object.frame : player.frame2324private alias object.value1 : player.timer25private alias object.value44 : player.missionBlockID2627// Reserved Object Slot Aliases28private alias 0 : SLOT_PLAYER1293031// ========================32// Events33// ========================3435event ObjectUpdate36CheckNotEqual(player[SLOT_PLAYER1].state, Player_State_Drown) // drowning is checked against but not death? if you really wanna, ig37temp0 = checkResult38CheckNotEqual(player[SLOT_PLAYER1].state, Player_State_LPullUp_Mission)39temp0 &= checkResult40CheckNotEqual(player[SLOT_PLAYER1].state, Player_State_LedgePullUp)41checkResult &= temp042if checkResult == true43BoxCollisionTest(C_SOLID, object.entityPos, -16, -16, 16, 16, SLOT_PLAYER1, C_BOX, C_BOX, C_BOX, C_BOX)44if player[SLOT_PLAYER1].state == Player_State_Climb_Mission45checkResult = COL_NONE46end if47if player[SLOT_PLAYER1].state == Player_State_Climb48checkResult = COL_NONE49end if5051if checkResult == COL_BOTTOM52if object.disableCrush == false // value set from editor53// ...it looks like this crush code was copied from SYZ's VBlock for some reason? it's not too hard to just make your own...5455if player[currentPlayer].gravity == GRAVITY_GROUND // btw currentPlayer is never set in this script56if object.angle > 384 // this object's angle is never set???57CallFunction(Player_Kill)58end if5960if object.angle < 128 // This object's angle is always 0 so this check always passes61CallFunction(Player_Kill)62end if63end if64end if65end if6667// Store what collision type the block got68temp0 = checkResult6970// See if the Player hit the left side of a block, while gliding right71CheckEqual(temp0, COL_LEFT)72temp1 = checkResult73CheckEqual(player[SLOT_PLAYER1].state, Player_State_GlideRight)74temp1 &= checkResult7576// And then see if the Player hit the right side of a block, while gliding left77CheckEqual(temp0, COL_RIGHT)78temp2 = checkResult79CheckEqual(player[SLOT_PLAYER1].state, Player_State_GlideLeft)80temp2 &= checkResult8182// See if either checks passed83temp1 |= temp284if temp1 != false85CheckEqual(object.ledgePullFlag, false) // value set from editor86temp0 = checkResult8788temp1 = object.ypos89temp1 -= 0x10000090CheckLower(temp1, object[SLOT_PLAYER1].ypos)91checkResult |= temp09293if checkResult != false94// Allow Knuckles to pull himself up this block9596player[SLOT_PLAYER1].animation = ANI_CLIMBING97player[SLOT_PLAYER1].frame = 098player[SLOT_PLAYER1].missionBlockID = TypeName[MissionBlock]99player[SLOT_PLAYER1].state = Player_State_Climb_Mission100player[SLOT_PLAYER1].speed = 0101player[SLOT_PLAYER1].xvel = 0102player[SLOT_PLAYER1].yvel = 0103player[SLOT_PLAYER1].timer = 0104105PlaySfx(SfxName[Catch], false)106end if107end if108end if109110// Little bit of code added in Origins Plus to make extra sure that the player's Mission Block ID is set111BoxCollisionTest(C_TOUCH, object.entityPos, -20, -20, 20, 20, SLOT_PLAYER1, C_BOX, C_BOX, C_BOX, C_BOX)112if checkResult != false113player[SLOT_PLAYER1].missionBlockID = TypeName[MissionBlock]114end if115end event116117118event ObjectDraw119DrawSprite(0)120end event121122123event ObjectStartup124// Load what's essentially the Labyrinth Zone sheet...125LoadSpriteSheet("Mission/Objects.gif")126127// And of course, only use a tiny portion of it128SpriteFrame(-16, -16, 32, 32, 1, 18)129end event130131132// ========================133// Editor Events134// ========================135136event RSDKEdit137if editor.returnVariable == true138switch editor.variableID139case EDIT_VAR_PROPVAL // property value140checkResult = object.propertyValue141break142143case 0 // disableCrush144CheckNotEqual(object.disableCrush, false)145break146147case 1 // ledgePullFlag148CheckNotEqual(object.ledgePullFlag, false)149break150151end switch152else153switch editor.variableID154case EDIT_VAR_PROPVAL // property value155object.propertyValue = editor.variableValue156break157158case 0 // disableCrush159object.disableCrush = editor.variableValue160break161162case 1 // ledgePullFlag163object.ledgePullFlag = editor.variableValue164break165166end switch167end if168end event169170171event RSDKDraw172DrawSprite(0)173end event174175176event RSDKLoad177LoadSpriteSheet("Mission/Objects.gif")178SpriteFrame(-16, -16, 32, 32, 1, 18)179180AddEditorVariable("disableCrush")181SetActiveVariable("disableCrush")182AddEnumVariable("False", false)183AddEnumVariable("True", true)184185AddEditorVariable("ledgePullFlag")186SetActiveVariable("ledgePullFlag")187AddEnumVariable("False", false)188AddEnumVariable("True", true)189end event190191192