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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Code for powerup objects.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2012-07-01 02:54:33 +00:00
|
|
|
#include "maths.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
#include "vecmat.h"
|
|
|
|
#include "gr.h"
|
|
|
|
#include "3d.h"
|
2012-07-07 18:35:06 +00:00
|
|
|
#include "dxxerror.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
#include "inferno.h"
|
|
|
|
#include "object.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "key.h"
|
|
|
|
#include "fireball.h"
|
|
|
|
#include "powerup.h"
|
|
|
|
#include "gauges.h"
|
|
|
|
#include "sounds.h"
|
|
|
|
#include "player.h"
|
2014-01-12 23:00:43 +00:00
|
|
|
#include "physfs-serial.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
#include "text.h"
|
|
|
|
#include "weapon.h"
|
|
|
|
#include "laser.h"
|
|
|
|
#include "scores.h"
|
|
|
|
#include "multi.h"
|
2015-01-29 04:27:36 +00:00
|
|
|
#include "segment.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
#include "lighting.h"
|
|
|
|
#include "controls.h"
|
|
|
|
#include "kconfig.h"
|
|
|
|
#include "newdemo.h"
|
|
|
|
#include "escort.h"
|
|
|
|
#ifdef EDITOR
|
|
|
|
#include "gr.h" // for powerup outline drawing
|
|
|
|
#include "editor/editor.h"
|
|
|
|
#endif
|
2015-04-19 04:18:51 +00:00
|
|
|
#include "hudmsg.h"
|
2008-04-13 00:28:36 +00:00
|
|
|
#include "playsave.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-01-18 18:02:02 +00:00
|
|
|
unsigned N_powerup_types;
|
|
|
|
array<powerup_type_info, MAX_POWERUP_TYPES> Powerup_info;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//process this powerup for this frame
|
2014-10-02 03:02:34 +00:00
|
|
|
void do_powerup_frame(const vobjptridx_t obj)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
fix fudge;
|
|
|
|
vclip_info *vci = &obj->rtype.vclip_info;
|
|
|
|
vclip *vc = &Vclip[vci->vclip_num];
|
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
fudge = 0;
|
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2013-12-24 04:53:59 +00:00
|
|
|
long objnum = obj;
|
2012-12-02 06:57:22 +00:00
|
|
|
fudge = (FrameTime * (objnum&3)) >> 4;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
vci->frametime -= FrameTime+fudge;
|
|
|
|
|
|
|
|
while (vci->frametime < 0 ) {
|
|
|
|
|
|
|
|
vci->frametime += vc->frame_time;
|
|
|
|
if (vci->framenum >= vc->num_frames)
|
|
|
|
vci->framenum=0;
|
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
if (vci->framenum < 0)
|
|
|
|
vci->framenum = vc->num_frames-1;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2012-12-02 06:57:22 +00:00
|
|
|
|
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
|
|
|
if (objnum&1)
|
|
|
|
{
|
|
|
|
if (vci->framenum)
|
|
|
|
vci->framenum--;
|
|
|
|
else
|
|
|
|
vci->framenum = vc->num_frames-1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
if (vci->framenum >= vc->num_frames-1)
|
|
|
|
vci->framenum=0;
|
|
|
|
else
|
|
|
|
vci->framenum++;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (obj->lifeleft <= 0) {
|
2015-11-19 03:23:34 +00:00
|
|
|
object_create_explosion(vsegptridx(obj->segnum), obj->pos, F1_0*7/2, VCLIP_POWERUP_DISAPPEARANCE);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
if ( Vclip[VCLIP_POWERUP_DISAPPEARANCE].sound_num > -1 )
|
2013-12-24 04:53:59 +00:00
|
|
|
digi_link_sound_to_object( Vclip[VCLIP_POWERUP_DISAPPEARANCE].sound_num, obj, 0, F1_0);
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-02 03:02:34 +00:00
|
|
|
void draw_powerup(const vobjptridx_t obj)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2014-11-30 22:09:23 +00:00
|
|
|
draw_object_blob(obj, Vclip[obj->rtype.vclip_info.vclip_num].frames[obj->rtype.vclip_info.framenum] );
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
2013-12-08 23:37:40 +00:00
|
|
|
static void _powerup_basic_nonhud(int redadd, int greenadd, int blueadd, int score)
|
|
|
|
{
|
|
|
|
PALETTE_FLASH_ADD(redadd,greenadd,blueadd);
|
|
|
|
add_points_to_score(score);
|
|
|
|
}
|
|
|
|
|
|
|
|
void (powerup_basic)(int redadd, int greenadd, int blueadd, int score, const char *format, ...)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, format );
|
2013-06-23 16:19:50 +00:00
|
|
|
HUD_init_message_va(HM_DEFAULT, format, args);
|
2006-03-20 17:12:09 +00:00
|
|
|
va_end(args);
|
2013-12-08 23:37:40 +00:00
|
|
|
_powerup_basic_nonhud(redadd, greenadd, blueadd, score);
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-12-08 23:37:40 +00:00
|
|
|
void powerup_basic_str(int redadd, int greenadd, int blueadd, int score, const char *str)
|
|
|
|
{
|
|
|
|
HUD_init_message_literal(HM_DEFAULT, str);
|
|
|
|
_powerup_basic_nonhud(redadd, greenadd, blueadd, score);
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//#ifndef RELEASE
|
|
|
|
// Give the megawow powerup!
|
|
|
|
void do_megawow_powerup(int quantity)
|
|
|
|
{
|
|
|
|
powerup_basic(30, 0, 30, 1, "MEGA-WOWIE-ZOWIE!");
|
2015-11-07 21:55:59 +00:00
|
|
|
auto &player_info = get_local_plrobj().ctype.player_info;
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
2015-11-07 21:55:59 +00:00
|
|
|
player_info.primary_weapon_flags = (HAS_LASER_FLAG | HAS_VULCAN_FLAG | HAS_SPREADFIRE_FLAG | HAS_PLASMA_FLAG | HAS_FUSION_FLAG);
|
2013-03-03 01:03:33 +00:00
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2015-11-07 21:55:59 +00:00
|
|
|
player_info.primary_weapon_flags = (HAS_LASER_FLAG | HAS_VULCAN_FLAG | HAS_SPREADFIRE_FLAG | HAS_PLASMA_FLAG | HAS_FUSION_FLAG) | (HAS_GAUSS_FLAG | HAS_HELIX_FLAG | HAS_PHOENIX_FLAG | HAS_OMEGA_FLAG);
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_vulcan_ammo() = VULCAN_AMMO_MAX;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-10-30 02:52:56 +00:00
|
|
|
auto &secondary_ammo = get_local_player_secondary_ammo();
|
2014-09-26 02:42:10 +00:00
|
|
|
for (int i=0; i<3; i++)
|
2015-10-30 02:52:56 +00:00
|
|
|
secondary_ammo[i] = quantity;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-09-26 02:42:10 +00:00
|
|
|
for (int i=3; i<MAX_SECONDARY_WEAPONS; i++)
|
2015-10-30 02:52:56 +00:00
|
|
|
secondary_ammo[i] = quantity/5;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-10-30 02:52:55 +00:00
|
|
|
get_local_player_energy() = F1_0*200;
|
2015-10-30 02:52:55 +00:00
|
|
|
get_local_player_shields() = F1_0*200;
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_QUAD_LASERS;
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
2015-11-07 21:55:59 +00:00
|
|
|
const auto laser_level = MAX_LASER_LEVEL;
|
2013-03-03 01:03:33 +00:00
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2013-08-11 16:03:47 +00:00
|
|
|
if (game_mode_hoard())
|
2015-10-30 02:52:56 +00:00
|
|
|
secondary_ammo[PROXIMITY_INDEX] = 12;
|
2015-11-07 21:55:59 +00:00
|
|
|
const auto laser_level = MAX_SUPER_LASER_LEVEL;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2015-11-07 21:55:59 +00:00
|
|
|
if (Newdemo_state == ND_STATE_RECORDING)
|
|
|
|
newdemo_record_laser_level(player_info.laser_level, laser_level);
|
|
|
|
player_info.laser_level = laser_level;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
update_laser_weapon_info();
|
|
|
|
|
|
|
|
}
|
|
|
|
//#endif
|
|
|
|
|
2013-10-27 22:00:14 +00:00
|
|
|
static int pick_up_energy(void)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
int used=0;
|
|
|
|
|
2015-10-30 02:52:55 +00:00
|
|
|
if (get_local_player_energy() < MAX_ENERGY) {
|
2006-03-20 17:12:09 +00:00
|
|
|
fix boost;
|
|
|
|
boost = 3*F1_0 + 3*F1_0*(NDL - Difficulty_level);
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
if (Difficulty_level == 0)
|
|
|
|
boost += boost/2;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2015-10-30 02:52:55 +00:00
|
|
|
get_local_player_energy() += boost;
|
|
|
|
if (get_local_player_energy() > MAX_ENERGY)
|
|
|
|
get_local_player_energy() = MAX_ENERGY;
|
|
|
|
powerup_basic(15,15,7, ENERGY_SCORE, "%s %s %d",TXT_ENERGY,TXT_BOOSTED_TO,f2ir(get_local_player_energy()));
|
2006-03-20 17:12:09 +00:00
|
|
|
used=1;
|
|
|
|
} else
|
2011-04-11 19:27:31 +00:00
|
|
|
HUD_init_message(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, TXT_MAXED_OUT,TXT_ENERGY);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
return used;
|
|
|
|
}
|
|
|
|
|
2013-10-27 22:00:14 +00:00
|
|
|
static int pick_up_vulcan_ammo(void)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2015-04-19 04:18:52 +00:00
|
|
|
int used=0;
|
2015-04-19 04:18:53 +00:00
|
|
|
if (pick_up_vulcan_ammo(VULCAN_AMMO_AMOUNT, false)) {
|
2006-03-20 17:12:09 +00:00
|
|
|
powerup_basic(7, 14, 21, VULCAN_AMMO_SCORE, "%s!", TXT_VULCAN_AMMO);
|
|
|
|
used = 1;
|
|
|
|
} else {
|
2015-11-07 21:55:59 +00:00
|
|
|
const auto max = PLAYER_MAX_AMMO(get_local_plrobj(), VULCAN_AMMO_MAX);
|
2016-02-20 17:28:11 +00:00
|
|
|
HUD_init_message(HM_DEFAULT | HM_REDUNDANT | HM_MAYDUPL, "%s %d %s!", TXT_ALREADY_HAVE, vulcan_ammo_scale(max), TXT_VULCAN_ROUNDS);
|
2006-03-20 17:12:09 +00:00
|
|
|
used = 0;
|
|
|
|
}
|
|
|
|
return used;
|
|
|
|
}
|
|
|
|
|
|
|
|
// returns true if powerup consumed
|
2014-10-02 03:02:34 +00:00
|
|
|
int do_powerup(const vobjptridx_t obj)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
int used=0;
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
int vulcan_ammo_to_add_with_cannon;
|
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
int special_used=0; //for when hitting vulcan cannon gets vulcan ammo
|
|
|
|
|
2015-12-15 04:09:35 +00:00
|
|
|
if (Player_dead_state != player_dead_state::no ||
|
|
|
|
ConsoleObject->type == OBJ_GHOST ||
|
|
|
|
get_local_player_shields() < 0)
|
2006-03-20 17:12:09 +00:00
|
|
|
return 0;
|
|
|
|
|
2010-12-22 00:17:59 +00:00
|
|
|
if ((obj->ctype.powerup_info.flags & PF_SPAT_BY_PLAYER) && obj->ctype.powerup_info.creation_time>0 && GameTime64<obj->ctype.powerup_info.creation_time+i2f(2))
|
2006-03-20 17:12:09 +00:00
|
|
|
return 0; //not enough time elapsed
|
|
|
|
|
2010-11-28 11:08:16 +00:00
|
|
|
if (Game_mode & GM_MULTI)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* The fact: Collecting a powerup is decided Client-side and due to PING it takes time for other players to know if one collected a powerup actually. This may lead to the case two players collect the same powerup!
|
|
|
|
* The solution: Let us check if someone else is closer to a powerup and if so, do not collect it.
|
|
|
|
* NOTE: Player positions computed by 'shortpos' and PING can still cause a small margin of error.
|
|
|
|
*/
|
|
|
|
vms_vector tvec;
|
2014-10-01 02:28:41 +00:00
|
|
|
fix mydist = vm_vec_normalized_dir(tvec, obj->pos, ConsoleObject->pos);
|
2010-11-28 11:08:16 +00:00
|
|
|
|
2014-09-20 23:47:27 +00:00
|
|
|
for (uint_fast32_t i = 0; i < MAX_PLAYERS; i++)
|
2010-11-28 11:08:16 +00:00
|
|
|
{
|
|
|
|
if (i == Player_num || Players[i].connected != CONNECT_PLAYING)
|
|
|
|
continue;
|
2015-10-03 17:17:49 +00:00
|
|
|
const auto &&o = vcobjptr(Players[i].objnum);
|
|
|
|
if (o->type == OBJ_GHOST)
|
2010-11-28 11:08:16 +00:00
|
|
|
continue;
|
2015-10-03 17:17:49 +00:00
|
|
|
if (mydist > vm_vec_normalized_dir(tvec, obj->pos, o->pos))
|
2010-11-28 11:08:16 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-07 21:55:59 +00:00
|
|
|
auto &player_info = get_local_plrobj().ctype.player_info;
|
2013-10-07 23:52:33 +00:00
|
|
|
int id=get_powerup_id(obj);
|
|
|
|
switch (get_powerup_id(obj)) {
|
2006-03-20 17:12:09 +00:00
|
|
|
case POW_EXTRA_LIFE:
|
2015-07-25 23:10:46 +00:00
|
|
|
get_local_player().lives++;
|
2013-12-08 23:37:40 +00:00
|
|
|
powerup_basic_str(15, 15, 15, 0, TXT_EXTRA_LIFE);
|
2006-03-20 17:12:09 +00:00
|
|
|
used=1;
|
|
|
|
break;
|
|
|
|
case POW_ENERGY:
|
|
|
|
used = pick_up_energy();
|
|
|
|
break;
|
|
|
|
case POW_SHIELD_BOOST:
|
2015-10-30 02:52:55 +00:00
|
|
|
if (get_local_player_shields() < MAX_SHIELDS) {
|
2006-03-20 17:12:09 +00:00
|
|
|
fix boost = 3*F1_0 + 3*F1_0*(NDL - Difficulty_level);
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
if (Difficulty_level == 0)
|
|
|
|
boost += boost/2;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2015-10-30 02:52:55 +00:00
|
|
|
get_local_player_shields() += boost;
|
|
|
|
if (get_local_player_shields() > MAX_SHIELDS)
|
|
|
|
get_local_player_shields() = MAX_SHIELDS;
|
|
|
|
powerup_basic(0, 0, 15, SHIELD_SCORE, "%s %s %d",TXT_SHIELD,TXT_BOOSTED_TO,f2ir(get_local_player_shields()));
|
2006-03-20 17:12:09 +00:00
|
|
|
used=1;
|
|
|
|
} else
|
2011-04-11 19:27:31 +00:00
|
|
|
HUD_init_message(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, TXT_MAXED_OUT,TXT_SHIELD);
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
case POW_LASER:
|
2015-11-07 21:55:59 +00:00
|
|
|
if (player_info.laser_level >= MAX_LASER_LEVEL) {
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
2015-11-07 21:55:59 +00:00
|
|
|
player_info.laser_level = MAX_LASER_LEVEL;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2011-04-11 19:27:31 +00:00
|
|
|
HUD_init_message(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, TXT_MAXED_OUT,TXT_LASER);
|
2006-03-20 17:12:09 +00:00
|
|
|
} else {
|
|
|
|
if (Newdemo_state == ND_STATE_RECORDING)
|
2015-11-07 21:55:59 +00:00
|
|
|
newdemo_record_laser_level(player_info.laser_level, player_info.laser_level + 1);
|
|
|
|
++ player_info.laser_level;
|
|
|
|
powerup_basic(10, 0, 10, LASER_SCORE, "%s %s %d",TXT_LASER,TXT_BOOSTED_TO, player_info.laser_level+1);
|
2006-03-20 17:12:09 +00:00
|
|
|
update_laser_weapon_info();
|
2015-10-18 21:01:18 +00:00
|
|
|
pick_up_primary (primary_weapon_index_t::LASER_INDEX);
|
2006-03-20 17:12:09 +00:00
|
|
|
used=1;
|
|
|
|
}
|
|
|
|
if (!used && !(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
break;
|
|
|
|
case POW_MISSILE_1:
|
|
|
|
used=pick_up_secondary(CONCUSSION_INDEX,1);
|
|
|
|
break;
|
|
|
|
case POW_MISSILE_4:
|
|
|
|
used=pick_up_secondary(CONCUSSION_INDEX,4);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_KEY_BLUE:
|
2015-10-30 02:52:56 +00:00
|
|
|
if (get_local_player_flags() & PLAYER_FLAGS_BLUE_KEY)
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
2015-08-05 02:59:02 +00:00
|
|
|
multi_digi_play_sample(Powerup_info[get_powerup_id(obj)].hit_sound, F1_0);
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_BLUE_KEY;
|
2006-03-20 17:12:09 +00:00
|
|
|
powerup_basic(0, 0, 15, KEY_SCORE, "%s %s",TXT_BLUE,TXT_ACCESS_GRANTED);
|
|
|
|
if (Game_mode & GM_MULTI)
|
|
|
|
used=0;
|
|
|
|
else
|
|
|
|
used=1;
|
|
|
|
invalidate_escort_goal();
|
|
|
|
break;
|
|
|
|
case POW_KEY_RED:
|
2015-10-30 02:52:56 +00:00
|
|
|
if (get_local_player_flags() & PLAYER_FLAGS_RED_KEY)
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
2015-08-05 02:59:02 +00:00
|
|
|
multi_digi_play_sample(Powerup_info[get_powerup_id(obj)].hit_sound, F1_0);
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_RED_KEY;
|
2006-03-20 17:12:09 +00:00
|
|
|
powerup_basic(15, 0, 0, KEY_SCORE, "%s %s",TXT_RED,TXT_ACCESS_GRANTED);
|
|
|
|
if (Game_mode & GM_MULTI)
|
|
|
|
used=0;
|
|
|
|
else
|
|
|
|
used=1;
|
|
|
|
invalidate_escort_goal();
|
|
|
|
break;
|
|
|
|
case POW_KEY_GOLD:
|
2015-10-30 02:52:56 +00:00
|
|
|
if (get_local_player_flags() & PLAYER_FLAGS_GOLD_KEY)
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
2015-08-05 02:59:02 +00:00
|
|
|
multi_digi_play_sample(Powerup_info[get_powerup_id(obj)].hit_sound, F1_0);
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_GOLD_KEY;
|
2006-03-20 17:12:09 +00:00
|
|
|
powerup_basic(15, 15, 7, KEY_SCORE, "%s %s",TXT_YELLOW,TXT_ACCESS_GRANTED);
|
|
|
|
if (Game_mode & GM_MULTI)
|
|
|
|
used=0;
|
|
|
|
else
|
|
|
|
used=1;
|
|
|
|
invalidate_escort_goal();
|
|
|
|
break;
|
|
|
|
case POW_QUAD_FIRE:
|
2015-10-30 02:52:56 +00:00
|
|
|
if (!(get_local_player_flags() & PLAYER_FLAGS_QUAD_LASERS)) {
|
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_QUAD_LASERS;
|
2006-03-20 17:12:09 +00:00
|
|
|
powerup_basic(15, 15, 7, QUAD_FIRE_SCORE, "%s!",TXT_QUAD_LASERS);
|
|
|
|
update_laser_weapon_info();
|
|
|
|
used=1;
|
|
|
|
} else
|
2011-04-11 19:27:31 +00:00
|
|
|
HUD_init_message(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, "%s %s!",TXT_ALREADY_HAVE,TXT_QUAD_LASERS);
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!used && !(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_VULCAN_WEAPON:
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
2015-10-18 21:01:18 +00:00
|
|
|
if ((used = pick_up_primary(primary_weapon_index_t::VULCAN_INDEX)) != 0) {
|
2013-03-03 01:03:33 +00:00
|
|
|
vulcan_ammo_to_add_with_cannon = obj->ctype.powerup_info.count;
|
|
|
|
if (vulcan_ammo_to_add_with_cannon < VULCAN_WEAPON_AMMO_AMOUNT) vulcan_ammo_to_add_with_cannon = VULCAN_WEAPON_AMMO_AMOUNT;
|
2015-04-19 04:18:53 +00:00
|
|
|
pick_up_vulcan_ammo(vulcan_ammo_to_add_with_cannon);
|
2013-03-03 01:03:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//added/edited 8/3/98 by Victor Rachels to fix vulcan multi bug
|
|
|
|
//check if multi, if so, pick up ammo w/o using, set ammo left. else, normal
|
|
|
|
|
|
|
|
//killed 8/27/98 by Victor Rachels to fix vulcan ammo multiplying. new way
|
|
|
|
// is by spewing the current held ammo when dead.
|
|
|
|
//-killed if (!used && (Game_mode & GM_MULTI))
|
|
|
|
//-killed {
|
|
|
|
//-killed int tempcount;
|
|
|
|
//-killed tempcount=Players[Player_num].primary_ammo[VULCAN_INDEX];
|
|
|
|
//-killed if (pick_up_ammo(CLASS_PRIMARY, VULCAN_INDEX, obj->ctype.powerup_info.count))
|
|
|
|
//-killed obj->ctype.powerup_info.count -= Players[Player_num].primary_ammo[VULCAN_INDEX]-tempcount;
|
|
|
|
//-killed }
|
|
|
|
//end kill - Victor Rachels
|
|
|
|
|
|
|
|
if (!used && !(Game_mode & GM_MULTI) )
|
|
|
|
//end addition/edit - Victor Rachels
|
|
|
|
used = pick_up_vulcan_ammo();
|
|
|
|
break;
|
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
case POW_GAUSS_WEAPON: {
|
|
|
|
int ammo = obj->ctype.powerup_info.count;
|
|
|
|
|
2015-10-18 21:01:18 +00:00
|
|
|
used = pick_up_primary((get_powerup_id(obj) == POW_VULCAN_WEAPON)
|
|
|
|
? primary_weapon_index_t::VULCAN_INDEX
|
|
|
|
: primary_weapon_index_t::GAUSS_INDEX
|
|
|
|
);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//didn't get the weapon (because we already have it), but
|
|
|
|
//maybe snag some of the ammo. if single-player, grab all the ammo
|
|
|
|
//and remove the powerup. If multi-player take ammo in excess of
|
|
|
|
//the amount in a powerup, and leave the rest.
|
|
|
|
if (! used)
|
|
|
|
if ((Game_mode & GM_MULTI) )
|
|
|
|
ammo -= VULCAN_AMMO_AMOUNT; //don't let take all ammo
|
|
|
|
|
|
|
|
if (ammo > 0) {
|
|
|
|
int ammo_used;
|
2015-04-19 04:18:53 +00:00
|
|
|
ammo_used = pick_up_vulcan_ammo(ammo);
|
2006-03-20 17:12:09 +00:00
|
|
|
obj->ctype.powerup_info.count -= ammo_used;
|
|
|
|
if (!used && ammo_used) {
|
|
|
|
powerup_basic(7, 14, 21, VULCAN_AMMO_SCORE, "%s!", TXT_VULCAN_AMMO);
|
|
|
|
special_used = 1;
|
|
|
|
id = POW_VULCAN_AMMO; //set new id for making sound at end of this function
|
|
|
|
if (obj->ctype.powerup_info.count == 0)
|
|
|
|
used = 1; //say used if all ammo taken
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
case POW_SPREADFIRE_WEAPON:
|
2015-10-18 21:01:18 +00:00
|
|
|
used = pick_up_primary(primary_weapon_index_t::SPREADFIRE_INDEX);
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!used && !(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
break;
|
|
|
|
case POW_PLASMA_WEAPON:
|
2015-10-18 21:01:18 +00:00
|
|
|
used = pick_up_primary(primary_weapon_index_t::PLASMA_INDEX);
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!used && !(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
break;
|
|
|
|
case POW_FUSION_WEAPON:
|
2015-10-18 21:01:18 +00:00
|
|
|
used = pick_up_primary(primary_weapon_index_t::FUSION_INDEX);
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!used && !(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
break;
|
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
case POW_HELIX_WEAPON:
|
2015-10-18 21:01:18 +00:00
|
|
|
used = pick_up_primary(primary_weapon_index_t::HELIX_INDEX);
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!used && !(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_PHOENIX_WEAPON:
|
2015-10-18 21:01:18 +00:00
|
|
|
used = pick_up_primary(primary_weapon_index_t::PHOENIX_INDEX);
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!used && !(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_OMEGA_WEAPON:
|
2015-10-18 21:01:18 +00:00
|
|
|
used = pick_up_primary(primary_weapon_index_t::OMEGA_INDEX);
|
2006-03-20 17:12:09 +00:00
|
|
|
if (used)
|
|
|
|
Omega_charge = obj->ctype.powerup_info.count;
|
|
|
|
if (!used && !(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
break;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
case POW_PROXIMITY_WEAPON:
|
|
|
|
used=pick_up_secondary(PROXIMITY_INDEX,4);
|
|
|
|
break;
|
|
|
|
case POW_SMARTBOMB_WEAPON:
|
|
|
|
used=pick_up_secondary(SMART_INDEX,1);
|
|
|
|
break;
|
|
|
|
case POW_MEGA_WEAPON:
|
|
|
|
used=pick_up_secondary(MEGA_INDEX,1);
|
|
|
|
break;
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
case POW_SMISSILE1_1:
|
|
|
|
used=pick_up_secondary(SMISSILE1_INDEX,1);
|
|
|
|
break;
|
|
|
|
case POW_SMISSILE1_4:
|
|
|
|
used=pick_up_secondary(SMISSILE1_INDEX,4);
|
|
|
|
break;
|
|
|
|
case POW_GUIDED_MISSILE_1:
|
|
|
|
used=pick_up_secondary(GUIDED_INDEX,1);
|
|
|
|
break;
|
|
|
|
case POW_GUIDED_MISSILE_4:
|
|
|
|
used=pick_up_secondary(GUIDED_INDEX,4);
|
|
|
|
break;
|
|
|
|
case POW_SMART_MINE:
|
|
|
|
used=pick_up_secondary(SMART_MINE_INDEX,4);
|
|
|
|
break;
|
|
|
|
case POW_MERCURY_MISSILE_1:
|
|
|
|
used=pick_up_secondary(SMISSILE4_INDEX,1);
|
|
|
|
break;
|
|
|
|
case POW_MERCURY_MISSILE_4:
|
|
|
|
used=pick_up_secondary(SMISSILE4_INDEX,4);
|
|
|
|
break;
|
|
|
|
case POW_EARTHSHAKER_MISSILE:
|
|
|
|
used=pick_up_secondary(SMISSILE5_INDEX,1);
|
|
|
|
break;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
case POW_VULCAN_AMMO:
|
|
|
|
used = pick_up_vulcan_ammo();
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
if (!used && !(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_vulcan_ammo();
|
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
case POW_HOMING_AMMO_1:
|
|
|
|
used=pick_up_secondary(HOMING_INDEX,1);
|
|
|
|
break;
|
|
|
|
case POW_HOMING_AMMO_4:
|
|
|
|
used=pick_up_secondary(HOMING_INDEX,4);
|
|
|
|
break;
|
|
|
|
case POW_CLOAK:
|
2015-10-30 02:52:56 +00:00
|
|
|
if (get_local_player_flags() & PLAYER_FLAGS_CLOAKED) {
|
2011-04-11 19:27:31 +00:00
|
|
|
HUD_init_message(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, "%s %s!",TXT_ALREADY_ARE,TXT_CLOAKED);
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
} else {
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_cloak_time() = GameTime64; // Not! changed by awareness events (like player fires laser).
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_CLOAKED;
|
2006-03-20 17:12:09 +00:00
|
|
|
ai_do_cloak_stuff();
|
|
|
|
if (Game_mode & GM_MULTI)
|
|
|
|
multi_send_cloak();
|
|
|
|
powerup_basic(-10,-10,-10, CLOAK_SCORE, "%s!",TXT_CLOAKING_DEVICE);
|
|
|
|
used = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case POW_INVULNERABILITY:
|
2015-10-30 02:52:56 +00:00
|
|
|
if (get_local_player_flags() & PLAYER_FLAGS_INVULNERABLE) {
|
2011-04-11 19:27:31 +00:00
|
|
|
HUD_init_message(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, "%s %s!",TXT_ALREADY_ARE,TXT_INVULNERABLE);
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
} else {
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_invulnerable_time() = GameTime64;
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_INVULNERABLE;
|
2006-03-20 17:12:09 +00:00
|
|
|
powerup_basic(7, 14, 21, INVULNERABILITY_SCORE, "%s!",TXT_INVULNERABILITY);
|
|
|
|
used = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#ifndef RELEASE
|
|
|
|
case POW_MEGAWOW:
|
|
|
|
do_megawow_powerup(50);
|
|
|
|
used = 1;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
case POW_FULL_MAP:
|
2015-10-30 02:52:56 +00:00
|
|
|
if (get_local_player_flags() & PLAYER_FLAGS_MAP_ALL) {
|
2011-04-11 19:27:31 +00:00
|
|
|
HUD_init_message(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, "%s %s!",TXT_ALREADY_HAVE,"the FULL MAP");
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
} else {
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_MAP_ALL;
|
2006-03-20 17:12:09 +00:00
|
|
|
powerup_basic(15, 0, 15, 0, "FULL MAP!");
|
|
|
|
used=1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_CONVERTER:
|
2015-10-30 02:52:56 +00:00
|
|
|
if (get_local_player_flags() & PLAYER_FLAGS_CONVERTER) {
|
2011-04-11 19:27:31 +00:00
|
|
|
HUD_init_message(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, "%s %s!",TXT_ALREADY_HAVE,"the Converter");
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
} else {
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_CONVERTER;
|
2008-05-07 14:02:01 +00:00
|
|
|
powerup_basic(15, 0, 15, 0, "Energy -> shield converter!");
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
used=1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_SUPER_LASER:
|
2015-11-07 21:55:59 +00:00
|
|
|
if (player_info.laser_level >= MAX_SUPER_LASER_LEVEL)
|
|
|
|
{
|
|
|
|
player_info.laser_level = MAX_SUPER_LASER_LEVEL;
|
2013-06-23 16:27:34 +00:00
|
|
|
HUD_init_message_literal(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, "SUPER LASER MAXED OUT!");
|
2006-03-20 17:12:09 +00:00
|
|
|
} else {
|
2015-11-07 21:55:59 +00:00
|
|
|
const auto old_level = player_info.laser_level;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-11-07 21:55:59 +00:00
|
|
|
if (player_info.laser_level <= MAX_LASER_LEVEL)
|
|
|
|
player_info.laser_level = MAX_LASER_LEVEL;
|
|
|
|
++ player_info.laser_level;
|
2006-03-20 17:12:09 +00:00
|
|
|
if (Newdemo_state == ND_STATE_RECORDING)
|
2015-11-07 21:55:59 +00:00
|
|
|
newdemo_record_laser_level(old_level, player_info.laser_level);
|
|
|
|
powerup_basic(10, 0, 10, LASER_SCORE, "Super Boost to Laser level %d", player_info.laser_level + 1);
|
2006-03-20 17:12:09 +00:00
|
|
|
update_laser_weapon_info();
|
2015-10-18 21:01:18 +00:00
|
|
|
if (Primary_weapon!=primary_weapon_index_t::LASER_INDEX)
|
2015-04-26 20:15:52 +00:00
|
|
|
check_to_use_primary_super_laser();
|
2006-03-20 17:12:09 +00:00
|
|
|
used=1;
|
|
|
|
}
|
|
|
|
if (!used && !(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_AMMO_RACK:
|
2015-10-30 02:52:56 +00:00
|
|
|
if (get_local_player_flags() & PLAYER_FLAGS_AMMO_RACK) {
|
2011-04-11 19:27:31 +00:00
|
|
|
HUD_init_message(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, "%s %s!",TXT_ALREADY_HAVE,"the Ammo rack");
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
}
|
|
|
|
else {
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_AMMO_RACK;
|
2015-08-05 02:59:02 +00:00
|
|
|
multi_digi_play_sample(Powerup_info[get_powerup_id(obj)].hit_sound, F1_0);
|
2006-03-20 17:12:09 +00:00
|
|
|
powerup_basic(15, 0, 15, 0, "AMMO RACK!");
|
|
|
|
used=1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_AFTERBURNER:
|
2015-10-30 02:52:56 +00:00
|
|
|
if (get_local_player_flags() & PLAYER_FLAGS_AFTERBURNER) {
|
2011-04-11 19:27:31 +00:00
|
|
|
HUD_init_message(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, "%s %s!",TXT_ALREADY_HAVE,"the Afterburner");
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
}
|
|
|
|
else {
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_AFTERBURNER;
|
2015-08-05 02:59:02 +00:00
|
|
|
multi_digi_play_sample(Powerup_info[get_powerup_id(obj)].hit_sound, F1_0);
|
2006-03-20 17:12:09 +00:00
|
|
|
powerup_basic(15, 15, 15, 0, "AFTERBURNER!");
|
|
|
|
Afterburner_charge = f1_0;
|
|
|
|
used=1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_HEADLIGHT:
|
2015-10-30 02:52:56 +00:00
|
|
|
if (get_local_player_flags() & PLAYER_FLAGS_HEADLIGHT) {
|
2011-04-11 19:27:31 +00:00
|
|
|
HUD_init_message(HM_DEFAULT|HM_REDUNDANT|HM_MAYDUPL, "%s %s!",TXT_ALREADY_HAVE,"the Headlight boost");
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!(Game_mode & GM_MULTI) )
|
|
|
|
used = pick_up_energy();
|
|
|
|
}
|
|
|
|
else {
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_HEADLIGHT;
|
2015-08-05 02:59:02 +00:00
|
|
|
multi_digi_play_sample(Powerup_info[get_powerup_id(obj)].hit_sound, F1_0);
|
2012-07-01 04:38:51 +00:00
|
|
|
powerup_basic(15, 0, 15, 0, "HEADLIGHT BOOST! (Headlight is %s)",PlayerCfg.HeadlightActiveDefault?"ON":"OFF");
|
2008-04-13 00:28:36 +00:00
|
|
|
if (PlayerCfg.HeadlightActiveDefault)
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_HEADLIGHT_ON;
|
2006-03-20 17:12:09 +00:00
|
|
|
used=1;
|
|
|
|
if (Game_mode & GM_MULTI)
|
|
|
|
multi_send_flags (Player_num);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_FLAG_BLUE:
|
2013-08-11 16:03:47 +00:00
|
|
|
if (game_mode_capture_flag())
|
2006-03-20 17:12:09 +00:00
|
|
|
if (get_team(Player_num) == TEAM_RED) {
|
|
|
|
powerup_basic(15, 0, 15, 0, "BLUE FLAG!");
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_FLAG;
|
2006-03-20 17:12:09 +00:00
|
|
|
used=1;
|
|
|
|
multi_send_got_flag (Player_num);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_HOARD_ORB:
|
2013-08-11 16:03:47 +00:00
|
|
|
if (game_mode_hoard())
|
2015-10-30 02:52:56 +00:00
|
|
|
{
|
|
|
|
auto &proximity = get_local_player_secondary_ammo()[PROXIMITY_INDEX];
|
|
|
|
if (proximity < 12) {
|
|
|
|
++ proximity;
|
2006-03-20 17:12:09 +00:00
|
|
|
powerup_basic(15, 0, 15, 0, "Orb!!!");
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_FLAG;
|
2006-03-20 17:12:09 +00:00
|
|
|
used=1;
|
|
|
|
multi_send_got_orb (Player_num);
|
|
|
|
}
|
2015-10-30 02:52:56 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case POW_FLAG_RED:
|
2013-08-11 16:03:47 +00:00
|
|
|
if (game_mode_capture_flag())
|
2006-03-20 17:12:09 +00:00
|
|
|
if (get_team(Player_num) == TEAM_BLUE) {
|
|
|
|
powerup_basic(15, 0, 15, 0, "RED FLAG!");
|
2015-10-30 02:52:56 +00:00
|
|
|
get_local_player_flags() |= PLAYER_FLAGS_FLAG;
|
2006-03-20 17:12:09 +00:00
|
|
|
used=1;
|
|
|
|
multi_send_got_flag (Player_num);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
// case POW_HOARD_ORB:
|
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
//always say used, until physics problem (getting stuck on unused powerup)
|
|
|
|
//is solved. Note also the break statements above that are commented out
|
|
|
|
//!! used=1;
|
|
|
|
|
|
|
|
if ((used || special_used) && Powerup_info[id].hit_sound > -1 ) {
|
2015-08-05 02:59:02 +00:00
|
|
|
multi_digi_play_sample(Powerup_info[id].hit_sound, F1_0);
|
2013-12-24 04:53:59 +00:00
|
|
|
detect_escort_goal_accomplished(obj);
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return used;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-12 23:00:43 +00:00
|
|
|
DEFINE_SERIAL_UDT_TO_MESSAGE(powerup_type_info, pti, (pti.vclip_num, pti.hit_sound, pti.size, pti.light));
|
|
|
|
ASSERT_SERIAL_UDT_MESSAGE_SIZE(powerup_type_info, 16);
|
|
|
|
|
2016-01-09 16:38:14 +00:00
|
|
|
void powerup_type_info_read(PHYSFS_File *fp, powerup_type_info &pti)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2014-01-12 23:00:43 +00:00
|
|
|
PHYSFSX_serialize_read(fp, pti);
|
|
|
|
}
|
|
|
|
|
2016-01-09 16:38:14 +00:00
|
|
|
void powerup_type_info_write(PHYSFS_File *fp, const powerup_type_info &pti)
|
2014-01-12 23:00:43 +00:00
|
|
|
{
|
|
|
|
PHYSFSX_serialize_write(fp, pti);
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|