FS2_Open
Open source remastering of the Freespace 2 engine
object.h File Reference
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
#include "math/vecmat.h"
#include "physics/physics.h"

Go to the source code of this file.

Classes

struct  obj_flag_name
 
class  object
 
struct  object_h
 
struct  object_orient_pos
 
struct  checkobject
 

Macros

#define DEFAULT_SHIELD_SECTIONS   4
 
#define OBJECT_CHECK
 
#define OBJ_NONE   0
 
#define OBJ_SHIP   1
 
#define OBJ_WEAPON   2
 
#define OBJ_FIREBALL   3
 
#define OBJ_START   4
 
#define OBJ_WAYPOINT   5
 
#define OBJ_DEBRIS   6
 
#define OBJ_GHOST   8
 
#define OBJ_POINT   9
 
#define OBJ_SHOCKWAVE   10
 
#define OBJ_WING   11
 
#define OBJ_OBSERVER   12
 
#define OBJ_ASTEROID   13
 
#define OBJ_JUMP_NODE   14
 
#define OBJ_BEAM   15
 
#define MAX_OBJECT_TYPES   16
 
#define UNUSED_OBJNUM   (-MAX_OBJECTS*2)
 
#define OF_RENDERS   (1<<0)
 
#define OF_COLLIDES   (1<<1)
 
#define OF_PHYSICS   (1<<2)
 
#define OF_SHOULD_BE_DEAD   (1<<3)
 
#define OF_INVULNERABLE   (1<<4)
 
#define OF_PROTECTED   (1<<5)
 
#define OF_PLAYER_SHIP   (1<<6)
 
#define OF_NO_SHIELDS   (1<<7)
 
#define OF_JUST_UPDATED   (1<<8)
 
#define OF_COULD_BE_PLAYER   (1<<9)
 
#define OF_WAS_RENDERED   (1<<10)
 
#define OF_NOT_IN_COLL   (1<<11)
 
#define OF_BEAM_PROTECTED   (1<<12)
 
#define OF_SPECIAL_WARPIN   (1<<13)
 
#define OF_DOCKED_ALREADY_HANDLED   (1<<14)
 
#define OF_TARGETABLE_AS_BOMB   (1<<15)
 
#define OF_FLAK_PROTECTED   (1<<16)
 
#define OF_LASER_PROTECTED   (1<<17)
 
#define OF_MISSILE_PROTECTED   (1<<18)
 
#define OF_IMMOBILE   (1<<19)
 
#define OF_MARKED   (1<<29)
 
#define OF_TEMP_MARKED   (1<<30)
 
#define OF_HIDDEN   (1<<31)
 
#define MAX_OBJECT_FLAG_NAMES   10
 
#define OBJ_INDEX(objp)   (ptrdiff_t)(objp-Objects)
 
#define OBJ_RECALC_PAIRS(obj_to_reset)   do { obj_set_flags(obj_to_reset, obj_to_reset->flags & ~(OF_COLLIDES)); obj_set_flags(obj_to_reset, obj_to_reset->flags | OF_COLLIDES); } while(0);
 

Typedefs

typedef struct obj_flag_name obj_flag_name
 
typedef struct object_orient_pos object_orient_pos
 
typedef struct checkobject checkobject
 

Functions

void obj_init ()
 
int obj_create (ubyte type, int parent_obj, int instance, matrix *orient, vec3d *pos, float radius, uint flags)
 
void obj_render_DEPRECATED (object *obj)
 
void obj_render (object *obj)
 
void obj_queue_render (object *obj, draw_list *scene)
 
void obj_render_all (void(*render_function)(object *objp), bool *render_viewer_last)
 
void obj_move_all (float frametime)
 
void obj_move_one (object *obj, float frametime)
 
void obj_delete (int objnum)
 
void obj_merge_created_list (void)
 
void obj_remove_pairs (object *a)
 
void obj_add_pairs (int objnum)
 
int objects_will_collide (object *A, object *B, float duration, float radius_scale)
 
void obj_init_all_ships_physics ()
 
float get_hull_pct (object *objp)
 
float get_sim_hull_pct (object *objp)
 
float get_shield_pct (object *objp)
 
float get_max_shield_quad (object *objp)
 
void obj_get_average_ship_pos (vec3d *pos)
 
void obj_player_fire_stuff (object *objp, control_info ci)
 
void obj_set_flags (object *obj, uint new_flags)
 
int obj_get_SIF (object *objp)
 
int obj_get_SIF (int obj)
 
int obj_team (object *objp)
 
void obj_move_all_pre (object *objp, float frametime)
 
void obj_move_all_post (object *objp, float frametime)
 
void obj_move_call_physics (object *objp, float frametime)
 
void obj_client_pre_interpolate ()
 
void obj_client_post_interpolate ()
 
void obj_observer_move (float frame_time)
 
int object_is_docked (object *objp)
 
int object_is_dead_docked (object *objp)
 
void obj_move_one_docked_object (object *objp, object *parent_objp)
 
void object_set_gliding (object *objp, bool enable=true, bool force=false)
 
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)
 
void obj_render_queue_all ()
 

Variables

char * Object_type_names [MAX_OBJECT_TYPES]
 
obj_flag_name Object_flag_names []
 
int Object_inited
 
int Show_waypoints
 
int Object_next_signature
 
int Num_objects
 
object Objects []
 
int Highest_object_index
 
int Highest_ever_object_index
 
object obj_free_list
 
object obj_used_list
 
object obj_create_list
 
int render_total
 
int render_order [MAX_OBJECTS]
 
objectViewer_obj
 
objectPlayer_obj
 

Macro Definition Documentation

#define DEFAULT_SHIELD_SECTIONS   4

Definition at line 24 of file object.h.

#define MAX_OBJECT_FLAG_NAMES   10

Definition at line 135 of file object.h.

#define MAX_OBJECT_TYPES   16

Definition at line 49 of file object.h.

#define OBJ_ASTEROID   13

Definition at line 44 of file object.h.

#define OBJ_BEAM   15

Definition at line 46 of file object.h.

#define OBJ_DEBRIS   6

Definition at line 37 of file object.h.

#define OBJ_FIREBALL   3

Definition at line 34 of file object.h.

#define OBJ_GHOST   8

Definition at line 39 of file object.h.

#define OBJ_INDEX (   objp)    (ptrdiff_t)(objp-Objects)

Definition at line 235 of file object.h.

#define OBJ_JUMP_NODE   14

Definition at line 45 of file object.h.

#define OBJ_NONE   0

Definition at line 31 of file object.h.

#define OBJ_OBSERVER   12

Definition at line 43 of file object.h.

#define OBJ_POINT   9

Definition at line 40 of file object.h.

#define OBJ_RECALC_PAIRS (   obj_to_reset)    do { obj_set_flags(obj_to_reset, obj_to_reset->flags & ~(OF_COLLIDES)); obj_set_flags(obj_to_reset, obj_to_reset->flags | OF_COLLIDES); } while(0);

Definition at line 274 of file object.h.

#define OBJ_SHIP   1

Definition at line 32 of file object.h.

#define OBJ_SHOCKWAVE   10

Definition at line 41 of file object.h.

#define OBJ_START   4

Definition at line 35 of file object.h.

#define OBJ_WAYPOINT   5

Definition at line 36 of file object.h.

#define OBJ_WEAPON   2

Definition at line 33 of file object.h.

#define OBJ_WING   11

Definition at line 42 of file object.h.

#define OBJECT_CHECK

Definition at line 27 of file object.h.

#define OF_BEAM_PROTECTED   (1<<12)

Definition at line 115 of file object.h.

#define OF_COLLIDES   (1<<1)

Definition at line 104 of file object.h.

#define OF_COULD_BE_PLAYER   (1<<9)

Definition at line 112 of file object.h.

#define OF_DOCKED_ALREADY_HANDLED   (1<<14)

Definition at line 117 of file object.h.

#define OF_FLAK_PROTECTED   (1<<16)

Definition at line 119 of file object.h.

#define OF_HIDDEN   (1<<31)

Definition at line 127 of file object.h.

#define OF_IMMOBILE   (1<<19)

Definition at line 122 of file object.h.

#define OF_INVULNERABLE   (1<<4)

Definition at line 107 of file object.h.

#define OF_JUST_UPDATED   (1<<8)

Definition at line 111 of file object.h.

#define OF_LASER_PROTECTED   (1<<17)

Definition at line 120 of file object.h.

#define OF_MARKED   (1<<29)

Definition at line 125 of file object.h.

#define OF_MISSILE_PROTECTED   (1<<18)

Definition at line 121 of file object.h.

#define OF_NO_SHIELDS   (1<<7)

Definition at line 110 of file object.h.

#define OF_NOT_IN_COLL   (1<<11)

Definition at line 114 of file object.h.

#define OF_PHYSICS   (1<<2)

Definition at line 105 of file object.h.

#define OF_PLAYER_SHIP   (1<<6)

Definition at line 109 of file object.h.

#define OF_PROTECTED   (1<<5)

Definition at line 108 of file object.h.

#define OF_RENDERS   (1<<0)

Definition at line 103 of file object.h.

#define OF_SHOULD_BE_DEAD   (1<<3)

Definition at line 106 of file object.h.

#define OF_SPECIAL_WARPIN   (1<<13)

Definition at line 116 of file object.h.

#define OF_TARGETABLE_AS_BOMB   (1<<15)

Definition at line 118 of file object.h.

#define OF_TEMP_MARKED   (1<<30)

Definition at line 126 of file object.h.

#define OF_WAS_RENDERED   (1<<10)

Definition at line 113 of file object.h.

#define UNUSED_OBJNUM   (-MAX_OBJECTS*2)

Definition at line 51 of file object.h.

Typedef Documentation

typedef struct checkobject checkobject
typedef struct obj_flag_name obj_flag_name

Function Documentation

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.

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_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 ( object obj,
float  frametime 
)
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_all ( void(*)(object *objp render_function,
bool *  render_viewer_last 
)

Definition at line 172 of file objectsort.cpp.

void obj_render_DEPRECATED ( object obj)

Definition at line 1537 of file object.cpp.

void obj_render_queue_all ( )

Definition at line 347 of file objectsort.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.

int objects_will_collide ( object A,
object B,
float  duration,
float  radius_scale 
)

Definition at line 672 of file objcollide.cpp.

Variable Documentation

int Highest_ever_object_index

Definition at line 70 of file object.cpp.

int Highest_object_index

Definition at line 69 of file object.cpp.

int Num_objects

Definition at line 68 of file object.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.

obj_flag_name Object_flag_names[]

Definition at line 97 of file object.cpp.

int Object_inited

Definition at line 72 of file object.cpp.

int Object_next_signature

Definition at line 71 of file object.cpp.

char* Object_type_names[MAX_OBJECT_TYPES]

Definition at line 76 of file object.cpp.

object Objects[]

Definition at line 62 of file object.cpp.

object* Player_obj

Definition at line 56 of file object.cpp.

int render_order[MAX_OBJECTS]
int render_total
int Show_waypoints

Definition at line 73 of file object.cpp.

object* Viewer_obj

Definition at line 57 of file object.cpp.