This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | DestroyBomb (MECH *mech, int loc) |
int | BombWeight (int i) |
char * | bomb_name (int i) |
void | bomb_list (MECH *mech, int player) |
float | calc_dest (MECH *mech, short *x, short *y) |
void | bomb_aim (MECH *mech, dbref player) |
void | bomb_hit_hexes (MAP *map, int x, int y, int hitnb, int iscluster, int aff_d, int aff_h, char *tomsg, char *otmsg, char *tomsg1, char *otmsg1) |
void | simulate_flight (MECH *mech, MAP *map, short *x, short *y, float t) |
void | bomb_drop (MECH *mech, int player, int bn) |
void | mech_bomb (dbref player, void *data, char *buffer) |
Definition at line 124 of file aero.bomb.c.
References calc_dest(), LBUF_SIZE, mech_printf(), MECHALL, x, and y.
Referenced by mech_bomb().
00125 { 00126 float t; /* The time of impact */ 00127 char toi[LBUF_SIZE]; 00128 short x, y; 00129 00130 t = calc_dest(mech, &x, &y); 00131 sprintf(toi, "%.1f second%s", t, (t >= 2.0 || t < 1.0) ? "" : "s"); 00132 mech_printf(mech, MECHALL, 00133 "Estimated bomb flight time %s, estimated landing hex %d,%d.", 00134 toi, x, y); 00135 }
void bomb_drop | ( | MECH * | mech, | |
int | player, | |||
int | bn | |||
) |
Definition at line 223 of file aero.bomb.c.
References Bomb2I, bomb_hit_event(), calc_dest(), Create, dir, DOCHECK, EVENT_DHIT, getMap(), GetPartType, IsBomb, MadePilotSkillRoll(), bomb_shot::map, MAP::map_height, MAP::map_width, MECH::mapindex, MAX, mech_notify(), MECHALL, MechLOSBroadcast(), muxevent_add(), NUM_CRITICALS, NUM_SECTIONS, Number, PartIsDestroyed, SetCargoWeight(), SetPartType, simulate_flight(), TWOPIOVER360, bomb_shot::type, bomb_shot::x, x, bomb_shot::y, and y.
Referenced by mech_bomb().
00224 { 00225 int bc = 0; 00226 int i, j, k; 00227 int lloc = 0, lpos = 0; 00228 float t; 00229 short x, y; 00230 int ob; 00231 int di; 00232 float dir; 00233 bomb_shot *s; 00234 MAP *map; 00235 00236 DOCHECK(bn < 0, "Negative bomb number? Gimme a break."); 00237 bn--; 00238 for(i = 0; i < NUM_SECTIONS; i++) 00239 for(j = 0; j < NUM_CRITICALS; j++) 00240 if(IsBomb((k = GetPartType(mech, i, j))) && 00241 !PartIsDestroyed(mech, i, j)) { 00242 if(bc == bn) { 00243 lloc = i; 00244 lpos = j; 00245 } 00246 bc++; 00247 } 00248 DOCHECK(!bc, "No bombs installed."); 00249 DOCHECK(!(map = getMap(mech->mapindex)), "You're on invalid map!"); 00250 DOCHECK(bn < 0 || 00251 bn >= bc, "No bomb with such number installed! (See BOMB LIST)"); 00252 MechLOSBroadcast(mech, 00253 "detaches a small object that starts falling down.."); 00254 k = Bomb2I(GetPartType(mech, lloc, lpos)); 00255 mech_notify(mech, MECHALL, "The ship trembles as you detach a bomb.."); 00256 t = calc_dest(mech, &x, &y); 00257 ob = (int) t / 10; 00258 if(MadePilotSkillRoll(mech, 4 + ob) || t < 2.0) 00259 mech_notify(mech, MECHALL, 00260 "Despite the slight problems, you keep the craft stable enough to drop the bomb right on target.."); 00261 else { 00262 mech_notify(mech, MECHALL, 00263 "The ship's lurches slightly, dropping the bomb off target!"); 00264 ob = 6 * (1 + ob); /* Max distance missed */ 00265 ob = MAX(1, (Number(1, ob)) / 2); 00266 di = Number(0, 359); 00267 dir = di * TWOPIOVER360; 00268 x = x + ob * cos(dir); 00269 y = y + ob * sin(dir); 00270 } 00271 simulate_flight(mech, map, &x, &y, t); 00272 if(x < 0 || y < 0 || x >= map->map_width || y >= map->map_height) 00273 return; 00274 SetPartType(mech, lloc, lpos, 0); 00275 Create(s, bomb_shot, 1); 00276 s->x = x; 00277 s->y = y; 00278 s->type = k; 00279 s->map = map; 00280 SetCargoWeight(mech); 00281 muxevent_add(MAX(1, t), 0, EVENT_DHIT, bomb_hit_event, (void *) s, NULL); 00282 }
void bomb_hit_hexes | ( | MAP * | map, | |
int | x, | |||
int | y, | |||
int | hitnb, | |||
int | iscluster, | |||
int | aff_d, | |||
int | aff_h, | |||
char * | tomsg, | |||
char * | otmsg, | |||
char * | tomsg1, | |||
char * | otmsg1 | |||
) |
Definition at line 137 of file aero.bomb.c.
References blast_hit_hexes().
Referenced by bomb_hit().
00140 { 00141 blast_hit_hexes(map, aff_d, iscluster ? 2 : 10, aff_h, x, y, tomsg, 00142 otmsg, tomsg1, otmsg1, 0, 4, 1, 1, hitnb); 00143 }
void bomb_list | ( | MECH * | mech, | |
int | player | |||
) |
Definition at line 64 of file aero.bomb.c.
References addline, ArmorStringFromIndex(), Bomb2I, bombs, c, cent, GetMechID(), GetPartType, IsBomb, KillCoolMenu(), MechMove, MechType, NUM_CRITICALS, NUM_SECTIONS, ShowCoolMenu(), tprintf(), and vsi.
Referenced by mech_bomb().
00065 { 00066 int bc = 0, fb; 00067 int i, j, k; 00068 char location[20]; 00069 static char *types[] = { 00070 "Standard", 00071 "Inferno", 00072 "Cluster", 00073 NULL 00074 }; 00075 coolmenu *c = NULL; 00076 00077 addline(); 00078 cent(tprintf("Bomb payload for %s:", GetMechID(mech))); 00079 addline(); 00080 for(i = 0; i < NUM_SECTIONS; i++) { 00081 fb = 1; 00082 for(j = 0; j < NUM_CRITICALS; j++) 00083 if(IsBomb((k = GetPartType(mech, i, j)))) { 00084 k = Bomb2I(k); 00085 if(fb) { 00086 ArmorStringFromIndex(i, location, MechType(mech), 00087 MechMove(mech)); 00088 fb = 0; 00089 } 00090 if(!bc) { 00091 vsi(tprintf("# %-20s %-5s %-5s %s", "Location", 00092 "Weight", "Power", "Type")); 00093 } 00094 vsi(tprintf("%-2d %-20s %5d %5d", bc + 1, location, 00095 bombs[k].weight / 10, bombs[k].aff, 00096 types[bombs[k].type])); 00097 bc++; 00098 } 00099 } 00100 if(!bc) 00101 cent("No bombs installed."); 00102 addline(); 00103 ShowCoolMenu(player, c); 00104 KillCoolMenu(c); 00105 }
char* bomb_name | ( | int | i | ) |
Definition at line 59 of file aero.bomb.c.
References bombs, and BOMBINFO::name.
Referenced by part_figure_out_name_sub(), and part_figure_out_shname().
int BombWeight | ( | int | i | ) |
Definition at line 54 of file aero.bomb.c.
References bombs, and BOMBINFO::weight.
Referenced by GetPartWeight().
float calc_dest | ( | MECH * | mech, | |
short * | x, | |||
short * | y | |||
) |
Definition at line 107 of file aero.bomb.c.
References GMOD, MechFX, MechFY, MechFZ, MechStartFX, MechStartFY, MechStartFZ, MOVE_TICK, RealCoordToMapCoord(), and ZSCALE.
Referenced by bomb_aim(), and bomb_drop().
00108 { 00109 /* Present location */ 00110 float fx = MechFX(mech); 00111 float fy = MechFY(mech); 00112 float fz = MechFZ(mech) / ZSCALE; 00113 float zspd = MechStartFZ(mech) / ZSCALE; 00114 float t, ot; 00115 00116 ot = t = (zspd + sqrt(zspd * zspd + 2 * GMOD * fz)) / GMOD; 00117 t = (float) t / MOVE_TICK; 00118 fx = fx + MechStartFX(mech) * t; 00119 fy = fy + MechStartFY(mech) * t; 00120 RealCoordToMapCoord(x, y, fx, fy); 00121 return ot; 00122 }
void DestroyBomb | ( | MECH * | mech, | |
int | loc | |||
) |
void mech_bomb | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 284 of file aero.bomb.c.
References args, bomb_aim(), bomb_drop(), bomb_list(), cch, DOCHECK, Landed, mech_parseattributes(), MECH_USUALSO, and Readnum.
00285 { 00286 MECH *mech = (MECH *) data; 00287 char *args[3]; 00288 int argc; 00289 int bn; 00290 00291 cch(MECH_USUALSO); 00292 DOCHECK(!(argc = 00293 mech_parseattributes(buffer, args, 3)), 00294 "(At least) one option required."); 00295 DOCHECK(argc > 2, "Too many arguments!"); 00296 if(!strcasecmp(args[0], "list")) { 00297 bomb_list(mech, player); 00298 return; 00299 } 00300 DOCHECK(Landed(mech), "The craft is landed!"); 00301 if(!strcasecmp(args[0], "aim")) { 00302 bomb_aim(mech, player); 00303 return; 00304 } 00305 DOCHECK(strcasecmp(args[0], "drop"), "Invalid argument to BOMB!"); 00306 DOCHECK(argc < 2, "The BOMB commands needs to know WHICH bomb to drop!"); 00307 DOCHECK(Readnum(bn, args[1]), "Invalid bomb number!"); 00308 bomb_drop(mech, player, bn); 00309 }
Definition at line 192 of file aero.bomb.c.
References Elevation, GMOD, MAP::map_height, MAP::map_width, MapCoordToRealCoord(), MechFX, MechFY, MechFZ, RealCoordToMapCoord(), and ZSCALE.
Referenced by bomb_drop().
00193 { 00194 float fx = MechFX(mech); 00195 float fy = MechFY(mech); 00196 float fz = MechFZ(mech); 00197 00198 /* float fs = MechStartFZ(mech); */ 00199 float delx, dely; 00200 float dx, dy; 00201 int i; 00202 short tx, ty; 00203 00204 if(t < 1.0) 00205 return; 00206 MapCoordToRealCoord(*x, *y, &dx, &dy); 00207 delx = (dx - fx) / t; 00208 dely = (dy - fy) / t; 00209 for(i = 1; i < t; i++) { 00210 fx = fx + delx; 00211 fy = fx + dely; 00212 fz = (float) fz - GMOD; 00213 RealCoordToMapCoord(&tx, &ty, fx, fy); 00214 if(tx < 0 || ty < 0 || tx >= map->map_width || ty >= map->map_height) 00215 continue; 00216 if(Elevation(map, tx, ty) > (fz / ZSCALE)) { 00217 *x = tx; 00218 *y = ty; 00219 } 00220 } 00221 }