Move object declarations to fwdobject.h

This commit is contained in:
Kp 2014-11-23 04:36:58 +00:00
parent 4ad784028b
commit 88101f8f57
5 changed files with 325 additions and 315 deletions

302
common/main/fwdobject.h Normal file
View file

@ -0,0 +1,302 @@
/*
* Portions of this file are copyright Rebirth contributors and licensed as
* described in COPYING.txt.
* Portions of this file are copyright Parallax Software and licensed
* according to the Parallax license.
* See COPYING.txt for license details.
*/
#pragma once
#include "dxxsconf.h"
#include "compiler-array.h"
#include "objnum.h"
#include "fwdvalptridx.h"
struct bitmap_index;
const unsigned MAX_OBJECTS = 350;
const unsigned MAX_USED_OBJECTS = MAX_OBJECTS - 20;
enum object_type_t : int;
#if defined(DXX_BUILD_DESCENT_I)
const unsigned MAX_OBJECT_TYPES = 15;
#elif defined(DXX_BUILD_DESCENT_II)
const unsigned MAX_OBJECT_TYPES = 16;
#endif
// Result types
typedef unsigned result_type_t;
const result_type_t RESULT_NOTHING = 0; // Ignore this collision
const result_type_t RESULT_CHECK = 1; // Check for this collision
// Control types - what tells this object what do do
typedef unsigned control_type_t;
const control_type_t CT_NONE = 0; // doesn't move (or change movement)
const control_type_t CT_AI = 1; // driven by AI
const control_type_t CT_EXPLOSION = 2; // explosion sequencer
const control_type_t CT_FLYING = 4; // the player is flying
const control_type_t CT_SLEW = 5; // slewing
const control_type_t CT_FLYTHROUGH = 6; // the flythrough system
const control_type_t CT_WEAPON = 9; // laser, etc.
const control_type_t CT_REPAIRCEN = 10; // under the control of the repair center
const control_type_t CT_MORPH = 11; // this object is being morphed
const control_type_t CT_DEBRIS = 12; // this is a piece of debris
const control_type_t CT_POWERUP = 13; // animating powerup blob
const control_type_t CT_LIGHT = 14; // doesn't actually do anything
const control_type_t CT_REMOTE = 15; // controlled by another net player
const control_type_t CT_CNTRLCEN = 16; // the control center/main reactor
// Movement types
typedef unsigned movement_type_t;
const movement_type_t MT_NONE = 0; // doesn't move
const movement_type_t MT_PHYSICS = 1; // moves by physics
const movement_type_t MT_SPINNING = 3; // this object doesn't move, just sits and spins
// Render types
typedef unsigned render_type_t;
const render_type_t RT_NONE = 0; // does not render
const render_type_t RT_POLYOBJ = 1; // a polygon model
const render_type_t RT_FIREBALL = 2; // a fireball
const render_type_t RT_LASER = 3; // a laser
const render_type_t RT_HOSTAGE = 4; // a hostage
const render_type_t RT_POWERUP = 5; // a powerup
const render_type_t RT_MORPH = 6; // a robot being morphed
const render_type_t RT_WEAPON_VCLIP = 7; // a weapon that renders as a vclip
// misc object flags
typedef unsigned object_flag_t;
const object_flag_t OF_EXPLODING = 1; // this object is exploding
const object_flag_t OF_SHOULD_BE_DEAD = 2; // this object should be dead, so next time we can, we should delete this object.
const object_flag_t OF_DESTROYED = 4; // this has been killed, and is showing the dead version
const object_flag_t OF_SILENT = 8; // this makes no sound when it hits a wall. Added by MK for weapons, if you extend it to other types, do it completely!
const object_flag_t OF_ATTACHED = 16; // this object is a fireball attached to another object
#if defined(DXX_BUILD_DESCENT_II)
const object_flag_t OF_PLAYER_DROPPED = 64; // this object was dropped by the player...
#endif
// physics flags
typedef unsigned physics_flag_t;
const physics_flag_t PF_TURNROLL = 0x01; // roll when turning
const physics_flag_t PF_LEVELLING = 0x02; // level object with closest side
const physics_flag_t PF_BOUNCE = 0x04; // bounce (not slide) when hit will
const physics_flag_t PF_WIGGLE = 0x08; // wiggle while flying
const physics_flag_t PF_STICK = 0x10; // object sticks (stops moving) when hits wall
const physics_flag_t PF_PERSISTENT = 0x20; // object keeps going even after it hits another object (eg, fusion cannon)
const physics_flag_t PF_USES_THRUST = 0x40; // this object uses its thrust
#if defined(DXX_BUILD_DESCENT_II)
const physics_flag_t PF_BOUNCED_ONCE = 0x80; // Weapon has bounced once.
const physics_flag_t PF_FREE_SPINNING = 0x100; // Drag does not apply to rotation of this object
const physics_flag_t PF_BOUNCES_TWICE = 0x200; // This weapon bounces twice, then dies
typedef unsigned powerup_flag_t;
const powerup_flag_t PF_SPAT_BY_PLAYER = 1; //this powerup was spat by the player
#endif
const unsigned IMMORTAL_TIME = 0x3fffffff; // Time assigned to immortal objects, about 32768 seconds, or about 9 hours.
struct shortpos;
struct quaternionpos;
// This is specific to the shortpos extraction routines in gameseg.c.
const unsigned RELPOS_PRECISION = 10;
const unsigned MATRIX_PRECISION = 9;
struct physics_info;
struct physics_info_rw;
struct laser_info;
struct laser_info_rw;
struct explosion_info;
struct explosion_info_rw;
struct light_info;
struct light_info_rw;
struct powerup_info;
struct powerup_info_rw;
struct vclip_info;
struct vclip_info_rw;
struct polyobj_info;
struct polyobj_info_rw;
struct obj_position;
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
extern const array<array<char, 9>, MAX_OBJECT_TYPES> Object_type_names;
#if defined(DXX_BUILD_DESCENT_I)
const unsigned MAX_CONTROLCEN_GUNS = 4;
const unsigned MAX_RENDERED_WINDOWS = 1;
#elif defined(DXX_BUILD_DESCENT_II)
const unsigned MAX_CONTROLCEN_GUNS = 8;
const unsigned MAX_RENDERED_WINDOWS = 3;
#endif
struct reactor_static;
struct object;
struct object_rw;
struct window_rendered_data;
typedef array<uint8_t, MAX_OBJECT_TYPES> collision_inner_array_t;
typedef array<collision_inner_array_t, MAX_OBJECT_TYPES> collision_outer_array_t;
extern const collision_outer_array_t CollisionResult;
struct object_array_t;
extern object_array_t Objects;
#endif
extern int Object_next_signature; // The next signature for the next newly created object
extern int num_objects;
extern int Num_robot_types;
extern object *ConsoleObject; // pointer to the object that is the player
extern object *Viewer; // which object we are seeing from
extern object *Dead_player_camera;
extern int Player_is_dead; // !0 means player is dead!
extern int Player_exploded;
extern int Player_eggs_dropped;
extern int Death_sequence_aborted;
extern objnum_t Player_fired_laser_this_frame;
extern int Drop_afterburner_blob_flag; //ugly hack
// do whatever setup needs to be done
void init_objects();
// when an object has moved into a new segment, this function unlinks it
// from its old segment, and links it into the new segment
void obj_relink(vobjptridx_t objnum,vsegptridx_t newsegnum);
// for getting out of messed up linking situations (i.e. caused by demo playback)
void obj_relink_all();
// links an object into a segment's list of objects.
// takes object number and segment number
void obj_link(vobjptridx_t objnum,vsegptridx_t segnum);
// unlinks an object from a segment's list of objects
void obj_unlink(vobjptridx_t objnum);
// initialize a new object. adds to the list for the given segment
// returns the object number
objptridx_t obj_create(object_type_t type, ubyte id, vsegptridx_t segnum, const vms_vector &pos, const vms_matrix *orient, fix size, ubyte ctype, ubyte mtype, ubyte rtype);
// make a copy of an object. returs num of new object
objptridx_t obj_create_copy(objnum_t objnum, const vms_vector &new_pos, segnum_t newsegnum);
// remove object from the world
void obj_delete(vobjptridx_t objnum);
// called after load. Takes number of objects, and objects should be
// compressed
void reset_objects(int n_objs);
// make object array non-sparse
void compress_objects();
// Render an object. Calls one of several routines based on type
void render_object(vobjptridx_t obj);
// Draw a blob-type object, like a fireball
void draw_object_blob(object &obj, bitmap_index bitmap);
// draw an object that is a texture-mapped rod
void draw_object_tmap_rod(vobjptridx_t obj, bitmap_index bitmap, int lighted);
// Toggles whether or not lock-boxes draw.
void object_toggle_lock_targets();
// move all objects for the current frame
void object_move_all(); // moves all objects
// set viewer object to next object in array
void object_goto_next_viewer();
// make object0 the player, setting all relevant fields
void init_player_object();
// check if object is in object->segnum. if not, check the adjacent
// segs. if not any of these, returns false, else sets obj->segnum &
// returns true callers should really use find_vector_intersection()
// Note: this function is in gameseg.c
int update_object_seg(vobjptridx_t obj);
// Finds what segment *obj is in, returns segment number. If not in
// any segment, returns -1. Note: This function is defined in
// gameseg.h, but object.h depends on gameseg.h, and object.h is where
// object is defined...get it?
segnum_t find_object_seg(vobjptr_t obj);
// go through all objects and make sure they have the correct segment
// numbers used when debugging is on
void fix_object_segs();
// Drops objects contained in objp.
objptridx_t object_create_egg(vobjptr_t objp);
// Interface to object_create_egg, puts count objects of type type, id
// = id in objp and then drops them.
objptridx_t call_object_create_egg(vobjptr_t objp, int count, int type, int id);
void dead_player_end();
// Extract information from an object (objp->orient, objp->pos,
// objp->segnum), stuff in a shortpos structure. See typedef
// shortpos.
void create_shortpos(shortpos *spp, vcobjptr_t objp, int swap_bytes);
// Extract information from a shortpos, stuff in objp->orient
// (matrix), objp->pos, objp->segnum
void extract_shortpos(vobjptridx_t objp, shortpos *spp, int swap_bytes);
// create and extract quaternion structure from object data which greatly saves bytes by using quaternion instead or orientation matrix
void create_quaternionpos(quaternionpos * qpp, vobjptr_t objp, int swap_bytes);
void extract_quaternionpos(vobjptridx_t objp, quaternionpos *qpp, int swap_bytes);
// delete objects, such as weapons & explosions, that shouldn't stay
// between levels if clear_all is set, clear even proximity bombs
void clear_transient_objects(int clear_all);
// Returns a new, unique signature for a new object
int obj_get_signature();
// returns the number of a free object, updating Highest_object_index.
// Generally, obj_create() should be called to get an object, since it
// fills in important fields and does the linking. returns -1 if no
// free objects
objptridx_t obj_allocate();
// after calling init_object(), the network code has grabbed specific
// object slots without allocating them. Go though the objects &
// build the free list, then set the apporpriate globals Don't call
// this function if you don't know what you're doing.
void special_reset_objects();
// attaches an object, such as a fireball, to another object, such as
// a robot
void obj_attach(vobjptridx_t parent,vobjptridx_t sub);
void create_small_fireball_on_object(vobjptridx_t objp, fix size_scale, int sound_flag);
void dead_player_frame();
#if defined(DXX_BUILD_DESCENT_II)
// returns object number
objnum_t drop_marker_object(const vms_vector &pos, segnum_t segnum, const vms_matrix &orient, int marker_num);
void wake_up_rendered_objects(vobjptridx_t gmissp, int window_num);
void fuelcen_check_for_goal (vsegptr_t);
#endif
objptridx_t obj_find_first_of_type(int type);
void object_rw_swap(struct object_rw *obj_rw, int swap);
void reset_player_object();

View file

@ -23,8 +23,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifndef _OBJECT_H
#define _OBJECT_H
#pragma once
#include "pstypes.h"
#include "vecmat.h"
@ -45,17 +44,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <vector>
#include <stdexcept>
#include "compiler-type_traits.h"
/*
* CONSTANTS
*/
#define MAX_OBJECTS 350 // increased on 01/24/95 for multiplayer. --MK; total number of objects in world
#define MAX_USED_OBJECTS (MAX_OBJECTS-20)
#include "fwdobject.h"
// Object types
enum object_type_t
enum object_type_t : int
{
OBJ_NONE = 255, // unused object
OBJ_WALL = 0, // A wall... not really an object, but used for collisions
@ -77,99 +69,11 @@ enum object_type_t
#endif
};
// WARNING!! If you add a type here, add its name to Object_type_names
// in object.c
#if defined(DXX_BUILD_DESCENT_I)
#define MAX_OBJECT_TYPES 15
#elif defined(DXX_BUILD_DESCENT_II)
#define MAX_OBJECT_TYPES 16
#endif
// Result types
#define RESULT_NOTHING 0 // Ignore this collision
#define RESULT_CHECK 1 // Check for this collision
// Control types - what tells this object what do do
#define CT_NONE 0 // doesn't move (or change movement)
#define CT_AI 1 // driven by AI
#define CT_EXPLOSION 2 // explosion sequencer
#define CT_FLYING 4 // the player is flying
#define CT_SLEW 5 // slewing
#define CT_FLYTHROUGH 6 // the flythrough system
#define CT_WEAPON 9 // laser, etc.
#define CT_REPAIRCEN 10 // under the control of the repair center
#define CT_MORPH 11 // this object is being morphed
#define CT_DEBRIS 12 // this is a piece of debris
#define CT_POWERUP 13 // animating powerup blob
#define CT_LIGHT 14 // doesn't actually do anything
#define CT_REMOTE 15 // controlled by another net player
#define CT_CNTRLCEN 16 // the control center/main reactor
// Movement types
#define MT_NONE 0 // doesn't move
#define MT_PHYSICS 1 // moves by physics
#define MT_SPINNING 3 // this object doesn't move, just sits and spins
// Render types
#define RT_NONE 0 // does not render
#define RT_POLYOBJ 1 // a polygon model
#define RT_FIREBALL 2 // a fireball
#define RT_LASER 3 // a laser
#define RT_HOSTAGE 4 // a hostage
#define RT_POWERUP 5 // a powerup
#define RT_MORPH 6 // a robot being morphed
#define RT_WEAPON_VCLIP 7 // a weapon that renders as a vclip
// misc object flags
#define OF_EXPLODING 1 // this object is exploding
#define OF_SHOULD_BE_DEAD 2 // this object should be dead, so next time we can, we should delete this object.
#define OF_DESTROYED 4 // this has been killed, and is showing the dead version
#define OF_SILENT 8 // this makes no sound when it hits a wall. Added by MK for weapons, if you extend it to other types, do it completely!
#define OF_ATTACHED 16 // this object is a fireball attached to another object
#if defined(DXX_BUILD_DESCENT_II)
#define OF_PLAYER_DROPPED 64 // this object was dropped by the player...
#endif
// Different Weapon ID types...
#define WEAPON_ID_LASER 0
#define WEAPON_ID_MISSLE 1
#define WEAPON_ID_CANNONBALL 2
// Object Initial shields...
#define OBJECT_INITIAL_SHIELDS F1_0/2
// physics flags
#define PF_TURNROLL 0x01 // roll when turning
#define PF_LEVELLING 0x02 // level object with closest side
#define PF_BOUNCE 0x04 // bounce (not slide) when hit will
#define PF_WIGGLE 0x08 // wiggle while flying
#define PF_STICK 0x10 // object sticks (stops moving) when hits wall
#define PF_PERSISTENT 0x20 // object keeps going even after it hits another object (eg, fusion cannon)
#define PF_USES_THRUST 0x40 // this object uses its thrust
#if defined(DXX_BUILD_DESCENT_II)
#define PF_BOUNCED_ONCE 0x80 // Weapon has bounced once.
#define PF_FREE_SPINNING 0x100 // Drag does not apply to rotation of this object
#define PF_BOUNCES_TWICE 0x200 // This weapon bounces twice, then dies
#define PF_SPAT_BY_PLAYER 1 //this powerup was spat by the player
#endif
#define IMMORTAL_TIME 0x3fffffff // Time assigned to immortal objects, about 32768 seconds, or about 9 hours.
/*
* STRUCTURES
*/
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
extern const char Object_type_names[MAX_OBJECT_TYPES][9];
#if defined(DXX_BUILD_DESCENT_I)
#define MAX_CONTROLCEN_GUNS 4
#define MAX_RENDERED_WINDOWS 1
#elif defined(DXX_BUILD_DESCENT_II)
#define MAX_CONTROLCEN_GUNS 8
#define MAX_RENDERED_WINDOWS 3
#endif
struct reactor_static {
/* Location of the gun on the reactor object */
vms_vector gun_pos[MAX_CONTROLCEN_GUNS];
@ -197,13 +101,8 @@ struct quaternionpos
vms_vector rotvel;
} __pack__;
// This is specific to the shortpos extraction routines in gameseg.c.
#define RELPOS_PRECISION 10
#define MATRIX_PRECISION 9
#define MATRIX_MAX 0x7f // This is based on MATRIX_PRECISION, 9 => 0x7f
// information for physics sim for an object
struct physics_info : public prohibit_void_ptr<physics_info>
struct physics_info : prohibit_void_ptr<physics_info>
{
vms_vector velocity; // velocity vector of this object
vms_vector thrust; // constant force applied to this object
@ -230,7 +129,7 @@ struct physics_info_rw
// stuctures for different kinds of simulation
struct laser_info : public prohibit_void_ptr<laser_info>
struct laser_info : prohibit_void_ptr<laser_info>
{
struct hitobj_list_t : public prohibit_void_ptr<hitobj_list_t>
{
@ -316,7 +215,7 @@ struct laser_info_rw
fix multiplier; // Power if this is a fusion bolt (or other super weapon to be added).
} __pack__;
struct explosion_info : public prohibit_void_ptr<explosion_info>
struct explosion_info : prohibit_void_ptr<explosion_info>
{
fix spawn_time; // when lifeleft is < this, spawn another
fix delete_time; // when to delete object
@ -336,7 +235,7 @@ struct explosion_info_rw
short next_attach; // next explosion in attach list
} __pack__;
struct light_info : public prohibit_void_ptr<light_info>
struct light_info : prohibit_void_ptr<light_info>
{
fix intensity; // how bright the light is
};
@ -346,7 +245,7 @@ struct light_info_rw
fix intensity; // how bright the light is
} __pack__;
struct powerup_info : public prohibit_void_ptr<powerup_info>
struct powerup_info : prohibit_void_ptr<powerup_info>
{
int count; // how many/much we pick up (vulcan cannon only?)
#if defined(DXX_BUILD_DESCENT_II)
@ -365,7 +264,7 @@ struct powerup_info_rw
#endif
} __pack__;
struct vclip_info : public prohibit_void_ptr<vclip_info>
struct vclip_info : prohibit_void_ptr<vclip_info>
{
int vclip_num;
fix frametime;
@ -381,7 +280,7 @@ struct vclip_info_rw
// structures for different kinds of rendering
struct polyobj_info : public prohibit_void_ptr<polyobj_info>
struct polyobj_info : prohibit_void_ptr<polyobj_info>
{
int model_num; // which polygon model
vms_angvec anim_angles[MAX_SUBMODELS]; // angles for each subobject
@ -399,16 +298,11 @@ struct polyobj_info_rw
int alt_textures; // if not -1, use these textures instead
} __pack__;
struct object_rw;
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
struct object {
int signature; // Every object ever has a unique signature...
ubyte type; // what type of object this is... robot, weapon, hostage, powerup, fireball
ubyte id; // which form of object...which powerup, robot, etc.
#ifdef WORDS_NEED_ALIGNMENT
short pad;
#endif
objnum_t next,prev; // id of next and previous connected object in Objects, -1 = no connection
ubyte control_type; // how this object is controlled
ubyte movement_type; // how this object moves
@ -449,10 +343,6 @@ struct object {
struct ai_static ai_info;
struct reactor_static reactor_info;
} ctype;
#ifdef WORDS_NEED_ALIGNMENT
short pad2;
#endif
};
// Same as above but structure Savegames/Multiplayer objects expect
@ -528,14 +418,9 @@ struct window_rendered_data
std::vector<objnum_t> rendered_robots;
};
extern window_rendered_data Window_rendered_data[MAX_RENDERED_WINDOWS];
extern array<window_rendered_data, MAX_RENDERED_WINDOWS> Window_rendered_data;
typedef array<ubyte, MAX_OBJECT_TYPES> collision_inner_array_t;
typedef array<collision_inner_array_t, MAX_OBJECT_TYPES> collision_outer_array_t;
extern const collision_outer_array_t CollisionResult;
// ie CollisionResult[a][b]== what happens to a when it collides with b
struct object_array_t : public array<object, MAX_OBJECTS>
struct object_array_t : array<object, MAX_OBJECTS>
{
int highest;
#define Highest_object_index Objects.highest
@ -556,7 +441,6 @@ struct object_array_t : public array<object, MAX_OBJECTS>
object_array_t(const object_array_t &) = delete;
object_array_t &operator=(const object_array_t &) = delete;
};
extern object_array_t Objects;
DEFINE_VALPTRIDX_SUBTYPE(obj, object, objnum_t, Objects);
@ -616,181 +500,4 @@ static inline void set_weapon_id(const vobjptr_t o, weapon_type_t id)
}
#endif
/*
* VARIABLES
*/
extern int Object_next_signature; // The next signature for the next newly created object
extern int num_objects;
extern int Num_robot_types;
extern object *ConsoleObject; // pointer to the object that is the player
extern object *Viewer; // which object we are seeing from
extern object *Dead_player_camera;
extern int Player_is_dead; // !0 means player is dead!
extern int Player_exploded;
extern int Player_eggs_dropped;
extern int Death_sequence_aborted;
extern objnum_t Player_fired_laser_this_frame;
extern int Drop_afterburner_blob_flag; //ugly hack
/*
* FUNCTIONS
*/
// do whatever setup needs to be done
void init_objects();
// when an object has moved into a new segment, this function unlinks it
// from its old segment, and links it into the new segment
void obj_relink(vobjptridx_t objnum,vsegptridx_t newsegnum);
// for getting out of messed up linking situations (i.e. caused by demo playback)
void obj_relink_all(void);
// links an object into a segment's list of objects.
// takes object number and segment number
void obj_link(vobjptridx_t objnum,vsegptridx_t segnum);
// unlinks an object from a segment's list of objects
void obj_unlink(vobjptridx_t objnum);
// initialize a new object. adds to the list for the given segment
// returns the object number
objptridx_t obj_create(object_type_t type, ubyte id, vsegptridx_t segnum, const vms_vector &pos,
const vms_matrix *orient, fix size,
ubyte ctype, ubyte mtype, ubyte rtype);
// make a copy of an object. returs num of new object
objptridx_t obj_create_copy(objnum_t objnum, const vms_vector &new_pos, segnum_t newsegnum);
// remove object from the world
void obj_delete(vobjptridx_t objnum);
// called after load. Takes number of objects, and objects should be
// compressed
void reset_objects(int n_objs);
// make object array non-sparse
void compress_objects(void);
// Render an object. Calls one of several routines based on type
void render_object(vobjptridx_t obj);
// Draw a blob-type object, like a fireball
void draw_object_blob(object &obj, bitmap_index bitmap);
// draw an object that is a texture-mapped rod
void draw_object_tmap_rod(vobjptridx_t obj, bitmap_index bitmap, int lighted);
// Deletes all objects that have been marked for death.
void obj_delete_all_that_should_be_dead();
// Toggles whether or not lock-boxes draw.
void object_toggle_lock_targets();
// move all objects for the current frame
void object_move_all(); // moves all objects
// set viewer object to next object in array
void object_goto_next_viewer();
// draw target boxes for nearby robots
void object_render_targets(void);
// move an object for the current frame
void object_move_one(vobjptridx_t obj);
// make object0 the player, setting all relevant fields
void init_player_object();
// check if object is in object->segnum. if not, check the adjacent
// segs. if not any of these, returns false, else sets obj->segnum &
// returns true callers should really use find_vector_intersection()
// Note: this function is in gameseg.c
int update_object_seg(vobjptridx_t obj);
// Finds what segment *obj is in, returns segment number. If not in
// any segment, returns -1. Note: This function is defined in
// gameseg.h, but object.h depends on gameseg.h, and object.h is where
// object is defined...get it?
segnum_t find_object_seg(vobjptr_t obj);
// go through all objects and make sure they have the correct segment
// numbers used when debugging is on
void fix_object_segs();
// Drops objects contained in objp.
objptridx_t object_create_egg(vobjptr_t objp);
// Interface to object_create_egg, puts count objects of type type, id
// = id in objp and then drops them.
objptridx_t call_object_create_egg(vobjptr_t objp, int count, int type, int id);
extern void dead_player_end(void);
// Extract information from an object (objp->orient, objp->pos,
// objp->segnum), stuff in a shortpos structure. See typedef
// shortpos.
void create_shortpos(shortpos *spp, vcobjptr_t objp, int swap_bytes);
// Extract information from a shortpos, stuff in objp->orient
// (matrix), objp->pos, objp->segnum
void extract_shortpos(vobjptridx_t objp, shortpos *spp, int swap_bytes);
// create and extract quaternion structure from object data which greatly saves bytes by using quaternion instead or orientation matrix
void create_quaternionpos(quaternionpos * qpp, vobjptr_t objp, int swap_bytes);
void extract_quaternionpos(vobjptridx_t objp, quaternionpos *qpp, int swap_bytes);
// delete objects, such as weapons & explosions, that shouldn't stay
// between levels if clear_all is set, clear even proximity bombs
void clear_transient_objects(int clear_all);
// Returns a new, unique signature for a new object
int obj_get_signature();
// returns the number of a free object, updating Highest_object_index.
// Generally, obj_create() should be called to get an object, since it
// fills in important fields and does the linking. returns -1 if no
// free objects
objptridx_t obj_allocate();
// 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
void obj_free(objnum_t objnum);
// after calling init_object(), the network code has grabbed specific
// object slots without allocating them. Go though the objects &
// build the free list, then set the apporpriate globals Don't call
// this function if you don't know what you're doing.
void special_reset_objects(void);
// attaches an object, such as a fireball, to another object, such as
// a robot
void obj_attach(vobjptridx_t parent,vobjptridx_t sub);
void create_small_fireball_on_object(vobjptridx_t objp, fix size_scale, int sound_flag);
void dead_player_frame(void);
#if defined(DXX_BUILD_DESCENT_II)
// returns object number
objnum_t drop_marker_object(const vms_vector &pos, segnum_t segnum, const vms_matrix &orient, int marker_num);
extern void wake_up_rendered_objects(vobjptridx_t gmissp, int window_num);
void fuelcen_check_for_goal (vsegptr_t);
#endif
objptridx_t obj_find_first_of_type(int type);
extern void object_rw_swap(struct object_rw *obj_rw, int swap);
void reset_player_object(void);
#endif
#endif

View file

@ -77,7 +77,7 @@ static const char *object_types(int objnum)
int type = Objects[objnum].type;
Assert((type == OBJ_NONE) || ((type >= 0) && (type < MAX_OBJECT_TYPES)));
return Object_type_names[type];
return &Object_type_names[type][0];
}
// ----------------------------------------------------------------------------
@ -312,15 +312,15 @@ static void write_key_text(PHYSFS_file *my_file)
if (Objects[i].contains_type == OBJ_POWERUP) {
switch (Objects[i].contains_id) {
case POW_KEY_BLUE:
PHYSFSX_printf(my_file, "The BLUE key is contained in object %hu (a %s %s) in segment %i\n", static_cast<uint16_t>(i), Object_type_names[Objects[i].type], Robot_names[get_robot_id(&Objects[i])], Objects[i].segnum);
PHYSFSX_printf(my_file, "The BLUE key is contained in object %hu (a %s %s) in segment %i\n", static_cast<uint16_t>(i), object_types(i), Robot_names[get_robot_id(&Objects[i])], Objects[i].segnum);
blue_count2 += Objects[i].contains_count;
break;
case POW_KEY_GOLD:
PHYSFSX_printf(my_file, "The GOLD key is contained in object %hu (a %s %s) in segment %i\n", static_cast<uint16_t>(i), Object_type_names[Objects[i].type], Robot_names[get_robot_id(&Objects[i])], Objects[i].segnum);
PHYSFSX_printf(my_file, "The GOLD key is contained in object %hu (a %s %s) in segment %i\n", static_cast<uint16_t>(i), object_types(i), Robot_names[get_robot_id(&Objects[i])], Objects[i].segnum);
gold_count2 += Objects[i].contains_count;
break;
case POW_KEY_RED:
PHYSFSX_printf(my_file, "The RED key is contained in object %hu (a %s %s) in segment %i\n", static_cast<uint16_t>(i), Object_type_names[Objects[i].type], Robot_names[get_robot_id(&Objects[i])], Objects[i].segnum);
PHYSFSX_printf(my_file, "The RED key is contained in object %hu (a %s %s) in segment %i\n", static_cast<uint16_t>(i), object_types(i), Robot_names[get_robot_id(&Objects[i])], Objects[i].segnum);
red_count2 += Objects[i].contains_count;
break;
default:

View file

@ -987,6 +987,7 @@ fcd_done1: ;
static sbyte convert_to_byte(fix f)
{
const uint8_t MATRIX_MAX = 0x7f; // This is based on MATRIX_PRECISION, 9 => 0x7f
if (f >= 0x00010000)
return MATRIX_MAX;
else if (f <= -0x00010000)

View file

@ -127,10 +127,10 @@ int print_object_info = 0;
//--unused-- int Player_controller_type = 0;
window_rendered_data Window_rendered_data[MAX_RENDERED_WINDOWS];
array<window_rendered_data, MAX_RENDERED_WINDOWS> Window_rendered_data;
#if defined(EDITOR) || !defined(NDEBUG)
const char Object_type_names[MAX_OBJECT_TYPES][9] = {
const array<array<char, 9>, MAX_OBJECT_TYPES> Object_type_names{{
"WALL ",
"FIREBALL",
"ROBOT ",
@ -149,7 +149,7 @@ const char Object_type_names[MAX_OBJECT_TYPES][9] = {
#if defined(DXX_BUILD_DESCENT_II)
"MARKER ",
#endif
};
}};
#endif
#ifndef RELEASE
@ -974,7 +974,7 @@ Unused_object_slots=0;
//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
void obj_free(objnum_t objnum)
static void obj_free(objnum_t objnum)
{
free_obj_list[--num_objects] = objnum;
Assert(num_objects >= 0);
@ -1536,7 +1536,7 @@ static void start_player_death_sequence(const vobjptr_t player)
}
// ------------------------------------------------------------------------------------------------------------------
void obj_delete_all_that_should_be_dead()
static void obj_delete_all_that_should_be_dead()
{
objnum_t local_dead_player_object=object_none;
@ -1618,7 +1618,7 @@ int Drop_afterburner_blob_flag; //ugly hack
//--------------------------------------------------------------------
//move an object for the current frame
void object_move_one(const vobjptridx_t obj)
static void object_move_one(const vobjptridx_t obj)
{
int previous_segment = obj->segnum;