forked from alterware/iw6-mod
Compare commits
2 Commits
struct_suf
...
get_client
Author | SHA1 | Date | |
---|---|---|---|
adc33983a8 | |||
27d1f61789 |
@ -86,18 +86,28 @@ namespace colors
|
||||
return string;
|
||||
}
|
||||
|
||||
size_t get_client_name_stub(const int local_client_num, const int index, char* buf, const int size,
|
||||
const size_t unk, const size_t unk2)
|
||||
size_t get_client_name_stub(const int local_client_num, const int index, char* name_buf,
|
||||
const int max_name_size, char* clan_buf, const int max_clan_size)
|
||||
{
|
||||
// CL_GetClientName (CL_GetClientNameAndClantag?)
|
||||
const auto result = reinterpret_cast<size_t(*)(int, int, char*, int, size_t, size_t)>(0x1402CF790)(
|
||||
local_client_num, index, buf, size, unk, unk2);
|
||||
// CL_GetClientNameAndClanTag (wrapper for CL_GetClientNameAndClanTagColorize)
|
||||
const auto result = reinterpret_cast<size_t(*)(int, int, char*, int, char*, int)>(0x1402CF790)(
|
||||
local_client_num, index, name_buf, max_name_size, clan_buf, max_clan_size);
|
||||
|
||||
utils::string::strip(buf, buf, size);
|
||||
utils::string::strip(name_buf, name_buf, static_cast<size_t>(max_name_size));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int clean_agent_name_stub(char* out, int max_size, const char* fmt, const char* in)
|
||||
{
|
||||
// format agent overhead name like [%s]
|
||||
const auto length = sprintf_s(out, max_size, fmt, in);
|
||||
|
||||
utils::string::strip(in, out, std::min(static_cast<size_t>(length), static_cast<size_t>(max_size)));
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
void rb_lookup_color_stub(const char index, DWORD* color)
|
||||
{
|
||||
*color = RGB(255, 255, 255);
|
||||
@ -143,6 +153,9 @@ namespace colors
|
||||
// don't apply colors to overhead names
|
||||
utils::hook::call(0x14025CE79, get_client_name_stub);
|
||||
|
||||
// don't apply colors to overhead names of agents (like dogs or juggernauts)
|
||||
utils::hook::call(0x1402CF760, clean_agent_name_stub);
|
||||
|
||||
// patch I_CleanStr
|
||||
utils::hook::jump(0x1404F63C0, i_clean_str_stub);
|
||||
}
|
||||
|
Reference in New Issue
Block a user