# HG changeset patch # User darius # Date 882967329 0 # Node ID 9f180bf494bd5f2dfb144e04891525742ac281b0 # Parent de685799a432e73daf079c18d56755178a36f60f Made torps and fighter wobbly. They have a chance of tracking randomly instead of staying straight or seeking if in nebulous terrain. Option is turned on when NEBULA_EFFECT contains PHOTON and/or FIGHTER. diff -r de685799a432 -r 9f180bf494bd src/weapons.c --- a/src/weapons.c Wed Dec 24 12:40:04 1997 +0000 +++ b/src/weapons.c Wed Dec 24 12:42:09 1997 +0000 @@ -67,8 +67,8 @@ void explode_damage(torp, radius, why) struct basetorp *torp; - int radius; - int why; +int radius; +int why; { register int i; /* looping var */ int dx, dy, dist; /* to calc distance from torp to players */ @@ -84,11 +84,11 @@ continue; /* Torps no longer damage owner. */ if ((torp->bt_status == TDET) /* if torp was detted then */ - && ((j->p_no == torp->bt_owner) || /* cannot damage firing - * player */ - ((j->p_no != torp->bt_whodet) /* cannot damage players on - * same team */ - && (j->p_team == players[torp->bt_whodet].p_team))) + && ((j->p_no == torp->bt_owner) || /* cannot damage firing + * player */ + ((j->p_no != torp->bt_whodet) /* cannot damage players on + * same team */ + && (j->p_team == players[torp->bt_whodet].p_team))) ) /* except the detter */ continue; @@ -102,16 +102,16 @@ continue; /* then continue */ if (dist > EXPDIST * EXPDIST) /* if not direct hit */ damage = torp->bt_damage * (radius - sqrt((double) dist)) / - (radius - EXPDIST); + (radius - EXPDIST); else /* else if direct hit */ damage = torp->bt_damage; /* do torp damage */ if (damage > 0) { /* if damage was done then */ if (players[torp->bt_owner].p_hostile & j->p_team) /* start war if */ - players[torp->bt_owner].p_swar |= j->p_team; /* necessary */ + players[torp->bt_owner].p_swar |= j->p_team; /* necessary */ inflict_damage(&players[torp->bt_owner], &players[torp->bt_whodet], - j, damage, why); + j, damage, why); } } } @@ -159,25 +159,25 @@ { /* all players */ switch (j->ph_status) { /* check player's phaser status */ - case PHFREE: /* if not beging fired */ - continue; /* then continue */ - case PHMISS: /* if it missed */ - case PHHIT2: /* or ????? */ - if (j->ph_fuse-- == 1) /* dec count of phaser */ - j->ph_status = PHFREE; /* free it up if count done */ - break; - case PHHIT: /* if it hit someone then */ - if (j->ph_fuse-- == players[i].p_ship.s_phaser.fuse) - { - victim = &players[j->ph_target]; /* get the victim */ - if (players[i].p_hostile & victim->p_team) /* start war if */ - players[i].p_swar |= victim->p_team; /* necessary */ - if (victim->p_status == PALIVE) /* only damage if alive */ - inflict_damage(&players[i], 0, victim, j->ph_damage, KPHASER); - } /* end of if phaser hit someone */ - if (j->ph_fuse == 0) - j->ph_status = PHFREE; - break; + case PHFREE: /* if not beging fired */ + continue; /* then continue */ + case PHMISS: /* if it missed */ + case PHHIT2: /* or ????? */ + if (j->ph_fuse-- == 1) /* dec count of phaser */ + j->ph_status = PHFREE; /* free it up if count done */ + break; + case PHHIT: /* if it hit someone then */ + if (j->ph_fuse-- == players[i].p_ship.s_phaser.fuse) + { + victim = &players[j->ph_target]; /* get the victim */ + if (players[i].p_hostile & victim->p_team) /* start war if */ + players[i].p_swar |= victim->p_team; /* necessary */ + if (victim->p_status == PALIVE) /* only damage if alive */ + inflict_damage(&players[i], 0, victim, j->ph_damage, KPHASER); + } /* end of if phaser hit someone */ + if (j->ph_fuse == 0) + j->ph_status = PHFREE; + break; } /* end of switch */ } /* end of for loop through players */ } @@ -191,8 +191,8 @@ int weap_near_object(torp, type, dist) struct basetorp *torp; - int type; - int dist; +int type; +int dist; { register struct planet *pl; /* to point to the planets */ int dx, dy, i; @@ -215,7 +215,7 @@ int near_player(torp, dist) struct basetorp *torp; /* the torp to check for */ - int dist; +int dist; { register int i; /* looping var */ int dx, dy; /* to calc torp-player distance */ @@ -324,7 +324,7 @@ & T_NEBULA) && neb_effect[SS_PHOTON]) if(TORP_NEB_EFF > (lrand48() % 100)) /* Is torp affected? */ turn = (lrand48() % 2); /* Yes */ - + if (turn < 0) { /* we will go left */ heading = ((int) j->t_dir) - j->t_turns; /* turn left */ @@ -361,8 +361,7 @@ break; /* no more torp processing */ } if ((sun_effect[SS_PHOTON] && weap_near_object(&j->t_base, PLSTAR, ORBDIST)) - || - (wh_effect[SS_PHOTON] && weap_near_object(&j->t_base, PLWHOLE, ORBDIST))) + ||(wh_effect[SS_PHOTON] && weap_near_object(&j->t_base, PLWHOLE, ORBDIST))) { /* did it hit a star or wormhole? */ j->t_whodet = j->t_owner;