Path: blob/master/Sonic 2/Scripts/MPZ/HPlatform2.txt
1478 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: H Platform 2 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 HPlatform2_DebugDraw27reserve function HPlatform2_DebugSpawn282930// ========================31// Function Definitions32// ========================3334private function HPlatform2_DebugDraw35DrawSprite(0)36end function373839private function HPlatform2_DebugSpawn40CreateTempObject(TypeName[H Platform 2], 0, object.xpos, object.ypos)41object[tempObjectPos].centerPos.x = object.xpos42object[tempObjectPos].propertyValue = object.direction43end function444546// ========================47// Events48// ========================4950event ObjectUpdate51temp6 = object.xpos5253GetTableValue(temp0, 14, StageSetup_oscillationTable)54if object.propertyValue == 155FlipSign(temp0)56temp0 += 0x800057end if58temp0 <<= 85960object.xpos = object.centerPos.x61object.xpos -= temp062temp6 &= 0xFFFF000063temp7 = object.xpos64temp7 &= 0xFFFF000065temp7 -= temp66667temp2 = 068foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)69GetBit(temp0, object.stoodPlayers, temp2)70if temp0 == true71player[currentPlayer].xpos += temp772end if7374SetBit(object.stoodPlayers, temp2, false)75BoxCollisionTest(C_SOLID, object.entityPos, -32, -12, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)76switch checkResult77case COL_TOP78SetBit(object.stoodPlayers, temp2, true)79break8081case COL_LEFT82case COL_RIGHT83if player[currentPlayer].state == Player_State_Climb84player[currentPlayer].timer = 085player[currentPlayer].animation = ANI_GLIDING_DROP86player[currentPlayer].state = Player_State_GlideDrop87end if88break8990case COL_BOTTOM91if player[currentPlayer].gravity == GRAVITY_GROUND92CallFunction(Player_Kill)93end if94break9596end switch9798temp2++99next100end event101102103event ObjectDraw104DrawSprite(0)105end event106107108event ObjectStartup109LoadSpriteSheet("MPZ/Objects.gif")110SpriteFrame(-32, -12, 64, 24, 383, 207)111112foreach (TypeName[H Platform 2], arrayPos0, ALL_ENTITIES)113object[arrayPos0].centerPos.x = object[arrayPos0].xpos114next115116SetTableValue(TypeName[H Platform 2], DebugMode_ObjCount, DebugMode_TypesTable)117SetTableValue(HPlatform2_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)118SetTableValue(HPlatform2_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)119DebugMode_ObjCount++120end event121122123// ========================124// Editor Events125// ========================126127event RSDKEdit128if editor.returnVariable == true129switch editor.variableID130case EDIT_VAR_PROPVAL // property value131checkResult = object.propertyValue132break133134case 0 // startDir135checkResult = object.propertyValue136break137138end switch139else140switch editor.variableID141case EDIT_VAR_PROPVAL // property value142object.propertyValue = editor.variableValue143break144145case 0 // startDir146object.propertyValue = editor.variableValue147break148149end switch150end if151end event152153154event RSDKDraw155DrawSprite(0)156end event157158159event RSDKLoad160LoadSpriteSheet("MPZ/Objects.gif")161SpriteFrame(-32, -12, 64, 24, 383, 207)162163AddEditorVariable("startDir")164SetActiveVariable("startDir")165AddEnumVariable("Left", 0)166AddEnumVariable("Right", 1)167end event168169170