mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 11:50:49 +00:00
- Add skill
CCMD to return player's current skill, while also being able to set skill for next game.
* Fixes #332.
This commit is contained in:
parent
77630dcbc7
commit
33845c4a23
10 changed files with 88 additions and 0 deletions
|
@ -495,3 +495,59 @@ CCMD(endofgame)
|
|||
STAT_Update(true);
|
||||
ChangeLevel(nullptr, -1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
CCMD(skill)
|
||||
{
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
auto argsCount = argv.argc();
|
||||
|
||||
if (argsCount < 2)
|
||||
{
|
||||
auto currentSkill = gi->GetCurrentSkill();
|
||||
if (currentSkill >= 0)
|
||||
{
|
||||
Printf("Current skill is %d (%s)\n", currentSkill, GStrings.localize(gSkillNames[currentSkill]));
|
||||
}
|
||||
else if (currentSkill == -1)
|
||||
{
|
||||
Printf("Current skill is not set (%d)\n");
|
||||
}
|
||||
else if (currentSkill == -2)
|
||||
{
|
||||
Printf("This game has no skill settings.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf("Current skill is an unknown/unsupported value (%d)\n");
|
||||
}
|
||||
}
|
||||
else if (argsCount == 2)
|
||||
{
|
||||
auto newSkill = atoi(argv[1]);
|
||||
if (newSkill >= 0 and newSkill < MAXSKILLS)
|
||||
{
|
||||
g_nextskill = newSkill;
|
||||
Printf("Skill will be changed for next game.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf("Please specify a skill level between 0 and %d\n", MAXSKILLS - 1);
|
||||
}
|
||||
}
|
||||
else if (argsCount > 2)
|
||||
{
|
||||
Printf(PRINT_BOLD, "skill <newskill>: returns the current skill level, and optionally sets the skill level for the next game.\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf("Currently not in a game.\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,6 +121,7 @@ struct GameInterface
|
|||
virtual bool GetGeoEffect(GeoEffect* eff, int viewsector) { return false; }
|
||||
virtual int Voxelize(int sprnum) { return -1; }
|
||||
virtual void AddExcludedEpisode(FString episode) {}
|
||||
virtual int GetCurrentSkill() { return -1; }
|
||||
|
||||
virtual FString statFPS()
|
||||
{
|
||||
|
|
|
@ -241,6 +241,12 @@ void GameInterface::NextLevel(MapRecord *map, int skill)
|
|||
NewLevel(map, skill, false);
|
||||
}
|
||||
|
||||
int GameInterface::GetCurrentSkill()
|
||||
{
|
||||
return gGameOptions.nDifficulty;
|
||||
}
|
||||
|
||||
|
||||
void GameInterface::Ticker()
|
||||
{
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
|
|
|
@ -149,6 +149,7 @@ struct GameInterface : public ::GameInterface
|
|||
void EnterPortal(spritetype* viewer, int type) override;
|
||||
void LeavePortal(spritetype* viewer, int type) override;
|
||||
void LoadGameTextures() override;
|
||||
int GetCurrentSkill() override;
|
||||
|
||||
GameStats getStats() override;
|
||||
};
|
||||
|
|
|
@ -68,6 +68,7 @@ struct GameInterface : public ::GameInterface
|
|||
void LeavePortal(spritetype* viewer, int type) override;
|
||||
bool GetGeoEffect(GeoEffect* eff, int viewsector) override;
|
||||
void AddExcludedEpisode(FString episode) override;
|
||||
int GetCurrentSkill() override;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -272,6 +272,11 @@ void GameInterface::loadPalette()
|
|||
genspriteremaps();
|
||||
}
|
||||
|
||||
int GameInterface::GetCurrentSkill()
|
||||
{
|
||||
return ud.player_skill - 1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// set up the game module's state
|
||||
|
|
|
@ -248,6 +248,7 @@ struct GameInterface : public ::GameInterface
|
|||
int chaseCamY(binangle ang) { return -ang.bsin() / 12; }
|
||||
int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() / 384; }
|
||||
void processSprites(spritetype* tsprite, int& spritesortcnt, int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) override;
|
||||
int GetCurrentSkill() override;
|
||||
|
||||
::GameStats getStats() override;
|
||||
};
|
||||
|
|
|
@ -141,6 +141,11 @@ void GameInterface::NewGame(MapRecord *map, int skill, bool frommenu)
|
|||
gameaction = ga_level;
|
||||
}
|
||||
|
||||
int GameInterface::GetCurrentSkill()
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
int selectedlevelnew;
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DMapScreen, SetNextLevel)
|
||||
|
|
|
@ -580,6 +580,17 @@ void GameInterface::NewGame(MapRecord *map, int skill, bool)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int GameInterface::GetCurrentSkill()
|
||||
{
|
||||
return Skill;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void GameInterface::Ticker(void)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -2274,6 +2274,7 @@ struct GameInterface : public ::GameInterface
|
|||
void LeavePortal(spritetype* viewer, int type) override;
|
||||
int Voxelize(int sprnum);
|
||||
void ExitFromMenu() override;
|
||||
int GetCurrentSkill() override;
|
||||
|
||||
|
||||
GameStats getStats() override;
|
||||
|
|
Loading…
Reference in a new issue