Path: blob/master/Sonic 1/Scripts/Special/UpDownBlock.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Up Down Block Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011// Player Aliases12private alias object.value10 : debugMode.currentSelection13private alias object.value15 : player.upDownBlockTimer141516// ========================17// Function Declarations18// ========================1920reserve function UpDownBlock_DebugDraw21reserve function UpDownBlock_DebugSpawn222324// ========================25// Static Values26// ========================2728private value UpDownBlock_startDebugID = 0293031// ========================32// Function Definitions33// ========================3435private function UpDownBlock_DebugDraw36temp4 = debugMode[0].currentSelection37temp4 -= UpDownBlock_startDebugID38DrawSprite(temp4)39end function404142private function UpDownBlock_DebugSpawn43temp4 = debugMode[0].currentSelection44temp4 -= UpDownBlock_startDebugID45temp5 = TypeName[Up Down Block]46CallFunction(DebugMode_PlaceBlock)47object[arrayPos0].drawOrder = 448object[arrayPos0].groupID = GROUP_BLOCKS49end function505152// ========================53// Events54// ========================5556event ObjectUpdate57foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)58CallFunction(SpecialSetup_PlayerBlockCol)59if checkResult != false60if player[currentPlayer].upDownBlockTimer == 061player[currentPlayer].upDownBlockTimer = 3062if object.propertyValue == 063if Player_rotateSpeed < 164Player_rotateSpeed++65object.propertyValue = 166PlaySfx(SfxName[Rotate Block], false)67end if68else69if Player_rotateSpeed > 070Player_rotateSpeed--71object.propertyValue = 072PlaySfx(SfxName[Rotate Block], false)73end if74end if75end if76end if77next78end event798081event ObjectDraw82CallFunction(SpecialSetup_GetBlockPos)83temp2 = oscillation84temp2 &= 1585temp2 >>= 386#platform: USE_ORIGINS87if game.playMode == BOOT_PLAYMODE_MIRRORING88object.direction = FLIP_X89if temp2 == 090DrawSpriteFX(object.propertyValue, FX_FLIP, temp0, temp1)91else92DrawSpriteFX(2, FX_FLIP, temp0, temp1)93end if94else95if temp2 == 096DrawSpriteXY(object.propertyValue, temp0, temp1)97else98DrawSpriteXY(2, temp0, temp1)99end if100end if101#endplatform102#platform: USE_STANDALONE103if temp2 == 0104DrawSpriteXY(object.propertyValue, temp0, temp1)105else106DrawSpriteXY(2, temp0, temp1)107end if108#endplatform109end event110111112event ObjectStartup113LoadSpriteSheet("Special/Objects.gif")114115// Up and down 'n all around frames116SpriteFrame(-12, -12, 24, 24, 226, 76)117SpriteFrame(-12, -12, 24, 24, 226, 176)118SpriteFrame(-12, -12, 24, 24, 251, 76)119120foreach (TypeName[Up Down Block], arrayPos0, ALL_ENTITIES)121object[arrayPos0].groupID = GROUP_BLOCKS122next123124// Add this object to the debug item list twice125UpDownBlock_startDebugID = DebugMode_ObjCount126SetTableValue(TypeName[Up Down Block], DebugMode_ObjCount, DebugMode_TypeTable)127SetTableValue(UpDownBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)128SetTableValue(UpDownBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)129DebugMode_ObjCount++130131SetTableValue(TypeName[Up Down Block], DebugMode_ObjCount, DebugMode_TypeTable)132SetTableValue(UpDownBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)133SetTableValue(UpDownBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)134DebugMode_ObjCount++135end event136137138// ========================139// Editor Events140// ========================141142event RSDKEdit143if editor.returnVariable == true144switch editor.variableID145case EDIT_VAR_PROPVAL // property value146checkResult = object.propertyValue147break148149case 0 // type150checkResult = object.propertyValue151break152153end switch154else155switch editor.variableID156case EDIT_VAR_PROPVAL // property value157object.propertyValue = editor.variableValue158break159160case 0 // type161object.propertyValue = temp0162break163164end switch165end if166end event167168169event RSDKDraw170DrawSprite(object.propertyValue)171end event172173174event RSDKLoad175LoadSpriteSheet("Special/Objects.gif")176SpriteFrame(-12, -12, 24, 24, 226, 76)177SpriteFrame(-12, -12, 24, 24, 226, 176)178SpriteFrame(-12, -12, 24, 24, 251, 76)179180AddEditorVariable("type")181SetActiveVariable("type")182AddEnumVariable("Speed Up", 0)183AddEnumVariable("Slow Down", 1)184end event185186187