Path: blob/main/Scripts/R6/R6CSetup.txt
1319 views
//-----------------Sonic CD R6 C 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.PaletteBank7#alias Object.Value4 : Object.LightTile8#alias Object.Value5 : Object.ElectricTile9#alias Object.Value6 : Object.BounceFloorAnim10#alias Object.Value7 : Object.BounceFloorTile11#alias Object.Scale : Object.BounceFloorFlag12#alias Object.Direction : Object.WebDirection1314// Player Aliases15#alias Player.Value4 : Player.InvincibleTimer1617// States18#alias 2 : R6C_SETUP_WEB_SHOCK1920// Web Directions21#alias 0 : VERTICAL_WEB22#alias 1 : HORIZONTAL_WEB23#alias 2 : DIAGONAL_WEB2425// Gravity26#alias 1 : GRAVITY_AIR2728// Stage SFX29#alias 0 : SFX_S_BOUNCEFLOOR30#alias 2 : SFX_S_CATCH3132// Priority33#alias 1 : PRIORITY_ACTIVE3435// Tile Info36#alias 8 : TILEINFO_ANGLEB373839sub ObjectMain40TempValue0 = Object.LightTile41TempValue0 &= 142if TempValue0 == 043TempValue0 = Object.LightTile44TempValue0 >>= 145TempValue0 += 80846Copy16x16Tile(579, TempValue0)47end if48Object.LightTile++49Object.LightTile %= 245051Object.Timer++52Object.Timer %= 12053if Object.Timer < 3154TempValue0 = Object.ElectricTile55TempValue0 %= 556if TempValue0 == 057TempValue0 = Object.ElectricTile58TempValue0 /= 559TempValue0 += 82060Copy16x16Tile(580, TempValue0)61TempValue0 += 362Copy16x16Tile(581, TempValue0)63end if64Object.ElectricTile++65Object.ElectricTile %= 1566else67Copy16x16Tile(580, 832)68Copy16x16Tile(581, 832)69end if7071TempValue0 = Object.BounceFloorAnim72TempValue0 &= 173if TempValue0 == 074TempValue0 = Object.BounceFloorTile75TempValue0 += 82676Object.BounceFloorTile++77Object.BounceFloorTile %= 678Copy16x16Tile(543, TempValue0)79end if80Object.BounceFloorAnim++81Object.BounceFloorAnim &= 5118283Object.BounceFloorFlag = true8485TempValue0 = Object.PaletteBank86TempValue0 >>= 187SetActivePalette(TempValue0, 0, Screen.YSize)88Object.PaletteBank++89Object.PaletteBank %= 690end sub919293sub ObjectPlayerInteraction94TempValue2 = Player.XPos95TempValue2 >>= 1696TempValue2 += Player.CollisionRight97TempValue3 = Player.YPos98TempValue3 >>= 1699TempValue3 += Player.CollisionBottom100TempValue3 += 2101Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)102103TempValue2 = Player.XPos104TempValue2 >>= 16105TempValue2 += Player.CollisionLeft106Get16x16TileInfo(TempValue1, TempValue2, TempValue3, TILEINFO_ANGLEB)107// Bug Details:108// Sonic Team updated the normal bounce floor (which is R6BounceFloor in Origins for the Past and Present)109// to prevent Knuckles from disabling his collisions when climbing onto the floor (they knew about this bug)110// However, they didn't update it here and in R6DSetup.111TempValue0 |= TempValue1112if TempValue0 == 1113if Object.BounceFloorFlag == true114if Player.YVelocity > -1115Player.Animation = ANI_JUMPING116Player.Gravity = GRAVITY_AIR117Player.Timer = 0118Player.YVelocity = -0x160000119120#platform: Use_Origins121Player.State = Player_State_Air_NoDropDash122#endplatform123124#platform: Use_Standalone125Player.State = Player_State_Air126#endplatform127PlayStageSfx(SFX_S_BOUNCEFLOOR, false)128129#platform: Use_Haptics130HapticEffect(60, 0, 0, 0)131#endplatform132133end if134end if135end if136137TempValue2 -= Player.CollisionLeft138TempValue3 -= Player.CollisionBottom139TempValue3 -= 2140// You will see constant checks for R6C_SETUP_WEB_SHOCK state141// while there are web shocks on the stage, in the good future those are permanently turned off142Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)143switch TempValue0144case 2145if Object.Timer < 31146if Player.InvincibleTimer == 0147Player.State = Player_State_GotHit148if Player.Direction == FACING_LEFT149Player.Speed = 0x20000150else151Player.Speed = -0x20000152end if153end if154end if155break156case 5157if Object.State == R6C_SETUP_WEB_SHOCK158if Player.InvincibleTimer == 0159Player.State = Player_State_GotHit160if Player.Direction == FACING_LEFT161Player.Speed = 0x20000162else163Player.Speed = -0x20000164end if165end if166end if167break168case 6169if Object.State == R6C_SETUP_WEB_SHOCK170if Object.WebDirection == VERTICAL_WEB171if Player.InvincibleTimer == 0172Player.State = Player_State_GotHit173if Player.Direction == FACING_LEFT174Player.Speed = 0x20000175else176Player.Speed = -0x20000177end if178end if179end if180end if181break182case 7183if Object.State == R6C_SETUP_WEB_SHOCK184if Object.WebDirection == HORIZONTAL_WEB185if Player.InvincibleTimer == 0186Player.State = Player_State_GotHit187if Player.Direction == FACING_LEFT188Player.Speed = 0x20000189else190Player.Speed = -0x20000191end if192end if193end if194end if195break196case 8197if Object.State == R6C_SETUP_WEB_SHOCK198if Object.WebDirection == DIAGONAL_WEB199if Player.InvincibleTimer == 0200Player.State = Player_State_GotHit201if Player.Direction == FACING_LEFT202Player.Speed = 0x20000203else204Player.Speed = -0x20000205end if206end if207end if208end if209break210end switch211TempValue3 -= 4212Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)213switch TempValue0214case 2215if Object.Timer < 31216if Player.InvincibleTimer == 0217Player.State = Player_State_GotHit218if Player.Direction == FACING_LEFT219Player.Speed = 0x20000220else221Player.Speed = -0x20000222end if223end if224end if225break226case 5227if Object.State == R6C_SETUP_WEB_SHOCK228if Player.InvincibleTimer == 0229Player.State = Player_State_GotHit230if Player.Direction == FACING_LEFT231Player.Speed = 0x20000232else233Player.Speed = -0x20000234end if235end if236end if237break238case 6239if Object.State == R6C_SETUP_WEB_SHOCK240if Object.WebDirection == VERTICAL_WEB241if Player.InvincibleTimer == 0242Player.State = Player_State_GotHit243if Player.Direction == FACING_LEFT244Player.Speed = 0x20000245else246Player.Speed = -0x20000247end if248end if249end if250end if251break252case 7253if Object.State == R6C_SETUP_WEB_SHOCK254if Object.WebDirection == HORIZONTAL_WEB255if Player.InvincibleTimer == 0256Player.State = Player_State_GotHit257if Player.Direction == FACING_LEFT258Player.Speed = 0x20000259else260Player.Speed = -0x20000261end if262end if263end if264end if265break266case 8267if Object.State == R6C_SETUP_WEB_SHOCK268if Object.WebDirection == DIAGONAL_WEB269if Player.InvincibleTimer == 0270Player.State = Player_State_GotHit271if Player.Direction == FACING_LEFT272Player.Speed = 0x20000273else274Player.Speed = -0x20000275end if276end if277end if278end if279break280end switch281282TempValue3 += 4283TempValue3 += Player.CollisionTop284Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)285if TempValue0 == 3286TempValue4 = TempValue3287TempValue4 &= 15288if TempValue4 < 8289if Player.State != Player_State_HangBar290Player.State = Player_State_HangBar291Player.YVelocity = 0292Player.Animation = ANI_HANGING293TempValue3 &= 0x7FF0294TempValue3 += 4295TempValue3 -= Player.CollisionTop296Player.iYPos = TempValue3297PlayStageSfx(SFX_S_CATCH, false)298Screen.AdjustCameraY = 0299end if300end if301end if302end sub303304305sub ObjectStartup306Object[19].Type = TypeName[R6 Setup]307Object[19].Priority = PRIORITY_ACTIVE308Object[19].DrawOrder = 2309310TempValue0 = 1311while TempValue0 < 3312RotatePalette(161, 163, 0)313CopyPalette(0, TempValue0)314TempValue0++315loop316RotatePalette(161, 163, 0)317end sub318319320// ========================321// Editor Subs322// ========================323324sub RSDKDraw325DrawSprite(0)326end sub327328329sub RSDKLoad330LoadSpriteSheet("Global/Display.gif")331SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon332333SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")334end sub335336337