Editors note: this is a very cool effect, you'll have all your view x-flipped, so left becomes right and vica versa.
Simple tutorial to add x flipping to the Quake engine(and a cvar to control it). Open up cl_input.c and find the CL_AdjustAngles function and add the following(between the "//Atomizer" and "//Atom" comments): void CL_AdjustAngles (void) { float speed; float up, down; if (in_speed.state & 1) speed = host_frametime * cl_anglespeedkey.value; else speed = host_frametime; //Atomizer - GL_XFLIP if (gl_xflip.value) cl.viewangles[YAW] *= -1; //Atom if (!(in_strafe.state & 1)) { cl.viewangles[YAW] -= speed*cl_yawspeed.value*CL_KeyState (&in_right); cl.viewangles[YAW] += speed*cl_yawspeed.value*CL_KeyState (&in_left); cl.viewangles[YAW] = anglemod(cl.viewangles[YAW]); } //Atomizer - GL_XFLIP if (gl_xflip.value) cl.viewangles[YAW] *= -1; //Atom Now in the same file, find the CL_BaseMove function and add the changes: void CL_BaseMove (usercmd_t *cmd) { if (cls.signon != SIGNONS) return; CL_AdjustAngles (); Q_memset (cmd, 0, sizeof(*cmd)); if (in_strafe.state & 1) { cmd->sidemove += cl_sidespeed.value * CL_KeyState (&in_right); cmd->sidemove -= cl_sidespeed.value * CL_KeyState (&in_left); } cmd->sidemove += cl_sidespeed.value * CL_KeyState (&in_moveright); cmd->sidemove -= cl_sidespeed.value * CL_KeyState (&in_moveleft); //Atomizer - GL_XFLIP if(gl_xflip.value) cmd->sidemove *= -1; //Atom Now open up gl_rmain.c and find the following line: cvar_t gl_doubleeyes = {"gl_doubleeys", "1"}; And add this below it: //Atomizer - GL_XFLIP cvar_t gl_xflip = {"gl_xflip", "0"}; //Atom In the same file, find R_SetupGL and add the following: glRotatef (-90, 1, 0, 0); // put Z going up glRotatef (90, 0, 0, 1); // put Z going up //Atomizer - GL_XFLIP if (gl_xflip.value) { glScalef (1, -1, 1); glCullFace(GL_BACK); } //Atom glRotatef (-r_refdef.viewangles[2], 1, 0, 0); glRotatef (-r_refdef.viewangles[0], 0, 1, 0); glRotatef (-r_refdef.viewangles[1], 0, 0, 1); Cvar_RegisterVariable (&gl_doubleeyes); //Atomizer - GL_XFLIP Cvar_RegisterVariable (&gl_xflip); //Atom extern cvar_t gl_doubleeyes; //Atomizer - GL_XFLIP extern cvar_t gl_xflip; //Atom //if (mx || my) // Con_DPrintf("mx=%d, my=%d\n", mx, my); //Atomizer - GL_XFLIP if(gl_xflip.value) mx *= -1; //Atom if (m_filter.value) { mouse_x = (mx + old_mouse_x) * 0.5; mouse_y = (my + old_mouse_y) * 0.5; } else { mouse_x = mx; mouse_y = my; } |