mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-22 15:51:50 +01:00
finished some classes
This commit is contained in:
parent
b4afb591a7
commit
f407c9829f
@ -6,6 +6,7 @@
|
||||
#include "Timer.h"
|
||||
#include "Camera.h"
|
||||
#include "World.h"
|
||||
#include "FileMgr.h"
|
||||
#include "CullZones.h"
|
||||
|
||||
int32 &CCullZones::NumCullZones = *(int*)0x8F2564;
|
||||
@ -45,6 +46,27 @@ CCullZones::Init(void)
|
||||
aPointersToBigBuildingsForTreadables[i] = -1;
|
||||
}
|
||||
|
||||
void
|
||||
CCullZones::ResolveVisibilities(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
CFileMgr::SetDir("");
|
||||
fd = CFileMgr::OpenFile("DATA\\cullzone.dat", "rb");
|
||||
if(fd > 0){
|
||||
CFileMgr::Read(fd, (char*)&NumCullZones, 4);
|
||||
CFileMgr::Read(fd, (char*)aZones, NUMCULLZONES*sizeof(CCullZone));
|
||||
CFileMgr::Read(fd, (char*)&NumAttributeZones, 4);
|
||||
CFileMgr::Read(fd, (char*)aAttributeZones, NUMATTRIBZONES*sizeof(CAttributeZone));
|
||||
CFileMgr::Read(fd, (char*)aIndices, NUMZONEINDICES*2);
|
||||
CFileMgr::Read(fd, (char*)aPointersToBigBuildingsForBuildings, NUMBUILDINGS*2);
|
||||
CFileMgr::Read(fd, (char*)aPointersToBigBuildingsForTreadables, NUMTREADABLES*2);
|
||||
CFileMgr::CloseFile(fd);
|
||||
}else{
|
||||
// TODO: implement code from mobile to generate data here
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CCullZones::Update(void)
|
||||
{
|
||||
@ -311,6 +333,7 @@ CCullZone::DoStuffEnteringZone_OneTreadable(uint16 i)
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x524BC0, &CCullZones::Init, PATCH_JUMP);
|
||||
InjectHook(0x524EC0, &CCullZones::ResolveVisibilities, PATCH_JUMP);
|
||||
InjectHook(0x524F80, &CCullZones::Update, PATCH_JUMP);
|
||||
InjectHook(0x525370, &CCullZones::AddCullZone, PATCH_JUMP);
|
||||
InjectHook(0x5250D0, &CCullZones::ForceCullZoneCoors, PATCH_JUMP);
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
static bool &bCullZonesDisabled;
|
||||
|
||||
static void Init(void);
|
||||
static void ResolveVisibilities(void);
|
||||
static void Update(void);
|
||||
static void ForceCullZoneCoors(CVector coors);
|
||||
static int32 FindCullZoneForCoors(CVector coors);
|
||||
|
@ -6,6 +6,9 @@ RwObject *GetFirstObject(RwFrame *frame);
|
||||
RpAtomic *GetFirstAtomic(RpClump *clump);
|
||||
|
||||
RwTexDictionary *RwTexDictionaryGtaStreamRead(RwStream *stream);
|
||||
RwTexDictionary *RwTexDictionaryGtaStreamRead1(RwStream *stream);
|
||||
RwTexDictionary *RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict);
|
||||
|
||||
bool RpClumpGtaStreamRead1(RwStream *stream);
|
||||
RpClump *RpClumpGtaStreamRead2(RwStream *stream);
|
||||
void RpClumpGtaCancelStream(void);
|
||||
|
@ -22,6 +22,18 @@ CTxdStore::Shutdown(void)
|
||||
delete ms_pTxdPool;
|
||||
}
|
||||
|
||||
void
|
||||
CTxdStore::GameShutdown(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < TXDSTORESIZE; i++){
|
||||
TxdDef *def = GetSlot(i);
|
||||
if(def && GetNumRefs(i))
|
||||
RemoveTxdSlot(i);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
CTxdStore::AddTxdSlot(const char *name)
|
||||
{
|
||||
@ -89,6 +101,12 @@ CTxdStore::Create(int slot)
|
||||
GetSlot(slot)->texDict = RwTexDictionaryCreate();
|
||||
}
|
||||
|
||||
int
|
||||
CTxdStore::GetNumRefs(int slot)
|
||||
{
|
||||
return GetSlot(slot)->refCount;
|
||||
}
|
||||
|
||||
void
|
||||
CTxdStore::AddRef(int slot)
|
||||
{
|
||||
@ -137,6 +155,27 @@ CTxdStore::LoadTxd(int slot, const char *filename)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
CTxdStore::StartLoadTxd(int slot, RwStream *stream)
|
||||
{
|
||||
TxdDef *def = GetSlot(slot);
|
||||
if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){
|
||||
def->texDict = RwTexDictionaryGtaStreamRead1(stream);
|
||||
return def->texDict != nil;
|
||||
}else{
|
||||
printf("Failed to load TXD\n");
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CTxdStore::FinishLoadTxd(int slot, RwStream *stream)
|
||||
{
|
||||
TxdDef *def = GetSlot(slot);
|
||||
def->texDict = RwTexDictionaryGtaStreamRead2(stream, def->texDict);
|
||||
return def->texDict != nil;
|
||||
}
|
||||
|
||||
void
|
||||
CTxdStore::RemoveTxd(int slot)
|
||||
{
|
||||
@ -146,15 +185,10 @@ CTxdStore::RemoveTxd(int slot)
|
||||
def->texDict = nil;
|
||||
}
|
||||
|
||||
//bool
|
||||
//CTxdStore::isTxdLoaded(int slot)
|
||||
//{
|
||||
// return GetSlot(slot)->texDict != nil;
|
||||
//}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x527440, CTxdStore::Initialize, PATCH_JUMP);
|
||||
InjectHook(0x527470, CTxdStore::Shutdown, PATCH_JUMP);
|
||||
InjectHook(0x527490, CTxdStore::GameShutdown, PATCH_JUMP);
|
||||
InjectHook(0x5274E0, CTxdStore::AddTxdSlot, PATCH_JUMP);
|
||||
InjectHook(0x5275D0, CTxdStore::FindTxdSlot, PATCH_JUMP);
|
||||
InjectHook(0x527590, CTxdStore::GetTxdName, PATCH_JUMP);
|
||||
@ -162,8 +196,13 @@ STARTPATCHES
|
||||
InjectHook(0x527910, CTxdStore::PopCurrentTxd, PATCH_JUMP);
|
||||
InjectHook(0x5278C0, CTxdStore::SetCurrentTxd, PATCH_JUMP);
|
||||
InjectHook(0x527830, CTxdStore::Create, PATCH_JUMP);
|
||||
InjectHook(0x527A00, CTxdStore::GetNumRefs, PATCH_JUMP);
|
||||
InjectHook(0x527930, CTxdStore::AddRef, PATCH_JUMP);
|
||||
InjectHook(0x527970, CTxdStore::RemoveRef, PATCH_JUMP);
|
||||
InjectHook(0x5279C0, CTxdStore::RemoveRefWithoutDelete, PATCH_JUMP);
|
||||
InjectHook(0x527700, (bool (*)(int, RwStream*))CTxdStore::LoadTxd, PATCH_JUMP);
|
||||
InjectHook(0x5276B0, (bool (*)(int, const char*))CTxdStore::LoadTxd, PATCH_JUMP);
|
||||
InjectHook(0x527770, CTxdStore::StartLoadTxd, PATCH_JUMP);
|
||||
InjectHook(0x5277E0, CTxdStore::FinishLoadTxd, PATCH_JUMP);
|
||||
InjectHook(0x527870, CTxdStore::RemoveTxd, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -15,6 +15,7 @@ class CTxdStore
|
||||
public:
|
||||
static void Initialize(void);
|
||||
static void Shutdown(void);
|
||||
static void GameShutdown(void);
|
||||
static int AddTxdSlot(const char *name);
|
||||
static void RemoveTxdSlot(int slot);
|
||||
static int FindTxdSlot(const char *name);
|
||||
@ -23,11 +24,14 @@ public:
|
||||
static void PopCurrentTxd(void);
|
||||
static void SetCurrentTxd(int slot);
|
||||
static void Create(int slot);
|
||||
static int GetNumRefs(int slot);
|
||||
static void AddRef(int slot);
|
||||
static void RemoveRef(int slot);
|
||||
static void RemoveRefWithoutDelete(int slot);
|
||||
static bool LoadTxd(int slot, RwStream *stream);
|
||||
static bool LoadTxd(int slot, const char *filename);
|
||||
static bool StartLoadTxd(int slot, RwStream *stream);
|
||||
static bool FinishLoadTxd(int slot, RwStream *stream);
|
||||
static void RemoveTxd(int slot);
|
||||
|
||||
static TxdDef *GetSlot(int slot) { return ms_pTxdPool->GetSlot(slot); }
|
||||
|
@ -48,6 +48,13 @@ CVisibilityPlugins::Initialise(void)
|
||||
m_alphaEntityList.tail.item.sort = 100000000.0f;
|
||||
}
|
||||
|
||||
void
|
||||
CVisibilityPlugins::Shutdown(void)
|
||||
{
|
||||
m_alphaList.Shutdown();
|
||||
m_alphaEntityList.Shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
CVisibilityPlugins::InitAlphaEntityList(void)
|
||||
{
|
||||
@ -822,6 +829,7 @@ CVisibilityPlugins::GetClumpAlpha(RpClump *clump)
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x527E50, CVisibilityPlugins::Initialise, PATCH_JUMP);
|
||||
InjectHook(0x527EA0, CVisibilityPlugins::Shutdown, PATCH_JUMP);
|
||||
InjectHook(0x528F90, CVisibilityPlugins::InitAlphaEntityList, PATCH_JUMP);
|
||||
InjectHook(0x528FF0, CVisibilityPlugins::InsertEntityIntoSortedList, PATCH_JUMP);
|
||||
InjectHook(0x528F80, CVisibilityPlugins::InitAlphaAtomicList, PATCH_JUMP);
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
static float &ms_pedFadeDist;
|
||||
|
||||
static void Initialise(void);
|
||||
static void Shutdown(void);
|
||||
static void InitAlphaEntityList(void);
|
||||
static bool InsertEntityIntoSortedList(CEntity *e, float dist);
|
||||
static void InitAlphaAtomicList(void);
|
||||
|
Loading…
Reference in New Issue
Block a user