Path: blob/master/Sonic 1/Scripts/SYZ/StaticPlatform.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Static Platform Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.propertyValue : object.canMove1213private alias object.value0 : object.stood14private alias object.value1 : object.stoodAngle15private alias object.value2 : object.collisionOffset.y16private alias object.value3 : object.timer17private alias object.value4 : object.centerPos.y1819private alias 0 : STATICPLATFORM_IDLE20private alias 1 : STATICPLATFORM_WAITFORBUTTON21private alias 2 : STATICPLATFORM_MOVEDELAY22private alias 3 : STATICPLATFORM_MOVING2324// Player Aliases25private alias object.ypos : player.ypos2627// PushButton aliases28private alias object.propertyValue : pushButton.stood2930// ========================31// Function Declarations32// ========================3334reserve function StaticPlatform_DebugDraw35reserve function StaticPlatform_DebugSpawn363738private function StaticPlatform_DebugDraw39DrawSprite(0)40end function414243private function StaticPlatform_DebugSpawn44CreateTempObject(TypeName[Static Platform], 0, object.xpos, object.ypos)45object[tempObjectPos].centerPos.y = object.ypos46object[tempObjectPos].state = STATICPLATFORM_WAITFORBUTTON47end function484950// ========================51// Events52// ========================5354event ObjectUpdate55if object.stood == true56if object.stoodAngle < 1657object.stoodAngle++5859temp0 = object.stoodAngle60temp0 &= 361if temp0 == 362object.collisionOffset.y = 0x1000063else64object.collisionOffset.y = 065end if66else67object.collisionOffset.y = 068end if69else70if object.stoodAngle > 071object.stoodAngle--7273temp0 = object.stoodAngle74temp0 &= 375if temp0 == 376object.collisionOffset.y = -0x1000077else78object.collisionOffset.y = 079end if80else81object.collisionOffset.y = 082end if83end if8485object.stood = false86switch object.state87case STATICPLATFORM_IDLE88break8990case STATICPLATFORM_WAITFORBUTTON91if pushButton[-1].stood == true92object.state++93end if94break9596case STATICPLATFORM_MOVEDELAY97if object.timer < 12098object.timer++99else100object.timer = 0101object.state++102end if103break104105case STATICPLATFORM_MOVING106if object.timer < 256107object.timer++108object.ypos -= 0x20000109object.centerPos.y -= 0x20000110else111object.timer = 0112object.state = STATICPLATFORM_IDLE113end if114break115end switch116117foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)118if object.yvel < 0x80000119BoxCollisionTest(C_PLATFORM, object.entityPos, -32, -8, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)120if checkResult == true121object.stood = true122player[currentPlayer].ypos += object.collisionOffset.y123end if124end if125next126object.ypos += object.collisionOffset.y127end event128129130event ObjectDraw131DrawSprite(0)132end event133134135event ObjectStartup136LoadSpriteSheet("SYZ/Objects.gif")137SpriteFrame(-32, -10, 64, 32, 119, 1)138139arrayPos0 = 32140while arrayPos0 < 0x420141if object[arrayPos0].type == TypeName[Static Platform]142object[arrayPos0].centerPos.y = object[arrayPos0].ypos143if object[arrayPos0].canMove == true144object[arrayPos0].state = STATICPLATFORM_WAITFORBUTTON145end if146end if147arrayPos0++148loop149150SetTableValue(TypeName[Static Platform], DebugMode_ObjCount, DebugMode_TypesTable)151SetTableValue(StaticPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)152SetTableValue(StaticPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)153DebugMode_ObjCount++154end event155156157// ========================158// Editor Events159// ========================160161event RSDKEdit162if editor.returnVariable == true163switch editor.variableID164case EDIT_VAR_PROPVAL // property value165checkResult = object.propertyValue166checkResult &= 1167break168169case 0 // canMove170checkResult = object.propertyValue171checkResult &= 1172break173174end switch175else176switch editor.variableID177case EDIT_VAR_PROPVAL // property value178object.propertyValue = editor.variableValue179object.propertyValue &= 1180break181182case 0 // canMove183object.propertyValue = editor.variableValue184object.propertyValue &= 1185break186187end switch188end if189end event190191192event RSDKDraw193DrawSprite(0)194end event195196197event RSDKLoad198LoadSpriteSheet("SYZ/Objects.gif")199SpriteFrame(-32, -10, 64, 32, 119, 1)200201AddEditorVariable("canMove")202SetActiveVariable("canMove")203AddEnumVariable("false", false)204AddEnumVariable("true", true)205end event206207208