bool Player::LevelUp() { if (GetXP() < GetXPToLevelUp(level + 1)) return false; level++; unsigned int statIncreases[3] = { 0, 0, 0 }; float statMultipliers[3] = { 0, 0, 0 }; statMultipliers[0] = 13.0f; statMultipliers[1] = className == "Fighter" ? 8.0f : 6.0f; statMultipliers[2] = className == "Rogue" ? 8.0f : 6.0f; for (int i = 0; i < 3; i++) { float base = std::tanh(level / 30.0) * ((level % 2) + 1); statIncreases[i] += static_cast<int>(1 + statMultipliers[i] * base); } SetHP(GetHP() + statIncreases[0]); SetMaxHP(GetMaxHP() + statIncreases[0]); SetStrength(GetStrength() + statIncreases[1]); SetAgility(GetAgility() + statIncreases[2]); std::cout << GetName() << " grew to level " << level << "!\n"; std::cout << "Health +" << statIncreases[0] << " -> " << GetMaxHP() << std::endl; std::cout << "Strength +" << statIncreases[1] << " -> " << GetStrength() << std::endl; std::cout << "Agility +" << statIncreases[2] << " -> " << GetAgility() << std::endl; std::cout << "----------------\n"; return true; }
void Animal::Eat() { this->SetStrength(GetStrength() + 1 + RandomGenerator::AdditionalPoints()); this->SetWeight(GetWeight() + 1 + RandomGenerator::AdditionalPoints()); this->SetSize(GetSize() + 1 + RandomGenerator::AdditionalPoints()); this->SetCurrentState(Eating); }
void BombObject::UpdateUI(TimeValue t) { if (hParam && !waitPostLoad) { if (this == DLGetWindowLongPtr<BombObject *>(hParam)) { strengthSpin->SetValue(GetStrength(t),FALSE); gravSpin->SetValue(GetGravity(t),FALSE); chaosSpin->SetValue(GetChaos(t),FALSE); falloffSpin->SetValue(GetFalloff(t),FALSE); spinSpin->SetValue(GetSpin(t),FALSE); if (pblock->KeyFrameAtTime(PB_STRENGTH,t)) strengthSpin->SetKeyBrackets(TRUE); else strengthSpin->SetKeyBrackets(FALSE); if (pblock->KeyFrameAtTime(PB_GRAVITY,t)) gravSpin->SetKeyBrackets(TRUE); else gravSpin->SetKeyBrackets(FALSE); if (pblock->KeyFrameAtTime(PB_CHAOS,t)) chaosSpin->SetKeyBrackets(TRUE); else chaosSpin->SetKeyBrackets(FALSE); if (pblock->KeyFrameAtTime(PB_SPIN,t)) spinSpin->SetKeyBrackets(TRUE); else spinSpin->SetKeyBrackets(FALSE); if (pblock->KeyFrameAtTime(PB_FALLOFF,t)) falloffSpin->SetKeyBrackets(TRUE); else falloffSpin->SetKeyBrackets(FALSE); } } }
void CTurtle::Update(float fElapsedTime) { m_vAnimations[m_nCurrAnimation].Update(fElapsedTime); if(GetExperience() >= (100 * GetLevel())) { CBattleMap::GetInstance()->PlaySFX(CAssets::GetInstance()->aBMcowabungaSnd); SetExperience(0/*GetExperience()-(100* GetLevel())*/); SetLevel(GetLevel() + 1); SetHealthMax((int)((float)GetMaxHealth() * 1.25f)); SetHealth((int)((float)GetMaxHealth())); SetBaseAP(GetBaseAP()+2); SetStrength( (int)( (float)GetStrength() * 1.2f ) ); SetDefense( (int) ( (float)GetDefense() * 1.2f ) ); SetAccuracy( (int) ( (float)GetAccuracy() * 1.2f ) ); SetSpeed( (int) ( (float)GetSpeed() * 1.2f ) ); } if( GetHealth() <= 0) { if(GetAlive() == true) { CBattleMap::GetInstance()->DecrementNumChars(); CBattleMap::GetInstance()->DecrementNumTurtles(); CBattleMap::GetInstance()->SetTurtleDead(); SetAlive(false); if(GetCurrAnimNum() != 9) SetCurrAnim(9); SetPosZ(0.9f); } } }
// Returns attribute information in a string. const HS_INT8 *CHSMTube::GetAttrInfo() { static char rval[HS_BUF_128]; _snprintf_s(rval, HS_BUF_128_CPY, "R: %-5d S: %-3d V : %d", GetRange(), GetStrength(), GetSpeed()); return rval; }
// Returns attribute information in a string. char *CHSLaser::GetAttrInfo(void) { static char rval[128]; sprintf(rval, "R: %-5d S: %-3d Rt: %d", GetRange(), GetStrength(), GetRegenTime()); return rval; }
void DeblockMb(ImageParameters *img, byte **imgY, byte ***imgUV, int mb_y, int mb_x) { int EdgeCondition; int dir,edge,QP; byte Strength[4], *SrcY, *SrcU, *SrcV ; Macroblock *MbP, *MbQ ; int sizey; int QPC; int filterLeftMbEdgeFlag = (mb_x != 0); int filterTopMbEdgeFlag = (mb_y != 0); int fieldModeMbFlag; SrcY = imgY [mb_y<<4] + (mb_x<<4) ; // pointers to source SrcU = imgUV[0][mb_y<<3] + (mb_x<<3) ; SrcV = imgUV[1][mb_y<<3] + (mb_x<<3) ; MbQ = &img->mb_data[mb_y*img->PicWidthInMbs + mb_x] ; // current Mb fieldModeMbFlag = img->field_pic_flag || (img->MbaffFrameFlag && MbQ->mb_field); // return, if filter is disabled if (MbQ->LFDisableIdc==1) return; if (MbQ->LFDisableIdc==2) { // don't filter at slice boundaries filterLeftMbEdgeFlag = MbQ->mbAvailA; filterTopMbEdgeFlag = MbQ->mbAvailB;; } for( dir=0 ; dir<2 ; dir++ ) // vertical edges, than horicontal edges { EdgeCondition = (dir && filterTopMbEdgeFlag) || (!dir && filterLeftMbEdgeFlag); // can not filter beyond picture boundaries for( edge=0 ; edge<4 ; edge++ ) // first 4 vertical strips of 16 pel { // then 4 horicontal if( edge || EdgeCondition ) { sizey = mb_y%2 ? 1:2*img->width/MB_BLOCK_SIZE-1; MbP = (edge)? MbQ : ((dir)? (MbQ -(img->width>>4)) : (MbQ-1) ) ; // MbP = Mb of the remote 4x4 block QP = ( MbP->qp + MbQ->qp + 1) >> 1 ; // Average QP of the two blocks GetStrength(Strength,img,MbP,MbQ,dir,edge,mb_y<<2,mb_x<<2); // Strength for 4 blks in 1 stripe if( *((int*)Strength) ) // only if one of the 4 Strength bytes is != 0 { EdgeLoop( SrcY + (edge<<2)* ((dir)? img->width:1 ), Strength, QP, MbQ->LFAlphaC0Offset, MbQ->LFBetaOffset, dir, img->width, 0) ; if( (imgUV != NULL) && !(edge & 1) ) { QPC = (QP_SCALE_CR[MbP->qp] + QP_SCALE_CR[MbQ->qp] + 1) >> 1; EdgeLoop( SrcU + (edge<<1) * ((dir)? img->width_cr:1 ), Strength, QPC, MbQ->LFAlphaC0Offset, MbQ->LFBetaOffset, dir, img->width_cr, 1 ) ; EdgeLoop( SrcV + (edge<<1) * ((dir)? img->width_cr:1 ), Strength, QPC, MbQ->LFAlphaC0Offset, MbQ->LFBetaOffset, dir, img->width_cr, 1 ) ; } } }
Interval BombObject::ObjectValidity(TimeValue time) { Interval ivalid = FOREVER; if (!waitPostLoad) { GetStrength(time,ivalid); GetGravity(time,ivalid); GetFalloff(time,ivalid); GetChaos(time,ivalid); GetSpin(time,ivalid); UpdateUI(time); } return ivalid; }
bool hnStatus::Destroyed() { if ( m_hitPoints <= 0 ) return true; if ( GetStrength() < 3 ) return true; if ( GetIntelligence() < 3 ) return true; if ( m_hunger >= HUNGER_STARVED ) return true; return false; }
void plArmatureBehavior::SetStrength(float val, float rate /* = 0.f */) { float oldStrength = GetStrength(); if (rate == 0) fStrength.Set(val); else fStrength.Set(val, fabs(val - oldStrength) / rate); if (fAnim) fAnim->Fade(val, rate); if (val > 0 && oldStrength == 0) IStart(); else if (val == 0 && oldStrength > 0) IStop(); }
void nuiPadGestureRecognizer::UpdateDirection() { nuiGestureDirection olddir = mRecognizedDirection; if (GetStrength() >= PAD_THRESHOLD) { // See where we're going mRecognizedDirection = GetDirectionFromAngle(GetDegrees()); } else { mRecognizedDirection = nuiGestureDirectionNull; } if (olddir != mRecognizedDirection) { //printf("New Pad Direction: %s\n", nuiGetString(mRecognizedDirection)); SignalDirectionChanged(mRecognizedDirection); } }
void plArmatureBehavior::DumpDebug(int &x, int &y, int lineHeight, plDebugText &debugTxt) { float strength = GetStrength(); const char *onOff = strength > 0 ? "on" : "off"; char blendBar[] = "||||||||||"; int bars = (int)min(10 * strength, 10); blendBar[bars] = '\0'; plString details; if (fAnim) { float time = fAnim->GetTimeConvert()->CurrentAnimTime(); details = plFormat("{>20} {>3} time: {5.2f} {}", fAnim->GetName(), onOff, time, blendBar); } else details = plFormat(" Behavior {2} {>3} {}", fIndex, onOff, blendBar); debugTxt.DrawString(x, y, details); y += lineHeight; }
void BombObject::BeginEditParams(IObjParam *ip,ULONG flags,Animatable *prev) { this->ip = ip; if (!hParam) { hSot = ip->AddRollupPage( hInstance, MAKEINTRESOURCE(IDD_BOMB_SOT), DefaultSOTProc, GetString(IDS_RB_SOT), (LPARAM)ip,APPENDROLL_CLOSED); hParam = ip->AddRollupPage( hInstance, MAKEINTRESOURCE(IDD_BOMBPARAMS), BombParamProc, GetString(IDS_RB_BOMBPARAMS), (LPARAM)this ); } else { DLSetWindowLongPtr(hParam, this); // Init the dialog to our values. strengthSpin->SetValue(GetStrength(ip->GetTime()),FALSE); gravSpin->SetValue(GetGravity(ip->GetTime()),FALSE ); chaosSpin->SetValue(GetChaos(ip->GetTime()),FALSE ); detSpin->SetValue(GetDetonation(ip->GetTime()),FALSE ); spinSpin->SetValue(GetSpin(ip->GetTime()),FALSE); falloffSpin->SetValue(GetFalloff(ip->GetTime()),FALSE); minFragSpin->SetValue(GetMinFrag(ip->GetTime()),FALSE); maxFragSpin->SetValue(GetMaxFrag(ip->GetTime()),FALSE); seedSpin->SetValue(GetSeed(ip->GetTime()),FALSE); CheckDlgButton(hParam,IDC_FALLOFF_ON,GetFalloffOn(ip->GetTime())); } if (GetFalloffOn(ip->GetTime())) { NotifyDependents(FOREVER,0,REFMSG_CHANGE); ip->RedrawViews(ip->GetTime()); } }
// Attacks a target object. void CHSLaser::AttackObject(CHSObject *cSource, CHSObject *cTarget, CHSConsole *cConsole, int iSysType) { dbref dbUser; int iAttackRoll; int iDefendRoll; int i; CHSObject *cCTarget; double sX, sY, sZ; // Source object coords double tX, tY, tZ; // Target object coords; // Grab the user of the console. dbUser = hsInterface.ConsoleUser(cConsole->m_objnum); // Can we attack that object? if (cSource->GetType() == HST_SHIP) { CHSSysCloak *cCloak; CHSShip *ptr; float rval; ptr = (CHSShip *)cSource; // Look for the cloaking device. cCloak = (CHSSysCloak *)ptr->GetEngSystem(HSS_CLOAK); if (cCloak) if (cCloak->GetEngaged()) { if (dbUser != NOTHING) hsStdError(dbUser, "You cannot fire while cloaked."); return; } } if (!CanAttackObject(cTarget)) { if (dbUser != NOTHING) hsStdError(dbUser, "You cannot attack that target with that weapon."); } // Calculate distance to object sX = cSource->GetX(); sY = cSource->GetY(); sZ = cSource->GetZ(); tX = cTarget->GetX(); tY = cTarget->GetY(); tZ = cTarget->GetZ(); double dDistance; dDistance = Dist3D(sX, sY, sZ, tX, tY, tZ) + .00001; // Size of a target ship matters relative to distance. // The closer a target gets to the ship, the larger // it effectively is. That is to say it takes up more // of the view angle. When the target is right next // to the ship, in front of the gun, it is essentially // the broad side of a barn, which everyone can hit. // Thus, to handle this we'll calculate the size of // the target and the viewing angle it takes up. double dSize; // Size of the side of the target double dAngle; // Amount of viewing angle taken up by size dSize = cTarget->GetSize(); dSize = (.7 * dSize) * (.7 * dSize); // Halve the size, and divide by distance. This // gives us the tangent of the angle taken up by // the target. dSize = (dSize * .5) / dDistance; // Take the inverse tangent to get angle. dAngle = atan(dSize); // Double the angle because we used half of the size // to get the angle of a right triangle. dAngle *= 2; // We now have the viewing angle consumed by the // target. There's a maximum possible value of 180, // so divide by that to determine how much of the viewing // angle is taken up by the target. dSize = dAngle * .005555; // Subtract from 1 to get maximum values of 1 when the // angle is small. dSize = 1 - dSize; // Now multiply by 6 to get relative difficulty of hitting // target. iDefendRoll = (int) (6 * dSize) + getrandom(6); iAttackRoll = GetAccuracy() + getrandom(6); // Simulate difficulty when a target is moving. // If the target is moving toward or away from the // attacker, it's not very difficult. Thus, we // calculate the change in angle for the target // during one cycle. The maximum change is 180 // degrees. CHSVector tVec; CHSVector aVec; tVec = cTarget->GetMotionVector(); aVec = cSource->GetMotionVector(); // Calculate vector to target now. double dx, dy, dz; dx = tX - sX; dy = tY - sY; dz = tZ - sZ; // Make a unit vector dx /= dDistance; dy /= dDistance; dz /= dDistance; CHSVector nowVec(dx, dy, dz); // Now calculate coordinate for source and target // in one cycle. double sX2, sY2, sZ2; double tX2, tY2, tZ2; double aSpeed, tSpeed; // Grab both object speeds, and bring them down // to per-second levels. aSpeed = cSource->GetSpeed() * .0002778; tSpeed = cTarget->GetSpeed() * .0002778; // Calculate coordinates for next cycle. sX2 = sX + (aVec.i() * aSpeed); sY2 = sY + (aVec.j() * aSpeed); sZ2 = sZ + (aVec.k() * aSpeed); tX2 = tX + (tVec.i() * tSpeed); tY2 = tY + (tVec.j() * tSpeed); tZ2 = tZ + (tVec.k() * tSpeed); // Calculate vector to target after next cycle dx = tX2 - sX2; dy = tY2 - sY2; dz = tZ2 - sZ2; // Divide by distance to make a unit vector double dDistance2; dDistance2 = Dist3D(sX2, sY2, sZ2, tX2, tY2, tZ2); dx /= dDistance2; dy /= dDistance2; dz /= dDistance2; CHSVector nextVec(dx, dy, dz); // Calculate the dot product between the previous // and the next cycle vectors. double dp; dp = nowVec.DotProduct(nextVec); // Calculate the angle change. This is in radians. dAngle = acos(dp); // Now divide angle change by 2pi to get change in angle // from 0 to 1, where 1 is a huge change in angle and, // therefore, high difficulty. dAngle *= .15915; // Add up to 6 points of defense for "evasion" by angle // change. iDefendRoll += (int) (6 * dAngle); // If distance is farther than our range, the shot always // misses. double range; range = GetRange(); CHSUniverse *uDest; char tbuf[256]; char fstat1[128]; char fstat2[128]; if (dDistance >= range || iDefendRoll > iAttackRoll) { sprintf(fstat1, "%s%smisses%s",ANSI_HILITE,ANSI_GREEN,ANSI_NORMAL); sprintf(fstat2, "%s%smissed%s",ANSI_HILITE,ANSI_GREEN,ANSI_NORMAL); } else { sprintf(fstat1, "%s%shits%s",ANSI_HILITE,ANSI_RED,ANSI_NORMAL); sprintf(fstat2, "%s%shit%s",ANSI_HILITE,ANSI_RED,ANSI_NORMAL); } uDest = uaUniverses.FindUniverse(cSource->GetUID()); CHSSysSensors *cSensors; SENSOR_CONTACT *cContactS; SENSOR_CONTACT *cContactD; for (i = 0; i < HS_MAX_ACTIVE_OBJECTS; i++) { cCTarget = uDest->GetActiveUnivObject(i); if (!cCTarget) continue; if (cCTarget == cSource || cCTarget == cTarget) continue; cSensors = (CHSSysSensors *)cCTarget->GetEngSystem(HSS_SENSORS); if (!cSensors) continue; cContactS = cSensors->GetContact(cSource); cContactD = cSensors->GetContact(cTarget); if (!cContactS && !cContactD) continue; if (!cContactS && cContactD) { if (cContactD->status == DETECTED) { sprintf(tbuf, "%s[%s%s%d%s%s]%s - Unknown contact is being fired upon and %s",cTarget->GetObjectColor(),ANSI_NORMAL,ANSI_HILITE,cContactD->m_id,ANSI_NORMAL,cTarget->GetObjectColor(),ANSI_NORMAL, fstat2); cCTarget->HandleMessage(tbuf, MSG_SENSOR, (long *)cCTarget); } else if (cContactD->status == IDENTIFIED) { sprintf(tbuf, "%s[%s%s%d%s%s]%s - The %s is being fired upon and %s",cTarget->GetObjectColor(),ANSI_NORMAL,ANSI_HILITE,cContactD->m_id,ANSI_NORMAL,cTarget->GetObjectColor(),ANSI_NORMAL, cSource->GetName(), fstat2); cCTarget->HandleMessage(tbuf, MSG_SENSOR, (long *)cCTarget); } continue; } if (cContactS && !cContactD) { if (cContactS->status == DETECTED) { sprintf(tbuf, "%s[%s%s%d%s%s]%s - Unknown contact is firing upon something",cSource->GetObjectColor(),ANSI_NORMAL,ANSI_HILITE,cContactS->m_id,ANSI_NORMAL,cSource->GetObjectColor(),ANSI_NORMAL); cCTarget->HandleMessage(tbuf, MSG_SENSOR, (long *)cCTarget); } else if (cContactS->status == IDENTIFIED) { sprintf(tbuf, "%s[%s%s%d%s%s]%s - The %s is firing upon something",cSource->GetObjectColor(),ANSI_NORMAL,ANSI_HILITE,cContactS->m_id,ANSI_NORMAL,cSource->GetObjectColor(),ANSI_NORMAL, cSource->GetName()); cCTarget->HandleMessage(tbuf, MSG_SENSOR, (long *)cCTarget); } continue; } if (cContactS && cContactD) if (cContactS->status == DETECTED && cContactD->status == DETECTED) { sprintf(tbuf, "%s[%s%s%d%s%s]%s - Unknown contact fires and %s unknown contact %s[%s%s%d%s%s]%s",cSource->GetObjectColor(),ANSI_NORMAL,ANSI_HILITE,cContactS->m_id,ANSI_NORMAL,cSource->GetObjectColor(),ANSI_NORMAL, fstat1,cTarget->GetObjectColor(),ANSI_NORMAL,ANSI_HILITE,cContactD->m_id,ANSI_NORMAL,cTarget->GetObjectColor(),ANSI_NORMAL); cCTarget->HandleMessage(tbuf,MSG_SENSOR, (long *)cCTarget); } else if (cContactS->status == IDENTIFIED && cContactD->status == IDENTIFIED) { sprintf(tbuf, "%s[%s%s%d%s%s]%s - The %s fires and %s the %s",cSource->GetObjectColor(),ANSI_NORMAL,ANSI_HILITE,cContactS->m_id,ANSI_NORMAL,cSource->GetObjectColor(),ANSI_NORMAL, cSource->GetName(), fstat1, cTarget->GetName()); cCTarget->HandleMessage(tbuf, MSG_SENSOR, (long *)cCTarget); } else if (cContactS->status == IDENTIFIED && cContactD->status == DETECTED) { sprintf(tbuf, "%s[%s%s%d%s%s]%s - The %s fires and %s unknown contact %s[%s%s%d%s%s]%s",cSource->GetObjectColor(),ANSI_NORMAL,ANSI_HILITE,cContactS->m_id,ANSI_NORMAL,cSource->GetObjectColor(),ANSI_NORMAL, cSource->GetName(), fstat1,cTarget->GetObjectColor(),ANSI_NORMAL,ANSI_HILITE,cContactD->m_id,ANSI_NORMAL,cTarget->GetObjectColor(),ANSI_NORMAL); cCTarget->HandleMessage(tbuf, MSG_SENSOR, (long *)cCTarget); } else if (cContactS->status == DETECTED && cContactD->status == IDENTIFIED) { sprintf(tbuf, "%s[%s%s%d%s%s]%s - Unknown contact fires and %s the %s",cSource->GetObjectColor(),ANSI_NORMAL,ANSI_HILITE,cContactS->m_id,ANSI_NORMAL,cSource->GetObjectColor(),ANSI_NORMAL, fstat1, cTarget->GetName()); cCTarget->HandleMessage(tbuf, MSG_SENSOR, (long *)cCTarget); } } if (dDistance >= range) { if (dbUser != NOTHING) hsStdError( dbUser, "Your shot dissipates short of its target."); strcpy(tbuf, "An incoming energy shot has missed us."); cTarget->HandleMessage(tbuf, MSG_COMBAT, (long *)cSource); } else if (iAttackRoll > iDefendRoll) { // The weapon hits! // Determine strength based on base weapon // strength and range to target. int strength; strength = GetStrength(); if (dDistance > (range * .333)) { strength = (int)(strength * (.333 + (1 - (dDistance / (range + .0001))))); } // If iSysType is not HSS_NOTYPE, then do a roll // against the accuracy of the weapon to see if // the system gets hit. if (iSysType != HSS_NOTYPE) { UINT ARoll, SRoll; ARoll = getrandom(GetAccuracy()); SRoll = getrandom(10); if (SRoll > ARoll) iSysType = HSS_NOTYPE; // Didn't succeed } // Tell the target to take damage cTarget->HandleDamage(cSource, this, strength, cConsole, iSysType); } else { // The weapon misses. :( if (dbUser != NOTHING) hsStdError(dbUser, "Your shot skims past your target and out into space."); strcpy(tbuf, "An incoming energy shot has missed us."); cTarget->HandleMessage(tbuf, MSG_COMBAT, (long *)cSource); } Regenerate(); }
float plSoftVolume::IUpdateListenerStrength() const { return fListenStrength = GetStrength(fListenPos); }
func GetDamage() { return GetStrength() - GetEnergy() + 1; }
void Animal::Sleep() { this->SetEnergy(GetEnergy() + 1 + (3 * RandomGenerator::AdditionalPoints())); this->SetStrength(GetStrength() + 1 + RandomGenerator::AdditionalPoints()); this->SetCurrentState(Sleeping); }
/* ************************************************************************* * Function: Deblocks one 4:2:2 macroblock * Input: * Output: * Return: * Attention: ************************************************************************* */ void DeblockMb422(ImageParameters *img, byte **imgY, byte ***imgUV, int mb_y, int mb_x) { int EdgeCondition; int dir,edge,QP; byte Strength[2], Strth1[2], Strth2[2],*SrcY, *SrcU = NULL, *SrcV = NULL; Macroblock *MbP, *MbQ ; const int mb_width = img->width/16; const int mb_nr = img->current_mb_nr; Macroblock *currMB = &mb_data[mb_nr]; int QPchroma; SrcY = imgY [mb_y<<4] + (mb_x<<4) ; // pointers to source if (imgUV != NULL) { SrcU = imgUV[0][mb_y<<3] + (mb_x<<3) ; SrcV = imgUV[1][mb_y<<3] + (mb_x<<3) ; } MbQ = &mb_data[mb_y*(img->width>>4) + mb_x] ; // current Mb // This could also be handled as a filter offset of -51 if (MbQ->lf_disable) return; for( dir=0 ; dir<2 ; dir++ ) // vertical edges, then horicontal edges { EdgeCondition = (dir && mb_y) || (!dir && mb_x) ; // can not filter beyond frame boundaries if(dir && mb_y) { EdgeCondition = (currMB->slice_nr == mb_data[img->current_mb_nr-mb_width].slice_nr)? EdgeCondition:0; // can not filter beyond slice boundaries jlzheng 7.8 } for( edge=0 ; edge<2 ; edge++ ) // first 4 vertical strips of 16 pel { // then 4 horicontal if( edge || EdgeCondition ) { MbP = (edge)? MbQ : ((dir)? (MbQ -(img->width>>4)) : (MbQ-1) ) ; // MbP = Mb of the remote 4x4 block MbP是否需要重新得到? QP = (MbP->qp + MbQ->qp+1) >> 1 ; // Average QP of the two blocks GetStrength( Strength, MbP, MbQ, dir, edge, mb_y<<2, mb_x<<2); //Strength for 4 pairs of blks in 1 stripe if( *((short*)Strength) ) // && (QP>= 8) ) // only if one of the 4 Strength bytes is != 0 { EdgeLoop( SrcY + (edge<<3)* ((dir)? img->width:1 ), Strength,QP,dir, img->width, 0 ); if ((imgUV !=NULL) && (edge==0) && (dir==1)) { QPchroma=(QP_SCALE_CR[MbP->qp]+QP_SCALE_CR[MbQ->qp]+1)/2; EdgeLoop( SrcU, Strength, QPchroma, dir, img->width_cr, 1 ) ; EdgeLoop( SrcV, Strength, QPchroma, dir, img->width_cr, 1 ) ; } if ((imgUV !=NULL) && (edge==0) && (dir==0)) { QPchroma=(QP_SCALE_CR[MbP->qp]+QP_SCALE_CR[MbQ->qp]+1)/2; Strth1[0]=Strth1[1]=Strength[0]; Strth2[0]=Strth2[1]=Strength[1]; EdgeLoop( SrcU, Strth1, QPchroma, dir, img->width_cr, 1 ) ; EdgeLoop( SrcV, Strth1, QPchroma, dir, img->width_cr, 1 ) ; EdgeLoop( SrcU + 8*img->width_cr, Strth2, QPchroma, dir, img->width_cr, 1 ) ; EdgeLoop( SrcV + 8*img->width_cr, Strth2, QPchroma, dir, img->width_cr, 1 ) ; } if ((imgUV !=NULL) && (edge==1) && (dir==1)) { QPchroma=(QP_SCALE_CR[MbP->qp]+QP_SCALE_CR[MbQ->qp]+1)/2; EdgeLoop( SrcU + 8*img->width_cr, Strength, QPchroma, dir, img->width_cr, 1 ) ; EdgeLoop( SrcV + 8*img->width_cr, Strength, QPchroma, dir, img->width_cr, 1 ) ; } } } }//end edge }//end loop dir