diff options
author | aap <aap@papnet.eu> | 2019-06-20 01:07:57 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-06-20 01:07:57 +0200 |
commit | f4146d39a266b83cef8e81bc62bcc77032c3b13c (patch) | |
tree | 50526c6443c448dbf0a2effa24b4dd040a3ac5e1 /src/modelinfo/VehicleModelInfo.cpp | |
parent | typo in visibility plugins (diff) | |
parent | implemented cHandlingDataMgr (diff) | |
download | re3-f4146d39a266b83cef8e81bc62bcc77032c3b13c.tar re3-f4146d39a266b83cef8e81bc62bcc77032c3b13c.tar.gz re3-f4146d39a266b83cef8e81bc62bcc77032c3b13c.tar.bz2 re3-f4146d39a266b83cef8e81bc62bcc77032c3b13c.tar.lz re3-f4146d39a266b83cef8e81bc62bcc77032c3b13c.tar.xz re3-f4146d39a266b83cef8e81bc62bcc77032c3b13c.tar.zst re3-f4146d39a266b83cef8e81bc62bcc77032c3b13c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/modelinfo/VehicleModelInfo.cpp | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index 5e3a77fe..36a6f301 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -6,6 +6,7 @@ #include "NodeName.h" #include "TxdStore.h" #include "Weather.h" +#include "HandlingMgr.h" #include "VisibilityPlugins.h" #include "FileMgr.h" #include "World.h" @@ -22,9 +23,6 @@ RwTexture **CVehicleModelInfo::ms_colourTextureTable = (RwTexture**)0x711C40; RwTexture *&gpWhiteTexture = *(RwTexture**)0x64C4F8; RwFrame *&pMatFxIdentityFrame = *(RwFrame**)0x64C510; -// TODO This depends on handling -WRAPPER void CVehicleModelInfo::SetVehicleComponentFlags(RwFrame *frame, uint32 flags) { EAXJMP(0x5203C0); } - enum { CAR_WHEEL_RF = 1, CAR_WHEEL_RM = 2, @@ -435,11 +433,13 @@ CVehicleModelInfo::SetAtomicRenderCallbacks(void) } } -RpAtomic* -CVehicleModelInfo::SetAtomicFlagCB(RpAtomic *atomic, void *data) +RwObject* +CVehicleModelInfo::SetAtomicFlagCB(RwObject *object, void *data) { + RpAtomic *atomic = (RpAtomic*)object; + assert(RwObjectGetType(object) == rpATOMIC); CVisibilityPlugins::SetAtomicFlag(atomic, (int)data); - return atomic; + return object; } 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_COMPS(comprule) ((comprule) & 0xFFF) @@ -1110,6 +1145,7 @@ STARTPATCHES InjectHook(0x520360, &CVehicleModelInfo::ClearAtomicFlagCB, PATCH_JUMP); InjectHook(0x5204D0, &CVehicleModelInfo::PreprocessHierarchy, PATCH_JUMP); + InjectHook(0x5203C0, &CVehicleModelInfo::SetVehicleComponentFlags, PATCH_JUMP); InjectHook(0x520840, &CVehicleModelInfo::GetWheelPosn, PATCH_JUMP); |