Path: blob/main/Scripts/R4/EffectTrigger.txt
1319 views
//--------------Sonic CD Effect Trigger Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Property Values56// Level7#alias 0 : SET_BG_LAYER8#alias 1 : SWAP_BACKGROUND9#alias 2 : WATER_HEIGHT10#alias 13 : WATER_HEIGHT_2 // not sure if this is used1112// Pipes13#alias 4 : PIPE_BOTTOM_ENTRY14#alias 5 : PIPE_TOP_ENTRY15#alias 6 : PIPE_TURN_LEFT16#alias 7 : PIPE_TURN_RIGHT17#alias 8 : PIPE_TURN_UP18#alias 9 : PIPE_TURN_DOWN19#alias 10 : UNUSED20#alias 11 : UNUSED_221#alias 12 : PIPE_EXIT_PIPE222324sub ObjectMain25switch Object.PropertyValue26case SET_BG_LAYER27if Player.XPos < 0x2800000 // X - 640 in map coords28Stage[0].ActiveLayer = 1 // why it does this instead of starting with this layer directly? no clue2930Object.Type = TypeName[Blank Object]31Object[19].Type = TypeName[BGAnimation]32end if33break3435case SWAP_BACKGROUND36if Player.YPos > Object.YPos37Stage[0].ActiveLayer = 23839Object[19].Type = TypeName[BGAnimation]40else41Stage[0].ActiveLayer = 14243Object[19].Type = TypeName[BGAnimation]44end if45break4647case WATER_HEIGHT48if Player.XPos > Object.XPos49Stage.NewWaterLevel = 0x2640000 // Y - 612 in map coords50else51Stage.NewWaterLevel = 0x2840000 // Y - 644 in map coords52end if53break5455case PIPE_BOTTOM_ENTRY56PlayerObjectCollision(C_TOUCH, -10, -16, 10, 16)57if CheckResult == true58if Player.State != Player_State_Death59if Player.State != Player_State_Drown60Warp.Timer = 06162Player.State = Player_State_WaterCurrent63Player.Animation = ANI_FANROTATE6465Player.XVelocity = 066Player.YVelocity = -0x400006768if Player.XPos < Object.XPos69Player.XPos += 0x1000070else71Player.XPos -= 0x1000072end if73end if74end if75else76if Player.State == Player_State_WaterCurrent77PlayerObjectCollision(C_TOUCH, -64, -16, -32, 16)78if CheckResult == true7980#platform: Use_Origins81Player.State = Player_State_Air_NoDropDash82#endplatform8384#platform: Use_Standalone85Player.State = Player_State_Air86#endplatform8788Player.Animation = ANI_WALKING89end if9091PlayerObjectCollision(C_TOUCH, 32, -16, 64, 16)92if CheckResult == true9394#platform: Use_Origins95Player.State = Player_State_Air_NoDropDash96#endplatform9798#platform: Use_Standalone99Player.State = Player_State_Air100#endplatform101102Player.Animation = ANI_WALKING103end if104end if105end if106break107108case PIPE_TOP_ENTRY109PlayerObjectCollision(C_TOUCH, -10, -16, 10, 16)110if CheckResult == true111if Player.State != Player_State_Death112if Player.State != Player_State_Drown113Warp.Timer = 0114Player.State = Player_State_WaterCurrent115Player.Animation = ANI_FANROTATE116117Player.XVelocity = 0118Player.YVelocity = 0x40000119120if Player.XPos < Object.XPos121Player.XPos += 0x10000122else123Player.XPos -= 0x10000124end if125end if126end if127else128if Player.State == Player_State_WaterCurrent129PlayerObjectCollision(C_TOUCH, -64, -16, -32, 16)130if CheckResult == true131Player.State = Player_State_Ground132Player.Animation = ANI_WALKING133end if134135PlayerObjectCollision(C_TOUCH, 32, -16, 64, 16)136if CheckResult == true137Player.State = Player_State_Ground138Player.Animation = ANI_WALKING139end if140end if141end if142break143144case PIPE_TURN_LEFT145PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)146if CheckResult == true147if Player.State != Player_State_Death148if Player.State != Player_State_Drown149Player.XVelocity = -0x40000150Player.Animation = ANI_FANROTATE151end if152end if153end if154break155156case PIPE_TURN_RIGHT157PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)158if CheckResult == true159if Player.State != Player_State_Death160if Player.State != Player_State_Drown161Player.XVelocity = 0x40000162Player.Animation = ANI_FANROTATE163end if164end if165end if166break167168case PIPE_TURN_UP169PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)170if CheckResult == true171if Player.State != Player_State_Death172if Player.State != Player_State_Drown173Player.YVelocity = -0x40000174Player.Animation = ANI_FANROTATE175end if176end if177end if178break179180case PIPE_TURN_DOWN181PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)182if CheckResult == true183if Player.State != Player_State_Death184if Player.State != Player_State_Drown185Player.YVelocity = 0x40000186Player.Animation = ANI_FANROTATE187end if188end if189end if190break191192case UNUSED193PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)194if CheckResult == true195if Player.State != Player_State_Death196if Player.State != Player_State_Drown197Player.XVelocity = 0198end if199end if200end if201break202203case UNUSED_2204PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)205if CheckResult == true206if Player.State != Player_State_Death207if Player.State != Player_State_Drown208Player.YVelocity = 0209end if210end if211end if212break213214case PIPE_EXIT_PIPE215PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)216if CheckResult == true217if Player.State != Player_State_Death218if Player.State != Player_State_Drown219Player.YVelocity = 0x40000220221#platform: Use_Origins222Player.State = Player_State_Air_NoDropDash223#endplatform224225#platform: Use_Standalone226Player.State = Player_State_Air227#endplatform228229Player.Animation = ANI_WALKING230end if231end if232end if233break234235case WATER_HEIGHT_2236if Player.XPos > Object.XPos237Stage.NewWaterLevel = 0x7800000 // Y - 1920 in map coords238else239Stage.NewWaterLevel = 0x5340000 // Y - 1332 in map coords240end if241break242243end switch244end sub245246247// ========================248// Editor Subs249// ========================250251sub RSDKEdit252if Editor.ReturnVariable == true253switch Editor.VariableID254case EDIT_VAR_PROPVAL // Property Value255CheckResult = Object.PropertyValue256break257case 0 // effect258CheckResult = Object.PropertyValue259CheckResult %= 14260break261end switch262else263switch Editor.VariableID264case EDIT_VAR_PROPVAL // Property Value265Object.PropertyValue = Editor.VariableValue266break267case 0 // effect268Object.PropertyValue = Editor.VariableValue269Object.PropertyValue %= 14270break271end switch272end if273end sub274275276sub RSDKDraw277LoadSpriteSheet("Global/Display.gif")278TempValue5 = Object.SpriteSheet279LoadSpriteSheet("Players/Sonic3.gif")280TempValue6 = Object.SpriteSheet281282Object.InkEffect = 2283Object.Alpha = 198284285TempValue0 = Object.XPos286TempValue0 -= 0x300000287TempValue1 = Object.XPos288TempValue1 += 0x300000289TempValue2 = Object.YPos290TempValue2 -= 0x300000291TempValue3 = Object.YPos292TempValue3 += 0x300000293294switch Object.PropertyValue295case SET_BG_LAYER296case SWAP_BACKGROUND297case WATER_HEIGHT298case WATER_HEIGHT_2299Object.SpriteSheet = TempValue5300TempValue1 = Object.YPos301TempValue1 -= 0x80000302TempValue2 = Object.YPos303TempValue2 += 0x80000304TempValue0 = Object.XPos305TempValue0 -= 0x80000306DrawSpriteXY(1, TempValue0, TempValue1)307DrawSpriteXY(1, TempValue0, TempValue2)308TempValue0 = Object.XPos309TempValue0 += 0x80000310DrawSpriteXY(1, TempValue0, TempValue1)311DrawSpriteXY(1, TempValue0, TempValue2)312break313314case PIPE_BOTTOM_ENTRY315DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue3, 255, 0, 0)316317Object.SpriteSheet = TempValue5318DrawSpriteXY(1, Object.XPos, Object.YPos)319TempValue4 = Object.XPos320TempValue4 -= 0x100000321DrawSpriteXY(1, TempValue4, Object.YPos)322TempValue4 = Object.XPos323TempValue4 += 0x100000324DrawSpriteXY(1, TempValue4, Object.YPos)325break326case PIPE_TOP_ENTRY327DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue3, 255, 0, 0)328329Object.SpriteSheet = TempValue5330DrawSpriteXY(1, Object.XPos, Object.YPos)331TempValue4 = Object.XPos332TempValue4 -= 0x100000333DrawSpriteXY(1, TempValue4, Object.YPos)334TempValue4 = Object.XPos335TempValue4 += 0x100000336DrawSpriteXY(1, TempValue4, Object.YPos)337break338case PIPE_TURN_LEFT339DrawArrow(Object.XPos, Object.YPos, TempValue0, Object.YPos, 255, 0, 0)340341Object.SpriteSheet = TempValue6342DrawSpriteFX(4, FX_INK, Object.XPos, Object.YPos)343break344case PIPE_TURN_RIGHT345DrawArrow(Object.XPos, Object.YPos, TempValue1, Object.YPos, 255, 0, 0)346347Object.SpriteSheet = TempValue6348DrawSpriteFX(2, FX_INK, Object.XPos, Object.YPos)349break350case PIPE_TURN_UP351DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue2, 255, 0, 0)352353Object.SpriteSheet = TempValue6354DrawSpriteFX(3, FX_INK, Object.XPos, Object.YPos)355break356case PIPE_TURN_DOWN357DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue3, 255, 0, 0)358359Object.SpriteSheet = TempValue6360DrawSpriteFX(3, FX_INK, Object.XPos, Object.YPos)361break362case UNUSED363case UNUSED_2364DrawSpriteFX(4, FX_INK, Object.XPos, Object.YPos)365break366case PIPE_EXIT_PIPE367Object.SpriteSheet = TempValue6368DrawSpriteFX(3, FX_INK, Object.XPos, Object.YPos)369370Object.SpriteSheet = TempValue5371TempValue2 = Object.YPos372TempValue2 -= 0x100000373DrawSpriteXY(1, Object.XPos, TempValue2)374TempValue4 = Object.XPos375TempValue4 -= 0x100000376DrawSpriteXY(1, TempValue4, TempValue2)377TempValue4 = Object.XPos378TempValue4 += 0x100000379DrawSpriteXY(1, TempValue4, TempValue2)380TempValue2 = Object.YPos381TempValue2 += 0x300000382DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue2, 255, 0, 0)383break384end switch385end sub386387388sub RSDKLoad389LoadSpriteSheet("Global/Display.gif")390SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon391SpriteFrame(-8, -8, 16, 16, 173, 67) // #1 - "T" Icon392393LoadSpriteSheet("Players/Sonic3.gif")394SpriteFrame(-28, -12, 56, 24, 199, 75) // #2 - Sonic Fan Rotate frame 0395SpriteFrame(-24, -12, 48, 24, 207, 125) // #3 - Sonic Fan Rotate frame 1396SpriteFrame(-28, -12, 56, 24, 199, 100) // #4 - Sonic Fan Rotate frame 2397398AddEditorVariable("effect")399SetActiveVariable("effect")400AddEnumVariable("Set background layer", SET_BG_LAYER)401AddEnumVariable("Swap backgrounds", SWAP_BACKGROUND)402AddEnumVariable("Set water height", WATER_HEIGHT)403AddEnumVariable("Stream entry (Bottom)", PIPE_BOTTOM_ENTRY)404AddEnumVariable("Stream entry (Top)", PIPE_TOP_ENTRY)405AddEnumVariable("Stream turn (Left)", PIPE_TURN_LEFT)406AddEnumVariable("Stream turn (Right)", PIPE_TURN_RIGHT)407AddEnumVariable("Stream turn (Up)", PIPE_TURN_UP)408AddEnumVariable("Stream turn (Down)", PIPE_TURN_DOWN)409AddEnumVariable("Stop horizontal speed", UNUSED)410AddEnumVariable("Stop vertical speed", UNUSED_2)411AddEnumVariable("Exit stream", PIPE_EXIT_PIPE)412AddEnumVariable("Set water height (Bottom of level)", WATER_HEIGHT_2)413end sub414415416