Path: blob/master/Sonic 1/Scripts/LZ/RisingPlatform.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Rising Platform Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.stood12private alias object.value1 : object.collisionOffset.y13private alias object.value2 : object.timer14private alias object.value3 : object.startPos.y15private alias object.value4 : object.stoodAngle1617private alias 0 : RISINGPLATFORM_IDLE18private alias 1 : RISINGPLATFORM_MOVING19private alias 2 : RISINGPLATFORM_RETURNTOSTART20private alias 3 : RISINGPLATFORM_OOB2122// Player Aliases23private alias object.xpos : player.xpos24private alias object.ypos : player.ypos2526// Path ID Aliases27private alias 0 : PATH_A282930// ========================31// Function Declarations32// ========================3334reserve function RisingPlatform_DebugDraw35reserve function RisingPlatform_DebugSpawn363738// ========================39// Tables40// ========================4142private function RisingPlatform_DebugDraw43DrawSprite(0)44end function454647private function RisingPlatform_DebugSpawn48CreateTempObject(TypeName[Rising Platform], 0, object.xpos, object.ypos)49object[tempObjectPos].startPos.y = object.ypos50object[tempObjectPos].drawOrder = 451end function525354// ========================55// Events56// ========================5758event ObjectUpdate59if object.stood == true60if object.timer == 061object.timer = 3062end if6364if object.stoodAngle < 6465object.stoodAngle += 466end if67else68if object.stoodAngle > 069object.stoodAngle -= 470end if71end if7273temp0 = object.ypos74temp0 &= 0xFFFF000075switch object.state76case RISINGPLATFORM_IDLE77temp1 = object.stoodAngle78temp1 <<= 179Sin(temp2, temp1)80temp2 <<= 981object.ypos = object.startPos.y82object.ypos += temp28384if object.timer != 085object.timer--86if object.timer == 087object.state++88object.priority = PRIORITY_ACTIVE89end if90end if91break9293case RISINGPLATFORM_MOVING94object.ypos += object.yvel95object.yvel -= 0x80096ObjectTileCollision(CSIDE_ROOF, 0, -12, PATH_A)97if checkResult == true98object.state++99end if100101if object.outOfBounds == true102object.ypos = object.startPos.y103object.yvel = 0104object.timer = 0105object.state = RISINGPLATFORM_OOB106end if107break108109case RISINGPLATFORM_RETURNTOSTART110if object.outOfBounds == true111object.ypos = object.startPos.y112object.yvel = 0113object.timer = 0114object.state++115end if116break117118case RISINGPLATFORM_OOB119if object.outOfBounds == true120object.state = RISINGPLATFORM_IDLE121object.priority = PRIORITY_BOUNDS122end if123break124125end switch126127object.collisionOffset.y = object.ypos128object.collisionOffset.y &= 0xFFFF0000129object.collisionOffset.y -= temp0130object.stood = false131132if object.state < RISINGPLATFORM_OOB133temp1 = object.ypos134object.ypos = temp0135foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)136BoxCollisionTest(C_SOLID, object.entityPos, -32, -12, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)137if checkResult == COL_TOP138object.stood = true139player[currentPlayer].ypos += object.collisionOffset.y140end if141next142object.ypos = temp1143end if144end event145146147event ObjectDraw148if object.state < RISINGPLATFORM_OOB149DrawSprite(0)150end if151end event152153154event ObjectStartup155LoadSpriteSheet("LZ/Objects.gif")156SpriteFrame(-32, -12, 64, 24, 126, 137)157158foreach (TypeName[Rising Platform], arrayPos0, ALL_ENTITIES)159object[arrayPos0].startPos.y = object[arrayPos0].ypos160object[arrayPos0].drawOrder = 4161next162163SetTableValue(TypeName[Rising Platform], DebugMode_ObjCount, DebugMode_TypesTable)164SetTableValue(RisingPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)165SetTableValue(RisingPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)166DebugMode_ObjCount++167end event168169170// ========================171// Editor Events172// ========================173174event RSDKDraw175DrawSprite(0)176end event177178179event RSDKLoad180LoadSpriteSheet("LZ/Objects.gif")181SpriteFrame(-32, -12, 64, 24, 126, 137)182183SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")184end event185186187