Improve naming and documentation of inventory data

This commit is contained in:
Ryan Dwyer
2022-10-22 18:42:45 +10:00
parent 4d04f1f282
commit b159e01edc
18 changed files with 2200 additions and 2100 deletions
+25 -14
View File
@@ -1184,6 +1184,9 @@
#define GOPOSMASK_SPEED (GOPOSFLAG_WALK | GOPOSFLAG_JOG | GOPOSFLAG_RUN)
#define GUNAMMOREASON_OPTION 0x01
#define GUNAMMOREASON_NOCONTROL 0x02
#define GUNCMD_END 0
#define GUNCMD_SHOWPART 1
#define GUNCMD_HIDEPART 2
@@ -1204,14 +1207,21 @@
#define GUNMEMOWNER_CHANGING 10
#define GUNMEMOWNER_FREE 11
#define GUNAMMOREASON_OPTION 0x01
#define GUNAMMOREASON_NOCONTROL 0x02
#define GUNSIGHTREASON_1 0x01
#define GUNSIGHTREASON_NOTAIMING 0x02
#define GUNSIGHTREASON_NOCONTROL 0x04
#define GUNSIGHTREASON_DAMAGE 0x10
#define GUNVISCMD_END 0
#define GUNVISCMD_ALWAYSTRUE 1
#define GUNVISCMD_CHECKUPGRADE 4
#define GUNVISCMD_CHECKINLEFTHAND 5
#define GUNVISCMD_CHECKINRIGHTHAND 6
#define GUNVISOP_IFTRUE_SETVISIBLE 0
#define GUNVISOP_IFTRUE_SETHIDDEN 1
#define GUNVISOP_SETVISIBILITY 3
#define HAND_RIGHT 0
#define HAND_LEFT 1
@@ -2557,6 +2567,7 @@
#define MODELPART_0003 0x0003
#define MODELPART_0010 0x0010
#define MODELPART_0011 0x0011
#define MODELPART_0029 0x0029
#define MODELPART_0035 0x0035
#define MODELPART_0036 0x0036
#define MODELPART_0042 0x0042
@@ -3589,12 +3600,12 @@
#define SIGHT_MAIAN 6
#define SIGHT_NONE 7
#define SIGHTTARGET_NONE 0
#define SIGHTTARGET_DEFAULT 1
#define SIGHTTARGET_BETASCANNER 2
#define SIGHTTARGET_ROCKETLAUNCHER 3
#define SIGHTTARGET_CMP150 4
#define SIGHTTARGET_THREATDETECTOR 5
#define SIGHTTRACKTYPE_NONE 0
#define SIGHTTRACKTYPE_DEFAULT 1
#define SIGHTTRACKTYPE_BETASCANNER 2
#define SIGHTTRACKTYPE_ROCKETLAUNCHER 3
#define SIGHTTRACKTYPE_FOLLOWLOCKON 4
#define SIGHTTRACKTYPE_THREATDETECTOR 5
#define SKEL_BASIC 0x02
#define SKEL_CHRGUN 0x03
@@ -4340,11 +4351,11 @@ enum weaponnum {
/*0x5d*/ WEAPON_SUICIDEPILL
};
#define WEAPONCLASSFLAG_MANUALZOOM 0x00000001
#define WEAPONCLASSFLAG_AUTOAIM 0x00000002
#define WEAPONCLASSFLAG_00000004 0x00000004
#define INVAIMFLAG_MANUALZOOM 0x00000001
#define INVAIMFLAG_AUTOAIM 0x00000002
#define INVAIMFLAG_ACCURATESINGLESHOT 0x00000004
#define WEAPONFLAG_00000001 0x00000001 // mines, grenades and knives
#define WEAPONFLAG_THROWABLE 0x00000001 // Entire weapon is throwable (eg. grendes, mines, knives)
#define WEAPONFLAG_00000004 0x00000004
#define WEAPONFLAG_ONEHANDED 0x00000008 // Makes guards carry the gun with one hand
#define WEAPONFLAG_AICANUSE 0x00000010
@@ -4368,7 +4379,7 @@ enum weaponnum {
#define WEAPONFLAG_DETERMINER_F_THE 0x01000000 // "Picked up the ..." (full version)
#define WEAPONFLAG_02000000 0x02000000 // Slayer
#define WEAPONFLAG_04000000 0x04000000
#define WEAPONFLAG_08000000 0x08000000
#define WEAPONFLAG_UNDROPPABLE 0x08000000 // Do not drop when disarmed or killed
#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
-2
View File
@@ -241,8 +241,6 @@ extern bool g_ObjectiveChecksDisabled;
extern u16 var8006ae90[];
extern u16 var8006af0c[];
extern u16 var8006af8c[];
extern struct noisesettings invnoisesettings_00010fd0;
extern struct inventory_class invclass_default;
extern struct weapon *g_Weapons[];
extern u32 var800700ac;
extern bool g_CasingsActive;
+2 -2
View File
@@ -11,9 +11,9 @@ void bgunStop(void);
void bgunRumble(s32 handnum, s32 weaponnum);
s32 bgunGetUnequippedReloadIndex(s32 weaponnum);
void bgunTickUnequippedReload(void);
bool bgun0f097df0(struct inventory_typef *arg0, struct hand *hand);
bool bgunTestGunVisCommand(struct gunviscmd *cmd, struct hand *hand);
void bgunSetPartVisible(s16 partnum, bool visible, struct hand *hand, struct modelfiledata *filedata);
void bgun0f097f28(struct hand *hand, struct modelfiledata *arg1, struct inventory_typef *arg2);
void bgunExecuteGunVisCommands(struct hand *hand, struct modelfiledata *arg1, struct gunviscmd *command);
void bgun0f098030(struct hand *hand, struct modelfiledata *arg1);
f32 bgun0f09815c(struct hand *hand);
void bgun0f0981e8(struct hand *hand, struct modelfiledata *modeldef);
+4 -4
View File
@@ -10,7 +10,7 @@ struct weaponfunc *gsetGetWeaponFunction2(struct gset *gset);
struct weaponfunc *gsetGetWeaponFunction(struct gset *gset);
struct weaponfunc *weaponGetFunction(struct gset *gset, s32 which);
struct weaponfunc *currentPlayerGetWeaponFunction(u32 hand);
struct inventory_class *func0f0b11bc(struct gset *gset);
struct invaimsettings *gsetGetAimSettings(struct gset *gset);
struct inventory_ammo *weaponGetAmmoByFunction(u32 weaponnum, u32 funcnum);
f32 handGetXShift(s32 handnum);
f32 func0f0b131c(s32 handnum);
@@ -18,7 +18,7 @@ f32 currentPlayerGetGunZoomFov(void);
void currentPlayerZoomOut(f32 fovpersec);
void currentPlayerZoomIn(f32 fovpersec);
bool weaponHasFlag(s32 itemid, u32 flag);
bool weaponHasClassFlag(s32 weaponnum, u32 flag);
bool weaponHasAimFlag(s32 weaponnum, u32 flag);
bool weaponHasAmmoFlag(s32 weaponnum, s32 funcnum, u32 flag);
s32 currentPlayerGetDeviceState(s32 weaponnum);
void currentPlayerSetDeviceActive(s32 weaponum, bool active);
@@ -26,8 +26,8 @@ u16 weaponGetModelNum(s32 weaponnum);
u16 weaponGetModelNum2(s32 weaponnum);
void gsetPopulateFromCurrentPlayer(s32 handnum, struct gset *gset);
struct inventory_ammo *gsetGetAmmoDefinition(struct gset *gset);
u8 gsetGetSingleUnk3c(struct gset *gset);
f32 gsetGetStrength(struct gset *gset);
u8 gsetGetSinglePenetration(struct gset *gset);
f32 gsetGetImpactForce(struct gset *gset);
f32 gsetGetDamage(struct gset *gset);
u8 gsetGetFireslotDuration(struct gset *gset);
u16 gsetGetSingleShootSound(struct gset *gset);
+2 -2
View File
@@ -4,8 +4,8 @@
#include "data.h"
#include "types.h"
extern struct noisesettings invnoisesettings_00010fd0;
extern struct inventory_class invclass_default;
extern struct noisesettings invnoisesettings_silent;
extern struct invaimsettings invaimsettings_default;
extern struct weapon *g_Weapons[WEAPON_SUICIDEPILL + 1];
void invReset(void);
+14
View File
@@ -34,3 +34,17 @@
#define gunscript_setsoundspeed(keyframe, speed) \
{ GUNCMD_SETSOUNDSPEED, 0, keyframe, speed },
#define gunviscmd_end \
{ GUNVISCMD_END },
#define gunviscmd_sethidden(modelpart) \
{ GUNVISCMD_ALWAYSTRUE, 0, GUNVISOP_IFTRUE_SETHIDDEN, modelpart, 0 },
#define gunviscmd_checkupgrade(upgrade, operator, modelpart) \
{ GUNVISCMD_CHECKUPGRADE, upgrade, operator, modelpart, 0 },
#define gunviscmd_checkinlefthand(operator, modelpart) \
{ GUNVISCMD_CHECKINLEFTHAND, 0, operator, modelpart, 0 },
#define gunviscmd_checkinrighthand(operator, modelpart) \
{ GUNVISCMD_CHECKINRIGHTHAND, 0, operator, modelpart, 0 },
+67 -58
View File
@@ -2752,7 +2752,7 @@ struct player {
/*0x1b88*/ s32 introanimnum;
/*0x1b8c*/ s32 lastsighton;
/*0x1b90*/ u16 targetset[4]; // related to trackedprops
/*0x1b98*/ u8 target;
/*0x1b98*/ u8 sighttracktype; // eg. threat detector, follow lock-on
/*0x1b9c*/ f32 speedthetacontrol;
/*0x1ba0*/ s32 cam_room;
/*0x1ba4*/ s16 autocontrol_aimpad;
@@ -2860,37 +2860,46 @@ struct noisesettings {
f32 minradius;
f32 maxradius;
f32 incradius;
f32 unk0c;
f32 unk10;
f32 decbasespeed;
f32 decremspeed;
};
struct inventory_class {
struct recoilsettings {
f32 xrange;
f32 yrange;
f32 zrange;
f32 unk0c; // not used
u8 unk10; // not used
};
struct invaimsettings {
f32 zoomfov;
f32 unk04;
f32 unk08;
f32 unk0c;
f32 unk10;
f32 unk14;
u32 unk18;
f32 guntransup; // gun y translation when aiming upwards
f32 guntransdown; // gun y translation when aiming downwards
f32 guntransside; // gun x translation when aiming sideways
f32 aimdamppal; // slowdown speed when aiming or turning (PAL)
f32 aimdamp; // slowdown speed when aiming or turning (NTSC)
u32 tracktype : 4;
u32 unk18_04 : 4; // not used
u32 flags;
};
struct inventory_typef {
// See related functions: bgun0f097f28 and bgun0f097df0
struct gunviscmd {
// See related functions: bgunExecuteGunVisCommands and bgunTestGunVisCommand
// unk00 - Some kind of condition field
// 0 = terminator
// 4 = if bit in hand->unk0639 (bit index specified via unk02)
// 5 = if in left hand
// 6 = if in right hand
u8 unk00;
u8 type;
u16 unk02;
u16 param;
// 0 = do true thing if condition passed
// 1 = do false thing if condition passed
// 3 = do true thing if condition passed, or false thing if condition failed
u8 unk04;
// 0 = set part visible if condition passed
// 1 = set part hidden if condition passed
// 3 = set part visible if condition passed, or hidden if condition failed
u8 op;
u16 partnum;
u16 unk08;
@@ -2899,7 +2908,7 @@ struct inventory_typef {
struct weaponfunc {
/*0x00*/ s32 type;
/*0x04*/ u16 name;
/*0x06*/ u8 unk06;
/*0x06*/ u8 unk06; // not used
/*0x07*/ s8 ammoindex; // -1 = no ammo, 0 or 1 = index into weapon->ammos[]
/*0x08*/ struct noisesettings *noisesettings;
/*0x0c*/ struct guncmd *fire_animation;
@@ -2908,8 +2917,8 @@ struct weaponfunc {
struct weaponfunc_shoot {
struct weaponfunc base;
/*0x14*/ struct noisesettings *unk14;
/*0x18*/ s8 unk18;
/*0x14*/ struct recoilsettings *recoilsettings;
/*0x18*/ s8 recoverytime60;
/*0x1c*/ f32 damage;
/*0x20*/ f32 spread;
@@ -2922,13 +2931,13 @@ struct weaponfunc_shoot {
/*0x26*/ s8 unk26;
/*0x27*/ s8 unk27;
/*0x28*/ f32 recoil;
/*0x2c*/ f32 unk2c;
/*0x28*/ f32 recoildist;
/*0x2c*/ f32 recoilangle;
/*0x30*/ f32 slidemax;
/*0x34*/ f32 strength;
/*0x38*/ u8 unk38;
/*0x34*/ f32 impactforce;
/*0x38*/ u8 duration60;
/*0x3a*/ u16 shootsound;
/*0x3c*/ u8 unk3c;
/*0x3c*/ u8 penetration;
};
struct weaponfunc_shootsingle {
@@ -2937,24 +2946,24 @@ struct weaponfunc_shootsingle {
struct weaponfunc_shootauto {
struct weaponfunc_shoot base;
/*0x40*/ f32 initialfirerate; // rounds per minute
/*0x44*/ f32 maxfirerate; // rounds per minute
/*0x48*/ f32 *unk48;
/*0x4c*/ f32 *unk4c;
/*0x50*/ s8 unk50;
/*0x51*/ s8 unk51;
/*0x40*/ f32 initialrpm; // rounds per minute
/*0x44*/ f32 maxrpm; // rounds per minute
/*0x48*/ f32 *vibrationstart;
/*0x4c*/ f32 *vibrationmax;
/*0x50*/ s8 turretaccel;
/*0x51*/ s8 turretdecel;
};
struct weaponfunc_shootprojectile {
struct weaponfunc_shoot base;
/*0x40*/ s32 projectilemodelnum;
/*0x44*/ u32 unk44;
/*0x44*/ u32 unk44; // unused
/*0x48*/ f32 scale;
/*0x4c*/ s32 unk4c;
/*0x4c*/ s32 speed;
/*0x50*/ f32 unk50;
/*0x54*/ s32 unk54;
/*0x54*/ s32 traveldist;
/*0x58*/ s32 timer60;
/*0x5c*/ f32 unk5c;
/*0x5c*/ f32 reflectangle;
/*0x60*/ s16 soundnum;
};
@@ -2970,25 +2979,25 @@ struct weaponfunc_close {
struct weaponfunc base;
/*0x14*/ f32 damage;
/*0x18*/ f32 range;
/*0x1c*/ u32 unk1c;
/*0x20*/ u32 unk20;
/*0x24*/ u32 unk24;
/*0x28*/ u32 unk28;
/*0x2c*/ u32 unk2c;
/*0x30*/ u32 unk30;
/*0x34*/ u32 unk34;
/*0x38*/ u32 unk38;
/*0x3c*/ u32 unk3c;
/*0x40*/ u32 unk40;
/*0x44*/ u32 unk44;
/*0x48*/ u32 unk48;
/*0x1c*/ u32 unk1c; // unused
/*0x20*/ u32 unk20; // unused
/*0x24*/ u32 unk24; // unused
/*0x28*/ f32 unk28; // unused
/*0x2c*/ f32 unk2c; // unused
/*0x30*/ f32 unk30; // unused
/*0x34*/ f32 unk34; // unused
/*0x38*/ f32 unk38; // unused
/*0x3c*/ f32 unk3c; // unused
/*0x40*/ f32 unk40; // unused
/*0x44*/ f32 unk44; // unused
/*0x48*/ u32 unk48; // unused
};
struct weaponfunc_special {
struct weaponfunc base;
/*0x14*/ s32 specialfunc;
/*0x18*/ s32 unk18;
/*0x1c*/ u32 unk1c;
/*0x18*/ s32 recoverytime60;
/*0x1c*/ u16 soundnum; // unused
};
struct weaponfunc_device {
@@ -3018,13 +3027,13 @@ struct weapon {
/*0x10*/ struct guncmd *sectopri_animation;
/*0x14*/ void *functions[2];
/*0x1c*/ struct inventory_ammo *ammos[2];
/*0x24*/ struct inventory_class *eptr;
/*0x28*/ f32 sway;
/*0x2c*/ f32 leftright;
/*0x30*/ f32 updown;
/*0x34*/ f32 frontback;
/*0x38*/ f32 unk38;
/*0x3c*/ struct inventory_typef *fptr;
/*0x24*/ struct invaimsettings *aimsettings;
/*0x28*/ f32 muzzlez;
/*0x2c*/ f32 posx;
/*0x30*/ f32 posy;
/*0x34*/ f32 posz;
/*0x38*/ f32 sway;
/*0x3c*/ struct gunviscmd *gunviscmds;
/*0x40*/ struct modelpartvisibility *partvisibility;
/*0x44*/ u16 shortname;
/*0x46*/ u16 name;
@@ -6019,7 +6028,7 @@ struct shotdata {
/*0x1c*/ struct coord gunpos;
/*0x28*/ struct coord dir;
/*0x34*/ f32 unk34;
/*0x38*/ s32 unk38;
/*0x38*/ s32 penetration;
/*0x3c*/ struct hit hits[10];
};