gta-reversed
gta-reversed copied to clipboard
reversed CWeaponEffects::MarkTarget()
// my first work :)
In CWeaponEffects.h
class CWeaponEffects
{
public:
void InjectHooks();
static void MarkTarget(int crosshairId, CVector posn, uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha, float size, uint8_t arg7);
};
In CWeaponEffects.cpp
void CWeaponEffects::InjectHooks() {
ReversibleHooks::Install("CWeaponEffects", "MarkTarget", 0x742BF0, &CWeaponEffects::MarkTarget);
}
void CWeaponEffects::MarkTarget(int crosshairId, CVector posn, uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha, float size, uint8_t arg7) {
CWeaponEffects& crossHair = gCrossHair[crosshairId];
crossHair.m_vecPosn = posn;
crossHair.m_color.Set(red, green, blue, alpha);
crossHair.m_bActive = true;
crossHair.m_fSize = size;
crossHair.m_nTimeWhenToDeactivate = -1;
crossHair.field_28 = arg7;
}
In InjectHooksMain.cpp:
Add this line where you think it's suitable.
CWeaponEffects::InjectHooks();
Thanks for contributing! This is how you need to write the code. Read it and try to understand how it's different from the code you wrote. When you're done writing the code, make sure to put the asi file in your GTA SA directory and use Silent's asi loader. Then start the game and see if everything's working as expected. Testing is extremely important.