...'s landmine


(*Shadow* Commando) #1

Hi,

If you plant a mine i want to let people know who’s mine it is. If you point your crosshair on the armed mine (flag) there is a name from the person who planted it, that’s my idea. I found something in cg_draw.c called CG_DrawCrosshairNames. There also is the “Disguised enemy” when you are level 4 field ops and looking at an opponent covert ops who has a disguise.

Does someone knows how to make this work?


(Demolama) #2

find the creator of forty mod… he did it


(jaybird) #3

I know this is a rather old topic, but it’s unanswered.

CG_Trace and trap_CM_BoxTraps don’t seem to work, and I’m guessing the reason is because r.contents is set to 0 when armed (see Weapon_Engineer, g_weapons.c). I’m looking for them in CG_ScanForCrosshairEntity. Any suggestions on the best way to trap landmines in client code?


(jaybird) #4

bump


(ensiform) #5

i also know that q3f / etf did something like what u want with when u highlight the entity.

…'s <sentry type> autosentry.


(Lanz) #6

hmm, without looking in the code, can’t you just set an unused var on the landmine entity to the client who armed it. Then do a trace from the client and if hit a mine, get the client # and present the name?


(jaybird) #7

I’m not so concerned with getting the mine’s parent, that’s cake. The problem is I cannot trace it in the client. I can finish the rest rather easily, but I cannot figure out exactly how to get a valid trace on a mine.


(jaybird) #8

Anyone?


(forty) #9

jaybird: When I have time later I’ll post about how to do it.


(jaybird) #10

Awesome. While I’m at it I’m having an issue with b_realHead I’d like to ask you about. If ya got the time, email me at (edit) (don’t want to bug you).


(forty) #11

cg_ents.c in CG_Missile


							ent.customShader = cgs.media.genericConstructionShader;
					} else {
						return;
					}
				} else {
					CG_DrawMineMarkerFlag( cent, &ent, weapon );
				}
			} else {
				// forty - mine id 
				CG_ScanForCrosshairMine(cent);
				CG_DrawMineMarkerFlag( cent, &ent, weapon );

cg_draw.c above CG_ScanForCrosshairEntity


/*
=================
CG_ScanForCrosshairMine
=================

 forty - mine id.

*/

void CG_ScanForCrosshairMine(centity_t *cent) {
	trace_t		trace;
	vec3_t		start, end;

	VectorCopy( cg.refdef.vieworg, start );
	VectorMA( start, 512, cg.refdef.viewaxis[0], end );	

	CG_Trace( &trace, start, NULL, NULL, end, -1, MASK_SOLID );

	if(
	Square(trace.endpos[0] - cent->currentState.pos.trBase[0]) < 256 &&
	Square(trace.endpos[1] - cent->currentState.pos.trBase[1]) < 256 && 
	Square(trace.endpos[2] - cent->currentState.pos.trBase[2]) < 256
	) {

		cg.crosshairMine = cent->currentState.otherEntityNum;
		cg.crosshairMineTime = cg.time;
	} else {
		//Don't unset, just cause we didn't get a trace hit,
		//don't worry the cross hair mine id will be unset at print time.
		// - forty
		//cg.crosshairMine = -1;
	}

}

cg_draw.c in CG_DrawCrosshairNames


	if ( cg_drawCrosshair.integer < 0 ) {
		return;
	}

	// forty - mine id's
	if ( cg.crosshairMine > -1 ) {
		color = CG_FadeColor( cg.crosshairMineTime, 1000 );
		s = va("%s\'s mine", cgs.clientinfo[cg.crosshairMine].name);
		w = CG_DrawStrlen( s ) * SMALLCHAR_WIDTH;
		CG_DrawSmallStringColor( 320 - w / 2, 170, s, color );
		cg.crosshairMine = -1;
		return;
	}

cg_local.h in typedef struct { … } cg_t;


	// crosshair client ID
	int			crosshairClientNum;
	int			crosshairClientTime;

	// forty - mine id
	int			crosshairMine;
	int			crosshairMineTime;

g_weapon.c in Weapon_Engineer


				if(G_LandmineUnarmed(traceEnt)) {
					// Opposing team cannot accidentally arm it
					if( G_LandmineTeam(traceEnt) != ent->client->sess.sessionTeam )
						return;

                                        ... skipped a bit to save space here ...

					// forty - mine id
					traceEnt->s.otherEntityNum = ent->s.number;

					// Don't allow disarming for sec (so guy that WAS arming doesn't start disarming it!
					traceEnt->timestamp = level.time + 1000;
					traceEnt->health = 0;

					traceEnt->s.teamNum = ent->client->sess.sessionTeam;
					traceEnt->s.modelindex2 = 0;

					traceEnt->nextthink = level.time + 2000;
					traceEnt->think = G_LandminePrime;
				} else {