Lephisto/src/pilot.h
2013-02-04 17:44:53 +00:00

47 lines
1.1 KiB
C

#pragma once
#include "main.h"
#include "physics.h"
#include "ai.h"
#include "ship.h"
#define PILOT_PLAYER 1 // Pilot is a player.
// Primary pilot structure.
typedef struct Pilot {
unsigned int id; // Pilots id.
char* name; // Pilot's name (if unique).
// Object characteristics.
Ship* ship; // Pilots ship.
Solid* solid; // Associated solid (physics).
// Current health.
double armor, shield, energy;
void (*update)(struct Pilot*, const double); // Update the pilot.
unsigned int properties; // Used for AI etc.
// AI.
void (*think)(struct Pilot*); // Ai thinking for the pilot.
Task* task; // Current action.
} Pilot;
extern Pilot* player; // The player.
Pilot* get_pilot(unsigned int id);
// Creation.
void pilot_init(Pilot* dest, Ship* ship, char* name,
const Vec2* vel, const Vec2* pos, const int flags);
unsigned int pilot_create(Ship* ship, char* name, const Vec2* vel,
const Vec2* pos, const int flags);
// Cleanup.
void pilot_destroy(Pilot* p);
void pilots_free(void);
// Update.
void pilots_update(double dt);