コード例 #1
0
ファイル: Weapon.cpp プロジェクト: AntonioModer/xray-16
void CWeapon::OnEvent(NET_Packet& P, u16 type) 
{
	switch (type)
	{
	case GE_ADDON_CHANGE:
		{
			P.r_u8					(m_flagsAddOnState);
			InitAddons();
			UpdateAddonsVisibility();
		}break;

	case GE_WPN_STATE_CHANGE:
		{
			u8				state;
			P.r_u8			(state);
			P.r_u8			(m_sub_state);		
//			u8 NewAmmoType = 
				P.r_u8();
			u8 AmmoElapsed = P.r_u8();
			u8 NextAmmo = P.r_u8();
			if (NextAmmo == undefined_ammo_type)
				m_set_next_ammoType_on_reload = undefined_ammo_type;
			else
				m_set_next_ammoType_on_reload = NextAmmo;

			if (OnClient()) SetAmmoElapsed(int(AmmoElapsed));			
			OnStateSwitch	(u32(state));
		}
		break;
	default:
		{
			inherited::OnEvent(P,type);
		}break;
	}
};
コード例 #2
0
ファイル: CustomZone.cpp プロジェクト: AntonioModer/xray-16
void	CCustomZone::OnEvent (NET_Packet& P, u16 type)
{	
	switch (type)
	{
		case GE_ZONE_STATE_CHANGE:
			{
				u8				S;
				P.r_u8			(S);
				OnStateSwitch	(EZoneState(S));
				break;
			}
	}
	inherited::OnEvent(P, type);
};
コード例 #3
0
ファイル: GameState.cpp プロジェクト: RickDork/2149
void CGameState::Think()
{
    
    if( !m_pGameContext->IsMissionOver() ) {

        m_pGameContext->GameLogic();

        if( !m_pGameContext->IsGameFrozen() ) {
            
            m_pPlayerEntity = m_pGameContext->GetPlayerEntity();
            
            if( m_pPlayerEntity ) {
                
                if( m_pGameContext->PlayerInputEnabled() && m_pPlayerEntity->CanShoot() && m_pGameContext->GetCurrentEnemyCount() > 0 )
                {
                    
                    if( m_pGameContext->HasUpgrade( 8 ) ) {
                    
                        m_pGameContext->FireBulletFromGunAtAngle( 0, ENTTYPE_PLYBULLET, m_pPlayerEntity, 500.0f,  135.0f );
                        m_pGameContext->FireBulletFromGunAtAngle( 1, ENTTYPE_PLYBULLET, m_pPlayerEntity, 500.0f,  45.0f );
                        
                        m_pGameContext->FireBulletFromGunAtAngle( 0, ENTTYPE_PLYBULLET, m_pPlayerEntity, 500.0f,  180.0f );
                        m_pGameContext->FireBulletFromGunAtAngle( 1, ENTTYPE_PLYBULLET, m_pPlayerEntity, 500.0f,  0.0f );
                        
                        m_pGameContext->FireBulletFromGunAtAngle( 0, ENTTYPE_PLYBULLET, m_pPlayerEntity, 500.0f,  -135.0f );
                        m_pGameContext->FireBulletFromGunAtAngle( 1, ENTTYPE_PLYBULLET, m_pPlayerEntity, 500.0f,  -45.0f );
                        
                        m_pGameContext->FireBulletFromGunAtAngle( 0, ENTTYPE_PLYBULLET, m_pPlayerEntity, 500.0f,  270.0f );
                        m_pGameContext->FireBulletFromGunAtAngle( 1, ENTTYPE_PLYBULLET, m_pPlayerEntity, 500.0f,  270.0f );
                        
                    } else if( m_pGameContext->HasUpgrade( 3 ) ) {
                        
                        m_pGameContext->FireBulletFromGunAtAngle( 0, ENTTYPE_PLYBULLET, m_pPlayerEntity, 500.0f,  135.0f );
                        m_pGameContext->FireBulletFromGunAtAngle( 1, ENTTYPE_PLYBULLET, m_pPlayerEntity, 500.0f,  45.0f );
                        
                    }
                    
                    m_pGameContext->FireBulletFrom( ENTTYPE_PLYBULLET, m_pPlayerEntity, 300.0f );
                    
                    float speedmul = 1.0f;
                    
                    if( m_pGameContext->HasUpgrade( 9 ) )
                        speedmul = .5f;
                    
                    m_pPlayerEntity->SetNextShotTime( SDL_GetTicks() + 200.0f * speedmul );
                    
                }

            }
            
        }
        
    } else {
        
        if( m_pGameContext->GetCurrentMission() == 4 ) {
            
            OnStateSwitch();
            
        } else
            SwitchToAnotherState( "UPGRADESELECT" );
        
    }
    
    if( m_pGameContext->IsGameEnded() )
        m_bContinue = false;
    
}
コード例 #4
0
ファイル: Grenade.cpp プロジェクト: AntonioModer/xray-16
void CGrenade::DiscardState()
{
	if(IsGameTypeSingle() && (GetState()==eReady || GetState()==eThrow) )
		OnStateSwitch(eIdle);
}