MantisBT - Zandronum
View Issue Details
0002642Zandronum[All Projects] Suggestionpublic2016-02-16 09:162016-10-10 22:41
capodecima 
 
normaltweakalways
newopen 
MicrosoftWindowsXP/Vista/7
 
 
0002642: Transparent gun, variable r_drawplayersprites
This feature is best known from Quakelive. For competitive gaming can be this feature very useful. Chowww already made patch for it, this could looks something like this'http://image.noelshack.com/fichiers/2014/37/1410570961-odamex-coop-20140913-031518-copy.png. [^]' The command r_playersprites can be variable from 1 (enabled sprites) to 0 (fully transparent). This feature is already on odamex btw.

The code:
1) Change the r_drawplayersprites cvar in cl_cvarlist.cpp :

CVAR_RANGE (r_drawplayersprites, "1", "Draws Weapon opacity", CVARTYPE_FLOAT, CVAR_ARCHIVE | CVAR_NOENABLEDISABLE, 0.0f, 1.0f)

2) in r_things.cpp, in void R_DrawPSprite (pspdef_t* psp, unsigned flags):
find this:
    vis->translucency = FRACUNIT;

And replace by:
    vis->translucency = r_drawplayersprites * FRACUNIT; // Ch0wW: Weapon opacity

Should do the trick.

Can be prob slightly diff on zandronum
No tags attached.
Issue History
2016-02-16 09:16capodecimaNew Issue
2016-02-27 12:55Ch0wWNote Added: 0014506
2016-02-27 12:58Ch0wWNote Edited: 0014506bug_revision_view_page.php?bugnote_id=14506#r8780
2016-10-10 22:41capodecimaNote Added: 0015890
2016-10-11 05:29DuskNote Deleted: 0015890

Notes
(0014506)
Ch0wW   
2016-02-27 12:55   
(edited on: 2016-02-27 12:58)
That's not that easy to put it that way, capo ;)

There's much more elements to check, especially with the software AND OpenGL renderer.

The way I've done was not the best, but well, it works:

1) In gl_model.cpp, in void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)

2) I added a fixed_t variable called alphawp;

3)
// Ch0wW: Add alphaweapons START
    
    if (PLAYER_IsTrueSpectator(playermo->player))
        playermo->RenderStyle = STYLE_None;
    else
        playermo->RenderStyle = STYLE_Translucent;
        alphawp = FRACUNIT*r_drawplayersprites;

    vis.RenderStyle=playermo->RenderStyle;
    vis.alpha=alphawp;
    // Ch0wW: Add alphaweapons STOP


That way, the local character is rendered with opacity, which affects the weapon too.

But I'm not against this o/ .