1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#ifndef __ROCKS_H__2010
#define __ROCKS_H__2010
#include <SDL/SDL.h>
#include "rockdodger_globals.h"
/*! \brief Structure describing rocks/asteroids
*/
struct rock_struct {
float x, y, xvel, yvel;
int active; //!< Is the rock active? Is it moving and being displayed?
unsigned short type_class; //!< 0 = normal, 1 = lithium, 2 = ice
unsigned short type_number;
float heat;
float heat_capacity; //!< How much energy is needed to heat the rock?
// rock_struct.greeb is an index into greeb[], the destination (or landing
// site) of the rock's greeb. This of course limits the number of greebs
// flying to the same rock.
int greeb;
// Angle for plumes when rock is heated.
short plume_angle;
};
extern struct rock_struct rock[MAX_ROCKS]; //!< Structure of all the rocks.
/*! \brief Get the current surface of the rock with index rockidx.
*
* \param rockidx Index to rock.
* \param hot 1 == return the "hot" surface, 0 == return "cool" surface
* \return Surface found (should never be illegal)
*/
SDL_Surface *get_rock_surface(int rockidx, int hot);
/*! \brief Heat a rock
*
* The rock is heated and the internal heat of the rock increased.
*
* \param rockidx index number of the rock to heat
* \param mvmt current movementrate
*/
void heat_rock_up(int rockidx, float mvmt);
/*! \brief Draw the rocks.
*
* This function will also draw the greeblies flying to its
* rock. TODO: Check if this can be untangled.
*
* \param surf_screen Surface to draw on.
*/
void display_rocks(SDL_Surface *surf_screen);
/*! \brief Update the rocks.
*
* Updates the position of the rocks. Uses the global movementrate.
*
* \param surf_screen Surface to draw on.
*/
void update_rocks(void);
/*! \brief Create a rock.
*
* Create a rock, if maximum number of rocks reached function returns
* immediately.
*
* \param rockspeed current default speed of the rock, modified by a random amount
*/
void create_rock(float rockspeed);
/*! \brief Initialise rock data.
*
* Initialise all data and load all beautiful rock images.
*
* \return NULL = fail, otherwise something else (do not rely on it for now!)
*/
void *init_rocks(void);
#endif
|