Group damage flags

This commit is contained in:
Alexander Batalov 2022-07-06 14:23:06 +03:00
parent c1e89205ed
commit f66b8df39b
6 changed files with 10 additions and 8 deletions

View File

@ -516,7 +516,7 @@ int reg_anim_obj_run_to_obj(Object* owner, Object* destination, int actionPoints
animationDescription->owner = owner; animationDescription->owner = owner;
animationDescription->destinationObj = destination; animationDescription->destinationObj = destination;
if ((owner->fid & 0xF000000) >> 24 == 1 && (owner->data.critter.combat.results & (DAM_CRIP_LEG_LEFT | DAM_CRIP_LEG_RIGHT)) if ((owner->fid & 0xF000000) >> 24 == 1 && (owner->data.critter.combat.results & DAM_CRIP_LEG_ANY)
|| owner == gDude && dudeHasState(0) && !perkGetRank(gDude, PERK_SILENT_RUNNING) || owner == gDude && dudeHasState(0) && !perkGetRank(gDude, PERK_SILENT_RUNNING)
|| !artExists(buildFid((owner->fid & 0xF000000) >> 24, owner->fid & 0xFFF, ANIM_RUNNING, 0, owner->rotation + 1))) { || !artExists(buildFid((owner->fid & 0xF000000) >> 24, owner->fid & 0xFFF, ANIM_RUNNING, 0, owner->rotation + 1))) {
animationDescription->anim = ANIM_WALK; animationDescription->anim = ANIM_WALK;
@ -631,7 +631,7 @@ int reg_anim_obj_run_to_tile(Object* obj, int tile_num, int elev, int actionPoin
animationDescription->elevation = elev; animationDescription->elevation = elev;
// TODO: Check. // TODO: Check.
if ((obj->fid & 0xF000000) >> 24 == 1 && (obj->data.critter.combat.results & (DAM_CRIP_LEG_LEFT | DAM_CRIP_LEG_RIGHT)) if ((obj->fid & 0xF000000) >> 24 == 1 && (obj->data.critter.combat.results & DAM_CRIP_LEG_ANY)
|| obj == gDude && dudeHasState(0) && !perkGetRank(gDude, PERK_SILENT_RUNNING) || obj == gDude && dudeHasState(0) && !perkGetRank(gDude, PERK_SILENT_RUNNING)
|| !artExists(buildFid((obj->fid & 0xF000000) >> 24, obj->fid & 0xFFF, ANIM_RUNNING, 0, obj->rotation + 1))) { || !artExists(buildFid((obj->fid & 0xF000000) >> 24, obj->fid & 0xFFF, ANIM_RUNNING, 0, obj->rotation + 1))) {
animationDescription->anim = ANIM_WALK; animationDescription->anim = ANIM_WALK;

View File

@ -4616,7 +4616,7 @@ static void _set_new_results(Object* critter, int flags)
queueAddEvent(10 * (35 - 3 * endurance), critter, NULL, EVENT_TYPE_KNOCKOUT); queueAddEvent(10 * (35 - 3 * endurance), critter, NULL, EVENT_TYPE_KNOCKOUT);
} }
if (critter == gDude && (flags & (DAM_CRIP_ARM_LEFT | DAM_CRIP_ARM_RIGHT)) != 0) { if (critter == gDude && (flags & DAM_CRIP_ARM_ANY) != 0) {
critter->data.critter.combat.results |= flags & (DAM_KNOCKED_OUT | DAM_KNOCKED_DOWN | DAM_CRIP | DAM_DEAD | DAM_LOSE_TURN); critter->data.critter.combat.results |= flags & (DAM_KNOCKED_OUT | DAM_KNOCKED_DOWN | DAM_CRIP | DAM_DEAD | DAM_LOSE_TURN);
int leftItemAction; int leftItemAction;
@ -5460,7 +5460,7 @@ int _combat_check_bad_shot(Object* attacker, Object* defender, int hitMode, bool
return 7; // both hands crippled return 7; // both hands crippled
} }
if ((attacker->data.critter.combat.results & (DAM_CRIP_ARM_LEFT | DAM_CRIP_ARM_RIGHT)) != 0) { if ((attacker->data.critter.combat.results & DAM_CRIP_ARM_ANY) != 0) {
if (weaponIsTwoHanded(weapon)) { if (weaponIsTwoHanded(weapon)) {
return 6; // crippled one arm for two-handed weapon return 6; // crippled one arm for two-handed weapon
} }

View File

@ -1835,7 +1835,7 @@ static bool _ai_can_use_weapon(Object* critter, Object* weapon, int hitMode)
return false; return false;
} }
if ((damageFlags & (DAM_CRIP_ARM_LEFT | DAM_CRIP_ARM_RIGHT)) != 0 && weaponIsTwoHanded(weapon)) { if ((damageFlags & DAM_CRIP_ARM_ANY) != 0 && weaponIsTwoHanded(weapon)) {
return false; return false;
} }

View File

@ -1326,7 +1326,7 @@ int critterGetMovementPointCostAdjustedForCrippledLegs(Object* critter, int acti
int flags = critter->data.critter.combat.results; int flags = critter->data.critter.combat.results;
if ((flags & DAM_CRIP_LEG_LEFT) != 0 && (flags & DAM_CRIP_LEG_RIGHT) != 0) { if ((flags & DAM_CRIP_LEG_LEFT) != 0 && (flags & DAM_CRIP_LEG_RIGHT) != 0) {
return 8 * actionPoints; return 8 * actionPoints;
} else if ((flags & (DAM_CRIP_LEG_LEFT | DAM_CRIP_LEG_RIGHT)) != 0) { } else if ((flags & DAM_CRIP_LEG_ANY) != 0) {
return 4 * actionPoints; return 4 * actionPoints;
} else { } else {
return actionPoints; return actionPoints;

View File

@ -3941,7 +3941,7 @@ static void opCritterInjure(Program* program)
} }
if (critter == gDude) { if (critter == gDude) {
if ((flags & (DAM_CRIP_ARM_LEFT | DAM_CRIP_ARM_RIGHT)) != 0) { if ((flags & DAM_CRIP_ARM_ANY) != 0) {
int leftItemAction; int leftItemAction;
int rightItemAction; int rightItemAction;
interfaceGetItemActions(&leftItemAction, &rightItemAction); interfaceGetItemActions(&leftItemAction, &rightItemAction);

View File

@ -106,7 +106,9 @@ typedef enum Dam {
DAM_CRIP_RANDOM = 0x200000, DAM_CRIP_RANDOM = 0x200000,
DAM_BACKWASH = 0x400000, DAM_BACKWASH = 0x400000,
DAM_PERFORM_REVERSE = 0x800000, DAM_PERFORM_REVERSE = 0x800000,
DAM_CRIP = (DAM_CRIP_LEG_LEFT | DAM_CRIP_LEG_RIGHT | DAM_CRIP_ARM_LEFT | DAM_CRIP_ARM_RIGHT | DAM_BLIND), DAM_CRIP_LEG_ANY = DAM_CRIP_LEG_LEFT | DAM_CRIP_LEG_RIGHT,
DAM_CRIP_ARM_ANY = DAM_CRIP_ARM_LEFT | DAM_CRIP_ARM_RIGHT,
DAM_CRIP = DAM_CRIP_LEG_ANY | DAM_CRIP_ARM_ANY | DAM_BLIND,
} Dam; } Dam;
#define OBJ_LOCKED 0x02000000 #define OBJ_LOCKED 0x02000000