Merge pull request #7926 from dobrykafe/pr-hud-teamlock

Add team-lock indicator to HUD
This commit is contained in:
Dennis Felsing 2024-02-05 10:22:50 +00:00 committed by GitHub
commit 5ddf6aefa1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 18 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View file

@ -448,6 +448,7 @@ container.sprites.Add(Sprite("hud_teleport_laser", set_hud, 8,4,2,2))
container.sprites.Add(Sprite("hud_practice_mode", set_hud, 4,6,2,2))
container.sprites.Add(Sprite("hud_dummy_hammer", set_hud, 6,6,2,2))
container.sprites.Add(Sprite("hud_dummy_copy", set_hud, 8,6,2,2))
container.sprites.Add(Sprite("hud_lock_mode", set_hud, 10,6,2,2))
container.sprites.Add(Sprite("part_snowflake", set_extras, 0,0,2,2))

View file

@ -11,7 +11,7 @@ CharacterFlags = ["SOLO", "JETPACK", "COLLISION_DISABLED", "ENDLESS_HOOK", "ENDL
"HAMMER_HIT_DISABLED", "SHOTGUN_HIT_DISABLED", "GRENADE_HIT_DISABLED", "LASER_HIT_DISABLED", "HOOK_HIT_DISABLED",
"TELEGUN_GUN", "TELEGUN_GRENADE", "TELEGUN_LASER",
"WEAPON_HAMMER", "WEAPON_GUN", "WEAPON_SHOTGUN", "WEAPON_GRENADE", "WEAPON_LASER", "WEAPON_NINJA",
"MOVEMENTS_DISABLED", "IN_FREEZE", "PRACTICE_MODE"]
"MOVEMENTS_DISABLED", "IN_FREEZE", "PRACTICE_MODE", "LOCK_MODE"]
GameInfoFlags = [
"TIMESCORE", "GAMETYPE_RACE", "GAMETYPE_FASTCAP", "GAMETYPE_FNG",
"GAMETYPE_DDRACE", "GAMETYPE_DDNET", "GAMETYPE_BLOCK_WORLDS",

View file

@ -744,8 +744,9 @@ void CHud::PreparePlayerStateQuads()
m_DummyHammerOffset = RenderTools()->QuadContainerAddSprite(m_HudQuadContainerIndex, 0.f, 0.f, 12.f, 12.f);
m_DummyCopyOffset = RenderTools()->QuadContainerAddSprite(m_HudQuadContainerIndex, 0.f, 0.f, 12.f, 12.f);
// Quad for displaying practice mode
// Quads for displaying team modes
m_PracticeModeOffset = RenderTools()->QuadContainerAddSprite(m_HudQuadContainerIndex, 0.f, 0.f, 12.f, 12.f);
m_LockModeOffset = RenderTools()->QuadContainerAddSprite(m_HudQuadContainerIndex, 0.f, 0.f, 12.f, 12.f);
}
void CHud::RenderPlayerState(const int ClientID)
@ -984,6 +985,12 @@ void CHud::RenderPlayerState(const int ClientID)
{
y += 12;
}
if(m_pClient->m_Snap.m_aCharacters[ClientID].m_HasExtendedDisplayInfo && m_pClient->m_Snap.m_aCharacters[ClientID].m_ExtendedData.m_Flags & CHARACTERFLAG_LOCK_MODE)
{
Graphics()->TextureSet(m_pClient->m_HudSkin.m_SpriteHudLockMode);
Graphics()->RenderQuadContainerAsSprite(m_HudQuadContainerIndex, m_LockModeOffset, x, y);
x += 12;
}
if(m_pClient->m_Snap.m_aCharacters[ClientID].m_HasExtendedDisplayInfo && m_pClient->m_Snap.m_aCharacters[ClientID].m_ExtendedData.m_Flags & CHARACTERFLAG_PRACTICE_MODE)
{
Graphics()->TextureSet(m_pClient->m_HudSkin.m_SpriteHudPracticeMode);

View file

@ -131,6 +131,7 @@ private:
int m_DummyHammerOffset;
int m_DummyCopyOffset;
int m_PracticeModeOffset;
int m_LockModeOffset;
};
#endif

View file

@ -3266,6 +3266,7 @@ void CGameClient::LoadHudSkin(const char *pPath, bool AsDir)
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudTeleportGun);
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudTeleportLaser);
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudPracticeMode);
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudLockMode);
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudDummyHammer);
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudDummyCopy);
m_HudSkinLoaded = false;
@ -3324,6 +3325,7 @@ void CGameClient::LoadHudSkin(const char *pPath, bool AsDir)
m_HudSkin.m_SpriteHudTeleportGun = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_HUD_TELEPORT_GUN]);
m_HudSkin.m_SpriteHudTeleportLaser = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_HUD_TELEPORT_LASER]);
m_HudSkin.m_SpriteHudPracticeMode = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_HUD_PRACTICE_MODE]);
m_HudSkin.m_SpriteHudLockMode = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_HUD_LOCK_MODE]);
m_HudSkin.m_SpriteHudDummyHammer = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_HUD_DUMMY_HAMMER]);
m_HudSkin.m_SpriteHudDummyCopy = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_HUD_DUMMY_COPY]);

View file

@ -706,6 +706,7 @@ public:
IGraphics::CTextureHandle m_SpriteHudTeleportGun;
IGraphics::CTextureHandle m_SpriteHudTeleportLaser;
IGraphics::CTextureHandle m_SpriteHudPracticeMode;
IGraphics::CTextureHandle m_SpriteHudLockMode;
IGraphics::CTextureHandle m_SpriteHudDummyHammer;
IGraphics::CTextureHandle m_SpriteHudDummyCopy;
};

View file

@ -1269,6 +1269,10 @@ void CCharacter::Snap(int SnappingClient)
{
pDDNetCharacter->m_Flags |= CHARACTERFLAG_PRACTICE_MODE;
}
if(Teams()->TeamLocked(Team()))
{
pDDNetCharacter->m_Flags |= CHARACTERFLAG_LOCK_MODE;
}
pDDNetCharacter->m_TargetX = m_Core.m_Input.m_TargetX;
pDDNetCharacter->m_TargetY = m_Core.m_Input.m_TargetY;
}