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(), and target_print_use().

◆ 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 360 of file quake3.qc.

361{
362 // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
363
364 if (!this.classname)
365 return true;
366
367 // DeFRaG mappers use "notcpm" or "notvq3" to disable an entity in CPM or VQ3 physics
368 // Xonotic is usually played with a CPM-based physics so we default to CPM mode
369 if(cvar_string("g_mod_physics") == "Q3")
370 {
371 if(stof(GetField_fullspawndata(this, "notvq3", false)))
372 return true;
373 }
374 else if(stof(GetField_fullspawndata(this, "notcpm", false)))
375 return true;
376
377 // Q3 mappers use "notq3a" or "notta" to disable an entity in Q3A or Q3TA
378 // Xonotic has ~equivalent features to Team Arena
379 if(stof(GetField_fullspawndata(this, "notta", false)))
380 return true;
381
382 // FIXME: singleplayer does not use maxclients 1 as that would prevent bots,
383 // this is the case in Q3 also, it uses another method to block clients.
384 // Only accessible in VQ3, via the `spmap` command.
385 if(stof(GetField_fullspawndata(this, "notsingle", false)))
386 if(maxclients == 1 && IS_GAMETYPE(DEATHMATCH))
387 return true;
388
389 if(stof(GetField_fullspawndata(this, "notteam", false)))
390 if(teamplay)
391 return true;
392
393 if(stof(GetField_fullspawndata(this, "notfree", false)))
394 if(!teamplay)
395 return true;
396
397 if(this.gametype || this.not_gametype)
398 {
399 // Q3 checks these with strstr(): case-sensitive, no gametype can be a substring of another,
400 // any separator is allowed (conventions are: spaces, commas, or commas with spaces).
401 // QL's entities.def says they're space delineated.
402
403 // Q3 gametype entity fields: ffa tournament single team ctf oneflag obelisk harvester (game/g_spawn.c)
404 // Q3 arena file 'type' key: ffa tourney ctf oneflag overload harvester (ui/ui_gameinfo.c)
405
406 // QL gametype entity fields: ffa duel tdm ca ft rr ctf ad dom har 1f race ob
407 // QL arena file 'type' key: ffa duel tdm ca ft rr ctf ad dom har oneflag race
408
409 string gametypename_q3, gametypename_ql;
410
411 // One of these will apply if our gametype has no Q3/QL equivalent
412 if(teamplay)
413 {
414 gametypename_q3 = "team";
415 gametypename_ql = "tdm";
416 }
417 else
418 gametypename_q3 = gametypename_ql = "ffa";
419
420 if(g_ctf)
421 {
422 if (cvar("g_ctf_oneflag"))
423 {
424 gametypename_q3 = "oneflag";
425 gametypename_ql = "1f";
426 }
427 else
428 gametypename_q3 = gametypename_ql = "ctf";
429 }
430 else if(g_duel)
431 {
432 gametypename_q3 = "tournament";
433 gametypename_ql = "duel";
434 }
435 else if(IS_GAMETYPE(DEATHMATCH) && maxclients == 1)
436 gametypename_q3 = "single";
437 else if(g_ca)
438 gametypename_ql = "ql";
439 else if(IS_GAMETYPE(FREEZETAG))
440 gametypename_ql = "ft";
441 else if(IS_GAMETYPE(DOMINATION))
442 gametypename_ql = "dom";
443 else if(g_race || g_cts)
444 gametypename_ql = "race";
445
446 if(this.gametype)
447 if(strstrofs(this.gametype, gametypename_q3, 0) < 0
448 && strstrofs(this.gametype, gametypename_ql, 0) < 0)
449 return true;
450
451 // Only supported by QL
452 if(strstrofs(this.not_gametype, gametypename_ql, 0) >= 0)
453 return true;
454 }
455
456 return false;
457}
#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:359
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 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.