0% found this document useful (0 votes)
32 views6 pages

Stage Menu

The document outlines the Stage Menu Object script for the RSDK Project: Sonic 1/Sonic 2, authored by Christian Whitehead and Simon Thomley. It includes function declarations, static values, and event handling for the stage menu, including user input processing and object positioning. The script manages the menu's state transitions, visual effects, and interactions with player controls.

Uploaded by

Jogatina animal
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)
32 views6 pages

Stage Menu

The document outlines the Stage Menu Object script for the RSDK Project: Sonic 1/Sonic 2, authored by Christian Whitehead and Simon Thomley. It includes function declarations, static values, and event handling for the stage menu, including user input processing and object positioning. The script manages the menu's state transitions, visual effects, and interactions with player controls.

Uploaded by

Jogatina animal
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/ 6

// ----------------------------------

// RSDK Project: Sonic 1/Sonic 2


// Script Description: Stage Menu Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 7 : TYPE_STAGEMENU

// Function declarations
reserve function StageMenu_Function2

// Static Values
public value StageMenu_value3 = 0;

// Tables
public table StageMenu_table3
0, 3, 6, 9, 12, 15, 18
end table

function StageMenu_Function2
object[10].xpos = -108
object[10].xpos *= object.scale
object[10].xpos >>= 8
object[14].xpos = object[10].xpos
object[11].xpos = -36
object[11].xpos *= object.scale
object[11].xpos >>= 8
object[15].xpos = object[11].xpos
object[12].xpos = 36
object[12].xpos *= object.scale
object[12].xpos >>= 8
object[16].xpos = object[12].xpos
object[13].xpos = 108
object[13].xpos *= object.scale
object[13].xpos >>= 8
object[17].xpos = object[13].xpos
object[10].ypos = -48
object[10].ypos *= object.scale
object[10].ypos >>= 8
object[11].ypos = object[10].ypos
object[12].ypos = object[10].ypos
object[13].ypos = object[10].ypos
object[14].ypos = 8
object[14].ypos *= object.scale
object[14].ypos >>= 8
object[15].ypos = object[14].ypos
object[16].ypos = object[14].ypos
object[17].ypos = object[14].ypos
end function

event ObjectMain
switch object.state
case 0
if engine.deviceType == RETRO_STANDARD
options.physicalControls = 1
object.value3 = 1
end if
object.scale = 256
arrayPos0 = 10
ResetObjectEntity(arrayPos0, TypeName[Zone Button], 1, -108, -48)
object[arrayPos0].priority = PRIORITY_ACTIVE
arrayPos0++
ResetObjectEntity(arrayPos0, TypeName[Zone Button], 2, -36, -48)
object[arrayPos0].priority = PRIORITY_ACTIVE
arrayPos0++
ResetObjectEntity(arrayPos0, TypeName[Zone Button], 3, 36, -48)
object[arrayPos0].priority = PRIORITY_ACTIVE
arrayPos0++
ResetObjectEntity(arrayPos0, TypeName[Zone Button], 4, 108, -48)
object[arrayPos0].priority = PRIORITY_ACTIVE
arrayPos0++
ResetObjectEntity(arrayPos0, TypeName[Zone Button], 5, -108, 8)
object[arrayPos0].priority = PRIORITY_ACTIVE
arrayPos0++
ResetObjectEntity(arrayPos0, TypeName[Zone Button], 6, -36, 8)
object[arrayPos0].priority = PRIORITY_ACTIVE
arrayPos0++
ResetObjectEntity(arrayPos0, TypeName[Zone Button], 7, 36, 8)
object[arrayPos0].priority = PRIORITY_ACTIVE
SetClassicFade(0, 0, 0, 255)
object.value0 = 384
options.stageSelectFlag = 0
object.state = 1
break
case 1
if object.value0 > 0
object.value0 -= 16
SetClassicFade(0, 0, 0, object.value0)
else
object.state = 3
end if
break
case 3
if options.physicalControls == 0
if object.state != 4
object.value3 = 0
if inputPress.left == 1
options.physicalControls = 1
object.value3 = 12
end if
if inputPress.right == 1
options.physicalControls = 1
object.value3 = 1
end if
if inputPress.up == 1
options.physicalControls = 1
object.value3 = 9
end if
if inputPress.down == 1
options.physicalControls = 1
object.value3 = 1
end if
end if
else
if inputPress.left == 1
object.value3--
if object.value3 < 1
object.value3 = 7
end if
PlaySfx(SfxName[Menu Move], 0)
end if
if inputPress.right == 1
object.value3++
if object.value3 > 7
object.value3 = 1
end if
PlaySfx(SfxName[Menu Move], 0)
end if
if inputPress.up == 1
object.value3 -= 4
if object.value3 < 1
object.value3 += 8
if object.value3 == 8
object.value3 = 4
end if
end if
PlaySfx(SfxName[Menu Move], 0)
end if
if inputPress.down == 1
object.value3 += 4
if object.value3 > 7
object.value3 -= 8
if object.value3 == 8
object.value3 = 4
end if
if object.value3 == 0
object.value3 = 4
end if
end if
PlaySfx(SfxName[Menu Move], 0)
end if
if inputPress.start == 1
arrayPos0 = object.value3
arrayPos0 += 9
if object[arrayPos0].value2 == 0
object.state = 4
PlaySfx(SfxName[Menu Select], 0)
else
PlaySfx(SfxName[Jump], 0)
end if
end if
if inputPress.buttonA == 1
arrayPos0 = object.value3
arrayPos0 += 9
if object[arrayPos0].value2 == 0
object.state = 4
PlaySfx(SfxName[Menu Select], 0)
else
PlaySfx(SfxName[Jump], 0)
end if
end if
end if
break
case 4
if object.scale > 0
object.scale -= 8
end if
object[10].alpha = object.scale
object[11].alpha = object.scale
object[12].alpha = object.scale
object[13].alpha = object.scale
object[14].alpha = object.scale
object[15].alpha = object.scale
object[16].alpha = object.scale
object[10].drawOrder = 3
object[11].drawOrder = 3
object[12].drawOrder = 3
object[13].drawOrder = 3
object[14].drawOrder = 3
object[15].drawOrder = 3
object[16].drawOrder = 3
arrayPos0 = object.value3
arrayPos0 += 9
object[arrayPos0].alpha = 256
object[arrayPos0].drawOrder = 4
arrayPos0 = object.value3
arrayPos0 += 9
CallFunction(StageMenu_Function2)
if object.value4 < 32
object.value4++
else
object.value4 = 0
object.state = 5
end if
break
case 5
arrayPos0 = object.value3
arrayPos0 += 9
if object[arrayPos0].value1 < 224
object[arrayPos0].value1 += 8
else
object.value0 = -640
object.state = 6
end if
break
case 6
if object.value0 < 256
music.volume -= 10
object.value0 += 16
if object.value0 > 0
SetClassicFade(0, 0, 0, object.value0)
end if
else
StopMusic()
player.score = 0
player.scoreBonus = 0xC350
stage.activeList = REGULAR_STAGE
temp0 = object.value3
temp0--
GetTableValue(stage.listPos, temp0, StageMenu_table3)
player.lives = StageMenu_value3
LoadStage()
SetClassicFade(0, 0, 0, 255)
end if
break
case 7
if object.value0 < 256
music.volume -= 10
object.value0 += 16
SetClassicFade(0, 0, 0, object.value0)
else
StopMusic()
engine.state = 8
SetClassicFade(0, 0, 0, 255)
end if
break
end switch

if inputPress.buttonB == 1

options.gameMode = 0
stage.playerListPos = 0

options.attractMode = 0
player.lives = 3
player.continues = 0
player.score = 0
player.scoreBonus = 0xC350
lampPostID = 0
specialStage.listPos = 0
specialStage.emeralds = 0
specialStage.nextZone = 0
stage.activeList = PRESENTATION_STAGE
stage.listPos = StageName[P - MAIN MENU]
LoadStage()
end if
end event

event ObjectDraw
DrawSpriteScreenXY(0, screen.xcenter, 17)
DrawSpriteScreenXY(1, screen.xcenter, 17)
end event

event ObjectStartup
LoadSpriteSheet("LevelSelect/Icons.gif")
SpriteFrame(-96, 0, 80, 14, 1, 208)
SpriteFrame(0, 0, 96, 14, 82, 208)
foreach (TypeName[Stage Menu], arrayPos0, ALL_ENTITIES)
object[arrayPos0].type = TypeName[Blank Object]
object[1].type = TypeName[Stage Menu]
object[1].priority = PRIORITY_ACTIVE
StageMenu_value3 = player.lives
player.lives = 1
next
end event

event RSDKDraw
DrawSprite(0)
end event

event RSDKLoad
LoadSpriteSheet("Global/Display.gif")
SpriteFrame(-16, -16, 32, 32, 1, 143)
end event

You might also like