summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-10-05 15:44:03 +0200
committereray orçunus <erayorcunus@gmail.com>2019-10-05 16:06:01 +0200
commitaa4e7ad5eb554b1219f7eaae53e5ddc0d4478dd9 (patch)
treead8198d43e156782930020c1e066f07812b9f45b /src/control
parentFix warnings (diff)
downloadre3-aa4e7ad5eb554b1219f7eaae53e5ddc0d4478dd9.tar
re3-aa4e7ad5eb554b1219f7eaae53e5ddc0d4478dd9.tar.gz
re3-aa4e7ad5eb554b1219f7eaae53e5ddc0d4478dd9.tar.bz2
re3-aa4e7ad5eb554b1219f7eaae53e5ddc0d4478dd9.tar.lz
re3-aa4e7ad5eb554b1219f7eaae53e5ddc0d4478dd9.tar.xz
re3-aa4e7ad5eb554b1219f7eaae53e5ddc0d4478dd9.tar.zst
re3-aa4e7ad5eb554b1219f7eaae53e5ddc0d4478dd9.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Darkel.cpp298
-rw-r--r--src/control/Darkel.h10
2 files changed, 171 insertions, 137 deletions
diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp
index 670c10fb..da28faa7 100644
--- a/src/control/Darkel.cpp
+++ b/src/control/Darkel.cpp
@@ -2,12 +2,12 @@
#include "patcher.h"
#include "main.h"
#include "Darkel.h"
+#include "PlayerPed.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"
@@ -19,105 +19,140 @@ int32 &CDarkel::WeaponType = *(int32*)0x9430F0;
int32 &CDarkel::AmmoInterruptedWeapon = *(int32*)0x8E29C8;
int32 &CDarkel::KillsNeeded = *(int32*)0x8F1AB8;
int8 &CDarkel::InterruptedWeapon = *(int8*)0x95CD60;
+
+/*
+ * bStandardSoundAndMessages is a completely beta thing,
+ * makes game handle sounds & messages instead of SCM (just like in GTA2)
+ * but it's never been used in the game. Has unused sliding text when frenzy completed etc.
+ */
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;
+uint16 (&CDarkel::RegisteredKills)[NUMDEFAULTMODELS] = *(uint16(*)[NUMDEFAULTMODELS]) * (uintptr*)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 start, uint32 end) {
+uint8
+CDarkel::CalcFade(uint32 time, uint32 start, uint32 end)
+{
if (time >= start && time <= end) {
if (time >= start + 500) {
if (time <= end - 500)
return 255;
else
return 255 * (end - time) / 500;
- }
- else
+ } else
return 255 * (time - start) / 500;
- }
- else
+ } else
return 0;
}
-// This function has been cleaned up from unused stuff.
-#if 0
-WRAPPER void CDarkel::DrawMessages(void) { EAXJMP(0x420920); }
-#else
-void CDarkel::DrawMessages()
+// Screen positions taken from VC
+void
+CDarkel::DrawMessages()
{
- bool DisplayTimers = false;
-
switch (Status) {
- case KILLFRENZY_ONGOING:
- assert(pStartMessage != nil);
- 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);
+ case KILLFRENZY_ONGOING:
+ {
+ CFont::SetJustifyOff();
+ CFont::SetBackgroundOff();
+ CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(30.0f));
+ CFont::SetCentreOn();
+ CFont::SetPropOn();
+ uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart;
+ if (CDarkel::bStandardSoundAndMessages) {
+ if (timePassedSinceStart >= 3000 && timePassedSinceStart < 11000) {
+ CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
+ CFont::SetJustifyOff();
+ CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 3000, 11000)));
+ CFont::SetFontStyle(FONT_BANK);
+ if (pStartMessage) {
+ CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, pStartMessage);
+ }
+ }
+ } else {
+ if (timePassedSinceStart < 8000) {
+ CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
+ CFont::SetJustifyOff();
+ CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 0, 8000)));
+ CFont::SetFontStyle(FONT_BANK);
+ if (pStartMessage) {
+ CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, pStartMessage);
+ }
+ }
+ }
+ CFont::SetScale(SCREEN_SCALE_X(0.75f), SCREEN_SCALE_Y(1.5f));
+ CFont::SetCentreOff();
+ CFont::SetRightJustifyOn();
+ CFont::SetFontStyle(FONT_HEADING);
+ if (CDarkel::TimeLimit >= 0) {
+ uint32 timeLeft = CDarkel::TimeLimit - (CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart);
+ sprintf(gString, "%d:%02d", timeLeft / 60000, timeLeft % 60000 / 1000);
+ AsciiToUnicode(gString, gUString);
+ if (timeLeft > 4000 || CTimer::GetFrameCounter() & 1) {
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(109.0f), gUString);
+ CFont::SetColor(CRGBA(150, 100, 255, 255));
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(108.0f), gUString);
+ }
+ }
+ sprintf(gString, "%d", (CDarkel::KillsNeeded >= 0 ? CDarkel::KillsNeeded : 0));
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);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(144.0f), gUString);
+ CFont::SetColor(CRGBA(255, 128, 128, 255));
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(143.0f), gUString);
+ break;
}
-
- 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);
+ case KILLFRENZY_PASSED:
+ {
+ if (CDarkel::bStandardSoundAndMessages) {
+ uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart;
+ if (CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart < 5000) {
+ CFont::SetBackgroundOff();
+ CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f));
+ CFont::SetCentreOn();
+ CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
+ CFont::SetJustifyOff();
+ CFont::SetColor(CRGBA(128, 255, 128, CalcFade(timePassedSinceStart, 0, 5000)));
+ CFont::SetFontStyle(FONT_BANK);
+ int y = SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(25.0f - timePassedSinceStart * 0.01f);
+ CFont::PrintString(SCREEN_WIDTH / 2, y, TheText.Get("KF_3"));
+ }
+ }
+ break;
+ }
+ default:
+ break;
}
}
-#endif
-void CDarkel::Init()
+void
+CDarkel::Init()
{
Status = KILLFRENZY_NONE;
}
-int16 CDarkel::QueryModelsKilledByPlayer(int32 modelId)
+uint16
+CDarkel::QueryModelsKilledByPlayer(int32 modelId)
{
return RegisteredKills[modelId];
}
-bool CDarkel::FrenzyOnGoing()
+bool
+CDarkel::FrenzyOnGoing()
{
return Status == KILLFRENZY_ONGOING;
}
-eKillFrenzyStatus CDarkel::ReadStatus()
+uint16
+CDarkel::ReadStatus()
{
return Status;
}
@@ -141,21 +176,24 @@ void CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool he
}
#endif
-void CDarkel::RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype)
+void
+CDarkel::RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype)
{
- ++CStats::NumberKillFrenziesPassed;
+ ++CStats::PeopleKilledByOthers;
}
-void CDarkel::ResetModelsKilledByPlayer()
+void
+CDarkel::ResetModelsKilledByPlayer()
{
- for (int i = 0; i < 200; i++)
+ for (int i = 0; i < NUMDEFAULTMODELS; i++)
RegisteredKills[i] = 0;
}
#if 0
WRAPPER void CDarkel::ResetOnPlayerDeath() { EAXJMP(0x420E70); }
#else
-void CDarkel::ResetOnPlayerDeath()
+void
+CDarkel::ResetOnPlayerDeath()
{
if (Status != KILLFRENZY_ONGOING)
return;
@@ -164,48 +202,37 @@ void CDarkel::ResetOnPlayerDeath()
Status = KILLFRENZY_FAILED;
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
+ eWeaponType fixedWeapon;
if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
- WeaponType = WEAPONTYPE_UZI;
-
- if (WeaponType < WEAPONTYPE_TOTALWEAPONS) {
- FindPlayerPed()->m_nSelectedWepSlot = InterruptedWeapon;
- CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal = AmmoInterruptedWeapon;
- }
-
- if (FindPlayerVehicle()) {
- FindPlayerPed()->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nModelId);
- FindPlayerPed()->m_currentWeapon = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType;
- FindPlayerPed()->MakeChangesForNewWeapon(FindPlayerPed()->m_currentWeapon);
- }
-
-
- CPopulation::m_AllRandomPedsThisType = -1;
- Status = KILLFRENZY_FAILED;
- TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
-
- if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
- WeaponType = WEAPONTYPE_UZI;
+ fixedWeapon = WEAPONTYPE_UZI;
+ else
+ fixedWeapon = (eWeaponType)WeaponType;
- if (WeaponType < WEAPONTYPE_TOTALWEAPONS) {
- FindPlayerPed()->m_nSelectedWepSlot = InterruptedWeapon;
- CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal = AmmoInterruptedWeapon;
+ CPlayerPed *player = FindPlayerPed();
+ if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
+ player->m_nSelectedWepSlot = InterruptedWeapon;
+ player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal = CDarkel::AmmoInterruptedWeapon;
}
if (FindPlayerVehicle()) {
- FindPlayerPed()->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nModelId);
- FindPlayerPed()->m_currentWeapon = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType;
- FindPlayerPed()->MakeChangesForNewWeapon(FindPlayerPed()->m_currentWeapon);
+ player->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nModelId);
+ player->m_currentWeapon = player->m_nSelectedWepSlot;
+ player->MakeChangesForNewWeapon(player->m_currentWeapon);
}
}
#endif
#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); }
+WRAPPER void CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 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)
+void
+CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot)
{
+ eWeaponType fixedWeapon;
if (weaponType == WEAPONTYPE_UZI_DRIVEBY)
- weaponType = WEAPONTYPE_UZI;
+ fixedWeapon = WEAPONTYPE_UZI;
+ else
+ fixedWeapon = weaponType;
WeaponType = weaponType;
Status = KILLFRENZY_ONGOING;
@@ -219,8 +246,7 @@ void CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, int16 kill, int32
if (text == TheText.Get("PAGE_00")) {
CDarkel::bProperKillFrenzy = 1;
CDarkel::pStartMessage = 0;
- }
- else
+ } else
bProperKillFrenzy = 0;
bStandardSoundAndMessages = standardSound;
@@ -229,20 +255,19 @@ void CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, int16 kill, int32
TimeLimit = time;
PreviousTime = time / 1000;
- if (weaponType < WEAPONTYPE_TOTALWEAPONS) {
- InterruptedWeapon = FindPlayerPed()->m_currentWeapon;
- FindPlayerPed()->GiveWeapon(weaponType, 0);
- AmmoInterruptedWeapon = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
- FindPlayerPed()->GiveWeapon(weaponType, 30000);
- FindPlayerPed()->m_nSelectedWepSlot = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType;
- FindPlayerPed()->MakeChangesForNewWeapon(FindPlayerPed()->m_nSelectedWepSlot);
+ CPlayerPed *player = FindPlayerPed();
+ if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
+ InterruptedWeapon = player->m_currentWeapon;
+ player->GiveWeapon(fixedWeapon, 0);
+ AmmoInterruptedWeapon = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal;
+ player->GiveWeapon(fixedWeapon, 30000);
+ player->m_nSelectedWepSlot = player->GetWeaponSlot(fixedWeapon);
+ player->MakeChangesForNewWeapon(player->m_nSelectedWepSlot);
if (FindPlayerVehicle()) {
- FindPlayerPed()->m_currentWeapon = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType;
- if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal <= CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip)
- CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
-
- FindPlayerPed()->ClearWeaponTarget();
+ player->m_currentWeapon = player->m_nSelectedWepSlot;
+ player->GetWeapon()->m_nAmmoInClip = min(player->GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition);
+ player->ClearWeaponTarget();
}
}
if (CDarkel::bStandardSoundAndMessages)
@@ -250,13 +275,15 @@ void CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, int16 kill, int32
}
#endif
-void CDarkel::Update()
+void
+CDarkel::Update()
{
if (Status != KILLFRENZY_ONGOING)
return;
int32 FrameTime = TimeLimit - (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart);
if ((TimeLimit - (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart)) > 0 || TimeLimit < 0) {
+
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_ONGOING, FrameTime);
int32 PrevTime = FrameTime / 1000;
@@ -267,24 +294,27 @@ void CDarkel::Update()
PreviousTime = PrevTime;
}
- }
- else {
+ } else {
CPopulation::m_AllRandomPedsThisType = -1;
Status = KILLFRENZY_FAILED;
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
+ eWeaponType fixedWeapon;
if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
- WeaponType = WEAPONTYPE_UZI;
+ fixedWeapon = WEAPONTYPE_UZI;
+ else
+ fixedWeapon = (eWeaponType)WeaponType;
- if (WeaponType < WEAPONTYPE_TOTALWEAPONS) {
- FindPlayerPed()->m_nSelectedWepSlot = InterruptedWeapon;
- CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal = AmmoInterruptedWeapon;
+ CPlayerPed *player = FindPlayerPed();
+ if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
+ player->m_nSelectedWepSlot = InterruptedWeapon;
+ player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal = CDarkel::AmmoInterruptedWeapon;
}
if (FindPlayerVehicle()) {
- FindPlayerPed()->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nModelId);
- FindPlayerPed()->m_currentWeapon = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType;
- FindPlayerPed()->MakeChangesForNewWeapon(FindPlayerPed()->m_currentWeapon);
+ player->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nModelId);
+ player->m_currentWeapon = player->m_nSelectedWepSlot;
+ player->MakeChangesForNewWeapon(player->m_currentWeapon);
}
if (bStandardSoundAndMessages)
@@ -302,18 +332,22 @@ void CDarkel::Update()
FindPlayerPed()->m_pWanted->SetWantedLevel(0);
+ eWeaponType fixedWeapon;
if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
- WeaponType = WEAPONTYPE_UZI;
+ fixedWeapon = WEAPONTYPE_UZI;
+ else
+ fixedWeapon = (eWeaponType)WeaponType;
- if (WeaponType < WEAPONTYPE_TOTALWEAPONS) {
- FindPlayerPed()->m_nSelectedWepSlot = InterruptedWeapon;
- CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal = AmmoInterruptedWeapon;
+ CPlayerPed* player = FindPlayerPed();
+ if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
+ player->m_nSelectedWepSlot = InterruptedWeapon;
+ player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal = CDarkel::AmmoInterruptedWeapon;
}
if (FindPlayerVehicle()) {
- FindPlayerPed()->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nModelId);
- FindPlayerPed()->m_currentWeapon = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType;
- FindPlayerPed()->MakeChangesForNewWeapon(FindPlayerPed()->m_currentWeapon);
+ player->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nModelId);
+ player->m_currentWeapon = player->m_nSelectedWepSlot;
+ player->MakeChangesForNewWeapon(player->m_currentWeapon);
}
if (bStandardSoundAndMessages)
@@ -322,17 +356,17 @@ void CDarkel::Update()
}
STARTPATCHES
- /*InjectHook(0x421380, CDarkel::CalcFade, PATCH_JUMP);
- InjectHook(0x420920, CDarkel::DrawMessages, PATCH_JUMP);
- InjectHook(0x420E60, CDarkel::FrenzyOnGoing, PATCH_JUMP);
+ InjectHook(0x421380, CDarkel::CalcFade, PATCH_JUMP);
InjectHook(0x420650, CDarkel::Init, PATCH_JUMP);
- InjectHook(0x421370, CDarkel::QueryModelsKilledByPlayer, PATCH_JUMP);
+ InjectHook(0x420660, CDarkel::Update, PATCH_JUMP);
+ InjectHook(0x420E60, CDarkel::FrenzyOnGoing, 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);*/
+ InjectHook(0x421370, CDarkel::QueryModelsKilledByPlayer, PATCH_JUMP);
+ InjectHook(0x421060, CDarkel::RegisterKillNotByPlayer, PATCH_JUMP);
+ InjectHook(0x421310, CDarkel::ResetModelsKilledByPlayer, PATCH_JUMP);
+ InjectHook(0x420920, CDarkel::DrawMessages, PATCH_JUMP);
+ //InjectHook(0x421070, CDarkel::RegisterCarBlownUpByPlayer, PATCH_JUMP);
+ //InjectHook(0x420F60, CDarkel::RegisterKillByPlayer, PATCH_JUMP);
ENDPATCHES \ No newline at end of file
diff --git a/src/control/Darkel.h b/src/control/Darkel.h
index 77a14bb8..0171cd2c 100644
--- a/src/control/Darkel.h
+++ b/src/control/Darkel.h
@@ -26,7 +26,7 @@ private:
static int8 &bNeedHeadShot;
static int8 &bProperKillFrenzy;
static eKillFrenzyStatus &Status;
- static int16 *RegisteredKills;
+ static uint16 (&RegisteredKills)[NUMDEFAULTMODELS];
static int32 &ModelToKill;
static int32 &ModelToKill2;
static int32 &ModelToKill3;
@@ -34,18 +34,18 @@ private:
static wchar *pStartMessage;
public:
- static int32 CalcFade(uint32 time, int32 min, uint32 max);
+ static uint8 CalcFade(uint32 time, uint32 min, uint32 max);
static void DrawMessages(void);
static bool FrenzyOnGoing();
static void Init();
- static int16 QueryModelsKilledByPlayer(int32 modelId);
- static eKillFrenzyStatus ReadStatus();
+ static uint16 QueryModelsKilledByPlayer(int32 modelId);
+ static uint16 ReadStatus();
static void RegisterCarBlownUpByPlayer(CVehicle *vehicle);
static void RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot = false);
static void RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype);
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 StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot);
static void Update();
};