Skip to content

Commit 9d8e820

Browse files
committed
CDecision updates
1 parent 4df15a5 commit 9d8e820

File tree

2 files changed

+42
-19
lines changed

2 files changed

+42
-19
lines changed

plugin_sa/game_sa/CDecision.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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 "CDecision.h"
8+
9+
CDecision::CDecision() {
10+
plugin::CallMethod<0x6040C0, CDecision*>(this);
11+
}

plugin_sa/game_sa/CDecision.h

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,44 @@
66
*/
77
#pragma once
88
#include "PluginBase.h"
9+
#include "eTaskType.h"
910

10-
/*
11-
https://www.gtamodding.com/wiki/Decision_Maker
12-
*/
11+
struct DecisionContext
12+
{
13+
bool onFoot = false;
14+
bool inVehicle = false;
1315

14-
enum eDecisionTypes {
15-
DECISION_ON_FOOT = 0,
16-
DECISION_IN_VEHICLE = 1
16+
DecisionContext() = default;
17+
DecisionContext(bool onFoot, bool inVehicle) :
18+
onFoot(onFoot), inVehicle(inVehicle)
19+
{}
1720
};
21+
VALIDATE_SIZE(DecisionContext, 0x2);
22+
23+
struct DecisionChances
24+
{
25+
// weights that sums up to total value of all responses applicable to current event,
26+
// then chance is weight/total
27+
unsigned char toNeutral = 0;
28+
unsigned char toPlayer = 0;
29+
unsigned char toFriend = 0;
30+
unsigned char toEnemy = 0;
1831

19-
enum eDecisionRelationship {
20-
DECISION_RELATIONSHIP_NEUTRAL = 0,
21-
DECISION_RELATIONSHIP_PLAYER = 1,
22-
DECISION_RELATIONSHIP_FRIEND = 2,
23-
DECISION_RELATIONSHIP_THREAT = 3
32+
DecisionChances() = default;
33+
DecisionChances(unsigned char toNeutral, unsigned char toPlayer, unsigned char toFriend, unsigned char toEnemy) :
34+
toNeutral(toNeutral), toPlayer(toPlayer), toFriend(toFriend), toEnemy(toEnemy)
35+
{}
2436
};
37+
VALIDATE_SIZE(DecisionChances, 0x4);
2538

2639
class PLUGIN_API CDecision {
2740
public:
28-
int m_anTaskTypes[6]; // see eTaskType
29-
unsigned char m_anResponseChances[6][4]; // 4 different relationships : see eDecisionRelationship
30-
unsigned char m_anTypeFlags[2][6]; // 2 different types : see eDecisionTypes
41+
constexpr static auto RESPONSE_COUNT = 6; // max count of unique responses
3142

32-
inline CDecision() { // @0x6040C0
33-
//SetDefault();
34-
}
35-
};
43+
eTaskType task[RESPONSE_COUNT]; // response's task
44+
DecisionChances chances[RESPONSE_COUNT]; // response's chances for each relationship type
45+
DecisionContext context[RESPONSE_COUNT]; // situations the response applies to
3646

37-
VALIDATE_SIZE(CDecision, 0x3C);
47+
CDecision();
48+
};
49+
VALIDATE_SIZE(CDecision, 0x3C);

0 commit comments

Comments
 (0)