Path: blob/master/Sonic 2/Scripts/MPZ/HPlatform.txt
1478 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: H Platform Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.centerPos.x12private alias object.value1 : object.stoodPlayers1314// Player Aliases15private alias object.state : player.state16private alias object.xpos : player.xpos17private alias object.gravity : player.gravity18private alias object.animation : player.animation1920private alias object.value1 : player.timer2122// ========================23// Function Declarations24// ========================2526reserve function HPlatform_DebugDraw27reserve function HPlatform_DebugSpawn282930// ========================31// Function Defintions32// ========================3334private function HPlatform_DebugDraw35DrawSprite(0)36end function373839private function HPlatform_DebugSpawn40CreateTempObject(TypeName[H Platform], 0, object.xpos, object.ypos)41object[tempObjectPos].centerPos.x = object.xpos42object[tempObjectPos].propertyValue = object.direction43end function444546// ========================47// Events48// ========================4950event ObjectUpdate51temp6 = object.xpos52GetTableValue(temp0, 4, StageSetup_oscillationTable)53if object.propertyValue == 154FlipSign(temp0)55temp0 += 0x400056end if57temp0 <<= 85859object.xpos = object.centerPos.x60object.xpos -= temp061temp6 &= 0xFFFF000062temp7 = object.xpos63temp7 &= 0xFFFF000064temp7 -= temp66566temp2 = 067foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)68GetBit(temp0, object.stoodPlayers, temp2)69if temp0 == true70player[currentPlayer].xpos += temp771end if7273SetBit(object.stoodPlayers, temp2, false)74BoxCollisionTest(C_SOLID, object.entityPos, -32, -12, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)75switch checkResult76case COL_TOP77SetBit(object.stoodPlayers, temp2, true)78break7980case COL_LEFT81case COL_RIGHT82if player[currentPlayer].state == Player_State_Climb83player[currentPlayer].timer = 084player[currentPlayer].animation = ANI_GLIDING_DROP85player[currentPlayer].state = Player_State_GlideDrop86end if87break8889case COL_BOTTOM90if player[currentPlayer].gravity == GRAVITY_GROUND91CallFunction(Player_Kill)92end if93break9495end switch9697temp2++98next99end event100101102event ObjectDraw103DrawSprite(0)104end event105106107event ObjectStartup108LoadSpriteSheet("MPZ/Objects.gif")109SpriteFrame(-32, -12, 64, 24, 383, 207)110111foreach (TypeName[H Platform], arrayPos0, ALL_ENTITIES)112object[arrayPos0].centerPos.x = object[arrayPos0].xpos113next114115SetTableValue(TypeName[H Platform], DebugMode_ObjCount, DebugMode_TypesTable)116SetTableValue(HPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)117SetTableValue(HPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)118DebugMode_ObjCount++119end event120121122// ========================123// Editor Events124// ========================125126event RSDKEdit127if editor.returnVariable == true128switch editor.variableID129case EDIT_VAR_PROPVAL // property value130checkResult = object.propertyValue131break132133case 0 // startDir134checkResult = object.propertyValue135break136137end switch138else139switch editor.variableID140case EDIT_VAR_PROPVAL // property value141object.propertyValue = editor.variableValue142break143144case 0 // startDir145object.propertyValue = editor.variableValue146break147148end switch149end if150end event151152153event RSDKDraw154DrawSprite(0)155end event156157158event RSDKLoad159LoadSpriteSheet("MPZ/Objects.gif")160SpriteFrame(-32, -12, 64, 24, 383, 207)161162AddEditorVariable("startDir")163SetActiveVariable("startDir")164AddEnumVariable("Left", 0)165AddEnumVariable("Right", 1)166end event167168169