Modified Scope Crosshair

Lithtech Jupiter engine

Post Reply
User avatar
Johnny LaRue
Advanced Member
Advanced Member
Posts: 33
Joined: Tue Jan 16, 2007 2:30 pm
Location: Oh Canada!
Contact:

Post by Johnny LaRue » Fri Apr 20, 2007 7:11 am

Greetings,

I was trying to edit the crosshair that is used for the scope (e.g Sniper Scope) but couldn't locate the texture/sprite or .txt file anywhere. This directory has all of the "overlay textures" but the crosshair texture isn't there:

game / interface / hud / sprtex (dtx)

game / interface / hud / spr (Sprites)

I also scoured the Weapons, fx, & layout butes files but still no luck. Has anyone else out there edited the scope crosshair before? :huh: It seems likely that i may have to tinker with the sourcecode.


JLAR

User avatar
Spawn
Admin
Admin
Posts: 1310
Joined: Sun Jul 25, 2004 12:50 am
Location: Norway
Contact:

Post by Spawn » Fri Apr 20, 2007 6:24 pm

You found the one that was used, the function is mainly done in Layout.txt
since it is a HUD you'll see and not a weapon :thumb:


Here's Nolf2's code:

/************************************************************************
**
** Overlay Layout
**
** Sprite<N> (String)
**
** Path to the sprite resource used as a mask for the overlay
**
** Scale<N> (Float)
**
** Amount to scale the overlay
**
**
*/
[Overlay]
Sprite0 = "Interface\hud\Spr\Scope.spr"
Scale0 = 0.08
Sprite1 = "Interface\hud\Spr\Binocs.spr"
Scale1 = 0.3
Sprite2 = "Interface\hud\Spr\ssmask.spr"
Scale2 = 0.23
Sprite3 = "Interface\hud\Spr\static.spr"
Scale3 = 0.1
Sprite4 = "Interface\hud\Spr\Camera1.spr"
Scale4 = 0.05
Sprite5 = "Interface\hud\Spr\Camera2.spr"
Scale5 = 0.05
Sprite6 = "Interface\hud\Spr\zoomin.spr"
Scale6 = 0.5
Sprite7 = "Interface\hud\Spr\zoomout.spr"
Scale7 = 0.5
Sprite8 = "Interface\hud\Spr\target.spr"
Scale8 = 0.07
Sprite9 = "Interface\hud\Spr\overload.spr"
Scale9 = 0.05
Sprite10 = "Interface\hud\Spr\warning.spr"
Scale10 = 0.05
Sprite11 = "Interface\hud\Spr\ssdead.spr"
Scale11 = 0.18
Sprite12 = "Interface\hud\Spr\rogue.spr"
Scale12 = 0.18
Sprite13 = "Interface\hud\Spr\SSMaskX.spr"
Scale13 = 0.23
[/quote]

And here's a example from a different game, such as Sharpshooter II:
/************************************************************************
**
** Overlay Layout
**
**- Overlays consist of a sprite (to supply texture and timing information),
**- and a rectangle describing the poly to apply that texture to. The following
**- is a list of the sprites that must remain as they are until a
**- programmer removes them.
**
**- eScope = 0,
**- eBinocular = 1,
**- eWNN = 2,
**- eNightVision = 3,
**- eTargetDesignator = 4,
**
**
** Sprite<N> (String)
**
**- Path to the sprite resource used as a mask for the overlay
**
** Rect<N> (x, y, width, height)
**
**- The rectangle that defines the sprite's position, based on a 640x480 resolution
**
**
*/
[Overlay]
Sprite0 = "Sprites\Interface\HUD\Scope_Overlay.spr"
Rect0 = (0, -80, 640, 640)
Sprite1 = "Sprites\Interface\HUD\Binocular_Overlay.spr"
Rect1 = (0, -80, 640, 640)
Sprite2 = "Sprites\Interface\HUD\WNN_Overlay.spr"
Rect2 = (328, 292, 314, 157)
Sprite3 = "Sprites\Interface\HUD\NightVision.spr"
Rect3 = (0, 0, 640, 480)
Sprite4 = "Sprites\Interface\HUD\TargetDesignator_Overlay.spr"
Rect4 = (0, -80, 640, 640)

The Crosshair is also spesified further down in the layout.txt:
[HUDCrosshair]
Crosshair0 = "interface\hud\crosshair\Crosshair0"
Crosshair1 = "interface\hud\crosshair\Crosshair1"
Crosshair2 = "interface\hud\crosshair\Crosshair2"
The scope sprite is just a overlay texture, what you really see is the same thing as a camera.. The Crosshair itself is a alphamask, so it will only show up as a white texture unless you go the texture's properties

All textures are showing up for me btw :)
You might have to unpack them manually if they're missing..

Hope this did any good :)
Image

User avatar
Johnny LaRue
Advanced Member
Advanced Member
Posts: 33
Joined: Tue Jan 16, 2007 2:30 pm
Location: Oh Canada!
Contact:

Post by Johnny LaRue » Sat Apr 21, 2007 3:29 am

I guess i have should have been more specific. I was trying to change the color of the scope crosshair. Check out these images:

From Mob Enforcer:

Image

From CJ/Nolf2:

Image

I am trying to change the CJ scope crosshair so that it will be all black (like the mob enforcer one) & there doesn't appear to be a way to do that in the Layout.txt. This scope crosshair overlay should be a texture yet it's nowhere to be found in the

" Interface / Hud / Sprtex " directory.

The SCOPE1_FADE.dtx is only the overlay texture for the scope lens & doesn't include a crosshair. Take for example the Spacesuit.spr file, its points to the
"SpaceHelmet.dtx" in the Tex / Moon base directory. The scope crosshair should also be an overlay texture that i can modify through photoshop.


The Crosshair is also spesified further down in the layout.txt:


QUOTE

[HUDCrosshair]
Crosshair0 = "interface\hud\crosshair\Crosshair0"
Crosshair1 = "interface\hud\crosshair\Crosshair1"
Crosshair2 = "interface\hud\crosshair\Crosshair2"


this section is for the standard player crosshair that is on the hud regardless of what weapon is selected.

If I have to look through every texture i will, i even checked out the Mob Enforcer layout.txt & it's overlay section is identical to the CJ text. So, how did they make the scope crosshair in Mob Enforcer all black?


JLAR

User avatar
URA
More Advanced Member
More Advanced Member
Posts: 55
Joined: Sat Jan 28, 2006 10:19 pm
Contact:

Post by URA » Sat Apr 21, 2007 10:31 am

Hmm, not a texture, tinker with sourcecode you must ((3))

I think CHUDCrosshair::RenderScope() is what you want.
Spawn wrote:// ----------------------------------------------------------------------- //
//
// ROUTINE: CHUDCrosshair::RenderScope()
//
// PURPOSE: Draw the scope crosshair
//
// ----------------------------------------------------------------------- //
void CHUDCrosshair::RenderScope()
{
g_pDrawPrim->SetTexture(LTNULL);

g_pDrawPrim->SetRGBA(&m_Poly[2],argbBlack);

float cx = 320.0f * g_pInterfaceResMgr->GetXRatio();
float cy = 240.0f * g_pInterfaceResMgr->GetYRatio();

float hR = g_vtScopeLRRadius.GetFloat() * cx * 2.0f;
float hGap = g_vtScopeLRGap.GetFloat() * g_pInterfaceResMgr->GetXRatio();
float vR = g_vtScopeUDRadius.GetFloat() * cx * 2.0f;
float vGap = g_vtScopeUDGap.GetFloat() * g_pInterfaceResMgr->GetXRatio();


//left post
float x = cx - hR;
float y = cy - 2.0f;
g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,(hR-hGap),4.0f);
g_pDrawPrim->DrawPrim(&m_Poly[2],1);

//right post
x = cx + hGap;
g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,(hR-hGap),4.0f);
g_pDrawPrim->DrawPrim(&m_Poly[2],1);

//horizontal hair
x = cx - hGap;
y = cy - 1.0f;
g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,(hGap * 2.0f),2.0f);
g_pDrawPrim->DrawPrim(&m_Poly[2],1);



//top post
x = cx - 2.0f;
y = cy - vR;
g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,4.0f,(vR-vGap));
g_pDrawPrim->DrawPrim(&m_Poly[2],1);

//bottom post
y = cy + vGap;
g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,4.0f,(vR-vGap));
g_pDrawPrim->DrawPrim(&m_Poly[2],1);

//vertical hair
x = cx - 1.0f;
y = cy - vGap;
g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,2.0f,(vGap * 2.0f));
g_pDrawPrim->DrawPrim(&m_Poly[2],1);


uint32 gold = SET_ARGB(255,140,128,20);
g_pDrawPrim->SetRGBA(&m_Poly[2],gold);


//left highlight
x = cx - hR;
y = cy - 1.0f;
g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,(hR-hGap),2.0f);
g_pDrawPrim->DrawPrim(&m_Poly[2],1);

//right highlight
x = cx + vGap;
g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,(hR-hGap),2.0f);
g_pDrawPrim->DrawPrim(&m_Poly[2],1);

//top highlight
x = cx - 1.0f;
y = cy - vR;
g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,2.0f,(vR-vGap));
g_pDrawPrim->DrawPrim(&m_Poly[2],1);

//bottom highlight
y = cy + vGap;
g_pDrawPrim->SetXYWH(&m_Poly[2],x,y,2.0f,(vR-vGap));
g_pDrawPrim->DrawPrim(&m_Poly[2],1);


}
Setting:
uint32 gold = SET_ARGB(255,140,128,20);

to:
uint32 gold = SET_ARGB(255,0,0,0);

Should = black like in Mob Enforcer.

User avatar
Johnny LaRue
Advanced Member
Advanced Member
Posts: 33
Joined: Tue Jan 16, 2007 2:30 pm
Location: Oh Canada!
Contact:

Post by Johnny LaRue » Sun Apr 22, 2007 9:22 am

Hmm, not a texture, tinker with sourcecode you must 

I think CHUDCrosshair::RenderScope() is what you want.
I knew it! I was never a fan of the default yellow scope crosshair so it'll be cool to change it up!

Thanks URA! :D

Post Reply
jedwabna poszewka 50x60