Pt-br/Lowering your weapon on sprint: Difference between revisions
< Pt-br
		
		
		
		Jump to navigation
		Jump to search
		| m (Nesciuse moved page Lowering your weapon on sprint/pt-br to Pt-br/Lowering your weapon on sprint over redirect: Language prefixes) | m (Multipage removal) | ||
| Line 1: | Line 1: | ||
| {{LanguageBar|title = Abaixando sua arma enquanto correndo}} | |||
| {{Underlinked|date=January 2024}} | |||
| {{Dead end|date=January 2024}} | {{Dead end|date=January 2024}} | ||
| Este artigo fornece uma implementação básica de abaixamento de armas durante a corrida e prevenção de disparos de armas ao fazê-lo. | Este artigo fornece uma implementação básica de abaixamento de armas durante a corrida e prevenção de disparos de armas ao fazê-lo. | ||
| Line 88: | Line 90: | ||
| {{Uncategorized|date=January 2024}} | {{Uncategorized|date=January 2024}} | ||
| {{ACategory|Weapons programming}} | |||
| {{ACategory|Tutorials}} | |||
Latest revision as of 08:13, 12 July 2024

This article needs more  links to other articles to help
 links to other articles to help  integrate it into the encyclopedia. Please help improve this article by adding links
 integrate it into the encyclopedia. Please help improve this article by adding links  that are relevant to the context within the existing text.
 that are relevant to the context within the existing text.
January 2024
 links to other articles to help
 links to other articles to help  integrate it into the encyclopedia. Please help improve this article by adding links
 integrate it into the encyclopedia. Please help improve this article by adding links  that are relevant to the context within the existing text.
 that are relevant to the context within the existing text.January 2024

This article has no  links to other VDC articles. Please help improve this article by adding links
 links to other VDC articles. Please help improve this article by adding links  that are relevant to the context within the existing text.
 that are relevant to the context within the existing text. 
January 2024
 links to other VDC articles. Please help improve this article by adding links
 links to other VDC articles. Please help improve this article by adding links  that are relevant to the context within the existing text.
 that are relevant to the context within the existing text. January 2024
Este artigo fornece uma implementação básica de abaixamento de armas durante a corrida e prevenção de disparos de armas ao fazê-lo.
 Notar:Isso não funcionará se seu modelo de visualização não tiver animação ACT_VM_IDLE_LOWERED declarada em algum lugar do arquivo .qc.
Notar:Isso não funcionará se seu modelo de visualização não tiver animação ACT_VM_IDLE_LOWERED declarada em algum lugar do arquivo .qc. Notar:Se sua gun_yourweaponname.cpp estiver substituindo ItemPostFrame, você deverá colocar BaseClass::ProcessAnimationEvents(); no ItemPostFrame dessa classe, mas somente se você não estiver chamando BaseClass::ItemPostFrame();. Por exemplo, em arma_shotgun.cpp ele tem uma substituição de ItemPostFrame, o que significa que o código de redução da arma não será chamado para esta arma, a menos que você adicione uma chamada a ela! Lembre-se de colocar as declarações Basecombatweapon_Shared.h em públicas ou protegidas para que você possa fazer uso dessas variáveis em classes que herdam basecombatweapon_shared, como o ItemPostFrame do Weapon_shotgun.cpp. Se você não fizer isso, receberá erros de identificador não declarados
Notar:Se sua gun_yourweaponname.cpp estiver substituindo ItemPostFrame, você deverá colocar BaseClass::ProcessAnimationEvents(); no ItemPostFrame dessa classe, mas somente se você não estiver chamando BaseClass::ItemPostFrame();. Por exemplo, em arma_shotgun.cpp ele tem uma substituição de ItemPostFrame, o que significa que o código de redução da arma não será chamado para esta arma, a menos que você adicione uma chamada a ela! Lembre-se de colocar as declarações Basecombatweapon_Shared.h em públicas ou protegidas para que você possa fazer uso dessas variáveis em classes que herdam basecombatweapon_shared, como o ItemPostFrame do Weapon_shotgun.cpp. Se você não fizer isso, receberá erros de identificador não declaradosO Codigo
 Notar:This has been tested with HL2MP, 2013 and Alien Swarm SDKS.
Notar:This has been tested with HL2MP, 2013 and Alien Swarm SDKS.BASECOMBATWEAPON_SHARED.CPP
Aperta CRTL+F e procure para essa parte:
void CBaseCombatWeapon::ItemPostFrame( void )
Em seguida, copie e cole isto acima:
void CBaseCombatWeapon::ProcessAnimationEvents(void)
{
	CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
	if (!pOwner)
		return;
	if ( !m_bWeaponIsLowered && (pOwner->m_nButtons & IN_SPEED ) )
	{
		m_bWeaponIsLowered = true;
		SendWeaponAnim( ACT_VM_IDLE_LOWERED );
		m_flNextPrimaryAttack = gpGlobals->curtime + GetViewModelSequenceDuration();
	        m_flNextSecondaryAttack = m_flNextPrimaryAttack;
	}
	else if ( m_bWeaponIsLowered && !(pOwner->m_nButtons & IN_SPEED ) )
	{
		m_bWeaponIsLowered = false;
		SendWeaponAnim( ACT_VM_IDLE );
		m_flNextPrimaryAttack = gpGlobals->curtime + GetViewModelSequenceDuration();
 	        m_flNextSecondaryAttack = m_flNextPrimaryAttack;
	}
	if ( m_bWeaponIsLowered )
	{
		if ( gpGlobals->curtime > m_flNextPrimaryAttack )
		{
			SendWeaponAnim( ACT_VM_IDLE_LOWERED );
			m_flNextPrimaryAttack = gpGlobals->curtime + GetViewModelSequenceDuration();
			m_flNextSecondaryAttack = m_flNextPrimaryAttack;
		}
	}
}
Agora, para garantir que nosso código seja chamado, adicionamos ProcessAnimationEvents(); aqui:
void CBaseCombatWeapon::ItemPostFrame( void )
{
     //Adicione isso abaixo da verificação do acessador pOwner.
      ProcessAnimationEvents();
}
BASECOMBATWEAPON_SHARED.H
Adicione essas declarações em public na linha 211 abaixo bool IsViewModelSequenceFinished( void ); // Retorna se a animação atual do viewmodel foi finalizada:
 Notar:Tornamos ProcessAnimationEvents virtuais para que possamos substituí-lo em classes que herdam esta classe.
Notar:Tornamos ProcessAnimationEvents virtuais para que possamos substituí-lo em classes que herdam esta classe.	virtual void            ProcessAnimationEvents(void);
	bool                    m_bWeaponIsLowered;
Fim
Agora quando você correr sua arma deve abaixar!

This article has not been added to any content  categories. Please help out by
 categories. Please help out by  adding categories.
 adding categories. 
January 2024
 categories. Please help out by
 categories. Please help out by  adding categories.
 adding categories. January 2024


























