Skip to content

Instantly share code, notes, and snippets.

@MegaManSec
Last active January 7, 2024 14:11
Show Gist options
  • Save MegaManSec/3f6ba81e1724295ffc4a to your computer and use it in GitHub Desktop.
Save MegaManSec/3f6ba81e1724295ffc4a to your computer and use it in GitHub Desktop.
Teeworlds 0.5.2 BBM mod patch
diff -Naur Coding/teeworlds-0.5.2-src/src/engine/e_config_variables.h BlockMod/src/engine/e_config_variables.h
--- Coding/teeworlds-0.5.2-src/src/engine/e_config_variables.h 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/engine/e_config_variables.h 2010-11-28 01:39:58.000000000 +1100
@@ -27,6 +27,12 @@
MACRO_CONFIG_INT(b_filter_pure_map, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-standard maps in browser")
MACRO_CONFIG_INT(b_filter_compatversion, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-compatible servers in browser")
+MACRO_CONFIG_INT(sv_max_connections, 2, 1, 16, CFGFLAG_SERVER, "Maximum count of connection from one IP server can accept")
+MACRO_CONFIG_INT(sv_rcon_tries, 5, 0, 100, CFGFLAG_SERVER, "How Many Password Tries Before ban")
+MACRO_CONFIG_INT(sv_rcon_tries_bantime, 300, 0, 9999, CFGFLAG_SERVER, "How Much time will the brute rcon password attacker will be banned")
+MACRO_CONFIG_INT(sv_netmsg_limit, 0, 0, 100, CFGFLAG_SERVER, "How Many unauthed Command Tries Before ban")
+MACRO_CONFIG_INT(sv_netmsg_bantime, 300, 0, 9999, CFGFLAG_SERVER, "How Much time will the unauthed rcon command spammer will be banned")
+
MACRO_CONFIG_INT(b_sort, 0, 0, 256, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
MACRO_CONFIG_INT(b_sort_order, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
MACRO_CONFIG_INT(b_max_requests, 10, 0, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Number of requests to use when refreshing server browser")
diff -Naur Coding/teeworlds-0.5.2-src/src/engine/server/es_server.c BlockMod/src/engine/server/es_server.c
--- Coding/teeworlds-0.5.2-src/src/engine/server/es_server.c 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/engine/server/es_server.c 2010-11-28 01:39:47.000000000 +1100
@@ -23,8 +23,8 @@
#include <mastersrv/mastersrv.h>
#if defined(CONF_FAMILY_WINDOWS)
- #define _WIN32_WINNT 0x0500
- #include <windows.h>
+#define _WIN32_WINNT 0x0500
+#include <windows.h>
#endif
static SNAPBUILD builder;
@@ -33,7 +33,8 @@
static int current_tick = 0;
static int run_server = 1;
-static char browseinfo_gametype[16] = {0};
+static char browseinfo_gametype[16] =
+{ 0 };
static int browseinfo_progression = -1;
static int64 lastheartbeat;
@@ -58,8 +59,8 @@
int timeout;
} SNAP_ID;
-static const int MAX_IDS = 16*1024; /* should be lowered */
-static SNAP_ID snap_ids[16*1024];
+static const int MAX_IDS = 16 * 1024; /* should be lowered */
+static SNAP_ID snap_ids[16 * 1024];
static int snap_first_free_id;
static int snap_first_timed_id;
static int snap_last_timed_id;
@@ -69,23 +70,17 @@
enum
{
- SRVCLIENT_STATE_EMPTY = 0,
- SRVCLIENT_STATE_AUTH,
- SRVCLIENT_STATE_CONNECTING,
- SRVCLIENT_STATE_READY,
- SRVCLIENT_STATE_INGAME,
-
- SRVCLIENT_SNAPRATE_INIT=0,
- SRVCLIENT_SNAPRATE_FULL,
- SRVCLIENT_SNAPRATE_RECOVER
+ SRVCLIENT_STATE_EMPTY = 0, SRVCLIENT_STATE_AUTH, SRVCLIENT_STATE_CONNECTING, SRVCLIENT_STATE_READY, SRVCLIENT_STATE_INGAME,
+
+ SRVCLIENT_SNAPRATE_INIT = 0, SRVCLIENT_SNAPRATE_FULL, SRVCLIENT_SNAPRATE_RECOVER
};
-typedef struct
+typedef struct
{
int data[MAX_INPUT_SIZE];
int game_tick; /* the tick that was chosen for the input */
} CLIENT_INPUT;
-
+
/* */
typedef struct
{
@@ -93,19 +88,27 @@
int state;
int latency;
int snap_rate;
-
+
int last_acked_snapshot;
int last_input_tick;
SNAPSTORAGE snapshots;
-
+
CLIENT_INPUT latestinput;
CLIENT_INPUT inputs[200]; /* TODO: handle input better */
int current_input;
-
+
char name[MAX_NAME_LENGTH];
char clan[MAX_CLANNAME_LENGTH];
int score;
int authed;
+
+ //Counting IPs 2cpip
+ NETADDR addr; // for storing address
+ //rcon count
+ int pw_tries; // a players rcon pw tries Kottizen
+ int command_tries; // players rcon command tries, to prevent command flood server crash
+ int64 command_tries_timer; // time
+
} CLIENT;
static CLIENT clients[MAX_CLIENTS];
@@ -114,39 +117,39 @@
static void snap_init_id()
{
int i;
- if(snap_id_inited)
+ if (snap_id_inited)
return;
-
- for(i = 0; i < MAX_IDS; i++)
+
+ for (i = 0; i < MAX_IDS; i++)
{
- snap_ids[i].next = i+1;
+ snap_ids[i].next = i + 1;
snap_ids[i].state = 0;
}
-
- snap_ids[MAX_IDS-1].next = -1;
+
+ snap_ids[MAX_IDS - 1].next = -1;
snap_first_free_id = 0;
snap_first_timed_id = -1;
snap_last_timed_id = -1;
snap_id_usage = 0;
snap_id_inusage = 0;
-
+
snap_id_inited = 1;
}
static void snap_remove_first_timeout()
{
int next_timed = snap_ids[snap_first_timed_id].next;
-
+
/* add it to the free list */
snap_ids[snap_first_timed_id].next = snap_first_free_id;
snap_ids[snap_first_timed_id].state = 0;
snap_first_free_id = snap_first_timed_id;
-
+
/* remove it from the timed list */
snap_first_timed_id = next_timed;
- if(snap_first_timed_id == -1)
+ if (snap_first_timed_id == -1)
snap_last_timed_id = -1;
-
+
snap_id_usage--;
}
@@ -154,13 +157,13 @@
{
int id;
int64 now = time_get();
- if(!snap_id_inited)
+ if (!snap_id_inited)
snap_init_id();
-
+
/* process timed ids */
- while(snap_first_timed_id != -1 && snap_ids[snap_first_timed_id].timeout < now)
+ while (snap_first_timed_id != -1 && snap_ids[snap_first_timed_id].timeout < now)
snap_remove_first_timeout();
-
+
id = snap_first_free_id;
dbg_assert(id != -1, "id error");
snap_first_free_id = snap_ids[snap_first_free_id].next;
@@ -173,7 +176,7 @@
void snap_timeout_ids()
{
/* process timed ids */
- while(snap_first_timed_id != -1)
+ while (snap_first_timed_id != -1)
snap_remove_first_timeout();
}
@@ -183,10 +186,10 @@
snap_id_inusage--;
snap_ids[id].state = 2;
- snap_ids[id].timeout = time_get()+time_freq()*5;
+ snap_ids[id].timeout = time_get() + time_freq() * 5;
snap_ids[id].next = -1;
-
- if(snap_last_timed_id != -1)
+
+ if (snap_last_timed_id != -1)
{
snap_ids[snap_last_timed_id].next = id;
snap_last_timed_id = id;
@@ -200,31 +203,31 @@
int *server_latestinput(int client_id, int *size)
{
- if(client_id < 0 || client_id > MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY)
+ if (client_id < 0 || client_id >= MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY)
return 0;
return clients[client_id].latestinput.data;
}
const char *server_clientname(int client_id)
{
- if(client_id < 0 || client_id > MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY)
+ if (client_id < 0 || client_id >= MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY)
return "(invalid client)";
return clients[client_id].name;
}
static const char *str_ltrim(const char *str)
{
- while(*str && *str <= 32)
+ while (*str && *str <= 32)
str++;
return str;
}
static void str_rtrim(char *str)
{
- int i = str_length(str)-1;
- while(i >= 0)
+ int i = str_length(str) - 1;
+ while (i >= 0)
{
- if(i > 23 || str[i] <= 32)
+ if (i > 23 || str[i] <= 32)
str[i] = 0;
else
break;
@@ -240,19 +243,18 @@
/* trim the name */
str_copy(trimmed_name, str_ltrim(name), sizeof(trimmed_name));
str_rtrim(trimmed_name);
- dbg_msg("", "'%s' -> '%s'", name, trimmed_name);
+ // dbg_msg("", "'%s' -> '%s'", name, trimmed_name);
name = trimmed_name;
-
-
+
/* check for empty names */
- if(!name[0])
+ if (!name[0])
return -1;
-
+
/* make sure that two clients doesn't have the same name */
- for(i = 0; i < MAX_CLIENTS; i++)
- if(i != client_id && clients[i].state >= SRVCLIENT_STATE_READY)
+ for (i = 0; i < MAX_CLIENTS; i++)
+ if (i != client_id && clients[i].state >= SRVCLIENT_STATE_READY)
{
- if(strcmp(name, clients[i].name) == 0)
+ if (strcmp(name, clients[i].name) == 0)
return -1;
}
@@ -265,20 +267,20 @@
{
char nametry[MAX_NAME_LENGTH];
int i;
- if(client_id < 0 || client_id > MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY)
+ if (client_id < 0 || client_id >= MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY)
return;
-
- if(!name)
+
+ if (!name)
return;
-
+
str_copy(nametry, name, MAX_NAME_LENGTH);
- if(server_try_setclientname(client_id, nametry))
+ if (server_try_setclientname(client_id, nametry))
{
/* auto rename */
- for(i = 1;; i++)
+ for (i = 1;; i++)
{
str_format(nametry, MAX_NAME_LENGTH, "(%d)%s", i, name);
- if(server_try_setclientname(client_id, nametry) == 0)
+ if (server_try_setclientname(client_id, nametry) == 0)
break;
}
}
@@ -286,7 +288,7 @@
void server_setclientscore(int client_id, int score)
{
- if(client_id < 0 || client_id > MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY)
+ if (client_id < 0 || client_id >= MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY)
return;
clients[client_id].score = score;
}
@@ -295,18 +297,18 @@
{
str_copy(browseinfo_gametype, game_type, sizeof(browseinfo_gametype));
browseinfo_progression = progression;
- if(browseinfo_progression > 100)
+ if (browseinfo_progression > 100)
browseinfo_progression = 100;
- if(browseinfo_progression < -1)
+ if (browseinfo_progression < -1)
browseinfo_progression = -1;
}
void server_kick(int client_id, const char *reason)
{
- if(client_id < 0 || client_id > MAX_CLIENTS)
+ if (client_id < 0 || client_id >= MAX_CLIENTS)
return;
-
- if(clients[client_id].state != SRVCLIENT_STATE_EMPTY)
+
+ if (clients[client_id].state != SRVCLIENT_STATE_EMPTY)
netserver_drop(net, client_id, reason);
}
@@ -317,7 +319,7 @@
int64 server_tick_start_time(int tick)
{
- return game_start_time + (time_freq()*tick)/SERVER_TICK_SPEED;
+ return game_start_time + (time_freq() * tick) / SERVER_TICK_SPEED;
}
int server_tickspeed()
@@ -328,7 +330,7 @@
int server_init()
{
int i;
- for(i = 0; i < MAX_CLIENTS; i++)
+ for (i = 0; i < MAX_CLIENTS; i++)
{
clients[i].state = SRVCLIENT_STATE_EMPTY;
clients[i].name[0] = 0;
@@ -346,7 +348,7 @@
dbg_assert(client_id >= 0 && client_id < MAX_CLIENTS, "client_id is not valid");
dbg_assert(info != 0, "info can not be null");
- if(clients[client_id].state == SRVCLIENT_STATE_INGAME)
+ if (clients[client_id].state == SRVCLIENT_STATE_INGAME)
{
info->name = clients[client_id].name;
info->latency = clients[client_id].latency;
@@ -359,32 +361,32 @@
{
const MSG_INFO *info = msg_get_info();
NETCHUNK packet;
- if(!info)
+ if (!info)
return -1;
-
+
mem_zero(&packet, sizeof(NETCHUNK));
-
+
packet.client_id = client_id;
packet.data = info->data;
packet.data_size = info->size;
- if(info->flags&MSGFLAG_VITAL)
+ if (info->flags & MSGFLAG_VITAL)
packet.flags |= NETSENDFLAG_VITAL;
- if(info->flags&MSGFLAG_FLUSH)
+ if (info->flags & MSGFLAG_FLUSH)
packet.flags |= NETSENDFLAG_FLUSH;
-
+
/* write message to demo recorder */
- if(!(info->flags&MSGFLAG_NORECORD))
+ if (!(info->flags & MSGFLAG_NORECORD))
demorec_record_message(info->data, info->size);
- if(!(info->flags&MSGFLAG_NOSEND))
+ if (!(info->flags & MSGFLAG_NOSEND))
{
- if(client_id == -1)
+ if (client_id == -1)
{
/* broadcast */
int i;
- for(i = 0; i < MAX_CLIENTS; i++)
- if(clients[i].state == SRVCLIENT_STATE_INGAME)
+ for (i = 0; i < MAX_CLIENTS; i++)
+ if (clients[i].state == SRVCLIENT_STATE_INGAME)
{
packet.client_id = i;
netserver_send(net, &packet);
@@ -399,16 +401,17 @@
static void server_do_snap()
{
int i;
-
+
{
- static PERFORMACE_INFO scope = {"presnap", 0};
+ static PERFORMACE_INFO scope =
+ { "presnap", 0 };
perf_start(&scope);
mods_presnap();
perf_end();
}
-
+
/* create snapshot for demo recording */
- if(demorec_isrecording())
+ if (demorec_isrecording())
{
char data[MAX_SNAPSHOT_SIZE];
int snapshot_size;
@@ -417,26 +420,26 @@
snapbuild_init(&builder);
mods_snap(-1);
snapshot_size = snapbuild_finish(&builder, data);
-
+
/* write snapshot */
demorec_record_snapshot(server_tick(), data, snapshot_size);
}
/* create snapshots for all clients */
- for(i = 0; i < MAX_CLIENTS; i++)
+ for (i = 0; i < MAX_CLIENTS; i++)
{
/* client must be ingame to recive snapshots */
- if(clients[i].state != SRVCLIENT_STATE_INGAME)
+ if (clients[i].state != SRVCLIENT_STATE_INGAME)
continue;
-
+
/* this client is trying to recover, don't spam snapshots */
- if(clients[i].snap_rate == SRVCLIENT_SNAPRATE_RECOVER && (server_tick()%50) != 0)
+ if (clients[i].snap_rate == SRVCLIENT_SNAPRATE_RECOVER && (server_tick() % 50) != 0)
continue;
-
+
/* this client is trying to recover, don't spam snapshots */
- if(clients[i].snap_rate == SRVCLIENT_SNAPRATE_INIT && (server_tick()%10) != 0)
+ if (clients[i].snap_rate == SRVCLIENT_SNAPRATE_INIT && (server_tick() % 10) != 0)
continue;
-
+
{
char data[MAX_SNAPSHOT_SIZE];
char deltadata[MAX_SNAPSHOT_SIZE];
@@ -448,13 +451,15 @@
int deltashot_size;
int delta_tick = -1;
int deltasize;
- static PERFORMACE_INFO scope = {"build", 0};
+ static PERFORMACE_INFO scope =
+ { "build", 0 };
perf_start(&scope);
snapbuild_init(&builder);
{
- static PERFORMACE_INFO scope = {"modsnap", 0};
+ static PERFORMACE_INFO scope =
+ { "modsnap", 0 };
perf_start(&scope);
mods_snap(i);
perf_end();
@@ -462,41 +467,41 @@
/* finish snapshot */
snapshot_size = snapbuild_finish(&builder, data);
- crc = snapshot_crc((SNAPSHOT*)data);
+ crc = snapshot_crc((SNAPSHOT*) data);
/* remove old snapshos */
/* keep 3 seconds worth of snapshots */
- snapstorage_purge_until(&clients[i].snapshots, current_tick-SERVER_TICK_SPEED*3);
-
+ snapstorage_purge_until(&clients[i].snapshots, current_tick - SERVER_TICK_SPEED * 3);
+
/* save it the snapshot */
snapstorage_add(&clients[i].snapshots, current_tick, time_get(), snapshot_size, data, 0);
-
+
/* find snapshot that we can preform delta against */
emptysnap.data_size = 0;
emptysnap.num_items = 0;
-
+
{
deltashot_size = snapstorage_get(&clients[i].snapshots, clients[i].last_acked_snapshot, 0, &deltashot, 0);
- if(deltashot_size >= 0)
+ if (deltashot_size >= 0)
delta_tick = clients[i].last_acked_snapshot;
else
{
/* no acked package found, force client to recover rate */
- if(clients[i].snap_rate == SRVCLIENT_SNAPRATE_FULL)
+ if (clients[i].snap_rate == SRVCLIENT_SNAPRATE_FULL)
clients[i].snap_rate = SRVCLIENT_SNAPRATE_RECOVER;
}
}
-
+
/* create delta */
{
- static PERFORMACE_INFO scope = {"delta", 0};
+ static PERFORMACE_INFO scope =
+ { "delta", 0 };
perf_start(&scope);
- deltasize = snapshot_create_delta(deltashot, (SNAPSHOT*)data, deltadata);
+ deltasize = snapshot_create_delta(deltashot, (SNAPSHOT*) data, deltadata);
perf_end();
}
-
- if(deltasize)
+ if (deltasize)
{
/* compress it */
int snapshot_size;
@@ -504,42 +509,43 @@
int numpackets;
int n, left;
- {
- static PERFORMACE_INFO scope = {"compress", 0};
+ {
+ static PERFORMACE_INFO scope =
+ { "compress", 0 };
/*char buffer[512];*/
perf_start(&scope);
snapshot_size = intpack_compress(deltadata, deltasize, compdata);
-
+
/*str_hex(buffer, sizeof(buffer), compdata, snapshot_size);
- dbg_msg("", "deltasize=%d -> %d : %s", deltasize, snapshot_size, buffer);*/
-
+ dbg_msg("", "deltasize=%d -> %d : %s", deltasize, snapshot_size, buffer);*/
+
perf_end();
}
- numpackets = (snapshot_size+max_size-1)/max_size;
-
- for(n = 0, left = snapshot_size; left; n++)
+ numpackets = (snapshot_size + max_size - 1) / max_size;
+
+ for (n = 0, left = snapshot_size; left; n++)
{
int chunk = left < max_size ? left : max_size;
left -= chunk;
- if(numpackets == 1)
+ if (numpackets == 1)
msg_pack_start_system(NETMSG_SNAPSINGLE, MSGFLAG_FLUSH);
else
msg_pack_start_system(NETMSG_SNAP, MSGFLAG_FLUSH);
-
+
msg_pack_int(current_tick);
- msg_pack_int(current_tick-delta_tick); /* compressed with */
-
- if(numpackets != 1)
+ msg_pack_int(current_tick - delta_tick); /* compressed with */
+
+ if (numpackets != 1)
{
msg_pack_int(numpackets);
msg_pack_int(n);
}
-
+
msg_pack_int(crc);
msg_pack_int(chunk);
- msg_pack_raw(&compdata[n*max_size], chunk);
+ msg_pack_raw(&compdata[n * max_size], chunk);
msg_pack_end();
server_send_msg(i);
}
@@ -548,11 +554,11 @@
{
msg_pack_start_system(NETMSG_SNAPEMPTY, MSGFLAG_FLUSH);
msg_pack_int(current_tick);
- msg_pack_int(current_tick-delta_tick); /* compressed with */
+ msg_pack_int(current_tick - delta_tick); /* compressed with */
msg_pack_end();
server_send_msg(i);
}
-
+
perf_end();
}
}
@@ -560,12 +566,11 @@
mods_postsnap();
}
-
static void reset_client(int cid)
{
/* reset input */
int i;
- for(i = 0; i < 200; i++)
+ for (i = 0; i < 200; i++)
clients[cid].inputs[i].game_tick = -1;
clients[cid].current_input = 0;
mem_zero(&clients[cid].latestinput, sizeof(clients[cid].latestinput));
@@ -584,6 +589,7 @@
clients[cid].name[0] = 0;
clients[cid].clan[0] = 0;
clients[cid].authed = 0;
+ memset(&clients[cid].addr, 0, sizeof(NETADDR)); // init that too for 2cpip
reset_client(cid);
return 0;
}
@@ -591,20 +597,21 @@
static int del_client_callback(int cid, void *user)
{
/* notify the mod about the drop */
- if(clients[cid].state >= SRVCLIENT_STATE_READY)
+ if (clients[cid].state >= SRVCLIENT_STATE_READY)
mods_client_drop(cid);
-
+
clients[cid].state = SRVCLIENT_STATE_EMPTY;
clients[cid].name[0] = 0;
clients[cid].clan[0] = 0;
clients[cid].authed = 0;
+ memset(&clients[cid].addr, 0, sizeof(NETADDR));
snapstorage_purge_all(&clients[cid].snapshots);
return 0;
}
static void server_send_map(int cid)
{
- msg_pack_start_system(NETMSG_MAP_CHANGE, MSGFLAG_VITAL|MSGFLAG_FLUSH);
+ msg_pack_start_system(NETMSG_MAP_CHANGE, MSGFLAG_VITAL | MSGFLAG_FLUSH);
msg_pack_string(config.sv_map, 0);
msg_pack_int(current_map_crc);
msg_pack_end();
@@ -623,16 +630,17 @@
{
static volatile int reentry_guard = 0;
int i;
-
- if(reentry_guard) return;
+
+ if (reentry_guard)
+ return;
reentry_guard++;
-
- for(i = 0; i < MAX_CLIENTS; i++)
+
+ for (i = 0; i < MAX_CLIENTS; i++)
{
- if(clients[i].state != SRVCLIENT_STATE_EMPTY && clients[i].authed)
+ if (clients[i].state != SRVCLIENT_STATE_EMPTY && clients[i].authed)
server_send_rcon_line(i, line);
}
-
+
reentry_guard--;
}
@@ -640,18 +648,19 @@
{
int cid = packet->client_id;
NETADDR addr;
-
+
int sys;
int msg = msg_unpack_start(packet->data, packet->data_size, &sys);
-
- if(clients[cid].state == SRVCLIENT_STATE_AUTH)
+
+ if (clients[cid].state == SRVCLIENT_STATE_AUTH)
{
- if(sys && msg == NETMSG_INFO)
+ if (sys && msg == NETMSG_INFO)
{
char version[64];
const char *password;
+ int i, ipcnt = 0; // ip count
str_copy(version, msg_unpack_string(), 64);
- if(strcmp(version, mods_net_version()) != 0)
+ if (strcmp(version, mods_net_version()) != 0)
{
/* OH FUCK! wrong version, drop him */
char reason[256];
@@ -659,110 +668,182 @@
netserver_drop(net, cid, reason);
return;
}
-
+
str_copy(clients[cid].name, msg_unpack_string(), MAX_NAME_LENGTH);
str_copy(clients[cid].clan, msg_unpack_string(), MAX_CLANNAME_LENGTH);
password = msg_unpack_string();
-
- if(config.password[0] != 0 && strcmp(config.password, password) != 0)
+
+ if (config.password[0] != 0 && strcmp(config.password, password) != 0)
{
/* wrong password */
netserver_drop(net, cid, "wrong password");
return;
}
-
+ //begin of 2cpip LemonFace
+ netserver_client_addr(net, cid, &addr);
+ clients[cid].addr = addr; // store the address info
+ for (i = 0; i < MAX_CLIENTS; i++)
+ {
+ if (clients[i].state != SRVCLIENT_STATE_EMPTY) // if not an empty slot
+ {
+ /* if (clients[i].addr.ip[0] == addr.ip[0] && // check each ip byte
+ clients[i].addr.ip[1] == addr.ip[1] && clients[i].addr.ip[2] == addr.ip[2] && clients[i].addr.ip[3]
+ == addr.ip[3]) *///(lol)
+ //why the fuck is ip of type char[16]?!
+ if (memcmp(clients[i].addr.ip, addr.ip, 4) == 0)
+ {
+
+ if (clients[i].authed > 0) // authed players can have clones
+ {
+ ipcnt = 0;
+ break;
+ }
+ ipcnt++;
+ }
+ }
+ }
+
+ if (ipcnt > config.sv_max_connections) // if already n connections exist, drop him
+ {
+ dbg_msg("server", "player dropped, too many connections from your site. cid=%x ip=%d.%d.%d.%d", cid, addr.ip[0],
+ addr.ip[1], addr.ip[2], addr.ip[3]);
+ netserver_drop(net, cid, "Connections Per IP Limit Exceeded");
+ return;
+ }//endof 2cpip by LemonFace
clients[cid].state = SRVCLIENT_STATE_CONNECTING;
server_send_map(cid);
}
}
else
{
- if(sys)
+ if (clients[cid].state < SRVCLIENT_STATE_CONNECTING)
+ {
+ return;
+ }
+ else
+ {
+ if (clients[cid].authed == 0 && msg != NETMSG_INPUT && msg != NETMSG_REQUEST_MAP_DATA)
+ {
+ if (time_get() > clients[cid].command_tries_timer + time_freq())
+ {
+ clients[cid].command_tries = 0;
+ clients[cid].command_tries_timer = time_get();
+ }
+ clients[cid].command_tries++;
+ //dbg_msg("server","client_counter: %d", clients[cid].command_tries);
+
+ if (clients[cid].command_tries > config.sv_netmsg_limit && config.sv_netmsg_limit != 0)
+ {//removed the 'DDoS'. a single client can never perform a _D_DoS since D means distributed.
+ dbg_msg("server", "client sending too many messages to server, banned. cid=%x ip=%d.%d.%d.%d", cid,
+ clients[cid].addr.ip[0], clients[cid].addr.ip[1], clients[cid].addr.ip[2], clients[cid].addr.ip[3]);
+
+ server_ban_add(clients[cid].addr, config.sv_netmsg_bantime); // bye
+ return;
+ }
+ }
+ }
+
+ if (sys)
{
+ if (msg != NETMSG_INPUT && msg != NETMSG_REQUEST_MAP_DATA)
+ {
+ clients[cid].command_tries++;
+ if ((time_get() < clients[cid].command_tries_timer + time_freq()/* * 1*/) && clients[cid].authed == 0)
+ {
+ if (clients[cid].command_tries > config.sv_netmsg_limit && config.sv_netmsg_limit != 0)
+ {
+ dbg_msg("server", "client trying to flood the server (%d tries), ban. cid=%x ip=%d.%d.%d.%d",
+ clients[cid].command_tries, cid, clients[cid].addr.ip[0], clients[cid].addr.ip[1], clients[cid].addr.ip[2],
+ clients[cid].addr.ip[3]);
+ server_ban_add(clients[cid].addr, config.sv_netmsg_bantime); // bye
+ return;
+ }
+ }
+ else
+ {
+ clients[cid].command_tries = 0;
+ }
+ clients[cid].command_tries_timer = time_get();
+ }
/* system message */
- if(msg == NETMSG_REQUEST_MAP_DATA)
+ if (msg == NETMSG_REQUEST_MAP_DATA)
{
int chunk = msg_unpack_int();
- int chunk_size = 1024-128;
+ int chunk_size = 1024 - 128;
int offset = chunk * chunk_size;
int last = 0;
-
+
/* drop faulty map data requests */
- if(chunk < 0 || offset > current_map_size)
+ if (chunk < 0 || offset > current_map_size)
return;
-
- if(offset+chunk_size >= current_map_size)
+
+ if (offset + chunk_size >= current_map_size)
{
- chunk_size = current_map_size-offset;
- if(chunk_size < 0)
+ chunk_size = current_map_size - offset;
+ if (chunk_size < 0)
chunk_size = 0;
last = 1;
}
-
- msg_pack_start_system(NETMSG_MAP_DATA, MSGFLAG_VITAL|MSGFLAG_FLUSH);
+
+ msg_pack_start_system(NETMSG_MAP_DATA, MSGFLAG_VITAL | MSGFLAG_FLUSH);
msg_pack_int(last);
msg_pack_int(current_map_size);
msg_pack_int(chunk_size);
msg_pack_raw(&current_map_data[offset], chunk_size);
msg_pack_end();
server_send_msg(cid);
-
- if(config.debug)
+
+ if (config.debug)
dbg_msg("server", "sending chunk %d with size %d", chunk, chunk_size);
}
- else if(msg == NETMSG_READY)
+ else if (msg == NETMSG_READY)
{
- if(clients[cid].state == SRVCLIENT_STATE_CONNECTING)
+ if (clients[cid].state == SRVCLIENT_STATE_CONNECTING)
{
netserver_client_addr(net, cid, &addr);
-
- dbg_msg("server", "player is ready. cid=%x ip=%d.%d.%d.%d",
- cid,
- addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3]
- );
+
+ dbg_msg("server", "player is ready. cid=%x ip=%d.%d.%d.%d", cid, addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3]);
clients[cid].state = SRVCLIENT_STATE_READY;
mods_connected(cid);
}
}
- else if(msg == NETMSG_ENTERGAME)
+ else if (msg == NETMSG_ENTERGAME)
{
- if(clients[cid].state == SRVCLIENT_STATE_READY)
+ if (clients[cid].state == SRVCLIENT_STATE_READY)
{
netserver_client_addr(net, cid, &addr);
-
- dbg_msg("server", "player has entered the game. cid=%x ip=%d.%d.%d.%d",
- cid,
- addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3]
- );
+
+ dbg_msg("server", "player has entered the game. cid=%x ip=%d.%d.%d.%d", cid, addr.ip[0], addr.ip[1], addr.ip[2],
+ addr.ip[3]);
clients[cid].state = SRVCLIENT_STATE_INGAME;
mods_client_enter(cid);
}
}
- else if(msg == NETMSG_INPUT)
+ else if (msg == NETMSG_INPUT)
{
int tick, size, i;
CLIENT_INPUT *input;
int64 tagtime;
-
+
clients[cid].last_acked_snapshot = msg_unpack_int();
tick = msg_unpack_int();
size = msg_unpack_int();
-
+
/* check for errors */
- if(msg_unpack_error() || size/4 > MAX_INPUT_SIZE)
+ if (msg_unpack_error() || size / 4 > MAX_INPUT_SIZE)
return;
- if(clients[cid].last_acked_snapshot > 0)
+ if (clients[cid].last_acked_snapshot > 0)
clients[cid].snap_rate = SRVCLIENT_SNAPRATE_FULL;
-
- if(snapstorage_get(&clients[cid].snapshots, clients[cid].last_acked_snapshot, &tagtime, 0, 0) >= 0)
- clients[cid].latency = (int)(((time_get()-tagtime)*1000)/time_freq());
+
+ if (snapstorage_get(&clients[cid].snapshots, clients[cid].last_acked_snapshot, &tagtime, 0, 0) >= 0)
+ clients[cid].latency = (int) (((time_get() - tagtime) * 1000) / time_freq());
/* add message to report the input timing */
/* skip packets that are old */
- if(tick > clients[cid].last_input_tick)
+ if (tick > clients[cid].last_input_tick)
{
- int time_left = ((server_tick_start_time(tick)-time_get())*1000) / time_freq();
+ int time_left = ((server_tick_start_time(tick) - time_get()) * 1000) / time_freq();
msg_pack_start_system(NETMSG_INPUTTIMING, 0);
msg_pack_int(tick);
msg_pack_int(time_left);
@@ -773,64 +854,71 @@
clients[cid].last_input_tick = tick;
input = &clients[cid].inputs[clients[cid].current_input];
-
- if(tick <= server_tick())
- tick = server_tick()+1;
+
+ if (tick <= server_tick())
+ tick = server_tick() + 1;
input->game_tick = tick;
-
- for(i = 0; i < size/4; i++)
+
+ for (i = 0; i < size / 4; i++)
input->data[i] = msg_unpack_int();
-
- mem_copy(clients[cid].latestinput.data, input->data, MAX_INPUT_SIZE*sizeof(int));
-
+
+ mem_copy(clients[cid].latestinput.data, input->data, MAX_INPUT_SIZE * sizeof(int));
+
clients[cid].current_input++;
clients[cid].current_input %= 200;
-
+
/* call the mod with the fresh input data */
- if(clients[cid].state == SRVCLIENT_STATE_INGAME)
+ if (clients[cid].state == SRVCLIENT_STATE_INGAME)
mods_client_direct_input(cid, clients[cid].latestinput.data);
}
- else if(msg == NETMSG_RCON_CMD)
+ else if (msg == NETMSG_RCON_CMD)
{
const char *cmd = msg_unpack_string();
-
- if(msg_unpack_error() == 0 && clients[cid].authed)
+
+ if (msg_unpack_error() == 0 && clients[cid].authed)
{
dbg_msg("server", "cid=%d rcon='%s'", cid, cmd);
console_execute_line(cmd);
}
}
- else if(msg == NETMSG_RCON_AUTH)
+ else if (msg == NETMSG_RCON_AUTH)
{
const char *pw;
msg_unpack_string(); /* login name, not used */
pw = msg_unpack_string();
-
- if(msg_unpack_error() == 0)
+
+ if (msg_unpack_error() == 0)
{
- if(config.sv_rcon_password[0] == 0)
+ if (config.sv_rcon_password[0] == 0)
{
server_send_rcon_line(cid, "No rcon password set on server. Set sv_rcon_password to enable the remote console.");
}
- else if(strcmp(pw, config.sv_rcon_password) == 0)
+ else if (strcmp(pw, config.sv_rcon_password) == 0)
{
msg_pack_start_system(NETMSG_RCON_AUTH_STATUS, MSGFLAG_VITAL);
msg_pack_int(1);
msg_pack_end();
server_send_msg(cid);
-
+
clients[cid].authed = 1;
server_send_rcon_line(cid, "Authentication successful. Remote console access granted.");
dbg_msg("server", "cid=%d authed", cid);
}
else
{
+ if (++clients[cid].pw_tries > config.sv_rcon_tries)
+ { // too many rcon pw tries
+ dbg_msg("server", "client tried bruteforce rcon, automated ban. cid=%x ip=%d.%d.%d.%d", cid,
+ clients[cid].addr.ip[0], clients[cid].addr.ip[1], clients[cid].addr.ip[2], clients[cid].addr.ip[3]);
+
+ server_ban_add(clients[cid].addr, config.sv_rcon_tries_bantime); // bye
+ }
server_send_rcon_line(cid, "Wrong password.");
}
}
}
- else if(msg == NETMSG_PING)
+ else if (msg == NETMSG_PING)
{
msg_pack_start_system(NETMSG_PING_REPLY, 0);
msg_pack_end();
@@ -842,32 +930,31 @@
char buf[512];
int b;
- for(b = 0; b < packet->data_size && b < 32; b++)
+ for (b = 0; b < packet->data_size && b < 32; b++)
{
- buf[b*3] = hex[((const unsigned char *)packet->data)[b]>>4];
- buf[b*3+1] = hex[((const unsigned char *)packet->data)[b]&0xf];
- buf[b*3+2] = ' ';
- buf[b*3+3] = 0;
+ buf[b * 3] = hex[((const unsigned char *) packet->data)[b] >> 4];
+ buf[b * 3 + 1] = hex[((const unsigned char *) packet->data)[b] & 0xf];
+ buf[b * 3 + 2] = ' ';
+ buf[b * 3 + 3] = 0;
}
dbg_msg("server", "strange message cid=%d msg=%d data_size=%d", cid, msg, packet->data_size);
dbg_msg("server", "%s", buf);
-
+
}
}
else
{
/* game message */
- if(clients[cid].state >= SRVCLIENT_STATE_READY)
+ if (clients[cid].state >= SRVCLIENT_STATE_READY)
mods_message(msg, cid);
}
}
}
-
int server_ban_add(NETADDR addr, int seconds)
{
- return netserver_ban_add(net, addr, seconds);
+ return netserver_ban_add(net, addr, seconds);
}
int server_ban_remove(NETADDR addr)
@@ -881,18 +968,18 @@
PACKER p;
char buf[128];
- /* count the players */
+ /* count the players */
int player_count = 0;
int i;
- for(i = 0; i < MAX_CLIENTS; i++)
+ for (i = 0; i < MAX_CLIENTS; i++)
{
- if(clients[i].state != SRVCLIENT_STATE_EMPTY)
+ if (clients[i].state != SRVCLIENT_STATE_EMPTY)
player_count++;
}
-
+
packer_reset(&p);
- if(token >= 0)
+ if (token >= 0)
{
/* new token based format */
packer_add_raw(&p, SERVERBROWSE_INFO, sizeof(SERVERBROWSE_INFO));
@@ -904,7 +991,7 @@
/* old format */
packer_add_raw(&p, SERVERBROWSE_OLD_INFO, sizeof(SERVERBROWSE_OLD_INFO));
}
-
+
packer_add_string(&p, mods_version(), 32);
packer_add_string(&p, config.sv_name, 64);
packer_add_string(&p, config.sv_map, 32);
@@ -914,7 +1001,7 @@
/* flags */
i = 0;
- if(config.password[0]) /* password set */
+ if (config.password[0]) /* password set */
i |= SRVFLAG_PASSWORD;
str_format(buf, sizeof(buf), "%d", i);
packer_add_string(&p, buf, 2);
@@ -922,20 +1009,22 @@
/* progression */
str_format(buf, sizeof(buf), "%d", browseinfo_progression);
packer_add_string(&p, buf, 4);
-
- str_format(buf, sizeof(buf), "%d", player_count); packer_add_string(&p, buf, 3); /* num players */
- str_format(buf, sizeof(buf), "%d", netserver_max_clients(net)); packer_add_string(&p, buf, 3); /* max players */
- for(i = 0; i < MAX_CLIENTS; i++)
+ str_format(buf, sizeof(buf), "%d", player_count);
+ packer_add_string(&p, buf, 3); /* num players */
+ str_format(buf, sizeof(buf), "%d", netserver_max_clients(net));
+ packer_add_string(&p, buf, 3); /* max players */
+
+ for (i = 0; i < MAX_CLIENTS; i++)
{
- if(clients[i].state != SRVCLIENT_STATE_EMPTY)
+ if (clients[i].state != SRVCLIENT_STATE_EMPTY)
{
- packer_add_string(&p, clients[i].name, 48); /* player name */
- str_format(buf, sizeof(buf), "%d", clients[i].score); packer_add_string(&p, buf, 6); /* player score */
+ packer_add_string(&p, clients[i].name, 48); /* player name */
+ str_format(buf, sizeof(buf), "%d", clients[i].score);
+ packer_add_string(&p, buf, 6); /* player score */
}
}
-
-
+
packet.client_id = -1;
packet.address = *addr;
packet.flags = NETSENDFLAG_CONNLESS;
@@ -952,24 +1041,23 @@
NETCHUNK packet;
netserver_update(net);
-
+
/* process packets */
- while(netserver_recv(net, &packet))
+ while (netserver_recv(net, &packet))
{
- if(packet.client_id == -1)
+ if (packet.client_id == -1)
{
/* stateless */
- if(!register_process_packet(&packet))
+ if (!register_process_packet(&packet))
{
- if(packet.data_size == sizeof(SERVERBROWSE_GETINFO)+1 &&
- memcmp(packet.data, SERVERBROWSE_GETINFO, sizeof(SERVERBROWSE_GETINFO)) == 0)
+ if (packet.data_size == sizeof(SERVERBROWSE_GETINFO) + 1 && memcmp(packet.data, SERVERBROWSE_GETINFO,
+ sizeof(SERVERBROWSE_GETINFO)) == 0)
{
- server_send_serverinfo(&packet.address, ((unsigned char *)packet.data)[sizeof(SERVERBROWSE_GETINFO)]);
+ server_send_serverinfo(&packet.address, ((unsigned char *) packet.data)[sizeof(SERVERBROWSE_GETINFO)]);
}
-
-
- if(packet.data_size == sizeof(SERVERBROWSE_OLD_GETINFO) &&
- memcmp(packet.data, SERVERBROWSE_OLD_GETINFO, sizeof(SERVERBROWSE_OLD_GETINFO)) == 0)
+
+ if (packet.data_size == sizeof(SERVERBROWSE_OLD_GETINFO) && memcmp(packet.data, SERVERBROWSE_OLD_GETINFO,
+ sizeof(SERVERBROWSE_OLD_GETINFO)) == 0)
{
server_send_serverinfo(&packet.address, -1);
}
@@ -986,26 +1074,26 @@
char buf[512];
str_format(buf, sizeof(buf), "maps/%s.map", mapname);
df = datafile_load(buf);
- if(!df)
+ if (!df)
return 0;
-
+
/* reinit snapshot ids */
snap_timeout_ids();
-
+
/* get the crc of the map */
current_map_crc = datafile_crc(buf);
dbg_msg("server", "%s crc is %08x", buf, current_map_crc);
-
+
str_copy(current_map, mapname, sizeof(current_map));
map_set(df);
-
+
/* load compelate map into memory for download */
{
IOHANDLE file = engine_openfile(buf, IOFLAG_READ);
- current_map_size = (int)io_length(file);
- if(current_map_data)
+ current_map_size = (int) io_length(file);
+ if (current_map_data)
mem_free(current_map_data);
- current_map_data = (unsigned char *)mem_alloc(current_map_size, 1);
+ current_map_data = (unsigned char *) mem_alloc(current_map_size, 1);
io_read(file, current_map_data, current_map_size);
io_close(file);
}
@@ -1018,20 +1106,20 @@
snap_init_id();
net_init();
-
+
/* */
console_register_print_callback(server_send_rcon_line_authed, 0);
/* load map */
- if(!server_load_map(config.sv_map))
+ if (!server_load_map(config.sv_map))
{
dbg_msg("server", "failed to load map. mapname='%s'", config.sv_map);
return -1;
}
-
+
/* start server */
/* TODO: IPv6 support */
- if(config.sv_bindaddr[0] && net_host_lookup(config.sv_bindaddr, &bindaddr, NETTYPE_IPV4) == 0)
+ if (config.sv_bindaddr[0] && net_host_lookup(config.sv_bindaddr, &bindaddr, NETTYPE_IPV4) == 0)
{
/* sweet! */
bindaddr.port = config.sv_port;
@@ -1041,18 +1129,18 @@
mem_zero(&bindaddr, sizeof(bindaddr));
bindaddr.port = config.sv_port;
}
-
+
net = netserver_open(bindaddr, config.sv_max_clients, 0);
- if(!net)
+ if (!net)
{
dbg_msg("server", "couldn't open socket. port might already be in use");
return -1;
}
-
+
netserver_set_callbacks(net, new_client_callback, del_client_callback, 0);
-
+
dbg_msg("server", "server name is '%s'", config.sv_name);
-
+
mods_init();
dbg_msg("server", "version %s", mods_net_version());
@@ -1060,44 +1148,45 @@
{
int64 reporttime = time_get();
int reportinterval = 3;
-
+
lastheartbeat = 0;
game_start_time = time_get();
-
- if(config.debug)
- dbg_msg("server", "baseline memory usage %dk", mem_stats()->allocated/1024);
- while(run_server)
+ if (config.debug)
+ dbg_msg("server", "baseline memory usage %dk", mem_stats()->allocated / 1024);
+
+ while (run_server)
{
- static PERFORMACE_INFO rootscope = {"root", 0};
+ static PERFORMACE_INFO rootscope =
+ { "root", 0 };
int64 t = time_get();
int new_ticks = 0;
-
+
perf_start(&rootscope);
-
+
/* load new map TODO: don't poll this */
- if(strcmp(config.sv_map, current_map) != 0 || config.sv_map_reload)
+ if (strcmp(config.sv_map, current_map) != 0 || config.sv_map_reload)
{
config.sv_map_reload = 0;
-
+
/* load map */
- if(server_load_map(config.sv_map))
+ if (server_load_map(config.sv_map))
{
int c;
-
+
/* new map loaded */
mods_shutdown();
-
- for(c = 0; c < MAX_CLIENTS; c++)
+
+ for (c = 0; c < MAX_CLIENTS; c++)
{
- if(clients[c].state == SRVCLIENT_STATE_EMPTY)
+ if (clients[c].state == SRVCLIENT_STATE_EMPTY)
continue;
-
+
server_send_map(c);
reset_client(c);
clients[c].state = SRVCLIENT_STATE_CONNECTING;
}
-
+
game_start_time = time_get();
current_tick = 0;
mods_init();
@@ -1108,96 +1197,99 @@
config_set_sv_map(&config, current_map);
}
}
-
- while(t > server_tick_start_time(current_tick+1))
+
+ while (t > server_tick_start_time(current_tick + 1))
{
current_tick++;
new_ticks++;
-
+
/* apply new input */
{
- static PERFORMACE_INFO scope = {"input", 0};
+ static PERFORMACE_INFO scope =
+ { "input", 0 };
int c, i;
-
+
perf_start(&scope);
-
- for(c = 0; c < MAX_CLIENTS; c++)
+
+ for (c = 0; c < MAX_CLIENTS; c++)
{
- if(clients[c].state == SRVCLIENT_STATE_EMPTY)
+ if (clients[c].state == SRVCLIENT_STATE_EMPTY)
continue;
- for(i = 0; i < 200; i++)
+ for (i = 0; i < 200; i++)
{
- if(clients[c].inputs[i].game_tick == server_tick())
+ if (clients[c].inputs[i].game_tick == server_tick())
{
- if(clients[c].state == SRVCLIENT_STATE_INGAME)
+ if (clients[c].state == SRVCLIENT_STATE_INGAME)
mods_client_predicted_input(c, clients[c].inputs[i].data);
break;
}
}
}
-
+
perf_end();
}
-
+
/* progress game */
{
- static PERFORMACE_INFO scope = {"tick", 0};
+ static PERFORMACE_INFO scope =
+ { "tick", 0 };
perf_start(&scope);
mods_tick();
perf_end();
}
}
-
+
/* snap game */
- if(new_ticks)
+ if (new_ticks)
{
- if(config.sv_high_bandwidth || (current_tick%2) == 0)
+ if (config.sv_high_bandwidth || (current_tick % 2) == 0)
{
- static PERFORMACE_INFO scope = {"snap", 0};
+ static PERFORMACE_INFO scope =
+ { "snap", 0 };
perf_start(&scope);
server_do_snap();
perf_end();
}
}
-
+
/* master server stuff */
register_update();
-
{
- static PERFORMACE_INFO scope = {"net", 0};
+ static PERFORMACE_INFO scope =
+ { "net", 0 };
perf_start(&scope);
server_pump_network();
perf_end();
}
perf_end();
-
- if(reporttime < time_get())
+
+ if (reporttime < time_get())
{
- if(config.debug)
+ if (config.debug)
{
/*
- static NETSTATS prev_stats;
- NETSTATS stats;
- netserver_stats(net, &stats);
-
- perf_next();
-
- if(config.dbg_pref)
- perf_dump(&rootscope);
-
- dbg_msg("server", "send=%8d recv=%8d",
- (stats.send_bytes - prev_stats.send_bytes)/reportinterval,
- (stats.recv_bytes - prev_stats.recv_bytes)/reportinterval);
-
- prev_stats = stats;
- */
+ static NETSTATS prev_stats;
+ NETSTATS stats;
+ netserver_stats(net, &stats);
+
+ perf_next();
+
+ if(config.dbg_pref)
+ perf_dump(&rootscope);
+
+ dbg_msg("server", "send=%8d recv=%8d",
+ (stats.send_bytes - prev_stats.send_bytes)/reportinterval,
+ (stats.recv_bytes - prev_stats.recv_bytes)/reportinterval);
+
+ prev_stats = stats;
+ */
}
-
- reporttime += time_freq()*reportinterval;
+
+ reporttime += time_freq() * reportinterval;
}
-
+
/* wait for incomming data */
net_socket_read_wait(netserver_socket(net), 5);
}
@@ -1206,7 +1298,7 @@
mods_shutdown();
map_unload();
- if(current_map_data)
+ if (current_map_data)
mem_free(current_map_data);
return 0;
}
@@ -1218,9 +1310,9 @@
static int str_allnum(const char *str)
{
- while(*str)
+ while (*str)
{
- if(!(*str >= '0' && *str <= '9'))
+ if (!(*str >= '0' && *str <= '9'))
return 0;
str++;
}
@@ -1232,33 +1324,33 @@
NETADDR addr;
char addrstr[128];
const char *str = console_arg_string(result, 0);
- int minutes = 30;
-
- if(console_arg_num(result) > 1)
- minutes = console_arg_int(result, 1);
-
- if(net_addr_from_str(&addr, str) == 0)
- server_ban_add(addr, minutes*60);
- else if(str_allnum(str))
+ int seconds = 300;
+
+ if (console_arg_num(result) > 1)
+ seconds = console_arg_int(result, 1);
+
+ if (net_addr_from_str(&addr, str) == 0)
+ server_ban_add(addr, seconds);
+ else if (str_allnum(str))
{
NETADDR addr;
int cid = atoi(str);
- if(cid < 0 || cid > MAX_CLIENTS || clients[cid].state == SRVCLIENT_STATE_EMPTY)
+ if (cid < 0 || cid >= MAX_CLIENTS || clients[cid].state == SRVCLIENT_STATE_EMPTY)
{
dbg_msg("server", "invalid client id");
return;
}
netserver_client_addr(net, cid, &addr);
- server_ban_add(addr, minutes*60);
+ server_ban_add(addr,seconds);
}
-
+
addr.port = 0;
net_addr_str(&addr, addrstr, sizeof(addrstr));
-
- if(minutes)
- dbg_msg("server", "banned %s for %d minutes", addrstr, minutes);
+
+ if (seconds)
+ dbg_msg("server", "banned %s for %d seconds", addrstr, seconds);
else
dbg_msg("server", "banned %s for life", addrstr);
}
@@ -1267,8 +1359,8 @@
{
NETADDR addr;
const char *str = console_arg_string(result, 0);
-
- if(net_addr_from_str(&addr, str) == 0)
+
+ if (net_addr_from_str(&addr, str) == 0)
server_ban_remove(addr);
else
dbg_msg("server", "invalid network address");
@@ -1281,20 +1373,21 @@
NETBANINFO info;
NETADDR addr;
int num = netserver_ban_num(net);
- for(i = 0; i < num; i++)
+ for (i = 0; i < num; i++)
{
unsigned t;
netserver_ban_get(net, i, &info);
addr = info.addr;
-
- if(info.expires == 0xffffffff)
+
+ if (info.expires == 0xffffffff)
{
dbg_msg("server", "#%d %d.%d.%d.%d for life", i, addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3]);
}
else
{
t = info.expires - now;
- dbg_msg("server", "#%d %d.%d.%d.%d for %d minutes and %d seconds", i, addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3], t/60, t%60);
+ dbg_msg("server", "#%d %d.%d.%d.%d for %d minutes and %d seconds", i, addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3], t / 60, t
+ % 60);
}
}
dbg_msg("server", "%d ban(s)", num);
@@ -1304,14 +1397,13 @@
{
int i;
NETADDR addr;
- for(i = 0; i < MAX_CLIENTS; i++)
+ for (i = 0; i < MAX_CLIENTS; i++)
{
- if(clients[i].state == SRVCLIENT_STATE_INGAME)
+ if (clients[i].state == SRVCLIENT_STATE_INGAME)
{
netserver_client_addr(net, i, &addr);
- dbg_msg("server", "id=%d addr=%d.%d.%d.%d:%d name='%s' score=%d",
- i, addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3], addr.port,
- clients[i].name, clients[i].score);
+ dbg_msg("server", "id=%d addr=%d.%d.%d.%d:%d name='%s' score=%d", i, addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3], addr.port,
+ clients[i].name, clients[i].score);
}
}
}
@@ -1363,14 +1455,14 @@
/* init the engine */
dbg_msg("server", "starting...");
engine_init("Teeworlds");
-
+
/* register all console commands */
server_register_commands();
mods_console_init();
-
+
/* parse the command line arguments */
engine_parse_arguments(argc, argv);
-
+
/* run the server */
server_run();
return 0;
diff -Naur Coding/teeworlds-0.5.2-src/src/game/collision.cpp BlockMod/src/game/collision.cpp
--- Coding/teeworlds-0.5.2-src/src/game/collision.cpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/collision.cpp 2010-11-28 01:39:32.000000000 +1100
@@ -16,18 +16,43 @@
int col_width() { return width; }
int col_height() { return height; }
+int *dc;
+int **dest;
+
+
int col_init()
{
width = layers_game_layer()->width;
height = layers_game_layer()->height;
tiles = (TILE *)map_get_data(layers_game_layer()->data);
-
+ dbg_msg("collision","start loop (w: %i, h: %i",width,height);
+ int tpnum=(TILE_TPORT_LAST-TILE_TPORT_FIRST+1)>>1;
+ int *destcount=(int*)malloc(sizeof(int)*tpnum);
+ dc=(int*)malloc(sizeof(int)*tpnum);
+ dest=(int**)malloc(sizeof(int*)*tpnum);
+ for(int z=0;z<tpnum;++z) destcount[z]=dc[z]=0;
+
+ for(int i = 0; i < width*height; i++) //tport first
+ {
+ int index = tiles[i].index;
+ if(index >= TILE_TPORT_FIRST && index <= TILE_TPORT_LAST && !(index&1)) {
+ int tind = ((index-TILE_TPORT_FIRST) >> 1);
+ destcount[tind]++;dc[tind]++;
+ }
+ }
+ for(int z=0;z<tpnum;++z) {
+ if (destcount[z]) {
+ dest[z]=(int*)malloc(sizeof(int)*destcount[z]);
+ }
+
+ }
+
for(int i = 0; i < width*height; i++)
{
int index = tiles[i].index;
-
- if(index > 128)
+ if(index >= TILE_CUSTOM_END) {
continue;
+ }
if(index == TILE_DEATH)
tiles[i].index = COLFLAG_DEATH;
@@ -35,30 +60,43 @@
tiles[i].index = COLFLAG_SOLID;
else if(index == TILE_NOHOOK)
tiles[i].index = COLFLAG_SOLID|COLFLAG_NOHOOK;
- else
+ else if(index >= TILE_TPORT_FIRST && index <= TILE_TPORT_LAST && !(index&1)) {
+ int tind = ((index-TILE_TPORT_FIRST) >> 1);
+ dest[tind][--destcount[tind]]=i;
+// dbg_msg("coll","dest[%i][%i]=%i",tind,destcount[tind],i);
+ }
+ else if (index >= TILE_CUSTOM_END)
tiles[i].index = 0;
+
+// if (index != tiles[i].index)
+// dbg_msg("collision","new index: %i",tiles[i].index);
}
+ free(destcount);
+ dbg_msg("collision","end of loop");
return 1;
}
+
int col_get(int x, int y)
{
int nx = clamp(x/32, 0, width-1);
int ny = clamp(y/32, 0, height-1);
-
- if(tiles[ny*width+nx].index > 128)
+ if (tiles[ny*width+nx].index)
+// dbg_msg("coll","col_get(%i,%i) -> nxy: (%i,%i) ---> index: %i =====> %i",x,y,nx,ny,ny*width+nx,(tiles[ny*width+nx].index > 128)?0:(tiles[ny*width+nx].index));
+
+ if(tiles[ny*width+nx].index >= TILE_CUSTOM_END)
return 0;
return tiles[ny*width+nx].index;
}
int col_is_solid(int x, int y)
{
- return col_get(x,y)&COLFLAG_SOLID;
+ int i = col_get(x,y);
+ return (i<=5) && (i&COLFLAG_SOLID);
}
-
// TODO: rewrite this smarter!
int col_intersect_line(vec2 pos0, vec2 pos1, vec2 *out_collision, vec2 *out_before_collision)
{
@@ -85,3 +123,76 @@
*out_before_collision = pos1;
return 0;
}
+
+/* -------- bbmod ---------*/
+//int col_get_a(int x, int y)
+//{
+// int nx = clamp(x/32, 0, width-1);
+// int ny = clamp(y/32, 0, height-1);
+// if (tiles[ny*width+nx].index)
+// dbg_msg("coll","geta(%i,%i)-->%i (arrayindex %i) ",nx,ny,tiles[ny*width+nx].index,ny*width+nx);
+// return tiles[ny*width+nx].index;
+//}
+int col_is_freeze(int x, int y)
+{
+ return (col_get(x,y))==TILE_FREEZE;
+}
+int col_is_unfreeze(int x, int y)
+{
+ return (col_get(x,y))==TILE_UNFREEZE;
+}
+int col_is_kick(int x, int y)
+{
+ return (col_get(x,y))==TILE_KICK;
+}
+int col_is_colfrz(int x, int y)
+{
+ int i = col_get(x,y);
+ return (i>=TILE_CFREEZE_GREEN && i <= TILE_CFREEZE_RESET)?i:0;
+}
+int col_is_pwrup(int x, int y)
+{
+ int i = col_get(x,y);
+ return (i>=TILE_PUP_JUMP && i <= TILE_PUP_RESET)?i:0;
+}
+int col_is_1on1(int x, int y)
+{
+ return (col_get(x,y))==TILE_1ON1TOGGLE;
+}
+int col_is_perfrzon(int x, int y)
+{
+ return (col_get(x,y))==TILE_PERFRZON;
+}
+int col_is_perfrzoff(int x, int y)
+{
+ return (col_get(x,y))==TILE_PERFRZOFF;
+}
+int col_is_teleport(int x, int y)
+{
+ int i = col_get(x,y);
+ return (i>=TILE_TPORT_FIRST && i <= TILE_TPORT_LAST)?i:0;
+}
+int col_is_loadslot(int x, int y)
+
+{
+ int i = col_get(x,y);
+ return (i==TILE_LOADSLOT1 || i==TILE_LOADSLOT2)?i:0;
+}
+int col_is_saveslot(int x, int y)
+{
+ int i = col_get(x,y);
+ return (i==TILE_SAVESLOT1 || i==TILE_SAVESLOT2)?i:0;
+}
+
+vec2 get_teleport(int tind)
+{
+ if (dc[tind]) {
+ int r = rand() % dc[tind];
+ int x = (dest[tind][r] % width) << 5;
+ int y = (dest[tind][r] / width) << 5;
+ return vec2((float)x + 16.0, (float)y + 16.0);
+ } else return vec2(0, 0);
+}
+
+
+/* -------- eobbmod ---------*/
diff -Naur Coding/teeworlds-0.5.2-src/src/game/collision.hpp BlockMod/src/game/collision.hpp
--- Coding/teeworlds-0.5.2-src/src/game/collision.hpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/collision.hpp 2010-11-28 01:38:07.000000000 +1100
@@ -18,4 +18,19 @@
int col_height();
int col_intersect_line(vec2 pos0, vec2 pos1, vec2 *out_collision, vec2 *out_before_collision);
+
+/* ------bbmod---------*/
+int col_is_freeze(int x, int y);
+int col_is_unfreeze(int x, int y);
+int col_is_kick(int x, int y);
+int col_is_colfrz(int x, int y);
+int col_is_pwrup(int x, int y);
+int col_is_1on1(int x, int y);
+int col_is_perfrzon(int x, int y);
+int col_is_perfrzoff(int x, int y);
+int col_is_loadslot(int x, int y);
+int col_is_saveslot(int x, int y);
+int col_is_teleport(int x, int y);
+vec2 get_teleport(int tind);
+/* ------eobbmod---------*/
#endif
diff -Naur Coding/teeworlds-0.5.2-src/src/game/gamecore.cpp BlockMod/src/game/gamecore.cpp
--- Coding/teeworlds-0.5.2-src/src/game/gamecore.cpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/gamecore.cpp 2010-11-28 01:39:32.000000000 +1100
@@ -1,7 +1,23 @@
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
#include <string.h>
#include "gamecore.hpp"
+/* ------- bbmod ------- */
+#define PUP_JUMP 0
+#define PUP_HAMMER 1
+#define PUP_LFREEZE 2
+#define PUP_SFREEZE 3
+#define PUP_HOOKDUR 4
+#define PUP_HOOKLEN 5
+#define PUP_WALKSPD 6
+#define PUP_EPICNINJA 7
+#define PUP_TPORT 8
+#define PUP_MAGNET 9
+#define PUP_KOD 10
+#define PUP_LASER 11
+#define NUM_PUPS 12
+
+/*----------eobbmod--------*/
const char *TUNING_PARAMS::names[] =
{
#define MACRO_TUNING_PARAM(name,value) #name,
@@ -176,6 +192,7 @@
hook_state = HOOK_IDLE;
hooked_player = -1;
jumped = 0;
+ fuc=0;
triggered_events = 0;
}
@@ -184,6 +201,7 @@
float phys_size = 28.0f;
triggered_events = 0;
+ forceupdate=false;
// get ground state
bool grounded = false;
if(col_check_point(pos.x+phys_size/2, pos.y+phys_size/2+5))
@@ -194,15 +212,30 @@
vec2 target_direction = normalize(vec2(input.target_x, input.target_y));
vel.y += world->tuning.gravity;
-
- float max_speed = grounded ? world->tuning.ground_control_speed : world->tuning.air_control_speed;
+ float max_speed = grounded ? (world->tuning.ground_control_speed*(1.0f+(skills?(skills[PUP_WALKSPD]/10.0f):0.0f))) : world->tuning.air_control_speed;
+// float max_speed = grounded ? world->tuning.ground_control_speed : world->tuning.air_control_speed;
float accel = grounded ? world->tuning.ground_control_accel : world->tuning.air_control_accel;
float friction = grounded ? world->tuning.ground_friction : world->tuning.air_friction;
-
+
+ if (grounded) {
+ extrajumpsleft=skills?skills[PUP_JUMP]:0;
+ }
+
// handle input
if(use_input)
{
+ ldir=direction;
direction = input.direction;
+ if (skills?(skills[PUP_WALKSPD]):0) {
+ if (direction != ldir) {
+ fuc=30;
+ }
+ }
+ if (fuc > 0) {
+ if ((--fuc % 10) == 5) {
+ forceupdate=1;
+ }
+ }
// setup angle
float a = 0;
@@ -232,6 +265,9 @@
triggered_events |= COREEVENT_AIR_JUMP;
vel.y = -world->tuning.air_jump_impulse;
jumped |= 3;
+ if (extrajumpsleft-- > 0) {
+ jumped&=~2;
+ }
}
}
}
@@ -277,7 +313,7 @@
if(hook_state == HOOK_IDLE)
{
hooked_player = -1;
- hook_state = HOOK_IDLE;
+ //hook_state = HOOK_IDLE;
hook_pos = pos;
}
else if(hook_state >= HOOK_RETRACT_START && hook_state < HOOK_RETRACT_END)
@@ -288,15 +324,17 @@
{
hook_state = HOOK_RETRACTED;
triggered_events |= COREEVENT_HOOK_RETRACT;
- hook_state = HOOK_RETRACTED;
}
else if(hook_state == HOOK_FLYING)
{
- vec2 new_pos = hook_pos+hook_dir*world->tuning.hook_fire_speed;
- if(distance(pos, new_pos) > world->tuning.hook_length)
+ float hookfac = 1.0f+(skills?(skills[PUP_HOOKLEN]/5.0f):0.0f);
+ vec2 new_pos = hook_pos+hook_dir*(world->tuning.hook_fire_speed*hookfac);
+ float hole = world->tuning.hook_length*hookfac;
+ if(distance(pos, new_pos) > hole)
{
hook_state = HOOK_RETRACT_START;
- new_pos = pos + normalize(new_pos-pos) * world->tuning.hook_length;
+ new_pos = pos + normalize(new_pos-pos) * hole;
+ forceupdate=1;
}
// make sure that the hook doesn't go though the ground
@@ -305,7 +343,7 @@
int hit = col_intersect_line(hook_pos, new_pos, &new_pos, 0);
if(hit)
{
- if(hit&COLFLAG_NOHOOK)
+ if(hit<=5 && (hit&COLFLAG_NOHOOK))
going_to_retract = true;
else
going_to_hit_ground = true;
@@ -330,6 +368,7 @@
hook_state = HOOK_GRABBED;
hooked_player = i;
dist = distance (hook_pos, p->pos);
+ forceupdate=1;
}
}
}
@@ -342,11 +381,13 @@
{
triggered_events |= COREEVENT_HOOK_ATTACH_GROUND;
hook_state = HOOK_GRABBED;
+ forceupdate=1;
}
else if(going_to_retract)
{
triggered_events |= COREEVENT_HOOK_HIT_NOHOOK;
hook_state = HOOK_RETRACT_START;
+ forceupdate=1;
}
hook_pos = new_pos;
@@ -399,7 +440,7 @@
// release hook (max hook time is 1.25
hook_tick++;
- if(hooked_player != -1 && (hook_tick > SERVER_TICK_SPEED+SERVER_TICK_SPEED/5 || !world->characters[hooked_player]))
+ if(hooked_player != -1 && (hook_tick > ((SERVER_TICK_SPEED+SERVER_TICK_SPEED/5)*(1.0f+(skills?(skills[PUP_HOOKDUR]/2.0f):0.0f))) || !world->characters[hooked_player]))
{
hooked_player = -1;
hook_state = HOOK_RETRACTED;
diff -Naur Coding/teeworlds-0.5.2-src/src/game/gamecore.hpp BlockMod/src/game/gamecore.hpp
--- Coding/teeworlds-0.5.2-src/src/game/gamecore.hpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/gamecore.hpp 2010-11-28 01:38:18.000000000 +1100
@@ -180,6 +180,14 @@
int triggered_events;
+ /* ------ bbmod ----- */
+ int ldir;
+ int forceupdate;
+ int fuc;
+ int *skills;
+ int extrajumpsleft;
+ /* ------ eobbmod ----- */
+
void reset();
void tick(bool use_input);
void move();
diff -Naur Coding/teeworlds-0.5.2-src/src/game/mapitems.hpp BlockMod/src/game/mapitems.hpp
--- Coding/teeworlds-0.5.2-src/src/game/mapitems.hpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/mapitems.hpp 2010-11-28 01:38:19.000000000 +1100
@@ -46,6 +46,71 @@
TILE_DEATH,
TILE_NOHOOK,
+ TILE_ACCEL_L,
+ TILE_ACCEL_R,
+ TILE_ACCEL_D,
+ TILE_ACCEL_U,
+
+ TILE_UNUSED,
+
+ TILE_FREEZE,
+ TILE_KICK,
+ TILE_UNFREEZE,
+
+ TILE_CFREEZE_GREEN,
+ TILE_CFREEZE_BLUE,
+ TILE_CFREEZE_RED,
+ TILE_CFREEZE_WHITE,
+ TILE_CFREEZE_GREY,
+ TILE_CFREEZE_YELLOW,
+ TILE_CFREEZE_PINK,
+ TILE_CFREEZE_RESET,
+
+ TILE_PUP_JUMP,
+ TILE_PUP_HAMMER,
+ TILE_PUP_LFREEZE,
+ TILE_PUP_SFREEZE,
+ TILE_PUP_HOOKDUR,
+ TILE_PUP_HOOKLEN,
+ TILE_PUP_WALKSPD,
+ TILE_PUP_EPICNINJA,
+ TILE_PUP_TPORT,
+ TILE_PUP_MAGNET,
+ TILE_PUP_KOD,
+ TILE_PUP_LASER,
+
+ TILE_PUP_RES01,
+ TILE_PUP_RES02,
+ TILE_PUP_RES03,
+ TILE_PUP_RES04,
+ TILE_PUP_RES05,
+ TILE_PUP_RES06,
+ TILE_PUP_RES07,
+ TILE_PUP_RES08,
+ TILE_PUP_RES09,
+ TILE_PUP_RES10,
+ TILE_PUP_RES11,
+ TILE_PUP_RES12,
+ TILE_PUP_RES13,
+ TILE_PUP_RES14,
+ TILE_PUP_RES15,
+ TILE_PUP_RES16,
+
+ TILE_PUP_RESET,
+
+
+ TILE_1ON1TOGGLE,
+ TILE_PERFRZOFF,
+ TILE_PERFRZON,
+ TILE_LOADSLOT1,
+ TILE_LOADSLOT2,
+ TILE_SAVESLOT1,
+ TILE_SAVESLOT2,
+
+ TILE_TPORT_FIRST = 112,
+ TILE_TPORT_LAST = 191,
+ TILE_CUSTOM_END,
+
TILEFLAG_VFLIP=1,
TILEFLAG_HFLIP=2,
TILEFLAG_OPAQUE=4,
diff -Naur Coding/teeworlds-0.5.2-src/src/game/server/entities/character.cpp BlockMod/src/game/server/entities/character.cpp
--- Coding/teeworlds-0.5.2-src/src/game/server/entities/character.cpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/server/entities/character.cpp 2010-11-28 01:37:45.000000000 +1100
@@ -1,4 +1,6 @@
#include <new>
+#include <cstring>
+#include <cstdio>
#include <engine/e_server_interface.h>
#include <engine/e_config.h>
#include <game/server/gamecontext.hpp>
@@ -31,6 +33,9 @@
return c;
}
+/*----bbmod-----*/
+char bbuf[512];
+/*----eobbmod-----*/
MACRO_ALLOC_POOL_ID_IMPL(CHARACTER, MAX_CLIENTS)
@@ -73,7 +78,23 @@
game.world.insert_entity(this);
alive = true;
player->force_balanced = false;
-
+ core.skills=player->skills;
+ if (player->is1on1) {
+ int *sl = player->slot3;
+ if (sl)
+ {
+ for (int z = 0; z < NUM_PUPS; ++z)
+ player->skills[z] = sl[z];
+ }
+ server_setclientname(player->client_id, player->oname);
+ free(player->oname);
+ player->oname = NULL;
+ player->is1on1=0;
+ }
+ player->isperfrz=0;
+ lastperfrz = 0;
+ lastepicninja=0;
+ epicninjaannounced=0;
game.controller->on_character_spawn(this);
return true;
@@ -135,8 +156,11 @@
if (ninja.currentmovetime == 0)
{
// reset player velocity
- core.vel *= 0.2f;
+// core.vel *= 0.2f;
//return MODIFIER_RETURNFLAGS_OVERRIDEWEAPON;
+ core.vel.x=0.0;
+ core.vel.y=0.0;
+ core.pos=epicninjaoldpos;
}
if (ninja.currentmovetime > 0)
@@ -185,7 +209,7 @@
if(numobjectshit < 10)
hitobjects[numobjectshit++] = ents[i];
- ents[i]->take_damage(vec2(0,10.0f), data->weapons.ninja.base->damage, player->client_id,WEAPON_NINJA);
+ ents[i]->take_damage(vec2(0,10.0f), 0, player->client_id,WEAPON_NINJA);
}
}
return 0;
@@ -306,14 +330,19 @@
// set his velocity to fast upward (for now)
game.create_hammerhit(pos);
- ents[i]->take_damage(vec2(0,-1.0f), data->weapons.hammer.base->damage, player->client_id, active_weapon);
+// ents[i]->take_damage(vec2(0,-1.0f), data->weapons.hammer.base->damage, player->client_id, active_weapon);
+ ents[i]->take_damage(vec2(0,-1.0f), 0, player->client_id, active_weapon);
+ ents[i]->lasthammeredat = server_tick();
+ ents[i]->lasthammeredby = player->client_id;
+ ents[i]->freeze(3*server_tickspeed());
vec2 dir;
if (length(target->pos - pos) > 0.0f)
dir = normalize(target->pos - pos);
else
dir = vec2(0,-1);
- target->core.vel += normalize(dir + vec2(0,-1.1f)) * 10.0f;
+ target->core.vel += normalize(dir + vec2(0, -1.1f)) * (10.0f + (player->skills[PUP_HAMMER] * 3));
+ target->unfreeze();
hits++;
}
@@ -330,7 +359,7 @@
projectile_startpos,
direction,
(int)(server_tickspeed()*tuning.gun_lifetime),
- 1, 0, 0, -1, WEAPON_GUN);
+ 0, 0, 0, -1, WEAPON_GUN);
// pack the projectile and send it to the client directly
NETOBJ_PROJECTILE p;
@@ -412,12 +441,25 @@
case WEAPON_NINJA:
{
+ if (player->skills[PUP_EPICNINJA]) {
+ if ((lastepicninja + 10 * server_tickspeed()) < server_tick()) {
+ lastepicninja=server_tick();
+ epicninjaoldpos=pos;
+ epicninjaannounced=0;
+ } else {
+ str_format(bbuf, 128, "epic ninja not yet ready.");
+ game.send_chat_target(player->client_id, bbuf);
+ return;
+ }
+ } else {
+ return;
+ }
attack_tick = server_tick();
ninja.activationdir = direction;
ninja.currentmovetime = data->weapons.ninja.movetime * server_tickspeed() / 1000;
//reload_timer = data->weapons.ninja.base->firedelay * server_tickspeed() / 1000 + server_tick();
-
+
// reset hit objects
numobjectshit = 0;
@@ -538,18 +580,286 @@
player->force_balanced = false;
}
+ if (frz_time > 0) {
+ if (frz_time % (REFREEZE_INTERVAL_TICKS) == 0) {
+ game.create_damageind(pos, 0, frz_time / REFREEZE_INTERVAL_TICKS);
+// dbg_msg("char","%i,%i",frz_time,frz_time / REFREEZE_INTERVAL_TICKS);
+ }
+ frz_time--;
+ input.direction = 0;
+ input.jump = 0;
+ input.hook = 0;
+ input.fire = 0;
+ if (frz_time - 1 == 0) {
+ unfreeze();
+ }
+ }
+ if (player->isperfrz) {
+ if ((lastperfrz + 25 * server_tickspeed()) < server_tick()) {
+ freeze(15 * server_tickspeed());
+ lastperfrz = server_tick();
+ }
+ }
+ if (frz_tick && player->skills[PUP_EPICNINJA] && ((lastepicninja+10*server_tickspeed()) < server_tick()) && !epicninjaannounced) {
+ str_format(bbuf, 128, "epic ninja ready!");
+ game.send_chat_target(player->client_id, bbuf);
+ epicninjaannounced=1;
+ }
+
//player_core core;
//core.pos = pos;
//core.jumped = jumped;
core.input = input;
core.tick(true);
+ if (core.hooked_player >= 0) {
+ if (game.players[core.hooked_player] && game.players[core.hooked_player]->get_character()) {
+ game.players[core.hooked_player]->get_character()->lasthookedat = server_tick();
+ game.players[core.hooked_player]->get_character()->lasthookedby = player->client_id;
+ }
+ }
+
+ int tmp;
+ if (col_is_kick(pos.x, pos.y))
+ {
+ // dbg_msg("char","ki");
+ server_kick(player->client_id, "You were kicked by evil kick zone");
+ }
+ else if (col_is_freeze(pos.x, pos.y))
+ {
+ // dbg_msg("char","fr");
+ int ft = server_tickspeed() * 3;
+ int add=0;
+// dbg_msg("char","char collision with freeze: wasout: %i, frz_tick: %i",wasout,frz_tick);
+ if ((wasout || frz_tick == 0) && (((lasthookedat + (server_tickspeed()<<1)) > server_tick()) || ((lasthammeredat + server_tickspeed()) > server_tick())))
+ {
+ int hooked = lasthookedat > lasthammeredat;
+ int by = hooked ? lasthookedby : lasthammeredby;
+ dbg_msg("char","got %s by player %i",hooked?"hooked":"hammered",by);
+ if (game.players[by] && game.players[by]->get_character()) {
+ add = game.players[by]->skills[PUP_LFREEZE];
+ }
+ blockedby=by;
+ if (blockedby>=0) blocktime=ft+(add * (server_tickspeed()>>1));
+ //dbg_msg("char","saving blocker (%i, time %i)",blockedby,blocktime);
+ } else {
+ if (frz_tick==0) {
+// dbg_msg("char","selfblocked");
+ blockedby=-1;
+ }
+ if (blockedby>=0)
+ ft=blocktime;
+ }
+
+ add -=player->skills[PUP_SFREEZE];
+ ft += (add * (server_tickspeed()>>1));
+ wasout=0;
+ freeze(ft);
+ }
+ else if (col_is_unfreeze(pos.x, pos.y))
+ {
+ // dbg_msg("char","unf");
+ unfreeze();
+ wasout=1;
+ }
+ else if ((tmp = col_is_colfrz(pos.x, pos.y)))
+ {
+ // dbg_msg("char","colfrz %i! (rst is %i)",tmp,TILE_CFREEZE_RESET);
+ if (lastcolfrz + REFREEZE_INTERVAL_TICKS < server_tick())
+ {
+ lastcolfrz = server_tick();
+ if (tmp == TILE_CFREEZE_RESET)
+ {
+ player->forcecolor = 0;
+ }
+ else
+ {
+ switch (tmp)
+ {
+ case TILE_CFREEZE_GREEN:
+ player->forcecolor = COL_GREEN;
+ break;
+ case TILE_CFREEZE_BLUE:
+ player->forcecolor = COL_BLUE;
+ break;
+ case TILE_CFREEZE_RED:
+ player->forcecolor = COL_RED;
+ break;
+ case TILE_CFREEZE_WHITE:
+ player->forcecolor = COL_WHITE;
+ break;
+ case TILE_CFREEZE_GREY:
+ player->forcecolor = COL_GREY;
+ break;
+ case TILE_CFREEZE_YELLOW:
+ player->forcecolor = COL_YELLOW;
+ break;
+ case TILE_CFREEZE_PINK:
+ player->forcecolor = COL_PINK;
+ break;
+ }
+ }
+ player->use_custom_color = (player->forcecolor) ? 1 : player->origusecustcolor;
+ player->color_body = (player->forcecolor) ? player->forcecolor : player->origbodycolor;
+ player->color_feet = (player->forcecolor) ? player->forcecolor : player->origfeetcolor;
+ game.controller->on_player_info_change(player);
+ }
+ }
+ else if ((tmp = col_is_pwrup(pos.x, pos.y)))
+ {
+ if ((lastup + ((tmp == TILE_PUP_RESET) ? server_tickspeed() >> 2 : server_tickspeed())) < server_tick())
+ {
+ lastup = server_tick();
+ if (player->is1on1)
+ {
+ game.send_chat_target(player->client_id, "leave 1on1 mode first!");
+ }
+ if ((lastepicninja + server_tickspeed()) > server_tick())
+ {
+ game.send_chat_target(player->client_id, "bad luck...");
+ }
+ else
+ {
+ if (tmp == TILE_PUP_RESET)
+ {
+ for (int z = 0; z < NUM_PUPS; ++z)
+ {
+ player->skills[z] = 0;
+ }
+ game.send_chat_target(player->client_id, "select new powerups!");
+ }
+ else
+ {
+if (player->skills[tmp - TILE_PUP_JUMP] < 10) {
+ player->skills[tmp - TILE_PUP_JUMP]++;
+ tell_powerup_info(player->client_id, tmp - TILE_PUP_JUMP);
+}
+ }
+ }
+ }
+ }
+ else if ((tmp = col_is_loadslot(pos.x, pos.y)))
+ {
+ if ((lastloadsave + server_tickspeed()) < server_tick())
+ {
+ lastloadsave = server_tick();
+ if (player->is1on1)
+ {
+ game.send_chat_target(player->client_id, "leave 1on1 mode first!");
+ }
+ else
+ {
+ int *sl = ((tmp == TILE_LOADSLOT1) ? player->slot1 : player->slot2);
+ if (sl)
+ {
+ for (int z = 0; z < NUM_PUPS; ++z)
+ {
+ player->skills[z] = sl[z];
+ }
+ game.send_chat_target(player->client_id, "loaded and equipped powerups!");
+ }
+ else
+ {
+ game.send_chat_target(player->client_id, "nothing saved for this slot yet!");
+ }
+ }
+ }
+ }
+ else if ((tmp = col_is_saveslot(pos.x, pos.y)))
+ {
+ if ((lastloadsave + server_tickspeed()) < server_tick())
+ {
+ lastloadsave = server_tick();
+ if (player->is1on1)
+ {
+ game.send_chat_target(player->client_id, "leave 1on1 mode first!");
+ }
+ else
+ {
+ int *sl = ((tmp == TILE_SAVESLOT1) ? player->slot1 : player->slot2);
+ if (sl)
+ free(sl);
+ sl = (int*) malloc(sizeof(int) * NUM_PUPS);
+ for (int z = 0; z < NUM_PUPS; ++z)
+ {
+ sl[z] = player->skills[z];
+ }
+ ((tmp == TILE_SAVESLOT1) ? player->slot1 : player->slot2) = sl;
+ game.send_chat_target(player->client_id, "powerups saved!");
+ }
+ }
+ }
+ else if ((tmp = col_is_1on1(pos.x, pos.y)))
+ {
+ if ((lastloadsave + server_tickspeed()) < server_tick())
+ {
+ lastloadsave = server_tick();
+ if ((player->is1on1 = 1 - player->is1on1))
+ {
+ int *sl = player->slot3;
+ if (sl)
+ free(sl);
+ sl = (int*) malloc(sizeof(int) * NUM_PUPS);
+ for (int z = 0; z < NUM_PUPS; ++z)
+ {
+ sl[z] = player->skills[z];
+ player->skills[z] = 0;
+ }
+ player->slot3 = sl;
+ player->oname = strdup(server_clientname(player->client_id));
+ char *buf = (char*) malloc(strlen(player->oname) + 8);
+ sprintf(buf, "[1on1] %s", player->oname);
+ server_setclientname(player->client_id, buf);
+ }
+ else
+ {
+ int *sl = player->slot3;
+ if (sl)
+ {
+ for (int z = 0; z < NUM_PUPS; ++z)
+ player->skills[z] = sl[z];
+ }
+ server_setclientname(player->client_id, player->oname);
+ free(player->oname);
+ player->oname = NULL;
+ }
+
+ str_format(bbuf, 128, "1on1 mode %s", (player->is1on1) ? "ON" : "OFF");
+ game.send_chat_target(player->client_id, bbuf);
+ }
+ }
+ else if (col_is_perfrzon(pos.x, pos.y))
+ {
+ player->isperfrz=1;
+ lastperfrz=server_tick()-(10*server_tickspeed());
+ }
+ else if (col_is_perfrzoff(pos.x, pos.y))
+ {
+ player->isperfrz=0;
+ }
+ else if ((tmp=col_is_teleport(pos.x, pos.y)))
+ {
+ if ((tmp-TILE_TPORT_FIRST)&1) {
+ core.hooked_player = -1;
+ core.hook_state = HOOK_RETRACTED;
+ core.triggered_events |= COREEVENT_HOOK_RETRACT;
+ core.hook_state = HOOK_RETRACTED;
+ core.hook_pos = core.pos;
+ core.pos = get_teleport((tmp-TILE_TPORT_FIRST)>>1);
+ }
+ }
+ else
+ {
+ wasout=1;
+ }
float phys_size = 28.0f;
// handle death-tiles
- if(col_get((int)(pos.x+phys_size/2), (int)(pos.y-phys_size/2))&COLFLAG_DEATH ||
- col_get((int)(pos.x+phys_size/2), (int)(pos.y+phys_size/2))&COLFLAG_DEATH ||
- col_get((int)(pos.x-phys_size/2), (int)(pos.y-phys_size/2))&COLFLAG_DEATH ||
- col_get((int)(pos.x-phys_size/2), (int)(pos.y+phys_size/2))&COLFLAG_DEATH)
+ int a,b,c,d;
+
+ if ( ((a=col_get((int)(pos.x+phys_size/2), (int)(pos.y-phys_size/2)))<=5 && (a&COLFLAG_DEATH)) ||
+ ((b=col_get((int)(pos.x+phys_size/2), (int)(pos.y+phys_size/2)))<=5 && (b&COLFLAG_DEATH)) ||
+ ((c=col_get((int)(pos.x-phys_size/2), (int)(pos.y-phys_size/2)))<=5 && (c&COLFLAG_DEATH)) ||
+ ((d=col_get((int)(pos.x-phys_size/2), (int)(pos.y+phys_size/2)))<=5 && (d&COLFLAG_DEATH)) )
{
die(player->client_id, WEAPON_WORLD);
}
@@ -628,7 +938,7 @@
core.write(&current);
// only allow dead reackoning for a top of 3 seconds
- if(reckoning_tick+server_tickspeed()*3 < server_tick() || mem_comp(&predicted, &current, sizeof(NETOBJ_CHARACTER)) != 0)
+ if (core.forceupdate || (reckoning_tick + server_tickspeed() * 3 < server_tick() || mem_comp(&predicted, &current, sizeof(NETOBJ_CHARACTER)) != 0))
{
reckoning_tick = server_tick();
sendcore = core;
@@ -718,7 +1028,7 @@
damage_taken = 0;
game.create_damageind(pos, 0, dmg);
}
-
+ if (weapon == WEAPON_NINJA) freeze(3 * server_tickspeed());
if(dmg)
{
if(armor)
@@ -836,3 +1146,72 @@
character->player_state = player_state;
}
+/*----------bbmod------------*/
+bool CHARACTER::freeze(int ticks)
+{
+ if (ticks <= 1) return false;
+ if (frz_tick > 0) { //already frozen
+ if (frz_tick + REFREEZE_INTERVAL_TICKS > server_tick()) return true;
+ } else {
+ frz_start=server_tick();
+ epicninjaannounced=0;
+ lastepicninja=server_tick()-5*server_tickspeed();
+ }
+ frz_tick=server_tick();
+ frz_time=ticks;
+ ninja.activationtick = server_tick();
+ weapons[WEAPON_NINJA].got = true;
+ weapons[WEAPON_NINJA].ammo = -1;
+ if (active_weapon != WEAPON_NINJA) {
+ set_weapon(WEAPON_NINJA);
+ }
+ return true;
+}
+bool CHARACTER::unfreeze(){
+ if (frz_time > 0) {
+ frz_tick = frz_time = frz_start = 0;
+ ninja.currentmovetime=-1;//prevent magic teleport when unfreezing while epic ninja
+ weapons[WEAPON_NINJA].got = false;
+ if (last_weapon <0 || last_weapon >= NUM_WEAPONS || last_weapon == WEAPON_NINJA || (!weapons[last_weapon].got)) last_weapon = WEAPON_HAMMER;
+ set_weapon(last_weapon);
+ epicninjaannounced=0;
+ return true;
+ }
+ return false;
+
+return true;
+}
+void tell_powerup_info(int client_id, int skill){
+ static char bbuf[256];
+ switch(skill) {
+ case PUP_JUMP:
+ str_format(bbuf, 128, "you got an extra air jump!");break;
+ case PUP_HAMMER:
+ str_format(bbuf, 128, "hammer powered!");break;
+ case PUP_LFREEZE:
+ str_format(bbuf, 128, "enemy freeze time increased!");break;
+ case PUP_SFREEZE:
+ str_format(bbuf, 128, "own freeze time shortened!");break;
+ case PUP_HOOKDUR:
+ str_format(bbuf, 128, "hook duration increased (you wont see it but it works!)!");break;
+ case PUP_HOOKLEN:
+ str_format(bbuf, 128, "hook length extended (its not smooth, however)");break;
+ case PUP_WALKSPD:
+ str_format(bbuf, 128, "walk speed increased");break;
+ case PUP_EPICNINJA:
+ str_format(bbuf, 128, "eeeeeeeeeeeeeeeeepic ninja! (freeze attack)");break;
+ case PUP_TPORT:
+ str_format(bbuf, 128, "short distance teleport!");break;
+ case PUP_MAGNET:
+ str_format(bbuf, 128, "magnet!");break;
+ case PUP_KOD:
+ str_format(bbuf, 128, "kiss of death");break;
+ case PUP_LASER:
+ str_format(bbuf, 128, "freeze laser");break;
+ default:
+ str_format(bbuf, 128, "wtf");break;
+ }
+ game.send_chat_target(client_id, bbuf);
+}
+/*---------eobbmod------------*/
+
diff -Naur Coding/teeworlds-0.5.2-src/src/game/server/entities/character.hpp BlockMod/src/game/server/entities/character.hpp
--- Coding/teeworlds-0.5.2-src/src/game/server/entities/character.hpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/server/entities/character.hpp 2010-11-28 01:37:46.000000000 +1100
@@ -16,6 +16,32 @@
WEAPON_WORLD = -1, // death tiles etc
};
+/*----------bbmod------------*/
+#define REFREEZE_INTERVAL_TICKS (server_tickspeed()>>1)
+
+#define COL_BLUE 0x90ff4d
+#define COL_GREEN 0x51ff4d
+#define COL_WHITE 0xffffff
+#define COL_GREY 0x1
+#define COL_RED 0xff00
+#define COL_YELLOW 0x2bff00
+#define COL_PINK 0xd6ff5b
+
+#define PUP_JUMP 0
+#define PUP_HAMMER 1
+#define PUP_LFREEZE 2
+#define PUP_SFREEZE 3
+#define PUP_HOOKDUR 4
+#define PUP_HOOKLEN 5
+#define PUP_WALKSPD 6
+#define PUP_EPICNINJA 7
+#define PUP_TPORT 8
+#define PUP_MAGNET 9
+#define PUP_KOD 10
+#define PUP_LASER 11
+#define NUM_PUPS 12
+/*----------eobbmod------------*/
+
class CHARACTER : public ENTITY
{
MACRO_ALLOC_POOL_ID()
@@ -71,6 +97,25 @@
int health;
int armor;
+ /*----------bbmod------------*/
+ int frz_time;//will be higher when blocker has lfreeze, for instance
+ int frz_tick;//will get updated on every REFREEZE_INTERVAL ticks
+ int frz_start;//will be set on the first freeze
+
+ int lastcolfrz;
+ int lasthammeredby, lasthammeredat;
+ int lasthookedby, lasthookedat;
+ int lastloadsave;
+ int lastup;
+ int lastperfrz;
+ int wasout;
+ int lastepicninja;
+ int epicninjaannounced;
+ int blockedby;
+ int blocktime;
+ vec2 epicninjaoldpos;
+ /*---------eobbmod------------*/
+
// ninja
struct
{
@@ -129,6 +174,14 @@
bool increase_health(int amount);
bool increase_armor(int amount);
-};
+ /*----------bbmod------------*/
+ bool freeze(int time);
+ bool unfreeze();
+ /*---------eobbmod------------*/
+
+};
+/*----------bbmod------------*/
+void tell_powerup_info(int client_id, int skill);
+/*----------eobbmod------------*/
#endif
diff -Naur Coding/teeworlds-0.5.2-src/src/game/server/entities/projectile.cpp BlockMod/src/game/server/entities/projectile.cpp
--- Coding/teeworlds-0.5.2-src/src/game/server/entities/projectile.cpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/server/entities/projectile.cpp 2010-11-28 01:37:50.000000000 +1100
@@ -76,8 +76,8 @@
if(flags & PROJECTILE_FLAGS_EXPLODE)
game.create_explosion(curpos, owner, weapon, false);
- else if(targetchr)
- targetchr->take_damage(direction * max(0.001f, force), damage, owner, weapon);
+ /*else if(targetchr)
+ targetchr->take_damage(direction * max(0.001f, force), owner, weapon);*/
game.world.destroy_entity(this);
}
diff -Naur Coding/teeworlds-0.5.2-src/src/game/server/gamemodes/ctf.cpp BlockMod/src/game/server/gamemodes/ctf.cpp
--- Coding/teeworlds-0.5.2-src/src/game/server/gamemodes/ctf.cpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/server/gamemodes/ctf.cpp 2010-11-28 01:38:00.000000000 +1100
@@ -74,7 +74,8 @@
continue;
// flag hits death-tile, reset it
- if(col_get((int)f->pos.x, (int)f->pos.y)&COLFLAG_DEATH)
+ int tmp;
+ if((tmp=col_get((int)f->pos.x, (int)f->pos.y)) <=5 && (tmp&COLFLAG_DEATH))
{
game.create_sound_global(SOUND_CTF_RETURN);
f->reset();
diff -Naur Coding/teeworlds-0.5.2-src/src/game/server/hooks.cpp BlockMod/src/game/server/hooks.cpp
--- Coding/teeworlds-0.5.2-src/src/game/server/hooks.cpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/server/hooks.cpp 2010-11-28 01:37:40.000000000 +1100
@@ -107,6 +107,7 @@
void mods_client_enter(int client_id)
{
+ dbg_msg("hooks","%s",__func__);
//game.world.insert_entity(&game.players[client_id]);
game.players[client_id]->respawn();
dbg_msg("game", "join player='%d:%s'", client_id, server_clientname(client_id));
@@ -121,6 +122,7 @@
void mods_connected(int client_id)
{
+ dbg_msg("hooks","%s",__func__);
game.players[client_id] = new(client_id) PLAYER(client_id);
//game.players[client_id].init(client_id);
//game.players[client_id].client_id = client_id;
@@ -142,6 +144,7 @@
void mods_client_drop(int client_id)
{
+ dbg_msg("hooks","%s",__func__);
game.abort_vote_kick_on_disconnect(client_id);
game.players[client_id]->on_disconnect();
delete game.players[client_id];
@@ -322,10 +325,21 @@
return;
p->last_changeinfo = time_get();
-
- p->use_custom_color = msg->use_custom_color;
- p->color_body = msg->color_body;
- p->color_feet = msg->color_feet;
+ dbg_msg("hks","color_body set to %x",msg->color_body);
+ if (!p->forcecolor) {
+ p->origusecustcolor=msg->use_custom_color;
+ p->origbodycolor=msg->color_body;
+ p->origfeetcolor=msg->color_feet;
+ }
+ /*-------bbmod-------*/
+ p->use_custom_color = (p->forcecolor)?1:msg->use_custom_color;
+ p->color_body = (p->forcecolor)?p->forcecolor:msg->color_body;
+ p->color_feet = (p->forcecolor)?p->forcecolor:msg->color_feet;
+ /*-------orig-------*/
+// p->use_custom_color = msg->use_custom_color;
+// p->color_body = msg->color_body;
+// p->color_feet = msg->color_feet;
+ /*-------eobbmod-------*/
// check for invalid chars
unsigned char *name = (unsigned char *)msg->name;
@@ -501,6 +515,7 @@
void mods_console_init()
{
+ dbg_msg("hooks","%s",__func__);
MACRO_REGISTER_COMMAND("tune", "si", CFGFLAG_SERVER, con_tune_param, 0, "");
MACRO_REGISTER_COMMAND("tune_reset", "", CFGFLAG_SERVER, con_tune_reset, 0, "");
MACRO_REGISTER_COMMAND("tune_dump", "", CFGFLAG_SERVER, con_tune_dump, 0, "");
@@ -517,6 +532,7 @@
void mods_init()
{
+ dbg_msg("hooks","%s",__func__);
//if(!data) /* only load once */
//data = load_data_from_memory(internal_data);
diff -Naur Coding/teeworlds-0.5.2-src/src/game/server/player.cpp BlockMod/src/game/server/player.cpp
--- Coding/teeworlds-0.5.2-src/src/game/server/player.cpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/server/player.cpp 2010-11-28 01:37:52.000000000 +1100
@@ -12,6 +12,7 @@
respawn_tick = server_tick();
character = 0;
this->client_id = client_id;
+ slot1=slot2=slot3=NULL;
}
PLAYER::~PLAYER()
diff -Naur Coding/teeworlds-0.5.2-src/src/game/server/player.hpp BlockMod/src/game/server/player.hpp
--- Coding/teeworlds-0.5.2-src/src/game/server/player.hpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/server/player.hpp 2010-11-28 01:37:53.000000000 +1100
@@ -53,7 +53,24 @@
// this is used for snapping so we know how we can clip the view for the player
vec2 view_pos;
+ /* ------- bbmod -------- */
+ int forcecolor;
+ int origusecustcolor;
+ int origbodycolor;
+ int origfeetcolor;
+
+ int skills[NUM_PUPS];
+
+ int *slot1;
+ int *slot2;
+ int *slot3;
+
+ int is1on1;
+ int isperfrz;
+ char *oname;
+
+ /* ------- eobbmod -------- */
void init(int client_id);
CHARACTER *get_character();
diff -Naur Coding/teeworlds-0.5.2-src/src/game/tuning.hpp BlockMod/src/game/tuning.hpp
--- Coding/teeworlds-0.5.2-src/src/game/tuning.hpp 2009-10-26 19:04:30.000000000 +1100
+++ BlockMod/src/game/tuning.hpp 2010-11-28 01:37:37.000000000 +1100
@@ -18,8 +18,8 @@
MACRO_TUNING_PARAM(velramp_curvature, 1.4f)
/* weapon tuning */
-MACRO_TUNING_PARAM(gun_curvature, 1.25f)
-MACRO_TUNING_PARAM(gun_speed, 2200.0f)
+MACRO_TUNING_PARAM(gun_curvature, 0.0f)
+MACRO_TUNING_PARAM(gun_speed, 1000.0f)
MACRO_TUNING_PARAM(gun_lifetime, 2.0f)
MACRO_TUNING_PARAM(shotgun_curvature, 1.25f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment