66*/
77
88#include " CHud.h"
9+ #include < algorithm>
10+ #include < string.h>
911
1012CHud** gHud = (CHud**)0x672F40 ;
1113
@@ -29,14 +31,35 @@ void CHud::DrawSprite(int id1, int id2, int x, int y, char style, int const& mod
2931 plugin::CallStd<0x4C71B0 , int , int , int , int , char , int const &, int , int , char >(id1, id2, x, y, style, mode, enableAlpha, alpha, unk);
3032}
3133
32- void CHudMessage::SetHudMessage (const wchar_t * str, int priority) {
33- plugin::CallMethod<0x4C6060 >(this , str, priority);
34+ void CHudMessage::SetHudMessage (const char * text, eMessagePriority priority) {
35+ _SWSTRING_STATIC_INIT (1 ); _SWSTRING_STATIC_FROM (1 , text);
36+ SetHudMessage (_SWSTRING_STATIC (1 ), priority);
3437}
3538
36- void CHudBrief::SetHudBrief ( int priority, const char * str ) {
37- plugin::CallMethod<0x4C6750 >(this , priority, str );
39+ void CHudMessage::SetHudMessage ( const wchar_t * text, eMessagePriority priority ) {
40+ plugin::CallMethod<0x4C6060 >(this , text, priority );
3841}
3942
40- void CHudBrief::Clear (int priority) {
43+ void CHudBrief::SetHudBrief (eMessagePriority priority, const char * gxt, unsigned int timeout) {
44+ plugin::CallMethod<0x4C6690 >(this , priority, gxt, timeout);
45+ }
46+
47+ void CHudBrief::SetHudBriefStr (const char * text, short time) {
48+ _SWSTRING_STATIC_INIT (1 ); _SWSTRING_STATIC_FROM (1 , text);
49+ SetHudBriefStr (_SWSTRING_STATIC (1 ), time);
50+ }
51+
52+ void CHudBrief::SetHudBriefStr (const wchar_t * text, short time) {
53+ SetHudBrief (eMessagePriority::MESSAGE_DISPLAY_NOW, " " , -1 );
54+
55+ wcscpy_s (this ->text , text);
56+ length = wcslen (this ->text );
57+ lines = 1 + std::count_if (this ->text , this ->text + length, [](auto ch){ return ch == L' \n ' ; });
58+
59+ if (time == 0 ) time = length * GetHud ()->m_nTextSpeed ; // automatic
60+ displayTime = time;
61+ }
62+
63+ void CHudBrief::Clear (eMessagePriority priority) {
4164 plugin::CallMethod<0x4C6860 >(this , priority);
4265}
0 commit comments