Blow up the entire ship (all remaining subobjects.
| 3088 | |
| 3089 | // Blow up the entire ship (all remaining subobjects. |
| 3090 | void 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 |
no test coverage detected