Path: blob/master/Sonic 1/Scripts/Special/RotateBlock.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Rotate Block Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer1213private alias 0 : BLOCK_ROTATE_IDLE14private alias 1 : BLOCK_ROTATE_ACTIVATED1516private alias object.value14 : player.rotateBlockTimer171819// ========================20// Function Declarations21// ========================2223reserve function RotateBlock_DebugDraw24reserve function RotateBlock_DebugSpawn252627// ========================28// Function Definitions29// ========================3031private function RotateBlock_DebugDraw32DrawSprite(0)33end function343536private function RotateBlock_DebugSpawn37temp5 = TypeName[Rotate Block]38temp4 = 039CallFunction(DebugMode_PlaceBlock)40object[arrayPos0].drawOrder = 441object[arrayPos0].groupID = GROUP_BLOCKS42end function434445// ========================46// Events47// ========================4849event ObjectUpdate50if object.state == BLOCK_ROTATE_ACTIVATED51object.frame = object.timer52object.frame >>= 353object.timer++54if object.timer == 3255object.timer = 056object.state = BLOCK_ROTATE_IDLE57object.frame = 058end if59end if6061foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)62CallFunction(SpecialSetup_PlayerBlockCol)63if checkResult != false64if player[currentPlayer].rotateBlockTimer == 065player[currentPlayer].rotateBlockTimer = 3066object.state = BLOCK_ROTATE_ACTIVATED67Player_rotateDir ^= 168PlaySfx(SfxName[Rotate Block], false)69end if70end if71next72end event737475event ObjectDraw76CallFunction(SpecialSetup_GetBlockPos)77#platform: USE_ORIGINS78if game.playMode == BOOT_PLAYMODE_MIRRORING79object.direction = FLIP_X80DrawSpriteFX(object.frame, FX_FLIP, temp0, temp1)81else82DrawSpriteXY(object.frame, temp0, temp1)83end if84#endplatform85#platform: USE_STANDALONE86DrawSpriteXY(object.frame, temp0, temp1)87#endplatform88end event899091event ObjectStartup92LoadSpriteSheet("Special/Objects.gif")93SpriteFrame(-12, -12, 24, 24, 176, 76)94SpriteFrame(-12, -12, 24, 24, 176, 176)95SpriteFrame(-12, -12, 24, 24, 176, 76)96SpriteFrame(-12, -12, 24, 24, 176, 176)9798foreach (TypeName[Rotate Block], arrayPos0, ALL_ENTITIES)99object[arrayPos0].groupID = GROUP_BLOCKS100next101102SetTableValue(TypeName[Rotate Block], DebugMode_ObjCount, DebugMode_TypeTable)103SetTableValue(RotateBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)104SetTableValue(RotateBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)105DebugMode_ObjCount++106end event107108109// ========================110// Editor Events111// ========================112113event RSDKDraw114DrawSprite(0)115end event116117118event RSDKLoad119LoadSpriteSheet("Special/Objects.gif")120SpriteFrame(-12, -12, 24, 24, 176, 76)121122SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")123end event124125126