mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-05 07:38:19 +00:00
loads of minor stuff
This commit is contained in:
parent
182c77721e
commit
f7ea0b2ba8
|
@ -1,6 +1,6 @@
|
||||||
import shutil, os, sys, zipfile
|
import shutil, os, sys, zipfile
|
||||||
|
|
||||||
valid_platforms = ["win32", "linux86", "linux86_64", "src"]
|
#valid_platforms = ["win32", "linux86", "linux86_64", "src"]
|
||||||
|
|
||||||
if len(sys.argv) != 3:
|
if len(sys.argv) != 3:
|
||||||
print "wrong number of arguments"
|
print "wrong number of arguments"
|
||||||
|
@ -18,16 +18,16 @@ include_exe = True
|
||||||
include_src = False
|
include_src = False
|
||||||
|
|
||||||
if platform == "src":
|
if platform == "src":
|
||||||
include_data = False
|
include_data = True
|
||||||
include_exe = False
|
include_exe = False
|
||||||
include_src = True
|
include_src = True
|
||||||
use_zip = 1
|
use_zip = 1
|
||||||
use_gz = 1
|
use_gz = 1
|
||||||
|
|
||||||
if not platform in valid_platforms:
|
#if not platform in valid_platforms:
|
||||||
print "not a valid platform"
|
# print "not a valid platform"
|
||||||
print valid_platforms
|
# print valid_platforms
|
||||||
sys.exit(-1)
|
# sys.exit(-1)
|
||||||
|
|
||||||
if platform == 'win32':
|
if platform == 'win32':
|
||||||
exe_ext = ".exe"
|
exe_ext = ".exe"
|
||||||
|
|
|
@ -45,7 +45,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
short next;
|
short next;
|
||||||
short state; /* 0 = free, 1 = alloced, 2 = timed */
|
short state; /* 0 = free, 1 = alloced, 2 = timed */
|
||||||
int timeout_tick;
|
int timeout;
|
||||||
} SNAP_ID;
|
} SNAP_ID;
|
||||||
|
|
||||||
static const int MAX_IDS = 16*1024; /* should be lowered */
|
static const int MAX_IDS = 16*1024; /* should be lowered */
|
||||||
|
@ -133,10 +133,12 @@ static void snap_remove_first_timeout()
|
||||||
int snap_new_id()
|
int snap_new_id()
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
|
int64 now = time_get();
|
||||||
dbg_assert(snap_id_inited == 1, "requesting id too soon");
|
dbg_assert(snap_id_inited == 1, "requesting id too soon");
|
||||||
|
|
||||||
|
|
||||||
/* process timed ids */
|
/* process timed ids */
|
||||||
while(snap_first_timed_id != -1 && snap_ids[snap_first_timed_id].timeout_tick < server_tick())
|
while(snap_first_timed_id != -1 && snap_ids[snap_first_timed_id].timeout < now)
|
||||||
snap_remove_first_timeout();
|
snap_remove_first_timeout();
|
||||||
|
|
||||||
id = snap_first_free_id;
|
id = snap_first_free_id;
|
||||||
|
@ -161,7 +163,7 @@ void snap_free_id(int id)
|
||||||
|
|
||||||
snap_id_inusage--;
|
snap_id_inusage--;
|
||||||
snap_ids[id].state = 2;
|
snap_ids[id].state = 2;
|
||||||
snap_ids[id].timeout_tick = server_tick() + server_tickspeed()*5;
|
snap_ids[id].timeout = time_get()+time_freq()*5;
|
||||||
snap_ids[id].next = -1;
|
snap_ids[id].next = -1;
|
||||||
|
|
||||||
if(snap_last_timed_id != -1)
|
if(snap_last_timed_id != -1)
|
||||||
|
|
|
@ -40,7 +40,7 @@ void move_point(vec2 *inout_pos, vec2 *inout_vel, float elasticity, int *bounces
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool test_box(vec2 pos, vec2 size)
|
bool test_box(vec2 pos, vec2 size)
|
||||||
{
|
{
|
||||||
size *= 0.5f;
|
size *= 0.5f;
|
||||||
if(col_check_point(pos.x-size.x, pos.y-size.y))
|
if(col_check_point(pos.x-size.x, pos.y-size.y))
|
||||||
|
|
|
@ -61,6 +61,7 @@ inline T saturated_add(T min, T max, T current, T modifier)
|
||||||
|
|
||||||
void move_point(vec2 *inout_pos, vec2 *inout_vel, float elasticity, int *bounces);
|
void move_point(vec2 *inout_pos, vec2 *inout_vel, float elasticity, int *bounces);
|
||||||
void move_box(vec2 *inout_pos, vec2 *inout_vel, vec2 size, float elasticity);
|
void move_box(vec2 *inout_pos, vec2 *inout_vel, vec2 size, float elasticity);
|
||||||
|
bool test_box(vec2 pos, vec2 size);
|
||||||
|
|
||||||
|
|
||||||
// hooking stuff
|
// hooking stuff
|
||||||
|
|
|
@ -634,6 +634,7 @@ int player::handle_ninja()
|
||||||
// hit a player, give him damage and stuffs...
|
// hit a player, give him damage and stuffs...
|
||||||
create_sound(ents[i]->pos, SOUND_NINJA_HIT);
|
create_sound(ents[i]->pos, SOUND_NINJA_HIT);
|
||||||
// set his velocity to fast upward (for now)
|
// set his velocity to fast upward (for now)
|
||||||
|
if(numobjectshit < 10)
|
||||||
hitobjects[numobjectshit++] = ents[i];
|
hitobjects[numobjectshit++] = ents[i];
|
||||||
ents[i]->take_damage(vec2(0,10.0f), data->weapons[WEAPON_NINJA].meleedamage, client_id,WEAPON_NINJA);
|
ents[i]->take_damage(vec2(0,10.0f), data->weapons[WEAPON_NINJA].meleedamage, client_id,WEAPON_NINJA);
|
||||||
}
|
}
|
||||||
|
@ -898,6 +899,7 @@ int player::handle_weapons()
|
||||||
// set his velocity to fast upward (for now)
|
// set his velocity to fast upward (for now)
|
||||||
create_smoke(ents[i]->pos);
|
create_smoke(ents[i]->pos);
|
||||||
create_sound(pos, SOUND_HAMMER_HIT);
|
create_sound(pos, SOUND_HAMMER_HIT);
|
||||||
|
if(numobjectshit < 10)
|
||||||
hitobjects[numobjectshit++] = ents[i];
|
hitobjects[numobjectshit++] = ents[i];
|
||||||
ents[i]->take_damage(vec2(0,-1.0f), data->weapons[active_weapon].meleedamage, client_id, active_weapon);
|
ents[i]->take_damage(vec2(0,-1.0f), data->weapons[active_weapon].meleedamage, client_id, active_weapon);
|
||||||
player* target = (player*)ents[i];
|
player* target = (player*)ents[i];
|
||||||
|
@ -1006,10 +1008,26 @@ void player::tick_defered()
|
||||||
{
|
{
|
||||||
if(!dead)
|
if(!dead)
|
||||||
{
|
{
|
||||||
|
vec2 start_pos = core.pos;
|
||||||
|
vec2 start_vel = core.vel;
|
||||||
|
bool stuck_before = test_box(core.pos, vec2(28.0f, 28.0f));
|
||||||
|
|
||||||
core.move();
|
core.move();
|
||||||
|
bool stuck_after_move = test_box(core.pos, vec2(28.0f, 28.0f));
|
||||||
core.quantize();
|
core.quantize();
|
||||||
|
bool stuck_after_quant = test_box(core.pos, vec2(28.0f, 28.0f));
|
||||||
pos = core.pos;
|
pos = core.pos;
|
||||||
|
|
||||||
|
if(!stuck_before && (stuck_after_move || stuck_after_quant))
|
||||||
|
{
|
||||||
|
dbg_msg("player", "STUCK!!! %f %f %f %f %x %x %x %x",
|
||||||
|
start_pos.x, start_pos.y,
|
||||||
|
start_vel.x, start_vel.y,
|
||||||
|
start_pos.x, start_pos.y,
|
||||||
|
start_vel.x, start_vel.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int events = core.triggered_events;
|
int events = core.triggered_events;
|
||||||
int mask = cmask_all_except_one(client_id);
|
int mask = cmask_all_except_one(client_id);
|
||||||
|
|
||||||
|
|
|
@ -44,11 +44,8 @@ private:
|
||||||
|
|
||||||
entity *prev_type_entity;
|
entity *prev_type_entity;
|
||||||
entity *next_type_entity;
|
entity *next_type_entity;
|
||||||
|
|
||||||
int index;
|
|
||||||
protected:
|
protected:
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
float proximity_radius;
|
float proximity_radius;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
|
|
Loading…
Reference in a new issue