Advertisement
dominus

Untitled

Feb 14th, 2022
1,486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.85 KB | None | 0 0
  1. diff --git a/effects.cc b/effects.cc
  2. index 27c74f2a..80fc1653 100644
  3. --- a/effects.cc
  4. +++ b/effects.cc
  5. @@ -1769,6 +1769,22 @@ Fire_field_effect::Fire_field_effect(
  6.     field = Game_object_weak(field_shared);
  7.     field_obj->set_flag(Obj_flags::is_temporary);
  8.     field_obj->move(t.tx, t.ty, t.tz);
  9. +   for (int frame = 1; frame <= 5; ++frame) {
  10. +       Game_object_shared dust_shared = gmap->create_ireg_object(224, frame);
  11. +       Game_object *dust_obj = dust_shared.get();
  12. +       dust = Game_object_weak(dust_shared);
  13. +       dust_obj->set_flag(Obj_flags::is_temporary);
  14. +       if (frame == 5)
  15. +           dust_obj->move(t.tx, t.ty, t.tz);
  16. +       else if (frame == 1)
  17. +           dust_obj->move(t.tx, t.ty + 1, t.tz);
  18. +       else if (frame == 2)
  19. +           dust_obj->move(t.tx, t.ty - 1, t.tz);
  20. +       else if (frame == 3)
  21. +           dust_obj->move(t.tx - 1, t.ty, t.tz);
  22. +       else if (frame == 4)
  23. +           dust_obj->move(t.tx + 1, t.ty, t.tz);
  24. +   }
  25.     gwin->get_tqueue()->add(Game::get_ticks() + 3000 + rand() % 2000, this);
  26.  }
  27.  
  28. @@ -1781,10 +1797,13 @@ void Fire_field_effect::handle_event(
  29.      uintptr udata
  30.  ) {
  31.     Game_object_shared field_obj = field.lock();
  32. +   Game_object_shared dust_obj = dust.lock();
  33.     int frnum = field_obj ? field_obj->get_framenum() : 0;
  34.     if (frnum == 0) {       // All done?
  35. -       if (field_obj)
  36. -           field_obj->remove_this();
  37. +       if (field_obj) {
  38. +           field_obj->remove_this();
  39. +           dust_obj->remove_this();
  40. +       }
  41.         auto ownHandle = eman->remove_effect(this);
  42.         return;
  43.     } else {
  44. diff --git a/effects.h b/effects.h
  45. index da9d3bf9..00b57600 100644
  46. --- a/effects.h
  47. +++ b/effects.h
  48. @@ -379,6 +379,7 @@ class Earthquake : public Time_sensitive {
  49.   */
  50.  class Fire_field_effect : public Special_effect {
  51.     Game_object_weak field;     // What we create.
  52. +   Game_object_weak dust;
  53.  public:
  54.     Fire_field_effect(Tile_coord const &t);
  55.     void handle_event(unsigned long curtime, uintptr udata) override;
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement