//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pOther - 
//-----------------------------------------------------------------------------
void CRocket_Turret_Projectile::MissileTouch( CBaseEntity *pOther )
{
	Assert( pOther );
	Vector vVel = GetAbsVelocity();

	// Touched a launcher, and is heading towards that launcher
	if ( FClassnameIs( pOther, "npc_rocket_turret" ) )
	{
		Dissolve( NULL, gpGlobals->curtime + 0.1f, false, ENTITY_DISSOLVE_NORMAL );
		Vector vBounceVel = Vector( -vVel.x, -vVel.y, 200 );
		SetAbsVelocity (  vBounceVel * 0.1f );
		QAngle vBounceAngles;
		VectorAngles( vBounceVel, vBounceAngles );
		SetAbsAngles ( vBounceAngles );
		SetLocalAngularVelocity ( QAngle ( 180, 90, 45 ) );
		UTIL_Remove ( m_hRocketTrail );

		SetSolid ( SOLID_NONE );

		if( m_hRocketTrail )
		{
			m_hRocketTrail->SetLifetime(0.1f);
			m_hRocketTrail = NULL;
		}

		return;
	}

	// Don't touch triggers (but DO hit weapons)
	if ( pOther->IsSolidFlagSet(FSOLID_TRIGGER|FSOLID_VOLUME_CONTENTS) && pOther->GetCollisionGroup() != COLLISION_GROUP_WEAPON )
		return;

	Explode();
}
Пример #2
0
//---------------------------------------------------------
bool CPolygon_Clip::On_Execute(void)
{
	CSG_Shapes	Clip, *pClip	= Parameters("CLIP")->asShapes();

	if( Parameters("DISSOLVE")->asBool() && Dissolve(pClip, &Clip) )
	{
		pClip	= &Clip;
	}

	//-----------------------------------------------------
	if( !Parameters("MULTIPLE")->asBool() )	// single input mode
	{
		return( Clip_Shapes(pClip,
			Parameters("S_INPUT" )->asShapes(),
			Parameters("S_OUTPUT")->asShapes()
		));
	}

	//-----------------------------------------------------
	else									// multiple input mode
	{
		CSG_Parameter_Shapes_List	*pInput		= Parameters("M_INPUT" )->asShapesList();
		CSG_Parameter_Shapes_List	*pOutput	= Parameters("M_OUTPUT")->asShapesList();

		pOutput->Del_Items();

		for(int i=0; i<pInput->Get_Count() && Process_Get_Okay(); i++)
		{
			CSG_Shapes	*pShapes	= SG_Create_Shapes();

			if( Clip_Shapes(pClip, pInput->asShapes(i), pShapes) )
			{
				pOutput->Add_Item(pShapes);
			}
			else
			{
				delete(pShapes);
			}
		}

		return( pOutput->Get_Count() > 0 );
	}
}
Пример #3
0
/*	Returns the option chosen by the user	 */
short Menu(const char *title, const char Options[], short Max_Length, short pos, short Fading) {
	short width = 0, No_Options = 0, Main_Pos = 0;
	short a, Changing = FALSE;
	
	while(_KeyCheck(ESCKEY));
	do 
	{
		if (DrawStrWidth(Options + (Max_Length * No_Options), F_6x8) > width)
			width = DrawStrWidth(Options + (Max_Length * No_Options), F_6x8);
	} while(*(Options + (Max_Length * (++No_Options))) != 0);
	
	do {
		
		memset(Hiddenl, 0xFF, LCD_SIZE + LCD_SIZE);
		GraySpriteX8_AND(g->Zerox + 8, 0, 16, ExciteBike_Title[1], ExciteBike_Title[0], 18, 
			Hiddenl, Hiddend);
		
		Display_Author();
		FS_DrawGrayString(0, 22, title, A_SHADOWED | A_XOR | A_CENTERED, F_6x8);
		for(a = (No_Options > 5 ? 6 : No_Options); a--;)
			FS_DrawGrayString(g->Zerox + 22, 34 + 10 * a, Options + (Max_Length * (Main_Pos + a)), 
			A_XOR, F_6x8);
		
		register short Offset = 2 + (g->Zerox >> 3) + 30 * (10 * pos + 0 + 36);
		*((char*)Hiddend + Offset +  0) &= 0x1F;
		*((char*)Hiddend + Offset + 30) &= 0x1F;
		*((char*)Hiddenl + Offset + 30) &= 0xBF;
		*((char*)Hiddend + Offset + 60) &= 0x1F;
		
		// Highlight the selected Option
		GrayInvertRect2B(g->Zerox + 21, 33 + 10 * pos, g->Zerox + 23 + width, 41 + 10 * pos, Hiddenl, Hiddend);
		
		if (!strcmp(title, "- Choose Mode -")) {
			a = Zeroy + 75;
			if (pos == 0) {
				FS_DrawGrayString(0, a, EFG("(The fastest time at the end of the race wins)", 
					"(Le plus rapide à la course gagne)", "(die beste Zeit am Ende des Rennens gewinnt)"), A_CENTERED | A_XOR, F_4x6);
				FS_DrawGrayString(0, a + 7, EFG("Hint: Perform flips to lower your time", 
					"Astuce: pirouettes pour meil. tps", "Tipp: Loopings für eine bessere Zeit"), 
					A_CENTERED | A_XOR, F_4x6);
			}
			if (pos == 1) {
				FS_DrawGrayString(0, a, EFG("(The first person to cross the finish line wins)", 
					"(Celui qui arrive en premier gagne)", "(derjenige, der als Erster ankommt, gewinnt)"), 
					A_CENTERED | A_XOR, F_4x6);
			}
		}
		
		if (Fading) {  // Make a new menu screen fade in
			Dissolve();
			Fading = FALSE;
		} else {
			Toggle_Screens();
		}
		
		// Algorithm allows for any size menues to be scrolled easily
		if (_keytest(RR_UP)) {
		 	if (Changing == FALSE) {
				Changing = TRUE;
				if (--pos < 0) {
					if (--Main_Pos < 0) {
						pos = (No_Options > 5 ? 5 : No_Options - 1);
						Main_Pos = (No_Options > 5) * (No_Options - 6);
					} else pos = 0;
				}
			}
		} else if (_keytest(RR_DOWN)) {
			if (Changing == FALSE) {
				Changing = TRUE;
				if (++pos >= (No_Options > 5 ? 6 : No_Options)) {
					if (++Main_Pos >= (No_Options > 5) * (No_Options - 5))
						pos = Main_Pos = 0;
					else pos = 5;
				}
			}
		} else Changing = FALSE;
		
		if (_KeyCheck(ESCKEY) || _KeyCheck(TEACHERKEY)) {
			Exit_Linkplay();
			while(_KeyCheck(ESCKEY));
			
			return QUIT;
		}
	} while (!_KeyCheck(CONFIRMKEY) && !(_keytest(RR_ENTER) || (CALCULATOR && _keytest(RR_ENTER1)) || 
	(CALCULATOR && _keytest(RR_ENTER2))));
	
	while(_rowread(0));
	return Main_Pos + pos;  // Return the option chosen by the user
}