Fix oriented sprites - quake draws them backwards.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5893 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-06-21 13:44:14 +00:00
parent 04689373a3
commit aa4cfe91b9
4 changed files with 34 additions and 5 deletions

View file

@ -231,6 +231,9 @@ cvar_t r_menutint = CVARF ("r_menutint", "0.68 0.4 0.13",
cvar_t r_netgraph = CVARD ("r_netgraph", "0", "Displays a graph of packet latency. A value of 2 will give additional info about what sort of data is being received from the server."); cvar_t r_netgraph = CVARD ("r_netgraph", "0", "Displays a graph of packet latency. A value of 2 will give additional info about what sort of data is being received from the server.");
extern cvar_t r_lerpmuzzlehack; extern cvar_t r_lerpmuzzlehack;
extern cvar_t mod_h2holey_bugged, mod_halftexel, mod_nomipmap; extern cvar_t mod_h2holey_bugged, mod_halftexel, mod_nomipmap;
#ifdef SPRMODELS
cvar_t r_sprite_backfacing = CVARD ("r_sprite_backfacing", "0", "Make oriented sprites face backwards relative to their orientation, for compat with q1.");
#endif
cvar_t r_nolerp = CVARF ("r_nolerp", "0", CVAR_ARCHIVE); cvar_t r_nolerp = CVARF ("r_nolerp", "0", CVAR_ARCHIVE);
cvar_t r_noframegrouplerp = CVARF ("r_noframegrouplerp", "0", CVAR_ARCHIVE); cvar_t r_noframegrouplerp = CVARF ("r_noframegrouplerp", "0", CVAR_ARCHIVE);
cvar_t r_nolightdir = CVARF ("r_nolightdir", "0", CVAR_ARCHIVE); cvar_t r_nolightdir = CVARF ("r_nolightdir", "0", CVAR_ARCHIVE);
@ -587,6 +590,9 @@ void GLRenderer_Init(void)
Cvar_Register (&mod_h2holey_bugged, GLRENDEREROPTIONS); Cvar_Register (&mod_h2holey_bugged, GLRENDEREROPTIONS);
Cvar_Register (&mod_halftexel, GLRENDEREROPTIONS); Cvar_Register (&mod_halftexel, GLRENDEREROPTIONS);
Cvar_Register (&mod_nomipmap, GLRENDEREROPTIONS); Cvar_Register (&mod_nomipmap, GLRENDEREROPTIONS);
#endif
#ifdef SPRMODELS
Cvar_Register (&r_sprite_backfacing, GLRENDEREROPTIONS);
#endif #endif
Cvar_Register (&r_lerpmuzzlehack, GLRENDEREROPTIONS); Cvar_Register (&r_lerpmuzzlehack, GLRENDEREROPTIONS);
Cvar_Register (&r_noframegrouplerp, GLRENDEREROPTIONS); Cvar_Register (&r_noframegrouplerp, GLRENDEREROPTIONS);

View file

@ -3794,7 +3794,7 @@ void COM_Gamedir (const char *dir, const struct gamepacks *packagespaths)
/*quake requires a few settings for compatibility*/ /*quake requires a few settings for compatibility*/
#define QRPCOMPAT "set cl_cursor_scale 0.2\nset cl_cursor_bias_x 7.5\nset cl_cursor_bias_y 0.8\n" #define QRPCOMPAT "set cl_cursor_scale 0.2\nset cl_cursor_bias_x 7.5\nset cl_cursor_bias_y 0.8\n"
#define QUAKESPASMSUCKS "set mod_h2holey_bugged 1\n" #define QUAKESPASMSUCKS "set mod_h2holey_bugged 1\n"
#define QCFG "set v_gammainverted 1\nset con_stayhidden 0\nset com_parseutf8 0\nset allow_download_pakcontents 1\nset allow_download_refpackages 0\nset r_meshpitch -1\nset sv_bigcoords \"\"\nmap_autoopenportals 1\n" "sv_port "STRINGIFY(PORT_QWSERVER)" "STRINGIFY(PORT_NQSERVER)"\n" ZFIXHACK EZQUAKECOMPETITIVE QRPCOMPAT QUAKESPASMSUCKS #define QCFG "set v_gammainverted 1\nset con_stayhidden 0\nset com_parseutf8 0\nset allow_download_pakcontents 1\nset allow_download_refpackages 0\nset r_meshpitch -1\nr_sprite_backfacing 1\nset sv_bigcoords \"\"\nmap_autoopenportals 1\n" "sv_port "STRINGIFY(PORT_QWSERVER)" "STRINGIFY(PORT_NQSERVER)"\n" ZFIXHACK EZQUAKECOMPETITIVE QRPCOMPAT QUAKESPASMSUCKS
/*NetQuake reconfiguration, to make certain people feel more at home...*/ /*NetQuake reconfiguration, to make certain people feel more at home...*/
#define NQCFG "//disablehomedir 1\n//mainconfig ftenq\ncfg_save_auto 1\n" QCFG "set sv_nqplayerphysics 1\nset cl_loopbackprotocol auto\ncl_sbar 1\nset plug_sbar 0\nset sv_port "STRINGIFY(PORT_NQSERVER)"\ncl_defaultport "STRINGIFY(PORT_NQSERVER)"\nset m_preset_chosen 1\nset vid_wait 1\nset cl_demoreel 1\n" #define NQCFG "//disablehomedir 1\n//mainconfig ftenq\ncfg_save_auto 1\n" QCFG "set sv_nqplayerphysics 1\nset cl_loopbackprotocol auto\ncl_sbar 1\nset plug_sbar 0\nset sv_port "STRINGIFY(PORT_NQSERVER)"\ncl_defaultport "STRINGIFY(PORT_NQSERVER)"\nset m_preset_chosen 1\nset vid_wait 1\nset cl_demoreel 1\n"
#define SPASMCFG NQCFG "fps_preset builtin_spasm\nset cl_demoreel 0\ncl_sbar 2\nset gl_load24bit 1\n" #define SPASMCFG NQCFG "fps_preset builtin_spasm\nset cl_demoreel 0\ncl_sbar 2\nset gl_load24bit 1\n"
@ -3810,7 +3810,7 @@ void COM_Gamedir (const char *dir, const struct gamepacks *packagespaths)
/*some modern non-compat settings*/ /*some modern non-compat settings*/
#define DMFCFG "set com_parseutf8 1\npm_airstep 1\nsv_demoExtensions 1\n" #define DMFCFG "set com_parseutf8 1\npm_airstep 1\nsv_demoExtensions 1\n"
/*set some stuff so our regular qw client appears more like hexen2. sv_mintic is required to 'fix' the ravenstaff so that its projectiles don't impact upon each other*/ /*set some stuff so our regular qw client appears more like hexen2. sv_mintic is required to 'fix' the ravenstaff so that its projectiles don't impact upon each other*/
#define HEX2CFG "set v_gammainverted 1\nset com_parseutf8 -1\nset gl_font gfx/hexen2\nset in_builtinkeymap 0\nset_calc cl_playerclass int (random * 5) + 1\nset cl_forwardspeed 200\nset cl_backspeed 200\ncl_sidespeed 225\nset sv_maxspeed 640\ncl_run 0\nset watervis 1\nset r_lavaalpha 1\nset r_lavastyle -2\nset r_wateralpha 0.5\nset sv_pupglow 1\ngl_shaftlight 0.5\nsv_mintic 0.015\nset r_meshpitch -1\nset r_meshroll -1\nset mod_warnmodels 0\nset cl_model_bobbing 1\nsv_sound_watersplash \"misc/hith2o.wav\"\nsv_sound_land \"fx/thngland.wav\"\nset sv_walkpitch 0\n" #define HEX2CFG "set v_gammainverted 1\nset com_parseutf8 -1\nset gl_font gfx/hexen2\nset in_builtinkeymap 0\nset_calc cl_playerclass int (random * 5) + 1\nset cl_forwardspeed 200\nset cl_backspeed 200\ncl_sidespeed 225\nset sv_maxspeed 640\ncl_run 0\nset watervis 1\nset r_lavaalpha 1\nset r_lavastyle -2\nset r_wateralpha 0.5\nset sv_pupglow 1\ngl_shaftlight 0.5\nsv_mintic 0.015\nset r_meshpitch -1\nset r_meshroll -1\nr_sprite_backfacing 1\nset mod_warnmodels 0\nset cl_model_bobbing 1\nsv_sound_watersplash \"misc/hith2o.wav\"\nsv_sound_land \"fx/thngland.wav\"\nset sv_walkpitch 0\n"
/*yay q2!*/ /*yay q2!*/
#define Q2CFG "set v_gammainverted 1\nset com_parseutf8 0\ncom_nogamedirnativecode 0\nset sv_bigcoords 0\nsv_port "STRINGIFY(PORT_Q2SERVER)"\n" #define Q2CFG "set v_gammainverted 1\nset com_parseutf8 0\ncom_nogamedirnativecode 0\nset sv_bigcoords 0\nsv_port "STRINGIFY(PORT_Q2SERVER)"\n"
/*Q3's ui doesn't like empty model/headmodel/handicap cvars, even if the gamecode copes*/ /*Q3's ui doesn't like empty model/headmodel/handicap cvars, even if the gamecode copes*/

View file

@ -40,6 +40,7 @@ typedef struct
extern cvar_t gl_part_flame, r_fullbrightSkins, r_fb_models, ruleset_allow_fbmodels; extern cvar_t gl_part_flame, r_fullbrightSkins, r_fb_models, ruleset_allow_fbmodels;
extern cvar_t r_noaliasshadows; extern cvar_t r_noaliasshadows;
extern cvar_t r_lodscale, r_lodbias; extern cvar_t r_lodscale, r_lodbias;
extern cvar_t r_sprite_backfacing;
extern cvar_t gl_ati_truform; extern cvar_t gl_ati_truform;
extern cvar_t r_vertexdlights; extern cvar_t r_vertexdlights;
@ -2654,7 +2655,7 @@ static void R_Sprite_GenerateTrisoup(entity_t *e, int bemode)
sprtype = psprite->type; sprtype = psprite->type;
} }
switch(sprtype) safeswitch(sprtype)
{ {
case SPR_ORIENTED: case SPR_ORIENTED:
// bullet marks on walls // bullet marks on walls
@ -2662,9 +2663,13 @@ static void R_Sprite_GenerateTrisoup(entity_t *e, int bemode)
Matrix3_Multiply(e->axis, r_refdef.playerview->vw_axis, spraxis); Matrix3_Multiply(e->axis, r_refdef.playerview->vw_axis, spraxis);
else else
memcpy(spraxis, e->axis, sizeof(spraxis)); memcpy(spraxis, e->axis, sizeof(spraxis));
if (!r_sprite_backfacing.ival)
VectorNegate(spraxis[1], spraxis[1]);
break; break;
case SPR_FACING_UPRIGHT: case SPR_FACING_UPRIGHT:
//up vector is worldspace up
//side is crossproduct of (org-vieworg),up
spraxis[2][0] = 0;spraxis[2][1] = 0;spraxis[2][2]=1; spraxis[2][0] = 0;spraxis[2][1] = 0;spraxis[2][2]=1;
spraxis[1][0] = sprorigin[1] - r_origin[1]; spraxis[1][0] = sprorigin[1] - r_origin[1];
spraxis[1][1] = -(sprorigin[0] - r_origin[0]); spraxis[1][1] = -(sprorigin[0] - r_origin[0]);
@ -2672,13 +2677,31 @@ static void R_Sprite_GenerateTrisoup(entity_t *e, int bemode)
VectorNormalize (spraxis[1]); VectorNormalize (spraxis[1]);
break; break;
case SPR_VP_PARALLEL_UPRIGHT: case SPR_VP_PARALLEL_UPRIGHT:
//up vector is worldspace up
//side vector matches view
spraxis[2][0] = 0;spraxis[2][1] = 0;spraxis[2][2]=1; spraxis[2][0] = 0;spraxis[2][1] = 0;spraxis[2][2]=1;
VectorCopy (vright, spraxis[1]); VectorCopy (vright, spraxis[1]);
break; break;
default: case SPR_VP_PARALLEL_ORIENTED:
//normal sprite, except rotating with roll angles
{
vec3_t ang;
int i;
float cr,sr;
VectorAngles(e->axis[0], e->axis[2], ang, false); //bah, slow.
cr = cos(ang[2] * M_PI/180);
sr = sin(ang[2]);
for (i=0 ; i<3 ; i++)
{
spraxis[1][i] = vright[i] * cr + vup[i] * sr;
spraxis[2][i] = vright[i] * -sr + vup[i] * cr;
}
}
break;
case SPR_VP_PARALLEL: case SPR_VP_PARALLEL:
//normal sprite //normal sprite
safedefault:
VectorCopy(vup, spraxis[2]); VectorCopy(vup, spraxis[2]);
VectorCopy(vright, spraxis[1]); VectorCopy(vright, spraxis[1]);
break; break;

View file

@ -5887,7 +5887,7 @@ qboolean QDECL Mod_LoadSpriteModel (model_t *mod, void *buffer, size_t fsize)
case SPR_FACING_UPRIGHT: case SPR_FACING_UPRIGHT:
case SPR_VP_PARALLEL: case SPR_VP_PARALLEL:
case SPR_ORIENTED: case SPR_ORIENTED:
// case SPR_VP_PARALLEL_ORIENTED: case SPR_VP_PARALLEL_ORIENTED:
// case SPRDP_LABEL: // case SPRDP_LABEL:
// case SPRDP_LABEL_SCALE: // case SPRDP_LABEL_SCALE:
// case SPRDP_OVERHEAD: // case SPRDP_OVERHEAD: