MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DoNewPlayerDeathFrame

Function DoNewPlayerDeathFrame

Descent3/Player.cpp:2256–2415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2254// The Death sequencer.
2255
2256void DoNewPlayerDeathFrame(int slot) {
2257 object *playerobj;
2258
2259 ASSERT(slot >= 0 && slot < MAX_PLAYERS);
2260
2261 // Kevin added this in case the player dies and while dying stops recording a demo.
2262 // It's the cleanest solution I could find.
2263 if ((Player_num == slot) && (!Death[slot].camera))
2264 return;
2265
2266 // if (Player_num==slot)
2267 // ASSERT(Death[slot].camera);
2268
2269 playerobj = &Objects[Players[slot].objnum];
2270
2271 // determine current state of player object.
2272 Death[slot].time_dying = Gametime - Death[slot].initial_death_time;
2273
2274 // Increase death time
2275 if (slot == Player_num && (Players[slot].flags & PLAYER_FLAGS_DEAD)) {
2276 // Total_time_dead+=Frametime;
2277 Total_time_dead = Death[slot].time_dying;
2278 if (Total_time_dead > DEATH_RESPAWN_TIME) {
2279 AddPersistentHUDMessage(GR_RGB(0, 255, 0), HUD_MSG_PERSISTENT_CENTER, Game_window_y + Game_window_h - 20,
2280 HUD_MSG_PERSISTENT_INFINITE, 0, SOUND_NONE_INDEX, TXT_SPACETOCONT);
2281 }
2282 }
2283
2284 // depending on state of player ship, perform some operation
2285 if (Players[playerobj->id].flags & PLAYER_FLAGS_DYING) {
2286 // modify player ship physics as needed.
2287 // player ship will fall to the ground and deaccelerate
2288 // modify physics properties every INTERVAL
2289 if ((Death[slot].physics_frametime + DEATH_PHYS_INTERVAL) > Gametime) {
2290 if (Death[slot].fate == DEATH_FALL) {
2291 playerobj->mtype.phys_info.rotvel.x /= 1.15f;
2292 playerobj->mtype.phys_info.rotvel.y /= 1.1f;
2293 playerobj->mtype.phys_info.rotvel.z /= 1.0f;
2294 } else if (Death[slot].fate == DEATH_D2STYLE) {
2295 playerobj->mtype.phys_info.rotvel.x /= 1.15f;
2296 playerobj->mtype.phys_info.rotvel.y /= 1.0f;
2297 playerobj->mtype.phys_info.rotvel.z /= 1.05f;
2298 } else {
2299 playerobj->mtype.phys_info.rotvel.x /= 1.10f;
2300 playerobj->mtype.phys_info.rotvel.y /= 1.05f;
2301 playerobj->mtype.phys_info.rotvel.z /= 1.0f;
2302 }
2303
2304 playerobj->mtype.phys_info.velocity *= Death[slot].accel_mod;
2305 Death[slot].physics_frametime = Gametime;
2306 }
2307
2308 // move death camera if distance between death camera and player is less than a certain amount.
2309 if (slot == Player_num && Death[slot].in_cockpit) {
2310 if (Death[slot].time_dying > DEATH_COCKPIT_TIME) {
2311 Death[slot].in_cockpit = false;
2312 SetHUDMode(HUD_LETTERBOX);
2313 Viewer_object = Death[slot].camera; // set the current viewer to be this new camera.

Callers 1

DoPlayerFrameForOneFunction · 0.85

Calls 15

AddPersistentHUDMessageFunction · 0.85
SetHUDModeFunction · 0.85
MoveDeathCamFunction · 0.85
fvi_FindIntersectionFunction · 0.85
PlayerShipExplodeFunction · 0.85
ps_randFunction · 0.85
PlayerShipBreakupFunction · 0.85
CreateFireballFunction · 0.85
GetPolyModelPointInWorldFunction · 0.85
GetRandomSmallExplosionFunction · 0.85
GR_RGBFunction · 0.50
vm_VectorDistanceQuickFunction · 0.50

Tested by

no test coverage detected