Path: blob/main/Scripts/R8/ConveyorPlatforms.txt
1319 views
//------------Sonic CD Conveyor Platforms Script--------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Angle6#alias Object.Value1 : Object.AngleOriginPos7#alias Object.Value2 : Object.PlatformXPos8#alias Object.Value3 : Object.PlatformYPos9#alias Object.Value4 : Object.XCollisionOffset10#alias Object.Value5 : Object.YCollisionOffset11#alias Object.Value6 : Object.CanBeStepped1213// Property Values14#alias 0 : GIMMICK_PARENT15#alias 1 : GIMMICK_CHILD161718sub ObjectMain19if Object.PropertyValue == GIMMICK_PARENT20TempValue2 = 021ArrayPos0 = Object.EntityNo22ArrayPos0++23while TempValue2 < 524Object[ArrayPos0].Angle = Object[ArrayPos0].AngleOriginPos25Object[ArrayPos0].Angle += Object.Angle26Object[ArrayPos0].Angle %= 44827if Object[ArrayPos0].Angle < 16028Object[ArrayPos0].XCollisionOffset = Object.XPos29Object[ArrayPos0].XCollisionOffset -= 0x4000003031TempValue0 = Object[ArrayPos0].Angle32TempValue0 <<= 1633Object[ArrayPos0].XCollisionOffset += TempValue034Object[ArrayPos0].YCollisionOffset = Object.YPos35Object[ArrayPos0].YCollisionOffset -= 0x3A00003637TempValue0 = Object[ArrayPos0].Angle38TempValue0 <<= 1539Object[ArrayPos0].YCollisionOffset += TempValue040else41if Object[ArrayPos0].Angle < 22442TempValue0 = Object[ArrayPos0].Angle43TempValue0 -= 14444TempValue0 <<= 245if TempValue0 > 14446Object[ArrayPos0].Rotation++47Object[ArrayPos0].Rotation %= 2448Object[ArrayPos0].CanBeStepped = false49end if50Sin(Object[ArrayPos0].XCollisionOffset, TempValue0)51Object[ArrayPos0].XCollisionOffset *= 0xC0052Object[ArrayPos0].XCollisionOffset += Object.XPos53Object[ArrayPos0].XCollisionOffset += 0x5000005455Cos(Object[ArrayPos0].YCollisionOffset, TempValue0)56Object[ArrayPos0].YCollisionOffset *= -0xC0057Object[ArrayPos0].YCollisionOffset += Object.YPos58Object[ArrayPos0].YCollisionOffset += 0x28000059else60if Object[ArrayPos0].Angle < 38461Object[ArrayPos0].Rotation++62Object[ArrayPos0].Rotation %= 2463Object[ArrayPos0].CanBeStepped = false6465TempValue0 = Object[ArrayPos0].Angle66TempValue0 -= 2246768Object[ArrayPos0].XCollisionOffset = Object.XPos69Object[ArrayPos0].XCollisionOffset += 0x3E000070TempValue1 = TempValue071TempValue1 <<= 1672Object[ArrayPos0].XCollisionOffset -= TempValue17374Object[ArrayPos0].YCollisionOffset = Object.YPos75Object[ArrayPos0].YCollisionOffset += 0x39000076TempValue1 = TempValue077TempValue1 <<= 1578Object[ArrayPos0].YCollisionOffset -= TempValue179else80TempValue0 = Object[ArrayPos0].Angle81TempValue0 -= 36882TempValue0 <<= 283if TempValue0 > 14484Object[ArrayPos0].Rotation = 085Object[ArrayPos0].CanBeStepped = true86else87Object[ArrayPos0].Rotation++88Object[ArrayPos0].Rotation %= 2489Object[ArrayPos0].CanBeStepped = false90end if9192Sin(Object[ArrayPos0].XCollisionOffset, TempValue0)93Object[ArrayPos0].XCollisionOffset *= -0xC0094Object[ArrayPos0].XCollisionOffset += Object.XPos95Object[ArrayPos0].XCollisionOffset -= 0x5000009697Cos(Object[ArrayPos0].YCollisionOffset, TempValue0)98Object[ArrayPos0].YCollisionOffset *= 0xC0099Object[ArrayPos0].YCollisionOffset += Object.YPos100Object[ArrayPos0].YCollisionOffset -= 0x280000101end if102end if103end if104Object[ArrayPos0].XCollisionOffset &= 0xFFFF0000 // Truncate the value105Object[ArrayPos0].PlatformXPos = Object[ArrayPos0].XCollisionOffset106Object[ArrayPos0].XCollisionOffset -= Object[ArrayPos0].XPos107108Object[ArrayPos0].YCollisionOffset &= 0xFFFF0000 // Truncate the value109Object[ArrayPos0].PlatformYPos = Object[ArrayPos0].YCollisionOffset110Object[ArrayPos0].YCollisionOffset -= Object[ArrayPos0].YPos111112TempValue2++113ArrayPos0++114loop115116Object.Angle++117Object.Angle %= 448118end if119end sub120121122sub ObjectPlayerInteraction123if Object.PropertyValue == GIMMICK_CHILD124if Object.CanBeStepped == true125PlayerObjectCollision(C_PLATFORM, -16, -5, 16, 11)126if CheckResult == true127Player.XPos += Object.XCollisionOffset128Player.YPos += Object.YCollisionOffset129end if130end if131end if132end sub133134135sub ObjectDraw136if Object.PropertyValue == GIMMICK_CHILD137Object.XPos = Object.PlatformXPos138Object.YPos = Object.PlatformYPos139140TempValue0 = Object.Rotation141TempValue0 >>= 1142switch TempValue0143case 0144case 6145DrawSprite(0)146break147case 1148case 7149DrawSprite(1)150break151case 2152case 8153DrawSprite(2)154break155case 3156case 9157DrawSprite(3)158break159case 4160case 10161Object.Direction = FACING_LEFT162DrawSpriteFX(4, FX_FLIP, Object.XPos, Object.YPos)163break164case 5165case 11166Object.Direction = FACING_LEFT167DrawSpriteFX(5, FX_FLIP, Object.XPos, Object.YPos)168break169end switch170end if171end sub172173174sub ObjectStartup175LoadSpriteSheet("R8/Objects.gif")176177SpriteFrame(-16, -8, 32, 16, 107, 98) // #0 - Platform Horizontal178SpriteFrame(-16, -12, 32, 24, 107, 115) // #1 - Platform Tilted frame 0179SpriteFrame(-12, -16, 24, 32, 230, 34) // #2 - Platform Tilted frame 1180181SpriteFrame(-8, -16, 16, 32, 239, 212) // #3 - Platform Vertical182SpriteFrame(-12, -16, 24, 32, 230, 34) // #4 - Platform Tilted frame 0183SpriteFrame(-16, -12, 32, 24, 107, 115) // #5 - Platform Tilted frame 1184185ArrayPos0 = 32186while ArrayPos0 < 1056187if Object[ArrayPos0].Type == TypeName[CPlatforms]188if Object[ArrayPos0].PropertyValue == GIMMICK_PARENT189ArrayPos0++190Object[ArrayPos0].AngleOriginPos = 0191Object[ArrayPos0].CanBeStepped = true192Object[ArrayPos0].PlatformXPos = Object[ArrayPos0].XPos193Object[ArrayPos0].PlatformYPos = Object[ArrayPos0].YPos194ArrayPos0++195Object[ArrayPos0].AngleOriginPos = 90196Object[ArrayPos0].CanBeStepped = true197Object[ArrayPos0].PlatformXPos = Object[ArrayPos0].XPos198Object[ArrayPos0].PlatformYPos = Object[ArrayPos0].YPos199ArrayPos0++200Object[ArrayPos0].AngleOriginPos = 180201Object[ArrayPos0].CanBeStepped = true202Object[ArrayPos0].PlatformXPos = Object[ArrayPos0].XPos203Object[ArrayPos0].PlatformYPos = Object[ArrayPos0].YPos204ArrayPos0++205Object[ArrayPos0].AngleOriginPos = 268206Object[ArrayPos0].CanBeStepped = true207Object[ArrayPos0].PlatformXPos = Object[ArrayPos0].XPos208Object[ArrayPos0].PlatformYPos = Object[ArrayPos0].YPos209ArrayPos0++210Object[ArrayPos0].AngleOriginPos = 358211Object[ArrayPos0].CanBeStepped = true212Object[ArrayPos0].PlatformXPos = Object[ArrayPos0].XPos213Object[ArrayPos0].PlatformYPos = Object[ArrayPos0].YPos214end if215end if216ArrayPos0++217loop218end sub219220221// ========================222// Editor Subs223// ========================224225sub RSDKDraw226DrawSprite(0)227228if Object.PropertyValue == GIMMICK_CHILD229ArrayPos0 = Object.EntityNo230TempValue0 = 0231TempValue1 = 0232while TempValue1 == false233if TempValue0 == 5234TempValue1 = true235end if236ArrayPos0--237TempValue0++238CheckEqual(Object[ArrayPos0].Type, TypeName[CPlatforms])239TempValue1 = CheckResult240CheckNotEqual(Object[ArrayPos0].PropertyValue, GIMMICK_CHILD)241TempValue1 &= CheckResult242loop243DrawLine(Object.XPos, Object.YPos, Object[ArrayPos0].XPos, Object[ArrayPos0].YPos, 255, 255, 0)244ArrayPos1 = Object.EntityNo245ArrayPos1 -= Object[ArrayPos0].EntityNo246switch ArrayPos1247case 1248TempValue7 = 0249break250case 2251TempValue7 = 90252break253case 3254TempValue7 = 180255break256case 4257TempValue7 = 268258break259case 5260TempValue7 = 358261break262end switch263264if TempValue7 < 160265TempValue4 = Object.XPos266TempValue4 -= 0x400000267268TempValue0 = TempValue7269TempValue0 <<= 16270TempValue4 += TempValue0271TempValue5 = Object.YPos272TempValue5 -= 0x3A0000273274TempValue0 = TempValue7275TempValue0 <<= 15276TempValue5 += TempValue0277else278if TempValue7 < 224279TempValue0 = TempValue7280TempValue0 -= 144281TempValue0 <<= 2282Sin(TempValue4, TempValue0)283TempValue4 *= 0xC00284TempValue4 += Object.XPos285TempValue4 += 0x500000286287Cos(TempValue5, TempValue0)288TempValue5 *= -0xC00289TempValue5 += Object.YPos290TempValue5 += 0x280000291else292if TempValue7 < 384293TempValue0 = TempValue7294TempValue0 -= 224295296TempValue4 = Object.XPos297TempValue4 += 0x3E0000298TempValue1 = TempValue0299TempValue1 <<= 16300TempValue4 -= TempValue1301302TempValue5 = Object.YPos303TempValue5 += 0x390000304TempValue1 = TempValue0305TempValue1 <<= 15306TempValue5 -= TempValue1307else308TempValue0 = TempValue7309TempValue0 -= 368310TempValue0 <<= 2311312Sin(TempValue4, TempValue0)313TempValue4 *= -0xC00314TempValue4 += Object.XPos315TempValue4 -= 0x500000316317Cos(TempValue5, TempValue0)318TempValue5 *= 0xC00319TempValue5 += Object.YPos320TempValue5 -= 0x280000321end if322end if323end if324TempValue4 &= 0xFFFF0000 // Truncate the value325TempValue2 = TempValue4326TempValue4 = Object.XPos327328TempValue5 &= 0xFFFF0000 // Truncate the value329TempValue3 = TempValue5330TempValue5 = Object.YPos331if Editor.ShowGizmos == true332Editor.DrawingOverlay = true333Object.InkEffect = 1334DrawSpriteFX(0, FX_INK,TempValue2,TempValue3)335DrawLine(Object.XPos, Object.YPos, TempValue2, TempValue3, 255, 255, 0)336Editor.DrawingOverlay = false337end if338end if339end sub340341342sub RSDKLoad343LoadSpriteSheet("R8/Objects.gif")344345SpriteFrame(-16, -8, 32, 16, 107, 98) // #0 - Platform Horizontal346SpriteFrame(-16, -12, 32, 24, 107, 115) // #1 - Platform Tilted frame 0347SpriteFrame(-12, -16, 24, 32, 230, 34) // #2 - Platform Tilted frame 1348349SpriteFrame(-8, -16, 16, 32, 239, 212) // #3 - Platform Vertical350SpriteFrame(-12, -16, 24, 32, 230, 34) // #4 - Platform Tilted frame 0351SpriteFrame(-16, -12, 32, 24, 107, 115) // #5 - Platform Tilted frame 1352353SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")354end sub355356357