Path: blob/master/Sonic 1/Scripts/GHZ/VPlatform.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// 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 &= 0xFFFF00006364object.collisionOffset.y = object.ypos65object.collisionOffset.y &= 0xFFFF000066object.collisionOffset.y -= temp76768object.ypos = temp76970foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)71BoxCollisionTest(C_PLATFORM, object.entityPos, -32, -8, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)72if checkResult == true73player[currentPlayer].ypos += object.collisionOffset.y74end if75next7677object.ypos = temp178end event798081event ObjectDraw82DrawSprite(0)83end event848586event ObjectStartup87LoadSpriteSheet("GHZ/Objects.gif")88SpriteFrame(-32, -14, 64, 32, 50, 18)8990foreach (TypeName[V Platform], arrayPos0, ALL_ENTITIES)91object[arrayPos0].centerPos.y = object[arrayPos0].ypos92next9394SetTableValue(TypeName[V Platform], DebugMode_ObjCount, DebugMode_TypesTable)95SetTableValue(VPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)96SetTableValue(VPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)97DebugMode_ObjCount++98end event99100101// ========================102// Editor Events103// ========================104105event RSDKEdit106if editor.returnVariable == true107switch editor.variableID108case EDIT_VAR_PROPVAL // property value109checkResult = object.propertyValue110break111112case 0 // startDir113checkResult = object.propertyValue114break115116end switch117else118switch editor.variableID119case EDIT_VAR_PROPVAL // property value120object.propertyValue = editor.variableValue121break122123case 0 // startDir124object.propertyValue = editor.variableValue125break126127end switch128end if129end event130131132event RSDKDraw133DrawSprite(0)134135if editor.showGizmos == true136// Draw some lines and ghosts to indicate where this platform is gonna go and that it's a vertical type137// (Otherwise it's just the generic platform sprite, which is shared between two other objects in GHZ)138139editor.drawingOverlay = true140141object.inkEffect = INK_BLEND142143temp0 = 0x408000144temp0 += object.ypos145DrawSpriteFX(0, FX_INK, object.xpos, temp0)146147temp1 = -0x3F8000148temp1 += object.ypos149DrawSpriteFX(0, FX_INK, object.xpos, temp1)150151DrawArrow(object.xpos, temp0, object.xpos, temp1, 255, 255, 255)152DrawArrow(object.xpos, temp1, object.xpos, temp0, 255, 255, 255)153154object.inkEffect = INK_NONE155156editor.drawingOverlay = false157end if158end event159160161event RSDKLoad162LoadSpriteSheet("GHZ/Objects.gif")163SpriteFrame(-32, -14, 64, 32, 50, 18)164165AddEditorVariable("startDir")166SetActiveVariable("startDir")167AddEnumVariable("Up", 0)168AddEnumVariable("Down", 1)169end event170171172