mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[saco] Implement/match CDeathWindow::CreateFonts()
* Implement/match `CDeathWindow::GetSymbolSize()`
This commit is contained in:
parent
cbd7949bd4
commit
e3617099bc
@ -1,6 +1,10 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
int GetDeathWindowFontSize();
|
||||
char* GetFontFace();
|
||||
int GetFontWeight();
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
CDeathWindow::CDeathWindow(IDirect3DDevice9 *pD3DDevice)
|
||||
@ -21,6 +25,44 @@ void CDeathWindow::CreateAuxFonts()
|
||||
field_14B = TRUE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void CDeathWindow::CreateFonts()
|
||||
{
|
||||
if(!m_pD3DDevice) return;
|
||||
|
||||
RECT rectLongestNick = {0,0,0,0};
|
||||
int iFontSize;
|
||||
|
||||
SAFE_RELEASE(m_pD3DFont);
|
||||
SAFE_RELEASE(m_pWeaponFont);
|
||||
SAFE_RELEASE(m_pWeaponFont2);
|
||||
SAFE_RELEASE(m_pSprite);
|
||||
|
||||
iFontSize = GetDeathWindowFontSize();
|
||||
|
||||
// Create a sprite to use when drawing text
|
||||
D3DXCreateSprite(m_pD3DDevice,&m_pSprite);
|
||||
|
||||
D3DXCreateFont(m_pD3DDevice, iFontSize, 0, GetFontWeight(), 1, FALSE,
|
||||
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, GetFontFace(), &m_pD3DFont);
|
||||
|
||||
// Store the rect for right aligned name (DT_RIGHT fucks the text)
|
||||
if(m_pD3DFont) m_pD3DFont->DrawText(0,"LONGESTNICKNICK_NICKNICK",-1,&rectLongestNick,DT_CALCRECT|DT_LEFT,0xFF000000);
|
||||
|
||||
m_iLongestNickLength = rectLongestNick.right - rectLongestNick.left;
|
||||
|
||||
D3DXCreateFont(m_pD3DDevice, iFontSize + 8, 0, FW_NORMAL, 1, FALSE,
|
||||
SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "GTAWEAPON3", &m_pWeaponFont);
|
||||
D3DXCreateFont(m_pD3DDevice, iFontSize + 12, 0, FW_NORMAL, 1, FALSE,
|
||||
SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "GTAWEAPON3", &m_pWeaponFont2);
|
||||
|
||||
field_12F = GetSymbolSize().cx;
|
||||
field_133 = GetSymbolSize().cy;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void CDeathWindow::AddMessage( CHAR *szKiller,
|
||||
CHAR *szKillee,
|
||||
DWORD dwKillerColor,
|
||||
@ -64,6 +106,27 @@ void CDeathWindow::PushBack()
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
SIZE CDeathWindow::GetSymbolSize()
|
||||
{
|
||||
SIZE ret;
|
||||
RECT rectSize;
|
||||
|
||||
rectSize.top = 0;
|
||||
rectSize.bottom = 100;
|
||||
rectSize.left = 0;
|
||||
rectSize.right = 100;
|
||||
|
||||
if(m_pWeaponFont2) {
|
||||
m_pWeaponFont2->DrawText(0,"G",-1,&rectSize,DT_CALCRECT|DT_NOCLIP|DT_VCENTER,0xFF000000);
|
||||
}
|
||||
|
||||
ret.cx = rectSize.right - rectSize.left;
|
||||
ret.cy = rectSize.bottom - rectSize.top;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
PCHAR CDeathWindow::SpriteIDForWeapon(BYTE byteWeaponID)
|
||||
{
|
||||
switch (byteWeaponID) {
|
||||
|
@ -18,17 +18,18 @@ typedef struct _DEATH_WINDOW_ENTRY
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
#pragma pack(1)
|
||||
class CDeathWindow
|
||||
{
|
||||
private:
|
||||
char _gap0[4];
|
||||
DEATH_WINDOW_ENTRY m_DeathWindowEntries[MAX_DISP_DEATH_MESSAGES];
|
||||
char _gap012B[24];
|
||||
BOOL field_14B;
|
||||
ID3DXFont *field_14F;
|
||||
ID3DXFont *field_153;
|
||||
|
||||
int m_iLongestNickLength; // In screen units, longest nick length;
|
||||
LONG field_12F;
|
||||
LONG field_133;
|
||||
|
||||
void PushBack();
|
||||
SIZE GetSymbolSize();
|
||||
void AddToDeathWindowBuffer(CHAR *szKiller,CHAR *szKillee,DWORD dwKillerColor,DWORD dwKilleeColor,BYTE byteWeaponID);
|
||||
|
||||
public:
|
||||
@ -38,8 +39,17 @@ public:
|
||||
|
||||
CDeathWindow(IDirect3DDevice9 *pD3DDevice);
|
||||
|
||||
void CreateFonts();
|
||||
void CreateAuxFonts();
|
||||
|
||||
ID3DXFont *m_pD3DFont;
|
||||
ID3DXFont *m_pWeaponFont;
|
||||
ID3DXFont *m_pWeaponFont2;
|
||||
ID3DXSprite *m_pSprite;
|
||||
IDirect3DDevice9 *m_pD3DDevice;
|
||||
BOOL field_14B;
|
||||
ID3DXFont *field_14F;
|
||||
ID3DXFont *field_153;
|
||||
};
|
||||
|
||||
//----------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user