本文整理汇总了C++中Mod::getVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ Mod::getVersion方法的具体用法?C++ Mod::getVersion怎么用?C++ Mod::getVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mod
的用法示例。
在下文中一共展示了Mod::getVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createActQFindEnemy
bool PedInstance::createActQFindEnemy(actionQueueGroupType &as) {
as.state = 1;
actionQueueType aq;
aq.as = PedInstance::pa_smNone;
aq.group_desc = PedInstance::gd_mThink;
aq.state = 1;
aq.ot_execute = PedInstance::ai_aFindEnemy;
as.actions.push_back(aq);
pedWeaponToUse pw_to_use;
Mod *pMod = slots_[Mod::MOD_BRAIN];
if (getMainType() == PedInstance::m_tpAgent) {
aq.multi_var.enemy_var.pw_to_use.use_ranks = pMod || (!isOurAgent())
? true: false;
WeaponInstance *wi = selectedWeapon();
if (wi && wi->usesAmmo() && wi->ammoRemaining() == 0) {
wi = NULL;
setSelectedWeapon(-1);
}
if (wi && wi->canShoot()) {
if (pMod) {
// This overrides selected weapon
// might be confusing for player
if (pMod->getVersion() == Mod::MOD_V3) {
pw_to_use.desc = 5;
pw_to_use.wpn.dmg_type = wi->dmgType();
} else if (pMod->getVersion() == Mod::MOD_V2) {
pw_to_use.desc = 4;
pw_to_use.wpn.dmg_type = wi->dmgType();
} else {
// Mod::MOD_V1
pw_to_use.desc = 3;
pw_to_use.wpn.wpn_type = wi->getWeaponType();
}
} else {
pw_to_use.desc = 2;
pw_to_use.wpn.wi = wi;
}
} else {
pw_to_use.desc = 5;
pw_to_use.wpn.dmg_type = MapObject::dmg_Physical;
}
} else {
pw_to_use.desc = 5;
pw_to_use.wpn.dmg_type = MapObject::dmg_Physical;
}
if (createActQFiring(as, NULL, NULL, false, 0, &pw_to_use))
as.actions.back().state |= 64;
else
return false;
createActQFollowing(as, NULL, 1);
as.actions.back().state |= 64;
return true;
}
示例2: createActQFiring
bool PedInstance::createActQFiring(actionQueueGroupType &as, PathNode *tpn,
ShootableMapObject *tsmo, bool forced_shot, uint32 make_shots,
pedWeaponToUse *pw_to_use, int32 value)
{
as.state = 1;
actionQueueType aq;
aq.group_desc = PedInstance::gd_mFire;
bool can_shoot = false;
bool does_phys_dmg = false;
Weapon *pWeapon = NULL;
if (pw_to_use) {
switch (pw_to_use->desc) {
case 1:
pw_to_use->wpn.wi = weapon(pw_to_use->wpn.indx);
can_shoot = pw_to_use->wpn.wi->canShoot();
does_phys_dmg = pw_to_use->wpn.wi->doesPhysicalDmg();
pw_to_use->desc = 2;
break;
case 2:
// pointer
can_shoot = pw_to_use->wpn.wi->canShoot();
does_phys_dmg = pw_to_use->wpn.wi->doesPhysicalDmg();
break;
case 3:
// weapon type
pWeapon = g_App.weapons().getWeapon(pw_to_use->wpn.wpn_type);
can_shoot = pWeapon->canShoot();
does_phys_dmg = pWeapon->doesPhysicalDmg();
break;
case 4:
// strict damage type
if(!g_App.weapons().checkDmgTypeCanShootStrict(
pw_to_use->wpn.dmg_type, can_shoot)) {
return false;
}
does_phys_dmg = (pw_to_use->wpn.dmg_type
& MapObject::dmg_Physical) != 0;
break;
case 5:
// non-strict damage type
if(!g_App.weapons().checkDmgTypeCanShootNonStrict(
pw_to_use->wpn.dmg_type, can_shoot)) {
return false;
}
does_phys_dmg = (pw_to_use->wpn.dmg_type
& MapObject::dmg_Physical) != 0;
break;
}
aq.multi_var.enemy_var.pw_to_use = *pw_to_use;
} else {
WeaponInstance *wi = selectedWeapon();
if (wi) {
can_shoot = wi->canShoot();
does_phys_dmg = wi->doesPhysicalDmg();
Mod *pMod = slots_[Mod::MOD_BRAIN];
if (pMod) {
if (pMod->getVersion() == Mod::MOD_V3) {
aq.multi_var.enemy_var.pw_to_use.desc = 5;
aq.multi_var.enemy_var.pw_to_use.wpn.dmg_type = wi->dmgType();
} else if (pMod->getVersion() == Mod::MOD_V2) {
aq.multi_var.enemy_var.pw_to_use.desc = 4;
aq.multi_var.enemy_var.pw_to_use.wpn.dmg_type = wi->dmgType();
} else {
aq.multi_var.enemy_var.pw_to_use.desc = 3;
aq.multi_var.enemy_var.pw_to_use.wpn.wpn_type = wi->getWeaponType();
}
} else {
aq.multi_var.enemy_var.pw_to_use.desc = 2;
aq.multi_var.enemy_var.pw_to_use.wpn.wi = wi;
}
} else
return false;
}
if (!can_shoot)
return false;
aq.multi_var.enemy_var.pw_to_use.use_ranks = slots_[Mod::MOD_BRAIN] ? true: false;
aq.multi_var.enemy_var.value = value;
aq.multi_var.enemy_var.forced_shot = forced_shot;
if (does_phys_dmg) {
aq.as = PedInstance::pa_smFiring;
// TODO: use condition to set more information for action execution
// continuos shooting until ammo ends(or all weapons ammo),
// until target destroyed, type of damage that will complete action
aq.multi_var.enemy_var.make_shots = make_shots;
aq.multi_var.enemy_var.shots_done = 0;
if (tpn) {
aq.t_pn = *tpn;
aq.ot_execute = PedInstance::ai_aAttackLocation;
aq.t_smo = NULL;
} else {
aq.t_smo = tsmo;
aq.ot_execute = PedInstance::ai_aDestroyObject;
}
} else {
if (tsmo && tsmo->majorType() == MapObject::mjt_Ped) {
aq.as = PedInstance::pa_smNone;
aq.multi_var.enemy_var.make_shots = make_shots;
aq.multi_var.enemy_var.shots_done = 0;
//.........这里部分代码省略.........