Path: blob/master/Sonic 2/Scripts/WFZ/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.hitbox.left13private alias object.value2 : object.hitbox.right14private alias object.value3 : object.stoodPlayers1516// Player Aliases17private alias object.ypos : player.ypos1819private alias object.value17 : debugMode.currentSelection202122// ========================23// Function Declarations24// ========================2526reserve function VPlatform2_DebugDraw27reserve function VPlatform2_DebugSpawn282930// ========================31// Static Values32// ========================3334private value VPlatform2_startDebugID = 0353637// ========================38// Function Definitions39// ========================4041private function VPlatform2_DebugDraw42temp0 = debugMode[0].currentSelection43temp0 -= VPlatform2_startDebugID44DrawSprite(temp0)45end function464748private function VPlatform2_DebugSpawn49temp0 = debugMode[0].currentSelection50temp0 -= VPlatform2_startDebugID51CreateTempObject(TypeName[V Platform 2], temp0, object.xpos, object.ypos)5253object[tempObjectPos].centerPos.y = object.ypos54object[tempObjectPos].direction = object.direction55if object[tempObjectPos].propertyValue == 056object[tempObjectPos].hitbox.left = -3257object[tempObjectPos].hitbox.right = 3258else59object[tempObjectPos].hitbox.left = -2460object[tempObjectPos].hitbox.right = 2461end if62end function636465// ========================66// Events67// ========================6869event ObjectUpdate70temp6 = object.ypos71object.ypos += object.yvel7273temp0 = object.centerPos.y74temp0 -= 0x60000075if object.ypos <= temp076object.yvel += 0x80077else78object.yvel -= 0x80079end if80temp6 &= 0xFFFF000081temp7 = object.ypos82temp7 &= 0xFFFF000083temp7 -= temp68485temp2 = 086foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)87GetBit(temp0, object.stoodPlayers, temp2)88if temp0 == true89player[currentPlayer].ypos += temp790end if9192SetBit(object.stoodPlayers, temp2, false)93BoxCollisionTest(C_PLATFORM, object.entityPos, object.hitbox.left, -16, object.hitbox.right, 0, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)94if checkResult == true95SetBit(object.stoodPlayers, temp2, true)96end if97temp2++98next99end event100101102event ObjectDraw103DrawSprite(object.propertyValue)104end event105106107event ObjectStartup108LoadSpriteSheet("SCZ/Objects.gif")109SpriteFrame(-24, -16, 48, 24, 381, 178)110SpriteFrame(-32, -16, 64, 24, 1, 146)111112foreach (TypeName[V Platform 2], arrayPos0, ALL_ENTITIES)113object[arrayPos0].centerPos.y = object[arrayPos0].ypos114if object[arrayPos0].direction == FLIP_Y115object[arrayPos0].direction -= 0xC00000 // prolly not supposed to be "object.direction"116end if117118if object[arrayPos0].propertyValue == 0119object[arrayPos0].hitbox.left = -32120object[arrayPos0].hitbox.right = 32121else122object[arrayPos0].hitbox.left = -24123object[arrayPos0].hitbox.right = 24124end if125next126127temp0 = 0128VPlatform2_startDebugID = DebugMode_ObjCount129while temp0 < 2130SetTableValue(TypeName[V Platform 2], DebugMode_ObjCount, DebugMode_TypesTable)131SetTableValue(VPlatform2_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)132SetTableValue(VPlatform2_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)133DebugMode_ObjCount++134temp0++135loop136end event137138139// ========================140// Editor Events141// ========================142143event RSDKEdit144if editor.returnVariable == true145switch editor.variableID146case EDIT_VAR_PROPVAL // property value147checkResult = object.propertyValue148break149150case 0 // type151checkResult = object.propertyValue152break153154end switch155else156switch editor.variableID157case EDIT_VAR_PROPVAL // property value158object.propertyValue = editor.variableValue159break160161case 0 // type162object.propertyValue = editor.variableValue163break164165end switch166end if167end event168169170event RSDKDraw171DrawSprite(object.propertyValue)172end event173174175event RSDKLoad176LoadSpriteSheet("SCZ/Objects.gif")177SpriteFrame(-24, -16, 48, 24, 381, 178)178SpriteFrame(-32, -16, 64, 24, 1, 146)179180AddEditorVariable("type")181SetActiveVariable("type")182AddEnumVariable("Small Platform", 0)183AddEnumVariable("Wide Platform", 1)184end event185186187