Advanced Targeting Reticule

An area for discussing new ideas and additions to Oolite.

Moderators: another_commander, winston

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6554
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Sure. Here you go:

Code: Select all

Comparing: D:\Ootrunk_v1.71.2\src\Core\HeadUpDisplay.m
To: D:\oosvn\trunk\src\Core\HeadUpDisplay.m
====
====
59	 <! void hudDrawReticleOnTarget(Entity* target, PlayerEntity* player1, GLfloat z1, GLfloat overallAlpha);
	 !> void hudDrawReticleOnTarget(Entity* target, PlayerEntity* player1, GLfloat z1, GLfloat overallAlpha, BOOL reticleTargetSensitive);

135	 !> 	reticleTargetSensitive = [hudinfo boolForKey:@"reticle_target_sensitive" defaultValue:NO];
	 !> 	

	 !> - (BOOL) reticleTargetSensitive
	 !> {
	 !> 	return reticleTargetSensitive;
	 !> }
	 !> 
	 !> 
	 !> - (void) setReticleTargetSensitive:(BOOL) newReticleTargetSensitiveValue
	 !> {
	 !> 	reticleTargetSensitive = !!newReticleTargetSensitiveValue; // ensure YES or NO.
	 !> }
	 !> 
	 !> 
1446	 <! 		hudDrawReticleOnTarget([player primaryTarget], player, z1, overallAlpha);
	 !> 		hudDrawReticleOnTarget([player primaryTarget], player, z1, overallAlpha, reticleTargetSensitive);
1923	 <! void hudDrawReticleOnTarget(Entity* target, PlayerEntity* player1, GLfloat z1, GLfloat overallAlpha)
	 !> void hudDrawReticleOnTarget(Entity* target, PlayerEntity* player1, GLfloat z1, GLfloat overallAlpha, BOOL reticleTargetSensitive)
2021	 <! 	// draw the reticle	
2022	 <! 	GLColorWithOverallAlpha(green_color, overallAlpha);
	 !> 	// draw the reticle
	 !> 	// If reticle is target sensitive, draw target box in red when target passes through crosshairs.
	 !> 	if (reticleTargetSensitive && [UNIVERSE getFirstEntityTargettedByPlayer] == [player1 primaryTarget])
	 !> 	{
	 !> 		GLColorWithOverallAlpha(red_color, overallAlpha);
	 !> 	}
	 !> 	else
	 !> 	{
	 !> 		GLColorWithOverallAlpha(green_color, overallAlpha);
	 !> 	}
Also, in HeadUpDisplay.h, add

Code: Select all

BOOL	reticleTargetSensitive;
inside the @interface HeadUpDisplay: NSObject declaration and the declaration for - (BOOL) reticleTargetSensitive;. Of course, remember to add the reticle_target_sensitive key in your shipdata.,plist and hold down Shift while starting up Oolite for the change in shipdata to take effect.

That's all. You should be good to go. Hope I haven't messed up the diff too much.
CmdrLUke
Deadly
Deadly
Posts: 170
Joined: Sun Aug 31, 2008 3:23 pm

Post by CmdrLUke »

It's in. It works. It's AWESOME

Thank you very much! I'd be happy to offer my oolite.exe to anybody who wants to try it out, I also have the "no slowdowns" fix applied. I'll post a message in the oolist-pc forum about this.
Post Reply