This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | mech_standfail_event (MUXEVENT *e) |
void | mech_fall_event (MUXEVENT *e) |
void | mech_lock_event (MUXEVENT *e) |
void | mech_stabilizing_event (MUXEVENT *e) |
void | mech_jump_event (MUXEVENT *e) |
void | mech_recovery_event (MUXEVENT *e) |
void | mech_recycle_event (MUXEVENT *e) |
void | ProlongUncon (MECH *mech, int len) |
void | MaybeRecycle (MECH *mech, int wticks) |
void | mech_lateral_event (MUXEVENT *e) |
void | mech_move_event (MUXEVENT *e) |
void | mech_stand_event (MUXEVENT *e) |
void | mech_plos_event (MUXEVENT *e) |
void | aero_move_event (MUXEVENT *e) |
void | very_fake_func (MUXEVENT *e) |
void | mech_crewstun_event (MUXEVENT *e) |
void | unstun_crew_event (MUXEVENT *e) |
void | mech_unjam_ammo_event (MUXEVENT *objEvent) |
void | check_stagger_event (MUXEVENT *event) |
int | calcStaggerBTHMod (MECH *mech) |
void aero_move_event | ( | MUXEVENT * | e | ) |
Definition at line 282 of file mech.events.c.
References aero_move_event(), aero_UpdateHeading(), aero_UpdateSpeed(), my_event_type::data, DS_BlastNearbyMechsAndTrees(), EVENT_MOVE, Fallen, FuelCheck(), IsDS, Landed, MechDesiredFacing, MechDesiredSpeed, MechElevation, MECHEVENT, MechFacing, MechSpeed, MechStartFZ, MechZ, move_mech(), MOVE_TICK, muxevent_tick, RollingT, Started, UpdateHeading(), UpdateSpeed(), and WEAPON_TICK.
Referenced by aero_move_event().
00283 { 00284 MECH *mech = (MECH *) e->data; 00285 00286 if(!Landed(mech)) { 00287 /* Returns 1 only if we 00288 1) Ran out of fuel, and 00289 2) Were VTOL, and 00290 3) Crashed 00291 */ 00292 if(FuelCheck(mech)) 00293 return; 00294 /* Genuine CHEAT :-) */ 00295 if(Started(mech)) { 00296 aero_UpdateHeading(mech); 00297 aero_UpdateSpeed(mech); 00298 } 00299 if(Fallen(mech)) 00300 MechStartFZ(mech) = MechStartFZ(mech) - 1; 00301 move_mech(mech); 00302 if(IsDS(mech) && MechZ(mech) <= (MechElevation(mech) + 5) && 00303 ((muxevent_tick / WEAPON_TICK) % 10) == 0) 00304 DS_BlastNearbyMechsAndTrees(mech, 00305 "You are hit by the DropShip's plasma exhaust!", 00306 "is hit directly by DropShip's exhaust!", 00307 "You are hit by the DropShip's plasma exhaust!", 00308 "is hit by DropShip's exhaust!", 00309 "light up and burn.", 8); 00310 MECHEVENT(mech, EVENT_MOVE, aero_move_event, MOVE_TICK, 0); 00311 } else if(Landed(mech) && !Fallen(mech) && RollingT(mech)) { 00312 UpdateHeading(mech); 00313 UpdateSpeed(mech); 00314 move_mech(mech); 00315 if(fabs(MechSpeed(mech)) > 0.0 || 00316 fabs(MechDesiredSpeed(mech)) > 0.0 || 00317 MechDesiredFacing(mech) != MechFacing(mech)) 00318 if(!FuelCheck(mech)) 00319 MECHEVENT(mech, EVENT_MOVE, aero_move_event, MOVE_TICK, 0); 00320 } 00321 }
int calcStaggerBTHMod | ( | MECH * | mech | ) |
Definition at line 534 of file mech.events.c.
References MechTons, StaggerLevel, and Started.
Referenced by check_stagger_event(), LandMech(), and mech_jump().
00535 { 00536 int bthMod = 0; 00537 int tonnageMod = 0; 00538 00539 if(!Started(mech)) { 00540 bthMod = 999; 00541 } else { 00542 bthMod = StaggerLevel(mech); 00543 00544 if(MechTons(mech) <= 35) 00545 tonnageMod = 1; 00546 else if(MechTons(mech) <= 55) 00547 tonnageMod = 0; 00548 else if(MechTons(mech) <= 75) 00549 tonnageMod = -1; 00550 else 00551 tonnageMod = -2; 00552 00553 bthMod += tonnageMod; 00554 } 00555 00556 return bthMod; 00557 }
void check_stagger_event | ( | MUXEVENT * | event | ) |
Definition at line 426 of file mech.events.c.
References calcStaggerBTHMod(), CLASS_MECH, my_event_type::data, Fallen, Jumping, MadePilotSkillRoll(), mech_notify(), MECHALL, MechFalls(), MechLOSBroadcast(), MechType, MECH::mynum, MECH::rd, SendDebug, mech_rd::staggerDamage, StaggerLevel, StopStaggerCheck, and tprintf().
00427 { 00428 MECH *mech = (MECH *) event->data; /* get the mech */ 00429 00430 SendDebug(tprintf("Triggered stagger check for %d.", mech->mynum)); 00431 00432 if((StaggerLevel(mech) < 1) || Fallen(mech) || 00433 (MechType(mech) != CLASS_MECH)) { 00434 StopStaggerCheck(mech); 00435 return; 00436 } 00437 00438 if(Jumping(mech)) { 00439 return; 00440 } 00441 00442 mech_notify(mech, MECHALL, "You stagger from the damage!"); 00443 if(!MadePilotSkillRoll(mech, calcStaggerBTHMod(mech))) { 00444 mech_notify(mech, MECHALL, 00445 "You loose the battle with gravity and tumble over!!"); 00446 MechLOSBroadcast(mech, "tumbles over, staggered by the damage!"); 00447 MechFalls(mech, 1, 0); 00448 } 00449 00450 StopStaggerCheck(mech); 00451 /* Since stagger rolls happen much more often now, this adds 10 damage 00452 * points of 'buffer' to mech that was just forced to make a stager roll. 00453 * Mechs whose damage accumulation times out without making a roll (<20 00454 * damage) don't get this help. This 10 points of damage assistance slowly 00455 * times out in CheckDamage, or can be erased by weapons fire */ 00456 mech->rd.staggerDamage = -10; 00457 }
void MaybeRecycle | ( | MECH * | mech, | |
int | wticks | |||
) |
void mech_crewstun_event | ( | MUXEVENT * | e | ) |
Definition at line 331 of file mech.events.c.
References CLASS_MECH, my_event_type::data, Destroyed, mech_notify(), MECH_STUNNED, MECHALL, MechCritStatus, MechType, and Started.
Referenced by ModifyHeadHit().
00332 { 00333 MECH *mech = (MECH *) e->data; 00334 00335 if(!mech) 00336 return; 00337 if(!Started(mech) || Destroyed(mech)) { 00338 if(MechCritStatus(mech) & MECH_STUNNED) 00339 MechCritStatus(mech) &= ~MECH_STUNNED; 00340 return; 00341 } 00342 if(MechType(mech) != CLASS_MECH) 00343 mech_notify(mech, MECHALL, 00344 "%ch%cgThe crew recovers from their bewilderment!%cn"); 00345 else 00346 mech_notify(mech, MECHALL, 00347 "%ch%cgYou recover from your stunning experience!%cn"); 00348 00349 if(MechCritStatus(mech) & MECH_STUNNED) 00350 MechCritStatus(mech) &= ~MECH_STUNNED; 00351 }
void mech_fall_event | ( | MUXEVENT * | e | ) |
Definition at line 47 of file mech.events.c.
References AeroFreeFuel, AeroFuel, CLASS_VTOL, my_event_type::data, my_event_type::data2, EVENT_FALL, factoral(), FALL_ACCEL, FALL_TICK, FlyingT, JUMPING, MarkForLOSUpdate(), mech_fall_event(), mech_notify(), MECHALL, MECHEVENT, MechFalls(), MechFZ, MechLOSBroadcast(), MechsElevation, MechStatus, MechType, MechZ, ROTOR, SectIsDestroyed, Started, and ZSCALE.
Referenced by cause_armordamage(), char_disembark(), FuelCheck(), mech_dropoff(), mech_fall_event(), mech_ood_damage(), mech_shutdown(), and StartVTOLCrash().
00048 { 00049 MECH *mech = (MECH *) e->data; 00050 int fallspeed = (int) e->data2; 00051 int fallen_elev; 00052 00053 if(Started(mech) && fallspeed >= 0) 00054 return; 00055 if(fallspeed <= 0 && (!Started(mech) || !(FlyingT(mech)) || 00056 ((AeroFuel(mech) <= 0) && !AeroFreeFuel(mech)) || 00057 ((MechType(mech) == CLASS_VTOL) && 00058 (SectIsDestroyed(mech, ROTOR))))) 00059 fallspeed -= FALL_ACCEL; 00060 else 00061 fallspeed += FALL_ACCEL; 00062 MarkForLOSUpdate(mech); 00063 if(MechsElevation(mech) > abs(fallspeed)) { 00064 MechZ(mech) -= abs(fallspeed); 00065 MechFZ(mech) = MechZ(mech) * ZSCALE; 00066 MECHEVENT(mech, EVENT_FALL, mech_fall_event, FALL_TICK, fallspeed); 00067 return; 00068 } 00069 /* Time to hit da ground */ 00070 fallen_elev = factoral(abs(fallspeed)); 00071 mech_notify(mech, MECHALL, "You hit the ground!"); 00072 MechLOSBroadcast(mech, "hits the ground!"); 00073 MechFalls(mech, fallen_elev, 0); 00074 MechStatus(mech) &= ~JUMPING; 00075 }
void mech_jump_event | ( | MUXEVENT * | e | ) |
Definition at line 113 of file mech.events.c.
References my_event_type::data, EVENT_JUMP, JUMP_TICK, Jumping, mech_jump_event(), MECHEVENT, move_mech(), and StopJump.
Referenced by mech_jump(), and mech_jump_event().
00114 { 00115 MECH *mech = (MECH *) e->data; 00116 00117 MECHEVENT(mech, EVENT_JUMP, mech_jump_event, JUMP_TICK, 0); 00118 move_mech(mech); 00119 if(!Jumping(mech)) 00120 StopJump(mech); 00121 }
void mech_lateral_event | ( | MUXEVENT * | e | ) |
Definition at line 188 of file mech.events.c.
References my_event_type::data, my_event_type::data2, EVENT_SIDESLIP, full, mech_printf(), MECHALL, MECHEVENT, MechLateral, MechMove, MOVE_QUAD, foo::ofs, SideSlipping, Started, and StopSideslip.
Referenced by mech_lateral().
00189 { 00190 MECH *mech = (MECH *) e->data; 00191 int latmode = (int) e->data2; 00192 00193 if(!mech || !Started(mech)) 00194 return; 00195 mech_printf(mech, MECHALL, 00196 "Lateral movement mode change to %s completed.", 00197 lateral_modes[latmode].full); 00198 MechLateral(mech) = lateral_modes[latmode].ofs; 00199 #ifdef BT_MOVEMENT_MODES 00200 if(MechMove(mech) != MOVE_QUAD) { 00201 if(MechLateral(mech) == 0) 00202 StopSideslip(mech); 00203 else if(!(SideSlipping(mech))) 00204 MECHEVENT(mech, EVENT_SIDESLIP, mech_sideslip_event, 1, 0); 00205 } 00206 #endif 00207 }
void mech_lock_event | ( | MUXEVENT * | e | ) |
Definition at line 78 of file mech.events.c.
References my_event_type::data, FindObjectsData(), FlMechRange, getMap(), GetMechToMechID(), InLineOfSight(), mech_printf(), MECHALL, MechTarget, MechTargX, MechTargY, MechX, and MechY.
Referenced by mech_settarget().
00079 { 00080 MECH *mech = (MECH *) e->data; 00081 MAP *map; 00082 MECH *target; 00083 00084 if(MechTarget(mech) >= 0) { 00085 map = getMap(mech->mapindex); 00086 target = FindObjectsData(MechTarget(mech)); 00087 if(!target) 00088 return; 00089 if(!InLineOfSight(mech, target, MechX(target), MechY(target), 00090 FlMechRange(map, mech, target))) 00091 return; 00092 mech_printf(mech, MECHALL, 00093 "The sensors acquire a stable lock on %s.", 00094 GetMechToMechID(mech, target)); 00095 } else if(MechTargX(mech) >= 0 && MechTargY(mech) >= 0) 00096 mech_printf(mech, MECHALL, 00097 "The sensors acquire a stable lock on (%d,%d).", 00098 MechTargX(mech), MechTargY(mech)); 00099 00100 }
void mech_move_event | ( | MUXEVENT * | e | ) |
Definition at line 209 of file mech.events.c.
References BRIDGE, CLASS_VEH_NAVAL, CLASS_VTOL, my_event_type::data, EVENT_MOVE, FuelCheck(), ICE, IsMechLegLess(), Jumping, Landed, mech_move_event(), MechDesiredFacing, MechDesiredSpeed, MECHEVENT, MechFacing, MechMove, MechRTerrain, MechSpeed, MechType, MechVerticalSpeed, move_mech(), MOVE_SUB, MOVE_TICK, OODing, UpdateHeading(), UpdateSpeed(), and WATER.
Referenced by mech_move_event().
00210 { 00211 MECH *mech = (MECH *) e->data; 00212 00213 if(MechType(mech) == CLASS_VTOL) 00214 if(Landed(mech) || FuelCheck(mech)) 00215 return; 00216 UpdateHeading(mech); 00217 if((IsMechLegLess(mech)) || Jumping(mech) || OODing(mech)) { 00218 if(MechDesiredFacing(mech) != MechFacing(mech)) 00219 MECHEVENT(mech, EVENT_MOVE, mech_move_event, MOVE_TICK, 0); 00220 return; 00221 } 00222 UpdateSpeed(mech); 00223 move_mech(mech); 00224 00225 if(mech->mapindex < 0) 00226 return; 00227 00228 if(MechType(mech) == CLASS_VEH_NAVAL && MechRTerrain(mech) != BRIDGE && 00229 MechRTerrain(mech) != ICE && MechRTerrain(mech) != WATER) 00230 return; 00231 00232 if(MechSpeed(mech) || MechDesiredSpeed(mech) || 00233 MechDesiredFacing(mech) != MechFacing(mech) || 00234 ((MechType(mech) == CLASS_VTOL || MechMove(mech) == MOVE_SUB) && 00235 MechVerticalSpeed(mech))) 00236 MECHEVENT(mech, EVENT_MOVE, mech_move_event, MOVE_TICK, 0); 00237 }
void mech_plos_event | ( | MUXEVENT * | e | ) |
Definition at line 248 of file mech.events.c.
References AA_TECH, my_event_type::data, EVENT_PLOS, FindObjectsData(), FlMechRange, getMap(), MECH::mapindex, MECH::mapnumber, mech_plos_event(), MECHEVENT, MECHLOSFLAG_SEEN, MechPNumSeen, MechSpecials, MECH::mynum, PLOS_TICK, Sensor_DoWeSeeNow(), and Started.
Referenced by mech_plos_event().
00249 { 00250 MECH *mech = (MECH *) e->data, *target; 00251 MAP *map; 00252 int mapvis; 00253 int maplight; 00254 float range; 00255 int i; 00256 00257 if(!Started(mech)) 00258 return; 00259 if(!(map = getMap(mech->mapindex))) 00260 return; 00261 MECHEVENT(mech, EVENT_PLOS, mech_plos_event, PLOS_TICK, 0); 00262 if(!MechPNumSeen(mech) && !(MechSpecials(mech) & AA_TECH)) 00263 return; 00264 mapvis = map->mapvis; 00265 maplight = map->maplight; 00266 MechPNumSeen(mech) = 0; 00267 for(i = 0; i < map->first_free; i++) 00268 if(map->mechsOnMap[i] > 0 && map->mechsOnMap[i] != mech->mynum) 00269 if(!(map->LOSinfo[mech->mapnumber][i] & MECHLOSFLAG_SEEN)) { 00270 target = FindObjectsData(map->mechsOnMap[i]); 00271 if(!target) 00272 continue; 00273 range = FlMechRange(map, mech, target); 00274 MechPNumSeen(mech)++; 00275 Sensor_DoWeSeeNow(mech, &map->LOSinfo[mech->mapnumber][i], 00276 range, -1, -1, target, mapvis, maplight, 00277 map->cloudbase, 1, 0); 00278 00279 } 00280 }
void mech_recovery_event | ( | MUXEVENT * | e | ) |
Definition at line 125 of file mech.events.c.
References my_event_type::data, Destroyed, handlemwconc(), mech_notify(), MECHALL, MechStatus, Uncon, and UNCONSCIOUS.
Referenced by ProlongUncon().
00126 { 00127 MECH *mech = (MECH *) e->data; 00128 00129 if(Destroyed(mech) || !Uncon(mech)) 00130 return; 00131 if(handlemwconc(mech, 0)) { 00132 MechStatus(mech) &= ~UNCONSCIOUS; 00133 mech_notify(mech, MECHALL, "The pilot regains consciousness!"); 00134 return; 00135 } 00136 }
void mech_recycle_event | ( | MUXEVENT * | e | ) |
void mech_stabilizing_event | ( | MUXEVENT * | e | ) |
Definition at line 105 of file mech.events.c.
References my_event_type::data, mech_notify(), and MECHSTARTED.
Referenced by LandMech(), and MechFalls().
00106 { 00107 MECH *mech = (MECH *) e->data; 00108 00109 mech_notify(mech, MECHSTARTED, 00110 "%cgYou have finally stabilized after your jump.%c"); 00111 }
void mech_stand_event | ( | MUXEVENT * | e | ) |
Definition at line 239 of file mech.events.c.
References my_event_type::data, MakeMechStand, mech_notify(), MECHALL, and MechLOSBroadcast().
Referenced by mech_stand().
00240 { 00241 MECH *mech = (MECH *) e->data; 00242 00243 MechLOSBroadcast(mech, "stands up!"); 00244 mech_notify(mech, MECHALL, "You have finally finished standing up."); 00245 MakeMechStand(mech); 00246 }
void mech_standfail_event | ( | MUXEVENT * | e | ) |
Definition at line 39 of file mech.events.c.
References my_event_type::data, mech_notify(), and MECHALL.
Referenced by mech_stand().
00040 { 00041 MECH *mech = (MECH *) e->data; 00042 00043 mech_notify(mech, MECHALL, 00044 "%cgYou have finally recovered from your attempt to stand.%c"); 00045 }
void mech_unjam_ammo_event | ( | MUXEVENT * | objEvent | ) |
Definition at line 365 of file mech.events.c.
References my_event_type::data, my_event_type::data2, decrement_ammunition(), FindAndCheckAmmo(), FindPilotGunnery(), FindWeaponIndex(), FindWeaponNumberOnMech(), get_parts_long_name(), I2Weapon, MadePilotSkillRoll(), mech_notify(), mech_printf(), MECHALL, MechLOSBroadcast(), MECHPILOT, MechWeapons, RAC, Roll(), SetPartTempNuke, Started, TIC_NUM_DESTROYED, and Uncon.
Referenced by mech_unjamammo_func().
00366 { 00367 MECH *objMech = (MECH *) objEvent->data; /* get the mech */ 00368 int wWeapNum = (int) objEvent->data2; /* and now the weapon number */ 00369 int wSect, wSlot, wWeapStatus, wWeapIdx; 00370 int ammoLoc, ammoCrit,ammoLoc1, ammoCrit1; 00371 int wRoll = 0; 00372 int wRollNeeded = 0; 00373 00374 if(Uncon(objMech) || !Started(objMech)) 00375 return; 00376 00377 wWeapStatus = FindWeaponNumberOnMech(objMech, wWeapNum, &wSect, &wSlot); 00378 00379 if(wWeapStatus == TIC_NUM_DESTROYED) /* return if the weapon has been destroyed */ 00380 return; 00381 00382 wWeapIdx = FindWeaponIndex(objMech, wWeapNum); 00383 00384 if(!FindAndCheckAmmo(objMech, wWeapIdx, wSect, wSlot, &ammoLoc, &ammoCrit, &ammoLoc1, &ammoCrit1, 0)) { 00385 SetPartTempNuke(objMech, wSect, wSlot, 0); 00386 00387 mech_printf(objMech, MECHALL, 00388 "You finish bouncing around and realize you no longer have ammo for your %s!", 00389 get_parts_long_name(I2Weapon(wWeapIdx), 0)); 00390 return; 00391 } 00392 00393 if(MechWeapons[wWeapStatus].special & RAC) { 00394 wRoll = Roll(); 00395 wRollNeeded = FindPilotGunnery(objMech, wWeapStatus) + 3; 00396 00397 mech_notify(objMech, MECHPILOT, 00398 "You make a roll to unjam the weapon!"); 00399 mech_printf(objMech, MECHPILOT, 00400 "Modified Gunnery Skill: BTH %d\tRoll: %d", 00401 wRollNeeded, wRoll); 00402 00403 if(wRoll < wRollNeeded) { 00404 mech_notify(objMech, MECHALL, 00405 "Your attempt to remove the jammed slug fails. You'll need to try again to clear it."); 00406 return; 00407 } 00408 } else { 00409 if(!MadePilotSkillRoll(objMech, 0)) { 00410 mech_notify(objMech, MECHALL, 00411 "Your attempt to remove the jammed slug fails. You'll need to try again to clear it."); 00412 return; 00413 } 00414 } 00415 00416 SetPartTempNuke(objMech, wSect, wSlot, 0); 00417 mech_printf(objMech, MECHALL, 00418 "You manage to clear the jam on your %s!", 00419 get_parts_long_name(I2Weapon(wWeapIdx), 0)); 00420 MechLOSBroadcast(objMech, "ejects a mangled shell!"); 00421 00422 decrement_ammunition(objMech, wWeapNum, wSect, wSlot, ammoLoc, ammoCrit, ammoLoc1, ammoCrit1, 0); 00423 00424 }
void ProlongUncon | ( | MECH * | mech, | |
int | len | |||
) |
Definition at line 138 of file mech.events.c.
References Destroyed, EVENT_RECOVERY, mech_recovery_event(), MECHEVENT, MechStatus, muxevent_last_type_data(), muxevent_remove_type_data(), Recovering, and UNCONSCIOUS.
Referenced by handlemwconc().
00139 { 00140 int l; 00141 00142 if(Destroyed(mech)) 00143 return; 00144 if(!Recovering(mech)) { 00145 MechStatus(mech) |= UNCONSCIOUS; 00146 MECHEVENT(mech, EVENT_RECOVERY, mech_recovery_event, len, 0); 00147 return; 00148 } 00149 l = muxevent_last_type_data(EVENT_RECOVERY, (void *) mech) + len; 00150 muxevent_remove_type_data(EVENT_RECOVERY, (void *) mech); 00151 MECHEVENT(mech, EVENT_RECOVERY, mech_recovery_event, l, 0); 00152 }
void unstun_crew_event | ( | MUXEVENT * | e | ) |
Definition at line 353 of file mech.events.c.
References CREW_STUNNED, CrewStunned, my_event_type::data, mech_notify(), MECHALL, and MechTankCritStatus.
00354 { 00355 MECH *mech = (MECH *) e->data; 00356 00357 if(CrewStunned(mech) > 1) /* If we've been stunned again! */ 00358 return; 00359 00360 mech_notify(mech, MECHALL, 00361 "Your head clears and you're able to control your vehicle again."); 00362 MechTankCritStatus(mech) &= ~CREW_STUNNED; 00363 }
void very_fake_func | ( | MUXEVENT * | e | ) |
Definition at line 323 of file mech.events.c.
Referenced by describe_repairs(), loadrepairs(), muxevent_tickmech_removegun(), muxevent_tickmech_removepart(), and save_event().