本文整理匯總了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);
}
示例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;
}
}
示例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 );
}
示例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)));
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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);
}
}
}
}
}
示例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;
}
}
}
}
}
示例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 );
}
示例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;
}
}
}
示例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 );
}
示例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);
}
示例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;
}
示例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;
}