Path: blob/master/Sonic 2/Scripts/WFZ/VPlatform.txt
1479 views
// ----------------------------------1// RSDK Project: Sonic 22// 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.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 VPlatform_DebugDraw27reserve function VPlatform_DebugSpawn282930// ========================31// Static Values32// ========================3334private value VPlatform_startDebugID = 0353637// ========================38// Function Definitions39// ========================4041private function VPlatform_DebugDraw42temp0 = debugMode[0].currentSelection43temp0 -= VPlatform_startDebugID44DrawSprite(temp0)45end function464748private function VPlatform_DebugSpawn49temp0 = debugMode[0].currentSelection50temp0 -= VPlatform_startDebugID51CreateTempObject(TypeName[V Platform], 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.ypos71GetTableValue(temp0, 14, StageSetup_oscillationTable)72if object.direction == FLIP_X73FlipSign(temp0)74temp0 += 0x800075end if76temp0 <<= 87778object.ypos = object.centerPos.y79object.ypos -= temp080temp6 &= 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], arrayPos0, ALL_ENTITIES)113object[arrayPos0].centerPos.y = object[arrayPos0].ypos114if object[arrayPos0].propertyValue == 0115object[arrayPos0].hitbox.left = -32116object[arrayPos0].hitbox.right = 32117else118object[arrayPos0].hitbox.left = -24119object[arrayPos0].hitbox.right = 24120end if121next122123temp0 = 0124VPlatform_startDebugID = DebugMode_ObjCount125while temp0 < 2126SetTableValue(TypeName[V Platform], DebugMode_ObjCount, DebugMode_TypesTable)127SetTableValue(VPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)128SetTableValue(VPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)129DebugMode_ObjCount++130temp0++131loop132end event133134135// ========================136// Editor Events137// ========================138139event RSDKEdit140if editor.returnVariable == true141switch editor.variableID142case EDIT_VAR_PROPVAL // property value143checkResult = object.propertyValue144break145146case 0 // type147checkResult = object.propertyValue148break149150end switch151else152switch editor.variableID153case EDIT_VAR_PROPVAL // property value154object.propertyValue = editor.variableValue155break156157case 0 // type158object.propertyValue = editor.variableValue159break160161end switch162end if163end event164165166event RSDKDraw167DrawSprite(object.propertyValue)168end event169170171event RSDKLoad172LoadSpriteSheet("SCZ/Objects.gif")173SpriteFrame(-24, -16, 48, 24, 381, 178)174SpriteFrame(-32, -16, 64, 24, 1, 146)175176AddEditorVariable("type")177SetActiveVariable("type")178AddEnumVariable("Small Platform", 0)179AddEnumVariable("Wide Platform", 1)180end event181182183