diff options
-rw-r--r-- | compat/assert.hpp | 12 | ||||
-rw-r--r-- | src/object.cpp | 9 |
2 files changed, 13 insertions, 8 deletions
diff --git a/compat/assert.hpp b/compat/assert.hpp index 2163c736..b7fb2fe9 100644 --- a/compat/assert.hpp +++ b/compat/assert.hpp @@ -92,11 +92,13 @@ { \ if (a != b) [[unlikely]] \ { \ - DBG_nospace << "assertion failed: fm_assert_equal(" \ - << #__VA_ARGS__ << ")"; \ - DBG_nospace << "in" << __FILE__ << ":" << __LINE__; \ - DBG_nospace << " expected: " << a; \ - DBG_nospace << " actual: " << b; \ + DBG_nospace << __FILE__ << ":" << __LINE__ << ": " \ + << Debug::color(Debug::Color::Red) \ + << "fatal:" \ + << Debug::resetColor \ + << " assertion failed: " << #__VA_ARGS__; \ + DBG_nospace << " expected: " << b; \ + DBG_nospace << " actual: " << a; \ fm_EMIT_ABORT(); \ } \ })(__VA_ARGS__) diff --git a/src/object.cpp b/src/object.cpp index 848fad64..1ad8c6b0 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -115,8 +115,8 @@ void object::rotate(size_t, rotation new_r) point object::normalize_coords(global_coords coord, Vector2b cur_offset, Vector2i new_offset) { auto off_tmp = Vector2i(cur_offset) + new_offset; - auto off_new = off_tmp % iTILE_SIZE2; - auto tiles = off_tmp / iTILE_SIZE2; + int off_new[2] = { off_tmp.x() % iTILE_SIZE2.x(), off_tmp.y() % iTILE_SIZE2.y() }; + int tiles[2] = { off_tmp.x() / iTILE_SIZE2.x(), off_tmp.y() / iTILE_SIZE2.y() }; constexpr auto half_tile = iTILE_SIZE2/2; for (auto i = 0uz; i < 2; i++) { @@ -130,7 +130,10 @@ point object::normalize_coords(global_coords coord, Vector2b cur_offset, Vector2 off_new[i] = (iTILE_SIZE[i] - absval)*-sign; } } - return { coord + tiles, Vector2b(off_new) }; + return { + coord + Vector2i(tiles[0], tiles[1]), + { (int8_t)off_new[0], (int8_t)off_new[1] }, + }; } point object::normalize_coords(const point& pt, Vector2i delta) |