Subversion Repositories Games.Descent

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Portions of this file are copyright Rebirth contributors and licensed as
  3.  * described in COPYING.txt.
  4.  * Portions of this file are copyright Parallax Software and licensed
  5.  * according to the Parallax license below.
  6.  * See COPYING.txt for license details.
  7.  
  8. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  9. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  10. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  11. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  12. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  13. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  14. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  15. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  16. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  17. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  18. */
  19.  
  20. /*
  21.  *
  22.  * Headerfile for effects.c
  23.  *
  24.  */
  25.  
  26. #pragma once
  27.  
  28. #include "vclip.h"
  29. #include "dxxsconf.h"
  30. #include "pack.h"
  31. #include <array>
  32.  
  33. #if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
  34. namespace dsx {
  35. #if defined(DXX_BUILD_DESCENT_I)
  36. constexpr std::integral_constant<unsigned, 60> MAX_EFFECTS{};
  37. constexpr std::integral_constant<uint32_t, UINT32_MAX> eclip_none{};
  38. #elif defined(DXX_BUILD_DESCENT_II)
  39. constexpr std::integral_constant<unsigned, 110> MAX_EFFECTS{};
  40. constexpr std::integral_constant<uint16_t, UINT16_MAX> eclip_none{};
  41. #endif
  42. }
  43.  
  44. //flags for eclips.  If no flags are set, always plays
  45.  
  46. #define EF_CRITICAL 1   //this doesn't get played directly (only when mine critical)
  47. #define EF_ONE_SHOT 2   //this is a special that gets played once
  48. #define EF_STOPPED  4   //this has been stopped
  49.  
  50. #define ECLIP_NUM_FUELCEN     2
  51. #define ECLIP_NUM_BOSS        53
  52. #ifdef DXX_BUILD_DESCENT_II
  53. #define ECLIP_NUM_FORCE_FIELD 78 // diagonal force field texture
  54. #define ECLIP_NUM_FORCE_FIELD2 93 // straight force field texture
  55. #endif
  56.  
  57. struct eclip : public prohibit_void_ptr<eclip>
  58. {
  59.         vclip   vc;             //imbedded vclip
  60.         fix     time_left;      //for sequencing
  61.         uint32_t frame_count;    //for sequencing
  62.         short   changing_wall_texture;      //Which element of Textures array to replace.
  63.         short   changing_object_texture;    //Which element of ObjBitmapPtrs array to replace.
  64.         int     flags;          //see above
  65.         int     crit_clip;      //use this clip instead of above one when mine critical
  66.         unsigned dest_bm_num;    //use this bitmap when monitor destroyed
  67.         int     dest_vclip;     //what vclip to play when exploding
  68.         int     dest_eclip;     //what eclip to play when exploding
  69.         fix     dest_size;      //3d size of explosion
  70.         int     sound_num;      //what sound this makes
  71.         segnum_t     segnum;
  72.         uint8_t sidenum; //what seg & side, for one-shot clips
  73. };
  74.  
  75. extern unsigned Num_effects;
  76.  
  77. // Set up special effects.
  78. extern void init_special_effects();
  79.  
  80. // Clear any active one-shots
  81. void reset_special_effects();
  82.  
  83. // Function called in game loop to do effects.
  84. extern void do_special_effects();
  85.  
  86. // Restore bitmap
  87. extern void restore_effect_bitmap_icons();
  88.  
  89. //stop an effect from animating.  Show first frame.
  90. void stop_effect(int effect_num);
  91.  
  92. //restart a stopped effect
  93. void restart_effect(int effect_num);
  94.  
  95. /*
  96.  * reads n eclip structs from a PHYSFS_File
  97.  */
  98. void eclip_read(PHYSFS_File *fp, eclip &ec);
  99. #if 0
  100. void eclip_write(PHYSFS_File *fp, const eclip &ec);
  101. #endif
  102.  
  103. #ifdef dsx
  104. namespace dsx {
  105.  
  106. using d_eclip_array = std::array<eclip, MAX_EFFECTS>;
  107.  
  108. struct d_level_unique_effects_clip_state
  109. {
  110.         d_eclip_array Effects;
  111. };
  112.  
  113. extern d_level_unique_effects_clip_state LevelUniqueEffectsClipState;
  114.  
  115. }
  116. #endif
  117.  
  118. #endif
  119.