| 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 |
* Header for fireball.c |
| 23 |
* |
| 24 |
*/ |
| 25 |
|
| 26 |
#pragma once |
| 27 |
|
| 28 |
#include <physfs.h> |
| 29 |
|
| 30 |
#include "maths.h" |
| 31 |
#include "fwd-powerup.h" |
| 32 |
#include "fwd-segment.h" |
| 33 |
#include "fwd-vecmat.h" |
| 34 |
#include "fwd-wall.h" |
| 35 |
#include "pack.h" |
| 36 |
#include "robot.h" |
| 37 |
|
| 38 |
namespace dcx { |
| 39 |
extern unsigned Num_exploding_walls; |
| 40 |
} |
| 41 |
|
| 42 |
#ifdef DXX_BUILD_DESCENT |
| 43 |
namespace dsx { |
| 44 |
|
| 45 |
#if DXX_BUILD_DESCENT == 2 |
| 46 |
struct disk_expl_wall |
| 47 |
{ |
| 48 |
uint32_t segnum; |
| 49 |
int sidenum; |
| 50 |
fix time; |
| 51 |
}; |
| 52 |
static_assert(sizeof(disk_expl_wall) == 12, "sizeof(disk_expl_wall) wrong"); |
| 53 |
#endif |
| 54 |
|
| 55 |
imobjptridx_t object_create_explosion_without_damage(const d_vclip_array &Vclip, vmsegptridx_t segnum, const vms_vector &position, fix size, vclip_index vclip_type); |
| 56 |
|
| 57 |
imobjptridx_t object_create_badass_explosion(const d_robot_info_array &Robot_info, imobjptridx_t objp, vmsegptridx_t segnum, const vms_vector &position, fix size, vclip_index vclip_type, |
| 58 |
fix maxdamage, fix maxdistance, fix maxforce, icobjptridx_t parent); |
| 59 |
|
| 60 |
// blows up a badass weapon, creating the badass explosion |
| 61 |
// return the explosion object |
| 62 |
void explode_badass_weapon(const d_robot_info_array &Robot_info, vmobjptridx_t obj,const vms_vector &pos); |
| 63 |
|
| 64 |
// blows up the player with a badass explosion |
| 65 |
void explode_badass_player(const d_robot_info_array &Robot_info, vmobjptridx_t obj); |
| 66 |
|
| 67 |
void explode_object(d_level_unique_object_state &LevelUniqueObjectState, const d_robot_info_array &Robot_info, const d_level_shared_segment_state &LevelSharedSegmentState, d_level_unique_segment_state &LevelUniqueSegmentState, vmobjptridx_t obj, fix delay_time); |
| 68 |
void do_explosion_sequence(const d_robot_info_array &Robot_info, object &obj); |
| 69 |
void do_debris_frame(const d_robot_info_array &Robot_info, vmobjptridx_t obj); // deal with debris for this frame |
| 70 |
|
| 71 |
void draw_fireball(const d_vclip_array &Vclip, grs_canvas &, vcobjptridx_t obj); |
| 72 |
|
| 73 |
void explode_wall(fvcvertptr &, vcsegptridx_t, sidenum_t sidenum, wall &); |
| 74 |
unsigned do_exploding_wall_frame(const d_robot_info_array &Robot_info, wall &); |
| 75 |
void maybe_drop_net_powerup(powerup_type_t powerup_type, bool adjust_cap, bool random_player); |
| 76 |
void maybe_replace_powerup_with_energy(object_base &del_obj); |
| 77 |
} |
| 78 |
|
| 79 |
namespace dcx { |
| 80 |
void init_exploding_walls(); |
| 81 |
enum class explosion_vclip_stage : bool |
| 82 |
{ |
| 83 |
s0, |
| 84 |
s1, |
| 85 |
}; |
| 86 |
} |
| 87 |
|
| 88 |
namespace dsx { |
| 89 |
vclip_index get_explosion_vclip(const d_robot_info_array &Robot_info, const object_base &obj, explosion_vclip_stage stage); |
| 90 |
|
| 91 |
imobjptridx_t drop_powerup(d_level_unique_object_state &LevelUniqueObjectState, const d_level_shared_segment_state &LevelSharedSegmentState, d_level_unique_segment_state &LevelUniqueSegmentState, const d_vclip_array &Vclip, powerup_type_t id, const vms_vector &init_vel, const vms_vector &pos, vmsegptridx_t segnum, bool player); |
| 92 |
bool drop_powerup(d_level_unique_object_state &LevelUniqueObjectState, const d_level_shared_segment_state &LevelSharedSegmentState, d_level_unique_segment_state &LevelUniqueSegmentState, const d_vclip_array &Vclip, powerup_type_t id, unsigned num, const vms_vector &init_vel, const vms_vector &pos, vmsegptridx_t segnum, bool player); |
| 93 |
|
| 94 |
#if DXX_BUILD_DESCENT == 2 |
| 95 |
// creates afterburner blobs behind the specified object |
| 96 |
void drop_afterburner_blobs(object &obj, int count, fix size_scale, fix lifetime); |
| 97 |
|
| 98 |
/* |
| 99 |
* reads n expl_wall structs from a PHYSFS_File and swaps if specified |
| 100 |
*/ |
| 101 |
void expl_wall_read_n_swap(fvmwallptr &, PHYSFS_File *fp, physfsx_endian swap, unsigned); |
| 102 |
void expl_wall_write(fvcwallptr &, PHYSFS_File *); |
| 103 |
extern fix Flash_effect; |
| 104 |
#endif |
| 105 |
|
| 106 |
vmsegidx_t choose_thief_recreation_segment(fvcsegptr &vcsegptr, fvcwallptr &vcwallptr, const vcsegidx_t plrseg); |
| 107 |
} |
| 108 |
#endif |