home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / RAYCAST.ZIP / DAMAGE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-25  |  787 b   |  26 lines

  1. #include "assert.h"
  2. #include "ray.h"
  3. #include "globals.h"
  4. #include "message.h"
  5. #include "damage.h"
  6. #include "visuals.h"
  7. #include "sprinter.h"
  8.  
  9. void Give_Damage(pobject the_obj, short amount) {
  10.    if (the_obj->stats.current_health>0) {
  11.       the_obj->stats.current_health-=amount;
  12.       if (the_obj==the_player) {
  13.         Visuals_Message(HURT_MESSAGE, (pdata)amount);
  14.       }
  15.       if (the_obj->stats.current_health<=0) {
  16.          if (the_obj==the_player) {
  17.            Create_Object(the_player->x, the_player->y,
  18.              the_player->z, the_player->angle, EXPLOSION_TYPE,
  19.              the_player->owner, the_player->team);
  20.            Visuals_Message(VIS_DIE_MSG, NULL);
  21.          } else Send_Specific_Message(NULL, the_obj, DIE_MESSAGE, NULL);
  22.       }
  23.    }
  24. }
  25.  
  26.