17#include "gatherable.h"
24#define GATHER_DIST 30.
30int gatherable_load (
void)
36void gatherable_cleanup (
void)
62 g->player_only = player_only;
65 g->lifeleng = RNGF()*100. + 50.;
67 g->lifeleng = lifeleng;
89 if (g->timer > g->lifeleng) {
125 double mindist = INFINITY;
129 double curdist = vec2_dist(&pos, &gat->
pos);
130 if ( (curdist<mindist) && (curdist<rad) ) {
182 if (pilot_isPlayer(p)) {
187 hparam[0].
type = HOOK_PARAM_STRING;
189 hparam[1].
type = HOOK_PARAM_NUMBER;
191 hparam[2].
type = HOOK_PARAM_SENTINEL;
204 player_message( _(
"Cannot gather material: no more cargo space available") );
Provides macros to work with dynamic arrays.
#define array_free(ptr_array)
Frees memory allocated and sets array to NULL.
#define array_end(array)
Returns a pointer to the end of the reserved memory space.
#define array_erase(ptr_array, first, last)
Erases elements in interval [first, last).
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
#define array_grow(ptr_array)
Increases the number of elements by one and returns the last element.
#define array_begin(array)
Returns a pointer to the beginning of the reserved memory space.
#define array_create(basic_type)
Creates a new dynamic array of ‘basic_type’.
int gatherable_getPos(vec2 *pos, vec2 *vel, int id)
Returns the position and velocity of a gatherable.
void gatherable_free(void)
Frees all the gatherables.
int gatherable_init(const Commodity *com, vec2 pos, vec2 vel, double lifeleng, int qtt, unsigned int player_only)
Initializes a gatherable object.
void gatherable_gather(Pilot *p)
See if the pilot can gather anything.
static Gatherable * gatherable_stack
void gatherable_update(double dt)
Updates all gatherable objects.
static float noscoop_timer
int gatherable_getClosest(vec2 pos, double rad)
Gets the closest gatherable from a given position, within a given radius.
void gatherable_render(void)
Renders all the gatherables.
void player_message(const char *fmt,...)
Adds a mesg to the queue to be displayed on screen.
int hooks_runParam(const char *stack, const HookParam *param)
Runs all the hooks of stack.
Header file with generic functions and naev-specifics.
void gl_renderSprite(const glTexture *sprite, double bx, double by, int sx, int sy, const glColour *c)
Blits a sprite, position is relative to the player.
int pilot_cargoFree(const Pilot *p)
Gets the pilot's free cargo space.
int pilot_cargoAdd(Pilot *pilot, const Commodity *cargo, int quantity, unsigned int id)
Tries to add quantity of cargo to pilot.
Represents stuff that can be gathered.
The actual hook parameter.
The representation of an in-game pilot.