diff --git a/game/camera.cpp b/game/camera.cpp index 9dc19fd91..acede8164 100644 --- a/game/camera.cpp +++ b/game/camera.cpp @@ -217,6 +217,14 @@ void Camera::toggleDebug() { dbg = !dbg; } +void Camera::toggleDesktop() { + desktop = !desktop; + } + +bool Camera::isDesktop() { + return desktop; +} + void Camera::setSpin(const PointF &p) { dst.spin = Vec3(p.x,p.y,0); src.spin = dst.spin; diff --git a/game/camera.h b/game/camera.h index df596be69..1f25a3587 100644 --- a/game/camera.h +++ b/game/camera.h @@ -80,6 +80,8 @@ class Camera final { void setLookBack(bool lb); void toggleDebug(); + void togglePDesktop(); + bool isDesktop(); void tick(uint64_t dt); void debugDraw(DbgPainter& p); @@ -142,6 +144,7 @@ class Camera final { uint32_t vpHeight=0; bool dbg = false; + bool desktop = false; bool tgEnable = true; bool fpEnable = false; bool lbEnable = false; diff --git a/game/mainwindow.cpp b/game/mainwindow.cpp index 59e2e74bb..a036b2d35 100644 --- a/game/mainwindow.cpp +++ b/game/mainwindow.cpp @@ -198,16 +198,18 @@ void MainWindow::paintEvent(PaintEvent& event) { paintFocus(p,focus,vp); if(auto pl = Gothic::inst().player()){ - float hp = float(pl->attribute(ATR_HITPOINTS))/float(pl->attribute(ATR_HITPOINTSMAX)); - float mp = float(pl->attribute(ATR_MANA)) /float(pl->attribute(ATR_MANAMAX)); - drawBar(p,barHp, 10, h()-10, hp, AlignLeft | AlignBottom); - drawBar(p,barMana,w()-10,h()-10, mp, AlignRight | AlignBottom); - if(pl->isDive()) { - uint32_t gl = pl->guild(); - auto v = float(pl->world().script().guildVal().dive_time[gl]); - if(v>0) { - auto t = float(pl->diveTime())/1000.f; - drawBar(p,barMisc,w()/2,h()-10, (v-t)/(v), AlignHCenter | AlignBottom); + if (!camera.isDesktop()) { + float hp = float(pl->attribute(ATR_HITPOINTS))/float(pl->attribute(ATR_HITPOINTSMAX)); + float mp = float(pl->attribute(ATR_MANA)) /float(pl->attribute(ATR_MANAMAX)); + drawBar(p,barHp, 10, h()-10, hp, AlignLeft | AlignBottom); + drawBar(p,barMana,w()-10,h()-10, mp, AlignRight | AlignBottom); + if(pl->isDive()) { + uint32_t gl = pl->guild(); + auto v = float(pl->world().script().guildVal().dive_time[gl]); + if(v>0) { + auto t = float(pl->diveTime())/1000.f; + drawBar(p,barMisc,w()/2,h()-10, (v-t)/(v), AlignHCenter | AlignBottom); + } } } } @@ -235,20 +237,32 @@ void MainWindow::paintEvent(PaintEvent& event) { renderer.dbgDraw(p); if(Gothic::inst().doFrate()) { - char fpsT[64]={}; - std::snprintf(fpsT,sizeof(fpsT),"fps = %.2f",fps.get()); - //string_frm fpsT("fps = ", fps.get(), " ", info); + bool printFrate = true; + if (world!=nullptr) { + auto& camera = *Gothic::inst().camera(); + if (camera.isDesktop()) { + printFrate = false; + } + } + if (printFrate) { + char fpsT[64]={}; + std::snprintf(fpsT,sizeof(fpsT),"fps = %.2f",fps.get()); + //string_frm fpsT("fps = ", fps.get(), " ", info); - auto& fnt = Resources::font(); - fnt.drawText(p,5,fnt.pixelSize()+5,fpsT); + auto& fnt = Resources::font(); + fnt.drawText(p,5,fnt.pixelSize()+5,fpsT); + } } if(Gothic::inst().doClock() && world!=nullptr) { - auto hour = world->time().hour(); - auto min = world->time().minute(); - auto& fnt = Resources::font(); - string_frm clockT(int(hour),":",int(min)); - fnt.drawText(p,w()-fnt.textSize(clockT).w-5,fnt.pixelSize()+5,clockT); + auto& camera = *Gothic::inst().camera(); + if (!camera.isDesktop()) { + auto hour = world->time().hour(); + auto min = world->time().minute(); + auto& fnt = Resources::font(); + string_frm clockT(int(hour),":",int(min)); + fnt.drawText(p,w()-fnt.textSize(clockT).w-5,fnt.pixelSize()+5,clockT); + } } } diff --git a/game/marvin.cpp b/game/marvin.cpp index 2d76bb335..133a1b2fd 100644 --- a/game/marvin.cpp +++ b/game/marvin.cpp @@ -95,7 +95,7 @@ Marvin::Marvin() { {"set time %d %d", C_SetTime}, {"spawnmass %d", C_Invalid}, {"spawnmass giga %d", C_Invalid}, - {"toggle desktop", C_Invalid}, + {"toggle desktop", C_ToggleDesktop}, {"toggle freepoints", C_Invalid}, {"toggle screen", C_Invalid}, {"toggle time", C_ToggleTime}, @@ -328,6 +328,11 @@ bool Marvin::exec(std::string_view v) { c->setInertiaTargetEnable(!c->isInertiaTargetEnabled()); return true; } + case C_ToggleDesktop: { + if(auto c = Gothic::inst().camera()) + c->toggleDesktop(); + return true; + } case C_Insert: { World* world = Gothic::inst().world(); Npc* player = Gothic::inst().player(); diff --git a/game/marvin.h b/game/marvin.h index bb4feea81..91d75bf4e 100644 --- a/game/marvin.h +++ b/game/marvin.h @@ -26,6 +26,8 @@ class Marvin { // rendering C_ToggleFrame, C_ToggleTime, + // game + C_ToggleDesktop, // npc C_CheatFull, C_CheatGod,