forked from CasualCoderGuy/FO4-ModSwitchFramework-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMSF_Serialization.h
More file actions
84 lines (73 loc) · 2.24 KB
/
MSF_Serialization.h
File metadata and controls
84 lines (73 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#include "f4se/PluginAPI.h"
#include "f4se/PapyrusEvents.h"
#include "MSF_WeaponState.h"
#include "MSF_Data.h"
#include <unordered_map>
class StoredExtraWeaponState
{
public:
static const UInt32 dataType = 'EXWS';
StoredExtraWeaponState(ExtraWeaponState* extraWeaponState);
StoredExtraWeaponState(const F4SESerializationInterface* intfc, UInt32 version);
bool SaveExtra(const F4SESerializationInterface* intfc, UInt32 version);
bool Recover(const F4SESerializationInterface* intfc, UInt32 version);
/*
static StoredExtraWeaponState* ConvertForStorage(ExtraWeaponState* extraWeaponState);
bool Recover();
class StoredAmmoMod
{
public:
StoredAmmoMod(AmmoData::AmmoMod* ammoMod);
AmmoData::AmmoMod* Recover();
UInt32 baseAmmo;
UInt32 ammoType;
UInt32 ammoMod;
UInt8 ammo_number;
};
class StoredModData
{
public:
StoredModData(ModData::Mod* mod);
ModData::Mod* Recover();
UInt32 attachParent;
UInt32 instantiationFilter;
UInt32 mod;
UInt8 mod_number;
};
*/
class StoredWeaponState
{
public:
StoredWeaponState(ExtraWeaponState::WeaponState* weaponState);
StoredWeaponState(const F4SESerializationInterface* intfc, UInt32 version);
bool SaveState(const F4SESerializationInterface* intfc, UInt32 version);
ExtraWeaponState::WeaponState* Recover(const F4SESerializationInterface* intfc, UInt32 version);
UInt16 flags; //state flags
UInt16 ammoCapacity;
UInt16 chamberSize;
UInt16 chamberedCount;
UInt16 shotCount;
UInt32 loadedAmmo;
UInt32 chamberedAmmo;
UInt32 equippedAmmo;
std::vector<UInt32> BCRammo;
std::vector<UInt32> stateMods;
//StoredAmmoMod switchToAmmoAfterFire;
//StoredAmmoMod currentSwitchedAmmo;
//std::vector<ModData::Mod*> attachedMods; //maybe later
};
private:
WeaponStateID ID;
UInt32 currentState;
//BurstModeManager* burstModeManager;
std::map<UInt32, StoredWeaponState> weaponStates;
};
namespace MSF_Serialization
{
void RevertCallback(const F4SESerializationInterface* intfc);
void LoadCallback(const F4SESerializationInterface* intfc);
void SaveCallback(const F4SESerializationInterface* intfc);
bool Load(const F4SESerializationInterface* intfc, UInt32 version);
bool Save(const F4SESerializationInterface* intfc, UInt32 version, ExtraWeaponState* extraState);
}