Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 2 additions & 72 deletions code/model/modelinterp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ struct interp_vertex {
static uint Num_interp_verts_allocated = 0;
vec3d **Interp_verts = NULL;
static vertex *Interp_points = NULL;
static vertex *Interp_splode_points = NULL;
vec3d *Interp_splode_verts = NULL;
static uint Interp_num_verts = 0;

static float Interp_box_scale = 1.0f; // this is used to scale both detail boxes and spheres
Expand Down Expand Up @@ -220,16 +218,6 @@ void model_deallocate_interp_data()
Interp_points = nullptr;
}

if (Interp_splode_points != nullptr) {
vm_free(Interp_splode_points);
Interp_splode_points = nullptr;
}

if (Interp_splode_verts != nullptr) {
vm_free(Interp_splode_verts);
Interp_splode_verts = nullptr;
}

if (Interp_norms != nullptr) {
vm_free(Interp_norms);
Interp_norms = nullptr;
Expand Down Expand Up @@ -273,8 +261,6 @@ void model_allocate_interp_data(uint n_verts, uint n_norms)
Interp_verts = (vec3d**) vm_malloc( n_verts * sizeof(vec3d *) );

Interp_points = (vertex*) vm_realloc( Interp_points, n_verts * sizeof(vertex) );
Interp_splode_points = (vertex*) vm_realloc( Interp_splode_points, n_verts * sizeof(vertex) );
Interp_splode_verts = (vec3d*) vm_realloc( Interp_splode_verts, n_verts * sizeof(vec3d) );

Num_interp_verts_allocated = n_verts;

Expand Down Expand Up @@ -315,9 +301,7 @@ void model_allocate_interp_data(uint n_verts, uint n_norms)

// check that everything is still usable (works in release and debug builds)
Verify( Interp_points != NULL );
Verify( Interp_splode_points != NULL );
Verify( Interp_verts != NULL );
Verify( Interp_splode_verts != NULL );
Verify( Interp_norms != NULL );
Verify( Interp_light_applied != NULL );
}
Expand Down Expand Up @@ -392,63 +376,8 @@ void model_set_thrust(int /*model_num*/, mst_info *mst)
Interp_draw_distortion = mst->draw_distortion;
}

bool splodeing = false;
int splodeingtexture = -1;
float splode_level = 0.0f;

float GEOMETRY_NOISE = 0.0f;

// Point list
// +0 int id
// +4 int size
// +8 int n_verts
// +12 int n_norms
// +16 int offset from start of chunk to vertex data
// +20 n_verts*char norm_counts
// +offset vertex data. Each vertex n is a point followed by norm_counts[n] normals.
void model_interp_splode_defpoints(ubyte * p, polymodel * /*pm*/, bsp_info * /*sm*/, float dist)
{
if(dist==0.0f)return;

if(dist<0.0f)dist*=-1.0f;

int n;
int nverts = w(p+8);
int offset = w(p+16);
int nnorms = 0;

ubyte * normcount = p+20;
vertex *dest = Interp_splode_points;
vec3d *src = vp(p+offset);

for (n = 0; n < nverts; n++) {
nnorms += normcount[n];
}

model_allocate_interp_data(nverts, nnorms);

vec3d dir;

for (n=0; n<nverts; n++ ) {
Interp_splode_verts[n] = *src;

src++;

vm_vec_avg_n(&dir, normcount[n], src);
vm_vec_normalize(&dir);

for(int i=0; i<normcount[n]; i++)src++;

vm_vec_scale_add2(&Interp_splode_verts[n], &dir, dist);

g3_rotate_vertex(dest, &Interp_splode_verts[n]);

dest++;

}

}

// Point list
// +0 int id
// +4 int size
Expand All @@ -459,7 +388,8 @@ void model_interp_splode_defpoints(ubyte * p, polymodel * /*pm*/, bsp_info * /*s
// +offset vertex data. Each vertex n is a point followed by norm_counts[n] normals.
void model_interp_defpoints(ubyte * p, polymodel *pm, bsp_info *sm)
{
if(splodeing)model_interp_splode_defpoints(p, pm, sm, splode_level*model_radius);
SCP_UNUSED(pm);
SCP_UNUSED(sm);

uint i, n;
uint nverts = uw(p+8);
Expand Down
30 changes: 2 additions & 28 deletions code/ship/ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ static int Num_ship_subsystems_allocated = 0;
static SCP_vector<ship_subsys*> Ship_subsystems;
ship_subsys ship_subsys_free_list;

extern bool splodeing;
extern float splode_level;
extern int splodeingtexture;

// The minimum required fuel to engage afterburners
static const float DEFAULT_MIN_AFTERBURNER_FUEL_TO_ENGAGE = 10.0f;

Expand Down Expand Up @@ -1279,9 +1275,6 @@ void ship_info::clone(const ship_info& other)

draw_distortion = other.draw_distortion;

splodeing_texture = other.splodeing_texture;
strcpy_s(splodeing_texture_name, other.splodeing_texture_name);

replacement_textures = other.replacement_textures;

armor_type_idx = other.armor_type_idx;
Expand Down Expand Up @@ -1634,9 +1627,6 @@ void ship_info::move(ship_info&& other)

draw_distortion = other.draw_distortion;

splodeing_texture = other.splodeing_texture;
std::swap(splodeing_texture_name, other.splodeing_texture_name);

std::swap(replacement_textures, other.replacement_textures);

armor_type_idx = other.armor_type_idx;
Expand Down Expand Up @@ -2037,9 +2027,6 @@ ship_info::ship_info()

draw_distortion = true;

splodeing_texture = -1;
strcpy_s(splodeing_texture_name, "boom");

replacement_textures.clear();

armor_type_idx = -1;
Expand Down Expand Up @@ -7120,8 +7107,6 @@ void ship::clear()
next_corkscrew_fire = timestamp(0);

final_death_time = timestamp(-1);
death_time = timestamp(-1);
end_death_time = timestamp(-1);
really_final_death_time = timestamp(-1);
deathroll_rotvel = vmd_zero_vector;

Expand Down Expand Up @@ -9717,7 +9702,6 @@ static void ship_dying_frame(object *objp, int ship_num)
}

if ( timestamp_elapsed(shipp->final_death_time)) {
shipp->death_time = shipp->final_death_time;
shipp->final_death_time = timestamp(-1); // never time out again

// play ship explosion sound effect, pick appropriate explosion sound
Expand Down Expand Up @@ -9780,8 +9764,6 @@ static void ship_dying_frame(object *objp, int ship_num)
shipfx_large_blowup_init(shipp);
// need to timeout immediately to keep physics in sync
shipp->really_final_death_time = timestamp(0);
polymodel *pm = model_get(sip->model_num);
shipp->end_death_time = timestamp((int) pm->core_radius);
} else {
// else, just a single big fireball
float big_rad;
Expand Down Expand Up @@ -9816,7 +9798,8 @@ static void ship_dying_frame(object *objp, int ship_num)
// ship, so instead of just taking this code out, since we might need
// it in the future, I disabled it. You can reenable it by changing
// the commenting on the following two lines.
shipp->end_death_time = shipp->really_final_death_time = timestamp( fl2i(explosion_life*1000.0f)/5 ); // Wait till 30% of vclip time before breaking the ship up.
shipp->really_final_death_time = timestamp( fl2i(explosion_life*1000.0f)/5 ); // Wait till 30% of vclip time before breaking the ship up.
//sp->really_final_death_time = timestamp(0); // Make ship break apart the instant the explosion starts
}

shipp->flags.set(Ship_Flags::Exploded);
Expand Down Expand Up @@ -19273,12 +19256,6 @@ void ship_page_in_textures(int ship_index)
if ( !generic_bitmap_load(&sip->thruster_tertiary_glow_info.afterburn) )
bm_page_in_texture(sip->thruster_tertiary_glow_info.afterburn.bitmap_id);

// splodeing bitmap
if ( VALID_FNAME(sip->splodeing_texture_name) ) {
sip->splodeing_texture = bm_load(sip->splodeing_texture_name);
bm_page_in_texture(sip->splodeing_texture);
}

// thruster/particle bitmaps
for (i = 0; i < (int)sip->normal_thruster_particles.size(); i++) {
generic_anim_load(&sip->normal_thruster_particles[i].thruster_bitmap);
Expand Down Expand Up @@ -19330,9 +19307,6 @@ void ship_page_out_textures(int ship_index, bool release)
PAGE_OUT_TEXTURE(sip->thruster_tertiary_glow_info.normal.bitmap_id);
PAGE_OUT_TEXTURE(sip->thruster_tertiary_glow_info.afterburn.bitmap_id);

// slodeing bitmap
PAGE_OUT_TEXTURE(sip->splodeing_texture);

// thruster/particle bitmaps
for (i = 0; i < (int)sip->normal_thruster_particles.size(); i++)
PAGE_OUT_TEXTURE(sip->normal_thruster_particles[i].thruster_bitmap.first_frame);
Expand Down
5 changes: 0 additions & 5 deletions code/ship/ship.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,6 @@ class ship
// END PACK

int final_death_time; // Time until big fireball starts
int death_time; // Time until big fireball starts
int end_death_time; // Time until big fireball starts
int really_final_death_time; // Time until ship breaks up and disappears
vec3d deathroll_rotvel; // Desired death rotational velocity

Expand Down Expand Up @@ -1429,9 +1427,6 @@ class ship_info

bool draw_distortion;

int splodeing_texture;
char splodeing_texture_name[MAX_FILENAME_LEN];

// Goober5000
SCP_vector<texture_replace> replacement_textures;

Expand Down
2 changes: 1 addition & 1 deletion code/ship/shiphit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@ void ship_generic_kill_stuff( object *objp, float percent_killed )
delta_time = 2;
}

sp->death_time = sp->final_death_time = timestamp(delta_time); // Give him 3 secs to explode
sp->final_death_time = timestamp(delta_time); // Give him 3 secs to explode

//SUSHI: What are the chances of an instant explosion? Check the ship type (objecttypes.tbl) as well as the ship (ships.tbl)
float skipChance;
Expand Down
Loading