added hitobj_list to struct laser_info to get a bit cleaner code
This commit is contained in:
parent
e9fba443ef
commit
858aa603e6
|
@ -6,6 +6,7 @@ arch/sdl/window.c: In window_close() prev window did not get EVENT_WINDOW_ACTIVA
|
||||||
arch/ogl/ogl.c, include/ogl_init.h, main/ai.c, main/ai.h, main/aipath.c, main/aistruct.h, main/collide.c, main/controls.c, main/fuelcen.c, main/game.c, main/game.h, main/gamecntl.c, main/gameseq.c, main/gauges.c, main/laser.c, main/lighting.c, main/mglobal.c, main/multi.c, main/multi.h, main/multibot.c, main/net_ipx.c, main/net_udp.c, main/newdemo.c, main/object.c, main/object.h, main/player.c, main/player.h, main/playsave.c, main/playsave.h, main/powerup.c, main/state.c, main/state.h, main/weapon.c: Made GameTime to GameTime64 using fix64; Changed all structures saving GameTime64 for internal timer purposes to store fix64 and added converting functions to save such times in fix; For Savegames/Demos always reset GameTime64 to 0 while saving and putting all timer values to safe limits, Multiplayer objects are sent in similar fashion
|
arch/ogl/ogl.c, include/ogl_init.h, main/ai.c, main/ai.h, main/aipath.c, main/aistruct.h, main/collide.c, main/controls.c, main/fuelcen.c, main/game.c, main/game.h, main/gamecntl.c, main/gameseq.c, main/gauges.c, main/laser.c, main/lighting.c, main/mglobal.c, main/multi.c, main/multi.h, main/multibot.c, main/net_ipx.c, main/net_udp.c, main/newdemo.c, main/object.c, main/object.h, main/player.c, main/player.h, main/playsave.c, main/playsave.h, main/powerup.c, main/state.c, main/state.h, main/weapon.c: Made GameTime to GameTime64 using fix64; Changed all structures saving GameTime64 for internal timer purposes to store fix64 and added converting functions to save such times in fix; For Savegames/Demos always reset GameTime64 to 0 while saving and putting all timer values to safe limits, Multiplayer objects are sent in similar fashion
|
||||||
main/game.c: Use game_init_render_buffers for editor (for now), fixing crash
|
main/game.c: Use game_init_render_buffers for editor (for now), fixing crash
|
||||||
main/gamecntl.c, main/net_udp.c: Fix warning for deliberate GameTime64 wrap; uncomment multi_object_to_object_rw and multi_object_rw_to_object prototypes
|
main/gamecntl.c, main/net_udp.c: Fix warning for deliberate GameTime64 wrap; uncomment multi_object_to_object_rw and multi_object_rw_to_object prototypes
|
||||||
|
main/collide.c, main/object.c, main/object.h, main/state.c: added hitobj_list to struct laser_info to get a bit cleaner code
|
||||||
|
|
||||||
20101211
|
20101211
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -807,9 +807,9 @@ void collide_weapon_and_controlcen( object * weapon, object *controlcen, vms_vec
|
||||||
if (weapon->mtype.phys_info.flags & PF_PERSISTENT)
|
if (weapon->mtype.phys_info.flags & PF_PERSISTENT)
|
||||||
{
|
{
|
||||||
damage = weapon->shields*2; // to not alter Gameplay too much, multiply damage by 2.
|
damage = weapon->shields*2; // to not alter Gameplay too much, multiply damage by 2.
|
||||||
if (!hitobj_list[weapon-Objects][controlcen-Objects])
|
if (!weapon->ctype.laser_info.hitobj_list[controlcen-Objects])
|
||||||
{
|
{
|
||||||
hitobj_list[weapon-Objects][controlcen-Objects] = 1;
|
weapon->ctype.laser_info.hitobj_list[controlcen-Objects] = 1;
|
||||||
weapon->ctype.laser_info.last_hitobj = controlcen-Objects;
|
weapon->ctype.laser_info.last_hitobj = controlcen-Objects;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -924,9 +924,9 @@ void collide_robot_and_weapon( object * robot, object * weapon, vms_vector *coll
|
||||||
*/
|
*/
|
||||||
if (weapon->mtype.phys_info.flags & PF_PERSISTENT)
|
if (weapon->mtype.phys_info.flags & PF_PERSISTENT)
|
||||||
{
|
{
|
||||||
if (!hitobj_list[weapon-Objects][robot-Objects])
|
if (!weapon->ctype.laser_info.hitobj_list[robot-Objects])
|
||||||
{
|
{
|
||||||
hitobj_list[weapon-Objects][robot-Objects] = 1;
|
weapon->ctype.laser_info.hitobj_list[robot-Objects] = 1;
|
||||||
weapon->ctype.laser_info.last_hitobj = robot-Objects;
|
weapon->ctype.laser_info.last_hitobj = robot-Objects;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1247,9 +1247,9 @@ void collide_player_and_weapon( object * player, object * weapon, vms_vector *co
|
||||||
*/
|
*/
|
||||||
if (weapon->mtype.phys_info.flags & PF_PERSISTENT)
|
if (weapon->mtype.phys_info.flags & PF_PERSISTENT)
|
||||||
{
|
{
|
||||||
if (!hitobj_list[weapon-Objects][player-Objects])
|
if (!weapon->ctype.laser_info.hitobj_list[player-Objects])
|
||||||
{
|
{
|
||||||
hitobj_list[weapon-Objects][player-Objects] = 1;
|
weapon->ctype.laser_info.hitobj_list[player-Objects] = 1;
|
||||||
weapon->ctype.laser_info.last_hitobj = player-Objects;
|
weapon->ctype.laser_info.last_hitobj = player-Objects;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -83,7 +83,6 @@ void obj_detach_one(object *sub);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ubyte CollisionResult[MAX_OBJECT_TYPES][MAX_OBJECT_TYPES];
|
ubyte CollisionResult[MAX_OBJECT_TYPES][MAX_OBJECT_TYPES];
|
||||||
ubyte hitobj_list[MAX_OBJECTS][MAX_OBJECTS]; // last_hitobj of laser_inof struct can only keep track of one object. Still a persistent laser can hit several objects at the same time. This list keeps track of those while last_hitobj will only represent the most recent (the last) hitobj.
|
|
||||||
|
|
||||||
object *ConsoleObject; //the object that is the player
|
object *ConsoleObject; //the object that is the player
|
||||||
|
|
||||||
|
@ -1130,7 +1129,7 @@ int obj_create(ubyte type,ubyte id,int segnum,vms_vector *pos,
|
||||||
obj->mtype.phys_info.flags |= (Weapon_info[obj->id].persistent*PF_PERSISTENT);
|
obj->mtype.phys_info.flags |= (Weapon_info[obj->id].persistent*PF_PERSISTENT);
|
||||||
obj->ctype.laser_info.creation_time = GameTime64;
|
obj->ctype.laser_info.creation_time = GameTime64;
|
||||||
obj->ctype.laser_info.last_hitobj = -1;
|
obj->ctype.laser_info.last_hitobj = -1;
|
||||||
memset(&hitobj_list[objnum], 0, sizeof(ubyte)*MAX_OBJECTS);
|
memset(&obj->ctype.laser_info.hitobj_list, 0, sizeof(ubyte)*MAX_OBJECTS);
|
||||||
obj->ctype.laser_info.multiplier = F1_0;
|
obj->ctype.laser_info.multiplier = F1_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,24 +167,25 @@ typedef struct physics_info {
|
||||||
//stuctures for different kinds of simulation
|
//stuctures for different kinds of simulation
|
||||||
|
|
||||||
typedef struct laser_info {
|
typedef struct laser_info {
|
||||||
short parent_type; // The type of the parent of this object
|
short parent_type; // The type of the parent of this object
|
||||||
short parent_num; // The object's parent's number
|
short parent_num; // The object's parent's number
|
||||||
int parent_signature; // The object's parent's signature...
|
int parent_signature; // The object's parent's signature...
|
||||||
fix64 creation_time; // Absolute time of creation.
|
fix64 creation_time; // Absolute time of creation.
|
||||||
short last_hitobj; // For persistent weapons (survive object collision), object it most recently hit. NOTE: SEE hitobj_list!!!
|
short last_hitobj; // For persistent weapons (survive object collision), object it most recently hit.
|
||||||
short track_goal; // Object this object is tracking.
|
ubyte hitobj_list[MAX_OBJECTS]; // list of all objects persistent weapon has already damaged (useful in case it's in contact with two objects at the same time)
|
||||||
fix multiplier; // Power if this is a fusion bolt (or other super weapon to be added).
|
short track_goal; // Object this object is tracking.
|
||||||
|
fix multiplier; // Power if this is a fusion bolt (or other super weapon to be added).
|
||||||
} __pack__ laser_info;
|
} __pack__ laser_info;
|
||||||
|
|
||||||
// Same as above but structure Savegames/Multiplayer objects expect
|
// Same as above but structure Savegames/Multiplayer objects expect
|
||||||
typedef struct laser_info_rw {
|
typedef struct laser_info_rw {
|
||||||
short parent_type; // The type of the parent of this object
|
short parent_type; // The type of the parent of this object
|
||||||
short parent_num; // The object's parent's number
|
short parent_num; // The object's parent's number
|
||||||
int parent_signature; // The object's parent's signature...
|
int parent_signature; // The object's parent's signature...
|
||||||
fix creation_time; // Absolute time of creation.
|
fix creation_time; // Absolute time of creation.
|
||||||
short last_hitobj; // For persistent weapons (survive object collision), object it most recently hit. NOTE: SEE hitobj_list!!!
|
short last_hitobj; // For persistent weapons (survive object collision), object it most recently hit.
|
||||||
short track_goal; // Object this object is tracking.
|
short track_goal; // Object this object is tracking.
|
||||||
fix multiplier; // Power if this is a fusion bolt (or other super weapon to be added).
|
fix multiplier; // Power if this is a fusion bolt (or other super weapon to be added).
|
||||||
} __pack__ laser_info_rw;
|
} __pack__ laser_info_rw;
|
||||||
|
|
||||||
extern ubyte hitobj_list[MAX_OBJECTS][MAX_OBJECTS];
|
extern ubyte hitobj_list[MAX_OBJECTS][MAX_OBJECTS];
|
||||||
|
|
12
main/state.c
12
main/state.c
|
@ -328,6 +328,7 @@ void state_object_rw_to_object(object_rw *obj_rw, object *obj)
|
||||||
obj->ctype.laser_info.parent_signature = obj_rw->ctype.laser_info.parent_signature;
|
obj->ctype.laser_info.parent_signature = obj_rw->ctype.laser_info.parent_signature;
|
||||||
obj->ctype.laser_info.creation_time = obj_rw->ctype.laser_info.creation_time;
|
obj->ctype.laser_info.creation_time = obj_rw->ctype.laser_info.creation_time;
|
||||||
obj->ctype.laser_info.last_hitobj = obj_rw->ctype.laser_info.last_hitobj;
|
obj->ctype.laser_info.last_hitobj = obj_rw->ctype.laser_info.last_hitobj;
|
||||||
|
obj->ctype.laser_info.hitobj_list[obj->ctype.laser_info.last_hitobj] = 1; // restore most recent hitobj to hitobj_list
|
||||||
obj->ctype.laser_info.track_goal = obj_rw->ctype.laser_info.track_goal;
|
obj->ctype.laser_info.track_goal = obj_rw->ctype.laser_info.track_goal;
|
||||||
obj->ctype.laser_info.multiplier = obj_rw->ctype.laser_info.multiplier;
|
obj->ctype.laser_info.multiplier = obj_rw->ctype.laser_info.multiplier;
|
||||||
break;
|
break;
|
||||||
|
@ -1235,17 +1236,6 @@ RetryObjectLoading:
|
||||||
}
|
}
|
||||||
obj_link(i,segnum);
|
obj_link(i,segnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If weapon, restore the most recent hitobj to the list
|
|
||||||
if (obj->type == OBJ_WEAPON)
|
|
||||||
{
|
|
||||||
if (obj->ctype.laser_info.last_hitobj > 0 && obj->ctype.laser_info.last_hitobj < MAX_OBJECTS)
|
|
||||||
{
|
|
||||||
memset(&hitobj_list[i], 0, sizeof(ubyte)*MAX_OBJECTS);
|
|
||||||
hitobj_list[i][obj->ctype.laser_info.last_hitobj] = 1;
|
|
||||||
printf("RESTORE WEAPON[%i] LHO[%i]\n",i,obj->ctype.laser_info.last_hitobj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
special_reset_objects();
|
special_reset_objects();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue