X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=chase.c;h=cef9305828cde8d0ffd9d4023fc91562614c6c61;hb=59e3b3ad8006957578534b8d3536f4b695609af1;hp=fa0f0a03f1fbc064049f709354d7a3ce77df3aa8;hpb=1019743b2072b60aa1a2897b04c7cbb8f94454d1;p=xonotic%2Fdarkplaces.git diff --git a/chase.c b/chase.c index fa0f0a03..cef93058 100644 --- a/chase.c +++ b/chase.c @@ -25,12 +25,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. cvar_t chase_back = {CVAR_SAVE, "chase_back", "48"}; cvar_t chase_up = {CVAR_SAVE, "chase_up", "24"}; cvar_t chase_active = {CVAR_SAVE, "chase_active", "0"}; +// GAME_GOODVSBAD2 +cvar_t chase_stevie = {0, "chase_stevie", "0"}; void Chase_Init (void) { Cvar_RegisterVariable (&chase_back); Cvar_RegisterVariable (&chase_up); Cvar_RegisterVariable (&chase_active); + if (gamemode == GAME_GOODVSBAD2) + Cvar_RegisterVariable (&chase_stevie); } void Chase_Reset (void) @@ -41,20 +45,33 @@ void Chase_Reset (void) void Chase_Update (void) { - vec3_t forward, stop, chase_dest, normal; - float dist; - - chase_back.value = bound(0, chase_back.value, 128); - chase_up.value = bound(-48, chase_up.value, 96); - - AngleVectors (cl.viewangles, forward, NULL, NULL); + vec_t camback, camup, dist, forward[3], stop[3], chase_dest[3], normal[3], projectangles[3]; + + camback = bound(0, chase_back.value, 128); + if (chase_back.value != camback) + Cvar_SetValueQuick(&chase_back, camback); + camup = bound(-48, chase_up.value, 96); + if (chase_up.value != camup) + Cvar_SetValueQuick(&chase_up, camup); + + // this + 22 is to match view_ofs for compatibility with older versions + camup += 22; + + VectorCopy(cl.viewangles, projectangles); + if (gamemode == GAME_GOODVSBAD2 && chase_stevie.integer) + { + projectangles[0] = 90; + r_refdef.viewangles[0] = 90; + camback = 2048; + } + AngleVectors (projectangles, forward, NULL, NULL); dist = -chase_back.value - 8; chase_dest[0] = r_refdef.vieworg[0] + forward[0] * dist; chase_dest[1] = r_refdef.vieworg[1] + forward[1] * dist; chase_dest[2] = r_refdef.vieworg[2] + forward[2] * dist + chase_up.value; - CL_TraceLine (r_refdef.vieworg, chase_dest, stop, normal, 0, true); + CL_TraceLine(r_refdef.vieworg, chase_dest, stop, normal, true, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_SKY); chase_dest[0] = stop[0] + forward[0] * 8 + normal[0] * 4; chase_dest[1] = stop[1] + forward[1] * 8 + normal[1] * 4; chase_dest[2] = stop[2] + forward[2] * 8 + normal[2] * 4;