root-cause / v-decompiled-scripts

134 stars 49 forks source link

Feature request: Map stats similar to how you do GXT text. #14

Open gir489returns opened 1 month ago

gir489returns commented 1 month ago

Since a couple of versions ago, GTA V instead of directly referencing the hash inline of a stat, does this extremely convoluted system to access stats by doing something like the following:

if (func_2540(137, func_63()) >= 5)

func_63 is just the global for MPPLY_LAST_MP_CHAR, but calls STAT_GET_INT from func_2541 which calls _GET_STAT_HASH_FOR_CHARACTER_STAT which is a new native. That list can be dumped and cross replicated from the native itself if you take every stat from mpstats.xml and create a list of indexes.

This might get complicated as I don't know how different your decompiler is from the original, but the original did not have very good support for recursion. Not only would you need to map each script's _GET_STAT_HASH_FOR_CHARACTER_STAT funciton, you'd also have to map the corresponding STAT_GET_INT with it.

But ideally instead of if (func_2540(137, func_63()) >= 5), it would say if if (func_2540(137, func_63() / MPX_AWD_DISPATCHWORK /) >= 5).

root-cause commented 1 month ago

The decompiler I'm using isn't that far off from the original so I probably won't try to add it, maybegreat48's fork might be better suited for such tasks