34 #include "../shared/parse.h"
47 Com_sprintf(smallBuf,
sizeof(smallBuf),
"(%i) Team %i %s status: %s\n", p->getNum(),
48 p->getTeam(), p->pers.netname, (p->roundDone ?
"waiting" :
"playing"));
51 if (strlen(smallBuf) + strlen(largeBuf) >
sizeof(largeBuf) - 100) {
52 Q_strcat(largeBuf,
sizeof(largeBuf),
"...\n");
55 Q_strcat(largeBuf,
sizeof(largeBuf),
"%s", smallBuf);
68 if (
level.
time < player.pers.flood_locktill) {
74 i = (
sizeof(player.pers.flood_when)/
sizeof(player.pers.flood_when[0])) + i;
80 player.pers.flood_whenhead = (player.pers.flood_whenhead + 1) %
81 (
sizeof(player.pers.flood_when)/
sizeof(player.pers.flood_when[0]));
82 player.pers.flood_when[player.pers.flood_whenhead] =
level.
time;
87 static void G_Say_f (Player& player,
bool arg0,
bool team)
89 if (
gi.Cmd_Argc() < 2 && !arg0)
104 if (s[0] ==
'"' && s[strlen(s) - 1] ==
'"') {
105 s[strlen(s) - 1] =
'\0';
111 gi.DPrintf(
"%s: %s\n", player.pers.netname, s);
113 gi.DPrintf(
"^B%s (team): %s\n", player.pers.netname, s);
118 if (team && p->getTeam() != player.getTeam())
133 static void G_KillTeam_f (
void)
140 if (
gi.Cmd_Argc() >= 2) {
142 if (
gi.Cmd_Argc() >= 3)
148 if (teamToKill >= 0) {
149 Actor* actor =
nullptr;
172 static void G_StunTeam_f (
void)
178 if (
gi.Cmd_Argc() >= 2)
181 if (teamToKill >= 0) {
182 Actor* actor =
nullptr;
202 static void G_ListMissionScore_f (
void)
207 if (
gi.Cmd_Argc() >= 2) {
214 Actor* actor =
nullptr;
216 if (team >= 0 && actor->
getTeam() != team)
221 gi.DPrintf(
"Soldier: %s\n", actor->
chr.
name);
226 gi.DPrintf(
" Kills:");
232 gi.DPrintf(
" Stuns:");
239 gi.DPrintf(
" Fired:");
245 gi.DPrintf(
" Hits:\n");
247 gi.DPrintf(
" Skill%i: ",
i);
255 gi.DPrintf(
" Fired Splash:");
261 gi.DPrintf(
" Hits Splash:\n");
263 gi.DPrintf(
" Skill%i: ",
i);
270 gi.DPrintf(
" Splash Damage:\n");
272 gi.DPrintf(
" Skill%i: ",
i);
280 gi.DPrintf(
" Kills per skill:");
294 void G_InvList_f (
const Player& player)
296 gi.DPrintf(
"Print inventory for '%s'\n", player.pers.netname);
298 Actor* actor =
nullptr;
300 gi.DPrintf(
"actor: '%s'\n", actor->
chr.
name);
305 Item* item =
nullptr;
307 Com_Printf(
".. item.def(): %i, item.ammo: %i, item.ammoLeft: %i, x: %i, y: %i\n",
321 const int tuPenalty = tus - normalTU;
323 Com_Printf(
"Weight: %g/%i, Encumbrance: %s (%.0f%%), TU's: %i (normal: %i, penalty/bonus: %+i)\n", invWeight, maxWeight, penaltyStr, invWeight / maxWeight * 100.0
f, tus, normalTU, tuPenalty);
327 static void G_TouchEdict_f (
void)
329 if (
gi.Cmd_Argc() < 2) {
340 gi.DPrintf(
"No touch function for entity %s\n", e->
classname);
348 gi.DPrintf(
"Call touch function for %s\n", e->
classname);
352 static void G_UseEdict_f (
void)
354 if (
gi.Cmd_Argc() < 2) {
361 gi.DPrintf(
"No entity with number %i\n", i);
367 gi.DPrintf(
"No use function for entity %s\n", e->
classname);
371 gi.DPrintf(
"Call use function for %s\n", e->
classname);
375 static void G_DestroyEdict_f (
void)
377 if (
gi.Cmd_Argc() < 2) {
388 gi.DPrintf(
"No destroy function for entity %s\n", e->
classname);
392 gi.DPrintf(
"Call destroy function for %s\n", e->
classname);
396 static void G_StateChange_f (
void)
398 if (
gi.Cmd_Argc() < 3) {
399 gi.DPrintf(
"Usage: %s <entnum> <state>\n States are: panic, rage, shaken",
gi.
Cmd_Argv(0));
425 if (!player.isInUse())
444 G_ListMissionScore_f();
void G_ClientPrintf(const Player &player, int printLevel, const char *fmt,...)
#define WEIGHT_NORMAL_PENALTY
Player * G_PlayerGetNextActiveHuman(Player *lastPlayer)
Iterate through the list of players.
Actor * G_EdictsGetNextLivingActor(Actor *lastEnt)
Iterate through the living actor entities.
unsigned num_stuns[MAX_TEAMS+1][MAX_TEAMS]
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
int hitsSplash[SKILL_NUM_TYPES][KILLED_NUM_TYPES]
bool(* use)(Edict *self, Edict *activator)
const objDef_t * def(void) const
void G_ClientCommand(Player &player)
void Com_Printf(const char *const fmt,...)
bool callTouch(Edict *activator)
static void G_Say_f(Player &player, bool arg0, bool team)
chrScoreMission_t * scoreMission
void G_MoraleBehaviour(int team)
Applies morale behaviour on actors.
int hits[SKILL_NUM_TYPES][KILLED_NUM_TYPES]
unsigned num_kills[MAX_TEAMS+1][MAX_TEAMS]
item instance data, with linked list capability
int hitsSplashDamage[SKILL_NUM_TYPES][KILLED_NUM_TYPES]
int kills[KILLED_NUM_TYPES]
int firedSplash[SKILL_NUM_TYPES]
int getWeight() const
Get the weight of the items in the given inventory (excluding those in temp containers).
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
#define Q_strcasecmp(a, b)
Item * getNextItem(const Item *prev) const
#define WEIGHT_HEAVY_PENALTY
#define GET_ENCUMBRANCE_PENALTY(weight, max)
int skillKills[SKILL_NUM_TYPES]
bool G_EdictsIsValidNum(const int num)
Check if the given number could point to an existing entity.
Actor * G_EdictsGetNextLivingActorOfTeam(Actor *lastEnt, const int team)
Iterate through the living actor entities of the given team.
const Container * getNextCont(const Container *prev, bool inclTemp=false) const
Local definitions for game module.
functions to handle the storage and lifecycle of all edicts in the game module.
void Q_strcat(char *dest, size_t destsize, const char *format,...)
Safely (without overflowing the destination buffer) concatenates two strings.
static void G_Players_f(const Player &player)
bool(* destroy)(Edict *self)
const objDef_t * ammoDef(void) const
const char *IMPORT * Cmd_Args(void)
bool G_ActorDieOrStun(Actor *actor, Edict *attacker)
Reports and handles death or stun of an actor. If the HP of an actor is zero the actor will die...
static bool G_CheckFlood(Player &player)
Check whether the user can talk.
void G_MatchEndCheck(void)
Checks whether there are still actors to fight with left. If none are the match end will be triggered...
Edict * G_EdictsGetByNum(const int num)
Get an entity by it's number.
int fired[SKILL_NUM_TYPES]
int stuns[KILLED_NUM_TYPES]
int skills[SKILL_NUM_TYPES]
const char *IMPORT * Cmd_Argv(int n)
Interface for g_client.cpp.