Path: blob/main/Scripts/R4/Fan.txt
1319 views
//--------------------Sonic CD Fan Script---------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//345// Button alias6#alias Object.PropertyValue : PushButton.Pressed78// HUD alias9#alias Object[24].PropertyValue : HUD.CurrentTimePeriod1011// States / Property Values12// These are based on Property Value, so technically they are named the same13#alias 0 : VERTICAL_FAN_OFF14#alias 1 : VERTICAL_FAN_ON15#alias 2 : HORIZONTAL_FAN_OFF16#alias 3 : HORIZONTAL_FAN_ON17#alias 4 : HORIZONTAL_FAN_LEFT_OFF18#alias 5 : HORIZONTAL_FAN_LEFT_ON1920// Time Periods21#alias 0 : TIME_PRESENT22#alias 1 : TIME_PAST23#alias 2 : TIME_GOOD_FUTURE24#alias 3 : TIME_BAD_FUTURE25262728sub ObjectMain29switch Object.State30case VERTICAL_FAN_OFF31case HORIZONTAL_FAN_OFF32if PushButton[-1].Pressed == true33Object.PropertyValue = VERTICAL_FAN_ON34Object.State++35end if36break3738case VERTICAL_FAN_ON39case HORIZONTAL_FAN_ON40if HUD.CurrentTimePeriod < 241Object.Frame++42if Object.Frame > 943Object.Frame = 044end if45else46Object.Frame = 247end if48break4950end switch51end sub525354sub ObjectDraw55switch Object.State56case VERTICAL_FAN_OFF57DrawSprite(0)58break5960case VERTICAL_FAN_ON61TempValue0 = Object.Frame62TempValue0 >>= 163DrawSprite(TempValue0)64break6566case HORIZONTAL_FAN_OFF67DrawSpriteFX(5, FX_FLIP, Object.XPos, Object.YPos)68break6970case HORIZONTAL_FAN_ON71TempValue0 = Object.Frame72TempValue0 >>= 173TempValue0 += 574DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)75break7677end switch78end sub798081sub ObjectStartup82switch HUD.CurrentTimePeriod83case TIME_PRESENT84case TIME_PAST85LoadSpriteSheet("R4/Objects.gif")8687SpriteFrame(-16, -8, 32, 16, 163, 35) // #0 - Fan vertical frame 088SpriteFrame(-12, -8, 24, 16, 229, 1) // #1 - Fan vertical frame 189SpriteFrame(-8, -8, 16, 16, 229, 18) // #2 - Fan vertical frame 290SpriteFrame(-12, -8, 24, 16, 196, 35) // #3 - Fan vertical frame 391SpriteFrame(-16, -8, 32, 16, 221, 35) // #4 - Fan vertical frame 492SpriteFrame(-8, -16, 16, 32, 239, 136) // #5 - Fan horizontal frame 093SpriteFrame(-8, -12, 16, 24, 222, 169) // #6 - Fan horizontal frame 194SpriteFrame(-8, -8, 16, 16, 239, 194) // #7 - Fan horizontal frame 295SpriteFrame(-8, -12, 16, 24, 239, 169) // #8 - Fan horizontal frame 396SpriteFrame(-8, -16, 16, 32, 222, 136) // #9 - Fan horizontal frame 497break9899case TIME_GOOD_FUTURE100LoadSpriteSheet("R4/Objects3.gif")101102SpriteFrame(-16, -8, 32, 16, 51, 67) // #0 - Future fan vertical off103SpriteFrame(-16, -8, 32, 16, 51, 84) // #1 - Future fan vertical on104SpriteFrame(-16, -8, 32, 16, 51, 84) // #2 - Future fan vertical on105SpriteFrame(-16, -8, 32, 16, 51, 84) // #3 - Future fan vertical on106SpriteFrame(-16, -8, 32, 16, 51, 84) // #4 - Future fan vertical on107SpriteFrame(-8, -16, 16, 32, 50, 101) // #5 - Future fan horizontal off108SpriteFrame(-8, -16, 16, 32, 67, 101) // #6 - Future fan horizontal on109SpriteFrame(-8, -16, 16, 32, 67, 101) // #7 - Future fan horizontal on110SpriteFrame(-8, -16, 16, 32, 67, 101) // #8 - Future fan horizontal on111SpriteFrame(-8, -16, 16, 32, 67, 101) // #9 - Future fan horizontal on112break113114case TIME_BAD_FUTURE115LoadSpriteSheet("R4/Objects3.gif")116117SpriteFrame(-16, -8, 32, 16, 62, 228) // #0 - Future fan vertical off118SpriteFrame(-16, -8, 32, 16, 94, 228) // #1 - Future fan vertical on119SpriteFrame(-16, -8, 32, 16, 94, 228) // #2 - Future fan vertical on120SpriteFrame(-16, -8, 32, 16, 94, 228) // #3 - Future fan vertical on121SpriteFrame(-16, -8, 32, 16, 94, 228) // #4 - Future fan vertical on122SpriteFrame(-8, -16, 16, 32, 76, 144) // #5 - Future fan horizontal off123SpriteFrame(-8, -16, 16, 32, 93, 144) // #6 - Future fan horizontal on124SpriteFrame(-8, -16, 16, 32, 93, 144) // #7 - Future fan horizontal on125SpriteFrame(-8, -16, 16, 32, 93, 144) // #8 - Future fan horizontal on126SpriteFrame(-8, -16, 16, 32, 93, 144) // #9 - Future fan horizontal on127break128129end switch130131ArrayPos0 = 32132while ArrayPos0 < 1056133if Object[ArrayPos0].Type == TypeName[Fan]134Object[ArrayPos0].State = Object[ArrayPos0].PropertyValue135136if Object[ArrayPos0].PropertyValue > 3137Object[ArrayPos0].State -= 2138Object[ArrayPos0].Direction = FACING_LEFT139end if140141Object[ArrayPos0].PropertyValue &= 1142end if143ArrayPos0++144loop145end sub146147148// ========================149// Editor Subs150// ========================151152sub RSDKEdit153if Editor.ReturnVariable == true154switch Editor.VariableID155case EDIT_VAR_PROPVAL // Property Value156CheckResult = Object.PropertyValue157break158case 0 // type159CheckResult = Object.PropertyValue160break161end switch162else163switch Editor.VariableID164case EDIT_VAR_PROPVAL // Property Value165Object.PropertyValue = Editor.VariableValue166break167case 0 // type168Object.PropertyValue = Editor.VariableValue169break170end switch171end if172end sub173174175sub RSDKDraw176if Object.PropertyValue > 3177Object.Direction = FACING_LEFT178end if179DrawSpriteFX(Object.PropertyValue, FX_FLIP, Object.XPos, Object.YPos)180end sub181182183sub RSDKLoad184CallFunction(EditorHelpers_FindTimePeriod)185switch CheckResult186case TIME_PRESENT187case TIME_PAST188LoadSpriteSheet("R4/Objects.gif")189190SpriteFrame(-16, -8, 32, 16, 163, 35) // #0 - Fan vertical frame 0191SpriteFrame(-12, -8, 24, 16, 229, 1) // #1 - Fan vertical frame 1192SpriteFrame(-8, -16, 16, 32, 239, 136) // #5 - Fan horizontal frame 0193SpriteFrame(-8, -12, 16, 24, 222, 169) // #6 - Fan horizontal frame 1194SpriteFrame(-8, -16, 16, 32, 239, 136) // #5 - Fan horizontal frame 0195SpriteFrame(-8, -12, 16, 24, 222, 169) // #6 - Fan horizontal frame 1196break197198case TIME_GOOD_FUTURE199LoadSpriteSheet("R4/Objects3.gif")200201SpriteFrame(-16, -8, 32, 16, 51, 67) // #0 - Future fan vertical off202SpriteFrame(-16, -8, 32, 16, 51, 84) // #1 - Future fan vertical on203SpriteFrame(-8, -16, 16, 32, 50, 101) // #5 - Future fan horizontal off204SpriteFrame(-8, -16, 16, 32, 67, 101) // #6 - Future fan horizontal on205SpriteFrame(-8, -16, 16, 32, 50, 101) // #5 - Future fan horizontal off206SpriteFrame(-8, -16, 16, 32, 67, 101) // #6 - Future fan horizontal on207break208209case TIME_BAD_FUTURE210LoadSpriteSheet("R4/Objects3.gif")211212SpriteFrame(-16, -8, 32, 16, 62, 228) // #0 - Future fan vertical off213SpriteFrame(-16, -8, 32, 16, 94, 228) // #1 - Future fan vertical on214SpriteFrame(-8, -16, 16, 32, 76, 144) // #5 - Future fan horizontal off215SpriteFrame(-8, -16, 16, 32, 93, 144) // #6 - Future fan horizontal on216SpriteFrame(-8, -16, 16, 32, 76, 144) // #5 - Future fan horizontal off217SpriteFrame(-8, -16, 16, 32, 93, 144) // #6 - Future fan horizontal on218break219220end switch221222AddEditorVariable("type")223SetActiveVariable("type")224AddEnumVariable("Vertical Fan (Off)", VERTICAL_FAN_OFF)225AddEnumVariable("Vertical Fan (On)", VERTICAL_FAN_ON)226AddEnumVariable("Horizontal Fan (Off)", HORIZONTAL_FAN_OFF)227AddEnumVariable("Horizontal Fan (On)", HORIZONTAL_FAN_ON)228AddEnumVariable("Horizontal Fan Facing Left (Off)", HORIZONTAL_FAN_LEFT_OFF)229AddEnumVariable("Horizontal Fan Facing Left (On)", HORIZONTAL_FAN_LEFT_ON)230231end sub232233234