fixed the remote console

This commit is contained in:
Magnus Auvinen 2008-08-30 08:01:29 +00:00
parent 0511e1152a
commit b4cef60d62
6 changed files with 34 additions and 43 deletions

View file

@ -349,6 +349,14 @@ void CONSOLE::client_console_print_callback(const char *str, void *user_data)
((CONSOLE *)user_data)->local_console.print_line(str);
}
void CONSOLE::print_line(int type, const char *line)
{
if(type == 0)
local_console.print_line(line);
else if(type == 1)
remote_console.print_line(line);
}
void CONSOLE::on_init()
{
//
@ -372,13 +380,15 @@ static void con_team(void *result, void *user_data)
send_switch_team(console_arg_int(result, 0));
}
void send_kill(int client_id);
static void con_kill(void *result, void *user_data)
{
send_kill(-1);
}
void send_kill(int client_id);
static void con_key_input_state(void *result, void *user_data)
{
((int *)user_data)[0] = console_arg_int(result, 0);

View file

@ -1,5 +1,6 @@
#include <engine/e_client_interface.h>
#include <game/client/component.hpp>
#include <game/client/lineinput.hpp>
class CONSOLE : public COMPONENT
{
@ -47,6 +48,8 @@ class CONSOLE : public COMPONENT
public:
CONSOLE();
void print_line(int type, const char *line);
virtual void on_init();
virtual void on_reset();
virtual void on_render();

View file

@ -11,6 +11,8 @@ void SOUNDS::on_init()
snd_set_channel(SOUNDS::CHN_MUSIC, 1.0f, 0.0f);
snd_set_channel(SOUNDS::CHN_WORLD, 0.9f, 1.0f);
snd_set_channel(SOUNDS::CHN_GLOBAL, 1.0f, 0.0f);
snd_set_listener_pos(0.0f, 0.0f);
}
void SOUNDS::on_render()

View file

@ -12,9 +12,9 @@ extern "C" {
#include <game/layers.hpp>
#include "gameclient.hpp"
#include "components/skins.hpp"
#include "components/console.hpp"
#include "gc_client.hpp"
#include "gc_render.hpp"
@ -22,10 +22,6 @@ extern "C" {
extern unsigned char internal_data[];
extern void menu_init();
extern bool menu_active;
extern bool menu_game_active;
static float load_total;
static float load_current;
@ -34,8 +30,6 @@ extern "C" void modc_console_init()
//client_console_init();
}
//binds_save()
static void load_sounds_thread(void *do_render)
{
// load sounds
@ -70,15 +64,9 @@ extern "C" void modc_init()
gfx_text_set_default_font(&default_font);
//particle_reset();
//menu_init();
// load the data container
//data = load_data_from_memory(internal_data);
// TODO: should be removed
snd_set_listener_pos(0.0f, 0.0f);
// setup load amount
load_total = data->num_images;
load_current = 0;
@ -95,7 +83,6 @@ extern "C" void modc_init()
}
gameclient.skins->init();
//skin_init();
if(config.cl_threadsoundloading)
thread_create(load_sounds_thread, 0);
@ -111,22 +98,9 @@ extern "C" void modc_save_config()
//binds_save();
}
CHARACTER_CORE predicted_prev_char;
CHARACTER_CORE predicted_char;
extern "C" void modc_entergame() {}
extern "C" void modc_shutdown() {}
extern "C" void modc_predict() { gameclient.on_predict(); }
extern "C" void modc_newsnapshot() { gameclient.on_snapshot(); }
extern "C" int modc_snap_input(int *data) { return gameclient.on_snapinput(data); }
extern "C" void modc_statechange(int state, int old) { gameclient.on_statechange(state, old); }
extern "C" void modc_render() { gameclient.on_render(); }
extern "C" void modc_rcon_line(const char *line)
{
//console_rcon_print(line);
}
/*
NETOBJ_PROJECTILE extraproj_projectiles[MAX_EXTRA_PROJECTILES];
@ -137,28 +111,29 @@ void extraproj_reset()
extraproj_num = 0;
}*/
extern "C" void modc_message(int msgtype)
{
gameclient.on_message(msgtype);
}
extern "C" void modc_connected()
{
// init some stuff
layers_init();
col_init();
img_init();
//flow_init();
render_tilemap_generate_skip();
gameclient.on_connected();
//tilemap_init();
//particle_reset();
//extraproj_reset();
//last_new_predicted_tick = -1;
}
// clean hooks
extern "C" void modc_entergame() {}
extern "C" void modc_shutdown() {}
extern "C" void modc_predict() { gameclient.on_predict(); }
extern "C" void modc_newsnapshot() { gameclient.on_snapshot(); }
extern "C" int modc_snap_input(int *data) { return gameclient.on_snapinput(data); }
extern "C" void modc_statechange(int state, int old) { gameclient.on_statechange(state, old); }
extern "C" void modc_render() { gameclient.on_render(); }
extern "C" void modc_message(int msgtype) { gameclient.on_message(msgtype); }
extern "C" void modc_rcon_line(const char *line) { gameclient.console->print_line(1, line); }
extern "C" const char *modc_net_version() { return GAME_NETVERSION; }
extern "C" const char *modc_getitemname(int type) { return netobj_get_name(type); }

View file

@ -52,9 +52,6 @@ void ui_draw_rect(const RECT *r, vec4 color, int corners, float rounding);
// larger rendering methods
void render_loading(float percent);
void render_damage_indicators();
void render_particles();
void render_tilemap_generate_skip();
// object render methods (gc_render_obj.cpp)

View file

@ -1,3 +1,5 @@
#ifndef GAME_CLIENT_LINEINPUT_H
#define GAME_CLIENT_LINEINPUT_H
// line input helter
class LINEINPUT
@ -21,3 +23,5 @@ public:
int get_length() const { return len; }
unsigned cursor_offset() const { return cursor_pos; }
};
#endif