Path: blob/master/Sonic 2/Scripts/MPZ/EPlatform.txt
1478 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: E Platform Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.fallVelocity12private alias object.value1 : object.centerPos.y13private alias object.value3 : object.stoodPlayers14private alias object.value31 : object.wrapOffset.y1516// States17private alias 0 : EPLATFORM_ERUPTING18private alias 1 : EPLATFORM_FALLING1920// Player Aliases21private alias object.ypos : player.ypos22private alias object.gravity : player.gravity232425// ========================26// Function Declarations27// ========================2829reserve function EPlatform_DebugDraw30reserve function EPlatform_DebugSpawn313233// ========================34// Function Definitions35// ========================3637private function EPlatform_DebugDraw38DrawSprite(0)39end function404142private function EPlatform_DebugSpawn43CreateTempObject(TypeName[E Platform], 0, object.xpos, object.ypos)44object[tempObjectPos].centerPos.y = object[tempObjectPos].ypos45end function464748// ========================49// Events50// ========================5152event ObjectUpdate53temp0 = object.ypos54temp0 &= 0xFFFF00005556switch object.state57case EPLATFORM_ERUPTING58if object.fallVelocity != 059object.ypos += object.yvel60if object.yvel == 0x2A80061FlipSign(object.fallVelocity)62end if6364object.yvel += object.fallVelocity65if object.yvel == 066object.fallVelocity = 067object.state++68end if69end if70break7172case EPLATFORM_FALLING73if object.outOfBounds == true74temp0 = object.ypos75object.ypos = object.centerPos.y76object.ypos += object.wrapOffset.y7778if object.outOfBounds == true79object.state = EPLATFORM_ERUPTING80object.priority = PRIORITY_BOUNDS81object.yvel = 082object.fallVelocity = 083object.stoodPlayers = 084else85object.ypos = temp086end if87end if88break8990end switch9192temp7 = object.ypos93temp7 &= 0xFFFF000094temp7 -= temp09596temp2 = 097foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)98GetBit(temp0, object.stoodPlayers, temp2)99if temp0 == true100player[currentPlayer].ypos += temp7101end if102103SetBit(object.stoodPlayers, temp2, false)104BoxCollisionTest(C_SOLID, object.entityPos, -32, -12, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)105switch checkResult106case COL_TOP107SetBit(object.stoodPlayers, temp2, true)108if object.state == EPLATFORM_ERUPTING109if object.fallVelocity == 0110object.priority = PRIORITY_ACTIVE111object.fallVelocity = 0x800112end if113end if114break115116case COL_BOTTOM117if player[currentPlayer].gravity == GRAVITY_GROUND118CallFunction(Player_Kill)119end if120break121122end switch123124temp2++125next126end event127128129event ObjectDraw130DrawSprite(0)131end event132133134event ObjectStartup135LoadSpriteSheet("MPZ/Objects.gif")136SpriteFrame(-32, -12, 64, 24, 383, 207)137138foreach (TypeName[E Platform], arrayPos0, ALL_ENTITIES)139object[arrayPos0].centerPos.y = object[arrayPos0].ypos140next141142SetTableValue(TypeName[E Platform], DebugMode_ObjCount, DebugMode_TypesTable)143SetTableValue(EPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)144SetTableValue(EPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)145DebugMode_ObjCount++146end event147148149// ========================150// Editor Events151// ========================152153event RSDKDraw154DrawSprite(0)155end event156157158event RSDKLoad159LoadSpriteSheet("MPZ/Objects.gif")160SpriteFrame(-32, -12, 64, 24, 383, 207)161162SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")163end event164165166