Figured out the crash, but want to see what valgrind would say.

This commit is contained in:
Zed A. Shaw 2026-02-12 12:59:35 -05:00
parent aaf5aa4165
commit 0e8b661273
7 changed files with 30 additions and 15 deletions

View file

@ -78,7 +78,7 @@ story:
gdb --nx -x .gdbinit --batch --ex run --ex bt --ex q --args ./builddir/storyboard
debug_animator:
gdb --nx -x .gdbinit --batch --ex run --ex bt --ex q --args ./builddir/animator.exe -s "rat_king_boss" -a "rat_king_boss" -b "test_background"
gdb --nx -x .gdbinit --batch --ex run --ex bt --ex q --args ./builddir/animator -s "rat_king_boss" -a "rat_king_boss" -b "test_background"
animator:
./builddir/animator.exe -s "rat_king_boss" -a "rat_king_boss" -b "test_background"

View file

@ -86,7 +86,11 @@ namespace animate2 {
} else {
sequence.timer.restart();
sequence.current++;
if(sequence.subframe > SUB_FRAME_SENSITIVITY) sequence.subframe = 0.0f;
if(sequence.subframe > SUB_FRAME_SENSITIVITY) {
sequence.subframe = 0.0f;
}
frame_change = true;
}

View file

@ -41,8 +41,6 @@ namespace boss {
using enum game::Event;
switch(ev) {
// this is only if using the debug X key to skip it
case TICK:
case BOSS_START:
$ui.status(L"PLAYER REQUESTS", L"COMMIT");
$battle.ap_refresh();
@ -177,7 +175,6 @@ namespace boss {
$ui.animate_actor("player");
break;
}
}
void Fight::run_systems() {

View file

@ -127,7 +127,9 @@ namespace scene {
void Engine::play_animations() {
for(auto& fixture : $fixtures) {
if(fixture.anim.playing) {
fixture.anim.update();
fixture.anim.apply(*fixture.st.sprite);
// REFACTOR: fixture.anim.apply(*fixture.st.sprite);
} else {
fixture.effect = nullptr;
}
@ -135,9 +137,10 @@ namespace scene {
for(auto& actor : $actors) {
if(actor.anim.playing) {
actor.anim.update();
actor.anim.apply(*actor.st.sprite);
// REFACTOR: actor.anim.apply(actor.text, actor.pos);
if(actor.effect != nullptr) actor.anim.apply_effect(actor.effect);
// if(actor.effect != nullptr) actor.anim.apply_effect(actor.effect);
} else {
actor.effect = nullptr;
}
@ -173,13 +176,22 @@ namespace scene {
}
void Engine::set_end_cb(std::function<void()> cb) {
// REFACTOR:
// for(auto& actor : $actors) {
// actor.anim.end_cb = cb;
// }
for(auto& actor : $actors) {
actor.anim.onLoop = [&](auto& seq, auto& tr) -> bool {
seq.current = tr.toggled ? seq.frame_count - 1 : 0;
cb();
return tr.looped;
};
}
}
void Engine::reset(sf::RenderTexture& view) {
$camera.reset(view);
}
void Engine::tick() {
for(auto& actor : $actors) {
auto [ticks, alpha] = actor.anim.commit();
}
}
}

View file

@ -58,5 +58,6 @@ namespace scene {
void zoom(float mid_x, float mid_y, const std::string& style, float scale);
void reset(sf::RenderTexture& view);
void set_end_cb(std::function<void()> cb);
void tick();
};
}

View file

@ -312,12 +312,12 @@ int error_usage() {
}
int main(int argc, char* argv[]) {
shaders::init();
ai::init("ai");
animation::init();
components::init();
sfml::Backend backend;
guecs::init(&backend);
ai::init("ai");
animation::init();
shaders::init();
std::string sprite_name;
std::string background;

View file

@ -50,13 +50,14 @@ int main(int, char*[]) {
dbc::check(main->$world == world, "GameDB::current_world doesn't match boss fight world.");
while(!main->in_state(boss::State::END)) {
main->$ui.$arena.tick();
main->render(window);
if(main->handle_keyboard_mouse() ||
main->handle_world_events())
{
return 0;
}
main->render(window);
window.display();
}