0% found this document useful (0 votes)
30 views8 pages

R6 Setup

The document is a setup script for Sonic CD R6, detailing the behavior and interactions of game objects, particularly focusing on a web mechanic and player interactions. It includes various state management, sound effects, and visual elements for the gameplay experience. The script also defines functions for object initialization, drawing, and player interactions with specific game mechanics like bounce floors and web shocks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views8 pages

R6 Setup

The document is a setup script for Sonic CD R6, detailing the behavior and interactions of game objects, particularly focusing on a web mechanic and player interactions. It includes various state management, sound effects, and visual elements for the gameplay experience. The script also defines functions for object initialization, drawing, and player interactions with specific game mechanics like bounce floors and web shocks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 8

//------------------Sonic CD R6 Setup Script------------------//

//--------Scripted by Christian Whitehead 'The Taxman'--------//


//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

// Aliases
#alias Object.Value0 : Object.Timer
#alias Object.Value1 : Object.PaletteBank
#alias Object.Value2 : Object.AlarmTimer
#alias Object.Value3 : Object.AlarmTile
#alias Object.Value4 : Object.LightTile
#alias Object.Value5 : Object.ElectricTile
#alias Object.Value6 : Object.BounceFloorAnim
#alias Object.Value7 : Object.BounceFloorTile
#alias Object.Scale : Object.BounceFloorFlag
#alias Object.Direction : Object.WebDirection

// Player Aliases
#alias Player.Value4 : Player.InvincibleTimer

// States
#alias 0 : R6_SETUP_PREPARE_CHARGE
#alias 1 : R6_SETUP_WEB_CHARGE
#alias 2 : R6_SETUP_WEB_SHOCK

// Web Directions
#alias 0 : VERTICAL_WEB
#alias 1 : HORIZONTAL_WEB
#alias 2 : DIAGONAL_WEB

// Gravity
#alias 1 : GRAVITY_AIR

// Stage SFX
#alias 0 : SFX_S_BOUNCEFLOOR
#alias 1 : SFX_S_ELECTRICITY
#alias 2 : SFX_S_CATCH

// Priority
#alias 1 : PRIORITY_ACTIVE

// Tile Info
#alias 8 : TILEINFO_ANGLEB

sub ObjectMain
switch Object.State
case R6_SETUP_PREPARE_CHARGE
if Object.Timer < 480
Object.Timer++
else
PlayStageSfx(SFX_S_ELECTRICITY, false)
Object.Timer = 0
Object.State = R6_SETUP_WEB_CHARGE
end if
break

case R6_SETUP_WEB_CHARGE
if Object.Timer < 90
Object.Timer++
Object.Frame++
Object.Frame &= 1
else
Object.Timer = 0
Object.Frame = 2
Object.State = R6_SETUP_WEB_SHOCK
end if
break

case R6_SETUP_WEB_SHOCK
if Object.Timer < 120
Object.Timer++
Object.Frame++
if Object.Frame == 9
Object.Frame = 2
end if
else
Object.Timer = 0
Object.Frame = 0
Object.State = R6_SETUP_PREPARE_CHARGE
Object.WebDirection++
Object.WebDirection %= 3
end if
break
end switch

switch Object.AlarmTile
case 0
if Object.AlarmTimer < 15
Object.AlarmTimer++
else
Copy16x16Tile(578, 801)
Copy16x16Tile(677, 801)
Object.AlarmTimer = 0
Object.AlarmTile++
end if
break
case 1
if Object.AlarmTimer < 4
Object.AlarmTimer++
else
Copy16x16Tile(578, 802)
Copy16x16Tile(677, 802)
Object.AlarmTimer = 0
Object.AlarmTile++
end if
break
case 2
if Object.AlarmTimer < 9
Object.AlarmTimer++
else
Copy16x16Tile(578, 803)
Copy16x16Tile(677, 803)
Object.AlarmTimer = 0
Object.AlarmTile++
end if
break
case 3
if Object.AlarmTimer < 4
Object.AlarmTimer++
else
Copy16x16Tile(578, 800)
Copy16x16Tile(677, 800)
Object.AlarmTimer = 0
Object.AlarmTile = 0
end if
break
end switch

TempValue0 = Object.LightTile
TempValue0 &= 1
if TempValue0 == 0
TempValue0 = Object.LightTile
TempValue0 >>= 1
TempValue0 += 804
Copy16x16Tile(579, TempValue0)
end if
Object.LightTile++
Object.LightTile %= 24

TempValue0 = Object.ElectricTile
TempValue0 %= 5
if TempValue0 == 0
TempValue0 = Object.ElectricTile
TempValue0 /= 5
TempValue0 += 816
Copy16x16Tile(580, TempValue0)
TempValue0 += 3
Copy16x16Tile(581, TempValue0)
end if
Object.ElectricTile++
Object.ElectricTile %= 15

if Object.BounceFloorAnim < 32
Object.BounceFloorAnim++
Object.BounceFloorFlag = false
else
if Object.BounceFloorAnim < 212
TempValue0 = Object.BounceFloorAnim
TempValue0 &= 1
if TempValue0 == 0
TempValue0 = Object.BounceFloorTile
TempValue0 += 822
Object.BounceFloorTile++
Object.BounceFloorTile %= 6
Copy16x16Tile(543, TempValue0)
end if
Object.BounceFloorAnim++
Object.BounceFloorFlag = true
else
Object.BounceFloorAnim = 0
Object.BounceFloorFlag = false
Copy16x16Tile(543, 822)
end if
end if

TempValue0 = Object.PaletteBank
TempValue0 >>= 1
SetActivePalette(TempValue0, 0, 240)
Object.PaletteBank++
Object.PaletteBank %= 6
end sub

sub ObjectPlayerInteraction
// They changed up how the Bounce Floor works in Origins Plus, see the new
R6BounceFloor object
// This is just (most of) the code from Standalone here.

TempValue2 = Player.XPos
TempValue2 >>= 16
#platform: Use_Standalone
TempValue2 += Player.CollisionRight
#endplatform
TempValue3 = Player.YPos
TempValue3 >>= 16
#platform: Use_Standalone
TempValue3 += Player.CollisionBottom
TempValue3 += 2
Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)

TempValue2 = Player.XPos
TempValue2 >>= 16
TempValue2 += Player.CollisionLeft
Get16x16TileInfo(TempValue1, TempValue2, TempValue3, TILEINFO_ANGLEB)

TempValue0 |= TempValue1
if TempValue0 == 1
if Object.BounceFloorFlag == true
if Player.YVelocity > -1
Player.Animation = ANI_JUMPING
Player.Gravity = GRAVITY_AIR
Player.Timer = 0
Player.YVelocity = -0x160000

Player.State = Player_State_Air

PlayStageSfx(SFX_S_BOUNCEFLOOR, false)
#endplatform
#platform: Use_Haptics
HapticEffect(60, 0, 0, 0)
#endplatform
#platform: Use_Standalone
end if
end if
end if
TempValue2 -= Player.CollisionLeft
TempValue3 -= Player.CollisionBottom
TempValue3 -= 2
#endplatform

Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)


switch TempValue0
case 2
if Player.InvincibleTimer == 0
Player.State = Player_State_GotHit
if Player.Direction == FACING_LEFT
Player.Speed = 0x20000
else
Player.Speed = -0x20000
end if
end if
break

case 5
if Object.State == R6_SETUP_WEB_SHOCK
if Player.InvincibleTimer == 0
Player.State = Player_State_GotHit
if Player.Direction == FACING_LEFT
Player.Speed = 0x20000
else
Player.Speed = -0x20000
end if
end if
end if
break

case 6
if Object.State == R6_SETUP_WEB_SHOCK
if Object.WebDirection == VERTICAL_WEB
if Player.InvincibleTimer == 0
Player.State = Player_State_GotHit
if Player.Direction == FACING_LEFT
Player.Speed = 0x20000
else
Player.Speed = -0x20000
end if
end if
end if
end if
break

case 7
if Object.State == R6_SETUP_WEB_SHOCK
if Object.WebDirection == HORIZONTAL_WEB
if Player.InvincibleTimer == 0
Player.State = Player_State_GotHit
if Player.Direction == FACING_LEFT
Player.Speed = 0x20000
else
Player.Speed = -0x20000
end if
end if
end if
end if
break

case 8
if Object.State == R6_SETUP_WEB_SHOCK
if Object.WebDirection == DIAGONAL_WEB
if Player.InvincibleTimer == 0
Player.State = Player_State_GotHit
if Player.Direction == FACING_LEFT
Player.Speed = 0x20000
else
Player.Speed = -0x20000
end if
end if
end if
end if
break
end switch

TempValue3 -= 4
Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)
switch TempValue0
case 2
if Player.InvincibleTimer == 0
Player.State = Player_State_GotHit
if Player.Direction == FACING_LEFT
Player.Speed = 0x20000
else
Player.Speed = -0x20000
end if
end if
break

case 5
if Object.State == R6_SETUP_WEB_SHOCK
if Player.InvincibleTimer == 0
Player.State = Player_State_GotHit
if Player.Direction == FACING_LEFT
Player.Speed = 0x20000
else
Player.Speed = -0x20000
end if
end if
end if
break

case 6
if Object.State == R6_SETUP_WEB_SHOCK
if Object.WebDirection == VERTICAL_WEB
if Player.InvincibleTimer == 0
Player.State = Player_State_GotHit
if Player.Direction == FACING_LEFT
Player.Speed = 0x20000
else
Player.Speed = -0x20000
end if
end if
end if
end if
break

case 7
if Object.State == R6_SETUP_WEB_SHOCK
if Object.WebDirection == HORIZONTAL_WEB
if Player.InvincibleTimer == 0
Player.State = Player_State_GotHit
if Player.Direction == FACING_LEFT
Player.Speed = 0x20000
else
Player.Speed = -0x20000
end if
end if
end if
end if
break

case 8
if Object.State == R6_SETUP_WEB_SHOCK
if Object.WebDirection == DIAGONAL_WEB
if Player.InvincibleTimer == 0
Player.State = Player_State_GotHit
if Player.Direction == FACING_LEFT
Player.Speed = 0x20000
else
Player.Speed = -0x20000
end if
end if
end if
end if
break
end switch

TempValue3 += 4
TempValue3 += Player.CollisionTop
Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)
if TempValue0 == 3
TempValue4 = TempValue3
TempValue4 &= 15
if TempValue4 < 8
if Player.State != Player_State_HangBar
Player.State = Player_State_HangBar
Player.YVelocity = 0
Player.Animation = ANI_HANGING
TempValue3 &= 0x7FF0
TempValue3 += 4
TempValue3 -= Player.CollisionTop
Player.iYPos = TempValue3
PlayStageSfx(SFX_S_CATCH, false)
Screen.AdjustCameraY = 0
end if
end if
end if
end sub

sub ObjectDraw
if Object.State == R6_SETUP_WEB_SHOCK
switch Object.Frame
case 2
DrawRect(0, 0, Screen.XSize, Screen.YSize, 128, 0, 64, 64)
break

case 3
DrawRect(0, 0, Screen.XSize, Screen.YSize, 128, 0, 64, 32)
break

case 4
DrawRect(0, 0, Screen.XSize, Screen.YSize, 255, 128, 255, 32)
break
case 5
DrawRect(0, 0, Screen.XSize, Screen.YSize, 128, 0, 64, 64)
break

case 6
DrawRect(0, 0, Screen.XSize, Screen.YSize, 128, 0, 64, 32)
break

case 7
DrawRect(0, 0, Screen.XSize, Screen.YSize, 255, 128, 255, 32)
break

case 8
DrawRect(0, 0, Screen.XSize, Screen.YSize, 128, 0, 64, 32)
break
end switch
end if
end sub

sub ObjectStartup
Object[19].Type = TypeName[R6 Setup]
Object[19].Priority = PRIORITY_ACTIVE
Object[19].DrawOrder = 2

TempValue0 = 1
while TempValue0 < 3
RotatePalette(161, 163, 0)
CopyPalette(0, TempValue0)
TempValue0++
loop
RotatePalette(161, 163, 0)
end sub

// ========================
// Editor Subs
// ========================

sub RSDKDraw
DrawSprite(0)
end sub

sub RSDKLoad
LoadSpriteSheet("Global/Display.gif")
SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon

SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end sub

You might also like