Gunz (Sniper) -> Real fix...

Status
Not open for further replies.
Newbie Spellweaver
Joined
Aug 10, 2011
Messages
77
Reaction score
133
Yeah about my old source... i accidently formated my drive that my gunz source was in when i was rebuilding my PC... **** happen i guess, well let's get to the point, I've somewhat found out that one of my friend shared this code whit someone here on RZ, so instead of having him brag about it, i will make it public.

Video:


ZCombatInterface.cpp Line:240
Bellow: bool IsMenuVisible() { return m_bMenuVisible; }
Add:
Code:
	bool bSniferMode() { return m_bSniferMode; }

ZCombatInterface.h Line: 122
Bellow: bool m_bMenuVisible;
Add:
Code:
	bool				m_bSniferMode;

ZCombatInterface.cpp Line: 1424
Above: void ZCombatInterface::Update(float fElapsed)
Add:
Code:
bool m_bSniferMode = false;

ZCombatInterface.cpp Line: 1545
Above: GameCheckPickCharacter();
Replace:
Code:
	if (pCharacter->GetItems()->GetSelectedWeaponParts() == MMCIP_MELEE) {
		ShowCrossHair(false);
	} else {
		ShowCrossHair(true);
	}
To:
Code:
	if ((pCharacter->GetItems()->GetSelectedWeaponParts() == MMCIP_MELEE) || (pSItem->GetDesc()->m_nWeaponType.Ref() == MWT_SNIFER) && (m_bSniferMode == false)){
		ShowCrossHair(false);
	} else {
		ShowCrossHair(true);
	}

ZCombatInterface.cpp Line: 3798
Replace:
Code:
void ZCombatInterface::OnGadget(MMatchWeaponType nWeaponType)
{
	if (m_pWeaponScreenEffect) m_pWeaponScreenEffect->OnGadget(nWeaponType);
	m_CrossHair.Show(false);
}
To:
Code:
void ZCombatInterface::OnGadget(MMatchWeaponType nWeaponType)
{
	m_bSniferMode = true;
	if (m_pWeaponScreenEffect) m_pWeaponScreenEffect->OnGadget(nWeaponType);
}

ZCombatInterface.cpp Line: 3804
Replace:
Code:
void ZCombatInterface::OnGadgetOff()
{
	if (m_pWeaponScreenEffect) m_pWeaponScreenEffect->OnGadgetOff();
	m_CrossHair.Show(true);
}
To:
Code:
void ZCombatInterface::OnGadgetOff()
{
	m_bSniferMode = false;
	if (m_pWeaponScreenEffect) m_pWeaponScreenEffect->OnGadgetOff();
}

ZGameInput.cpp Line: 538
Replace:
Code:
	case MWM_MOUSEWHEEL:
		{
			if ( ZGetGame()->IsReplay())
				break;

			int nDelta = pEvent->nDelta;

			if ( (ZGetMyInfo()->IsAdminGrade() && ZGetCombatInterface()->GetObserver()->IsVisible()) ||
				(ZGetGameInterface()->GetScreenDebugger()->IsVisible()) || 
				(!ZGetGameInterface()->m_bViewUI))
			{
				ZCamera* pCamera = ZGetGameInterface()->GetCamera();
				pCamera->m_fDist+=-(float)nDelta;
				pCamera->m_fDist=max(CAMERA_DIST_MIN,pCamera->m_fDist);
				pCamera->m_fDist=min(CAMERA_DIST_MAX,pCamera->m_fDist);
				break;
			}

//			if (nDelta > 0)	ZGetGameInterface()->ChangeWeapon(ZCWT_PREV);
//			else if (nDelta < 0) ZGetGameInterface()->ChangeWeapon(ZCWT_NEXT);
		}break;
To:
Code:
	case MWM_MOUSEWHEEL:
		{
			if (ZGetGame()->IsReplay())
				break;

			int nDelta = pEvent->nDelta;

			if ((ZGetGameInterface()->GetCombatInterface()->bSniferMode())){
				if(pEvent->nDelta<0){
				g_fFOV+=(05.0f / 180.0f * pi);
			    g_fFOV=max((10.0f / 180.0f * pi),g_fFOV);
				g_fFOV=min((60.0f / 180.0f * pi),g_fFOV);
				break;
				}else{
				g_fFOV-=(05.0f / 180.0f * pi);
				g_fFOV=max((10.0f / 180.0f * pi),g_fFOV);
				g_fFOV=min((60.0f / 180.0f * pi),g_fFOV);
				break;
				}
            break;
		    }else if ((ZGetGameInterface()->GetScreenDebugger()->IsVisible())){
				ZCamera* pCamera = ZGetGameInterface()->GetCamera();
				pCamera->m_fDist+=-(float)nDelta;
				pCamera->m_fDist=max(CAMERA_DIST_MIN,pCamera->m_fDist);
				pCamera->m_fDist=min(CAMERA_DIST_MAX,pCamera->m_fDist);
				break;
			}
		}break;

ZMyCharacter.cpp Line: 1448
Above: if (m_pVMesh)
Replace:
Code:
	// RangeŸÀÔÀÇ ¹«±âŸÀÔ¸¶´Ù °¢°¢ÀÇ GadgetÀ» ¼öÇàÇÑ´Ù
	if (ZIsActionKeyPressed(ZACTION_USE_WEAPON2))
	{
		ZItem* pSelectedItem = GetItems()->GetSelectedWeapon();
		if (pSelectedItem)
		{
			if(pSelectedItem->GetDesc()) {

				switch (pSelectedItem->GetDesc()->m_nWeaponType.Ref())
				{
				case MWT_SNIFER:
					{
						OnGadget_Snifer();
					}
					break;
				}

			}
		}
	}
To:
Code:
	// RangeŸÀÔÀÇ ¹«±âŸÀÔ¸¶´Ù °¢°¢ÀÇ GadgetÀ» ¼öÇàÇÑ´Ù
	if( zStatus.m_bRButtonFirstPressed && ZIsActionKeyPressed(ZACTION_USE_WEAPON2)) {
		MMatchWeaponType type = MWT_NONE;

		ZItem* pSItem = GetItems()->GetSelectedWeapon();

		if(pSItem && pSItem->GetDesc())
			type = pSItem->GetDesc()->m_nWeaponType.Ref();
		switch(type){
			case MWT_SNIFER :
			zStatus.m_bSniferMode = !zStatus.m_bSniferMode;
			ZCombatInterface* ci=ZGetCombatInterface();
		if (zStatus.m_bSniferMode){
			ci->OnGadget(MWT_SNIFER);
		}else{
			ci->OnGadgetOff();
		}
		break;
	}
 }

ZWeaponScreenEffect.cpp Line:66
Remove: return;
Code:
Should look like this:
void ZWeaponScreenEffect::OnGadget(MMatchWeaponType nWeaponType)
{
	if (m_nWeaponType == nWeaponType) return;
	if (m_nWeaponType != MWT_NONE) OnGadgetOff();

	InitWeapon(nWeaponType);
	m_nWeaponType = nWeaponType;
}

ZWeaponScreenEffect.cpp Line:77
Remove: return;
Code:
Should look like this:
void ZWeaponScreenEffect::OnGadgetOff()
{
	FinalWeapon(m_nWeaponType);
	m_nWeaponType = MWT_NONE;
}

ZWeaponScreenEffect.cpp Line:73
Replace:
Code:
((MBitmapR2*)m_pSniferPanel)->Create("snifer.png", RGetDevice(), "interface/Default/Combat/snifer.png");
To
Code:
((MBitmapR2*)m_pSniferPanel)->Create("sniperscope.png", RGetDevice(), "Custom/Crosshair/sniperscope.png");

Sniperscope:
snipersco - Gunz (Sniper) -> Real fix... - RaGEZONE Forums

Note: This is maybe a comeback, maybe a farewell, who actually know...
 
Last edited:
Yeah about my old source... i accidently formated my drive that my gunz source was in when i was rebuilding my PC... **** happen i guess, well let's get to the point, I've somewhat found out that one of my friend shared this code whit someone here on RZ, so instead of having him brag about it, i will make it public.

Video:


ZCombatInterface.cpp Line:240
Bellow: bool IsMenuVisible() { return m_bMenuVisible; }
Add:
Code:
	bool bSniferMode() { return m_bSniferMode; }

ZCombatInterface.h Line: 122
Bellow: bool m_bMenuVisible;
Add:
Code:
	bool				m_bSniferMode;

ZCombatInterface.cpp Line: 1424
Above: void ZCombatInterface::Update(float fElapsed)
Add:
Code:
bool m_bSniferMode = false;

ZCombatInterface.cpp Line: 1545
Above: GameCheckPickCharacter();
Replace:
Code:
	if (pCharacter->GetItems()->GetSelectedWeaponParts() == MMCIP_MELEE) {
		ShowCrossHair(false);
	} else {
		ShowCrossHair(true);
	}
To:
Code:
	if ((pCharacter->GetItems()->GetSelectedWeaponParts() == MMCIP_MELEE) || (pSItem->GetDesc()->m_nWeaponType.Ref() == MWT_SNIFER) && (m_bSniferMode == false)){
		ShowCrossHair(false);
	} else {
		ShowCrossHair(true);
	}

ZCombatInterface.cpp Line: 3798
Replace:
Code:
void ZCombatInterface::OnGadget(MMatchWeaponType nWeaponType)
{
	if (m_pWeaponScreenEffect) m_pWeaponScreenEffect->OnGadget(nWeaponType);
	m_CrossHair.Show(false);
}
To:
Code:
void ZCombatInterface::OnGadget(MMatchWeaponType nWeaponType)
{
	m_bSniferMode = true;
	if (m_pWeaponScreenEffect) m_pWeaponScreenEffect->OnGadget(nWeaponType);
}

ZCombatInterface.cpp Line: 3804
Replace:
Code:
void ZCombatInterface::OnGadgetOff()
{
	if (m_pWeaponScreenEffect) m_pWeaponScreenEffect->OnGadgetOff();
	m_CrossHair.Show(true);
}
To:
Code:
void ZCombatInterface::OnGadgetOff()
{
	m_bSniferMode = false;
	if (m_pWeaponScreenEffect) m_pWeaponScreenEffect->OnGadgetOff();
}

ZGameInput.cpp Line: 538
Replace:
Code:
	case MWM_MOUSEWHEEL:
		{
			if ( ZGetGame()->IsReplay())
				break;

			int nDelta = pEvent->nDelta;

			if ( (ZGetMyInfo()->IsAdminGrade() && ZGetCombatInterface()->GetObserver()->IsVisible()) ||
				(ZGetGameInterface()->GetScreenDebugger()->IsVisible()) || 
				(!ZGetGameInterface()->m_bViewUI))
			{
				ZCamera* pCamera = ZGetGameInterface()->GetCamera();
				pCamera->m_fDist+=-(float)nDelta;
				pCamera->m_fDist=max(CAMERA_DIST_MIN,pCamera->m_fDist);
				pCamera->m_fDist=min(CAMERA_DIST_MAX,pCamera->m_fDist);
				break;
			}

//			if (nDelta > 0)	ZGetGameInterface()->ChangeWeapon(ZCWT_PREV);
//			else if (nDelta < 0) ZGetGameInterface()->ChangeWeapon(ZCWT_NEXT);
		}break;
To:
Code:
	case MWM_MOUSEWHEEL:
		{
			if (ZGetGame()->IsReplay())
				break;

			int nDelta = pEvent->nDelta;

			if ((ZGetGameInterface()->GetCombatInterface()->bSniferMode())){
				if(pEvent->nDelta<0){
				g_fFOV+=(05.0f / 180.0f * pi);
			    g_fFOV=max((10.0f / 180.0f * pi),g_fFOV);
				g_fFOV=min((60.0f / 180.0f * pi),g_fFOV);
				break;
				}else{
				g_fFOV-=(05.0f / 180.0f * pi);
				g_fFOV=max((10.0f / 180.0f * pi),g_fFOV);
				g_fFOV=min((60.0f / 180.0f * pi),g_fFOV);
				break;
				}
            break;
		    }else if ((ZGetGameInterface()->GetScreenDebugger()->IsVisible())){
				ZCamera* pCamera = ZGetGameInterface()->GetCamera();
				pCamera->m_fDist+=-(float)nDelta;
				pCamera->m_fDist=max(CAMERA_DIST_MIN,pCamera->m_fDist);
				pCamera->m_fDist=min(CAMERA_DIST_MAX,pCamera->m_fDist);
				break;
			}
		}break;

ZMyCharacter.cpp Line: 1448
Above: if (m_pVMesh)
Replace:
Code:
	// RangeŸÀÔÀÇ ¹«±âŸÀÔ¸¶´Ù °¢°¢ÀÇ GadgetÀ» ¼öÇàÇÑ´Ù
	if (ZIsActionKeyPressed(ZACTION_USE_WEAPON2))
	{
		ZItem* pSelectedItem = GetItems()->GetSelectedWeapon();
		if (pSelectedItem)
		{
			if(pSelectedItem->GetDesc()) {

				switch (pSelectedItem->GetDesc()->m_nWeaponType.Ref())
				{
				case MWT_SNIFER:
					{
						OnGadget_Snifer();
					}
					break;
				}

			}
		}
	}
To:
Code:
	// RangeŸÀÔÀÇ ¹«±âŸÀÔ¸¶´Ù °¢°¢ÀÇ GadgetÀ» ¼öÇàÇÑ´Ù
	if( zStatus.m_bRButtonFirstPressed && ZIsActionKeyPressed(ZACTION_USE_WEAPON2)) {
		MMatchWeaponType type = MWT_NONE;

		ZItem* pSItem = GetItems()->GetSelectedWeapon();

		if(pSItem && pSItem->GetDesc())
			type = pSItem->GetDesc()->m_nWeaponType.Ref();
		switch(type){
			case MWT_SNIFER :
			zStatus.m_bSniferMode = !zStatus.m_bSniferMode;
			ZCombatInterface* ci=ZGetCombatInterface();
		if (zStatus.m_bSniferMode){
			ci->OnGadget(MWT_SNIFER);
		}else{
			ci->OnGadgetOff();
		}
		break;
	}
 }

ZWeaponScreenEffect.cpp Line:66
Remove: return;
Code:
Should look like this:
void ZWeaponScreenEffect::OnGadget(MMatchWeaponType nWeaponType)
{
	if (m_nWeaponType == nWeaponType) return;
	if (m_nWeaponType != MWT_NONE) OnGadgetOff();

	InitWeapon(nWeaponType);
	m_nWeaponType = nWeaponType;
}

ZWeaponScreenEffect.cpp Line:77
Remove: return;
Code:
Should look like this:
void ZWeaponScreenEffect::OnGadgetOff()
{
	FinalWeapon(m_nWeaponType);
	m_nWeaponType = MWT_NONE;
}

ZWeaponScreenEffect.cpp Line:73
Replace:
Code:
((MBitmapR2*)m_pSniferPanel)->Create("snifer.png", RGetDevice(), "interface/Default/Combat/snifer.png");
To
Code:
((MBitmapR2*)m_pSniferPanel)->Create("sniperscope.png", RGetDevice(), "Custom/Crosshair/sniperscope.png");

Sniperscope:
View attachment 141365

Note: This is maybe a comeback, maybe a farewell, who actually know...


i liked the part of hiding the cross hair but i already fixed the bug of it before
 
This fix also removes the gun by changing mouse scroll? fix because they are over there when one puts one uses the scroll and the camera moves the Player does more weapon change is usually ...

The joke is that being in increase and decrease the zoom zoom of the sniper, and when one player with shotgun or other weapon can change the scroll, that's my question, if not for that place if you like the others. ..

Please clarify my doubts about this release.!
 
For the last thing, make it zoom when you click right button (or the button used) till the weapon and then show the crosshair.

You see the green dot in the middle of the scope in the video? that's my crosshair lol.
And... it already does that... but if you want it already zoomed just change the value of g_fFOV manually.

Very nice. I don't really like the zoom in and out because then I cant quick scope n that properly because the Mousewheel is being used by the Zoom function.

Nice release!

It's actually bind himself on mousewhell only if it is in zoom mode, but if you don't want it, just don't apply the mousewhell part.
Or take note of the code that is actually in this part, and create a new input in your option files, so you will be able to decide the btn to zoom-in/zoom-out.

You get my LIKE! bravo bro.. Can you release too? when you shot the sniper in zoom mode it will move-up like real sniper when you shoot it. :)
(Ctrl+F) _RECOIL, This is already coded into the source but i never tryed it, it is maybe unfinished as well.

This fix also removes the gun by changing mouse scroll? fix because they are over there when one puts one uses the scroll and the camera moves the Player does more weapon change is usually ...

The joke is that being in increase and decrease the zoom zoom of the sniper, and when one player with shotgun or other weapon can change the scroll, that's my question, if not for that place if you like the others. ..

Please clarify my doubts about this release.!

Only when the sniper is in zoom-mode.
If you aren't in zoom-mode you will be able to use the mousescroll to quick-switch your weapons.
 
Last edited:
You see the green dot in the middle of the scope in the video? that's my crosshair lol.
And... it already does that... but if you want it already zoomed just change the value of g_fFOV manually.

You don't get it.

I mean an animation from default zoom to zoomed in, when it hits just before the zoomed in value, show crosshair pic (the sniper crosshair)
 
Status
Not open for further replies.
Back