1
0
mirror of https://github.com/XLabsProject/iw3x-port.git synced 2023-08-02 15:02:11 +02:00

Some gameflags & static models flag fix!

This commit is contained in:
louve 2022-12-22 11:01:48 +01:00
parent bcba338ea8
commit 1d431eedff
3 changed files with 45 additions and 35 deletions

View File

@ -979,7 +979,14 @@ namespace Components
{
// Confirmed to be the same in the rendering functions
// Check R_AddAllStaticModelSurfacesSpotShadow in both iw3 and iw4
map.dpvs.smodelDrawInsts[i].flags |= Game::IW4::STATIC_MODEL_FLAG_NO_CAST_SHADOW;
// aaaaand NO it's not !
// For some reason while being used in the same place for the same thing AFAIK,
// setting this to the "correct value" in iw4 results in blocky smodel shadows!
// Unless we keep the iw3 flag in (which should be non existent in iw4!)
map.dpvs.smodelDrawInsts[i].flags |= Game::IW3::STATIC_MODEL_FLAG_NO_SHADOW;
}
if (world->dpvs.smodelInsts)
@ -993,22 +1000,6 @@ namespace Components
map.dpvs.smodelDrawInsts[i].flags |= Game::IW4::STATIC_MODEL_FLAG_GROUND_LIGHTING;
}
}
auto xmodel = map.dpvs.smodelDrawInsts[i].model;
if (xmodel)
{
for (size_t surfaceIndex = 0; surfaceIndex < xmodel->numsurfs; surfaceIndex++)
{
auto material = xmodel->materialHandles[surfaceIndex];
// Do not delay model surface ever! In iw4 this doesn't even exist
// If this flag is ever set to 0 it usually burns the delayed surface buffer of IW4
//material->info.gameFlags.fields.unkNeededForSModelDisplay = 1;
//material->info.gameFlags.fields.doNotDelaySurface = 1; // Still blocky shadows even when i have just this one enabled
//material->info.gameFlags.fields.isFoliageRequiresGroundLighting = (map.dpvs.smodelDrawInsts[i].flags & Game::IW4::STATIC_MODEL_FLAG_GROUND_LIGHTING) != 0;
}
}
}
}

View File

@ -364,6 +364,8 @@ namespace Components
mat.name = material->info.name;
mat.gameFlags.packed = material->info.gameFlags.packed;
mat.gameFlags.fields.unk7 = material->info.gameFlags.fields.unkNeededForSModelDisplay;
mat.gameFlags.fields.unkCastShadowMaybe = material->info.gameFlags.fields.MTL_GAMEFLAG_CASTS_SHADOW;
// Sort key
#if USE_IW3_SORTKEYS

View File

@ -129,25 +129,6 @@ namespace Game
SAT_COUNT = 0x3,
};
struct MaterialGameFlagsFields
{
unsigned char unk1 : 1; // 0x1
unsigned char addShadowToPrimaryLight : 1; // 0x2
unsigned char isFoliageRequiresGroundLighting : 1; // 0x4
unsigned char unk4 : 1; // 0x8
unsigned char unk5 : 1; // 0x10
unsigned char unk6 : 1; // 0x20
unsigned char MTL_GAMEFLAG_CASTS_SHADOW : 1; // 0x40
unsigned char unkNeededForSModelDisplay : 1; // 0x80
};
union MaterialGameFlags
{
MaterialGameFlagsFields fields;
unsigned char packed;
};
struct cmd_function_s
{
cmd_function_s *next;
@ -853,6 +834,24 @@ namespace Game
MaterialTechnique *techniques[34];
};
struct MaterialGameFlagsFields
{
unsigned char unk1 : 1; // 0x1
unsigned char addShadowToPrimaryLight : 1; // 0x2
unsigned char isFoliageRequiresGroundLighting : 1; // 0x4
unsigned char unk4 : 1; // 0x8
unsigned char unk5 : 1; // 0x10
unsigned char unk6 : 1; // 0x20
unsigned char MTL_GAMEFLAG_CASTS_SHADOW : 1; // 0x40
unsigned char unkNeededForSModelDisplay : 1; // 0x80
};
union MaterialGameFlags
{
MaterialGameFlagsFields fields;
unsigned char packed;
};
#pragma pack(push, 4)
struct MaterialInfo
{
@ -3468,6 +3467,24 @@ namespace Game
MTL_STATE_SET_COUNT = 0xB,
};
struct MaterialGameFlagsFields
{
unsigned char unk1 : 1; // 0x1
unsigned char addShadowToPrimaryLight : 1; // 0x2
unsigned char isFoliageRequiresGroundLighting : 1; // 0x4
unsigned char unk4 : 1; // 0x8
unsigned char unk5 : 1; // 0x10
unsigned char unk6 : 1; // 0x20
unsigned char unk7 : 1; // 0x40
unsigned char unkCastShadowMaybe : 1; // 0x80
};
union MaterialGameFlags
{
MaterialGameFlagsFields fields;
unsigned char packed;
};
#pragma pack(push, 4)
struct Material
{