From 3705064b109580103a3d13f44693503da9927281 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Thu, 12 Jun 2008 12:09:34 +0000 Subject: renamed .h to .hpp in game because they are c++ headers --- src/game/client/gc_anim.h | 14 -- src/game/client/gc_anim.hpp | 14 ++ src/game/client/gc_client.cpp | 28 ++-- src/game/client/gc_client.h | 275 -------------------------------------- src/game/client/gc_client.hpp | 275 ++++++++++++++++++++++++++++++++++++++ src/game/client/gc_console.cpp | 10 +- src/game/client/gc_console.h | 19 --- src/game/client/gc_console.hpp | 19 +++ src/game/client/gc_effects.cpp | 6 +- src/game/client/gc_flow.cpp | 4 +- src/game/client/gc_hooks.cpp | 18 +-- src/game/client/gc_map_image.cpp | 4 +- src/game/client/gc_map_image.h | 10 -- src/game/client/gc_map_image.hpp | 10 ++ src/game/client/gc_menu.cpp | 20 +-- src/game/client/gc_menu.h | 5 - src/game/client/gc_menu.hpp | 5 + src/game/client/gc_particles.cpp | 4 +- src/game/client/gc_render.cpp | 16 +-- src/game/client/gc_render.h | 82 ------------ src/game/client/gc_render.hpp | 82 ++++++++++++ src/game/client/gc_render_map.cpp | 4 +- src/game/client/gc_render_obj.cpp | 14 +- src/game/client/gc_skin.cpp | 4 +- src/game/client/gc_skin.h | 21 --- src/game/client/gc_skin.hpp | 21 +++ src/game/client/gc_ui.cpp | 2 +- src/game/client/gc_ui.h | 65 --------- src/game/client/gc_ui.hpp | 65 +++++++++ 29 files changed, 558 insertions(+), 558 deletions(-) delete mode 100644 src/game/client/gc_anim.h create mode 100644 src/game/client/gc_anim.hpp delete mode 100644 src/game/client/gc_client.h create mode 100644 src/game/client/gc_client.hpp delete mode 100644 src/game/client/gc_console.h create mode 100644 src/game/client/gc_console.hpp delete mode 100644 src/game/client/gc_map_image.h create mode 100644 src/game/client/gc_map_image.hpp delete mode 100644 src/game/client/gc_menu.h create mode 100644 src/game/client/gc_menu.hpp delete mode 100644 src/game/client/gc_render.h create mode 100644 src/game/client/gc_render.hpp delete mode 100644 src/game/client/gc_skin.h create mode 100644 src/game/client/gc_skin.hpp delete mode 100644 src/game/client/gc_ui.h create mode 100644 src/game/client/gc_ui.hpp (limited to 'src/game/client') diff --git a/src/game/client/gc_anim.h b/src/game/client/gc_anim.h deleted file mode 100644 index f6e9aac3..00000000 --- a/src/game/client/gc_anim.h +++ /dev/null @@ -1,14 +0,0 @@ - -struct ANIM_STATE -{ - ANIM_KEYFRAME body; - ANIM_KEYFRAME back_foot; - ANIM_KEYFRAME front_foot; - ANIM_KEYFRAME attach; -}; - -void anim_seq_eval(ANIM_SEQUENCE *seq, float time, ANIM_KEYFRAME *frame); -void anim_eval(ANIMATION *anim, float time, ANIM_STATE *state); -void anim_add_keyframe(ANIM_KEYFRAME *seq, ANIM_KEYFRAME *added, float amount); -void anim_add(ANIM_STATE *state, ANIM_STATE *added, float amount); -void anim_eval_add(ANIM_STATE *state, ANIMATION *anim, float time, float amount); diff --git a/src/game/client/gc_anim.hpp b/src/game/client/gc_anim.hpp new file mode 100644 index 00000000..f6e9aac3 --- /dev/null +++ b/src/game/client/gc_anim.hpp @@ -0,0 +1,14 @@ + +struct ANIM_STATE +{ + ANIM_KEYFRAME body; + ANIM_KEYFRAME back_foot; + ANIM_KEYFRAME front_foot; + ANIM_KEYFRAME attach; +}; + +void anim_seq_eval(ANIM_SEQUENCE *seq, float time, ANIM_KEYFRAME *frame); +void anim_eval(ANIMATION *anim, float time, ANIM_STATE *state); +void anim_add_keyframe(ANIM_KEYFRAME *seq, ANIM_KEYFRAME *added, float amount); +void anim_add(ANIM_STATE *state, ANIM_STATE *added, float amount); +void anim_eval_add(ANIM_STATE *state, ANIMATION *anim, float time, float amount); diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp index 89c7ffcd..c42c354e 100644 --- a/src/game/client/gc_client.cpp +++ b/src/game/client/gc_client.cpp @@ -1,5 +1,5 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include +#include #include #include #include @@ -10,19 +10,19 @@ extern "C" { #include }; -#include "../g_game.h" -#include "../g_version.h" -#include "../g_layers.h" -#include "../g_math.h" -#include "gc_map_image.h" -#include "../generated/gc_data.h" -#include "gc_menu.h" -#include "gc_skin.h" -#include "gc_ui.h" -#include "gc_client.h" -#include "gc_render.h" -#include "gc_anim.h" -#include "gc_console.h" +#include "../g_game.hpp" +#include "../g_version.hpp" +#include "../g_layers.hpp" +#include "../g_math.hpp" +#include "gc_map_image.hpp" +#include "../generated/gc_data.hpp" +#include "gc_menu.hpp" +#include "gc_skin.hpp" +#include "gc_ui.hpp" +#include "gc_client.hpp" +#include "gc_render.hpp" +#include "gc_anim.hpp" +#include "gc_console.hpp" //struct data_container *data = 0; int64 debug_firedelay = 0; diff --git a/src/game/client/gc_client.h b/src/game/client/gc_client.h deleted file mode 100644 index bb8a69cf..00000000 --- a/src/game/client/gc_client.h +++ /dev/null @@ -1,275 +0,0 @@ -#include -#include -#include - -#include - -// sound channels -enum -{ - CHN_GUI=0, - CHN_MUSIC, - CHN_WORLD, - CHN_GLOBAL, -}; - -//extern struct data_container *data; - -extern vec2 mouse_pos; -extern vec2 local_character_pos; -extern vec2 local_target_pos; - -// snap pointers -struct SNAPSTATE -{ - const NETOBJ_PLAYER_CHARACTER *local_character; - const NETOBJ_PLAYER_CHARACTER *local_prev_character; - const NETOBJ_PLAYER_INFO *local_info; - const NETOBJ_FLAG *flags[2]; - const NETOBJ_GAME *gameobj; - - const NETOBJ_PLAYER_INFO *player_infos[MAX_CLIENTS]; - const NETOBJ_PLAYER_INFO *info_by_score[MAX_CLIENTS]; - int num_players; -}; - -extern SNAPSTATE netobjects; - -/* -extern const NETOBJ_PLAYER_CHARACTER *local_character; -extern const NETOBJ_PLAYER_CHARACTER *local_prev_character; -extern const NETOBJ_PLAYER_INFO *local_info; -extern const NETOBJ_FLAG *flags[2]; -extern const NETOBJ_GAME *gameobj; -* */ - -extern TUNING_PARAMS tuning; - -// predicted players -extern PLAYER_CORE predicted_prev_player; -extern PLAYER_CORE predicted_player; - -// input -extern NETOBJ_PLAYER_INPUT input_data; -extern int input_direction_left; -extern int input_direction_right; - -// debug -extern int64 debug_firedelay; - -// extra projs -enum -{ - MAX_EXTRA_PROJECTILES=32, -}; - -extern NETOBJ_PROJECTILE extraproj_projectiles[MAX_EXTRA_PROJECTILES]; -extern int extraproj_num; - -void extraproj_reset(); - -// chat -enum -{ - CHATMODE_NONE=0, - CHATMODE_ALL, - CHATMODE_TEAM, -}; - -extern int chat_mode; -void chat_add_line(int client_id, int team, const char *line); -void chat_reset(); -bool chat_input_handle(INPUT_EVENT e, void *user_data); - -// broadcasts -extern char broadcast_text[1024]; -extern int64 broadcast_time; - -// motd -extern int64 server_motd_time; -extern char server_motd[900]; // FUGLY - -// line input helter -class line_input -{ - char str[256]; - unsigned len; - unsigned cursor_pos; -public: - class callback - { - public: - virtual ~callback() {} - virtual bool event(INPUT_EVENT e) = 0; - }; - - line_input(); - void clear(); - void process_input(INPUT_EVENT e); - void set(const char *string); - const char *get_string() const { return str; } - int get_length() const { return len; } - unsigned cursor_offset() const { return cursor_pos; } -}; - -class INPUT_STACK_HANDLER -{ -public: - typedef bool (*CALLBACK)(INPUT_EVENT e, void *user); - - INPUT_STACK_HANDLER(); - void add_handler(CALLBACK cb, void *user_data); - void dispatch_input(); - -private: - enum - { - MAX_HANDLERS=16 - }; - - CALLBACK handlers[MAX_HANDLERS]; - void *user_data[MAX_HANDLERS]; - int num_handlers; -}; - -extern INPUT_STACK_HANDLER input_stack; - - -extern int emoticon_selector_active; // TODO: ugly -extern int scoreboard_active; // TODO: ugly - -// client data -struct CLIENT_DATA -{ - char name[64]; - char skin_name[64]; - int skin_id; - int skin_color; - int team; - int emoticon; - int emoticon_start; - PLAYER_CORE predicted; - - TEE_RENDER_INFO skin_info; // this is what the server reports - TEE_RENDER_INFO render_info; // this is what we use - - float angle; - - void update_render_info(); -}; - -extern CLIENT_DATA client_datas[MAX_CLIENTS]; - -// kill messages -struct KILLMSG -{ - int weapon; - int victim; - int killer; - int mode_special; // for CTF, if the guy is carrying a flag for example - int tick; -}; - -const int killmsg_max = 5; -extern KILLMSG killmsgs[killmsg_max]; -extern int killmsg_current; - -// -void send_switch_team(int team); - -// various helpers -void snd_play_random(int chn, int setid, float vol, vec2 pos); -void process_events(int snaptype); -void clear_object_pointers(); -void reset_projectile_particles(); -void send_info(bool start); -void send_emoticon(int emoticon); - -void chat_say(int team, const char *line); -void chat_enable_mode(int team); - -inline vec2 random_dir() { return normalize(vec2(frandom()-0.5f, frandom()-0.5f)); } - - -// effects -void effects_update(); - -void effect_bullettrail(vec2 pos); -void effect_smoketrail(vec2 pos, vec2 vel); -void effect_skidtrail(vec2 pos, vec2 vel); -void effect_explosion(vec2 pos); -void effect_air_jump(vec2 pos); -void effect_damage_indicator(vec2 pos, vec2 dir); -void effect_playerspawn(vec2 pos); -void effect_playerdeath(vec2 pos, int cid); -void effect_powerupshine(vec2 pos, vec2 size); - -// particles -struct PARTICLE -{ - void set_default() - { - vel = vec2(0,0); - life_span = 0; - start_size = 32; - end_size = 32; - rot = 0; - rotspeed = 0; - gravity = 0; - friction = 0; - flow_affected = 1.0f; - color = vec4(1,1,1,1); - } - - vec2 pos; - vec2 vel; - - int spr; - - float flow_affected; - - float life_span; - - float start_size; - float end_size; - - float rot; - float rotspeed; - - float gravity; - float friction; - - vec4 color; - - // set by the particle system - float life; - int prev_part; - int next_part; -}; - -enum -{ - PARTGROUP_PROJECTILE_TRAIL=0, - PARTGROUP_EXPLOSIONS, - PARTGROUP_GENERAL, - NUM_PARTGROUPS -}; - -void particle_add(int group, PARTICLE *part); -void particle_render(int group); -void particle_update(float time_passed); -void particle_reset(); - -// flow grid -vec2 flow_get(vec2 pos); -void flow_add(vec2 pos, vec2 vel, float size); -void flow_dbg_render(); -void flow_init(); -void flow_update(); - -// -void binds_default(); -void binds_save(); -void binds_set(int keyid, const char *str); -const char *binds_get(int keyid); - diff --git a/src/game/client/gc_client.hpp b/src/game/client/gc_client.hpp new file mode 100644 index 00000000..750154b3 --- /dev/null +++ b/src/game/client/gc_client.hpp @@ -0,0 +1,275 @@ +#include +#include +#include + +#include + +// sound channels +enum +{ + CHN_GUI=0, + CHN_MUSIC, + CHN_WORLD, + CHN_GLOBAL, +}; + +//extern struct data_container *data; + +extern vec2 mouse_pos; +extern vec2 local_character_pos; +extern vec2 local_target_pos; + +// snap pointers +struct SNAPSTATE +{ + const NETOBJ_PLAYER_CHARACTER *local_character; + const NETOBJ_PLAYER_CHARACTER *local_prev_character; + const NETOBJ_PLAYER_INFO *local_info; + const NETOBJ_FLAG *flags[2]; + const NETOBJ_GAME *gameobj; + + const NETOBJ_PLAYER_INFO *player_infos[MAX_CLIENTS]; + const NETOBJ_PLAYER_INFO *info_by_score[MAX_CLIENTS]; + int num_players; +}; + +extern SNAPSTATE netobjects; + +/* +extern const NETOBJ_PLAYER_CHARACTER *local_character; +extern const NETOBJ_PLAYER_CHARACTER *local_prev_character; +extern const NETOBJ_PLAYER_INFO *local_info; +extern const NETOBJ_FLAG *flags[2]; +extern const NETOBJ_GAME *gameobj; +* */ + +extern TUNING_PARAMS tuning; + +// predicted players +extern PLAYER_CORE predicted_prev_player; +extern PLAYER_CORE predicted_player; + +// input +extern NETOBJ_PLAYER_INPUT input_data; +extern int input_direction_left; +extern int input_direction_right; + +// debug +extern int64 debug_firedelay; + +// extra projs +enum +{ + MAX_EXTRA_PROJECTILES=32, +}; + +extern NETOBJ_PROJECTILE extraproj_projectiles[MAX_EXTRA_PROJECTILES]; +extern int extraproj_num; + +void extraproj_reset(); + +// chat +enum +{ + CHATMODE_NONE=0, + CHATMODE_ALL, + CHATMODE_TEAM, +}; + +extern int chat_mode; +void chat_add_line(int client_id, int team, const char *line); +void chat_reset(); +bool chat_input_handle(INPUT_EVENT e, void *user_data); + +// broadcasts +extern char broadcast_text[1024]; +extern int64 broadcast_time; + +// motd +extern int64 server_motd_time; +extern char server_motd[900]; // FUGLY + +// line input helter +class line_input +{ + char str[256]; + unsigned len; + unsigned cursor_pos; +public: + class callback + { + public: + virtual ~callback() {} + virtual bool event(INPUT_EVENT e) = 0; + }; + + line_input(); + void clear(); + void process_input(INPUT_EVENT e); + void set(const char *string); + const char *get_string() const { return str; } + int get_length() const { return len; } + unsigned cursor_offset() const { return cursor_pos; } +}; + +class INPUT_STACK_HANDLER +{ +public: + typedef bool (*CALLBACK)(INPUT_EVENT e, void *user); + + INPUT_STACK_HANDLER(); + void add_handler(CALLBACK cb, void *user_data); + void dispatch_input(); + +private: + enum + { + MAX_HANDLERS=16 + }; + + CALLBACK handlers[MAX_HANDLERS]; + void *user_data[MAX_HANDLERS]; + int num_handlers; +}; + +extern INPUT_STACK_HANDLER input_stack; + + +extern int emoticon_selector_active; // TODO: ugly +extern int scoreboard_active; // TODO: ugly + +// client data +struct CLIENT_DATA +{ + char name[64]; + char skin_name[64]; + int skin_id; + int skin_color; + int team; + int emoticon; + int emoticon_start; + PLAYER_CORE predicted; + + TEE_RENDER_INFO skin_info; // this is what the server reports + TEE_RENDER_INFO render_info; // this is what we use + + float angle; + + void update_render_info(); +}; + +extern CLIENT_DATA client_datas[MAX_CLIENTS]; + +// kill messages +struct KILLMSG +{ + int weapon; + int victim; + int killer; + int mode_special; // for CTF, if the guy is carrying a flag for example + int tick; +}; + +const int killmsg_max = 5; +extern KILLMSG killmsgs[killmsg_max]; +extern int killmsg_current; + +// +void send_switch_team(int team); + +// various helpers +void snd_play_random(int chn, int setid, float vol, vec2 pos); +void process_events(int snaptype); +void clear_object_pointers(); +void reset_projectile_particles(); +void send_info(bool start); +void send_emoticon(int emoticon); + +void chat_say(int team, const char *line); +void chat_enable_mode(int team); + +inline vec2 random_dir() { return normalize(vec2(frandom()-0.5f, frandom()-0.5f)); } + + +// effects +void effects_update(); + +void effect_bullettrail(vec2 pos); +void effect_smoketrail(vec2 pos, vec2 vel); +void effect_skidtrail(vec2 pos, vec2 vel); +void effect_explosion(vec2 pos); +void effect_air_jump(vec2 pos); +void effect_damage_indicator(vec2 pos, vec2 dir); +void effect_playerspawn(vec2 pos); +void effect_playerdeath(vec2 pos, int cid); +void effect_powerupshine(vec2 pos, vec2 size); + +// particles +struct PARTICLE +{ + void set_default() + { + vel = vec2(0,0); + life_span = 0; + start_size = 32; + end_size = 32; + rot = 0; + rotspeed = 0; + gravity = 0; + friction = 0; + flow_affected = 1.0f; + color = vec4(1,1,1,1); + } + + vec2 pos; + vec2 vel; + + int spr; + + float flow_affected; + + float life_span; + + float start_size; + float end_size; + + float rot; + float rotspeed; + + float gravity; + float friction; + + vec4 color; + + // set by the particle system + float life; + int prev_part; + int next_part; +}; + +enum +{ + PARTGROUP_PROJECTILE_TRAIL=0, + PARTGROUP_EXPLOSIONS, + PARTGROUP_GENERAL, + NUM_PARTGROUPS +}; + +void particle_add(int group, PARTICLE *part); +void particle_render(int group); +void particle_update(float time_passed); +void particle_reset(); + +// flow grid +vec2 flow_get(vec2 pos); +void flow_add(vec2 pos, vec2 vel, float size); +void flow_dbg_render(); +void flow_init(); +void flow_update(); + +// +void binds_default(); +void binds_save(); +void binds_set(int keyid, const char *str); +const char *binds_get(int keyid); + diff --git a/src/game/client/gc_console.cpp b/src/game/client/gc_console.cpp index 76bf7218..45666a01 100644 --- a/src/game/client/gc_console.cpp +++ b/src/game/client/gc_console.cpp @@ -1,5 +1,5 @@ -#include "gc_console.h" -#include "../generated/gc_data.h" +#include "gc_console.hpp" +#include "../generated/gc_data.hpp" extern "C" { #include @@ -13,10 +13,10 @@ extern "C" { #include #include -#include "gc_ui.h" -#include "gc_client.h" +#include "gc_ui.hpp" +#include "gc_client.hpp" -#include "../g_version.h" +#include "../g_version.hpp" enum { diff --git a/src/game/client/gc_console.h b/src/game/client/gc_console.h deleted file mode 100644 index 0f5e7b9f..00000000 --- a/src/game/client/gc_console.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _GC_CONSOLE_H -#define _GC_CONSOLE_H - -#include - -bool console_input_cli(INPUT_EVENT e, void *user_data); -bool console_input_special_binds(INPUT_EVENT e, void *user_data); -bool console_input_normal_binds(INPUT_EVENT e, void *user_data); - -//void console_handle_input(); - -void console_clear(int type); -void console_toggle(int tpye); -void console_render(); -int console_active(); -void client_console_init(); -void console_rcon_print(const char *line); - -#endif diff --git a/src/game/client/gc_console.hpp b/src/game/client/gc_console.hpp new file mode 100644 index 00000000..0f5e7b9f --- /dev/null +++ b/src/game/client/gc_console.hpp @@ -0,0 +1,19 @@ +#ifndef _GC_CONSOLE_H +#define _GC_CONSOLE_H + +#include + +bool console_input_cli(INPUT_EVENT e, void *user_data); +bool console_input_special_binds(INPUT_EVENT e, void *user_data); +bool console_input_normal_binds(INPUT_EVENT e, void *user_data); + +//void console_handle_input(); + +void console_clear(int type); +void console_toggle(int tpye); +void console_render(); +int console_active(); +void client_console_init(); +void console_rcon_print(const char *line); + +#endif diff --git a/src/game/client/gc_effects.cpp b/src/game/client/gc_effects.cpp index 5a9ebfc6..387e1471 100644 --- a/src/game/client/gc_effects.cpp +++ b/src/game/client/gc_effects.cpp @@ -1,7 +1,7 @@ #include -#include "gc_client.h" -#include "gc_skin.h" -#include "../generated/gc_data.h" +#include "gc_client.hpp" +#include "gc_skin.hpp" +#include "../generated/gc_data.hpp" static bool add_50hz = false; static bool add_100hz = false; diff --git a/src/game/client/gc_flow.cpp b/src/game/client/gc_flow.cpp index aac35058..63e60617 100644 --- a/src/game/client/gc_flow.cpp +++ b/src/game/client/gc_flow.cpp @@ -1,7 +1,7 @@ #include #include -#include "gc_client.h" -#include "../g_layers.h" +#include "gc_client.hpp" +#include "../g_layers.hpp" struct FLOWCELL { diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp index 61e5f2e8..2aaca900 100644 --- a/src/game/client/gc_hooks.cpp +++ b/src/game/client/gc_hooks.cpp @@ -8,17 +8,17 @@ extern "C" { #include }; -#include -#include -#include +#include +#include +#include -#include +#include -#include "gc_client.h" -#include "gc_skin.h" -#include "gc_render.h" -#include "gc_map_image.h" -#include "gc_console.h" +#include "gc_client.hpp" +#include "gc_skin.hpp" +#include "gc_render.hpp" +#include "gc_map_image.hpp" +#include "gc_console.hpp" extern unsigned char internal_data[]; diff --git a/src/game/client/gc_map_image.cpp b/src/game/client/gc_map_image.cpp index 65cb0608..63a57c70 100644 --- a/src/game/client/gc_map_image.cpp +++ b/src/game/client/gc_map_image.cpp @@ -2,8 +2,8 @@ #include #include #include -#include -#include "gc_map_image.h" +#include +#include "gc_map_image.hpp" static int map_textures[64] = {0}; static int count = 0; diff --git a/src/game/client/gc_map_image.h b/src/game/client/gc_map_image.h deleted file mode 100644 index d73f43d3..00000000 --- a/src/game/client/gc_map_image.h +++ /dev/null @@ -1,10 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -// loads images from the map to textures -int img_init(); - -// returns the number of images in the map -int img_num(); - -// fetches the texture id for the image -int img_get(int index); diff --git a/src/game/client/gc_map_image.hpp b/src/game/client/gc_map_image.hpp new file mode 100644 index 00000000..d73f43d3 --- /dev/null +++ b/src/game/client/gc_map_image.hpp @@ -0,0 +1,10 @@ +/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ + +// loads images from the map to textures +int img_init(); + +// returns the number of images in the map +int img_num(); + +// fetches the texture id for the image +int img_get(int index); diff --git a/src/game/client/gc_menu.cpp b/src/game/client/gc_menu.cpp index 3a41aee4..cb8324a7 100644 --- a/src/game/client/gc_menu.cpp +++ b/src/game/client/gc_menu.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include extern "C" { #include @@ -14,15 +14,15 @@ extern "C" { #include } -#include "../g_version.h" -#include "../g_protocol.h" +#include "../g_version.hpp" +#include "../g_protocol.hpp" -#include "../generated/gc_data.h" -#include "gc_render.h" -#include "gc_anim.h" -#include "gc_skin.h" -#include "gc_ui.h" -#include "gc_client.h" +#include "../generated/gc_data.hpp" +#include "gc_render.hpp" +#include "gc_anim.hpp" +#include "gc_skin.hpp" +#include "gc_ui.hpp" +#include "gc_client.hpp" #include //extern data_container *data; diff --git a/src/game/client/gc_menu.h b/src/game/client/gc_menu.h deleted file mode 100644 index ba12894c..00000000 --- a/src/game/client/gc_menu.h +++ /dev/null @@ -1,5 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef __MENU_H -#define __MENU_H - -#endif diff --git a/src/game/client/gc_menu.hpp b/src/game/client/gc_menu.hpp new file mode 100644 index 00000000..ba12894c --- /dev/null +++ b/src/game/client/gc_menu.hpp @@ -0,0 +1,5 @@ +/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ +#ifndef __MENU_H +#define __MENU_H + +#endif diff --git a/src/game/client/gc_particles.cpp b/src/game/client/gc_particles.cpp index 2c3ef36c..504ebbab 100644 --- a/src/game/client/gc_particles.cpp +++ b/src/game/client/gc_particles.cpp @@ -1,6 +1,6 @@ #include -#include "gc_client.h" -#include "../generated/gc_data.h" +#include "gc_client.hpp" +#include "../generated/gc_data.hpp" // NOTE: the way the particle system works isn't very cache friendly diff --git a/src/game/client/gc_render.cpp b/src/game/client/gc_render.cpp index 364b33eb..2e5a3d50 100644 --- a/src/game/client/gc_render.cpp +++ b/src/game/client/gc_render.cpp @@ -2,14 +2,14 @@ #include #include #include -#include -#include -#include -#include -#include "gc_render.h" -#include "gc_anim.h" -#include "gc_client.h" -#include "gc_map_image.h" +#include +#include +#include +#include +#include "gc_render.hpp" +#include "gc_anim.hpp" +#include "gc_client.hpp" +#include "gc_map_image.hpp" static float sprite_w_scale; static float sprite_h_scale; diff --git a/src/game/client/gc_render.h b/src/game/client/gc_render.h deleted file mode 100644 index 508ab195..00000000 --- a/src/game/client/gc_render.h +++ /dev/null @@ -1,82 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef GAME_CLIENT_RENDER_H -#define GAME_CLIENT_RENDER_H - -#include "../g_vmath.h" -#include "../g_mapitems.h" -#include "gc_ui.h" - -struct TEE_RENDER_INFO -{ - TEE_RENDER_INFO() - { - texture = -1; - color_body = vec4(1,1,1,1); - color_feet = vec4(1,1,1,1); - size = 1.0f; - got_airjump = 1; - }; - - int texture; - vec4 color_body; - vec4 color_feet; - float size; - int got_airjump; -}; - -// sprite renderings -enum -{ - SPRITE_FLAG_FLIP_Y=1, - SPRITE_FLAG_FLIP_X=2, - - LAYERRENDERFLAG_OPAQUE=1, - LAYERRENDERFLAG_TRANSPARENT=2, - - TILERENDERFLAG_EXTEND=4, -}; - -typedef struct SPRITE; - -void select_sprite(SPRITE *spr, int flags=0, int sx=0, int sy=0); -void select_sprite(int id, int flags=0, int sx=0, int sy=0); - -void draw_sprite(float x, float y, float size); - -// rects -void draw_round_rect(float x, float y, float w, float h, float r); -void draw_round_rect_ext(float x, float y, float w, float h, float r, int corners); -void ui_draw_rect(const RECT *r, vec4 color, int corners, float rounding); - -// larger rendering methods -void menu_render(); -void render_game(); -void render_world(float center_x, float center_y, float zoom); -void render_loading(float percent); - -void render_damage_indicators(); -void render_particles(); - -void render_tilemap_generate_skip(); - -// object render methods (gc_render_obj.cpp) -void render_tee(class ANIM_STATE *anim, TEE_RENDER_INFO *info, int emote, vec2 dir, vec2 pos); -void render_flag(const struct NETOBJ_FLAG *prev, const struct NETOBJ_FLAG *current); -void render_pickup(const struct NETOBJ_PICKUP *prev, const struct NETOBJ_PICKUP *current); -void render_projectile(const struct NETOBJ_PROJECTILE *current, int itemid); -void render_laser(const struct NETOBJ_LASER *current); -void render_player( - const struct NETOBJ_PLAYER_CHARACTER *prev_char, const struct NETOBJ_PLAYER_CHARACTER *player_char, - const struct NETOBJ_PLAYER_INFO *prev_info, const struct NETOBJ_PLAYER_INFO *player_info); - -// map render methods (gc_render_map.cpp) -void render_eval_envelope(ENVPOINT *points, int num_points, int channels, float time, float *result); -void render_quads(QUAD *quads, int num_quads, void (*eval)(float time_offset, int env, float *channels), int flags); -void render_tilemap(TILE *tiles, int w, int h, float scale, vec4 color, int flags); - -// helpers -void mapscreen_to_world(float center_x, float center_y, float parallax_x, float parallax_y, - float offset_x, float offset_y, float aspect, float zoom, float *points); - - -#endif diff --git a/src/game/client/gc_render.hpp b/src/game/client/gc_render.hpp new file mode 100644 index 00000000..02bc224d --- /dev/null +++ b/src/game/client/gc_render.hpp @@ -0,0 +1,82 @@ +/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ +#ifndef GAME_CLIENT_RENDER_H +#define GAME_CLIENT_RENDER_H + +#include "../g_vmath.hpp" +#include "../g_mapitems.hpp" +#include "gc_ui.hpp" + +struct TEE_RENDER_INFO +{ + TEE_RENDER_INFO() + { + texture = -1; + color_body = vec4(1,1,1,1); + color_feet = vec4(1,1,1,1); + size = 1.0f; + got_airjump = 1; + }; + + int texture; + vec4 color_body; + vec4 color_feet; + float size; + int got_airjump; +}; + +// sprite renderings +enum +{ + SPRITE_FLAG_FLIP_Y=1, + SPRITE_FLAG_FLIP_X=2, + + LAYERRENDERFLAG_OPAQUE=1, + LAYERRENDERFLAG_TRANSPARENT=2, + + TILERENDERFLAG_EXTEND=4, +}; + +typedef struct SPRITE; + +void select_sprite(SPRITE *spr, int flags=0, int sx=0, int sy=0); +void select_sprite(int id, int flags=0, int sx=0, int sy=0); + +void draw_sprite(float x, float y, float size); + +// rects +void draw_round_rect(float x, float y, float w, float h, float r); +void draw_round_rect_ext(float x, float y, float w, float h, float r, int corners); +void ui_draw_rect(const RECT *r, vec4 color, int corners, float rounding); + +// larger rendering methods +void menu_render(); +void render_game(); +void render_world(float center_x, float center_y, float zoom); +void render_loading(float percent); + +void render_damage_indicators(); +void render_particles(); + +void render_tilemap_generate_skip(); + +// object render methods (gc_render_obj.cpp) +void render_tee(class ANIM_STATE *anim, TEE_RENDER_INFO *info, int emote, vec2 dir, vec2 pos); +void render_flag(const struct NETOBJ_FLAG *prev, const struct NETOBJ_FLAG *current); +void render_pickup(const struct NETOBJ_PICKUP *prev, const struct NETOBJ_PICKUP *current); +void render_projectile(const struct NETOBJ_PROJECTILE *current, int itemid); +void render_laser(const struct NETOBJ_LASER *current); +void render_player( + const struct NETOBJ_PLAYER_CHARACTER *prev_char, const struct NETOBJ_PLAYER_CHARACTER *player_char, + const struct NETOBJ_PLAYER_INFO *prev_info, const struct NETOBJ_PLAYER_INFO *player_info); + +// map render methods (gc_render_map.cpp) +void render_eval_envelope(ENVPOINT *points, int num_points, int channels, float time, float *result); +void render_quads(QUAD *quads, int num_quads, void (*eval)(float time_offset, int env, float *channels), int flags); +void render_tilemap(TILE *tiles, int w, int h, float scale, vec4 color, int flags); + +// helpers +void mapscreen_to_world(float center_x, float center_y, float parallax_x, float parallax_y, + float offset_x, float offset_y, float aspect, float zoom, float *points); + + +#endif diff --git a/src/game/client/gc_render_map.cpp b/src/game/client/gc_render_map.cpp index 2ad3ad94..90579aa7 100644 --- a/src/game/client/gc_render_map.cpp +++ b/src/game/client/gc_render_map.cpp @@ -1,7 +1,7 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ #include -#include "../g_math.h" -#include "gc_client.h" +#include "../g_math.hpp" +#include "gc_client.hpp" void render_eval_envelope(ENVPOINT *points, int num_points, int channels, float time, float *result) { diff --git a/src/game/client/gc_render_obj.cpp b/src/game/client/gc_render_obj.cpp index a6cd2b69..119db4d6 100644 --- a/src/game/client/gc_render_obj.cpp +++ b/src/game/client/gc_render_obj.cpp @@ -3,13 +3,13 @@ #include #include #include -#include "../generated/gc_data.h" -#include "../g_protocol.h" -#include "../g_math.h" -#include "gc_render.h" -#include "gc_anim.h" -#include "gc_client.h" -#include "gc_skin.h" +#include "../generated/gc_data.hpp" +#include "../g_protocol.hpp" +#include "../g_math.hpp" +#include "gc_render.hpp" +#include "gc_anim.hpp" +#include "gc_client.hpp" +#include "gc_skin.hpp" void render_projectile(const NETOBJ_PROJECTILE *current, int itemid) diff --git a/src/game/client/gc_skin.cpp b/src/game/client/gc_skin.cpp index a876c960..2bd2d4ff 100644 --- a/src/game/client/gc_skin.cpp +++ b/src/game/client/gc_skin.cpp @@ -4,8 +4,8 @@ #include #include #include -#include "gc_skin.h" -#include "../g_math.h" +#include "gc_skin.hpp" +#include "../g_math.hpp" enum { diff --git a/src/game/client/gc_skin.h b/src/game/client/gc_skin.h deleted file mode 100644 index d3840302..00000000 --- a/src/game/client/gc_skin.h +++ /dev/null @@ -1,21 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "../g_vmath.h" - -// do this better and nicer -typedef struct -{ - int org_texture; - int color_texture; - char name[31]; - char term[1]; - vec3 blood_color; -} skin; - -vec4 skin_get_color(int v); -void skin_init(); -int skin_num(); -const skin *skin_get(int index); -int skin_find(const char *name); - - -vec3 hsl_to_rgb(vec3 in); diff --git a/src/game/client/gc_skin.hpp b/src/game/client/gc_skin.hpp new file mode 100644 index 00000000..3a746589 --- /dev/null +++ b/src/game/client/gc_skin.hpp @@ -0,0 +1,21 @@ +/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ +#include "../g_vmath.hpp" + +// do this better and nicer +typedef struct +{ + int org_texture; + int color_texture; + char name[31]; + char term[1]; + vec3 blood_color; +} skin; + +vec4 skin_get_color(int v); +void skin_init(); +int skin_num(); +const skin *skin_get(int index); +int skin_find(const char *name); + + +vec3 hsl_to_rgb(vec3 in); diff --git a/src/game/client/gc_ui.cpp b/src/game/client/gc_ui.cpp index dc78c0ca..a344d661 100644 --- a/src/game/client/gc_ui.cpp +++ b/src/game/client/gc_ui.cpp @@ -2,7 +2,7 @@ #include #include #include -#include "gc_ui.h" +#include "gc_ui.hpp" /******************************************************** UI diff --git a/src/game/client/gc_ui.h b/src/game/client/gc_ui.h deleted file mode 100644 index 26c4dcdb..00000000 --- a/src/game/client/gc_ui.h +++ /dev/null @@ -1,65 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef _UI_H -#define _UI_H - -typedef struct -{ - float x, y, w, h; -} RECT; - -enum -{ - CORNER_TL=1, - CORNER_TR=2, - CORNER_BL=4, - CORNER_BR=8, - - CORNER_T=CORNER_TL|CORNER_TR, - CORNER_B=CORNER_BL|CORNER_BR, - CORNER_R=CORNER_TR|CORNER_BR, - CORNER_L=CORNER_TL|CORNER_BL, - - CORNER_ALL=CORNER_T|CORNER_B -}; - -int ui_update(float mx, float my, float mwx, float mwy, int buttons); - -float ui_mouse_x(); -float ui_mouse_y(); -float ui_mouse_world_x(); -float ui_mouse_world_y(); -int ui_mouse_button(int index); -int ui_mouse_button_clicked(int index); - -void ui_set_hot_item(const void *id); -void ui_set_active_item(const void *id); -void ui_clear_last_active_item(); -const void *ui_hot_item(); -const void *ui_next_hot_item(); -const void *ui_active_item(); -const void *ui_last_active_item(); - -int ui_mouse_inside(const RECT *r); - -RECT *ui_screen(); -void ui_set_scale(float s); -float ui_scale(); -void ui_clip_enable(const RECT *r); -void ui_clip_disable(); - -void ui_hsplit_t(const RECT *original, float cut, RECT *top, RECT *bottom); -void ui_hsplit_b(const RECT *original, float cut, RECT *top, RECT *bottom); -void ui_vsplit_mid(const RECT *original, RECT *left, RECT *right); -void ui_vsplit_l(const RECT *original, float cut, RECT *left, RECT *right); -void ui_vsplit_r(const RECT *original, float cut, RECT *left, RECT *right); - -void ui_margin(const RECT *original, float cut, RECT *other_rect); -void ui_vmargin(const RECT *original, float cut, RECT *other_rect); -void ui_hmargin(const RECT *original, float cut, RECT *other_rect); - -typedef void (*ui_draw_button_func)(const void *id, const char *text, int checked, const RECT *r, const void *extra); -int ui_do_button(const void *id, const char *text, int checked, const RECT *r, ui_draw_button_func draw_func, const void *extra); -void ui_do_label(const RECT *r, const char *text, float size, int align, int max_width = -1); - - -#endif diff --git a/src/game/client/gc_ui.hpp b/src/game/client/gc_ui.hpp new file mode 100644 index 00000000..26c4dcdb --- /dev/null +++ b/src/game/client/gc_ui.hpp @@ -0,0 +1,65 @@ +/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ +#ifndef _UI_H +#define _UI_H + +typedef struct +{ + float x, y, w, h; +} RECT; + +enum +{ + CORNER_TL=1, + CORNER_TR=2, + CORNER_BL=4, + CORNER_BR=8, + + CORNER_T=CORNER_TL|CORNER_TR, + CORNER_B=CORNER_BL|CORNER_BR, + CORNER_R=CORNER_TR|CORNER_BR, + CORNER_L=CORNER_TL|CORNER_BL, + + CORNER_ALL=CORNER_T|CORNER_B +}; + +int ui_update(float mx, float my, float mwx, float mwy, int buttons); + +float ui_mouse_x(); +float ui_mouse_y(); +float ui_mouse_world_x(); +float ui_mouse_world_y(); +int ui_mouse_button(int index); +int ui_mouse_button_clicked(int index); + +void ui_set_hot_item(const void *id); +void ui_set_active_item(const void *id); +void ui_clear_last_active_item(); +const void *ui_hot_item(); +const void *ui_next_hot_item(); +const void *ui_active_item(); +const void *ui_last_active_item(); + +int ui_mouse_inside(const RECT *r); + +RECT *ui_screen(); +void ui_set_scale(float s); +float ui_scale(); +void ui_clip_enable(const RECT *r); +void ui_clip_disable(); + +void ui_hsplit_t(const RECT *original, float cut, RECT *top, RECT *bottom); +void ui_hsplit_b(const RECT *original, float cut, RECT *top, RECT *bottom); +void ui_vsplit_mid(const RECT *original, RECT *left, RECT *right); +void ui_vsplit_l(const RECT *original, float cut, RECT *left, RECT *right); +void ui_vsplit_r(const RECT *original, float cut, RECT *left, RECT *right); + +void ui_margin(const RECT *original, float cut, RECT *other_rect); +void ui_vmargin(const RECT *original, float cut, RECT *other_rect); +void ui_hmargin(const RECT *original, float cut, RECT *other_rect); + +typedef void (*ui_draw_button_func)(const void *id, const char *text, int checked, const RECT *r, const void *extra); +int ui_do_button(const void *id, const char *text, int checked, const RECT *r, ui_draw_button_func draw_func, const void *extra); +void ui_do_label(const RECT *r, const char *text, float size, int align, int max_width = -1); + + +#endif -- cgit 1.4.1