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

Function PlayerShipExplode

Descent3/Player.cpp:3090–3146  ·  view source on GitHub ↗

Blow up the entire ship (all remaining subobjects.

Source from the content-addressed store, hash-verified

3088
3089// Blow up the entire ship (all remaining subobjects.
3090void PlayerShipExplode(object *obj, float magnitude) {
3091 int visnum;
3092
3093 ASSERT(obj != NULL);
3094
3095 DLLInfo.me_handle = obj->handle;
3096 DLLInfo.it_handle = obj->handle;
3097 CallGameDLL(EVT_GAMEPLAYEREXPLODED, &DLLInfo);
3098
3099 if (Death[obj->id].dying_model && (Death[obj->id].dying_model->n_models > 1)) {
3100 int i;
3101
3102 // Create debris pieces from subobjects
3103 for (i = 1; i < Death[obj->id].dying_model->n_models; i++) {
3104 if (obj->rtype.pobj_info.subobj_flags & (1 << i)) {
3105 PlayerShipSpewPart(obj, i, magnitude * 0.85f);
3106 }
3107 }
3108 }
3109
3110 CreateBlastRing(&obj->pos, BLAST_RING_INDEX, DAMAGE_RING_TIME, obj->size * 3, obj->roomnum);
3111
3112 obj->rtype.pobj_info.subobj_flags = 0;
3113
3114 // Player explosion sound
3115 Sound_system.Play3dSound(SOUND_BUILDING_EXPLODE, obj);
3116
3117 CreateRandomSparks(80, &obj->pos, obj->roomnum, HOT_SPARK_INDEX, (ps_rand() % 3) + 2);
3118 visnum = CreateFireball(&obj->pos, BIG_EXPLOSION_INDEX, obj->roomnum, VISUAL_FIREBALL);
3119 if (visnum >= 0)
3120 VisEffects[visnum].size *= (3.0f * (magnitude / MAX_EXPLOSION_MAG));
3121
3122 // Do badass damage
3123 obj->impact_time = 0;
3124 obj->impact_size = obj->size * 3;
3125 obj->impact_force = obj->impact_size * 2;
3126 obj->impact_generic_damage = obj->impact_size * 3;
3127 obj->impact_player_damage = obj->impact_size * 3;
3128 DoConcussiveForce(obj, obj->handle, 1.0);
3129
3130 // Spew out any weapons, powerups, inventory
3131 PlayerSpewInventory(obj);
3132
3133 if (Game_mode & GM_MULTI)
3134 MultiMakePlayerGhost(obj->id);
3135
3136 obj->effect_info->type_flags = 0;
3137
3138 // Stop sounds for this player
3139 PlayerStopSounds(obj->id);
3140
3141 // Clear keyboard buffer
3142 if (obj->id == Player_num) {
3143 ddio_KeyFlush();
3144 Controller->flush();
3145 }
3146}
3147

Callers 2

DoNewPlayerDeathFrameFunction · 0.85
EndPlayerDeathFunction · 0.85

Calls 13

CallGameDLLFunction · 0.85
PlayerShipSpewPartFunction · 0.85
CreateBlastRingFunction · 0.85
CreateRandomSparksFunction · 0.85
ps_randFunction · 0.85
CreateFireballFunction · 0.85
DoConcussiveForceFunction · 0.85
PlayerSpewInventoryFunction · 0.85
MultiMakePlayerGhostFunction · 0.85
PlayerStopSoundsFunction · 0.85
ddio_KeyFlushFunction · 0.85
Play3dSoundMethod · 0.80

Tested by

no test coverage detected