• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Msg函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Msg函数的典型用法代码示例。如果您正苦于以下问题:C++ Msg函数的具体用法?C++ Msg怎么用?C++ Msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Msg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: VLine

int EBuffer::GetMatchBrace(EPoint &M, int MinLine, int MaxLine, int show) {
    int StateLen;
    hsState *StateMap = 0;
    int Pos;
    PELine L = VLine(M.Row);
    int dir = 0;
    hsState State;
    char Ch1, Ch2;
    int CountX = 0;
    int StateRow = -1;

    M.Row = VToR(CP.Row);

    Pos = CharOffset(L, M.Col);
    if (Pos >= L->Count) return 0;
    switch (L->Chars[Pos]) {
    case '{':
        dir = + 1;
        Ch1 = '{';
        Ch2 = '}';
        break;
    case '[':
        dir = + 1;
        Ch1 = '[';
        Ch2 = ']';
        break;
    case '<':
        dir = + 1;
        Ch1 = '<';
        Ch2 = '>';
        break;
    case '(':
        dir = + 1;
        Ch1 = '(';
        Ch2 = ')';
        break;
    case '}':
        dir = -1;
        Ch1 = '}';
        Ch2 = '{';
        break;
    case ']':
        dir = -1;
        Ch1 = ']';
        Ch2 = '[';
        break;
    case '>':
        dir = -1;
        Ch1 = '>';
        Ch2 = '<';
        break;
    case ')':
        dir = -1;
        Ch1 = ')';
        Ch2 = '(';
        break;
    default:
        return 0;
    }
    StateMap = 0;
    if (GetMap(M.Row, &StateLen, &StateMap) == 0) return 0;
    State = StateMap[Pos];
    StateRow = M.Row;

    while (M.Row >= MinLine && M.Row < MaxLine) {
        while (Pos >= 0 && Pos < L->Count) {
            if (L->Chars[Pos] == Ch1 || L->Chars[Pos] == Ch2) {
                // update syntax state if needed
                if (StateRow != M.Row) {
                    free(StateMap);
                    StateMap = 0;
                    GetMap(M.Row, &StateLen, &StateMap);
                    if (StateMap == 0) return 0;
                    StateRow = M.Row;
                }
                if (StateMap[Pos] == State) {
                    if (L->Chars[Pos] == Ch1) CountX++;
                    if (L->Chars[Pos] == Ch2) CountX--;
                    if (CountX == 0) {
                        M.Col = ScreenPos(L, Pos);
                        free(StateMap);
                        return 1;
                    }
                }
            }
            Pos += dir;
        }
        M.Row += dir;
        if (M.Row >= 0 && M.Row < RCount) {
            L = RLine(M.Row);
            Pos = (dir == 1) ? 0 : (L->Count - 1);
        }
    }
    if (StateMap) free(StateMap);
    if (show)
        Msg(S_INFO, "No match (%d missing).", CountX);
    return 0;
}
开发者ID:AaronDP,项目名称:efte_adbshell,代码行数:98,代码来源:e_search.cpp


示例2: ResponseCurveLookAccelerated

static float ResponseCurveLookAccelerated( float x, int axis, float otherAxis, float dist, float frametime )
{
	float input = x;

	float flJoyDist = ( sqrt(x*x + otherAxis * otherAxis) );
	bool bIsPegged = ( flJoyDist>= joy_pegged.GetFloat() );

	// Make X positive to make arithmetic easier for the rest of this function, and
	// remember whether we have to flip it back!
	bool negative = false;
	if( x < 0.0f )
	{
		negative = true;
		x *= -1;
	}

	// Perform the two-stage mapping.
	bool bDoAcceleration = false;// Assume we won't accelerate the input

	if( bIsPegged && x > joy_accel_filter.GetFloat() )
	{
		// Accelerate this axis, since the stick is pegged and 
		// this axis is pressed farther than the acceleration filter
		// Take the lowmap value, or the input, whichever is higher, since 
		// we don't necesarily know whether this is the axis which is pegged
		x = MAX( joy_lowmap.GetFloat(), x );
		bDoAcceleration = true;
	}
	else
	{
		// Joystick is languishing in the low-end, turn off acceleration.
		controlEnvelope.envelopeScale[axis] = 0.0f;
		float factor = x / joy_lowend.GetFloat();
		x = joy_lowmap.GetFloat() * factor;
	}

	if( bDoAcceleration )
	{
		float flMax = joy_accelmax.GetFloat();
		if( controlEnvelope.envelopeScale[axis] < flMax )
		{
			float delta = x - joy_lowmap.GetFloat();
			x = joy_lowmap.GetFloat() + (delta * controlEnvelope.envelopeScale[axis]);
			controlEnvelope.envelopeScale[axis] += ( frametime * joy_accelscale.GetFloat() );

			if( controlEnvelope.envelopeScale[axis] > flMax )
			{
				controlEnvelope.envelopeScale[axis] = flMax;
			}
		}
	}

	x *= AutoAimDampening( input, axis, dist );

	if( axis == YAW && input != 0.0f && joy_display_input.GetBool() )
	{
		Msg("In:%f Out:%f Frametime:%f\n", input, x, frametime );
	}

	if( negative )
	{
		x *= -1;
	}

	return x;
}
开发者ID:EspyEspurr,项目名称:game,代码行数:66,代码来源:in_joystick.cpp


示例3: OnMCFCreateComplete

	void OnMCFCreateComplete(gcString &strPath)
	{
		Msg("Completed creating Mcf.\n");
		g_strMcfOutPath = strPath;
		g_WaitCon.notify();
	}
开发者ID:CSRedRat,项目名称:desura-app,代码行数:6,代码来源:UploadMCF.cpp


示例4: InitializeWindowlessVMR

HRESULT InitializeWindowlessVMR(IBaseFilter **ppVmr9)
{
    IBaseFilter* pVmr = NULL;

    if (!ppVmr9)
        return E_POINTER;
    *ppVmr9 = NULL;

    // Create the VMR and add it to the filter graph.
    HRESULT hr = CoCreateInstance(CLSID_VideoMixingRenderer9, NULL,
                     CLSCTX_INPROC, IID_IBaseFilter, (void**)&pVmr);
    if (SUCCEEDED(hr)) 
    {
        hr = pGB->AddFilter(pVmr, L"Video Mixing Renderer 9");
        if (SUCCEEDED(hr)) 
        {
            // Set the rendering mode and number of streams
            SmartPtr <IVMRFilterConfig9> pConfig;

            JIF(pVmr->QueryInterface(IID_IVMRFilterConfig9, (void**)&pConfig));
            JIF(pConfig->SetRenderingMode(VMR9Mode_Windowless));

            hr = pVmr->QueryInterface(IID_IVMRWindowlessControl9, (void**)&pWC);
            if( SUCCEEDED(hr)) 
            {
                hr = pWC->SetVideoClippingWindow(ghApp);
                hr = pWC->SetBorderColor(RGB(0,0,0));
            }

#ifndef BILINEAR_FILTERING
            // Request point filtering (instead of bilinear filtering)
            // to improve the text quality.  In general, if you are 
            // not scaling the app Image, you should use point filtering.
            // This is very important if you are doing source color keying.
            IVMRMixerControl9 *pMix;

            hr = pVmr->QueryInterface(IID_IVMRMixerControl9, (void**)&pMix);
            if( SUCCEEDED(hr)) 
            {
                DWORD dwPrefs=0;
                hr = pMix->GetMixingPrefs(&dwPrefs);

                if (SUCCEEDED(hr))
                {
                    dwPrefs |= MixerPref_PointFiltering;
                    dwPrefs &= ~(MixerPref_BiLinearFiltering);

                    hr = pMix->SetMixingPrefs(dwPrefs);
                }
                pMix->Release();
            }
#endif

            // Get alpha-blended bitmap interface
            hr = pVmr->QueryInterface(IID_IVMRMixerBitmap9, (void**)&pBMP);
        }
        else
            Msg(TEXT("Failed to add VMR to graph!  hr=0x%x\r\n"), hr);

        // Don't release the pVmr interface because we are copying it into
        // the caller's ppVmr9 pointer
        *ppVmr9 = pVmr;
    }
    else
        Msg(TEXT("Failed to create VMR!  hr=0x%x\r\n"), hr);

   return hr;
}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:68,代码来源:ticker.cpp


示例5: ToePosition

bool CIKFoot::GetFootStepMatrix( ik_goal_matrix &m, const Fmatrix &g_anim, const  SIKCollideData &cld, bool collide, bool rotation, bool b_make_shift/*=true*/ )const
{
	const Fmatrix global_anim = g_anim;
	Fvector	local_point;		ToePosition( local_point );													//toe position in bone[2] space
	Fvector	global_point;		global_anim.transform_tiny( global_point, local_point );						//non collided toe in global space
	Fvector foot_normal;		FootNormal( foot_normal );
	global_anim.transform_dir( foot_normal );
#ifdef DEBUG
		//if( ph_dbg_draw_mask.test( phDbgDrawIKGoal ) )
		//{
		//	DBG_DrawLine( global_point, Fvector().add( global_point, foot_normal ), D3DCOLOR_XRGB( 0, 255, 255) );
		//}
#endif
	if( cld.m_collide_point == ik_foot_geom::heel || cld.m_collide_point == ik_foot_geom::side )
	{
		Fmatrix foot;ref_bone_to_foot( foot, g_anim );
		Fvector heel;
		HeelPosition( heel );
		foot.transform_tiny(global_point, heel );
#ifdef DEBUG
		if( ph_dbg_draw_mask.test( phDbgDrawIKGoal ) )
			DBG_DrawPoint( global_point, 0.01, D3DCOLOR_XRGB( 0, 255, 255));
#endif
		Fmatrix foot_to_ref;
		ref_bone_to_foot_transform(foot_to_ref).transform_tiny(local_point, heel );
	}

	float	dtoe_tri		=-cld.m_plane.d - cld.m_plane.n.dotproduct( global_point );	
	if(  !cld.collided ||  _abs( dtoe_tri ) > collide_dist )
	{
		m.set( global_anim, ik_goal_matrix::cl_free );
		return false;
	}

	Fplane p = cld.m_plane;
	Fmatrix xm; xm.set( global_anim );
	ik_goal_matrix::e_collide_state cl_state = ik_goal_matrix::cl_undefined;
	if( rotation )//!collide || ik_allign_free_foot
		cl_state = rotate( xm, p, foot_normal, global_point, collide );

	if( b_make_shift && make_shift( xm, local_point, collide, p, cld.m_pick_dir ) )
		switch( cl_state )
		{
			case ik_goal_matrix::cl_aligned		:					break;
			case ik_goal_matrix::cl_undefined	:
			case ik_goal_matrix::cl_free		:
					cl_state = ik_goal_matrix::cl_translational;	break;
			case ik_goal_matrix::cl_rotational:
					cl_state = ik_goal_matrix::cl_mixed;			break;
			default:		NODEFAULT;
			
		}
	else if( cl_state == ik_goal_matrix::cl_undefined )
			cl_state = ik_goal_matrix::cl_free;
	

	VERIFY( _valid( xm ) );
	m.set( xm, cl_state );
#ifdef DEBUG
	if(ph_dbg_draw_mask.test( phDbgDrawIKGoal ))
	{
		DBG_DrawPoint( global_point, 0.03f, D3DCOLOR_RGBA( 255, 0, 0, 255 ) );
	}
	if(!fsimilar( _abs( DET( g_anim ) - 1.f ), _abs( DET( m.get() ) - 1.f ), 0.001f ) )
		Msg("scale g_anim: %f scale m: %f ",  DET( g_anim ) ,  DET( m.get() ) );
#endif

	return true;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:69,代码来源:IKFoot.cpp


示例6: DevMsg

//-----------------------------------------------------------------------------
// Purpose: 
//    NOTE: Doesn't call the base call enter vehicle on purpose!
//-----------------------------------------------------------------------------
void CPropVehicleManhack::EnterVehicle( CBaseCombatCharacter *pPassenger )
{
	if ( pPassenger == NULL )
		return;

	DevMsg("CPropVehicleManhack: EnterVehicl(...)\n");

	CBasePlayer *pPlayer = ToBasePlayer( pPassenger );
	if ( pPlayer != NULL )
	{
		// Remove any player who may be in the vehicle at the moment
		if ( m_hPlayer )
		{
			ExitVehicle( VEHICLE_ROLE_DRIVER );
		}

		m_hPlayer = pPlayer;
		m_bHadDriver = true;

		if (GetNumberOfHacks(false)>1 && m_iHintTimesShown < 2)
		{
			m_iHintTimesShown++;
			m_iHintNoSwapTimesShown++;
			UTIL_HudHintText( pPlayer, "#HLSS_Hint_ManhackSwap" );
		} else if (m_iHintNoSwapTimesShown < 2)
		{
			m_iHintNoSwapTimesShown++;
			UTIL_HudHintText( pPlayer, "#HLSS_Hint_ManhackExit" );
		}
		else UTIL_HudHintText( pPlayer, "" );
	

		pPlayer->SetViewOffset( vec3_origin );
		pPlayer->ShowCrosshair( false );


		CHL2_Player *pHL2Player = dynamic_cast<CHL2_Player*>( pPlayer );
		if ( pHL2Player )
		{
			if ( pHL2Player->IsSprinting() )
			{
				pHL2Player->StopSprinting();
			}

			if ( pHL2Player->FlashlightIsOn() )
			{
				pHL2Player->FlashlightTurnOff();
			}
		}

		CNPC_Manhack *pManhack = dynamic_cast<CNPC_Manhack*>((CBaseEntity*)m_hManhack);
		if (pManhack!=NULL)
		{
			pManhack->SetControllable(true);

			if (manhack_dont_draw.GetBool())
			{
				pManhack->AddEffects( EF_NODRAW );
				pManhack->ShowRedGlow(false);
			}

			m_vecLastEyeTarget = pManhack->GetManhackView();
			m_vecLastEyePos    = pManhack->GetManhackView();
			m_vecTargetSpeed   = pManhack->GetAbsVelocity();

			m_vecFlyingDirection = pManhack->GetAbsVelocity();
		}

		//We want to see and feel the "vehicle" in manhack mode
		//SetRenderMode(kRenderNormal);
		RemoveEffects( EF_NODRAW );
		SetSolid(SOLID_BBOX);
		RemoveSolidFlags( FSOLID_NOT_SOLID );

		if (m_bDriverDucked) 
		{
			SetCollisionBounds( Vector(-16,-16,0), Vector(16,16,45) );

			int nSequence = LookupSequence( "crouch" );

			DevMsg("Player is ducking\n");

			// Set to the desired anim, or default anim if the desired is not present
			if ( nSequence > ACTIVITY_NOT_AVAILABLE )
			{
				SetCycle( 0 );
				m_flAnimTime = gpGlobals->curtime;
				ResetSequence( nSequence );
				ResetClientsideFrame();
			}
			else 
			{
				// Not available try to get default anim
				Msg( "Manhack Controller %s: missing crouch sequence\n", GetDebugName() );
				SetSequence( 0 );
			}
//.........这里部分代码省略.........
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:101,代码来源:vehicle_manhack.cpp


示例7: PlayMovieInWindow

HRESULT PlayMovieInWindow(LPTSTR szFile)
{
    HRESULT hr;

    // Check input string
    if (szFile == NULL)
        return E_POINTER;

    // Clear open dialog remnants before calling RenderFile()
    UpdateWindow(ghApp);

    // Get the interface for DirectShow's GraphBuilder
    JIF(CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, 
                         IID_IGraphBuilder, (void **)&pGB));

    if(SUCCEEDED(hr))
    {
        SmartPtr <IBaseFilter> pVmr;

        // Create the Video Mixing Renderer and add it to the graph
        JIF(InitializeWindowlessVMR(&pVmr));

        // Render the file programmatically to use the VMR9 as renderer.
        // Pass TRUE to create an audio renderer also.
        if (FAILED(hr = RenderFileToVideoRenderer(pGB, szFile, TRUE)))
            return hr;

        // QueryInterface for DirectShow interfaces
        JIF(pGB->QueryInterface(IID_IMediaControl, (void **)&pMC));
        JIF(pGB->QueryInterface(IID_IMediaEventEx, (void **)&pME));
        JIF(pGB->QueryInterface(IID_IMediaSeeking, (void **)&pMS));

        // Is this an audio-only file (no video component)?
        if (CheckVideoVisibility())
        {
            JIF(InitVideoWindow(1, 1));
        }
        else
        {
            // This sample requires a video clip to be loaded
            Msg(TEXT("This sample requires media with a video component.  ")
                TEXT("Please select another file."));
            return E_FAIL;
        }

        // Have the graph signal event via window callbacks for performance
        JIF(pME->SetNotifyWindow((OAHWND)ghApp, WM_GRAPHNOTIFY, 0));

        // Add the bitmap (static image or dynamic text) to the VMR's input
        if (g_dwTickerFlags & MARK_STATIC_IMAGE)
        {
            hr = BlendApplicationImage(ghApp);
            if (FAILED(hr))
                PostMessage(ghApp, WM_CLOSE, 0, 0);

            CheckMenuItem(ghMenu, ID_TICKER_STATIC_IMAGE, MF_CHECKED);
            CheckMenuItem(ghMenu, ID_TICKER_DYNAMIC_TEXT, MF_UNCHECKED);
        }
        else                                        // MARK_DYNAMIC_TEXT
        {
            if (!g_hFont)
                g_hFont = SetTextFont(FALSE);  // Don't display the Windows Font Select dialog

            // If the initial blend fails, post a close message to exit the app
            hr = BlendApplicationText(ghApp, g_szAppText);
            if (FAILED(hr))
                PostMessage(ghApp, WM_CLOSE, 0, 0);

            CheckMenuItem(ghMenu, ID_TICKER_STATIC_IMAGE, MF_UNCHECKED);
            CheckMenuItem(ghMenu, ID_TICKER_DYNAMIC_TEXT, MF_CHECKED);
        }

        // Complete the window setup
        ShowWindow(ghApp, SW_SHOWNORMAL);
        UpdateWindow(ghApp);
        SetForegroundWindow(ghApp);
        SetFocus(ghApp);

#ifdef REGISTER_FILTERGRAPH
        if (FAILED(AddGraphToRot(pGB, &g_dwGraphRegister)))
        {
            Msg(TEXT("Failed to register filter graph with ROT!"));
            g_dwGraphRegister = 0;
        }
#endif

        // Run the graph to play the media file
        JIF(pMC->Run());

        // Start animation by default
        PostMessage(ghApp, WM_COMMAND, ID_SLIDE, 0);
    }

    return hr;
}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:95,代码来源:ticker.cpp


示例8: Reload

void CASW_Weapon_Minigun::PrimaryAttack()
{
	// can't attack until the minigun barrel has spun up
	if ( GetSpinRate() < asw_minigun_spin_rate_threshold.GetFloat() )
		return;
	
	// If my clip is empty (and I use clips) start reload
	if ( UsesClipsForAmmo1() && !m_iClip1 ) 
	{		
		Reload();
		return;
	}

	CASW_Player *pPlayer = GetCommander();
	CASW_Marine *pMarine = GetMarine();
	if ( !pMarine )
		return;

	m_bIsFiring = true;
	// MUST call sound before removing a round from the clip of a CMachineGun
	WeaponSound(SINGLE);

	if (m_iClip1 <= AmmoClickPoint())
	{
		LowAmmoSound();
	}

	// tell the marine to tell its weapon to draw the muzzle flash
	pMarine->DoMuzzleFlash();

	// sets the animation on the weapon model itself
	SendWeaponAnim( GetPrimaryAttackActivity() );

	// sets the animation on the marine holding this weapon
	//pMarine->SetAnimation( PLAYER_ATTACK1 );

#ifdef GAME_DLL	// check for turning on lag compensation
	if (pPlayer && pMarine->IsInhabited())
	{
		CASW_Lag_Compensation::RequestLagCompensation( pPlayer, pPlayer->GetCurrentUserCommand() );
	}
#endif

	FireBulletsInfo_t info;
	info.m_vecSrc	 = pMarine->Weapon_ShootPosition( );
	if ( pPlayer && pMarine->IsInhabited() )
	{
		info.m_vecDirShooting = pPlayer->GetAutoaimVectorForMarine(pMarine, GetAutoAimAmount(), GetVerticalAdjustOnlyAutoAimAmount());	// 45 degrees = 0.707106781187
	}
	else
	{
#ifdef CLIENT_DLL
		Msg("Error, clientside firing of a weapon that's being controlled by an AI marine\n");
#else
		info.m_vecDirShooting = pMarine->GetActualShootTrajectory( info.m_vecSrc );
#endif
	}

	// To make the firing framerate independent, we may have to fire more than one bullet here on low-framerate systems, 
	// especially if the weapon we're firing has a really fast rate of fire.
	info.m_iShots = 0;
	float fireRate = GetFireRate() * ( 1.0f / MAX( GetSpinRate(), asw_minigun_spin_rate_threshold.GetFloat() ) );
	while ( m_flNextPrimaryAttack <= gpGlobals->curtime )
	{
		m_flNextPrimaryAttack = m_flNextPrimaryAttack + fireRate;
		info.m_iShots++;
		if ( !fireRate )
			break;
	}

	// Make sure we don't fire more than the amount in the clip
	if ( UsesClipsForAmmo1() )
	{
		info.m_iShots = MIN( info.m_iShots, m_iClip1 );
		m_flPartialBullets += static_cast<float>( info.m_iShots ) * 0.5f;

		if ( m_flPartialBullets >= 1.0f )
		{
			// Subtract ammo if we've counted up a whole bullet
			int nBullets = m_flPartialBullets;
			m_iClip1 -= nBullets;
			m_flPartialBullets -= nBullets;
		}

#ifdef GAME_DLL
		CASW_Marine *pMarine = GetMarine();
		if (pMarine && m_iClip1 <= 0 && pMarine->GetAmmoCount(m_iPrimaryAmmoType) <= 0 )
		{
			pMarine->OnWeaponOutOfAmmo(true);
		}
#endif
	}
	else
	{
		info.m_iShots = MIN( info.m_iShots, pMarine->GetAmmoCount( m_iPrimaryAmmoType ) );
		pMarine->RemoveAmmo( info.m_iShots, m_iPrimaryAmmoType );
	}

	info.m_flDistance = asw_weapon_max_shooting_distance.GetFloat();
	info.m_iAmmoType = m_iPrimaryAmmoType;
//.........这里部分代码省略.........
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:101,代码来源:asw_weapon_minigun.cpp


示例9: net_flags

void xrServer::Process_event_destroy	(NET_Packet& P, ClientID sender, u32 time, u16 ID, NET_Packet* pEPack)
{
	u32								MODE = net_flags(TRUE,TRUE);
	// Parse message
	u16								id_dest	= ID;
#ifdef DEBUG
	if( dbg_net_Draw_Flags.test( dbg_destroy ) )
		Msg								("sv destroy object %s [%d]", ent_name_safe(id_dest).c_str(), Device.dwFrame);
#endif

	CSE_Abstract*					e_dest = game->get_entity_from_eid	(id_dest);	// кто должен быть уничтожен
	if (!e_dest) 
	{
#ifndef MASTER_GOLD
		Msg							("!SV:ge_destroy: [%d] not found on server",id_dest);
#endif // #ifndef MASTER_GOLD
		return;
	};

	R_ASSERT						(e_dest);
	xrClientData					*c_dest = e_dest->owner;				// клиент, чей юнит
	R_ASSERT						(c_dest);
	xrClientData					*c_from = ID_to_client(sender);	// клиент, кто прислал
	R_ASSERT						(c_dest == c_from);							// assure client ownership of event
	u16								parent_id = e_dest->ID_Parent;

#ifdef MP_LOGGING
	Msg("--- SV: Process destroy: parent [%d] item [%d][%s]", 
		parent_id, id_dest, e_dest->name());
#endif //#ifdef MP_LOGGING

	//---------------------------------------------
	NET_Packet	P2, *pEventPack = pEPack;
	P2.w_begin	(M_EVENT_PACK);
	//---------------------------------------------
	// check if we have children 
	if (!e_dest->children.empty()) {
		if (!pEventPack) pEventPack = &P2;

		while (!e_dest->children.empty())
			Process_event_destroy		(P,sender,time,*e_dest->children.begin(), pEventPack);
	};

	if (0xffff == parent_id && NULL == pEventPack) 
	{
		SendBroadcast				(BroadcastCID,P,MODE);
	}
	else 
	{
		NET_Packet	tmpP;
		if (0xffff != parent_id && Process_event_reject(P,sender,time,parent_id,ID,false)) 
		{
			game->u_EventGen(tmpP, GE_OWNERSHIP_REJECT, parent_id);
			tmpP.w_u16(id_dest);
			tmpP.w_u8(1);
		
			if (!pEventPack) pEventPack = &P2;
			
			pEventPack->w_u8(u8(tmpP.B.count));
			pEventPack->w(&tmpP.B.data, tmpP.B.count);
		};
		
 		game->u_EventGen(tmpP, GE_DESTROY, id_dest);
		
		pEventPack->w_u8(u8(tmpP.B.count));
		pEventPack->w(&tmpP.B.data, tmpP.B.count);
	};

	if (NULL == pEPack && NULL != pEventPack)
	{
		SendBroadcast				(BroadcastCID, *pEventPack, MODE);
	}

	// Everything OK, so perform entity-destroy
	if (e_dest->m_bALifeControl && ai().get_alife()) {
		game_sv_Single				*_game = smart_cast<game_sv_Single*>(game);
		VERIFY						(_game);
		if (ai().alife().objects().object(id_dest,true))
			_game->alife().release	(e_dest,false);
	}

	if (game)
		game->OnDestroyObject		(e_dest->ID);

	entity_Destroy					(e_dest);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:86,代码来源:xrServer_process_event_destroy.cpp


示例10: AngleVectors


//.........这里部分代码省略.........

		CTraceFilterSkipTwoEntities filter(this, GetOwnerEntity(), COLLISION_GROUP_NONE);

		for ( int i = 0; i < count; i++ )
		{
			CBaseEntity *pEntity = pList[i];

			if (!pEntity || !pEntity->IsAlive() || !pEntity->edict() || !pEntity->IsNPC() )
			{
				//Msg("not alive or not an edict, skipping\n");
				continue;
			}

			if (!pEntity || !pEntity->IsAlive() || !pEntity->edict() || !pEntity->IsNPC() )
			{
				//Msg("not alive or not an edict, skipping\n");
				continue;
			}
	
			// don't autoaim onto marines
			if (pEntity->Classify() == CLASS_ASW_MARINE)
				continue;

			if ( pEntity->Classify() == CLASS_ASW_PARASITE )
			{
				CASW_Parasite *pParasite = static_cast< CASW_Parasite* >( pEntity );
				if ( pParasite->m_bInfesting )
				{
					continue;
				}
			}

			Vector center = pEntity->BodyTarget( GetAbsOrigin() );
			Vector center_flat = center;
			center_flat.z = GetAbsOrigin().z;

			Vector dir = (center - GetAbsOrigin());
			VectorNormalize( dir );

			Vector dir_flat = (center_flat - GetAbsOrigin());
			VectorNormalize( dir_flat );

			// make sure it's in front of the rocket
			float dot = DotProduct (dir, v_forward );
			//if (dot < 0)
			//{					
			//continue;
			//}

			float dist = (pEntity->GetAbsOrigin() - GetAbsOrigin()).LengthSqr();
			if (dist > ASW_ROCKET_MAX_HOMING_RANGE)
				continue;

			// check another marine isn't between us and the target to reduce FF
			trace_t tr;
			UTIL_TraceLine(GetAbsOrigin(), pEntity->WorldSpaceCenter(), MASK_SHOT, &filter, &tr);
			if (tr.fraction < 1.0f && tr.m_pEnt != pEntity && tr.m_pEnt && tr.m_pEnt->Classify() == CLASS_ASW_MARINE)
				continue;

			// does this critter already have enough rockets to kill it?
			{ 
				CASW_DamageAllocationMgr::IndexType_t assignmentIndex = m_RocketAssigner.Find( pEntity );
				if ( m_RocketAssigner.IsValid(assignmentIndex) )
				{
					if ( m_RocketAssigner[assignmentIndex].m_flAccumulatedDamage > pEntity->GetHealth() )
					{
						continue;
					}
				}
			}


			// check another marine isn't between us and the target to reduce FF
			UTIL_TraceLine(GetAbsOrigin(), pEntity->WorldSpaceCenter(), MASK_SHOT, &filter, &tr);
			if (tr.fraction < 1.0f && tr.m_pEnt != pEntity && tr.m_pEnt && tr.m_pEnt->Classify() == CLASS_ASW_MARINE)
				continue;

			// increase distance if dot isn't towards us
			dist += (1.0f - dot) * 150;	// bias of x units when object is 90 degrees to the side
			if (bestdist == 0 || dist < bestdist)
			{
				bestdist = dist;
				bestent = pEntity;
			}
		}

		if ( bestent && asw_rocket_debug.GetBool() )
		{
			Vector center = bestent->BodyTarget( GetAbsOrigin() );
			Vector center_flat = center;
			center_flat.z = GetAbsOrigin().z;

			Vector dir = (center - GetAbsOrigin());
			VectorNormalize( dir );
			Msg( "Rocket[%d] starting homing in on %s(%d) dir = %f %f %f\n", entindex(), bestent->GetClassname(), bestent->entindex(), VectorExpand( dir ) );
		}
	}

	return bestent;
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:101,代码来源:asw_rocket.cpp


示例11: ShowMenu

//---------------------------------------------------------------------------------
// Purpose: called when a client types in a command (only a subset of commands however, not CON_COMMAND's)
//---------------------------------------------------------------------------------
PLUGIN_RESULT CEmptyServerPlugin::ClientCommand( edict_t *pEntity, const CCommand &args )
{
	const char *cmd = args.Arg(0);
    const char *cmd1 = args.Arg(1);

    if (strcmp(cmd, "achievements")==0)
    {
        //int client = engine->IndexOfEdict(pEntity);
        // Create a filter and add this client to it
        //SRecipientFilter filter;
		
        //filter.AddRecipient(engine->IndexOfEdict(pEntity));

        //// Start the usermessage and get a bf_write
        //bf_write* pBuffer = engine->UserMessageBegin(&filter, 9);

        //// Send the menu
        //CreateMenu(pBuffer, "Menu Title\n---------------\n->1.Option1\n->2.Option2\n->3.Option3\n->4.Option4\n->5.Option5\n->6.Option6\n->7.Option7\n->8.Option8", 8, 10);

        //engine->MessageEnd();

		ShowMenu( pEntity, 0xffff, -1, "Menu Title\n---------------\n->1.Option1\n->2.Option2\n->3.Option3\n->4.Option4\n->5.Option5\n->6.Option6\n->7.Option7\n->8.Option8" );

        return PLUGIN_CONTINUE;
    }

    if (strcmp(cmd, "menuselect")==0)
    {
        switch(atoi(cmd1))
        {
        case 1:
            Msg("Selected Option1");
            break;
        case 2:
            Msg("Selected Option2");
            break;
        case 3:
            Msg("Selected Option3");
            break;
        case 4:
            Msg("Selected Option4");
            break;
        case 5:
            Msg("Selected Option5");
            break;
        case 6:
            Msg("Selected Option6");
            break;
        case 7:
            Msg("Selected Option7");
            break;
        case 8:
            Msg("Selected Option8");
            break;
        }
 
        return PLUGIN_CONTINUE;
    }

	return PLUGIN_CONTINUE;
}
开发者ID:SizzlingStats,项目名称:sizzlingplugins,代码行数:64,代码来源:serverplugin_empty.cpp


示例12: EmitDispLMAlphaAndNeighbors

void EmitDispLMAlphaAndNeighbors()
{
	int i;

	Msg( "Finding displacement neighbors...\n" );

	// Do lightmap alpha.
    g_DispLightmapAlpha.RemoveAll();

	// Build the CCoreDispInfos.
	CUtlVector<dface_t*> faces;

	// Create the core dispinfos and init them for use as CDispUtilsHelpers.
	g_CoreDispInfos.SetSize( nummapdispinfo );
	for ( i=0; i < nummapdispinfo; i++ )
	{
		g_CoreDispInfos[i].SetDispUtilsHelperInfo( g_CoreDispInfos.Base(), nummapdispinfo );
	}

	faces.SetSize( nummapdispinfo );

	for( i = 0; i < numfaces; i++ )
	{
        dface_t *pFace = &dfaces[i];

		if( pFace->dispinfo == -1 )
			continue;

		mapdispinfo_t *pMapDisp = &mapdispinfo[pFace->dispinfo];
		
		// Set the displacement's face index.
		ddispinfo_t *pDisp = &g_dispinfo[pFace->dispinfo];
		pDisp->m_iMapFace = i;

		// Get a CCoreDispInfo. All we need is the triangles and lightmap texture coordinates.
		CCoreDispInfo *pCoreDispInfo = &g_CoreDispInfos[pFace->dispinfo];
		DispMapToCoreDispInfo( pMapDisp, pCoreDispInfo, pFace );
		
		faces[pFace->dispinfo] = pFace;
	}

	
	// Generate and export neighbor data.
	ExportNeighborData( g_CoreDispInfos.Base(), g_dispinfo.Base(), nummapdispinfo );

	// Generate and export the active vert lists.
	ExportAllowedVertLists( g_CoreDispInfos.Base(), g_dispinfo.Base(), nummapdispinfo );

	Msg( "Finding lightmap sample positions...\n" );
	for ( i=0; i < nummapdispinfo; i++ )
	{
		dface_t *pFace = faces[i];
		ddispinfo_t *pDisp = &g_dispinfo[pFace->dispinfo];
		CCoreDispInfo *pCoreDispInfo = &g_CoreDispInfos[i];

		pDisp->m_iLightmapSamplePositionStart = g_DispLightmapSamplePositions.Count();

		CalculateLightmapSamplePositions( 
			pCoreDispInfo, 
			pFace,
			g_DispLightmapSamplePositions );
	}


	StartPacifier( "Displacement Alpha : ");

	// Build lightmap alphas.
	int dispCount = 0;	// How many we've processed.
	for( i = 0; i < nummapdispinfo; i++ )
	{
        dface_t *pFace = faces[i];

		Assert( pFace->dispinfo == i );
		mapdispinfo_t *pMapDisp = &mapdispinfo[pFace->dispinfo];
		ddispinfo_t *pDisp = &g_dispinfo[pFace->dispinfo];

		CCoreDispInfo *pCoreDispInfo = &g_CoreDispInfos[i];

		// Allocate space for the alpha values.
		pDisp->m_iLightmapAlphaStart = g_DispLightmapAlpha.Count();
		int nLuxelsToAdd = (pFace->m_LightmapTextureSizeInLuxels[0]+1) * (pFace->m_LightmapTextureSizeInLuxels[1]+1);
		g_DispLightmapAlpha.AddMultipleToTail( nLuxelsToAdd );

		DispUpdateLightmapAlpha( 
			g_CoreDispInfos.Base(),
			i,
			(float)dispCount     / g_dispinfo.Count(),
			(float)(dispCount+1) / g_dispinfo.Count(),
			pDisp, 
			pFace->m_LightmapTextureSizeInLuxels[0],
			pFace->m_LightmapTextureSizeInLuxels[1] );
	
		++dispCount;
	}

	EndPacifier();
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:97,代码来源:disp_vbsp.cpp


示例13: PlayMedia

HRESULT PlayMedia(LPTSTR lpszMovie, HINSTANCE hInstance)
{
    HRESULT hr = S_OK;
    BOOL bSleep=TRUE;

    if (!lpszMovie)
        return E_POINTER;

    // Allow DirectShow to create the FilterGraph for this media file
    hr = pGB->RenderFile(lpszMovie, NULL);
    if (FAILED(hr)) {
        Msg(TEXT("Failed(0x%08lx) in RenderFile(%s)!\r\n"), hr, lpszMovie);
        return hr;
    }

    // Set the message drain of the video window to point to our hidden
    // application window.  This allows keyboard input to be transferred
    // to our main window for processing.
    //
    // If this is an audio-only or MIDI file, then put_MessageDrain will fail.
    //
    hr = pVW->put_MessageDrain((OAHWND) g_hwndMain);
    if (FAILED(hr))
    {
        Msg(TEXT("Failed(0x%08lx) to set message drain for %s.\r\n\r\n")
            TEXT("This sample is designed to play videos, but the file selected ")
            TEXT("has no video component."), hr, lpszMovie);
        return hr;
    }

    // Set fullscreen
    hr = SetFullscreen();
    if (FAILED(hr)) {
        Msg(TEXT("Failed(%08lx) to set fullscreen!\r\n"), hr);
        return hr;
    }

    // Display first frame of the movie
    hr = pMC->Pause();
    if (FAILED(hr)) {
        Msg(TEXT("Failed(%08lx) in Pause()!\r\n"), hr);
        return hr;
    }

    // Start playback
    hr = pMC->Run();
    if (FAILED(hr)) {
        Msg(TEXT("Failed(%08lx) in Run()!\r\n"), hr);
        return hr;
    }

    // Update state variables
    g_bContinue = TRUE;

    // Enter a loop of checking for events and sampling keyboard input
    while (g_bContinue)
    {
        MSG msg;
        long lEventCode;
        LONG_PTR lpParam1, lpParam2;

        // Reset sleep flag
        bSleep = TRUE;

        // Has there been a media event?  Look for end of stream condition.
        if(E_ABORT != pME->GetEvent(&lEventCode, &lpParam1, 
                                    &lpParam2, 0))
        {
            // Is this the end of the movie?
            if (lEventCode == EC_COMPLETE)
            {
                g_bContinue = FALSE;
                bSleep = FALSE;
            }

            // Free the media event resources
            hr = pME->FreeEventParams(lEventCode, lpParam1, lpParam2);
            if (FAILED(hr))
            {
                Msg(TEXT("Failed(%08lx) to free event params (%s)!\r\n"),
                    hr, lpszMovie);
            }
        }

        // Give system threads time to run (and don't sample user input madly)
        if (bSleep)
            Sleep(KEYBOARD_SAMPLE_FREQ);

        // Check and process window messages (like our keystrokes)
        while (PeekMessage (&msg, g_hwndMain, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return hr;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:98,代码来源:cutscene.cpp


示例14: strlen


//.........这里部分代码省略.........

            if (!(Options & SEARCH_NASK)) {
                char ch;

                while (1) {
                    Draw(VToR(CP.Row), 1);
                    Redraw();
                    switch (View->MView->Win->Choice(0, "Delete Line",
                                                     5,
                                                     "&Yes",
                                                     "&All",
                                                     "&Once",
                                                     "&Skip",
                                                     "&Cancel",
                                                     "Delete line %d?", VToR(CP.Row))) {
                    case 0:
                        ch = 'Y';
                        break;
                    case 1:
                        ch = 'A';
                        break;
                    case 2:
                        ch = 'O';
                        break;
                    case 3:
                        ch = 'N';
                        break;
                    case 4:
                    case -1:
                    default:
                        ch = 'Q';
                        break;
                    }
                    if (ch == 'Y') {
                        ask = 'Y';
                        goto ok_delete;
                    }
                    if (ch == 'N') {
                        ask = 'N';
                        goto ok_delete;
                    }
                    if (ch == 'Q') {
                        ask = 'Q';
                        goto ok_delete;
                    }
                    if (ch == 'A') {
                        ask = 'A';
                        goto ok_delete;
                    }
                    if (ch == 'O') {
                        ask = 'O';
                        goto ok_delete;
                    }
                }
ok_delete:
                if (ask == 'N') goto next;
                if (ask == 'Q') goto end;
                if (ask == 'A') Options |= SEARCH_NASK;
            }

            if (Match.Row == RCount - 1) {
                if (DelText(Match.Row, 0, LineLen()) == 0) goto error;
            } else
                if (DelLine(Match.Row) == 0) goto error;

            if (ask == 'O')
                goto end;
            if (!(Options & SEARCH_ALL))
                break;
            goto last;
        }
next:
        if (!(Options & SEARCH_ALL))
            break;
        Options |= SEARCH_NEXT;
last:
        ;
    }
end:
    // end of search
    if (R)
        RxFree(R);

    if (Options & SEARCH_ALL)
        Msg(S_INFO, "%d match(es) found.", opt.resCount);
    else {
        if (opt.resCount == 0) {
            Msg(S_INFO, "[%s] not found", opt.strSearch);
            return 0;
        }
    }
    return 1;
error:

    if (R) {
        RxFree(R);
    }
    View->MView->Win->Choice(GPC_ERROR, "Find", 1, "O&K", "Error in search/replace.");
    return 0;
}
开发者ID:AaronDP,项目名称:efte_adbshell,代码行数:101,代码来源:e_search.cpp


示例15: Msg

// Print Data Functions
void
V3SvrBoolector::printInfo() const {
   Msg(MSG_IFO) << "#Ref = " << boolector_get_refs(_Solver) << ", "
                << "#SV = " << totalSolves() << ", AccT = " << totalTime();
}
开发者ID:ChunHungLiu,项目名称:abc1234,代码行数:6,代码来源:v3SvrBoolector.cpp


示例16: Q_snprintf

void CASW_Mission_Chooser_Source_Local::AddToSavedCampaignList(const char *szSaveName)
{
	// find out what campaign this save is for
	char szFullFileName[256];
	Q_snprintf(szFullFileName, sizeof(szFullFileName), "save/%s", szSaveName);
	KeyValues *pSaveKeyValues = new KeyValues( szSaveName );
	if (pSaveKeyValues->LoadFromFile(g_pFullFileSystem, szFullFileName))
	{
		const char *pCampaignName = pSaveKeyValues->GetString("CampaignName");
		// check the campaign exists
		char tempfile[MAX_PATH];
		Q_snprintf( tempfile, sizeof( tempfile ), "resource/campaigns/%s.txt", pCampaignName );
		if (g_pFullFileSystem->FileExists(tempfile))
		{
			ASW_Mission_Chooser_Saved_Campaign item;
			Q_snprintf(item.m_szSaveName, sizeof(item.m_szSaveName), "%s", szSaveName);
			Q_snprintf(item.m_szCampaignName, sizeof(item.m_szCampaignName), "%s", pCampaignName);
			Q_snprintf(item.m_szDateTime, sizeof(item.m_szDateTime), "%s", pSaveKeyValues->GetString("DateTime"));
			//Msg("save %s multiplayer %d\n", szSaveName, pSaveKeyValues->GetInt("Multiplayer"));
			item.m_bMultiplayer = (pSaveKeyValues->GetInt("Multiplayer") > 0);
			//Msg("item multiplayer = %d\n", item.m_bMultiplayer);

			// check subsections for player names and player IDs, concat them into two strings
			char namebuffer[256];
			char idbuffer[512];
			namebuffer[0] = '\0';
			idbuffer[0] = '\0';
			int namepos = 0;
			int idpos = 0;
			KeyValues *pkvSubSection = pSaveKeyValues->GetFirstSubKey();
			while ( pkvSubSection )
			{
				if ((Q_stricmp(pkvSubSection->GetName(), "PLAYER")==0) && namepos < 253)
				{
					const char *pName = pkvSubSection->GetString("PlayerName");
					if (pName && pName[0] != '\0')
					{
						int namelength = Q_strlen(pName);
						for (int charcopy=0; charcopy<namelength && namepos<253; charcopy++)
						{
							namebuffer[namepos] = pName[charcopy];
							namepos++;
						}
						namebuffer[namepos] = ' '; namepos++;
						namebuffer[namepos] = '\0';
					}
				}
				if ((Q_stricmp(pkvSubSection->GetName(), "DATA")==0) && idpos < 253)
				{
					const char *pID = pkvSubSection->GetString("DataBlock");
					if (pID && pID[0] != '\0')
					{
						int idlength = Q_strlen(pID);
						for (int charcopy=0; charcopy<idlength && idpos<253; charcopy++)
						{
							idbuffer[idpos] = pID[charcopy];
							idpos++;
						}
						idbuffer[idpos] = ' '; idpos++;
						idbuffer[idpos] = '\0';
					}
				}
				pkvSubSection = pkvSubSection->GetNextKey();
			}
			Q_snprintf(item.m_szPlayerNames, sizeof(item.m_szPlayerNames), "%s", namebuffer);
			Q_snprintf(item.m_szPlayerIDs, sizeof(item.m_szPlayerIDs), "%s", idbuffer);
			item.m_iMissionsComplete = pSaveKeyValues->GetInt("NumMissionsComplete");
			m_SavedCampaignList.Insert( item );
		}
	}
	pSaveKeyValues->deleteThis();

	// check if there's now too many save games
	int iNumMultiplayer = GetNumSavedCampaigns(true, NULL);
	if (iNumMultiplayer > asw_max_saves.GetInt())
	{
		// find the oldest one
		ASW_Mission_Chooser_Saved_Campaign* pChosen = false;
		int iChosen = -1;
		for (int i=m_SavedCampaignList.Count()-1; i>=0; i--)
		{
			if (m_SavedCampaignList[i].m_bMultiplayer)
			{
				pChosen = &m_SavedCampaignList[i];
				iChosen = i;
				break;
			}			
		}
		// delete if found
		if (iChosen != -1 && pChosen)
		{
			char buffer[MAX_PATH];
			Q_snprintf(buffer, sizeof(buffer), "save/%s", pChosen->m_szSaveName);
			Msg("Deleting save %s as we have too many\n", buffer);
			g_pFullFileSystem->RemoveFile( buffer, "GAME" );
			m_SavedCampaignList.Remove(iChosen);
		}
	}
}
开发者ID:ppittle,项目名称:AlienSwarmDirectorMod,代码行数:99,代码来源:asw_mission_chooser_source_local.cpp


示例17: FindConPrintf

void FindConPrintf(void)
{
	ConCommandBase *pBase = NULL;
	unsigned char *ptr = NULL;

#ifdef GAME_ORANGE
	FnCommandCallback_t callback = NULL;
#else
	FnCommandCallback callback = NULL;
#endif

	int offs = 0;

#if !defined ( GAME_CSGO )
	pBase = g_pCVar->GetCommands();
	while (pBase)
	{
		if ( strcmp(pBase->GetName(), "echo") == 0 )
		{
			//callback = //*((FnCommandCallback *)((char *)pBase + offsetof(ConCommand, m_fnCommandCallback)));
			callback = ((ConCommand *)pBase)->m_fnCommandCallback;
			ptr = (unsigned char *)callback;
			if (vcmp(ptr, ENGINE486_SIG, SIGLEN))
			{
				offs = ENGINE486_OFFS;
			} else if (vcmp(ptr, ENGINE686_SIG, SIGLEN)) {
				offs = ENGINE686_OFFS;
			} else if (vcmp(ptr, ENGINEAMD_SIG, SIGLEN)) {
				offs = ENGINEAMD_OFFS;
			} else if (vcmp(ptr, ENGINEW32_SIG, SIGLEN)) {
				offs = ENGINEW3 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MsgBox函数代码示例发布时间:2022-05-30
下一篇:
C++ Mset函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap