Merge branch 'd1x-rebirth/master' into unification/master

This commit is contained in:
Kp 2013-06-02 20:13:38 +00:00
commit 306ab24486
14 changed files with 72 additions and 66 deletions

View file

@ -70,7 +70,7 @@ typedef struct {
ubyte r,g,b;
} rgb;
extern rgb player_rgb[];
extern const rgb player_rgb[];
#if defined(DXX_BUILD_DESCENT_II)
#define WBU_WEAPON 0 // the weapons display

View file

@ -196,7 +196,7 @@ void calc_gun_point(vms_vector *gun_point,struct object *obj,int gun_num);
// On exit:
// Returns number of joints in list.
// jp_list_ptr is stuffed with a pointer to a static array of joint positions. This pointer is valid forever.
extern int robot_get_anim_state(jointpos **jp_list_ptr,int robot_type,int gun_num,int state);
extern int robot_get_anim_state(const jointpos **jp_list_ptr,int robot_type,int gun_num,int state);
/*
* reads n robot_info structs from a PHYSFS_file

View file

@ -345,7 +345,6 @@ void hostage_close_window()
int hostage_dialog_handler(UI_DIALOG *dlg, d_event *event, hostage_dialog *h)
{
fix DeltaTime;
fix64 Temp;
int keypress = 0;
int rval = 0;
@ -392,7 +391,6 @@ int hostage_dialog_handler(UI_DIALOG *dlg, d_event *event, hostage_dialog *h)
// A simple frame time counter for spinning the objects...
Temp = timer_query();
DeltaTime = Temp - h->time;
h->time = Temp;
if (CurrentHostageIndex > -1 ) {

View file

@ -545,7 +545,7 @@ int player_is_visible_from_object(object *objp, vms_vector *pos, fix field_of_vi
int do_silly_animation(object *objp)
{
int objnum = objp-Objects;
jointpos *jp_list;
const jointpos *jp_list;
int robot_type, gun_num, robot_state, num_joint_positions;
polyobj_info *pobj_info = &objp->rtype.pobj_info;
ai_static *aip = &objp->ctype.ai_info;
@ -580,7 +580,7 @@ int do_silly_animation(object *objp)
for (joint=0; joint<num_joint_positions; joint++) {
fix delta_angle, delta_2;
int jointnum = jp_list[joint].jointnum;
vms_angvec *jp = &jp_list[joint].angles;
const vms_angvec *jp = &jp_list[joint].angles;
vms_angvec *pobjp = &pobj_info->anim_angles[jointnum];
if (jointnum >= Polygon_models[objp->rtype.pobj_info.model_num].n_models) {

View file

@ -1753,11 +1753,12 @@ void bm_read_hostage()
void bm_read_hostage_face(int skip, int pc_shareware)
{
char *abm_name,*equal_ptr;
int clip_num=-1,sound_num=-1;
fix time=0;
char *equal_ptr;
#ifndef NDEBUG
int clip_num=-1;
#endif
abm_name = strtok( NULL, space );
strtok( NULL, space );
arg = strtok( NULL, space );
while (arg!=NULL) {
@ -1768,13 +1769,11 @@ void bm_read_hostage_face(int skip, int pc_shareware)
// if we have john=cool, arg is 'john' and equal_ptr is 'cool'
#ifndef NDEBUG
if (!d_stricmp( arg, "clip_num" )) {
clip_num = atoi(equal_ptr);
} else if (!d_stricmp( arg, "time" )) {
time = fl2f(atof(equal_ptr));
} else if (!d_stricmp( arg, "sound_num" )) {
sound_num = atoi(equal_ptr);
}
#endif
}
arg = strtok( NULL, space );

View file

@ -214,19 +214,25 @@ object *explode_badass_weapon(object *obj,vms_vector *pos)
}
//blows up the player with a badass explosion
//return the explosion object
object *explode_badass_player(object *objp)
object *explode_badass_object(object *objp, fix damage, fix distance, fix force)
{
object *rval;
rval = object_create_badass_explosion(objp, objp->segnum, &objp->pos, objp->size,
get_explosion_vclip(objp, 0),
F1_0*50, F1_0*40, F1_0*150,
damage, distance, force,
objp-Objects);
if (rval)
digi_link_sound_to_object(SOUND_BADASS_EXPLOSION, rval-Objects, 0, F1_0);
return (rval);
}
//blows up the player with a badass explosion
//return the explosion object
object *explode_badass_player(object *objp)
{
return explode_badass_object(objp, F1_0*50, F1_0*40, F1_0*150);
}
@ -655,28 +661,26 @@ void maybe_replace_powerup_with_energy(object *del_obj)
}
}
// ------------------------------------------------------------------------------------------------------
// Returns created object number.
int object_create_egg(object *objp)
int drop_powerup(int type, int id, int num, vms_vector *init_vel, vms_vector *pos, int segnum)
{
int objnum=0, count;
object *obj;
vms_vector new_velocity, new_pos;
fix old_mag;
switch (objp->contains_type) {
switch (type) {
case OBJ_POWERUP:
for (count=0; count<objp->contains_count; count++) {
for (count=0; count<num; count++) {
int rand_scale;
new_velocity = objp->mtype.phys_info.velocity;
old_mag = vm_vec_mag_quick(&objp->mtype.phys_info.velocity);
new_velocity = *init_vel;
old_mag = vm_vec_mag_quick(init_vel);
// We want powerups to move more in network mode.
if ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_ROBOTS)) {
rand_scale = 4;
// extra life powerups are converted to invulnerability in multiplayer, for what is an extra life, anyway?
if (objp->contains_id == POW_EXTRA_LIFE)
objp->contains_id = POW_INVULNERABILITY;
if (id == POW_EXTRA_LIFE)
id = POW_INVULNERABILITY;
} else
rand_scale = 2;
@ -686,10 +690,10 @@ int object_create_egg(object *objp)
// Give keys zero velocity so they can be tracked better in multi
if ((Game_mode & GM_MULTI) && (objp->contains_id >= POW_KEY_BLUE) && (objp->contains_id <= POW_KEY_GOLD))
if ((Game_mode & GM_MULTI) && (id >= POW_KEY_BLUE) && (id <= POW_KEY_GOLD))
vm_vec_zero(&new_velocity);
new_pos = objp->pos;
new_pos = *pos;
// new_pos.x += (d_rand()-16384)*8;
// new_pos.y += (d_rand()-16384)*8;
// new_pos.z += (d_rand()-16384)*8;
@ -704,7 +708,7 @@ int object_create_egg(object *objp)
}
#endif
objnum = obj_create( objp->contains_type, objp->contains_id, objp->segnum, &new_pos, &vmd_identity_matrix, Powerup_info[objp->contains_id].size, CT_POWERUP, MT_PHYSICS, RT_POWERUP);
objnum = obj_create( type, id, segnum, &new_pos, &vmd_identity_matrix, Powerup_info[id].size, CT_POWERUP, MT_PHYSICS, RT_POWERUP);
if (objnum < 0 ) {
Int3();
@ -750,10 +754,10 @@ int object_create_egg(object *objp)
break;
case OBJ_ROBOT:
for (count=0; count<objp->contains_count; count++) {
for (count=0; count<num; count++) {
int rand_scale;
new_velocity = objp->mtype.phys_info.velocity;
old_mag = vm_vec_mag_quick(&objp->mtype.phys_info.velocity);
new_velocity = *init_vel;
old_mag = vm_vec_mag_quick(init_vel);
vm_vec_normalize_quick(&new_velocity);
@ -769,13 +773,13 @@ int object_create_egg(object *objp)
vm_vec_normalize_quick(&new_velocity);
vm_vec_scale(&new_velocity, (F1_0*32 + old_mag) * rand_scale);
new_pos = objp->pos;
new_pos = *pos;
// This is dangerous, could be outside mine.
// new_pos.x += (d_rand()-16384)*8;
// new_pos.y += (d_rand()-16384)*7;
// new_pos.z += (d_rand()-16384)*6;
objnum = obj_create(OBJ_ROBOT, objp->contains_id, objp->segnum, &new_pos, &vmd_identity_matrix, Polygon_models[Robot_info[ObjId[objp->contains_type]].model_num].rad, CT_AI, MT_PHYSICS, RT_POLYOBJ);
objnum = obj_create(OBJ_ROBOT, id, segnum, &new_pos, &vmd_identity_matrix, Polygon_models[Robot_info[ObjId[type]].model_num].rad, CT_AI, MT_PHYSICS, RT_POLYOBJ);
if ( objnum < 0 ) {
Int3();
@ -818,12 +822,22 @@ int object_create_egg(object *objp)
break;
default:
Error("Error: Illegal type (%i) in object spawning.\n", objp->contains_type);
Error("Error: Illegal type (%i) in object spawning.\n", type);
}
return objnum;
}
// ----------------------------------------------------------------------------
// Returns created object number.
// If object dropped by player, set flag.
int object_create_egg(object *objp)
{
int rval;
rval = drop_powerup(objp->contains_type, objp->contains_id, objp->contains_count, &objp->mtype.phys_info.velocity, &objp->pos, objp->segnum);
return rval;
}
#if 0 // implemented differently
// get maximum number of objects of this type,id that may be created
// returns -1 if no maximum

View file

@ -44,10 +44,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define REMOVE_EXT(s) (*(strchr( (s), '.' ))='\0')
struct mtfi mine_top_fileinfo; // Should be same as first two fields below...
struct mfi mine_fileinfo;
struct mh mine_header;
struct me mine_editor;
int CreateDefaultNewSegment();
int load_mine_data_compiled_new(PHYSFS_file *LoadFile);
@ -57,6 +53,10 @@ int load_mine_data_compiled_new(PHYSFS_file *LoadFile);
static char old_tmap_list[MAX_TEXTURES][13];
short tmap_xlate_table[MAX_TEXTURES];
static short tmap_times_used[MAX_TEXTURES];
struct mtfi mine_top_fileinfo; // Should be same as first two fields below...
struct mfi mine_fileinfo;
struct mh mine_header;
struct me mine_editor;
// -----------------------------------------------------------------------------
//loads from an already-open file

View file

@ -116,7 +116,7 @@ void show_framerate()
void show_netplayerinfo()
{
int x=0, y=0, i=0, color=0, eff=0;
char *eff_strings[]={"trashing","really hurting","seriously effecting","hurting","effecting","tarnishing"};
static const char *const eff_strings[]={"trashing","really hurting","seriously effecting","hurting","effecting","tarnishing"};
gr_set_current_canvas(NULL);
gr_set_curfont(GAME_FONT);

View file

@ -1963,7 +1963,7 @@ extern int Missile_gun;
extern int allowed_to_fire_laser(void);
extern int allowed_to_fire_missile(void);
rgb player_rgb[] = { {15,15,23},
const rgb player_rgb[] = { {15,15,23},
{27,0,0},
{0,23,0},
{30,11,31},
@ -1977,9 +1977,9 @@ typedef struct {
} xy;
//offsets for reticle parts: high-big high-sml low-big low-sml
xy cross_offsets[4] = { {-8,-5}, {-4,-2}, {-4,-2}, {-2,-1} };
xy primary_offsets[4] = { {-30,14}, {-16,6}, {-15,6}, {-8, 2} };
xy secondary_offsets[4] = { {-24,2}, {-12,0}, {-12,1}, {-6,-2} };
static const xy cross_offsets[4] = { {-8,-5}, {-4,-2}, {-4,-2}, {-2,-1} };
static const xy primary_offsets[4] = { {-30,14}, {-16,6}, {-15,6}, {-8, 2} };
static const xy secondary_offsets[4] = { {-24,2}, {-12,0}, {-12,1}, {-6,-2} };
//draw the reticle
void show_reticle(int reticle_type, int secondary_display)

View file

@ -2545,7 +2545,6 @@ multi_send_player_explode(char type)
multi_strip_robots(Player_num);
}
extern ubyte Secondary_weapon_to_powerup[], Primary_weapon_to_powerup[];
extern int Proximity_dropped;
/*

View file

@ -1355,7 +1355,7 @@ RetryObjectLoading:
Total_countdown_time = Countdown_timer/F0_5; // we do not need to know this, but it should not be 0 either...
// Restore the AI state
ai_restore_state( fp, 0, swap );
ai_restore_state( fp, version, swap );
// Restore the automap visited info
if ( Highest_segment_index+1 > MAX_SEGMENTS_ORIGINAL )

View file

@ -31,21 +31,21 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "playsave.h"
// Convert primary weapons to indices in Weapon_info array.
ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS] = {0, 11, 12, 13, 14};
ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS] = {8, 15, 16, 17, 18};
const ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS] = {0, 11, 12, 13, 14};
const ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS] = {8, 15, 16, 17, 18};
//for each primary weapon, what kind of powerup gives weapon
ubyte Primary_weapon_to_powerup[MAX_PRIMARY_WEAPONS] = {POW_LASER,POW_VULCAN_WEAPON,POW_SPREADFIRE_WEAPON,POW_PLASMA_WEAPON,POW_FUSION_WEAPON};
const ubyte Primary_weapon_to_powerup[MAX_PRIMARY_WEAPONS] = {POW_LASER,POW_VULCAN_WEAPON,POW_SPREADFIRE_WEAPON,POW_PLASMA_WEAPON,POW_FUSION_WEAPON};
//for each Secondary weapon, what kind of powerup gives weapon
ubyte Secondary_weapon_to_powerup[MAX_SECONDARY_WEAPONS] = {POW_MISSILE_1,POW_HOMING_AMMO_1,POW_PROXIMITY_WEAPON,POW_SMARTBOMB_WEAPON,POW_MEGA_WEAPON};
int Primary_ammo_max[MAX_PRIMARY_WEAPONS] = {0, VULCAN_AMMO_MAX, 0, 0, 0};
ubyte Secondary_ammo_max[MAX_SECONDARY_WEAPONS] = {20, 10, 10, 5, 5};
const ubyte Secondary_weapon_to_powerup[MAX_SECONDARY_WEAPONS] = {POW_MISSILE_1,POW_HOMING_AMMO_1,POW_PROXIMITY_WEAPON,POW_SMARTBOMB_WEAPON,POW_MEGA_WEAPON};
const int Primary_ammo_max[MAX_PRIMARY_WEAPONS] = {0, VULCAN_AMMO_MAX, 0, 0, 0};
const ubyte Secondary_ammo_max[MAX_SECONDARY_WEAPONS] = {20, 10, 10, 5, 5};
weapon_info Weapon_info[MAX_WEAPON_TYPES];
int N_weapon_types=0;
sbyte Primary_weapon, Secondary_weapon;
int POrderList (int num);
int SOrderList (int num);
ubyte DefaultPrimaryOrder[] = { 4, 3, 2, 1, 0, 255 };
ubyte DefaultSecondaryOrder[] = { 4, 3, 1, 0, 255, 2 };
static const ubyte DefaultPrimaryOrder[] = { 4, 3, 2, 1, 0, 255 };
static const ubyte DefaultSecondaryOrder[] = { 4, 3, 1, 0, 255, 2 };
extern ubyte MenuReordering;
// ------------------------------------------------------------------------------------

View file

@ -131,21 +131,17 @@ extern void do_weapon_select(int weapon_num, int secondary_flag);
extern sbyte Primary_weapon, Secondary_weapon;
extern ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS];
extern ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS];
extern const ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS];
extern const ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS];
//for each primary weapon, what kind of powerup gives weapon
extern ubyte Primary_weapon_to_powerup[MAX_SECONDARY_WEAPONS];
extern const ubyte Primary_weapon_to_powerup[MAX_SECONDARY_WEAPONS];
//for each Secondary weapon, what kind of powerup gives weapon
extern ubyte Secondary_weapon_to_powerup[MAX_SECONDARY_WEAPONS];
extern const ubyte Secondary_weapon_to_powerup[MAX_SECONDARY_WEAPONS];
extern void auto_select_weapon(int weapon_type); //parm is primary or secondary
extern void select_weapon(int weapon_num, int secondary_flag, int print_message,int wait_for_rearm);
extern char *Primary_weapon_names_short[];
extern char *Secondary_weapon_names_short[];
extern char *Primary_weapon_names[];
extern char *Secondary_weapon_names[];
extern int Primary_ammo_max[MAX_PRIMARY_WEAPONS];
extern ubyte Secondary_ammo_max[MAX_PRIMARY_WEAPONS];
extern const int Primary_ammo_max[MAX_PRIMARY_WEAPONS];
extern const ubyte Secondary_ammo_max[MAX_PRIMARY_WEAPONS];
#define HAS_WEAPON_FLAG 1
#define HAS_ENERGY_FLAG 2

View file

@ -130,7 +130,7 @@ void calc_gun_point(vms_vector *gun_point,object *obj,int gun_num)
//fills in ptr to list of joints, and returns the number of joints in list
//takes the robot type (object id), gun number, and desired state
int robot_get_anim_state(jointpos **jp_list_ptr,int robot_type,int gun_num,int state)
int robot_get_anim_state(const jointpos **jp_list_ptr,int robot_type,int gun_num,int state)
{
Assert(gun_num <= Robot_info[robot_type].n_guns);