FS2_Open
Open source remastering of the Freespace 2 engine
object.cpp File Reference
#include "asteroid/asteroid.h"
#include "cmeasure/cmeasure.h"
#include "debris/debris.h"
#include "debugconsole/console.h"
#include "fireball/fireballs.h"
#include "freespace2/freespace.h"
#include "globalincs/linklist.h"
#include "iff_defs/iff_defs.h"
#include "io/timer.h"
#include "jumpnode/jumpnode.h"
#include "lighting/lighting.h"
#include "mission/missionparse.h"
#include "network/multi.h"
#include "network/multiutil.h"
#include "object/deadobjectdock.h"
#include "object/objcollide.h"
#include "object/object.h"
#include "object/objectdock.h"
#include "object/objectshield.h"
#include "object/objectsnd.h"
#include "observer/observer.h"
#include "parse/scripting.h"
#include "playerman/player.h"
#include "radar/radar.h"
#include "radar/radarsetup.h"
#include "render/3d.h"
#include "ship/afterburner.h"
#include "ship/ship.h"
#include "weapon/beam.h"
#include "weapon/shockwave.h"
#include "weapon/swarm.h"
#include "weapon/weapon.h"

Go to the source code of this file.

Macros

#define IMPORTANT_FLAGS   (OF_COLLIDES)
 

Functions

int free_object_slots (int num_used)
 
float get_max_shield_quad (object *objp)
 
float get_hull_pct (object *objp)
 
float get_sim_hull_pct (object *objp)
 
float get_shield_pct (object *objp)
 
void obj_init ()
 
int obj_allocate (void)
 
void obj_free (int objnum)
 
int obj_create (ubyte type, int parent_obj, int instance, matrix *orient, vec3d *pos, float radius, uint flags)
 
void obj_delete (int objnum)
 
void obj_delete_all_that_should_be_dead ()
 
void obj_merge_created_list (void)
 
void call_doa (object *child, object *parent)
 
void obj_move_one_docked_object (object *objp, object *parent_objp)
 
void obj_player_fire_stuff (object *objp, control_info ci)
 
void obj_move_call_physics (object *objp, float frametime)
 
void obj_set_flags (object *obj, uint new_flags)
 
void obj_move_all_pre (object *objp, float frametime)
 
void obj_clear_weapon_group_id_list ()
 
void obj_move_all_post (object *objp, float frametime)
 
void obj_move_all (float frametime)
 
void obj_render_DEPRECATED (object *obj)
 
void obj_render (object *obj)
 
void obj_queue_render (object *obj, draw_list *scene)
 
void obj_init_all_ships_physics ()
 
void obj_client_pre_interpolate ()
 
void obj_client_post_interpolate ()
 
void obj_observer_move (float frame_time)
 
void obj_get_average_ship_pos (vec3d *pos)
 
int obj_get_SIF (object *objp)
 
int obj_get_SIF (int obj)
 
int obj_team (object *objp)
 
void obj_add_pairs (int objnum)
 
void obj_remove_pairs (object *a)
 
void obj_reset_all_collisions ()
 
int object_is_docked (object *objp)
 
int object_is_dead_docked (object *objp)
 
void object_set_gliding (object *objp, bool enable, bool force)
 
bool object_get_gliding (object *objp)
 
bool object_glide_forced (object *objp)
 
int obj_get_by_signature (int sig)
 
int object_get_model (object *objp)
 

Variables

object obj_free_list
 
object obj_used_list
 
object obj_create_list
 
objectPlayer_obj = NULL
 
objectViewer_obj = NULL
 
int Cmdline_old_collision_sys
 
object Objects [MAX_OBJECTS]
 
int Num_objects =-1
 
int Highest_object_index =-1
 
int Highest_ever_object_index =0
 
int Object_next_signature = 1
 
int Object_inited = 0
 
int Show_waypoints = 0
 
char * Object_type_names [MAX_OBJECT_TYPES]
 
obj_flag_name Object_flag_names []
 
int physics_paused = 0
 
int ai_paused = 0
 
ubyte Obj_weapon_group_id_used [WEAPON_MAX_GROUP_IDS]
 
int Arc_light = 1
 
fireball Fireballs []
 
int Collisions_enabled = 1
 
int Cmdline_dis_weapons
 
int Num_pairs
 
obj_pair pair_used_list
 
obj_pair pair_free_list
 

Macro Definition Documentation

#define IMPORTANT_FLAGS   (OF_COLLIDES)

Definition at line 942 of file object.cpp.

Function Documentation

void call_doa ( object child,
object parent 
)

Definition at line 12072 of file aicode.cpp.

int free_object_slots ( int  num_used)

Scan the object list, freeing down to num_used objects

Parameters
num_usedNumber of used objects to free down to
Returns
Returns number of slots freed

Definition at line 152 of file object.cpp.

float get_hull_pct ( object objp)

Definition at line 271 of file object.cpp.

float get_max_shield_quad ( object objp)

Definition at line 260 of file object.cpp.

float get_shield_pct ( object objp)

Definition at line 308 of file object.cpp.

float get_sim_hull_pct ( object objp)

Definition at line 289 of file object.cpp.

void obj_add_pairs ( int  objnum)

Add an element to the CheckObjects[] array, and update the object pairs. This is called from obj_create(), and the restore save-game code.

Definition at line 1901 of file object.cpp.

int obj_allocate ( void  )

Allocates an object

Generally, obj_create() should be called to get an object, since it fills in important fields and does the linking.

Returns
the number of a free object, updating Highest_object_index
-1 if no free objects

Definition at line 370 of file object.cpp.

void obj_clear_weapon_group_id_list ( )

Called once a frame to mark all weapon groups as not having cast light yet.

Definition at line 1158 of file object.cpp.

void obj_client_post_interpolate ( )

Do client-side post-interpolation object movement

Definition at line 1748 of file object.cpp.

void obj_client_pre_interpolate ( )

Do client-side pre-interpolation object movement

Definition at line 1703 of file object.cpp.

int obj_create ( ubyte  type,
int  parent_obj,
int  instance,
matrix orient,
vec3d pos,
float  radius,
uint  flags 
)

Initialize a new object. Adds to the list for the given segment.

The object will be a non-rendering, non-physics object. Pass -1 if no parent.

Returns
the object number

Definition at line 467 of file object.cpp.

void obj_delete ( int  objnum)

Remove object from the world If Player_obj, don't remove it!

Parameters
objnumObject number to remove

Definition at line 522 of file object.cpp.

void obj_delete_all_that_should_be_dead ( )

Definition at line 624 of file object.cpp.

void obj_free ( int  objnum)

Frees up an object

Generally, obj_delete() should be called to get rid of an object. This function deallocates the object entry after the object has been unlinked

Definition at line 429 of file object.cpp.

void obj_get_average_ship_pos ( vec3d pos)

Returns a vector of the average position of all ships in the mission.

Definition at line 1796 of file object.cpp.

int obj_get_by_signature ( int  sig)

Quickly finds an object by its signature

Definition at line 2074 of file object.cpp.

int obj_get_SIF ( object objp)

Definition at line 1817 of file object.cpp.

int obj_get_SIF ( int  obj)

Definition at line 1826 of file object.cpp.

void obj_init ( )

Sets up the free list & init player & whatever else

Definition at line 327 of file object.cpp.

void obj_init_all_ships_physics ( )

Definition at line 1689 of file object.cpp.

void obj_merge_created_list ( void  )

Add all newly created objects to the end of the used list and create their object pairs for collision detection

Definition at line 651 of file object.cpp.

void obj_move_all ( float  frametime)

Move all objects for the current frame

Definition at line 1383 of file object.cpp.

void obj_move_all_post ( object objp,
float  frametime 
)

Definition at line 1167 of file object.cpp.

void obj_move_all_pre ( object objp,
float  frametime 
)

Definition at line 1103 of file object.cpp.

void obj_move_call_physics ( object objp,
float  frametime 
)

Definition at line 781 of file object.cpp.

void obj_move_one_docked_object ( object objp,
object parent_objp 
)

Definition at line 682 of file object.cpp.

void obj_observer_move ( float  frame_time)

Definition at line 1772 of file object.cpp.

void obj_player_fire_stuff ( object objp,
control_info  ci 
)

Deals with firing player things like lasers, missiles, etc.

Separated out because of multiplayer issues.

Definition at line 720 of file object.cpp.

void obj_queue_render ( object obj,
draw_list scene 
)

Definition at line 1625 of file object.cpp.

void obj_remove_pairs ( object a)

Definition at line 1938 of file object.cpp.

void obj_render ( object obj)

Definition at line 1604 of file object.cpp.

void obj_render_DEPRECATED ( object obj)

Definition at line 1537 of file object.cpp.

void obj_reset_all_collisions ( )

Reset all collisions

Definition at line 1985 of file object.cpp.

void obj_set_flags ( object obj,
uint  new_flags 
)

Call this if you want to change an object flag so that the object code knows what's going on. For instance if you turn off OF_COLLIDES, the object code needs to know this in order to actually turn the object collision detection off. By calling this you shouldn't get Int3's in the checkobject code. If you do, then put code in here to correctly handle the case.

Definition at line 1000 of file object.cpp.

int obj_team ( object objp)

Return the team for the object passed as a parameter

Parameters
objpPointer to object that you want team for
Returns
enumerated team on success
-1 on failure (for objects that don't have teams)

Definition at line 1843 of file object.cpp.

bool object_get_gliding ( object objp)
Returns
whether an object is gliding -WMC

Definition at line 2059 of file object.cpp.

int object_get_model ( object objp)

Gets object model

Definition at line 2092 of file object.cpp.

bool object_glide_forced ( object objp)

Definition at line 2066 of file object.cpp.

int object_is_dead_docked ( object objp)

Definition at line 2025 of file object.cpp.

int object_is_docked ( object objp)

Definition at line 2019 of file object.cpp.

void object_set_gliding ( object objp,
bool  enable,
bool  force 
)

Makes an object start 'gliding'

It will continue on the same velocity that it was going, regardless of orientation -WMC

Definition at line 2036 of file object.cpp.

Variable Documentation

int ai_paused = 0

Definition at line 677 of file object.cpp.

int Arc_light = 1

Definition at line 1163 of file object.cpp.

int Cmdline_dis_weapons

Render an object. Calls one of several routines based on type

Definition at line 491 of file cmdline.cpp.

int Cmdline_old_collision_sys

Definition at line 489 of file cmdline.cpp.

int Collisions_enabled = 1

Definition at line 1374 of file object.cpp.

fireball Fireballs[]

Definition at line 43 of file fireballs.cpp.

int Highest_ever_object_index =0

Definition at line 70 of file object.cpp.

int Highest_object_index =-1

Definition at line 69 of file object.cpp.

int Num_objects =-1

Definition at line 68 of file object.cpp.

int Num_pairs

Removes any occurances of object 'a' from the pairs list.

Definition at line 32 of file objcollide.cpp.

object obj_create_list

Definition at line 54 of file object.cpp.

object obj_free_list

Definition at line 52 of file object.cpp.

object obj_used_list

Definition at line 53 of file object.cpp.

ubyte Obj_weapon_group_id_used[WEAPON_MAX_GROUP_IDS]

Definition at line 1153 of file object.cpp.

obj_flag_name Object_flag_names[]
Initial value:
= {
{OF_INVULNERABLE, "invulnerable", 1, },
{OF_PROTECTED, "protect-ship", 1, },
{OF_BEAM_PROTECTED, "beam-protect-ship", 1, },
{OF_NO_SHIELDS, "no-shields", 1, },
{OF_TARGETABLE_AS_BOMB, "targetable-as-bomb", 1, },
{OF_FLAK_PROTECTED, "flak-protect-ship", 1, },
{OF_LASER_PROTECTED, "laser-protect-ship", 1, },
{OF_MISSILE_PROTECTED, "missile-protect-ship", 1, },
{OF_IMMOBILE, "immobile", 1, },
{OF_COLLIDES, "collides", 1, },
}
#define OF_INVULNERABLE
Definition: object.h:107
#define OF_LASER_PROTECTED
Definition: object.h:120
#define OF_NO_SHIELDS
Definition: object.h:110
#define OF_COLLIDES
Definition: object.h:104
#define OF_TARGETABLE_AS_BOMB
Definition: object.h:118
#define OF_IMMOBILE
Definition: object.h:122
#define OF_PROTECTED
Definition: object.h:108
#define OF_MISSILE_PROTECTED
Definition: object.h:121
#define OF_FLAK_PROTECTED
Definition: object.h:119
#define OF_BEAM_PROTECTED
Definition: object.h:115

Definition at line 97 of file object.cpp.

int Object_inited = 0

Definition at line 72 of file object.cpp.

int Object_next_signature = 1

Definition at line 71 of file object.cpp.

char* Object_type_names[MAX_OBJECT_TYPES]
Initial value:
= {
"None",
"Ship",
"Weapon",
"Fireball",
"Start",
"Waypoint",
"Debris",
"Countermeasure",
"Ghost",
"Point",
"Shockwave",
"Wing",
"Observer",
"Asteroid",
"Jump Node",
"Beam",
}

Definition at line 76 of file object.cpp.

object Objects[MAX_OBJECTS]

Definition at line 62 of file object.cpp.

obj_pair pair_free_list

Definition at line 42 of file objcollide.cpp.

obj_pair pair_used_list

Definition at line 41 of file objcollide.cpp.

int physics_paused = 0

Definition at line 677 of file object.cpp.

object* Player_obj = NULL

Definition at line 56 of file object.cpp.

int Show_waypoints = 0

Definition at line 73 of file object.cpp.

object* Viewer_obj = NULL

Definition at line 57 of file object.cpp.