Flesh out weapon flag constants

This commit is contained in:
Ryan Dwyer
2021-04-06 19:45:51 +10:00
parent f6a9b44dae
commit 1de2cc728e
14 changed files with 555 additions and 519 deletions
+10 -10
View File
@@ -74,7 +74,7 @@ bool bmoveIsAutoAimYEnabledForCurrentWeapon(void)
struct weaponfunc *func = currentPlayerGetWeaponFunction(0);
if (func) {
if (func->flags & WEAPONFUNCFLAG_00000040) {
if (func->flags & FUNCFLAG_NOAUTOAIM) {
return false;
}
@@ -132,7 +132,7 @@ bool bmoveIsAutoAimXEnabledForCurrentWeapon(void)
struct weaponfunc *func = currentPlayerGetWeaponFunction(0);
if (func) {
if (func->flags & WEAPONFUNCFLAG_00000040) {
if (func->flags & FUNCFLAG_NOAUTOAIM) {
return false;
}
@@ -1178,7 +1178,7 @@ glabel var7f1ad8e4
/* f0c8be4: 00002025 */ or $a0,$zero,$zero
/* f0c8be8: afa201ac */ sw $v0,0x1ac($sp)
/* f0c8bec: 00402025 */ or $a0,$v0,$zero
/* f0c8bf0: 0fc2c601 */ jal weaponHasInvEFlag
/* f0c8bf0: 0fc2c601 */ jal weaponHasClassFlag
/* f0c8bf4: 24050001 */ addiu $a1,$zero,0x1
/* f0c8bf8: 8e4f0288 */ lw $t7,0x288($s2)
/* f0c8bfc: afa201a8 */ sw $v0,0x1a8($sp)
@@ -4128,7 +4128,7 @@ glabel var7f1ad8e4
/* f0cb578: 8fa401ac */ lw $a0,0x1ac($sp)
/* f0cb57c: 11800005 */ beqz $t4,.L0f0cb594
/* f0cb580: 00000000 */ nop
/* f0cb584: 0fc2c601 */ jal weaponHasInvEFlag
/* f0cb584: 0fc2c601 */ jal weaponHasClassFlag
/* f0cb588: 24050002 */ addiu $a1,$zero,0x2
/* f0cb58c: 5440000b */ bnezl $v0,.L0f0cb5bc
/* f0cb590: 00008025 */ or $s0,$zero,$zero
@@ -4329,7 +4329,7 @@ glabel var7f1ad8e4
/* f0c8be4: 00002025 */ or $a0,$zero,$zero
/* f0c8be8: afa201ac */ sw $v0,0x1ac($sp)
/* f0c8bec: 00402025 */ or $a0,$v0,$zero
/* f0c8bf0: 0fc2c601 */ jal weaponHasInvEFlag
/* f0c8bf0: 0fc2c601 */ jal weaponHasClassFlag
/* f0c8bf4: 24050001 */ addiu $a1,$zero,0x1
/* f0c8bf8: 8e4f0288 */ lw $t7,0x288($s2)
/* f0c8bfc: afa201a8 */ sw $v0,0x1a8($sp)
@@ -7279,7 +7279,7 @@ glabel var7f1ad8e4
/* f0cb578: 8fa401ac */ lw $a0,0x1ac($sp)
/* f0cb57c: 11800005 */ beqz $t4,.L0f0cb594
/* f0cb580: 00000000 */ nop
/* f0cb584: 0fc2c601 */ jal weaponHasInvEFlag
/* f0cb584: 0fc2c601 */ jal weaponHasClassFlag
/* f0cb588: 24050002 */ addiu $a1,$zero,0x2
/* f0cb58c: 5440000b */ bnezl $v0,.L0f0cb5bc
/* f0cb590: 00008025 */ or $s0,$zero,$zero
@@ -7480,7 +7480,7 @@ glabel var7f1ad8e4
/* f0c6440: 00002025 */ or $a0,$zero,$zero
/* f0c6444: afa201ac */ sw $v0,0x1ac($sp)
/* f0c6448: 00402025 */ or $a0,$v0,$zero
/* f0c644c: 0fc2bd59 */ jal weaponHasInvEFlag
/* f0c644c: 0fc2bd59 */ jal weaponHasClassFlag
/* f0c6450: 24050001 */ addiu $a1,$zero,0x1
/* f0c6454: 8e4f0288 */ lw $t7,0x288($s2)
/* f0c6458: afa201a8 */ sw $v0,0x1a8($sp)
@@ -10418,7 +10418,7 @@ glabel var7f1ad8e4
/* f0c8da8: 8fa401ac */ lw $a0,0x1ac($sp)
/* f0c8dac: 11400005 */ beqz $t2,.NB0f0c8dc4
/* f0c8db0: 00000000 */ sll $zero,$zero,0x0
/* f0c8db4: 0fc2bd59 */ jal weaponHasInvEFlag
/* f0c8db4: 0fc2bd59 */ jal weaponHasClassFlag
/* f0c8db8: 24050002 */ addiu $a1,$zero,0x2
/* f0c8dbc: 5440000b */ bnezl $v0,.NB0f0c8dec
/* f0c8dc0: 00008025 */ or $s0,$zero,$zero
@@ -10633,7 +10633,7 @@ glabel var7f1ad8e4
//
// controlmode = optionsGetControlMode(g_Vars.currentplayerstats->mpindex);
// weaponnum = handGetWeaponNum(HAND_RIGHT);
// sp1a8 = weaponHasInvEFlag(weaponnum, 0x00000001);
// sp1a8 = weaponHasClassFlag(weaponnum, WEAPONCLASSFLAG_MANUALZOOM);
// contpad1 = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex);
//
// // 8c10
@@ -11813,7 +11813,7 @@ glabel var7f1ad8e4
// && (bmoveIsAutoAimXEnabledForCurrentWeapon() || bmoveIsAutoAimYEnabledForCurrentWeapon())
// && g_Vars.currentplayer->autoxaimprop
// && g_Vars.currentplayer->autoyaimprop
// && weaponHasInvEFlag(weaponnum, 0x00000002)
// && weaponHasClassFlag(weaponnum, WEAPONCLASSFLAG_AUTOAIM)
// )
// || (handGetWeaponNum(HAND_RIGHT) == WEAPON_CMP150 && g_Vars.currentplayer->hands[HAND_RIGHT].weaponfunc == FUNC_SECONDARY)) {
// // Auto aim - move crosshair towards target
+1 -1
View File
@@ -16697,7 +16697,7 @@ struct prop *chrGetEquippedWeaponPropWithCheck(struct chrdata *chr, s32 hand)
if (prop) {
struct weaponobj *weapon = prop->weapon;
if (!weaponHasFlag(weapon->weaponnum, WEAPONFLAG_00000010)) {
if (!weaponHasFlag(weapon->weaponnum, WEAPONFLAG_AICANUSE)) {
prop = NULL;
}
}
+7 -3
View File
@@ -246,16 +246,20 @@ void func0f010bb0(void)
if (stageGetIndex(g_Vars.stagenum) == STAGEINDEX_AIRBASE) {
g_Weapons[WEAPON_EYESPY]->name = L_GUN_061; // "DrugSpy"
g_Weapons[WEAPON_EYESPY]->shortname = L_GUN_061; // "DrugSpy"
g_Weapons[WEAPON_EYESPY]->flags &= ~(WEAPONFLAG_00200000 | WEAPONFLAG_00400000);
g_Weapons[WEAPON_EYESPY]->flags &= ~(WEAPONFLAG_DETERMINER_S_AN | WEAPONFLAG_DETERMINER_F_AN);
} else if (stageGetIndex(g_Vars.stagenum) == STAGEINDEX_CHICAGO
|| (stageGetIndex(g_Vars.stagenum) == STAGEINDEX_MBR)) {
g_Weapons[WEAPON_EYESPY]->name = L_GUN_062; // "BombSpy"
g_Weapons[WEAPON_EYESPY]->shortname = L_GUN_062; // "BombSpy"
g_Weapons[WEAPON_EYESPY]->flags &= ~(WEAPONFLAG_00200000 | WEAPONFLAG_00400000);
g_Weapons[WEAPON_EYESPY]->flags &= ~(WEAPONFLAG_DETERMINER_S_AN | WEAPONFLAG_DETERMINER_F_AN);
} else {
// This is setting the "an" determiner for the camspy which seems
// unusual at first. The theory is that during development it was called
// the eyespy, then the pickup message was changed to "your camspy"
// which made the determiner unused, hence no need to update it.
g_Weapons[WEAPON_EYESPY]->name = L_GUN_060; // "CamSpy"
g_Weapons[WEAPON_EYESPY]->shortname = L_GUN_060; // "CamSpy"
g_Weapons[WEAPON_EYESPY]->flags |= (WEAPONFLAG_00200000 | WEAPONFLAG_00400000);
g_Weapons[WEAPON_EYESPY]->flags |= (WEAPONFLAG_DETERMINER_S_AN | WEAPONFLAG_DETERMINER_F_AN);
}
func0f09ceac();
+5 -5
View File
@@ -8502,7 +8502,7 @@ bool func0f09b260(s32 handnum, struct hand *hand)
if (hand->unk0c40 == 0) {
if (hand->unk0c50 == 0) {
if (func->base.flags & FUNCFLAG_00040000) {
if (func->base.flags & FUNCFLAG_DISCARDWEAPON) {
invRemoveItemByNum(hand->base.weaponnum);
g_Vars.currentplayer->gunctrl.unk1583_04 = true;
#if VERSION >= VERSION_NTSC_1_0
@@ -21746,7 +21746,7 @@ void handCalculateShotSpread(struct coord *arg0, struct coord *arg1, s32 handnum
}
// Unsure what this is
if (weaponHasInvEFlag(getCurrentPlayerWeaponIdWrapper(handnum), 0x00000004)
if (weaponHasClassFlag(getCurrentPlayerWeaponIdWrapper(handnum), WEAPONCLASSFLAG_00000004)
&& player->hands[handnum].unk0b90 == 1) {
spread *= 0.25f;
}
@@ -21821,7 +21821,7 @@ glabel func0f0a0fac
/* f0a1014: 8faa00b8 */ lw $t2,0xb8($sp)
/* f0a1018: 8fa400ac */ lw $a0,0xac($sp)
/* f0a101c: 24050004 */ addiu $a1,$zero,0x4
/* f0a1020: 0fc2c601 */ jal weaponHasInvEFlag
/* f0a1020: 0fc2c601 */ jal weaponHasClassFlag
/* f0a1024: e7a200a4 */ swc1 $f2,0xa4($sp)
/* f0a1028: 10400006 */ beqz $v0,.L0f0a1044
/* f0a102c: c7a200a4 */ lwc1 $f2,0xa4($sp)
@@ -22636,7 +22636,7 @@ glabel currentPlayerAutoSwitchWeapon
// weapon = weaponFindById(weaponnum);
// func = weaponGetFunctionById(weaponnum, FUNC_PRIMARY);
//
// if (!func0f0990b0(func, weapon) && (func->flags & FUNCFLAG_00100000) == 0) {
// if (!func0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) {
// usable = true;
// }
//
@@ -22645,7 +22645,7 @@ glabel currentPlayerAutoSwitchWeapon
// } else {
// func = weaponGetFunctionById(weaponnum, FUNC_SECONDARY);
//
// if (!func0f0990b0(func, weapon) && (func->flags & FUNCFLAG_00100000) == 0) {
// if (!func0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) {
// usable = true;
// }
// }
+3 -3
View File
@@ -102,7 +102,7 @@ u32 weaponGetNumFunctions(u32 weaponnum)
return 2;
}
struct inventory_typee *func0f0b11bc(struct shorthand *hand)
struct inventory_class *func0f0b11bc(struct shorthand *hand)
{
struct weapon *weapon = weaponFindById(hand->weaponnum);
@@ -110,7 +110,7 @@ struct inventory_typee *func0f0b11bc(struct shorthand *hand)
return weapon->eptr;
}
return &inve_000110c0;
return &invclass_default;
}
struct inventory_ammo *weaponGetAmmoByFunction(u32 weaponnum, u32 funcnum)
@@ -278,7 +278,7 @@ bool weaponHasFlag(s32 itemid, u32 flag)
return (weapon->flags & flag) != 0;
}
bool weaponHasInvEFlag(s32 weaponnum, u32 flag)
bool weaponHasClassFlag(s32 weaponnum, u32 flag)
{
struct weapon *weapon = weaponFindById(weaponnum);
+470 -470
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3929,7 +3929,7 @@ Gfx *lvRender(Gfx *gdl)
g_Vars.currentplayer->lookingatprop.prop = NULL;
}
if (handHasFunctionFlags(&g_Vars.currentplayer->hands[0].base, FUNCFLAG_00080000)) {
if (handHasFunctionFlags(&g_Vars.currentplayer->hands[0].base, FUNCFLAG_THREATDETECTOR)) {
lvFindThreats();
} else if (weaponHasFlag(handGetWeaponNum(HAND_RIGHT), WEAPONFLAG_AIMTRACK)) {
s32 j;
+3 -3
View File
@@ -20,7 +20,7 @@ u32 var80070590 = 0x00000000;
void mpstatsIncrementPlayerShotCount(struct shorthand *hand, s32 region)
{
if (!weaponHasFlag(hand->weaponnum, WEAPONFLAG_00100000)) {
if (!weaponHasFlag(hand->weaponnum, WEAPONFLAG_DONTCOUNTSHOTS)) {
g_Vars.currentplayerstats->shotcount[region]++;
}
}
@@ -28,13 +28,13 @@ void mpstatsIncrementPlayerShotCount(struct shorthand *hand, s32 region)
void mpstatsIncrementPlayerShotCount2(struct shorthand *hand, s32 region)
{
if (region == 0) {
if (!weaponHasFlag(hand->weaponnum, WEAPONFLAG_00100000)) {
if (!weaponHasFlag(hand->weaponnum, WEAPONFLAG_DONTCOUNTSHOTS)) {
var80070590 = 1;
g_Vars.currentplayerstats->shotcount[region]++;
}
} else {
if (var80070590) {
if (!weaponHasFlag(hand->weaponnum, WEAPONFLAG_00100000)) {
if (!weaponHasFlag(hand->weaponnum, WEAPONFLAG_DONTCOUNTSHOTS)) {
g_Vars.currentplayerstats->shotcount[region]++;
}
+2 -2
View File
@@ -168,7 +168,7 @@ void sightTick(bool sighton)
u8 newtarget;
s32 i;
s32 index;
struct inventory_typee *thing = func0f0b11bc(&g_Vars.currentplayer->hands[0].base);
struct inventory_class *thing = func0f0b11bc(&g_Vars.currentplayer->hands[0].base);
struct weaponfunc *func = weaponGetFunctionById(g_Vars.currentplayer->hands[0].base.weaponnum,
g_Vars.currentplayer->hands[0].base.weaponfunc);
@@ -192,7 +192,7 @@ void sightTick(bool sighton)
newtarget = thing->unk18 >> 28;
if (handHasFunctionFlags(&g_Vars.currentplayer->hands[0].base, FUNCFLAG_00080000)) {
if (handHasFunctionFlags(&g_Vars.currentplayer->hands[0].base, FUNCFLAG_THREATDETECTOR)) {
newtarget = 5;
}
+44 -12
View File
@@ -849,9 +849,29 @@
#define FUNC_PRIMARY 0
#define FUNC_SECONDARY 1
#define FUNCFLAG_00040000 0x00040000
#define FUNCFLAG_00080000 0x00080000
#define FUNCFLAG_00100000 0x00100000
#define FUNCFLAG_BURST3 0x00000002
#define FUNCFLAG_MAGDISCHARGE 0x00000020 // automatics only
#define FUNCFLAG_NOAUTOAIM 0x00000040
#define FUNCFLAG_STICKTOWALL 0x00000100
#define FUNCFLAG_MAKEDIZZY 0x00000200
#define FUNCFLAG_DROPWEAPON 0x00000400
#define FUNCFLAG_FLYBYWIRE 0x00000800
#define FUNCFLAG_BURST2 0x00001000
#define FUNCFLAG_NOMUZZLEFLASH 0x00002000
#define FUNCFLAG_EXPLOSIVESHELLS 0x00004000
#define FUNCFLAG_LESSDAMAGE 0x00008000
#define FUNCFLAG_NOSTUN 0x00010000
#define FUNCFLAG_BURST5 0x00020000
#define FUNCFLAG_DISCARDWEAPON 0x00040000 // Dragon and Laptop throw
#define FUNCFLAG_THREATDETECTOR 0x00080000
#define FUNCFLAG_AUTOSWITCHUNSELECTABLE 0x00100000
#define FUNCFLAG_00200000 0x00200000 // Psychosis gun only, but doesn't trigger psychosis
#define FUNCFLAG_00400000 0x00400000 // punch, disarm and pistol whip
#define FUNCFLAG_00800000 0x00800000 // mostly throwables but some projectiles too
#define FUNCFLAG_08000000 0x08000000 // rockets
#define FUNCFLAG_10000000 0x10000000 // grenade launchers
#define FUNCFLAG_20000000 0x20000000 // explosives related
#define FUNCFLAG_HOMINGROCKET 0x40000000
#define GAILIST_IDLE 0x0000
#define GAILIST_UNALERTED_0001 0x0001
@@ -3386,27 +3406,39 @@
#define WEAPON_DISABLED 0x5c
#define WEAPON_SUICIDEPILL 0x5d
#define WEAPONCLASSFLAG_MANUALZOOM 0x00000001
#define WEAPONCLASSFLAG_AUTOAIM 0x00000002
#define WEAPONCLASSFLAG_00000004 0x00000004
#define WEAPONFLAG_00000001 0x00000001 // mines, grenades and knives
#define WEAPONFLAG_00000004 0x00000004
#define WEAPONFLAG_ONEHANDED 0x00000008 // Makes guards carry the gun with one hand
#define WEAPONFLAG_00000010 0x00000010
#define WEAPONFLAG_00000400 0x00000400
#define WEAPONFLAG_AICANUSE 0x00000010
#define WEAPONFLAG_DUALFLIP 0x00000020 // For dual wielding, flip the right model to make the left (else have two right hands)
#define WEAPONFLAG_00000040 0x00000040
#define WEAPONFLAG_00000080 0x00000080 // Night vision
#define WEAPONFLAG_TRACKTIMEUSED 0x00000200 // Allow tracking how long gun is used, for weapon of choice
#define WEAPONFLAG_00000400 0x00000400
#define WEAPONFLAG_00000800 0x00000800 // MP briefcase
#define WEAPONFLAG_DUALWIELD 0x00001000 // Allow dual wielding
#define WEAPONFLAG_00002000 0x00002000
#define WEAPONFLAG_00004000 0x00004000
#define WEAPONFLAG_00008000 0x00008000 // Editor: "Special environment mapping"
#define WEAPONFLAG_HASHANDS 0x00020000
#define WEAPONFLAG_HIDEMENUMODEL 0x00040000 // Don't display the rotating model in the inventory menu
#define WEAPONFLAG_HOLDSIDEWAYS 0x00080000 // Allow turning the gun sideways at close range
#define WEAPONFLAG_GANGSTA 0x00080000 // Allow turning the gun sideways at close range
#define WEAPONFLAG_DONTCOUNTSHOTS 0x00100000 // Laser and MP briefcase
#define WEAPONFLAG_DETERMINER_S_AN 0x00200000 // "An ..." (short version - when vertically split)
#define WEAPONFLAG_DETERMINER_F_AN 0x00400000 // "Picked up an ..." (full version)
#define WEAPONFLAG_DETERMINER_S_THE 0x00800000 // "The ..." (short version - when vertically split)
#define WEAPONFLAG_DETERMINER_F_THE 0x01000000 // "Picked up the ..." (full version)
#define WEAPONFLAG_00100000 0x00100000
#define WEAPONFLAG_00200000 0x00200000 // Camspy related
#define WEAPONFLAG_00400000 0x00400000 // Camspy related
#define WEAPONFLAG_02000000 0x02000000 // Slayer
#define WEAPONFLAG_04000000 0x04000000
#define WEAPONFLAG_08000000 0x08000000
#define WEAPONFLAG_DETERMINER_S_SOME 0x10000000 // "Some ..." (short version - when vertically split)
#define WEAPONFLAG_DETERMINER_F_SOME 0x20000000 // "Picked up some ..." (full version)
#define WEAPONFLAG_AIMTRACK 0x40000000 // Allow drawing red box around targets in aim mode
#define WEAPONFLAG_80000000 0x80000000
#define WEAPONFUNCFLAG_00000040 0x00000040 // related to auto aim
#define WEAPONFLAG_FIRETOACTIVATE 0x80000000 // For devices/gadgets
#define WEATHERTYPE_RAIN 0
#define WEATHERTYPE_SNOW 1
+1 -1
View File
@@ -272,7 +272,7 @@ extern u16 var8006ae90[];
extern u16 var8006af0c[];
extern u16 var8006af8c[];
extern struct inventory_menupos invmenupos_00010fd0;
extern struct inventory_typee inve_000110c0;
extern struct inventory_class invclass_default;
extern struct weapon *g_Weapons[];
extern u32 var800700ac;
extern s32 g_CasingsActive;
+2 -2
View File
@@ -10,7 +10,7 @@ struct weaponfunc *handGetWeaponFunction2(struct shorthand *hand);
struct weaponfunc *handGetWeaponFunction(struct shorthand *hand);
struct weaponfunc *weaponGetFunction(struct shorthand *hand, s32 which);
struct weaponfunc *currentPlayerGetWeaponFunction(u32 hand);
struct inventory_typee *func0f0b11bc(struct shorthand *hand);
struct inventory_class *func0f0b11bc(struct shorthand *hand);
struct inventory_ammo *weaponGetAmmoByFunction(u32 weaponnum, u32 funcnum);
f32 handGetXShift(s32 handnum);
f32 func0f0b131c(u32 hand);
@@ -18,7 +18,7 @@ f32 currentPlayerGetGunZoomFov(void);
void currentPlayerZoomOut(f32 fovpersec);
void currentPlayerZoomIn(f32 fovpersec);
bool weaponHasFlag(s32 itemid, u32 flag);
bool weaponHasInvEFlag(s32 weaponnum, u32 flag);
bool weaponHasClassFlag(s32 weaponnum, u32 flag);
bool func0f0b184c(s32 weaponnum, s32 funcnum, s32 arg2);
s32 currentPlayerGetDeviceState(s32 weaponnum);
void currentPlayerSetDeviceActive(s32 weaponum, bool active);
+1 -1
View File
@@ -3,7 +3,7 @@
#include <ultra64.h>
extern struct inventory_menupos invmenupos_00010fd0;
extern struct inventory_typee inve_000110c0;
extern struct inventory_class invclass_default;
extern struct weapon *g_Weapons[WEAPON_SUICIDEPILL + 1];
#endif
+5 -5
View File
@@ -3080,7 +3080,7 @@ struct inventory_menupos {
f32 size;
};
struct inventory_typee {
struct inventory_class {
f32 zoomfov;
f32 unk04;
f32 unk08;
@@ -3125,9 +3125,9 @@ struct weaponfunc_shoot {
/*0x26*/ s8 unk26;
/*0x27*/ s8 unk27;
/*0x28*/ u32 unk28;
/*0x2c*/ u32 unk2c;
/*0x30*/ u32 unk30;
/*0x28*/ f32 recoil;
/*0x2c*/ f32 unk2c;
/*0x30*/ f32 unk30;
/*0x34*/ f32 unk34;
/*0x38*/ u8 unk38;
/*0x3a*/ u16 shootsound;
@@ -3220,7 +3220,7 @@ struct weapon {
/*0x10*/ struct guncmd *sectopri_animation;
/*0x14*/ void *functions[2];
/*0x1c*/ struct inventory_ammo *ammos[2];
/*0x24*/ struct inventory_typee *eptr;
/*0x24*/ struct inventory_class *eptr;
/*0x28*/ f32 sway;
/*0x2c*/ f32 leftright;
/*0x30*/ f32 updown;