Path: blob/main/Scripts/Global/Transporter.txt
1319 views
//----------------Sonic CD Transporter Script-----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.FrameTimer6#alias Object.Value1 : Object.YOriginPos7#alias Object.Value2 : Object.Timer8#alias Object.Value3 : Object.Oscillation910// States11#alias 0 : TRANSPORTER_HOVER_DOWN12#alias 1 : TRANSPORTER_HOVER_UP13#alias 2 : TRANSPORTER_EXPLODE1415// Player16#alias 0 : PLAYER_SONIC_A1718// Property Values19#alias 0 : OPERATIVE20#alias 1 : OLD21#alias 2 : DESTROYED22#alias 3 : OLD_DESTROYED2324// Global SFX25#alias 21 : SFX_G_ACHIEVEMENT26#alias 22 : SFX_G_EXPLOSION2728// Priority29#alias 0 : PRIORITY_BOUNDS30#alias 1 : PRIORITY_ACTIVE3132// Directions33#alias 2 : FLIP_Y343536sub ObjectMain37if Object.PropertyValue == OPERATIVE38switch Object.State39case TRANSPORTER_HOVER_DOWN40Object.Timer++41if Object.Timer == 3242Object.Oscillation = 0x200043Object.Timer = 044Object.State = TRANSPORTER_HOVER_UP45end if46break4748case TRANSPORTER_HOVER_UP49Object.Timer++50if Object.Timer == 3251Object.Oscillation = -0x200052Object.Timer = 053Object.State = TRANSPORTER_HOVER_DOWN54end if55break5657case TRANSPORTER_EXPLODE58// Explosion code59Rand(TempValue0, 80)60TempValue0 -= 4061TempValue0 <<= 1662TempValue0 += Object.XPos6364Rand(TempValue1, 64)65TempValue1 -= 3266TempValue1 <<= 1667TempValue1 += Object.YPos6869CreateTempObject(TypeName[Explosion], 0, TempValue0, TempValue1)7071TempValue0 = Object.Timer72TempValue0 &= 373if TempValue0 == 074PlaySfx(SFX_G_EXPLOSION, false)75end if7677Object.Timer++78if Object.Timer == 6079Object.Priority = PRIORITY_BOUNDS80Object.Timer = 081Object.State = TRANSPORTER_HOVER_DOWN82Object.PropertyValue = DESTROYED8384Object.iYPos += 1685PlaySfx(SFX_G_ACHIEVEMENT, false)86end if87break88end switch89end if90end sub919293sub ObjectPlayerInteraction94if Object.PropertyValue == OPERATIVE95if Object.State < TRANSPORTER_EXPLODE96// if Player.Animation == ANI_JUMPING // Original check9798CheckEqual(Player.Animation, ANI_JUMPING)99TempValue0 = CheckResult100#platform: Use_Origins101CheckEqual(Player.Animation, ANI_GLIDING)102TempValue0 |= CheckResult103if Stage.PlayerListPos == PLAYER_AMY104if Player.Animation == ANI_HAMMER_JUMP105TempValue0 = true106end if107if Player.Animation == ANI_HAMMER_DASH108TempValue0 = true109end if110end if111#endplatform112if TempValue0 == true113PlayerObjectCollision(C_TOUCH, -38, -32, 38, 32)114if CheckResult == true115Object.State = TRANSPORTER_EXPLODE116117Object.YPos = Object.YOriginPos118119Transporter_Destroyed = true120Good_Future = true121122Object.Priority = PRIORITY_ACTIVE123124Player.Score += 1500125if Stage.ActNo < 3126TempValue0 = Stage.ListPos127TempValue0 /= 10128TempValue0 <<= 1129TempValue0 += Stage.ActNo130TempValue0--131SetBit(Good_Future_List, TempValue0, 1)132end if133134// Saviour of the Planet unlock criteria135if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins136if Stage.DebugMode == false137if Good_Future_List > 16382 // 0b11111111111110138if MetalSonic_List > 11139SetAchievement(11, 100)140end if141end if142end if143end if144145#platform: Use_Haptics146HapticEffect(90, 0, 0, 0)147#endplatform148149end if150else151PlayerObjectCollision(C_BOX, -38, -32, 38, 36)152if CheckResult == true153Player.YPos += Object.Oscillation154end if155156end if157158end if159160end if161end sub162163164sub ObjectDraw165switch Object.PropertyValue166case OPERATIVE167if Object.State < TRANSPORTER_EXPLODE168Object.YPos += Object.Oscillation169DrawSprite(Object.Frame)170DrawSpriteFX(Object.Frame, FX_FLIP, Object.XPos, Object.YPos)171172// Electricity173TempValue0 = Object.Frame174TempValue0 += 4175DrawSprite(TempValue0)176TempValue0 += 4177DrawSprite(TempValue0)178TempValue0 += 4179DrawSprite(TempValue0)180181Object.FrameTimer++182if Object.FrameTimer > 3183Object.FrameTimer = 0184Object.Frame++185if Object.Frame > 3186Object.Frame = 0187end if188end if189190end if191break192193case OLD194DrawSprite(17)195DrawSpriteFX(17, FX_FLIP, Object.XPos, Object.YPos)196break197198case DESTROYED199DrawSprite(16)200break201202case OLD_DESTROYED203DrawSprite(18)204break205end switch206end sub207208209sub ObjectStartup210LoadSpriteSheet("Global/Items3.gif")211SpriteFrame(-40, -32, 80, 24, 175, 61) // #0 - Transporter Frame 0212SpriteFrame(-40, -32, 80, 24, 175, 86) // #1 - Transporter Frame 1213SpriteFrame(-40, -32, 80, 24, 175, 111) // #2 - Transporter Frame 2214SpriteFrame(-40, -32, 80, 24, 175, 86) // #3 - Transporter Frame 3215SpriteFrame(-6, -8, 12, 16, 149, 1) // #4 - Electricity Frame 0216SpriteFrame(-6, -8, 12, 16, 162, 1) // #5 - Electricity Frame 1217SpriteFrame(-6, -8, 12, 16, 149, 18) // #6 - Electricity Frame 2218SpriteFrame(-6, -8, 12, 16, 162, 18) // #7 - Electricity Frame 3219SpriteFrame(-22, -8, 12, 16, 149, 1) // #8 - Electricity Frame 4220SpriteFrame(-22, -8, 12, 16, 162, 1) // #9 - Electricity Frame 5221SpriteFrame(-22, -8, 12, 16, 149, 18) // #10 - Electricity Frame 6222SpriteFrame(-22, -8, 12, 16, 162, 18) // #11 - Electricity Frame 7223SpriteFrame(10, -8, 12, 16, 149, 1) // #12 - Electricity Frame 8224SpriteFrame(10, -8, 12, 16, 162, 1) // #13 - Electricity Frame 9225SpriteFrame(10, -8, 12, 16, 149, 18) // #14 - Electricity Frame 10226SpriteFrame(10, -8, 12, 16, 162, 18) // #15 - Electricity Frame 11227SpriteFrame(-40, 16, 80, 16, 175, 44) // #16 - Transporter Destroyed228SpriteFrame(-40, -32, 80, 25, 175, 18) // #17 - Transporter Old229SpriteFrame(-40, 16, 80, 16, 175, 1) // #18 - Transporter Old Destroyed230231ArrayPos0 = 32232while ArrayPos0 < 1056233if Object[ArrayPos0].Type == TypeName[Transporter]234Object[ArrayPos0].Direction = FLIP_Y235236if Transporter_Destroyed == true237switch Object[ArrayPos0].PropertyValue238case OPERATIVE239Object[ArrayPos0].PropertyValue = DESTROYED240break241case OLD242Object[ArrayPos0].PropertyValue = OLD_DESTROYED243break244end switch245else246if Object[ArrayPos0].PropertyValue == OPERATIVE247Object[ArrayPos0].iYPos -= 16248end if249250Object[ArrayPos0].YOriginPos = Object[ArrayPos0].YPos251Object[ArrayPos0].Oscillation = -0x2000252end if253end if254ArrayPos0++255loop256end sub257258259// ========================260// Editor Subs261// ========================262263sub RSDKEdit264if Editor.ReturnVariable == true265switch Editor.VariableID266case EDIT_VAR_PROPVAL // Property Value267case 0 // inactive268CheckResult = Object.PropertyValue269break270end switch271else272switch Editor.VariableID273case EDIT_VAR_PROPVAL // Property Value274case 0 // inactive275Object.PropertyValue = Editor.VariableValue276break277end switch278end if279end sub280281282sub RSDKDraw283Object.Direction = FLIP_Y284285if Object.PropertyValue == OPERATIVE286// Machine287DrawSprite(0)288DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)289290// Electricity291DrawSprite(4)292DrawSprite(8)293DrawSprite(12)294else295DrawSprite(17)296DrawSpriteFX(17, FX_FLIP, Object.XPos, Object.YPos)297end if298end sub299300301sub RSDKLoad302LoadSpriteSheet("Global/Items3.gif")303SpriteFrame(-40, -32, 80, 24, 175, 61) // #0 - Transporter Frame 0304SpriteFrame(-40, -32, 80, 24, 175, 86) // #1 - Transporter Frame 1305SpriteFrame(-40, -32, 80, 24, 175, 111) // #2 - Transporter Frame 2306SpriteFrame(-40, -32, 80, 24, 175, 86) // #3 - Transporter Frame 3307SpriteFrame(-6, -8, 12, 16, 149, 1) // #4 - Electricity Frame 0308SpriteFrame(-6, -8, 12, 16, 162, 1) // #5 - Electricity Frame 1309SpriteFrame(-6, -8, 12, 16, 149, 18) // #6 - Electricity Frame 2310SpriteFrame(-6, -8, 12, 16, 162, 18) // #7 - Electricity Frame 3311SpriteFrame(-22, -8, 12, 16, 149, 1) // #8 - Electricity Frame 4312SpriteFrame(-22, -8, 12, 16, 162, 1) // #9 - Electricity Frame 5313SpriteFrame(-22, -8, 12, 16, 149, 18) // #10 - Electricity Frame 6314SpriteFrame(-22, -8, 12, 16, 162, 18) // #11 - Electricity Frame 7315SpriteFrame(10, -8, 12, 16, 149, 1) // #12 - Electricity Frame 8316SpriteFrame(10, -8, 12, 16, 162, 1) // #13 - Electricity Frame 9317SpriteFrame(10, -8, 12, 16, 149, 18) // #14 - Electricity Frame 10318SpriteFrame(10, -8, 12, 16, 162, 18) // #15 - Electricity Frame 11319SpriteFrame(-40, 16, 80, 16, 175, 44) // #16 - Transporter Destroyed320SpriteFrame(-40, -32, 80, 25, 175, 18) // #17 - Transporter Old321SpriteFrame(-40, 16, 80, 16, 175, 1) // #18 - Transporter Old Destroyed322323AddEditorVariable("inactive")324SetActiveVariable("inactive")325AddEnumVariable("False", false)326AddEnumVariable("True", true)327end sub328329330