Path: blob/main/Scripts/DAGarden/LittlePlanet.txt
1319 views
//---------------Sonic CD Little Planet Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value1 : Object.ZoomDepth6#alias Object.Value2 : Object.RotationLimit7#alias Object.Value3 : Object.RotationSpeed8#alias Object.Value4 : Object.RotationDirection9#alias Object.Value5 : Object.ZoomIn10#alias Object.Value6 : Object.Drag11#alias Object.Value7 : Object.TouchInput1213// MenuControl Alias14#alias Object[0].State : MenuControl.State1516// MenuControl States17#alias 2 : MENUCONTROL_IDLE1819sub ObjectMain20if MenuControl.State == MENUCONTROL_IDLE21// Update Little Planet control22// Most of the things here are for physical controllers - touch input is handled in the Touch Buttons object2324// Planet Movement25if KeyDown[0].Left == true26if Object.XPos > -0x40027Object.XPos--28end if29end if3031if KeyDown[0].Right == true32if Object.XPos < 0x40033Object.XPos++34end if35end if3637if KeyDown[0].Up == true38Object.YPos--39end if4041if KeyDown[0].Down == true42Object.YPos++43end if4445// Rotation46// Previously ButtonB, Origins change47if KeyDown[0].Start == true // Increase rotation speed48if Object.RotationDirection == FACING_LEFT49if Object.RotationSpeed < 25650Object.RotationSpeed += 251end if52else53if Object.RotationSpeed > -25654Object.RotationSpeed -= 255end if56end if57end if5859if KeyPress[0].Start == true // Flip Rotation60Object.RotationDirection++61Object.RotationDirection &= 162Object.RotationSpeed = 063end if6465// Zooming66if KeyDown[0].ButtonC == true // Zoom In/Out67if Object.ZoomIn == false68if Object.ZoomDepth < 0x400069Object.ZoomDepth += 870end if71else72if Object.ZoomDepth > 4873Object.ZoomDepth -= 874end if75end if76end if7778if KeyPress[0].ButtonC == true // Switch Zoom In / Zoom Out79Object.ZoomIn++80Object.ZoomIn &= 181end if8283// Touch Input Planet Movement84CheckTouchRect(0, 32, Screen.XSize, 208)85if CheckResult > -186if Object.TouchInput != CheckResult87Object.Drag = false88end if89ArrayPos0 = CheckResult90if Object.Drag == false91Object.Drag = true92Object.TouchInput = CheckResult93Object[0].XPos = TouchScreen[ArrayPos0].XPos94Object[0].YPos = TouchScreen[ArrayPos0].YPos95Object[1].XPos = Object.XPos96Object[1].YPos = Object.YPos97else98TempValue0 = TouchScreen[ArrayPos0].XPos99TempValue0 -= Object[0].XPos100TempValue0 *= Object.ZoomDepth101TempValue0 >>= 11102TempValue0 += Object[1].XPos103TempValue1 = TempValue0104TempValue1 -= Object.XPos105if TempValue1 < 0106FlipSign(TempValue1)107end if108if TempValue1 < 14109Object.XPos = TempValue0110end if111TempValue0 = TouchScreen[ArrayPos0].YPos112TempValue0 -= Object[0].YPos113TempValue0 *= Object.ZoomDepth114TempValue0 >>= 11115TempValue0 += Object[1].YPos116TempValue1 = TempValue0117TempValue1 -= Object.YPos118if TempValue1 < 0119FlipSign(TempValue1)120end if121if TempValue1 < 14122Object.YPos = TempValue0123end if124end if125else126Object.Drag = false127end if128end if129130Object.RotationLimit += Object.RotationSpeed131if Object.RotationLimit < 0132Object.RotationLimit += 0x2000133end if134Object.RotationLimit &= 0x1FFF135136Object.Rotation = Object.RotationLimit137Object.Rotation >>= 4138end sub139140141sub ObjectDraw142if Object.Frame == 22143DrawRect(0, 32, Screen.XSize, 176, 64, 64, 32, 176)144end if145146if Object.ZoomDepth > 0147TempValue0 = Object.XPos148TempValue0 <<= 11149TempValue0 /= Object.ZoomDepth150TempValue0 += Screen.CenterX151152TempValue1 = Object.YPos153TempValue1 <<= 11154TempValue1 /= Object.ZoomDepth155TempValue1 += 120156157Object.Scale = 0x20000158Object.Scale /= Object.ZoomDepth159DrawSpriteScreenFX(Object.Frame, FX_ROTOZOOM, TempValue0, TempValue1)160161TempValue2 = Object.AnimationTimer162TempValue2 >>= 3163TempValue3 = Object.Frame164switch TempValue2165case 0166TempValue3++167DrawSpriteScreenFX(TempValue3, FX_ROTOZOOM, TempValue0, TempValue1)168break169170case 1171TempValue3 += 2172DrawSpriteScreenFX(TempValue3, FX_ROTOZOOM, TempValue0, TempValue1)173break174175case 2176TempValue3 += 3177DrawSpriteScreenFX(TempValue3, FX_ROTOZOOM, TempValue0, TempValue1)178break179180case 3181TempValue3 += 4182DrawSpriteScreenFX(TempValue3, FX_ROTOZOOM, TempValue0, TempValue1)183break184185case 4186TempValue3 += 5187DrawSpriteScreenFX(TempValue3, FX_ROTOZOOM, TempValue0, TempValue1)188break189190case 24191TempValue3 += 6192DrawSpriteScreenFX(TempValue3, FX_ROTOZOOM, TempValue0, TempValue1)193break194195case 25196TempValue3 += 7197DrawSpriteScreenFX(TempValue3, FX_ROTOZOOM, TempValue0, TempValue1)198break199200case 26201TempValue3 += 8202DrawSpriteScreenFX(TempValue3, FX_ROTOZOOM, TempValue0, TempValue1)203break204205case 27206TempValue3 += 9207DrawSpriteScreenFX(TempValue3, FX_ROTOZOOM, TempValue0, TempValue1)208break209210case 28211TempValue3 += 10212DrawSpriteScreenFX(TempValue3, FX_ROTOZOOM, TempValue0, TempValue1)213break214215end switch216Object.AnimationTimer++217Object.AnimationTimer &= 511218end if219end sub220221222sub ObjectStartup223LoadSpriteSheet("DAGarden/LittlePlanet.gif")224225SpriteFrame(-126, -126, 252, 252, 0, 0) // #0 - Little Planet226SpriteFrame(95, -70, 16, 16, 256, 257) // #1 - Vulkan Smoke Frame 0227SpriteFrame(91, -75, 24, 24, 256, 274) // #2 - Vulkan Smoke Frame 1228SpriteFrame(92, -88, 32, 32, 256, 299) // #3 - Vulkan Smoke Frame 2229SpriteFrame(86, -92, 40, 40, 256, 332) // #4 - Vulkan Smoke Frame 3230SpriteFrame(85, -94, 40, 40, 256, 373) // #5 - Vulkan Smoke Frame 4231SpriteFrame(76, -90, 16, 16, 273, 257) // #6 - Vulkan Smoke Frame 5232SpriteFrame(75, -97, 24, 24, 281, 274) // #7 - Vulkan Smoke Frame 6233SpriteFrame(73, -104, 32, 32, 289, 299) // #8 - Vulkan Smoke Frame 7234SpriteFrame(76, -107, 32, 32, 297, 332) // #9 - Vulkan Smoke Frame 8235SpriteFrame(75, -110, 32, 32, 297, 365) // #10 - Vulkan Smoke Frame 9236SpriteFrame(-126, -126, 252, 252, 256, 0) // #11 - Little Planet Good Future237SpriteFrame(95, -70, 16, 16, 330, 257) // #12 - GF Vulkan Smoke Frame 0238SpriteFrame(91, -75, 24, 24, 330, 274) // #13 - GF Vulkan Smoke Frame 1239SpriteFrame(92, -88, 32, 32, 330, 299) // #14 - GF Vulkan Smoke Frame 2240SpriteFrame(86, -92, 40, 40, 330, 332) // #15 - GF Vulkan Smoke Frame 3241SpriteFrame(85, -94, 40, 40, 330, 373) // #16 - GF Vulkan Smoke Frame 4242SpriteFrame(76, -90, 16, 16, 347, 257) // #17 - GF Vulkan Smoke Frame 5243SpriteFrame(75, -97, 24, 24, 355, 274) // #18 - GF Vulkan Smoke Frame 6244SpriteFrame(73, -104, 32, 32, 363, 299) // #19 - GF Vulkan Smoke Frame 7245SpriteFrame(76, -107, 32, 32, 371, 332) // #20 - GF Vulkan Smoke Frame 8246SpriteFrame(75, -110, 32, 32, 371, 365) // #21 - GF Vulkan Smoke Frame 9247SpriteFrame(-126, -126, 252, 252, 0, 256) // #22 - Little Planet Bad Future248SpriteFrame(95, -70, 16, 16, 404, 257) // #23 - BF Vulkan Smoke Frame 0249SpriteFrame(91, -75, 24, 24, 404, 274) // #24 - BF Vulkan Smoke Frame 1250SpriteFrame(92, -88, 32, 32, 404, 299) // #25 - BF Vulkan Smoke Frame 2251SpriteFrame(86, -92, 40, 40, 404, 332) // #26 - BF Vulkan Smoke Frame 3252SpriteFrame(85, -94, 40, 40, 404, 373) // #27 - BF Vulkan Smoke Frame 4253SpriteFrame(76, -90, 16, 16, 421, 257) // #28 - BF Vulkan Smoke Frame 5254SpriteFrame(75, -97, 24, 24, 429, 274) // #29 - BF Vulkan Smoke Frame 6255SpriteFrame(73, -104, 32, 32, 437, 299) // #30 - BF Vulkan Smoke Frame 7256SpriteFrame(76, -107, 32, 32, 445, 332) // #31 - BF Vulkan Smoke Frame 8257SpriteFrame(75, -110, 32, 32, 445, 365) // #32 - BF Vulkan Smoke Frame 9258259ArrayPos0 = 32260while ArrayPos0 < 1056261if Object[ArrayPos0].Type == TypeName[Little Planet]262Object[ArrayPos0].XPos = 0263Object[ArrayPos0].YPos = 0264Object[ArrayPos0].ZoomDepth = 384265Object[ArrayPos0].RotationSpeed = -8266end if267ArrayPos0++268loop269end sub270271272// ========================273// Editor Subs274// ========================275276sub RSDKDraw277DrawSprite(0)278end sub279280281sub RSDKLoad282LoadSpriteSheet("DAGarden/LittlePlanet.gif")283SpriteFrame(-126, -126, 252, 252, 0, 0) // #0 - Little Planet284285SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")286end sub287288289