mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 09:20:02 +00:00
Changed save/load in CGang
This commit is contained in:
parent
969d4ac48d
commit
1c7fee4b9f
|
@ -2,7 +2,7 @@
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
#include "Gangs.h"
|
#include "Gangs.h"
|
||||||
|
|
||||||
CGangInfo(&CGangs::Gang)[TOTAL_GANGS] = *(CGangInfo(*)[9])*(uintptr*)0x6EDF78;
|
CGangInfo(&CGangs::Gang)[NUM_GANGS] = *(CGangInfo(*)[9])*(uintptr*)0x6EDF78;
|
||||||
|
|
||||||
void CGangs::Initialize(void)
|
void CGangs::Initialize(void)
|
||||||
{
|
{
|
||||||
|
@ -41,23 +41,43 @@ int8 CGangs::GetGangPedModelOverride(int16 gang)
|
||||||
|
|
||||||
void CGangs::SaveAllGangData(uint8 *buffer, uint32 *size)
|
void CGangs::SaveAllGangData(uint8 *buffer, uint32 *size)
|
||||||
{
|
{
|
||||||
tGangSaveData *data = (tGangSaveData*)buffer;
|
buffer[0] = 'G';
|
||||||
data->tag[0] = 'G';
|
buffer[1] = 'N';
|
||||||
data->tag[1] = 'N';
|
buffer[2] = 'G';
|
||||||
data->tag[2] = 'G';
|
buffer[3] = '\0';
|
||||||
data->tag[3] = '\0';
|
*size = 8 + NUM_GANGS * 16;
|
||||||
data->size = *size = sizeof(tGangSaveData);
|
*(uint32*)(buffer + 4) = *size - 8;
|
||||||
for (int i = 0; i < TOTAL_GANGS; i++)
|
buffer += 8;
|
||||||
data->gangs[i] = *GetGangInfo(i);
|
for (int i = 0; i < NUM_GANGS; i++) {
|
||||||
buffer += sizeof(tGangSaveData);
|
*(uint32*)(buffer) = GetGangInfo(i)->m_nVehicleMI;
|
||||||
|
*(int8*)(buffer + 4) = GetGangInfo(i)->m_nPedModelOverride;
|
||||||
|
*(int8*)(buffer + 5) = GetGangInfo(i)->field_5;
|
||||||
|
*(int16*)(buffer + 6) = GetGangInfo(i)->field_6;
|
||||||
|
*(eWeaponType*)(buffer + 8) = GetGangInfo(i)->m_Weapon1;
|
||||||
|
*(eWeaponType*)(buffer + 12) = GetGangInfo(i)->m_Weapon2;
|
||||||
|
buffer += 16;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGangs::LoadAllGangData(uint8 *buffer, uint32 size)
|
void CGangs::LoadAllGangData(uint8 *buffer, uint32 size)
|
||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
tGangSaveData* data = (tGangSaveData*)buffer;
|
assert(size == 8 + NUM_GANGS * 16);
|
||||||
for (int i = 0; i < TOTAL_GANGS; i++)
|
assert(buffer[0] == 'G');
|
||||||
*GetGangInfo(i) = data->gangs[i];
|
assert(buffer[1] == 'N');
|
||||||
|
assert(buffer[2] == 'G');
|
||||||
|
assert(buffer[3] == '\0');
|
||||||
|
assert(*(uint32*)(buffer + 4) == size - 8);
|
||||||
|
buffer += 8;
|
||||||
|
for (int i = 0; i < NUM_GANGS; i++){
|
||||||
|
GetGangInfo(i)->m_nVehicleMI = *(uint32*)(buffer);
|
||||||
|
GetGangInfo(i)->m_nPedModelOverride = *(int8*)(buffer + 4);
|
||||||
|
GetGangInfo(i)->field_5 = *(int8*)(buffer + 5);
|
||||||
|
GetGangInfo(i)->field_6 = *(int16*)(buffer + 6);
|
||||||
|
GetGangInfo(i)->m_Weapon1 = *(eWeaponType*)(buffer + 8);
|
||||||
|
GetGangInfo(i)->m_Weapon2 = *(eWeaponType*)(buffer + 12);
|
||||||
|
buffer += 16;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
GANG_HOODS,
|
GANG_HOODS,
|
||||||
GANG_7,
|
GANG_7,
|
||||||
GANG_8,
|
GANG_8,
|
||||||
TOTAL_GANGS
|
NUM_GANGS
|
||||||
};
|
};
|
||||||
static void Initialize(void);
|
static void Initialize(void);
|
||||||
static void SetGangVehicleModel(int16, int);
|
static void SetGangVehicleModel(int16, int);
|
||||||
|
@ -49,14 +49,5 @@ public:
|
||||||
private:
|
private:
|
||||||
static CGangInfo* GetGangInfo(int16 gang) { return &Gang[gang]; }
|
static CGangInfo* GetGangInfo(int16 gang) { return &Gang[gang]; }
|
||||||
|
|
||||||
static CGangInfo(&Gang)[TOTAL_GANGS];
|
static CGangInfo(&Gang)[NUM_GANGS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tGangSaveData
|
|
||||||
{
|
|
||||||
char tag[4];
|
|
||||||
int32 size;
|
|
||||||
CGangInfo gangs[CGangs::TOTAL_GANGS];
|
|
||||||
};
|
|
||||||
|
|
||||||
static_assert(sizeof(tGangSaveData) == 0x98, "tGangSaveData: error");
|
|
||||||
|
|
Loading…
Reference in a new issue