Path: blob/master/Sonic 2/Scripts/CPZ/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.hitboxL13private alias object.value2 : object.hitboxR14private 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_debugStartID = 0353637// ========================38// Function Definitions39// ========================4041private function VPlatform2_DebugDraw42temp0 = debugMode[0].currentSelection43temp0 -= VPlatform2_debugStartID44DrawSprite(temp0)45end function464748private function VPlatform2_DebugSpawn49temp0 = debugMode[0].currentSelection50temp0 -= VPlatform2_debugStartID51CreateTempObject(TypeName[V Platform 2], temp0, object.xpos, object.ypos)5253object[tempObjectPos].centerPos.y = object.ypos54object[tempObjectPos].direction = object.direction55if object[tempObjectPos].propertyValue == 056object[tempObjectPos].hitboxL = -3257object[tempObjectPos].hitboxR = 3258else59object[tempObjectPos].hitboxL = -2460object[tempObjectPos].hitboxR = 2461end if62end function636465// ========================66// Events67// ========================6869event ObjectUpdate70temp6 = object.ypos7172object.ypos += object.yvel73temp0 = object.centerPos.y74temp0 -= 0x60000075if object.ypos <= temp076object.yvel += 0x80077else78object.yvel -= 0x80079end if8081temp6 &= 0xFFFF000082temp7 = object.ypos83temp7 &= 0xFFFF000084temp7 -= temp68586temp2 = 087foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)88GetBit(temp0, object.stoodPlayers, temp2)89if temp0 == true90player[currentPlayer].ypos += temp791end if9293SetBit(object.stoodPlayers, temp2, false)94BoxCollisionTest(C_PLATFORM, object.entityPos, object.hitboxL, -16, object.hitboxR, 0, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)95if checkResult == true96SetBit(object.stoodPlayers, temp2, true)97end if9899temp2++100next101end event102103104event ObjectDraw105DrawSprite(object.propertyValue)106end event107108109event ObjectStartup110LoadSpriteSheet("CPZ/Objects.gif")111SpriteFrame(-32, -16, 64, 27, 136, 155) // Large Platform112SpriteFrame(-24, -16, 48, 26, 136, 183) // Small Platform113114foreach (TypeName[V Platform 2], arrayPos0, ALL_ENTITIES)115object[arrayPos0].centerPos.y = object[arrayPos0].ypos116if object[arrayPos0].direction == FLIP_Y117object[arrayPos0].direction -= 0xC00000 // prolly not supposed to be "object.direction"118end if119if object[arrayPos0].propertyValue == 0120object[arrayPos0].hitboxL = -32121object[arrayPos0].hitboxR = 32122else123object[arrayPos0].hitboxL = -24124object[arrayPos0].hitboxR = 24125end if126next127128temp0 = 0129VPlatform2_debugStartID = DebugMode_ObjCount130while temp0 < 2131SetTableValue(TypeName[V Platform 2], DebugMode_ObjCount, DebugMode_TypesTable)132SetTableValue(VPlatform2_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)133SetTableValue(VPlatform2_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)134DebugMode_ObjCount++135temp0++136loop137end event138139140// ========================141// Editor Events142// ========================143144event RSDKEdit145if editor.returnVariable == true146switch editor.variableID147case EDIT_VAR_PROPVAL // property value148checkResult = object.propertyValue149break150151case 0 // type152checkResult = object.propertyValue153break154155end switch156else157switch editor.variableID158case EDIT_VAR_PROPVAL // property value159object.propertyValue = editor.variableValue160break161162case 0 // type163object.propertyValue = editor.variableValue164break165166end switch167end if168end event169170171event RSDKDraw172DrawSprite(object.propertyValue)173end event174175176event RSDKLoad177LoadSpriteSheet("CPZ/Objects.gif")178SpriteFrame(-32, -16, 64, 27, 136, 155)179SpriteFrame(-24, -16, 48, 26, 136, 183)180181AddEditorVariable("type")182SetActiveVariable("type")183AddEnumVariable("Large", 0)184AddEnumVariable("Small", 1)185end event186187188