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

Go to the source code of this file.

Functions

 spawnfunc (target_changelevel)
void target_changelevel_reset (entity this)
void target_changelevel_use (entity this, entity actor, entity trigger)

Variables

entity chlevel_targ
string chmap
string gametype

Function Documentation

◆ spawnfunc()

spawnfunc ( target_changelevel )

Definition at line 60 of file changelevel.qc.

61{
63 this.active = ACTIVE_ACTIVE;
64 this.reset = target_changelevel_reset;
65
66 if(!this.count)
67 {
68 this.count = 0.7;
69 }
70}
void target_changelevel_use(entity this, entity actor, entity trigger)
Definition changelevel.qc:6
void target_changelevel_reset(entity this)
float count
Definition powerups.qc:22
#define use
int active
Definition defs.qh:34
const int ACTIVE_ACTIVE
Definition defs.qh:37

References active, ACTIVE_ACTIVE, count, target_changelevel_reset(), target_changelevel_use(), and use.

◆ target_changelevel_reset()

void target_changelevel_reset ( entity this)

Definition at line 45 of file changelevel.qc.

46{
47 this.active = ACTIVE_ACTIVE;
48}

References active, ACTIVE_ACTIVE, and entity().

Referenced by spawnfunc().

◆ target_changelevel_use()

void target_changelevel_use ( entity this,
entity actor,
entity trigger )

Definition at line 6 of file changelevel.qc.

7{
9 return;
10 if(this.active != ACTIVE_ACTIVE)
11 return;
12
14 {
15 // simply don't react if a non-player triggers it
16 if(!IS_PLAYER(actor)) { return; }
17
18 actor.chlevel_targ = this;
19
20 int plnum = 0;
21 int realplnum = 0;
22 // let's not count bots
24 ++realplnum;
25 if(it.chlevel_targ == this)
26 ++plnum;
27 });
28 if(plnum < ceil(realplnum * min(1, this.count))) // 70% of players
29 return;
30 }
31
32 if(this.gametype != "")
34
35 if (this.chmap == "")
36 {
37 if(IS_REAL_CLIENT(actor) && autocvar_g_campaign) // only count it as a win if the player touched (TODO: bots ending stage/vehicles?)
38 campaign_forcewin = true; // this counts as beating the map in a campaign stage!
39 NextLevel();
40 }
41 else
42 changelevel(this.chmap);
43}
string chmap
Definition changelevel.qc:3
const int CHANGELEVEL_MULTIPLAYER
Definition changelevel.qh:4
entity gametype
Definition main.qh:43
int spawnflags
Definition ammo.qh:15
#define IS_PLAYER(s)
Definition player.qh:243
float game_stopped
Definition stats.qh:81
void MapInfo_SwitchGameType(Gametype t)
Definition mapinfo.qc:1518
Gametype MapInfo_Type_FromString(string gtype, bool dowarn, bool is_q3compat)
Definition mapinfo.qc:621
bool autocvar_g_campaign
Definition menu.qc:747
float ceil(float f)
void changelevel(string map)
float min(float f,...)
bool campaign_forcewin
Definition campaign.qh:28
#define IS_REAL_CLIENT(v)
Definition utils.qh:17
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50
void NextLevel()
Definition world.qc:1384

References active, ACTIVE_ACTIVE, autocvar_g_campaign, campaign_forcewin, ceil(), changelevel(), CHANGELEVEL_MULTIPLAYER, chmap, count, entity(), FOREACH_CLIENT, game_stopped, gametype, IS_PLAYER, IS_REAL_CLIENT, MapInfo_SwitchGameType(), MapInfo_Type_FromString(), min(), NextLevel(), and spawnflags.

Referenced by spawnfunc().

Variable Documentation

◆ chlevel_targ

entity chlevel_targ

Definition at line 4 of file changelevel.qc.

◆ chmap

string chmap

Definition at line 3 of file changelevel.qc.

Referenced by target_changelevel_use().

◆ gametype

string gametype

Definition at line 3 of file changelevel.qc.