void FX_CCharManager::GenerateMyCharacter () { Fx_CHARACTER_t *pNewChar; int itemTableIdx, itemIdx; pNewChar = &m_Characters [0]; if( pNewChar->isTransform ) return; SetDefaultCharacter ( 0 ); pNewChar->equipNumber = 0; for ( int i = 0; \ i < EQUIP_RING; \ i++ ) { if ( g_cgv.myCharacterInfo ->equipment [i] == -1 ) continue; if( g_cgv.myCharacterInfo->curWeapon == 0 && i == EQUIP_WEAPON_2 ) continue; if( g_cgv.myCharacterInfo->curWeapon == 1 && i == EQUIP_WEAPON_1 ) continue; itemIdx = g_cgv.myCharacterInfo->equipment[i]; if( !GTH_CheckRequire( g_cgv.myCharacterInfo, 0, &g_cgv.myCharacterInfo->item[itemIdx] ) ) continue; itemTableIdx = g_cgv.myCharacterInfo ->item [g_cgv.myCharacterInfo ->equipment [i]].itemTableIdx; pNewChar ->equipment [pNewChar ->equipNumber] = itemTableIdx; pNewChar ->equipNumber++; } EquipAllItem (0); int tableIdx, mainClass, attackAni = 0; tableIdx = pNewChar->tableIdx; if ( pNewChar->equipNumber > 0 ) { itemIdx = pNewChar->equipment[0]; mainClass = g_itemTable[itemIdx].classIdx; if ( g_itemClassTable[mainClass].attackAtt ) { attackAni = g_itemTable[itemIdx].attackAni[tableIdx]; } } if( attackAni != pNewChar->ani_curItemSetIndex ) GTH_ChangeAnimation( pNewChar, pNewChar->ani_curSetType, pNewChar->ani_curSetID, true, NULL, true ); CheckAuraExist (0); UpdateSysVBInfo (); UpdateCharacterState (); SetTargetID (); }
void FX_CCharManager::GenerateOtherCharacter ( int iCharID ) { Fx_CHARACTER_t *pNewChar; pNewChar = &m_Characters [iCharID]; SetDefaultCharacter ( iCharID ); EquipAllItem (iCharID); CheckAuraExist (iCharID); UpdateSysVBInfo (); UpdateCharacterState (); SetTargetID (); }
bool AIStrategy::Parse(TiXmlElement* xml) { if (xml == 0) return false; // file could not be opened //const char *str; // parse the file until end reached //str = xml->Value(); int res,val; res = xml->QueryIntAttribute("target_id", &val); if (TIXML_SUCCESS==res) SetTargetID(val); return TIXML_SUCCESS==res; }
void FX_CCharManager::GenerateCharacter ( syncCharacter_t *data, int numData ) { Fx_CHARACTER_t *pNewChar; int backupIdx; float distance; int index, subindex, k; int aniSetIndex = 0; bool flagBackupChecked [MAX_CHAR_A_SCENE]; memset ( flagBackupChecked, 0, sizeof(bool) * MAX_CHAR_A_SCENE ); memcpy( m_CharactersBackup, m_Characters, sizeof(Fx_CHARACTER_t) * m_iNumCharacters ); m_iNumBackupCharacters = m_iNumCharacters; memset ( m_Characters, 0, sizeof (Fx_CHARACTER_t) * MAX_CHAR_A_SCENE ); m_iNumCharacters = numData; for ( index = 0; \ index < numData; \ ++index, ++data ) { pNewChar = &m_Characters[ index ]; pNewChar->ID = index; for ( subindex = 0; \ subindex < m_iNumBackupCharacters; \ ++subindex ) { if ( m_CharactersBackup[ subindex ].idxOnServer == data->idxOnServer && m_CharactersBackup[ subindex ].entityType == data->entityType ) { flagBackupChecked[ subindex ] = true; break; } } if ( subindex >= m_iNumBackupCharacters ) backupIdx = -1; else backupIdx = subindex; if ( backupIdx == -1 ) { SetInitialDataForNewChar( pNewChar, data ); if ( pNewChar->entityType == ENTITY_PC ) { pNewChar->isTransform = data->isTransform; pNewChar->transformEntityIdx = data->transformEntityIdx; pNewChar->transformType = data->transformType; if ( ! data->isTransform ) { SetPCSpecificDataNormal( pNewChar, data ); } else { SetPCSpecificDataTransform( pNewChar, data ); } pNewChar->chaosPoint = data->chaosPoint; pNewChar->pvpMode = data->pvpMode; pNewChar->generalSpeed = data->generalSpeed; } else if ( pNewChar->entityType == ENTITY_MONSTER || pNewChar->entityType == ENTITY_NPC ) { SetNonPCSpecificData( pNewChar, data ); } pNewChar->stat_height = GetInitialHeight( pNewChar, pNewChar->ani_curIdx ) * pNewChar->stat_scale; pNewChar->attr_tall = GetInitialTall ( pNewChar, pNewChar->ani_curIdx ) * pNewChar->stat_scale; pNewChar->stat_radius = GetInitialRadius( pNewChar, pNewChar->ani_curIdx ) * pNewChar->stat_scale; CheckNewAddedEffect( pNewChar, data ); pNewChar->ren_generalSpeed = 100.0f; SetCharacterSpeed( pNewChar, (float)data->generalSpeed ); CheckNewCreature( pNewChar, data ); } else { data->position[ 2 ] = g_move->GetHeight( data->position ); memcpy( pNewChar, &m_CharactersBackup[ backupIdx ], sizeof(Fx_CHARACTER_t) ); pNewChar->ID = index; SetInitialDataForExistChar( pNewChar, data ); if (pNewChar->entityType == ENTITY_PC) { if( data->isTransform != pNewChar->isTransform ) { pNewChar->isTransform = data->isTransform; pNewChar->transformEntityIdx = data->transformEntityIdx; pNewChar->transformType = data->transformType; if ( ! data->isTransform ) { pNewChar->attr_skelID = m_pCharLookupMng->GetBoneIDFromTable( ENTITY_PC, pNewChar->tableIdx ); SetPCSpecificDataNormal( pNewChar, data ); } else { SetPCSpecificDataTransform( pNewChar, data ); } pNewChar->stat_height = GetInitialHeight ( pNewChar, pNewChar->ani_curIdx ) * pNewChar->stat_scale; pNewChar->attr_tall = GetInitialTall ( pNewChar, pNewChar->ani_curIdx ) * pNewChar->stat_scale; pNewChar->stat_radius = GetInitialRadius ( pNewChar, pNewChar->ani_curIdx ) * pNewChar->stat_scale; } else { if ( ! data->isTransform ) { pNewChar->equipNumber = data->equipNumber; for ( k = 0; \ k < pNewChar->equipNumber; \ ++k ) pNewChar->equipment[ k ] = data->equipment[ k ]; SetDefaultCharacter( index ); EquipAllItem( index ); } } pNewChar->chaosPoint = data->chaosPoint; pNewChar->pvpMode = data->pvpMode; pNewChar->generalSpeed = data->generalSpeed; } pNewChar -> useInterpolation = false; if ( pNewChar->idxOnServer == g_cgv.myPCIdxOnServer && pNewChar->entityType == ENTITY_PC ) { VectorCopy( pNewChar->syncPosition, data->position ); } else { distance = GTH_GetDistance2D( data->position, pNewChar->position ); if ( distance > 100 ) { VectorCopy( pNewChar->position, data->position ); VectorCopy( pNewChar->syncPosition, data->position ); } else { VectorCopy( pNewChar->syncPosition, data->position ); pNewChar->useInterpolation = true; } pNewChar->event = data->event; VectorCopy( pNewChar->angles, data->angles ); pNewChar->mouseAngle = data->angles[YAW]; } pNewChar->boothState = data->boothState; if( data->boothState == 2 ) { strcpy( pNewChar->boothName, data->boothName ); } GenerateCharacterAffect( pNewChar, data->numStaticEffects, data->staticEffectIndex ); SetCharacterSpeed ( pNewChar, (float)data ->generalSpeed ); pNewChar->bHide = false; for( int p = 0; p < data->numStaticEffects; p++ ) { if( data->staticEffectIndex[p] == 44 ) { pNewChar->bHide = true; } } } if (pNewChar->entityType == ENTITY_PC) { pNewChar->skinPart[0] = data->skinPart[0]; pNewChar->skinPart[1] = data->skinPart[1]; pNewChar->m_bWaitingRoom = data->waitingRoom; pNewChar->m_JoinNum = data->joinNum; pNewChar->m_NameColorIdx = data->nameColorIdx; } if ( pNewChar->curRA > 0 ) pNewChar->isAlive = true; else pNewChar->isAlive = false; CheckAuraExist( index ); pNewChar->SetupVectors (); } for ( index = 0; \ index < m_iNumBackupCharacters; \ ++index ) { if ( flagBackupChecked [index] ) continue; Fx_CHARACTER_t *backup; backup = &m_CharactersBackup [index]; for ( int subindex = 0; \ subindex < backup ->ren_numStaticEffects; \ ++subindex ) { int effectEntityIndex = backup ->ren_staticEffectEntityIndex [subindex]; if ( effectEntityIndex >= 0 ) g_effectMng ->Delete ( effectEntityIndex ); } } UpdateSysVBInfo (); UpdateCharacterState (); FixCharacterPosition (); SetTargetID (); }