/* base/game.h This file is part of the Osirion project and is distributed under the terms of the GNU General Public License version 2 */ #ifndef __INCLUDED_BASE_H__ #define __INCLUDED_BASE_H__ #include #include #include "core/module.h" #include "core/range.h" #include "core/application.h" #include "core/gameinterface.h" #include "filesystem/inifile.h" #include "sys/sys.h" /** * @brief the base game module * the base game module contains the game-specific code for Project::OSiRiON **/ namespace game { // entity module type constants const unsigned int star_enttype = 100; const unsigned int planet_enttype = 101; const unsigned int platform_enttype = 200; const unsigned int station_enttype = 201; const unsigned int navpoint_enttype = 302; const unsigned int jumppoint_enttype = 303; const unsigned int jumpgate_enttype = 304; const unsigned int race_enttype = 305; const unsigned int patrol_enttype = 500; const unsigned int ship_enttype = 501; const unsigned int cargopod_enttype = 600; const unsigned int spacemine_enttype = 601; // ship engine delay times const float jump_timer_delay = 5.0f; const float jump_cooldown_delay = 2.0f; const float impulse_timer_delay = 3.0f; class Character; class ShipModel; class Weapon; /// default player settings class Default { public: typedef std::vector Characters; static core::Zone *zone; /* static core::Entity *view; static ShipModel *shipmodel; static Weapon *cannonmodel; static Weapon *turretmodel; static long credits; */ static void clear(); static Characters characters; }; /// the base Project::OSiRiON game model class Game : public core::Module { public: Game(); virtual ~Game(); /// run one game frame void frame(float seconds); /// is called when a player connects virtual void player_connect(core::Player *player); /// is called when a player disconnects virtual void player_disconnect(core::Player *player); /// load a player data virtual void player_load(core::Player *player); /// save player data virtual void player_save(core::Player *player); /// singleplayer load game function virtual void game_load(core::Player *player, filesystem::IniFile & inifile); /// singleplayer save game function virtual void game_save(core::Player *player, std::ostream & os); /* --- game variables -------------------------------------- */ /// game variable: maximum ship speed static core::Cvar *g_impulsespeed; /// game variable: jumppoint range static core::Cvar *g_jumppointrange; /// game variable: enable or disable development mode (cheat mode) static core::Cvar *g_devel; /// game variable: number of seconds it takes for 1 unit of cargo to deplete from station inventories static core::Cvar *g_deplete; /// game variable: percentage of cargo to drop on player death static core::Cvar *g_cargoloss; /// physics variable: default damping factor of space static core::Cvar *g_damping; private: bool load_world(); bool load_zone(core::Zone *zone); bool validate_zone_phase1(core::Zone *zone); bool validate_zone_phase2(core::Zone *zone); bool generate_entity_menus(core::Entity *entity); bool load_commodities(); bool load_settings(); /* ---- game functions ------------------------------------- */ static void func_join(core::Player *player, std::string const &args); static void func_spectate(core::Player *player, std::string const &args); static void func_abandon(core::Player *player, std::string const &args); static void func_jump(core::Player *player, std::string const &args); static void func_impulse(core::Player *player, std::string const &args); static void func_launch(core::Player *player, std::string const &args); static void func_respawn(core::Player *player, std::string const &args); static void func_goto(core::Player *player, const std::string &args); static void func_explode(core::Player *player, const std::string &args); static void func_buy(core::Player *player, std::string const &args); static void func_sell(core::Player *player, const std::string &args); static void func_give(core::Player *player, const std::string &args); static void func_specs(core::Player *player, const std::string &args); static void func_eject(core::Player *player, const std::string &args); static void func_drop(core::Player *player, std::string const &args); static void func_mount(core::Player *player, const std::string &args); static void func_unmount(core::Player *player, const std::string &args); static void func_beam(core::Player *player, const std::string &args); static void func_repair(core::Player *player, const std::string &args); static void func_wingmen(core::Player *player, const std::string &args); static void func_freeflight(core::Player *player, std::string const &args); /* ---- target functions ----------------------------------- */ static void func_target_goto(core::Player *player, core::Entity *entity); static void func_target_dock(core::Player *player, core::Entity *entity); static void func_target_formation(core::Player *player, core::Entity *entity); static void func_target_hail(core::Player *player, core::Entity *entity); static void func_target_trade(core::Player *player, core::Entity *entity); }; /// factory function core::Module *factory(); } #endif // __INCLUDED_BASE_H__