| 567 | } |
| 568 | |
| 569 | void drawradar_vicinity(playerent *p, int w, int h) |
| 570 | { |
| 571 | bool spect3rd = p->spectatemode > SM_FOLLOW1ST && p->spectatemode <= SM_FOLLOW3RD_TRANSPARENT; |
| 572 | playerent *d = spect3rd ? players[p->followplayercn] : p; |
| 573 | int p_baseteam = p->team == TEAM_SPECT && spect3rd ? team_base(players[p->followplayercn]->team) : team_base(p->team); |
| 574 | extern GLuint minimaptex; |
| 575 | int gdim = max(clmapdims.xspan, clmapdims.yspan); |
| 576 | float radarviewsize = min(VIRTW,VIRTH)/5; |
| 577 | float halfviewsize = radarviewsize/2.0f; |
| 578 | float iconsize = radarentsize/0.4f; |
| 579 | float scaleh = radarheight/(2.0f*gdim); |
| 580 | float scaled = radarviewsize/float(radarheight); |
| 581 | float offd = fabs((clmapdims.yspan - clmapdims.xspan) / 2.0f); |
| 582 | if(gdim < 1) { gdim = ssize/2; offd = 0; } |
| 583 | float offx = gdim == clmapdims.yspan ? offd : 0; |
| 584 | float offy = gdim == clmapdims.xspan ? offd : 0; |
| 585 | vec rtr = vec(clmapdims.x1 - offx, clmapdims.y1 - offy, 0); |
| 586 | vec rsd = vec(clmapdims.xm, clmapdims.ym, 0); |
| 587 | float d2s = radarheight * radarheight / 4.0f; |
| 588 | glColor3f(1.0f, 1.0f, 1.0f); |
| 589 | glPushMatrix(); |
| 590 | vec centerpos(VIRTW-halfviewsize-72, halfviewsize+64, 0); |
| 591 | glTranslatef(centerpos.x, centerpos.y, 0); |
| 592 | glRotatef(-camera1->yaw, 0, 0, 1); |
| 593 | glTranslatef(-halfviewsize, -halfviewsize, 0); |
| 594 | vec d4rc = vec(d->o).sub(rsd).normalize().mul(0); |
| 595 | vec usecenter = vec(d->o).sub(rtr).sub(d4rc); |
| 596 | glDisable(GL_BLEND); |
| 597 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| 598 | circle(minimaptex, halfviewsize, halfviewsize, halfviewsize, usecenter.x/(float)gdim, usecenter.y/(float)gdim, scaleh, 31); //Draw mimimaptext as radar background |
| 599 | glTranslatef(halfviewsize, halfviewsize, 0); |
| 600 | |
| 601 | if(!(p->isspectating() && spect3rd)) drawradarent(0, 0, p->yaw, (p->state==CS_ALIVE || p->state==CS_EDITING) ? (isattacking(p) ? 2 : 0) : 1, 2, iconsize, isattacking(p), "%s", colorname(p)); // local player |
| 602 | loopv(players) // other players |
| 603 | { |
| 604 | playerent *pl = players[i]; |
| 605 | if(!pl || pl == p || !team_isactive(pl->team)) continue; |
| 606 | if(OUTBORD(pl->o.x, pl->o.y)) continue; |
| 607 | int pl_baseteam = team_base(pl->team); |
| 608 | if(p->team < TEAM_SPECT && ((m_teammode && !isteam(p_baseteam, pl_baseteam)) || (!m_teammode && !(spect3rd && d == pl)))) continue; |
| 609 | if(p->team == TEAM_SPECT && !(spect3rd && (isteam(p_baseteam, pl_baseteam) || d == pl))) continue; |
| 610 | vec rtmp = vec(pl->o).sub(d->o); |
| 611 | bool isok = rtmp.sqrxy() < d2s; |
| 612 | if(isok) |
| 613 | { |
| 614 | rtmp.mul(scaled); |
| 615 | drawradarent(rtmp.x, rtmp.y, pl->yaw, pl->state==CS_ALIVE ? (isattacking(pl) ? 2 : 0) : 1, spect3rd && d == pl ? 2 : pl_baseteam, iconsize, isattacking(pl), "%s", colorname(pl)); |
| 616 | } |
| 617 | } |
| 618 | if(m_flags_) |
| 619 | { |
| 620 | glColor4f(1.0f, 1.0f, 1.0f, (sinf(lastmillis / 100.0f) + 1.0f) / 2.0f); |
| 621 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| 622 | float d2c = 1.6f * radarentsize/16.0f; |
| 623 | loopi(2) // flag items |
| 624 | { |
| 625 | flaginfo &f = flaginfos[i]; |
| 626 | entity *e = f.flagent; |
no test coverage detected