Path: blob/main/Scripts/Mission/MissionBlock.txt
1319 views
//---------------Sonic CD Mission Block Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.PropertyValue : Object.BlocksNo678sub ObjectPlayerInteraction910if Object.BlocksNo <= 11112// If the Block count for this Object is 0 or 1, then it's only a single block13// From here, check Collision as such14PlayerObjectCollision(C_BOX, -16, -16, 16, 16)15else1617// This Object is meant to represent several blocks1819// Base block width is 3220TempValue0 = 322122// From here, multiply that width by how many blocks there are23TempValue0 *= Object.BlocksNo2425// Because the left box is already 16 wide, we can shve 16 off from the right26TempValue0 -= 162728// And now, check collision against all those blocks29PlayerObjectCollision(C_BOX, -16, -16, TempValue0, 16)3031end if3233end sub343536sub ObjectDraw3738if Object.BlocksNo <= 139// If a single block, then just draw a single sprite4041DrawSprite(0)42else43// This Object is several blocks, so more has to be done4445// Use of values here46// - TempValue0 is the X Position of the current block47// - TempValue1 is the Y Position of the current block, this stays the same throughout the whole process48// - TempValue2 is the current block number, starting from 04950TempValue0 = Object.XPos51TempValue1 = Object.YPos52TempValue2 = 05354while TempValue2 < Object.BlocksNo55// First, draw the Sprite56// -> This is done first so that the first Block is displayed correctly57DrawSpriteXY(0, TempValue0, TempValue1)5859// Move 32 pixels to the right60TempValue0 += 0x2000006162// Next block!63TempValue2++64loop65end if6667end sub686970sub ObjectStartup7172// Loading the Labrynth Zone sheet...73LoadSpriteSheet("Mission/Objects.gif")7475// Well, it's a Mission Block!76SpriteFrame(-16, -16, 32, 32, 1, 1)7778end sub798081// ========================82// Editor Subs83// ========================8485sub RSDKDraw86if Object.PropertyValue < 287DrawSprite(0)88else89TempValue0 = 090TempValue1 = Object.XPos9192while TempValue0 < Object.PropertyValue93DrawSpriteXY(0, TempValue1, Object.YPos)9495TempValue1 += 0x20000096TempValue0++97loop98end if99end sub100101102sub RSDKLoad103LoadSpriteSheet("Mission/Objects.gif")104SpriteFrame(-16, -16, 32, 32, 1, 1)105106SetVariableAlias(ALIAS_VAR_PROPVAL, "BlocksNo")107end sub108109110111112