diff options
| -rw-r--r-- | src/game/client/components/broadcast.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/components/chat.cpp | 1 | ||||
| -rw-r--r-- | src/game/client/components/console.cpp | 3 | ||||
| -rw-r--r-- | src/game/client/components/debughud.cpp | 5 | ||||
| -rw-r--r-- | src/game/client/components/effects.cpp | 3 | ||||
| -rw-r--r-- | src/game/client/components/hud.cpp | 1 | ||||
| -rw-r--r-- | src/game/client/components/items.cpp | 1 | ||||
| -rw-r--r-- | src/game/client/components/killmessages.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/components/menus.cpp | 39 | ||||
| -rw-r--r-- | src/game/client/components/motd.cpp | 1 | ||||
| -rw-r--r-- | src/game/client/components/players.cpp | 9 | ||||
| -rw-r--r-- | src/game/client/gameclient.cpp | 1 | ||||
| -rw-r--r-- | src/game/client/gameclient.hpp | 4 | ||||
| -rw-r--r-- | src/game/client/gc_client.hpp | 66 | ||||
| -rw-r--r-- | src/game/client/gc_hooks.cpp | 1 | ||||
| -rw-r--r-- | src/game/client/gc_render.cpp | 1 | ||||
| -rw-r--r-- | src/game/client/gc_render_map.cpp | 4 |
17 files changed, 55 insertions, 89 deletions
diff --git a/src/game/client/components/broadcast.cpp b/src/game/client/components/broadcast.cpp index 31ff6a71..960b004c 100644 --- a/src/game/client/components/broadcast.cpp +++ b/src/game/client/components/broadcast.cpp @@ -4,8 +4,6 @@ #include <game/generated/gc_data.hpp> #include <game/client/gameclient.hpp> -//#include <game/client/gc_anim.hpp> -#include <game/client/gc_client.hpp> #include "broadcast.hpp" diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index fbca1256..ca1d6ea5 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -5,7 +5,6 @@ #include <game/generated/gc_data.hpp> #include <game/client/gameclient.hpp> -#include <game/client/gc_client.hpp> #include <game/client/components/sounds.hpp> diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp index 66a2249a..9b5161a0 100644 --- a/src/game/client/components/console.cpp +++ b/src/game/client/components/console.cpp @@ -1,4 +1,6 @@ //#include "gc_console.hpp" +#include <math.h> + #include <game/generated/gc_data.hpp> #include <base/system.h> @@ -14,7 +16,6 @@ extern "C" { #include <cstdio> #include <game/client/gc_ui.hpp> -#include <game/client/gc_client.hpp> #include <game/version.hpp> diff --git a/src/game/client/components/debughud.cpp b/src/game/client/components/debughud.cpp index 0c8b0b91..7bb48307 100644 --- a/src/game/client/components/debughud.cpp +++ b/src/game/client/components/debughud.cpp @@ -12,7 +12,6 @@ extern "C" { #include <game/client/gameclient.hpp> #include <game/client/animstate.hpp> -#include <game/client/gc_client.hpp> #include <game/client/gc_render.hpp> //#include "controls.hpp" @@ -55,7 +54,7 @@ void DEBUGHUD::render_tuning() float y = 50.0f; int count = 0; - for(int i = 0; i < tuning.num(); i++) + for(int i = 0; i < gameclient.tuning.num(); i++) { char buf[128]; float current, standard; @@ -81,7 +80,7 @@ void DEBUGHUD::render_tuning() gfx_text(0x0, x-w, y+count*6, 5, buf, -1); x += 5.0f; - gfx_text(0x0, x, y+count*6, 5, tuning.names[i], -1); + gfx_text(0x0, x, y+count*6, 5, gameclient.tuning.names[i], -1); count++; } diff --git a/src/game/client/components/effects.cpp b/src/game/client/components/effects.cpp index 000d0f3a..282da6f8 100644 --- a/src/game/client/components/effects.cpp +++ b/src/game/client/components/effects.cpp @@ -7,10 +7,11 @@ #include <game/client/components/flow.hpp> #include <game/client/components/damageind.hpp> #include <game/client/gameclient.hpp> -#include <game/client/gc_client.hpp> #include "effects.hpp" +inline vec2 random_dir() { return normalize(vec2(frandom()-0.5f, frandom()-0.5f)); } + EFFECTS::EFFECTS() { add_50hz = false; diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index cee7a8bb..8344754e 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -8,7 +8,6 @@ #include <game/client/gameclient.hpp> #include <game/client/animstate.hpp> -#include <game/client/gc_client.hpp> #include <game/client/gc_render.hpp> #include "controls.hpp" diff --git a/src/game/client/components/items.cpp b/src/game/client/components/items.cpp index 43a3224a..940c39fd 100644 --- a/src/game/client/components/items.cpp +++ b/src/game/client/components/items.cpp @@ -4,7 +4,6 @@ #include <game/gamecore.hpp> // get_angle #include <game/client/gameclient.hpp> -#include <game/client/gc_client.hpp> #include <game/client/gc_ui.hpp> #include <game/client/gc_render.hpp> diff --git a/src/game/client/components/killmessages.cpp b/src/game/client/components/killmessages.cpp index 41ba2e48..106433f5 100644 --- a/src/game/client/components/killmessages.cpp +++ b/src/game/client/components/killmessages.cpp @@ -4,8 +4,6 @@ #include <game/client/gameclient.hpp> #include <game/client/animstate.hpp> -#include <game/client/gc_client.hpp> - #include "killmessages.hpp" void KILLMESSAGES::on_reset() diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 4a37669e..4893d0ea 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -26,7 +26,6 @@ extern "C" { #include <game/client/animstate.hpp> #include <game/client/gc_render.hpp> #include <game/client/gc_ui.hpp> -#include <game/client/gc_client.hpp> #include <mastersrv/mastersrv.h> vec4 MENUS::gui_color; @@ -41,6 +40,44 @@ vec4 MENUS::color_tabbar_active_ingame; INPUT_EVENT MENUS::inputevents[MAX_INPUTEVENTS]; int MENUS::num_inputevents; +inline float hue_to_rgb(float v1, float v2, float h) +{ + if(h < 0) h += 1; + if(h > 1) h -= 1; + if((6 * h) < 1) return v1 + ( v2 - v1 ) * 6 * h; + if((2 * h) < 1) return v2; + if((3 * h) < 2) return v1 + ( v2 - v1 ) * ((2.0f/3.0f) - h) * 6; + return v1; +} + +inline vec3 hsl_to_rgb(vec3 in) +{ + float v1, v2; + vec3 out; + + if(in.s == 0) + { + out.r = in.l; + out.g = in.l; + out.b = in.l; + } + else + { + if(in.l < 0.5f) + v2 = in.l * (1 + in.s); + else + v2 = (in.l+in.s) - (in.s*in.l); + + v1 = 2 * in.l - v2; + + out.r = hue_to_rgb(v1, v2, in.h + (1.0f/3.0f)); + out.g = hue_to_rgb(v1, v2, in.h); + out.b = hue_to_rgb(v1, v2, in.h - (1.0f/3.0f)); + } + + return out; +} + MENUS::MENUS() { diff --git a/src/game/client/components/motd.cpp b/src/game/client/components/motd.cpp index e5dfb507..19693390 100644 --- a/src/game/client/components/motd.cpp +++ b/src/game/client/components/motd.cpp @@ -4,7 +4,6 @@ #include <game/generated/gc_data.hpp> #include <game/client/gameclient.hpp> -#include <game/client/gc_client.hpp> #include "motd.hpp" diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index ed8d0c17..1d4452d4 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -5,7 +5,6 @@ #include <game/gamecore.hpp> // get_angle #include <game/client/animstate.hpp> #include <game/client/gameclient.hpp> -#include <game/client/gc_client.hpp> #include <game/client/gc_ui.hpp> #include <game/client/gc_render.hpp> @@ -125,8 +124,8 @@ void PLAYERS::render_player( else { // apply predicted results - predicted_char.write(&player); - predicted_prev_char.write(&prev); + gameclient.predicted_char.write(&player); + gameclient.predicted_prev_char.write(&prev); intratick = client_predintratick(); } } @@ -198,8 +197,8 @@ void PLAYERS::render_player( { if(gameclient.snap.local_info && player_char->hooked_player == gameclient.snap.local_info->cid) { - hook_pos = mix(vec2(predicted_prev_char.pos.x, predicted_prev_char.pos.y), - vec2(predicted_char.pos.x, predicted_char.pos.y), client_predintratick()); + hook_pos = mix(vec2(gameclient.predicted_prev_char.pos.x, gameclient.predicted_prev_char.pos.y), + vec2(gameclient.predicted_char.pos.x, gameclient.predicted_char.pos.y), client_predintratick()); } else hook_pos = mix(vec2(prev_char->hook_x, prev_char->hook_y), vec2(player_char->hook_x, player_char->hook_y), client_intratick()); diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index a6c531dd..1ff4225f 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -2,7 +2,6 @@ #include <game/generated/g_protocol.hpp> #include "gameclient.hpp" -#include "gc_client.hpp" #include "components/killmessages.hpp" #include "components/chat.hpp" #include "components/motd.hpp" diff --git a/src/game/client/gameclient.hpp b/src/game/client/gameclient.hpp index 0e6547d9..cfcf6a65 100644 --- a/src/game/client/gameclient.hpp +++ b/src/game/client/gameclient.hpp @@ -38,6 +38,10 @@ public: vec2 local_character_pos; vec2 local_target_pos; + // predicted players + CHARACTER_CORE predicted_prev_char; + CHARACTER_CORE predicted_char; + // snap pointers struct SNAPSTATE { diff --git a/src/game/client/gc_client.hpp b/src/game/client/gc_client.hpp deleted file mode 100644 index c164d990..00000000 --- a/src/game/client/gc_client.hpp +++ /dev/null @@ -1,66 +0,0 @@ -#include <base/vmath.hpp> - -#include <game/generated/g_protocol.hpp> -#include <game/gamecore.hpp> - -#include <game/client/gc_render.hpp> - -extern TUNING_PARAMS tuning; - -// predicted players -extern CHARACTER_CORE predicted_prev_char; -extern CHARACTER_CORE predicted_char; - -// extra projs -enum -{ - MAX_EXTRA_PROJECTILES=32, -}; - -extern NETOBJ_PROJECTILE extraproj_projectiles[MAX_EXTRA_PROJECTILES]; -extern int extraproj_num; -void extraproj_reset(); - -// various helpers -//void snd_play_random(int chn, int setid, float vol, vec2 pos); -//void chat_enable_mode(int team); - -inline vec2 random_dir() { return normalize(vec2(frandom()-0.5f, frandom()-0.5f)); } - -inline float hue_to_rgb(float v1, float v2, float h) -{ - if(h < 0) h += 1; - if(h > 1) h -= 1; - if((6 * h) < 1) return v1 + ( v2 - v1 ) * 6 * h; - if((2 * h) < 1) return v2; - if((3 * h) < 2) return v1 + ( v2 - v1 ) * ((2.0f/3.0f) - h) * 6; - return v1; -} - -inline vec3 hsl_to_rgb(vec3 in) -{ - float v1, v2; - vec3 out; - - if(in.s == 0) - { - out.r = in.l; - out.g = in.l; - out.b = in.l; - } - else - { - if(in.l < 0.5f) - v2 = in.l * (1 + in.s); - else - v2 = (in.l+in.s) - (in.s*in.l); - - v1 = 2 * in.l - v2; - - out.r = hue_to_rgb(v1, v2, in.h + (1.0f/3.0f)); - out.g = hue_to_rgb(v1, v2, in.h); - out.b = hue_to_rgb(v1, v2, in.h - (1.0f/3.0f)); - } - - return out; -} diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp index 19bc3ae2..cd027ff2 100644 --- a/src/game/client/gc_hooks.cpp +++ b/src/game/client/gc_hooks.cpp @@ -16,7 +16,6 @@ extern "C" { #include "components/skins.hpp" #include "components/console.hpp" -#include "gc_client.hpp" #include "gc_render.hpp" #include "gc_map_image.hpp" diff --git a/src/game/client/gc_render.cpp b/src/game/client/gc_render.cpp index 6dacc354..4dcc4583 100644 --- a/src/game/client/gc_render.cpp +++ b/src/game/client/gc_render.cpp @@ -10,7 +10,6 @@ #include <game/layers.hpp> #include "animstate.hpp" #include "gc_render.hpp" -#include "gc_client.hpp" #include "gc_map_image.hpp" static float sprite_w_scale; diff --git a/src/game/client/gc_render_map.cpp b/src/game/client/gc_render_map.cpp index bbd9f7b1..d4f35d6c 100644 --- a/src/game/client/gc_render_map.cpp +++ b/src/game/client/gc_render_map.cpp @@ -1,7 +1,9 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ +#include <math.h> #include <base/math.hpp> #include <engine/e_client_interface.h> -#include "gc_client.hpp" + +#include "gc_render.hpp" void render_eval_envelope(ENVPOINT *points, int num_points, int channels, float time, float *result) { |