2006-03-20 17:12:09 +00:00
|
|
|
/*
|
2014-06-01 17:55:23 +00:00
|
|
|
* Portions of this file are copyright Rebirth contributors and licensed as
|
|
|
|
* described in COPYING.txt.
|
|
|
|
* Portions of this file are copyright Parallax Software and licensed
|
|
|
|
* according to the Parallax license below.
|
|
|
|
* See COPYING.txt for license details.
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
|
|
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
|
|
|
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
|
|
|
|
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
|
|
|
|
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
|
|
|
|
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
|
|
|
|
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
|
|
|
|
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
|
|
|
|
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
|
|
|
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Powerup header file.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-04-19 04:18:52 +00:00
|
|
|
#pragma once
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-06-27 02:35:22 +00:00
|
|
|
#include "dxxsconf.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
#include "vclip.h"
|
2013-12-08 23:37:40 +00:00
|
|
|
#include "fmtcheck.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2012-11-11 22:12:51 +00:00
|
|
|
#ifdef __cplusplus
|
2015-10-10 03:44:14 +00:00
|
|
|
#include "fwd-object.h"
|
2012-11-11 22:12:51 +00:00
|
|
|
|
2015-09-26 21:17:12 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
2015-04-19 04:18:53 +00:00
|
|
|
enum powerup_type_t : uint8_t
|
2012-09-01 22:24:42 +00:00
|
|
|
{
|
|
|
|
POW_EXTRA_LIFE = 0,
|
|
|
|
POW_ENERGY = 1,
|
|
|
|
POW_SHIELD_BOOST = 2,
|
|
|
|
POW_LASER = 3,
|
|
|
|
|
|
|
|
POW_KEY_BLUE = 4,
|
|
|
|
POW_KEY_RED = 5,
|
|
|
|
POW_KEY_GOLD = 6,
|
|
|
|
|
|
|
|
// POW_RADAR_ROBOTS = 7,
|
|
|
|
// POW_RADAR_POWERUPS = 8,
|
|
|
|
|
|
|
|
POW_MISSILE_1 = 10,
|
|
|
|
POW_MISSILE_4 = 11, // 4-pack MUST follow single missile
|
|
|
|
|
|
|
|
POW_QUAD_FIRE = 12,
|
|
|
|
|
|
|
|
POW_VULCAN_WEAPON = 13,
|
|
|
|
POW_SPREADFIRE_WEAPON = 14,
|
|
|
|
POW_PLASMA_WEAPON = 15,
|
|
|
|
POW_FUSION_WEAPON = 16,
|
|
|
|
POW_PROXIMITY_WEAPON = 17,
|
|
|
|
POW_HOMING_AMMO_1 = 18,
|
|
|
|
POW_HOMING_AMMO_4 = 19, // 4-pack MUST follow single missile
|
|
|
|
POW_SMARTBOMB_WEAPON = 20,
|
|
|
|
POW_MEGA_WEAPON = 21,
|
|
|
|
POW_VULCAN_AMMO = 22,
|
|
|
|
POW_CLOAK = 23,
|
|
|
|
POW_TURBO = 24,
|
|
|
|
POW_INVULNERABILITY = 25,
|
|
|
|
POW_MEGAWOW = 27,
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2012-09-01 22:24:42 +00:00
|
|
|
POW_GAUSS_WEAPON = 28,
|
|
|
|
POW_HELIX_WEAPON = 29,
|
|
|
|
POW_PHOENIX_WEAPON = 30,
|
|
|
|
POW_OMEGA_WEAPON = 31,
|
|
|
|
|
|
|
|
POW_SUPER_LASER = 32,
|
|
|
|
POW_FULL_MAP = 33,
|
|
|
|
POW_CONVERTER = 34,
|
|
|
|
POW_AMMO_RACK = 35,
|
|
|
|
POW_AFTERBURNER = 36,
|
|
|
|
POW_HEADLIGHT = 37,
|
|
|
|
|
|
|
|
POW_SMISSILE1_1 = 38,
|
|
|
|
POW_SMISSILE1_4 = 39, // 4-pack MUST follow single missile
|
|
|
|
POW_GUIDED_MISSILE_1 = 40,
|
|
|
|
POW_GUIDED_MISSILE_4 = 41, // 4-pack MUST follow single missile
|
|
|
|
POW_SMART_MINE = 42,
|
|
|
|
POW_MERCURY_MISSILE_1 = 43,
|
|
|
|
POW_MERCURY_MISSILE_4 = 44, // 4-pack MUST follow single missile
|
|
|
|
POW_EARTHSHAKER_MISSILE = 45,
|
|
|
|
|
|
|
|
POW_FLAG_BLUE = 46,
|
|
|
|
POW_FLAG_RED = 47,
|
|
|
|
|
|
|
|
POW_HOARD_ORB = 7, // use unused slot
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2012-09-01 22:24:42 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2016-06-25 23:21:36 +00:00
|
|
|
#ifdef dsx
|
2016-07-09 17:58:34 +00:00
|
|
|
namespace dcx {
|
2017-10-14 17:10:30 +00:00
|
|
|
constexpr std::integral_constant<unsigned, 16> POWERUP_NAME_LENGTH{};
|
2016-07-09 17:58:34 +00:00
|
|
|
}
|
|
|
|
|
2016-06-25 23:21:36 +00:00
|
|
|
namespace dsx {
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
2016-02-20 17:28:11 +00:00
|
|
|
#define VULCAN_AMMO_MAX (392u*2)
|
2017-10-14 17:10:30 +00:00
|
|
|
constexpr std::integral_constant<unsigned, 29> MAX_POWERUP_TYPES{};
|
2013-03-03 01:03:33 +00:00
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2016-02-20 17:28:11 +00:00
|
|
|
#define VULCAN_AMMO_MAX (392u*4)
|
2006-03-20 17:12:09 +00:00
|
|
|
#define GAUSS_WEAPON_AMMO_AMOUNT 392
|
|
|
|
|
2017-10-14 17:10:30 +00:00
|
|
|
constexpr std::integral_constant<unsigned, 50> MAX_POWERUP_TYPES{};
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2013-12-21 22:45:54 +00:00
|
|
|
#define VULCAN_WEAPON_AMMO_AMOUNT 196
|
|
|
|
#define VULCAN_AMMO_AMOUNT (49*2)
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2016-09-11 18:49:16 +00:00
|
|
|
#if DXX_USE_EDITOR
|
2016-07-09 17:58:34 +00:00
|
|
|
using powerup_names_array = array<array<char, POWERUP_NAME_LENGTH>, MAX_POWERUP_TYPES>;
|
|
|
|
extern powerup_names_array Powerup_names;
|
|
|
|
#endif
|
2016-06-25 23:21:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2018-10-08 03:58:48 +00:00
|
|
|
namespace dcx {
|
|
|
|
|
2014-06-21 23:55:24 +00:00
|
|
|
struct powerup_type_info : public prohibit_void_ptr<powerup_type_info>
|
2013-12-22 22:03:07 +00:00
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
int vclip_num;
|
|
|
|
int hit_sound;
|
|
|
|
fix size; // 3d size of longest dimension
|
|
|
|
fix light; // amount of light cast by this powerup, set in bitmaps.tbl
|
2014-01-12 23:00:43 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2016-01-09 16:38:14 +00:00
|
|
|
void powerup_type_info_read(PHYSFS_File *fp, powerup_type_info &pti);
|
|
|
|
void powerup_type_info_write(PHYSFS_File *fp, const powerup_type_info &pti);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2016-06-25 23:21:36 +00:00
|
|
|
extern unsigned N_powerup_types;
|
2018-10-21 00:24:07 +00:00
|
|
|
void draw_powerup(const d_vclip_array &Vclip, grs_canvas &, const object_base &obj);
|
2016-04-06 03:34:14 +00:00
|
|
|
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//returns true if powerup consumed
|
2016-08-25 04:05:32 +00:00
|
|
|
#ifdef dsx
|
|
|
|
namespace dsx {
|
2018-10-08 03:58:48 +00:00
|
|
|
using d_powerup_info_array = array<powerup_type_info, MAX_POWERUP_TYPES>;
|
|
|
|
extern d_powerup_info_array Powerup_info;
|
2017-06-10 03:31:02 +00:00
|
|
|
int do_powerup(vmobjptridx_t obj);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//process (animate) a powerup for one frame
|
2018-10-21 00:24:07 +00:00
|
|
|
void do_powerup_frame(const d_vclip_array &Vclip, vmobjptridx_t obj);
|
2016-06-25 23:21:36 +00:00
|
|
|
}
|
2015-11-26 02:56:55 +00:00
|
|
|
#endif
|
2018-10-08 03:58:48 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// Diminish shields and energy towards max in case they exceeded it.
|
|
|
|
extern void diminish_towards_max(void);
|
|
|
|
|
2016-08-25 04:05:32 +00:00
|
|
|
#ifdef dsx
|
|
|
|
namespace dsx {
|
2006-03-20 17:12:09 +00:00
|
|
|
extern void do_megawow_powerup(int quantity);
|
|
|
|
|
2016-08-25 04:05:32 +00:00
|
|
|
}
|
|
|
|
#endif
|
2013-12-08 23:37:40 +00:00
|
|
|
void powerup_basic_str(int redadd, int greenadd, int blueadd, int score, const char *str) __attribute_nonnull();
|
2013-06-27 02:35:22 +00:00
|
|
|
extern void powerup_basic(int redadd, int greenadd, int blueadd, int score, const char *format, ...) __attribute_format_printf(5, 6);
|
2013-12-08 23:37:40 +00:00
|
|
|
#define powerup_basic(A1,A2,A3,A4,F,...) dxx_call_printf_checked(powerup_basic,powerup_basic_str,(A1,A2,A3,A4),(F),##__VA_ARGS__)
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2012-11-11 22:12:51 +00:00
|
|
|
#endif
|