Path: blob/master/Sonic 1/Scripts/LZ/Door.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Door Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer1213private alias 0 : DOOR_CLOSED14private alias 1 : DOOR_OPENING15private alias 2 : DOOR_OPENED16private alias 3 : DOOR_AWAITCLOSE17private alias 4 : DOOR_CLOSING1819// PushButton Aliases20private alias object.value0 : pushButton.stood2122// Player Aliases23private alias object.xpos : player.xpos242526// ========================27// Function Declarations28// ========================2930reserve function Door_DebugDraw31reserve function Door_DebugSpawn323334// ========================35// Function Definitions36// ========================3738private function Door_DebugDraw39DrawSprite(0)40end function414243private function Door_DebugSpawn44CreateTempObject(TypeName[Door], 0, object.xpos, object.ypos)45object[tempObjectPos].priority = PRIORITY_ACTIVE46object[tempObjectPos].timer = 3247end function484950// ========================51// Events52// ========================5354event ObjectUpdate55switch object.state56case DOOR_CLOSED57if object.propertyValue == 258if player[0].xpos < object.xpos59CurrentTunnel_activateDelay = 460end if61end if6263if pushButton[+1].stood == true64object.state++65end if66break6768case DOOR_OPENING69object.ypos -= 0x200007071object.timer--72if object.timer < 073object.state++74if object.propertyValue == 175object.state++76end if77end if78break7980case DOOR_OPENED81break8283case DOOR_AWAITCLOSE84if player[0].xpos > 0x11200000 // hardcoded xpos in the scene :(85object.state++86end if87break8889case DOOR_CLOSING90object.ypos += 0x200009192object.timer++93if object.timer >= 3294object.state = DOOR_CLOSED95end if96break9798end switch99100foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)101BoxCollisionTest(C_SOLID, object.entityPos, -8, -32, 8, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)102next103end event104105106event ObjectDraw107DrawSprite(0)108end event109110111event ObjectStartup112LoadSpriteSheet("LZ/Objects.gif")113114// Door frame115SpriteFrame(-8, -32, 16, 64, 206, 142)116117foreach (TypeName[Door], arrayPos0, ALL_ENTITIES)118object[arrayPos0].priority = PRIORITY_ACTIVE119object[arrayPos0].timer = 32120next121122// Add this object to the debug item list123SetTableValue(TypeName[Door], DebugMode_ObjCount, DebugMode_TypesTable)124SetTableValue(Door_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)125SetTableValue(Door_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)126DebugMode_ObjCount++127end event128129130// ========================131// Editor Events132// ========================133134event RSDKEdit135if editor.returnVariable == true136switch editor.variableID137case EDIT_VAR_PROPVAL // property value138checkResult = object.propertyValue139break140141case 0 // type142checkResult = object.propertyValue143break144145end switch146else147switch editor.variableID148case EDIT_VAR_PROPVAL // property value149object.propertyValue = editor.variableValue150break151152case 0 // type153object.propertyValue = editor.variableValue154break155156end switch157end if158end event159160161event RSDKDraw162DrawSprite(0)163164if editor.showGizmos == true165editor.drawingOverlay = true166167// Draw a line connecting the door to its trigger button168DrawLine(object.xpos, object.ypos, object[+1].xpos, object[+1].ypos, 0xFF, 0xFF, 0x00)169170editor.drawingOverlay = false171end if172end event173174175event RSDKLoad176LoadSpriteSheet("LZ/Objects.gif")177SpriteFrame(-8, -32, 16, 64, 206, 142)178179AddEditorVariable("type")180SetActiveVariable("type")181AddEnumVariable("Stay Opened", 0)182AddEnumVariable("Open Then Close", 1) // hardcoded to only close after player passes ixpos 4384 in the scene btw183AddEnumVariable("Current", 2)184end event185186187