Thirdperson Crosshair and Hints


(ensiform) #1

For those who use thirdperson …

Somewhere in cg_local.h where the thirdperson cvars are:

extern	vmCvar_t		cg_thirdPersonHints;
extern	vmCvar_t		cg_thirdPersonCrosshair;

Somewhere in cg_main.c where the thirdperson cvars are:

vmCvar_t	cg_thirdPersonHints;
vmCvar_t	cg_thirdPersonCrosshair;

Down below in cg_main.c still where the third person cvars are:

	{ &cg_thirdPersonHints, "cg_thirdPersonHints", "0", 0 },
	{ &cg_thirdPersonCrosshair, "cg_thirdPersonCrosshair", "0", 0 },

Now in cg_draw.c go to the CG_DrawCrosshair function look for this in it:

	if ( cg.renderingThirdPerson ) {
		return;
	}

Now, replace it with:

The scopes and binoculars have odd behavior (they dont actually zoom) so i just made it so that they didnt draw with thirdperson.

	if ( !cg_thirdPersonCrosshair.integer &&
		!cg.zoomedBinoc &&
		cg.snap->ps.weapon != WP_FG42SCOPE &&
		cg.snap->ps.weapon != WP_GARAND_SCOPE &&
		cg.snap->ps.weapon != WP_K43_SCOPE ) {
		if ( cg.renderingThirdPerson ) {
			return;
		}
	}

Now for the cursor hints:

Somewhere down further in cg_draw.c in CG_CheckForCursorHints:

Replace this code:

		if ( cg.renderingThirdPerson ) {
			return;
		}

with:

	if ( !cg_thirdPersonHints.integer ) {
		if ( cg.renderingThirdPerson ) {
			return;
		}
	}

Now you have thirdperson hints and crosshair if the cvars are set to 1 :banana:


(Jaquboss) #2

i would use this : find

cg.renderingThirdPerson =

and replace whole thing with something like this :

cg.renderingThirdPerson = (cg_thirdPerson.integer && !(cg.predictedPlayerState.eFlags & EF_ZOOMING) && !(BG_IsScopedWeapon(cg.predictedPlayerState.weapon)) || (cg.snap->ps.stats[STAT_HEALTH] <= 0) || cg.showGameView;

that will make ppl switch to first person when using sniper/binocs
EDIT: you can also notice some more bugs :

  1. Players view themselfs very closely when using mg
    fix: find this comment
// Ridah, lock the viewangles if the game has told us to

well , then you will see three similar if just with another number like this one

if (ps->viewlocked == 7)

add to all of them

&& !(cg.renderingThirdPerson)

so it will look like this

if (ps->viewlocked == 7 && !(cg.renderingThirdPerson))
  1. when on tank , mg is on strange position
    sorry i dunno…
    BTW: all my changes are in cg_view.c…

(ensiform) #3

I’ve noticed this and it seems quite annoying when in thirdperson :> if anyone figures it out please let me know. im thinking that the mg42 is moving with the script_mover for some reason and it really shouldnt. maybe look for the code to snap the mg42 to the player while in first person ? and have it do it in thirdperson also ?


(Jaquboss) #4

EDIT: there was only small problem, this

	for( i = 0; i < MAX_CLIENTS; i++ ) {
			// Gordon: is this entity mounted on a tank, and attached to _OUR_ turret entity (which could be us)
			if( cg_entities[i].currentValid && cg_entities[i].currentState.eFlags & EF_MOUNTEDTANK && cg_entities[i].tagParent == tank - cg_entities ) {
				angles[YAW] -= tank->lerpAngles[YAW];
				angles[PITCH] -= tank->lerpAngles[PITCH];
				break;
			}
		}

did NOT worked for current player , so it needs this

		if( cg.snap->ps.eFlags & EF_MOUNTEDTANK && cg_entities[cg.snap->ps.clientNum].tagParent == tank - cg_entities) {
		angles[YAW] -= tank->lerpAngles[YAW];
		angles[PITCH] -= tank->lerpAngles[PITCH];
	} else 

just above it…
That is all…


(ensiform) #5

wow thanks dude :smiley: :banana: :banana:


(D-Eagle) #6

There is still problem, like in seawall battery:
http://img149.imageshack.us/my.php?image=problem3zq.jpg

http://img149.imageshack.us/my.php?image=problem20qe.jpg

http://img149.imageshack.us/my.php?image=problem31db.jpg


(Berzerkr) #7

It should change automaticly in first-person-view if you aim with a mg, snipe or use binocs, if this is possible.
Can anyone please post the full changed working script if it’s done? Thanks.


(Jaquboss) #8

@ Berzerk : Well code in my post change it back for snipe and binocs not for mg ( that will be same simple :

   if ( !cg_thirdPersonCrosshair.integer &&
      !cg.zoomedBinoc &&
      cg.snap->ps.weapon != WP_FG42SCOPE &&
      cg.snap->ps.weapon != WP_GARAND_SCOPE &&
      !(cg.snap->ps.eFlags  & EF_MG42_ACTIVE) &&
      !(cg.snap->ps.eFlags  & EF_MOUNTEDTANK) &&
      cg.snap->ps.weapon != WP_K43_SCOPE ) {
      if ( cg.renderingThirdPerson ) {
         return;
      }
   }

d-eagle , i know this , look at my first reply , it is there how you solve that…


(Jaquboss) #9

BEWARE PEOPLE DONT USE CG_THIRDPERSON , rename it to somethin else , since it is checked by punkbuster…
You will get #20006 voilation with cg_thirdperson ( GAME INTEGRITY )


(D-Eagle) #10

This can be stupid question, but how do i rename it?


(D-Eagle) #11

Ok nwm, i got it :slight_smile:


(ensiform) #12

ahem this would be for cheats when enabled like in devmap for testing.


(dark-tim) #13

ey Jaquboss with this:

i would use this : find Code:
cg.renderingThirdPerson =

do you mean this:

C:\WET_Source\src\cgame\cg_multiview.c(503):		cg.renderingThirdPerson = qtrue;
C:\WET_Source\src\cgame\cg_multiview.c(508):		cg.renderingThirdPerson = qfalse;
C:\WET_Source\src\cgame\cg_multiview.c(535):		cg.renderingThirdPerson = qfalse;
C:\WET_Source\src\cgame\cg_view.c(1784):		cg.renderingThirdPerson = cg_thirdPerson.integer || (cg.snap->ps.stats[STAT_HEALTH] <= 0) || cg.showGameView;

?


(Jaquboss) #14

this

C:\WET_Source\src\cgame\cg_view.c(1784):      cg.renderingThirdPerson = cg_thirdPerson.integer || (cg.snap->ps.stats[STAT_HEALTH] <= 0) || cg.showGameView; 

sir , sorry that I havent posted it whole , ( that is becasue i dont have always installed unchanged ET SDK )
dont forget to rename cg_thirdperson to cg_3rdperson for example… ( just rewrite all cg_thirdperson you see )


(dark-tim) #15

okey thanks


(ensiform) #16

theres no need unless ur making a mod that has thirdperson… i showed this for ppl who wanted them as developers. hence cvar_cheat.


(Jaquboss) #17

well , i thought that for playing , because i see no reason to improve something that will be used only very rarely…