- Статус
- Оффлайн
- Регистрация
- 18 Янв 2019
- Сообщения
- 89
- Реакции
- 6
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Код:
//first of all, declare our StaticSound stuct
typedef struct StaticSound_s
{
DWORD Timestamp[2];
Vector Origin;
char* SoundName;
};
//then, std::vector container for them
std::vector<StaticSound_s> StaticSounds;
pattern: 55 8B EC 83 EC 44 53 56 57 8B 7D 10, mask: xxxxxxxxxxxx
Код:
typedef void(*S_StaticSound_t)(int unk, int entchannel, char *szSoundFile, float *fOrigin, void*, void*, void*, void*); //im not sure about void* args, they doesn't seem to be same as in S_DynamicSound
S_StaticSound_t o_S_StaticSound;
so, in our hooked function:
Код:
void h_S_StaticSound(int unk, int entchannel, char *szSoundFile, float* fOrigin, void* unk0, void* unk1, void* unk2, void* unk3)
{
StaticSound_s snd;
snd.Timestamp[0] = GetTickCount();
snd.Origin = fOrigin;
snd.SoundName = szSoundFile;
if (StaticSounds.size() > 32)
StaticSounds.clear();
StaticSounds.push_back(snd);
o_S_StaticSound(unk, entchannel, szSoundFile, fOrigin, unk0, unk1, unk2, unk3);
}
//Lets visualize our sounds real quick:
for (int i = 0; i < StaticSounds.size(); i++) //use for (auto Sound : StaticSounds) instead, my compiler doesn't support c++11, sadly
{
float SoundPos[2];
if (Utils::WorldToScreen(StaticSounds[i].Origin, SoundPos))
{
StaticSounds[i].Timestamp[1] = GetTickCount();
float TimestampDiff = StaticSounds[i].Timestamp[1] - StaticSounds[i].Timestamp[0];
if (TimestampDiff < g_Settings.Visuals.SoundESP.BulletTime)
{
//dynamic alpha value for "fade-out" effect
float alpha = 255.f - (float)LinearInterpolation(TimestampDiff, 0.f, g_Settings.Visuals.SoundESP.BulletTime, 0.f, 255.f);
//if we can't see bullet, that means we shooted through texture, let this be red, instead of white, just for fun
ImVec4 color = (Utils::TraceLine(g_Local.Eye, StaticSounds[i].Origin, -1)) ? ImVec4(255, 255, 255, alpha) : ImVec4(255, 0, 0, alpha);
ImGui::GetWindowDrawList()->AddCircle(ImVec2(SoundPos[0], SoundPos[1]), 6.0f, ImGui::GetColorU32(color));
}
}
}