Path: blob/main/Scripts/R5/StaticRock.txt
1319 views
//----------------Sonic CD Static Rock Script-----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Collision Modes5#alias 1 : CMODE_LWALL6#alias 3 : CMODE_RWALL789sub ObjectPlayerInteraction1011switch Object.PropertyValue12case 013PlayerObjectCollision(C_BOX, -16, -16, 16, 16)14break1516case 117PlayerObjectCollision(C_TOUCH, -16, -14, 16, 16)18if CheckResult == true19if Player.XPos < Object.XPos20// Move the player to be 16 pixels to the left of the object2122Player.XPos = Player.CollisionLeft23Player.XPos <<= 1624Player.XPos += Object.XPos25Player.XPos -= 0x10000026else27// Move the player to be 16 pixels to the right of the object2829Player.XPos = Player.CollisionRight30Player.XPos <<= 1631Player.XPos += Object.XPos32Player.XPos += 0x10000033end if34end if35break3637case 238// Some cases for Wall Collision Modes39if Player.CollisionMode == CMODE_LWALL40PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)41if CheckResult == true42Player.YPos = Player.CollisionBottom43Player.YPos <<= 1644Player.YPos += Object.YPos45Player.YPos += 0x10000046Player.Speed = 047end if48end if4950if Player.CollisionMode == CMODE_RWALL51PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)52if CheckResult == true53Player.YPos = Player.CollisionBottom54Player.YPos <<= 1655Player.YPos += Object.YPos56Player.YPos += 0x10000057Player.Speed = 058end if59end if60break6162end switch6364// pardon?65// What is this even supposed to be, there's not even an if statement that'd need these...66// else67// ???68// These have been uncommented since they'd would cause a crash if function count was ever changed,69// but they do exist in the original code for whatever reason70// end if7172end sub737475sub ObjectDraw76DrawSprite(Object.PropertyValue)77end sub787980sub ObjectStartup81LoadSpriteSheet("R5/Objects.gif")8283// 0 - Rock Frame84SpriteFrame(-16, -16, 32, 32, 92, 18)8586// 1-2 - Invisible Frames87// (here for ease in drawing)88SpriteFrame(0, 0, 0, 0, 1, 1)89SpriteFrame(0, 0, 0, 0, 1, 1)9091end sub929394// ========================95// Editor Subs96// ========================9798sub RSDKEdit99if Editor.ReturnVariable == true100switch Editor.VariableID101case EDIT_VAR_PROPVAL // Property Value102CheckResult = Object.PropertyValue103break104case 0 // Type105CheckResult = Object.PropertyValue106break107end switch108else109switch Editor.VariableID110case EDIT_VAR_PROPVAL // Property Value111Object.PropertyValue = Editor.VariableValue112break113case 0 // Type114Object.PropertyValue = Editor.VariableValue115break116end switch117end if118end sub119120121sub RSDKDraw122CheckGreater(Object.PropertyValue, 0)123Object.InkEffect = CheckResult124DrawSprite(Object.PropertyValue, FX_INK, Object.XPos, Object.YPos)125126TempValue0 = 16127switch Object.PropertyValue128case 1129// Slightly different box size makes everything wonky - can't draw a blend version of the box since then it'd technically be representing the wrong size...130TempValue0 = 14131case 2132TempValue1 = TempValue0133TempValue1 += 16134TempValue2 = Object.iXPos135TempValue2 -= TempValue0136TempValue3 = Object.iYPos137TempValue3 -= 16138DrawRectOutline(TempValue2, TempValue3, 32, TempValue1, 255, 255, 255, 255)139break140end switch141end sub142143144sub RSDKLoad145LoadSpriteSheet("R5/Objects.gif")146SpriteFrame(-16, -16, 32, 32, 92, 18)147SpriteFrame(-16, -14, 32, 30, 94, 18)148SpriteFrame(-16, -16, 32, 32, 92, 18)149150AddEditorVariable("Type")151SetActiveVariable("Type")152AddEnumVariable("Normal Block", 0)153AddEnumVariable("Invsible (Floor)", 1)154AddEnumVariable("Invisible (Roof)", 2)155end sub156157158