void P_AimCamera (AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &CameraZ, sector_t *&CameraSector) { fixed_t distance; // Ch0wW: Fix r_deathcamera angles when dead. angle_t angle = (t1->angle - ANG180) >> ANGLETOFINESHIFT; angle_t pitch = (angle_t)(t1->pitch) >> ANGLETOFINESHIFT; FTraceResults trace; fixed_t vx, vy, vz, sz; // Ch0wW: Fix r_deathcamera angles when dead. -- START -- if (t1->player->health <= 0) distance = (fixed_t)(90 * FRACUNIT); else distance = (fixed_t)(chase_dist * FRACUNIT); // Ch0wW: Fix r_deathcamera angles when dead. -- STOP -- vx = FixedMul (finecosine[pitch], finecosine[angle]); vy = FixedMul (finecosine[pitch], finesine[angle]); vz = finesine[pitch]; // Ch0wW: Fix r_deathcamera angles when dead. -- START -- if (t1->player->health <= 0) sz = t1->z - t1->floorclip + t1->height + (fixed_t)(-8 * FRACUNIT); else sz = t1->z - t1->floorclip + t1->height + (fixed_t)(chase_height * FRACUNIT); // Ch0wW: Fix r_deathcamera angles when dead. -- STOP -- if (Trace (t1->x, t1->y, sz, t1->Sector, vx, vy, vz, distance, 0, 0, NULL, trace) && trace.Distance > 10*FRACUNIT) { // Position camera slightly in front of hit thing fixed_t dist = trace.Distance - 5*FRACUNIT; CameraX = t1->x + FixedMul (vx, dist); CameraY = t1->y + FixedMul (vy, dist); CameraZ = sz + FixedMul (vz, dist); } else { CameraX = trace.X; CameraY = trace.Y; CameraZ = trace.Z; } CameraSector = trace.Sector; }