コード例 #1
0
void WeaponRack::internalOnEvent(EventIdT action,
                                 Property::Value payload,
                                 GameHandle module,
                                 GameHandle sender)
{
	switch(action)
	{
	case ID::GOE_FIRE_ROCKET:
		fireRocket();
		break;

	case ID::GOE_FIRE_LASER:
		fireLaser();
		break;

	case ID::GOE_SET_WEAPON_TARGET:
		mTarget = payload;
		infolog << "WeaponRack_New Target: " << mTarget;
		break;
		
	case ID::GOE_REINITIALIZE:
		mRocketAmmo = ROCKET_AMMO_START_AMOUNT_FOR_TESTING;
		updateGuiAmmo();
		break;

	default:
		throw std::logic_error("un nu?");
	}
}
コード例 #2
0
ファイル: player.c プロジェクト: akien-mga/tbftss
static void handleMouse(void)
{
	faceMouse();
	
	if (battle.status == MS_IN_PROGRESS)
	{
		if (isControl(CONTROL_FIRE) && !player->reload && player->guns[0].type)
		{
			if (player->selectedGunType != BT_ROCKET)
			{
				fireGuns(player);
			}
			else
			{
				fireRocket(player);
			}
			
			if (battle.hasSuspicionLevel && !battle.numEnemies && !battle.suspicionCoolOff)
			{
				battle.suspicionLevel += (MAX_SUSPICION_LEVEL * 0.05);
			}
		}
		
		if (isControl(CONTROL_ACCELERATE))
		{
			if (battle.boostTimer > BOOST_FINISHED_TIME || game.currentMission->challengeData.noBoost)
			{
				applyFighterThrust();
			}
		}
		
		if (isControl(CONTROL_MISSILE))
		{
			preFireMissile();
			
			app.mouse.button[SDL_BUTTON_MIDDLE] = 0;
		}
		
		if (isControl(CONTROL_GUNS))
		{
			switchGuns();
			
			app.mouse.button[SDL_BUTTON_X1] = 0;
		}
		
		if (isControl(CONTROL_RADAR))
		{
			cycleRadarZoom();
			
			app.mouse.button[SDL_BUTTON_X2] = 0;
		}
	}
}