diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 5ca5af5f..57ebedf1 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -612,7 +612,7 @@ void suicide() COMMAND(suicide, ARG_NONE); -// EDIT: AH + void flagaction(int flag, int action) { flaginfo &f = flaginfos[flag]; diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index d2d2c926..0428ec8d 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -430,8 +430,9 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) f.flag->y = (ushort) (getint(p)/DMF); f.flag->z = (ushort) (getint(p)/DMF); f.flag->z -= 4; - - float floor = (float)S(f.flag->x, f.flag->y)->floor; + sqr *dropplace = S_SECURE(f.flag->x, f.flag->y); + if(!dropplace) return; + float floor = (float)dropplace->floor; if(f.flag->z > hdr.waterlevel) // above water { if(floor < hdr.waterlevel) @@ -521,24 +522,3 @@ void localservertoclient(int chan, uchar *buf, int len) // processes any updat break; }; }; - -void test1(int x, int y) -{ - conoutf("mipsize %i", mipsize); - conoutf("world : %i %i %i", sizeof(world), sizeof(world[0]), sizeof(&world) / sizeof(world[0])); - - sqr *q = S_SECURE(x, y); - if(q) - conoutf("%i\n", q->floor); - else conoutf("invalid!"); -}; - -COMMAND(test1, ARG_2INT); - -void test2() -{ - conoutf("%f %f %f", player1->o.x, player1->o.y, (float) S((ushort)(player1->o.x), (ushort)(player1->o.y))->floor); -}; - -COMMAND(test2, ARG_NONE); - diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 4fc5f781..e2af91b9 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -240,14 +240,18 @@ void newprojectile(vec &from, vec &to, float speed, bool local, playerent *owner void hit(int target, int damage, playerent *d, playerent *at, bool gib=false) { - d->lastpain = lastmillis; + if(m_ctf && isteam(d->team, at->team)) + { + flaginfo &enemyflag = flaginfos[team_opposite(team_int(d->team))]; + if(enemyflag.state == CTFF_STOLEN && enemyflag.actor == d) return; // protect flag stealer from friendly-fire + }; + d->lastpain = lastmillis; if(d==player1 || d->type==ENT_BOT) selfdamage(damage, -1, at, gib, d); else { addmsg(gib ? SV_GIBDAMAGE : SV_DAMAGE, "ri3", target, damage, d->lifesequence); playsound(S_PAIN1+rnd(5), &d->o); }; - particle_splash(3, damage, 1000, d->o); demodamage(damage, d->o); }; @@ -424,7 +428,6 @@ void shootv(int gun, vec &from, vec &to, playerent *d, bool local, int nademilli case GUN_ASSAULT: addshotline(d, from, to); particle_splash(0, 5, 250, to); - //particle_trail(1, 10, from, to); break; case GUN_GRENADE: @@ -635,7 +638,7 @@ void shoot(playerent *d, vec &targ) else d->gunwait = guns[d->gunselect].attackdelay; shootv(d->gunselect, from, to, d, 0); - if(d->type==ENT_PLAYER) addmsg(SV_SHOT, "ri8", d->gunselect, (int)(from.x*DMF), (int)(from.y*DMF), (int)(from.z*DMF), (int)(to.x*DMF), (int)(to.y*DMF), (int)(to.z*DMF), 0 ); + if(d->type==ENT_PLAYER) addmsg(SV_SHOT, "ri8", d->gunselect, (int)(from.x*DMF), (int)(from.y*DMF), (int)(from.z*DMF), (int)(to.x*DMF), (int)(to.y*DMF), (int)(to.z*DMF), 0); if(autoreload && d == player1 && !d->mag[d->gunselect]) reload(d); diff --git a/source/src/world.h b/source/src/world.h index dbbd45ce..6db0246e 100644 --- a/source/src/world.h +++ b/source/src/world.h @@ -49,7 +49,7 @@ struct header // map file format header #define SWS(w,x,y,s) (&(w)[(y)*(s)+(x)]) #define SW(w,x,y) SWS(w,x,y,ssize) #define S(x,y) SW(world,x,y) // convenient lookup of a lowest mip cube -#define S_SECURE(x, y) ((y)*ssize+(x) < sizeof(world) / sizeof(world[0]) ? S(x,y) : NULL) // same as above, but validates coords +#define S_SECURE(x, y) ((y)*ssize+(x)<=mipsize ? S(x,y) : NULL) // same as above, but validates coords #define SMALLEST_FACTOR 6 // determines number of mips there can be #define DEFAULT_FACTOR 8 #define LARGEST_FACTOR 11 // 10 is already insane