summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bench/critter.cpp2
-rw-r--r--serialize/old-savegame.cpp2
-rw-r--r--serialize/savegame.cpp3
-rw-r--r--src/chunk-scenery.cpp2
-rw-r--r--src/critter-script.hpp3
-rw-r--r--src/critter.cpp22
-rw-r--r--src/critter.hpp2
-rw-r--r--src/rotation.hpp2
-rw-r--r--src/scenery-proto.hpp2
-rw-r--r--src/world.hpp2
-rw-r--r--test/critter.cpp2
-rw-r--r--test/save.cpp6
12 files changed, 23 insertions, 27 deletions
diff --git a/bench/critter.cpp b/bench/critter.cpp
index dc60a71a..9dd69f3a 100644
--- a/bench/critter.cpp
+++ b/bench/critter.cpp
@@ -131,7 +131,7 @@ bool run(world& w, const function_view<Ns() const>& make_dt,
<< " dt:" << dt
<< " dist:" << point::distance_l2(pos, start)
<< " delta:" << npc.delta
- << " frac:" << npc.offset_frac_;
+ << " frac:" << npc.offset_frac;
};
auto fail = [b = grace.no_crash](const char* file, int line) {
diff --git a/serialize/old-savegame.cpp b/serialize/old-savegame.cpp
index 247462b6..073756d2 100644
--- a/serialize/old-savegame.cpp
+++ b/serialize/old-savegame.cpp
@@ -438,7 +438,7 @@ void reader_state::read_chunks(reader_t& s)
}
SET_CHUNK_SIZE();
auto e = _world->make_object<critter, false>(oid, {ch, local}, proto);
- e->offset_frac_ = (uint16_t)((Vector2(offset_frac)*(1.f/65355)).length()*32768);
+ e->offset_frac = (uint16_t)((Vector2(offset_frac)*(1.f/65355)).length()*32768);
(void)e;
break;
}
diff --git a/serialize/savegame.cpp b/serialize/savegame.cpp
index 40e6cba4..0c664eed 100644
--- a/serialize/savegame.cpp
+++ b/serialize/savegame.cpp
@@ -267,7 +267,6 @@ struct visitor_
template<typename F> void visit_scenery_proto(o_sc_g& s, F&& f)
{
using T = std::conditional_t<IsWriter, generic_scenery, generic_scenery_proto>;
- // todo! make bitmask reader/writer
constexpr struct {
uint8_t bits;
bool(*getter)(const T&);
@@ -410,7 +409,7 @@ struct writer final : visitor_<writer, true>
template<typename F> void visit(qual<std::shared_ptr<anim_atlas>>& a, atlas_type type, F&& f)
{ atlasid id = intern_atlas(a, type); visit(id, f); }
- template<typename F> void write_scenery_proto(const scenery& obj, F&& f) // todo! replace scenery::subtype with inheritance!
+ template<typename F> void write_scenery_proto(const scenery& obj, F&& f)
{
auto sc_type = obj.scenery_type();
fm_debug_assert(sc_type != scenery_type::none && sc_type < scenery_type::COUNT);
diff --git a/src/chunk-scenery.cpp b/src/chunk-scenery.cpp
index 016c7269..2e491d4d 100644
--- a/src/chunk-scenery.cpp
+++ b/src/chunk-scenery.cpp
@@ -194,7 +194,7 @@ auto chunk::ensure_scenery_mesh(scenery_scratch_buffers buffers) noexcept -> sce
auto index = e->is_dynamic() ? (uint32_t)-1 : j++;
array[i++] = { e.get(), (uint32_t)-1, e->ordinal(), make_topo_sort_data(*e, index) };
}
- topological_sort(array, i); // todo! do this before upload so that multi-draw works
+ topological_sort(array, i);
return { scenery_mesh, ArrayView<object_draw_order>{array, size}, j };
}
diff --git a/src/critter-script.hpp b/src/critter-script.hpp
index c26d57e0..2b81a939 100644
--- a/src/critter-script.hpp
+++ b/src/critter-script.hpp
@@ -17,13 +17,10 @@ struct critter_script : base_script
~critter_script() noexcept override;
virtual void on_init(const std::shared_ptr<critter>& c) = 0;
- // todo can_activate, activate
virtual void on_update(const std::shared_ptr<critter>& c, size_t& i, const Ns& dt) = 0;
virtual void on_destroy(const std::shared_ptr<critter>& c, script_destroy_reason reason) = 0;
virtual void delete_self() = 0;
- // todo! move to src/scripts dir
-
object_type type() const override;
static Pointer<critter_script> make_walk_script(point to);
diff --git a/src/critter.cpp b/src/critter.cpp
index 505bbe16..4c04022c 100644
--- a/src/critter.cpp
+++ b/src/critter.cpp
@@ -117,10 +117,10 @@ CORRADE_ALWAYS_INLINE
bool update_movement_body(size_t& i, critter& C, const anim_def& info, uint8_t nsteps)
{
constexpr auto vec = rotation_to_vec(new_r);
- using Frac = decltype(critter::offset_frac_);
+ using Frac = decltype(critter::offset_frac);
constexpr auto frac = (float{limits<Frac>::max}+1)/2;
constexpr auto inv_frac = 1 / frac;
- const auto from_accum = C.offset_frac_ * inv_frac * vec;
+ const auto from_accum = C.offset_frac * inv_frac * vec;
Vector2 offset_{NoInit};
if constexpr(MultiStep)
@@ -132,7 +132,7 @@ bool update_movement_body(size_t& i, critter& C, const anim_def& info, uint8_t n
if (!off_i.isZero())
{
auto rem = Math::fmod(offset_, 1.f).length();
- C.offset_frac_ = Frac(rem * frac);
+ C.offset_frac = Frac(rem * frac);
if (C.can_move_to(off_i))
{
C.move_to(i, off_i, new_r);
@@ -146,7 +146,7 @@ bool update_movement_body(size_t& i, critter& C, const anim_def& info, uint8_t n
else
{
auto rem = offset_.length();
- C.offset_frac_ = Frac(rem * frac);
+ C.offset_frac = Frac(rem * frac);
return true;
}
return false;
@@ -387,7 +387,7 @@ void critter::update(const std::shared_ptr<object>& ptrʹ, size_t& i, const Ns&
const auto new_r = arrows_to_dir(moves.L, moves.R, moves.U, moves.D);
if (new_r == rotation_COUNT)
{
- offset_frac_ = {};
+ offset_frac = {};
delta = 0;
}
else
@@ -428,7 +428,7 @@ void critter::update_movement(size_t& i, const Ns& dt, rotation new_r)
if (!ret) [[unlikely]]
{
delta = {};
- offset_frac_ = {};
+ offset_frac = {};
}
}
@@ -466,12 +466,12 @@ auto critter::move_toward(size_t& index, Ns& dt, const point& dest) -> move_resu
//Debug{} << "step" << step.direction << step.count << "|" << C.position();
fm_assert(step.direction != Vector2b{} && step.count > 0);
const auto new_r = dir_from_step(step);
- using Frac = decltype(critter::offset_frac_);
+ using Frac = decltype(critter::offset_frac);
constexpr auto frac = (float{limits<Frac>::max}+1)/2;
constexpr auto inv_frac = 1 / frac;
const auto mag = step_magnitude(step.direction);
const auto vec = Vector2(step.direction) * mag;
- const auto from_accum = offset_frac_ * inv_frac * vec;
+ const auto from_accum = offset_frac * inv_frac * vec;
auto offset_ = vec + from_accum;
auto off_i = Vector2i(offset_);
//Debug{} << "vec" << vec << "mag" << mag << "off_i" << off_i << "offset_" << C.offset_frac_;
@@ -479,7 +479,7 @@ auto critter::move_toward(size_t& index, Ns& dt, const point& dest) -> move_resu
if (!off_i.isZero())
{
auto rem = Math::fmod(offset_, 1.f).length();
- offset_frac_ = Frac(rem * frac);
+ offset_frac = Frac(rem * frac);
//Debug{} << "foo1" << C.offset_frac_;
if (can_move_to(off_i))
{
@@ -497,7 +497,7 @@ auto critter::move_toward(size_t& index, Ns& dt, const point& dest) -> move_resu
else
{
auto rem = offset_.length();
- offset_frac_ = Frac(rem * frac);
+ offset_frac = Frac(rem * frac);
}
}
@@ -508,7 +508,7 @@ auto critter::move_toward(size_t& index, Ns& dt, const point& dest) -> move_resu
//Debug{} << "bad";
set_keys(false, false, false, false);
delta = {};
- offset_frac_ = {};
+ offset_frac = {};
return { .blocked = true, .moved = moved };
}
diff --git a/src/critter.hpp b/src/critter.hpp
index c569bd33..38b5addf 100644
--- a/src/critter.hpp
+++ b/src/critter.hpp
@@ -53,7 +53,7 @@ struct critter final : object
Script<critter_script, critter> script;
String name;
float speed = 1;
- uint16_t offset_frac_ = 0; // todo! remove underscore
+ uint16_t offset_frac = 0;
bool playable : 1 = false;
diff --git a/src/rotation.hpp b/src/rotation.hpp
index 99f8c4a3..471007c3 100644
--- a/src/rotation.hpp
+++ b/src/rotation.hpp
@@ -8,6 +8,6 @@ enum class rotation : unsigned char {
constexpr inline size_t rotation_BITS = 3;
constexpr inline size_t rotation_MASK = (1 << rotation_BITS)-1;
-constexpr inline rotation rotation_COUNT = rotation{1 << rotation_BITS}; // todo! remove
+constexpr inline rotation rotation_COUNT = rotation{1 << rotation_BITS};
} // namespace floormat
diff --git a/src/scenery-proto.hpp b/src/scenery-proto.hpp
index 44c8fe6f..113660aa 100644
--- a/src/scenery-proto.hpp
+++ b/src/scenery-proto.hpp
@@ -28,7 +28,7 @@ using scenery_proto_variants = std::variant<std::monostate, generic_scenery_prot
struct scenery_proto : object_proto
{
- scenery_proto_variants subtype; // todo! add std::monostate
+ scenery_proto_variants subtype;
scenery_proto() noexcept;
~scenery_proto() noexcept override;
diff --git a/src/world.hpp b/src/world.hpp
index fe434e17..c8084614 100644
--- a/src/world.hpp
+++ b/src/world.hpp
@@ -49,7 +49,7 @@ private:
explicit world(size_t capacity);
- void do_make_object(const std::shared_ptr<object>& e, global_coords pos, bool sorted); // todo! replace 2nd arg with chunk&
+ void do_make_object(const std::shared_ptr<object>& e, global_coords pos, bool sorted); // todo replace 2nd arg with chunk&
void do_kill_object(object_id id);
std::shared_ptr<object> find_object_(object_id id);
diff --git a/test/critter.cpp b/test/critter.cpp
index d9fa486d..071fae9b 100644
--- a/test/critter.cpp
+++ b/test/critter.cpp
@@ -140,7 +140,7 @@ bool run(world& w, const function_view<Ns() const>& make_dt,
<< " dt:" << dt
<< " dist:" << point::distance_l2(pos, start)
<< " delta:" << npc.delta
- << " frac:" << npc.offset_frac_;
+ << " frac:" << npc.offset_frac;
};
auto fail = [b = grace.no_crash](const char* file, int line) {
diff --git a/test/save.cpp b/test/save.cpp
index cf4ccd44..f596cf00 100644
--- a/test/save.cpp
+++ b/test/save.cpp
@@ -35,7 +35,7 @@ chunk& Test::make_test_chunk(world& w, chunk_coords_ ch)
c[{K, K+1}].wall_north() = { metal2, 0 };
c[{K+1, K }].wall_west() = { metal2, 0 };
w.make_scenery(w.make_id(), {ch, {3, 4}}, scenery_proto(table));
- w.make_scenery(w.make_id(), {ch, {K, K+1}}, scenery_proto(control_panel)); // todo!
+ w.make_scenery(w.make_id(), {ch, {K, K+1}}, scenery_proto(control_panel));
auto L = light_proto{};
L.color = {64, 128, 252, 201};
L.max_distance = float{0.125};
@@ -229,7 +229,7 @@ void test_save_objs()
const auto objʹ = w.make_object<critter>(w.make_id(), coord, p);
fm_assert(objʹ);
const auto& obj = *objʹ;
- const_cast<uint16_t&>(obj.offset_frac_) = offset_frac;
+ const_cast<uint16_t&>(obj.offset_frac) = offset_frac;
auto w2 = reload_from_save(tmp, w);
const auto& obj2ʹ = w.find_object<critter>(obj.id);
fm_assert(obj2ʹ);
@@ -237,7 +237,7 @@ void test_save_objs()
fm_assert(p.name == obj2.name);
fm_assert(p.frame == obj2.frame);
fm_assert(p.speed == obj2.speed);
- fm_assert(obj.offset_frac_ == obj2.offset_frac_);
+ fm_assert(obj.offset_frac == obj2.offset_frac);
assert_chunks_equal(w.at(ch), w2.at(ch));
}