Darkel/Wanted update.
This commit is contained in:
parent
bdd5ed6a20
commit
9fed0c040c
@ -136,6 +136,15 @@ CCamera::RenderMotionBlur(void)
|
|||||||
m_motionBlur, m_BlurType, m_imotionBlurAddAlpha);
|
m_motionBlur, m_BlurType, m_imotionBlurAddAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CCamera::ClearPlayerWeaponMode()
|
||||||
|
{
|
||||||
|
PlayerWeaponMode.Mode = 0;
|
||||||
|
PlayerWeaponMode.MaxZoom = 1;
|
||||||
|
PlayerWeaponMode.MinZoom = -1;
|
||||||
|
PlayerWeaponMode.Duration = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -457,6 +457,7 @@ int m_iModeObbeCamIsInForCar;
|
|||||||
void SetMotionBlur(int r, int g, int b, int a, int type);
|
void SetMotionBlur(int r, int g, int b, int a, int type);
|
||||||
void SetMotionBlurAlpha(int a);
|
void SetMotionBlurAlpha(int a);
|
||||||
void RenderMotionBlur(void);
|
void RenderMotionBlur(void);
|
||||||
|
void ClearPlayerWeaponMode();
|
||||||
void CalculateDerivedValues(void);
|
void CalculateDerivedValues(void);
|
||||||
|
|
||||||
void DrawBordersForWideScreen(void);
|
void DrawBordersForWideScreen(void);
|
||||||
|
@ -3,3 +3,10 @@
|
|||||||
|
|
||||||
int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
|
int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
|
||||||
int32 &CStats::HeadShots = *(int32*)0x8F647C;
|
int32 &CStats::HeadShots = *(int32*)0x8F647C;
|
||||||
|
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
|
||||||
|
int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;
|
||||||
|
|
||||||
|
void CStats::AnotherKillFrenzyPassed()
|
||||||
|
{
|
||||||
|
++NumberKillFrenziesPassed;
|
||||||
|
}
|
||||||
|
@ -5,4 +5,8 @@ class CStats
|
|||||||
public:
|
public:
|
||||||
static int32 &DaysPassed;
|
static int32 &DaysPassed;
|
||||||
static int32 &HeadShots;
|
static int32 &HeadShots;
|
||||||
|
static int32 &NumberKillFrenziesPassed;
|
||||||
|
static int32 &PeopleKilledByOthers;
|
||||||
|
|
||||||
|
static void AnotherKillFrenzyPassed();
|
||||||
};
|
};
|
@ -2,6 +2,8 @@
|
|||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
|
|
||||||
|
int32 &CWanted::MaximumWantedLevel = *(int32*)0x5F7714;
|
||||||
|
|
||||||
bool CWanted::AreSwatRequired()
|
bool CWanted::AreSwatRequired()
|
||||||
{
|
{
|
||||||
return m_nWantedLevel >= 4;
|
return m_nWantedLevel >= 4;
|
||||||
@ -34,3 +36,94 @@ int CWanted::NumOfHelisRequired()
|
|||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWanted::SetWantedLevel(int32 level)
|
||||||
|
{
|
||||||
|
ClearQdCrimes();
|
||||||
|
switch (level) {
|
||||||
|
case NOTWANTED:
|
||||||
|
m_nChaos = 0;
|
||||||
|
break;
|
||||||
|
case WANTEDLEVEL_1:
|
||||||
|
m_nChaos = 60;
|
||||||
|
break;
|
||||||
|
case WANTEDLEVEL_2:
|
||||||
|
m_nChaos = 220;
|
||||||
|
break;
|
||||||
|
case WANTEDLEVEL_3:
|
||||||
|
m_nChaos = 420;
|
||||||
|
break;
|
||||||
|
case WANTEDLEVEL_4:
|
||||||
|
m_nChaos = 820;
|
||||||
|
break;
|
||||||
|
case WANTEDLEVEL_5:
|
||||||
|
m_nChaos = 1620;
|
||||||
|
break;
|
||||||
|
case WANTEDLEVEL_6:
|
||||||
|
m_nChaos = 3220;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (level > MaximumWantedLevel)
|
||||||
|
m_nChaos = MaximumWantedLevel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
UpdateWantedLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWanted::ClearQdCrimes()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
m_sCrimes[i].m_eCrimeType = CRIME_NONE;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWanted::UpdateWantedLevel()
|
||||||
|
{
|
||||||
|
int32 CurrWantedLevel = m_nWantedLevel;
|
||||||
|
|
||||||
|
if (m_nChaos >= 0 && m_nChaos < 40) {
|
||||||
|
m_nWantedLevel = NOTWANTED;
|
||||||
|
m_MaximumLawEnforcerVehicles = 0;
|
||||||
|
m_MaxCops = 0;
|
||||||
|
m_RoadblockDensity = 0;
|
||||||
|
}
|
||||||
|
else if (m_nChaos >= 40 && m_nChaos < 200) {
|
||||||
|
m_nWantedLevel = WANTEDLEVEL_1;
|
||||||
|
m_MaximumLawEnforcerVehicles = 1;
|
||||||
|
m_MaxCops = 1;
|
||||||
|
m_RoadblockDensity = 0;
|
||||||
|
}
|
||||||
|
else if (m_nChaos >= 200 && m_nChaos < 400) {
|
||||||
|
m_nWantedLevel = WANTEDLEVEL_2;
|
||||||
|
m_MaximumLawEnforcerVehicles = 2;
|
||||||
|
m_MaxCops = 3;
|
||||||
|
m_RoadblockDensity = 0;
|
||||||
|
}
|
||||||
|
else if (m_nChaos >= 400 && m_nChaos < 800) {
|
||||||
|
m_nWantedLevel = WANTEDLEVEL_3;
|
||||||
|
m_MaximumLawEnforcerVehicles = 2;
|
||||||
|
m_MaxCops = 4;
|
||||||
|
m_RoadblockDensity = 4;
|
||||||
|
}
|
||||||
|
else if (m_nChaos >= 800 && m_nChaos < 1600) {
|
||||||
|
m_nWantedLevel = WANTEDLEVEL_4;
|
||||||
|
m_MaximumLawEnforcerVehicles = 2;
|
||||||
|
m_MaxCops = 6;
|
||||||
|
m_RoadblockDensity = 8;
|
||||||
|
}
|
||||||
|
else if (m_nChaos >= 1600 && m_nChaos < 3200) {
|
||||||
|
m_nWantedLevel = WANTEDLEVEL_5;
|
||||||
|
m_MaximumLawEnforcerVehicles = 3;
|
||||||
|
m_MaxCops = 8;
|
||||||
|
m_RoadblockDensity = 10;
|
||||||
|
}
|
||||||
|
else if (m_nChaos >= 3200) {
|
||||||
|
m_nWantedLevel = WANTEDLEVEL_6;
|
||||||
|
m_MaximumLawEnforcerVehicles = 3;
|
||||||
|
m_MaxCops = 10;
|
||||||
|
m_RoadblockDensity = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CurrWantedLevel != m_nWantedLevel)
|
||||||
|
m_nLastWantedLevelChange = CTimer::GetTimeInMilliseconds();
|
||||||
|
}
|
12
src/Wanted.h
12
src/Wanted.h
@ -20,11 +20,11 @@ public:
|
|||||||
int32 m_nLastUpdateTime;
|
int32 m_nLastUpdateTime;
|
||||||
int32 m_nLastWantedLevelChange;
|
int32 m_nLastWantedLevelChange;
|
||||||
float m_fCrimeSensitivity;
|
float m_fCrimeSensitivity;
|
||||||
uint8 m_bCurrentCops;
|
uint8 m_CurrentCops;
|
||||||
uint8 m_bMaxCops;
|
uint8 m_MaxCops;
|
||||||
uint8 m_bMaximumLawEnforcerVehicles;
|
uint8 m_MaximumLawEnforcerVehicles;
|
||||||
int8 field_19;
|
int8 field_19;
|
||||||
int16 m_wRoadblockDensity;
|
int16 m_RoadblockDensity;
|
||||||
uint8 m_IsIgnoredByCops : 1;
|
uint8 m_IsIgnoredByCops : 1;
|
||||||
uint8 m_IsIgnoredByEveryOne : 1;
|
uint8 m_IsIgnoredByEveryOne : 1;
|
||||||
uint8 m_IsSwatRequired : 1;
|
uint8 m_IsSwatRequired : 1;
|
||||||
@ -34,12 +34,16 @@ public:
|
|||||||
int32 m_nWantedLevel;
|
int32 m_nWantedLevel;
|
||||||
CCrime m_sCrimes[16];
|
CCrime m_sCrimes[16];
|
||||||
CCopPed *m_pCops[10];
|
CCopPed *m_pCops[10];
|
||||||
|
static int32 &MaximumWantedLevel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool AreSwatRequired();
|
bool AreSwatRequired();
|
||||||
bool AreFbiRequired();
|
bool AreFbiRequired();
|
||||||
bool AreArmyRequired();
|
bool AreArmyRequired();
|
||||||
int NumOfHelisRequired();
|
int NumOfHelisRequired();
|
||||||
|
void SetWantedLevel(int32);
|
||||||
|
void ClearQdCrimes();
|
||||||
|
void UpdateWantedLevel();
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(CWanted) == 0x204, "CWanted: error");
|
static_assert(sizeof(CWanted) == 0x204, "CWanted: error");
|
||||||
|
@ -1,12 +1,320 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "main.h"
|
||||||
#include "Darkel.h"
|
#include "Darkel.h"
|
||||||
|
#include "Timer.h"
|
||||||
|
#include "DMAudio.h"
|
||||||
|
#include "Population.h"
|
||||||
|
#include "Weapon.h"
|
||||||
|
#include "World.h"
|
||||||
|
#include "PlayerPed.h"
|
||||||
|
#include "Stats.h"
|
||||||
|
#include "Font.h"
|
||||||
|
#include "Text.h"
|
||||||
|
|
||||||
|
int32 &CDarkel::TimeLimit = *(int32*)0x885BAC;
|
||||||
|
int32 &CDarkel::PreviousTime = *(int32*)0x885B00;
|
||||||
|
int32 &CDarkel::TimeOfFrenzyStart = *(int32*)0x9430D8;
|
||||||
|
int32 &CDarkel::WeaponType = *(int32*)0x9430F0;
|
||||||
|
int32 &CDarkel::AmmoInterruptedWeapon = *(int32*)0x8E29C8;
|
||||||
|
int32 &CDarkel::KillsNeeded = *(int32*)0x8F1AB8;
|
||||||
|
int8 &CDarkel::InterruptedWeapon = *(int8*)0x95CD60;
|
||||||
|
int8 &CDarkel::bStandardSoundAndMessages = *(int8*)0x95CDB6;
|
||||||
|
int8 &CDarkel::bNeedHeadShot = *(int8*)0x95CDCA;
|
||||||
|
int8 &CDarkel::bProperKillFrenzy = *(int8*)0x95CD98;
|
||||||
|
eKillFrenzyStatus &CDarkel::Status = *(eKillFrenzyStatus*)0x95CCB4;
|
||||||
|
int16 *CDarkel::RegisteredKills = (int16*)0x6EDBE0;
|
||||||
|
int32 &CDarkel::ModelToKill = *(int32*)0x8F2C78;
|
||||||
|
int32 &CDarkel::ModelToKill2 = *(int32*)0x885B40;
|
||||||
|
int32 &CDarkel::ModelToKill3 = *(int32*)0x885B3C;
|
||||||
|
int32 &CDarkel::ModelToKill4 = *(int32*)0x885B34;
|
||||||
|
wchar *CDarkel::pStartMessage = (wchar*)0x8F2C08;
|
||||||
|
|
||||||
|
int32 CDarkel::CalcFade(uint32 time, int32 min, uint32 max) {
|
||||||
|
if (time >= min && time <= max) {
|
||||||
|
if (time >= min + 500) {
|
||||||
|
if (time <= max - 500)
|
||||||
|
return -1;
|
||||||
|
else
|
||||||
|
return 255 * (max - time) / 500;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 255 * (time - min) / 500;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
WRAPPER void CDarkel::DrawMessages(void) { EAXJMP(0x420920); }
|
WRAPPER void CDarkel::DrawMessages(void) { EAXJMP(0x420920); }
|
||||||
|
#else
|
||||||
|
void CDarkel::DrawMessages()
|
||||||
|
{
|
||||||
|
bool DisplayTimers = false;
|
||||||
|
|
||||||
|
switch (Status) {
|
||||||
|
case KILLFRENZY_ONGOING:
|
||||||
|
DisplayTimers = true;
|
||||||
|
break;
|
||||||
|
case KILLFRENZY_PASSED:
|
||||||
|
case KILLFRENZY_FAILED:
|
||||||
|
DisplayTimers = false;
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (DisplayTimers) {
|
||||||
|
CFont::SetPropOn();
|
||||||
|
CFont::SetBackgroundOff();
|
||||||
|
CFont::SetBackGroundOnlyTextOn();
|
||||||
|
CFont::SetAlignment(ALIGN_RIGHT);
|
||||||
|
CFont::SetRightJustifyWrap(-SCREEN_WIDTH);
|
||||||
|
CFont::SetFontStyle(FONT_HEADING);
|
||||||
|
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
|
||||||
|
|
||||||
|
float AlignToHUD = SCREEN_SCALE_X(-10.0f);
|
||||||
|
int32 a = (TimeLimit - (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart));
|
||||||
|
if (CTimer::GetFrameCounter() & 8 || a > 4000) {
|
||||||
|
sprintf(gString, "%d:%02d", a / 60000, a % 60000 / 1000);
|
||||||
|
AsciiToUnicode(gString, gUString);
|
||||||
|
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
||||||
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(25.0f) + AlignToHUD, SCREEN_SCALE_Y(112.0f), gUString);
|
||||||
|
|
||||||
|
CFont::SetColor(CRGBA(150, 100, 255, 255));
|
||||||
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) + AlignToHUD, SCREEN_SCALE_Y(110.0f), gUString);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (KillsNeeded <= 0)
|
||||||
|
KillsNeeded = 0;
|
||||||
|
|
||||||
|
sprintf((char *)gString, "%d", KillsNeeded);
|
||||||
|
AsciiToUnicode(gString, gUString);
|
||||||
|
|
||||||
|
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
||||||
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(25.0f) + AlignToHUD, SCREEN_SCALE_Y(134.0f), gUString);
|
||||||
|
|
||||||
|
CFont::SetColor(CRGBA(255, 128, 128, 255));
|
||||||
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) + AlignToHUD, SCREEN_SCALE_Y(132.0f), gUString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void CDarkel::Init()
|
||||||
|
{
|
||||||
|
Status = KILLFRENZY_INIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
int16 CDarkel::QueryModelsKilledByPlayer(int32 modelId)
|
||||||
|
{
|
||||||
|
return RegisteredKills[modelId];
|
||||||
|
}
|
||||||
|
|
||||||
bool CDarkel::Status = *(bool*)0x95CCB4;
|
|
||||||
|
|
||||||
bool CDarkel::FrenzyOnGoing()
|
bool CDarkel::FrenzyOnGoing()
|
||||||
{
|
{
|
||||||
return Status == 1;
|
return Status == KILLFRENZY_ONGOING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eKillFrenzyStatus CDarkel::ReadStatus()
|
||||||
|
{
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 CDarkel::RegisterCarBlownUpByPlayer(eKillFrenzyStatus status)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDarkel::RegisterKillByPlayer(int32 modelid, eWeaponType weapontype, bool flag)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDarkel::RegisterKillNotByPlayer()
|
||||||
|
{
|
||||||
|
++CStats::NumberKillFrenziesPassed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDarkel::ResetModelsKilledByPlayer()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 200; i++) {
|
||||||
|
for (int j = 0; j < 8; j++)
|
||||||
|
RegisteredKills[i + j] = 0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDarkel::ResetOnPlayerDeath()
|
||||||
|
{
|
||||||
|
eWeaponType &EWeaponType = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType;
|
||||||
|
int32 &CurrentWeapon = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nModelId;
|
||||||
|
int32 &CurrentDarkelWeapon = CDarkel::WeaponType;
|
||||||
|
uint32 &TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
|
||||||
|
|
||||||
|
if (Status == KILLFRENZY_ONGOING) {
|
||||||
|
CPopulation::m_AllRandomPedsThisType = -1;
|
||||||
|
Status = KILLFRENZY_FAILED;
|
||||||
|
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
||||||
|
|
||||||
|
if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
|
||||||
|
CurrentDarkelWeapon = WEAPONTYPE_UZI;
|
||||||
|
|
||||||
|
if (CurrentDarkelWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
||||||
|
FindPlayerPed()->m_bWeaponSlot = InterruptedWeapon;
|
||||||
|
TotalAmmo = AmmoInterruptedWeapon;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FindPlayerVehicle()) {
|
||||||
|
FindPlayerPed()->RemoveWeaponModel(CurrentWeapon);
|
||||||
|
FindPlayerPed()->m_currentWeapon = EWeaponType;
|
||||||
|
FindPlayerPed()->MakeChangesForNewWeapon(FindPlayerPed()->m_currentWeapon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
WRAPPER void CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, int16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot) { EAXJMP(0x4210E0); }
|
||||||
|
#else
|
||||||
|
void CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, int16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot)
|
||||||
|
{
|
||||||
|
eWeaponType &EWeaponType = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType;
|
||||||
|
uint32 &TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
|
||||||
|
uint32 &AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip;
|
||||||
|
|
||||||
|
if (weaponType == WEAPONTYPE_UZI_DRIVEBY)
|
||||||
|
weaponType = WEAPONTYPE_UZI;
|
||||||
|
|
||||||
|
WeaponType = weaponType;
|
||||||
|
Status = KILLFRENZY_ONGOING;
|
||||||
|
KillsNeeded = kill;
|
||||||
|
ModelToKill = modelId0;
|
||||||
|
ModelToKill2 = modelId2;
|
||||||
|
ModelToKill3 = modelId3;
|
||||||
|
ModelToKill4 = modelId4;
|
||||||
|
pStartMessage = text;
|
||||||
|
|
||||||
|
if (text == TheText.Get("PAGE_00")) {
|
||||||
|
CDarkel::bProperKillFrenzy = 1;
|
||||||
|
CDarkel::pStartMessage = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bProperKillFrenzy = 0;
|
||||||
|
|
||||||
|
bStandardSoundAndMessages = standardSound;
|
||||||
|
bNeedHeadShot = needHeadShot;
|
||||||
|
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
||||||
|
TimeLimit = time;
|
||||||
|
PreviousTime = time / 1000;
|
||||||
|
|
||||||
|
if (weaponType < WEAPONTYPE_TOTALWEAPONS) {
|
||||||
|
InterruptedWeapon = FindPlayerPed()->m_currentWeapon;
|
||||||
|
FindPlayerPed()->GiveWeapon(weaponType, 0);
|
||||||
|
AmmoInterruptedWeapon = TotalAmmo;
|
||||||
|
FindPlayerPed()->GiveWeapon(weaponType, 30000);
|
||||||
|
FindPlayerPed()->m_bWeaponSlot = EWeaponType;
|
||||||
|
FindPlayerPed()->MakeChangesForNewWeapon(FindPlayerPed()->m_bWeaponSlot);
|
||||||
|
|
||||||
|
if (FindPlayerVehicle()) {
|
||||||
|
FindPlayerPed()->m_currentWeapon = EWeaponType;
|
||||||
|
if (TotalAmmo <= AmmoInClip)
|
||||||
|
AmmoInClip = TotalAmmo;
|
||||||
|
|
||||||
|
FindPlayerPed()->ClearWeaponTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CDarkel::bStandardSoundAndMessages)
|
||||||
|
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_START, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void CDarkel::Update()
|
||||||
|
{
|
||||||
|
eWeaponType &EWeaponType = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType;
|
||||||
|
int32 &CurrentWeapon = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nModelId;
|
||||||
|
int32 &CurrentDarkelWeapon = CDarkel::WeaponType;
|
||||||
|
uint32 &TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
|
||||||
|
|
||||||
|
if (Status == KILLFRENZY_ONGOING) {
|
||||||
|
int32 FrameTime = TimeLimit - (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart);
|
||||||
|
if ((TimeLimit - (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart)) > 0 || TimeLimit < 0) {
|
||||||
|
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_ONGOING, FrameTime);
|
||||||
|
|
||||||
|
int32 PrevTime = FrameTime / 1000;
|
||||||
|
|
||||||
|
if (PrevTime != PreviousTime) {
|
||||||
|
if (PreviousTime < 12)
|
||||||
|
DMAudio.PlayFrontEndSound(SOUND_CLOCK_TICK, PrevTime);
|
||||||
|
PreviousTime = PrevTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CPopulation::m_AllRandomPedsThisType = -1;
|
||||||
|
Status = KILLFRENZY_FAILED;
|
||||||
|
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
||||||
|
|
||||||
|
if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
|
||||||
|
CurrentDarkelWeapon = WEAPONTYPE_UZI;
|
||||||
|
|
||||||
|
if (CurrentDarkelWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
||||||
|
FindPlayerPed()->m_bWeaponSlot = InterruptedWeapon;
|
||||||
|
TotalAmmo = AmmoInterruptedWeapon;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FindPlayerVehicle()) {
|
||||||
|
FindPlayerPed()->RemoveWeaponModel(CurrentWeapon);
|
||||||
|
FindPlayerPed()->m_currentWeapon = EWeaponType;
|
||||||
|
FindPlayerPed()->MakeChangesForNewWeapon(FindPlayerPed()->m_currentWeapon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bStandardSoundAndMessages)
|
||||||
|
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_FAILED, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (KillsNeeded <= 0) {
|
||||||
|
CPopulation::m_AllRandomPedsThisType = -1;
|
||||||
|
Status = KILLFRENZY_PASSED;
|
||||||
|
|
||||||
|
if (bProperKillFrenzy)
|
||||||
|
CStats::AnotherKillFrenzyPassed();
|
||||||
|
|
||||||
|
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
||||||
|
|
||||||
|
FindPlayerPed()->m_pWanted->SetWantedLevel(NOTWANTED);
|
||||||
|
|
||||||
|
if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
|
||||||
|
CurrentDarkelWeapon = WEAPONTYPE_UZI;
|
||||||
|
|
||||||
|
if (CurrentDarkelWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
||||||
|
FindPlayerPed()->m_bWeaponSlot = InterruptedWeapon;
|
||||||
|
TotalAmmo = AmmoInterruptedWeapon;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FindPlayerVehicle()) {
|
||||||
|
FindPlayerPed()->RemoveWeaponModel(CurrentWeapon);
|
||||||
|
FindPlayerPed()->m_currentWeapon = EWeaponType;
|
||||||
|
FindPlayerPed()->MakeChangesForNewWeapon(FindPlayerPed()->m_currentWeapon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bStandardSoundAndMessages)
|
||||||
|
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_PASSED, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
STARTPATCHES
|
||||||
|
/*InjectHook(0x421380, CDarkel::CalcFade, PATCH_JUMP);
|
||||||
|
InjectHook(0x420920, CDarkel::DrawMessages, PATCH_JUMP);
|
||||||
|
InjectHook(0x420E60, CDarkel::FrenzyOnGoing, PATCH_JUMP);
|
||||||
|
InjectHook(0x420650, CDarkel::Init, PATCH_JUMP);
|
||||||
|
InjectHook(0x421370, CDarkel::QueryModelsKilledByPlayer, PATCH_JUMP);
|
||||||
|
InjectHook(0x420E50, CDarkel::ReadStatus, PATCH_JUMP);
|
||||||
|
InjectHook(0x421070, CDarkel::RegisterCarBlownUpByPlayer, PATCH_JUMP);
|
||||||
|
InjectHook(0x420F60, CDarkel::RegisterKillByPlayer, PATCH_JUMP);
|
||||||
|
InjectHook(0x421060, CDarkel::RegisterKillNotByPlayer, PATCH_JUMP);
|
||||||
|
InjectHook(0x421310, CDarkel::ResetModelsKilledByPlayer, PATCH_JUMP);
|
||||||
|
InjectHook(0x420E70, CDarkel::ResetOnPlayerDeath, PATCH_JUMP);
|
||||||
|
InjectHook(0x4210E0, CDarkel::StartFrenzy, PATCH_JUMP);
|
||||||
|
InjectHook(0x420660, CDarkel::Update, PATCH_JUMP);*/
|
||||||
|
ENDPATCHES
|
@ -1,11 +1,48 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "Weapon.h"
|
||||||
|
|
||||||
|
enum eKillFrenzyStatus
|
||||||
|
{
|
||||||
|
KILLFRENZY_INIT,
|
||||||
|
KILLFRENZY_ONGOING,
|
||||||
|
KILLFRENZY_PASSED,
|
||||||
|
KILLFRENZY_FAILED,
|
||||||
|
};
|
||||||
|
|
||||||
class CDarkel
|
class CDarkel
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static bool Status;
|
static int32 &TimeLimit;
|
||||||
|
static int32 &PreviousTime;
|
||||||
|
static int32 &TimeOfFrenzyStart;
|
||||||
|
static int32 &WeaponType;
|
||||||
|
static int32 &AmmoInterruptedWeapon;
|
||||||
|
static int32 &KillsNeeded;
|
||||||
|
static int8 &InterruptedWeapon;
|
||||||
|
static int8 &bStandardSoundAndMessages;
|
||||||
|
static int8 &bNeedHeadShot;
|
||||||
|
static int8 &bProperKillFrenzy;
|
||||||
|
static eKillFrenzyStatus &Status;
|
||||||
|
static int16 *RegisteredKills;
|
||||||
|
static int32 &ModelToKill;
|
||||||
|
static int32 &ModelToKill2;
|
||||||
|
static int32 &ModelToKill3;
|
||||||
|
static int32 &ModelToKill4;
|
||||||
|
static wchar *pStartMessage;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static int32 CalcFade(uint32 time, int32 min, uint32 max);
|
||||||
static void DrawMessages(void);
|
static void DrawMessages(void);
|
||||||
static bool FrenzyOnGoing();
|
static bool FrenzyOnGoing();
|
||||||
|
static void Init();
|
||||||
|
static int16 QueryModelsKilledByPlayer(int32 modelId);
|
||||||
|
static eKillFrenzyStatus ReadStatus();
|
||||||
|
static int32 RegisterCarBlownUpByPlayer(eKillFrenzyStatus status);
|
||||||
|
static void RegisterKillByPlayer(int32 modelid, eWeaponType weapontype, bool flag);
|
||||||
|
static void RegisterKillNotByPlayer();
|
||||||
|
static void ResetModelsKilledByPlayer();
|
||||||
|
static void ResetOnPlayerDeath();
|
||||||
|
static void StartFrenzy(eWeaponType weaponType, int32 time, int16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot);
|
||||||
|
static void Update();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -39,6 +39,7 @@ WRAPPER void CPed::PreRender(void) { EAXJMP(0x4CFDD0); }
|
|||||||
WRAPPER void CPed::Render(void) { EAXJMP(0x4D03F0); }
|
WRAPPER void CPed::Render(void) { EAXJMP(0x4D03F0); }
|
||||||
WRAPPER int32 CPed::ProcessEntityCollision(CEntity*, CColPoint*) { EAXJMP(0x4CBB30); }
|
WRAPPER int32 CPed::ProcessEntityCollision(CEntity*, CColPoint*) { EAXJMP(0x4CBB30); }
|
||||||
WRAPPER void CPed::SetMoveAnim(void) { EAXJMP(0x4C5A40); }
|
WRAPPER void CPed::SetMoveAnim(void) { EAXJMP(0x4C5A40); }
|
||||||
|
WRAPPER void CPed::MakeChangesForNewWeapon(int8) { EAXJMP(0x4F2560); }
|
||||||
|
|
||||||
bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44;
|
bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44;
|
||||||
bool &CPed::bPedCheat2 = *(bool*)0x95CD5A;
|
bool &CPed::bPedCheat2 = *(bool*)0x95CD5A;
|
||||||
@ -461,9 +462,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
|
|||||||
}
|
}
|
||||||
m_maxWeaponTypeAllowed = 0;
|
m_maxWeaponTypeAllowed = 0;
|
||||||
m_currentWeapon = 0;
|
m_currentWeapon = 0;
|
||||||
m_storedWeapon = NO_STORED_WEAPON;
|
m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
|
||||||
|
|
||||||
for(int i = 0; i < NUM_PED_WEAPONTYPES; i++)
|
for(int i = 0; i < WEAPONTYPE_TOTAL_INVENTORY_WEAPONS; i++)
|
||||||
{
|
{
|
||||||
CWeapon &weapon = GetWeapon(i);
|
CWeapon &weapon = GetWeapon(i);
|
||||||
weapon.m_eWeaponType = WEAPONTYPE_UNARMED;
|
weapon.m_eWeaponType = WEAPONTYPE_UNARMED;
|
||||||
@ -1445,9 +1446,9 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
|
|||||||
|
|
||||||
// Only uzi can be used on cars, so previous weapon was stored
|
// Only uzi can be used on cars, so previous weapon was stored
|
||||||
if (ped->IsPlayer() && weaponType == WEAPONTYPE_UZI) {
|
if (ped->IsPlayer() && weaponType == WEAPONTYPE_UZI) {
|
||||||
if (ped->m_storedWeapon != NO_STORED_WEAPON) {
|
if (ped->m_storedWeapon != WEAPONTYPE_UNIDENTIFIED) {
|
||||||
ped->SetCurrentWeapon(ped->m_storedWeapon);
|
ped->SetCurrentWeapon(ped->m_storedWeapon);
|
||||||
ped->m_storedWeapon = NO_STORED_WEAPON;
|
ped->m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ped->AddWeaponModel(CWeaponInfo::GetWeaponInfo(weaponType)->m_nModelId);
|
ped->AddWeaponModel(CWeaponInfo::GetWeaponInfo(weaponType)->m_nModelId);
|
||||||
|
@ -324,7 +324,7 @@ public:
|
|||||||
uint8 pad_351[3];
|
uint8 pad_351[3];
|
||||||
uint32 m_timerUnused;
|
uint32 m_timerUnused;
|
||||||
CEntity *m_targetUnused;
|
CEntity *m_targetUnused;
|
||||||
CWeapon m_weapons[NUM_PED_WEAPONTYPES];
|
CWeapon m_weapons[WEAPONTYPE_TOTAL_INVENTORY_WEAPONS];
|
||||||
eWeaponType m_storedWeapon;
|
eWeaponType m_storedWeapon;
|
||||||
uint8 m_currentWeapon; // eWeaponType
|
uint8 m_currentWeapon; // eWeaponType
|
||||||
uint8 m_maxWeaponTypeAllowed; // eWeaponType
|
uint8 m_maxWeaponTypeAllowed; // eWeaponType
|
||||||
@ -427,6 +427,7 @@ public:
|
|||||||
bool CanSeeEntity(CEntity*, float);
|
bool CanSeeEntity(CEntity*, float);
|
||||||
void RestorePreviousObjective(void);
|
void RestorePreviousObjective(void);
|
||||||
void SetObjective(eObjective, void*);
|
void SetObjective(eObjective, void*);
|
||||||
|
void MakeChangesForNewWeapon(int8);
|
||||||
|
|
||||||
// Static methods
|
// Static methods
|
||||||
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
|
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
#include "PlayerPed.h"
|
#include "PlayerPed.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "WeaponEffects.h"
|
||||||
|
|
||||||
CPlayerPed::~CPlayerPed()
|
CPlayerPed::~CPlayerPed()
|
||||||
{
|
{
|
||||||
@ -9,6 +11,18 @@ CPlayerPed::~CPlayerPed()
|
|||||||
|
|
||||||
WRAPPER void CPlayerPed::ReApplyMoveAnims(void) { EAXJMP(0x4F07C0); }
|
WRAPPER void CPlayerPed::ReApplyMoveAnims(void) { EAXJMP(0x4F07C0); }
|
||||||
|
|
||||||
|
void CPlayerPed::ClearWeaponTarget()
|
||||||
|
{
|
||||||
|
if (!m_nPedType) {
|
||||||
|
m_pPointGunAt = 0;
|
||||||
|
TheCamera.ClearPlayerWeaponMode();
|
||||||
|
CWeaponEffects::ClearCrosshair();
|
||||||
|
}
|
||||||
|
ClearPointGunAt();
|
||||||
|
}
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
InjectHook(0x4EFB30, &CPlayerPed::dtor, PATCH_JUMP);
|
InjectHook(0x4EFB30, &CPlayerPed::dtor, PATCH_JUMP);
|
||||||
|
InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP);
|
||||||
|
|
||||||
ENDPATCHES
|
ENDPATCHES
|
@ -43,6 +43,7 @@ public:
|
|||||||
|
|
||||||
void dtor(void) { this->CPlayerPed::~CPlayerPed(); }
|
void dtor(void) { this->CPlayerPed::~CPlayerPed(); }
|
||||||
void ReApplyMoveAnims(void);
|
void ReApplyMoveAnims(void);
|
||||||
|
void ClearWeaponTarget();
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error");
|
static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error");
|
||||||
|
@ -3,3 +3,10 @@
|
|||||||
#include "WeaponEffects.h"
|
#include "WeaponEffects.h"
|
||||||
|
|
||||||
WRAPPER void CWeaponEffects::Render(void) { EAXJMP(0x564D70); }
|
WRAPPER void CWeaponEffects::Render(void) { EAXJMP(0x564D70); }
|
||||||
|
|
||||||
|
CWeaponEffects &gCrossHair = *(CWeaponEffects*)0x6503BC;
|
||||||
|
|
||||||
|
void CWeaponEffects::ClearCrosshair()
|
||||||
|
{
|
||||||
|
gCrossHair.m_bCrosshair = false;
|
||||||
|
}
|
||||||
|
@ -2,6 +2,20 @@
|
|||||||
|
|
||||||
class CWeaponEffects
|
class CWeaponEffects
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
bool m_bCrosshair;
|
||||||
|
int8 gap_1[3];
|
||||||
|
CVector m_vecPos;
|
||||||
|
int8 field_16;
|
||||||
|
int8 field_17;
|
||||||
|
int8 field_18;
|
||||||
|
int8 field_19;
|
||||||
|
float field_20;
|
||||||
|
int32 field_24;
|
||||||
|
RwTexture *m_pTexture;
|
||||||
|
RwRaster *m_pRaster;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Render(void);
|
static void Render(void);
|
||||||
|
static void ClearCrosshair();
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
|
|
||||||
enum eWeaponType : uint32
|
enum eWeaponType
|
||||||
{
|
{
|
||||||
WEAPONTYPE_UNARMED = 0,
|
WEAPONTYPE_UNARMED,
|
||||||
WEAPONTYPE_BASEBALLBAT,
|
WEAPONTYPE_BASEBALLBAT,
|
||||||
WEAPONTYPE_COLT45,
|
WEAPONTYPE_COLT45,
|
||||||
WEAPONTYPE_UZI,
|
WEAPONTYPE_UZI,
|
||||||
@ -16,10 +16,16 @@ enum eWeaponType : uint32
|
|||||||
WEAPONTYPE_MOLOTOV,
|
WEAPONTYPE_MOLOTOV,
|
||||||
WEAPONTYPE_GRENADE,
|
WEAPONTYPE_GRENADE,
|
||||||
WEAPONTYPE_DETONATOR,
|
WEAPONTYPE_DETONATOR,
|
||||||
NUM_PED_WEAPONTYPES = 13,
|
WEAPONTYPE_TOTAL_INVENTORY_WEAPONS,
|
||||||
WEAPONTYPE_HELICANNON = 13,
|
WEAPONTYPE_TOTALWEAPONS,
|
||||||
NUM_WEAPONTYPES,
|
WEAPONTYPE_ARMOUR,
|
||||||
NO_STORED_WEAPON = 22
|
WEAPONTYPE_RAMMEDBYCAR,
|
||||||
|
WEAPONTYPE_RUNOVERBYCAR,
|
||||||
|
WEAPONTYPE_EXPLOSION,
|
||||||
|
WEAPONTYPE_UZI_DRIVEBY,
|
||||||
|
WEAPONTYPE_WATER,
|
||||||
|
WEAPONTYPE_FALL_DAMAGE,
|
||||||
|
WEAPONTYPE_UNIDENTIFIED,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eWeaponFire {
|
enum eWeaponFire {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "AnimBlendAssociation.h"
|
#include "AnimBlendAssociation.h"
|
||||||
|
|
||||||
//CWeaponInfo (&CWeaponInfo::ms_apWeaponInfos)[14] = * (CWeaponInfo(*)[14]) * (uintptr*)0x6503EC;
|
//CWeaponInfo (&CWeaponInfo::ms_apWeaponInfos)[14] = * (CWeaponInfo(*)[14]) * (uintptr*)0x6503EC;
|
||||||
CWeaponInfo CWeaponInfo::ms_apWeaponInfos[NUM_WEAPONTYPES];
|
CWeaponInfo CWeaponInfo::ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS];
|
||||||
|
|
||||||
static char ms_aWeaponNames[][32] = {
|
static char ms_aWeaponNames[][32] = {
|
||||||
"Unarmed",
|
"Unarmed",
|
||||||
@ -34,7 +34,7 @@ void
|
|||||||
CWeaponInfo::Initialise(void)
|
CWeaponInfo::Initialise(void)
|
||||||
{
|
{
|
||||||
debug("Initialising CWeaponInfo...\n");
|
debug("Initialising CWeaponInfo...\n");
|
||||||
for (int i = 0; i < NUM_WEAPONTYPES; i++) {
|
for (int i = 0; i < WEAPONTYPE_TOTALWEAPONS; i++) {
|
||||||
ms_apWeaponInfos[i].m_eWeaponFire = WEAPON_FIRE_INSTANT_HIT;
|
ms_apWeaponInfos[i].m_eWeaponFire = WEAPON_FIRE_INSTANT_HIT;
|
||||||
ms_apWeaponInfos[i].m_AnimToPlay = ANIM_PUNCH_R;
|
ms_apWeaponInfos[i].m_AnimToPlay = ANIM_PUNCH_R;
|
||||||
ms_apWeaponInfos[i].m_Anim2ToPlay = NUM_ANIMS;
|
ms_apWeaponInfos[i].m_Anim2ToPlay = NUM_ANIMS;
|
||||||
@ -176,7 +176,7 @@ CWeaponInfo::LoadWeaponData(void)
|
|||||||
eWeaponType
|
eWeaponType
|
||||||
CWeaponInfo::FindWeaponType(char *name)
|
CWeaponInfo::FindWeaponType(char *name)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NUM_WEAPONTYPES; i++) {
|
for (int i = 0; i < WEAPONTYPE_TOTALWEAPONS; i++) {
|
||||||
if (strcmp(ms_aWeaponNames[i], name) == 0) {
|
if (strcmp(ms_aWeaponNames[i], name) == 0) {
|
||||||
return static_cast<eWeaponType>(i);
|
return static_cast<eWeaponType>(i);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user