|
|
1.1 ! root 1: #include "g_local.h" ! 2: ! 3: ! 4: void UpdateChaseCam(edict_t *ent) ! 5: { ! 6: vec3_t o, ownerv, goal; ! 7: edict_t *targ; ! 8: vec3_t forward, right; ! 9: trace_t trace; ! 10: int i; ! 11: vec3_t oldgoal; ! 12: vec3_t angles; ! 13: ! 14: // is our chase target gone? ! 15: if (!ent->client->chase_target->inuse) { ! 16: ent->client->chase_target = NULL; ! 17: return; ! 18: } ! 19: ! 20: targ = ent->client->chase_target; ! 21: ! 22: VectorCopy(targ->s.origin, ownerv); ! 23: VectorCopy(ent->s.origin, oldgoal); ! 24: ! 25: ownerv[2] += targ->viewheight; ! 26: ! 27: VectorCopy(targ->client->v_angle, angles); ! 28: if (angles[PITCH] > 56) ! 29: angles[PITCH] = 56; ! 30: AngleVectors (angles, forward, right, NULL); ! 31: VectorNormalize(forward); ! 32: VectorMA(ownerv, -30, forward, o); ! 33: ! 34: if (o[2] < targ->s.origin[2] + 20) ! 35: o[2] = targ->s.origin[2] + 20; ! 36: ! 37: // jump animation lifts ! 38: if (!targ->groundentity) ! 39: o[2] += 16; ! 40: ! 41: trace = gi.trace(ownerv, vec3_origin, vec3_origin, o, targ, MASK_SOLID); ! 42: ! 43: VectorCopy(trace.endpos, goal); ! 44: ! 45: VectorMA(goal, 2, forward, goal); ! 46: ! 47: // pad for floors and ceilings ! 48: VectorCopy(goal, o); ! 49: o[2] += 6; ! 50: trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); ! 51: if (trace.fraction < 1) { ! 52: VectorCopy(trace.endpos, goal); ! 53: goal[2] -= 6; ! 54: } ! 55: ! 56: VectorCopy(goal, o); ! 57: o[2] -= 6; ! 58: trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); ! 59: if (trace.fraction < 1) { ! 60: VectorCopy(trace.endpos, goal); ! 61: goal[2] += 6; ! 62: } ! 63: ! 64: ent->client->ps.pmove.pm_type = PM_FREEZE; ! 65: ! 66: VectorCopy(goal, ent->s.origin); ! 67: for (i=0 ; i<3 ; i++) ! 68: ent->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(targ->client->v_angle[i] - ent->client->resp.cmd_angles[i]); ! 69: ! 70: VectorCopy(targ->client->v_angle, ent->client->ps.viewangles); ! 71: VectorCopy(targ->client->v_angle, ent->client->v_angle); ! 72: ! 73: ent->viewheight = 0; ! 74: ent->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION; ! 75: gi.linkentity(ent); ! 76: ! 77: if ((!ent->client->showscores && !ent->client->menu && ! 78: !ent->client->showinventory && !ent->client->showhelp && ! 79: !(level.framenum & 31)) || ent->client->update_chase) { ! 80: char s[1024]; ! 81: ! 82: ent->client->update_chase = false; ! 83: sprintf(s, "xv 0 yb -68 string2 \"Chasing %s\"", ! 84: targ->client->pers.netname); ! 85: gi.WriteByte (svc_layout); ! 86: gi.WriteString (s); ! 87: gi.unicast(ent, false); ! 88: } ! 89: ! 90: } ! 91: ! 92: void ChaseNext(edict_t *ent) ! 93: { ! 94: int i; ! 95: edict_t *e; ! 96: ! 97: if (!ent->client->chase_target) ! 98: return; ! 99: ! 100: i = ent->client->chase_target - g_edicts; ! 101: do { ! 102: i++; ! 103: if (i > maxclients->value) ! 104: i = 1; ! 105: e = g_edicts + i; ! 106: if (!e->inuse) ! 107: continue; ! 108: if (e->solid != SOLID_NOT) ! 109: break; ! 110: } while (e != ent->client->chase_target); ! 111: ! 112: ent->client->chase_target = e; ! 113: ent->client->update_chase = true; ! 114: } ! 115: ! 116: void ChasePrev(edict_t *ent) ! 117: { ! 118: int i; ! 119: edict_t *e; ! 120: ! 121: if (!ent->client->chase_target) ! 122: return; ! 123: ! 124: i = ent->client->chase_target - g_edicts; ! 125: do { ! 126: i--; ! 127: if (i < 1) ! 128: i = maxclients->value; ! 129: e = g_edicts + i; ! 130: if (!e->inuse) ! 131: continue; ! 132: if (e->solid != SOLID_NOT) ! 133: break; ! 134: } while (e != ent->client->chase_target); ! 135: ! 136: ent->client->chase_target = e; ! 137: ent->client->update_chase = true; ! 138: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.