Path: blob/main/Scripts/R7/R7Spring.txt
1319 views
//-----------------Sonic CD R7 Spring Script------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer678sub ObjectDraw9if Object.Timer == 010// Inactive spring, draw whatever the normal frame should be11DrawSpriteFX(Object.PropertyValue, FX_FLIP, Object.XPos, Object.YPos)12else13Object.Timer++1415TempValue0 = Object.Timer16TempValue0 >>= 11718switch TempValue019case 020case 121// Display the normal frame22DrawSpriteFX(Object.PropertyValue, FX_FLIP, Object.XPos, Object.YPos)23break2425case 226case 627// Display the recoil frame28TempValue1 = Object.PropertyValue29TempValue1 += 830DrawSpriteFX(TempValue1, FX_FLIP, Object.XPos, Object.YPos)31break3233case 334case 435case 536// Display the launch frame37TempValue1 = Object.PropertyValue38TempValue1 += 1639DrawSpriteFX(TempValue1, FX_FLIP, Object.XPos, Object.YPos)40break4142end switch4344if Object.Timer > 1245// Only 12 frames of animation, go back to normal after that46Object.Timer = 047end if48end if4950end sub515253sub ObjectStartup5455// Load the normal Springs Items sheet56LoadSpriteSheet("Global/Items.gif")5758// Spring Frames59// They're the same as the normal Red Spring sprites, just with different offsets6061// Idle Frames62SpriteFrame(-16, -16, 32, 16, 84, 1)63SpriteFrame(0, -16, 16, 32, 117, 1)64SpriteFrame(-16, -16, 16, 32, 175, 1)65SpriteFrame(-16, 0, 32, 16, 84, 59)66SpriteFrame(-8, -24, 32, 32, 84, 117)67SpriteFrame(-24, -24, 32, 32, 117, 165)68SpriteFrame(-8, -24, 32, 32, 84, 117)69SpriteFrame(-24, -24, 32, 32, 117, 165)7071// Recoil Frames72SpriteFrame(-16, -8, 32, 8, 84, 1)73SpriteFrame(0, -16, 8, 32, 125, 1)74SpriteFrame(-8, -16, 8, 32, 175, 1)75SpriteFrame(-16, 0, 32, 8, 84, 67)76SpriteFrame(-8, -24, 32, 32, 84, 150)77SpriteFrame(-24, -24, 32, 32, 150, 165)78SpriteFrame(-8, -24, 32, 32, 84, 150)79SpriteFrame(-24, -24, 32, 32, 150, 165)8081// Launch Frames82SpriteFrame(-16, -40, 32, 40, 84, 18)83SpriteFrame(0, -16, 40, 32, 134, 1)84SpriteFrame(-24, -16, 40, 32, 192, 1)85SpriteFrame(-16, 0, 32, 40, 84, 76)86SpriteFrame(-8, -40, 48, 48, 117, 34)87SpriteFrame(-40, -40, 48, 48, 166, 34)88SpriteFrame(-8, -40, 48, 48, 117, 34)89SpriteFrame(-40, -40, 48, 48, 166, 34)9091end sub929394// ========================95// Editor Subs96// ========================9798sub RSDKDraw99TempValue0 = 0100101// If the last object is a Spring Cage, then try and match its direction102// TODO: change this to "Spring Cage" once GetObjectType works with spaces103GetObjectType(TempValue1, "SpringCage")104if Object[-1].Type == TempValue1105switch Object[-1].PropertyValue106case 0107TempValue0 = 0; break108case 1109TempValue0 = 2; break110case 3111TempValue0 = 4; break112case 2 // shouldn't be here, but just in case113case 4114TempValue0 = 0; break115case 5116TempValue0 = 5; break117case 6118TempValue0 = 1; break119end switch120end if121122DrawSprite(TempValue0)123end sub124125126sub RSDKLoad127LoadSpriteSheet("Global/Items.gif")128SpriteFrame(-16, -16, 32, 16, 84, 1)129SpriteFrame(0, -16, 16, 32, 117, 1)130SpriteFrame(-16, -16, 16, 32, 175, 1)131SpriteFrame(-16, 0, 32, 16, 84, 59)132SpriteFrame(-8, -24, 32, 32, 84, 117)133SpriteFrame(-24, -24, 32, 32, 117, 165)134SpriteFrame(-8, -24, 32, 32, 84, 117)135SpriteFrame(-24, -24, 32, 32, 117, 165)136137// Although used by the object, it shouldn't be used here138SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")139end sub140141142