Path: blob/main/Scripts/R7/R7DBossSetup.txt
1319 views
//--------------Sonic CD R7 D Boss Setup Script---------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer6#alias Object.Value1 : Object.ActivePalette78// Collision Modes9#alias 0 : CMODE_FLOOR1011// Priority12#alias 1 : PRIORITY_ACTIVE1314// Tile Info15#alias 0 : TILEINFO_INDEX161718// Function declarations19#function R7Setup_GetLoopTileInfo202122function R7Setup_GetLoopTileInfo23// Gets info from out of bounds chunks, located past the signpost2425// Precondition:26// - TempValue0 is the chunk ID of the chunk currentbly being checked against2728TempValue3 = Player.XPos29TempValue3 >>= 1630TempValue3 &= 25531TempValue3 += 0x400032TempValue0 -= 1633TempValue0 >>= 234TempValue0 <<= 83536TempValue4 = Player.YPos37TempValue4 >>= 1638TempValue4 &= 25539TempValue4 += TempValue04041Get16x16TileInfo(TempValue0, TempValue3, TempValue4, TILEINFO_INDEX)42end function434445sub ObjectMain4647Object.Timer++48if Object.Timer == 549Object.Timer = 050Object.ActivePalette++51Object.ActivePalette %= 652SetActivePalette(Object.ActivePalette, 0, 240)53end if5455end sub565758sub ObjectPlayerInteraction5960// Manage stage layers6162// Get the chunk ID of the chunk the player's currently in63TempValue1 = Player.XPos64TempValue1 >>= 2365TempValue2 = Player.YPos66TempValue2 >>= 2367GetTileLayerEntry(TempValue0, 0, TempValue1, TempValue2)6869// If possible, jump to its corresponding entry over here now70switch TempValue071case 1672case 1773case 1874case 1975// Loop chunks, opening on left side76CallFunction(R7Setup_GetLoopTileInfo)77if Player.CollisionMode == CMODE_FLOOR78if TempValue0 == 100179TempValue1 &= 102280TempValue2 &= 102281SetTileLayerEntry(20, 0, TempValue1, TempValue2)82TempValue1++83SetTileLayerEntry(21, 0, TempValue1, TempValue2)84TempValue1--85TempValue2++86SetTileLayerEntry(22, 0, TempValue1, TempValue2)87TempValue1++88SetTileLayerEntry(23, 0, TempValue1, TempValue2)89end if90else91if Player.Speed > 092if TempValue0 == 100393TempValue1 &= 102294TempValue2 &= 102295SetTileLayerEntry(20, 0, TempValue1, TempValue2)96TempValue1++97SetTileLayerEntry(21, 0, TempValue1, TempValue2)98TempValue1--99TempValue2++100SetTileLayerEntry(22, 0, TempValue1, TempValue2)101TempValue1++102SetTileLayerEntry(23, 0, TempValue1, TempValue2)103end if104end if105end if106break107108case 20109case 21110case 22111case 23112// Loop chunks, opening on right side113CallFunction(R7Setup_GetLoopTileInfo)114if Player.CollisionMode == CMODE_FLOOR115if TempValue0 == 1000116TempValue1 &= 1022117TempValue2 &= 1022118SetTileLayerEntry(16, 0, TempValue1, TempValue2)119TempValue1++120SetTileLayerEntry(17, 0, TempValue1, TempValue2)121TempValue1--122TempValue2++123SetTileLayerEntry(18, 0, TempValue1, TempValue2)124TempValue1++125SetTileLayerEntry(19, 0, TempValue1, TempValue2)126end if127else128if Player.Speed < 0129if TempValue0 == 1002130TempValue1 &= 1022131TempValue2 &= 1022132SetTileLayerEntry(16, 0, TempValue1, TempValue2)133TempValue1++134SetTileLayerEntry(17, 0, TempValue1, TempValue2)135TempValue1--136TempValue2++137SetTileLayerEntry(18, 0, TempValue1, TempValue2)138TempValue1++139SetTileLayerEntry(19, 0, TempValue1, TempValue2)140end if141end if142end if143break144145case 24146case 25147case 26148case 27149// Wavy chunks, opening on left side... or at least they should be150// However!151// These don't exist in Act 3, so this function call is actually checking against blank chunks...152CallFunction(R7Setup_GetLoopTileInfo)153if TempValue0 == 1001154TempValue1 &= 1022155TempValue2 &= 1022156SetTileLayerEntry(28, 0, TempValue1, TempValue2)157TempValue1++158SetTileLayerEntry(29, 0, TempValue1, TempValue2)159TempValue1--160TempValue2++161SetTileLayerEntry(30, 0, TempValue1, TempValue2)162TempValue1++163SetTileLayerEntry(31, 0, TempValue1, TempValue2)164end if165break166167case 28168case 29169case 30170case 31171// Wavy chunks, opening on right side, but see note above172// Same story here173CallFunction(R7Setup_GetLoopTileInfo)174if TempValue0 == 1000175TempValue1 &= 1022176TempValue2 &= 1022177SetTileLayerEntry(24, 0, TempValue1, TempValue2)178TempValue1++179SetTileLayerEntry(25, 0, TempValue1, TempValue2)180TempValue1--181TempValue2++182SetTileLayerEntry(26, 0, TempValue1, TempValue2)183TempValue1++184SetTileLayerEntry(27, 0, TempValue1, TempValue2)185end if186break187188end switch189190end sub191192193sub ObjectDraw194// Find the XPos to draw the lamp at, since it's supposed to have parallax and loop around the stage195Object.XPos = Screen.XOffset196Object.XPos /= 420197Object.XPos *= 420198Object.XPos += 320199Object.XPos *= 3200Object.XPos >>= 1201TempValue0 = Screen.XOffset202TempValue0 *= 3203TempValue0 >>= 1204Object.XPos -= TempValue0205Object.YPos = 520206207// And now find the YPos to draw it at, there's also vertical parallax too208TempValue0 = Screen.YOffset209TempValue0 *= 23210TempValue0 >>= 4211Object.YPos -= TempValue0212213DrawSpriteScreenXY(0, Object.XPos, Object.YPos)214DrawSpriteScreenXY(1, Object.XPos, Object.YPos)215DrawSpriteScreenXY(2, Object.XPos, Object.YPos)216DrawSpriteScreenXY(3, Object.XPos, Object.YPos)217218end sub219220221sub ObjectStartup222223LoadSpriteSheet("R7/Objects2.gif")224225// Place the Setup object into slot 19, make it always active, and give it a high draworder so that it's in front of Sonic226Object[19].Type = TypeName[R7 Setup]227Object[19].Priority = PRIORITY_ACTIVE228Object[19].DrawOrder = 5229230// Lamp Post Head231SpriteFrame(-24, -24, 48, 24, 173, 26)232233// Lamp Post Post234SpriteFrame(-8, 0, 16, 224, 222, 26)235SpriteFrame(-8, 224, 16, 224, 222, 26)236SpriteFrame(-8, 448, 16, 224, 222, 26)237238// Set initial stage bounds239Stage.XBoundary2 -= 288240241// Setup the stage's palette cycle242CopyPalette(0, 1)243CopyPalette(0, 2)244CopyPalette(0, 3)245CopyPalette(0, 4)246CopyPalette(0, 5)247248TempValue0 = 0249TempValue1 = 0250TempValue2 = 16251while TempValue0 < 6252LoadPalette("R7D_PalCycle.act", TempValue0, 160, TempValue1, TempValue2)253TempValue0++254TempValue1 += 16255TempValue2 += 16256loop257258end sub259260261// ========================262// Editor Subs263// ========================264265sub RSDKDraw266DrawSprite(0)267DrawSprite(1)268end sub269270271sub RSDKLoad272LoadSpriteSheet("R7/Objects2.gif")273SpriteFrame(-24, -24, 48, 24, 173, 26)274SpriteFrame(-8, 0, 16, 224, 222, 26)275276SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")277end sub278279280