Path: blob/master/Sonic 2/Scripts/MPZ/MPlatform.txt
1478 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: M 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.tablePos13private alias object.value2 : object.centerPos.x14private alias object.value3 : object.centerPos.y15private alias object.value4 : object.stoodPlayers16private alias object.value31 : object.wrapOffset.y1718// Player Aliases19private alias object.xpos : player.xpos20private alias object.ypos : player.ypos212223// ========================24// Function Declarations25// ========================2627reserve function MPlatform_Setup28reserve function MPlatform_DebugDraw29reserve function MPlatform_DebugSpawn303132// ========================33// Tables34// ========================3536private table MPlatform_XVelTable370380x4000039040-0x4000041end table4243private table MPlatform_YVelTable440x4000045-0x20000460x4000047-0x2000048end table4950private table MPlatform_durationTable511652325316543255end table565758// ========================59// Function Definitions60// ========================6162private function MPlatform_Setup63object[arrayPos0].priority = PRIORITY_ACTIVE64object[arrayPos0].timer = 065object[arrayPos0].tablePos = 066object[arrayPos0].xpos = object[arrayPos0].centerPos.x67object[arrayPos0].ypos = object[arrayPos0].centerPos.y68object[arrayPos0].ypos += object[arrayPos0].wrapOffset.y69object[arrayPos0].stoodPlayers = 070end function717273private function MPlatform_DebugDraw74DrawSprite(0)75end function767778private function MPlatform_DebugSpawn79CreateTempObject(TypeName[M Platform], 0, object.xpos, object.ypos)80arrayPos0 = object[tempObjectPos].entityPos81object[arrayPos0].centerPos.x = object.xpos82object[arrayPos0].centerPos.y = object.ypos83CallFunction(MPlatform_Setup)84end function858687// ========================88// Events89// ========================9091event ObjectUpdate92object.xpos += object.xvel93object.ypos += object.yvel9495temp0 = 096temp1 = 097temp2 = 098foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)99GetBit(temp3, object.stoodPlayers, temp2)100if temp3 == true101player[currentPlayer].xpos += object.xvel102player[currentPlayer].ypos += object.yvel103temp1 = true104end if105106SetBit(object.stoodPlayers, temp2, false)107BoxCollisionTest(C_SOLID, object.entityPos, -32, -12, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)108if checkResult == COL_TOP109temp0 = true110SetBit(object.stoodPlayers, temp2, true)111end if112113temp2++114next115116if object.timer == 0117if temp0 == false118if temp1 == true119GetTableValue(object.xvel, object.tablePos, MPlatform_XVelTable)120GetTableValue(object.yvel, object.tablePos, MPlatform_YVelTable)121GetTableValue(object.timer, object.tablePos, MPlatform_durationTable)122object.tablePos++123object.tablePos &= 3124end if125end if126else127object.timer--128if object.timer == 0129object.xvel = 0130object.yvel = 0131end if132end if133end event134135136event ObjectDraw137DrawSprite(0)138end event139140141event ObjectStartup142LoadSpriteSheet("MPZ/Objects.gif")143SpriteFrame(-32, -12, 64, 24, 383, 207)144145foreach (TypeName[M Platform], arrayPos0, ALL_ENTITIES)146object[arrayPos0].centerPos.x = object[arrayPos0].xpos147object[arrayPos0].centerPos.y = object[arrayPos0].ypos148CallFunction(MPlatform_Setup)149next150151SetTableValue(TypeName[M Platform], DebugMode_ObjCount, DebugMode_TypesTable)152SetTableValue(MPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)153SetTableValue(MPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)154DebugMode_ObjCount++155end event156157158// ========================159// Editor Events160// ========================161162event RSDKDraw163DrawSprite(0)164end event165166167event RSDKLoad168LoadSpriteSheet("MPZ/Objects.gif")169SpriteFrame(-32, -12, 64, 24, 383, 207)170171SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")172end event173174175