Add centering back into edit/practice mode playback.

This commit is contained in:
Brandon W
2024-09-30 17:20:11 -07:00
committed by teejusb
parent bcd7e8e1d2
commit 7b2f0338b8
4 changed files with 34 additions and 2 deletions
+4
View File
@@ -22,6 +22,10 @@ void EditModePlayerManager::AddPlayers(const NoteData& note_data) {
player->SetY(SCREEN_CENTER_Y);
player->SetZoom(SCREEN_HEIGHT / 480);
StyleType style_type = GAMESTATE->GetCurrentStyle(pn)->m_StyleType;
if (center_) {
// Use the doubles style positioning for centering.
style_type = StyleType_OnePlayerTwoSides;
}
player->SetX(THEME->GetMetricF("ScreenGameplay", ssprintf("PlayerP%d%sX", pn + 1, StyleTypeToString(style_type).c_str())));
// Initial state is to hide the notefield.
+4 -1
View File
@@ -16,7 +16,6 @@
class EditModePlayerManager
{
public:
// Adds players based on the current gamestate.
void AddPlayers(const NoteData& note_data);
@@ -43,7 +42,11 @@ public:
// Play assist ticks.
void PlayTicks(GameplayAssist& gameplay_assist);
// Sets the "center" boolean, for centering the notefield.
void SetCenter(bool center) { center_ = center; }
private:
// All players that the manager is looking at. Indexable by PlayerNumber.
std::unordered_map<PlayerNumber, std::shared_ptr<PlayerPlus>> players_;
bool center_;
};
+21
View File
@@ -1525,6 +1525,27 @@ void ScreenEdit::Init()
SetDirty(true);
}
// There are two conditions for centering the notefield.
// 1. We're in EditMode
// 2. We're in PracticeMode, the preference is enabled,
// sylte is OnePlayerOneSide, and the theme allows it.
//
// If the "center_enabled" check is modified, also modify
// ScreenGameplay::Center1Player().
ThemeMetric<bool> allow_center;
allow_center.Load("ScreenGameplay", "AllowCenter1Player");
bool center_enabled = (Preference<bool>::GetPreferenceByName("Center1Player")->Get()
&& GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StyleType
== StyleType_OnePlayerOneSide)
&& GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE
&& GAMESTATE->m_PlayMode != PLAY_MODE_RAVE
&& allow_center;
bool edit_mode_screen = (m_sName == "ScreenEdit");
player_manager_.SetCenter(edit_mode_screen || center_enabled);
player_manager_.AddPlayers(m_NoteDataEdit);
player_manager_.AddPlayersToActorFrame(*this);
TransitionEditState(STATE_EDITING);
+5 -1
View File
@@ -882,7 +882,11 @@ bool ScreenGameplay::Center1Player() const
/* Perhaps this should be handled better by defining a new
* StyleType for ONE_PLAYER_ONE_CREDIT_AND_ONE_COMPUTER,
* but for now just ignore Center1Player when it's Battle or Rave
* Mode. This doesn't begin to address two-player solo (6 arrows) */
* Mode. This doesn't begin to address two-player solo (6 arrows)
*
* If this check is modified, also modify the center check in
* ScreenEdit::Init().
*/
return g_bCenter1Player &&
(bool)ALLOW_CENTER_1_PLAYER &&
GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE &&