Move */main/fireball.c -> similar/main/fireball.c

This commit is contained in:
Kp 2013-03-03 01:03:33 +00:00
parent 148dd00eeb
commit 18aea17f9e
4 changed files with 77 additions and 1226 deletions

View file

@ -932,6 +932,7 @@ class DXXProgram(DXXCommon):
'main/digiobj.cpp',
'main/effects.cpp',
'main/endlevel.cpp',
'main/fireball.c',
'main/fuelcen.cpp',
'main/fvi.cpp',
'main/game.cpp',
@ -1223,7 +1224,6 @@ class D1XProgram(DXXProgram):
'main/bmread.cpp',
'main/collide.c',
'main/custom.cpp',
'main/fireball.c',
'main/snddecom.cpp',
#'tracker/client/tracker_client.c'
]
@ -1276,7 +1276,6 @@ class D2XProgram(DXXProgram):
'libmve/mveplay.cpp',
'main/collide.c',
'main/escort.cpp',
'main/fireball.c',
'main/gamepal.cpp',
'main/movie.cpp',
'main/segment.cpp',

View file

@ -230,6 +230,8 @@ enum secondary_weapon_index_t
PROXIMITY_INDEX = 2,
SMART_INDEX = 3,
MEGA_INDEX = 4,
#define NUM_SMART_CHILDREN 6 // Number of smart children created by default.
#if defined(DXX_BUILD_DESCENT_I)
#define NUM_SHAREWARE_WEAPONS 3 //in shareware, old get first 3 of each
@ -245,8 +247,6 @@ enum secondary_weapon_index_t
#define VULCAN_AMMO_SCALE 0xcc163 //(0x198300/2) //multiply ammo by this before displaying
#define NUM_SMART_CHILDREN 6 // Number of smart children created by default.
#define HAS_FLASH_FLAG HAS_SECONDARY_FLAG(SMISSILE1_INDEX)
#define HAS_GUIDED_FLAG HAS_SECONDARY_FLAG(GUIDED_INDEX)
#define HAS_SMART_BOMB_FLAG HAS_SECONDARY_FLAG(SMART_MINE_INDEX)

File diff suppressed because it is too large Load diff

View file

@ -60,8 +60,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
//--unused-- ubyte Frame_processed[MAX_OBJECTS];
#if defined(DXX_BUILD_DESCENT_II)
fix Flash_effect=0;
static const int PK1=1, PK2=8;
#endif
static object *object_create_explosion_sub(object *objp, short segnum, vms_vector * position, fix size, int vclip_type, fix maxdamage, fix maxdistance, fix maxforce, int parent )
{
@ -104,6 +106,11 @@ static object *object_create_explosion_sub(object *objp, short segnum, vms_vecto
if ((Objects[parent].type != OBJ_ROBOT) || (get_robot_id(&Objects[parent]) != obj0p->id))
parent_check = 1;
#if defined(DXX_BUILD_DESCENT_I)
if ( (obj0p->type == OBJ_CNTRLCEN) ||
(obj0p->type==OBJ_PLAYER) ||
((obj0p->type==OBJ_ROBOT) && parent_check))
#elif defined(DXX_BUILD_DESCENT_II)
if ( (obj0p!=objp) &&
!(obj0p->flags&OF_SHOULD_BE_DEAD) &&
((obj0p->type==OBJ_WEAPON && (obj0p->id==PROXIMITY_ID || obj0p->id==SUPERPROX_ID || obj0p->id==PMINE_ID)) ||
@ -111,6 +118,7 @@ static object *object_create_explosion_sub(object *objp, short segnum, vms_vecto
(obj0p->type==OBJ_PLAYER) ||
((obj0p->type==OBJ_ROBOT) && parent_check)
))
#endif
{
dist = vm_vec_dist_quick( &obj0p->pos, &obj->pos );
// Make damage be from 'maxdamage' to 0.0, where 0.0 is 'maxdistance' away;
@ -128,6 +136,7 @@ static object *object_create_explosion_sub(object *objp, short segnum, vms_vecto
vm_vec_scale(vm_vec_sub(&pos_hit, &obj->pos, &obj0p->pos), fixdiv(obj0p->size, obj0p->size + dist));
switch ( obj0p->type ) {
#if defined(DXX_BUILD_DESCENT_II)
case OBJ_WEAPON:
phys_apply_force(obj0p,&vforce);
@ -138,11 +147,11 @@ static object *object_create_explosion_sub(object *objp, short segnum, vms_vecto
}
}
break;
#endif
case OBJ_ROBOT:
{
phys_apply_force(obj0p,&vforce);
#if defined(DXX_BUILD_DESCENT_II)
// If not a boss, stun for 2 seconds at 32 force, 1 second at 16 force
if ((objp != NULL) && (!Robot_info[obj0p->id].boss_flag) && (Weapon_info[objp->id].flash)) {
ai_static *aip = &obj0p->ctype.ai_info;
@ -159,8 +168,8 @@ static object *object_create_explosion_sub(object *objp, short segnum, vms_vecto
//@@ buddy_message("Daisy, Daisy, Give me...");
} else
aip->SKIP_AI_COUNT--;
}
#endif
// When a robot gets whacked by a badass force, he looks towards it because robots tend to get blasted from behind.
{
@ -171,15 +180,16 @@ static object *object_create_explosion_sub(object *objp, short segnum, vms_vecto
phys_apply_rot(obj0p,&neg_vforce);
}
if ( obj0p->shields >= 0 ) {
#if defined(DXX_BUILD_DESCENT_II)
if (Robot_info[obj0p->id].boss_flag)
if (Boss_invulnerable_matter[Robot_info[obj0p->id].boss_flag-BOSS_D2])
damage /= 4;
#endif
if (apply_damage_to_robot(obj0p, damage, parent))
if ((objp != NULL) && (parent == Players[Player_num].objnum))
add_points_to_score(Robot_info[obj0p->id].score_value);
add_points_to_score(Robot_info[get_robot_id(obj0p)].score_value);
}
#if defined(DXX_BUILD_DESCENT_II)
if ((objp != NULL) && (Robot_info[obj0p->id].companion) && (!Weapon_info[objp->id].flash)) {
int i, count;
char ouch_str[6*4 + 2];
@ -195,6 +205,7 @@ static object *object_create_explosion_sub(object *objp, short segnum, vms_vecto
buddy_message("%s", ouch_str);
}
#endif
break;
}
case OBJ_CNTRLCEN:
@ -205,7 +216,7 @@ static object *object_create_explosion_sub(object *objp, short segnum, vms_vecto
case OBJ_PLAYER: {
object * killer=NULL;
vms_vector vforce2;
#if defined(DXX_BUILD_DESCENT_II)
// Hack! Warning! Test code!
if ((objp != NULL) && Weapon_info[objp->id].flash && obj0p->id==Player_num) {
int fe;
@ -221,7 +232,7 @@ static object *object_create_explosion_sub(object *objp, short segnum, vms_vecto
PALETTE_FLASH_ADD(PK1 + f2i(PK2*force), PK1 + f2i(PK2*force), PK1 + f2i(PK2*force));
}
}
#endif
if ((objp != NULL) && (Game_mode & GM_MULTI) && (objp->type == OBJ_PLAYER)) {
killer = objp;
}
@ -235,8 +246,10 @@ static object *object_create_explosion_sub(object *objp, short segnum, vms_vecto
phys_apply_force(obj0p,&vforce);
phys_apply_rot(obj0p,&vforce2);
#if defined(DXX_BUILD_DESCENT_II)
if (Difficulty_level == 0)
damage /= 4;
#endif
if ( obj0p->shields >= 0 )
apply_damage_to_player(obj0p, killer, damage, 0 );
}
@ -288,10 +301,10 @@ object *explode_badass_weapon(object *obj,vms_vector *pos)
weapon_info *wi = &Weapon_info[get_weapon_id(obj)];
Assert(wi->damage_radius);
#if defined(DXX_BUILD_DESCENT_II)
if ((obj->id == EARTHSHAKER_ID) || (obj->id == ROBOT_EARTHSHAKER_ID))
smega_rock_stuff();
#endif
digi_link_sound_to_object(SOUND_BADASS_EXPLOSION, obj-Objects, 0, F1_0);
return object_create_badass_explosion(obj, obj->segnum, pos,
@ -453,7 +466,6 @@ int pick_connected_segment(object *objp, int max_depth)
side_rand[i] = temp;
}
while (tail != head) {
int sidenum, count;
segment *segp;
@ -511,7 +523,11 @@ int pick_connected_segment(object *objp, int max_depth)
return -1;
}
#if defined(DXX_BUILD_DESCENT_I)
#define BASE_NET_DROP_DEPTH 10
#elif defined(DXX_BUILD_DESCENT_II)
#define BASE_NET_DROP_DEPTH 8
#endif
// ------------------------------------------------------------------------------------------------------
// Choose segment to drop a powerup in.
@ -537,7 +553,11 @@ static int choose_drop_segment()
while ((segnum == -1) && (cur_drop_depth > BASE_NET_DROP_DEPTH/2)) {
pnum = (d_rand() * N_players) >> 15;
count = 0;
#if defined(DXX_BUILD_DESCENT_I)
while ((count < N_players) && ((Players[pnum].connected == CONNECT_DISCONNECTED) || (pnum==Player_num)))
#elif defined(DXX_BUILD_DESCENT_II)
while ((count < N_players) && ((Players[pnum].connected == CONNECT_DISCONNECTED) || (pnum==Player_num) || ((Game_mode & (GM_TEAM|GM_CAPTURE)) && (get_team(pnum)==get_team(Player_num)))))
#endif
{
pnum = (pnum+1)%N_players;
count++;
@ -704,10 +724,12 @@ void maybe_replace_powerup_with_energy(object *del_obj)
case POW_SPREADFIRE_WEAPON: weapon_index = SPREADFIRE_INDEX; break;
case POW_PLASMA_WEAPON: weapon_index = PLASMA_INDEX; break;
case POW_FUSION_WEAPON: weapon_index = FUSION_INDEX; break;
#if defined(DXX_BUILD_DESCENT_II)
case POW_GAUSS_WEAPON: weapon_index = GAUSS_INDEX; break;
case POW_HELIX_WEAPON: weapon_index = HELIX_INDEX; break;
case POW_PHOENIX_WEAPON: weapon_index = PHOENIX_INDEX; break;
case POW_OMEGA_WEAPON: weapon_index = OMEGA_INDEX; break;
#endif
}
// Don't drop vulcan ammo if player maxed out.
@ -716,6 +738,9 @@ void maybe_replace_powerup_with_energy(object *del_obj)
else if (weapon_index != -1) {
if ((player_has_weapon(weapon_index, 0) & HAS_WEAPON_FLAG) || weapon_nearby(del_obj, del_obj->contains_id)) {
if (d_rand() > 16384) {
#if defined(DXX_BUILD_DESCENT_I)
del_obj->contains_count = 1;
#endif
del_obj->contains_type = OBJ_POWERUP;
if (weapon_index_uses_vulcan_ammo(weapon_index)) {
del_obj->contains_id = POW_VULCAN_AMMO;
@ -724,18 +749,29 @@ void maybe_replace_powerup_with_energy(object *del_obj)
del_obj->contains_id = POW_ENERGY;
}
} else {
#if defined(DXX_BUILD_DESCENT_I)
del_obj->contains_count = 0;
#elif defined(DXX_BUILD_DESCENT_II)
del_obj->contains_type = OBJ_POWERUP;
del_obj->contains_id = POW_SHIELD_BOOST;
#endif
}
}
} else if (del_obj->contains_id == POW_QUAD_FIRE)
if ((Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS) || weapon_nearby(del_obj, del_obj->contains_id)) {
if (d_rand() > 16384) {
#if defined(DXX_BUILD_DESCENT_I)
del_obj->contains_count = 1;
#endif
del_obj->contains_type = OBJ_POWERUP;
del_obj->contains_id = POW_ENERGY;
} else {
#if defined(DXX_BUILD_DESCENT_I)
del_obj->contains_count = 0;
#elif defined(DXX_BUILD_DESCENT_II)
del_obj->contains_type = OBJ_POWERUP;
del_obj->contains_id = POW_SHIELD_BOOST;
#endif
}
}
@ -752,6 +788,9 @@ void maybe_replace_powerup_with_energy(object *del_obj)
}
}
#if defined(DXX_BUILD_DESCENT_I)
static
#endif
int drop_powerup(int type, int id, int num, vms_vector *init_vel, vms_vector *pos, int segnum)
{
int objnum=-1;
@ -796,8 +835,10 @@ int drop_powerup(int type, int id, int num, vms_vector *init_vel, vms_vector *po
{
return (-1);
}
#if defined(DXX_BUILD_DESCENT_II)
if ((Game_mode & GM_NETWORK) && Network_status == NETSTAT_ENDLEVEL)
return (-1);
#endif
}
objnum = obj_create( type, id, segnum, &new_pos, &vmd_identity_matrix, Powerup_info[id].size, CT_POWERUP, MT_PHYSICS, RT_POWERUP);
@ -867,7 +908,11 @@ int drop_powerup(int type, int id, int num, vms_vector *init_vel, vms_vector *po
// new_pos.y += (d_rand()-16384)*7;
// new_pos.z += (d_rand()-16384)*6;
#if defined(DXX_BUILD_DESCENT_I)
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);
#elif defined(DXX_BUILD_DESCENT_II)
objnum = obj_create(OBJ_ROBOT, id, segnum, &new_pos, &vmd_identity_matrix, Polygon_models[Robot_info[id].model_num].rad, CT_AI, MT_PHYSICS, RT_POLYOBJ);
#endif
if ( objnum < 0 ) {
Int3();
@ -905,11 +950,12 @@ int drop_powerup(int type, int id, int num, vms_vector *init_vel, vms_vector *po
obj->ctype.ai_info.REMOTE_OWNER = -1;
}
#if defined(DXX_BUILD_DESCENT_II)
// At JasenW's request, robots which contain robots
// sometimes drop shields.
if (d_rand() > 16384)
drop_powerup(OBJ_POWERUP, POW_SHIELD_BOOST, 1, init_vel, pos, segnum);
#endif
break;
default:
@ -925,7 +971,7 @@ int drop_powerup(int type, int id, int num, vms_vector *init_vel, vms_vector *po
int object_create_egg(object *objp)
{
int rval;
#if defined(DXX_BUILD_DESCENT_II)
if (!(Game_mode & GM_MULTI) & (objp->type != OBJ_PLAYER))
{
if (objp->contains_type == OBJ_POWERUP)
@ -953,9 +999,9 @@ int object_create_egg(object *objp)
}
}
}
#endif
rval = drop_powerup(objp->contains_type, objp->contains_id, objp->contains_count, &objp->mtype.phys_info.velocity, &objp->pos, objp->segnum);
#if defined(DXX_BUILD_DESCENT_II)
if (rval != -1)
{
if ((objp->type == OBJ_PLAYER) && (objp->id == Player_num))
@ -969,7 +1015,7 @@ int object_create_egg(object *objp)
Objects[rval].ctype.powerup_info.count = MAX_OMEGA_CHARGE;
}
}
#endif
return rval;
}
@ -1019,7 +1065,9 @@ static void explode_model(object *obj)
int i;
for (i=1;i<Polygon_models[obj->rtype.pobj_info.model_num].n_models;i++)
#if defined(DXX_BUILD_DESCENT_II)
if (!(obj->type == OBJ_ROBOT && get_robot_id(obj) == 44 && i == 5)) //energy sucker energy part
#endif
object_create_debris(obj,i);
//make parent object only draw center part
@ -1151,9 +1199,11 @@ void do_explosion_sequence(object *obj)
vclip_num = get_explosion_vclip(del_obj,1);
#if defined(DXX_BUILD_DESCENT_II)
if (del_obj->type == OBJ_ROBOT && Robot_info[del_obj->id].badass)
expl_obj = object_create_badass_explosion( NULL, del_obj->segnum, spawn_pos, fixmul(del_obj->size, EXPLOSION_SCALE), vclip_num, F1_0*Robot_info[del_obj->id].badass, i2f(4)*Robot_info[del_obj->id].badass, i2f(35)*Robot_info[del_obj->id].badass, -1 );
else
#endif
expl_obj = object_create_explosion( del_obj->segnum, spawn_pos, fixmul(del_obj->size, EXPLOSION_SCALE), vclip_num );
if ((del_obj->contains_count > 0) && !(Game_mode & GM_MULTI)) { // Multiplayer handled outside of this code!!
@ -1172,12 +1222,14 @@ void do_explosion_sequence(object *obj)
object_create_egg(del_obj);
}
}
#if defined(DXX_BUILD_DESCENT_II)
if (robot_is_thief(robptr))
drop_stolen_items(del_obj);
if (robot_is_companion(robptr)) {
DropBuddyMarker(del_obj);
}
#endif
}
const robot_info *robptr = &Robot_info[get_robot_id(del_obj)];
@ -1226,7 +1278,11 @@ void do_explosion_sequence(object *obj)
#define EXPL_WALL_TIME (f1_0)
#define EXPL_WALL_TOTAL_FIREBALLS 32
#if defined(DXX_BUILD_DESCENT_I)
#define EXPL_WALL_FIREBALL_SIZE 0x48000 //smallest size
#elif defined(DXX_BUILD_DESCENT_II)
#define EXPL_WALL_FIREBALL_SIZE (0x48000*6/10) //smallest size
#endif
expl_wall expl_wall_list[MAX_EXPLODING_WALLS];
@ -1359,7 +1415,7 @@ void do_exploding_wall_frame()
}
#if defined(DXX_BUILD_DESCENT_II)
//creates afterburner blobs behind the specified object
void drop_afterburner_blobs(object *obj, int count, fix size_scale, fix lifetime)
{
@ -1411,4 +1467,4 @@ void expl_wall_read_n_swap(expl_wall *ew, int n, int swap, PHYSFS_file *fp)
for (i = 0; i < n; i++)
expl_wall_swap(&ew[i], swap);
}
#endif