Skip to content

Commit

Permalink
add "butt bubbles" feature
Browse files Browse the repository at this point in the history
EE-475
  • Loading branch information
stohrendorf committed May 20, 2022
1 parent afef8c6 commit 7bef066
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 13 deletions.
15 changes: 10 additions & 5 deletions share/edisonengine.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: EdisonEngine 1.3\n"
"Report-Msgid-Bugs-To: https://github.com/stohrendorf/EdisonEngine/issues\n"
"POT-Creation-Date: 2022-05-16 03:47+0200\n"
"POT-Creation-Date: 2022-05-20 22:20+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -18,7 +18,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"

#. translators: TR charmap encoding
#: util/helpers.cpp:192
#: util/helpers.cpp:193
#, c-format, boost-format
msgid "%1$02d:%2$02d"
msgstr ""
Expand All @@ -43,13 +43,13 @@ msgid "%1% Misses"
msgstr ""

#. translators: TR charmap encoding
#: util/helpers.cpp:183
#: util/helpers.cpp:184
#, boost-format
msgid "%1%:%2$02d:%3$02d"
msgstr ""

#. translators: TR charmap encoding
#: menu/rendersettingsmenustate.cpp:358
#: menu/rendersettingsmenustate.cpp:369
#, boost-format
msgid "%1%x Anisotropic Filtering"
msgstr ""
Expand Down Expand Up @@ -192,6 +192,11 @@ msgstr ""
msgid "Building textures"
msgstr ""

#. translators: TR charmap encoding
#: menu/rendersettingsmenustate.cpp:351
msgid "Butt Bubbles"
msgstr ""

#. translators: TR charmap encoding
#: hid/names.cpp:59
msgctxt "Keyboard|Key"
Expand Down Expand Up @@ -627,7 +632,7 @@ msgstr ""
msgid "Loading %1%"
msgstr ""

#: engine/engine.cpp:604
#: engine/engine.cpp:594
msgid "Loading Glidos texture pack"
msgstr ""

Expand Down
15 changes: 10 additions & 5 deletions share/po/de_DE/edisonengine.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: EdisonEngine\n"
"Report-Msgid-Bugs-To: https://github.com/stohrendorf/EdisonEngine/issues\n"
"POT-Creation-Date: 2022-05-16 03:47+0200\n"
"POT-Creation-Date: 2022-05-20 22:20+0200\n"
"Last-Translator: Steffen Ohrendorf\n"
"Language-Team: none\n"
"Language: de_DE\n"
Expand All @@ -17,7 +17,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. translators: TR charmap encoding
#: util/helpers.cpp:192
#: util/helpers.cpp:193
#, c-format, boost-format
msgid "%1$02d:%2$02d"
msgstr "%1$02d:%2$02d"
Expand All @@ -42,13 +42,13 @@ msgid "%1% Misses"
msgstr "%1% Fehlsch~usse"

#. translators: TR charmap encoding
#: util/helpers.cpp:183
#: util/helpers.cpp:184
#, boost-format
msgid "%1%:%2$02d:%3$02d"
msgstr "%1%:%2$02d:%3$02d"

#. translators: TR charmap encoding
#: menu/rendersettingsmenustate.cpp:358
#: menu/rendersettingsmenustate.cpp:369
#, boost-format
msgid "%1%x Anisotropic Filtering"
msgstr "%1%x Anisotropische Filterung"
Expand Down Expand Up @@ -191,6 +191,11 @@ msgstr "Starte"
msgid "Building textures"
msgstr "Erstelle Texturen"

#. translators: TR charmap encoding
#: menu/rendersettingsmenustate.cpp:351
msgid "Butt Bubbles"
msgstr "Po-Blasen"

#. translators: TR charmap encoding
#: hid/names.cpp:59
msgctxt "Keyboard|Key"
Expand Down Expand Up @@ -629,7 +634,7 @@ msgstr "Spiel laden"
msgid "Loading %1%"
msgstr "Lade %1%"

#: engine/engine.cpp:604
#: engine/engine.cpp:594
msgid "Loading Glidos texture pack"
msgstr "Lade Glidos Textur Paket"

Expand Down
3 changes: 2 additions & 1 deletion src/engine/engineconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ void EngineConfig::serialize(const serialization::Serializer<EngineConfig>& ser)
S_NVD("inputMappings", inputMappings, getDefaultMappings()),
S_NVO("restoreHealth", restoreHealth),
S_NVO("pulseLowHealthHealthBar", pulseLowHealthHealthBar),
S_NVO("lowHealthMonochrome", lowHealthMonochrome));
S_NVO("lowHealthMonochrome", lowHealthMonochrome),
S_NVO("buttBubbles", buttBubbles));
}

EngineConfig::EngineConfig()
Expand Down
1 change: 1 addition & 0 deletions src/engine/engineconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct EngineConfig
bool restoreHealth = false;
bool pulseLowHealthHealthBar = true;
bool lowHealthMonochrome = true;
bool buttBubbles = false;

explicit EngineConfig();

Expand Down
15 changes: 15 additions & 0 deletions src/engine/objects/laraobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "core/interval.h"
#include "engine/audioengine.h"
#include "engine/cameracontroller.h"
#include "engine/engine.h"
#include "engine/ghosting/ghost.h"
#include "engine/heightinfo.h"
#include "engine/inventory.h"
Expand Down Expand Up @@ -458,6 +459,20 @@ void LaraObject::update()
}
handleLaraStateSwimming();
}

if(getWorld().getEngine().getEngineConfig()->buttBubbles)
{
const auto boneSpheres = getSkeleton()->getBoneCollisionSpheres();
const auto position
= core::TRVec{boneSpheres.at(BoneHips).relative(core::TRVec{0_len, 20_len, -50_len}.toRenderSystem())};
auto bubbleCount = util::rand15(2);
while(bubbleCount-- > 0)
{
auto particle = gsl::make_shared<BubbleParticle>(Location{m_state.location.room, position}, getWorld(), false);
setParent(particle, m_state.location.room->node);
getWorld().getObjectManager().registerParticle(particle);
}
}
}

void LaraObject::updateImpl()
Expand Down
2 changes: 1 addition & 1 deletion src/engine/particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ bool BubbleParticle::update(world::World& world)
angle.Y += 9_deg;
location.position += util::pitch(11_len, angle.Y, -speed * 1_frame);
auto sector = location.updateRoom();
if(!location.room->isWaterRoom)
if(m_onlyInWater && !location.room->isWaterRoom)
{
return false;
}
Expand Down
6 changes: 5 additions & 1 deletion src/engine/particle.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ class RicochetParticle final : public Particle
class BubbleParticle final : public Particle
{
public:
explicit BubbleParticle(const Location& location, world::World& world)
explicit BubbleParticle(const Location& location, world::World& world, bool onlyInWater = true)
: Particle{"bubble", TR1ItemId::Bubbles, location, world, true, nullptr}
, m_onlyInWater{onlyInWater}
{
speed = 10_spd + util::rand15(6_spd);

Expand All @@ -159,6 +160,9 @@ class BubbleParticle final : public Particle
}

bool update(world::World& world) override;

private:
const bool m_onlyInWater;
};

class SparkleParticle final : public Particle
Expand Down
11 changes: 11 additions & 0 deletions src/menu/rendersettingsmenustate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,17 @@ RenderSettingsMenuState::RenderSettingsMenuState(const std::shared_ptr<MenuRingT
auto& b = engine.getEngineConfig()->lowHealthMonochrome;
b = !b;
});
listBox->addSetting(
/* translators: TR charmap encoding */ _("Butt Bubbles"),
[&engine]()
{
return engine.getEngineConfig()->buttBubbles;
},
[&engine]()
{
auto& b = engine.getEngineConfig()->buttBubbles;
b = !b;
});
}

std::unique_ptr<MenuState>
Expand Down
1 change: 1 addition & 0 deletions src/util/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ int16_t rand15()
// NOLINTNEXTLINE(cert-msc50-cpp, concurrency-mt-unsafe)
return gsl::narrow_cast<int16_t>(std::rand() % Rand15Max);
}

std::string toTimeStr(const core::Seconds& t)
{
static constexpr std::chrono::seconds Minute = std::chrono::seconds{60};
Expand Down

0 comments on commit 7bef066

Please sign in to comment.