Use helper for robot weapon type
This commit is contained in:
parent
c45f93b503
commit
31d538ebe2
|
@ -31,94 +31,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#ifdef __cplusplus
|
||||
#include "segnum.h"
|
||||
#include "fwd-object.h"
|
||||
|
||||
enum weapon_type_t
|
||||
{
|
||||
LASER_ID_L1,
|
||||
LASER_ID = LASER_ID_L1, //0..3 are lasers
|
||||
LASER_ID_L2,
|
||||
LASER_ID_L3,
|
||||
LASER_ID_L4,
|
||||
CLS1_DRONE_FIRE = 5,
|
||||
CONTROLCEN_WEAPON_NUM = 6,
|
||||
CONCUSSION_ID = 8,
|
||||
FLARE_ID = 9, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
CLS2_DRONE_LASER = 10,
|
||||
VULCAN_ID = 11, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
SPREADFIRE_ID = 12, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
#endif
|
||||
PLASMA_ID = 13, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
FUSION_ID = 14, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
HOMING_ID = 15,
|
||||
PROXIMITY_ID = 16,
|
||||
SMART_ID = 17,
|
||||
MEGA_ID = 18,
|
||||
|
||||
PLAYER_SMART_HOMING_ID = 19,
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
SPREADFIRE_ID = 20,
|
||||
#endif
|
||||
SUPER_MECH_MISS = 21,
|
||||
REGULAR_MECH_MISS = 22,
|
||||
SILENT_SPREADFIRE_ID = 23,
|
||||
MEDIUM_LIFTER_LASER = 24,
|
||||
SMALL_HULK_FIRE = 25,
|
||||
HEAVY_DRILLER_PLASMA = 26,
|
||||
SPIDER_ROBOT_FIRE = 27,
|
||||
ROBOT_MEGA_ID = 28,
|
||||
ROBOT_SMART_HOMING_ID = 29,
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
SUPER_LASER_ID = 30, // 30,31 are super lasers (level 5,6)
|
||||
LASER_ID_L5 = SUPER_LASER_ID,
|
||||
LASER_ID_L6,
|
||||
|
||||
GAUSS_ID = 32, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
HELIX_ID = 33, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
PHOENIX_ID = 34, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
OMEGA_ID = 35, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
|
||||
FLASH_ID = 36,
|
||||
GUIDEDMISS_ID = 37,
|
||||
SUPERPROX_ID = 38,
|
||||
MERCURY_ID = 39,
|
||||
EARTHSHAKER_ID = 40,
|
||||
SMELTER_PHOENIX_ID = 44,
|
||||
|
||||
SMART_MINE_HOMING_ID = 47,
|
||||
BPER_PHASE_ENERGY_ID = 48,
|
||||
ROBOT_SMART_MINE_HOMING_ID = 49,
|
||||
ROBOT_SUPERPROX_ID = 53,
|
||||
EARTHSHAKER_MEGA_ID = 54,
|
||||
ROBOT_EARTHSHAKER_ID = 58,
|
||||
|
||||
PMINE_ID = 51, //the mine that the designers can place
|
||||
|
||||
ROBOT_26_WEAPON_46_ID = 46,
|
||||
ROBOT_27_WEAPON_52_ID = 52,
|
||||
ROBOT_28_WEAPON_42_ID = 42,
|
||||
ROBOT_29_WEAPON_20_ID = 20,
|
||||
ROBOT_30_WEAPON_48_ID = 48,
|
||||
ROBOT_36_WEAPON_41_ID = 41,
|
||||
ROBOT_37_WEAPON_41_ID = 41,
|
||||
ROBOT_38_WEAPON_42_ID = 42,
|
||||
ROBOT_39_WEAPON_43_ID = 43,
|
||||
ROBOT_43_WEAPON_55_ID = 55,
|
||||
ROBOT_45_WEAPON_45_ID = 45,
|
||||
ROBOT_46_WEAPON_55_ID = 55,
|
||||
ROBOT_47_WEAPON_26_ID = 26,
|
||||
ROBOT_50_WEAPON_50_ID = 50,
|
||||
ROBOT_52_WEAPON_52_ID = 52,
|
||||
ROBOT_53_WEAPON_45_ID = 45,
|
||||
ROBOT_55_WEAPON_44_ID = 44,
|
||||
ROBOT_57_WEAPON_44_ID = 44,
|
||||
ROBOT_59_WEAPON_48_ID = 48,
|
||||
ROBOT_62_WEAPON_60_ID = 60,
|
||||
ROBOT_47_WEAPON_57_ID = 57,
|
||||
ROBOT_62_WEAPON_61_ID = 61,
|
||||
ROBOT_71_WEAPON_62_ID = 62, // M.A.X. homing flash missile
|
||||
#endif
|
||||
};
|
||||
#include "weapon_id.h"
|
||||
|
||||
// These are new defines for the value of 'flags' passed to do_laser_firing.
|
||||
// The purpose is to collect other flags like QUAD_LASER and Spreadfire_toggle
|
||||
|
@ -149,7 +62,7 @@ extern void calc_d_homer_tick();
|
|||
|
||||
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
||||
void Laser_render(vobjptr_t obj);
|
||||
objptridx_t Laser_player_fire(vobjptridx_t obj, enum weapon_type_t laser_type, int gun_num, int make_sound, vms_vector shot_orientation);
|
||||
objptridx_t Laser_player_fire(vobjptridx_t obj, weapon_id_type laser_type, int gun_num, int make_sound, vms_vector shot_orientation);
|
||||
void Laser_do_weapon_sequence(vobjptridx_t obj);
|
||||
void Flare_create(vobjptridx_t obj);
|
||||
bool laser_are_related(vcobjptridx_t o1, vcobjptridx_t o2);
|
||||
|
@ -159,7 +72,7 @@ extern void do_missile_firing(int drop_bomb);
|
|||
extern void net_missile_firing(int player, int weapon, int flags);
|
||||
extern objnum_t Network_laser_track;
|
||||
|
||||
objptridx_t Laser_create_new(const vms_vector &direction, const vms_vector &position, segnum_t segnum, vobjptridx_t parent, enum weapon_type_t type, int make_sound);
|
||||
objptridx_t Laser_create_new(const vms_vector &direction, const vms_vector &position, segnum_t segnum, vobjptridx_t parent, weapon_id_type type, int make_sound);
|
||||
|
||||
// Fires a laser-type weapon (a Primary weapon)
|
||||
// Fires from object objnum, weapon type weapon_id.
|
||||
|
@ -177,7 +90,7 @@ int do_laser_firing(vobjptridx_t objnum, int weapon_id, int level, int flags, in
|
|||
// direction "direction" from the position "position"
|
||||
// Returns object number of laser fired or -1 if not possible to fire
|
||||
// laser.
|
||||
objptridx_t Laser_create_new_easy(const vms_vector &direction, const vms_vector &position, vobjptridx_t parent, enum weapon_type_t weapon_type, int make_sound);
|
||||
objptridx_t Laser_create_new_easy(const vms_vector &direction, const vms_vector &position, vobjptridx_t parent, weapon_id_type weapon_type, int make_sound);
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
// give up control of the guided missile
|
||||
|
@ -213,7 +126,7 @@ extern array<muzzle_info, MUZZLE_QUEUE_MAX> Muzzle_data;
|
|||
void omega_charge_frame(void);
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
||||
static inline int is_proximity_bomb_or_smart_mine(enum weapon_type_t id)
|
||||
static inline int is_proximity_bomb_or_smart_mine(weapon_id_type id)
|
||||
{
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
if (id == SUPERPROX_ID)
|
||||
|
@ -222,7 +135,7 @@ static inline int is_proximity_bomb_or_smart_mine(enum weapon_type_t id)
|
|||
return id == PROXIMITY_ID;
|
||||
}
|
||||
|
||||
static inline int is_proximity_bomb_or_smart_mine_or_placed_mine(enum weapon_type_t id)
|
||||
static inline int is_proximity_bomb_or_smart_mine_or_placed_mine(weapon_id_type id)
|
||||
{
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
if (id == SUPERPROX_ID || id == PMINE_ID)
|
||||
|
|
|
@ -466,9 +466,9 @@ static inline uint8_t get_marker_id(const object &o)
|
|||
return o.id;
|
||||
}
|
||||
|
||||
static inline weapon_type_t get_weapon_id(const object &o)
|
||||
static inline weapon_id_type get_weapon_id(const object &o)
|
||||
{
|
||||
return static_cast<weapon_type_t>(o.id);
|
||||
return static_cast<weapon_id_type>(o.id);
|
||||
}
|
||||
|
||||
static inline void set_hostage_id(object &o, ubyte id)
|
||||
|
@ -493,7 +493,7 @@ static inline void set_robot_id(object &o, ubyte id)
|
|||
o.id = id;
|
||||
}
|
||||
|
||||
static inline void set_weapon_id(object &o, weapon_type_t id)
|
||||
static inline void set_weapon_id(object &o, weapon_id_type id)
|
||||
{
|
||||
o.id = id;
|
||||
}
|
||||
|
|
|
@ -74,35 +74,27 @@ struct jointlist
|
|||
struct robot_info : prohibit_void_ptr<robot_info>
|
||||
{
|
||||
int model_num; // which polygon model?
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
int n_guns; // how many different gun positions
|
||||
#endif
|
||||
array<vms_vector, MAX_GUNS> gun_points; // where each gun model is
|
||||
array<uint8_t, MAX_GUNS> gun_submodels; // which submodel is each gun in?
|
||||
uint16_t score_value; // Score from this robot.
|
||||
short exp1_vclip_num;
|
||||
short exp1_sound_num;
|
||||
short exp2_vclip_num;
|
||||
short exp2_sound_num;
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
short weapon_type;
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
sbyte weapon_type;
|
||||
sbyte weapon_type2; // Secondary weapon number, -1 means none, otherwise gun #0 fires this weapon.
|
||||
sbyte n_guns; // how many different gun positions
|
||||
#endif
|
||||
uint8_t weapon_type;
|
||||
uint8_t n_guns; // how many different gun positions
|
||||
sbyte contains_id; // ID of powerup this robot can contain.
|
||||
|
||||
sbyte contains_count; // Max number of things this instance can contain.
|
||||
sbyte contains_prob; // Probability that this instance will contain something in N/16
|
||||
sbyte contains_type; // Type of thing contained, robot or powerup, in bitmaps.tbl, !0=robot, 0=powerup
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
int score_value; // Score from this robot.
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
sbyte kamikaze; // !0 means commits suicide when hits you, strength thereof. 0 means no.
|
||||
|
||||
short score_value; // Score from this robot.
|
||||
sbyte badass; // Dies with badass explosion, and strength thereof, 0 means NO.
|
||||
sbyte energy_drain; // Points of energy drained at each collision.
|
||||
uint8_t weapon_type2; // Secondary weapon number, -1 means none, otherwise gun #0 fires this weapon.
|
||||
#endif
|
||||
fix lighting; // should this be here or with polygon model?
|
||||
fix strength; // Initial shields of robot
|
||||
|
@ -153,7 +145,7 @@ struct robot_info : prohibit_void_ptr<robot_info>
|
|||
int always_0xabcd; // debugging
|
||||
};
|
||||
|
||||
const int weapon_none = -1;
|
||||
const uint8_t weapon_none = 0xff;
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
#define MAX_ROBOT_TYPES 30 // maximum number of robot types
|
||||
|
@ -236,6 +228,7 @@ void robot_info_read(PHYSFS_File *fp, robot_info &r);
|
|||
void jointpos_read(PHYSFS_file *fp, jointpos &jp);
|
||||
void jointpos_write(PHYSFS_file *fp, const jointpos &jp);
|
||||
void robot_set_angles(robot_info *r,polymodel *pm, array<array<vms_angvec, MAX_SUBMODELS>, N_ANIM_STATES> &angs);
|
||||
uint8_t get_robot_weapon(const robot_info &ri, const unsigned gun_num);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
101
common/main/weapon_id.h
Normal file
101
common/main/weapon_id.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* 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 <cstdint>
|
||||
|
||||
enum weapon_id_type : uint8_t
|
||||
{
|
||||
LASER_ID_L1,
|
||||
LASER_ID = LASER_ID_L1, //0..3 are lasers
|
||||
LASER_ID_L2,
|
||||
LASER_ID_L3,
|
||||
LASER_ID_L4,
|
||||
CLS1_DRONE_FIRE = 5,
|
||||
CONTROLCEN_WEAPON_NUM = 6,
|
||||
CONCUSSION_ID = 8,
|
||||
FLARE_ID = 9, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
CLS2_DRONE_LASER = 10,
|
||||
VULCAN_ID = 11, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
SPREADFIRE_ID = 12, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
#endif
|
||||
PLASMA_ID = 13, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
FUSION_ID = 14, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
HOMING_ID = 15,
|
||||
PROXIMITY_ID = 16,
|
||||
SMART_ID = 17,
|
||||
MEGA_ID = 18,
|
||||
|
||||
PLAYER_SMART_HOMING_ID = 19,
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
SPREADFIRE_ID = 20,
|
||||
#endif
|
||||
SUPER_MECH_MISS = 21,
|
||||
REGULAR_MECH_MISS = 22,
|
||||
SILENT_SPREADFIRE_ID = 23,
|
||||
MEDIUM_LIFTER_LASER = 24,
|
||||
SMALL_HULK_FIRE = 25,
|
||||
HEAVY_DRILLER_PLASMA = 26,
|
||||
SPIDER_ROBOT_FIRE = 27,
|
||||
ROBOT_MEGA_ID = 28,
|
||||
ROBOT_SMART_HOMING_ID = 29,
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
SUPER_LASER_ID = 30, // 30,31 are super lasers (level 5,6)
|
||||
LASER_ID_L5 = SUPER_LASER_ID,
|
||||
LASER_ID_L6,
|
||||
|
||||
GAUSS_ID = 32, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
HELIX_ID = 33, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
PHOENIX_ID = 34, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
OMEGA_ID = 35, // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
|
||||
|
||||
FLASH_ID = 36,
|
||||
GUIDEDMISS_ID = 37,
|
||||
SUPERPROX_ID = 38,
|
||||
MERCURY_ID = 39,
|
||||
EARTHSHAKER_ID = 40,
|
||||
SMELTER_PHOENIX_ID = 44,
|
||||
|
||||
SMART_MINE_HOMING_ID = 47,
|
||||
BPER_PHASE_ENERGY_ID = 48,
|
||||
ROBOT_SMART_MINE_HOMING_ID = 49,
|
||||
ROBOT_SUPERPROX_ID = 53,
|
||||
EARTHSHAKER_MEGA_ID = 54,
|
||||
ROBOT_EARTHSHAKER_ID = 58,
|
||||
|
||||
PMINE_ID = 51, //the mine that the designers can place
|
||||
|
||||
ROBOT_26_WEAPON_46_ID = 46,
|
||||
ROBOT_27_WEAPON_52_ID = 52,
|
||||
ROBOT_28_WEAPON_42_ID = 42,
|
||||
ROBOT_29_WEAPON_20_ID = 20,
|
||||
ROBOT_30_WEAPON_48_ID = 48,
|
||||
ROBOT_36_WEAPON_41_ID = 41,
|
||||
ROBOT_37_WEAPON_41_ID = 41,
|
||||
ROBOT_38_WEAPON_42_ID = 42,
|
||||
ROBOT_39_WEAPON_43_ID = 43,
|
||||
ROBOT_43_WEAPON_55_ID = 55,
|
||||
ROBOT_45_WEAPON_45_ID = 45,
|
||||
ROBOT_46_WEAPON_55_ID = 55,
|
||||
ROBOT_47_WEAPON_26_ID = 26,
|
||||
ROBOT_50_WEAPON_50_ID = 50,
|
||||
ROBOT_52_WEAPON_52_ID = 52,
|
||||
ROBOT_53_WEAPON_45_ID = 45,
|
||||
ROBOT_55_WEAPON_44_ID = 44,
|
||||
ROBOT_57_WEAPON_44_ID = 44,
|
||||
ROBOT_59_WEAPON_48_ID = 48,
|
||||
ROBOT_62_WEAPON_60_ID = 60,
|
||||
ROBOT_47_WEAPON_57_ID = 57,
|
||||
ROBOT_62_WEAPON_61_ID = 61,
|
||||
ROBOT_71_WEAPON_62_ID = 62, // M.A.X. homing flash missile
|
||||
#endif
|
||||
unspecified = 0xff,
|
||||
};
|
||||
|
|
@ -321,6 +321,17 @@ static const sbyte Ai_transition_table[AI_MAX_EVENT][AI_MAX_STATE][AI_MAX_STATE]
|
|||
}
|
||||
};
|
||||
|
||||
uint8_t get_robot_weapon(const robot_info &ri, const unsigned gun_num)
|
||||
{
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
(void)gun_num;
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
if (ri.weapon_type2 != weapon_none && !gun_num)
|
||||
return ri.weapon_type2;
|
||||
#endif
|
||||
return ri.weapon_type;
|
||||
}
|
||||
|
||||
static int ready_to_fire_weapon1(const ai_local *ailp, fix threshold)
|
||||
{
|
||||
return (ailp->next_fire <= threshold);
|
||||
|
@ -964,7 +975,6 @@ static int lead_player(const vobjptr_t objp, const vms_vector &fire_point, const
|
|||
{
|
||||
fix dot, player_speed, dist_to_player, max_weapon_speed, projected_time;
|
||||
vms_vector player_movement_dir;
|
||||
int weapon_type;
|
||||
weapon_info *wptr;
|
||||
robot_info *robptr;
|
||||
|
||||
|
@ -989,10 +999,7 @@ static int lead_player(const vobjptr_t objp, const vms_vector &fire_point, const
|
|||
|
||||
// Looks like it might be worth trying to lead the player.
|
||||
robptr = &Robot_info[get_robot_id(objp)];
|
||||
weapon_type = robptr->weapon_type;
|
||||
if (robptr->weapon_type2 != weapon_none)
|
||||
if (gun_num == 0)
|
||||
weapon_type = robptr->weapon_type2;
|
||||
const auto weapon_type = get_robot_weapon(*robptr, gun_num);
|
||||
|
||||
wptr = &Weapon_info[weapon_type];
|
||||
max_weapon_speed = wptr->speed[Difficulty_level];
|
||||
|
@ -1190,15 +1197,9 @@ static void ai_fire_laser_at_player(const vobjptridx_t obj, const vms_vector &fi
|
|||
player_led: ;
|
||||
#endif
|
||||
|
||||
int weapon_type;
|
||||
weapon_type = robptr->weapon_type;
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
if (robptr->weapon_type2 != weapon_none)
|
||||
if (gun_num == 0)
|
||||
weapon_type = robptr->weapon_type2;
|
||||
#endif
|
||||
const auto weapon_type = get_robot_weapon(*robptr, gun_num);
|
||||
|
||||
Laser_create_new_easy( fire_vec, fire_point, obj, static_cast<weapon_type_t>(weapon_type), 1);
|
||||
Laser_create_new_easy( fire_vec, fire_point, obj, static_cast<weapon_id_type>(weapon_type), 1);
|
||||
|
||||
if (Game_mode & GM_MULTI)
|
||||
{
|
||||
|
|
|
@ -1892,7 +1892,7 @@ void drop_player_eggs(const vobjptridx_t playerobj)
|
|||
auto &secondary_ammo = playerobj->ctype.player_info.secondary_ammo;
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
// If the player had smart mines, maybe arm one of them.
|
||||
const auto drop_armed_bomb = [&](uint8_t mines, weapon_type_t id) {
|
||||
const auto drop_armed_bomb = [&](uint8_t mines, weapon_id_type id) {
|
||||
mines %= 4;
|
||||
for (int rthresh = 30000; mines && d_rand() < rthresh; rthresh /= 2)
|
||||
{
|
||||
|
|
|
@ -426,7 +426,7 @@ static void clear_missile_viewer()
|
|||
}
|
||||
|
||||
__attribute_warn_unused_result
|
||||
static bool is_viewable_missile(weapon_type_t laser_type)
|
||||
static bool is_viewable_missile(weapon_id_type laser_type)
|
||||
{
|
||||
return laser_type == CONCUSSION_ID ||
|
||||
laser_type == HOMING_ID ||
|
||||
|
|
|
@ -636,7 +636,7 @@ static void do_omega_stuff(const vobjptridx_t parent_objp, const vms_vector &fir
|
|||
}
|
||||
#endif
|
||||
|
||||
static inline int is_laser_weapon_type(enum weapon_type_t weapon_type)
|
||||
static inline int is_laser_weapon_type(weapon_id_type weapon_type)
|
||||
{
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
if (weapon_type == LASER_ID_L5 || weapon_type == LASER_ID_L6)
|
||||
|
@ -648,7 +648,7 @@ static inline int is_laser_weapon_type(enum weapon_type_t weapon_type)
|
|||
// ---------------------------------------------------------------------------------
|
||||
// Initializes a laser after Fire is pressed
|
||||
// Returns object number.
|
||||
objptridx_t Laser_create_new(const vms_vector &direction, const vms_vector &position, segnum_t segnum, const vobjptridx_t parent, enum weapon_type_t weapon_type, int make_sound )
|
||||
objptridx_t Laser_create_new(const vms_vector &direction, const vms_vector &position, segnum_t segnum, const vobjptridx_t parent, weapon_id_type weapon_type, int make_sound )
|
||||
{
|
||||
fix parent_speed, weapon_speed;
|
||||
fix volume;
|
||||
|
@ -950,7 +950,7 @@ objptridx_t Laser_create_new(const vms_vector &direction, const vms_vector &posi
|
|||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
// Calls Laser_create_new, but takes care of the segment and point computation for you.
|
||||
objptridx_t Laser_create_new_easy(const vms_vector &direction, const vms_vector &position, const vobjptridx_t parent, enum weapon_type_t weapon_type, int make_sound )
|
||||
objptridx_t Laser_create_new_easy(const vms_vector &direction, const vms_vector &position, const vobjptridx_t parent, weapon_id_type weapon_type, int make_sound )
|
||||
{
|
||||
fvi_query fq;
|
||||
fvi_info hit_data;
|
||||
|
@ -1287,7 +1287,7 @@ static objptridx_t track_track_goal(const objptridx_t track_goal, const vobjptri
|
|||
|
||||
//-------------- Initializes a laser after Fire is pressed -----------------
|
||||
|
||||
static objptridx_t Laser_player_fire_spread_delay(const vobjptridx_t obj, enum weapon_type_t laser_type, int gun_num, fix spreadr, fix spreadu, fix delay_time, int make_sound, vms_vector shot_orientation)
|
||||
static objptridx_t Laser_player_fire_spread_delay(const vobjptridx_t obj, weapon_id_type laser_type, int gun_num, fix spreadr, fix spreadu, fix delay_time, int make_sound, vms_vector shot_orientation)
|
||||
{
|
||||
int Fate;
|
||||
vms_vector LaserDir;
|
||||
|
@ -1448,14 +1448,14 @@ static objptridx_t Laser_player_fire_spread_delay(const vobjptridx_t obj, enum w
|
|||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
static objptridx_t Laser_player_fire_spread(const vobjptridx_t obj, enum weapon_type_t laser_type, int gun_num, fix spreadr, fix spreadu, int make_sound, vms_vector shot_orientation)
|
||||
static objptridx_t Laser_player_fire_spread(const vobjptridx_t obj, weapon_id_type laser_type, int gun_num, fix spreadr, fix spreadu, int make_sound, vms_vector shot_orientation)
|
||||
{
|
||||
return Laser_player_fire_spread_delay(obj, laser_type, gun_num, spreadr, spreadu, 0, make_sound, shot_orientation);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
objptridx_t Laser_player_fire(const vobjptridx_t obj, enum weapon_type_t laser_type, int gun_num, int make_sound, vms_vector shot_orientation)
|
||||
objptridx_t Laser_player_fire(const vobjptridx_t obj, weapon_id_type laser_type, int gun_num, int make_sound, vms_vector shot_orientation)
|
||||
{
|
||||
return Laser_player_fire_spread(obj, laser_type, gun_num, 0, 0, make_sound, shot_orientation);
|
||||
}
|
||||
|
@ -1851,7 +1851,7 @@ int do_laser_firing(vobjptridx_t objp, int weapon_num, int level, int flags, int
|
|||
{
|
||||
switch (weapon_num) {
|
||||
case primary_weapon_index_t::LASER_INDEX: {
|
||||
enum weapon_type_t weapon_type;
|
||||
weapon_id_type weapon_type;
|
||||
|
||||
switch(level)
|
||||
{
|
||||
|
@ -2024,7 +2024,7 @@ const vm_distance_squared MAX_SMART_DISTANCE_SQUARED = MAX_SMART_DISTANCE * MAX_
|
|||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
// if goal_obj == -1, then create random vector
|
||||
static objptridx_t create_homing_missile(const vobjptridx_t objp, const objptridx_t goal_obj, enum weapon_type_t objtype, int make_sound)
|
||||
static objptridx_t create_homing_missile(const vobjptridx_t objp, const objptridx_t goal_obj, weapon_id_type objtype, int make_sound)
|
||||
{
|
||||
vms_vector vector_to_goal;
|
||||
//vms_vector goal_pos;
|
||||
|
@ -2067,7 +2067,7 @@ struct miniparent
|
|||
static void create_smart_children(const vobjptridx_t objp, const uint_fast32_t num_smart_children, const miniparent parent)
|
||||
{
|
||||
unsigned numobjs = 0;
|
||||
enum weapon_type_t blob_id;
|
||||
weapon_id_type blob_id;
|
||||
|
||||
array<objnum_t, MAX_OBJDISTS> objlist;
|
||||
{
|
||||
|
@ -2132,8 +2132,8 @@ static void create_smart_children(const vobjptridx_t objp, const uint_fast32_t n
|
|||
}
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
if (objp->type == OBJ_WEAPON) {
|
||||
blob_id = (enum weapon_type_t) Weapon_info[get_weapon_id(objp)].children;
|
||||
Assert(blob_id != -1); // Hmm, missing data in bitmaps.tbl. Need "children=NN" parameter.
|
||||
blob_id = (weapon_id_type) Weapon_info[get_weapon_id(objp)].children;
|
||||
Assert(blob_id != weapon_none); // Hmm, missing data in bitmaps.tbl. Need "children=NN" parameter.
|
||||
} else {
|
||||
Assert(objp->type == OBJ_ROBOT);
|
||||
blob_id = ROBOT_SMART_HOMING_ID;
|
||||
|
@ -2236,12 +2236,12 @@ void do_missile_firing(int drop_bomb)
|
|||
if (auto &secondary_weapon_ammo = get_local_player_secondary_ammo()[weapon])
|
||||
{
|
||||
|
||||
enum weapon_type_t weapon_index;
|
||||
weapon_id_type weapon_index;
|
||||
int weapon_gun;
|
||||
|
||||
-- secondary_weapon_ammo;
|
||||
|
||||
weapon_index = (enum weapon_type_t) Secondary_weapon_to_weapon_info[weapon];
|
||||
weapon_index = (weapon_id_type) Secondary_weapon_to_weapon_info[weapon];
|
||||
|
||||
if (!cheats.rapidfire)
|
||||
Next_missile_fire_time = GameTime64 + Weapon_info[weapon_index].fire_wait - fire_frame_overhead;
|
||||
|
|
|
@ -1559,7 +1559,7 @@ static void multi_do_fire(const playernum_t pnum, const ubyte *buf)
|
|||
else
|
||||
if (weapon >= MISSILE_ADJUST) {
|
||||
int weapon_gun,remote_objnum;
|
||||
enum weapon_type_t weapon_id = (enum weapon_type_t) Secondary_weapon_to_weapon_info[weapon-MISSILE_ADJUST];
|
||||
weapon_id_type weapon_id = (weapon_id_type) Secondary_weapon_to_weapon_info[weapon-MISSILE_ADJUST];
|
||||
weapon_gun = Secondary_weapon_to_gun_num[weapon-MISSILE_ADJUST] + (flags & 1);
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
|
|
|
@ -842,18 +842,18 @@ multi_do_robot_fire(const ubyte *buf)
|
|||
{
|
||||
// Drop proximity bombs
|
||||
const auto gun_point = vm_vec_add(botp->pos, fire);
|
||||
if (gun_num == -1)
|
||||
Laser_create_new_easy( fire, gun_point, botp, PROXIMITY_ID, 1);
|
||||
const auto weapon_id =
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
else
|
||||
Laser_create_new_easy( fire, gun_point, botp, SUPERPROX_ID, 1);
|
||||
gun_num != -1 ? SUPERPROX_ID :
|
||||
#endif
|
||||
PROXIMITY_ID;
|
||||
Laser_create_new_easy( fire, gun_point, botp, weapon_id, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto gun_point = calc_gun_point(botp, gun_num);
|
||||
robptr = &Robot_info[get_robot_id(botp)];
|
||||
Laser_create_new_easy( fire, gun_point, botp, (enum weapon_type_t) robptr->weapon_type, 1);
|
||||
Laser_create_new_easy( fire, gun_point, botp, (weapon_id_type) get_robot_weapon(*robptr, 1), 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue