forked from etternagame/etterna
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create PlayerPractice derivative of Player for Practice Mode
for finer control of the inner working of the game and make cheating both easier and harder at the same time (please)
- Loading branch information
Showing
4 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#include "Etterna/Globals/global.h" | ||
#include "Etterna/Models/Misc/PlayerAI.h" | ||
#include "Etterna/Models/Misc/PlayerState.h" | ||
#include "ArrowEffects.h" | ||
#include "NoteField.h" | ||
#include "Etterna/Models/Misc/AdjustSync.h" | ||
#include "Etterna/Models/Misc/Game.h" | ||
#include "Etterna/Models/NoteData/NoteDataWithScoring.h" | ||
#include "Etterna/Models/ScoreKeepers/ScoreKeeperNormal.h" | ||
#include "Etterna/Singletons/GameState.h" | ||
#include "Etterna/Singletons/NoteSkinManager.h" | ||
#include "Etterna/Singletons/StatsManager.h" | ||
#include "Etterna/Singletons/ScreenManager.h" | ||
#include "Etterna/Singletons/ThemeManager.h" | ||
#include "Etterna/Models/Misc/ThemeMetric.h" | ||
#include "RageUtil/Utils/RageUtil.h" | ||
#include "PlayerPractice.h" | ||
|
||
PlayerPractice::PlayerPractice(NoteData& nd, bool bVisibleParts) | ||
: Player(nd, bVisibleParts) | ||
{ | ||
// eh | ||
} | ||
|
||
PlayerPractice::~PlayerPractice() | ||
{ | ||
// dont have to do anything here | ||
} | ||
|
||
void | ||
PlayerPractice::Init(const std::string& sType, | ||
PlayerState* pPlayerState, | ||
PlayerStageStats* pPlayerStageStats, | ||
LifeMeter* pLM, | ||
ScoreKeeper* pPrimaryScoreKeeper) | ||
{ | ||
Player::Init( | ||
sType, pPlayerState, pPlayerStageStats, pLM, pPrimaryScoreKeeper); | ||
if (m_pPlayerStageStats) | ||
m_pPlayerStageStats->m_bDisqualified = true; | ||
} | ||
|
||
void | ||
PlayerPractice::Update(float fDeltaTime) | ||
{ | ||
const auto now = std::chrono::steady_clock::now(); | ||
if (!m_bLoaded || GAMESTATE->m_pCurSong == NULL) | ||
return; | ||
|
||
ActorFrame::Update(fDeltaTime); | ||
|
||
const float fSongBeat = m_pPlayerState->m_Position.m_fSongBeat; | ||
const int iSongRow = BeatToNoteRow(fSongBeat); | ||
|
||
ArrowEffects::SetCurrentOptions( | ||
&m_pPlayerState->m_PlayerOptions.GetCurrent()); | ||
|
||
UpdateVisibleParts(); | ||
|
||
// Sure, why not? | ||
if (GAMESTATE->GetPaused()) | ||
return; | ||
|
||
// Tell the NoteField we pressed (or didnt press) certain columns | ||
UpdatePressedFlags(); | ||
|
||
// Tell Rolls to update (if in Autoplay) | ||
// Tell Holds to update (lose life) | ||
UpdateHoldsAndRolls(fDeltaTime, now); | ||
|
||
// A lot of logic... basically everything not listed here | ||
UpdateCrossedRows(now); | ||
|
||
// Check for completely judged rows. | ||
UpdateJudgedRows(fDeltaTime); | ||
UpdateTapNotesMissedOlderThan(GetMaxStepDistanceSeconds()); | ||
} | ||
|
||
void | ||
PlayerPractice::PositionReset() | ||
{ | ||
// Reset stage stats and stuff | ||
countStats = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef PlayerPractice_H | ||
#define PlayerPractice_H | ||
|
||
#include "Player.h" | ||
|
||
// Player derivative meant to ignore useless stuff | ||
class PlayerPractice : public Player | ||
{ | ||
public: | ||
PlayerPractice(NoteData& nd, bool bVisibleParts = true); | ||
~PlayerPractice() override; | ||
|
||
void Init(const std::string& sType, | ||
PlayerState* pPlayerState, | ||
PlayerStageStats* pPlayerStageStats, | ||
LifeMeter* pLM, | ||
ScoreKeeper* pPrimaryScoreKeeper) override; | ||
void Update(float fDeltaTime) override; | ||
|
||
// When called, resets stage stats and necessary things | ||
// Also sets countStats to false. | ||
void PositionReset(); | ||
|
||
private: | ||
// Becomes true immediately on first button press. | ||
// Allows notes to pass without counting for anything. | ||
bool countStats = false; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters