Rename entitytype to attackflags

This commit is contained in:
Ryan Dwyer
2021-05-23 12:08:26 +10:00
parent 24a9b5013f
commit 152c955a6f
29 changed files with 281 additions and 285 deletions
+20 -23
View File
@@ -216,39 +216,37 @@
/**
* Makes the chr attempt to do a standing attack.
*
* entity_type is expected to be an ENTITYTYPE constant. It can be bitwise ORed
* with ENTITYTYPE_AIMONLY to make the chr only aim at the entity.
* attackflags is expected to be a bitfield of ATTACKFLAG constants.
*/
#define try_attack_stand(entity_type, entity_id, label) \
#define try_attack_stand(attackflags, entity_id, label) \
mkshort(0x0015), \
mkshort(entity_type), \
mkshort(attackflags), \
mkshort(entity_id), \
label,
/**
* Makes the chr attempt to do a kneeling attack.
*
* entity_type is expected to be an ENTITYTYPE constant. It can be bitwise ORed
* with ENTITYTYPE_AIMONLY to make the chr only aim at the entity.
* attackflags is expected to be a bitfield of ATTACKFLAG constants.
*/
#define try_attack_kneel(entity_type, entity_id, label) \
#define try_attack_kneel(attackflags, entity_id, label) \
mkshort(0x0016), \
mkshort(entity_type), \
mkshort(attackflags), \
mkshort(entity_id), \
label,
/**
* Modifies the target entity and the aim-only/shoot flag.
* Modifies the attackflags for the current attack.
*
* This command can only be used after try_attack_stand, try_attack_kneel,
* try_attack_lie or try_face_entity. A common pattern is to use one of those
* commands with the ENTITYTYPE_AIMONLY flag to point the gun at the entity, and
* commands with the ATTACKFLAG_AIMONLY flag to point the gun at the entity, and
* if the label was followed then call try_modify_attack to remove the
* ENTITYTYPE_AIMONLY flag, causing the chr to shoot.
* ATTACKFLAG_AIMONLY flag, causing the chr to shoot.
*/
#define try_modify_attack(entity_type, entity_id, label) \
#define try_modify_attack(attackflags, entity_id, label) \
mkshort(0x0017), \
mkshort(entity_type), \
mkshort(attackflags), \
mkshort(entity_id), \
label,
@@ -256,11 +254,11 @@
* Makes the chr begin facing the given entity. They will continue to face it
* until stop_chr is used or a significantly different action is given to them.
*
* entity_type is expected to be an ENTITYTYPE constant.
* attackflags is expected to be a bitfield of ATTACKFLAG constants.
*/
#define try_face_entity(entity_type, entity_id, label) \
#define try_face_entity(attackflags, entity_id, label) \
mkshort(0x0018), \
mkshort(entity_type), \
mkshort(attackflags), \
mkshort(entity_id), \
label,
@@ -3324,7 +3322,7 @@
chr, \
label,
#define play_sound_from_entity(channel, entity_id, u1, u2, entity_type) \
#define play_sound_from_entity(channel, entity_id, u1, u2, attackflags) \
mkshort(0x0179), \
channel, \
entity_id, \
@@ -3332,11 +3330,11 @@
0x01, \
mkshort(u1), \
mkshort(u2), \
entity_type,
attackflags,
/**
* Checks if the chr can see their attack target, which should have been
* specified in a prior attack command using entitytype and entityid.
* specified in a prior attack command using attackflags and entityid.
*
* If the chr is not currently doing an attack action, it checks if they can see
* their normal target (same as if_can_see_target).
@@ -3811,12 +3809,11 @@
/**
* Makes the chr attempt to do a lying down attack.
*
* entity_type is expected to be an ENTITYTYPE constant. It can be bitwise ORed
* with ENTITYTYPE_AIMONLY to make the chr only aim at the entity.
* attackflags is expected to be a bitfield of ATTACKFLAG constants.
*/
#define try_attack_lie(entity_type, entity_id, label) \
#define try_attack_lie(attackflags, entity_id, label) \
mkshort(0x01ba), \
mkshort(entity_type), \
mkshort(attackflags), \
mkshort(entity_id), \
label,
+10 -10
View File
@@ -297,6 +297,16 @@
#define ANIMFLAG_02 0x02
#define ANIMFLAG_08 0x08
#define ATTACKFLAG_AIMATBOND 0x0001 // aim/shoot at Jo
#define ATTACKFLAG_AIMFORWARD 0x0002 // aim/shoot in front of self
#define ATTACKFLAG_AIMATCHR 0x0004 // aim/shoot at chr (ID should be given in entityid)
#define ATTACKFLAG_AIMATPAD 0x0008 // aim/shoot at pad (ID should be given in entityid)
#define ATTACKFLAG_AIMATDIRECTION 0x0010 // aim/shoot in compass direction (0000, 4000, 8000, c000)
#define ATTACKFLAG_AIMONLY 0x0020 // aim only - do not shoot
#define ATTACKFLAG_DONTTURN 0x0040 // don't do a shooting animation that would change the chr's direction
#define ATTACKFLAG_SINGLESHOT 0x0080 // single shot only (doesn't work correctly with dual weapons)
#define ATTACKFLAG_AIMATTARGET 0x0200 // aim/shoot at whatever is in the chr's `target` field
#define AUDIOCHANNELFLAG_IDLE 0x0001
#define AUDIOCHANNELFLAG_0002 0x0002
#define AUDIOCHANNELFLAG_0008 0x0008
@@ -759,16 +769,6 @@
#define DROPREASON_5 5
#define DROPREASON_6 6
#define ENTITYTYPE_BOND 0x0001 // aim/shoot at Jo
#define ENTITYTYPE_FORWARD 0x0002 // aim/shoot in front of self
#define ENTITYTYPE_CHR 0x0004 // aim/shoot at chr (ID should be given in entity_id)
#define ENTITYTYPE_PAD 0x0008 // aim/shoot at pad (ID should be given in entity_id)
#define ENTITYTYPE_DIRECTION 0x0010 // aim/shoot in compass direction (0000, 4000, 8000, c000)
#define ENTITYTYPE_AIMONLY 0x0020 // aim only - do not shoot
#define ENTITYTYPE_DONTTURN 0x0040 // don't do a shooting animation that would change the chr's direction
#define ENTITYTYPE_SINGLESHOT 0x0080
#define ENTITYTYPE_TARGET 0x0200 // aim/shoot at whatever is in the chr's `target` field
#define EXPLOSIONTYPE_0 0
#define EXPLOSIONTYPE_2 2
#define EXPLOSIONTYPE_3 3
+14 -14
View File
@@ -20,8 +20,8 @@ bool weaponIsOneHanded(struct prop *prop);
f32 chrGetRangedSpeed(struct chrdata *chr, f32 min, f32 max);
s32 chrGetPercentageOfSlowness(struct chrdata *chr, s32 percentage);
f32 chrGetRangedArghSpeed(struct chrdata *chr, f32 min, f32 max);
f32 chrGetRelativeAttackAngle(struct chrdata *chr, s32 entitytype, s32 entityid);
f32 chrGetDistanceToEntity(struct chrdata *chr, u32 entitytype, s32 entityid);
f32 chrGetRelativeAttackAngle(struct chrdata *chr, u32 attackflags, s32 entityid);
f32 chrGetDistanceToEntity(struct chrdata *chr, u32 attackflags, s32 entityid);
void func0f02e3dc(struct coord *a, struct coord *b, struct coord *c, struct coord *d, struct coord *dst);
void func0f02e4f8(struct coord *arg0, struct coord *arg1, struct coord *dst);
f32 func0f02e550(struct prop *prop, f32 arg1, f32 arg2, u32 arg3, f32 ymax, f32 ymin);
@@ -38,17 +38,17 @@ void chrSurrenderChooseAnimation(struct chrdata *chr);
void chrSidestepChooseAnimation(struct chrdata *chr);
void chrJumpOutChooseAnimation(struct chrdata *chr);
void chrRunPosChooseAnimation(struct chrdata *chr);
void chrAttackStand(struct chrdata *chr, s32 entitytype, s32 entityid);
void chrAttackLie(struct chrdata *chr, s32 entitytype, s32 entityid);
void chrAttackKneel(struct chrdata *chr, s32 entitytype, s32 entityid);
void chrAttackStand(struct chrdata *chr, u32 attackflags, s32 entityid);
void chrAttackLie(struct chrdata *chr, u32 attackflags, s32 entityid);
void chrAttackKneel(struct chrdata *chr, u32 attackflags, s32 entityid);
void chrAttackWalkChooseAnimation(struct chrdata *chr);
void chrAttackWalk(struct chrdata *chr, u32 speed);
void chrAttackRollChooseAnimation(struct chrdata *chr);
void chrAttackRoll(struct chrdata *chr, bool direction);
void chrStartAnim(struct chrdata *chr, s32 animnum, f32 startframe, f32 endframe, u8 flags, s32 arg5, f32 speed);
void func0f031254(struct chrdata *chr);
void chrAttack(struct chrdata *chr, struct attackanimgroup **arg1, bool flip, bool *firing, u32 entitytype, u32 entityid, u32 arg6);
void chrAttackAmount(struct chrdata *chr, u32 entitytype, u32 entityid, u32 maxshots);
void chrAttack(struct chrdata *chr, struct attackanimgroup **arg1, bool flip, bool *firing, u32 attackflags, u32 entityid, u32 arg6);
void chrAttackAmount(struct chrdata *chr, u32 attackflags, u32 entityid, u32 maxshots);
void chrBeginDeath(struct chrdata *chr, struct coord *dir, f32 relangle, s32 ibh, struct shorthand *hand, bool knockout, s32 aplayernum);
void chrBeginArgh(struct chrdata *chr, f32 angle, s32 ibh);
void chrReactToDamage(struct chrdata *chr, struct coord *pos, f32 angle, s32 ibh, struct shorthand *hand, s32 playernum);
@@ -94,7 +94,7 @@ void chrGoPosChooseAnimation(struct chrdata *chr);
bool chrGoToPos(struct chrdata *chr, struct coord *pos, s16 *rooms, u32 flags);
void chrPatrolChooseAnimation(struct chrdata *chr);
void chrStartPatrol(struct chrdata *chr, struct path *path);
bool chrCanSeeEntity(struct chrdata *chr, struct coord *pos, s16 *rooms, bool arg3, u32 entitytype, u32 entityid);
bool chrCanSeeEntity(struct chrdata *chr, struct coord *pos, s16 *rooms, bool arg3, u32 attackflags, u32 entityid);
bool chrCanSeeAttackTarget(struct chrdata *chr, struct coord *pos, s16 *rooms, bool arg3);
bool chrCanSeeChr(struct chrdata *chr, struct chrdata *target, s16 *room);
bool chrHasLineOfSightToPos(struct chrdata *viewerchr, struct coord *pos, s16 *rooms);
@@ -247,11 +247,11 @@ bool chrCanSeeTarget(struct chrdata *chr);
void chrRecordLastSeeTargetTime(struct chrdata *chr);
void chrRecordLastHearTargetTime(struct chrdata *chr);
bool chrIsDead(struct chrdata *chr);
bool chrTryAttackStand(struct chrdata *chr, s32 entitytype, s32 entityid);
bool chrTryAttackKneel(struct chrdata *chr, s32 entitytype, s32 entityid);
bool chrTryAttackLie(struct chrdata *chr, s32 entitytype, s32 entityid);
bool chrTryModifyAttack(struct chrdata *chr, u32 entitytype, s32 entityid);
bool chrFaceEntity(struct chrdata *chr, u32 entitytype, u32 entityid);
bool chrTryAttackStand(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chrTryAttackKneel(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chrTryAttackLie(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chrTryModifyAttack(struct chrdata *chr, u32 attackflags, s32 entityid);
bool chrFaceEntity(struct chrdata *chr, u32 attackflags, u32 entityid);
bool chrSetPath(struct chrdata *chr, u32 path_id);
bool chrTryStartPatrol(struct chrdata *chr);
bool chrTrySurrender(struct chrdata *chr);
@@ -266,7 +266,7 @@ bool chrTrySurprisedLookAround(struct chrdata *chr);
bool chrTryKneel(struct chrdata *chr);
bool chrTryStartAnim(struct chrdata *chr, s32 animfnum, f32 startframe, f32 endframe, u8 flags, s32 arg5, f32 speed);
bool chrTryStartAlarm(struct chrdata *chr, s32 pad_id);
s32 chrConsiderGrenadeThrow(struct chrdata *chr, u32 entitytype, u32 entityid);
s32 chrConsiderGrenadeThrow(struct chrdata *chr, u32 attackflags, u32 entityid);
void chrTickKneel(struct chrdata *chr);
void chrFadeCorpse(struct chrdata *chr);
void chrEnableReap(struct chrdata *chr);
+1 -1
View File
@@ -6,7 +6,7 @@
s32 chraiGetListIdByList(u8 *ailist, bool *is_global);
u32 chraiGoToLabel(u8 *ailist, u32 aioffset, u8 label);
void chraiExecute(void *entity, s32 entity_type);
void chraiExecute(void *entity, s32 proptype);
u32 chraiGetCommandLength(u8 *ailist, u32 aioffset);
#endif
+4 -4
View File
@@ -1005,8 +1005,8 @@ struct tilething {
struct act_stand {
/*0x2c*/ s32 unk02c;
/*0x30*/ u32 face_entitytype;
/*0x34*/ s32 face_entityid;
/*0x30*/ u32 flags;
/*0x34*/ s32 entityid;
/*0x38*/ u32 unk038;
/*0x3c*/ s32 unk03c;
/*0x40*/ u32 unk040;
@@ -1090,7 +1090,7 @@ struct act_attack {
/*0x40*/ u32 unk040;
/*0x44*/ u32 unk044;
/*0x48*/ u32 unk048;
/*0x4c*/ u32 entitytype;
/*0x4c*/ u32 flags;
/*0x50*/ u32 entityid;
/*0x54*/ u32 unk054;
/*0x58*/ u32 unk058;
@@ -1189,7 +1189,7 @@ struct act_surprised {
};
struct act_throwgrenade {
/*0x2c*/ u32 entitytype;
/*0x2c*/ u32 flags;
/*0x30*/ u32 entityid;
/*0x34*/ u32 hand;
/*0x38*/ bool needsequip;