| 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 |
#pragma once |
| 21 |
|
| 22 |
#include <array> |
| 23 |
#include <cstdint> |
| 24 |
#include <span> |
| 25 |
#include <type_traits> |
| 26 |
#include "fwd-object.h" |
| 27 |
#include "fwd-vclip.h" |
| 28 |
|
| 29 |
#if DXX_USE_EDITOR |
| 30 |
#include "fwd-d_array.h" |
| 31 |
#endif |
| 32 |
|
| 33 |
namespace dcx { |
| 34 |
|
| 35 |
constexpr std::integral_constant<unsigned, 196> VULCAN_WEAPON_AMMO_AMOUNT{}; |
| 36 |
constexpr uint16_t VULCAN_AMMO_AMOUNT = 49*2; |
| 37 |
|
| 38 |
constexpr std::integral_constant<unsigned, 16> POWERUP_NAME_LENGTH{}; |
| 39 |
struct powerup_type_info; |
| 40 |
|
| 41 |
void powerup_type_info_read(NamedPHYSFS_File fp, powerup_type_info &pti); |
| 42 |
void powerup_type_info_write(PHYSFS_File *fp, const powerup_type_info &pti); |
| 43 |
|
| 44 |
extern uint8_t N_powerup_types; |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
#ifdef DXX_BUILD_DESCENT |
| 49 |
namespace dsx { |
| 50 |
|
| 51 |
enum class powerup_type_t : uint8_t; |
| 52 |
|
| 53 |
#if DXX_BUILD_DESCENT == 1 |
| 54 |
constexpr std::integral_constant<unsigned, 392*2> VULCAN_AMMO_MAX{}; |
| 55 |
constexpr std::integral_constant<unsigned, 29> MAX_POWERUP_TYPES{}; |
| 56 |
#elif DXX_BUILD_DESCENT == 2 |
| 57 |
constexpr std::integral_constant<unsigned, 392*4> VULCAN_AMMO_MAX{}; |
| 58 |
constexpr std::integral_constant<unsigned, 392> GAUSS_WEAPON_AMMO_AMOUNT{}; |
| 59 |
constexpr std::integral_constant<unsigned, 50> MAX_POWERUP_TYPES{}; |
| 60 |
#endif |
| 61 |
|
| 62 |
#if DXX_USE_EDITOR |
| 63 |
using powerup_names_array = enumerated_array<std::array<char, POWERUP_NAME_LENGTH>, MAX_POWERUP_TYPES, powerup_type_t>; |
| 64 |
extern powerup_names_array Powerup_names; |
| 65 |
#endif |
| 66 |
|
| 67 |
void draw_powerup(const d_vclip_array &Vclip, grs_canvas &, const object_base &obj); |
| 68 |
int do_powerup(vmobjptridx_t obj); |
| 69 |
|
| 70 |
//process (animate) a powerup for one frame |
| 71 |
void do_powerup_frame(const d_vclip_array &Vclip, vmobjptridx_t obj); |
| 72 |
|
| 73 |
void do_megawow_powerup(object &plrobj, int quantity); |
| 74 |
|
| 75 |
void powerup_basic_str(int redadd, int greenadd, int blueadd, int score, std::span<const char> str); |
| 76 |
|
| 77 |
// Interface to object_create_egg, puts count objects of type type, id |
| 78 |
// = id in objp and then drops them. |
| 79 |
imobjptridx_t call_object_create_egg(const object_base &objp, powerup_type_t id); |
| 80 |
void call_object_create_egg(const object_base &objp, unsigned count, powerup_type_t id); |
| 81 |
} |
| 82 |
#endif |