feature: show player names (#234)

# Conflicts:
#	source/blood/src/config.cpp
#	source/blood/src/config.h
#	source/blood/src/menu.cpp
#	source/blood/src/osdcmd.cpp
This commit is contained in:
CommonLoon102 2019-10-27 16:55:14 +00:00 committed by Christoph Oelckers
parent 19b9e34726
commit 43da4b68a2
4 changed files with 35 additions and 8 deletions

View file

@ -386,7 +386,7 @@ bool IntersectRay(int wx, int wy, int wdx, int wdy, int x1, int y1, int z1, int
return 1; return 1;
} }
int HitScan(spritetype *pSprite, int z, int dx, int dy, int dz, unsigned int nMask, int a8) int HitScan(spritetype *pSprite, int z, int dx, int dy, int dz, unsigned int nMask, int nRange)
{ {
dassert(pSprite != NULL); dassert(pSprite != NULL);
dassert(dx != 0 || dy != 0); dassert(dx != 0 || dy != 0);
@ -398,10 +398,10 @@ int HitScan(spritetype *pSprite, int z, int dx, int dy, int dz, unsigned int nMa
int nSector = pSprite->sectnum; int nSector = pSprite->sectnum;
int bakCstat = pSprite->cstat; int bakCstat = pSprite->cstat;
pSprite->cstat &= ~256; pSprite->cstat &= ~256;
if (a8) if (nRange)
{ {
hitscangoal.x = x + mulscale30(a8 << 4, Cos(pSprite->ang)); hitscangoal.x = x + mulscale30(nRange << 4, Cos(pSprite->ang));
hitscangoal.y = y + mulscale30(a8 << 4, Sin(pSprite->ang)); hitscangoal.y = y + mulscale30(nRange << 4, Sin(pSprite->ang));
} }
else else
{ {

View file

@ -58,6 +58,7 @@ void SetCDVol(CGameMenuItemSlider *);
void SetDoppler(CGameMenuItemZBool *); void SetDoppler(CGameMenuItemZBool *);
void SetCrosshair(CGameMenuItemZBool *); void SetCrosshair(CGameMenuItemZBool *);
void SetCenterHoriz(CGameMenuItemZBool *); void SetCenterHoriz(CGameMenuItemZBool *);
void SetShowPlayerNames(CGameMenuItemZBool *);
void SetShowWeapons(CGameMenuItemZCycle *); void SetShowWeapons(CGameMenuItemZCycle *);
void SetSlopeTilting(CGameMenuItemZBool *); void SetSlopeTilting(CGameMenuItemZBool *);
void SetViewBobbing(CGameMenuItemZBool *); void SetViewBobbing(CGameMenuItemZBool *);
@ -409,6 +410,7 @@ CGameMenuItemTitle itemOptionsGameTitle("GAME SETUP", 1, 160, 20, 2038);
CGameMenuItemZBool itemOptionsGameBoolWeaponsV10X("V1.0x WEAPONS BALANCE:", 3, 66, 130, 180, gWeaponsV10x, SetWeaponsV10X, NULL, NULL); CGameMenuItemZBool itemOptionsGameBoolWeaponsV10X("V1.0x WEAPONS BALANCE:", 3, 66, 130, 180, gWeaponsV10x, SetWeaponsV10X, NULL, NULL);
/////////////////// ///////////////////
CGameMenuItemZBool itemOptionsGameBoolShowPlayerNames("SHOW PLAYER NAMES:", 3, 66, 60, 180, gShowPlayerNames, SetShowPlayerNames, NULL, NULL);
CGameMenuItemZCycle itemOptionsGameShowWeapons("SHOW WEAPONS:", 3, 66, 70, 180, 0, SetShowWeapons, pzShowWeaponStrings, ARRAY_SSIZE(pzShowWeaponStrings), 0); CGameMenuItemZCycle itemOptionsGameShowWeapons("SHOW WEAPONS:", 3, 66, 70, 180, 0, SetShowWeapons, pzShowWeaponStrings, ARRAY_SSIZE(pzShowWeaponStrings), 0);
CGameMenuItemZBool itemOptionsGameBoolSlopeTilting("SLOPE TILTING:", 3, 66, 80, 180, cl_slopetilting, SetSlopeTilting, NULL, NULL); CGameMenuItemZBool itemOptionsGameBoolSlopeTilting("SLOPE TILTING:", 3, 66, 80, 180, cl_slopetilting, SetSlopeTilting, NULL, NULL);
CGameMenuItemZBool itemOptionsGameBoolViewBobbing("VIEW BOBBING:", 3, 66, 90, 180, cl_viewvbob, SetViewBobbing, NULL, NULL); CGameMenuItemZBool itemOptionsGameBoolViewBobbing("VIEW BOBBING:", 3, 66, 90, 180, cl_viewvbob, SetViewBobbing, NULL, NULL);
@ -1117,7 +1119,8 @@ void SetupOptionsMenu(void)
menuOptions.Add(&itemBloodQAV, false); menuOptions.Add(&itemBloodQAV, false);
menuOptionsGame.Add(&itemOptionsGameTitle, false); menuOptionsGame.Add(&itemOptionsGameTitle, false);
menuOptionsGame.Add(&itemOptionsGameShowWeapons, true); menuOptionsGame.Add(&itemOptionsGameBoolShowPlayerNames, true);
menuOptionsGame.Add(&itemOptionsGameShowWeapons, false);
menuOptionsGame.Add(&itemOptionsGameBoolSlopeTilting, false); menuOptionsGame.Add(&itemOptionsGameBoolSlopeTilting, false);
menuOptionsGame.Add(&itemOptionsGameBoolViewBobbing, false); menuOptionsGame.Add(&itemOptionsGameBoolViewBobbing, false);
menuOptionsGame.Add(&itemOptionsGameBoolViewSwaying, false); menuOptionsGame.Add(&itemOptionsGameBoolViewSwaying, false);
@ -1407,6 +1410,11 @@ void SetWeaponsV10X(CGameMenuItemZBool* pItem)
} }
//// ////
void SetShowPlayerNames(CGameMenuItemZBool *pItem)
{
cl_idplayers = pItem->at20;
}
void SetShowWeapons(CGameMenuItemZCycle *pItem) void SetShowWeapons(CGameMenuItemZCycle *pItem)
{ {
cl_showweapon = pItem->m_nFocus; cl_showweapon = pItem->m_nFocus;

View file

@ -1283,6 +1283,25 @@ void viewDrawMapTitle(void)
} }
} }
void viewDrawAimedPlayerName(void)
{
if (!cl_idplayers || (gView->aim.dx == 0 && gView->aim.dy == 0))
return;
int hit = HitScan(gView->pSprite, gView->pSprite->z, gView->aim.dx, gView->aim.dy, gView->aim.dz, CLIPMASK0, 512);
if (hit == 3)
{
spritetype* pSprite = &sprite[gHitInfo.hitsprite];
if (IsPlayerSprite(pSprite))
{
char nPlayer = pSprite->type-kDudePlayer1;
char* szName = gProfile[nPlayer].name;
int nPalette = (gPlayer[nPlayer].teamId&3)+11;
viewDrawText(4, szName, 160, 125, -128, nPalette, 1, 1);
}
}
}
void viewDrawPack(PLAYER *pPlayer, int x, int y) void viewDrawPack(PLAYER *pPlayer, int x, int y)
{ {
int packs[5]; int packs[5];
@ -1701,8 +1720,6 @@ void UpdateStatusBar(ClockTicks arg)
viewDrawPowerUps(pPlayer); viewDrawPowerUps(pPlayer);
} }
viewDrawMapTitle();
if (gGameOptions.nGameType < 1) return; if (gGameOptions.nGameType < 1) return;
if (gGameOptions.nGameType == 3) if (gGameOptions.nGameType == 3)
@ -3550,6 +3567,8 @@ RORHACK:
printext256(fX-strlen(gTempStr)*4, fY, 31, -1, gTempStr, 1); printext256(fX-strlen(gTempStr)*4, fY, 31, -1, gTempStr, 1);
} }
#endif #endif
viewDrawMapTitle();
viewDrawAimedPlayerName();
viewPrintFPS(); viewPrintFPS();
if (gPaused) if (gPaused)
{ {

View file

@ -64,7 +64,7 @@ CVARD(Int, cl_maxautosaves, 8, CVAR_ARCHIVE, "number of autosaves to keep before
CVARD(Int, cl_cheatmask, ~0, CVAR_ARCHIVE, "configure what cheats show in the cheats menu") CVARD(Int, cl_cheatmask, ~0, CVAR_ARCHIVE, "configure what cheats show in the cheats menu")
CVARD(Bool, cl_obituaries, true, CVAR_ARCHIVE, "enable/disable multiplayer death messages") // Not implemented for Blood CVARD(Bool, cl_obituaries, true, CVAR_ARCHIVE, "enable/disable multiplayer death messages") // Not implemented for Blood
CVARD(Bool, cl_democams, true, CVAR_ARCHIVE, "enable/disable demo playback cameras") // Not implemented for Blood CVARD(Bool, cl_democams, true, CVAR_ARCHIVE, "enable/disable demo playback cameras") // Not implemented for Blood
CVARD(Bool, cl_idplayers, true, CVAR_ARCHIVE, "enable/disable name display when aiming at opponents") // Not implemented for Blood CVARD(Bool, cl_idplayers, true, CVAR_ARCHIVE, "enable/disable name display when aiming at opponents")
CVARD(Bool, cl_showcoords, false, 0, "show your position in the game world") // This is a debug oprion in its current form, not implemented in Blood CVARD(Bool, cl_showcoords, false, 0, "show your position in the game world") // This is a debug oprion in its current form, not implemented in Blood
CVARD(Bool, cl_weaponsway, true, CVAR_ARCHIVE, "enable/disable player weapon swaying") // Not implemented for Blood CVARD(Bool, cl_weaponsway, true, CVAR_ARCHIVE, "enable/disable player weapon swaying") // Not implemented for Blood