Path: blob/master/Sonic 1/Scripts/GHZ/VPlatform2.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// 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 -= temp060temp1 = object.ypos61temp7 &= 0xFFFF000062object.collisionOffset.y = object.ypos63object.collisionOffset.y &= 0xFFFF000064object.collisionOffset.y -= temp765object.ypos = temp76667foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)68BoxCollisionTest(C_PLATFORM, object.entityPos, -32, -2, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)69if checkResult == true70player[currentPlayer].ypos += object.collisionOffset.y71end if72next7374object.ypos = temp175end event767778event ObjectDraw79DrawSprite(0)80end event818283event ObjectStartup84LoadSpriteSheet("GHZ/Objects.gif")85SpriteFrame(-32, -8, 64, 144, 191, 1)8687foreach (TypeName[V Platform 2], arrayPos0, ALL_ENTITIES)88object[arrayPos0].centerPos.y = object[arrayPos0].ypos89next9091SetTableValue(TypeName[V Platform 2], DebugMode_ObjCount, DebugMode_TypesTable)92SetTableValue(VPlatform2_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)93SetTableValue(VPlatform2_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.propertyValue111break112113end switch114else115switch editor.variableID116case EDIT_VAR_PROPVAL // property value117object.propertyValue = editor.variableValue118break119120case 0 // startDir121object.propertyValue = editor.variableValue122break123124end switch125end if126end event127128129event RSDKDraw130DrawSprite(0)131132if editor.showGizmos == true133// Clarify that this object isn't just part of the level terrain, draw some lines134135// TODO: probably best to make sure these arrows somewhat accurately represent how far it'll go in-game136// i have no idea how these currently look since i haven't been given any fancy re2 betas yet but the values probably look wrong137// the "correct" values could probably be reused from Mania's version of the object preview, although i don't have access to that either...138// edit: the miracle happen;139// github down rn but snag values from there once it's back up140// perhaps used cropped frame so that bottom of sprite so lower end doesn't stick out more than it should, only have grass ghost141142editor.drawingOverlay = true143144temp0 = 0x204000145temp0 += object.ypos146temp1 = -0x1FC000147temp1 += object.ypos148149DrawLine(object.xpos, temp0, object.xpos, temp1, 255, 255, 255)150151editor.drawingOverlay = false152end if153end event154155156event RSDKLoad157LoadSpriteSheet("GHZ/Objects.gif")158SpriteFrame(-32, -8, 64, 144, 191, 1)159160AddEditorVariable("startDir")161SetActiveVariable("startDir")162AddEnumVariable("Up", 0)163AddEnumVariable("Down", 1)164end event165166167