Skip to content

Commit

Permalink
Merge pull request #198 from Laupetin/feature/accuracy-tables
Browse files Browse the repository at this point in the history
feat: dump and load weapon accuracy tables
  • Loading branch information
Laupetin authored May 20, 2024
2 parents 183ebe4 + e68a730 commit 47f5f2a
Show file tree
Hide file tree
Showing 35 changed files with 908 additions and 416 deletions.
24 changes: 10 additions & 14 deletions src/Common/Game/IW3/IW3_Assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -3091,20 +3091,16 @@ namespace IW3
float fHipViewScatterMax;
float fightDist;
float maxDist;
// TODO: Order is accuracyGraphName[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ...
// Which is currently not possible to do in code generation. Afaik this is the only place where this is the case.
// So might be something to fix but on the other hand it might be too much work for this little inconvenience.
// const char* accuracyGraphName[2];
const char* accuracyGraphName0;
const char* accuracyGraphName1;
// float(*accuracyGraphKnots[2])[2];
vec2_t* accuracyGraphKnots0;
vec2_t* accuracyGraphKnots1;
// float(*originalAccuracyGraphKnots[2])[2];
vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1;
int accuracyGraphKnotCount[2];
int originalAccuracyGraphKnotCount[2];
const char* aiVsAiAccuracyGraphName;
const char* aiVsPlayerAccuracyGraphName;
vec2_t* aiVsAiAccuracyGraphKnots;
vec2_t* aiVsPlayerAccuracyGraphKnots;
vec2_t* originalAiVsAiAccuracyGraphKnots;
vec2_t* originalAiVsPlayerAccuracyGraphKnots;
int aiVsAiAccuracyGraphKnotCount;
int aiVsPlayerAccuracyGraphKnotCount;
int originalAiVsAiAccuracyGraphKnotCount;
int originalAiVsPlayerAccuracyGraphKnotCount;
int iPositionReloadTransTime;
float leftArc;
float rightArc;
Expand Down
21 changes: 10 additions & 11 deletions src/Common/Game/IW4/IW4_Assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -4399,15 +4399,12 @@ namespace IW4
float fHipViewScatterMax;
float fightDist;
float maxDist;
// const char* accuracyGraphName[2];// TODO: Order is accuracyGraphName[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ...
// Which is currently not possible to do in code generation. Afaik this is the only place where this is the case.
// So might be something to fix but on the other hand it might be too much work for this little inconvenience.
// vec2_t* originalAccuracyGraphKnots[2];
const char* accuracyGraphName0;
const char* accuracyGraphName1;
vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1;
uint16_t originalAccuracyGraphKnotCount[2];
const char* aiVsAiAccuracyGraphName;
const char* aiVsPlayerAccuracyGraphName;
vec2_t* originalAiVsAiAccuracyGraphKnots;
vec2_t* originalAiVsPlayerAccuracyGraphKnots;
uint16_t originalAiVsAiAccuracyGraphKnotCount;
uint16_t originalAiVsPlayerAccuracyGraphKnotCount;
int iPositionReloadTransTime;
float leftArc;
float rightArc;
Expand Down Expand Up @@ -4551,8 +4548,10 @@ namespace IW4
int ammoDropStockMax;
float adsDofStart;
float adsDofEnd;
uint16_t accuracyGraphKnotCount[2];
vec2_t* accuracyGraphKnots[2];
uint16_t aiVsAiAccuracyGraphKnotCount;
uint16_t aiVsPlayerAccuracyGraphKnotCount;
vec2_t* aiVsAiAccuracyGraphKnots;
vec2_t* aiVsPlayerAccuracyGraphKnots;
bool motionTracker;
bool enhanced;
bool dpadIconShowsAmmo;
Expand Down
21 changes: 10 additions & 11 deletions src/Common/Game/IW5/IW5_Assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -3756,15 +3756,12 @@ namespace IW5
float fHipViewScatterMax;
float fightDist;
float maxDist;
// const char* accuracyGraphName[2];// TODO: Order is accuracyGraphName[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ...
// Which is currently not possible to do in code generation. Afaik this is the only place where this is the case.
// So might be something to fix but on the other hand it might be too much work for this little inconvenience.
// vec2_t* originalAccuracyGraphKnots[2];
const char* accuracyGraphName0;
const char* accuracyGraphName1;
vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1;
unsigned short originalAccuracyGraphKnotCount[2];
const char* aiVsAiAccuracyGraphName;
const char* aiVsPlayerAccuracyGraphName;
vec2_t* originalAiVsAiAccuracyGraphKnots;
vec2_t* originalAiVsPlayerAccuracyGraphKnots;
unsigned short originalAiVsAiAccuracyGraphKnotCount;
unsigned short originalAiVsPlayerAccuracyGraphKnotCount;
int iPositionReloadTransTime;
float leftArc;
float rightArc;
Expand Down Expand Up @@ -4021,8 +4018,10 @@ namespace IW5
int ammoDropStockMax;
float adsDofStart;
float adsDofEnd;
unsigned short accuracyGraphKnotCount[2];
vec2_t* accuracyGraphKnots[2];
uint16_t aiVsAiAccuracyGraphKnotCount;
uint16_t aiVsPlayerAccuracyGraphKnotCount;
vec2_t* aiVsAiAccuracyGraphKnots;
vec2_t* aiVsPlayerAccuracyGraphKnots;
bool motionTracker;
bool enhanced;
bool dpadIconShowsAmmo;
Expand Down
24 changes: 10 additions & 14 deletions src/Common/Game/T5/T5_Assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -3861,20 +3861,16 @@ namespace T5
float fHipViewScatterMax;
float fightDist;
float maxDist;
// const char *accuracyGraphName[2]; // TODO: Order is accuracyGraphName[0] -> accuracyGraphKnots[0] -> originalAccuracyGraphKnots[0] ->
// accuracyGraphName[1] -> ...
// Which is currently not possible to do in code generation. Afaik this is the only place where this is the case.
// So might be something to fix but on the other hand it might be too much work for this little inconvenience.
const char* accuracyGraphName0;
const char* accuracyGraphName1;
// vec2_t *accuracyGraphKnots[2];
vec2_t* accuracyGraphKnots0;
vec2_t* accuracyGraphKnots1;
// vec2_t *originalAccuracyGraphKnots[2];
vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1;
int accuracyGraphKnotCount[2];
int originalAccuracyGraphKnotCount[2];
const char* aiVsAiAccuracyGraphName;
const char* aiVsPlayerAccuracyGraphName;
vec2_t* aiVsAiAccuracyGraphKnots;
vec2_t* aiVsPlayerAccuracyGraphKnots;
vec2_t* originalAiVsAiAccuracyGraphKnots;
vec2_t* originalAiVsPlayerAccuracyGraphKnots;
int aiVsAiAccuracyGraphKnotCount;
int aiVsPlayerAccuracyGraphKnotCount;
int originalAiVsAiAccuracyGraphKnotCount;
int originalAiVsPlayerAccuracyGraphKnotCount;
int iPositionReloadTransTime;
float leftArc;
float rightArc;
Expand Down
24 changes: 10 additions & 14 deletions src/Common/Game/T6/T6_Assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -4860,20 +4860,16 @@ namespace T6
float fAntiQuickScopeSwayFactor;
float fightDist;
float maxDist;
// const char *accuracyGraphName[2]; // TODO: Order is accuracyGraphName[0] -> accuracyGraphKnots[0] -> originalAccuracyGraphKnots[0] ->
// accuracyGraphName[1] -> ...
// Which is currently not possible to do in code generation. Afaik this is the only place where this is the case.
// So might be something to fix but on the other hand it might be too much work for this little inconvenience.
const char* accuracyGraphName0;
const char* accuracyGraphName1;
// vec2_t *accuracyGraphKnots[2];
vec2_t* accuracyGraphKnots0;
vec2_t* accuracyGraphKnots1;
// vec2_t *originalAccuracyGraphKnots[2];
vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1;
int accuracyGraphKnotCount[2];
int originalAccuracyGraphKnotCount[2];
const char* aiVsAiAccuracyGraphName;
const char* aiVsPlayerAccuracyGraphName;
vec2_t* aiVsAiAccuracyGraphKnots;
vec2_t* aiVsPlayerAccuracyGraphKnots;
vec2_t* originalAiVsAiAccuracyGraphKnots;
vec2_t* originalAiVsPlayerAccuracyGraphKnots;
int aiVsAiAccuracyGraphKnotCount;
int aiVsPlayerAccuracyGraphKnotCount;
int originalAiVsAiAccuracyGraphKnotCount;
int originalAiVsPlayerAccuracyGraphKnotCount;
int iPositionReloadTransTime;
float leftArc;
float rightArc;
Expand Down
4 changes: 2 additions & 2 deletions src/ObjCommon/Game/IW4/InfoString/WeaponFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,8 @@ namespace IW4
{"scanPauseTime", offsetof(WeaponFullDef, weapDef.scanPauseTime), CSPFT_MILLISECONDS },
{"fightDist", offsetof(WeaponFullDef, weapDef.fightDist), CSPFT_FLOAT },
{"maxDist", offsetof(WeaponFullDef, weapDef.maxDist), CSPFT_FLOAT },
{"aiVsAiAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName0), CSPFT_STRING },
{"aiVsPlayerAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName1), CSPFT_STRING },
{"aiVsAiAccuracyGraph", offsetof(WeaponFullDef, weapDef.aiVsAiAccuracyGraphName), CSPFT_STRING },
{"aiVsPlayerAccuracyGraph", offsetof(WeaponFullDef, weapDef.aiVsPlayerAccuracyGraphName), CSPFT_STRING },
{"locNone", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_NONE]), CSPFT_FLOAT },
{"locHelmet", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HELMET]), CSPFT_FLOAT },
{"locHead", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HEAD]), CSPFT_FLOAT },
Expand Down
4 changes: 2 additions & 2 deletions src/ObjCommon/Game/IW5/InfoString/WeaponFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,8 @@ namespace IW5
{"scanPauseTime", offsetof(WeaponFullDef, weapDef.scanPauseTime), CSPFT_MILLISECONDS },
{"fightDist", offsetof(WeaponFullDef, weapDef.fightDist), CSPFT_FLOAT },
{"maxDist", offsetof(WeaponFullDef, weapDef.maxDist), CSPFT_FLOAT },
{"aiVsAiAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName0), CSPFT_STRING },
{"aiVsPlayerAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName1), CSPFT_STRING },
{"aiVsAiAccuracyGraph", offsetof(WeaponFullDef, weapDef.aiVsAiAccuracyGraphName), CSPFT_STRING },
{"aiVsPlayerAccuracyGraph", offsetof(WeaponFullDef, weapDef.aiVsPlayerAccuracyGraphName), CSPFT_STRING },
{"locNone", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_NONE]), CSPFT_FLOAT },
{"locHelmet", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HELMET]), CSPFT_FLOAT },
{"locHead", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HEAD]), CSPFT_FLOAT },
Expand Down
4 changes: 2 additions & 2 deletions src/ObjCommon/Game/T6/InfoString/WeaponFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,8 @@ namespace T6
{"explosionCameraShakeRadius", offsetof(WeaponFullDef, weapDef.explosionCameraShakeRadius), CSPFT_INT },
{"fightDist", offsetof(WeaponFullDef, weapDef.fightDist), CSPFT_FLOAT },
{"maxDist", offsetof(WeaponFullDef, weapDef.maxDist), CSPFT_FLOAT },
{"aiVsAiAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName0), CSPFT_STRING },
{"aiVsPlayerAccuracyGraph", offsetof(WeaponFullDef, weapDef.accuracyGraphName1), CSPFT_STRING },
{"aiVsAiAccuracyGraph", offsetof(WeaponFullDef, weapDef.aiVsAiAccuracyGraphName), CSPFT_STRING },
{"aiVsPlayerAccuracyGraph", offsetof(WeaponFullDef, weapDef.aiVsPlayerAccuracyGraphName), CSPFT_STRING },
{"locNone", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_NONE]), CSPFT_FLOAT },
{"locHelmet", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HELMET]), CSPFT_FLOAT },
{"locHead", offsetof(WeaponFullDef, locationDamageMultipliers[HITLOC_HEAD]), CSPFT_FLOAT },
Expand Down
25 changes: 25 additions & 0 deletions src/ObjCommon/Parsing/GenericGraph2D.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once
#include <string>
#include <vector>

class GenericGraph2DKnot
{
public:
double x;
double y;

GenericGraph2DKnot() = default;

GenericGraph2DKnot(const double x, const double y)
: x(x),
y(y)
{
}
};

class GenericGraph2D
{
public:
std::string name;
std::vector<GenericGraph2DKnot> knots;
};
Loading

0 comments on commit 47f5f2a

Please sign in to comment.