-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
p_players.h
122 lines (105 loc) · 3.5 KB
/
p_players.h
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/** @file p_players.h World player entities.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2014 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
*/
#ifndef DENG_WORLD_P_PLAYERS_H
#define DENG_WORLD_P_PLAYERS_H
#include "api_player.h"
#include <de/String>
#ifdef __CLIENT__
# include "clientplayer.h"
typedef ClientPlayer AppPlayer;
#else
# include "serverplayer.h"
typedef ServerPlayer AppPlayer;
#endif
/**
* Describes a player interaction impulse.
*
* @ingroup playsim
*/
struct PlayerImpulse
{
int id = 0;
impulsetype_t type = IT_ANALOG;
de::String name; ///< Symbolic. Used when resolving or generating textual binding descriptors.
de::String bindContextName; ///< Symbolic name of the associated binding context.
};
typedef Player player_t; // to aid legacy code
extern Player *viewPlayer;
extern int consolePlayer;
extern int displayPlayer;
AppPlayer *DD_Player(int number);
/**
* Determine which console is used by the given local player. Local players
* are numbered starting from zero.
*/
int P_LocalToConsole(int localPlayer);
/**
* Determine the local player number used by a particular console. Local
* players are numbered starting from zero.
*
* @param playerNum Console number.
*
* @return Local player number. Returns -1 if @a playerNum does not correspond
* to any local player.
*/
int P_ConsoleToLocal(int playerNum);
/**
* Given a ptr to ddplayer_t, return it's logical index.
*/
int P_GetDDPlayerIdx(ddplayer_t *ddpl);
/**
* Do we THINK the given (camera) player is currently in the void.
* The method used to test this is to compare the position of the mobj
* each time it is linked into a BSP leaf.
*
* @note Cannot be 100% accurate so best not to use it for anything critical...
*
* @param player The player to test.
*
* @return @c true if the player is thought to be in the void.
*/
bool P_IsInVoid(player_t *player);
short P_LookDirToShort(float lookDir);
float P_ShortToLookDir(short s);
/**
* Remove all the player impulse definitions and destroy the associated accumulators
* of all players.
*/
void P_ClearPlayerImpulses();
/**
* Lookup a player impulse defintion by it's unique @a id.
*
* @param id Unique identifier of the player impulse definition to lookup.
*
* @return The associated PlayerImpulse if found; otherwise @c nullptr.
*/
PlayerImpulse *P_PlayerImpulsePtr(int id);
/**
* Lookup a player impulse defintion by it's symbolic @a name.
*
* @param name Symbolic name of the player impulse definition to lookup.
*
* @return The associated PlayerImpulse if found; otherwise @c nullptr.
*/
PlayerImpulse *P_PlayerImpulseByName(de::String const &name);
/**
* Register the console commands and variables of this module.
*/
void P_ConsoleRegister();
#endif // DENG_WORLD_P_PLAYERS_H