From dffda5738168e2450d588b23fe04f3b1feeec5c5 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Mon, 2 Apr 2007 19:23:13 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@891 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/geom.h | 2 ++ source/src/renderextras.cpp | 31 +++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/source/src/geom.h b/source/src/geom.h index f5f95065..2ced17e7 100644 --- a/source/src/geom.h +++ b/source/src/geom.h @@ -33,6 +33,8 @@ struct vec float dist(const vec &e) const { vec t; return dist(e, t); } float dist(const vec &e, vec &t) const { t = *this; t.sub(e); return t.magnitude(); } + float distxy(const vec &e) const { float dx = e.x - x, dy = e.y - y; return sqrtf(dx*dx + dy*dy); } + bool reject(const vec &o, float max) { return x>o.x+max || xo.y+max || yteam, pl->team) || (centerpos.z=pl->o.z && centerpos.reject(pl->o, radarres/2))) continue; + if(!pl || !isteam(player1->team, pl->team) || !insideradar(centerpos, radarres/2, pl->o)) continue; drawradarent(pl->o.x*coordtrans, pl->o.y*coordtrans, pl->yaw, pl->state==CS_ALIVE ? (pl->attacking ? 2 : 0) : 1, team_int(pl->team), iconsize, false); } if(m_ctf) @@ -377,9 +400,9 @@ void drawradar(const vec ¢er, float angle, int radarres, int w, int h, bool flaginfo &f = flaginfos[i]; entity *e = f.flag; if(!e) continue; - if(f.state==CTFF_STOLEN && f.actor && (centerpos.z=f.actor->o.z && !centerpos.reject(f.actor->o, radarres/2))) + if(f.state==CTFF_STOLEN && f.actor && insideradar(centerpos, radarres/2, f.actor->o)) drawradarent(f.actor->o.x*coordtrans+iconsize/2, f.actor->o.y*coordtrans+iconsize/2, 0, 3, f.team, iconsize, true); // draw near flag thief - else if(!vec(e->x, e->y, centerpos.z).reject(centerpos, radarres/2)) drawradarent(e->x*coordtrans, e->y*coordtrans, 0, 3, f.team, iconsize, false); // draw on entitiy pos + else if(insideradar(centerpos, radarres/2, vec(e->x, e->y, centerpos.z))) drawradarent(e->x*coordtrans, e->y*coordtrans, 0, 3, f.team, iconsize, false); // draw on entitiy pos } }