void CG_DrawMapEntity(mapEntityData_t *mEnt, float x, float y, float w, float h, int mEntFilter, mapScissor_t *scissor, qboolean interactive, snapshot_t *snap, int icon_size) { int j = 1; qhandle_t pic; clientInfo_t *ci; bg_playerclass_t *classInfo; centity_t *cent; const char *name; vec4_t c_clr = { 1.f, 1.f, 1.f, 1.f }; vec2_t icon_extends, icon_pos, string_pos = { 0 }; int customimage = 0; oidInfo_t *oidInfo = NULL; switch (mEnt->type) { case ME_PLAYER_DISGUISED: case ME_PLAYER_REVIVE: case ME_PLAYER: ci = &cgs.clientinfo[mEnt->data]; if (!ci->infoValid) { return; } if (ci->team == TEAM_AXIS) { if (mEntFilter & CC_FILTER_AXIS) { return; } } else if (ci->team == TEAM_ALLIES) { if (mEntFilter & CC_FILTER_ALLIES) { return; } } else { return; } cent = &cg_entities[mEnt->data]; if (mEnt->type == ME_PLAYER_DISGUISED && !(cent->currentState.powerups & (1 << PW_OPS_DISGUISED))) { return; } classInfo = CG_PlayerClassForClientinfo(ci, cent); // For these, if availaible, ignore the coordinate data and grab the most up to date pvs data if (cent - cg_entities == cg.clientNum) { if (!scissor) { mEnt->transformed[0] = ((cg.predictedPlayerEntity.lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w; mEnt->transformed[1] = ((cg.predictedPlayerEntity.lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h; } else { mEnt->automapTransformed[0] = ((cg.predictedPlayerEntity.lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w * scissor->zoomFactor; mEnt->automapTransformed[1] = ((cg.predictedPlayerEntity.lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h * scissor->zoomFactor; } mEnt->yaw = cg.predictedPlayerState.viewangles[YAW]; } else if (ci->team == snap->ps.persistant[PERS_TEAM] && cent->currentValid) { if (!scissor) { mEnt->transformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w; mEnt->transformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h; } else { mEnt->automapTransformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w * scissor->zoomFactor; mEnt->automapTransformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h * scissor->zoomFactor; } mEnt->yaw = cent->lerpAngles[YAW]; } else { // only see revivables for own team, duh :) if (mEnt->type == ME_PLAYER_REVIVE) { return; } } // now check to see if the entity is within our clip region if (scissor && CG_ScissorEntIsCulled(mEnt, scissor)) { return; } if (cgs.ccLayers) { if (CG_CurLayerForZ(mEnt->z) != cgs.ccSelectedLayer) { return; } } if (scissor) { icon_pos[0] = mEnt->automapTransformed[0] - scissor->tl[0] + x - (icon_size * (scissor->zoomFactor / 5.159)); icon_pos[1] = mEnt->automapTransformed[1] - scissor->tl[1] + y - (icon_size * (scissor->zoomFactor / 5.159)); } else { icon_pos[0] = x + mEnt->transformed[0] - icon_size; icon_pos[1] = y + mEnt->transformed[1] - icon_size; string_pos[0] = x + mEnt->transformed[0]; string_pos[1] = y + mEnt->transformed[1] + icon_size; } icon_extends[0] = 2 * icon_size; icon_extends[1] = 2 * icon_size; if (scissor) { icon_extends[0] *= (scissor->zoomFactor / 5.159); icon_extends[1] *= (scissor->zoomFactor / 5.159); } if (mEnt->type == ME_PLAYER_REVIVE) { float msec; vec4_t reviveClr = { 1.f, 1.f, 1.f, 1.f }; if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_AXIS) { msec = (cg_redlimbotime.integer - (cg.time % cg_redlimbotime.integer)) / (float)cg_redlimbotime.integer; } else if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_ALLIES) { msec = (cg_bluelimbotime.integer - (cg.time % cg_bluelimbotime.integer)) / (float)cg_bluelimbotime.integer; } else { msec = 0; } reviveClr[3] = .5f + .5f * ((sin(sqrt(msec) * 25 * 2 * M_PI) + 1) * .5f); trap_R_SetColor(reviveClr); CG_DrawPic(icon_pos[0] + 3, icon_pos[1] + 3, icon_extends[0] - 3, icon_extends[1] - 3, cgs.media.medicIcon); trap_R_SetColor(NULL); } else { if (cg.clientNum == mEnt->data) { if (ci->ccSelected) { trap_R_SetColor(colorRed); } else { trap_R_SetColor(colorYellow); } CG_DrawPic(icon_pos[0], icon_pos[1], icon_extends[0], icon_extends[1], cgs.media.ccPlayerHighlight); trap_R_SetColor(NULL); if (cg.predictedPlayerEntity.voiceChatSpriteTime > cg.time) { CG_DrawPic(icon_pos[0] + 12, icon_pos[1], icon_extends[0] * 0.5f, icon_extends[1] * 0.5f, cg.predictedPlayerEntity.voiceChatSprite); } } else if (mEnt->type == ME_PLAYER_DISGUISED) { trap_R_SetColor(colorOrange); CG_DrawPic(icon_pos[0], icon_pos[1], icon_extends[0], icon_extends[1], cgs.media.ccPlayerHighlight); trap_R_SetColor(NULL); } else if (/*!(cgs.ccFilter & CC_FILTER_BUDDIES) &&*/ CG_IsOnSameFireteam(cg.clientNum, mEnt->data)) { if (ci->ccSelected) { trap_R_SetColor(colorRed); } CG_DrawPic(icon_pos[0], icon_pos[1], icon_extends[0], icon_extends[1], cgs.media.ccPlayerHighlight); trap_R_SetColor(NULL); if (!scissor) { CG_Text_Paint_Ext(string_pos[0], string_pos[1], 0.2f, 0.2f, colorWhite, ci->name, 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } if (cent->voiceChatSpriteTime > cg.time) { CG_DrawPic(icon_pos[0] + 12, icon_pos[1], icon_extends[0] * 0.5f, icon_extends[1] * 0.5f, cent->voiceChatSprite); } } else if (ci->team == snap->ps.persistant[PERS_TEAM]) { if (ci->ccSelected) { trap_R_SetColor(colorRed); CG_DrawPic(icon_pos[0], icon_pos[1], icon_extends[0], icon_extends[1], cgs.media.ccPlayerHighlight); trap_R_SetColor(NULL); } if (cent->voiceChatSpriteTime > cg.time) { CG_DrawPic(icon_pos[0] + 12, icon_pos[1], icon_extends[0] * 0.5f, icon_extends[1] * 0.5f, cent->voiceChatSprite); } } c_clr[3] = 1.0f; trap_R_SetColor(c_clr); CG_DrawPic(icon_pos[0], icon_pos[1], icon_extends[0], icon_extends[1], classInfo->icon); CG_DrawRotatedPic(icon_pos[0] - 1, icon_pos[1] - 1, icon_extends[0] + 2, icon_extends[1] + 2, classInfo->arrow, (0.5 - (mEnt->yaw - 180.f) / 360.f)); trap_R_SetColor(NULL); } return; case ME_CONSTRUCT: case ME_DESTRUCT: case ME_DESTRUCT_2: case ME_TANK: case ME_TANK_DEAD: case ME_COMMANDMAP_MARKER: cent = NULL; if (mEnt->type == ME_TANK || mEnt->type == ME_TANK_DEAD) { oidInfo = &cgs.oidInfo[mEnt->data]; for (j = 0; j < cg.snap->numEntities; j++) { if (cg.snap->entities[j].eType == ET_OID_TRIGGER && cg.snap->entities[j].teamNum == mEnt->data) { cent = &cg_entities[cg.snap->entities[j].number]; if (!scissor) { mEnt->transformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w; mEnt->transformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h; } else { mEnt->automapTransformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w * scissor->zoomFactor; mEnt->automapTransformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h * scissor->zoomFactor; } break; } } } else if (mEnt->type == ME_CONSTRUCT || mEnt->type == ME_DESTRUCT || mEnt->type == ME_DESTRUCT_2) { cent = &cg_entities[mEnt->data]; oidInfo = &cgs.oidInfo[cent->currentState.modelindex2]; if (!scissor) { mEnt->transformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w; mEnt->transformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h; } else { mEnt->automapTransformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w * scissor->zoomFactor; mEnt->automapTransformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h * scissor->zoomFactor; } } else if (mEnt->type == ME_COMMANDMAP_MARKER) { oidInfo = &cgs.oidInfo[mEnt->data]; if (!scissor) { mEnt->transformed[0] = ((oidInfo->origin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w; mEnt->transformed[1] = ((oidInfo->origin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h; } else { mEnt->automapTransformed[0] = ((oidInfo->origin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w * scissor->zoomFactor; mEnt->automapTransformed[1] = ((oidInfo->origin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h * scissor->zoomFactor; } } // now check to see if the entity is within our clip region if (scissor && CG_ScissorEntIsCulled(mEnt, scissor)) { return; } if (cgs.ccLayers) { if (CG_CurLayerForZ(mEnt->z) != cgs.ccSelectedLayer) { return; } } if (oidInfo) { customimage = mEnt->team == TEAM_AXIS ? oidInfo->customimageaxis : oidInfo->customimageallies; } if (mEnt->type == ME_CONSTRUCT) { if (mEntFilter & CC_FILTER_CONSTRUCTIONS) { return; } pic = mEnt->team == TEAM_AXIS ? cgs.media.ccConstructIcon[0] : cgs.media.ccConstructIcon[1]; } else if (mEnt->type == ME_TANK) { if (mEntFilter & CC_FILTER_OBJECTIVES) { return; } pic = cgs.media.ccTankIcon; } else if (mEnt->type == ME_TANK_DEAD) { if (mEntFilter & CC_FILTER_OBJECTIVES) { return; } pic = cgs.media.ccTankIcon; trap_R_SetColor(colorRed); } else if (mEnt->type == ME_COMMANDMAP_MARKER) { pic = 0; } else if (mEnt->type == ME_DESTRUCT_2) { pic = 0; } else { if (mEntFilter & CC_FILTER_DESTRUCTIONS) { return; } pic = mEnt->team == TEAM_AXIS ? cgs.media.ccDestructIcon[cent->currentState.effect1Time][0] : cgs.media.ccDestructIcon[cent->currentState.effect1Time][1]; } { int info = 0; if (oidInfo) { info = oidInfo->spawnflags; } if (info & (1 << 4)) { if (mEntFilter & CC_FILTER_OBJECTIVES) { return; } } if (info & (1 << 5)) { if (mEntFilter & CC_FILTER_HACABINETS) { return; } } if (info & (1 << 6)) { if (mEnt->type == ME_DESTRUCT_2) { pic = mEnt->team == TEAM_AXIS ? cgs.media.ccCmdPost[0] : cgs.media.ccCmdPost[1]; } if (mEntFilter & CC_FILTER_CMDPOST) { return; } } } if (customimage) { pic = customimage; } if (scissor) { icon_pos[0] = mEnt->automapTransformed[0] - scissor->tl[0] + x; icon_pos[1] = mEnt->automapTransformed[1] - scissor->tl[1] + y; } else { icon_pos[0] = x + mEnt->transformed[0]; icon_pos[1] = y + mEnt->transformed[1]; } #define CONST_ICON_NORMAL_SIZE 32.f #define CONST_ICON_EXPANDED_SIZE 48.f if (interactive && !expanded && BG_RectContainsPoint(x + mEnt->transformed[0] - (CONST_ICON_NORMAL_SIZE * 0.5f), y + mEnt->transformed[1] - (CONST_ICON_NORMAL_SIZE * 0.5f), CONST_ICON_NORMAL_SIZE, CONST_ICON_NORMAL_SIZE, cgDC.cursorx, cgDC.cursory)) { float w; icon_extends[0] = CONST_ICON_EXPANDED_SIZE; icon_extends[1] = CONST_ICON_EXPANDED_SIZE; if (mEnt->type == ME_TANK_DEAD || mEnt->type == ME_TANK) { icon_extends[1] *= 0.5f; } if (scissor) { icon_extends[0] *= (scissor->zoomFactor / 5.159); icon_extends[1] *= (scissor->zoomFactor / 5.159); } else { icon_extends[0] *= cgs.ccZoomFactor; icon_extends[1] *= cgs.ccZoomFactor; } CG_DrawPic(icon_pos[0] - (icon_extends[0] * 0.5f), icon_pos[1] - (icon_extends[1] * 0.5f), icon_extends[0], icon_extends[1], pic); if (oidInfo) { name = oidInfo->name; } else { name = va("%i", j); } w = CG_Text_Width_Ext(name, 0.2f, 0, &cgs.media.limboFont2); CG_CommandMap_SetHighlightText(name, icon_pos[0] - (w * 0.5f), icon_pos[1] - 8); } else if (interactive && (mEnt->yaw & 0xFF) & (1 << cgs.ccSelectedObjective)) { float scalesize; int time = cg.time % 1400; if (time <= 700) { scalesize = 12 * (time) / 700.f; } else { scalesize = 12 * (1 - ((time - 700) / 700.f)); } icon_extends[0] = CONST_ICON_NORMAL_SIZE + scalesize; icon_extends[1] = CONST_ICON_NORMAL_SIZE + scalesize; if (scissor) { icon_extends[0] *= (scissor->zoomFactor / 5.159); icon_extends[1] *= (scissor->zoomFactor / 5.159); } else { icon_extends[0] *= cgs.ccZoomFactor; icon_extends[1] *= cgs.ccZoomFactor; } if (mEnt->type == ME_TANK_DEAD || mEnt->type == ME_TANK) { icon_extends[1] *= 0.5f; } CG_DrawPic(icon_pos[0] - (icon_extends[0] * 0.5f), icon_pos[1] - (icon_extends[1] * 0.5f), icon_extends[0], icon_extends[1], pic); } else { icon_extends[0] = CONST_ICON_NORMAL_SIZE; icon_extends[1] = CONST_ICON_NORMAL_SIZE; if (mEnt->type == ME_TANK_DEAD || mEnt->type == ME_TANK) { icon_extends[1] *= 0.5f; } if (scissor) { icon_extends[0] *= (scissor->zoomFactor / 5.159); icon_extends[1] *= (scissor->zoomFactor / 5.159); } else { icon_extends[0] *= cgs.ccZoomFactor; icon_extends[1] *= cgs.ccZoomFactor; } CG_DrawPic(icon_pos[0] - (icon_extends[0] * 0.5f), icon_pos[1] - (icon_extends[1] * 0.5f), icon_extends[0], icon_extends[1], pic); } trap_R_SetColor(NULL); return; case ME_LANDMINE: /* if(mEntFilter & CC_FILTER_LANDMINES) { continue; }*/ // now check to see if the entity is within our clip region if (scissor && CG_ScissorEntIsCulled(mEnt, scissor)) { return; } if (cgs.ccLayers) { if (CG_CurLayerForZ(mEnt->z) != cgs.ccSelectedLayer) { return; } } if (mEnt->data == TEAM_AXIS) { pic = cgs.media.commandCentreAxisMineShader; } else // TEAM_ALLIES { pic = cgs.media.commandCentreAlliedMineShader; } c_clr[3] = 1.0f; if (scissor) { icon_pos[0] = mEnt->automapTransformed[0] - scissor->tl[0] + x; icon_pos[1] = mEnt->automapTransformed[1] - scissor->tl[1] + y; } else { icon_pos[0] = x + mEnt->transformed[0]; icon_pos[1] = y + mEnt->transformed[1]; } icon_extends[0] = 12; icon_extends[1] = 12; if (scissor) { icon_extends[0] *= (scissor->zoomFactor / 5.159); icon_extends[1] *= (scissor->zoomFactor / 5.159); } else { icon_extends[0] *= cgs.ccZoomFactor; icon_extends[1] *= cgs.ccZoomFactor; } trap_R_SetColor(c_clr); CG_DrawPic(icon_pos[0] - icon_extends[0] * 0.5f, icon_pos[1] - icon_extends[1] * 0.5f, icon_extends[0], icon_extends[1], pic); trap_R_SetColor(NULL); j++; return; default: return; } }
/* ================= CG_DrawNewCompass ================= */ static void CG_DrawNewCompass(rectDef_t location) { float basex = location.x, basey = location.y - 16, basew = location.w, baseh = location.h; snapshot_t *snap; float angle; int i; static float lastangle = 0; static float anglespeed = 0; float diff; if (cg.nextSnap && !cg.nextFrameTeleport && !cg.thisFrameTeleport) { snap = cg.nextSnap; } else { snap = cg.snap; } if (snap->ps.pm_flags & PMF_LIMBO /*|| snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR*/ #if FEATURE_MULTIVIEW || cg.mvTotalClients > 0 #endif ) { CG_DrawExpandedAutoMap(); return; } diff = basew * 0.25f; if (cgs.autoMapExpanded) { if (cg.time - cgs.autoMapExpandTime < 100.f) { CG_CompasMoveLocation(&basex, &basey, qtrue); } else { CG_DrawExpandedAutoMap(); return; } } else { if (cg.time - cgs.autoMapExpandTime <= 150.f) { CG_DrawExpandedAutoMap(); return; } else if ((cg.time - cgs.autoMapExpandTime > 150.f) && (cg.time - cgs.autoMapExpandTime < 250.f)) { CG_CompasMoveLocation(&basex, &basey, qfalse); } } if (snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR) { return; } CG_DrawAutoMap(basex + (diff / 2), basey + (diff / 2), basew - diff, baseh - diff); CG_DrawPic(basex + 4, basey + 4, basew - 8, baseh - 8, cgs.media.compassShader); angle = (cg.predictedPlayerState.viewangles[YAW] + 180.f) / 360.f - (0.125f); diff = AngleSubtract(angle * 360, lastangle * 360) / 360.f; anglespeed /= 1.08f; anglespeed += diff * 0.01f; if (Q_fabs(anglespeed) < 0.00001f) { anglespeed = 0; } lastangle += anglespeed; CG_DrawRotatedPic(basex + 4, basey + 4, basew - 8, baseh - 8, cgs.media.compass2Shader, lastangle); //if( !(cgs.ccFilter & CC_FILTER_REQUESTS) ) { // draw voice chats { centity_t *cent; for (i = 0; i < MAX_CLIENTS; i++) { cent = &cg_entities[i]; if (cg.predictedPlayerState.clientNum == i || !cgs.clientinfo[i].infoValid || cg.predictedPlayerState.persistant[PERS_TEAM] != cgs.clientinfo[i].team) { continue; } // also draw revive icons if cent is dead and player is a medic if (cent->voiceChatSpriteTime < cg.time) { continue; } if (cgs.clientinfo[i].health <= 0) { // reset cent->voiceChatSpriteTime = cg.time; continue; } CG_DrawCompassIcon(basex, basey, basew, baseh, cg.predictedPlayerState.origin, cent->lerpOrigin, cent->voiceChatSprite); } } //} /*if( !(cgs.ccFilter & CC_FILTER_DESTRUCTIONS) ) { // draw explosives if an engineer if ( cg.predictedPlayerState.stats[ STAT_PLAYER_CLASS ] == PC_ENGINEER ) { for ( i = 0; i < snap->numEntities; i++ ) { centity_t *cent = &cg_entities[ snap->entities[ i ].number ]; if ( cent->currentState.eType != ET_EXPLOSIVE_INDICATOR ) { continue; } if ( cent->currentState.teamNum == 1 && cg.predictedPlayerState.persistant[PERS_TEAM] == TEAM_AXIS ) continue; else if ( cent->currentState.teamNum == 2 && cg.predictedPlayerState.persistant[PERS_TEAM] == TEAM_ALLIES ) continue; CG_DrawCompassIcon( basex, basey, basew, baseh, cg.predictedPlayerState.origin, cent->lerpOrigin, cgs.media.compassDestroyShader ); } } }*/ { entityState_t *ent; for (i = 0; i < snap->numEntities; i++) { ent = &snap->entities[i]; if (ent->eType != ET_PLAYER) { continue; } if (ent->eFlags & EF_DEAD) { if (cg.predictedPlayerState.stats[STAT_PLAYER_CLASS] == PC_MEDIC && ent->number == ent->clientNum) // && !(cgs.ccFilter & CC_FILTER_REQUESTS) { if (!cgs.clientinfo[ent->clientNum].infoValid || cg.predictedPlayerState.persistant[PERS_TEAM] != cgs.clientinfo[ent->clientNum].team) { continue; } CG_DrawCompassIcon(basex, basey, basew, baseh, cg.predictedPlayerState.origin, ent->pos.trBase, cgs.media.medicReviveShader); } continue; } if (!cgs.clientinfo[ent->clientNum].infoValid || cg.predictedPlayerState.persistant[PERS_TEAM] != cgs.clientinfo[ent->clientNum].team) { continue; } if (!CG_IsOnSameFireteam(cg.clientNum, ent->clientNum)) { continue; } CG_DrawCompassIcon(basex, basey, basew, baseh, cg.predictedPlayerState.origin, ent->pos.trBase, cgs.media.buddyShader); //if( !(cgs.ccFilter & CC_FILTER_BUDDIES) ) { } } }
void CG_DrawMortarMarker(int px, int py, int pw, int ph, qboolean draw, mapScissor_t *scissor, int expand) { if (cg.lastFiredWeapon == WP_MORTAR_SET && cg.mortarImpactTime >= 0) { if (cg.snap->ps.weapon != WP_MORTAR_SET) { cg.mortarImpactTime = 0; } else { vec4_t colour = { 1.f, 1.f, 1.f, 1.f }; vec3_t point; if (scissor) { point[0] = ((cg.mortarImpactPos[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * pw * scissor->zoomFactor; point[1] = ((cg.mortarImpactPos[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * ph * scissor->zoomFactor; } else { point[0] = px + (((cg.mortarImpactPos[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * pw); point[1] = py + (((cg.mortarImpactPos[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * ph); } // don't return if the marker is culled, just don't draw it. if (!(scissor && CG_ScissorPointIsCulled(point, scissor))) { if (scissor) { point[0] += px - scissor->tl[0]; point[1] += py - scissor->tl[1]; } if (cg.mortarImpactOutOfMap) { if (!scissor) { // near the edge of the map, fit into it if (point[0] + 8.f > (px + pw)) { point[0] -= 8.f; } else if (point[0] - 8.f < px) { point[0] += 8.f; } if (point[1] + 8.f > (py + ph)) { point[1] -= 8.f; } else if (point[1] - 8.f < py) { point[1] += 8.f; } } colour[3] = .5f; } trap_R_SetColor(colour); CG_DrawRotatedPic(point[0] - 8.f, point[1] - 8.f, 16, 16, cgs.media.ccMortarHit, .5f - (cg.mortarFireAngles[YAW] /*- 180.f */ + 45.f) / 360.f); trap_R_SetColor(NULL); } } } if (COM_BitCheck(cg.snap->ps.weapons, WP_MORTAR_SET)) { vec4_t colour = { 1.f, 1.f, 1.f, 1.f }; vec3_t point; int i, fadeTime; for (i = 0; i < MAX_CLIENTS; i++) { fadeTime = cg.time - (cg.artilleryRequestTime[i] + 25000); if (fadeTime < 5000) { if (fadeTime > 0) { colour[3] = 1.f - (fadeTime / 5000.f); } if (scissor) { point[0] = ((cg.artilleryRequestPos[i][0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * pw * scissor->zoomFactor; point[1] = ((cg.artilleryRequestPos[i][1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * ph * scissor->zoomFactor; } else { point[0] = px + (((cg.artilleryRequestPos[i][0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * pw); point[1] = py + (((cg.artilleryRequestPos[i][1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * ph); } // don't return if the marker is culled, just skip // it (so we draw the rest, if any) if (scissor && CG_ScissorPointIsCulled(point, scissor)) { continue; } if (scissor) { point[0] += px - scissor->tl[0]; point[1] += py - scissor->tl[1]; } trap_R_SetColor(colour); CG_DrawPic(point[0] - 8.f, point[1] - 8.f, 16, 16, cgs.media.ccMortarTarget); trap_R_SetColor(NULL); } } } }
void CG_DrawMap(float x, float y, float w, float h, int mEntFilter, mapScissor_t *scissor, qboolean interactive, float alpha, qboolean borderblend) { int i; snapshot_t *snap; mapEntityData_t *mEnt = &mapEntities[0]; int icon_size; int exspawn; team_t RealTeam = CG_LimboPanel_GetRealTeam(); expanded = qfalse; if (cg.nextSnap && !cg.nextFrameTeleport && !cg.thisFrameTeleport) { snap = cg.nextSnap; } else { snap = cg.snap; } if (scissor) { icon_size = AUTOMAP_PLAYER_ICON_SIZE; if (scissor->br[0] >= scissor->tl[0]) { float s0, s1, t0, t1; float sc_x = x, sc_y = y, sc_w = w, sc_h = h; CG_DrawPic(sc_x, sc_y, sc_w, sc_h, cgs.media.commandCentreAutomapMaskShader); s0 = (scissor->tl[0]) / (w * scissor->zoomFactor); s1 = (scissor->br[0]) / (w * scissor->zoomFactor); t0 = (scissor->tl[1]) / (h * scissor->zoomFactor); t1 = (scissor->br[1]) / (h * scissor->zoomFactor); CG_AdjustFrom640(&sc_x, &sc_y, &sc_w, &sc_h); if (cgs.ccLayers) { trap_R_DrawStretchPic(sc_x, sc_y, sc_w, sc_h, s0, t0, s1, t1, cgs.media.commandCentreAutomapShader[cgs.ccSelectedLayer]); } else { trap_R_DrawStretchPic(sc_x, sc_y, sc_w, sc_h, s0, t0, s1, t1, cgs.media.commandCentreAutomapShader[0]); } // FIXME: the code above seems to do weird things to the next trap_R_DrawStretchPic issued. // This hack works around this. trap_R_DrawStretchPic(0, 0, 0, 0, 0, 0, 0, 0, cgs.media.whiteShader); } // Draw the grid CG_DrawGrid(x, y, w, h, scissor); } else { vec4_t color; icon_size = COMMANDMAP_PLAYER_ICON_SIZE; Vector4Set(color, 1.f, 1.f, 1.f, alpha); trap_R_SetColor(color); CG_DrawPic(x, y, w, h, cgs.media.blackmask); if (cgs.ccLayers) { CG_DrawPic(x, y, w, h, cgs.media.commandCentreMapShaderTrans[cgs.ccSelectedLayer]); } else { CG_DrawPic(x, y, w, h, cgs.media.commandCentreMapShaderTrans[0]); } trap_R_SetColor(NULL); // Draw the grid CG_DrawGrid(x, y, w, h, NULL); } if (borderblend) { trap_R_SetColor(clrBorderblend); CG_DrawPic(x, y, w, h, cgs.media.limboBlendThingy); trap_R_SetColor(NULL); } exspawn = CG_DrawSpawnPointInfo(x, y, w, h, qfalse, scissor, -1); // entnfo data for (i = 0, mEnt = &mapEntities[0]; i < mapEntityCount; ++i, ++mEnt) { // spectators can see icons of both teams if ((interactive && mEnt->team != RealTeam) || (mEnt->team != snap->ps.persistant[PERS_TEAM] && snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR)) { goto CG_DrawMap_check; } if (mEnt->type == ME_PLAYER || mEnt->type == ME_PLAYER_DISGUISED || mEnt->type == ME_PLAYER_OBJECTIVE || mEnt->type == ME_PLAYER_REVIVE) { goto CG_DrawMap_check; } goto CG_DrawMap_draw; CG_DrawMap_check: if (mEnt->team != RealTeam && !CG_DisguiseMapCheck(mEnt)) { continue; } if (mEnt->type != ME_PLAYER && mEnt->type != ME_PLAYER_DISGUISED && mEnt->type != ME_PLAYER_OBJECTIVE && mEnt->type != ME_PLAYER_REVIVE) { continue; } CG_DrawMap_draw: CG_DrawMapEntity(mEnt, x, y, w, h, mEntFilter, scissor, interactive, snap, icon_size); } // entnfo2 data, draw non-players & non-tanks //for(i = 0, mEnt = &mapEntities2[0]; i < mapEntityCount2; ++i, ++mEnt ) { // CG_DrawMapEntity( mEnt, x, y, w, h, mEntFilter, scissor, interactive, snap, icon_size ); //} CG_DrawSpawnPointInfo(x, y, w, h, qtrue, scissor, exspawn); CG_DrawMortarMarker(x, y, w, h, qtrue, scissor, exspawn); // draw spectator position and direction if (cgs.clientinfo[cg.clientNum].team == TEAM_SPECTATOR) { vec2_t pos, size; bg_playerclass_t *classInfo; if (snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR) { size[0] = size[1] = 16; } else { size[0] = size[1] = 12; } if (scissor) { size[0] *= (scissor->zoomFactor / AUTOMAP_ZOOM); size[1] *= (scissor->zoomFactor / AUTOMAP_ZOOM); } else { size[0] *= cgs.ccZoomFactor; size[1] *= cgs.ccZoomFactor; } if (scissor) { pos[0] = ((cg.predictedPlayerEntity.lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w * scissor->zoomFactor - scissor->tl[0] + x; pos[1] = ((cg.predictedPlayerEntity.lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h * scissor->zoomFactor - scissor->tl[1] + y; } else { pos[0] = x + ((cg.predictedPlayerEntity.lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w; pos[1] = y + ((cg.predictedPlayerEntity.lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h; } if (snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR) { // draw a arrow when free-spectating. // FIXME: don't reuse the ccMortarTargetArrow CG_DrawRotatedPic(pos[0] - (size[0] * 0.5f), pos[1] - (size[1] * 0.5f), size[0], size[1], cgs.media.ccMortarTargetArrow, (0.625 - (cg.predictedPlayerState.viewangles[YAW] - 180.f) / 360.f)); } else { // show only current player position to spectators classInfo = CG_PlayerClassForClientinfo(&cgs.clientinfo[snap->ps.clientNum], &cg_entities[snap->ps.clientNum]); if (snap->ps.powerups[PW_OPS_DISGUISED]) { CG_DrawPic(pos[0] - (size[0] * 0.5f), pos[1] - (size[1] * 0.5f), size[0], size[1], classInfo->icon); CG_DrawPic(pos[0] - (size[0] * 0.5f), pos[1] - (size[1] * 0.5f), size[0], size[1], cgs.media.friendShader); } else if (snap->ps.powerups[PW_REDFLAG] || snap->ps.powerups[PW_BLUEFLAG]) { CG_DrawPic(pos[0] - (size[0] * 0.5f), pos[1] - (size[1] * 0.5f), size[0], size[1], cgs.media.objectiveShader); } else { CG_DrawPic(pos[0] - (size[0] * 0.5f), pos[1] - (size[1] * 0.5f), size[0], size[1], classInfo->icon); } CG_DrawRotatedPic(pos[0] - (size[0] * 0.5f) - 1, pos[1] - (size[1] * 0.5f) - 1, size[0] + 2, size[1] + 2, classInfo->arrow, (0.5 - (cg.predictedPlayerState.viewangles[YAW] - 180.f) / 360.f)); } } }