Small thing (#799)
Co-authored-by: Louvenarde <louve@louve.systems> Co-authored-by: FutureRave <edoardo.sanguineti222@gmail.com>
This commit is contained in:
parent
be5bdcb9d7
commit
3843547676
2
deps/iw4-open-formats
vendored
2
deps/iw4-open-formats
vendored
@ -1 +1 @@
|
|||||||
Subproject commit e4bac07fd3925bcf82e9ea3c45f51137fde20b8e
|
Subproject commit 62936d258669d6e5226325dc17a6b825d2f1c539
|
@ -168,6 +168,11 @@ namespace Assets
|
|||||||
Utils::Stream::ClearPointer(&nodes[i].plane);
|
Utils::Stream::ClearPointer(&nodes[i].plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AssertUnreachable;
|
||||||
|
Components::Logger::Error(Game::ERR_FATAL, "node {} of clipmap {} has no plane!", i, asset->name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Stream::ClearPointer(&dest->nodes);
|
Utils::Stream::ClearPointer(&dest->nodes);
|
||||||
@ -217,9 +222,6 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
if (node[i].data.leaf.brushes)
|
if (node[i].data.leaf.brushes)
|
||||||
{
|
{
|
||||||
assert(node[i].data.leaf.brushes >= asset->leafbrushes);
|
|
||||||
assert(node[i].data.leaf.brushes < asset->leafbrushes + sizeof(unsigned short) * asset->numLeafBrushes);
|
|
||||||
|
|
||||||
if (builder->hasPointer(node[i].data.leaf.brushes))
|
if (builder->hasPointer(node[i].data.leaf.brushes))
|
||||||
{
|
{
|
||||||
node[i].data.leaf.brushes = builder->getPointer(node[i].data.leaf.brushes);
|
node[i].data.leaf.brushes = builder->getPointer(node[i].data.leaf.brushes);
|
||||||
|
@ -16,6 +16,7 @@ namespace Components
|
|||||||
Dvar::Var Renderer::r_drawAABBTrees;
|
Dvar::Var Renderer::r_drawAABBTrees;
|
||||||
Dvar::Var Renderer::r_playerDrawDebugDistance;
|
Dvar::Var Renderer::r_playerDrawDebugDistance;
|
||||||
Dvar::Var Renderer::r_forceTechnique;
|
Dvar::Var Renderer::r_forceTechnique;
|
||||||
|
Dvar::Var Renderer::r_listSamplers;
|
||||||
|
|
||||||
float cyan[4] = { 0.0f, 0.5f, 0.5f, 1.0f };
|
float cyan[4] = { 0.0f, 0.5f, 0.5f, 1.0f };
|
||||||
float red[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
|
float red[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
|
||||||
@ -178,32 +179,6 @@ namespace Components
|
|||||||
return Utils::Hook::Call<int(int, float, float, const char*, Game::vec4_t*, int)>(0x005033E0)(a1, a2, a3, Utils::String::VA("%s (^3%s^7)", mat->info.name, mat->techniqueSet->name), color, a6);
|
return Utils::Hook::Call<int(int, float, float, const char*, Game::vec4_t*, int)>(0x005033E0)(a1, a2, a3, Utils::String::VA("%s (^3%s^7)", mat->info.name, mat->techniqueSet->name), color, a6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListSamplers()
|
|
||||||
{
|
|
||||||
static auto* source = reinterpret_cast<Game::GfxCmdBufSourceState*>(0x6CAF080);
|
|
||||||
|
|
||||||
Game::Font_s* font = Game::R_RegisterFont("fonts/smallFont", 0);
|
|
||||||
auto height = Game::R_TextHeight(font);
|
|
||||||
auto scale = 1.0f;
|
|
||||||
float color[4] = {0.0f, 1.0f, 0.0f, 1.0f};
|
|
||||||
|
|
||||||
for (std::size_t i = 0; i < 27; ++i)
|
|
||||||
{
|
|
||||||
if (source->input.codeImages[i] == nullptr)
|
|
||||||
{
|
|
||||||
color[0] = 1.f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
color[0] = 0.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::stringstream str;
|
|
||||||
str << std::format("{}/{:#X} => ", i, i) << (source->input.codeImages[i] == nullptr ? "---" : source->input.codeImages[i]->name) << " " << std::to_string(source->input.codeImageSamplerStates[i]);
|
|
||||||
Game::R_AddCmdDrawText(str.str().data(), std::numeric_limits<int>::max(), font, 15.0f, (height * scale + 1) * (i + 1) + 14.0f, scale, scale, 0.0f, color, Game::ITEM_TEXTSTYLE_NORMAL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Renderer::DebugDrawTriggers()
|
void Renderer::DebugDrawTriggers()
|
||||||
{
|
{
|
||||||
if (!r_drawTriggers.get<bool>()) return;
|
if (!r_drawTriggers.get<bool>()) return;
|
||||||
@ -529,6 +504,40 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::ListSamplers()
|
||||||
|
{
|
||||||
|
if (!r_listSamplers.get<bool>())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static auto* source = reinterpret_cast<Game::GfxCmdBufSourceState*>(0x6CAF080);
|
||||||
|
|
||||||
|
auto* font = Game::R_RegisterFont("fonts/smallFont", 0);
|
||||||
|
auto height = Game::R_TextHeight(font);
|
||||||
|
auto scale = 1.0f;
|
||||||
|
float color[] = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < 27; ++i)
|
||||||
|
{
|
||||||
|
if (source->input.codeImages[i] == nullptr)
|
||||||
|
{
|
||||||
|
color[0] = 1.f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
color[0] = 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto* str = Utils::String::Format("{}/{:#X} => {} {}", i, i,
|
||||||
|
(source->input.codeImages[i] == nullptr ? "---" : source->input.codeImages[i]->name),
|
||||||
|
std::to_string(source->input.codeImageSamplerStates[i])
|
||||||
|
);
|
||||||
|
|
||||||
|
Game::R_AddCmdDrawText(str, std::numeric_limits<int>::max(), font, 15.0f, (height * scale + 1) * (i + 1) + 14.0f, scale, scale, 0.0f, color, Game::ITEM_TEXTSTYLE_NORMAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int Renderer::FixSunShadowPartitionSize(Game::GfxCamera* camera, Game::GfxSunShadowMapMetrics* mapMetrics, Game::GfxSunShadow* sunShadow, Game::GfxSunShadowClip* clip, float* partitionFraction)
|
int Renderer::FixSunShadowPartitionSize(Game::GfxCamera* camera, Game::GfxSunShadowMapMetrics* mapMetrics, Game::GfxSunShadow* sunShadow, Game::GfxSunShadowClip* clip, float* partitionFraction)
|
||||||
{
|
{
|
||||||
auto result = Utils::Hook::Call<int(Game::GfxCamera*, Game::GfxSunShadowMapMetrics*, Game::GfxSunShadow*, Game::GfxSunShadowClip*, float*)>(0x5463B0)(camera, mapMetrics, sunShadow, clip, partitionFraction);
|
auto result = Utils::Hook::Call<int(Game::GfxCamera*, Game::GfxSunShadowMapMetrics*, Game::GfxSunShadow*, Game::GfxSunShadowClip*, float*)>(0x5463B0)(camera, mapMetrics, sunShadow, clip, partitionFraction);
|
||||||
@ -557,9 +566,15 @@ namespace Components
|
|||||||
DebugDrawSceneModelCollisions();
|
DebugDrawSceneModelCollisions();
|
||||||
DebugDrawTriggers();
|
DebugDrawTriggers();
|
||||||
ForceTechnique();
|
ForceTechnique();
|
||||||
|
ListSamplers();
|
||||||
}
|
}
|
||||||
}, Scheduler::Pipeline::RENDERER);
|
}, Scheduler::Pipeline::RENDERER);
|
||||||
|
|
||||||
|
#if _DEBUG
|
||||||
|
// Disable ATI Radeon 4000 optimization that crashes Pixwin
|
||||||
|
Utils::Hook::Set(0x5066F8, D3DFMT_UNKNOWN);
|
||||||
|
#endif
|
||||||
|
|
||||||
// COD4 Map Fixes
|
// COD4 Map Fixes
|
||||||
// The day map porting is perfect we should be able to remove these
|
// The day map porting is perfect we should be able to remove these
|
||||||
Utils::Hook(0x546A09, FixSunShadowPartitionSize, HOOK_CALL).install()->quick();
|
Utils::Hook(0x546A09, FixSunShadowPartitionSize, HOOK_CALL).install()->quick();
|
||||||
@ -613,6 +628,7 @@ namespace Components
|
|||||||
Renderer::r_drawAABBTrees = Game::Dvar_RegisterBool("r_drawAabbTrees", false, Game::DVAR_CHEAT, "Draw aabb trees");
|
Renderer::r_drawAABBTrees = Game::Dvar_RegisterBool("r_drawAabbTrees", false, Game::DVAR_CHEAT, "Draw aabb trees");
|
||||||
Renderer::r_playerDrawDebugDistance = Game::Dvar_RegisterInt("r_drawDebugDistance", 1000, 0, 50000, Game::DVAR_ARCHIVE, "r_draw debug functions draw distance relative to the player");
|
Renderer::r_playerDrawDebugDistance = Game::Dvar_RegisterInt("r_drawDebugDistance", 1000, 0, 50000, Game::DVAR_ARCHIVE, "r_draw debug functions draw distance relative to the player");
|
||||||
Renderer::r_forceTechnique = Game::Dvar_RegisterInt("r_forceTechnique", 0, 0, 14, Game::DVAR_NONE, "Force a base technique on the renderer");
|
Renderer::r_forceTechnique = Game::Dvar_RegisterInt("r_forceTechnique", 0, 0, 14, Game::DVAR_NONE, "Force a base technique on the renderer");
|
||||||
|
Renderer::r_listSamplers = Game::Dvar_RegisterBool("r_listSamplers", false, Game::DVAR_NONE, "List samplers & sampler states");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ namespace Components
|
|||||||
static void DebugDrawRunners();
|
static void DebugDrawRunners();
|
||||||
static void DebugDrawAABBTrees();
|
static void DebugDrawAABBTrees();
|
||||||
static void ForceTechnique();
|
static void ForceTechnique();
|
||||||
|
static void ListSamplers();
|
||||||
|
|
||||||
static int FixSunShadowPartitionSize(Game::GfxCamera* camera, Game::GfxSunShadowMapMetrics* mapMetrics, Game::GfxSunShadow* sunShadow, Game::GfxSunShadowClip* clip, float* partitionFraction);
|
static int FixSunShadowPartitionSize(Game::GfxCamera* camera, Game::GfxSunShadowMapMetrics* mapMetrics, Game::GfxSunShadow* sunShadow, Game::GfxSunShadowClip* clip, float* partitionFraction);
|
||||||
|
|
||||||
@ -58,5 +59,6 @@ namespace Components
|
|||||||
static Dvar::Var r_drawAABBTrees;
|
static Dvar::Var r_drawAABBTrees;
|
||||||
static Dvar::Var r_playerDrawDebugDistance;
|
static Dvar::Var r_playerDrawDebugDistance;
|
||||||
static Dvar::Var r_forceTechnique;
|
static Dvar::Var r_forceTechnique;
|
||||||
|
static Dvar::Var r_listSamplers;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,6 @@ namespace Components
|
|||||||
Logger::Error(Game::ERR_FATAL, "Missing required asset '{}' ({}). Export failed!", name, Game::DB_GetXAssetTypeName(type));
|
Logger::Error(Game::ERR_FATAL, "Missing required asset '{}' ({}). Export failed!", name, Game::DB_GetXAssetTypeName(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::Debug("Saving require ({}): {}", Game::DB_GetXAssetTypeName(type), Game::DB_GetXAssetNameHandlers[type](&header));
|
|
||||||
|
|
||||||
// we alias the next 4 (aligned) bytes of the stream b/c DB_InsertPointer gives us a nice pointer to use as the alias
|
// we alias the next 4 (aligned) bytes of the stream b/c DB_InsertPointer gives us a nice pointer to use as the alias
|
||||||
// otherwise it would be a fuckfest trying to figure out where the alias is in the stream
|
// otherwise it would be a fuckfest trying to figure out where the alias is in the stream
|
||||||
@ -508,7 +507,6 @@ namespace Components
|
|||||||
this->buffer.pushBlock(Game::XFILE_BLOCK_TEMP);
|
this->buffer.pushBlock(Game::XFILE_BLOCK_TEMP);
|
||||||
this->buffer.align(Utils::Stream::ALIGN_4);
|
this->buffer.align(Utils::Stream::ALIGN_4);
|
||||||
|
|
||||||
Logger::Debug("Saving ({}): {}", Game::DB_GetXAssetTypeName(asset.type), Game::DB_GetXAssetNameHandlers[asset.type](&asset.header));
|
|
||||||
|
|
||||||
this->store(asset.header);
|
this->store(asset.header);
|
||||||
AssetHandler::ZoneSave(asset, this);
|
AssetHandler::ZoneSave(asset, this);
|
||||||
|
Loading…
Reference in New Issue
Block a user