Merge commit '6f440770dbdb' into atheros/item_keys
authorPrzemysław Grzywacz <nexather@gmail.com>
Tue, 18 Oct 2011 17:38:00 +0000 (19:38 +0200)
committerPrzemysław Grzywacz <nexather@gmail.com>
Tue, 18 Oct 2011 17:38:00 +0000 (19:38 +0200)
1  2 
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/progs.src
qcsrc/server/t_plats.qc

Simple merge
Simple merge
Simple merge
@@@ -882,10 -882,9 +882,10 @@@ void door_go_up(
        self.message = "";
        SUB_UseTargets();
        self.message = oldmessage;
- };
+ }
  
  
 +
  /*
  =============================================================================
  
@@@ -894,62 -893,10 +894,62 @@@ ACTIVATION FUNCTION
  =============================================================================
  */
  
 +float door_check_keys(void) {
 +      local entity door;
 +      
 +      
 +      if (self.owner)
 +              door = self.owner;
 +      else
 +              door = self;
 +      
 +      if (door.spawnflags & (SPAWNFLAGS_GOLD_KEY | SPAWNFLAGS_SILVER_KEY)) {
 +              // this door require a key
 +              // only a player can have a key
 +              if (other.classname != "player")
 +                      return FALSE;
 +              
 +              // check gold key
 +              if (self.owner.spawnflags & SPAWNFLAGS_GOLD_KEY) {
 +                      if (!(other.itemkeys & KEYS_GOLD_KEY)) {
 +                              if (other.key_door_messagetime <= time) {
 +                                      play2(other, "misc/talk.wav");
 +                                      centerprint(other, "You don't have the gold key!");
 +                                      other.key_door_messagetime = time + 2;
 +                              }
 +                              return FALSE;
 +                      } else {
 +                              self.owner.spawnflags &~= SPAWNFLAGS_GOLD_KEY;
 +                      }
 +              }
 +                      
 +              // check silver key
 +              if (self.owner.spawnflags & SPAWNFLAGS_SILVER_KEY) {
 +                      if (!(other.itemkeys & KEYS_SILVER_KEY)) {
 +                              if (other.key_door_messagetime <= time) {
 +                                      play2(other, "misc/talk.wav");
 +                                      centerprint(other, "You don't have the silver key!");
 +                                      other.key_door_messagetime = time + 2;
 +                              }
 +                              return FALSE;
 +                      } else {
 +                              self.owner.spawnflags &~= SPAWNFLAGS_SILVER_KEY;
 +                      }
 +              }
 +              
 +              // door is now unlocked
 +              play2(other, "misc/talk.wav");
 +              centerprint(other, "Door unlocked!");
 +      }
 +      
 +      return TRUE;
 +}
 +
 +
  void door_fire()
  {
-       local entity    oself;
-       local entity    starte;
+       entity  oself;
+       entity  starte;
  
        if (self.owner != self)
                objerror ("door_fire: self.owner != self");
  
  void door_use()
  {
-       local entity oself;
+       entity oself;
  
        //dprint("door_use (model: ");dprint(self.model);dprint(")\n");
 +      
        if (self.owner)
        {
                oself = self;
@@@ -1333,10 -1268,10 +1333,10 @@@ void LinkDoors(
                }
        } while (1 );
  
- };
+ }
  
  
 -/*QUAKED spawnfunc_func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK x x TOGGLE
 +/*QUAKED spawnfunc_func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK GOLD_KEY SILVER_KEY TOGGLE
  if two doors touch, they are assumed to be connected and operate as a unit.
  
  TOGGLE causes the door to wait in both the start and end states for a trigger event.