Avoid redundant vsegptridx calculation in object_move_one

This commit is contained in:
Kp 2015-04-11 04:01:29 +00:00
parent fa82c1bd3b
commit e99a9236cf
3 changed files with 5 additions and 4 deletions

View file

@ -40,7 +40,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
// these global vars are set after a call to do_physics_sim(). Ugly, I know.
// list of segments went through
extern unsigned n_phys_segs;
extern array<int, MAX_FVI_SEGS> phys_seglist;
extern array<segnum_t, MAX_FVI_SEGS> phys_seglist;
// Simulate a physics object for this frame
void do_physics_sim(vobjptridx_t obj);

View file

@ -1711,9 +1711,10 @@ static void object_move_one(const vobjptridx_t obj)
int old_level = Current_level_num;
#endif
for (int i=0;i<n_phys_segs-1;i++) {
auto connect_side = find_connect_side(&Segments[phys_seglist[i+1]], &Segments[phys_seglist[i]]);
const auto seg0 = vsegptridx(phys_seglist[i]);
const auto connect_side = find_connect_side(vcsegptridx(phys_seglist[i+1]), seg0);
if (connect_side != -1)
check_trigger(&Segments[phys_seglist[i]], connect_side, obj,0);
check_trigger(seg0, connect_side, obj,0);
#if defined(DXX_BUILD_DESCENT_II)
//maybe we've gone on to the next level. if so, bail!
if (Current_level_num != old_level)

View file

@ -159,7 +159,7 @@ static void set_object_turnroll(const vobjptr_t obj)
//list of segments went through
unsigned n_phys_segs;
array<int, MAX_FVI_SEGS> phys_seglist;
array<segnum_t, MAX_FVI_SEGS> phys_seglist;
#define MAX_IGNORE_OBJS 100