Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
net.qh File Reference
#include "sv_mapvoting.qh"
#include "cl_mapvoting.qh"
Include dependency graph for net.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void MapVote_ReadPlayerVote (entity voter)
void MapVote_Spawn ()
void MapVote_TouchMask ()
void MapVote_Winner (int mappos)
void MapVote_WritePicture (entity to, int id)
void MapVote_WritePlayerVote (int index)

Variables

const int SF_MV_ABSTAIN = BIT(4)
 mv_abstain is true if this is set
const int SF_MV_DETAIL_COUNTS = BIT(5)
 mv_detail 1
const int SF_MV_DETAIL_WINNER = BIT(6)
 mv_detail 2
const int SF_MV_GTV_DONE = 2
const int SF_MV_GTV_MAPS = 0
const int SF_MV_GTV_NOW = 1
const int SF_MV_INIT = BIT(0)
const int SF_MV_MASK = BIT(1)
const int SF_MV_VOTES = BIT(2)
const int SF_MV_WINNER = BIT(3)

Function Documentation

◆ MapVote_ReadPlayerVote()

void MapVote_ReadPlayerVote ( entity voter)

Definition at line 27 of file net.qc.

28{
29 // clear possibly invalid vote
30 if (!(mv_flags[voter.mapvote - 1] & GTV_AVAILABLE))
31 voter.mapvote = 0;
32 // use impulse as new vote
33 if (CS(voter).impulse >= 1 && CS(voter).impulse <= mv_count // valid impulse
34 && (mv_flags[CS(voter).impulse - 1] & GTV_AVAILABLE) // map/gametype is available
35 && !ClientCommand_antispam(voter, strcat("impulse ", itos(CS(voter).impulse)), spamtime, 0.5, 2)) // not spamming
36 {
37 voter.mapvote = CS(voter).impulse;
38 mapvote_ent.SendFlags |= SF_MV_VOTES;
39 }
40 CS(voter).impulse = 0;
41}
bool ClientCommand_antispam(entity this, string command,.float antispam_fld, float antispam_time, int antispam_count)
Returns true if antispam should prevent the command.
Definition cmd.qc:1165
const int SF_MV_VOTES
Definition net.qh:8
#define itos(i)
Definition int.qh:6
float spamtime
Definition net.qc:26
entity mapvote_ent
Definition net.qc:7
int mv_count
(shared) number of maps/gametypes
Definition mapvoting.qh:14
int mv_flags[MAPVOTE_COUNT]
(shared) map/gametype flags
Definition mapvoting.qh:18
const int GTV_AVAILABLE
Can be voted.
Definition mapvoting.qh:28
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
float impulse
Definition progsdefs.qc:158
ClientState CS(Client this)
Definition state.qh:47

References ClientCommand_antispam(), CS(), entity(), GTV_AVAILABLE, impulse, itos, mapvote_ent, mv_count, mv_flags, SF_MV_VOTES, spamtime, and strcat().

Referenced by MapVote_Tick().

◆ MapVote_Spawn()

void MapVote_Spawn ( )

Definition at line 8 of file net.qc.

9{
11}
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:167
bool MapVote_SendEntity(entity this, entity to, int sf)
Definition net.qc:250

References mapvote_ent, MapVote_SendEntity(), and Net_LinkEntity().

Referenced by GameTypeVote_Start(), and MapVote_Init().

◆ MapVote_TouchMask()

void MapVote_TouchMask ( )

Definition at line 13 of file net.qc.

14{
15 mapvote_ent.SendFlags |= SF_MV_MASK;
16}
const int SF_MV_MASK
Definition net.qh:7

References mapvote_ent, and SF_MV_MASK.

Referenced by MapVote_CheckRules_decide().

◆ MapVote_Winner()

void MapVote_Winner ( int mappos)

Definition at line 17 of file net.qc.

18{
19 mapvote_ent.SendFlags |= SF_MV_WINNER;
21 mv_winner = mappos;
22}
float mv_winner_time
const int SF_MV_WINNER
Definition net.qh:9
float time
int mv_winner
Definition mapvoting.qh:24

References mapvote_ent, mv_winner, mv_winner_time, SF_MV_WINNER, and time.

Referenced by MapVote_Finished().

◆ MapVote_WritePicture()

void MapVote_WritePicture ( entity to,
int id )

Definition at line 342 of file net.qc.

343{
344 msg_entity = to;
345 WriteHeader(MSG_ONE, TE_CSQC_PICTURE);
346 WriteByte(MSG_ONE, id);
347 WritePicture(MSG_ONE, strcat(mv_ssdirs[mv_ssdir_i[id]], "/", mv_entries[id]), 3072);
348}
WriteByte(chan, ent.angles.y/DEC_FACTOR)
#define WriteHeader(to, id)
Definition net.qh:265
string mv_entries[MAPVOTE_COUNT]
(shared) map name or gametype name
Definition mapvoting.qh:16
string mv_ssdirs[MAPVOTE_SSDIRS_COUNT]
Definition mapvoting.qh:9
float MSG_ONE
Definition menudefs.qc:56
entity msg_entity
Definition progsdefs.qc:63
int mv_ssdir_i[MAPVOTE_COUNT]
(shared) where to look for screenshots (mv_ssdirs index), set to 0 for gametype voting

References entity(), msg_entity, MSG_ONE, mv_entries, mv_ssdir_i, mv_ssdirs, strcat(), WriteByte(), and WriteHeader.

Referenced by ClientCommand_mv_getpicture().

◆ MapVote_WritePlayerVote()

void MapVote_WritePlayerVote ( int index)

Definition at line 43 of file net.qc.

44{
45 TC(int, index);
46 localcmd("\nimpulse ", itos(index + 1), "\n");
47}
#define TC(T, sym)
Definition _all.inc:82
void localcmd(string command,...)

References itos, localcmd(), and TC.

Referenced by MapVote_InputEvent().

Variable Documentation

◆ SF_MV_ABSTAIN

const int SF_MV_ABSTAIN = BIT(4)

mv_abstain is true if this is set

Definition at line 11 of file net.qh.

Referenced by MapVote_Init_Client(), and MapVote_SendEntity().

◆ SF_MV_DETAIL_COUNTS

const int SF_MV_DETAIL_COUNTS = BIT(5)

mv_detail 1

Definition at line 12 of file net.qh.

Referenced by MapVote_Init_Client(), and MapVote_SendEntity().

◆ SF_MV_DETAIL_WINNER

const int SF_MV_DETAIL_WINNER = BIT(6)

mv_detail 2

Definition at line 13 of file net.qh.

Referenced by MapVote_Init_Client(), and MapVote_SendEntity().

◆ SF_MV_GTV_DONE

const int SF_MV_GTV_DONE = 2

Definition at line 17 of file net.qh.

Referenced by MapVote_Init_Server().

◆ SF_MV_GTV_MAPS

const int SF_MV_GTV_MAPS = 0

Definition at line 15 of file net.qh.

Referenced by MapVote_Init_Client(), and MapVote_Init_Server().

◆ SF_MV_GTV_NOW

const int SF_MV_GTV_NOW = 1

Definition at line 16 of file net.qh.

Referenced by MapVote_Init_Client(), and MapVote_Init_Server().

◆ SF_MV_INIT

const int SF_MV_INIT = BIT(0)

Definition at line 6 of file net.qh.

Referenced by MapVote_SendEntity(), and NET_HANDLE().

◆ SF_MV_MASK

const int SF_MV_MASK = BIT(1)

Definition at line 7 of file net.qh.

Referenced by MapVote_SendEntity(), MapVote_TouchMask(), and NET_HANDLE().

◆ SF_MV_VOTES

const int SF_MV_VOTES = BIT(2)

Definition at line 8 of file net.qh.

Referenced by MapVote_ReadPlayerVote(), MapVote_SendEntity(), and NET_HANDLE().

◆ SF_MV_WINNER

const int SF_MV_WINNER = BIT(3)

Definition at line 9 of file net.qh.

Referenced by MapVote_SendEntity(), MapVote_Winner(), and NET_HANDLE().