-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactions.cpp
More file actions
58 lines (53 loc) · 1.41 KB
/
actions.cpp
File metadata and controls
58 lines (53 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "pch.h"
#include "actions.h"
//-------------------------------------------------------------//
void Actions::SetActions(const AddressesList& addresses)
{
movForward.action = addresses.w;
movBack.action = addresses.s;
movLeft.action = addresses.a;
movRight.action = addresses.d;
crouch.action = addresses.crouch;
att.action = addresses.att;
altAtt.action = addresses.altAttack;
jump.action = addresses.jump;
}
//-------------------------------------------------------------//
void Actions::WriteToMem(uintptr_t address, int value)
{
if (address)
*(int*)address = value;
}
//-------------------------------------------------------------//
bool Actions::Do(ActionFlag &action)
{
if (!action.action)
return false;
if (!action.actionFlag)
{
WriteToMem(action.action, 1);
action.actionFlag = true;
}
}
//-------------------------------------------------------------//
bool Actions::Stop(ActionFlag& action)
{
if (!action.action)
return false;
if (action.actionFlag)
{
WriteToMem(action.action, 0);
action.actionFlag = false;
}
}
//-------------------------------------------------------------//
bool Actions::AmIDoing(ActionFlag &action)
{
if (!action.action)
return false;
// return (*(bool*)action.action);
if (*(bool*)action.action)
return true;
else
return false;
}