diff --git a/src/DETHRACE/common/world.c b/src/DETHRACE/common/world.c index 3a3a9af3..ac6ab885 100644 --- a/src/DETHRACE/common/world.c +++ b/src/DETHRACE/common/world.c @@ -5519,19 +5519,18 @@ void DeleteSpecVol(void) { int index; index = FindSpecVolIndex(gLast_actor); - if (index < 0) { - return; + if (index >= 0) { + DelSpecVolumeGraph(index); + memmove(&gProgram_state.special_volumes[index], &gProgram_state.special_volumes[index + 1], (gProgram_state.special_volume_count - index - 1) * sizeof(tSpecial_volume)); + memmove(&gSpec_vol_actors[index], &gSpec_vol_actors[index + 1], (gProgram_state.special_volume_count - index - 1) * sizeof(br_actor*)); + gProgram_state.special_volume_count--; + NewTextHeadupSlot(eHeadupSlot_misc, 0, 2000, -2, "There's been a special volumes MURDER!!"); + gLast_actor = NULL; + if (&gProgram_state.special_volumes[index] < gDefault_water_spec_vol) { + gDefault_water_spec_vol--; + } + SaveSpecialVolumes(); } - DelSpecVolumeGraph(index); - memmove(&gProgram_state.special_volumes[index], &gProgram_state.special_volumes[index + 1], (gProgram_state.special_volume_count - index - 1) * sizeof(tSpecial_volume)); - memmove(&gSpec_vol_actors[index], &gSpec_vol_actors[index + 1], (gProgram_state.special_volume_count - index - 1) * sizeof(br_actor*)); - gProgram_state.special_volume_count--; - NewTextHeadupSlot(eHeadupSlot_misc, 0, 2000, -2, "There's been a special volumes MURDER!!"); - gLast_actor = NULL; - if (&gProgram_state.special_volumes[index] < gDefault_water_spec_vol) { - gDefault_water_spec_vol--; - } - SaveSpecialVolumes(); } // IDA: void __cdecl RotateSpecVolL() @@ -5841,12 +5840,11 @@ void ShowSpecialVolumes(void) { gSpec_vol_mode = 1; internal_mat = GetInternalMat(); external_mat = GetExternalMat(); - for (i = 0; i < gProgram_state.special_volume_count; i++) { - v = &gProgram_state.special_volumes[i]; - if (!v->no_mat) { - BuildSpecVolModel(v, i, internal_mat, external_mat); - } else { + for (i = 0, v = gProgram_state.special_volumes; i < gProgram_state.special_volume_count; i++, v++) { + if (v->no_mat) { gSpec_vol_actors[i] = NULL; + } else { + BuildSpecVolModel(v, i, internal_mat, external_mat); } } } diff --git a/src/DETHRACE/dr_types.h b/src/DETHRACE/dr_types.h index 2ac8f2db..9553351b 100644 --- a/src/DETHRACE/dr_types.h +++ b/src/DETHRACE/dr_types.h @@ -454,22 +454,22 @@ typedef struct tCrush_data { tCrush_point_spec* crush_points; } tCrush_data; -typedef struct tSpecial_volume { - br_matrix34 mat; - br_matrix34 inv_mat; - br_bounds bounds; - br_scalar gravity_multiplier; - br_scalar viscosity_multiplier; - float car_damage_per_ms; - float ped_damage_per_ms; - int no_mat; - int camera_special_effect_index; - int sky_col; - int entry_noise; - int exit_noise; - int engine_noise_index; - br_material* screen_material; - int material_modifier_index; +typedef struct tSpecial_volume { // size: 0xa8 + br_matrix34 mat; // @0x0 + br_matrix34 inv_mat; // @0x30 + br_bounds bounds; // @0x60 + br_scalar gravity_multiplier; // @0x78 + br_scalar viscosity_multiplier; // @0x7c + float car_damage_per_ms; // @0x80 + float ped_damage_per_ms; // @0x84 + int no_mat; // @0x88 + int camera_special_effect_index; // @0x8c + int sky_col; // @0x90 + int entry_noise; // @0x94 + int exit_noise; // @0x98 + int engine_noise_index; // @0x9c + br_material* screen_material; // @0xa0 + int material_modifier_index; // @0xa4 } tSpecial_volume; typedef struct tReduced_matrix {