diff --git a/src/DETHRACE/common/piping.c b/src/DETHRACE/common/piping.c index ff5ebee0..9ab2fd0a 100644 --- a/src/DETHRACE/common/piping.c +++ b/src/DETHRACE/common/piping.c @@ -245,6 +245,8 @@ tU32 LengthOfSession(tPipe_session* pSession) { REPLAY_DEBUG_ASSERT(pSession->pipe_magic1 == REPLAY_DEBUG_SESSION_MAGIC1); + running_total = 0; + switch (pSession->chunk_type) { case ePipe_chunk_actor_rstyle: running_total = SIZEOF_CHUNK(actor_rstyle_data) * pSession->number_of_chunks; @@ -287,11 +289,8 @@ tU32 LengthOfSession(tPipe_session* pSession) { running_total = 0; for (i = 0; i < pSession->number_of_chunks; i++) { the_chunk = (tPipe_chunk*)&(((tU8*)&pSession->chunks)[running_total]); - if (the_chunk->chunk_data.pedestrian_data.hit_points <= 0) { - running_total += SIZEOF_CHUNK(pedestrian_data); - } else { - running_total += offsetof(tPipe_pedestrian_data, spin_period) + offsetof(tPipe_chunk, chunk_data); - } + running_total = running_total + (the_chunk->chunk_data.pedestrian_data.hit_points <= 0 ? sizeof(tPipe_pedestrian_data) : offsetof(tPipe_pedestrian_data, spin_period)) + + offsetof(tPipe_chunk, chunk_data); } break; case ePipe_chunk_frame_boundary: @@ -322,11 +321,8 @@ tU32 LengthOfSession(tPipe_session* pSession) { running_total = 0; for (i = 0; i < pSession->number_of_chunks; i++) { the_chunk = (tPipe_chunk*)&((tU8*)&pSession->chunks)[running_total]; - if (the_chunk->subject_index & 0x8000) { - running_total += SIZEOF_CHUNK(shrapnel_data); - } else { - running_total += offsetof(tPipe_shrapnel_data, age) + offsetof(tPipe_chunk, chunk_data); - } + running_total = running_total + ((the_chunk->subject_index & 0x8000) == 0 ? offsetof(tPipe_shrapnel_data, age) : sizeof(tPipe_shrapnel_data)) + + offsetof(tPipe_chunk, chunk_data); } break; case ePipe_chunk_screen_shake: @@ -354,7 +350,8 @@ tU32 LengthOfSession(tPipe_session* pSession) { running_total = 0; for (i = 0; i < pSession->number_of_chunks; i++) { the_chunk = (tPipe_chunk*)&((tU8*)&pSession->chunks)[running_total]; - running_total += the_chunk->chunk_data.smudge_data.vertex_count * sizeof(tSmudged_vertex) + offsetof(tPipe_smudge_data, vertex_changes) + offsetof(tPipe_chunk, chunk_data); + running_total += the_chunk->chunk_data.smudge_data.vertex_count * sizeof(tSmudged_vertex) + offsetof(tPipe_smudge_data, vertex_changes) + + offsetof(tPipe_chunk, chunk_data); } break; case ePipe_chunk_splash: diff --git a/src/DETHRACE/dr_types.h b/src/DETHRACE/dr_types.h index 9a7ad3fb..f2e408ef 100644 --- a/src/DETHRACE/dr_types.h +++ b/src/DETHRACE/dr_types.h @@ -2231,15 +2231,15 @@ typedef struct tPipe_smudge_data { tSmudged_vertex vertex_changes[1]; } tPipe_smudge_data; -typedef struct tPipe_pedestrian_data { - tU8 action_and_frame_index; - tS8 hit_points; - tU16 parent; - br_vector3 new_translation; - float spin_period; - br_actor* parent_actor; - br_vector3 offset; - br_scalar jump_magnitude; +typedef struct tPipe_pedestrian_data { // size: 0x28 + tU8 action_and_frame_index; // @0x0 + tS8 hit_points; // @0x1 + tU16 parent; // @0x2 + br_vector3 new_translation; // @0x4 + float spin_period; // @0x10 + br_actor* parent_actor; // @0x14 + br_vector3 offset; // @0x18 + br_scalar jump_magnitude; // @0x24 } tPipe_pedestrian_data; typedef struct tPipe_frame_boundary_data {