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

Go to the source code of this file.

Functions

 spawnfunc (trigger_secret)
void trigger_secret_touch (entity this, entity toucher)
 A secret has been found (maybe :P)

Function Documentation

◆ spawnfunc()

spawnfunc ( trigger_secret )

Definition at line 55 of file secret.qc.

56{
57 // FIXME: should it be disabled in most modes?
58
59 // update secrets count
60 secrets_total += 1;
61
62 // add default message
63 if (!this.message || this.message == "")
64 this.message = "You found a secret!";
65
66 // set default sound
67 if ((!this.noise || this.noise == "") && !this.sounds)
68 this.sounds = 1; // misc/secret.wav
69
70 switch(this.sounds)
71 {
72 case 1: this.noise = "misc/secret.wav"; break;
73 case 2: this.noise = strzone(SND(TALK)); break;
74 case 3: this.noise = "misc/trigger1.wav"; break;
75 }
76
77 if(this.noise && this.noise != "")
79
80 // a secret cannot be delayed
81 this.delay = 0;
82
84
86// NOTE: old maps don't expect secrets to reset, so enabling resetting can cause issues!
87#if 0
88 this.reset = trigger_secret_reset;
89#endif
90}
string message
Definition powerups.qc:19
float delay
Definition items.qc:17
#define EXACTTRIGGER_INIT
Definition common.qh:116
string precache_sound(string sample)
string strzone(string s)
void trigger_secret_touch(entity this, entity toucher)
A secret has been found (maybe :P)
Definition secret.qc:15
int secrets_total
Definition secret.qh:5
#define settouch(e, f)
Definition self.qh:73
#define SND(id)
Definition all.qh:35
string noise
Definition subs.qh:83
float sounds
Definition subs.qh:42

References delay, EXACTTRIGGER_INIT, message, noise, precache_sound(), secrets_total, settouch, SND, sounds, strzone(), and trigger_secret_touch().

◆ trigger_secret_touch()

void trigger_secret_touch ( entity this,
entity toucher )

A secret has been found (maybe :P)

Definition at line 15 of file secret.qc.

16{
17 // only a player can trigger this
18 if (!IS_PLAYER(toucher))
19 return;
20
22
23 // update secrets found counter
24 secrets_found += 1;
25
26 // message and noise handled by SUB_UseTargets
28
29 // we can't just delete(this) here, because this is a touch function
30 // called while C code is looping through area links...
31 settouch(this, func_null);
32}
#define IS_PLAYER(s)
Definition player.qh:243
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition triggers.qc:344
#define EXACTTRIGGER_TOUCH(e, t)
Definition common.qh:115
var void func_null()
int secrets_found
Definition secret.qh:8
entity entity toucher
Definition self.qh:72

References entity(), EXACTTRIGGER_TOUCH, func_null(), IS_PLAYER, secrets_found, settouch, SUB_UseTargets(), and toucher.

Referenced by spawnfunc().