}
}
#define HUD_GETSTATS \
- local noref int vh_health = getstati(STAT_VEHICLESTAT_HEALTH); \
- local noref int shield = getstati(STAT_VEHICLESTAT_SHIELD); \
- local noref int energy = getstati(STAT_VEHICLESTAT_ENERGY); \
- local noref int ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \
- local noref int reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
- local noref int ammo2 = getstati(STAT_VEHICLESTAT_AMMO2); \
- local noref int reload2 = getstati(STAT_VEHICLESTAT_RELOAD2);
+ int vh_health = getstati(STAT_VEHICLESTAT_HEALTH); \
+ int shield = getstati(STAT_VEHICLESTAT_SHIELD); \
+ noref int energy = getstati(STAT_VEHICLESTAT_ENERGY); \
+ noref int ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \
+ noref int reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
+ noref int ammo2 = getstati(STAT_VEHICLESTAT_AMMO2); \
+ noref int reload2 = getstati(STAT_VEHICLESTAT_RELOAD2);
void CSQC_BUMBLE_HUD()
{
void CSQCModel_Draw()
{
// some nice flags for CSQCMODEL_IF and the hooks
- local noref bool isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
- local noref bool islocalplayer = (self.entnum == player_localnum + 1);
- local noref bool isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
+ bool isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
+ noref bool islocalplayer = (self.entnum == player_localnum + 1);
+ noref bool isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
// we don't do this for the local player as that one is already handled
// by CSQCPlayer_SetCamera()
int sf = ReadInt24_t();
// some nice flags for CSQCMODEL_IF and the hooks
- local noref bool isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
- local noref bool islocalplayer = (self.entnum == player_localnum + 1);
- local noref bool isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
+ bool isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
+ bool islocalplayer = (self.entnum == player_localnum + 1);
+ noref bool isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
self.classname = "csqcmodel";
self.iflags |= IFLAG_ORIGIN; // interpolate origin too
//"leftarm" (which is a child of "torso") which would return 2 instead...
float(float skel, float bonenum, string g1, string g2, string g3, string g4, string g5, string g6) example_skel_findbonegroup =
{
- local string bonename;
+ string bonename;
while (bonenum >= 0)
{
bonename = skel_get_bonename(skel, bonenum);
// apply a different framegroup animation to bones with a specified parent
void(float animmodelindex, float framegroup, float framegroupstarttime, float blendalpha, string groupbonename, string excludegroupname1, string excludegroupname2) example_skel_player_update_applyoverride =
{
- local float bonenum;
- local float numbones;
self.frame = framegroup;
self.frame2 = 0;
self.frame3 = 0;
self.lerpfrac = 0;
self.lerpfrac3 = 0;
self.lerpfrac4 = 0;
- bonenum = 0;
- numbones = skel_get_numbones(self.skeletonindex);
+ float bonenum = 0;
+ float numbones = skel_get_numbones(self.skeletonindex);
while (bonenum < numbones)
{
if (example_skel_findbonegroup(self.skeletonindex, bonenum, groupbonename, excludegroupname1, excludegroupname2, "", "", "") == 1)
// make eyes point at a target location, be sure v_forward, v_right, v_up are set correctly before calling
void(vector eyetarget, string bonename) example_skel_player_update_eyetarget =
{
- local float bonenum;
- local vector ang;
- local vector oldforward, oldright, oldup;
- local vector relforward, relright, relup, relorg;
- local vector boneforward, boneright, boneup, boneorg;
- local vector parentforward, parentright, parentup, parentorg;
- local vector u, v;
- local vector modeleyetarget;
- bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
+ float bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
if (bonenum < 0)
return;
- oldforward = v_forward;
- oldright = v_right;
- oldup = v_up;
- v = eyetarget - self.origin;
+ vector oldforward = v_forward;
+ vector oldright = v_right;
+ vector oldup = v_up;
+ vector v = eyetarget - self.origin;
+ vector modeleyetarget;
modeleyetarget_x = v * v_forward;
modeleyetarget_y = 0-v * v_right;
modeleyetarget_z = v * v_up;
// this is an eyeball, make it point at the target location
// first get all the data we can...
- relorg = skel_get_bonerel(self.skeletonindex, bonenum);
- relforward = v_forward;
- relright = v_right;
- relup = v_up;
- boneorg = skel_get_boneabs(self.skeletonindex, bonenum);
- boneforward = v_forward;
- boneright = v_right;
- boneup = v_up;
- parentorg = skel_get_boneabs(self.skeletonindex, skel_get_boneparent(self.skeletonindex, bonenum));
- parentforward = v_forward;
- parentright = v_right;
- parentup = v_up;
+ vector relorg = skel_get_bonerel(self.skeletonindex, bonenum);
+ vector relforward = v_forward;
+ vector relright = v_right;
+ vector relup = v_up;
+ vector boneorg = skel_get_boneabs(self.skeletonindex, bonenum);
+ vector boneforward = v_forward;
+ vector boneright = v_right;
+ vector boneup = v_up;
+ vector parentorg = skel_get_boneabs(self.skeletonindex, skel_get_boneparent(self.skeletonindex, bonenum));
+ vector parentforward = v_forward;
+ vector parentright = v_right;
+ vector parentup = v_up;
// get the vector from the eyeball to the target
- u = modeleyetarget - boneorg;
+ vector u = modeleyetarget - boneorg;
// now transform it inversely by the parent matrix to produce new rel vectors
v_x = u * parentforward;
v_y = u * parentright;
v_z = u * parentup;
- ang = vectoangles2(v, relup);
+ vector ang = vectoangles2(v, relup);
ang_x = 0 - ang_x;
makevectors(ang);
// set the relative bone matrix
//"leftarm" (which is a child of "torso") which would return 2 instead...
float(float skel, float bonenum, string g1, string g2, string g3, string g4, string g5, string g6) example_skel_findbonegroup =
{
- local string bonename;
while (bonenum >= 0)
{
- bonename = skel_get_bonename(skel, bonenum);
+ string bonename = skel_get_bonename(skel, bonenum);
if (bonename == g1) return 1;
if (bonename == g2) return 2;
if (bonename == g3) return 3;
// apply a different framegroup animation to bones with a specified parent
void(float animmodelindex, float framegroup, float framegroupstarttime, float blendalpha, string groupbonename, string excludegroupname1, string excludegroupname2) example_skel_player_update_applyoverride =
{
- local float bonenum;
- local float numbones;
self.frame = framegroup;
self.frame2 = 0;
self.frame3 = 0;
self.lerpfrac = 0;
self.lerpfrac3 = 0;
self.lerpfrac4 = 0;
- bonenum = 0;
- numbones = skel_get_numbones(self.skeletonindex);
+ float bonenum = 0;
+ float numbones = skel_get_numbones(self.skeletonindex);
while (bonenum < numbones)
{
if (example_skel_findbonegroup(self.skeletonindex, bonenum, groupbonename, excludegroupname1, excludegroupname2, "", "", "") == 1)
// make eyes point at a target location, be sure v_forward, v_right, v_up are set correctly before calling
void(vector eyetarget, string bonename) example_skel_player_update_eyetarget =
{
- local float bonenum;
- local vector ang;
- local vector oldforward, oldright, oldup;
- local vector relforward, relright, relup, relorg;
- local vector boneforward, boneright, boneup, boneorg;
- local vector parentforward, parentright, parentup, parentorg;
- local vector u, v;
- local vector modeleyetarget;
- bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
+ float bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
if (bonenum < 0)
return;
- oldforward = v_forward;
- oldright = v_right;
- oldup = v_up;
- v = eyetarget - self.origin;
+ vector oldforward = v_forward;
+ vector oldright = v_right;
+ vector oldup = v_up;
+ vector v = eyetarget - self.origin;
+ vector modeleyetarget;
modeleyetarget_x = v * v_forward;
modeleyetarget_y = 0-v * v_right;
modeleyetarget_z = v * v_up;
// this is an eyeball, make it point at the target location
// first get all the data we can...
- relorg = skel_get_bonerel(self.skeletonindex, bonenum);
- relforward = v_forward;
- relright = v_right;
- relup = v_up;
- boneorg = skel_get_boneabs(self.skeletonindex, bonenum);
- boneforward = v_forward;
- boneright = v_right;
- boneup = v_up;
- parentorg = skel_get_boneabs(self.skeletonindex, skel_get_boneparent(self.skeletonindex, bonenum));
- parentforward = v_forward;
- parentright = v_right;
- parentup = v_up;
+ vector relorg = skel_get_bonerel(self.skeletonindex, bonenum);
+ vector relforward = v_forward;
+ vector relright = v_right;
+ vector relup = v_up;
+ vector boneorg = skel_get_boneabs(self.skeletonindex, bonenum);
+ vector boneforward = v_forward;
+ vector boneright = v_right;
+ vector boneup = v_up;
+ vector parentorg = skel_get_boneabs(self.skeletonindex, skel_get_boneparent(self.skeletonindex, bonenum));
+ vector parentforward = v_forward;
+ vector parentright = v_right;
+ vector parentup = v_up;
// get the vector from the eyeball to the target
- u = modeleyetarget - boneorg;
+ vector u = modeleyetarget - boneorg;
// now transform it inversely by the parent matrix to produce new rel vectors
v_x = u * parentforward;
v_y = u * parentright;
v_z = u * parentup;
- ang = vectoangles2(v, relup);
+ vector ang = vectoangles2(v, relup);
ang_x = 0 - ang_x;
makevectors(ang);
// set the relative bone matrix
float autocvar_g_nades_nade_radius;
float autocvar_g_nades_nade_force;
float autocvar_g_nades_nade_newton_style;
-float autocvar_g_nades_napalm_ball_count;
+int autocvar_g_nades_napalm_ball_count;
float autocvar_g_nades_napalm_ball_spread;
float autocvar_g_nades_napalm_ball_damage;
float autocvar_g_nades_napalm_ball_damageforcescale;
//
void LaunchDebris (string debrisname, vector force)
{
- local entity dbr;
-
- dbr = spawn();
+ entity dbr = spawn();
setorigin(dbr, self.absmin
+ '1 0 0' * random() * (self.absmax_x - self.absmin_x)
+ '0 1 0' * random() * (self.absmax_y - self.absmin_y)
}
void spawnfunc_dynlight()
{
- local entity targ;
-
if (!self.light_lev)
self.light_lev = 200;
if (!self.color)
- should keys have a trigger?
*/
-float item_keys_usekey(entity l, entity p) {
+bool item_keys_usekey(entity l, entity p) {
float valid = l.itemkeys & p.itemkeys;
if (!valid) {
itemkeys MUST always have exactly one bit set.
*/
void spawnfunc_item_key() {
- local string _model, _netname;
- local vector _colormod;
+ string _netname;
+ vector _colormod;
// reject this entity if more than one key was set!
if (self.itemkeys>0 && (self.itemkeys & (self.itemkeys-1)) != 0) {
}
// find default model
-#ifdef GMQCC
- _model = string_null;
-#endif
+ string _model = string_null;
if (self.itemkeys <= ITEM_KEY_BIT(2)) {
_model = "models/keys/key.md3";
} else if (self.itemkeys >= ITEM_KEY_BIT(3) && self.itemkeys <= ITEM_KEY_BIT(5)) {
* trigger givent targets
*/
void trigger_keylock_trigger(string s) {
- local entity t, stemp, otemp, atemp;
-
- stemp = self;
- otemp = other;
- atemp = activator;
-
+ entity stemp = self;
+ entity otemp = other;
+ entity atemp = activator;
+ entity t;
for(t = world; (t = find(t, targetname, s)); )
if (t.use) {
self = t;
* kill killtarget of trigger keylock.
*/
void trigger_keylock_kill(string s) {
- local entity t;
+ entity t;
for(t = world; (t = find(t, targetname, s)); )
remove(t);
};
void trigger_keylock_touch(void) {
- local float key_used, started_delay;
-
- key_used = FALSE;
- started_delay = FALSE;
+ bool key_used = FALSE;
+ bool started_delay = FALSE;
// only player may trigger the lock
if (!IS_PLAYER(other))
void nade_napalm_boom()
{
entity fountain;
- local float c;
- for (c = 0; c < autocvar_g_nades_napalm_ball_count; c ++)
+ int c;
+ for (c = 0; c < autocvar_g_nades_napalm_ball_count; c++)
nade_napalm_ball();
*/
float door_check_keys(void) {
- local entity door;
-
-
- if (self.owner)
- door = self.owner;
- else
- door = self;
+ entity door = self.owner ? self.owner : self;
// no key needed
if (!door.itemkeys)