void CDlgObjectManager::OnObjmngProperties() { if(!m_hI) return; CCriticalSection cs; cs.Lock(); CMyObject* pObj; pObj = FindObj(m_hI); if(pObj && m_pDoc) { pObj->Properties(); m_tree.SetItemText(m_hI, pObj->GetIdName()); if(m_pDoc) { m_pDoc->SetModifiedFlag(); if( pObj->IsKindOf(RUNTIME_CLASS( CImgReferenced )) ) m_pDoc->UpdateAllViews(NULL, UPDATE_BITMAP_CAHNGED); else if( pObj->IsKindOf(RUNTIME_CLASS(CGridObj)) ) m_pDoc->UpdateAllViews(NULL, UPDATE_LEADHRZ_CAHNGED); else if( pObj->IsKindOf(RUNTIME_CLASS(CData3D)) ) m_pDoc->UpdateAllViews(NULL, UPDATE_DATA3D_CHANGED); else m_pDoc->UpdateAllViews(NULL); m_hI = NULL; } return; } CBody* pBd; pBd = (CBody*) FindBody(m_hI); if(pBd && m_pDoc) { pBd->Properties(); m_tree.SetItemText( m_hI, pBd->GetStrIdName() ); m_hI = NULL; } }
bool IRenderSystem::findRenderNode( IRenderable* obj , RenderNode& node ) { node = std::find_if( mRenderList.begin() , mRenderList.end() , FindObj(obj) ); if ( node != mRenderList.end() ) return true; return false; }
void CPersistantDebug::AddEntityTag(const SEntityTagParams& params, const char *tagContext) { // Create tag SEntityTag tag; tag.params = params; tag.params.column = max(1, tag.params.column); tag.params.visibleTime = max(0.f, tag.params.visibleTime); tag.params.fadeTime = max(0.f, tag.params.fadeTime); if (tagContext != NULL && *tagContext != '\0') tag.params.tagContext = tagContext; tag.totalTime = tag.params.visibleTime + tag.params.fadeTime; tag.totalFadeTime = tag.params.fadeTime; tag.vScreenPos.zero(); SObj *obj = FindObj(params.entity); if (!obj) { // Create new object to push back SObj sobj; sobj.obj = eOT_EntityTag; sobj.entityId = params.entity; sobj.entityHeight = 0.f; sobj.timeRemaining = tag.totalTime; sobj.totalTime = tag.totalTime; sobj.columns.resize(params.column); AddToTagList(sobj.tags, tag); m_objects[entityTagsContext].push_back(sobj); } else { obj->timeRemaining = max(obj->timeRemaining, tag.totalTime); obj->totalTime = obj->timeRemaining; int size = max(int(obj->columns.size()), params.column); if (obj->columns.size() < size) obj->columns.resize(size); AddToTagList(obj->tags, tag); } if (m_pETLog->GetIVal() > 0) { IEntity *ent = gEnv->pEntitySystem->GetEntity(params.entity); if (ent) { CryLog("[Entity Tag] %s added tag: %s", ent->GetName(), params.text.c_str()); if (m_pETLog->GetIVal() > 1) { char text[256]; _snprintf(text, sizeof(text), "[Entity Tag] %s", params.text.c_str()); gEnv->pAISystem->Record(ent->GetAI(), IAIRecordable::E_NONE, text); } } } }
void CSpaceObjectList::Add (CSpaceObject *pObj, int *retiIndex) // Add // // Add object to the list. If the object is already in the list, we // don't add it. { if (FindObj(pObj)) return; FastAdd(pObj, retiIndex); }
void CPersistantDebug::ClearStaticTag(EntityId entityId, const char *staticId) { SObj *obj = FindObj(entityId); if (obj && staticId) { for (TListTag::iterator iterList = obj->tags.begin(); iterList != obj->tags.end(); ++iterList) { if (iterList->params.staticId.compare(staticId) == 0) { obj->tags.erase(iterList); break; } } } }
bool CSpaceObjectList::Remove (CSpaceObject *pObj) // Remove // // Remove the object. Returns TRUE if we removed the object. { int iIndex; if (FindObj(pObj, &iIndex)) { Remove(iIndex); return true; } return false; }
void CTextureAssembler::AccumulateRMResources(hgeResourceManager *rm, int resgroup, char *mask_set, bool bMaskInclusive) { ResDesc *resdesc; // RES_SPRITE resdesc = rm->res[7]; while(resdesc) { if(!resgroup || resdesc->resgroup == resgroup) if(CheckMask(resdesc->name, mask_set, bMaskInclusive)) if(!FindObj(obj_list, resdesc->name)) { obj_list.push_back(new CSpriteObject((hgeSprite *)resdesc->Get(rm), resdesc->name, resdesc->resgroup, false)); } resdesc = resdesc->next; } }
void CDlgObjectManager::OnNMDblclkTree(NMHDR *pNMHDR, LRESULT *pResult) { if( m_pDoc == NULL) return; CMyObject* pObj; HTREEITEM hI; CPoint pt; UINT uFlags; CRect rc; GetCursorPos(&pt); m_tree.GetWindowRect(&rc); pt.x -= rc.left; pt.y -= rc.top; hI = m_tree.HitTest( pt, &uFlags); pObj = FindObj(hI); if(pObj && m_pDoc && (TVHT_ONITEM & uFlags)) { pObj->Properties(); m_tree.SetItemText(hI, pObj->GetIdName()); if(m_pDoc) { m_pDoc->SetModifiedFlag(); if( pObj->IsKindOf(RUNTIME_CLASS( CImgReferenced )) ) m_pDoc->UpdateAllViews(NULL, UPDATE_BITMAP_CAHNGED); else if( pObj->IsKindOf(RUNTIME_CLASS(CGridObj)) ) m_pDoc->UpdateAllViews(NULL, UPDATE_LEADHRZ_CAHNGED); else if( pObj->IsKindOf(RUNTIME_CLASS(CData3D)) ) m_pDoc->UpdateAllViews(NULL, UPDATE_DATA3D_CHANGED); else m_pDoc->UpdateAllViews(NULL); } } CBody* pBd; pBd = (CBody*) FindBody(hI); if(pBd && m_pDoc && (TVHT_ONITEM & uFlags)) { pBd->Properties(); m_tree.SetItemText( hI, pBd->GetStrIdName() ); } pNMHDR->code = 0; *pResult = 0; }
void CDlgObjectManager::OnNMRclickTree(NMHDR *pNMHDR, LRESULT *pResult) { if( m_pDoc == NULL) return; CMyObject* pObj; HTREEITEM hI; CPoint pt, ptMenu; UINT uFlags; CRect rc; GetCursorPos(&pt); ptMenu=pt; m_tree.GetWindowRect(&rc); pt.x -= rc.left; pt.y -= rc.top; hI = m_tree.HitTest( pt, &uFlags); pObj = FindObj(hI); if(pObj && (uFlags==TVHT_ONITEMLABEL) ){ m_hI = hI; CMenu menu; CRect wndRect; this->GetWindowRect(wndRect); menu.LoadMenu(IDR_MENU_OBJMNG); CMenu* subMenu = menu.GetSubMenu(0); subMenu->TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON , ptMenu.x, ptMenu.y, this); } CBody* pBd; pBd = (CBody*) FindBody(hI); if(pBd && (uFlags==TVHT_ONITEMLABEL) ) { m_hI = hI; CMenu menu; CRect wndRect; this->GetWindowRect(wndRect); menu.LoadMenu(IDR_MENU_OBJMNG); CMenu* subMenu = menu.GetSubMenu(0); subMenu->TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON , ptMenu.x, ptMenu.y, this); } *pResult = 0; }
void CPersistantDebug::ClearTagContext(const char *tagContext, EntityId entityId) { if (!tagContext) return; SObj *obj = FindObj(entityId); if (obj) { for (TListTag::iterator iterList = obj->tags.begin(); iterList != obj->tags.end();) { if (iterList->params.tagContext.compare(tagContext) != 0) { ++iterList; } else { TListTag::iterator nextIter = obj->tags.erase(iterList); iterList = nextIter; } } } }
void CDlgObjectManager::OnNMClickTree(NMHDR *pNMHDR, LRESULT *pResult) { if( m_pDoc == NULL) return; CMyObject* pObj; HTREEITEM hI; CPoint pt; UINT uFlags; CRect rc; GetCursorPos(&pt); m_tree.GetWindowRect(&rc); pt.x -= rc.left; pt.y -= rc.top; hI = m_tree.HitTest( pt, &uFlags); pObj = FindObj(hI); if(pObj && (uFlags==64)) { pObj->Show( !m_tree.GetCheck(hI) ); if(m_pDoc) { m_pDoc->UpdateAllViews(NULL, UPDATE_OBJECT_MANAGER_SHOW); //if( pObj->IsKindOf(RUNTIME_CLASS( CImgReferenced )) ) // m_pDoc->UpdateAllViews(NULL, UPDATE_BITMAP_DELETE); //if( pObj->IsKindOf(RUNTIME_CLASS(CGridObj)) ) // m_pDoc->UpdateAllViews(NULL, UPDATE_LEADHRZ_DELETE); } } CBody* pBd; pBd = (CBody*) FindBody(hI); if(pBd && (uFlags==64)) { pBd->Show( !m_tree.GetCheck(hI) ); if(m_pDoc) m_pDoc->UpdateAllViews(NULL, UPDATE_OBJECT_MANAGER_SHOW); } pNMHDR->code = 0; *pResult = 0; }
void CTextureAssembler::AccumulateFileResources(char *wildcard, int resgroup, char *mask_set, bool bMaskInclusive) { HANDLE hSearch; WIN32_FIND_DATA SearchData; char filename[MAX_PATH]; char temp[MAX_PATH]; char *buf; HTEXTURE tex; hgeSprite *spr; hSearch = FindFirstFile(wildcard, &SearchData); if(hSearch == INVALID_HANDLE_VALUE) { SysLog("Can't find the path: %s\n", wildcard); return; } do { // recurse subfolders if(SearchData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if(SearchData.cFileName[0] == '.') continue; strcpy(filename, wildcard); buf=strrchr(filename, '\\'); if(!buf) buf=filename; else buf++; strcpy(temp, buf); strcpy(buf, SearchData.cFileName); strcat(filename, "\\"); strcat(filename, temp); AccumulateFileResources(filename, resgroup, mask_set, bMaskInclusive); } // process a file else { if(CheckMask(SearchData.cFileName, mask_set, bMaskInclusive)) if(!FindObj(obj_list, SearchData.cFileName)) { strcpy(filename, wildcard); buf=strrchr(filename, '\\'); if(!buf) buf=filename; else buf++; strcpy(buf, SearchData.cFileName); tex = hge->Texture_Load(filename); if(!tex) { SysLog("Can't load texture: %s\n", filename); continue; } spr = new hgeSprite(tex, 0, 0, (float)hge->Texture_GetWidth(tex, true), (float)hge->Texture_GetHeight(tex, true)); buf = new char[strlen(SearchData.cFileName)+1]; strcpy(buf, SearchData.cFileName); obj_list.push_back(new CSpriteObject(spr, buf, resgroup, true)); } } } while(FindNextFile(hSearch, &SearchData)); FindClose(hSearch); }
void HourlyLarryUpdate( void ) { SOLDIERTYPE * pSoldier; INT8 bSlot, bBoozeSlot; INT8 bLarryItemLoop; UINT16 usTemptation = 0; UINT16 usCashAmount; BOOLEAN fBar = FALSE; pSoldier = FindSoldierByProfileID( LARRY_NORMAL, TRUE ); if ( !pSoldier ) { pSoldier = FindSoldierByProfileID( LARRY_DRUNK, TRUE ); } if ( pSoldier ) { if ( pSoldier->bAssignment >= ON_DUTY ) { return; } if ( pSoldier->fBetweenSectors ) { return; } if ( pSoldier->bActive && pSoldier->bInSector && (gTacticalStatus.fEnemyInSector || guiCurrentScreen == GAME_SCREEN ) ) { return; } // look for items in Larry's inventory to maybe use for ( bLarryItemLoop = 0; bLarryItemLoop < NUM_LARRY_ITEMS; bLarryItemLoop++ ) { bSlot = FindObj( pSoldier, LarryItems[ bLarryItemLoop ][ 0 ] ); if ( bSlot != NO_SLOT ) { usTemptation = LarryItems[ bLarryItemLoop ][ 1 ]; break; } } // check to see if we're in a bar sector, if we are, we have access to alcohol // which may be better than anything we've got... if ( usTemptation < BAR_TEMPTATION && GetCurrentBalance() >= Item[ ALCOHOL ].usPrice ) { if ( pSoldier->bSectorZ == 0 && ( ( pSoldier->sSectorX == 13 && pSoldier->sSectorY == MAP_ROW_B) || ( pSoldier->sSectorX == 13 && pSoldier->sSectorY == MAP_ROW_C) || ( pSoldier->sSectorX == 5 && pSoldier->sSectorY == MAP_ROW_C) || ( pSoldier->sSectorX == 6 && pSoldier->sSectorY == MAP_ROW_C) || ( pSoldier->sSectorX == 5 && pSoldier->sSectorY == MAP_ROW_D) || ( pSoldier->sSectorX == 2 && pSoldier->sSectorY == MAP_ROW_H) ) ) { // in a bar! fBar = TRUE; usTemptation = BAR_TEMPTATION; } } if ( usTemptation > 0 ) { if ( pSoldier->ubProfile == LARRY_NORMAL ) { gMercProfiles[ LARRY_NORMAL ].bNPCData += (INT8) Random( usTemptation ); if ( gMercProfiles[ LARRY_NORMAL ].bNPCData >= LARRY_FALLS_OFF_WAGON ) { if ( fBar ) { // take $ from player's account usCashAmount = Item[ ALCOHOL ].usPrice; AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, pSoldier->ubProfile, GetWorldTotalMin() , -( usCashAmount ) ); // give Larry some booze and set slot etc values appropriately bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, SMALLPOCK8POS ); if ( bBoozeSlot != NO_SLOT ) { // give Larry booze here CreateItem( ALCOHOL, 100, &(pSoldier->inv[bBoozeSlot]) ); } bSlot = bBoozeSlot; bLarryItemLoop = 1; } // ahhhh!!! SwapLarrysProfiles( pSoldier ); if ( bSlot != NO_SLOT ) { UseKitPoints( &(pSoldier->inv[ bSlot ]), LarryItems[ bLarryItemLoop ][ 2 ], pSoldier ); } } } else { // NB store all drunkenness info in LARRY_NORMAL profile (to use same values) // so long as he keeps consuming, keep number above level at which he cracked gMercProfiles[ LARRY_NORMAL ].bNPCData = __max( gMercProfiles[ LARRY_NORMAL ].bNPCData, LARRY_FALLS_OFF_WAGON ); gMercProfiles[ LARRY_NORMAL ].bNPCData += (INT8) Random( usTemptation ); // allow value to keep going up to 24 (about 2 days since we subtract Random( 2 ) when he has no access ) gMercProfiles[ LARRY_NORMAL ].bNPCData = __min( gMercProfiles[ LARRY_NORMAL ].bNPCData, 24 ); if ( fBar ) { // take $ from player's account usCashAmount = Item[ ALCOHOL ].usPrice; AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, pSoldier->ubProfile, GetWorldTotalMin() , -( usCashAmount ) ); // give Larry some booze and set slot etc values appropriately bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, SMALLPOCK8POS ); if ( bBoozeSlot != NO_SLOT ) { // give Larry booze here CreateItem( ALCOHOL, 100, &(pSoldier->inv[bBoozeSlot]) ); } bSlot = bBoozeSlot; bLarryItemLoop = 1; } if ( bSlot != NO_SLOT ) { // ahhhh!!! UseKitPoints( &(pSoldier->inv[ bSlot ]), LarryItems[ bLarryItemLoop ][ 2 ], pSoldier ); } } } else if ( pSoldier->ubProfile == LARRY_DRUNK ) { gMercProfiles[ LARRY_NORMAL ].bNPCData -= (INT8) Random( 2 ); if ( gMercProfiles[ LARRY_NORMAL ].bNPCData <= 0 ) { // goes sober! SwapLarrysProfiles( pSoldier ); } } } }
INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) { INT32 iSkill; INT32 iChance, iReportChance; INT32 iRoll, iMadeItBy; INT8 bSlot; INT32 iLoop; SOLDIERTYPE * pTeamSoldier; INT8 bBuddyIndex; BOOLEAN fForceDamnSound = FALSE; iReportChance = -1; switch (bReason) { case LOCKPICKING_CHECK: case ELECTRONIC_LOCKPICKING_CHECK: fForceDamnSound = TRUE; iSkill = EffectiveMechanical( pSoldier ); if (iSkill == 0) { break; } // adjust skill based on wisdom (knowledge) iSkill = iSkill * (EffectiveWisdom( pSoldier ) + 100) / 200; // and dexterity (clumsy?) iSkill = iSkill * (EffectiveDexterity( pSoldier ) + 100) / 200; // factor in experience iSkill = iSkill + EffectiveExpLevel( pSoldier ) * 3; if (HAS_SKILL_TRAIT( pSoldier, LOCKPICKING ) ) { // if we specialize in picking locks... iSkill += gbSkillTraitBonus[LOCKPICKING] * NUM_SKILL_TRAITS( pSoldier, LOCKPICKING ); } if (bReason == ELECTRONIC_LOCKPICKING_CHECK && !(HAS_SKILL_TRAIT( pSoldier, ELECTRONICS)) ) { // if we are unfamiliar with electronics... iSkill /= 2; } // adjust chance based on status of kit bSlot = FindObj( pSoldier, LOCKSMITHKIT ); if (bSlot == NO_SLOT) { // this should never happen, but might as well check... iSkill = 0; } iSkill = iSkill * pSoldier->inv[bSlot].bStatus[0] / 100; break; case ATTACHING_DETONATOR_CHECK: case ATTACHING_REMOTE_DETONATOR_CHECK: iSkill = EffectiveExplosive( pSoldier ); if (iSkill == 0) { break; } iSkill = (iSkill * 3 + EffectiveDexterity( pSoldier ) ) / 4; if ( bReason == ATTACHING_REMOTE_DETONATOR_CHECK && !(HAS_SKILL_TRAIT( pSoldier, ELECTRONICS )) ) { iSkill /= 2; } break; case PLANTING_BOMB_CHECK: case PLANTING_REMOTE_BOMB_CHECK: iSkill = EffectiveExplosive( pSoldier ) * 7; iSkill += EffectiveWisdom( pSoldier ) * 2; iSkill += EffectiveExpLevel( pSoldier ) * 10; iSkill = iSkill / 10; // bring the value down to a percentage if ( bReason == PLANTING_REMOTE_BOMB_CHECK && !(HAS_SKILL_TRAIT( pSoldier, ELECTRONICS)) ) { // deduct only a bit... iSkill = (iSkill * 3) / 4; } // Ok, this is really damn easy, so skew the values... // e.g. if calculated skill is 84, skewed up to 96 // 51 to 84 // 22 stays as is iSkill = (iSkill + 100 * (iSkill / 25) ) / (iSkill / 25 + 1); break; case DISARM_TRAP_CHECK: fForceDamnSound = TRUE; iSkill = EffectiveExplosive( pSoldier ) * 7; if ( iSkill == 0 ) { break; } iSkill += EffectiveDexterity( pSoldier ) * 2; iSkill += EffectiveExpLevel( pSoldier ) * 10; iSkill = iSkill / 10; // bring the value down to a percentage // penalty based on poor wisdom iSkill -= (100 - EffectiveWisdom( pSoldier ) ) / 5; break; case DISARM_ELECTRONIC_TRAP_CHECK: fForceDamnSound = TRUE; iSkill = __max( EffectiveMechanical( pSoldier ) , EffectiveExplosive( pSoldier ) ) * 7; if ( iSkill == 0 ) { break; } iSkill += EffectiveDexterity( pSoldier ) * 2; iSkill += EffectiveExpLevel( pSoldier ) * 10; iSkill = iSkill / 10; // bring the value down to a percentage // penalty based on poor wisdom iSkill -= (100 - EffectiveWisdom( pSoldier ) ) / 5; if ( !(HAS_SKILL_TRAIT( pSoldier, ELECTRONICS )) ) { iSkill = (iSkill * 3) / 4; } break; case OPEN_WITH_CROWBAR: // Add for crowbar... iSkill = EffectiveStrength( pSoldier ) + 20; fForceDamnSound = TRUE; break; case SMASH_DOOR_CHECK: iSkill = EffectiveStrength( pSoldier ); break; case UNJAM_GUN_CHECK: iSkill = 30 + EffectiveMechanical( pSoldier ) / 2; break; case NOTICE_DART_CHECK: // only a max of ~20% chance iSkill = EffectiveWisdom( pSoldier ) / 10 + EffectiveExpLevel( pSoldier ); break; case LIE_TO_QUEEN_CHECK: // competitive check vs the queen's wisdom and leadership... poor guy! iSkill = 50 * ( EffectiveWisdom( pSoldier ) + EffectiveLeadership( pSoldier ) ) / ( gMercProfiles[ QUEEN ].bWisdom + gMercProfiles[ QUEEN ].bLeadership ); break; case ATTACHING_SPECIAL_ITEM_CHECK: case ATTACHING_SPECIAL_ELECTRONIC_ITEM_CHECK: iSkill = EffectiveMechanical( pSoldier ); if (iSkill == 0) { break; } // adjust skill based on wisdom (knowledge) iSkill = iSkill * (EffectiveWisdom( pSoldier ) + 100) / 200; // and dexterity (clumsy?) iSkill = iSkill * (EffectiveDexterity( pSoldier ) + 100) / 200; // factor in experience iSkill = iSkill + EffectiveExpLevel( pSoldier ) * 3; if (bReason == ATTACHING_SPECIAL_ELECTRONIC_ITEM_CHECK && !(HAS_SKILL_TRAIT( pSoldier, ELECTRONICS)) ) { // if we are unfamiliar with electronics... iSkill /= 2; } break; default: iSkill = 0; break; } iSkill -= GetSkillCheckPenaltyForFatigue( pSoldier, iSkill ); iChance = iSkill + bChanceMod; switch (bReason) { case LOCKPICKING_CHECK: case ELECTRONIC_LOCKPICKING_CHECK: case DISARM_TRAP_CHECK: case DISARM_ELECTRONIC_TRAP_CHECK: case OPEN_WITH_CROWBAR: case SMASH_DOOR_CHECK: case ATTACHING_SPECIAL_ITEM_CHECK: case ATTACHING_SPECIAL_ELECTRONIC_ITEM_CHECK: // for lockpicking and smashing locks, if the chance isn't reasonable // we set it to 0 so they can never get through the door if they aren't // good enough if (iChance < 30) { iChance = 0; break; } // else fall through default: iChance += GetMoraleModifier( pSoldier ); break; } if (iChance > 99) { iChance = 99; } else if (iChance < 0) { iChance = 0; } iRoll = PreRandom( 100 ); iMadeItBy = iChance - iRoll; if (iMadeItBy < 0) { if ( (pSoldier->bLastSkillCheck == bReason) && (pSoldier->sGridNo == pSoldier->sSkillCheckGridNo) ) { pSoldier->ubSkillCheckAttempts++; if (pSoldier->ubSkillCheckAttempts > 2) { if (iChance == 0) { // do we realize that we just can't do this? if ( (100 - (pSoldier->ubSkillCheckAttempts - 2) * 20) < EffectiveWisdom( pSoldier ) ) { // say "I can't do this" quote TacticalCharacterDialogue( pSoldier, QUOTE_DEFINITE_CANT_DO ); return( iMadeItBy ); } } } } else { pSoldier->bLastSkillCheck = bReason; pSoldier->ubSkillCheckAttempts = 1; pSoldier->sSkillCheckGridNo = pSoldier->sGridNo; } if ( fForceDamnSound || Random( 100 ) < 40 ) { switch( bReason ) { case UNJAM_GUN_CHECK: case NOTICE_DART_CHECK: case LIE_TO_QUEEN_CHECK: // silent check break; default: DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 ); break; } } } else { // A buddy might make a positive comment based on our success; // Increase the chance for people with higher skill and for more difficult tasks iChance = 15 + iSkill / 20 + (-bChanceMod) / 20; if (iRoll < iChance) { // If a buddy of this merc is standing around nearby, they'll make a positive comment. iLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pTeamSoldier = MercPtrs[ iLoop ]; iLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; iLoop++,pTeamSoldier++ ) { if ( OK_INSECTOR_MERC( pTeamSoldier ) ) { bBuddyIndex = WhichBuddy( pTeamSoldier->ubProfile, pSoldier->ubProfile ); if (bBuddyIndex >= 0 && SpacesAway( pSoldier->sGridNo, pTeamSoldier->sGridNo ) < 15) { switch( bBuddyIndex ) { case 0: // buddy #1 did something good! TacticalCharacterDialogue( pTeamSoldier, QUOTE_BUDDY_1_GOOD ); break; case 1: // buddy #2 did something good! TacticalCharacterDialogue( pTeamSoldier, QUOTE_BUDDY_2_GOOD ); break; case 2: // learn to like buddy did something good! TacticalCharacterDialogue( pTeamSoldier, QUOTE_LEARNED_TO_LIKE_WITNESSED ); break; default: break; } } } } } } return( iMadeItBy ); }
void CPersistantDebug::ClearEntityTags(EntityId entityId) { SObj *obj = FindObj(entityId); if (obj) obj->tags.clear(); }