summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice <maurice.henke@protonmail.com>2021-07-04 20:16:43 +0200
committerMaurice <maurice.henke@protonmail.com>2021-07-04 20:16:43 +0200
commit025cd59f6b4feafcab7045ad6c4e89210310b097 (patch)
tree40a0f22806733181fe00c1337ab5531246c6bbb6
parentb2181702d27e32f9e21eada5251e486ba31fba15 (diff)
Newer seed selection implemented
m---------GameCube/externals/libtp_rel0
-rw-r--r--GameCube/source/main.cpp47
2 files changed, 38 insertions, 9 deletions
diff --git a/GameCube/externals/libtp_rel b/GameCube/externals/libtp_rel
-Subproject 31f0dd644db50ae7a9da55ec65148b779aeca25
+Subproject 55210aa0043bd8e024fd084735f0612d3a42657
diff --git a/GameCube/source/main.cpp b/GameCube/source/main.cpp
index 6f95b118..e8e34667 100644
--- a/GameCube/source/main.cpp
+++ b/GameCube/source/main.cpp
@@ -15,7 +15,7 @@
namespace mod
{
// Bind extern global variables
- libtp::display::Console console;
+ libtp::display::Console console( 9 );
rando::Randomizer* randomizer = nullptr;
rando::SeedList seedList;
@@ -51,10 +51,34 @@ namespace mod
using namespace libtp::tp::m_do_controller_pad;
auto checkBtn = [&input]( uint32_t combo ) { return ( input & combo ) == combo; };
- if ( input )
+ if ( input && gameState == GAME_TITLE )
{
- // TODO: Handle inputs for seed selection if required
+ // Handle seed selection if necessary
+ if ( seedList.m_numSeeds > 1 )
+ {
+ if ( checkBtn( Button_X ) )
+ {
+ seedList.m_selectedSeed++;
+
+ if ( seedList.m_selectedSeed >= seedList.m_numSeeds )
+ seedList.m_selectedSeed = 0;
+ }
+ else if ( checkBtn( Button_Y ) )
+ {
+ if ( seedList.m_selectedSeed == 0 )
+ seedList.m_selectedSeed = seedList.m_numSeeds;
+
+ seedList.m_selectedSeed--;
+ }
+
+ // 8 is the line it typically appears
+ console.setLine( 8 );
+ console << "\r"
+ << "[" << seedList.m_selectedSeed + 1 << "/" << seedList.m_numSeeds
+ << "] Seed: " << seedList[seedList.m_selectedSeed].seed;
+ }
}
+ // End of handling title screen inputs
}
void handle_fapGm_Execute()
@@ -72,10 +96,12 @@ namespace mod
if ( l_fpcNdRq_Queue )
{
+ // Previous state
+ uint8_t prevState = gameState;
uint8_t state = *reinterpret_cast<uint8_t*>( reinterpret_cast<uint32_t>( l_fpcNdRq_Queue ) + 0x59 );
// Normal/Loading into game
- if ( gameState != GAME_ACTIVE && state == 11 )
+ if ( prevState != GAME_ACTIVE && state == 11 )
{
// check whether we're in title screen CS
if ( 0 != strcmp( "S_MV000", gameInfo->nextStageVars.nextStage ) )
@@ -83,10 +109,12 @@ namespace mod
gameState = GAME_ACTIVE;
}
}
- else if ( gameState != GAME_TITLE && ( state == 12 || state == 13 ) )
+ else if ( prevState != GAME_TITLE && ( state == 12 || state == 13 ) )
{
+ gameState = GAME_TITLE;
+
// Handle console differently when the user first loads it
- if ( gameState == GAME_BOOT )
+ if ( prevState == GAME_BOOT )
{
switch ( seedList.m_numSeeds )
{
@@ -105,13 +133,14 @@ namespace mod
default:
// User has to select one of the seeds
- console << seedList.m_numSeeds << " Seeds available, please select one.\n";
+ console << "Please select a seed <X/Y>\n";
+ // trigger a dummy input to print the current selection
+ doInput( Button_Start );
+
setScreen( true );
break;
}
}
-
- gameState = GAME_TITLE;
}
}
// End of handling gameStates