Open source remastering of the Freespace 2 engine
collideshipship.cpp File Reference
#include "asteroid/asteroid.h"
#include "debris/debris.h"
#include "debugconsole/console.h"
#include "freespace2/freespace.h"
#include "gamesequence/gamesequence.h"
#include "gamesnd/gamesnd.h"
#include "hud/hudmessage.h"
#include "hud/hudshield.h"
#include "io/joy_ff.h"
#include "io/timer.h"
#include "object/objcollide.h"
#include "object/object.h"
#include "object/objectdock.h"
#include "object/objectshield.h"
#include "parse/scripting.h"
#include "playerman/player.h"
#include "render/3d.h"
#include "ship/ship.h"
#include "ship/shiphit.h"

Go to the source code of this file.


#define PLANET_DAMAGE_SCALE   4.0f


void get_I_inv (matrix *I_inv, matrix *I_inv_body, matrix *orient)
void calculate_ship_ship_collision_physics (collision_info_struct *ship_ship_hit_info)
int ship_hit_shield (object *obj, mc_info *mc, collision_info_struct *sshs)
void collect_ship_ship_physics_info (object *heavier_obj, object *lighter_obj, mc_info *mc_info_obj, collision_info_struct *ship_ship_hit_info)
int ships_are_docking (object *objp1, object *objp2)
int bay_emerge_or_depart (object *heavy_objp, object *light_objp)
int ship_ship_check_collision (collision_info_struct *ship_ship_hit_info, vec3d *hitpos)
int check_special_cruiser_asteroid_collision (object *heavy, object *lighter, float *cruiser_mass, int *cruiser_light)
bool check_subsystem_landing_allowed (ship_info *heavy_sip, collision_info_struct *ship_ship_hit_info)
void hud_start_text_flash (char *txt, int t, int interval)
void mcp_1 (object *player_objp, object *planet_objp)
int is_planet (object *objp)
int maybe_collide_planet (object *obj1, object *obj2)
int get_ship_quadrant_from_global (vec3d *global_pos, object *objp)
void collide_ship_ship_sounds_init ()
void collide_ship_ship_do_sound (vec3d *world_hit_pos, object *A, object *B, int player_involved)
void do_kamikaze_crash (object *obj1, object *obj2)
void maybe_push_little_ship_from_fast_big_ship (object *big_obj, object *small_obj, float impulse, vec3d *normal)
int collide_ship_ship (obj_pair *pair)


fix Last_planet_damage_time = 0

Macro Definition Documentation


Definition at line 33 of file collideshipship.cpp.


Definition at line 945 of file collideshipship.cpp.


Definition at line 866 of file collideshipship.cpp.

#define PLANET_DAMAGE_SCALE   4.0f

Definition at line 865 of file collideshipship.cpp.

Function Documentation

int bay_emerge_or_depart ( object heavy_objp,
object light_objp 

If light_obj emerging from or departing to dock bay in heavy_obj, no collision detection.

Definition at line 91 of file collideshipship.cpp.

void calculate_ship_ship_collision_physics ( collision_info_struct ship_ship_hit_info)

Definition at line 535 of file collideshipship.cpp.

int check_special_cruiser_asteroid_collision ( object heavy,
object lighter,
float cruiser_mass,
int cruiser_light 

Gets modified mass of cruiser in cruiser/asteroid collision so cruisers don't get bumped so hard. modified mass is 10x, 4x, or 2x larger than asteroid mass

1 if modified mass is larger than given mass, 0 otherwise

Definition at line 460 of file collideshipship.cpp.

bool check_subsystem_landing_allowed ( ship_info heavy_sip,
collision_info_struct ship_ship_hit_info 

Find the subobject corresponding to the submodel hit

Definition at line 507 of file collideshipship.cpp.

void collect_ship_ship_physics_info ( object heavier_obj,
object lighter_obj,
mc_info mc_info_obj,
collision_info_struct ship_ship_hit_info 

Definition at line 1315 of file collideshipship.cpp.

int collide_ship_ship ( obj_pair pair)

Checks ship-ship collisions.

1 if all future collisions between these can be ignored because pair->a or pair->b aren't ships
Otherwise always returns 0, since two ships can always collide unless one (1) dies or (2) warps out.

Definition at line 1064 of file collideshipship.cpp.

void collide_ship_ship_do_sound ( vec3d world_hit_pos,
object A,
object B,
int  player_involved 

Determine what sound to play when two ships collide

Definition at line 958 of file collideshipship.cpp.

void collide_ship_ship_sounds_init ( )

Definition at line 947 of file collideshipship.cpp.

void do_kamikaze_crash ( object obj1,
object obj2 

obj1 and obj2 collided. If different teams, kamikaze bit set and other ship is large, auto-explode!

Definition at line 998 of file collideshipship.cpp.

void get_I_inv ( matrix I_inv,
matrix I_inv_body,
matrix orient 

Definition at line 853 of file collideshipship.cpp.

int get_ship_quadrant_from_global ( vec3d global_pos,
object objp 

Given a global point and an object, get the quadrant number the point belongs to.

Definition at line 935 of file collideshipship.cpp.

void hud_start_text_flash ( char *  txt,
int  t,
int  interval 
int is_planet ( object objp)

Return true if *objp is a planet, else return false. Hack: Just checking first six letters of name.

Definition at line 900 of file collideshipship.cpp.

int maybe_collide_planet ( object obj1,
object obj2 

If exactly one of these is a planet and the other is a player ship, do something special.

true if this was a ship:planet (or planet_ship) collision and we processed it. Else return false.

Definition at line 910 of file collideshipship.cpp.

void maybe_push_little_ship_from_fast_big_ship ( object big_obj,
object small_obj,
float  impulse,
vec3d normal 

Response when hit by fast moving cap ship

Definition at line 1027 of file collideshipship.cpp.

void mcp_1 ( object player_objp,
object planet_objp 

Procss player_ship:planet damage. If within range of planet, apply damage to ship.

Definition at line 875 of file collideshipship.cpp.

int ship_hit_shield ( object obj,
mc_info mc,
collision_info_struct sshs 
int ship_ship_check_collision ( collision_info_struct ship_ship_hit_info,
vec3d hitpos 

Definition at line 111 of file collideshipship.cpp.

int ships_are_docking ( object objp1,
object objp2 

Return true if two ships are docking.

Definition at line 57 of file collideshipship.cpp.

Variable Documentation

fix Last_planet_damage_time = 0

Definition at line 868 of file collideshipship.cpp.