Path: blob/master/Sonic 2/Scripts/ARZ/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.ypos16private alias object.gravity : player.gravity171819// ========================20// Function Declarations21// ========================2223reserve function VPlatform2_DebugDraw24reserve function VPlatform2_DebugSpawn252627// ========================28// Function Definitions29// ========================3031private function VPlatform2_DebugDraw32DrawSprite(0)33end function343536private function VPlatform2_DebugSpawn37CreateTempObject(TypeName[V Platform 2], 0, object.xpos, object.ypos)38object[tempObjectPos].centerPos.y = object.ypos39object[tempObjectPos].propertyValue = object.direction40end function414243// ========================44// Events45// ========================4647event ObjectUpdate48temp7 = object.ypos49GetTableValue(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 -= temp76667object.ypos = temp768foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)69BoxCollisionTest(C_SOLID, object.entityPos, -32, -41, 32, 39, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)70if checkResult == COL_TOP71player[currentPlayer].ypos += object.collisionOffset.y72end if7374if checkResult == COL_BOTTOM75if player[currentPlayer].gravity == GRAVITY_GROUND76CallFunction(Player_Kill)77end if78end if79next80object.ypos = temp181end event828384event ObjectDraw85DrawSprite(0)86end event878889event ObjectStartup90LoadSpriteSheet("ARZ/Objects.gif")91SpriteFrame(-32, -45, 64, 85, 191, 170)9293foreach (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.propertyValue117break118end switch119else120switch editor.variableID121case EDIT_VAR_PROPVAL // property value122object.propertyValue = editor.variableValue123break124125case 0 // startDir126object.propertyValue = editor.variableValue127break128end switch129end if130end event131132133event RSDKDraw134DrawSprite(0)135end event136137138event RSDKLoad139LoadSpriteSheet("ARZ/Objects.gif")140SpriteFrame(-32, -45, 64, 85, 191, 170)141142AddEditorVariable("startDir")143SetActiveVariable("startDir")144AddEnumVariable("Up", 0)145AddEnumVariable("Down", 1)146end event147148149