FS2_Open
Open source remastering of the Freespace 2 engine
|
#include "asteroid/asteroid.h"
#include "debugconsole/console.h"
#include "fireball/fireballs.h"
#include "freespace2/freespace.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/compatibility.h"
#include "globalincs/linklist.h"
#include "globalincs/systemvars.h"
#include "hud/hud.h"
#include "hud/hudescort.h"
#include "hud/hudgauges.h"
#include "hud/hudtarget.h"
#include "iff_defs/iff_defs.h"
#include "io/timer.h"
#include "localization/localize.h"
#include "math/staticrand.h"
#include "math/vecmat.h"
#include "model/model.h"
#include "network/multi.h"
#include "network/multimsgs.h"
#include "network/multiutil.h"
#include "object/objcollide.h"
#include "object/object.h"
#include "parse/parselo.h"
#include "parse/scripting.h"
#include "particle/particle.h"
#include "render/3d.h"
#include "ship/ship.h"
#include "ship/shiphit.h"
#include "species_defs/species_defs.h"
#include "stats/scoring.h"
#include "weapon/weapon.h"
#include <algorithm>
Go to the source code of this file.
Macros | |
#define | ASTEROID_OBJ_USED (1<<0) |
#define | MAX_ASTEROID_OBJS MAX_ASTEROIDS |
#define | SMALL_DEBRIS_WEIGHT 8 |
#define | MEDIUM_DEBRIS_WEIGHT 4 |
#define | LARGE_DEBRIS_WEIGHT 1 |
#define | ASTEROID_CHECK_WRAP_TIMESTAMP 2000 |
#define | ASTEROID_UPDATE_COLLIDE_TIMESTAMP 2000 |
#define | ASTEROID_MIN_COLLIDE_TIME 24 |
#define ASTEROID_CHECK_WRAP_TIMESTAMP 2000 |
Definition at line 73 of file asteroid.cpp.
#define ASTEROID_MIN_COLLIDE_TIME 24 |
Definition at line 75 of file asteroid.cpp.
#define ASTEROID_OBJ_USED (1<<0) |
Definition at line 47 of file asteroid.cpp.
#define ASTEROID_UPDATE_COLLIDE_TIMESTAMP 2000 |
Definition at line 74 of file asteroid.cpp.
#define LARGE_DEBRIS_WEIGHT 1 |
Definition at line 55 of file asteroid.cpp.
#define MAX_ASTEROID_OBJS MAX_ASTEROIDS |
Definition at line 48 of file asteroid.cpp.
#define MEDIUM_DEBRIS_WEIGHT 4 |
Definition at line 54 of file asteroid.cpp.
#define SMALL_DEBRIS_WEIGHT 8 |
Definition at line 53 of file asteroid.cpp.
Create a normalized vector generally in the direction from *hitpos to other_obj->pos
Definition at line 1216 of file asteroid.cpp.
Play sound when asteroid explodes
Definition at line 1299 of file asteroid.cpp.
Create an asteroid that will hit object *objp in delta_time seconds
Definition at line 748 of file asteroid.cpp.
Prevent speed from getting too huge so it's hard to catch up to an asteroid.
Definition at line 142 of file asteroid.cpp.
int asteroid_check_collision | ( | object * | pasteroid, |
object * | other_obj, | ||
vec3d * | hitpos, | ||
collision_info_struct * | asteroid_hit_info | ||
) |
Definition at line 918 of file asteroid.cpp.
Find the object number of the object the asteroid is about to impact
Definition at line 1781 of file asteroid.cpp.
int asteroid_count | ( | ) |
Return the number of active asteroids
Definition at line 1473 of file asteroid.cpp.
object* asteroid_create | ( | asteroid_field * | asfieldp, |
int | asteroid_type, | ||
int | asteroid_subtype | ||
) |
Create a single asteroid
Definition at line 231 of file asteroid.cpp.
void asteroid_create_all | ( | ) |
Create all the asteroids for the mission
Definition at line 529 of file asteroid.cpp.
Create asteroid explosion
Definition at line 1267 of file asteroid.cpp.
Delete asteroid from Asteroid_used_list
Definition at line 826 of file asteroid.cpp.
Do the area effect for an asteroid exploding
asteroid_objp | object pointer to asteriod causing explosion |
Definition at line 1329 of file asteroid.cpp.
void asteroid_frame | ( | ) |
Definition at line 2122 of file asteroid.cpp.
Return multiplier on asteroid radius for fireball
Definition at line 1238 of file asteroid.cpp.
Definition at line 1600 of file asteroid.cpp.
Upon asteroid asteroid_obj being hit. Apply damage and maybe make it break into smaller asteroids.
pasteroid_obj | pointer to asteroid object getting hit |
other_obj | object that hit asteroid, can be NULL if asteroid hit by area effect |
hitpos | world position asteroid was hit, can be NULL if hit by area effect |
damage | amount of damage to apply to asteroid |
Definition at line 1368 of file asteroid.cpp.
int asteroid_in_inner_bound | ( | asteroid_field * | asfieldp, |
vec3d * | pos, | ||
float | delta | ||
) |
Check if asteroid is within inner bound
Definition at line 192 of file asteroid.cpp.
int asteroid_in_inner_bound_with_axes | ( | asteroid_field * | asfieldp, |
vec3d * | pos, | ||
float | delta | ||
) |
Returns whether position is inside inner bounding volume
Sum together the following: 1 inside x, 2 inside y, 4 inside z inside only when sum = 7
Definition at line 168 of file asteroid.cpp.
void asteroid_init | ( | ) |
Called once, at game start. Do any one-time initializations here
Definition at line 2140 of file asteroid.cpp.
Is asteroid targeted?
Definition at line 727 of file asteroid.cpp.
void asteroid_level_close | ( | ) |
De-init asteroids, called from game_level_close()
Definition at line 1423 of file asteroid.cpp.
void asteroid_level_init | ( | ) |
Init asteriod system for the level, called from game_level_init()
Definition at line 628 of file asteroid.cpp.
Load in an asteroid model
Definition at line 446 of file asteroid.cpp.
See if asteroid should split up. We delay splitting up to allow the explosion animation to play for a bit.
Definition at line 1482 of file asteroid.cpp.
void asteroid_maybe_reposition | ( | object * | objp, |
asteroid_field * | asfieldp | ||
) |
See if we should reposition the asteroid. Only reposition if oustide the bounding volume and the player isn't looking towards the asteroid.
Definition at line 850 of file asteroid.cpp.
Add a node from the Asteroid_obj_list. Only called from weapon_create()
Definition at line 105 of file asteroid.cpp.
void asteroid_obj_list_init | ( | ) |
Clear out the Asteroid_obj_list
Definition at line 91 of file asteroid.cpp.
Remove a node from the Asteroid_obj_list. Only called from weapon_delete()
Definition at line 127 of file asteroid.cpp.
void asteroid_page_in | ( | ) |
Definition at line 2222 of file asteroid.cpp.
void asteroid_parse_section | ( | asteroid_info * | asip | ) |
Read in a single asteroid section from asteroid.tbl
Definition at line 1820 of file asteroid.cpp.
void asteroid_parse_tbl | ( | ) |
Read in data from asteroid.tbl into Asteroid_info[] array.
After this function is completes, the Asteroid_info[] array will contain exactly three asteroids per species plus exactly three generic asteroids. These three asteroids are a set of small, medium, and large asteroids in that exact order.
If asteroid.tbl contains too many or too few asteroids as per the rules above this function will abort the engine with an error message stating the number expected and it will write to the debug.log how everything was parsed.
Note that by saying "asteroid" this code is talking about the asteroids and the debris that make up asteroid fields and debris fields. Which means that these debris have nothing to do with the debris of ships that explode, however these are the same debris and asteroids that get flung at a ship that is being protected.
Definition at line 1920 of file asteroid.cpp.
Definition at line 1750 of file asteroid.cpp.
Definition at line 908 of file asteroid.cpp.
Definition at line 1189 of file asteroid.cpp.
Definition at line 1170 of file asteroid.cpp.
int asteroid_should_wrap | ( | object * | objp, |
asteroid_field * | asfieldp | ||
) |
Should asteroid wrap from one end of the asteroid field to the other. Multiplayer clients will always return 0 from this function. We will force a wrap on the clients when server tells us
Definition at line 645 of file asteroid.cpp.
void asteroid_show_brackets | ( | ) |
Draw brackets around on-screen asteroids that are about to collide, otherwise draw an offscreen indicator
Definition at line 2150 of file asteroid.cpp.
Create asteroids when parent_objp blows up.
Definition at line 405 of file asteroid.cpp.
void asteroid_target_closest_danger | ( | ) |
Target the closest danger asteroid to the player
Definition at line 2192 of file asteroid.cpp.
void asteroid_test_collide | ( | object * | pasteroid_obj, |
object * | pship_obj, | ||
mc_info * | mc, | ||
bool | lazy = false |
||
) |
Definition at line 1619 of file asteroid.cpp.
Find the time until asteroid will collide with object
Definition at line 1790 of file asteroid.cpp.
Force updating of pair stuff for asteroid *objp.
Definition at line 80 of file asteroid.cpp.
See if asteroid will collide with a large ship on the escort list in the next ASTEROID_MIN_COLLIDE_TIME seconds.
Definition at line 1701 of file asteroid.cpp.
Warn if asteroid on collision path with ship
Definition at line 1679 of file asteroid.cpp.
Ensure that the collide objnum for the asteroid is still valid
Definition at line 1740 of file asteroid.cpp.
Test if asteroid will collide with escort ship within ASTEROID_MIN_COLLIDE_TIME seconds
Definition at line 1661 of file asteroid.cpp.
void asteroid_wrap_pos | ( | object * | objp, |
asteroid_field * | asfieldp | ||
) |
Wrap an asteroid from one end of the asteroid field to the other
Definition at line 690 of file asteroid.cpp.
int count_incident_asteroids | ( | ) |
Return number of asteroids expected to collide with a ship.
Definition at line 2071 of file asteroid.cpp.
DCF_BOOL2 | ( | asteroids | , |
Asteroids_enabled | , | ||
"enables or disables asteroids" | , | ||
"Usage: asteroids \nTurns asteroid system on/off. If nothing | passed[bool], | ||
then toggles it.\n" | |||
) |
Randomly choose a debris model within the current group
Definition at line 490 of file asteroid.cpp.
Returns a weight that depends on asteroid size.
The weight is then used to determine the frequencty of different sizes of ship debris
Definition at line 506 of file asteroid.cpp.
void hud_target_asteroid | ( | ) |
Definition at line 1441 of file asteroid.cpp.
void inner_bound_pos_fixup | ( | asteroid_field * | asfieldp, |
vec3d * | pos | ||
) |
Repositions asteroid outside the inner box on all 3 axes
Moves to the other side of the inner box a distance delta from edge of box
Definition at line 206 of file asteroid.cpp.
Definition at line 903 of file asteroid.cpp.
Call once per frame to maybe throw an asteroid at a ship.
count | asteroids already targeted on |
Definition at line 776 of file asteroid.cpp.
int set_asteroid_throw_objnum | ( | ) |
Pick object to throw asteroids at. Pick any capital or big ship inside the bounds of the asteroid field.
Definition at line 2095 of file asteroid.cpp.
asteroid_field Asteroid_field |
Definition at line 64 of file asteroid.cpp.
char Asteroid_icon_closeup_model[NAME_LENGTH] |
Definition at line 69 of file asteroid.cpp.
vec3d Asteroid_icon_closeup_position |
Definition at line 70 of file asteroid.cpp.
float Asteroid_icon_closeup_zoom |
Definition at line 71 of file asteroid.cpp.
SCP_vector< asteroid_info > Asteroid_info |
Definition at line 62 of file asteroid.cpp.
asteroid_obj Asteroid_obj_list |
Definition at line 50 of file asteroid.cpp.
asteroid_obj Asteroid_objs[MAX_ASTEROID_OBJS] |
Definition at line 49 of file asteroid.cpp.
int Asteroid_throw_objnum = -1 |
Definition at line 59 of file asteroid.cpp.
asteroid Asteroids[MAX_ASTEROIDS] |
Definition at line 63 of file asteroid.cpp.
int Asteroids_enabled = 1 |
Definition at line 57 of file asteroid.cpp.
int Cmdline_targetinfo |
Definition at line 367 of file cmdline.cpp.
int Next_asteroid_throw |
Definition at line 60 of file asteroid.cpp.
int Num_asteroids = 0 |
Definition at line 58 of file asteroid.cpp.