Esempio n. 1
0
void Scene3D::drawAxis()
{
   glLineWidth(3.0f);

   glColor4f(1.00f, 0.00f, 0.00f, 1.0f);
   glBegin(GL_LINES);
      glVertex3f( 1.0f,  0.0f,  0.0f);
      glVertex3f(-1.0f,  0.0f,  0.0f);
   glEnd();

   QColor halfGreen(0, 128, 0, 255);
   qglColor(halfGreen);
   glBegin(GL_LINES);
      glVertex3f( 0.0f,  1.0f,  -0.0f);
      glVertex3f( 0.0f, -1.0f,  0.0f);

      glColor4f(0.00f, 0.00f, 1.00f, 1.0f);
      glVertex3f( 0.0f,  0.0f,  1.0f);
      glVertex3f( 0.0f,  0.0f, -1.0f);
   glEnd();

   unsigned char axisColor[] = { 0, 0, 255 };
//   unsigned char *axisColor = new unsigned char[3];
//   axisColor[0] = 0; axisColor[1] = 1; axisColor[2] = 255;
   drawCam(1, 0, 0, 0.02, 0, -90, 0, axisColor);
   drawCam(0, 1, 0, 0.02, 90, 0, 0, axisColor);
   drawCam(0, 0, 1, 0.02, 180, 0, 0, axisColor);
}
Esempio n. 2
0
void CCam::satchelCam(camInfo_t *ci)
{
	int satchelEntityNum = Engine.findSatchel();

	// If don't find satchel or is out of range to fire
	if (satchelEntityNum == -1 || VectorDistance(eth32.cg.refdef->vieworg, eth32.cg.gentity[satchelEntityNum].lerpOrigin) > 2000)
		return;

	int w = ci->x2 - ci->x1;
	int h = ci->y2 - ci->y1;

	// Set the view
	memcpy(&camRefDef, &eth32.cg.refdef, sizeof(refdef_t));
	// fov
	camRefDef.fov_x = (w>h) ? ci->fov : ci->fov * w / h;
	camRefDef.fov_y = (h>w) ? ci->fov : ci->fov * h / w;
	// origin
	VectorCopy(eth32.cg.gentity[satchelEntityNum].lerpOrigin, camRefDef.vieworg);

	camRefDef.vieworg[ROLL] += ci->distance;
	// view angle
	vec3_t camAngle;
	VectorCopy(eth32.cg.refdefViewAngles, camAngle);
	camAngle[PITCH] = ci->angle;
	AnglesToAxis(camAngle, camRefDef.viewaxis);

	// Draw the spycam
	drawCam(ci->x1, ci->y1, w, h, &camRefDef, qfalse);
}
Esempio n. 3
0
void CCam::rifleCam(camInfo_t *ci)
{
	int w = ci->x2 - ci->x1;
	int h = ci->y2 - ci->y1;

	// Set the view
	memcpy(&camRefDef, &eth32.cg.refdef, sizeof(refdef_t));
	// fov
	camRefDef.fov_x = (w>h) ? ci->fov : ci->fov * w / h;
	camRefDef.fov_y = (h>w) ? ci->fov : ci->fov * h / w;
	// origin
	VectorCopy(Aimbot.lastImpact, camRefDef.vieworg);
	camRefDef.vieworg[ROLL] += ci->distance;
	// angle
	vec3_t camAngle;
	VectorCopy(eth32.cg.refdefViewAngles, camAngle);
	camAngle[PITCH] = ci->angle;
	AnglesToAxis(camAngle, camRefDef.viewaxis);

	// Draw the riflecam
	drawCam(ci->x1, ci->y1, w, h, &camRefDef, qtrue);

	// Draw impact time
	sprintf(this->str, "^b%.1f ^7s", (float)Aimbot.flyTime / 1000.0f);
	Draw.Text(ci->x1 + (w / 2) - (TEXTWIDTH(this->str) / 2), ci->y1 + h - 22 , 0.24f, str, GUI_FONTCOLOR1, qfalse, qtrue, &eth32.cg.media.fontArial, true);
}
Esempio n. 4
0
void drawGame(void) {
	GLint i;

	polycount = 0;

	clearScreen();

	glShadeModel( GL_SMOOTH );
	glDepthMask(GL_TRUE);
	glEnable(GL_DEPTH_TEST);

	for(i = 0; i < vp_max[gViewportType]; i++) {
		Player *p = game->player + viewport_content[i];
		PlayerVisual *pV = gPlayerVisuals + viewport_content[i];
		Visual *d = & pV->display;

		if(d->onScreen == 1) {
			glViewport(d->vp_x, d->vp_y, d->vp_w, d->vp_h);
			drawCam(p, pV);

			/* hud stuff for every player */
			drawHUD(p, pV);
		}
	}
	/* printf("%d polys\n", polycount); */
}
Esempio n. 5
0
void drawGame(void) {
	GLint i;

	clearScreen();

	glShadeModel( GL_SMOOTH );
	glDepthMask(GL_TRUE);
	glEnable(GL_DEPTH_TEST);

	for(i = 0; i < vp_max[gViewportType]; i++) {
		Visual *d = &gPlayerVisuals[viewport_content[i]].display;

		if(d->onScreen == 1) {
			glViewport(d->vp_x, d->vp_y, d->vp_w, d->vp_h);
			drawCam(viewport_content[i]);

			/* hud stuff for every player */
			drawHUD(game->player + viewport_content[i],
				gPlayerVisuals + viewport_content[i]);
		}
	}
}
Esempio n. 6
0
void CCam::targetCam(camInfo_t *ci)
{

	if (this->targetClientNum < 0 || this->targetClientNum > (MAX_CLIENTS-1) || !IS_INFOVALID(this->targetClientNum) || IS_DEAD(eth32.cg.clientNum))
	{
		this->targetClientNum = -1;
		return;
	}

	player_t *player = &eth32.cg.players[targetClientNum];

	int w = ci->x2 - ci->x1;
	int h = ci->y2 - ci->y1;

	// Set the view
	memcpy(&camRefDef, &eth32.cg.refdef, sizeof(refdef_t));
	// fov
	camRefDef.fov_x = (w>h) ? ci->fov : ci->fov * w / h;
	camRefDef.fov_y = (h>w) ? ci->fov : ci->fov * h / w;
	// origin
	vec3_t origin;
	VectorCopy( player->orHead.origin, origin );
	VectorMA( origin, -(int)ci->distance, eth32.cg.refdef->viewaxis[0], origin );
	VectorCopy(origin, camRefDef.vieworg);

	// view angle
	vec3_t camAngle;

	VectorCopy(eth32.cg.refdefViewAngles, camAngle);
	AnglesToAxis(camAngle, camRefDef.viewaxis);

	// Draw the spycam
	drawCam(ci->x1, ci->y1, w, h, &camRefDef, qfalse);

	strcpy(this->str, player->name);
	Draw.Text(ci->x1 + (w / 2) - (TEXTWIDTH(this->str) / 2), ci->y1 + h - 22 , 0.24f, str, GUI_FONTCOLOR1, qfalse, qtrue, &eth32.cg.media.fontArial, true);
}
Esempio n. 7
0
void CCam::enemyCam(camInfo_t *ci)
{
	int entityNum = nearestEntity();

	if (entityNum == -1)
		return;

	player_t *player = &eth32.cg.players[entityNum];

	int w = ci->x2 - ci->x1;
	int h = ci->y2 - ci->y1;

	// Set the view
	memcpy(&camRefDef, &eth32.cg.refdef, sizeof(refdef_t));
	// fov
	camRefDef.fov_x = (w>h) ? ci->fov : ci->fov * w / h;
	camRefDef.fov_y = (h>w) ? ci->fov : ci->fov * h / w;
	// origin
	VectorCopy( player->lerpOrigin, camRefDef.vieworg );

	if (player->currentState->eFlags & EF_CROUCHING)
		camRefDef.vieworg[2] += CROUCH_VIEWHEIGHT;
	else if (player->currentState->eFlags & EF_PRONE)
		camRefDef.vieworg[2] += PRONE_VIEWHEIGHT;
	else
		camRefDef.vieworg[2] += DEFAULT_VIEWHEIGHT;

	// view angle
	AnglesToAxis(player->currentState->apos.trBase, camRefDef.viewaxis);

	// Draw the spycam
	drawCam(ci->x1, ci->y1, w, h, &camRefDef, qfalse);

	sprintf(this->str, player->name);
	Draw.Text(ci->x1 + (w / 2) - (TEXTWIDTH(this->str) / 2), ci->y1 + h - 22 , 0.24f, str, GUI_FONTCOLOR1, qfalse, qtrue, &eth32.cg.media.fontArial, true);
}
Esempio n. 8
0
void drawGame() {
  GLint i;
  gDisplay *d;
  Player *p;

  polycount = 0;
  glClearColor(.0, .0, .0, .0);
  glDepthMask(GL_TRUE);
  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glDepthMask(GL_FALSE);

  for(i = 0; i < vp_max[ game->settings->display_type]; i++) {
    p = &(game->player[ game->settings->content[i] ]);
    if(p->display->onScreen == 1) {
      d = p->display;
      glViewport(d->vp_x, d->vp_y, d->vp_w, d->vp_h);
      drawCam(p, d);
      drawScore(p, d);
      if(game->settings->show_ai_status)
	if(p->ai->active == 1)
	  drawAI(d);
    }
  }

  if(game->settings->show_2d > 0)
    drawDebugTex(game->screen);
  if(game->settings->show_fps)
    drawFPS(game->screen);

  /*
  if(game->settings->show_help == 1)
    drawHelp(game->screen);
  */

  /* printf("%d polys\n", polycount); */
}
Esempio n. 9
0
void CCam::followCam(camInfo_t *ci)
{

	vec3_t		forward, right, up, ViewAngles;
	refdef_t	camRefDef;

	vec3_t		focusAngles, focusPoint, view;

	float		forwardScale, sideScale, focusDist;

	if(!IS_WEAPATTRIB(eth32.cg.snap->ps.weapon, WA_MORTAR))
		return;

	memcpy(&camRefDef, &eth32.cg.refdef, sizeof(refdef_t));

	VectorCopy( eth32.cg.refdefViewAngles, ViewAngles );
	VectorCopy( ViewAngles, camRefDef.vieworg );
	VectorCopy( ViewAngles, focusAngles );
	focusAngles[PITCH] = 45;

	AngleVectors( focusAngles, forward, NULL, NULL );

	VectorCopy( this->gentityOrigin, focusPoint );
	VectorCopy( this->gentityOrigin, view );
	view[2] += 8;

	ViewAngles[PITCH] *= 0.5;

	AngleVectors( ViewAngles, forward, right, up );

	forwardScale = cos( 0 / 180 * M_PI );
	sideScale = sin( 0 / 180 * M_PI );
	VectorMA( view, -ci->distance * forwardScale, forward, view );
	VectorMA( view, -ci->distance * sideScale, right, view );

	// select pitch to look at focus point from vieword
	VectorSubtract( focusPoint, view, focusPoint );
	focusDist = sqrt( focusPoint[0] * focusPoint[0] + focusPoint[1] * focusPoint[1] );

	if ( focusDist < 1 ) {
		focusDist = 1;	// should never happen
	}

	int w = ci->x2 - ci->x1;
	int h = ci->y2 - ci->y1;

	VectorCopy( view, camRefDef.vieworg );

	// fov
	camRefDef.fov_x = (w>h) ? ci->fov : ci->fov * w / h;
	camRefDef.fov_y = (h>w) ? ci->fov : ci->fov * h / w;

	//Adjusting the angle to look towards entity origin
	vec3_t temp;
	VectorCopy( ViewAngles, temp );

	temp[PITCH] = -180 / M_PI * atan2( focusPoint[2], focusDist );

	AnglesToAxis( temp, camRefDef.viewaxis );

	drawCam(ci->x1, ci->y1, w, h, &camRefDef, qfalse);
}
Esempio n. 10
0
void CCam::mortarCam(camInfo_t *ci)
{
	if (eth32.cg.snap->ps.ammo == 0)
		return;

// Set mortar trajectory from current view
	vec3_t angles, forward;
	VectorCopy(eth32.cg.refdef->viewaxis[ROLL], forward);
	VectorCopy(eth32.cg.snap->ps.viewangles, angles);
	angles[PITCH] -= 60.f;
	AngleVectors(angles, forward, NULL, NULL);
	forward[0] *= 3000 * 1.1f;
	forward[1] *= 3000 * 1.1f;
	forward[2] *= 1500 * 1.1f;

	trajectory_t mortarTrajectory;
	mortarTrajectory.trType = TR_GRAVITY;
	mortarTrajectory.trTime = eth32.cg.time;
	VectorCopy(eth32.cg.muzzle, mortarTrajectory.trBase);
	VectorCopy(forward, mortarTrajectory.trDelta);

	// Calculate mortar impact
	int timeOffset = 0;
	trace_t mortarTrace;
	vec3_t mortarImpact;
	VectorCopy(mortarTrajectory.trBase, mortarImpact);
	#define TIME_STEP 20
	while (timeOffset < 10000) {
		vec3_t nextPos;
		timeOffset += TIME_STEP;
		BG_EvaluateTrajectory(&mortarTrajectory, eth32.cg.time + timeOffset, nextPos, qfalse, 0);
		orig_CG_Trace(&mortarTrace, mortarImpact, 0, 0, nextPos, eth32.cg.snap->ps.clientNum, MASK_MISSILESHOT);
		if ((mortarTrace.fraction != 1)
				// Stop if we hit sky
				&& !((mortarTrace.surfaceFlags & SURF_NODRAW) || (mortarTrace.surfaceFlags & SURF_NOIMPACT))
				&& (mortarTrace.contents != 0)) {
			break;
		}
		VectorCopy(nextPos, mortarImpact);
	}

	memcpy(&camRefDef, &eth32.cg.refdef, sizeof(refdef_t));

	// kobject: add some angles
	vec3_t	dpos;
	vec3_t	camOrg;

	dpos[0] = eth32.cg.refdef->vieworg[0]-mortarImpact[0];
	dpos[1] = eth32.cg.refdef->vieworg[1]-mortarImpact[1];
	dpos[2] = 0.0f;
	VectorNormalizeFast( dpos );
	VectorCopy( mortarImpact, camOrg );
	VectorMA( camOrg, ci->distance * sinf(ci->angle * M_PI/180.0), zAxis, camOrg );
	VectorMA( camOrg, ci->distance * cosf(ci->angle * M_PI/180.0), dpos, camOrg );

	int w = ci->x2 - ci->x1;
	int h = ci->y2 - ci->y1;

	camRefDef.fov_x = (w>h) ? ci->fov : ci->fov * w / h;
	camRefDef.fov_y = (h>w) ? ci->fov : ci->fov * h / w;

	VectorCopy(camOrg, camRefDef.vieworg);

	vec3_t camAngle;
	VectorCopy(eth32.cg.refdefViewAngles, camAngle);
	camAngle[PITCH] = ci->angle;

	AnglesToAxis(camAngle, camRefDef.viewaxis);

	drawCam(ci->x1, ci->y1, w, h, &camRefDef, qtrue);

	// Draw impact time
	sprintf(this->str, "^7Impact Time: ^b%.1f ^7seconds", (float)timeOffset / 1000.0f);
	Draw.Text(ci->x1 + (w / 2) - (TEXTWIDTH(this->str) / 2), ci->y1 + h - 22 , 0.24f, str, GUI_FONTCOLOR1, qfalse, qtrue, &eth32.cg.media.fontArial, true);

}