|
| 1 | +/* |
| 2 | + Plugin-SDK (Grand Theft Auto San Andreas) source file |
| 3 | + Authors: GTA Community. See more here |
| 4 | + https://github.com/DK22Pac/plugin-sdk |
| 5 | + Do not delete this comment block. Respect others' work! |
| 6 | +*/ |
| 7 | +#include "CDecisionMakerTypes.h" |
| 8 | + |
| 9 | +CDecisionMakerTypes* CDecisionMakerTypes::GetInstance() { |
| 10 | + return plugin::CallAndReturn<CDecisionMakerTypes*, 0x4684F0>(); |
| 11 | +} |
| 12 | + |
| 13 | +eDecisionMakerType CDecisionMakerTypes::AddDecisionMaker(CDecisionMaker* templateDm, eDecisionMakerType dm, bool bDecisionMakerForMission) { |
| 14 | + return plugin::CallMethodAndReturn<eDecisionMakerType, 0x607050, CDecisionMakerTypes*, CDecisionMaker*, eDecisionMakerType, bool>(this, templateDm, dm, bDecisionMakerForMission); |
| 15 | +} |
| 16 | + |
| 17 | +void CDecisionMakerTypes::RemoveDecisionMaker(eDecisionMakerType dm) { |
| 18 | + return plugin::Call<0x6043A0>(dm); |
| 19 | +} |
| 20 | + |
| 21 | +void CDecisionMakerTypes::AddEventResponse(eDecisionMakerType dm, eEventType eventType, eTaskType taskId, DecisionChances chances, DecisionContext context) { |
| 22 | + float chancesF[4]; // internally converted back to byte |
| 23 | + chancesF[0] = chances.toNeutral; |
| 24 | + chancesF[1] = chances.toPlayer; |
| 25 | + chancesF[2] = chances.toFriend; |
| 26 | + chancesF[3] = chances.toEnemy; |
| 27 | + |
| 28 | + plugin::CallMethod<0x6044C0, CDecisionMakerTypes*, eDecisionMakerType, eEventType, eTaskType, float*, DecisionContext&>(this, dm, eventType, taskId, chancesF, context); |
| 29 | +} |
| 30 | + |
| 31 | +void CDecisionMakerTypes::FlushDecisionMakerEventResponse(eDecisionMakerType dm, eEventType eventId) { |
| 32 | + plugin::CallMethod<0x604490>(this, dm, eventId); |
| 33 | +} |
| 34 | + |
| 35 | +eTaskType CDecisionMakerTypes::MakeDecision(CPedGroup* pedGroup, eEventType eventType, int eventSourceType, bool bIsPedInVehicle, eTaskType taskId1, eTaskType taskId2, eTaskType taskId3, eTaskType taskId4) { |
| 36 | + return plugin::CallMethodAndReturn<eTaskType, 0x606F80, CDecisionMakerTypes*, CPedGroup*, int, int, bool, int, int, int, int>( |
| 37 | + this, pedGroup, eventType, eventSourceType, bIsPedInVehicle, taskId1, taskId2, taskId3, taskId4); |
| 38 | +} |
| 39 | + |
| 40 | +void CDecisionMakerTypes::MakeDecision(CPed* ped, eEventType eventType, int eventSourceType, bool bIsPedInVehicle, eTaskType taskTypeToAvoid1, eTaskType taskTypeToAvoid2, eTaskType taskTypeToAvoid3, eTaskType taskTypeToSeek, bool bUseInGroupDecisionMaker, short& taskType, short& facialTaskType) { |
| 41 | + plugin::CallMethod<0x606E70>(this, ped, eventType, eventSourceType, bIsPedInVehicle, taskTypeToAvoid1, taskTypeToAvoid2, taskTypeToAvoid3, taskTypeToSeek, bUseInGroupDecisionMaker, &taskType, &facialTaskType); |
| 42 | +} |
| 43 | + |
| 44 | +void CDecisionMakerTypes::LoadEventIndices() { |
| 45 | + plugin::CallMethod<0x600840>(this); |
| 46 | +} |
0 commit comments