From 06e86735fcb176654253c1a321e629b55ed63026 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 30 Aug 2022 21:36:30 +0200 Subject: [PATCH] - use temp_pos instead of maintaining yet another variable for FIREBALL --- source/games/duke/src/actors_d.cpp | 5 +++-- source/games/duke/src/savegame.cpp | 4 +--- source/games/duke/src/types.h | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index a2bc79517..5c802da29 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1321,7 +1321,7 @@ static bool movefireball(DDukeActor* actor) if (trail) { FireProj* proj = &trail->fproj; - ball->set_int_pos(proj->pos); + ball->spr.pos = trail->temp_pos; ball->spr.xvel = proj->vel.X; ball->spr.yvel = proj->vel.Y; ball->spr.zvel = proj->vel.Z; @@ -1331,7 +1331,8 @@ static bool movefireball(DDukeActor* actor) ball->spr.cstat = actor->spr.cstat; ball->spr.extra = 0; - ball->fproj = { ball->int_pos(), { ball->spr.xvel, ball->spr.yvel, ball->spr.zvel } }; + ball->temp_pos = ball->spr.pos; + ball->fproj.vel = { ball->spr.xvel, ball->spr.yvel, ball->spr.zvel }; ChangeActorStat(ball, STAT_PROJECTILE); } diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index ab6ab82da..b0f9bcf7a 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -51,9 +51,7 @@ static FSerializer& Serialize(FSerializer& arc, const char* key, FireProj& p, Fi { if (arc.BeginObject(key)) { - arc("x", p.pos.X) - ("y", p.pos.Y) - ("z", p.pos.Z) + arc ("xv", p.vel.X) ("yv", p.vel.Y) ("zv", p.vel.Z) diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index c11e5ff4f..6c69b67f9 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -23,7 +23,7 @@ struct STATUSBARTYPE struct FireProj { - vec3_t pos, vel; + vec3_t vel; }; // Todo - put more state in here @@ -63,7 +63,7 @@ public: walltype* temp_walls[2]; // SE20 + SE128 sectortype* temp_sect, *actorstayput; DAngle temp_angle; // only used by TRIPBOMB - DVector3 temp_pos; // used by TRIPBOMB and SE_26. + DVector3 temp_pos; // used by TRIPBOMB, SE_26 and FIREBALL. TObjPtr temp_actor, seek_actor;