Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
quake3.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Q3COMPAT_ARENA   BIT(0)
#define Q3COMPAT_DEFI   BIT(1)
#define SPAWNFUNC_Q3(weapon_classname, ammo_classname, xonwep, ...)
#define SPAWNFUNC_Q3AMMO(classname, xonwep, ...)
#define SPAWNFUNC_Q3WEAPON(classname, xonwep, ...)

Functions

bool DoesQ3ARemoveThisEntity (entity this)

Variables

bool autocvar_sv_q3compat_changehitbox
int fragsfilter_cnt
int q3compat = 0

Macro Definition Documentation

◆ Q3COMPAT_ARENA

#define Q3COMPAT_ARENA   BIT(0)

Definition at line 4 of file quake3.qh.

Referenced by spawnfunc(), and SPAWNFUNC_Q3().

◆ Q3COMPAT_DEFI

#define Q3COMPAT_DEFI   BIT(1)

Definition at line 5 of file quake3.qh.

Referenced by spawnfunc().

◆ SPAWNFUNC_Q3

#define SPAWNFUNC_Q3 ( weapon_classname,
ammo_classname,
xonwep,
... )
Value:
SPAWNFUNC_Q3WEAPON(weapon_classname, xonwep, __VA_ARGS__) \
SPAWNFUNC_Q3AMMO(ammo_classname, xonwep, __VA_ARGS__)
#define SPAWNFUNC_Q3WEAPON(classname, xonwep,...)
Definition quake3.qh:28

Definition at line 36 of file quake3.qh.

36#define SPAWNFUNC_Q3(weapon_classname, ammo_classname, xonwep, ...) \
37 SPAWNFUNC_Q3WEAPON(weapon_classname, xonwep, __VA_ARGS__) \
38 SPAWNFUNC_Q3AMMO(ammo_classname, xonwep, __VA_ARGS__)

◆ SPAWNFUNC_Q3AMMO

#define SPAWNFUNC_Q3AMMO ( classname,
xonwep,
... )
Value:
{ \
__VA_OPT__(this.count *= (__VA_ARGS__);) \
if(this.count && (xonwep).ammo_type != RES_NONE) \
SetResource(this, (xonwep).ammo_type, rint(this.count * GetAmmoConsumption(xonwep))); \
SPAWNFUNC_BODY(GetAmmoItem((xonwep).ammo_type)) \
}
float count
Definition powerups.qc:22
string classname
float rint(float f)
#define spawnfunc(id)
Definition spawnfunc.qh:96
int GetAmmoConsumption(entity wpn)
Returns ammo consumed per shot by the primary/default fire mode.
entity GetAmmoItem(Resource ammotype)
Definition all.qc:189

Definition at line 18 of file quake3.qh.

18#define SPAWNFUNC_Q3AMMO(classname, xonwep, ...) \
19 spawnfunc(classname) \
20 { \
21 __VA_OPT__(this.count *= (__VA_ARGS__);) \
22 if(this.count && (xonwep).ammo_type != RES_NONE) \
23 SetResource(this, (xonwep).ammo_type, rint(this.count * GetAmmoConsumption(xonwep))); \
24 SPAWNFUNC_BODY(GetAmmoItem((xonwep).ammo_type)) \
25 }

◆ SPAWNFUNC_Q3WEAPON

#define SPAWNFUNC_Q3WEAPON ( classname,
xonwep,
... )
Value:
{ \
__VA_OPT__(this.count *= (__VA_ARGS__);) \
weapon_defaultspawnfunc(this, xonwep); \
}
void weapon_defaultspawnfunc(entity this, Weapon e)
Definition spawning.qc:30

Definition at line 28 of file quake3.qh.

28#define SPAWNFUNC_Q3WEAPON(classname, xonwep, ...) \
29 spawnfunc(classname) \
30 { \
31 __VA_OPT__(this.count *= (__VA_ARGS__);) \
32 weapon_defaultspawnfunc(this, xonwep); \
33 }

Function Documentation

◆ DoesQ3ARemoveThisEntity()

bool DoesQ3ARemoveThisEntity ( entity this)

Definition at line 299 of file quake3.qc.

300{
301 // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
302
303 if (!this.classname)
304 return true;
305
306 // DeFRaG mappers use "notcpm" or "notvq3" to disable an entity in CPM or VQ3 physics
307 // Xonotic is usually played with a CPM-based physics so we default to CPM mode
308 if(cvar_string("g_mod_physics") == "Q3")
309 {
310 if(stof(GetField_fullspawndata(this, "notvq3", false)))
311 return true;
312 }
313 else if(stof(GetField_fullspawndata(this, "notcpm", false)))
314 return true;
315
316 // Q3 mappers use "notq3a" or "notta" to disable an entity in Q3A or Q3TA
317 // Xonotic has ~equivalent features to Team Arena
318 if(stof(GetField_fullspawndata(this, "notta", false)))
319 return true;
320
321 // FIXME: singleplayer does not use maxclients 1 as that would prevent bots,
322 // this is the case in Q3 also, it uses another method to block clients.
323 // Only accessible in VQ3, via the `spmap` command.
324 if(stof(GetField_fullspawndata(this, "notsingle", false)))
325 if(maxclients == 1 && IS_GAMETYPE(DEATHMATCH))
326 return true;
327
328 if(stof(GetField_fullspawndata(this, "notteam", false)))
329 if(teamplay)
330 return true;
331
332 if(stof(GetField_fullspawndata(this, "notfree", false)))
333 if(!teamplay)
334 return true;
335
336 if(this.gametype || this.not_gametype)
337 {
338 // Q3 checks these with strstr(): case-sensitive, no gametype can be a substring of another,
339 // any separator is allowed (conventions are: spaces, commas, or commas with spaces).
340 // QL's entities.def says they're space delineated.
341
342 // Q3 gametype entity fields: ffa tournament single team ctf oneflag obelisk harvester (game/g_spawn.c)
343 // Q3 arena file 'type' key: ffa tourney ctf oneflag overload harvester (ui/ui_gameinfo.c)
344
345 // QL gametype entity fields: ffa duel tdm ca ft rr ctf ad dom har 1f race ob
346 // QL arena file 'type' key: ffa duel tdm ca ft rr ctf ad dom har oneflag race
347
348 string gametypename_q3, gametypename_ql;
349
350 // One of these will apply if our gametype has no Q3/QL equivalent
351 if(teamplay)
352 {
353 gametypename_q3 = "team";
354 gametypename_ql = "tdm";
355 }
356 else
357 gametypename_q3 = gametypename_ql = "ffa";
358
359 if(g_ctf)
360 {
361 if (cvar("g_ctf_oneflag"))
362 {
363 gametypename_q3 = "oneflag";
364 gametypename_ql = "1f";
365 }
366 else
367 gametypename_q3 = gametypename_ql = "ctf";
368 }
369 else if(g_duel)
370 {
371 gametypename_q3 = "tournament";
372 gametypename_ql = "duel";
373 }
374 else if(IS_GAMETYPE(DEATHMATCH) && maxclients == 1)
375 gametypename_q3 = "single";
376 else if(g_ca)
377 gametypename_ql = "ql";
378 else if(IS_GAMETYPE(FREEZETAG))
379 gametypename_ql = "ft";
380 else if(IS_GAMETYPE(DOMINATION))
381 gametypename_ql = "dom";
382 else if(g_race || g_cts)
383 gametypename_ql = "race";
384
385 if(this.gametype)
386 if(strstrofs(this.gametype, gametypename_q3, 0) < 0
387 && strstrofs(this.gametype, gametypename_ql, 0) < 0)
388 return true;
389
390 // Only supported by QL
391 if(strstrofs(this.not_gametype, gametypename_ql, 0) >= 0)
392 return true;
393 }
394
395 return false;
396}
#define g_ca
Definition clanarena.qh:51
entity gametype
Definition main.qh:43
#define g_race
Definition race.qh:48
float maxclients
#define g_ctf
Definition ctf.qh:39
#define g_cts
Definition cts.qh:36
#define strstrofs
#define g_duel
Definition duel.qh:32
float stof(string val,...)
float cvar(string name)
const string cvar_string(string name)
string not_gametype
Definition quake3.qc:298
string GetField_fullspawndata(entity e, string fieldname, bool vfspath)
Retrieves the value of a map entity field from fullspawndata.
Definition main.qc:451
bool teamplay
Definition teams.qh:59

References classname, cvar(), cvar_string(), entity(), g_ca, g_ctf, g_cts, g_duel, g_race, gametype, GetField_fullspawndata(), maxclients, not_gametype, stof(), strstrofs, and teamplay.

Referenced by SV_OnEntityPreSpawnFunction().

Variable Documentation

◆ autocvar_sv_q3compat_changehitbox

bool autocvar_sv_q3compat_changehitbox

Definition at line 7 of file quake3.qh.

Referenced by _GlobalSound(), Physics_UpdateStats(), and PutPlayerInServer().

◆ fragsfilter_cnt

int fragsfilter_cnt

Definition at line 11 of file quake3.qh.

Referenced by PutPlayerInServer().

◆ q3compat

int q3compat = 0

Definition at line 3 of file quake3.qh.