From 6f8d215bce41bc6ee0954b313696e1727b645ab9 Mon Sep 17 00:00:00 2001 From: cryham Date: Fri, 3 May 2024 22:42:38 +0200 Subject: [PATCH] fixes --- docs/Roadmap.md | 4 ++-- src/game/CarModel_Create.cpp | 9 +++++---- src/game/CarModel_Update.cpp | 5 +++-- src/game/Gui_Util.cpp | 18 ++++++++++-------- src/vdrift/car.h | 5 +++-- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/docs/Roadmap.md b/docs/Roadmap.md index d937e976..6cd92dc3 100644 --- a/docs/Roadmap.md +++ b/docs/Roadmap.md @@ -8,8 +8,8 @@ Marked: `crucial`, **Next or Big**, _Important_. ---- ### New game stuff✨ -🏆✨ new [game Modes](https://stuntrally.tuxfamily.org/mantis/view.php?id=21): [Career](https://forum.freegamedev.net/viewtopic.php?f=79&t=5211), WIP Collection, 3d cup models -Score for: drift (sliding on road), air time (jumps etc) +🏆 new [game Modes](https://stuntrally.tuxfamily.org/mantis/view.php?id=21): [Career](https://forum.freegamedev.net/viewtopic.php?f=79&t=5211), WIP Collection, 3d cup models +Score for: drift (sliding on road), air time (jumps etc), hitting dynamic objects 🕹️ New **Game** elements: ✨Teleporters, moving & rotating Obstacles, elevators diff --git a/src/game/CarModel_Create.cpp b/src/game/CarModel_Create.cpp index 00a52a6d..18a4a94f 100644 --- a/src/game/CarModel_Create.cpp +++ b/src/game/CarModel_Create.cpp @@ -193,7 +193,7 @@ void CarModel::CreateLight(SceneNode* ndCar, LiType type, Vector3 pos, ColourVal const Real dirY = under ?-1.f : front ? -0.1f : -0.0f; //par- const Real dirZ = under ? 0.f : front ? 1.0f : -1.0f; - LogO("C**L Add light: type "+toStr(type)+" pos "+toStr(pos)); //- + LogO("C**L Add light: "+strLiType[type]+" pos "+toStr(pos)); //- SceneNode* node = ndCar->createChildSceneNode( SCENE_DYNAMIC, pos ); Light* l = mSceneMgr->createLight(); node->attachObject( l ); ToDel(node); @@ -261,7 +261,8 @@ void CarModel::CreateLight(SceneNode* ndCar, LiType type, Vector3 pos, ColourVal //------------------------------------------------------------------------------------------------------- void CarModel::Create() { - LogO("C==C Creating Vehicle: "+sDirname+" -----"); + LogO(""); + LogO("C==C ----- Creating Vehicle: "+sDirname+" -----"); //if (!pCar) return; String strI = toStr(iIndex)+ (cType == CT_TRACK ? "Z" : (cType == CT_GHOST2 ? "V" :"")); @@ -490,7 +491,7 @@ void CarModel::Create() for (auto& pos : fsReverse.pos) { bsReverse->createBillboard(pos, fsReverse.clr); - if (fsReverse.lit[n] && pSet->li.front && !ghost) + if (fsReverse.lit[n] && pSet->li.reverse && !ghost) CreateLight(ndCar, LI_Revese, pos, fsReverse.clr); //💡 ++n; } @@ -616,5 +617,5 @@ void CarModel::Create() } } UpdParsTrails(); } - LogO("C--L Created Vehicle: "+sDirname+" total lights: "+toStr(lights.size())+" -----"); + LogO("C--L ----- Created Vehicle: "+sDirname+" total lights: "+toStr(lights.size())+" -----\n"); } diff --git a/src/game/CarModel_Update.cpp b/src/game/CarModel_Update.cpp index 93c7d3b8..45ccb112 100644 --- a/src/game/CarModel_Update.cpp +++ b/src/game/CarModel_Update.cpp @@ -284,6 +284,7 @@ void CarModel::Update(PosInfo& posInfo, PosInfo& posInfoCam, float time) // 🔴 brake state flares + //------------------------------------------------------------------------ bool braking = posInfo.braking > 0; if (bBraking != braking && gPar.carPrv == 0) { @@ -292,7 +293,7 @@ void CarModel::Update(PosInfo& posInfo, PosInfo& posInfoCam, float time) if (bsBrakes) bsBrakes->setVisible(vis); } - // reverse + // 💡 reverse bool reverse = posInfo.reverse > 0; if (bReverse != reverse && gPar.carPrv == 0) { @@ -301,7 +302,6 @@ void CarModel::Update(PosInfo& posInfo, PosInfo& posInfoCam, float time) if (bsReverse) bsReverse->setVisible(vis); } - bReverseOld = bReverse; // meh bReverse = reverse; if (bReverse != bReverseOld) { @@ -311,6 +311,7 @@ void CarModel::Update(PosInfo& posInfo, PosInfo& posInfoCam, float time) if (bsReverse) bsReverse->setVisible(bReverse && pSet->li.front); } + bReverseOld = bReverse; // 💡 Lights //------------------------------------------------------------------------ diff --git a/src/game/Gui_Util.cpp b/src/game/Gui_Util.cpp index 826ae533..063e516a 100644 --- a/src/game/Gui_Util.cpp +++ b/src/game/Gui_Util.cpp @@ -219,15 +219,17 @@ void CGui::GuiShortcut(EMenu menu, int tab, int subtab, int game) if (menu != MN_NoCng) // chg menu { pSet->iMenu = menu; - - if (tab == TAB_Track || tab == TAB_Champs) - { SetNumPlayers(1); app->updPanGames(game); } - if (tab == TAB_Split) - { SetNumPlayers(-2); app->updPanGames(game); } // 👥 - if (tab == TAB_Multi) - { SetNumPlayers(1); app->updPanGames(game); } // 📡 - } + if (pSet->iMenu == MN_Single) // set num plr + { + if (tab == TAB_Track || tab == TAB_Champs) + { SetNumPlayers(1); app->updPanGames(game); } + if (tab == TAB_Split) + { SetNumPlayers(-2); app->updPanGames(game); } // 👥 + if (tab == TAB_Multi) + { SetNumPlayers(1); app->updPanGames(game); } // 📡 + } } + TabPtr tabs = 0; std::vector* subt = 0; diff --git a/src/vdrift/car.h b/src/vdrift/car.h index eb5e7ef1..7aad8224 100644 --- a/src/vdrift/car.h +++ b/src/vdrift/car.h @@ -85,8 +85,9 @@ class CAR /// return the speedometer reading (based on the driveshaft speed) in m/s float GetSpeedometer() const { - return dynamics.vtype != V_Car ? - dynamics.GetSpeedDir() : dynamics.GetSpeedMPS(); + auto& t = dynamics.vtype; + return t == V_Sphere ? dynamics.GetVelocity().Magnitude() : + t != V_Car ? dynamics.GetSpeedDir() : dynamics.GetSpeedMPS(); } std::string GetCarType() const { return cartype; }