Git Repos / fte_dogmode / qc / triggers / ladder.qc
Last update to this file was on 2025-08-13 at 05:20.
Show ladder.qc
//==============================================================================
// trigger_ladder -- selections from Rubicon 2 qc by john fitzgibbons
//==============================================================================
//======================================================================
// forward declarations
//======================================================================
#ifdef CSQC
void(float isnew) trigger_ladder_netreceive;
#endif
#ifdef SSQC
float(entity to, float netflags) trigger_ladder_netsend;
#endif
#if defined(CSQC) || defined (SSQC)
void() trigger_ladder_touch;
void(entity e) trigger_ladder_init;
#endif
#ifdef SSQC
void() trigger_ladder;
#endif
//------------------------------------------------------------------------------
/*QUAKED trigger_ladder (.5 .5 .5) ? X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
invisible ladder entity. when player is touching this entity, he can climb by pushing 'jump'
Keys:
"angle" the direction player must be facing to climb ladder
*/
//----------------------------------------------------------------------
// class trigger_ladder: base_trigger
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) trigger_ladder_netreceive =
{
local float netflags = ReadByte ();
BASE_TRIGGER_READSTATEFLAGS (NETFLAG_BASE_TRIGGER_STATEFLAGS)
BASE_TRIGGER_READSIZE (NETFLAG_BASE_TRIGGER_SIZE)
BASE_TRIGGER_READMOVEDIR (NETFLAG_BASE_TRIGGER_MOVEDIR)
if (netflags & NETFLAG_BASE_TRIGGER_RESERVED1)
{
self.angles_x = ReadAngle ();
self.angles_y = ReadAngle ();
self.angles_z = ReadAngle ();
}
if (isnew)
trigger_ladder_init (self);
// make sure size is set -- CEV
if (netflags & NETFLAG_BASE_TRIGGER_SIZE)
setsize (self, self.mins, self.maxs);
};
#endif
#ifdef SSQC
//--------------------------------------------------------------
float(entity to, float netflags) trigger_ladder_netsend =
{
BASE_ENTITY_WRITECLASSTYPE ()
if (netflags > NETFLAG_BASE_TRIGGER_FULLSEND)
netflags = NETFLAG_BASE_TRIGGER_FULLSEND;
WriteByte (MSG_ENTITY, netflags);
BASE_TRIGGER_WRITESTATEFLAGS (NETFLAG_BASE_TRIGGER_STATEFLAGS)
BASE_TRIGGER_WRITESIZE (NETFLAG_BASE_TRIGGER_SIZE)
BASE_TRIGGER_WRITEMOVEDIR (NETFLAG_BASE_TRIGGER_MOVEDIR)
if (netflags & NETFLAG_BASE_TRIGGER_RESERVED1)
{
WriteAngle (MSG_ENTITY, self.angles.x);
WriteAngle (MSG_ENTITY, self.angles.y);
WriteAngle (MSG_ENTITY, self.angles.z);
}
return TRUE;
};
#endif
#if defined(CSQC) || defined (SSQC)
//--------------------------------------------------------------
// trigger_ladder_touch
//--------------------------------------------------------------
void() trigger_ladder_touch =
{
if (self.stateflags & STATE_INACTIVE)
return;
// from Copper -- dumptruck_ds
if (sub_checkvalidtouch(other) == FALSE)
return;
// prevent the player "sticking" to a ladder if they are
// standing on the platform at the top of the ladder with
// the bottom of their bounding box flush with the top of
// the trigger -- iw
if (other.absmin_z + 1 >= self.absmax_z - 1)
return;
// if the trigger has an angles field, check player's
// facing direction
if (self.movedir != '0 0 0')
{
makevectors (other.angles);
if (v_forward * self.movedir < 0)
{
#if 0
dprint (sprintf("trigger_ladder_touch: "
"facing wrong way; movedir %v, "
"other ang %v\n", self.movedir,
other.angles));
#endif
// not facing the right way
return;
}
}
// changed to PMFLAGS -- CEV
other.moveflags |= PMF_ONLADDER;
};
#endif
#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) trigger_ladder_init =
{
e.classname = "trigger_ladder";
e.classtype = CT_TRIGGER_LADDER;
#ifdef SSQC
// ignore an "up" or "down" angle (doesn't make sense
// for a ladder)
if (e.angles_y == -1 || e.angles_y == -2)
{
dprint (sprintf("trigger_ladder_init: ignoring bad "
"'angle' value: %g\n", e.angles_y));
e.angles_y = 0;
}
#endif
base_trigger_init (e);
e.touch = trigger_ladder_touch;
#ifdef SSQC
sub_checkwaiting (e);
// trigger_ladder needs to be networked to the client. set
// our transmit function then full send the entity -- CEV
e.SendEntity = trigger_ladder_netsend;
e.SendFlags |= NETFLAG_BASE_TRIGGER_FULLSEND;
#endif
};
#endif
#ifdef SSQC
//--------------------------------------------------------------
void() trigger_ladder =
{
BASE_TRIGGER_PREINIT (base_trigger_init_field)
trigger_ladder_init (self);
};
#endif
// };
Return to the top of this page or return to the overview of this repo.
Log ladder.qc
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2025-08-13 | Another big commit. Item changes, field rework, etc. | cev | +21 | -81 |
2025-03-30 | Big commit. Entity networking, etc. | cev | +66 | -47 |
2024-11-20 | pmove refactor into prepoc macros, view bobbing | cev | +17 | -3 |
2024-07-17 | pmove changes, smooth crouching | cev | +1 | -1 |
2024-07-03 | pmove changes and fixes, improved climbing | cev | +1 | -1 |
2024-06-15 | Major update, committing as-is, will have bugs | cev | +113 | |
2024-03-24 | 2nd pass refactor, rework QC class structure | cev | +37 | -20 |
2024-01-09 | Continue OO / Class-based refactor | cev | +13 | -14 |
2023-12-09 | Start OO / class-based refactor, work on items | cev | +52 | -50 |
2023-11-16 | pmove bug fixes, moved q3 compat code, cleanup | cev | +67 |
Return to the top of this page or return to the overview of this repo.