Add Practice Mode Symbol next to the timer

- Add new hud.png
- expand DDNetCharacterDisplayInfo with m_IsInPracticeMode
This commit is contained in:
c0d3d3v 2022-03-31 18:05:16 +02:00
parent ef468e8181
commit 940047fb8e
No known key found for this signature in database
GPG key ID: 068AF680530DFF31
9 changed files with 31 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View file

@ -276,7 +276,7 @@ set_guiicons = SpriteSet("guiicons", image_guiicons, 12, 2)
set_demobuttons2 = SpriteSet("demobuttons2", image_demobuttons2, 4, 1)
set_audio_source = SpriteSet("audio_source", image_audio_source, 1, 1)
set_strongweak = SpriteSet("strongweak", image_strongweak, 2, 1)
set_hud = SpriteSet("hud", image_hud, 14, 6)
set_hud = SpriteSet("hud", image_hud, 14, 12)
container.spritesets.Add(set_particles)
container.spritesets.Add(set_game)
@ -454,13 +454,14 @@ container.sprites.Add(Sprite("hud_no_hammer_hit", set_hud, 6,2,2,2))
container.sprites.Add(Sprite("hud_no_shotgun_hit", set_hud, 8,2,2,2))
container.sprites.Add(Sprite("hud_no_grenade_hit", set_hud, 10,2,2,2))
container.sprites.Add(Sprite("hud_no_laser_hit", set_hud, 12,2,2,2))
container.sprites.Add(Sprite("hud_deep_frozen", set_hud, 0,4,2,2))
container.sprites.Add(Sprite("hud_live_frozen", set_hud, 2,4,2,2))
container.sprites.Add(Sprite("hud_deep_frozen", set_hud, 10,4,2,2))
container.sprites.Add(Sprite("hud_live_frozen", set_hud, 12,4,2,2))
container.sprites.Add(Sprite("hud_teleport_grenade", set_hud, 4,4,2,2))
container.sprites.Add(Sprite("hud_teleport_gun", set_hud, 6,4,2,2))
container.sprites.Add(Sprite("hud_teleport_laser", set_hud, 8,4,2,2))
container.sprites.Add(Sprite("hud_dummy_hammer", set_hud, 10,4,2,2))
container.sprites.Add(Sprite("hud_dummy_copy", set_hud, 12,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))
anim = Animation("base")
anim.body.frames.Add(AnimKeyframe(0, 0, -4, 0))

View file

@ -250,6 +250,7 @@ Objects = [
NetTick("m_NinjaActivationTick"),
NetTick("m_FreezeTick"),
NetBool("m_IsInFreeze"),
NetBool("m_IsInPracticeMode"),
]),
NetObjectEx("DDNetPlayer", "player@netobj.ddnet.tw", [

View file

@ -138,6 +138,17 @@ void CHud::RenderGameTimer()
}
TextRender()->Text(0, Half - w / 2, 2, FontSize, aBuf, -1.0f);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
int DisplayedClientID = m_pClient->m_Snap.m_LocalClientID;
if(m_pClient->m_Snap.m_SpecInfo.m_Active && m_pClient->m_Snap.m_SpecInfo.m_SpectatorID != SPEC_FREEVIEW)
{
DisplayedClientID = m_pClient->m_Snap.m_SpecInfo.m_SpectatorID;
}
if(m_pClient->m_Snap.m_aCharacters[DisplayedClientID].m_HasExtendedDisplayInfo && m_pClient->m_Snap.m_aCharacters[DisplayedClientID].m_ExtendedDisplayInfo.m_IsInPracticeMode)
{
Graphics()->TextureSet(m_pClient->m_HudSkin.m_SpriteHudPracticeMode);
Graphics()->RenderQuadContainerAsSprite(m_HudQuadContainerIndex, m_PracticeModeOffset, Half + w / 2 + 6, 2 + 5);
}
}
}
@ -820,11 +831,16 @@ void CHud::PreparePlayerStateQuads()
m_NoGrenadeHitOffset = RenderTools()->QuadContainerAddSprite(m_HudQuadContainerIndex, 0.f, 0.f, 12.f, 12.f);
m_NoLaserHitOffset = RenderTools()->QuadContainerAddSprite(m_HudQuadContainerIndex, 0.f, 0.f, 12.f, 12.f);
// Quads for displaying dummy actions and freeze status
// Quads for displaying freeze status
m_DeepFrozenOffset = RenderTools()->QuadContainerAddSprite(m_HudQuadContainerIndex, 0.f, 0.f, 12.f, 12.f);
m_LiveFrozenOffset = RenderTools()->QuadContainerAddSprite(m_HudQuadContainerIndex, 0.f, 0.f, 12.f, 12.f);
// Quads for displaying dummy actions
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
m_PracticeModeOffset = RenderTools()->QuadContainerAddSprite(m_HudQuadContainerIndex, 12.f, 12.f);
}
void CHud::RenderPlayerState(const int ClientID)

View file

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

View file

@ -3045,6 +3045,7 @@ void CGameClient::LoadHudSkin(const char *pPath, bool AsDir)
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudTeleportGrenade);
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudTeleportGun);
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudTeleportLaser);
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudPracticeMode);
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudDummyHammer);
Graphics()->UnloadTexture(&m_HudSkin.m_SpriteHudDummyCopy);
m_HudSkinLoaded = false;
@ -3101,6 +3102,7 @@ void CGameClient::LoadHudSkin(const char *pPath, bool AsDir)
m_HudSkin.m_SpriteHudTeleportGrenade = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_HUD_TELEPORT_GRENADE]);
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_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

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

View file

@ -102,7 +102,9 @@ void CCharacterCore::Reset()
m_HasTelegunGun = false;
m_HasTelegunGrenade = false;
m_HasTelegunLaser = false;
m_FreezeTick = 0;
m_FreezeEnd = 0;
m_IsInFreeze = false;
m_DeepFrozen = false;
m_LiveFrozen = false;

View file

@ -1250,6 +1250,7 @@ void CCharacter::Snap(int SnappingClient)
pDDNetCharacterDisplayInfo->m_NinjaActivationTick = m_Core.m_Ninja.m_ActivationTick;
pDDNetCharacterDisplayInfo->m_FreezeTick = m_Core.m_FreezeTick;
pDDNetCharacterDisplayInfo->m_IsInFreeze = m_Core.m_IsInFreeze;
pDDNetCharacterDisplayInfo->m_IsInPracticeMode = Teams()->IsPractice(Team());
}
// DDRace