Skip to content

Commit

Permalink
chall xml deny pace option
Browse files Browse the repository at this point in the history
  • Loading branch information
cryham committed Sep 17, 2015
1 parent 3ad6c08 commit 1f760c4
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 deletions.
5 changes: 3 additions & 2 deletions config/challenges.xml
Expand Up @@ -38,9 +38,9 @@
// *** Hud ***
// not allowed when "0", "1" means user can choose
// checkpoint arrow, checkpoint beam (default: 0 deny)
// minimap, track's ghost (default: 1 allow)
// minimap, track's ghost, pacenotes (default: 1 allow)
<hud minimap="1" chkArrow="1" chkBeam="1" trkGhost="1" />
<hud minimap="1" chkArrow="1" chkBeam="1" trkGhost="1" pacenotes="1" />
// *** Pass (win) conditions, for whole challenge ***
// use many if desired (one is good)
Expand Down Expand Up @@ -747,6 +747,7 @@
<challenge name="Horrible Weather" ver="1" difficulty="5" type="5"
descr="Ice, sandstorm and heavy rain, this is definitely a challenge. Remember, on ice, push throttle only occasionally.">
<car names="3S|TC6|M3" />
<hud pacenotes="0" />
<pass avgPoints="14" factor="2" />
<tracks>
<t name="Wnt4-IceSlip" passPoints="11" />
Expand Down
2 changes: 1 addition & 1 deletion source/ogre/CGame.cpp
Expand Up @@ -38,7 +38,7 @@ App::App(SETTINGS *settings, GAME *game)
,carIdWin(-1), iRplCarOfs(0)
// other
,newGameRpl(0), curLoadState(0), dstTrk(1)
,bHideHudAid(0), bHideHudBeam(0)
,bHideHudArr(0), bHideHudBeam(0), bHideHudPace(0)
,bRplPlay(0),bRplPause(0), bRplRec(0), bRplWnd(1), iRplSkip(0)
,iEdTire(0), iTireLoad(0), iCurLat(0),iCurLong(0),iCurAlign(0), iUpdTireGr(0)
,fLastFrameDT(0.001f)
Expand Down
4 changes: 3 additions & 1 deletion source/ogre/CGame.h
Expand Up @@ -148,7 +148,9 @@ class App : public BaseApp,
PreviewTex prvStCh; // champ,chall stage view

bool bHideHudBeam; // hides beam when replay or no road
bool bHideHudAid; // hides arrow,pacenotes when replay,splitscreen or no road
bool bHideHudArr; // hides arrow when replay,splitscreen
bool bHideHudPace; // hides pacenotes when same or deny by challenge

bool bRplPlay,bRplPause, bRplRec, bRplWnd; // game
int carIdWin, iRplCarOfs, iRplSkip;

Expand Down
4 changes: 3 additions & 1 deletion source/ogre/ChallengesXml.cpp
Expand Up @@ -20,7 +20,8 @@ Chall::Chall() // defaults
,sim_mode("normal")
,damage_type(2), boost_type(1), flip_type(2), rewind_type(1)
,dmg_lap(40)
,minimap(1), chk_arr(0), chk_beam(0), trk_ghost(1)
,minimap(1), chk_arr(0), chk_beam(0)
,trk_ghost(1), pacenotes(1)
,abs(0),tcs(0)
,avgPoints(-1.f), totalTime(-1.f), avgPos(-1.f) // pass
,carChng(0), prizes(2), factor(1.f)
Expand Down Expand Up @@ -100,6 +101,7 @@ bool ChallXml::LoadXml(std::string file, TracksXml* trks, bool check)
a = eHud->Attribute("chkArrow"); if (a) c.chk_arr = s2i(a) > 0;
a = eHud->Attribute("chkBeam"); if (a) c.chk_beam = s2i(a) > 0;
a = eHud->Attribute("trkGhost"); if (a) c.trk_ghost = s2i(a) > 0;
a = eHud->Attribute("pacenotes"); if (a) c.pacenotes = s2i(a) > 0;
}
XMLElement* ePass = eCh->FirstChildElement("pass");
if (ePass)
Expand Down
3 changes: 2 additions & 1 deletion source/ogre/ChallengesXml.h
Expand Up @@ -45,7 +45,8 @@ class Chall
int dmg_lap; // dmg repair on lap

// hud
bool minimap, chk_arr, chk_beam, trk_ghost; // deny using it if false
bool minimap, chk_arr, chk_beam,
trk_ghost, pacenotes; // deny using it if false
bool abs,tcs; // deny if false

// pass -1 means not needed, you can use one or more conditions
Expand Down
2 changes: 1 addition & 1 deletion source/ogre/Gui_Events.cpp
Expand Up @@ -343,7 +343,7 @@ void CGui::chkHudShow(Ck*)
void CGui::chkArrow(Ck*)
{
if (hud->arrow.nodeRot)
hud->arrow.nodeRot->setVisible(pSet->check_arrow && !app->bHideHudAid);
hud->arrow.nodeRot->setVisible(pSet->check_arrow && !app->bHideHudArr);
}
void CGui::chkBeam(Ck*)
{
Expand Down
11 changes: 7 additions & 4 deletions source/ogre/SceneInit.cpp
Expand Up @@ -247,7 +247,10 @@ void App::LoadCleanUp() // 1 first
// hide hud arrow,beam,pace
bool rplRd = bRplPlay /*|| scn->road && scn->road->getNumPoints() < 2/**/;
bHideHudBeam = rplRd;
bHideHudAid = rplRd || pSet->game.local_players > 1;
bHideHudArr = rplRd || pSet->game.local_players > 1;
bool denyPace = gui->pChall && !gui->pChall->pacenotes;
bHideHudPace = bHideHudArr || denyPace;


// rem old track
if (dstTrk)
Expand Down Expand Up @@ -478,7 +481,7 @@ void App::LoadScene() // 3

// checkpoint arrow
bool deny = gui->pChall && !gui->pChall->chk_arr;
if (!bHideHudAid && !deny)
if (!bHideHudArr && !deny)
hud->arrow.Create(mSceneMgr, pSet);
}

Expand Down Expand Up @@ -590,7 +593,7 @@ void App::LoadRoad() // 6
CreateRoad(); // dstTrk inside

if (hud->arrow.nodeRot)
hud->arrow.nodeRot->setVisible(pSet->check_arrow && !bHideHudAid);
hud->arrow.nodeRot->setVisible(pSet->check_arrow && !bHideHudArr);

// boost fuel at start . . .
// based on road length
Expand Down Expand Up @@ -835,7 +838,7 @@ void App::CreateRoad()
// pace ~ ~
scn->DestroyPace();

if (!bHideHudAid)
if (!bHideHudPace)
{
scn->pace = new PaceNotes(pSet);
scn->pace->Setup(mSceneMgr, cam, scn->terrain, gui->mGui, mWindow);
Expand Down

0 comments on commit 1f760c4

Please sign in to comment.