DAMAGE.CPP
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:1k
源码类别:

游戏

开发平台:

Visual C++

  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. void Give_Damage(pobject the_obj, short amount) {
  9.    if (the_obj->stats.current_health>0) {
  10.       the_obj->stats.current_health-=amount;
  11.       if (the_obj==the_player) {
  12.         Visuals_Message(HURT_MESSAGE, (pdata)amount);
  13.       }
  14.       if (the_obj->stats.current_health<=0) {
  15.          if (the_obj==the_player) {
  16.            Create_Object(the_player->x, the_player->y,
  17.              the_player->z, the_player->angle, EXPLOSION_TYPE,
  18.              the_player->owner, the_player->team);
  19.            Visuals_Message(VIS_DIE_MSG, NULL);
  20.          } else Send_Specific_Message(NULL, the_obj, DIE_MESSAGE, NULL);
  21.       }
  22.    }
  23. }