當前位置: 首頁>>代碼示例>>C++>>正文


C++ AddScore函數代碼示例

本文整理匯總了C++中AddScore函數的典型用法代碼示例。如果您正苦於以下問題:C++ AddScore函數的具體用法?C++ AddScore怎麽用?C++ AddScore使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了AddScore函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: switch

void GameControl::AddCompleteLines(int Lines) {
    m_completeLines += Lines;
    int diffLines = m_completeLines - m_prevLines;

    switch (diffLines) {
        case 1: //single line clear
            AddScore((m_level+1)*40);
            break;
        case 2: //double line clear
            AddScore((m_level+1)*100);
            break;
        case 3: //triple line clear
            AddScore((m_level+1)*300);
            break;
        case 4: //tetris line clear
            AddScore((m_level+1)*1200);
            break;
        default:
            break;
    }

    //increase the level if we've got enough lines and then
    //speed up the drop interval
    m_prevLines = m_completeLines;
    int currentLevel;
    currentLevel = int(m_completeLines / LINES_PER_LEVEL);
    if (currentLevel > GetLevel()) {
        m_level++;
        SetDropInterval(GetDropInterval() - (DROP_INTERVAL_INCREMENT));
        sound->Play(SOUND_LEVEL_UP);
    }
    else
        sound->Play(SOUND_CLEAR_LINE);
}
開發者ID:shiver,項目名稱:heavy_metal,代碼行數:34,代碼來源:gamecontrol.cpp

示例2: Touch_flagonly

void Touch_flagonly( gentity_t *ent, gentity_t *other, trace_t *trace ) {

	if ( !other->client ) {
		return;
	}

	if ( ent->spawnflags & RED_FLAG && other->client->ps.powerups[ PW_REDFLAG ] ) {

		AddScore( other, ent->accuracy ); // JPW NERVE set from map, defaults to 20

		G_Script_ScriptEvent( ent, "death", "" );

		// Removes itself
		ent->touch = 0;
		ent->nextthink = level.time + FRAMETIME;
		ent->think = G_FreeEntity;
	} else if ( ent->spawnflags & BLUE_FLAG && other->client->ps.powerups[ PW_BLUEFLAG ] )   {

		AddScore( other, ent->accuracy ); // JPW NERVE set from map, defaults to 20

		G_Script_ScriptEvent( ent, "death", "" );

		// Removes itself
		ent->touch = 0;
		ent->nextthink = level.time + FRAMETIME;
		ent->think = G_FreeEntity;
	}
}
開發者ID:MAN-AT-ARMS,項目名稱:iortcw-archive,代碼行數:28,代碼來源:g_trigger.c

示例3: HoldNoteScoreToDancePoints

void ScoreKeeperMAX2::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
{
	// update dance points totals
	if( !m_pPlayerStageStats->bFailed )
		m_pPlayerStageStats->iActualDancePoints += HoldNoteScoreToDancePoints( holdScore );
	m_pPlayerStageStats->iCurPossibleDancePoints += HoldNoteScoreToDancePoints( HNS_OK );
	m_pPlayerStageStats->iHoldNoteScores[holdScore] ++;

	// increment the current total possible dance score

	m_pPlayerStageStats->iCurPossibleDancePoints += HoldNoteScoreToDancePoints( HNS_OK );

	if( holdScore == HNS_OK )
		AddScore( TNS_MARVELOUS );
	else if ( holdScore == HNS_NG )
		AddScore( TNS_GOOD ); // required for subtractive score display to work properly

	// TODO: Remove indexing with PlayerNumber
	PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
	NSMAN->ReportScore(
		pn, 
		holdScore+TNS_MARVELOUS, 
        m_pPlayerStageStats->iScore,
        m_pPlayerStageStats->iCurCombo );
}
開發者ID:Prcuvu,項目名稱:StepMania-3.95,代碼行數:25,代碼來源:ScoreKeeperMAX2.cpp

示例4: ObeliskDie

/*
=======================================================================================================================================
ObeliskDie
=======================================================================================================================================
*/
static void ObeliskDie(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod) {
	int otherTeam;

	otherTeam = OtherTeam(self->spawnflags);

	self->takedamage = qfalse;
	self->think = ObeliskRespawn;
	self->nextthink = level.time + g_obeliskRespawnDelay.integer * 1000;
	self->activator->s.modelindex2 = 0xff;
	self->activator->s.frame = 2;

	G_AddEvent(self->activator, EV_OBELISKEXPLODE, 0);

	if (self->spawnflags == attacker->client->sess.sessionTeam) {
		AddScore(attacker, self->r.currentOrigin, -CTF_CAPTURE_BONUS);
	} else {
		AddScore(attacker, self->r.currentOrigin, CTF_CAPTURE_BONUS);

		attacker->client->rewardTime = level.time + REWARD_TIME;
		attacker->client->ps.persistant[PERS_CAPTURES]++;
	}

	AddTeamScore(self->s.pos.trBase, otherTeam, 1);
	CalculateRanks();
	Team_CaptureFlagSound(self, self->spawnflags);
	Team_ForceGesture(otherTeam);

	teamgame.redObeliskAttackedTime = 0;
	teamgame.blueObeliskAttackedTime = 0;

	trap_SendServerCommand(-1, va("cp \"%s" S_COLOR_WHITE "\ndestroyed the %s obelisk!\n\"", attacker->client->pers.netname, TeamName(self->spawnflags)));
}
開發者ID:KuehnhammerTobias,項目名稱:ioqw,代碼行數:37,代碼來源:g_team.c

示例5: Touch_flagonly

void Touch_flagonly (gentity_t *ent, gentity_t *other, trace_t *trace) {
	gentity_t* tmp;

	if (!other->client)
		return;
	

	if ( ent->spawnflags & RED_FLAG && other->client->ps.powerups[ PW_REDFLAG ] ) {

		if( ent->spawnflags & 4 ) {
			other->client->ps.powerups[ PW_REDFLAG ] = 0;
			other->client->speedScale = 0;
		}

		AddScore(other, ent->accuracy); // JPW NERVE set from map, defaults to 20
		//G_AddExperience( other, 2.f );

		tmp = ent->parent;
		ent->parent = other;

		G_Script_ScriptEvent( ent, "death", "" );

		G_Script_ScriptEvent( &g_entities[other->client->flagParent], "trigger", "captured" );

		ent->parent = tmp;

		// Removes itself
		ent->touch = NULL;
		ent->nextthink = level.time + FRAMETIME;
		ent->think = G_FreeEntity;
	} else if ( ent->spawnflags & BLUE_FLAG && other->client->ps.powerups[ PW_BLUEFLAG ] ) {

		if( ent->spawnflags & 4 ) {
			other->client->ps.powerups[ PW_BLUEFLAG ] = 0;
			other->client->speedScale = 0;
		}

		AddScore(other, ent->accuracy); // JPW NERVE set from map, defaults to 20

		//G_AddExperience( other, 2.f );

		tmp = ent->parent;
		ent->parent = other;

		G_Script_ScriptEvent( ent, "death", "" );

		G_Script_ScriptEvent( &g_entities[other->client->flagParent], "trigger", "captured" );

		ent->parent = tmp;

		// Removes itself
		ent->touch = NULL;
		ent->nextthink = level.time + FRAMETIME;
		ent->think = G_FreeEntity;
	}
}
開發者ID:BackupTheBerlios,項目名稱:et-flf-svn,代碼行數:56,代碼來源:g_trigger.c

示例6: AddScore

bool Actor::Clicked(const Point p) {
	if(IsValidAddPoint(p)) {
		if (mArea.AddPoint(p)) {
			AddScore(1);
			AddScore(10*World::get_mutable_instance().PointAdded(p, mId));
			return true;
		}
	}
	return false;
}
開發者ID:opatut,項目名稱:gamejam,代碼行數:10,代碼來源:Actor.cpp

示例7: Touch_flagonly_multiple

void Touch_flagonly_multiple(gentity_t * ent, gentity_t * other, trace_t * trace)
{
	gentity_t      *tmp;

	if(!other->client)
	{
		return;
	}

	if(ent->spawnflags & RED_FLAG && other->client->ps.powerups[PW_REDFLAG])
	{

		other->client->ps.powerups[PW_REDFLAG] = 0;
		other->client->speedScale = 0;

		AddScore(other, ent->accuracy);	// JPW NERVE set from map, defaults to 20
		//G_AddExperience( other, 2.f );

		tmp = ent->parent;
		ent->parent = other;

		G_Script_ScriptEvent(ent, "death", "");

		G_Script_ScriptEvent(&g_entities[other->client->flagParent], "trigger", "captured");
#ifdef OMNIBOT
		Bot_Util_SendTrigger(ent, NULL, va("Allies captured %s", ent->scriptName), "");
#endif

		ent->parent = tmp;
	}
	else if(ent->spawnflags & BLUE_FLAG && other->client->ps.powerups[PW_BLUEFLAG])
	{

		other->client->ps.powerups[PW_BLUEFLAG] = 0;
		other->client->speedScale = 0;

		AddScore(other, ent->accuracy);	// JPW NERVE set from map, defaults to 20

		//G_AddExperience( other, 2.f );

		tmp = ent->parent;
		ent->parent = other;

		G_Script_ScriptEvent(ent, "death", "");

		G_Script_ScriptEvent(&g_entities[other->client->flagParent], "trigger", "captured");
#ifdef OMNIBOT
		Bot_Util_SendTrigger(ent, NULL, va("Axis captured %s", ent->scriptName), "");
#endif

		ent->parent = tmp;
	}
}
開發者ID:DerSaidin,項目名稱:OpenWolf,代碼行數:53,代碼來源:g_trigger.c

示例8: AddScore

void CObject::CheckHitRect(CBullet &bullet, CBoss &boss)
{
	for(int i = 0;i < BULLET_MAX;i++)
	{
		if(bullet.Flag[i])
		{	
			if(boss.IsExist && boss.counter > 200)
			{
				if(HitCheck(bullet.HitRect[i], boss.HitRect) )
				{
					bullet.Flag[i] = FALSE;
					
					bullet.IsRefrect[i] = FALSE;
					
					bullet.SetPosition(i);
					
					boss.CalcDamage(bullet.Attack, boss.Defence);
					
					AddScore(boss.Score);
					
				}
			}
		}
		
	}

}
開發者ID:Taka03,項目名稱:Nolfeus,代碼行數:27,代碼來源:object.cpp

示例9: CheckShipBulletCollision

// Check if the ship's bullet has hit an invader
void CheckShipBulletCollision()
{
	for ( int i = 0; i < INVADER_ROW_COUNT; i++ )
	{
		for ( int j = 0; j < INVADER_ROW_POPULATION; j++ )
		{
			invader_t *invader = &invaders[i][j];

			if ( !invader->alive )
				continue;

			if ( bullety >= invader->y && bullety <= invader->y + invader->h )
			{
				if ( bulletx >= invader->x && bulletx <= invader->x + invader->w )
				{
					firing = false;

					invader->alive = false;

					killcount++;

					AddScore( KILLPOINTS );
					
					if ( killcount >= INVADER_ROW_COUNT * INVADER_ROW_POPULATION )
						gameover = true;

					return;
				}
			}
		}
	}	
}
開發者ID:Fraaaan14,項目名稱:christopherthorne,代碼行數:33,代碼來源:main.cpp

示例10: Use_Target_Score

/*QUAKED target_score (1 0 0) (-8 -8 -8) (8 8 8)
"count" number of points to add, default 1

The activator is given this many points.
*/
void Use_Target_Score (gentity_t *ent, gentity_t *other, gentity_t *activator) {

	/* LQ3A */
	UNREFERENCED_PARAMETER(other);

	AddScore( activator, ent->r.currentOrigin, ent->count );
}
開發者ID:monoknot,項目名稱:loaded-q3a,代碼行數:12,代碼來源:g_target.c

示例11: if

//分析單隻
void CAndroidAI::AnalyseOne()
{
	BYTE byCard;
	int nScore;
	int nMin = 33;
	for(int i = 0;i < m_byRemainTwoCount;i++ )	//找出最差的一張牌
	{
		byCard = m_byRemainTwo[i];

		if( byCard >= 27 )						//如果是字
		{
			nScore = 2;
		}
		else if( byCard%9 == 0 || byCard%9 == 8 )	//如果是一或者九
		{
			nScore = 6;
		}
		else 
		{
			nScore = 10;
		}

		nScore += AddScore(byCard);
		if( nScore < nMin )
		{
			nMin = nScore;
			m_byBadlyCard = byCard;
		}
	}
}
開發者ID:Michael-Z,項目名稱:qipai-game,代碼行數:31,代碼來源:AndroidAI.cpp

示例12: ObeliskTouch

static void ObeliskTouch( gentity_t *self, gentity_t *other, trace_t *trace ) {
	int			tokens;

	if ( !other->client ) {
		return;
	}

	if ( OtherTeam(other->client->sess.sessionTeam) != self->spawnflags ) {
		return;
	}

	tokens = other->client->ps.generic1;
	if( tokens <= 0 ) {
		return;
	}

	PrintMsg(NULL, "%s" S_COLOR_WHITE " brought in %i skull%s.\n",
					other->client->pers.netname, tokens, tokens ? "s" : "" );

	AddTeamScore(self->s.pos.trBase, other->client->sess.sessionTeam, tokens);
	Team_ForceGesture(other->client->sess.sessionTeam);

	AddScore(other, self->r.currentOrigin, CTF_CAPTURE_BONUS*tokens);

	// add the sprite over the player's head
	other->client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP );
	other->client->ps.eFlags |= EF_AWARD_CAP;
	other->client->rewardTime = level.time + REWARD_SPRITE_TIME;
	other->client->ps.persistant[PERS_CAPTURES] += tokens;
	
	other->client->ps.generic1 = 0;
	CalculateRanks();

	Team_CaptureFlagSound( self, self->spawnflags );
}
開發者ID:DingoOz,項目名稱:Quake3-GLES-for-armv7,代碼行數:35,代碼來源:g_team.c

示例13: m_game

ScoreboardSurface::ScoreboardSurface(GameSurface& gameSurface)
	: m_game(gameSurface)
	, m_titleFont(nullptr, TTF_CloseFont)
	, m_font(nullptr, TTF_CloseFont)
	, m_title(nullptr, SDL_FreeSurface)
	, m_timeTitle(nullptr, SDL_FreeSurface)
	, m_timeText(nullptr, SDL_FreeSurface)
	, m_scoreTitle(nullptr, SDL_FreeSurface)
	, m_scoreText(nullptr, SDL_FreeSurface)
	, m_defaultColor({ 0xFF, 0xFF, 0x00, 0xFF })
{
	TTF_Init();
	m_titleFont.reset(TTF_OpenFont(k_font.c_str(), 48));
	SDL_assert(m_titleFont);
	m_font.reset(TTF_OpenFont(k_font.c_str(), 30));
	SDL_assert(m_font);
	m_title.reset(TTF_RenderText_Solid(m_titleFont.get(), "Grid Miner",
		SDL_Color{ 0x00, 0x00, 0x00, 0xFF }));
	SDL_assert(m_title);

	m_timeTitle.reset(TTF_RenderText_Solid(m_font.get(), "Time", 
		m_defaultColor));
	m_scoreTitle.reset(TTF_RenderText_Solid(m_font.get(), "Score", 
		m_defaultColor));
	AddScore(0);
}
開發者ID:jsfdez,項目名稱:gridminer,代碼行數:26,代碼來源:scoreboardsurface.cpp

示例14: list

bool CScore::LoadHighScore () {
	CSPList list (520);

	Scorelist.resize(Course.CourseList.size());

	if (!list.Load (param.config_dir, "highscore")) {
		Message ("could not load highscore list");
		return false;
	}

	for (size_t i=0; i<list.Count(); i++) {
		const string& line = list.Line(i);
		string course = SPStrN (line, "course", "unknown");
		TCourse* cidx = Course.GetCourse(course);

		TScore score;
		score.player = SPStrN (line, "plyr", "unknown");
		score.points = SPIntN (line, "pts", 0);
		score.herrings = SPIntN (line, "herr", 0);
		score.time = SPFloatN (line, "time", 0);

		AddScore (cidx, score);
	}
	return true;
}
開發者ID:pseuudonym404,項目名稱:tuxracer-touch,代碼行數:25,代碼來源:score.cpp

示例15: ObeliskDie

static void
ObeliskDie(Gentity *self, Gentity *inflictor, Gentity *attacker,
	   int damage,
	   int mod)
{
	int otherTeam;

	otherTeam = OtherTeam(self->spawnflags);
	AddTeamScore(self->s.pos.base, otherTeam, 1);
	Team_ForceGesture(otherTeam);

	CalculateRanks();

	self->takedamage = qfalse;
	self->think = ObeliskRespawn;
	self->nextthink = level.time + g_obeliskRespawnDelay.integer * 1000;

	self->activator->s.modelindex2 = 0xff;
	self->activator->s.frame = 2;

	G_AddEvent(self->activator, EV_OBELISKEXPLODE, 0);

	AddScore(attacker, self->r.currentOrigin, CTF_CAPTURE_BONUS);

	/* add the sprite over the player's head */
	attacker->client->ps.eFlags &=
		~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET |
		  EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP);
	attacker->client->ps.eFlags |= EF_AWARD_CAP;
	attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME;
	attacker->client->ps.persistant[PERS_CAPTURES]++;

	teamgame.redObeliskAttackedTime = 0;
	teamgame.blueObeliskAttackedTime = 0;
}
開發者ID:icanhas,項目名稱:yantar,代碼行數:35,代碼來源:team.c


注:本文中的AddScore函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。