-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include "StdInc.h" | ||
#include "TaskSimpleDoHandSignal.h" | ||
#include "TaskComplexPlayHandSignalAnim.h" | ||
|
||
void CTaskSimpleDoHandSignal::InjectHooks() { | ||
RH_ScopedVirtualClass(CTaskSimpleDoHandSignal, 0x86fa68, 9); | ||
RH_ScopedCategory("Tasks/TaskTypes"); | ||
|
||
RH_ScopedInstall(Constructor, 0x660880); | ||
RH_ScopedInstall(Destructor, 0x6608B0); | ||
|
||
RH_ScopedVMTInstall(Clone, 0x6608C0); | ||
RH_ScopedVMTInstall(GetTaskType, 0x6608A0); | ||
RH_ScopedVMTInstall(MakeAbortable, 0x660930); | ||
RH_ScopedVMTInstall(ProcessPed, 0x660940); | ||
} | ||
|
||
CTaskSimpleDoHandSignal::CTaskSimpleDoHandSignal(const CTaskSimpleDoHandSignal& o) : | ||
m_Initialized{ o.m_Initialized } | ||
{ | ||
} | ||
|
||
// 0x660940 | ||
bool CTaskSimpleDoHandSignal::ProcessPed(CPed* ped) { | ||
if (!ped->GetIsOnScreen()) { | ||
return true; | ||
} | ||
|
||
const auto animTask = ped->GetTaskManager().GetTaskSecondary(TASK_SECONDARY_PARTIAL_ANIM); | ||
|
||
if (m_Initialized) { | ||
return !animTask || !CTask::IsA<TASK_COMPLEX_HANDSIGNAL_ANIM>(animTask); | ||
} | ||
|
||
if (animTask) { | ||
if (CTask::IsA<TASK_COMPLEX_HANDSIGNAL_ANIM>(animTask)) { | ||
return true; | ||
} | ||
animTask->MakeAbortable(ped, ABORT_PRIORITY_URGENT, nullptr); | ||
return false; | ||
} | ||
|
||
ped->GetTaskManager().SetTaskSecondary( | ||
new CTaskComplexPlayHandSignalAnim{}, | ||
TASK_SECONDARY_PARTIAL_ANIM | ||
); | ||
m_Initialized = true; | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
|
||
#include "TaskSimple.h" | ||
|
||
class CTaskSimpleDoHandSignal; | ||
class CPed; | ||
class CEvent; | ||
|
||
class NOTSA_EXPORT_VTABLE CTaskSimpleDoHandSignal : public CTaskSimple { | ||
public: | ||
static void InjectHooks(); | ||
|
||
static constexpr auto Type = eTaskType::TASK_SIMPLE_DO_HAND_SIGNAL; | ||
|
||
CTaskSimpleDoHandSignal() = default; | ||
CTaskSimpleDoHandSignal(const CTaskSimpleDoHandSignal&); | ||
~CTaskSimpleDoHandSignal() = default; | ||
|
||
CTask* Clone() const override { return new CTaskSimpleDoHandSignal{*this}; } | ||
eTaskType GetTaskType() const override { return Type; } | ||
bool MakeAbortable(CPed* ped, eAbortPriority priority, CEvent const* event) override { return true; } | ||
bool ProcessPed(CPed* ped) override; | ||
|
||
private: // Wrappers for hooks | ||
// 0x660880 | ||
CTaskSimpleDoHandSignal* Constructor() { | ||
this->CTaskSimpleDoHandSignal::CTaskSimpleDoHandSignal(); | ||
return this; | ||
} | ||
// 0x6608B0 | ||
CTaskSimpleDoHandSignal* Destructor() { | ||
this->CTaskSimpleDoHandSignal::~CTaskSimpleDoHandSignal(); | ||
return this; | ||
} | ||
|
||
protected: | ||
bool m_Initialized{}; | ||
}; |