1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 10:40:00 +00:00

finally finished CVehicleModelInfo

This commit is contained in:
aap 2019-06-20 01:07:57 +02:00
commit f4146d39a2
5 changed files with 46 additions and 9 deletions

View file

@ -7,7 +7,7 @@
#include "TempColModels.h" #include "TempColModels.h"
#include "VisibilityPlugins.h" #include "VisibilityPlugins.h"
#include "FileMgr.h" #include "FileMgr.h"
#include "HandlingDataMgr.h" #include "HandlingMgr.h"
#include "CarCtrl.h" #include "CarCtrl.h"
#include "PedType.h" #include "PedType.h"
#include "PedStats.h" #include "PedStats.h"

View file

@ -2,7 +2,7 @@
#include "patcher.h" #include "patcher.h"
#include "main.h" #include "main.h"
#include "FileMgr.h" #include "FileMgr.h"
#include "HandlingDatamgr.h" #include "HandlingMgr.h"
cHandlingDataMgr &mod_HandlingManager = *(cHandlingDataMgr*)0x728060; cHandlingDataMgr &mod_HandlingManager = *(cHandlingDataMgr*)0x728060;

View file

@ -133,6 +133,7 @@ public:
int FindExactWord(const char *word, const char *words, int wordLen, int numWords); int FindExactWord(const char *word, const char *words, int wordLen, int numWords);
void ConvertDataToGameUnits(tHandlingData *handling); void ConvertDataToGameUnits(tHandlingData *handling);
int32 GetHandlingId(const char *name); int32 GetHandlingId(const char *name);
tHandlingData *GetHandlingData(eHandlingId id) { return &HandlingData[id]; }
}; };
VALIDATE_SIZE(cHandlingDataMgr, 0x3030); VALIDATE_SIZE(cHandlingDataMgr, 0x3030);
extern cHandlingDataMgr &mod_HandlingManager; extern cHandlingDataMgr &mod_HandlingManager;

View file

@ -6,6 +6,7 @@
#include "NodeName.h" #include "NodeName.h"
#include "TxdStore.h" #include "TxdStore.h"
#include "Weather.h" #include "Weather.h"
#include "HandlingMgr.h"
#include "VisibilityPlugins.h" #include "VisibilityPlugins.h"
#include "FileMgr.h" #include "FileMgr.h"
#include "World.h" #include "World.h"
@ -22,9 +23,6 @@ RwTexture **CVehicleModelInfo::ms_colourTextureTable = (RwTexture**)0x711C40;
RwTexture *&gpWhiteTexture = *(RwTexture**)0x64C4F8; RwTexture *&gpWhiteTexture = *(RwTexture**)0x64C4F8;
RwFrame *&pMatFxIdentityFrame = *(RwFrame**)0x64C510; RwFrame *&pMatFxIdentityFrame = *(RwFrame**)0x64C510;
// TODO This depends on handling
WRAPPER void CVehicleModelInfo::SetVehicleComponentFlags(RwFrame *frame, uint32 flags) { EAXJMP(0x5203C0); }
enum { enum {
CAR_WHEEL_RF = 1, CAR_WHEEL_RF = 1,
CAR_WHEEL_RM = 2, CAR_WHEEL_RM = 2,
@ -435,11 +433,13 @@ CVehicleModelInfo::SetAtomicRenderCallbacks(void)
} }
} }
RpAtomic* RwObject*
CVehicleModelInfo::SetAtomicFlagCB(RpAtomic *atomic, void *data) CVehicleModelInfo::SetAtomicFlagCB(RwObject *object, void *data)
{ {
RpAtomic *atomic = (RpAtomic*)object;
assert(RwObjectGetType(object) == rpATOMIC);
CVisibilityPlugins::SetAtomicFlag(atomic, (int)data); CVisibilityPlugins::SetAtomicFlag(atomic, (int)data);
return atomic; return object;
} }
RpAtomic* RpAtomic*
@ -550,6 +550,41 @@ CVehicleModelInfo::PreprocessHierarchy(void)
} }
} }
void
CVehicleModelInfo::SetVehicleComponentFlags(RwFrame *frame, uint32 flags)
{
tHandlingData *handling;
handling = mod_HandlingManager.GetHandlingData((eHandlingId)m_handlingId);
#define SETFLAGS(f) RwFrameForAllObjects(frame, SetAtomicFlagCB, (void*)(f))
if(flags & VEHICLE_FLAG_WINDSCREEN){
if(this == CModelInfo::GetModelInfo(MI_RHINO))
return;
SETFLAGS(ATOMIC_FLAG_WINDSCREEN);
}
if(flags & VEHICLE_FLAG_ANGLECULL)
SETFLAGS(ATOMIC_FLAG_ANGLECULL);
if(flags & VEHICLE_FLAG_FRONT)
SETFLAGS(ATOMIC_FLAG_FRONT);
else if(flags & VEHICLE_FLAG_REAR && (handling->Flags & HANDLING_IS_VAN || (flags & (VEHICLE_FLAG_LEFT|VEHICLE_FLAG_RIGHT)) == 0))
SETFLAGS(ATOMIC_FLAG_REAR);
if(flags & VEHICLE_FLAG_LEFT)
SETFLAGS(ATOMIC_FLAG_LEFT);
if(flags & VEHICLE_FLAG_RIGHT)
SETFLAGS(ATOMIC_FLAG_RIGHT);
if(flags & VEHICLE_FLAG_REARDOOR)
SETFLAGS(ATOMIC_FLAG_REARDOOR);
else if(flags & VEHICLE_FLAG_FRONTDOOR)
SETFLAGS(ATOMIC_FLAG_FRONTDOOR);
if(flags & VEHICLE_FLAG_DRAWLAST)
SETFLAGS(ATOMIC_FLAG_DRAWLAST);
}
#define COMPRULE_RULE(comprule) (((comprule) >> 12) & 0xF) #define COMPRULE_RULE(comprule) (((comprule) >> 12) & 0xF)
#define COMPRULE_COMPS(comprule) ((comprule) & 0xFFF) #define COMPRULE_COMPS(comprule) ((comprule) & 0xFFF)
@ -1110,6 +1145,7 @@ STARTPATCHES
InjectHook(0x520360, &CVehicleModelInfo::ClearAtomicFlagCB, PATCH_JUMP); InjectHook(0x520360, &CVehicleModelInfo::ClearAtomicFlagCB, PATCH_JUMP);
InjectHook(0x5204D0, &CVehicleModelInfo::PreprocessHierarchy, PATCH_JUMP); InjectHook(0x5204D0, &CVehicleModelInfo::PreprocessHierarchy, PATCH_JUMP);
InjectHook(0x5203C0, &CVehicleModelInfo::SetVehicleComponentFlags, PATCH_JUMP);
InjectHook(0x520840, &CVehicleModelInfo::GetWheelPosn, PATCH_JUMP); InjectHook(0x520840, &CVehicleModelInfo::GetWheelPosn, PATCH_JUMP);

View file

@ -99,7 +99,7 @@ public:
static RpAtomic *SetAtomicRendererCB_Heli(RpAtomic *atomic, void *data); static RpAtomic *SetAtomicRendererCB_Heli(RpAtomic *atomic, void *data);
void SetAtomicRenderCallbacks(void); void SetAtomicRenderCallbacks(void);
static RpAtomic *SetAtomicFlagCB(RpAtomic *atomic, void *data); static RwObject *SetAtomicFlagCB(RwObject *object, void *data);
static RpAtomic *ClearAtomicFlagCB(RpAtomic *atomic, void *data); static RpAtomic *ClearAtomicFlagCB(RpAtomic *atomic, void *data);
void SetVehicleComponentFlags(RwFrame *frame, uint32 flags); void SetVehicleComponentFlags(RwFrame *frame, uint32 flags);
void PreprocessHierarchy(void); void PreprocessHierarchy(void);