scoreboard fixed

This commit is contained in:
Magnus Auvinen 2008-08-27 19:50:33 +00:00
parent 8f23204eef
commit ae364d4d29
11 changed files with 46 additions and 33 deletions

View file

@ -14,6 +14,9 @@ extern "C" {
#include "e_if_msg.h" #include "e_if_msg.h"
#include "e_if_modc.h" #include "e_if_modc.h"
#include "e_console.h"
#include "e_config.h"
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -1,7 +1,7 @@
#ifndef _RINGBUFFER_H #ifndef _RINGBUFFER_H
#define _RINGBUFFER_H #define _RINGBUFFER_H
typedef struct typedef struct RINGBUFFER
{ {
/* what you need */ /* what you need */
struct RBITEM_t *next_alloc; struct RBITEM_t *next_alloc;

View file

@ -1,7 +1,4 @@
extern "C" { #include <engine/e_client_interface.h>
#include <engine/e_console.h>
}
#include "binds.hpp" #include "binds.hpp"
BINDS::BINDS() BINDS::BINDS()

View file

@ -1,15 +1,10 @@
#include <string.h> // strcmp #include <string.h> // strcmp
extern "C" {
#include <engine/e_console.h>
}
#include <engine/e_client_interface.h> #include <engine/e_client_interface.h>
#include <game/generated/g_protocol.hpp> #include <game/generated/g_protocol.hpp>
#include <game/generated/gc_data.hpp> #include <game/generated/gc_data.hpp>
#include <game/client/gameclient.hpp> #include <game/client/gameclient.hpp>
//#include <game/client/gc_anim.hpp>
#include <game/client/gc_client.hpp> #include <game/client/gc_client.hpp>
#include "chat.hpp" #include "chat.hpp"

View file

@ -3,10 +3,9 @@
#include <base/system.h> #include <base/system.h>
#include <engine/e_client_interface.h>
extern "C" { extern "C" {
#include <engine/e_client_interface.h>
#include <engine/e_config.h>
#include <engine/e_console.h>
#include <engine/e_ringbuffer.h> #include <engine/e_ringbuffer.h>
#include <engine/client/ec_font.h> #include <engine/client/ec_font.h>
} }

View file

@ -1,11 +1,4 @@
extern "C" { #include <engine/e_client_interface.h>
#include <engine/e_client_interface.h>
#include <engine/e_config.h>
#include <engine/e_console.h>
#include <engine/e_ringbuffer.h>
#include <engine/client/ec_font.h>
}
#include <game/client/component.hpp> #include <game/client/component.hpp>
class CONSOLE : public COMPONENT class CONSOLE : public COMPONENT
@ -14,11 +7,11 @@ class CONSOLE : public COMPONENT
{ {
public: public:
char history_data[65536]; char history_data[65536];
RINGBUFFER *history; struct RINGBUFFER *history;
char *history_entry; char *history_entry;
char backlog_data[65536]; char backlog_data[65536];
RINGBUFFER *backlog; struct RINGBUFFER *backlog;
LINEINPUT input; LINEINPUT input;

View file

@ -1,9 +1,4 @@
extern "C" { #include <engine/e_client_interface.h>
#include <engine/e_config.h>
#include <engine/e_console.h>
#include <engine/e_client_interface.h>
}
#include <base/math.hpp> #include <base/math.hpp>
#include <game/collision.hpp> #include <game/collision.hpp>
#include <game/client/gameclient.hpp> #include <game/client/gameclient.hpp>

View file

@ -1,5 +1,4 @@
#include <string.h> #include <string.h>
#include <engine/e_client_interface.h> #include <engine/e_client_interface.h>
#include <game/generated/g_protocol.hpp> #include <game/generated/g_protocol.hpp>
#include <game/generated/gc_data.hpp> #include <game/generated/gc_data.hpp>
@ -8,6 +7,27 @@
#include <game/client/gc_render.hpp> #include <game/client/gc_render.hpp>
#include "scoreboard.hpp" #include "scoreboard.hpp"
SCOREBOARD::SCOREBOARD()
{
on_reset();
}
void SCOREBOARD::con_key_scoreboard(void *result, void *user_data)
{
((SCOREBOARD *)user_data)->active = console_arg_int(result, 0) != 0;
}
void SCOREBOARD::on_reset()
{
active = false;
}
void SCOREBOARD::on_init()
{
MACRO_REGISTER_COMMAND("+scoreboard", "", con_key_scoreboard, this);
}
void SCOREBOARD::render_goals(float x, float y, float w) void SCOREBOARD::render_goals(float x, float y, float w)
{ {
float h = 50.0f; float h = 50.0f;
@ -204,6 +224,8 @@ void SCOREBOARD::render_scoreboard(float x, float y, float w, int team, const ch
void SCOREBOARD::on_render() void SCOREBOARD::on_render()
{ {
if(!active)
return;
// TODO: repair me // TODO: repair me
/* /*

View file

@ -5,7 +5,15 @@ class SCOREBOARD : public COMPONENT
void render_goals(float x, float y, float w); void render_goals(float x, float y, float w);
void render_spectators(float x, float y, float w); void render_spectators(float x, float y, float w);
void render_scoreboard(float x, float y, float w, int team, const char *title); void render_scoreboard(float x, float y, float w, int team, const char *title);
static void con_key_scoreboard(void *result, void *user_data);
bool active;
public: public:
SCOREBOARD();
virtual void on_reset();
virtual void on_init();
virtual void on_render(); virtual void on_render();
}; };

View file

@ -21,6 +21,7 @@
#include "components/debughud.hpp" #include "components/debughud.hpp"
#include "components/controls.hpp" #include "components/controls.hpp"
#include "components/effects.hpp" #include "components/effects.hpp"
#include "components/scoreboard.hpp"
GAMECLIENT gameclient; GAMECLIENT gameclient;
@ -40,6 +41,7 @@ static HUD hud;
static DEBUGHUD debughud; static DEBUGHUD debughud;
static CONTROLS controls; static CONTROLS controls;
static EFFECTS effects; static EFFECTS effects;
static SCOREBOARD scoreboard;
static PLAYERS players; static PLAYERS players;
static ITEMS items; static ITEMS items;
@ -85,6 +87,7 @@ void GAMECLIENT::on_init()
all.add(chat); all.add(chat);
all.add(&broadcast); all.add(&broadcast);
all.add(&debughud); all.add(&debughud);
all.add(&scoreboard);
all.add(&motd); all.add(&motd);
all.add(menus); all.add(menus);
all.add(console); all.add(console);

View file

@ -3,9 +3,7 @@
#include <engine/e_client_interface.h> #include <engine/e_client_interface.h>
extern "C" { extern "C" {
#include <engine/e_config.h>
#include <engine/client/ec_font.h> #include <engine/client/ec_font.h>
#include <engine/e_console.h>
}; };
#include <game/generated/gc_data.hpp> #include <game/generated/gc_data.hpp>