Path: blob/master/Sonic 2/Scripts/EHZ/VPlatform2.txt
1480 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 -= 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, -46, 32, -26, 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 ObjectStartup84CheckCurrentStageFolder("Zone01")85if checkResult == true86LoadSpriteSheet("EHZ/Objects.gif")87SpriteFrame(-32, -52, 64, 96, 127, 1)88else89LoadSpriteSheet("MBZ/Objects.gif")90SpriteFrame(-32, -46, 64, 96, 1, 305)91end if9293foreach (TypeName[V Platform 2], arrayPos0, ALL_ENTITIES)94object[arrayPos0].centerPos.y = object[arrayPos0].ypos95next9697SetTableValue(TypeName[V Platform 2], DebugMode_ObjCount, DebugMode_TypesTable)98SetTableValue(VPlatform2_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)99SetTableValue(VPlatform2_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)100DebugMode_ObjCount++101end event102103104// ========================105// Editor Events106// ========================107108event RSDKEdit109if editor.returnVariable == true110switch editor.variableID111case EDIT_VAR_PROPVAL // property value112checkResult = object.propertyValue113break114115case 0 // startDir116checkResult = object.propertyValue117break118119end switch120else121switch editor.variableID122case EDIT_VAR_PROPVAL // property value123object.propertyValue = editor.variableValue124break125126case 0 // startDir127object.propertyValue = editor.variableValue128break129130end switch131end if132end event133134135event RSDKDraw136// Because of how tall this object is its movement path doesn't look too good137// I hope you'll find it fine enough though...138139if editor.showGizmos == true140editor.drawingOverlay = true141142// Draw the Platform's ghosts143144object.inkEffect = INK_BLEND145146temp0 = object.ypos147temp0 += 0x1F0000148DrawSpriteFX(0, FX_INK, object.xpos, temp0)149150temp1 = object.ypos151temp1 -= 0x210000152DrawSpriteFX(0, FX_INK, object.xpos, temp1)153154object.inkEffect = INK_NONE155156editor.drawingOverlay = false157end if158159DrawSprite(0)160161if editor.showGizmos == true162editor.drawingOverlay = true163164// Draw the Platform's range, using those values from earlier165166DrawArrow(object.xpos, temp0, object.xpos, temp1, 255, 255, 255)167DrawArrow(object.xpos, temp1, object.xpos, temp0, 255, 255, 255)168169editor.drawingOverlay = false170end if171end event172173174event RSDKLoad175CheckCurrentStageFolder("Zone01")176if checkResult == true177LoadSpriteSheet("EHZ/Objects.gif")178SpriteFrame(-32, -52, 64, 96, 127, 1)179else180LoadSpriteSheet("MBZ/Objects.gif")181SpriteFrame(-32, -46, 64, 96, 1, 305)182end if183184AddEditorVariable("startDir")185SetActiveVariable("startDir")186AddEnumVariable("Up", 0)187AddEnumVariable("Down", 1)188end event189190191