Rename critter flags

This commit is contained in:
Alexander Batalov 2022-10-05 13:06:49 +03:00
parent 65f43804b3
commit 8754a5d6c9
10 changed files with 41 additions and 39 deletions

View File

@ -96,7 +96,7 @@ static int _compute_dmg_damage(int min, int max, Object* obj, int* a4, int damag
// 0x410468 // 0x410468
int actionKnockdown(Object* obj, int* anim, int maxDistance, int rotation, int delay) int actionKnockdown(Object* obj, int* anim, int maxDistance, int rotation, int delay)
{ {
if (_critter_flag_check(obj->pid, CRITTER_FLAG_0x4000)) { if (_critter_flag_check(obj->pid, CRITTER_NO_KNOCKBACK)) {
return -1; return -1;
} }
@ -196,7 +196,7 @@ int _pick_death(Object* attacker, Object* defender, Object* weapon, int damage,
int violenceLevel = VIOLENCE_LEVEL_MAXIMUM_BLOOD; int violenceLevel = VIOLENCE_LEVEL_MAXIMUM_BLOOD;
configGetInt(&gGameConfig, GAME_CONFIG_PREFERENCES_KEY, GAME_CONFIG_VIOLENCE_LEVEL_KEY, &violenceLevel); configGetInt(&gGameConfig, GAME_CONFIG_PREFERENCES_KEY, GAME_CONFIG_VIOLENCE_LEVEL_KEY, &violenceLevel);
if (_critter_flag_check(defender->pid, CRITTER_FLAG_0x1000)) { if (_critter_flag_check(defender->pid, CRITTER_SPECIAL_DEATH)) {
return _check_death(defender, ANIM_EXPLODED_TO_NOTHING, VIOLENCE_LEVEL_NORMAL, isFallingBack); return _check_death(defender, ANIM_EXPLODED_TO_NOTHING, VIOLENCE_LEVEL_NORMAL, isFallingBack);
} }
@ -287,7 +287,7 @@ void _show_damage_to_object(Object* a1, int damage, int flags, Object* weapon, b
int fid; int fid;
const char* sfx_name; const char* sfx_name;
if (_critter_flag_check(a1->pid, CRITTER_FLAG_0x4000)) { if (_critter_flag_check(a1->pid, CRITTER_NO_KNOCKBACK)) {
knockbackDistance = 0; knockbackDistance = 0;
} }
@ -463,7 +463,7 @@ int _show_death(Object* obj, int anim)
} }
} }
if (_critter_flag_check(obj->pid, CRITTER_FLAG_0x800) == 0) { if (!_critter_flag_check(obj->pid, CRITTER_FLAT)) {
obj->flags |= OBJECT_NO_BLOCK; obj->flags |= OBJECT_NO_BLOCK;
if (_obj_toggle_flat(obj, &v7) == 0) { if (_obj_toggle_flat(obj, &v7) == 0) {
rectUnion(&v8, &v7, &v8); rectUnion(&v8, &v7, &v8);
@ -474,7 +474,7 @@ int _show_death(Object* obj, int anim)
rectUnion(&v8, &v7, &v8); rectUnion(&v8, &v7, &v8);
} }
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_SPECIAL_DEATH) && !_critter_flag_check(obj->pid, CRITTER_NO_DROP)) {
itemDropAll(obj, obj->tile); itemDropAll(obj, obj->tile);
} }
@ -1960,7 +1960,7 @@ int _report_dmg(Attack* attack, Object* a2)
// 0x413660 // 0x413660
int _compute_dmg_damage(int min, int max, Object* obj, int* a4, int damageType) int _compute_dmg_damage(int min, int max, Object* obj, int* a4, int damageType)
{ {
if (!_critter_flag_check(obj->pid, CRITTER_FLAG_0x4000)) { if (!_critter_flag_check(obj->pid, CRITTER_NO_KNOCKBACK)) {
a4 = NULL; a4 = NULL;
} }

View File

@ -4069,7 +4069,7 @@ void _compute_explosion_on_extras(Attack* attack, int a2, bool isGrenade, int a4
static int attackComputeCriticalHit(Attack* attack) static int attackComputeCriticalHit(Attack* attack)
{ {
Object* defender = attack->defender; Object* defender = attack->defender;
if (defender != NULL && _critter_flag_check(defender->pid, CRITTER_FLAG_0x400)) { if (defender != NULL && _critter_flag_check(defender->pid, CRITTER_INVULNERABLE)) {
return 2; return 2;
} }
@ -4143,7 +4143,7 @@ static int _attackFindInvalidFlags(Object* critter, Object* item)
{ {
int flags = 0; int flags = 0;
if (critter != NULL && PID_TYPE(critter->pid) == OBJ_TYPE_CRITTER && _critter_flag_check(critter->pid, CRITTER_FLAG_0x40)) { if (critter != NULL && PID_TYPE(critter->pid) == OBJ_TYPE_CRITTER && _critter_flag_check(critter->pid, CRITTER_NO_DROP)) {
flags |= DAM_DROP; flags |= DAM_DROP;
} }
@ -4159,7 +4159,7 @@ static int attackComputeCriticalFailure(Attack* attack)
{ {
attack->attackerFlags |= DAM_HIT; attack->attackerFlags |= DAM_HIT;
if (attack->attacker != NULL && _critter_flag_check(attack->attacker->pid, CRITTER_FLAG_0x400)) { if (attack->attacker != NULL && _critter_flag_check(attack->attacker->pid, CRITTER_INVULNERABLE)) {
return 0; return 0;
} }
@ -4620,7 +4620,7 @@ static void attackComputeDamage(Attack* attack, int ammoQuantity, int bonusDamag
&& (critter->flags & OBJECT_MULTIHEX) == 0 && (critter->flags & OBJECT_MULTIHEX) == 0
&& (damageType == DAMAGE_TYPE_EXPLOSION || attack->weapon == NULL || weaponGetAttackTypeForHitMode(attack->weapon, attack->hitMode) == ATTACK_TYPE_MELEE) && (damageType == DAMAGE_TYPE_EXPLOSION || attack->weapon == NULL || weaponGetAttackTypeForHitMode(attack->weapon, attack->hitMode) == ATTACK_TYPE_MELEE)
&& PID_TYPE(critter->pid) == OBJ_TYPE_CRITTER && PID_TYPE(critter->pid) == OBJ_TYPE_CRITTER
&& _critter_flag_check(critter->pid, CRITTER_FLAG_0x4000) == 0) { && !_critter_flag_check(critter->pid, CRITTER_NO_KNOCKBACK)) {
bool shouldKnockback = true; bool shouldKnockback = true;
bool hasStonewall = false; bool hasStonewall = false;
if (critter == gDude) { if (critter == gDude) {
@ -4751,7 +4751,7 @@ void _apply_damage(Attack* attack, bool animated)
// 0x424EE8 // 0x424EE8
static void _check_for_death(Object* object, int damage, int* flags) static void _check_for_death(Object* object, int damage, int* flags)
{ {
if (object == NULL || !_critter_flag_check(object->pid, CRITTER_FLAG_0x400)) { if (object == NULL || !_critter_flag_check(object->pid, CRITTER_INVULNERABLE)) {
if (object == NULL || PID_TYPE(object->pid) == OBJ_TYPE_CRITTER) { if (object == NULL || PID_TYPE(object->pid) == OBJ_TYPE_CRITTER) {
if (damage > 0) { if (damage > 0) {
if (critterGetHitPoints(object) - damage <= 0) { if (critterGetHitPoints(object) - damage <= 0) {
@ -4773,7 +4773,7 @@ static void _set_new_results(Object* critter, int flags)
return; return;
} }
if (_critter_flag_check(critter->pid, CRITTER_FLAG_0x400)) { if (_critter_flag_check(critter->pid, CRITTER_INVULNERABLE)) {
return; return;
} }
@ -4811,7 +4811,7 @@ static void _damage_object(Object* a1, int damage, bool animated, int a4, Object
return; return;
} }
if (_critter_flag_check(a1->pid, CRITTER_FLAG_0x400)) { if (_critter_flag_check(a1->pid, CRITTER_INVULNERABLE)) {
return; return;
} }

View File

@ -422,7 +422,7 @@ int critterAdjustRadiation(Object* obj, int amount)
} }
if (amount > 0) { if (amount > 0) {
proto->critter.data.flags |= CRITTER_FLAG_0x2; proto->critter.data.flags |= CRITTER_RADIATED;
} }
if (amount > 0) { if (amount > 0) {
@ -489,7 +489,7 @@ int _critter_check_rads(Object* obj)
Proto* proto; Proto* proto;
protoGetProto(obj->pid, &proto); protoGetProto(obj->pid, &proto);
if ((proto->critter.data.flags & CRITTER_FLAG_0x2) == 0) { if ((proto->critter.data.flags & CRITTER_RADIATED) == 0) {
return 0; return 0;
} }
@ -530,7 +530,7 @@ int _critter_check_rads(Object* obj)
queueAddEvent(GAME_TIME_TICKS_PER_HOUR * randomBetween(4, 18), obj, radiationEvent, EVENT_TYPE_RADIATION); queueAddEvent(GAME_TIME_TICKS_PER_HOUR * randomBetween(4, 18), obj, radiationEvent, EVENT_TYPE_RADIATION);
} }
proto->critter.data.flags &= ~(CRITTER_FLAG_0x2); proto->critter.data.flags &= ~CRITTER_RADIATED;
return 0; return 0;
} }
@ -876,7 +876,7 @@ void critterKill(Object* critter, int anim, bool a3)
rectUnion(&updatedRect, &tempRect, &updatedRect); rectUnion(&updatedRect, &tempRect, &updatedRect);
} }
if (!_critter_flag_check(critter->pid, CRITTER_FLAG_0x800)) { if (!_critter_flag_check(critter->pid, CRITTER_FLAT)) {
critter->flags |= OBJECT_NO_BLOCK; critter->flags |= OBJECT_NO_BLOCK;
_obj_toggle_flat(critter, &tempRect); _obj_toggle_flat(critter, &tempRect);
} }

View File

@ -3594,7 +3594,7 @@ int _gdCanBarter()
return 1; return 1;
} }
if (proto->critter.data.flags & CRITTER_FLAG_0x2) { if (proto->critter.data.flags & CRITTER_BARTER) {
return 1; return 1;
} }
@ -4194,7 +4194,7 @@ void gameDialogBarterButtonUpMouseUp(int btn, int keyCode)
Proto* proto; Proto* proto;
protoGetProto(gGameDialogSpeaker->pid, &proto); protoGetProto(gGameDialogSpeaker->pid, &proto);
if (proto->critter.data.flags & CRITTER_FLAG_0x2) { if (proto->critter.data.flags & CRITTER_BARTER) {
if (gGameDialogLipSyncStarted) { if (gGameDialogLipSyncStarted) {
if (soundIsPlaying(gLipsData.sound)) { if (soundIsPlaying(gLipsData.sound)) {
gameDialogEndLips(); gameDialogEndLips();

View File

@ -692,7 +692,7 @@ void gameMouseRefresh()
primaryAction = GAME_MOUSE_ACTION_MENU_ITEM_TALK; primaryAction = GAME_MOUSE_ACTION_MENU_ITEM_TALK;
} }
} else { } else {
if (_critter_flag_check(pointedObject->pid, CRITTER_FLAG_0x20)) { if (_critter_flag_check(pointedObject->pid, CRITTER_NO_STEAL)) {
primaryAction = GAME_MOUSE_ACTION_MENU_ITEM_LOOK; primaryAction = GAME_MOUSE_ACTION_MENU_ITEM_LOOK;
} else { } else {
primaryAction = GAME_MOUSE_ACTION_MENU_ITEM_USE; primaryAction = GAME_MOUSE_ACTION_MENU_ITEM_USE;
@ -1096,7 +1096,7 @@ void _gmouse_handle_event(int mouseX, int mouseY, int mouseState)
actionMenuItems[actionMenuItemsCount++] = GAME_MOUSE_ACTION_MENU_ITEM_TALK; actionMenuItems[actionMenuItemsCount++] = GAME_MOUSE_ACTION_MENU_ITEM_TALK;
} }
} else { } else {
if (!_critter_flag_check(v16->pid, CRITTER_FLAG_0x20)) { if (!_critter_flag_check(v16->pid, CRITTER_NO_STEAL)) {
actionMenuItems[actionMenuItemsCount++] = GAME_MOUSE_ACTION_MENU_ITEM_USE; actionMenuItems[actionMenuItemsCount++] = GAME_MOUSE_ACTION_MENU_ITEM_USE;
} }
} }

View File

@ -3314,7 +3314,7 @@ static void opMetarule(Program* program)
if (PID_TYPE(object->pid) == OBJ_TYPE_CRITTER) { if (PID_TYPE(object->pid) == OBJ_TYPE_CRITTER) {
Proto* proto; Proto* proto;
protoGetProto(object->pid, &proto); protoGetProto(object->pid, &proto);
if ((proto->critter.data.flags & CRITTER_FLAG_0x2) != 0) { if ((proto->critter.data.flags & CRITTER_BARTER) != 0) {
result = 1; result = 1;
} }
} }

View File

@ -4020,7 +4020,7 @@ int inventoryOpenLooting(Object* a1, Object* a2)
} }
if (FID_TYPE(a2->fid) == OBJ_TYPE_CRITTER) { if (FID_TYPE(a2->fid) == OBJ_TYPE_CRITTER) {
if (_critter_flag_check(a2->pid, CRITTER_FLAG_0x20)) { if (_critter_flag_check(a2->pid, CRITTER_NO_STEAL)) {
// You can't find anything to take from that. // You can't find anything to take from that.
messageListItem.num = 50; messageListItem.num = 50;
if (messageListGetItem(&gInventoryMessageList, &messageListItem)) { if (messageListGetItem(&gInventoryMessageList, &messageListItem)) {

View File

@ -1607,7 +1607,7 @@ int weaponGetRange(Object* critter, int hitMode)
return range; return range;
} }
if (_critter_flag_check(critter->pid, CRITTER_FLAG_0x2000)) { if (_critter_flag_check(critter->pid, CRITTER_LONG_LIMBS)) {
return 2; return 2;
} }

View File

@ -1082,7 +1082,7 @@ static int _map_age_dead_critters()
&& !objectIsPartyMember(obj) && !objectIsPartyMember(obj)
&& !critterIsDead(obj)) { && !critterIsDead(obj)) {
obj->data.critter.combat.maneuver &= ~CRITTER_MANUEVER_FLEEING; obj->data.critter.combat.maneuver &= ~CRITTER_MANUEVER_FLEEING;
if (critterGetKillType(obj) != KILL_TYPE_ROBOT && _critter_flag_check(obj->pid, CRITTER_FLAG_0x200) == 0) { if (critterGetKillType(obj) != KILL_TYPE_ROBOT && !_critter_flag_check(obj->pid, CRITTER_NO_HEAL)) {
_critter_heal_hours(obj, hoursSinceLastVisit); _critter_heal_hours(obj, hoursSinceLastVisit);
} }
} }
@ -1107,7 +1107,7 @@ static int _map_age_dead_critters()
int type = PID_TYPE(obj->pid); int type = PID_TYPE(obj->pid);
if (type == OBJ_TYPE_CRITTER) { if (type == OBJ_TYPE_CRITTER) {
if (obj != gDude && critterIsDead(obj)) { if (obj != gDude && critterIsDead(obj)) {
if (critterGetKillType(obj) != KILL_TYPE_ROBOT && _critter_flag_check(obj->pid, CRITTER_FLAG_0x200) == 0) { if (critterGetKillType(obj) != KILL_TYPE_ROBOT && !_critter_flag_check(obj->pid, CRITTER_NO_HEAL)) {
objects[count++] = obj; objects[count++] = obj;
if (count >= capacity) { if (count >= capacity) {
@ -1138,7 +1138,7 @@ static int _map_age_dead_critters()
for (int index = 0; index < count; index++) { for (int index = 0; index < count; index++) {
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_NO_DROP)) {
itemDropAll(obj, obj->tile); itemDropAll(obj, obj->tile);
} }
@ -1154,7 +1154,7 @@ static int _map_age_dead_critters()
protoGetProto(obj->pid, &proto); protoGetProto(obj->pid, &proto);
int frame = randomBetween(0, 3); int frame = randomBetween(0, 3);
if ((proto->critter.flags & 0x800)) { if ((proto->critter.flags & CRITTER_FLAT)) {
frame += 6; frame += 6;
} else { } else {
if (critterGetKillType(obj) != KILL_TYPE_RAT if (critterGetKillType(obj) != KILL_TYPE_RAT

View File

@ -73,19 +73,21 @@ typedef enum ObjectFlags {
} ObjectFlags; } ObjectFlags;
typedef enum CritterFlags { typedef enum CritterFlags {
CRITTER_FLAG_0x2 = 0x2, CRITTER_BARTER = 0x02,
CRITTER_FLAG_0x20 = 0x20, CRITTER_NO_STEAL = 0x20,
CRITTER_FLAG_0x40 = 0x40, CRITTER_NO_DROP = 0x40,
CRITTER_FLAG_0x80 = 0x80, CRITTER_NO_LIMBS = 0x80,
CRITTER_FLAG_0x100 = 0x100, CRITTER_NO_AGE = 0x100,
CRITTER_FLAG_0x200 = 0x200, CRITTER_NO_HEAL = 0x200,
CRITTER_FLAG_0x400 = 0x400, CRITTER_INVULNERABLE = 0x400,
CRITTER_FLAG_0x800 = 0x800, CRITTER_FLAT = 0x800,
CRITTER_FLAG_0x1000 = 0x1000, CRITTER_SPECIAL_DEATH = 0x1000,
CRITTER_FLAG_0x2000 = 0x2000, CRITTER_LONG_LIMBS = 0x2000,
CRITTER_FLAG_0x4000 = 0x4000, CRITTER_NO_KNOCKBACK = 0x4000,
} CritterFlags; } CritterFlags;
#define CRITTER_RADIATED 0x02
#define OUTLINE_TYPE_MASK 0xFFFFFF #define OUTLINE_TYPE_MASK 0xFFFFFF
#define OUTLINE_PALETTED 0x40000000 #define OUTLINE_PALETTED 0x40000000
#define OUTLINE_DISABLED 0x80000000 #define OUTLINE_DISABLED 0x80000000