Path: blob/master/Sonic 2/Scripts/HTZ/VPlatform2.txt
1479 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: V Platform 2 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 VPlatform2_DebugDraw23reserve function VPlatform2_DebugSpawn242526// ========================27// Function Definitions28// ========================2930private function VPlatform2_DebugDraw31DrawSprite(0)32end function333435private function VPlatform2_DebugSpawn36CreateTempObject(TypeName[V Platform 2], 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 <<= 75758object.ypos = object.centerPos.y59object.ypos -= temp06061temp1 = object.ypos62temp7 &= 0xFFFF000063object.collisionOffset.y = object.ypos64object.collisionOffset.y &= 0xFFFF000065object.collisionOffset.y -= temp76667// Backup the object's position and temporarily move it for collision checks68object.ypos = temp769foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)70BoxCollisionTest(C_SOLID2, object.entityPos, -32, -48, 32, 48, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)71if checkResult == COL_TOP72player[currentPlayer].ypos += object.collisionOffset.y73end if74next75object.ypos = temp176end event777879event ObjectDraw80DrawSprite(0)81end event828384event ObjectStartup85LoadSpriteSheet("HTZ/Objects.gif")86SpriteFrame(-32, -52, 64, 96, 191, 126)8788foreach (TypeName[V Platform 2], arrayPos0, ALL_ENTITIES)89object[arrayPos0].centerPos.y = object[arrayPos0].ypos90next9192SetTableValue(TypeName[V Platform 2], DebugMode_ObjCount, DebugMode_TypesTable)93SetTableValue(VPlatform2_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)94SetTableValue(VPlatform2_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)95DebugMode_ObjCount++96end event979899// ========================100// Editor Events101// ========================102103event RSDKEdit104if editor.returnVariable == true105switch editor.variableID106case EDIT_VAR_PROPVAL // property value107checkResult = object.propertyValue108break109110case 0 // startDir111checkResult = object.propertyValue112checkResult &= 1113break114115end switch116else117switch editor.variableID118case EDIT_VAR_PROPVAL // property value119object.propertyValue = editor.variableValue120break121122case 0 // startDir123object.propertyValue = editor.variableValue124object.propertyValue &= 1125break126127end switch128end if129end event130131132event RSDKDraw133DrawSprite(0)134end event135136137event RSDKLoad138LoadSpriteSheet("HTZ/Objects.gif")139SpriteFrame(-32, -52, 64, 96, 191, 126)140141AddEditorVariable("startDir")142SetActiveVariable("startDir")143AddEnumVariable("Up", 0)144AddEnumVariable("Down", 1)145end event146147148