Create struct reactor analogous to D2X
This commit is contained in:
parent
9f5fe33543
commit
c8c1489837
|
@ -217,12 +217,12 @@ void properties_read_cmp(PHYSFS_file * fp)
|
||||||
ObjStrength[i] = PHYSFSX_readFix(fp);
|
ObjStrength[i] = PHYSFSX_readFix(fp);
|
||||||
|
|
||||||
First_multi_bitmap_num = PHYSFSX_readInt(fp);
|
First_multi_bitmap_num = PHYSFSX_readInt(fp);
|
||||||
N_controlcen_guns = PHYSFSX_readInt(fp);
|
Reactors[0].n_guns = PHYSFSX_readInt(fp);
|
||||||
|
|
||||||
for (i = 0; i < MAX_CONTROLCEN_GUNS; i++)
|
for (i = 0; i < MAX_CONTROLCEN_GUNS; i++)
|
||||||
PHYSFSX_readVector(&controlcen_gun_points[i], fp);
|
PHYSFSX_readVector(&Reactors[0].gun_points[i], fp);
|
||||||
for (i = 0; i < MAX_CONTROLCEN_GUNS; i++)
|
for (i = 0; i < MAX_CONTROLCEN_GUNS; i++)
|
||||||
PHYSFSX_readVector(&controlcen_gun_dirs[i], fp);
|
PHYSFSX_readVector(&Reactors[0].gun_dirs[i], fp);
|
||||||
|
|
||||||
exit_modelnum = PHYSFSX_readInt(fp);
|
exit_modelnum = PHYSFSX_readInt(fp);
|
||||||
destroyed_exit_modelnum = PHYSFSX_readInt(fp);
|
destroyed_exit_modelnum = PHYSFSX_readInt(fp);
|
||||||
|
|
|
@ -1224,7 +1224,7 @@ void bm_read_object(int skip)
|
||||||
model_num = load_polygon_model(model_name,n_normal_bitmaps,first_bitmap_num,NULL);
|
model_num = load_polygon_model(model_name,n_normal_bitmaps,first_bitmap_num,NULL);
|
||||||
|
|
||||||
if (type == OL_CONTROL_CENTER)
|
if (type == OL_CONTROL_CENTER)
|
||||||
N_controlcen_guns = read_model_guns(model_name,controlcen_gun_points,controlcen_gun_dirs,NULL);
|
Reactors[0].n_guns = read_model_guns(model_name,Reactors[0].gun_points,Reactors[0].gun_dirs,NULL);
|
||||||
|
|
||||||
if ( model_name_dead )
|
if ( model_name_dead )
|
||||||
Dead_modelnums[model_num] = load_polygon_model(model_name_dead,N_ObjBitmapPtrs-first_bitmap_num_dead,first_bitmap_num_dead,NULL);
|
Dead_modelnums[model_num] = load_polygon_model(model_name_dead,N_ObjBitmapPtrs-first_bitmap_num_dead,first_bitmap_num_dead,NULL);
|
||||||
|
@ -1846,9 +1846,9 @@ void bm_write_all(PHYSFS_file *fp)
|
||||||
|
|
||||||
PHYSFS_write( fp, &First_multi_bitmap_num, sizeof(int), 1);
|
PHYSFS_write( fp, &First_multi_bitmap_num, sizeof(int), 1);
|
||||||
|
|
||||||
PHYSFS_write( fp, &N_controlcen_guns, sizeof(int), 1);
|
PHYSFS_write( fp, &Reactors[0].n_guns, sizeof(int), 1);
|
||||||
PHYSFS_write( fp, controlcen_gun_points, sizeof(vms_vector), MAX_CONTROLCEN_GUNS);
|
PHYSFS_write( fp, Reactors[0].gun_points, sizeof(vms_vector), MAX_CONTROLCEN_GUNS);
|
||||||
PHYSFS_write( fp, controlcen_gun_dirs, sizeof(vms_vector), MAX_CONTROLCEN_GUNS);
|
PHYSFS_write( fp, Reactors[0].gun_dirs, sizeof(vms_vector), MAX_CONTROLCEN_GUNS);
|
||||||
PHYSFS_write( fp, &exit_modelnum, sizeof(int), 1);
|
PHYSFS_write( fp, &exit_modelnum, sizeof(int), 1);
|
||||||
PHYSFS_write( fp, &destroyed_exit_modelnum, sizeof(int), 1);
|
PHYSFS_write( fp, &destroyed_exit_modelnum, sizeof(int), 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,12 +32,10 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
#include "endlevel.h"
|
#include "endlevel.h"
|
||||||
#include "byteswap.h"
|
#include "byteswap.h"
|
||||||
|
|
||||||
vms_vector controlcen_gun_points[MAX_CONTROLCEN_GUNS];
|
reactor Reactors[MAX_REACTORS];
|
||||||
vms_vector controlcen_gun_dirs[MAX_CONTROLCEN_GUNS];
|
|
||||||
|
|
||||||
control_center_triggers ControlCenterTriggers;
|
control_center_triggers ControlCenterTriggers;
|
||||||
|
|
||||||
int N_controlcen_guns;
|
|
||||||
int Control_center_been_hit;
|
int Control_center_been_hit;
|
||||||
int Control_center_player_been_seen;
|
int Control_center_player_been_seen;
|
||||||
int Control_center_next_fire_time;
|
int Control_center_next_fire_time;
|
||||||
|
@ -51,20 +49,21 @@ void do_countdown_frame();
|
||||||
//return the position & orientation of a gun on the control center object
|
//return the position & orientation of a gun on the control center object
|
||||||
void calc_controlcen_gun_point(vms_vector *gun_point,vms_vector *gun_dir,object *obj,int gun_num)
|
void calc_controlcen_gun_point(vms_vector *gun_point,vms_vector *gun_dir,object *obj,int gun_num)
|
||||||
{
|
{
|
||||||
|
reactor *reactor = &Reactors[0];
|
||||||
vms_matrix m;
|
vms_matrix m;
|
||||||
|
|
||||||
Assert(obj->type == OBJ_CNTRLCEN);
|
Assert(obj->type == OBJ_CNTRLCEN);
|
||||||
Assert(obj->render_type==RT_POLYOBJ);
|
Assert(obj->render_type==RT_POLYOBJ);
|
||||||
|
|
||||||
Assert(gun_num < N_controlcen_guns);
|
Assert(gun_num < reactor->n_guns);
|
||||||
|
|
||||||
//instance gun position & orientation
|
//instance gun position & orientation
|
||||||
|
|
||||||
vm_copy_transpose_matrix(&m,&obj->orient);
|
vm_copy_transpose_matrix(&m,&obj->orient);
|
||||||
|
|
||||||
vm_vec_rotate(gun_point,&controlcen_gun_points[gun_num],&m);
|
vm_vec_rotate(gun_point,&reactor->gun_points[gun_num],&m);
|
||||||
vm_vec_add2(gun_point,&obj->pos);
|
vm_vec_add2(gun_point,&obj->pos);
|
||||||
vm_vec_rotate(gun_dir,&controlcen_gun_dirs[gun_num],&m);
|
vm_vec_rotate(gun_dir,&reactor->gun_dirs[gun_num],&m);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -290,9 +289,9 @@ void do_controlcen_frame(object *obj)
|
||||||
|
|
||||||
if ((Control_center_next_fire_time < 0) && !(controlcen_death_silence > F1_0*2)) {
|
if ((Control_center_next_fire_time < 0) && !(controlcen_death_silence > F1_0*2)) {
|
||||||
if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED)
|
if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED)
|
||||||
best_gun_num = calc_best_gun(N_controlcen_guns, Gun_pos, Gun_dir, &Believed_player_pos);
|
best_gun_num = calc_best_gun(Reactors[0].n_guns, Gun_pos, Gun_dir, &Believed_player_pos);
|
||||||
else
|
else
|
||||||
best_gun_num = calc_best_gun(N_controlcen_guns, Gun_pos, Gun_dir, &ConsoleObject->pos);
|
best_gun_num = calc_best_gun(Reactors[0].n_guns, Gun_pos, Gun_dir, &ConsoleObject->pos);
|
||||||
|
|
||||||
if (best_gun_num != -1) {
|
if (best_gun_num != -1) {
|
||||||
vms_vector vec_to_goal;
|
vms_vector vec_to_goal;
|
||||||
|
@ -395,7 +394,7 @@ void init_controlcen_for_level(void)
|
||||||
} else {
|
} else {
|
||||||
// Compute all gun positions.
|
// Compute all gun positions.
|
||||||
objp = &Objects[cntrlcen_objnum];
|
objp = &Objects[cntrlcen_objnum];
|
||||||
for (i=0; i<N_controlcen_guns; i++)
|
for (i=0; i<Reactors[0].n_guns; i++)
|
||||||
calc_controlcen_gun_point(&Gun_pos[i], &Gun_dir[i], objp, i);
|
calc_controlcen_gun_point(&Gun_pos[i], &Gun_dir[i], objp, i);
|
||||||
Control_center_present = 1;
|
Control_center_present = 1;
|
||||||
|
|
||||||
|
|
|
@ -39,15 +39,22 @@ typedef struct control_center_triggers {
|
||||||
|
|
||||||
extern control_center_triggers ControlCenterTriggers;
|
extern control_center_triggers ControlCenterTriggers;
|
||||||
|
|
||||||
extern int N_controlcen_guns;
|
typedef struct reactor {
|
||||||
|
int n_guns;
|
||||||
|
vms_vector gun_points[MAX_CONTROLCEN_GUNS];
|
||||||
|
vms_vector gun_dirs[MAX_CONTROLCEN_GUNS];
|
||||||
|
} reactor;
|
||||||
|
|
||||||
|
#define MAX_REACTORS 1
|
||||||
|
|
||||||
|
extern reactor Reactors[MAX_REACTORS];
|
||||||
|
|
||||||
extern int Control_center_been_hit;
|
extern int Control_center_been_hit;
|
||||||
extern int Control_center_player_been_seen;
|
extern int Control_center_player_been_seen;
|
||||||
extern int Control_center_next_fire_time;
|
extern int Control_center_next_fire_time;
|
||||||
extern int Control_center_present;
|
extern int Control_center_present;
|
||||||
extern int Dead_controlcen_object_num;
|
extern int Dead_controlcen_object_num;
|
||||||
|
|
||||||
extern vms_vector controlcen_gun_points[MAX_CONTROLCEN_GUNS];
|
|
||||||
extern vms_vector controlcen_gun_dirs[MAX_CONTROLCEN_GUNS];
|
|
||||||
extern vms_vector Gun_pos[MAX_CONTROLCEN_GUNS];
|
extern vms_vector Gun_pos[MAX_CONTROLCEN_GUNS];
|
||||||
|
|
||||||
//return the position & orientation of a gun on the control center object
|
//return the position & orientation of a gun on the control center object
|
||||||
|
|
Loading…
Reference in a new issue