Path: blob/master/Sonic 2/Scripts/WFZ/HPlatform2.txt
1478 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: H Platform 2 Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.centerPos.x12private alias object.value1 : object.hitbox.left13private alias object.value2 : object.hitbox.right14private alias object.value3 : object.stoodPlayers1516// Player Aliases17private alias object.xpos : player.xpos1819private alias object.value17 : debugMode.currentSelection202122// ========================23// Function Declarations24// ========================2526reserve function HPlatform2_DebugDraw27reserve function HPlatform2_DebugSpawn282930// ========================31// Static Values32// ========================3334private value HPlatform2_startDebugID = 0353637// ========================38// Function Definitions39// ========================4041private function HPlatform2_DebugDraw42temp0 = debugMode[0].currentSelection43temp0 -= HPlatform2_startDebugID44DrawSprite(temp0)45end function464748private function HPlatform2_DebugSpawn49temp0 = debugMode[0].currentSelection50temp0 -= HPlatform2_startDebugID51CreateTempObject(TypeName[H Platform 2], temp0, object.xpos, object.ypos)5253object[tempObjectPos].centerPos.x = object.xpos54object[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.xpos71GetTableValue(temp0, 4, StageSetup_oscillationTable)72if object.direction == FLIP_X73FlipSign(temp0)74temp0 += 0x400075end if76temp0 <<= 87778object.xpos = object.centerPos.x79object.xpos -= temp080temp6 &= 0xFFFF000081temp7 = object.xpos82temp7 &= 0xFFFF000083temp7 -= temp68485temp2 = 086foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)87GetBit(temp0, object.stoodPlayers, temp2)88if temp0 == true89player[currentPlayer].xpos += 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[H Platform 2], arrayPos0, ALL_ENTITIES)113object[arrayPos0].centerPos.x = object[arrayPos0].xpos114if object[arrayPos0].propertyValue == 0115object[arrayPos0].hitbox.left = -32116object[arrayPos0].hitbox.right = 32117else118object[arrayPos0].hitbox.left = -24119object[arrayPos0].hitbox.right = 24120end if121next122123temp0 = 0124HPlatform2_startDebugID = DebugMode_ObjCount125while temp0 < 2126SetTableValue(TypeName[H Platform 2], DebugMode_ObjCount, DebugMode_TypesTable)127SetTableValue(HPlatform2_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)128SetTableValue(HPlatform2_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