(Old code tutorial) Knife Ammo Display (quick fix) from Wolf Planet forum

View previous topic View next topic Go down

(Old code tutorial) Knife Ammo Display (quick fix) from Wolf Planet forum

Post by Officer-M. John (Admin) on Sun Mar 27, 2016 9:00 am

This is a simple fix that makes the statusbar display 0 ammo when the knife is out. Simply replace the DrawAmmo routine with:

Code:

/*
===============
=
= DrawAmmo
=
===============
*/

void  DrawAmmo (void)
{
  char noammo=0;

  switch (gamestate.weapon)
  {
      case  wp_knife:
        LatchNumber (27,16,2,noammo);
        break;
      case  wp_pistol:
      case  wp_machinegun:
      case  wp_chaingun:
        LatchNumber (27,16,2,gamestate.ammo);
        break;
  }
}

With further editting (which I can't be stuffed doing right at this moment), you can make the area blank when the knife is out.

There you go
-Deathshead

Writte by Deathshead on Mon Feb 28, 2005 9:44 am
avatar
Officer-M. John (Admin)
Admin

Posts : 323
Join date : 2015-10-02
Age : 19

View user profile http://wolf3dfanboys.usersboard.com

Back to top Go down

Re: (Old code tutorial) Knife Ammo Display (quick fix) from Wolf Planet forum

Post by Officer-M. John (Admin) on Sun Mar 27, 2016 9:14 am

Using yours as a base, I found out how to show no ammo with the knife.

Code:

/*
===============
=
= DrawAmmo
=
===============
*/

void  DrawAmmo (void)
{

  switch (gamestate.weapon)
  {
      case  wp_knife:
        StatusDrawPic (27,16,N_BLANKPIC);
    StatusDrawPic (28,16,N_BLANKPIC);
        break;
      case  wp_pistol:
      case  wp_machinegun:
      case  wp_chaingun:
        LatchNumber (27,16,2,gamestate.ammo);
        break;
  }
}


/

As you can see, I simply took out the "char noammo" and had blank pics drawn instead. This is what I used for WarStorm, tought is there an even easier way? The only other way I have been shown takes far more memory, so I didn't use that one. No bugs as of now, exept it will currently only work with 1 to 2 digits.

Writte by Conner94 on Mon Feb 28, 2005 4:39 pm
avatar
Officer-M. John (Admin)
Admin

Posts : 323
Join date : 2015-10-02
Age : 19

View user profile http://wolf3dfanboys.usersboard.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum