mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58: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
|
||||
|
||||
valid_platforms = ["win32", "linux86", "linux86_64", "src"]
|
||||
#valid_platforms = ["win32", "linux86", "linux86_64", "src"]
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print "wrong number of arguments"
|
||||
|
@ -18,16 +18,16 @@ include_exe = True
|
|||
include_src = False
|
||||
|
||||
if platform == "src":
|
||||
include_data = False
|
||||
include_data = True
|
||||
include_exe = False
|
||||
include_src = True
|
||||
use_zip = 1
|
||||
use_gz = 1
|
||||
|
||||
if not platform in valid_platforms:
|
||||
print "not a valid platform"
|
||||
print valid_platforms
|
||||
sys.exit(-1)
|
||||
#if not platform in valid_platforms:
|
||||
# print "not a valid platform"
|
||||
# print valid_platforms
|
||||
# sys.exit(-1)
|
||||
|
||||
if platform == 'win32':
|
||||
exe_ext = ".exe"
|
||||
|
|
|
@ -45,7 +45,7 @@ typedef struct
|
|||
{
|
||||
short next;
|
||||
short state; /* 0 = free, 1 = alloced, 2 = timed */
|
||||
int timeout_tick;
|
||||
int timeout;
|
||||
} SNAP_ID;
|
||||
|
||||
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 id;
|
||||
int64 now = time_get();
|
||||
dbg_assert(snap_id_inited == 1, "requesting id too soon");
|
||||
|
||||
|
||||
/* 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();
|
||||
|
||||
id = snap_first_free_id;
|
||||
|
@ -161,7 +163,7 @@ void snap_free_id(int id)
|
|||
|
||||
snap_id_inusage--;
|
||||
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;
|
||||
|
||||
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;
|
||||
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_box(vec2 *inout_pos, vec2 *inout_vel, vec2 size, float elasticity);
|
||||
bool test_box(vec2 pos, vec2 size);
|
||||
|
||||
|
||||
// hooking stuff
|
||||
|
|
|
@ -634,7 +634,8 @@ int player::handle_ninja()
|
|||
// hit a player, give him damage and stuffs...
|
||||
create_sound(ents[i]->pos, SOUND_NINJA_HIT);
|
||||
// set his velocity to fast upward (for now)
|
||||
hitobjects[numobjectshit++] = ents[i];
|
||||
if(numobjectshit < 10)
|
||||
hitobjects[numobjectshit++] = ents[i];
|
||||
ents[i]->take_damage(vec2(0,10.0f), data->weapons[WEAPON_NINJA].meleedamage, client_id,WEAPON_NINJA);
|
||||
}
|
||||
}
|
||||
|
@ -898,7 +899,8 @@ int player::handle_weapons()
|
|||
// set his velocity to fast upward (for now)
|
||||
create_smoke(ents[i]->pos);
|
||||
create_sound(pos, SOUND_HAMMER_HIT);
|
||||
hitobjects[numobjectshit++] = ents[i];
|
||||
if(numobjectshit < 10)
|
||||
hitobjects[numobjectshit++] = ents[i];
|
||||
ents[i]->take_damage(vec2(0,-1.0f), data->weapons[active_weapon].meleedamage, client_id, active_weapon);
|
||||
player* target = (player*)ents[i];
|
||||
vec2 dir;
|
||||
|
@ -1006,9 +1008,25 @@ void player::tick_defered()
|
|||
{
|
||||
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();
|
||||
bool stuck_after_move = test_box(core.pos, vec2(28.0f, 28.0f));
|
||||
core.quantize();
|
||||
bool stuck_after_quant = test_box(core.pos, vec2(28.0f, 28.0f));
|
||||
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 mask = cmask_all_except_one(client_id);
|
||||
|
|
|
@ -44,11 +44,8 @@ private:
|
|||
|
||||
entity *prev_type_entity;
|
||||
entity *next_type_entity;
|
||||
|
||||
int index;
|
||||
protected:
|
||||
int id;
|
||||
|
||||
public:
|
||||
float proximity_radius;
|
||||
unsigned flags;
|
||||
|
|
Loading…
Reference in a new issue