home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / RAYCAST.ZIP / EXPLOSIO.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-18  |  1.0 KB  |  39 lines

  1. #include "ray.h"
  2. #include "globals.h"
  3. #include "rayspr.h"
  4. #include "sprfunc.h"
  5. #include "sfvars.h"
  6. #include "sound.h"
  7.  
  8. long explo_sound_id;
  9.  
  10. void Explosion_Create(pobject explo_obj, long extra_data_offset);
  11. void Explosion_Update(pobject explo_obj, long update_num);
  12.  
  13. void Init_Explosion(func_index index) {
  14.    explo_sound_id=Load_Sound("explo.wav");
  15.    update_funcs[index]=Explosion_Update;
  16.    load_extra_funcs[index]=Explosion_Create;
  17. }
  18.  
  19. void Explosion_Create(pobject explo_obj, long extra_data_offset)
  20. {
  21.    PSHORT new_counter=(PSHORT)NewPtr(sizeof(SHORT));
  22.    *(new_counter)=0;
  23.    explo_obj->extra_data=(pdata)new_counter;
  24.    Play_Sound(explo_sound_id);
  25. }
  26.  
  27. void Explosion_Update(pobject explo_obj, long update_num)
  28. {
  29.    PSHORT cur_time=(PSHORT)explo_obj->extra_data;
  30.    if (++(*cur_time)>=explo_obj->type->stats.base_speed) {
  31.       (*cur_time)=0;
  32.        if (++explo_obj->cur_frame==
  33.           wall[explo_obj->type->frames[0]].num_image) {
  34.              Kill_Object(explo_obj);
  35.        }
  36.    }
  37. }
  38.  
  39.