mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
fixed on_console_init and on_save
This commit is contained in:
parent
a9211ffd64
commit
fa266334fd
|
@ -5,20 +5,14 @@
|
|||
#include "gameclient.hpp"
|
||||
#include "components/console.hpp"
|
||||
|
||||
extern "C" void modc_console_init()
|
||||
{
|
||||
//client_console_init();
|
||||
}
|
||||
|
||||
|
||||
extern "C" void modc_save_config()
|
||||
{
|
||||
//binds_save();
|
||||
}
|
||||
|
||||
// clean hooks
|
||||
extern "C" void modc_entergame() {}
|
||||
extern "C" void modc_shutdown() {}
|
||||
extern "C" void modc_console_init() { gameclient.on_console_init(); }
|
||||
extern "C" void modc_save_config() { gameclient.on_save(); }
|
||||
extern "C" void modc_init() { gameclient.on_init(); }
|
||||
extern "C" void modc_connected() { gameclient.on_connected(); }
|
||||
extern "C" void modc_predict() { gameclient.on_predict(); }
|
||||
|
|
|
@ -13,7 +13,9 @@ public:
|
|||
~COMPONENT() {}
|
||||
|
||||
virtual void on_statechange(int new_state, int old_state) {};
|
||||
virtual void on_console_init() {};
|
||||
virtual void on_init() {};
|
||||
virtual void on_save() {};
|
||||
virtual void on_reset() {};
|
||||
virtual void on_render() {};
|
||||
virtual void on_message(int msg, void *rawmsg) {}
|
||||
|
|
|
@ -92,7 +92,7 @@ void BINDS::set_defaults()
|
|||
bind('Y', "chat team");
|
||||
}
|
||||
|
||||
void BINDS::on_init()
|
||||
void BINDS::on_console_init()
|
||||
{
|
||||
// bindings
|
||||
MACRO_REGISTER_COMMAND("bind", "sr", con_bind, this);
|
||||
|
@ -176,8 +176,7 @@ int BINDS::get_key_id(const char *key_name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
void binds_save()
|
||||
void BINDS::on_save()
|
||||
{
|
||||
char buffer[256];
|
||||
char *end = buffer+sizeof(buffer)-8;
|
||||
|
@ -204,5 +203,3 @@ void binds_save()
|
|||
client_save_line(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
void unbindall();
|
||||
const char *get(int keyid);
|
||||
|
||||
virtual void on_init();
|
||||
virtual void on_save();
|
||||
virtual void on_console_init();
|
||||
virtual bool on_input(INPUT_EVENT e);
|
||||
};
|
||||
|
|
|
@ -39,7 +39,7 @@ void CHAT::con_chat(void *result, void *user_data)
|
|||
dbg_msg("console", "expected all or team as mode");
|
||||
}
|
||||
|
||||
void CHAT::on_init()
|
||||
void CHAT::on_console_init()
|
||||
{
|
||||
MACRO_REGISTER_COMMAND("say", "r", con_say, this);
|
||||
MACRO_REGISTER_COMMAND("say_team", "r", con_sayteam, this);
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
void say(int team, const char *line);
|
||||
|
||||
virtual void on_init();
|
||||
virtual void on_console_init();
|
||||
virtual void on_reset();
|
||||
virtual void on_render();
|
||||
virtual void on_message(int msgtype, void *rawmsg);
|
||||
|
|
|
@ -358,7 +358,7 @@ void CONSOLE::print_line(int type, const char *line)
|
|||
remote_console.print_line(line);
|
||||
}
|
||||
|
||||
void CONSOLE::on_init()
|
||||
void CONSOLE::on_console_init()
|
||||
{
|
||||
//
|
||||
console_register_print_callback(client_console_print_callback, this);
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
void print_line(int type, const char *line);
|
||||
|
||||
virtual void on_init();
|
||||
virtual void on_console_init();
|
||||
virtual void on_reset();
|
||||
virtual void on_render();
|
||||
virtual void on_message(int msgtype, void *rawmsg);
|
||||
|
|
|
@ -46,7 +46,7 @@ static void con_key_input_nextprev_weapon(void *result, void *user_data)
|
|||
set->controls->input_data.wanted_weapon = 0;
|
||||
}
|
||||
|
||||
void CONTROLS::on_init()
|
||||
void CONTROLS::on_console_init()
|
||||
{
|
||||
// game commands
|
||||
MACRO_REGISTER_COMMAND("+left", "", con_key_input_state, &input_direction_left);
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
CONTROLS();
|
||||
virtual void on_message(int msg, void *rawmsg);
|
||||
virtual bool on_mousemove(float x, float y);
|
||||
virtual void on_init();
|
||||
virtual void on_console_init();
|
||||
|
||||
int snapinput(int *data);
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@ void EMOTICON::con_emote(void *result, void *user_data)
|
|||
((EMOTICON *)user_data)->emote(console_arg_int(result, 0));
|
||||
}
|
||||
|
||||
void EMOTICON::on_init()
|
||||
void EMOTICON::on_console_init()
|
||||
{
|
||||
MACRO_REGISTER_COMMAND("+emote", "", con_key_emoticon, this);
|
||||
MACRO_REGISTER_COMMAND("emote", "", con_emote, this);
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
EMOTICON();
|
||||
|
||||
virtual void on_reset();
|
||||
virtual void on_init();
|
||||
virtual void on_console_init();
|
||||
virtual void on_render();
|
||||
virtual void on_message(int msgtype, void *rawmsg);
|
||||
virtual bool on_mousemove(float x, float y);
|
||||
|
|
|
@ -24,7 +24,7 @@ void SCOREBOARD::on_reset()
|
|||
active = false;
|
||||
}
|
||||
|
||||
void SCOREBOARD::on_init()
|
||||
void SCOREBOARD::on_console_init()
|
||||
{
|
||||
MACRO_REGISTER_COMMAND("+scoreboard", "", con_key_scoreboard, this);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class SCOREBOARD : public COMPONENT
|
|||
public:
|
||||
SCOREBOARD();
|
||||
virtual void on_reset();
|
||||
virtual void on_init();
|
||||
virtual void on_console_init();
|
||||
virtual void on_render();
|
||||
};
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ static void load_sounds_thread(void *do_render)
|
|||
}
|
||||
}
|
||||
|
||||
void GAMECLIENT::on_init()
|
||||
void GAMECLIENT::on_console_init()
|
||||
{
|
||||
// setup pointers
|
||||
binds = &::binds;
|
||||
|
@ -146,15 +146,23 @@ void GAMECLIENT::on_init()
|
|||
input.add(&emoticon);
|
||||
input.add(controls);
|
||||
input.add(binds);
|
||||
|
||||
// add the some console commands
|
||||
MACRO_REGISTER_COMMAND("team", "", con_team, this);
|
||||
MACRO_REGISTER_COMMAND("kill", "", con_kill, this);
|
||||
|
||||
for(int i = 0; i < all.num; i++)
|
||||
all.components[i]->on_console_init();
|
||||
}
|
||||
|
||||
void GAMECLIENT::on_init()
|
||||
{
|
||||
|
||||
|
||||
// init all components
|
||||
for(int i = 0; i < all.num; i++)
|
||||
all.components[i]->on_init();
|
||||
|
||||
// add the some console commands
|
||||
MACRO_REGISTER_COMMAND("team", "", con_team, this);
|
||||
MACRO_REGISTER_COMMAND("kill", "", con_kill, this);
|
||||
|
||||
// setup item sizes
|
||||
for(int i = 0; i < NUM_NETOBJTYPES; i++)
|
||||
snap_set_staticsize(i, netobj_get_size(i));
|
||||
|
@ -197,6 +205,12 @@ void GAMECLIENT::on_init()
|
|||
|
||||
}
|
||||
|
||||
void GAMECLIENT::on_save()
|
||||
{
|
||||
for(int i = 0; i < all.num; i++)
|
||||
all.components[i]->on_save();
|
||||
}
|
||||
|
||||
void GAMECLIENT::dispatch_input()
|
||||
{
|
||||
// handle mouse movement
|
||||
|
|
|
@ -90,6 +90,8 @@ public:
|
|||
void on_connected();
|
||||
void on_render();
|
||||
void on_init();
|
||||
void on_save();
|
||||
void on_console_init();
|
||||
void on_statechange(int new_state, int old_state);
|
||||
void on_message(int msgtype);
|
||||
void on_snapshot();
|
||||
|
|
Loading…
Reference in a new issue