diff --git a/plugin_III/game_III/CFont.cpp b/plugin_III/game_III/CFont.cpp new file mode 100644 index 00000000..9051ec0f --- /dev/null +++ b/plugin_III/game_III/CFont.cpp @@ -0,0 +1,212 @@ +/* +Plugin-SDK (Grand Theft Auto) source file +Authors: GTA Community. See more here +https://github.com/DK22Pac/plugin-sdk +Do not delete this comment block. Respect others' work! +*/ +#include "CFont.h" + +CFontDetails &CFont::Details = *(CFontDetails *)0x8F317C; +CSprite2d *CFont::Sprite = (CSprite2d *)0x95CC04; +_int16 &CFont::NewLine = *(_int16 *)0x95CC94; +char *aStr = (char *)0x64C624; + +// Converted from cdecl void CFont::DrawFonts(void) 0x501B50 +void CFont::DrawFonts() { + plugin::Call<0x501B50>(); +} + +// Converted from cdecl wchar_t* CFont::GetNextSpace(wchar_t *str) 0x501960 +wchar_t* CFont::GetNextSpace(wchar_t* str) { + return plugin::CallAndReturn(str); +} + +// Converted from cdecl int CFont::GetNumberLines(float x,float y,wchar_t *text) 0x501260 +int CFont::GetNumberLines(float x, float y, wchar_t* text) { + return plugin::CallAndReturn(x, y, text); +} + +// Converted from cdecl float CFont::GetStringWidth(wchar_t *str,bool sentence) 0x5018A0 +float CFont::GetStringWidth(wchar_t* str, bool sentence) { + return plugin::CallAndReturn(str, sentence); +} + +// Converted from cdecl CRect* CFont::GetTextRect(CRect *rect_out,float x,float y,wchar_t *text) 0x5013B0 +CRect* CFont::GetTextRect(CRect* rect_out, float x, float y, wchar_t* text) { + return plugin::CallAndReturn(rect_out, x, y, text); +} + +// Converted from cdecl void CFont::InitPerFrame(void) 0x500BE0 +void CFont::InitPerFrame() { + plugin::Call<0x500BE0>(); +} + +// Converted from cdecl void CFont::Initialise(void) 0x500A40 +void CFont::Initialise() { + plugin::Call<0x500A40>(); +} + +// Converted from cdecl wchar_t* CFont::ParseToken(wchar_t *str) 0x5019A0 +wchar_t* CFont::ParseToken(wchar_t* str) { + return plugin::CallAndReturn(str); +} + +// Converted from cdecl void CFont::PrintChar(float x,float y,short character) 0x500C30 +void CFont::PrintChar(float x, float y, short character) { + plugin::Call<0x500C30, float, float, short>(x, y, character); +} + +// Converted from cdecl void CFont::PrintString(float x,float y,wchar_t *text) 0x500F50 +void CFont::PrintString(float x, float y, wchar_t* text) { + plugin::Call<0x500F50, float, float, wchar_t*>(x, y, text); +} + +// Converted from cdecl void CFont::PrintString(float x,float y,wchar_t *str1,wchar_t *str2,float) 0x501730 +void CFont::PrintString(float x, float y, wchar_t* str1, wchar_t* str2, float arg4) { + plugin::Call<0x501730, float, float, wchar_t*, wchar_t*, float>(x, y, str1, str2, arg4); +} + +// Converted from cdecl void CFont::SetAlphaFade(float alpha) 0x501DD0 +void CFont::SetAlphaFade(float alpha) { + plugin::Call<0x501DD0, float>(alpha); +} + +// Converted from cdecl void CFont::SetBackGroundOnlyTextOff(void) 0x501D40 +void CFont::SetBackGroundOnlyTextOff() { + plugin::Call<0x501D40>(); +} + +// Converted from cdecl void CFont::SetBackGroundOnlyTextOn(void) 0x501D30 +void CFont::SetBackGroundOnlyTextOn() { + plugin::Call<0x501D30>(); +} + +// Converted from cdecl void CFont::SetBackgroundColor(CRGBA color) 0x501D00 +void CFont::SetBackgroundColor(CRGBA color) { + plugin::Call<0x501D00, CRGBA*>(&color); +} + +// Converted from cdecl void CFont::SetBackgroundOff(void) 0x501CF0 +void CFont::SetBackgroundOff() { + plugin::Call<0x501CF0>(); +} + +// Converted from cdecl void CFont::SetBackgroundOn(void) 0x501CE0 +void CFont::SetBackgroundOn() { + plugin::Call<0x501CE0>(); +} + +// Converted from cdecl void CFont::SetCentreOff(void) 0x501CB0 +void CFont::SetCentreOff() { + plugin::Call<0x501CB0>(); +} + +// Converted from cdecl void CFont::SetCentreOn(void) 0x501C90 +void CFont::SetCentreOn() { + plugin::Call<0x501C90>(); +} + +// Converted from cdecl void CFont::SetCentreSize(float size) 0x501CD0 +void CFont::SetCentreSize(float size) { + plugin::Call<0x501CD0, float>(size); +} + +// Converted from cdecl void CFont::SetColor(CRGBA color) 0x501BD0 +void CFont::SetColor(CRGBA color) { + plugin::Call<0x501BD0, CRGBA*>(&color); +} + +// Converted from cdecl void CFont::SetDropColor(CRGBA color) 0x501DE0 +void CFont::SetDropColor(CRGBA color) { + plugin::Call<0x501DE0, CRGBA*>(&color); +} + +// Converted from cdecl void CFont::SetDropShadowPosition(short value) 0x501E70 +void CFont::SetDropShadowPosition(short value) { + plugin::Call<0x501E70, short>(value); +} + +// Converted from cdecl void CFont::SetFontStyle(short style) 0x501DB0 +void CFont::SetFontStyle(short style) { + plugin::Call<0x501DB0, short>(style); +} + +// Converted from cdecl void CFont::SetJustifyOff(void) 0x501C80 +void CFont::SetJustifyOff() { + plugin::Call<0x501C80>(); +} + +// Converted from cdecl void CFont::SetJustifyOn(void) 0x501C60 +void CFont::SetJustifyOn() { + plugin::Call<0x501C60>(); +} + +// Converted from cdecl void CFont::SetPropOff(void) 0x501D90 +void CFont::SetPropOff() { + plugin::Call<0x501D90>(); +} + +// Converted from cdecl void CFont::SetPropOn(void) 0x501DA0 +void CFont::SetPropOn() { + plugin::Call<0x501DA0>(); +} + +// Converted from cdecl void CFont::SetRightJustifyOff(void) 0x501D70 +void CFont::SetRightJustifyOff() { + plugin::Call<0x501D70>(); +} + +// Converted from cdecl void CFont::SetRightJustifyOn(void) 0x501D50 +void CFont::SetRightJustifyOn() { + plugin::Call<0x501D50>(); +} + +// Converted from cdecl void CFont::SetRightJustifyWrap(float value) 0x501DC0 +void CFont::SetRightJustifyWrap(float value) { + plugin::Call<0x501DC0, float>(value); +} + +// Converted from cdecl void CFont::SetScale(float width,float height) 0x501B80 +void CFont::SetScale(float width, float height) { + plugin::Call<0x501B80, float, float>(width, height); +} + +// Converted from cdecl void CFont::SetSlant(float value) 0x501BC0 +void CFont::SetSlant(float value) { + plugin::Call<0x501BC0, float>(value); +} + +// Converted from cdecl void CFont::SetSlantRefPoint(float x,float y) 0x501BA0 +void CFont::SetSlantRefPoint(float x, float y) { + plugin::Call<0x501BA0, float, float>(x, y); +} + +// Converted from cdecl void CFont::SetWrapx(float value) 0x501CC0 +void CFont::SetWrapx(float value) { + plugin::Call<0x501CC0, float>(value); +} + +// Converted from cdecl void CFont::Shutdown(void) 0x500BA0 +void CFont::Shutdown() { + plugin::Call<0x500BA0>(); +} + +// Converted from cdecl short CFont::character_code(uchar character) 0x501E80 +short CFont::character_code(unsigned char character) { + return plugin::CallAndReturn(character); +} + +// Converted from cdecl void AsciiToUnicode(char const* str_ascii,wchar_t * str_unicode) 0x5009C0 +void AsciiToUnicode(char const* str_ascii, wchar_t* str_unicode) { + plugin::Call<0x5009C0, char const*, wchar_t*>(str_ascii, str_unicode); +} + +// Converted from cdecl int UnicodeStrlen(wchar_t const* str) 0x500A20 +int UnicodeStrlen(wchar_t const* str) { + return plugin::CallAndReturn(str); +} + +// Converted from cdecl char* UnicodeToAscii(wchar_t *str_unicode) 0x52C2F0 +char* UnicodeToAscii(wchar_t* str_unicode) { + return plugin::CallAndReturn(str_unicode); +} diff --git a/plugin_III/game_III/CFont.h b/plugin_III/game_III/CFont.h new file mode 100644 index 00000000..c93815dc --- /dev/null +++ b/plugin_III/game_III/CFont.h @@ -0,0 +1,81 @@ +/* +Plugin-SDK (Grand Theft Auto) header file +Authors: GTA Community. See more here +https://github.com/DK22Pac/plugin-sdk +Do not delete this comment block. Respect others' work! +*/ +#pragma once + +#include "plbase\PluginBase_III.h" +#include "CRGBA.h" +#include "CRect.h" +#include "CFontDetails.h" +#include "CSprite2d.h" + +class CFont { +public: + // variables + static CFontDetails &Details; + static CSprite2d *Sprite; + static _int16 + + // funcs + + static void DrawFonts(); + // get next ' ' character in a string + static wchar_t* GetNextSpace(wchar_t* str); + static int GetNumberLines(float x, float y, wchar_t* text); + static float GetStringWidth(wchar_t* str, bool sentence); + static CRect* GetTextRect(CRect* rect_out, float x, float y, wchar_t* text); + static void InitPerFrame(); + // CFont initialisation + static void Initialise(); + static wchar_t* ParseToken(wchar_t* str); + // this adds a single character into rendering buffer + static void PrintChar(float x, float y, short character); + static void PrintString(float x, float y, wchar_t* text); + static void PrintString(float x, float y, wchar_t* str1, wchar_t* str2, float arg4); + // like a 'global' font alpha, multiplied with each text alpha (from SetColor) + static void SetAlphaFade(float alpha); + static void SetBackGroundOnlyTextOff(); + static void SetBackGroundOnlyTextOn(); + // sets background color + static void SetBackgroundColor(CRGBA color); + static void SetBackgroundOff(); + static void SetBackgroundOn(); + static void SetCentreOff(); + static void SetCentreOn(); + // set line width at center + static void SetCentreSize(float size); + // set text color + static void SetColor(CRGBA color); + // drop color is used for text shadow and text outline + static void SetDropColor(CRGBA color); + // set shadow size + static void SetDropShadowPosition(short value); + // set text style + static void SetFontStyle(short style); + static void SetJustifyOff(); + static void SetJustifyOn(); + static void SetPropOff(); + static void SetPropOn(); + static void SetRightJustifyOff(); + static void SetRightJustifyOn(); + static void SetRightJustifyWrap(float value); + // text scaling + static void SetScale(float width, float height); + // set text rotation angle + static void SetSlant(float value); + // set text rotation point + static void SetSlantRefPoint(float x, float y); + // set line width at right + static void SetWrapx(float value); + // CFont closing + static void Shutdown(); + static short character_code(unsigned char character); +}; + +void AsciiToUnicode(char const* str_ascii, wchar_t* str_unicode); +int UnicodeStrlen(wchar_t const* str); +char* UnicodeToAscii(wchar_t* str_unicode); +extern char *aStr; \ No newline at end of file diff --git a/plugin_III/game_III/CFontDetails.cpp b/plugin_III/game_III/CFontDetails.cpp new file mode 100644 index 00000000..88ebb2d3 --- /dev/null +++ b/plugin_III/game_III/CFontDetails.cpp @@ -0,0 +1,12 @@ +/* +Plugin-SDK (Grand Theft Auto) header file +Authors: GTA Community. See more here +https://github.com/DK22Pac/plugin-sdk +Do not delete this comment block. Respect others' work! +*/ +#include "CFontDetails.h" + +// Converted from thiscall void CFontDetails::~CFontDetails() 0x501F10 +CFontDetails::~CFontDetails() { + plugin::CallMethod<0x501F10, CFontDetails *>(this); +} diff --git a/plugin_III/game_III/CFontDetails.h b/plugin_III/game_III/CFontDetails.h new file mode 100644 index 00000000..e988ac84 --- /dev/null +++ b/plugin_III/game_III/CFontDetails.h @@ -0,0 +1,47 @@ +/* +Plugin-SDK (Grand Theft Auto) header file +Authors: GTA Community. See more here +https://github.com/DK22Pac/plugin-sdk +Do not delete this comment block. Respect others' work! +*/ +#pragma once + +#include "plbase\PluginBase_III.h" +#include "CRGBA.h" +#include "CVector2D.h" + +#pragma pack(push, 2) +class CFontDetails { +public: + CRGBA m_Color; + CVector2D m_vScale; + float m_fSlant; + CVector2D m_vSlantRefPoint; + bool m_bJustify; + bool m_bCentre; + bool m_bRightJustify; + bool m_bBackground; + bool m_bBackGroundOnlyText; + bool m_bProp; +private: + char _pad1E[2]; +public: + float m_fAlphaFade; + CRGBA m_BackgroundColor; + float m_fWrapX; + float m_fCentreSize; + float m_fRightJustifyWrap; + _int16 m_nStyle; +private: + char _pad36[2]; +public: + int field_38; + _int16 m_nDropShadowPosition; + CRGBA m_DropColor; + + //funcs + ~CFontDetails(); +}; +#pragma pack(pop) + +VALIDATE_SIZE(CFontDetails, 0x42); \ No newline at end of file diff --git a/plugin_III/game_III/CPlane.cpp b/plugin_III/game_III/CPlane.cpp index 68805349..b17c546d 100644 --- a/plugin_III/game_III/CPlane.cpp +++ b/plugin_III/game_III/CPlane.cpp @@ -82,3 +82,15 @@ unsigned int *DropOffCesnaMissionStatus = (unsigned int *)0x64CFF0; unsigned int *DropOffCesnaMissionStartTime = (unsigned int *)0x64CFF4; CPlane **pDropOffCesna = (CPlane **)0x8E2A38; CPlane **pDrugRunCesna = (CPlane **)0x8F5F80; +unsigned int *NumPathNodes = (unsigned int *)0x8F2BE4; +unsigned int *NumPath2Nodes = (unsigned int *)0x941498; +unsigned int *NumPath3Nodes = (unsigned int *)0x9414D8; +unsigned int *NumPath4Nodes = (unsigned int *)0x9412C8; +float *TotalLengthOfFlightPath = (float *)0x8F2C6C; +float *TotalLengthOfFlightPath2 = (float *)0x64CFBC; +float *TotalLengthOfFlightPath3 = (float *)0x64CFD0; +float *TotalLengthOfFlightPath4 = (float *)0x64CFDC; +CPathNode **pPathNodes = (CPathNode **)0x8F1B68; +CPathNode **pPath2Nodes = (CPathNode **)0x885B8C; +CPathNode **pPath3Nodes = (CPathNode **)0x885B78; +CPathNode **pPath4Nodes = (CPathNode **)0x885AD8; diff --git a/plugin_III/game_III/CPlane.h b/plugin_III/game_III/CPlane.h index 445b881e..4b67b8a0 100644 --- a/plugin_III/game_III/CPlane.h +++ b/plugin_III/game_III/CPlane.h @@ -8,6 +8,7 @@ Do not delete this comment block. Respect others' work! #include "plbase\PluginBase_III.h" #include "CVehicle.h" +#include "CPathNode.h" enum ePlaneNodes { PLANE_NODE_NONE = 0, @@ -56,4 +57,16 @@ extern unsigned int *CesnaMissionStartTime; extern unsigned int *DropOffCesnaMissionStatus; extern unsigned int *DropOffCesnaMissionStartTime; extern CPlane **pDropOffCesna; -extern CPlane **pDrugRunCesna; \ No newline at end of file +extern CPlane **pDrugRunCesna; +extern unsigned int *NumPathNodes; +extern unsigned int *NumPath2Nodes; +extern unsigned int *NumPath3Nodes; +extern unsigned int *NumPath4Nodes; +extern float *TotalLengthOfFlightPath; +extern float *TotalLengthOfFlightPath2; +extern float *TotalLengthOfFlightPath3; +extern float *TotalLengthOfFlightPath4; +extern CPathNode **pPathNodes; +extern CPathNode **pPath2Nodes; +extern CPathNode **pPath3Nodes; +extern CPathNode **pPath4Nodes; \ No newline at end of file diff --git a/plugin_III/game_III/CRGBA.cpp b/plugin_III/game_III/CRGBA.cpp index 95d318c4..b05deacb 100644 --- a/plugin_III/game_III/CRGBA.cpp +++ b/plugin_III/game_III/CRGBA.cpp @@ -9,4 +9,9 @@ // Converted from thiscall void CRGBA::CRGBA(uchar r, uchar g, uchar b, uchar a) 0x4F8C20 CRGBA::CRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) { ((void(__thiscall *)(CRGBA*, unsigned char, unsigned char, unsigned char, unsigned char))0x4F8C20)(this, r, g, b, a); -} \ No newline at end of file +} + +// Converted from thiscall void CRGBA::~CRGBA() 0x40B290 +CRGBA::~CRGBA() { + plugin::CallMethod<0x40B290, CRGBA *>(this); +} diff --git a/plugin_III/game_III/CRGBA.h b/plugin_III/game_III/CRGBA.h index 5581edd7..71f2b17b 100644 --- a/plugin_III/game_III/CRGBA.h +++ b/plugin_III/game_III/CRGBA.h @@ -5,6 +5,7 @@ Do not delete this comment block. Respect others' work! */ #pragma once +#include "plbase/PluginBase_III.h" class CRGBA { public: @@ -16,5 +17,6 @@ class CRGBA { }; CRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); + ~CRGBA(); CRGBA() {} }; \ No newline at end of file diff --git a/plugin_III/game_III/CTimer.cpp b/plugin_III/game_III/CTimer.cpp index aa4deb31..bdb19eb1 100644 --- a/plugin_III/game_III/CTimer.cpp +++ b/plugin_III/game_III/CTimer.cpp @@ -9,10 +9,10 @@ Do not delete this comment block. Respect others' work! bool &CTimer::m_CodePause = *(bool *)0x95CDB1; unsigned int &CTimer::m_FrameCounter = *(unsigned int *)0x9412EC; bool &CTimer::m_UserPause = *(bool *)0x95CD7C; -int &CTimer::m_snPreviousTimeInMilliseconds = *(int *)0x8F29E4; -int &CTimer::m_snTimeInMilliseconds = *(int *)0x885B48; -int &CTimer::m_snTimeInMillisecondsNonClipped = *(int *)0x9412E8; -int &CTimer::m_snTimeInMillisecondsPauseMode = *(int *)0x5F7614; +unsigned int &CTimer::m_snPreviousTimeInMilliseconds = *(int *)0x8F29E4; +unsigned int &CTimer::m_snTimeInMilliseconds = *(int *)0x885B48; +unsigned int &CTimer::m_snTimeInMillisecondsNonClipped = *(int *)0x9412E8; +unsigned int &CTimer::m_snTimeInMillisecondsPauseMode = *(int *)0x5F7614; float &CTimer::ms_fTimeScale = *(float *)0x8F2C20; float &CTimer::ms_fTimeStep = *(float *)0x8E2CB4; float &CTimer::ms_fTimeStepNonClipped = *(float *)0x8E2C4C; diff --git a/plugin_III/game_III/CTimer.h b/plugin_III/game_III/CTimer.h index a5bd97ec..3bfaa694 100644 --- a/plugin_III/game_III/CTimer.h +++ b/plugin_III/game_III/CTimer.h @@ -25,10 +25,10 @@ class CTimer { static bool &m_CodePause; static unsigned int &m_FrameCounter; static bool &m_UserPause; - static int &m_snPreviousTimeInMilliseconds; - static int &m_snTimeInMilliseconds; - static int &m_snTimeInMillisecondsNonClipped; - static int &m_snTimeInMillisecondsPauseMode; + static unsigned int &m_snPreviousTimeInMilliseconds; + static unsigned int &m_snTimeInMilliseconds; + static unsigned int &m_snTimeInMillisecondsNonClipped; + static unsigned int &m_snTimeInMillisecondsPauseMode; static float &ms_fTimeScale; static float &ms_fTimeStep; static float &ms_fTimeStepNonClipped; diff --git a/plugin_III/proj/plugin_III.vcxproj b/plugin_III/proj/plugin_III.vcxproj index 0ddc03ef..51cee099 100644 --- a/plugin_III/proj/plugin_III.vcxproj +++ b/plugin_III/proj/plugin_III.vcxproj @@ -109,6 +109,8 @@ + + @@ -245,6 +247,8 @@ + + diff --git a/plugin_III/proj/plugin_III.vcxproj.filters b/plugin_III/proj/plugin_III.vcxproj.filters index e3d0ace1..30609db3 100644 --- a/plugin_III/proj/plugin_III.vcxproj.filters +++ b/plugin_III/proj/plugin_III.vcxproj.filters @@ -448,6 +448,12 @@ game_III + + game_III + + + game_III + @@ -684,6 +690,12 @@ game_III + + game_III + + + game_III +