]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Penguinum/Antiwall
authorMario <zacjardine@y7mail.com>
Sun, 12 Jul 2015 10:46:34 +0000 (20:46 +1000)
committerMario <zacjardine@y7mail.com>
Sun, 12 Jul 2015 10:46:34 +0000 (20:46 +1000)
1  2 
qcsrc/client/wall.qc
qcsrc/client/wall.qh
qcsrc/server/defs.qh
qcsrc/server/g_models.qc
qcsrc/server/g_triggers.qc
qcsrc/server/g_triggers.qh

diff --combined qcsrc/client/wall.qc
index 6a9f5a440fc1c1d6f0fc366d5110945bda33d300,f591268d358919420adcbd57851bf6e98f8b0356..f9bf9914c6f1ab7bc3587499001bdf223cae75e4
@@@ -1,46 -1,16 +1,57 @@@
  #include "wall.qh"
+ #include "_all.qh"
+ #include "bgmscript.qh"
+ #include "../common/util.qh"
+ #include "../csqcmodellib/interpolate.qh"
+ .float alpha;
+ .float scale;
+ .vector movedir;
  
 +void Ent_Wall_PreDraw()
 +{
 +      if (self.inactive)
 +      {
 +              self.alpha = 0;
 +      }
 +      else
 +      {
 +              vector org;
 +              org = getpropertyvec(VF_ORIGIN);
 +              if(!checkpvs(org, self))
 +                      self.alpha = 0;
 +              else if(self.fade_start || self.fade_end) {
 +                      vector offset = '0 0 0';
 +                      offset_z = self.fade_vertical_offset;
 +                      float player_dist = vlen(org - self.origin - 0.5 * (self.mins + self.maxs) + offset);
 +                      if (self.fade_end == self.fade_start)
 +                      {
 +                              if (player_dist >= self.fade_start)
 +                                      self.alpha = 0;
 +                              else
 +                                      self.alpha = 1;
 +                      }
 +                      else
 +                      {
 +                              self.alpha = (self.alpha_min + self.alpha_max * bound(0,
 +                                                         (self.fade_end - player_dist)
 +                                                         / (self.fade_end - self.fade_start), 1)) / 100.0;
 +                      }
 +              }
 +              else
 +              {
 +                      self.alpha = 1;
 +              }
 +      }
 +      if(self.alpha <= 0)
 +              self.drawmask = 0;
 +      else
 +              self.drawmask = MASK_NORMAL;
 +}
 +
  void Ent_Wall_Draw()
  {
        float f;
@@@ -50,7 -20,7 +61,7 @@@
                fld = angles;
        else
                fld = origin;
-       self.fld = self.saved;
+       self.(fld) = self.saved;
  
        if(self.lodmodelindex1)
        {
  
        InterpolateOrigin_Do();
  
-       self.saved = self.fld;
+       self.saved = self.(fld);
  
-       f = BGMScript(self);
+       f = doBGMScript(self);
        if(f >= 0)
        {
                if(self.lip < 0) // < 0: alpha goes from 1 to 1-|lip| when toggled (toggling subtracts lip)
                        self.alpha = 1 + self.lip * f;
                else // > 0: alpha goes from 1-|lip| to 1 when toggled (toggling adds lip)
                        self.alpha = 1 - self.lip * (1 - f);
-               self.fld = self.fld + self.movedir * f;
+               self.(fld) = self.(fld) + self.movedir * f;
        }
        else
                self.alpha = 1;
@@@ -118,7 -88,7 +129,7 @@@ void Ent_Wall(
                fld = angles;
        else
                fld = origin;
-       self.fld = self.saved;
+       self.(fld) = self.saved;
  
        f = ReadByte();
  
                        self.movedir_z = ReadCoord();
                        self.lip = ReadByte() / 255.0;
                }
 +              self.fade_start = ReadShort();
 +              self.fade_end = ReadShort();
 +              self.alpha_max = ReadShort();
 +              self.alpha_min = ReadShort();
 +              self.inactive = ReadShort();
 +              self.fade_vertical_offset = ReadShort();
                BGMScript_InitEntity(self);
        }
  
        InterpolateOrigin_Note();
  
-       self.saved = self.fld;
+       self.saved = self.(fld);
  
        self.entremove = Ent_Wall_Remove;
        self.draw = Ent_Wall_Draw;
 +      self.predraw = Ent_Wall_PreDraw;
  }
diff --combined qcsrc/client/wall.qh
index 3094b4373de44f8cf288414b16e6715e93512dde,57aef7e0c51959d9c11eae7b858ded57b3ad2bb9..d84fa46b6cd8812ad6540c9844f385d8ff003ac6
@@@ -1,22 -1,13 +1,23 @@@
  #ifndef WALL_H
  #define WALL_H
  
- .float lip;
- .float bgmscriptangular;
- .int lodmodelindex0, lodmodelindex1, lodmodelindex2;
- .float loddistance1, loddistance2;
- .vector saved;
+ entityclass(Wall);
+ class(Wall) .float lip;
+ class(Wall) .float bgmscriptangular;
+ class(Wall) .int lodmodelindex0, lodmodelindex1, lodmodelindex2;
+ class(Wall) .float loddistance1, loddistance2;
+ class(Wall) .vector saved;
  
 +// Needed for interactive clientwalls
 +.float inactive; // Clientwall disappears when inactive
 +.float alpha_max, alpha_min;
 +// If fade_start > fade_end, fadeout will be inverted
 +// fade_vertical_offset is a vertival offset for player position
 +.float fade_start, fade_end, fade_vertical_offset;
 +.float default_solid;
 +// This variable will be set by trigger
 +.float antiwall_flag;
 +
  void Ent_Wall_Draw();
  
  void Ent_Wall_Remove();
diff --combined qcsrc/server/defs.qh
index 98f0661e7c05e1bb0132440ea2467675d2d689cc,9e907e86638ca4c769fcc648958be62b29e84525..276f3f9ad810a051da1ac7531bf9702a69f0c422
@@@ -1,7 -1,7 +1,7 @@@
  #ifndef SERVER_DEFS_H
  #define SERVER_DEFS_H
  
- #include "../common/weapons/weapons.qh"
+ #include "../common/weapons/all.qh"
  
  #define INDEPENDENT_ATTACK_FINISHED
  
@@@ -81,13 -81,6 +81,13 @@@ float server_is_dedicated
  .string  platmovetype;
  .float platmovetype_start, platmovetype_end;
  
 +
 +// Needed for dynamic clientwalls
 +.float inactive; // Clientwall disappears when inactive
 +.float alpha_max, alpha_min;
 +.float fade_start, fade_end, fade_vertical_offset;
 +.float default_solid; // Variable to store default self.solid for clientwalls
 +
  .string killtarget;
  
  .vector       pos1, pos2;
@@@ -257,7 -250,7 +257,7 @@@ float nJoinAllowed(entity ignore)
  
  .entity flagcarried;
  
- .float playerid;
+ .int playerid;
  float playerid_last;
  .float noalign;               // if set to 1, the item or spawnpoint won't be dropped to the floor
  
@@@ -292,7 -285,7 +292,7 @@@ float default_weapon_alpha
  .float version_nagtime;
  
  const int NUM_JUMPPADSUSED = 3;
- .float jumppadcount;
+ .int jumppadcount;
  .entity jumppadsused[NUM_JUMPPADSUSED];
  
  string gamemode_name;
@@@ -354,7 -347,7 +354,7 @@@ float next_pingtime
  
  .float Version;
  .int SendFlags;
- .float(entity to, float sendflags) SendEntity;
+ .bool(entity to, int sendflags) SendEntity;
  
  // player sounds, voice messages
  // TODO implemented fall and falling
@@@ -459,6 -452,29 +459,29 @@@ float round_starttime; //point in time 
  .float stat_sv_airspeedlimit_nonqw;
  .float stat_sv_maxspeed;
  
+ // new properties
+ .float stat_sv_jumpvelocity;
+ .float stat_sv_airaccel_qw_stretchfactor;
+ .float stat_sv_maxairstrafespeed;
+ .float stat_sv_maxairspeed;
+ .float stat_sv_airstrafeaccelerate;
+ .float stat_sv_warsowbunny_turnaccel;
+ .float stat_sv_airaccel_sideways_friction;
+ .float stat_sv_aircontrol;
+ .float stat_sv_aircontrol_power;
+ .float stat_sv_aircontrol_penalty;
+ .float stat_sv_warsowbunny_airforwardaccel;
+ .float stat_sv_warsowbunny_topspeed;
+ .float stat_sv_warsowbunny_accel;
+ .float stat_sv_warsowbunny_backtosideratio;
+ .float stat_sv_friction;
+ .float stat_sv_accelerate;
+ .float stat_sv_stopspeed;
+ .float stat_sv_airaccelerate;
+ .float stat_sv_airstopaccelerate;
+ .string cvar_cl_physics;
  void W_Porto_Remove (entity p);
  
  .int projectiledeathtype;
@@@ -526,7 -542,7 +549,7 @@@ string matchid
  
  .float stat_leadlimit;
  
float radar_showennemies;
bool radar_showennemies;
  
  #ifdef PROFILING
  float client_cefc_accumulator;
@@@ -534,7 -550,7 +557,7 @@@ float client_cefc_accumulatortime
  #endif
  
  .float weapon_load[WEP_MAXCOUNT];
- .float ammo_none; // used by the reloading system, must always be 0
+ .int ammo_none; // used by the reloading system, must always be 0
  .float clip_load;
  .float old_clip_load;
  .float clip_size;
  .float vortex_chargepool_ammo;
  .float hagar_load;
  
- .float grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab
+ .int grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab
  
  #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE
  // when doing this, hagar can go through clones
diff --combined qcsrc/server/g_models.qc
index 9bf4c4ece34f39bff24cd80be23dec39add3f947,e25ce66f3229a80c41ef44d19e702bc5579934d7..1a9be7ff257c938fc2eb04f0212efd423b945f6c
@@@ -1,14 -1,10 +1,10 @@@
- #if defined(CSQC)
- #elif defined(MENUQC)
- #elif defined(SVQC)
-       #include "../dpdefs/progsdefs.qh"
-     #include "../dpdefs/dpextensions.qh"
-     #include "../common/constants.qh"
-     #include "autocvars.qh"
-     #include "constants.qh"
-     #include "defs.qh"
-     #include "../csqcmodellib/sv_model.qh"
- #endif
+ #include "_all.qh"
+ #include "g_subs.qh"
+ #include "g_triggers.qh"
+ #include "../common/constants.qh"
+ #include "../csqcmodellib/sv_model.qh"
  
  .float modelscale;
  
@@@ -29,22 -25,7 +25,22 @@@ void g_model_setcolormaptoactivator (vo
  void g_clientmodel_setcolormaptoactivator (void)
  {
        g_model_setcolormaptoactivator();
 -      self.SendFlags |= 1;
 +      self.SendFlags |= 9;
 +}
 +
 +void g_clientmodel_use(void)
 +{
 +      if (self.antiwall_flag == 1)
 +      {
 +              self.inactive = 1;
 +              self.solid = SOLID_NOT;
 +      }
 +      else if (self.antiwall_flag == 2)
 +      {
 +              self.inactive = 0;
 +              self.solid = self.default_solid;
 +      }
 +      g_clientmodel_setcolormaptoactivator();
  }
  
  void g_model_dropbyspawnflags()
@@@ -75,12 -56,12 +71,12 @@@ void g_clientmodel_dropbyspawnflags(
                self.SendFlags |= 2;
  }
  
- float g_clientmodel_genericsendentity (entity to, float sf)
+ float g_clientmodel_genericsendentity (entity to, int sf)
  {
        sf = sf & 0x0F;
        if(self.angles != '0 0 0')
                sf |= 0x10;
 -      if(self.solid && (self.mins != '0 0 0' || self.maxs != '0 0 0'))
 +      if(self.mins != '0 0 0' || self.maxs != '0 0 0')
                sf |= 0x20;
        if(self.colormap != 0)
                sf |= 0x40;
                        WriteCoord(MSG_ENTITY, self.movedir.z);
                        WriteByte(MSG_ENTITY, floor(self.lip * 255));
                }
 +              WriteShort(MSG_ENTITY, self.fade_start);
 +              WriteShort(MSG_ENTITY, self.fade_end);
 +              WriteShort(MSG_ENTITY, self.alpha_max);
 +              WriteShort(MSG_ENTITY, self.alpha_min);
 +              WriteShort(MSG_ENTITY, self.inactive);
 +              WriteShort(MSG_ENTITY, self.fade_vertical_offset);
        }
  
        return true;
        if(self.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) self.movetype = MOVETYPE_PHYSICS; \
        if(!self.scale) self.scale = self.modelscale; \
        SetBrushEntityModel(); \
 -      self.use = g_clientmodel_setcolormaptoactivator; \
 +      self.use = g_clientmodel_use; \
        InitializeEntity(self, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
        if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT; \
        if(!self.bgmscriptsustain) self.bgmscriptsustain = 1; else if(self.bgmscriptsustain < 0) self.bgmscriptsustain = 0; \
 -      Net_LinkEntity(self, true, 0, g_clientmodel_genericsendentity);
 +      Net_LinkEntity(self, true, 0, g_clientmodel_genericsendentity); \
 +      self.default_solid = sol;
  
  // non-solid model entities:
  void spawnfunc_misc_gamemodel()         { self.angles_x = -self.angles.x; G_MODEL_INIT      (SOLID_NOT) } // model entity
index 717a19b09f09e17165ed9de426b7179b30f05d5a,872e597d12d2237e321f2b63bc53d85ca4582fb1..cdca7e245a6066f33d4d928ecf79c612a97070c0
@@@ -1,4 -1,10 +1,10 @@@
  #include "g_triggers.qh"
+ #include "_all.qh"
+ #include "weapons/csqcprojectile.qh"
+ #include "../common/deathtypes.qh"
+ #include "../warpzonelib/util_server.qh"
+ #include "g_subs.qh"
  #include "t_jumppads.qh"
  
  void SUB_DontUseTargets()
@@@ -103,9 -109,6 +109,9 @@@ void SUB_UseTargets(
                }
                if (s != "")
                {
 +                      // Flag to set func_clientwall state
 +                      // 1 == deactivate, 2 == activate, 0 == do nothing
 +                      float aw_flag = self.antiwall_flag;
                        for(t = world; (t = find(t, targetname, s)); )
                        if(t.use)
                        {
                                }
                                else
                                {
 +                                      if (t.classname == "func_clientwall" || t.classname == "func_clientillusionary")
 +                                              t.antiwall_flag = aw_flag;
                                        self = t;
                                        other = stemp;
                                        activator = act;
@@@ -688,11 -689,11 +694,11 @@@ void target_speaker_use_activator(
                sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1));
                if(GetPlayerSoundSampleField_notFound)
                        snd = "misc/null.wav";
-               else if(activator.sample == "")
+               else if (activator.(sample) == "")
                        snd = "misc/null.wav";
                else
                {
-                       tokenize_console(activator.sample);
+                       tokenize_console(activator.(sample));
                        float n;
                        n = stof(argv(1));
                        if(n > 0)
@@@ -715,11 -716,11 +721,11 @@@ void target_speaker_use_on(
                sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1));
                if(GetPlayerSoundSampleField_notFound)
                        snd = "misc/null.wav";
-               else if(activator.sample == "")
+               else if (activator.(sample) == "")
                        snd = "misc/null.wav";
                else
                {
-                       tokenize_console(activator.sample);
+                       tokenize_console(activator.(sample));
                        float n;
                        n = stof(argv(1));
                        if(n > 0)
@@@ -989,7 -990,7 +995,7 @@@ void spawnfunc_func_sparks(
        spawnfunc_func_pointparticles();
  }
  
- float rainsnow_SendEntity(entity to, float sf)
+ float rainsnow_SendEntity(entity to, int sf)
  {
        WriteByte(MSG_ENTITY, ENT_CLIENT_RAINSNOW);
        WriteByte(MSG_ENTITY, self.state);
index 1bc097fbe2aeb7600eae9ac0d6e7d18e4d0dd72f,793d7990957e6edb953dc6efa2618abe5483bc74..46face3407e19da89df03f3789630d339be8588c
@@@ -193,7 -193,7 +193,7 @@@ void spawnfunc_func_pointparticles()
  
  void spawnfunc_func_sparks();
  
- float rainsnow_SendEntity(entity to, float sf);
+ float rainsnow_SendEntity(entity to, int sf);
  
  /*QUAKED spawnfunc_func_rain (0 .5 .8) ?
  This is an invisible area like a trigger, which rain falls inside of.
@@@ -385,8 -385,4 +385,8 @@@ void spawnfunc_relay_activatetoggle()
  void spawnfunc_target_changelevel_use();
  
  void spawnfunc_target_changelevel();
 +
 +.float antiwall_flag; // Variable to define what to do with func_clientwall
 +// 0 == do nothing, 1 == deactivate, 2 == activate
 +
  #endif