Inside3D!
     

Silly hud code

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Mon Dec 15, 2008 10:10 pm    Post subject: Silly hud code Reply with quote

Okay I was digging thru some old code and found something I wrote so long ago i barely remember it....

Code:



void() flash_rune_on  =
{
  if ((self.owner.player_flag & ITEM_RUNE_MASK) && (self.lip < 11))
  {
    self.lip          = (self.lip + 1.00);//lip is a counter for the flash
    self.think        = flash_rune_off;
    self.nextthink    = time + 0.1;
    self.owner.items2 = (self.owner.items2 | self.cnt); //--toggle rune
  }
  else
  {
    remove(self);
  }
}

void() flash_rune_off =
{
  if ((self.owner.player_flag & ITEM_RUNE_MASK) && (self.lip < 10))
  {
    self.lip          = (self.lip + 1.00);  //--lip is a counter for the flash
    self.think        = flash_rune_on;
    self.nextthink    = time + 0.1;   
    self.owner.items2 = self.owner.items2 - (self.owner.items2 & self.cnt);//--toggle rune off
  }
  else
  {
    remove(self);
  }
}

void(float sig) flash_rune_stat =
{
    local entity flash;
   
    flash           = spawn();
    flash.think     = flash_rune_on;
    flash.nextthink = time + 0.1;
    flash.cnt       = sig;//remember the rune we have
    flash.owner     = self;   
};


then for example call flash like this

void () RegenerationSound =
{
   if ((self.player_flag & ITEM_RUNE4_FLAG))
   {
      if ((self.regeneration_sound < time))
      {
         self.regeneration_sound = (time + 1);
         sound (self, CHAN_AUTO, "items/r_item1.wav", 1, ATTN_NORM);
         flash_rune_stat(IT2_SIGIL4);
      }
   }
};


Basically when u get the rune items the corresponding icon on the hud will flash intermittently to draw attention. can be used i suppose as a global filter also... again its old code havent even retried it Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group