Zandronum Chat on our Discord Server Get the latest version: 3.2
Source Code

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002029Zandronum[All Projects] Bugpublic2014-12-19 20:412016-02-13 22:11
ReporterCh0wW 
Assigned ToTorr Samaho 
PrioritynormalSeverityminorReproducibilityalways
Statusneeds reviewResolutionopen 
PlatformOSOS Version
Product Version1.3 
Target VersionFixed in Version 
Summary0002029: "Draw Coop Infos" and weirdness/optimisations
DescriptionAs a spectator, using "Coop Infos" (or Sitrep) on CTF games has unwanted elements readable.

For instance, the Ammo. When spectating someone in his "eyes", you have no info about his ammo. However, with the coop infos, ammo is displayed. So either display his ammo, or just don't display it at all?

Steps To Reproduce1) Play CTF or any competitive gamemode.
2) Be a spectator and don't spec someone's eyes.
3) Check "Coop Infos"
4) Ammo is readable.

Additional InformationAlso, optimising space, by not showing ???/??? on competitive gamemodes should be done. Wasting space for useless text isn't really wanted.
Attached Filespng file icon Screenshot_Doom_20141219_211546.png [^] (214,848 bytes) 2014-12-20 02:11


png file icon Screenshot_Doom_20141219_211551.png [^] (352,459 bytes) 2014-12-20 02:11

- Relationships

-  Notes
User avatar (0011081)
Watermelon (developer)
2014-12-21 16:56

The HUD is sadly a mess and in need of re-working. I'll be overhauling a lot of it with the new scoreboard that will have to rip apart the HUD.

If you have any graphical ideas you should post them as to what it should look like.
User avatar (0011084)
Ch0wW (reporter)
2014-12-22 11:34
edited on: 2014-12-22 17:43

Here is a DrawHUD_CoopInfo() optimisation code, with the ammo fixed, but I don't think it is complete.

It now does the following:

- Check the following gamemode, to check if the server has a "casual" gamemode (ie: coop/survival/invasion).

- Do NOT display health if we're not in a casual gamemode. However, players within a team can still see them, or if the server allows to see player's health as a spectator.

- Do NOT display ammo if we're not in a casual gamemode. However, display still his weapon or if he's dead (or not, if the server allows to see player's health as a spectator)

'http://pastebin.com/ae3AgHXj [^]'

EDIT: SCREENSHOTS:

'http://image.noelshack.com/fichiers/2014/52/1419270058-screenshot-doom-20141222-183122.png [^]'
'http://image.noelshack.com/fichiers/2014/52/1419270057-screenshot-doom-20141222-183948.png [^]'
'http://image.noelshack.com/fichiers/2014/52/1419270058-screenshot-doom-20141222-184023.png [^]'

User avatar (0014433)
Ch0wW (reporter)
2016-02-13 22:11

Looks like my previous patch didn't fix a rare case where everyone could see life and armor, aswell as ammo.

Here's the real fix.


// Ch0wW: Fixed view (issue:'https://zandronum.com/tracker/view.php?id=2029 [^]' )
void DrawHUD_CoopInfo()
{
    // [BB] Only draw the info if the user wishes to see it (cl_drawcoopinfo)
    // and if this is a cooperative or team based game mode. Further don't draw this in single player.
    if ( ( cl_drawcoopinfo == false ) || ( zadmflags & ZADF_NO_COOP_INFO )
        || ! ( (GAMEMODE_GetFlags( GAMEMODE_GetCurrentMode( )) & GMF_COOPERATIVE)
            || (GAMEMODE_GetFlags( GAMEMODE_GetCurrentMode( )) & GMF_PLAYERSONTEAMS) )
        || NETWORK_GetState() == NETSTATE_SINGLE )
        return;

    const bool bScale = HUD_IsScaled();
    bool bCanSeeLife;

    FString drawString;

    // [BB] We may not draw in the first 4 lines, this is reserved for chat messages.
    // Leave free another line to prevent the keys from being drawn over in ST's
    // fullscreen HUD.
    // [Dusk] Said message field can now have an arbitrary amount of lines, so
    // we cannot assume the default 4.
    const int yOffset = ( 1 + con_notifylines ) * SmallFont->GetHeight( );
    int playersDrawn = 0;

    for ( int i = 0; i < MAXPLAYERS; i++ )
    {
        // [BB] Only draw the info of players who are actually in the game.
        if ( (playeringame[i] == false) || ( players[i].bSpectating ) || (players[i].mo == NULL) )
            continue;

        // [BB] No need to draw the info of the player who's eyes we are looking through.
        if ( players[i].mo->CheckLocalView( consoleplayer ) )
            continue;

        // [BB] Only display team mates (in coop all players are team mates). Spectators see everybody.
        if ( players[consoleplayer].camera && !players[consoleplayer].camera->IsTeammate ( players[i].mo )
            && !( players[consoleplayer].camera->player && players[consoleplayer].camera->player->bSpectating ) )
            continue;

        // [BB] We need more spacing if there is SECTINFO.
        int curYPos = yOffset + (playersDrawn/2) * ( ( 4 + ( level.info->SectorInfo.Names.Size() > 0 ) ) * SmallFont->GetHeight( ) + 3 ) ;

        const bool drawLeft = ( playersDrawn % 2 == 0 );

        // [BB] Draw player name.
        drawString = players[i].userinfo.netname;
        V_ColorizeString( drawString );
        EColorRange nameColor = CR_GREY;
        // [BB] If the player is on a team, use the team's text color.
        if ( GAMEMODE_GetFlags( GAMEMODE_GetCurrentMode( )) & GMF_PLAYERSONTEAMS )
            nameColor = static_cast<EColorRange> ( TEAM_GetTextColor ( players[i].ulTeam ) );
        HUD_DrawTextAligned ( nameColor, curYPos, drawString.GetChars(), drawLeft, bScale );
        curYPos += SmallFont->GetHeight( ) + 1;

        // [BL] Draw the player's location, [BB] but only if the map has any SectorInfo.
        if ( level.info->SectorInfo.Names.Size() > 0 )
        {
            drawString = SECTINFO_GetPlayerLocation( i );
            V_ColorizeString( drawString );
            HUD_DrawTextAligned ( CR_GREY, curYPos, drawString.GetChars(), drawLeft, bScale );
            curYPos += SmallFont->GetHeight( ) + 1;
        }

        //============= NEW PART

        // Ch0wW -- Health indicator is only seen for players, OR if the server allows knowing life.
        if (SERVER_IsPlayerAllowedToKnowHealth( consoleplayer, i))
        {
            // [BB] Draw player health (color coded) and armor.
            EColorRange healthColor = CR_RED;
            // [BB] Player is alive.
            if ( players[i].mo->health <= 0 )
                drawString = "dead";
            else
            {
                AInventory* pArmor = players[i].mo->FindInventory(RUNTIME_CLASS(ABasicArmor));
                drawString.Format( "%d \\cD/ %d", players[i].mo->health, pArmor ? pArmor->Amount : 0 );
                V_ColorizeString( drawString );
                if ( players[i].mo->health > 66 )
                    healthColor = CR_GREEN;
                else if ( players[i].mo->health > 33 )
                    healthColor = CR_GOLD;
            }
            HUD_DrawTextAligned ( healthColor, curYPos, drawString.GetChars(), drawLeft, bScale );
            curYPos += SmallFont->GetHeight( ) + 1;

        // [BB] Draw player weapon and Ammo1/Ammo2, but only if the player is alive.
        // [Spleen] And don't draw ammo if sv_infiniteammo is enabled.
        // Ch0wW -- Rewriting for DrawCoopinfo patch:
        // >> If we're in a casual gamemode or that we're a player, you can get info from your friends
            if (players[i].ReadyWeapon && players[i].mo->health > 0)
            {
                drawString = players[i].ReadyWeapon->GetClass()->TypeName;

                if ( players[i].ReadyWeapon->Ammo1 && ( ( dmflags & DF_INFINITE_AMMO ) == false ) )
                    drawString.AppendFormat( " \\cf%d", players[i].ReadyWeapon->Ammo1->Amount );
                else
                    drawString += " \\cg-";
                if ( players[i].ReadyWeapon->Ammo2 && ( ( dmflags & DF_INFINITE_AMMO ) == false ) )
                    drawString.AppendFormat( " \\cf%d", players[i].ReadyWeapon->Ammo2->Amount );

                V_ColorizeString( drawString );
                HUD_DrawTextAligned ( CR_GREEN, curYPos, drawString.GetChars(), drawLeft, bScale );
            }
        }
        else // Ch0wW -- ELSE, in competitive and as a spectator, know only his weapon OR if he's dead...
        {
            if (players[i].ReadyWeapon)
            {
                EColorRange healthColor = CR_GREEN;
                
                if (players[i].mo->health > 0)
                    drawString = players[i].ReadyWeapon->GetClass()->TypeName;

                // If he's dead, simply put "dead" (or nothing, depending of the DMFLAGS) ...
                else if ( players[i].mo->health <= 0 ) {
                    healthColor = CR_RED;
                    drawString = "dead";
                }
                V_ColorizeString( drawString );
                HUD_DrawTextAligned ( healthColor, curYPos, drawString.GetChars(), drawLeft, bScale );
            }
        }

        playersDrawn++;
    }
}

Issue Community Support
Only registered users can voice their support. Click here to register, or here to log in.
Supporters: AlienOverlord JC Ch0wW FascistCat unknownna
Opponents: No one explicitly opposes this issue yet.

- Issue History
Date Modified Username Field Change
2014-12-19 20:41 Ch0wW New Issue
2014-12-20 02:11 Ch0wW File Added: Screenshot_Doom_20141219_211546.png
2014-12-20 02:11 Ch0wW File Added: Screenshot_Doom_20141219_211551.png
2014-12-21 16:56 Watermelon Note Added: 0011081
2014-12-21 16:56 Watermelon Status new => acknowledged
2014-12-22 11:34 Ch0wW Note Added: 0011084
2014-12-22 17:43 Ch0wW Note Edited: 0011084 View Revisions
2014-12-28 16:10 Torr Samaho Assigned To => Torr Samaho
2014-12-28 16:10 Torr Samaho Status acknowledged => needs review
2016-02-13 22:11 Ch0wW Note Added: 0014433






Questions or other issues? Contact Us.

Links


Copyright © 2000 - 2025 MantisBT Team
Powered by Mantis Bugtracker