Rename some item functions
This commit is contained in:
parent
4eb5e39946
commit
a41780caa2
|
@ -472,7 +472,7 @@ int _show_death(Object* obj, int anim)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anim >= 30 && anim <= 31 && _critter_flag_check(obj->pid, CRITTER_FLAG_0x1000) == 0 && _critter_flag_check(obj->pid, CRITTER_FLAG_0x40) == 0) {
|
if (anim >= 30 && anim <= 31 && _critter_flag_check(obj->pid, CRITTER_FLAG_0x1000) == 0 && _critter_flag_check(obj->pid, CRITTER_FLAG_0x40) == 0) {
|
||||||
_item_drop_all(obj, obj->tile);
|
itemDropAll(obj, obj->tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
tileWindowRefreshRect(&v8, obj->elevation);
|
tileWindowRefreshRect(&v8, obj->elevation);
|
||||||
|
@ -713,7 +713,7 @@ int _action_ranged(Attack* attack, int anim)
|
||||||
int actionFrame = (art != NULL) ? artGetActionFrame(art) : 0;
|
int actionFrame = (art != NULL) ? artGetActionFrame(art) : 0;
|
||||||
artUnlock(artHandle);
|
artUnlock(artHandle);
|
||||||
|
|
||||||
_item_w_range(attack->attacker, attack->hitMode);
|
weaponGetRange(attack->attacker, attack->hitMode);
|
||||||
|
|
||||||
int damageType = weaponGetDamageType(attack->attacker, attack->weapon);
|
int damageType = weaponGetDamageType(attack->attacker, attack->weapon);
|
||||||
|
|
||||||
|
@ -760,7 +760,7 @@ int _action_ranged(Attack* attack, int anim)
|
||||||
interfaceGetItemActions(&leftItemAction, &rightItemAction);
|
interfaceGetItemActions(&leftItemAction, &rightItemAction);
|
||||||
|
|
||||||
itemRemove(attack->attacker, weapon, 1);
|
itemRemove(attack->attacker, weapon, 1);
|
||||||
v50 = _item_replace(attack->attacker, weapon, weaponFlags & OBJECT_IN_ANY_HAND);
|
v50 = itemReplace(attack->attacker, weapon, weaponFlags & OBJECT_IN_ANY_HAND);
|
||||||
objectSetFid(projectile, projectileProto->fid, NULL);
|
objectSetFid(projectile, projectileProto->fid, NULL);
|
||||||
_cAIPrepWeaponItem(attack->attacker, weapon);
|
_cAIPrepWeaponItem(attack->attacker, weapon);
|
||||||
|
|
||||||
|
|
|
@ -3005,7 +3005,7 @@ int _check_move(int* a1)
|
||||||
bool aiming;
|
bool aiming;
|
||||||
interfaceGetCurrentHitMode(&hitMode, &aiming);
|
interfaceGetCurrentHitMode(&hitMode, &aiming);
|
||||||
|
|
||||||
int v6 = _item_mp_cost(gDude, hitMode, aiming);
|
int v6 = itemGetActionPointCost(gDude, hitMode, aiming);
|
||||||
*a1 = *a1 - v6;
|
*a1 = *a1 - v6;
|
||||||
if (*a1 <= 0) {
|
if (*a1 <= 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -2261,7 +2261,7 @@ static bool _combat_safety_invalidate_weapon_func(Object* critter, Object* weapo
|
||||||
|
|
||||||
int intelligence = critterGetStat(critter, STAT_INTELLIGENCE);
|
int intelligence = critterGetStat(critter, STAT_INTELLIGENCE);
|
||||||
int team = critter->data.critter.combat.team;
|
int team = critter->data.critter.combat.team;
|
||||||
int v41 = _item_w_area_damage_radius(weapon, hitMode);
|
int v41 = weaponGetDamageRadius(weapon, hitMode);
|
||||||
int maxDamage;
|
int maxDamage;
|
||||||
weaponGetDamageMinMax(weapon, NULL, &maxDamage);
|
weaponGetDamageMinMax(weapon, NULL, &maxDamage);
|
||||||
int damageType = weaponGetDamageType(critter, weapon);
|
int damageType = weaponGetDamageType(critter, weapon);
|
||||||
|
@ -3468,7 +3468,7 @@ int _combat_attack(Object* a1, Object* a2, int hitMode, int hitLocation)
|
||||||
aiming = true;
|
aiming = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int actionPoints = _item_w_mp_cost(a1, _main_ctd.hitMode, aiming);
|
int actionPoints = weaponGetActionPointCost(a1, _main_ctd.hitMode, aiming);
|
||||||
debugPrint("sequencing attack...\n");
|
debugPrint("sequencing attack...\n");
|
||||||
|
|
||||||
if (_action_attack(&_main_ctd) == -1) {
|
if (_action_attack(&_main_ctd) == -1) {
|
||||||
|
@ -3509,7 +3509,7 @@ int _combat_bullet_start(const Object* a1, const Object* a2)
|
||||||
// 0x423128
|
// 0x423128
|
||||||
static bool _check_ranged_miss(Attack* attack)
|
static bool _check_ranged_miss(Attack* attack)
|
||||||
{
|
{
|
||||||
int range = _item_w_range(attack->attacker, attack->hitMode);
|
int range = weaponGetRange(attack->attacker, attack->hitMode);
|
||||||
int to = _tile_num_beyond(attack->attacker->tile, attack->defender->tile, range);
|
int to = _tile_num_beyond(attack->attacker->tile, attack->defender->tile, range);
|
||||||
|
|
||||||
int roll = ROLL_FAILURE;
|
int roll = ROLL_FAILURE;
|
||||||
|
@ -3698,7 +3698,7 @@ static int _compute_spray(Attack* attack, int accuracy, int* a3, int* a4, int an
|
||||||
*a3 = 1;
|
*a3 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int range = _item_w_range(attack->attacker, attack->hitMode);
|
int range = weaponGetRange(attack->attacker, attack->hitMode);
|
||||||
int mainTargetEndTile = _tile_num_beyond(attack->attacker->tile, attack->defender->tile, range);
|
int mainTargetEndTile = _tile_num_beyond(attack->attacker->tile, attack->defender->tile, range);
|
||||||
*a3 += _shoot_along_path(attack, mainTargetEndTile, centerRounds - *a3, anim);
|
*a3 += _shoot_along_path(attack, mainTargetEndTile, centerRounds - *a3, anim);
|
||||||
|
|
||||||
|
@ -3754,7 +3754,7 @@ static int attackComputeEnhancedKnockout(Attack* attack)
|
||||||
// 0x42378C
|
// 0x42378C
|
||||||
static int attackCompute(Attack* attack)
|
static int attackCompute(Attack* attack)
|
||||||
{
|
{
|
||||||
int range = _item_w_range(attack->attacker, attack->hitMode);
|
int range = weaponGetRange(attack->attacker, attack->hitMode);
|
||||||
int distance = objectGetDistanceBetween(attack->attacker, attack->defender);
|
int distance = objectGetDistanceBetween(attack->attacker, attack->defender);
|
||||||
|
|
||||||
if (range < distance) {
|
if (range < distance) {
|
||||||
|
@ -3966,9 +3966,9 @@ void _compute_explosion_on_extras(Attack* attack, int a2, bool isGrenade, int a4
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
v22++;
|
v22++;
|
||||||
if (isGrenade && _item_w_grenade_dmg_radius(attack->weapon) < v22) {
|
if (isGrenade && weaponGetGrenadeExplosionRadius(attack->weapon) < v22) {
|
||||||
v5 = -1;
|
v5 = -1;
|
||||||
} else if (isGrenade || _item_w_rocket_dmg_radius(attack->weapon) >= v22) {
|
} else if (isGrenade || weaponGetRocketExplosionRadius(attack->weapon) >= v22) {
|
||||||
v5 = tileGetTileInDirection(v19, ROTATION_NE, 1);
|
v5 = tileGetTileInDirection(v19, ROTATION_NE, 1);
|
||||||
} else {
|
} else {
|
||||||
v5 = -1;
|
v5 = -1;
|
||||||
|
@ -4117,7 +4117,7 @@ static int _attackFindInvalidFlags(Object* critter, Object* item)
|
||||||
flags |= DAM_DROP;
|
flags |= DAM_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item != NULL && weaponIsNatural(item)) {
|
if (item != NULL && itemIsHidden(item)) {
|
||||||
flags |= DAM_DROP;
|
flags |= DAM_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4268,7 +4268,7 @@ static int attackDetermineToHit(Object* attacker, int tile, Object* defender, in
|
||||||
if (weapon == NULL || isUnarmedHitMode(hitMode)) {
|
if (weapon == NULL || isUnarmedHitMode(hitMode)) {
|
||||||
accuracy = skillGetValue(attacker, SKILL_UNARMED);
|
accuracy = skillGetValue(attacker, SKILL_UNARMED);
|
||||||
} else {
|
} else {
|
||||||
accuracy = _item_w_skill_level(attacker, hitMode);
|
accuracy = weaponGetSkillValue(attacker, hitMode);
|
||||||
|
|
||||||
int modifier = 0;
|
int modifier = 0;
|
||||||
|
|
||||||
|
@ -4534,7 +4534,7 @@ static void attackComputeDamage(Attack* attack, int ammoQuantity, int bonusDamag
|
||||||
int damageDivisor = weaponGetAmmoDamageDivisor(attack->weapon);
|
int damageDivisor = weaponGetAmmoDamageDivisor(attack->weapon);
|
||||||
|
|
||||||
for (int index = 0; index < ammoQuantity; index++) {
|
for (int index = 0; index < ammoQuantity; index++) {
|
||||||
int damage = weaponGetMeleeDamage(attack->attacker, attack->hitMode);
|
int damage = weaponGetDamage(attack->attacker, attack->hitMode);
|
||||||
|
|
||||||
damage += damageBonus;
|
damage += damageBonus;
|
||||||
|
|
||||||
|
@ -4799,7 +4799,7 @@ static void _damage_object(Object* a1, int damage, bool animated, int a4, Object
|
||||||
if ((a1->data.critter.combat.results & DAM_DEAD) != 0) {
|
if ((a1->data.critter.combat.results & DAM_DEAD) != 0) {
|
||||||
scriptSetObjects(a1->sid, a1->data.critter.combat.whoHitMe, NULL);
|
scriptSetObjects(a1->sid, a1->data.critter.combat.whoHitMe, NULL);
|
||||||
scriptExecProc(a1->sid, SCRIPT_PROC_DESTROY);
|
scriptExecProc(a1->sid, SCRIPT_PROC_DESTROY);
|
||||||
_item_destroy_all_hidden(a1);
|
itemDestroyAllHidden(a1);
|
||||||
|
|
||||||
if (a1 != gDude) {
|
if (a1 != gDude) {
|
||||||
Object* whoHitMe = a1->data.critter.combat.whoHitMe;
|
Object* whoHitMe = a1->data.critter.combat.whoHitMe;
|
||||||
|
@ -5600,11 +5600,11 @@ int _combat_check_bad_shot(Object* attacker, Object* defender, int hitMode, bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_item_w_mp_cost(attacker, hitMode, aiming) > attacker->data.critter.combat.ap) {
|
if (weaponGetActionPointCost(attacker, hitMode, aiming) > attacker->data.critter.combat.ap) {
|
||||||
return 3; // not enough action points
|
return 3; // not enough action points
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_item_w_range(attacker, hitMode) < range) {
|
if (weaponGetRange(attacker, hitMode) < range) {
|
||||||
return 2; // target out of range
|
return 2; // target out of range
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5618,7 +5618,7 @@ int _combat_check_bad_shot(Object* attacker, Object* defender, int hitMode, bool
|
||||||
|
|
||||||
if (attackType == ATTACK_TYPE_RANGED
|
if (attackType == ATTACK_TYPE_RANGED
|
||||||
|| attackType == ATTACK_TYPE_THROW
|
|| attackType == ATTACK_TYPE_THROW
|
||||||
|| _item_w_range(attacker, hitMode) > 1) {
|
|| weaponGetRange(attacker, hitMode) > 1) {
|
||||||
if (_combat_is_shot_blocked(attacker, attacker->tile, tile, defender, NULL)) {
|
if (_combat_is_shot_blocked(attacker, attacker->tile, tile, defender, NULL)) {
|
||||||
return 5; // Your aim is blocked
|
return 5; // Your aim is blocked
|
||||||
}
|
}
|
||||||
|
@ -5689,7 +5689,7 @@ void _combat_attack_this(Object* a1)
|
||||||
item = critterGetWeaponForHitMode(gDude, hitMode);
|
item = critterGetWeaponForHitMode(gDude, hitMode);
|
||||||
messageListItem.num = 100; // You need %d action points.
|
messageListItem.num = 100; // You need %d action points.
|
||||||
if (messageListGetItem(&gCombatMessageList, &messageListItem)) {
|
if (messageListGetItem(&gCombatMessageList, &messageListItem)) {
|
||||||
int actionPointsRequired = _item_w_mp_cost(gDude, hitMode, aiming);
|
int actionPointsRequired = weaponGetActionPointCost(gDude, hitMode, aiming);
|
||||||
sprintf(formattedText, messageListItem.text, actionPointsRequired);
|
sprintf(formattedText, messageListItem.text, actionPointsRequired);
|
||||||
displayMonitorAddMessage(formattedText);
|
displayMonitorAddMessage(formattedText);
|
||||||
}
|
}
|
||||||
|
@ -5895,7 +5895,7 @@ int _combat_player_knocked_out_by()
|
||||||
// 0x426DB8
|
// 0x426DB8
|
||||||
int _combat_explode_scenery(Object* a1, Object* a2)
|
int _combat_explode_scenery(Object* a1, Object* a2)
|
||||||
{
|
{
|
||||||
_scr_explode_scenery(a1, a1->tile, _item_w_rocket_dmg_radius(NULL), a1->elevation);
|
_scr_explode_scenery(a1, a1->tile, weaponGetRocketExplosionRadius(NULL), a1->elevation);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6631,7 +6631,7 @@ static void damageModCalculateGlovz(DamageCalculationContext* context)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int index = 0; index < context->ammoQuantity; index++) {
|
for (int index = 0; index < context->ammoQuantity; index++) {
|
||||||
int damage = weaponGetMeleeDamage(context->attack->attacker, context->attack->hitMode);
|
int damage = weaponGetDamage(context->attack->attacker, context->attack->hitMode);
|
||||||
|
|
||||||
damage += context->damageBonus;
|
damage += context->damageBonus;
|
||||||
if (damage <= 0) {
|
if (damage <= 0) {
|
||||||
|
@ -6721,7 +6721,7 @@ static void damageModCalculateYaam(DamageCalculationContext* context)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int index = 0; index < context->ammoQuantity; index++) {
|
for (int index = 0; index < context->ammoQuantity; index++) {
|
||||||
int damage = weaponGetMeleeDamage(context->attack->weapon, context->attack->hitMode);
|
int damage = weaponGetDamage(context->attack->weapon, context->attack->hitMode);
|
||||||
damage += context->damageBonus;
|
damage += context->damageBonus;
|
||||||
|
|
||||||
damage -= calculatedDamageThreshold;
|
damage -= calculatedDamageThreshold;
|
||||||
|
|
|
@ -1648,7 +1648,7 @@ static int _ai_have_ammo(Object* critter_obj, Object* weapon_obj, Object** out_a
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weaponGetAnimationCode(weapon_obj)) {
|
if (weaponGetAnimationCode(weapon_obj)) {
|
||||||
if (_item_w_range(critter_obj, 2) < 3) {
|
if (weaponGetRange(critter_obj, 2) < 3) {
|
||||||
_inven_unwield(critter_obj, 1);
|
_inven_unwield(critter_obj, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1716,7 +1716,7 @@ static Object* _ai_best_weapon(Object* attacker, Object* weapon1, Object* weapon
|
||||||
|
|
||||||
// SFALL: Fix avg damage calculation.
|
// SFALL: Fix avg damage calculation.
|
||||||
avgDamage1 = (maxDamage + minDamage) / 2;
|
avgDamage1 = (maxDamage + minDamage) / 2;
|
||||||
if (_item_w_area_damage_radius(weapon1, HIT_MODE_RIGHT_WEAPON_PRIMARY) > 0 && defender != NULL) {
|
if (weaponGetDamageRadius(weapon1, HIT_MODE_RIGHT_WEAPON_PRIMARY) > 0 && defender != NULL) {
|
||||||
attack.weapon = weapon1;
|
attack.weapon = weapon1;
|
||||||
_compute_explosion_on_extras(&attack, 0, weaponIsGrenade(weapon1), 1);
|
_compute_explosion_on_extras(&attack, 0, weaponIsGrenade(weapon1), 1);
|
||||||
avgDamage1 *= attack.extrasLength + 1;
|
avgDamage1 *= attack.extrasLength + 1;
|
||||||
|
@ -1734,12 +1734,12 @@ static Object* _ai_best_weapon(Object* attacker, Object* weapon1, Object* weapon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weaponIsNatural(weapon1)) {
|
if (itemIsHidden(weapon1)) {
|
||||||
return weapon1;
|
return weapon1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
distance = objectGetDistanceBetween(attacker, defender);
|
distance = objectGetDistanceBetween(attacker, defender);
|
||||||
if (_item_w_range(attacker, HIT_MODE_PUNCH) >= distance) {
|
if (weaponGetRange(attacker, HIT_MODE_PUNCH) >= distance) {
|
||||||
attackType1 = ATTACK_TYPE_UNARMED;
|
attackType1 = ATTACK_TYPE_UNARMED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1761,7 +1761,7 @@ static Object* _ai_best_weapon(Object* attacker, Object* weapon1, Object* weapon
|
||||||
|
|
||||||
// SFALL: Fix avg damage calculation.
|
// SFALL: Fix avg damage calculation.
|
||||||
avgDamage2 = (maxDamage + minDamage) / 2;
|
avgDamage2 = (maxDamage + minDamage) / 2;
|
||||||
if (_item_w_area_damage_radius(weapon2, HIT_MODE_RIGHT_WEAPON_PRIMARY) > 0 && defender != NULL) {
|
if (weaponGetDamageRadius(weapon2, HIT_MODE_RIGHT_WEAPON_PRIMARY) > 0 && defender != NULL) {
|
||||||
attack.weapon = weapon2;
|
attack.weapon = weapon2;
|
||||||
_compute_explosion_on_extras(&attack, 0, weaponIsGrenade(weapon2), 1);
|
_compute_explosion_on_extras(&attack, 0, weaponIsGrenade(weapon2), 1);
|
||||||
avgDamage2 *= attack.extrasLength + 1;
|
avgDamage2 *= attack.extrasLength + 1;
|
||||||
|
@ -1778,7 +1778,7 @@ static Object* _ai_best_weapon(Object* attacker, Object* weapon1, Object* weapon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weaponIsNatural(weapon2)) {
|
if (itemIsHidden(weapon2)) {
|
||||||
return weapon2;
|
return weapon2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1786,7 +1786,7 @@ static Object* _ai_best_weapon(Object* attacker, Object* weapon1, Object* weapon
|
||||||
distance = objectGetDistanceBetween(attacker, weapon1);
|
distance = objectGetDistanceBetween(attacker, weapon1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_item_w_range(attacker, HIT_MODE_PUNCH) >= distance) {
|
if (weaponGetRange(attacker, HIT_MODE_PUNCH) >= distance) {
|
||||||
attackType2 = ATTACK_TYPE_UNARMED;
|
attackType2 = ATTACK_TYPE_UNARMED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1882,7 +1882,7 @@ Object* _ai_search_inven_weap(Object* critter, int a2, Object* a3)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a2) {
|
if (a2) {
|
||||||
if (weaponGetActionPointCost1(weapon) > critter->data.critter.combat.ap) {
|
if (weaponGetPrimaryActionPointCost(weapon) > critter->data.critter.combat.ap) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2388,7 +2388,7 @@ static bool _cai_attackWouldIntersect(Object* a1, Object* a2, Object* a3, int ti
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_item_w_range(a1, hitMode) < 1) {
|
if (weaponGetRange(a1, hitMode) < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2416,7 +2416,7 @@ static int _ai_switch_weapons(Object* a1, int* hitMode, Object** weapon, Object*
|
||||||
} else {
|
} else {
|
||||||
Object* v8 = _ai_search_environ(a1, ITEM_TYPE_WEAPON);
|
Object* v8 = _ai_search_environ(a1, ITEM_TYPE_WEAPON);
|
||||||
if (v8 == NULL) {
|
if (v8 == NULL) {
|
||||||
if (_item_w_mp_cost(a1, *hitMode, 0) <= a1->data.critter.combat.ap) {
|
if (weaponGetActionPointCost(a1, *hitMode, 0) <= a1->data.critter.combat.ap) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2433,7 +2433,7 @@ static int _ai_switch_weapons(Object* a1, int* hitMode, Object** weapon, Object*
|
||||||
if (*weapon != NULL) {
|
if (*weapon != NULL) {
|
||||||
_inven_wield(a1, *weapon, 1);
|
_inven_wield(a1, *weapon, 1);
|
||||||
_combat_turn_run();
|
_combat_turn_run();
|
||||||
if (_item_w_mp_cost(a1, *hitMode, 0) <= a1->data.critter.combat.ap) {
|
if (weaponGetActionPointCost(a1, *hitMode, 0) <= a1->data.critter.combat.ap) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2452,8 +2452,8 @@ static int _ai_called_shot(Object* a1, Object* a2, int a3)
|
||||||
|
|
||||||
v5 = 3;
|
v5 = 3;
|
||||||
|
|
||||||
if (_item_w_mp_cost(a1, a3, 1) <= a1->data.critter.combat.ap) {
|
if (weaponGetActionPointCost(a1, a3, 1) <= a1->data.critter.combat.ap) {
|
||||||
if (_item_w_called_shot(a1, a3)) {
|
if (critterCanAim(a1, a3)) {
|
||||||
ai = aiGetPacket(a1);
|
ai = aiGetPacket(a1);
|
||||||
if (randomBetween(1, ai->called_freq) == 1) {
|
if (randomBetween(1, ai->called_freq) == 1) {
|
||||||
combat_difficulty = 1;
|
combat_difficulty = 1;
|
||||||
|
@ -2546,7 +2546,7 @@ static int _ai_try_attack(Object* a1, Object* a2)
|
||||||
if (reason == 1) {
|
if (reason == 1) {
|
||||||
// out of ammo
|
// out of ammo
|
||||||
if (_ai_have_ammo(a1, weapon, &ammo)) {
|
if (_ai_have_ammo(a1, weapon, &ammo)) {
|
||||||
int v9 = _item_w_reload(weapon, ammo);
|
int v9 = weaponReload(weapon, ammo);
|
||||||
if (v9 == 0 && ammo != NULL) {
|
if (v9 == 0 && ammo != NULL) {
|
||||||
_obj_destroy(ammo);
|
_obj_destroy(ammo);
|
||||||
}
|
}
|
||||||
|
@ -2569,7 +2569,7 @@ static int _ai_try_attack(Object* a1, Object* a2)
|
||||||
if (ammo != NULL) {
|
if (ammo != NULL) {
|
||||||
ammo = _ai_retrieve_object(a1, ammo);
|
ammo = _ai_retrieve_object(a1, ammo);
|
||||||
if (ammo != NULL) {
|
if (ammo != NULL) {
|
||||||
int v15 = _item_w_reload(weapon, ammo);
|
int v15 = weaponReload(weapon, ammo);
|
||||||
if (v15 == 0) {
|
if (v15 == 0) {
|
||||||
_obj_destroy(ammo);
|
_obj_destroy(ammo);
|
||||||
}
|
}
|
||||||
|
@ -2690,11 +2690,11 @@ static int _ai_try_attack(Object* a1, Object* a2)
|
||||||
}
|
}
|
||||||
|
|
||||||
v38 = 0;
|
v38 = 0;
|
||||||
if (_ai_attack(a1, a2, hitMode) == -1 || _item_w_mp_cost(a1, hitMode, 0) > a1->data.critter.combat.ap) {
|
if (_ai_attack(a1, a2, hitMode) == -1 || weaponGetActionPointCost(a1, hitMode, 0) > a1->data.critter.combat.ap) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_ai_attack(a1, a2, hitMode) == -1 || _item_w_mp_cost(a1, hitMode, 0) > a1->data.critter.combat.ap) {
|
if (_ai_attack(a1, a2, hitMode) == -1 || weaponGetActionPointCost(a1, hitMode, 0) > a1->data.critter.combat.ap) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2732,7 +2732,7 @@ void _cai_attempt_w_reload(Object* critter_obj, int a2)
|
||||||
|
|
||||||
v5 = ammoGetQuantity(weapon_obj);
|
v5 = ammoGetQuantity(weapon_obj);
|
||||||
if (v5 < ammoGetCapacity(weapon_obj) && _ai_have_ammo(critter_obj, weapon_obj, &ammo_obj)) {
|
if (v5 < ammoGetCapacity(weapon_obj) && _ai_have_ammo(critter_obj, weapon_obj, &ammo_obj)) {
|
||||||
v9 = _item_w_reload(weapon_obj, ammo_obj);
|
v9 = weaponReload(weapon_obj, ammo_obj);
|
||||||
if (v9 == 0) {
|
if (v9 == 0) {
|
||||||
_obj_destroy(ammo_obj);
|
_obj_destroy(ammo_obj);
|
||||||
}
|
}
|
||||||
|
@ -3202,7 +3202,7 @@ Object* _combat_ai_random_target(Attack* attack)
|
||||||
// Looks like this function does nothing because it's result is not used. I
|
// Looks like this function does nothing because it's result is not used. I
|
||||||
// suppose it was planned to use range as a condition below, but it was
|
// suppose it was planned to use range as a condition below, but it was
|
||||||
// later moved into 0x426614, but remained here.
|
// later moved into 0x426614, but remained here.
|
||||||
_item_w_range(attack->attacker, attack->hitMode);
|
weaponGetRange(attack->attacker, attack->hitMode);
|
||||||
|
|
||||||
Object* critter = NULL;
|
Object* critter = NULL;
|
||||||
|
|
||||||
|
|
|
@ -883,7 +883,7 @@ void critterKill(Object* critter, int anim, bool a3)
|
||||||
_critterClearObj = critter;
|
_critterClearObj = critter;
|
||||||
_queue_clear_type(EVENT_TYPE_DRUG, _critterClearObjDrugs);
|
_queue_clear_type(EVENT_TYPE_DRUG, _critterClearObjDrugs);
|
||||||
|
|
||||||
_item_destroy_all_hidden(critter);
|
itemDestroyAllHidden(critter);
|
||||||
|
|
||||||
if (a3) {
|
if (a3) {
|
||||||
tileWindowRefreshRect(&updatedRect, elevation);
|
tileWindowRefreshRect(&updatedRect, elevation);
|
||||||
|
|
|
@ -3258,16 +3258,16 @@ void _gdialog_barter_cleanup_tables()
|
||||||
length = inventory->length;
|
length = inventory->length;
|
||||||
for (int index = 0; index < length; index++) {
|
for (int index = 0; index < length; index++) {
|
||||||
Object* item = inventory->items->item;
|
Object* item = inventory->items->item;
|
||||||
int quantity = _item_count(_peon_table_obj, item);
|
int quantity = itemGetQuantity(_peon_table_obj, item);
|
||||||
_item_move_force(_peon_table_obj, gDude, item, quantity);
|
itemMoveForce(_peon_table_obj, gDude, item, quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
inventory = &(_barterer_table_obj->data.inventory);
|
inventory = &(_barterer_table_obj->data.inventory);
|
||||||
length = inventory->length;
|
length = inventory->length;
|
||||||
for (int index = 0; index < length; index++) {
|
for (int index = 0; index < length; index++) {
|
||||||
Object* item = inventory->items->item;
|
Object* item = inventory->items->item;
|
||||||
int quantity = _item_count(_barterer_table_obj, item);
|
int quantity = itemGetQuantity(_barterer_table_obj, item);
|
||||||
_item_move_force(_barterer_table_obj, gGameDialogSpeaker, item, quantity);
|
itemMoveForce(_barterer_table_obj, gGameDialogSpeaker, item, quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_barterer_temp_obj != NULL) {
|
if (_barterer_temp_obj != NULL) {
|
||||||
|
@ -3275,8 +3275,8 @@ void _gdialog_barter_cleanup_tables()
|
||||||
length = inventory->length;
|
length = inventory->length;
|
||||||
for (int index = 0; index < length; index++) {
|
for (int index = 0; index < length; index++) {
|
||||||
Object* item = inventory->items->item;
|
Object* item = inventory->items->item;
|
||||||
int quantity = _item_count(_barterer_temp_obj, item);
|
int quantity = itemGetQuantity(_barterer_temp_obj, item);
|
||||||
_item_move_force(_barterer_temp_obj, gGameDialogSpeaker, item, quantity);
|
itemMoveForce(_barterer_temp_obj, gGameDialogSpeaker, item, quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1016,7 +1016,7 @@ void _gmouse_handle_event(int mouseX, int mouseY, int mouseState)
|
||||||
? HIT_MODE_RIGHT_WEAPON_PRIMARY
|
? HIT_MODE_RIGHT_WEAPON_PRIMARY
|
||||||
: HIT_MODE_LEFT_WEAPON_PRIMARY;
|
: HIT_MODE_LEFT_WEAPON_PRIMARY;
|
||||||
|
|
||||||
int actionPointsRequired = _item_mp_cost(gDude, hitMode, false);
|
int actionPointsRequired = itemGetActionPointCost(gDude, hitMode, false);
|
||||||
if (actionPointsRequired <= gDude->data.critter.combat.ap) {
|
if (actionPointsRequired <= gDude->data.critter.combat.ap) {
|
||||||
if (_action_use_an_item_on_object(gDude, object, weapon) != -1) {
|
if (_action_use_an_item_on_object(gDude, object, weapon) != -1) {
|
||||||
int actionPoints = gDude->data.critter.combat.ap;
|
int actionPoints = gDude->data.critter.combat.ap;
|
||||||
|
|
|
@ -1236,7 +1236,7 @@ int interfaceUpdateItems(bool animated, int leftItemAction, int rightItemAction)
|
||||||
Object* item1 = critterGetItem1(gDude);
|
Object* item1 = critterGetItem1(gDude);
|
||||||
if (item1 == leftItemState->item && leftItemState->item != NULL) {
|
if (item1 == leftItemState->item && leftItemState->item != NULL) {
|
||||||
if (leftItemState->item != NULL) {
|
if (leftItemState->item != NULL) {
|
||||||
leftItemState->isDisabled = _can_use_weapon(item1);
|
leftItemState->isDisabled = dudeIsWeaponDisabled(item1);
|
||||||
leftItemState->itemFid = itemGetInventoryFid(item1);
|
leftItemState->itemFid = itemGetInventoryFid(item1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1246,7 +1246,7 @@ int interfaceUpdateItems(bool animated, int leftItemAction, int rightItemAction)
|
||||||
leftItemState->item = item1;
|
leftItemState->item = item1;
|
||||||
|
|
||||||
if (item1 != NULL) {
|
if (item1 != NULL) {
|
||||||
leftItemState->isDisabled = _can_use_weapon(item1);
|
leftItemState->isDisabled = dudeIsWeaponDisabled(item1);
|
||||||
leftItemState->primaryHitMode = HIT_MODE_LEFT_WEAPON_PRIMARY;
|
leftItemState->primaryHitMode = HIT_MODE_LEFT_WEAPON_PRIMARY;
|
||||||
leftItemState->secondaryHitMode = HIT_MODE_LEFT_WEAPON_SECONDARY;
|
leftItemState->secondaryHitMode = HIT_MODE_LEFT_WEAPON_SECONDARY;
|
||||||
leftItemState->isWeapon = itemGetType(item1) == ITEM_TYPE_WEAPON;
|
leftItemState->isWeapon = itemGetType(item1) == ITEM_TYPE_WEAPON;
|
||||||
|
@ -1285,7 +1285,7 @@ int interfaceUpdateItems(bool animated, int leftItemAction, int rightItemAction)
|
||||||
Object* item2 = critterGetItem2(gDude);
|
Object* item2 = critterGetItem2(gDude);
|
||||||
if (item2 == rightItemState->item && rightItemState->item != NULL) {
|
if (item2 == rightItemState->item && rightItemState->item != NULL) {
|
||||||
if (rightItemState->item != NULL) {
|
if (rightItemState->item != NULL) {
|
||||||
rightItemState->isDisabled = _can_use_weapon(rightItemState->item);
|
rightItemState->isDisabled = dudeIsWeaponDisabled(rightItemState->item);
|
||||||
rightItemState->itemFid = itemGetInventoryFid(rightItemState->item);
|
rightItemState->itemFid = itemGetInventoryFid(rightItemState->item);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1295,7 +1295,7 @@ int interfaceUpdateItems(bool animated, int leftItemAction, int rightItemAction)
|
||||||
rightItemState->item = item2;
|
rightItemState->item = item2;
|
||||||
|
|
||||||
if (item2 != NULL) {
|
if (item2 != NULL) {
|
||||||
rightItemState->isDisabled = _can_use_weapon(item2);
|
rightItemState->isDisabled = dudeIsWeaponDisabled(item2);
|
||||||
rightItemState->primaryHitMode = HIT_MODE_RIGHT_WEAPON_PRIMARY;
|
rightItemState->primaryHitMode = HIT_MODE_RIGHT_WEAPON_PRIMARY;
|
||||||
rightItemState->secondaryHitMode = HIT_MODE_RIGHT_WEAPON_SECONDARY;
|
rightItemState->secondaryHitMode = HIT_MODE_RIGHT_WEAPON_SECONDARY;
|
||||||
rightItemState->isWeapon = itemGetType(item2) == ITEM_TYPE_WEAPON;
|
rightItemState->isWeapon = itemGetType(item2) == ITEM_TYPE_WEAPON;
|
||||||
|
@ -1407,7 +1407,7 @@ int interfaceCycleItemAction()
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
case INTERFACE_ITEM_ACTION_PRIMARY_AIMING:
|
case INTERFACE_ITEM_ACTION_PRIMARY_AIMING:
|
||||||
if (_item_w_called_shot(gDude, itemState->primaryHitMode)) {
|
if (critterCanAim(gDude, itemState->primaryHitMode)) {
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1422,7 +1422,7 @@ int interfaceCycleItemAction()
|
||||||
if (itemState->secondaryHitMode != HIT_MODE_PUNCH
|
if (itemState->secondaryHitMode != HIT_MODE_PUNCH
|
||||||
&& itemState->secondaryHitMode != HIT_MODE_KICK
|
&& itemState->secondaryHitMode != HIT_MODE_KICK
|
||||||
&& weaponGetAttackTypeForHitMode(itemState->item, itemState->secondaryHitMode) != ATTACK_TYPE_NONE
|
&& weaponGetAttackTypeForHitMode(itemState->item, itemState->secondaryHitMode) != ATTACK_TYPE_NONE
|
||||||
&& _item_w_called_shot(gDude, itemState->secondaryHitMode)) {
|
&& critterCanAim(gDude, itemState->secondaryHitMode)) {
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1461,7 +1461,7 @@ void _intface_use_item()
|
||||||
? HIT_MODE_LEFT_WEAPON_RELOAD
|
? HIT_MODE_LEFT_WEAPON_RELOAD
|
||||||
: HIT_MODE_RIGHT_WEAPON_RELOAD;
|
: HIT_MODE_RIGHT_WEAPON_RELOAD;
|
||||||
|
|
||||||
int actionPointsRequired = _item_mp_cost(gDude, hitMode, false);
|
int actionPointsRequired = itemGetActionPointCost(gDude, hitMode, false);
|
||||||
if (actionPointsRequired <= gDude->data.critter.combat.ap) {
|
if (actionPointsRequired <= gDude->data.critter.combat.ap) {
|
||||||
if (_intface_item_reload() == 0) {
|
if (_intface_item_reload() == 0) {
|
||||||
if (actionPointsRequired > gDude->data.critter.combat.ap) {
|
if (actionPointsRequired > gDude->data.critter.combat.ap) {
|
||||||
|
@ -1487,7 +1487,7 @@ void _intface_use_item()
|
||||||
gameMouseSetMode(GAME_MOUSE_MODE_USE_CROSSHAIR);
|
gameMouseSetMode(GAME_MOUSE_MODE_USE_CROSSHAIR);
|
||||||
} else if (_obj_action_can_use(ptr->item)) {
|
} else if (_obj_action_can_use(ptr->item)) {
|
||||||
if (isInCombat()) {
|
if (isInCombat()) {
|
||||||
int actionPointsRequired = _item_mp_cost(gDude, ptr->secondaryHitMode, false);
|
int actionPointsRequired = itemGetActionPointCost(gDude, ptr->secondaryHitMode, false);
|
||||||
if (actionPointsRequired <= gDude->data.critter.combat.ap) {
|
if (actionPointsRequired <= gDude->data.critter.combat.ap) {
|
||||||
_obj_use_item(gDude, ptr->item);
|
_obj_use_item(gDude, ptr->item);
|
||||||
interfaceUpdateItems(false, INTERFACE_ITEM_ACTION_DEFAULT, INTERFACE_ITEM_ACTION_DEFAULT);
|
interfaceUpdateItems(false, INTERFACE_ITEM_ACTION_DEFAULT, INTERFACE_ITEM_ACTION_DEFAULT);
|
||||||
|
@ -1748,7 +1748,7 @@ static int interfaceBarRefreshMainAction()
|
||||||
artUnlock(useTextFrmHandle);
|
artUnlock(useTextFrmHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
actionPoints = _item_mp_cost(gDude, itemState->primaryHitMode, false);
|
actionPoints = itemGetActionPointCost(gDude, itemState->primaryHitMode, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int primaryFid = -1;
|
int primaryFid = -1;
|
||||||
|
@ -1771,7 +1771,7 @@ static int interfaceBarRefreshMainAction()
|
||||||
hitMode = itemState->secondaryHitMode;
|
hitMode = itemState->secondaryHitMode;
|
||||||
break;
|
break;
|
||||||
case INTERFACE_ITEM_ACTION_RELOAD:
|
case INTERFACE_ITEM_ACTION_RELOAD:
|
||||||
actionPoints = _item_mp_cost(gDude, gInterfaceCurrentHand == HAND_LEFT ? HIT_MODE_LEFT_WEAPON_RELOAD : HIT_MODE_RIGHT_WEAPON_RELOAD, false);
|
actionPoints = itemGetActionPointCost(gDude, gInterfaceCurrentHand == HAND_LEFT ? HIT_MODE_LEFT_WEAPON_RELOAD : HIT_MODE_RIGHT_WEAPON_RELOAD, false);
|
||||||
primaryFid = buildFid(OBJ_TYPE_INTERFACE, 291, 0, 0, 0);
|
primaryFid = buildFid(OBJ_TYPE_INTERFACE, 291, 0, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1797,7 +1797,7 @@ static int interfaceBarRefreshMainAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hitMode != -1) {
|
if (hitMode != -1) {
|
||||||
actionPoints = _item_w_mp_cost(gDude, hitMode, bullseyeFid != -1);
|
actionPoints = weaponGetActionPointCost(gDude, hitMode, bullseyeFid != -1);
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
int anim = critterGetAnimationForHitMode(gDude, hitMode);
|
int anim = critterGetAnimationForHitMode(gDude, hitMode);
|
||||||
|
@ -2218,7 +2218,7 @@ static int _intface_item_reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool v0 = false;
|
bool v0 = false;
|
||||||
while (_item_w_try_reload(gDude, gInterfaceItemStates[gInterfaceCurrentHand].item) != -1) {
|
while (weaponAttemptReload(gDude, gInterfaceItemStates[gInterfaceCurrentHand].item) != -1) {
|
||||||
v0 = true;
|
v0 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1035,7 +1035,7 @@ static void opDestroyObject(Program* program)
|
||||||
|
|
||||||
Object* owner = objectGetOwner(object);
|
Object* owner = objectGetOwner(object);
|
||||||
if (owner != NULL) {
|
if (owner != NULL) {
|
||||||
int quantity = _item_count(owner, object);
|
int quantity = itemGetQuantity(owner, object);
|
||||||
itemRemove(owner, object, quantity);
|
itemRemove(owner, object, quantity);
|
||||||
|
|
||||||
if (owner == gDude) {
|
if (owner == gDude) {
|
||||||
|
@ -3236,7 +3236,7 @@ static void opMetarule(Program* program)
|
||||||
case METARULE_DROP_ALL_INVEN:
|
case METARULE_DROP_ALL_INVEN:
|
||||||
if (1) {
|
if (1) {
|
||||||
Object* object = static_cast<Object*>(param.pointerValue);
|
Object* object = static_cast<Object*>(param.pointerValue);
|
||||||
result = _item_drop_all(object, object->tile);
|
result = itemDropAll(object, object->tile);
|
||||||
if (gDude == object) {
|
if (gDude == object) {
|
||||||
interfaceUpdateItems(false, INTERFACE_ITEM_ACTION_DEFAULT, INTERFACE_ITEM_ACTION_DEFAULT);
|
interfaceUpdateItems(false, INTERFACE_ITEM_ACTION_DEFAULT, INTERFACE_ITEM_ACTION_DEFAULT);
|
||||||
interfaceRenderArmorClass(false);
|
interfaceRenderArmorClass(false);
|
||||||
|
@ -3630,7 +3630,7 @@ static void opRemoveMultipleObjectsFromInventory(Program* program)
|
||||||
|
|
||||||
bool itemWasEquipped = (item->flags & OBJECT_EQUIPPED) != 0;
|
bool itemWasEquipped = (item->flags & OBJECT_EQUIPPED) != 0;
|
||||||
|
|
||||||
int quantity = _item_count(owner, item);
|
int quantity = itemGetQuantity(owner, item);
|
||||||
if (quantity > quantityToRemove) {
|
if (quantity > quantityToRemove) {
|
||||||
quantity = quantityToRemove;
|
quantity = quantityToRemove;
|
||||||
}
|
}
|
||||||
|
@ -4459,7 +4459,7 @@ static void opDestroyMultipleObjects(Program* program)
|
||||||
|
|
||||||
Object* owner = objectGetOwner(object);
|
Object* owner = objectGetOwner(object);
|
||||||
if (owner != NULL) {
|
if (owner != NULL) {
|
||||||
int quantityToDestroy = _item_count(owner, object);
|
int quantityToDestroy = itemGetQuantity(owner, object);
|
||||||
if (quantityToDestroy > quantity) {
|
if (quantityToDestroy > quantity) {
|
||||||
quantityToDestroy = quantity;
|
quantityToDestroy = quantity;
|
||||||
}
|
}
|
||||||
|
@ -4579,7 +4579,7 @@ static void opMoveObjectInventoryToObject(Program* program)
|
||||||
_correctFidForRemovedItem(object1, item2, flags);
|
_correctFidForRemovedItem(object1, item2, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
_item_move_all(object1, object2);
|
itemMoveAll(object1, object2);
|
||||||
|
|
||||||
if (object1 == gDude) {
|
if (object1 == gDude) {
|
||||||
if (oldArmor != NULL) {
|
if (oldArmor != NULL) {
|
||||||
|
|
|
@ -2612,7 +2612,7 @@ static void inventoryRenderSummary()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Formula is the same as in `weaponGetMeleeDamage`.
|
// Formula is the same as in `weaponGetDamage`.
|
||||||
int minDamage;
|
int minDamage;
|
||||||
int maxDamage;
|
int maxDamage;
|
||||||
int bonusDamage = unarmedGetDamage(hitMode, &minDamage, &maxDamage);
|
int bonusDamage = unarmedGetDamage(hitMode, &minDamage, &maxDamage);
|
||||||
|
@ -2663,7 +2663,7 @@ static void inventoryRenderSummary()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int range = _item_w_range(_stack[0], hitMode);
|
int range = weaponGetRange(_stack[0], hitMode);
|
||||||
|
|
||||||
int damageMin;
|
int damageMin;
|
||||||
int damageMax;
|
int damageMax;
|
||||||
|
@ -2696,7 +2696,7 @@ static void inventoryRenderSummary()
|
||||||
// like we cannot be here with anything besides melee or
|
// like we cannot be here with anything besides melee or
|
||||||
// unarmed.
|
// unarmed.
|
||||||
if (_stack[0] == gDude && (attackType == ATTACK_TYPE_MELEE || attackType == ATTACK_TYPE_UNARMED)) {
|
if (_stack[0] == gDude && (attackType == ATTACK_TYPE_MELEE || attackType == ATTACK_TYPE_UNARMED)) {
|
||||||
// See explanation in `weaponGetMeleeDamage`.
|
// See explanation in `weaponGetDamage`.
|
||||||
damageMin += 2 * perkGetRank(gDude, PERK_BONUS_HTH_DAMAGE);
|
damageMin += 2 * perkGetRank(gDude, PERK_BONUS_HTH_DAMAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3347,7 +3347,7 @@ static void inventoryWindowOpenContextMenu(int keyCode, int inventoryWindowType)
|
||||||
|
|
||||||
int actionMenuItemsLength;
|
int actionMenuItemsLength;
|
||||||
const int* actionMenuItems;
|
const int* actionMenuItems;
|
||||||
if (itemType == ITEM_TYPE_WEAPON && _item_w_can_unload(item)) {
|
if (itemType == ITEM_TYPE_WEAPON && weaponCanBeUnloaded(item)) {
|
||||||
if (inventoryWindowType != INVENTORY_WINDOW_TYPE_NORMAL && objectGetOwner(item) != gDude) {
|
if (inventoryWindowType != INVENTORY_WINDOW_TYPE_NORMAL && objectGetOwner(item) != gDude) {
|
||||||
actionMenuItemsLength = 3;
|
actionMenuItemsLength = 3;
|
||||||
actionMenuItems = _act_weap2;
|
actionMenuItems = _act_weap2;
|
||||||
|
@ -3597,7 +3597,7 @@ static void inventoryWindowOpenContextMenu(int keyCode, int inventoryWindowType)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
Object* ammo = _item_w_unload(item);
|
Object* ammo = weaponUnload(item);
|
||||||
if (ammo == NULL) {
|
if (ammo == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3704,7 +3704,7 @@ int inventoryOpenLooting(Object* a1, Object* a2)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_item_move_all_hidden(a2, a1a);
|
itemMoveAllHidden(a2, a1a);
|
||||||
|
|
||||||
Object* item1 = NULL;
|
Object* item1 = NULL;
|
||||||
Object* item2 = NULL;
|
Object* item2 = NULL;
|
||||||
|
@ -3834,7 +3834,7 @@ int inventoryOpenLooting(Object* a1, Object* a2)
|
||||||
int currentWeight = objectGetInventoryWeight(a1);
|
int currentWeight = objectGetInventoryWeight(a1);
|
||||||
int newInventoryWeight = objectGetInventoryWeight(a2);
|
int newInventoryWeight = objectGetInventoryWeight(a2);
|
||||||
if (newInventoryWeight <= maxCarryWeight - currentWeight) {
|
if (newInventoryWeight <= maxCarryWeight - currentWeight) {
|
||||||
_item_move_all(a2, a1);
|
itemMoveAll(a2, a1);
|
||||||
_display_target_inventory(_target_stack_offset[_target_curr_stack], -1, _target_pud, INVENTORY_WINDOW_TYPE_LOOT);
|
_display_target_inventory(_target_stack_offset[_target_curr_stack], -1, _target_pud, INVENTORY_WINDOW_TYPE_LOOT);
|
||||||
_display_inventory(_stack_offset[_curr_stack], -1, INVENTORY_WINDOW_TYPE_LOOT);
|
_display_inventory(_stack_offset[_curr_stack], -1, INVENTORY_WINDOW_TYPE_LOOT);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4025,7 +4025,7 @@ int inventoryOpenLooting(Object* a1, Object* a2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_item_move_all(a1a, a2);
|
itemMoveAll(a1a, a2);
|
||||||
objectDestroy(a1a, NULL);
|
objectDestroy(a1a, NULL);
|
||||||
|
|
||||||
if (_gIsSteal) {
|
if (_gIsSteal) {
|
||||||
|
@ -4181,7 +4181,7 @@ static int _move_inventory(Object* a1, int a2, Object* a3, bool a4)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc != 1) {
|
if (rc != 1) {
|
||||||
if (_item_move(_inven_dude, a3, a1, quantityToMove) != -1) {
|
if (itemMove(_inven_dude, a3, a1, quantityToMove) != -1) {
|
||||||
rc = 2;
|
rc = 2;
|
||||||
} else {
|
} else {
|
||||||
// There is no space left for that item.
|
// There is no space left for that item.
|
||||||
|
@ -4210,7 +4210,7 @@ static int _move_inventory(Object* a1, int a2, Object* a3, bool a4)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc != 1) {
|
if (rc != 1) {
|
||||||
if (_item_move(a3, _inven_dude, a1, quantityToMove) == 0) {
|
if (itemMove(a3, _inven_dude, a1, quantityToMove) == 0) {
|
||||||
if ((a1->flags & OBJECT_IN_RIGHT_HAND) != 0) {
|
if ((a1->flags & OBJECT_IN_RIGHT_HAND) != 0) {
|
||||||
a3->fid = buildFid(FID_TYPE(a3->fid), a3->fid & 0xFFF, FID_ANIM_TYPE(a3->fid), 0, a3->rotation + 1);
|
a3->fid = buildFid(FID_TYPE(a3->fid), a3->fid & 0xFFF, FID_ANIM_TYPE(a3->fid), 0, a3->rotation + 1);
|
||||||
}
|
}
|
||||||
|
@ -4298,7 +4298,7 @@ static int _barter_attempt_transaction(Object* a1, Object* a2, Object* a3, Objec
|
||||||
if (a2->data.inventory.length == 0) {
|
if (a2->data.inventory.length == 0) {
|
||||||
v11 = true;
|
v11 = true;
|
||||||
} else {
|
} else {
|
||||||
if (_item_queued(a2)) {
|
if (itemIsQueued(a2)) {
|
||||||
if (a2->pid != PROTO_ID_GEIGER_COUNTER_I || miscItemTurnOff(a2) == -1) {
|
if (a2->pid != PROTO_ID_GEIGER_COUNTER_I || miscItemTurnOff(a2) == -1) {
|
||||||
v11 = true;
|
v11 = true;
|
||||||
}
|
}
|
||||||
|
@ -4322,8 +4322,8 @@ static int _barter_attempt_transaction(Object* a1, Object* a2, Object* a3, Objec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_item_move_all(a4, a1);
|
itemMoveAll(a4, a1);
|
||||||
_item_move_all(a2, a3);
|
itemMoveAll(a2, a3);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4383,7 +4383,7 @@ static void _barter_move_inventory(Object* a1, int quantity, int a3, int a4, Obj
|
||||||
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_X, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_Y)) {
|
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_X, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_Y)) {
|
||||||
int quantityToMove = quantity > 1 ? inventoryQuantitySelect(INVENTORY_WINDOW_TYPE_MOVE_ITEMS, a1, quantity) : 1;
|
int quantityToMove = quantity > 1 ? inventoryQuantitySelect(INVENTORY_WINDOW_TYPE_MOVE_ITEMS, a1, quantity) : 1;
|
||||||
if (quantityToMove != -1) {
|
if (quantityToMove != -1) {
|
||||||
if (_item_move_force(_inven_dude, a6, a1, quantityToMove) == -1) {
|
if (itemMoveForce(_inven_dude, a6, a1, quantityToMove) == -1) {
|
||||||
// There is no space left for that item.
|
// There is no space left for that item.
|
||||||
messageListItem.num = 26;
|
messageListItem.num = 26;
|
||||||
if (messageListGetItem(&gInventoryMessageList, &messageListItem)) {
|
if (messageListGetItem(&gInventoryMessageList, &messageListItem)) {
|
||||||
|
@ -4396,7 +4396,7 @@ static void _barter_move_inventory(Object* a1, int quantity, int a3, int a4, Obj
|
||||||
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_X, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_Y)) {
|
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_X, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_Y)) {
|
||||||
int quantityToMove = quantity > 1 ? inventoryQuantitySelect(INVENTORY_WINDOW_TYPE_MOVE_ITEMS, a1, quantity) : 1;
|
int quantityToMove = quantity > 1 ? inventoryQuantitySelect(INVENTORY_WINDOW_TYPE_MOVE_ITEMS, a1, quantity) : 1;
|
||||||
if (quantityToMove != -1) {
|
if (quantityToMove != -1) {
|
||||||
if (_item_move_force(a5, a6, a1, quantityToMove) == -1) {
|
if (itemMoveForce(a5, a6, a1, quantityToMove) == -1) {
|
||||||
// You cannot pick that up. You are at your maximum weight capacity.
|
// You cannot pick that up. You are at your maximum weight capacity.
|
||||||
messageListItem.num = 25;
|
messageListItem.num = 25;
|
||||||
if (messageListGetItem(&gInventoryMessageList, &messageListItem)) {
|
if (messageListGetItem(&gInventoryMessageList, &messageListItem)) {
|
||||||
|
@ -4466,7 +4466,7 @@ static void _barter_move_from_table_inventory(Object* a1, int quantity, int a3,
|
||||||
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_X, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_Y)) {
|
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_X, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_Y)) {
|
||||||
int quantityToMove = quantity > 1 ? inventoryQuantitySelect(INVENTORY_WINDOW_TYPE_MOVE_ITEMS, a1, quantity) : 1;
|
int quantityToMove = quantity > 1 ? inventoryQuantitySelect(INVENTORY_WINDOW_TYPE_MOVE_ITEMS, a1, quantity) : 1;
|
||||||
if (quantityToMove != -1) {
|
if (quantityToMove != -1) {
|
||||||
if (_item_move_force(a5, _inven_dude, a1, quantityToMove) == -1) {
|
if (itemMoveForce(a5, _inven_dude, a1, quantityToMove) == -1) {
|
||||||
// There is no space left for that item.
|
// There is no space left for that item.
|
||||||
messageListItem.num = 26;
|
messageListItem.num = 26;
|
||||||
if (messageListGetItem(&gInventoryMessageList, &messageListItem)) {
|
if (messageListGetItem(&gInventoryMessageList, &messageListItem)) {
|
||||||
|
@ -4479,7 +4479,7 @@ static void _barter_move_from_table_inventory(Object* a1, int quantity, int a3,
|
||||||
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_X, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_Y)) {
|
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_X, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_Y)) {
|
||||||
int quantityToMove = quantity > 1 ? inventoryQuantitySelect(INVENTORY_WINDOW_TYPE_MOVE_ITEMS, a1, quantity) : 1;
|
int quantityToMove = quantity > 1 ? inventoryQuantitySelect(INVENTORY_WINDOW_TYPE_MOVE_ITEMS, a1, quantity) : 1;
|
||||||
if (quantityToMove != -1) {
|
if (quantityToMove != -1) {
|
||||||
if (_item_move_force(a5, a4, a1, quantityToMove) == -1) {
|
if (itemMoveForce(a5, a4, a1, quantityToMove) == -1) {
|
||||||
// You cannot pick that up. You are at your maximum weight capacity.
|
// You cannot pick that up. You are at your maximum weight capacity.
|
||||||
messageListItem.num = 25;
|
messageListItem.num = 25;
|
||||||
if (messageListGetItem(&gInventoryMessageList, &messageListItem)) {
|
if (messageListGetItem(&gInventoryMessageList, &messageListItem)) {
|
||||||
|
@ -4678,8 +4678,8 @@ void inventoryOpenTrade(int win, Object* a2, Object* a3, Object* a4, int a5)
|
||||||
_barter_mod = a5 + modifier;
|
_barter_mod = a5 + modifier;
|
||||||
|
|
||||||
if (keyCode == KEY_LOWERCASE_T || modifier <= -30) {
|
if (keyCode == KEY_LOWERCASE_T || modifier <= -30) {
|
||||||
_item_move_all(a4, a2);
|
itemMoveAll(a4, a2);
|
||||||
_item_move_all(a3, gDude);
|
itemMoveAll(a3, gDude);
|
||||||
_barter_end_to_talk_to();
|
_barter_end_to_talk_to();
|
||||||
break;
|
break;
|
||||||
} else if (keyCode == KEY_LOWERCASE_M) {
|
} else if (keyCode == KEY_LOWERCASE_M) {
|
||||||
|
@ -4886,7 +4886,7 @@ void inventoryOpenTrade(int win, Object* a2, Object* a3, Object* a4, int a5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_item_move_all(a1a, a2);
|
itemMoveAll(a1a, a2);
|
||||||
objectDestroy(a1a, NULL);
|
objectDestroy(a1a, NULL);
|
||||||
|
|
||||||
if (armor != NULL) {
|
if (armor != NULL) {
|
||||||
|
@ -5042,7 +5042,7 @@ static int _drop_ammo_into_weapon(Object* weapon, Object* ammo, Object** a3, int
|
||||||
bool v17 = false;
|
bool v17 = false;
|
||||||
int rc = itemRemove(_inven_dude, weapon, 1);
|
int rc = itemRemove(_inven_dude, weapon, 1);
|
||||||
for (int index = 0; index < quantityToMove; index++) {
|
for (int index = 0; index < quantityToMove; index++) {
|
||||||
int v11 = _item_w_reload(weapon, v14);
|
int v11 = weaponReload(weapon, v14);
|
||||||
if (v11 == 0) {
|
if (v11 == 0) {
|
||||||
if (a3 != NULL) {
|
if (a3 != NULL) {
|
||||||
*a3 = NULL;
|
*a3 = NULL;
|
||||||
|
|
218
src/item.cc
218
src/item.cc
|
@ -505,93 +505,64 @@ static int _item_move_func(Object* a1, Object* a2, Object* a3, int quantity, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x47769C
|
// 0x47769C
|
||||||
int _item_move(Object* a1, Object* a2, Object* a3, int quantity)
|
int itemMove(Object* from, Object* to, Object* item, int quantity)
|
||||||
{
|
{
|
||||||
return _item_move_func(a1, a2, a3, quantity, false);
|
return _item_move_func(from, to, item, quantity, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x4776A4
|
// 0x4776A4
|
||||||
int _item_move_force(Object* a1, Object* a2, Object* a3, int quantity)
|
int itemMoveForce(Object* from, Object* to, Object* item, int quantity)
|
||||||
{
|
{
|
||||||
return _item_move_func(a1, a2, a3, quantity, true);
|
return _item_move_func(from, to, item, quantity, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x4776AC
|
// 0x4776AC
|
||||||
void _item_move_all(Object* a1, Object* a2)
|
void itemMoveAll(Object* from, Object* to)
|
||||||
{
|
{
|
||||||
Inventory* inventory = &(a1->data.inventory);
|
Inventory* inventory = &(from->data.inventory);
|
||||||
while (inventory->length > 0) {
|
while (inventory->length > 0) {
|
||||||
InventoryItem* inventoryItem = &(inventory->items[0]);
|
InventoryItem* inventoryItem = &(inventory->items[0]);
|
||||||
_item_move_func(a1, a2, inventoryItem->item, inventoryItem->quantity, true);
|
// NOTE: Uninline.
|
||||||
|
itemMoveForce(from, to, inventoryItem->item, inventoryItem->quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x4776E0
|
// 0x4776E0
|
||||||
int _item_move_all_hidden(Object* a1, Object* a2)
|
int itemMoveAllHidden(Object* from, Object* to)
|
||||||
{
|
{
|
||||||
Inventory* inventory = &(a1->data.inventory);
|
Inventory* inventory = &(from->data.inventory);
|
||||||
// TODO: Not sure about two loops.
|
for (int index = 0; index < inventory->length;) {
|
||||||
for (int i = 0; i < inventory->length;) {
|
InventoryItem* inventoryItem = &(inventory->items[index]);
|
||||||
for (int j = i; j < inventory->length;) {
|
// NOTE: Uninline.
|
||||||
bool v5;
|
if (itemIsHidden(inventoryItem->item)) {
|
||||||
InventoryItem* inventoryItem = &(inventory->items[j]);
|
// NOTE: Uninline.
|
||||||
if (PID_TYPE(inventoryItem->item->pid) == OBJ_TYPE_ITEM) {
|
itemMoveForce(from, to, inventoryItem->item, inventoryItem->quantity);
|
||||||
Proto* proto;
|
} else {
|
||||||
if (protoGetProto(inventoryItem->item->pid, &proto) != -1) {
|
index++;
|
||||||
v5 = (proto->item.extendedFlags & ItemProtoExtendedFlags_NaturalWeapon) == 0;
|
|
||||||
} else {
|
|
||||||
v5 = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
v5 = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!v5) {
|
|
||||||
_item_move_func(a1, a2, inventoryItem->item, inventoryItem->quantity, true);
|
|
||||||
} else {
|
|
||||||
i++;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x477770
|
// 0x477770
|
||||||
int _item_destroy_all_hidden(Object* a1)
|
int itemDestroyAllHidden(Object* owner)
|
||||||
{
|
{
|
||||||
Inventory* inventory = &(a1->data.inventory);
|
Inventory* inventory = &(owner->data.inventory);
|
||||||
// TODO: Not sure about this one. Why two loops?
|
for (int index = 0; index < inventory->length;) {
|
||||||
for (int i = 0; i < inventory->length;) {
|
InventoryItem* inventoryItem = &(inventory->items[index]);
|
||||||
// TODO: Probably wrong, something with two loops.
|
// NOTE: Uninline.
|
||||||
for (int j = i; j < inventory->length;) {
|
if (itemIsHidden(inventoryItem->item)) {
|
||||||
bool v5;
|
itemRemove(owner, inventoryItem->item, 1);
|
||||||
InventoryItem* inventoryItem = &(inventory->items[j]);
|
_obj_destroy(inventoryItem->item);
|
||||||
if (PID_TYPE(inventoryItem->item->pid) == OBJ_TYPE_ITEM) {
|
} else {
|
||||||
Proto* proto;
|
index++;
|
||||||
if (protoGetProto(inventoryItem->item->pid, &proto) != -1) {
|
|
||||||
v5 = (proto->item.extendedFlags & ItemProtoExtendedFlags_NaturalWeapon) == 0;
|
|
||||||
} else {
|
|
||||||
v5 = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
v5 = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!v5) {
|
|
||||||
itemRemove(a1, inventoryItem->item, 1);
|
|
||||||
_obj_destroy(inventoryItem->item);
|
|
||||||
} else {
|
|
||||||
i++;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x477804
|
// 0x477804
|
||||||
int _item_drop_all(Object* critter, int tile)
|
int itemDropAll(Object* critter, int tile)
|
||||||
{
|
{
|
||||||
bool hasEquippedItems = false;
|
bool hasEquippedItems = false;
|
||||||
|
|
||||||
|
@ -667,11 +638,11 @@ static bool _item_identical(Object* a1, Object* a2)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((a1->flags & (OBJECT_EQUIPPED | OBJECT_USED)) != 0) {
|
if ((a1->flags & (OBJECT_EQUIPPED | OBJECT_QUEUED)) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((a2->flags & (OBJECT_EQUIPPED | OBJECT_USED)) != 0) {
|
if ((a2->flags & (OBJECT_EQUIPPED | OBJECT_QUEUED)) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,7 +750,7 @@ int itemGetWeight(Object* item)
|
||||||
int weight = proto->item.weight;
|
int weight = proto->item.weight;
|
||||||
|
|
||||||
// NOTE: Uninline.
|
// NOTE: Uninline.
|
||||||
if (weaponIsNatural(item)) {
|
if (itemIsHidden(item)) {
|
||||||
weight = 0;
|
weight = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -972,7 +943,7 @@ int objectGetInventoryWeight(Object* obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x477F3C
|
// 0x477F3C
|
||||||
bool _can_use_weapon(Object* weapon)
|
bool dudeIsWeaponDisabled(Object* weapon)
|
||||||
{
|
{
|
||||||
if (weapon == NULL) {
|
if (weapon == NULL) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1001,12 +972,11 @@ bool _can_use_weapon(Object* weapon)
|
||||||
// 0x477FB0
|
// 0x477FB0
|
||||||
int itemGetInventoryFid(Object* item)
|
int itemGetInventoryFid(Object* item)
|
||||||
{
|
{
|
||||||
Proto* proto;
|
|
||||||
|
|
||||||
if (item == NULL) {
|
if (item == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Proto* proto;
|
||||||
protoGetProto(item->pid, &proto);
|
protoGetProto(item->pid, &proto);
|
||||||
|
|
||||||
return proto->item.inventoryFid;
|
return proto->item.inventoryFid;
|
||||||
|
@ -1030,7 +1000,7 @@ Object* critterGetWeaponForHitMode(Object* critter, int hitMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x478040
|
// 0x478040
|
||||||
int _item_mp_cost(Object* obj, int hitMode, bool aiming)
|
int itemGetActionPointCost(Object* obj, int hitMode, bool aiming)
|
||||||
{
|
{
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1042,25 +1012,24 @@ int _item_mp_cost(Object* obj, int hitMode, bool aiming)
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _item_w_mp_cost(obj, hitMode, aiming);
|
return weaponGetActionPointCost(obj, hitMode, aiming);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns quantity of [a2] in [obj]s inventory.
|
// Returns quantity of [item] in [obj]s inventory.
|
||||||
//
|
//
|
||||||
// 0x47808C
|
// 0x47808C
|
||||||
int _item_count(Object* obj, Object* a2)
|
int itemGetQuantity(Object* obj, Object* item)
|
||||||
{
|
{
|
||||||
int quantity = 0;
|
int quantity = 0;
|
||||||
|
|
||||||
Inventory* inventory = &(obj->data.inventory);
|
Inventory* inventory = &(obj->data.inventory);
|
||||||
for (int index = 0; index < inventory->length; index++) {
|
for (int index = 0; index < inventory->length; index++) {
|
||||||
InventoryItem* inventoryItem = &(inventory->items[index]);
|
InventoryItem* inventoryItem = &(inventory->items[index]);
|
||||||
Object* item = inventoryItem->item;
|
if (inventoryItem->item == item) {
|
||||||
if (item == a2) {
|
|
||||||
quantity = inventoryItem->quantity;
|
quantity = inventoryItem->quantity;
|
||||||
} else {
|
} else {
|
||||||
if (itemGetType(item) == ITEM_TYPE_CONTAINER) {
|
if (itemGetType(inventoryItem->item) == ITEM_TYPE_CONTAINER) {
|
||||||
quantity = _item_count(item, a2);
|
quantity = itemGetQuantity(inventoryItem->item, item);
|
||||||
if (quantity > 0) {
|
if (quantity > 0) {
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
@ -1074,25 +1043,25 @@ int _item_count(Object* obj, Object* a2)
|
||||||
// Returns true if [a1] posesses an item with 0x2000 flag.
|
// Returns true if [a1] posesses an item with 0x2000 flag.
|
||||||
//
|
//
|
||||||
// 0x4780E4
|
// 0x4780E4
|
||||||
int _item_queued(Object* obj)
|
int itemIsQueued(Object* obj)
|
||||||
{
|
{
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((obj->flags & OBJECT_USED) != 0) {
|
if ((obj->flags & OBJECT_QUEUED) != 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Inventory* inventory = &(obj->data.inventory);
|
Inventory* inventory = &(obj->data.inventory);
|
||||||
for (int index = 0; index < inventory->length; index++) {
|
for (int index = 0; index < inventory->length; index++) {
|
||||||
InventoryItem* inventoryItem = &(inventory->items[index]);
|
InventoryItem* inventoryItem = &(inventory->items[index]);
|
||||||
if ((inventoryItem->item->flags & OBJECT_USED) != 0) {
|
if ((inventoryItem->item->flags & OBJECT_QUEUED) != 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemGetType(inventoryItem->item) == ITEM_TYPE_CONTAINER) {
|
if (itemGetType(inventoryItem->item) == ITEM_TYPE_CONTAINER) {
|
||||||
if (_item_queued(inventoryItem->item)) {
|
if (itemIsQueued(inventoryItem->item)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1102,36 +1071,36 @@ int _item_queued(Object* obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x478154
|
// 0x478154
|
||||||
Object* _item_replace(Object* a1, Object* a2, int a3)
|
Object* itemReplace(Object* owner, Object* itemToReplace, int flags)
|
||||||
{
|
{
|
||||||
if (a1 == NULL) {
|
if (owner == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a2 == NULL) {
|
if (itemToReplace == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Inventory* inventory = &(a1->data.inventory);
|
Inventory* inventory = &(owner->data.inventory);
|
||||||
for (int index = 0; index < inventory->length; index++) {
|
for (int index = 0; index < inventory->length; index++) {
|
||||||
InventoryItem* inventoryItem = &(inventory->items[index]);
|
InventoryItem* inventoryItem = &(inventory->items[index]);
|
||||||
if (_item_identical(inventoryItem->item, a2)) {
|
if (_item_identical(inventoryItem->item, itemToReplace)) {
|
||||||
Object* item = inventoryItem->item;
|
Object* item = inventoryItem->item;
|
||||||
if (itemRemove(a1, item, 1) == 0) {
|
if (itemRemove(owner, item, 1) == 0) {
|
||||||
item->flags |= a3;
|
item->flags |= flags;
|
||||||
if (itemAdd(a1, item, 1) == 0) {
|
if (itemAdd(owner, item, 1) == 0) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
item->flags &= ~a3;
|
item->flags &= ~flags;
|
||||||
if (itemAdd(a1, item, 1) != 0) {
|
if (itemAdd(owner, item, 1) != 0) {
|
||||||
_obj_destroy(item);
|
_obj_destroy(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemGetType(inventoryItem->item) == ITEM_TYPE_CONTAINER) {
|
if (itemGetType(inventoryItem->item) == ITEM_TYPE_CONTAINER) {
|
||||||
Object* obj = _item_replace(inventoryItem->item, a2, a3);
|
Object* obj = itemReplace(inventoryItem->item, itemToReplace, flags);
|
||||||
if (obj != NULL) {
|
if (obj != NULL) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -1141,24 +1110,19 @@ Object* _item_replace(Object* a1, Object* a2, int a3)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if [item] is an natural weapon of it's owner.
|
|
||||||
//
|
|
||||||
// See [ItemProtoExtendedFlags_NaturalWeapon] for more details on natural weapons.
|
|
||||||
//
|
|
||||||
// 0x478244
|
// 0x478244
|
||||||
int weaponIsNatural(Object* obj)
|
bool itemIsHidden(Object* item)
|
||||||
{
|
{
|
||||||
|
if (PID_TYPE(item->pid) != OBJ_TYPE_ITEM) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Proto* proto;
|
Proto* proto;
|
||||||
|
if (protoGetProto(item->pid, &proto) == -1) {
|
||||||
if (PID_TYPE(obj->pid) != OBJ_TYPE_ITEM) {
|
return false;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (protoGetProto(obj->pid, &proto) == -1) {
|
return (proto->item.extendedFlags & ITEM_HIDDEN) != 0;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return proto->item.extendedFlags & ItemProtoExtendedFlags_NaturalWeapon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x478280
|
// 0x478280
|
||||||
|
@ -1217,7 +1181,7 @@ int weaponGetSkillForHitMode(Object* weapon, int hitMode)
|
||||||
// Returns skill value when critter is about to perform hitMode.
|
// Returns skill value when critter is about to perform hitMode.
|
||||||
//
|
//
|
||||||
// 0x478370
|
// 0x478370
|
||||||
int _item_w_skill_level(Object* critter, int hitMode)
|
int weaponGetSkillValue(Object* critter, int hitMode)
|
||||||
{
|
{
|
||||||
if (critter == NULL) {
|
if (critter == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1258,7 +1222,7 @@ int weaponGetDamageMinMax(Object* weapon, int* minDamagePtr, int* maxDamagePtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x478448
|
// 0x478448
|
||||||
int weaponGetMeleeDamage(Object* critter, int hitMode)
|
int weaponGetDamage(Object* critter, int hitMode)
|
||||||
{
|
{
|
||||||
if (critter == NULL) {
|
if (critter == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1452,7 +1416,7 @@ void ammoSetQuantity(Object* ammoOrWeapon, int quantity)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x478768
|
// 0x478768
|
||||||
int _item_w_try_reload(Object* critter, Object* weapon)
|
int weaponAttemptReload(Object* critter, Object* weapon)
|
||||||
{
|
{
|
||||||
// NOTE: Uninline.
|
// NOTE: Uninline.
|
||||||
int quantity = ammoGetQuantity(weapon);
|
int quantity = ammoGetQuantity(weapon);
|
||||||
|
@ -1471,7 +1435,7 @@ int _item_w_try_reload(Object* critter, Object* weapon)
|
||||||
|
|
||||||
if (weapon->data.item.weapon.ammoTypePid == ammo->pid) {
|
if (weapon->data.item.weapon.ammoTypePid == ammo->pid) {
|
||||||
if (weaponCanBeReloadedWith(weapon, ammo) != 0) {
|
if (weaponCanBeReloadedWith(weapon, ammo) != 0) {
|
||||||
int rc = _item_w_reload(weapon, ammo);
|
int rc = weaponReload(weapon, ammo);
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
_obj_destroy(ammo);
|
_obj_destroy(ammo);
|
||||||
}
|
}
|
||||||
|
@ -1493,7 +1457,7 @@ int _item_w_try_reload(Object* critter, Object* weapon)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weaponCanBeReloadedWith(weapon, ammo) != 0) {
|
if (weaponCanBeReloadedWith(weapon, ammo) != 0) {
|
||||||
int rc = _item_w_reload(weapon, ammo);
|
int rc = weaponReload(weapon, ammo);
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
_obj_destroy(ammo);
|
_obj_destroy(ammo);
|
||||||
}
|
}
|
||||||
|
@ -1507,7 +1471,7 @@ int _item_w_try_reload(Object* critter, Object* weapon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_item_w_reload(weapon, NULL) != 0) {
|
if (weaponReload(weapon, NULL) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1567,7 +1531,7 @@ bool weaponCanBeReloadedWith(Object* weapon, Object* ammo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x478918
|
// 0x478918
|
||||||
int _item_w_reload(Object* weapon, Object* ammo)
|
int weaponReload(Object* weapon, Object* ammo)
|
||||||
{
|
{
|
||||||
if (!weaponCanBeReloadedWith(weapon, ammo)) {
|
if (!weaponCanBeReloadedWith(weapon, ammo)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1608,7 +1572,7 @@ int _item_w_reload(Object* weapon, Object* ammo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x478A1C
|
// 0x478A1C
|
||||||
int _item_w_range(Object* critter, int hitMode)
|
int weaponGetRange(Object* critter, int hitMode)
|
||||||
{
|
{
|
||||||
int range;
|
int range;
|
||||||
int v12;
|
int v12;
|
||||||
|
@ -1651,7 +1615,7 @@ int _item_w_range(Object* critter, int hitMode)
|
||||||
// Returns action points required for hit mode.
|
// Returns action points required for hit mode.
|
||||||
//
|
//
|
||||||
// 0x478B24
|
// 0x478B24
|
||||||
int _item_w_mp_cost(Object* critter, int hitMode, bool aiming)
|
int weaponGetActionPointCost(Object* critter, int hitMode, bool aiming)
|
||||||
{
|
{
|
||||||
int actionPoints;
|
int actionPoints;
|
||||||
|
|
||||||
|
@ -1680,15 +1644,15 @@ int _item_w_mp_cost(Object* critter, int hitMode, bool aiming)
|
||||||
if (weapon != NULL) {
|
if (weapon != NULL) {
|
||||||
if (hitMode == HIT_MODE_LEFT_WEAPON_PRIMARY || hitMode == HIT_MODE_RIGHT_WEAPON_PRIMARY) {
|
if (hitMode == HIT_MODE_LEFT_WEAPON_PRIMARY || hitMode == HIT_MODE_RIGHT_WEAPON_PRIMARY) {
|
||||||
// NOTE: Uninline.
|
// NOTE: Uninline.
|
||||||
actionPoints = weaponGetActionPointCost1(weapon);
|
actionPoints = weaponGetPrimaryActionPointCost(weapon);
|
||||||
} else {
|
} else {
|
||||||
// NOTE: Uninline.
|
// NOTE: Uninline.
|
||||||
actionPoints = weaponGetActionPointCost2(weapon);
|
actionPoints = weaponGetSecondaryActionPointCost(weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (critter == gDude) {
|
if (critter == gDude) {
|
||||||
if (traitIsSelected(TRAIT_FAST_SHOT)) {
|
if (traitIsSelected(TRAIT_FAST_SHOT)) {
|
||||||
if (_item_w_range(critter, hitMode) > 2) {
|
if (weaponGetRange(critter, hitMode) > 2) {
|
||||||
actionPoints--;
|
actionPoints--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1831,16 +1795,16 @@ char weaponGetSoundId(Object* weapon)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x478E5C
|
// 0x478E5C
|
||||||
int _item_w_called_shot(Object* critter, int hitMode)
|
bool critterCanAim(Object* critter, int hitMode)
|
||||||
{
|
{
|
||||||
if (critter == gDude && traitIsSelected(TRAIT_FAST_SHOT)) {
|
if (critter == gDude && traitIsSelected(TRAIT_FAST_SHOT)) {
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Uninline.
|
// NOTE: Uninline.
|
||||||
int anim = critterGetAnimationForHitMode(critter, hitMode);
|
int anim = critterGetAnimationForHitMode(critter, hitMode);
|
||||||
if (anim == ANIM_FIRE_BURST || anim == ANIM_FIRE_CONTINUOUS) {
|
if (anim == ANIM_FIRE_BURST || anim == ANIM_FIRE_CONTINUOUS) {
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Uninline.
|
// NOTE: Uninline.
|
||||||
|
@ -1854,7 +1818,7 @@ int _item_w_called_shot(Object* critter, int hitMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x478EF4
|
// 0x478EF4
|
||||||
int _item_w_can_unload(Object* weapon)
|
int weaponCanBeUnloaded(Object* weapon)
|
||||||
{
|
{
|
||||||
if (weapon == NULL) {
|
if (weapon == NULL) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1888,9 +1852,9 @@ int _item_w_can_unload(Object* weapon)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x478F80
|
// 0x478F80
|
||||||
Object* _item_w_unload(Object* weapon)
|
Object* weaponUnload(Object* weapon)
|
||||||
{
|
{
|
||||||
if (!_item_w_can_unload(weapon)) {
|
if (!weaponCanBeUnloaded(weapon)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1927,7 +1891,7 @@ Object* _item_w_unload(Object* weapon)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x47905C
|
// 0x47905C
|
||||||
int weaponGetActionPointCost1(Object* weapon)
|
int weaponGetPrimaryActionPointCost(Object* weapon)
|
||||||
{
|
{
|
||||||
if (weapon == NULL) {
|
if (weapon == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1942,7 +1906,7 @@ int weaponGetActionPointCost1(Object* weapon)
|
||||||
// NOTE: Inlined.
|
// NOTE: Inlined.
|
||||||
//
|
//
|
||||||
// 0x479084
|
// 0x479084
|
||||||
int weaponGetActionPointCost2(Object* weapon)
|
int weaponGetSecondaryActionPointCost(Object* weapon)
|
||||||
{
|
{
|
||||||
if (weapon == NULL) {
|
if (weapon == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1983,30 +1947,30 @@ bool weaponIsGrenade(Object* weapon)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x47910C
|
// 0x47910C
|
||||||
int _item_w_area_damage_radius(Object* weapon, int hitMode)
|
int weaponGetDamageRadius(Object* weapon, int hitMode)
|
||||||
{
|
{
|
||||||
int attackType = weaponGetAttackTypeForHitMode(weapon, hitMode);
|
int attackType = weaponGetAttackTypeForHitMode(weapon, hitMode);
|
||||||
int anim = weaponGetAnimationForHitMode(weapon, hitMode);
|
int anim = weaponGetAnimationForHitMode(weapon, hitMode);
|
||||||
int damageType = weaponGetDamageType(NULL, weapon);
|
int damageType = weaponGetDamageType(NULL, weapon);
|
||||||
|
|
||||||
int v1 = 0;
|
int radius = 0;
|
||||||
if (attackType == ATTACK_TYPE_RANGED) {
|
if (attackType == ATTACK_TYPE_RANGED) {
|
||||||
if (anim == ANIM_FIRE_SINGLE && damageType == DAMAGE_TYPE_EXPLOSION) {
|
if (anim == ANIM_FIRE_SINGLE && damageType == DAMAGE_TYPE_EXPLOSION) {
|
||||||
// NOTE: Uninline.
|
// NOTE: Uninline.
|
||||||
v1 = _item_w_rocket_dmg_radius(weapon);
|
radius = weaponGetRocketExplosionRadius(weapon);
|
||||||
}
|
}
|
||||||
} else if (attackType == ATTACK_TYPE_THROW) {
|
} else if (attackType == ATTACK_TYPE_THROW) {
|
||||||
// NOTE: Uninline.
|
// NOTE: Uninline.
|
||||||
if (weaponIsGrenade(weapon)) {
|
if (weaponIsGrenade(weapon)) {
|
||||||
// NOTE: Uninline.
|
// NOTE: Uninline.
|
||||||
v1 = _item_w_grenade_dmg_radius(weapon);
|
radius = weaponGetGrenadeExplosionRadius(weapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return v1;
|
return radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x479180
|
// 0x479180
|
||||||
int _item_w_grenade_dmg_radius(Object* weapon)
|
int weaponGetGrenadeExplosionRadius(Object* weapon)
|
||||||
{
|
{
|
||||||
// SFALL
|
// SFALL
|
||||||
if (gExplosionRadius != -1) {
|
if (gExplosionRadius != -1) {
|
||||||
|
@ -2017,7 +1981,7 @@ int _item_w_grenade_dmg_radius(Object* weapon)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x479188
|
// 0x479188
|
||||||
int _item_w_rocket_dmg_radius(Object* weapon)
|
int weaponGetRocketExplosionRadius(Object* weapon)
|
||||||
{
|
{
|
||||||
// SFALL
|
// SFALL
|
||||||
if (gExplosionRadius != -1) {
|
if (gExplosionRadius != -1) {
|
||||||
|
|
62
src/item.h
62
src/item.h
|
@ -4,14 +4,14 @@
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "obj_types.h"
|
#include "obj_types.h"
|
||||||
|
|
||||||
typedef enum _WeaponClass {
|
typedef enum AttackType {
|
||||||
ATTACK_TYPE_NONE,
|
ATTACK_TYPE_NONE,
|
||||||
ATTACK_TYPE_UNARMED, // unarmed
|
ATTACK_TYPE_UNARMED,
|
||||||
ATTACK_TYPE_MELEE, // melee
|
ATTACK_TYPE_MELEE,
|
||||||
ATTACK_TYPE_THROW,
|
ATTACK_TYPE_THROW,
|
||||||
ATTACK_TYPE_RANGED,
|
ATTACK_TYPE_RANGED,
|
||||||
ATTACK_TYPE_COUNT,
|
ATTACK_TYPE_COUNT,
|
||||||
} WeaponClass;
|
} AttackType;
|
||||||
|
|
||||||
typedef enum HealingItem {
|
typedef enum HealingItem {
|
||||||
HEALING_ITEM_STIMPACK,
|
HEALING_ITEM_STIMPACK,
|
||||||
|
@ -27,13 +27,13 @@ int itemsLoad(File* stream);
|
||||||
int itemsSave(File* stream);
|
int itemsSave(File* stream);
|
||||||
int itemAttemptAdd(Object* owner, Object* itemToAdd, int quantity);
|
int itemAttemptAdd(Object* owner, Object* itemToAdd, int quantity);
|
||||||
int itemAdd(Object* owner, Object* itemToAdd, int quantity);
|
int itemAdd(Object* owner, Object* itemToAdd, int quantity);
|
||||||
int itemRemove(Object* a1, Object* a2, int quantity);
|
int itemRemove(Object* owner, Object* itemToRemove, int quantity);
|
||||||
int _item_move(Object* a1, Object* a2, Object* a3, int quantity);
|
int itemMove(Object* from, Object* to, Object* item, int quantity);
|
||||||
int _item_move_force(Object* a1, Object* a2, Object* a3, int quantity);
|
int itemMoveForce(Object* from, Object* to, Object* item, int quantity);
|
||||||
void _item_move_all(Object* a1, Object* a2);
|
void itemMoveAll(Object* from, Object* to);
|
||||||
int _item_move_all_hidden(Object* a1, Object* a2);
|
int itemMoveAllHidden(Object* from, Object* to);
|
||||||
int _item_destroy_all_hidden(Object* a1);
|
int itemDestroyAllHidden(Object* owner);
|
||||||
int _item_drop_all(Object* critter, int tile);
|
int itemDropAll(Object* critter, int tile);
|
||||||
char* itemGetName(Object* obj);
|
char* itemGetName(Object* obj);
|
||||||
char* itemGetDescription(Object* obj);
|
char* itemGetDescription(Object* obj);
|
||||||
int itemGetType(Object* item);
|
int itemGetType(Object* item);
|
||||||
|
@ -43,19 +43,19 @@ int itemGetWeight(Object* item);
|
||||||
int itemGetCost(Object* obj);
|
int itemGetCost(Object* obj);
|
||||||
int objectGetCost(Object* obj);
|
int objectGetCost(Object* obj);
|
||||||
int objectGetInventoryWeight(Object* obj);
|
int objectGetInventoryWeight(Object* obj);
|
||||||
bool _can_use_weapon(Object* item_obj);
|
bool dudeIsWeaponDisabled(Object* weapon);
|
||||||
int itemGetInventoryFid(Object* obj);
|
int itemGetInventoryFid(Object* obj);
|
||||||
Object* critterGetWeaponForHitMode(Object* critter, int hitMode);
|
Object* critterGetWeaponForHitMode(Object* critter, int hitMode);
|
||||||
int _item_mp_cost(Object* obj, int hitMode, bool aiming);
|
int itemGetActionPointCost(Object* obj, int hitMode, bool aiming);
|
||||||
int _item_count(Object* obj, Object* a2);
|
int itemGetQuantity(Object* obj, Object* a2);
|
||||||
int _item_queued(Object* obj);
|
int itemIsQueued(Object* obj);
|
||||||
Object* _item_replace(Object* a1, Object* a2, int a3);
|
Object* itemReplace(Object* a1, Object* a2, int a3);
|
||||||
int weaponIsNatural(Object* obj);
|
bool itemIsHidden(Object* obj);
|
||||||
int weaponGetAttackTypeForHitMode(Object* a1, int a2);
|
int weaponGetAttackTypeForHitMode(Object* a1, int a2);
|
||||||
int weaponGetSkillForHitMode(Object* a1, int a2);
|
int weaponGetSkillForHitMode(Object* a1, int a2);
|
||||||
int _item_w_skill_level(Object* a1, int a2);
|
int weaponGetSkillValue(Object* a1, int a2);
|
||||||
int weaponGetDamageMinMax(Object* weapon, int* minDamagePtr, int* maxDamagePtr);
|
int weaponGetDamageMinMax(Object* weapon, int* minDamagePtr, int* maxDamagePtr);
|
||||||
int weaponGetMeleeDamage(Object* critter, int hitMode);
|
int weaponGetDamage(Object* critter, int hitMode);
|
||||||
int weaponGetDamageType(Object* critter, Object* weapon);
|
int weaponGetDamageType(Object* critter, Object* weapon);
|
||||||
int weaponIsTwoHanded(Object* weapon);
|
int weaponIsTwoHanded(Object* weapon);
|
||||||
int critterGetAnimationForHitMode(Object* critter, int hitMode);
|
int critterGetAnimationForHitMode(Object* critter, int hitMode);
|
||||||
|
@ -64,11 +64,11 @@ int ammoGetCapacity(Object* ammoOrWeapon);
|
||||||
int ammoGetQuantity(Object* ammoOrWeapon);
|
int ammoGetQuantity(Object* ammoOrWeapon);
|
||||||
int ammoGetCaliber(Object* ammoOrWeapon);
|
int ammoGetCaliber(Object* ammoOrWeapon);
|
||||||
void ammoSetQuantity(Object* ammoOrWeapon, int quantity);
|
void ammoSetQuantity(Object* ammoOrWeapon, int quantity);
|
||||||
int _item_w_try_reload(Object* critter, Object* weapon);
|
int weaponAttemptReload(Object* critter, Object* weapon);
|
||||||
bool weaponCanBeReloadedWith(Object* weapon, Object* ammo);
|
bool weaponCanBeReloadedWith(Object* weapon, Object* ammo);
|
||||||
int _item_w_reload(Object* weapon, Object* ammo);
|
int weaponReload(Object* weapon, Object* ammo);
|
||||||
int _item_w_range(Object* critter, int hitMode);
|
int weaponGetRange(Object* critter, int hitMode);
|
||||||
int _item_w_mp_cost(Object* critter, int hitMode, bool aiming);
|
int weaponGetActionPointCost(Object* critter, int hitMode, bool aiming);
|
||||||
int weaponGetMinStrengthRequired(Object* weapon);
|
int weaponGetMinStrengthRequired(Object* weapon);
|
||||||
int weaponGetCriticalFailureType(Object* weapon);
|
int weaponGetCriticalFailureType(Object* weapon);
|
||||||
int weaponGetPerk(Object* weapon);
|
int weaponGetPerk(Object* weapon);
|
||||||
|
@ -77,16 +77,16 @@ int weaponGetAnimationCode(Object* weapon);
|
||||||
int weaponGetProjectilePid(Object* weapon);
|
int weaponGetProjectilePid(Object* weapon);
|
||||||
int weaponGetAmmoTypePid(Object* weapon);
|
int weaponGetAmmoTypePid(Object* weapon);
|
||||||
char weaponGetSoundId(Object* weapon);
|
char weaponGetSoundId(Object* weapon);
|
||||||
int _item_w_called_shot(Object* critter, int hitMode);
|
bool critterCanAim(Object* critter, int hitMode);
|
||||||
int _item_w_can_unload(Object* weapon);
|
int weaponCanBeUnloaded(Object* weapon);
|
||||||
Object* _item_w_unload(Object* weapon);
|
Object* weaponUnload(Object* weapon);
|
||||||
int weaponGetActionPointCost1(Object* weapon);
|
int weaponGetPrimaryActionPointCost(Object* weapon);
|
||||||
int weaponGetActionPointCost2(Object* weapon);
|
int weaponGetSecondaryActionPointCost(Object* weapon);
|
||||||
int _item_w_compute_ammo_cost(Object* obj, int* inout_a2);
|
int _item_w_compute_ammo_cost(Object* obj, int* inout_a2);
|
||||||
bool weaponIsGrenade(Object* weapon);
|
bool weaponIsGrenade(Object* weapon);
|
||||||
int _item_w_area_damage_radius(Object* weapon, int hitMode);
|
int weaponGetDamageRadius(Object* weapon, int hitMode);
|
||||||
int _item_w_grenade_dmg_radius(Object* weapon);
|
int weaponGetGrenadeExplosionRadius(Object* weapon);
|
||||||
int _item_w_rocket_dmg_radius(Object* weapon);
|
int weaponGetRocketExplosionRadius(Object* weapon);
|
||||||
int weaponGetAmmoArmorClassModifier(Object* weapon);
|
int weaponGetAmmoArmorClassModifier(Object* weapon);
|
||||||
int weaponGetAmmoDamageResistanceModifier(Object* weapon);
|
int weaponGetAmmoDamageResistanceModifier(Object* weapon);
|
||||||
int weaponGetAmmoDamageMultiplier(Object* weapon);
|
int weaponGetAmmoDamageMultiplier(Object* weapon);
|
||||||
|
|
|
@ -1135,7 +1135,7 @@ static int _map_age_dead_critters()
|
||||||
Object* obj = objects[index];
|
Object* obj = objects[index];
|
||||||
if (PID_TYPE(obj->pid) == OBJ_TYPE_CRITTER) {
|
if (PID_TYPE(obj->pid) == OBJ_TYPE_CRITTER) {
|
||||||
if (_critter_flag_check(obj->pid, CRITTER_FLAG_0x40) == 0) {
|
if (_critter_flag_check(obj->pid, CRITTER_FLAG_0x40) == 0) {
|
||||||
_item_drop_all(obj, obj->tile);
|
itemDropAll(obj, obj->tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object* blood;
|
Object* blood;
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef enum ObjectFlags {
|
||||||
OBJECT_FLAG_0x400 = 0x400, // ???
|
OBJECT_FLAG_0x400 = 0x400, // ???
|
||||||
OBJECT_MULTIHEX = 0x800,
|
OBJECT_MULTIHEX = 0x800,
|
||||||
OBJECT_NO_HIGHLIGHT = 0x1000,
|
OBJECT_NO_HIGHLIGHT = 0x1000,
|
||||||
OBJECT_USED = 0x2000, // set if there was/is any event for the object
|
OBJECT_QUEUED = 0x2000, // set if there was/is any event for the object
|
||||||
OBJECT_TRANS_RED = 0x4000,
|
OBJECT_TRANS_RED = 0x4000,
|
||||||
OBJECT_TRANS_NONE = 0x8000,
|
OBJECT_TRANS_NONE = 0x8000,
|
||||||
OBJECT_TRANS_WALL = 0x10000,
|
OBJECT_TRANS_WALL = 0x10000,
|
||||||
|
|
|
@ -1088,7 +1088,7 @@ int _obj_copy(Object** a1, Object* a2)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
objectListNode->obj->flags &= ~OBJECT_USED;
|
objectListNode->obj->flags &= ~OBJECT_QUEUED;
|
||||||
|
|
||||||
Inventory* newInventory = &(objectListNode->obj->data.inventory);
|
Inventory* newInventory = &(objectListNode->obj->data.inventory);
|
||||||
newInventory->length = 0;
|
newInventory->length = 0;
|
||||||
|
|
|
@ -816,7 +816,7 @@ static int _obj_use_flare(Object* critter_obj, Object* flare)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flare->flags & OBJECT_USED) != 0) {
|
if ((flare->flags & OBJECT_QUEUED) != 0) {
|
||||||
if (critter_obj == gDude) {
|
if (critter_obj == gDude) {
|
||||||
// The flare is already lit.
|
// The flare is already lit.
|
||||||
messageListItem.num = 588;
|
messageListItem.num = 588;
|
||||||
|
@ -872,7 +872,7 @@ static int _obj_use_explosive(Object* explosive)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((explosive->flags & OBJECT_USED) != 0) {
|
if ((explosive->flags & OBJECT_QUEUED) != 0) {
|
||||||
// The timer is already ticking.
|
// The timer is already ticking.
|
||||||
messageListItem.num = 590;
|
messageListItem.num = 590;
|
||||||
if (messageListGetItem(&gProtoMessageList, &messageListItem)) {
|
if (messageListGetItem(&gProtoMessageList, &messageListItem)) {
|
||||||
|
@ -1118,7 +1118,7 @@ int _obj_use_item(Object* a1, Object* a2)
|
||||||
if (root != NULL) {
|
if (root != NULL) {
|
||||||
int flags = a2->flags & OBJECT_IN_ANY_HAND;
|
int flags = a2->flags & OBJECT_IN_ANY_HAND;
|
||||||
itemRemove(root, a2, 1);
|
itemRemove(root, a2, 1);
|
||||||
Object* v8 = _item_replace(root, a2, flags);
|
Object* v8 = itemReplace(root, a2, flags);
|
||||||
if (root == gDude) {
|
if (root == gDude) {
|
||||||
int leftItemAction;
|
int leftItemAction;
|
||||||
int rightItemAction;
|
int rightItemAction;
|
||||||
|
@ -1360,7 +1360,7 @@ int _obj_use_item_on(Object* a1, Object* a2, Object* a3)
|
||||||
int flags = a3->flags & OBJECT_IN_ANY_HAND;
|
int flags = a3->flags & OBJECT_IN_ANY_HAND;
|
||||||
itemRemove(a1, a3, 1);
|
itemRemove(a1, a3, 1);
|
||||||
|
|
||||||
Object* v7 = _item_replace(a1, a3, flags);
|
Object* v7 = itemReplace(a1, a3, flags);
|
||||||
|
|
||||||
int leftItemAction;
|
int leftItemAction;
|
||||||
int rightItemAction;
|
int rightItemAction;
|
||||||
|
|
|
@ -221,7 +221,7 @@ typedef enum ItemProtoExtendedFlags {
|
||||||
// This flag is used on weapons to indicate that's an natural (integral)
|
// This flag is used on weapons to indicate that's an natural (integral)
|
||||||
// part of it's owner, for example Claw, or Robot's Rocket Launcher. Items
|
// part of it's owner, for example Claw, or Robot's Rocket Launcher. Items
|
||||||
// with this flag on do count toward total weight and cannot be dropped.
|
// with this flag on do count toward total weight and cannot be dropped.
|
||||||
ItemProtoExtendedFlags_NaturalWeapon = 0x08000000,
|
ITEM_HIDDEN = 0x08000000,
|
||||||
} ItemProtoExtendedFlags;
|
} ItemProtoExtendedFlags;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -256,7 +256,7 @@ int queueAddEvent(int delay, Object* obj, void* data, int eventType)
|
||||||
newQueueListNode->data = data;
|
newQueueListNode->data = data;
|
||||||
|
|
||||||
if (obj != NULL) {
|
if (obj != NULL) {
|
||||||
obj->flags |= OBJECT_USED;
|
obj->flags |= OBJECT_QUEUED;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueListNode** v3 = &gQueueListHead;
|
QueueListNode** v3 = &gQueueListHead;
|
||||||
|
|
Loading…
Reference in New Issue