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

Go to the source code of this file.

Functions

void door_rotating_go_down (entity this)
void door_rotating_go_up (entity this, entity oth)
void door_rotating_hit_bottom (entity this)
void door_rotating_hit_top (entity this)
void door_rotating_init_startopen (entity this)
void door_rotating_reset (entity this)
 spawnfunc (func_door_rotating)

Function Documentation

◆ door_rotating_go_down()

void door_rotating_go_down ( entity this)

Definition at line 54 of file door_rotating.qc.

55{
56 if (this.noise2 != "")
58 if (this.max_health)
59 {
61 SetResourceExplicit(this, RES_HEALTH, this.max_health);
62 }
63
64 this.state = STATE_DOWN;
66}
float max_health
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
int state
void door_rotating_hit_bottom(entity this)
float speed
Definition dynlight.qc:9
const int CH_TRIGGER_SINGLE
Definition sound.qh:13
const float VOL_BASE
Definition sound.qh:36
#define _sound(e, c, s, v, a)
Definition sound.qh:43
const float ATTEN_NORM
Definition sound.qh:30
void SUB_CalcAngleMove(entity this, vector destangle, float tspeedtype, float tspeed, void(entity this) func)
Definition subs.qc:347
const int DAMAGE_YES
Definition subs.qh:80
vector pos1
Definition subs.qh:50
string noise2
Definition subs.qh:83
const int TSPEED_LINEAR
Definition subs.qh:71
float takedamage
Definition subs.qh:78
#define STATE_DOWN
Definition sys-pre.qh:31

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, DAMAGE_YES, door_rotating_hit_bottom(), entity(), max_health, noise2, pos1, SetResourceExplicit(), speed, state, STATE_DOWN, SUB_CalcAngleMove(), takedamage, TSPEED_LINEAR, and VOL_BASE.

Referenced by door_blocked(), door_generic_plat_blocked(), door_hit_top(), door_rotating_hit_top(), and door_use().

◆ door_rotating_go_up()

void door_rotating_go_up ( entity this,
entity oth )

Definition at line 68 of file door_rotating.qc.

69{
70 if (this.state == STATE_UP)
71 return; // already going up
72
73 if (this.state == STATE_TOP)
74 { // reset top wait time
75 this.nextthink = this.ltime + this.wait;
76 return;
77 }
78 if (this.noise2 != "")
80 this.state = STATE_UP;
82
83 string oldmessage;
84 oldmessage = this.message;
85 this.message = "";
86 SUB_UseTargets(this, NULL, oth); // TODO: is oth needed here?
87 this.message = oldmessage;
88}
string message
Definition powerups.qc:19
float wait
Definition items.qc:17
float nextthink
void door_rotating_hit_top(entity this)
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition triggers.qc:344
float ltime
Definition net.qc:10
#define NULL
Definition post.qh:14
vector pos2
Definition subs.qh:50
#define STATE_UP
Definition sys-pre.qh:30
#define STATE_TOP
Definition sys-pre.qh:28

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, door_rotating_hit_top(), entity(), ltime, message, nextthink, noise2, NULL, pos2, speed, state, STATE_TOP, STATE_UP, SUB_CalcAngleMove(), SUB_UseTargets(), TSPEED_LINEAR, VOL_BASE, and wait.

Referenced by door_blocked(), door_generic_plat_blocked(), and door_use().

◆ door_rotating_hit_bottom()

void door_rotating_hit_bottom ( entity this)

Definition at line 42 of file door_rotating.qc.

43{
44 if (this.noise1 != "")
46 if (this.lip==666) // this.lip is used to remember reverse opening direction for door_rotating
47 {
48 this.pos2 = '0 0 0' - this.pos2;
49 this.lip = 0;
50 }
51 this.state = STATE_BOTTOM;
52}
string noise1
Definition subs.qh:83
float lip
Definition subs.qh:40
#define STATE_BOTTOM
Definition sys-pre.qh:29

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, entity(), lip, noise1, pos2, state, STATE_BOTTOM, and VOL_BASE.

Referenced by door_rotating_go_down().

◆ door_rotating_hit_top()

void door_rotating_hit_top ( entity this)

Definition at line 31 of file door_rotating.qc.

32{
33 if (this.noise1 != "")
35 this.state = STATE_TOP;
36 if (this.spawnflags & DOOR_TOGGLE)
37 return; // don't come down automatically
39 this.nextthink = this.ltime + this.wait;
40}
int spawnflags
Definition ammo.qh:15
const int DOOR_TOGGLE
Definition door.qh:11
void door_rotating_go_down(entity this)
#define setthink(e, f)

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, door_rotating_go_down(), DOOR_TOGGLE, entity(), ltime, nextthink, noise1, setthink, spawnflags, state, STATE_TOP, VOL_BASE, and wait.

Referenced by door_rotating_go_up().

◆ door_rotating_init_startopen()

void door_rotating_init_startopen ( entity this)

Definition at line 101 of file door_rotating.qc.

102{
103 this.angles = this.movedir;
104 this.pos2 = '0 0 0';
105 this.pos1 = this.movedir;
106}
ent angles
Definition ent_cs.qc:121
vector movedir
Definition viewloc.qh:18

References angles, entity(), movedir, pos1, and pos2.

Referenced by spawnfunc().

◆ door_rotating_reset()

void door_rotating_reset ( entity this)

Definition at line 92 of file door_rotating.qc.

93{
94 this.angles = this.pos1;
95 this.avelocity = '0 0 0';
96 this.state = STATE_BOTTOM;
97 setthink(this, func_null);
98 this.nextthink = 0;
99}
vector avelocity
var void func_null()

References angles, avelocity, entity(), func_null(), nextthink, pos1, setthink, state, and STATE_BOTTOM.

Referenced by spawnfunc().

◆ spawnfunc()

spawnfunc ( func_door_rotating )

Definition at line 108 of file door_rotating.qc.

109{
110 //if (!this.deathtype) // map makers can override this
111 // this.deathtype = " got in the way";
112
113 // I abuse "movedir" for denoting the axis for now
115 this.movedir = '0 0 1';
116 else if (this.spawnflags & DOOR_ROTATING_YAXIS)
117 this.movedir = '1 0 0';
118 else // Z
119 this.movedir = '0 1 0';
120
121 if (this.angles_y==0) this.angles_y = 90;
122
123 this.movedir = this.movedir * this.angles_y;
124 this.angles = '0 0 0';
125
126 this.avelocity = this.movedir;
127 if (!InitMovingBrushTrigger(this))
128 return;
129 this.velocity = '0 0 0';
130 //this.effects |= EF_LOWPRECISION;
131 this.classname = "door_rotating";
132
134 this.use = door_use;
135 this.active = ACTIVE_ACTIVE;
136
137 this.pos1 = '0 0 0';
138 this.pos2 = this.movedir;
139
140// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
141// but spawn in the open position
142 if (this.spawnflags & DOOR_START_OPEN)
144
145 door_init_shared(this);
146 if (!this.speed)
147 {
148 this.speed = 50;
149 }
150 this.lip = 0; // this.lip is used to remember reverse opening direction for door_rotating
151
152 settouch(this, door_touch);
153
154// LinkDoors can't be done until all of the doors have been spawned, so
155// the sizes can be detected properly.
157
158 this.reset = door_rotating_reset;
159}
const int INITPRIO_SETLOCATION
Definition constants.qh:98
const int INITPRIO_LINKDOORS
Definition constants.qh:99
string classname
vector velocity
#define use
int active
Definition defs.qh:34
const int ACTIVE_ACTIVE
Definition defs.qh:37
void door_use(entity this, entity actor, entity trigger)
Definition door.qc:216
void door_init_shared(entity this)
Definition door.qc:667
void door_blocked(entity this, entity blocker)
Definition door.qc:28
void LinkDoors(entity this)
Definition door.qc:454
void door_touch(entity this, entity toucher)
Definition door.qc:296
const int DOOR_START_OPEN
Definition door.qh:7
void door_rotating_init_startopen(entity this)
void door_rotating_reset(entity this)
const int DOOR_ROTATING_YAXIS
const int DOOR_ROTATING_XAXIS
angles_y
Definition ent_cs.qc:119
#define settouch(e, f)
Definition self.qh:73
#define setblocked(e, f)
bool InitMovingBrushTrigger(entity this)
Definition subs.qc:577
void InitializeEntity(entity e, void(entity this) func, int order)
Definition world.qc:2209

References active, ACTIVE_ACTIVE, angles, angles_y, avelocity, classname, door_blocked(), door_init_shared(), door_rotating_init_startopen(), door_rotating_reset(), DOOR_ROTATING_XAXIS, DOOR_ROTATING_YAXIS, DOOR_START_OPEN, door_touch(), door_use(), InitializeEntity(), InitMovingBrushTrigger(), INITPRIO_LINKDOORS, INITPRIO_SETLOCATION, LinkDoors(), lip, movedir, pos1, pos2, setblocked, settouch, spawnflags, speed, use, and velocity.