components/prboom/wi_stuff.c
// ====================================================================
// WI_updateNetgameStats
// Purpose: Calculate coop stats as we display them with noise and fury
// Args:    none
// Returns: void
// Comment: This stuff sure is complicated for what it does
//
WI_updateNetgameStats
Purpose: Calculate coop stats as we display them with noise and fury
Args:    none
Returns: void
Comment: This stuff sure is complicated for what it does
WI_updateNetgameStats Purpose : Calculate coop stats as we display them with noise and fury Args : none Returns : void Comment : This stuff sure is complicated for what it does
void WI_updateNetgameStats(void)
{
  int   i;
  int   fsum;
  boolean stillticking;
  WI_updateAnimatedBack();
  if (acceleratestage && ng_state != 10)
  {
    acceleratestage = 0;
    for (i=0 ; i<MAXPLAYERS ; i++)
    {
      if (!playeringame[i])
        continue;
      cnt_kills[i] = (plrs[i].skills * 100) / wbs->maxkills;
      cnt_items[i] = (plrs[i].sitems * 100) / wbs->maxitems;
      cnt_secret[i] = wbs->maxsecret ?
                      (plrs[i].ssecret * 100) / wbs->maxsecret : 100;
      if (dofrags)
        cnt_frags[i] = WI_fragSum(i);  
    }
    S_StartSound(0, sfx_barexp);  
    ng_state = 10;
  }
  if (ng_state == 2)
  {
    if (!(bcnt&3))
      S_StartSound(0, sfx_pistol);  
    stillticking = false;
    for (i=0 ; i<MAXPLAYERS ; i++)
    {
      if (!playeringame[i])
        continue;
      cnt_kills[i] += 2;
      if (cnt_kills[i] >= (plrs[i].skills * 100) / wbs->maxkills)
        cnt_kills[i] = (plrs[i].skills * 100) / wbs->maxkills;
      else
        stillticking = true; 
    }
    if (!stillticking)
    {
      S_StartSound(0, sfx_barexp);
      ng_state++;
    }
  }
  else if (ng_state == 4)
  {
    if (!(bcnt&3))
      S_StartSound(0, sfx_pistol);
    stillticking = false;
    for (i=0 ; i<MAXPLAYERS ; i++)
    {
      if (!playeringame[i])
        continue;
      cnt_items[i] += 2;
      if (cnt_items[i] >= (plrs[i].sitems * 100) / wbs->maxitems)
        cnt_items[i] = (plrs[i].sitems * 100) / wbs->maxitems;
      else
        stillticking = true;
    }
    if (!stillticking)
    {
      S_StartSound(0, sfx_barexp);
      ng_state++;
    }
  }
  else if (ng_state == 6)
  {
    if (!(bcnt&3))
      S_StartSound(0, sfx_pistol);
    stillticking = false;
    for (i=0 ; i<MAXPLAYERS ; i++)
    {
      if (!playeringame[i])
        continue;
      cnt_secret[i] += 2;
      if (cnt_secret[i] >= (wbs->maxsecret ? (plrs[i].ssecret * 100) / wbs->maxsecret : compatibility_level < lxdoom_1_compatibility ? 0 : 100))
        cnt_secret[i] = wbs->maxsecret ? (plrs[i].ssecret * 100) / wbs->maxsecret : 100;
      else
        stillticking = true;
    }
    if (!stillticking)
    {
      S_StartSound(0, sfx_barexp);
      ng_state += 1 + 2*!dofrags;
    }
  }
  else if (ng_state == 8)
  {
    if (!(bcnt&3))
      S_StartSound(0, sfx_pistol);
    stillticking = false;
    for (i=0 ; i<MAXPLAYERS ; i++)
    {
      if (!playeringame[i])
        continue;
      cnt_frags[i] += 1;
      if (cnt_frags[i] >= (fsum = WI_fragSum(i)))
        cnt_frags[i] = fsum;
      else
        stillticking = true;
    }
    if (!stillticking)
    {
      S_StartSound(0, sfx_pldeth);
      ng_state++;
    }
  }
  else if (ng_state == 10)
  {
    if (acceleratestage)
    {
      S_StartSound(0, sfx_sgcock);
      if ( gamemode == commercial )
        WI_initNoState();
      else
        WI_initShowNextLoc();
    }
  }
  else if (ng_state & 1)
  {
    if (!--cnt_pause)
    {
      ng_state++;
      cnt_pause = TICRATE;
    }
  }
}
void WI_updateNetgameStats ( void ) { int i ; int fsum ; boolean stillticking ; WI_updateAnimatedBack ( ) ; if ( acceleratestage && ng_state != 10 ) { acceleratestage = 0 ; for ( i = 0 ; i < MAXPLAYERS ; i ++ ) { if ( ! playeringame [ i ] ) continue ; cnt_kills [ i ] = ( plrs [ i ] . skills * 100 ) / wbs -> maxkills ; cnt_items [ i ] = ( plrs [ i ] . sitems * 100 ) / wbs -> maxitems ; cnt_secret [ i ] = wbs -> maxsecret ? ( plrs [ i ] . ssecret * 100 ) / wbs -> maxsecret : 100 ; if ( dofrags ) cnt_frags [ i ] = WI_fragSum ( i ) ; } S_StartSound ( 0 , sfx_barexp ) ; ng_state = 10 ; } if ( ng_state == 2 ) { if ( ! ( bcnt & 3 ) ) S_StartSound ( 0 , sfx_pistol ) ; stillticking = false ; for ( i = 0 ; i < MAXPLAYERS ; i ++ ) { if ( ! playeringame [ i ] ) continue ; cnt_kills [ i ] += 2 ; if ( cnt_kills [ i ] >= ( plrs [ i ] . skills * 100 ) / wbs -> maxkills ) cnt_kills [ i ] = ( plrs [ i ] . skills * 100 ) / wbs -> maxkills ; else stillticking = true ; } if ( ! stillticking ) { S_StartSound ( 0 , sfx_barexp ) ; ng_state ++ ; } } else if ( ng_state == 4 ) { if ( ! ( bcnt & 3 ) ) S_StartSound ( 0 , sfx_pistol ) ; stillticking = false ; for ( i = 0 ; i < MAXPLAYERS ; i ++ ) { if ( ! playeringame [ i ] ) continue ; cnt_items [ i ] += 2 ; if ( cnt_items [ i ] >= ( plrs [ i ] . sitems * 100 ) / wbs -> maxitems ) cnt_items [ i ] = ( plrs [ i ] . sitems * 100 ) / wbs -> maxitems ; else stillticking = true ; } if ( ! stillticking ) { S_StartSound ( 0 , sfx_barexp ) ; ng_state ++ ; } } else if ( ng_state == 6 ) { if ( ! ( bcnt & 3 ) ) S_StartSound ( 0 , sfx_pistol ) ; stillticking = false ; for ( i = 0 ; i < MAXPLAYERS ; i ++ ) { if ( ! playeringame [ i ] ) continue ; cnt_secret [ i ] += 2 ; if ( cnt_secret [ i ] >= ( wbs -> maxsecret ? ( plrs [ i ] . ssecret * 100 ) / wbs -> maxsecret : compatibility_level < lxdoom_1_compatibility ? 0 : 100 ) ) cnt_secret [ i ] = wbs -> maxsecret ? ( plrs [ i ] . ssecret * 100 ) / wbs -> maxsecret : 100 ; else stillticking = true ; } if ( ! stillticking ) { S_StartSound ( 0 , sfx_barexp ) ; ng_state += 1 + 2 * ! dofrags ; } } else if ( ng_state == 8 ) { if ( ! ( bcnt & 3 ) ) S_StartSound ( 0 , sfx_pistol ) ; stillticking = false ; for ( i = 0 ; i < MAXPLAYERS ; i ++ ) { if ( ! playeringame [ i ] ) continue ; cnt_frags [ i ] += 1 ; if ( cnt_frags [ i ] >= ( fsum = WI_fragSum ( i ) ) ) cnt_frags [ i ] = fsum ; else stillticking = true ; } if ( ! stillticking ) { S_StartSound ( 0 , sfx_pldeth ) ; ng_state ++ ; } } else if ( ng_state == 10 ) { if ( acceleratestage ) { S_StartSound ( 0 , sfx_sgcock ) ; if ( gamemode == commercial ) WI_initNoState ( ) ; else WI_initShowNextLoc ( ) ; } } else if ( ng_state & 1 ) { if ( ! -- cnt_pause ) { ng_state ++ ; cnt_pause = TICRATE ; } } }
WI_updateNetgameStats
Purpose: Calculate coop stats as we display them with noise and fury
Args:    none
Returns: void
Comment: This stuff sure is complicated for what it does
WI_updateNetgameStats Purpose : Calculate coop stats as we display them with noise and fury Args : none Returns : void Comment : This stuff sure is complicated for what it does
// killough 2/22/98: Make secrets = 100% if maxsecret = 0: // we had frags // bang // pop // still got stuff to tally // killough 2/22/98: Make secrets = 100% if maxsecret = 0: