Skip to content

Commit

Permalink
fixes to merge with new ddnet
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed May 17, 2022
1 parent 6687590 commit 8e51ef5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/game/client/components/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,10 +858,10 @@ void CHud::RenderCursor()
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);

// render cursor
int CurWeapon = m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS;
int Wep = m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS;
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
Graphics()->TextureSet(m_pClient->m_GameSkin.m_SpriteWeaponCursors[CurWeapon]);
Graphics()->RenderQuadContainerAsSprite(m_HudQuadContainerIndex, m_CursorOffset[CurWeapon], m_pClient->m_Controls.m_TargetPos[g_Config.m_ClDummy].x, m_pClient->m_Controls.m_TargetPos[g_Config.m_ClDummy].y);
Graphics()->TextureSet(m_pClient->m_GameSkin.m_SpriteWeaponCursors[Wep]);
Graphics()->RenderQuadContainerAsSprite(m_HudQuadContainerIndex, m_CursorOffset[Wep], m_pClient->m_Controls.m_TargetPos[g_Config.m_ClDummy].x, m_pClient->m_Controls.m_TargetPos[g_Config.m_ClDummy].y);
}

void CHud::PrepareAmmoHealthAndArmorQuads()
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/gameclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void CGameClient::OnInit()

// propagate pointers
m_UI.Init(Graphics(), TextRender());
m_RenderTools.Init(Graphics(), TextRender());
m_RenderTools.Init(Graphics(), TextRender(), this);

int64_t Start = time_get();

Expand Down
5 changes: 4 additions & 1 deletion src/game/client/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
#include <game/generated/protocol.h>
#include <game/layers.h>


static float gs_SpriteWScale;
static float gs_SpriteHScale;

void CRenderTools::Init(IGraphics *pGraphics, ITextRender *pTextRender)
void CRenderTools::Init(IGraphics *pGraphics, ITextRender *pTextRender, class CGameClient *pGameClient)
{
m_pGraphics = pGraphics;
m_pTextRender = pTextRender;
m_pGameClient = (CGameClient *)pGameClient;
m_TeeQuadContainerIndex = Graphics()->CreateQuadContainer(false);
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);

Expand Down Expand Up @@ -719,6 +721,7 @@ void CRenderTools::RenderTee(CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote
if(g_Config.m_ClWhiteFeet && pInfo->m_CustomColoredSkin)
{
CTeeRenderInfo WhiteFeetInfo;

int Skin = GameClient()->m_Skins.Find("x_ninja");
if(Skin != -1)
{
Expand Down
4 changes: 3 additions & 1 deletion src/game/client/render.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ class CRenderTools
void GetRenderTeeFeetScale(float BaseSize, float &FeetScaleWidth, float &FeetScaleHeight);

public:
class CGameClient *m_pGameClient;
class IGraphics *Graphics() const { return m_pGraphics; }
class ITextRender *TextRender() const { return m_pTextRender; }
class CGameClient *GameClient() const { return m_pGameClient; }

void Init(class IGraphics *pGraphics, class ITextRender *pTextRender);
void Init(class IGraphics *pGraphics, class ITextRender *pTextRender, class CGameClient *pGameClient);

void SelectSprite(struct CDataSprite *pSprite, int Flags = 0, int sx = 0, int sy = 0);
void SelectSprite(int Id, int Flags = 0, int sx = 0, int sy = 0);
Expand Down
3 changes: 2 additions & 1 deletion src/game/editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6343,7 +6343,8 @@ void CEditor::Init()
m_pStorage = Kernel()->RequestInterface<IStorage>();
m_pSound = Kernel()->RequestInterface<ISound>();
m_UI.Init(m_pGraphics, m_pTextRender);
m_RenderTools.Init(m_pGraphics, m_pTextRender);
CGameClient *pGameClient = (CGameClient *)Kernel()->RequestInterface<IGameClient>();
m_RenderTools.Init(m_pGraphics, m_pTextRender, pGameClient);
m_Map.m_pEditor = this;

UIEx()->Init(UI(), Kernel(), RenderTools(), Input()->GetEventsRaw(), Input()->GetEventCountRaw());
Expand Down

0 comments on commit 8e51ef5

Please sign in to comment.