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.  * Powerup header file.
  23.  *
  24.  */
  25.  
  26. #pragma once
  27.  
  28. #include "dxxsconf.h"
  29. #include "vclip.h"
  30. #include "fmtcheck.h"
  31.  
  32. #ifdef __cplusplus
  33. #include "fwd-object.h"
  34.  
  35. #if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
  36. enum powerup_type_t : uint8_t
  37. {
  38.         POW_EXTRA_LIFE = 0,
  39.         POW_ENERGY = 1,
  40.         POW_SHIELD_BOOST = 2,
  41.         POW_LASER = 3,
  42.  
  43.         POW_KEY_BLUE = 4,
  44.         POW_KEY_RED = 5,
  45.         POW_KEY_GOLD = 6,
  46.  
  47. //      POW_RADAR_ROBOTS = 7,
  48. //      POW_RADAR_POWERUPS = 8,
  49.  
  50.         POW_MISSILE_1 = 10,
  51.         POW_MISSILE_4 = 11,      // 4-pack MUST follow single missile
  52.  
  53.         POW_QUAD_FIRE = 12,
  54.  
  55.         POW_VULCAN_WEAPON = 13,
  56.         POW_SPREADFIRE_WEAPON = 14,
  57.         POW_PLASMA_WEAPON = 15,
  58.         POW_FUSION_WEAPON = 16,
  59.         POW_PROXIMITY_WEAPON = 17,
  60.         POW_HOMING_AMMO_1 = 18,
  61.         POW_HOMING_AMMO_4 = 19,      // 4-pack MUST follow single missile
  62.         POW_SMARTBOMB_WEAPON = 20,
  63.         POW_MEGA_WEAPON = 21,
  64.         POW_VULCAN_AMMO = 22,
  65.         POW_CLOAK = 23,
  66.         POW_TURBO = 24,
  67.         POW_INVULNERABILITY = 25,
  68.         POW_MEGAWOW = 27,
  69. #if defined(DXX_BUILD_DESCENT_II)
  70.         POW_GAUSS_WEAPON = 28,
  71.         POW_HELIX_WEAPON = 29,
  72.         POW_PHOENIX_WEAPON = 30,
  73.         POW_OMEGA_WEAPON = 31,
  74.  
  75.         POW_SUPER_LASER = 32,
  76.         POW_FULL_MAP = 33,
  77.         POW_CONVERTER = 34,
  78.         POW_AMMO_RACK = 35,
  79.         POW_AFTERBURNER = 36,
  80.         POW_HEADLIGHT = 37,
  81.  
  82.         POW_SMISSILE1_1 = 38,
  83.         POW_SMISSILE1_4 = 39,      // 4-pack MUST follow single missile
  84.         POW_GUIDED_MISSILE_1 = 40,
  85.         POW_GUIDED_MISSILE_4 = 41,      // 4-pack MUST follow single missile
  86.         POW_SMART_MINE = 42,
  87.         POW_MERCURY_MISSILE_1 = 43,
  88.         POW_MERCURY_MISSILE_4 = 44,      // 4-pack MUST follow single missile
  89.         POW_EARTHSHAKER_MISSILE = 45,
  90.  
  91.         POW_FLAG_BLUE = 46,
  92.         POW_FLAG_RED = 47,
  93.  
  94.         POW_HOARD_ORB = 7,       // use unused slot
  95. #endif
  96. };
  97.  
  98. #ifdef dsx
  99. namespace dcx {
  100. constexpr std::integral_constant<unsigned, 16> POWERUP_NAME_LENGTH{};
  101. }
  102.  
  103. namespace dsx {
  104. #if defined(DXX_BUILD_DESCENT_I)
  105. #define VULCAN_AMMO_MAX             (392u*2)
  106. constexpr std::integral_constant<unsigned, 29> MAX_POWERUP_TYPES{};
  107. #elif defined(DXX_BUILD_DESCENT_II)
  108. #define VULCAN_AMMO_MAX             (392u*4)
  109. #define GAUSS_WEAPON_AMMO_AMOUNT    392
  110.  
  111. constexpr std::integral_constant<unsigned, 50> MAX_POWERUP_TYPES{};
  112. #endif
  113. #define VULCAN_WEAPON_AMMO_AMOUNT   196
  114. #define VULCAN_AMMO_AMOUNT          (49*2)
  115.  
  116. #if DXX_USE_EDITOR
  117. using powerup_names_array = std::array<std::array<char, POWERUP_NAME_LENGTH>, MAX_POWERUP_TYPES>;
  118. extern powerup_names_array Powerup_names;
  119. #endif
  120.  
  121. }
  122. #endif
  123.  
  124. namespace dcx {
  125.  
  126. struct powerup_type_info : public prohibit_void_ptr<powerup_type_info>
  127. {
  128.         int vclip_num;
  129.         int hit_sound;
  130.         fix size;       // 3d size of longest dimension
  131.         fix light;      // amount of light cast by this powerup, set in bitmaps.tbl
  132. };
  133.  
  134. void powerup_type_info_read(PHYSFS_File *fp, powerup_type_info &pti);
  135. void powerup_type_info_write(PHYSFS_File *fp, const powerup_type_info &pti);
  136.  
  137. extern unsigned N_powerup_types;
  138. void draw_powerup(const d_vclip_array &Vclip, grs_canvas &, const object_base &obj);
  139.  
  140. }
  141.  
  142. //returns true if powerup consumed
  143. #ifdef dsx
  144. namespace dsx {
  145. using d_powerup_info_array = std::array<powerup_type_info, MAX_POWERUP_TYPES>;
  146. extern d_powerup_info_array Powerup_info;
  147. int do_powerup(vmobjptridx_t obj);
  148.  
  149. //process (animate) a powerup for one frame
  150. void do_powerup_frame(const d_vclip_array &Vclip, vmobjptridx_t obj);
  151. }
  152. #endif
  153. #endif
  154.  
  155. // Diminish shields and energy towards max in case they exceeded it.
  156. extern void diminish_towards_max(void);
  157.  
  158. #ifdef dsx
  159. namespace dsx {
  160. extern void do_megawow_powerup(int quantity);
  161.  
  162. }
  163. #endif
  164. void powerup_basic_str(int redadd, int greenadd, int blueadd, int score, const char *str) __attribute_nonnull();
  165. extern void powerup_basic(int redadd, int greenadd, int blueadd, int score, const char *format, ...) __attribute_format_printf(5, 6);
  166. #define powerup_basic(A1,A2,A3,A4,F,...)        dxx_call_printf_checked(powerup_basic,powerup_basic_str,(A1,A2,A3,A4),(F),##__VA_ARGS__)
  167.  
  168. #endif
  169.