Path: blob/main/Scripts/TAttack/SpecialIcon.txt
1319 views
//----------------Sonic CD Special Icon Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer6#alias Object.Value1 : Object.Minutes7#alias Object.Value2 : Object.Seconds8#alias Object.Value3 : Object.Milliseconds9#alias Object.Value4 : Object.LockedZone10#alias Object.PropertyValue : Object.Portrait1112// Menu Control Aliases13#alias Object[0].Value2 : MenuControl.SelectedButton // Only used for Mobile14#alias Object[0].Value3 : MenuControl.SavedRound // This is used AFTER you play in time attack15#alias Object[0].State : MenuControl.State // This is used AFTER you play in time attack1617// States18#alias 0 : ROUNDICON_BLANK19#alias 1 : ROUNDICON_SELECTED_ZONE2021// MenuControl States22#alias 2 : MENUCONTROL_CONTROLS23#alias 3 : MENUCONTROL_BLANK24#alias 4 : MENUCONTROL_RETURN_TO_MENU25#alias 5 : MENUCONTROL_ENTER_SM2627// Global SFX28#alias 27 : SFX_G_SELECT2930// Property Values31#alias 0 : SPECIAL_STAGE_1_ICON32#alias 1 : SPECIAL_STAGE_2_ICON33#alias 2 : SPECIAL_STAGE_3_ICON34#alias 3 : SPECIAL_STAGE_4_ICON35#alias 4 : SPECIAL_STAGE_5_ICON36#alias 5 : SPECIAL_STAGE_6_ICON37#alias 6 : SPECIAL_STAGE_7_ICON38#alias 7 : EXIT_ICON394041sub ObjectMain42#platform: Mobile43if Options.PhysicalControls == false44if MenuControl.State == MENUCONTROL_CONTROLS45TempValue0 = Object.iXPos46TempValue0 -= 3447TempValue1 = Object.iXPos48TempValue1 += 3449TempValue2 = Object.iYPos50TempValue2 -= 4551TempValue3 = Object.iYPos52TempValue3 += 4553CheckTouchRect(TempValue0, TempValue2, TempValue1, TempValue3)54if CheckResult > -155MenuControl.SelectedButton = Object.PropertyValue56else57CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)58if CheckResult < 059if MenuControl.SelectedButton == Object.PropertyValue60PlaySfx(SFX_G_SELECT, false)61MenuControl.State = MENUCONTROL_BLANK62Object.State = ROUNDICON_SELECTED_ZONE63if Object.Portrait == EXIT_ICON64StopMusic()65end if66end if67else68if MenuControl.SelectedButton == Object.Portrait69MenuControl.SelectedButton = -170end if71end if72end if73end if74end if75#endplatform76end sub777879sub ObjectDraw80DrawSprite(10)81// Icon Movement82Object.Rotation++83Object.Rotation &= 51184Cos(TempValue0, Object.Rotation)85TempValue0 >>= 486Sin(TempValue1, Object.Rotation)87TempValue1 >>= 48889switch Object.Portrait90case SPECIAL_STAGE_1_ICON91TempValue0 += 6492TempValue1 += 36493break94case SPECIAL_STAGE_2_ICON95TempValue0 += 19296TempValue1 += 36497break98case SPECIAL_STAGE_3_ICON99TempValue0 += 320100TempValue1 += 364101break102case SPECIAL_STAGE_4_ICON103TempValue0 += 448104TempValue1 += 364105break106case SPECIAL_STAGE_5_ICON107TempValue0 += 64108TempValue1 += 508109break110case SPECIAL_STAGE_6_ICON111TempValue0 += 192112TempValue1 += 508113break114case SPECIAL_STAGE_7_ICON115TempValue0 += 320116TempValue1 += 508117break118end switch119120if Object.Portrait < EXIT_ICON // Draw for all special stages121VertexBuffer[0].x = Object.XPos122VertexBuffer[0].x >>= 16123VertexBuffer[0].x -= 32124VertexBuffer[0].u = TempValue0125VertexBuffer[0].u -= 32126VertexBuffer[0].y = Object.YPos127VertexBuffer[0].y >>= 16128VertexBuffer[0].y -= 43129VertexBuffer[0].v = TempValue1130VertexBuffer[0].v -= 43131VertexBuffer[1].x = Object.XPos132VertexBuffer[1].x >>= 16133VertexBuffer[1].x += 31134VertexBuffer[1].u = TempValue0135VertexBuffer[1].u += 31136VertexBuffer[1].y = VertexBuffer[0].y137VertexBuffer[1].v = VertexBuffer[0].v138VertexBuffer[2].x = VertexBuffer[0].x139VertexBuffer[2].u = VertexBuffer[0].u140VertexBuffer[2].y = Object.YPos141VertexBuffer[2].y >>= 16142VertexBuffer[2].y += 24143VertexBuffer[2].v = TempValue1144VertexBuffer[2].v += 24145VertexBuffer[3].x = VertexBuffer[1].x146VertexBuffer[3].u = VertexBuffer[1].u147VertexBuffer[3].y = VertexBuffer[2].y148VertexBuffer[3].v = VertexBuffer[2].v149Draw3DScene()150DrawSprite(19)151152TempValue0 = Object.XPos153TempValue0 >>= 16154TempValue0 -= 24155TempValue1 = Object.YPos156TempValue1 >>= 16157TempValue1 += 34158// Zone specific time159DrawNumbers(0, TempValue0, TempValue1, Object.Minutes, 2, 6, 1)160TempValue0 += 16161DrawNumbers(0, TempValue0, TempValue1, Object.Seconds, 2, 6, 1)162TempValue0 += 19163DrawNumbers(0, TempValue0, TempValue1, Object.Milliseconds, 2, 6, 1)164else // Draw the Exit165DrawSprite(20)166TempValue0 = Object.XPos167TempValue0 >>= 16168TempValue0 -= 18169TempValue1 = Object.YPos170TempValue1 >>= 16171TempValue1 += 34172// Total Time173DrawNumbers(0, TempValue0, TempValue1, Object.Minutes, 3, 6, 1)174TempValue0 += 16175DrawNumbers(0, TempValue0, TempValue1, Object.Seconds, 2, 6, 1)176TempValue0 += 19177DrawNumbers(0, TempValue0, TempValue1, Object.Milliseconds, 2, 6, 1)178DrawSprite(22)179end if180181DrawSprite(Object.Frame)182if Object.State == ROUNDICON_SELECTED_ZONE183TempValue0 = Object.Timer184TempValue0 &= 3185TempValue0 >>= 1186if TempValue0 == 0187if MenuControl.SavedRound == Object.Portrait188DrawSprite(21)189end if190end if191192Object.Timer++193if Object.Timer == 30194Object.Timer = 0195Object.State = ROUNDICON_BLANK196if Object.Portrait == EXIT_ICON197MenuControl.State = MENUCONTROL_RETURN_TO_MENU198else199MenuControl.State = MENUCONTROL_ENTER_SM200MenuControl.SelectedButton = -1201end if202end if203else204if MenuControl.State == MENUCONTROL_CONTROLS205if MenuControl.SavedRound == Object.PropertyValue206DrawSprite(21)207end if208end if209end if210end sub211212213sub ObjectStartup214LoadSpriteSheet("TAttack/TimeAttack.gif")215216SpriteFrame(0, 0, 6, 8, 330, 577) // #0 - 0217SpriteFrame(0, 0, 6, 8, 337, 577) // #1 - 1218SpriteFrame(0, 0, 6, 8, 344, 577) // #2 - 2219SpriteFrame(0, 0, 6, 8, 351, 577) // #3 - 3220SpriteFrame(0, 0, 6, 8, 330, 586) // #4 - 4221SpriteFrame(0, 0, 6, 8, 337, 586) // #5 - 5222SpriteFrame(0, 0, 6, 8, 344, 586) // #6 - 6223SpriteFrame(0, 0, 6, 8, 351, 586) // #7 - 7224SpriteFrame(0, 0, 6, 8, 330, 595) // #8 - 8225SpriteFrame(0, 0, 6, 8, 337, 595) // #9 - 9226SpriteFrame(-34, -45, 68, 90, 1, 609) // #10 - Border227SpriteFrame(-32, 15, 64, 16, 66, 764) // #11 - Special Zone 1228SpriteFrame(-32, 15, 64, 16, 131, 764) // #12 - Special Zone 2229SpriteFrame(-32, 15, 64, 16, 196, 764) // #13 - Special Zone 3230SpriteFrame(-32, 15, 64, 16, 261, 764) // #14 - Special Zone 4231SpriteFrame(-32, 15, 64, 16, 66, 780) // #15 - Special Zone 5232SpriteFrame(-32, 15, 64, 16, 131, 780) // #16 - Special Zone 6233SpriteFrame(-32, 15, 64, 16, 196, 780) // #17 - Special Zone 7234SpriteFrame(-32, 15, 64, 16, 265, 593) // #18 - Total Time235SpriteFrame(-32, 31, 64, 13, 70, 638) // #19 - ' "236SpriteFrame(-32, 31, 64, 13, 70, 652) // #20 - ' "237SpriteFrame(-35, -46, 70, 92, 441, 860) // #21 - Selected Border238SpriteFrame(-29, -22, 56, 21, 223, 679) // #22 - Exit239240ArrayPos0 = 32241while ArrayPos0 < 1056242if Object[ArrayPos0].Type == TypeName[Special Icon]243Object[ArrayPos0].Frame = Object[ArrayPos0].Portrait244Object[ArrayPos0].Frame += 11245246Object[ArrayPos0].Rotation = Object[ArrayPos0].Portrait247Object[ArrayPos0].Rotation <<= 8248249if Object[ArrayPos0].Portrait > 3250Object[ArrayPos0].Rotation += 256251end if252end if253ArrayPos0++254loop255end sub256257258// ========================259// Editor Subs260// ========================261262sub RSDKEdit263if Editor.ReturnVariable == true264switch Editor.VariableID265case EDIT_VAR_PROPVAL // Property Value266CheckResult = Object.PropertyValue267CheckResult &= 7268break269case 0 // roundID270CheckResult = Object.PropertyValue271CheckResult &= 7272break273end switch274else275switch Editor.VariableID276case EDIT_VAR_PROPVAL // Property Value277Object.PropertyValue = Editor.VariableValue278Object.PropertyValue &= 7279break280case 0 // roundID281Object.PropertyValue = Editor.VariableValue282Object.PropertyValue &= 7283break284end switch285end if286end sub287288289sub RSDKDraw290Object.Frame = Object.PropertyValue291Object.Frame += 11292293DrawSprite(10)294295if Object.PropertyValue < 7 // Draw for all main stages296DrawSprite(19)297else // Draw the Exit298DrawSprite(20)299DrawSprite(22)300end if301302DrawSprite(Object.Frame)303end sub304305306sub RSDKLoad307LoadSpriteSheet("TAttack/TimeAttack.gif")308SpriteFrame(0, 0, 6, 8, 330, 577) // #0 - 0309SpriteFrame(0, 0, 6, 8, 337, 577) // #1 - 1310SpriteFrame(0, 0, 6, 8, 344, 577) // #2 - 2311SpriteFrame(0, 0, 6, 8, 351, 577) // #3 - 3312SpriteFrame(0, 0, 6, 8, 330, 586) // #4 - 4313SpriteFrame(0, 0, 6, 8, 337, 586) // #5 - 5314SpriteFrame(0, 0, 6, 8, 344, 586) // #6 - 6315SpriteFrame(0, 0, 6, 8, 351, 586) // #7 - 7316SpriteFrame(0, 0, 6, 8, 330, 595) // #8 - 8317SpriteFrame(0, 0, 6, 8, 337, 595) // #9 - 9318SpriteFrame(-34, -45, 68, 90, 1, 609) // #10 - Border319SpriteFrame(-32, 15, 64, 16, 66, 764) // #11 - Special Zone 1320SpriteFrame(-32, 15, 64, 16, 131, 764) // #12 - Special Zone 2321SpriteFrame(-32, 15, 64, 16, 196, 764) // #13 - Special Zone 3322SpriteFrame(-32, 15, 64, 16, 261, 764) // #14 - Special Zone 4323SpriteFrame(-32, 15, 64, 16, 66, 780) // #15 - Special Zone 5324SpriteFrame(-32, 15, 64, 16, 131, 780) // #16 - Special Zone 6325SpriteFrame(-32, 15, 64, 16, 196, 780) // #17 - Special Zone 7326SpriteFrame(-32, 15, 64, 16, 265, 593) // #18 - Total Time327SpriteFrame(-32, 31, 64, 13, 70, 638) // #19 - ' "328SpriteFrame(-32, 31, 64, 13, 70, 652) // #20 - ' "329SpriteFrame(-35, -46, 70, 92, 441, 860) // #21 - Selected Border330SpriteFrame(-29, -22, 56, 21, 223, 679) // #22 - Exit331332AddEditorVariable("roundID")333SetActiveVariable("roundID")334AddEnumVariable("Special Zone 1", 0)335AddEnumVariable("Special Zone 2", 1)336AddEnumVariable("Special Zone 3", 2)337AddEnumVariable("Special Zone 4", 3)338AddEnumVariable("Special Zone 5", 4)339AddEnumVariable("Special Zone 6", 5)340AddEnumVariable("Special Zone 7", 6)341AddEnumVariable("Total Time", 7)342end sub343344345