Path: blob/main/Scripts/R6/RotatingSpikes.txt
1319 views
//---------------Sonic CD Rotating Spikes Script--------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Angle6#alias Object.Value1 : Object.Increment7#alias Object.Value2 : Object.SpawnedSpikes89#alias Object[-1].Rotation : MovingBlocks.Rotation1011// HUD Alias12#alias Object[24].PropertyValue : HUD.CurrentTimePeriod1314// Time Periods15#alias 0 : TIME_PRESENT16#alias 1 : TIME_PAST17#alias 2 : TIME_GOOD_FUTURE18#alias 3 : TIME_BAD_FUTURE1920// Property Values21#alias 0 : ROTATION_CLOCKWISE22#alias 1 : ROTATION_COUNTERCLOCKWISE23#alias 2 : ROTATION_CCW_LINK_MOVINGBLOCKS24#alias 3 : ROTATION_CCW_TWO_SPIKES25#alias 4 : ROTATION_CW_SIX_SPIKES262728sub ObjectMain29if Object.PropertyValue == ROTATION_CCW_LINK_MOVINGBLOCKS30Object.Angle = MovingBlocks.Rotation31else32Object.Angle += Object.Increment33end if3435if Object.Angle < 036Object.Angle += 51237end if38Object.Angle &= 51139end sub404142sub ObjectPlayerInteraction43TempValue0 = 044TempValue1 = 1645TempValue2 = Object.XPos46TempValue3 = Object.YPos4748while TempValue0 < Object.SpawnedSpikes4950Cos(Object.XPos, Object.Angle)51Object.XPos *= TempValue152Object.XPos <<= 753Object.XPos += TempValue25455Sin(Object.YPos, Object.Angle)56Object.YPos *= TempValue157Object.YPos <<= 758Object.YPos += TempValue35960PlayerObjectCollision(C_TOUCH, -8, -8, 8, 8)61if CheckResult == true62CallFunction(Player_Hit)63end if6465TempValue0++66TempValue1 += 1667loop68Object.XPos = TempValue269Object.YPos = TempValue370end sub717273sub ObjectDraw74DrawSprite(0)75TempValue0 = 076TempValue1 = 167778while TempValue0 < Object.SpawnedSpikes79Cos(TempValue2, Object.Angle)80TempValue2 *= TempValue181TempValue2 <<= 782TempValue2 += Object.XPos8384Sin(TempValue3, Object.Angle)85TempValue3 *= TempValue186TempValue3 <<= 787TempValue3 += Object.YPos8889DrawSpriteXY(1, TempValue2, TempValue3)9091TempValue0++92TempValue1 += 1693loop94end sub959697sub ObjectStartup98LoadSpriteSheet("R6/Objects.gif")99100SpriteFrame(-8, -8, 16, 16, 133, 199) // #0 - Rotating Spikes Center101SpriteFrame(-8, -8, 16, 16, 150, 199) // #1 - Spikes102103ArrayPos0 = 32104while ArrayPos0 < 1056105if Object[ArrayPos0].Type == TypeName[Rotating Spikes]106switch Object[ArrayPos0].PropertyValue107case ROTATION_CLOCKWISE108Object[ArrayPos0].Increment = 2109switch HUD.CurrentTimePeriod110case TIME_PRESENT111Object[ArrayPos0].SpawnedSpikes = 5112break113114case TIME_PAST115Object[ArrayPos0].SpawnedSpikes = 4116break117118case TIME_GOOD_FUTURE119case TIME_BAD_FUTURE120Object[ArrayPos0].SpawnedSpikes = 6121break122end switch123124break125126case ROTATION_COUNTERCLOCKWISE127Object[ArrayPos0].Increment = -2128switch HUD.CurrentTimePeriod129case TIME_PRESENT130Object[ArrayPos0].SpawnedSpikes = 5131break132133case TIME_PAST134Object[ArrayPos0].SpawnedSpikes = 4135break136137case TIME_GOOD_FUTURE138case TIME_BAD_FUTURE139Object[ArrayPos0].SpawnedSpikes = 6140break141end switch142143Object[ArrayPos0].Angle = 384144break145146case ROTATION_CCW_LINK_MOVINGBLOCKS147Object[ArrayPos0].Increment = -2148switch HUD.CurrentTimePeriod149case TIME_PRESENT150Object[ArrayPos0].SpawnedSpikes = 5151break152153case TIME_PAST154Object[ArrayPos0].SpawnedSpikes = 4155break156157case TIME_GOOD_FUTURE158case TIME_BAD_FUTURE159Object[ArrayPos0].SpawnedSpikes = 6160break161end switch162163break164165case ROTATION_CCW_TWO_SPIKES166Object[ArrayPos0].Increment = -2167Object[ArrayPos0].SpawnedSpikes = 2168break169170case ROTATION_CW_SIX_SPIKES171Object[ArrayPos0].Increment = 2172Object[ArrayPos0].SpawnedSpikes = 6173break174end switch175end if176ArrayPos0++177loop178end sub179180181// ========================182// Editor Subs183// ========================184185sub RSDKEdit186if Editor.ReturnVariable == true187switch Editor.VariableID188case EDIT_VAR_PROPVAL // Property Value189CheckResult = Object.PropertyValue190CheckResult %= 5191break192case 0 // spikeType193CheckResult = Object.PropertyValue194CheckResult %= 5195break196end switch197else198switch Editor.VariableID199case EDIT_VAR_PROPVAL // Property Value200Object.PropertyValue = Editor.VariableValue201Object.PropertyValue %= 5202break203case 0 // spikeType204Object.PropertyValue = Editor.VariableValue205Object.PropertyValue %= 5206break207end switch208end if209end sub210211212sub RSDKDraw213DrawSprite(0)214215TempValue0 = 0216217switch Object.PropertyValue218case ROTATION_CLOCKWISE219case ROTATION_COUNTERCLOCKWISE220case ROTATION_CCW_LINK_MOVINGBLOCKS221CallFunction(EditorHelpers_FindTimePeriod)222switch CheckResult223case TIME_PRESENT224TempValue1 = 5225break226case TIME_PAST227TempValue1 = 4228break229case TIME_GOOD_FUTURE230case TIME_BAD_FUTURE231TempValue1 = 6232break233end switch234break235case ROTATION_CCW_TWO_SPIKES236TempValue1 = 2237break238case ROTATION_CW_SIX_SPIKES239TempValue1 = 6240break241end switch242243TempValue2 = Object.XPos244TempValue3 = Object.YPos245while TempValue0 < TempValue1246TempValue2 += 0x100000247TempValue3 += 0x100000248DrawSpriteXY(1, TempValue2, TempValue3)249TempValue0++250loop251252if Editor.ShowGizmos == true253switch Object.PropertyValue254case ROTATION_CLOCKWISE255case ROTATION_CW_SIX_SPIKES256TempValue0 = Object.iXPos257TempValue0 += 32258TempValue0 <<= 16259260TempValue1 = Object.iYPos261TempValue1 += 32262TempValue1 <<= 16263DrawArrow(TempValue0, Object.YPos, Object.XPos, TempValue1, 255, 255, 255, 0)264break265case ROTATION_COUNTERCLOCKWISE266case ROTATION_CCW_LINK_MOVINGBLOCKS267case ROTATION_CCW_TWO_SPIKES268TempValue0 = Object.iXPos269TempValue0 += 32270TempValue0 <<= 16271272TempValue1 = Object.iYPos273TempValue1 += 32274TempValue1 <<= 16275DrawArrow(Object.XPos, TempValue1, TempValue0, Object.YPos, 255, 255, 255, 0)276break277end switch278279if Object.PropertyValue == ROTATION_CCW_LINK_MOVINGBLOCKS280DrawLine(Object.XPos, Object.YPos, Object[-1].XPos, Object[-1].YPos, 0, 255, 255)281end if282end if283end sub284285286sub RSDKLoad287LoadSpriteSheet("R3/Objects.gif")288289SpriteFrame(-8, -8, 16, 16, 181, 143) // #0 - Spike Joint290SpriteFrame(-8, -8, 16, 16, 181, 160) // #1 - Spike291292CallFunction(EditorHelpers_FindTimePeriod)293AddEditorVariable("spikeType")294SetActiveVariable("spikeType")295switch CheckResult296default297case TIME_PRESENT298AddEnumVariable("5 Spikes Clock-wise", ROTATION_CLOCKWISE)299AddEnumVariable("5 Spikes Counter Clock-wise", ROTATION_COUNTERCLOCKWISE)300AddEnumVariable("5 Spikes Clock-wise, linked to moving blocks", ROTATION_CCW_LINK_MOVINGBLOCKS)301break302case TIME_PAST303AddEnumVariable("4 Spikes Clock-wise", ROTATION_CLOCKWISE)304AddEnumVariable("4 Spikes Counter Clock-wise", ROTATION_COUNTERCLOCKWISE)305AddEnumVariable("4 Spikes Clock-wise, linked to moving blocks", ROTATION_CCW_LINK_MOVINGBLOCKS)306break307case TIME_GOOD_FUTURE308case TIME_BAD_FUTURE309AddEnumVariable("6 Spikes Clock-wise", ROTATION_CLOCKWISE)310AddEnumVariable("6 Spikes Counter Clock-wise", ROTATION_COUNTERCLOCKWISE)311AddEnumVariable("6 Spikes Counter Clock-wise, linked to moving blocks", ROTATION_CCW_LINK_MOVINGBLOCKS)312break313end switch314AddEnumVariable("2 Spikes Counter Clock-wise", ROTATION_CCW_TWO_SPIKES)315AddEnumVariable("6 Spikes Clock-wise", ROTATION_CW_SIX_SPIKES)316end sub317318319