Path: blob/master/Sonic 1/Scripts/SYZ/HPlatform.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: H Platform Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.stood12private alias object.value1 : object.centerPos.x13private alias object.value2 : object.centerPos.y14private alias object.value3 : object.stoodAngle1516// Player Aliases17private alias object.xpos : player.xpos18private alias object.ypos : player.ypos192021// ========================22// Function Declarations23// ========================2425reserve function HPlatform_DebugDraw26reserve function HPlatform_DebugSpawn272829// ========================30// Tables31// ========================3233private function HPlatform_DebugDraw34DrawSprite(0)35end function363738private function HPlatform_DebugSpawn39CreateTempObject(TypeName[H Platform], object.direction, object.xpos, object.ypos)40object[tempObjectPos].centerPos.x = object.xpos41object[tempObjectPos].centerPos.y = object.ypos42end function434445// ========================46// Events47// ========================4849event ObjectUpdate50temp6 = object.xpos51temp7 = object.ypos52GetTableValue(temp0, 12, StageSetup_oscillationTable)53GetBit(temp1, object.propertyValue, 0)54if temp1 == 155FlipSign(temp0)56temp0 += 0x400057else58temp0 -= 0x400059end if60temp0 <<= 86162object.xpos = object.centerPos.x63object.xpos -= temp06465if object.stood == true66if object.stoodAngle < 6467object.stoodAngle += 468end if69else70if object.stoodAngle > 071object.stoodAngle -= 472end if73end if7475temp0 = object.stoodAngle76temp0 <<= 177Sin(temp1, temp0)78temp1 <<= 979object.ypos = object.centerPos.y80object.ypos += temp18182object.stood = false8384temp0 = object.xpos85temp1 = object.ypos86temp6 &= 0xFFFF000087temp7 &= 0xFFFF000088temp4 = object.xpos89temp4 &= 0xFFFF000090temp4 -= temp691temp5 = object.ypos92temp5 &= 0xFFFF000093temp5 -= temp79495object.xpos = temp696object.ypos = temp797foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)98BoxCollisionTest(C_PLATFORM, object.entityPos, -32, -8, 32, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)99if checkResult == true100object.stood = true101player[currentPlayer].xpos += temp4102player[currentPlayer].ypos += temp5103end if104next105106object.xpos = temp0107object.ypos = temp1108end event109110111event ObjectDraw112DrawSprite(0)113end event114115116event ObjectStartup117LoadSpriteSheet("SYZ/Objects.gif")118SpriteFrame(-32, -10, 64, 32, 119, 1)119120foreach (TypeName[H Platform], arrayPos0, ALL_ENTITIES)121object[arrayPos0].centerPos.x = object[arrayPos0].xpos122object[arrayPos0].centerPos.y = object[arrayPos0].ypos123next124125SetTableValue(TypeName[H Platform], DebugMode_ObjCount, DebugMode_TypesTable)126SetTableValue(HPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)127SetTableValue(HPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)128DebugMode_ObjCount++129end event130131132// ========================133// Editor Events134// ========================135136event RSDKEdit137if editor.returnVariable == true138switch editor.variableID139case EDIT_VAR_PROPVAL // property value140checkResult = object.propertyValue141break142143case 0 // startDir144GetBit(checkResult, object.propertyValue, 0)145break146147end switch148else149switch editor.variableID150case EDIT_VAR_PROPVAL // property value151object.propertyValue = editor.variableValue152break153154case 0 // startDir155CheckNotEqual(editor.variableValue, false)156SetBit(object.propertyValue, 0, checkResult)157break158159end switch160end if161end event162163164event RSDKDraw165DrawSprite(0)166167if editor.showGizmos == true168editor.drawingOverlay = true169170// Draw some lines to indicate where this platform is gonna go and that it's a horizontal type171// (Otherwise it's just the generic platform sprite, which is shared between two other objects)172173// object.inkEffect = INK_BLEND174175temp0 = 0x3f8000176temp0 += object.xpos177// DrawSpriteFX(0, FX_INK, temp0, object.ypos)178179temp1 = -0x408000180temp1 += object.xpos181// DrawSpriteFX(0, FX_INK, temp1, object.ypos)182183DrawLine(temp0, object.ypos, temp1, object.ypos, 255, 255, 255)184185// object.inkEffect = INK_NONE186187editor.drawingOverlay = false188end if189end event190191192event RSDKLoad193LoadSpriteSheet("SYZ/Objects.gif")194SpriteFrame(-32, -10, 64, 32, 119, 1)195196AddEditorVariable("startDir")197SetActiveVariable("startDir")198AddEnumVariable("Left", 0)199AddEnumVariable("Right", 1)200201// there is apparently another variable (uses bit 1, while startDir uses bit 0), though its not used and thus idk what it is202// TODO: I may have an inkling as to what it may be, investigate some more203end event204205206