I followed this tutorial on the old forum:
https://www.cryengine.com/community_arc ... 91&t=28560
to add the zoom on goc mod of crysis 1 with succes, I am looking for a person who can help me to fix the position of weapon accesories change in the hud to the thirdperson!
I followed this tutorial, I miss a function in the hud.cpp to fix !
thank you
look here:
https://www.youtube.com/watch?v=juJtFdrCpX0
end here:
https://www.youtube.com/watch?v=OR_Gx5qcGxQ
Re: help me to finish zoom in goc tird person view on crysis 1 to fix the weapon offsets
#2is the function in hud.cpp:
CWeapon *pCurrentWeapon = GetCurrentWeapon();
if(pCurrentWeapon && pCurrentWeapon->IsModifying())
{
IGameTokenSystem *pGameTokenSystem = gEnv->pGame->GetIGameFramework()->GetIGameTokenSystem();
char tempBuf[HUD_MAX_STRING_SIZE];
const CItem::THelperVector& helpers = pCurrentWeapon->GetAttachmentHelpers();
for (int i = 0; i < helpers.size(); i++)
{
CItem::SAttachmentHelper helper = helpers;
//NEW STUFF if (helper.slot != CItem::eIGS_FirstPerson&& helper.slot != CItem::eIGS_ThirdPerson) //NEW STUFF!!!!
continue;
Vec3 vWorldPos = pCurrentWeapon->GetSlotHelperPos(CItem::eIGS_FirstPerson, helper.bone,true);
Vec3 vScreenSpace;
m_pRenderer->ProjectToScreen(vWorldPos.x,vWorldPos.y,vWorldPos.z,&vScreenSpace.x,&vScreenSpace.y,&vScreenSpace.z);
float fScaleX = 0.0f;
float fScaleY = 0.0f;
float fHalfUselessSize = 0.0f;
GetProjectionScale(&m_animWeaponAccessories,&fScaleX,&fScaleY,&fHalfUselessSize);
vScreenSpace.x = vScreenSpace.x * fScaleX + fHalfUselessSize;
vScreenSpace.y = vScreenSpace.y * fScaleY;
AdjustWeaponAccessory(pCurrentWeapon->GetEntity()->GetClass()->GetName(),helper.name,&vScreenSpace);
_snprintf(tempBuf, sizeof(tempBuf), "hud.WS%sX", helper.name.c_str());
tempBuf[sizeof(tempBuf)-1] = '\0';
pGameTokenSystem->SetOrCreateToken(tempBuf,TFlowInputData(vScreenSpace.x,true));
_snprintf(tempBuf, sizeof(tempBuf), "hud.WS%sY", helper.name.c_str());
tempBuf[sizeof(tempBuf)-1] = '\0';
pGameTokenSystem->SetOrCreateToken(tempBuf,TFlowInputData(vScreenSpace.y,true));
}
}
I change the line if (helper.slot != CItem::eIGS_FirstPerson) to
if (helper.slot != CItem::eIGS_FirstPerson && helper.slot != CItem::eIGS_ThirdPerson)
Technically, weapons are supposed to be defined based on whether their first person or third person, but some of the third person weapons are set to the first person slot.
The other suspect is AdjustWeaponAccessory. I nedd a function for handling the offsets???
you need to read the first post on the old forum, the problem is that the angle of the camera in third person or after the zoom does not have the same position as the first person
tank you
CWeapon *pCurrentWeapon = GetCurrentWeapon();
if(pCurrentWeapon && pCurrentWeapon->IsModifying())
{
IGameTokenSystem *pGameTokenSystem = gEnv->pGame->GetIGameFramework()->GetIGameTokenSystem();
char tempBuf[HUD_MAX_STRING_SIZE];
const CItem::THelperVector& helpers = pCurrentWeapon->GetAttachmentHelpers();
for (int i = 0; i < helpers.size(); i++)
{
CItem::SAttachmentHelper helper = helpers;
//NEW STUFF if (helper.slot != CItem::eIGS_FirstPerson&& helper.slot != CItem::eIGS_ThirdPerson) //NEW STUFF!!!!
continue;
Vec3 vWorldPos = pCurrentWeapon->GetSlotHelperPos(CItem::eIGS_FirstPerson, helper.bone,true);
Vec3 vScreenSpace;
m_pRenderer->ProjectToScreen(vWorldPos.x,vWorldPos.y,vWorldPos.z,&vScreenSpace.x,&vScreenSpace.y,&vScreenSpace.z);
float fScaleX = 0.0f;
float fScaleY = 0.0f;
float fHalfUselessSize = 0.0f;
GetProjectionScale(&m_animWeaponAccessories,&fScaleX,&fScaleY,&fHalfUselessSize);
vScreenSpace.x = vScreenSpace.x * fScaleX + fHalfUselessSize;
vScreenSpace.y = vScreenSpace.y * fScaleY;
AdjustWeaponAccessory(pCurrentWeapon->GetEntity()->GetClass()->GetName(),helper.name,&vScreenSpace);
_snprintf(tempBuf, sizeof(tempBuf), "hud.WS%sX", helper.name.c_str());
tempBuf[sizeof(tempBuf)-1] = '\0';
pGameTokenSystem->SetOrCreateToken(tempBuf,TFlowInputData(vScreenSpace.x,true));
_snprintf(tempBuf, sizeof(tempBuf), "hud.WS%sY", helper.name.c_str());
tempBuf[sizeof(tempBuf)-1] = '\0';
pGameTokenSystem->SetOrCreateToken(tempBuf,TFlowInputData(vScreenSpace.y,true));
}
}
I change the line if (helper.slot != CItem::eIGS_FirstPerson) to
if (helper.slot != CItem::eIGS_FirstPerson && helper.slot != CItem::eIGS_ThirdPerson)
Technically, weapons are supposed to be defined based on whether their first person or third person, but some of the third person weapons are set to the first person slot.
The other suspect is AdjustWeaponAccessory. I nedd a function for handling the offsets???
you need to read the first post on the old forum, the problem is that the angle of the camera in third person or after the zoom does not have the same position as the first person
tank you
Re: help me to finish zoom in goc tird person view on crysis 1 to fix the weapon offsets
#3I found the lines changed to show the weapon hub position to the third person same as the first person:
change:
Vec3 vWorldPos = pCurrentWeapon-> GetSlotHelperPos (CItem :: eIGS_FirstPerson, helper.bone, true);
by
Vec3 vWorldPos = pCurrentWeapon-> GetSlotHelperPos (CItem :: eIGS_ThirdPerson, helper.bone, true);
and add
vScreenSpace.z = 1;
with these changes the weapon hub is displayed to the third person correctly but has the first person, I can not modify the code so that it appears correctly in the firt person and the third person at the same time!
the problem is that I have to modify the code to make the difference between the first and the last person
my knowledge is limited in c ++, can someone help me?
thank you
change:
Vec3 vWorldPos = pCurrentWeapon-> GetSlotHelperPos (CItem :: eIGS_FirstPerson, helper.bone, true);
by
Vec3 vWorldPos = pCurrentWeapon-> GetSlotHelperPos (CItem :: eIGS_ThirdPerson, helper.bone, true);
and add
vScreenSpace.z = 1;
with these changes the weapon hub is displayed to the third person correctly but has the first person, I can not modify the code so that it appears correctly in the firt person and the third person at the same time!
the problem is that I have to modify the code to make the difference between the first and the last person
my knowledge is limited in c ++, can someone help me?
thank you
Re: help me to finish zoom in goc tird person view on crysis 1 to fix the weapon offsets
#4I tried:
if (helper.slot! = CItem :: eIGS_ThirdPerson)
Vec3 vWorldPos = pCurrentWeapon-> GetSlotHelperPos (CItem :: eIGS_ThirdPerson, helper.bone, true);
vScreenSpace.z = 1;
but it does not work, a little help to write the code with the right syntax, and in the right place, I think it's pretty easy for you here?
I know I am a noob!
thank you
if (helper.slot! = CItem :: eIGS_ThirdPerson)
Vec3 vWorldPos = pCurrentWeapon-> GetSlotHelperPos (CItem :: eIGS_ThirdPerson, helper.bone, true);
vScreenSpace.z = 1;
but it does not work, a little help to write the code with the right syntax, and in the right place, I think it's pretty easy for you here?
I know I am a noob!
thank you