-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathlocalplayer.cpp
69 lines (65 loc) · 1.4 KB
/
localplayer.cpp
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
59
60
61
62
63
64
65
66
67
68
69
#include "localplayer.h"
#include "spritemanager.h"
namespace OpenGTA {
Pedestrian & PlayerController::getPed() {
return SpriteManagerHolder::Instance().getPed(playerId);
}
bool PlayerController::up(const uint32_t & key) {
if (!pc_ptr)
return false;
bool handled = false;
switch (key) {
case SDLK_LEFT:
pc_ptr->releaseTurnLeft();
handled = true;
break;
case SDLK_RIGHT:
pc_ptr->releaseTurnRight();
handled = true;
break;
case SDLK_UP:
pc_ptr->releaseMoveForward();
handled = true;
break;
case SDLK_DOWN:
pc_ptr->releaseMoveBack();
handled = true;
break;
case SDLK_LCTRL:
pc_ptr->releaseFireWeapon();
handled = true;
break;
default:
break;
}
return handled;
}
bool PlayerController::down(const uint32_t & key) {
if (!pc_ptr)
return false;
bool handled = false;
switch(key) {
case SDLK_LEFT:
handled = true;
break;
case SDLK_RIGHT:
handled = true;
break;
case SDLK_UP:
handled = true;
break;
case SDLK_DOWN:
handled = true;
break;
case SDLK_LCTRL:
handled = true;
break;
case SDLK_LSHIFT:
handled = true;
break;
default:
break;
}
return handled;
}
}