All pastes #166106 Raw Edit

ascii

public c v1 · immutable
·published 2006-09-10 15:40 UTC
rendered paste body
void drawEspEntities() {	int entityNum;		// Player esp	for (entityNum = 0; entityNum < MAX_CLIENTS; entityNum++) {		ethEntity_t* entity = &eth.entities[entityNum];				if (!eth.clientInfo[entityNum].infoValid || !entity->isInScreen)			continue;		// Esp dist		if ((seth.value[VAR_ESP_DIST] != 0) && (entity->distance > seth.value[VAR_ESP_DIST]))			continue;		// Sanity check		if (!entity->espColor) {			ethLog("error: esp: don't find color for entity %i", entityNum);			continue;		}		// Define fade color for both name and icon		float fadeColor;		// Auto fade		if (seth.value[VAR_ESP_FADE] == ESP_FADE_AUTO) {			fadeColor = 800.0f / entity->distance;			fadeColor = max(fadeColor, 0.2f);	// Max fade			fadeColor = min(fadeColor, 1.0f);	// Min fade		// Manual fade		} else {			fadeColor = seth.value[VAR_ESP_FADE_VALUE] / 100.0f;		}		// Name esp		int y = 0;	// Keep y here so esp icon can know where to start display		if (seth.value[VAR_ESPNAME]) {			char *str = eth.clientInfo[entityNum].name;						float fontScale;			// Static font size			if (seth.value[VAR_ESPSIZE]) {				fontScale = 0.19f;			// Distance based font size			} else {				fontScale = 150.f / entity->distance;				fontScale = max(fontScale, 0.12f);	// Min size				fontScale = min(fontScale, 0.4f);	// Max size			}			// Position			int x = entity->screenX - (sizeTextWidth(fontScale, str, &eth.fontVariable) / 2);			y = entity->screenY - sizeTextHeight(fontScale, &eth.fontVariable);			// Define name color				vec4_t nameColor;			Vector4Copy(colorWhite, nameColor);			nameColor[3] = fadeColor;			if (seth.value[VAR_ESPNAME_BG]) {				// Background color				vec4_t bgColor;				Vector4Copy(colorBlack, bgColor);				bgColor[3] = fadeColor;				// Border color				vec4_t borderColor;				Vector4Copy(colorLtGrey, borderColor);				borderColor[3] = fadeColor;				drawTextRect(x, y, fontScale, str, nameColor, seth.value[VAR_ESPNAME] == 1 ? qfalse : qtrue, qfalse, qtrue, qtrue, bgColor, borderColor, &eth.fontVariable);			} else {				drawText(x, y, fontScale, str, nameColor, qfalse, qtrue, &eth.fontVariable);			}		}		// Class and weapon icon esp		if (seth.value[VAR_ESPICON] && (eth.mod.type != MOD_TCE)) {			float iconSize;			// Static icon size			if (seth.value[VAR_ESPSIZE]) {				iconSize = 15.0f;			// Distance based icon size			} else {				iconSize = 10000.0f / entity->distance;				iconSize = max(iconSize, 5.0f);		// Min size				iconSize = min(iconSize, 25.0f);	// Max size			}			// Position			int x = entity->screenX - (iconSize * 3) / 2;			y -= iconSize + 4;			// Icon color			vec4_t iconColor;			VectorCopy(entity->espColor, iconColor);			iconColor[3] = fadeColor;			// Background			if (seth.value[VAR_ESPICON_BG]) {				vec4_t bgColor;				Vector4Copy(colorBlack, bgColor);				bgColor[3] = fadeColor;				drawFillRect(x, y, (iconSize * 3) + 2 , iconSize + 2, bgColor);			}			syscall_CG_R_SetColor(iconColor);		    // Class			drawPic(x, y, iconSize, iconSize, eth.classIcons[eth.clientInfo[entityNum].cls]);			// Weapon			drawPic(x + iconSize, y, iconSize * 2, iconSize, eth.weaponIcons[eth.cg_entities[entityNum].currentState->weapon]);		    			syscall_CG_R_SetColor(NULL);				}		// Mortar trace		if (seth.value[VAR_MORTARTRACE] && (eth.cg_entities[entityNum].currentState->weapon == WP_MORTAR_SET))			drawMortarTrace(entityNum);	}		// Missile esp	for (entityNum = MAX_CLIENTS; entityNum < MAX_GENTITIES && seth.value[VAR_ESPENT]; entityNum++) {		ethEntity_t* entity = &eth.entities[entityNum];		if (!*eth.cg_entities[entityNum].currentValid || !entity->isInScreen || !IS_MISSILE(entityNum))			continue;		// Esp dist		if ((seth.value[VAR_ESP_DIST] != 0) && (entity->distance > seth.value[VAR_ESP_DIST]))			continue;		// Landmine esp		if(IS_LANDMINE(entityNum) && IS_MISSILE_ARMED(entityNum)) {			drawText(entity->screenX - 4 , entity->screenY, 0.19f, "L", colorYellow, qfalse, qtrue, &eth.fontVariable);		// Dynamite esp		} else if(IS_DYNAMITE(entityNum)) {			int time = 30 - ((eth.cg_time - eth.cg_entities[entityNum].currentState->effect1Time) / 1000);			if (time > 0) {				char timeStr[8];				snprintf(timeStr, sizeof(timeStr), "D:%i", time);				drawText(entity->screenX - 16, entity->screenY, 0.19f, timeStr, colorYellow,qfalse, qtrue, &eth.fontVariable);			} else				drawText(entity->screenX - 4, entity->screenY, 0.19f, "D", colorYellow, qfalse, qtrue, &eth.fontVariable);		// Grenade esp		} else if (IS_GRENADE(entityNum)) {			drawText(entity->screenX - 4, entity->screenY, 0.19f, "G", colorYellow, qfalse, qtrue, &eth.fontVariable);		// Satchel esp		} else if (IS_SATCHEL(entityNum)) {			drawText(entity->screenX - 4, entity->screenY, 0.19f, "S", colorYellow, qfalse, qtrue, &eth.fontVariable);		// Panzer esp		} else if (IS_PANZER(entityNum)) {			drawText(entity->screenX - 4, entity->screenY, 0.19f, "P", colorYellow, qfalse, qtrue, &eth.fontVariable);		// Mortar esp		} else if (IS_MORTAR(entityNum)) {			drawText(entity->screenX - 4, entity->screenY, 0.19f, "M", colorYellow, qfalse, qtrue, &eth.fontVariable);		}	}	/*	// World entities esp	for (entityNum = 0; entityNum < eth.refEntitiesCount; entityNum++) {		refEntity_t* refEnt = &eth.refEntities[entityNum];		int x, y;		if (worldToScreen(refEnt->origin, &x, &y)) {			// AmmoPack esp			if (refEnt->hModel == eth.hAmmoPack) {				orig_CG_DrawStringExt(x - 4, y, "A", colorWhite, qtrue, qtrue, 8, 12, 50);			// MedicPack esp			} else if (refEnt->hModel == eth.hMedicPack) {				orig_CG_DrawStringExt(x - 4, y, "M", colorWhite, qtrue, qtrue, 8, 12, 50);			// Bullet esp			} else if (refEnt->hModel == eth.hBullet) {				orig_CG_DrawStringExt(x - 2, y, "B", colorWhite, qtrue, qtrue, 4, 6, 50);			}		}	}*/}