variuos crash fixes and fixed ninja

This commit is contained in:
Magnus Auvinen 2007-12-13 20:28:22 +00:00
parent 8f39b81ab0
commit c3b492b4be
3 changed files with 12 additions and 8 deletions

View file

@ -1507,11 +1507,9 @@ static void render_player(
float alpha = 1.0f;
if (alpha > 0.0f && data->weapons[iw].sprite_muzzle[itex].psprite)
{
vec2 dir = vec2(player.x,player.y) - vec2(prev.x, prev.y);
vec2 dir = vec2(player_char->x,player_char->y) - vec2(prev_char->x, prev_char->y);
dir = normalize(dir);
float hadokenangle = atan(dir.y/dir.x);
if (dir.x < 0.0f)
hadokenangle += pi;
float hadokenangle = get_angle(dir);
gfx_quads_setrotation(hadokenangle);
//float offsety = -data->weapons[iw].muzzleoffsety;
select_sprite(data->weapons[iw].sprite_muzzle[itex].psprite, 0);

View file

@ -356,7 +356,6 @@ void player::init()
client_id = -1;
team = -1; // -1 == spectator
extrapowerflags = 0;
ninjaactivationtick = 0;
latency_accum = 0;
latency_accum_min = 0;
@ -390,6 +389,9 @@ void player::reset()
emote_stop = 0;
damage_taken_tick = 0;
attack_tick = 0;
numobjectshit = 0;
ninjaactivationtick = 0;
currentmovetime = 0;
active_weapon = WEAPON_GUN;
last_weapon = WEAPON_HAMMER;
@ -571,6 +573,7 @@ int player::handle_ninja()
activationdir = direction;
currentmovetime = data->weapons[WEAPON_NINJA].movetime * server_tickspeed() / 1000;
currentcooldown = data->weapons[WEAPON_NINJA].firedelay * server_tickspeed() / 1000 + server_tick();
// reset hit objects
numobjectshit = 0;
@ -1038,8 +1041,11 @@ void player::tick_defered()
{
create_sound(pos, SOUND_PLAYER_JUMP, mask);
ev_common *c = (ev_common *)::events.create(EVENT_AIR_JUMP, sizeof(ev_common), mask);
c->x = (int)pos.x;
c->y = (int)pos.y;
if(c)
{
c->x = (int)pos.x;
c->y = (int)pos.y;
}
}
//if(events&COREEVENT_HOOK_LAUNCH) snd_play_random(CHN_WORLD, SOUND_HOOK_LOOP, 1.0f, pos);

View file

@ -14,7 +14,7 @@ inline bool cmask_is_set(int mask, int cid) { return (mask&cmask_one(cid)) != 0;
class event_handler
{
static const int MAX_EVENTS = 128;
static const int MAX_DATASIZE = 128*4;
static const int MAX_DATASIZE = 128*64;
int types[MAX_EVENTS]; // TODO: remove some of these arrays
int offsets[MAX_EVENTS];