Path: blob/master/Sonic 2/Scripts/WFZ/TurretPlatform.txt
1479 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Turret Platform Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer1213// Player Aliases14private alias object.value17 : debugMode.currentSelection151617// ========================18// Function Declarations19// ========================2021reserve function TurretPlatform_SetupPlatform22reserve function TurretPlatform_DebugDraw23reserve function TurretPlatform_DebugSpawn242526// ========================27// Static Values28// ========================2930private value TurretPlatform_startDebugID = 0313233// ========================34// Function Definitions35// ========================3637private function TurretPlatform_SetupPlatform38object[arrayPos0].timer = 039object[arrayPos0].animationTimer = 040object[arrayPos0].frame = 041object[arrayPos0].state = 042object[arrayPos0].priority = PRIORITY_ACTIVE43end function444546private function TurretPlatform_DebugDraw47DrawSprite(0)48end function495051private function TurretPlatform_DebugSpawn52temp0 = debugMode[0].currentSelection53temp0 -= TurretPlatform_startDebugID54temp0 *= 0x3055temp0 &= 0xF056CreateTempObject(TypeName[Turret Platform], temp0, object.xpos, object.ypos)5758arrayPos0 = object[tempObjectPos].entityPos59CallFunction(TurretPlatform_SetupPlatform)60end function616263// ========================64// Events65// ========================6667event ObjectUpdate68// TODO: add cool state names69switch object.state70case 071temp0 = oscillation72temp0 &= 0xF073if temp0 == object.propertyValue74object.priority = PRIORITY_ACTIVE75object.timer = 16076object.animationTimer = 677object.state = 178end if79break8081case 182object.animationTimer++83object.frame = object.animationTimer84object.frame /= 685if object.frame == 486object.state = 287end if88break8990case 291object.timer--92if object.timer == 093object.state = 394end if95break9697case 398object.animationTimer--99object.frame = object.animationTimer100object.frame /= 6101if object.animationTimer == 0102object.state = 0103end if104break105106end switch107108foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)109if object.frame >= 3110BoxCollisionTest(C_PLATFORM, object.entityPos, -32, -24, 32, 0, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)111end if112next113114if object.outOfBounds == true115arrayPos0 = object.entityPos116CallFunction(TurretPlatform_SetupPlatform)117end if118end event119120121event ObjectDraw122DrawSprite(object.frame)123end event124125126event ObjectStartup127LoadSpriteSheet("SCZ/Objects.gif")128SpriteFrame(-24, -24, 48, 16, 130, 92)129SpriteFrame(-24, -24, 48, 16, 130, 109)130SpriteFrame(-24, -24, 48, 16, 130, 126)131SpriteFrame(-28, -24, 56, 21, 130, 143)132SpriteFrame(-32, -24, 64, 24, 130, 165)133134foreach (TypeName[Turret Platform], arrayPos0, ALL_ENTITIES)135CallFunction(TurretPlatform_SetupPlatform)136next137138temp0 = 0139TurretPlatform_startDebugID = DebugMode_ObjCount140while temp0 < 6141SetTableValue(TypeName[Turret Platform], DebugMode_ObjCount, DebugMode_TypesTable)142SetTableValue(TurretPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)143SetTableValue(TurretPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)144DebugMode_ObjCount++145temp0++146loop147end event148149150// ========================151// Editor Events152// ========================153154event RSDKDraw155DrawSprite(0)156end event157158159event RSDKLoad160LoadSpriteSheet("SCZ/Objects.gif")161SpriteFrame(-24, -24, 48, 16, 130, 92)162163SetVariableAlias(ALIAS_VAR_PROPVAL, "intervalOffset")164end event165166167