Path: blob/master/Sonic 2/Scripts/ARZ/VPlatform.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: V Platform Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.centerPos.y12private alias object.value1 : object.collisionOffset.y1314// Player Aliases15private alias object.ypos : player.ypos161718// ========================19// Function Declarations20// ========================2122reserve function VPlatform_DebugDraw23reserve function VPlatform_DebugSpawn242526// ========================27// Function Definitions28// ========================2930private function VPlatform_DebugDraw31DrawSprite(0)32end function333435private function VPlatform_DebugSpawn36CreateTempObject(TypeName[V Platform], 0, object.xpos, object.ypos)37object[tempObjectPos].centerPos.y = object.ypos38object[tempObjectPos].propertyValue = object.direction39end function404142// ========================43// Events44// ========================4546event ObjectUpdate47temp7 = object.ypos4849GetTableValue(temp0, 12, StageSetup_oscillationTable)50if object.propertyValue == 151FlipSign(temp0)52temp0 += 0x400053else54temp0 -= 0x400055end if56temp0 <<= 85758object.ypos = object.centerPos.y59object.ypos -= temp06061temp1 = object.ypos62temp7 &= 0xFFFF000063object.collisionOffset.y = object.ypos64object.collisionOffset.y &= 0xFFFF000065object.collisionOffset.y -= temp76667object.ypos = temp768foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)69BoxCollisionTest(C_PLATFORM, object.entityPos, -32, -8, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)70if checkResult == true71player[currentPlayer].ypos += object.collisionOffset.y72end if73next74object.ypos = temp175end event767778event ObjectDraw79DrawSprite(0)80end event818283event ObjectStartup84LoadSpriteSheet("ARZ/Objects.gif")85SpriteFrame(-32, -13, 64, 45, 126, 145)8687foreach (TypeName[V Platform], arrayPos0, ALL_ENTITIES)88object[arrayPos0].centerPos.y = object[arrayPos0].ypos89next9091SetTableValue(TypeName[V Platform], DebugMode_ObjCount, DebugMode_TypesTable)92SetTableValue(VPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)93SetTableValue(VPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)94DebugMode_ObjCount++95end event969798// ========================99// Editor Events100// ========================101102event RSDKEdit103if editor.returnVariable == true104switch editor.variableID105case EDIT_VAR_PROPVAL // property value106checkResult = object.propertyValue107break108109case 0 // startDir110checkResult = object.propertyValue111break112end switch113else114switch editor.variableID115case EDIT_VAR_PROPVAL // property value116object.propertyValue = editor.variableValue117break118119case 0 // startDir120object.propertyValue = editor.variableValue121break122end switch123end if124end event125126127event RSDKDraw128DrawSprite(0)129end event130131132event RSDKLoad133LoadSpriteSheet("ARZ/Objects.gif")134SpriteFrame(-32, -13, 64, 45, 126, 145)135136AddEditorVariable("startDir")137SetActiveVariable("startDir")138AddEnumVariable("Up", 0)139AddEnumVariable("Down", 1)140end event141142143