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

modelinfo and visibility plg fixes

This commit is contained in:
aap 2021-01-24 23:25:12 +01:00
parent 513d418771
commit 453a16c978
5 changed files with 42 additions and 15 deletions

View file

@ -57,7 +57,7 @@ void
CBaseModelInfo::SetTexDictionary(const char *name) CBaseModelInfo::SetTexDictionary(const char *name)
{ {
int slot = CTxdStore::FindTxdSlot(name); int slot = CTxdStore::FindTxdSlot(name);
if(slot < 0) if(slot == -1)
slot = CTxdStore::AddTxdSlot(name); slot = CTxdStore::AddTxdSlot(name);
m_txdSlot = slot; m_txdSlot = slot;
} }

View file

@ -2,12 +2,11 @@
#include "General.h" #include "General.h"
#include "Camera.h" #include "Camera.h"
#include "Renderer.h"
#include "ModelInfo.h" #include "ModelInfo.h"
#include "AnimManager.h" #include "AnimManager.h"
#include "custompipes.h" #include "custompipes.h"
#define LOD_DISTANCE (300.0f)
void void
CSimpleModelInfo::DeleteRwObject(void) CSimpleModelInfo::DeleteRwObject(void)
{ {

View file

@ -339,7 +339,7 @@ CVehicleModelInfo::SetAtomicRendererCB(RpAtomic *atomic, void *data)
}else if(strstr(name, "_lo")){ }else if(strstr(name, "_lo")){
RpClumpRemoveAtomic(clump, atomic); RpClumpRemoveAtomic(clump, atomic);
RpAtomicDestroy(atomic); RpAtomicDestroy(atomic);
return atomic; // BUG: not done by gta return atomic; // BUG: nil in gta
}else if(strstr(name, "_vlo")) }else if(strstr(name, "_vlo"))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleReallyLowDetailCB); CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleReallyLowDetailCB);
else else
@ -402,21 +402,31 @@ CVehicleModelInfo::SetAtomicRendererCB_Boat(RpAtomic *atomic, void *data)
{ {
RpClump *clump; RpClump *clump;
char *name; char *name;
bool alpha;
clump = (RpClump*)data; clump = (RpClump*)data;
name = GetFrameNodeName(RpAtomicGetFrame(atomic)); name = GetFrameNodeName(RpAtomicGetFrame(atomic));
alpha = false;
RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), HasAlphaMaterialCB, &alpha);
if(strcmp(name, "boat_hi") == 0 || !CGeneral::faststrncmp(name, "extra", 5)) if(strcmp(name, "boat_hi") == 0 || !CGeneral::faststrncmp(name, "extra", 5))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB_Boat); CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB_Boat);
else if(strstr(name, "_hi")) else if(strstr(name, "_hi")){
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB); if(alpha)
else if(strstr(name, "_lo")){ CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_Boat);
else
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB);
}else if(strstr(name, "_lo")){
RpClumpRemoveAtomic(clump, atomic); RpClumpRemoveAtomic(clump, atomic);
RpAtomicDestroy(atomic); RpAtomicDestroy(atomic);
return atomic; // BUG: not done by gta return atomic; // BUG: not done by gta
}else if(strstr(name, "_vlo")) }else if(strstr(name, "_vlo"))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleReallyLowDetailCB_BigVehicle); CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleLoDetailCB_Boat);
else else{
CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil); if(alpha)
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_Boat);
else
CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil);
}
HideDamagedAtomicCB(atomic, nil); HideDamagedAtomicCB(atomic, nil);
return atomic; return atomic;
} }
@ -459,7 +469,7 @@ CVehicleModelInfo::SetAtomicRendererCB_RealHeli(RpAtomic *atomic, void *data)
}else if(strstr(name, "_lo")){ }else if(strstr(name, "_lo")){
RpClumpRemoveAtomic(clump, atomic); RpClumpRemoveAtomic(clump, atomic);
RpAtomicDestroy(atomic); RpAtomicDestroy(atomic);
return atomic; // BUG: not done by gta return atomic; // BUG: nil in gta
}else if(strstr(name, "_vlo")) }else if(strstr(name, "_vlo"))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleReallyLowDetailCB); CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleReallyLowDetailCB);
else else
@ -629,9 +639,9 @@ CVehicleModelInfo::SetVehicleComponentFlags(RwFrame *frame, uint32 flags)
SETFLAGS(ATOMIC_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)) else if(flags & VEHICLE_FLAG_REAR && (handling->Flags & HANDLING_IS_VAN || (flags & (VEHICLE_FLAG_LEFT|VEHICLE_FLAG_RIGHT)) == 0))
SETFLAGS(ATOMIC_FLAG_REAR); SETFLAGS(ATOMIC_FLAG_REAR);
if(flags & VEHICLE_FLAG_LEFT) else if(flags & VEHICLE_FLAG_LEFT)
SETFLAGS(ATOMIC_FLAG_LEFT); SETFLAGS(ATOMIC_FLAG_LEFT);
if(flags & VEHICLE_FLAG_RIGHT) else if(flags & VEHICLE_FLAG_RIGHT)
SETFLAGS(ATOMIC_FLAG_RIGHT); SETFLAGS(ATOMIC_FLAG_RIGHT);
if(flags & VEHICLE_FLAG_REARDOOR) if(flags & VEHICLE_FLAG_REARDOOR)
@ -796,7 +806,7 @@ struct editableMatCBData
RpMaterial* RpMaterial*
CVehicleModelInfo::GetEditableMaterialListCB(RpMaterial *material, void *data) CVehicleModelInfo::GetEditableMaterialListCB(RpMaterial *material, void *data)
{ {
static RwRGBA white = { 255, 255, 255, 255 }; RwRGBA white = { 255, 255, 255, 255 };
const RwRGBA *col; const RwRGBA *col;
editableMatCBData *cbdata; editableMatCBData *cbdata;

View file

@ -454,7 +454,7 @@ CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_BigVehicle(RpAtomic *atomic)
RpAtomic* RpAtomic*
CVisibilityPlugins::RenderVehicleHiDetailCB_Boat(RpAtomic *atomic) CVisibilityPlugins::RenderVehicleHiDetailCB_Boat(RpAtomic *atomic)
{ {
if(DistToCameraSq < ms_bigVehicleLod1Dist) if(DistToCameraSq < ms_vehicleLod0Dist)
RENDERCALLBACK(atomic); RENDERCALLBACK(atomic);
return atomic; return atomic;
} }
@ -472,6 +472,23 @@ CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_Boat(RpAtomic *atomic)
return atomic; return atomic;
} }
RpAtomic*
CVisibilityPlugins::RenderVehicleLoDetailCB_Boat(RpAtomic *atomic)
{
RpClump *clump;
int32 alpha;
clump = RpAtomicGetClump(atomic);
if(DistToCameraSq >= ms_vehicleLod0Dist){
alpha = GetClumpAlpha(clump);
if(alpha == 255)
RENDERCALLBACK(atomic);
else
RenderAlphaAtomic(atomic, alpha);
}
return atomic;
}
RpAtomic* RpAtomic*
CVisibilityPlugins::RenderVehicleLowDetailCB_BigVehicle(RpAtomic *atomic) CVisibilityPlugins::RenderVehicleLowDetailCB_BigVehicle(RpAtomic *atomic)
{ {

View file

@ -61,6 +61,7 @@ public:
static RpAtomic *RenderVehicleHiDetailAlphaCB_BigVehicle(RpAtomic *atomic); static RpAtomic *RenderVehicleHiDetailAlphaCB_BigVehicle(RpAtomic *atomic);
static RpAtomic *RenderVehicleHiDetailCB_Boat(RpAtomic *atomic); static RpAtomic *RenderVehicleHiDetailCB_Boat(RpAtomic *atomic);
static RpAtomic *RenderVehicleHiDetailAlphaCB_Boat(RpAtomic *atomic); static RpAtomic *RenderVehicleHiDetailAlphaCB_Boat(RpAtomic *atomic);
static RpAtomic *RenderVehicleLoDetailCB_Boat(RpAtomic *atomic);
static RpAtomic *RenderVehicleLowDetailCB_BigVehicle(RpAtomic *atomic); static RpAtomic *RenderVehicleLowDetailCB_BigVehicle(RpAtomic *atomic);
static RpAtomic *RenderVehicleLowDetailAlphaCB_BigVehicle(RpAtomic *atomic); static RpAtomic *RenderVehicleLowDetailAlphaCB_BigVehicle(RpAtomic *atomic);
static RpAtomic *RenderVehicleReallyLowDetailCB(RpAtomic *atomic); static RpAtomic *RenderVehicleReallyLowDetailCB(RpAtomic *atomic);