Path: blob/master/Sonic 2/Scripts/MPZ/LPlatform.txt
1479 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: L Platform Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer12private alias object.value1 : object.centerPos.y13private alias object.value2 : object.stoodPlayers14private alias object.value31 : object.wrapOffset.y1516// States17private alias 0 : LPLATFORM_IDLE18private alias 1 : LPLATFORM_SINKING19private alias 2 : LPLATFORM_SUNKEN2021// Player Aliases22private alias object.ypos : player.ypos23private alias object.gravity : player.gravity242526// ========================27// Function Declarations28// ========================2930reserve function LPlatform_DebugDraw31reserve function LPlatform_DebugSpawn323334// ========================35// Function Definitions36// ========================3738private function LPlatform_DebugDraw39DrawSprite(0)40end function414243private function LPlatform_DebugSpawn44CreateTempObject(TypeName[L Platform], 0, object.xpos, object.ypos)45object[tempObjectPos].centerPos.y = object[tempObjectPos].ypos46end function474849// ========================50// Events51// ========================5253event ObjectUpdate54temp0 = object.ypos55temp0 &= 0xFFFF00005657switch object.state58case LPLATFORM_IDLE59GetTableValue(temp6, 0, StageSetup_oscillationTable)60temp6 <<= 761object.ypos = object.centerPos.y62object.ypos -= temp663break6465case LPLATFORM_SINKING66object.ypos += object.yvel67object.yvel += 0x8006869if object.outOfBounds == true70object.ypos = object.centerPos.y71object.ypos += object.wrapOffset.y72object.yvel = 073object.timer = 074object.state++75end if76break7778case LPLATFORM_SUNKEN79if object.outOfBounds == true80object.state = LPLATFORM_IDLE81object.priority = PRIORITY_BOUNDS82end if83break8485end switch8687temp7 = object.ypos88temp7 &= 0xFFFF000089temp7 -= temp090if object.state < 291temp2 = 092foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)93GetBit(temp0, object.stoodPlayers, temp2)94if temp0 == true95player[currentPlayer].ypos += temp796end if9798SetBit(object.stoodPlayers, temp2, false)99BoxCollisionTest(C_SOLID, object.entityPos, -32, -12, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)100switch checkResult101case COL_TOP102SetBit(object.stoodPlayers, temp2, true)103if object.timer == 0104if object.state == LPLATFORM_IDLE105object.priority = PRIORITY_ACTIVE106object.state++107end if108end if109break110111case COL_BOTTOM112if player[currentPlayer].gravity == 0113CallFunction(Player_Kill)114end if115break116end switch117118temp2++119next120end if121end event122123124event ObjectDraw125if object.state < LPLATFORM_SUNKEN126DrawSprite(0)127end if128end event129130131event ObjectStartup132LoadSpriteSheet("MPZ/Objects.gif")133SpriteFrame(-32, -12, 64, 24, 383, 207)134135foreach (TypeName[L Platform], arrayPos0, ALL_ENTITIES)136object[arrayPos0].ypos += 0x100000137object[arrayPos0].centerPos.y = object[arrayPos0].ypos138next139140SetTableValue(TypeName[L Platform], DebugMode_ObjCount, DebugMode_TypesTable)141SetTableValue(LPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)142SetTableValue(LPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)143DebugMode_ObjCount++144end event145146147// ========================148// Editor Events149// ========================150151event RSDKDraw152DrawSprite(0)153end event154155156event RSDKLoad157LoadSpriteSheet("MPZ/Objects.gif")158SpriteFrame(-32, -12, 64, 24, 383, 207)159160SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")161end event162163164