Finishing CDarkel

This commit is contained in:
Sergeanur 2020-01-07 16:37:20 +02:00
parent f7e962beaa
commit 208754ac68
3 changed files with 46 additions and 10 deletions

View File

@ -11,6 +11,10 @@
#include "Stats.h" #include "Stats.h"
#include "Font.h" #include "Font.h"
#include "Text.h" #include "Text.h"
#include "Vehicle.h"
#define FRENZY_ANY_PED -1
#define FRENZY_ANY_CAR -2
int32 &CDarkel::TimeLimit = *(int32*)0x885BAC; int32 &CDarkel::TimeLimit = *(int32*)0x885BAC;
int32 &CDarkel::PreviousTime = *(int32*)0x885B00; int32 &CDarkel::PreviousTime = *(int32*)0x885B00;
@ -157,29 +161,57 @@ CDarkel::ReadStatus()
return Status; return Status;
} }
#if 1 #if 0
WRAPPER void CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle) { EAXJMP(0x421070); } WRAPPER void CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle) { EAXJMP(0x421070); }
#else #else
int32 CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle) void
CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle)
{ {
return 0; if (FrenzyOnGoing()) {
int32 model = vehicle->GetModelIndex();
if (ModelToKill == FRENZY_ANY_CAR || ModelToKill == model || ModelToKill2 == model || ModelToKill3 == model || ModelToKill4 == model) {
KillsNeeded--;
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_CAR_BLOWN, 0);
}
}
RegisteredKills[vehicle->GetModelIndex()]++;
CStats::CarsExploded++;
} }
#endif #endif
#if 1 #if 0
WRAPPER void CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot) { EAXJMP(0x420F60); } WRAPPER void CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot) { EAXJMP(0x420F60); }
#else #else
void CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot) void
CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapon, bool headshot)
{ {
if (FrenzyOnGoing() && (weapon == WeaponType
|| weapon == WEAPONTYPE_EXPLOSION
|| weapon == WEAPONTYPE_UZI_DRIVEBY && WeaponType == WEAPONTYPE_UZI
|| weapon == WEAPONTYPE_RAMMEDBYCAR && WeaponType == WEAPONTYPE_RUNOVERBYCAR
|| weapon == WEAPONTYPE_RUNOVERBYCAR && WeaponType == WEAPONTYPE_RAMMEDBYCAR
|| weapon == WEAPONTYPE_FLAMETHROWER && WeaponType == WEAPONTYPE_MOLOTOV)) {
int32 model = victim->GetModelIndex();
if (ModelToKill == FRENZY_ANY_PED || ModelToKill == model || ModelToKill2 == model || ModelToKill3 == model || ModelToKill4 == model) {
if (!bNeedHeadShot || headshot) {
KillsNeeded--;
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_KILL, 0);
}
}
}
CStats::PeopleKilledByPlayer++;
RegisteredKills[victim->GetModelIndex()]++;
CStats::PedsKilledOfThisType[victim->bChrisCriminal ? PEDTYPE_CRIMINAL : victim->m_nPedType]++;
if (headshot)
CStats::HeadsPopped++;
CStats::KillsSinceLastCheckpoint++;
} }
#endif #endif
void void
CDarkel::RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype) CDarkel::RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype)
{ {
++CStats::PeopleKilledByOthers; CStats::PeopleKilledByOthers++;
} }
void void
@ -367,6 +399,6 @@ STARTPATCHES
InjectHook(0x421060, CDarkel::RegisterKillNotByPlayer, PATCH_JUMP); InjectHook(0x421060, CDarkel::RegisterKillNotByPlayer, PATCH_JUMP);
InjectHook(0x421310, CDarkel::ResetModelsKilledByPlayer, PATCH_JUMP); InjectHook(0x421310, CDarkel::ResetModelsKilledByPlayer, PATCH_JUMP);
InjectHook(0x420920, CDarkel::DrawMessages, PATCH_JUMP); InjectHook(0x420920, CDarkel::DrawMessages, PATCH_JUMP);
//InjectHook(0x421070, CDarkel::RegisterCarBlownUpByPlayer, PATCH_JUMP); InjectHook(0x421070, CDarkel::RegisterCarBlownUpByPlayer, PATCH_JUMP);
//InjectHook(0x420F60, CDarkel::RegisterKillByPlayer, PATCH_JUMP); InjectHook(0x420F60, CDarkel::RegisterKillByPlayer, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -17,6 +17,8 @@ int32& CStats::DistanceTravelledInVehicle = *(int32*)0x940574;
int32& CStats::DistanceTravelledOnFoot = *(int32*)0x941518; int32& CStats::DistanceTravelledOnFoot = *(int32*)0x941518;
int32 &CStats::ProgressMade = *(int32*)0x8F6224; int32 &CStats::ProgressMade = *(int32*)0x8F6224;
int32 &CStats::TotalProgressInGame = *(int32*)0x885B2C; int32 &CStats::TotalProgressInGame = *(int32*)0x885B2C;
int32& CStats::CarsExploded = *(int32*)0x941288;
int32& CStats::PeopleKilledByPlayer = *(int32*)0x8F1B7C;
float &CStats::MaximumJumpDistance = *(float*)0x8F2BDC; float &CStats::MaximumJumpDistance = *(float*)0x8F2BDC;
float &CStats::MaximumJumpHeight = *(float*)0x940564; float &CStats::MaximumJumpHeight = *(float*)0x940564;
int32 &CStats::MaximumJumpFlips = *(int32*)0x8F2524; int32 &CStats::MaximumJumpFlips = *(int32*)0x8F2524;

View File

@ -17,6 +17,8 @@ public:
static int32 &KillsSinceLastCheckpoint; static int32 &KillsSinceLastCheckpoint;
static int32 &DistanceTravelledInVehicle; static int32 &DistanceTravelledInVehicle;
static int32 &DistanceTravelledOnFoot; static int32 &DistanceTravelledOnFoot;
static int32 &CarsExploded;
static int32 &PeopleKilledByPlayer;
static int32 &ProgressMade; static int32 &ProgressMade;
static int32 &TotalProgressInGame; static int32 &TotalProgressInGame;
static float &MaximumJumpDistance; static float &MaximumJumpDistance;