Skip to content

Commit

Permalink
add full mp support (all fixed-function rendering)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxor4d committed Feb 24, 2024
1 parent 22313d2 commit 7d7fef9
Show file tree
Hide file tree
Showing 16 changed files with 2,613 additions and 179 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,29 @@
This client modification is made to make the game compatible with nvidia's [rtx-remix](https://github.com/NVIDIAGameWorks/rtx-remix).
How? By manually reimplementing fixed function rendering :)


It does __not__ come with a 'rtx mod' -> meaning no custom models nor materials.

A demo mod can be found over at modDB: https://www.moddb.com/mods/cod5-nacht-der-untoten-demo
^ Footage: https://www.youtube.com/watch?v=hCv3p1qT3q0

<h3 align="center">fully sp / mp compatible</h3>
<br>

</div>


<div align="center" markdown="1">

![img](img/01.jpg)



If you want to buy me a coffee:

[![ko-fi](https://xoxor4d.github.io/assets/img/social/kofi.png)](https://ko-fi.com/xoxor4d)
</div>

<h3 align="center">sp / mp compatible (sp is mostly feature complete - mp has basic support)</h3>
<br>

# Usage

Expand Down
36 changes: 21 additions & 15 deletions assets/rtx.conf

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/components/loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ namespace components
mem_allocator_.clear();

_register(new command());
_register(new map_settings());

if (game::is_sp)
{
_register(new sp::main_module());
_register(new sp::fixed_function());
_register(new sp::map_settings());

}

if (game::is_mp)
{
_register(new mp::main_module());
_register(new mp::fixed_function());
}

#if DEBUG
Expand Down
3 changes: 2 additions & 1 deletion src/components/loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ namespace components

#include "modules/sp/main_module.hpp"
#include "modules/sp/fixed_function.hpp"
#include "modules/sp/map_settings.hpp"

#include "modules/mp/main_module.hpp"
#include "modules/mp/fixed_function.hpp"

#include "modules/map_settings.hpp"
#include "modules/flags.hpp"
#include "modules/command.hpp"
14 changes: 9 additions & 5 deletions src/components/modules/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ namespace components
return "";
}

return game::is_sp ? game::sp::cmd_args->argv[this->command_id][index]: nullptr; // TODO
return game::is_sp ? game::sp::cmd_args->argv[this->command_id][index]
: game::mp::cmd_args->argv[this->command_id][index];
}

size_t command::params::length()
{
return game::is_sp ? game::sp::cmd_args->argc[this->command_id] : 0; // TODO
return game::is_sp ? game::sp::cmd_args->argc[this->command_id]
: game::mp::cmd_args->argc[this->command_id];
}

void command::add(const char* name, std::function<command::callback> callback)
Expand All @@ -33,11 +35,13 @@ namespace components

if (sync)
{
game::is_sp ? game::sp::Cmd_ExecuteSingleCommand(0, 0, command.data()) : __debugbreak(); // TODO
game::is_sp ? game::sp::Cmd_ExecuteSingleCommand(0, 0, command.data())
: game::mp::Cmd_ExecuteSingleCommand(0, 0, command.data());
}
else
{
game::is_sp ? game::sp::Cbuf_AddText(command.data()) : __debugbreak(); // TODO
game::is_sp ? game::sp::Cbuf_AddText(command.data())
: game::mp::Cbuf_AddText(command.data());
}
}

Expand All @@ -51,7 +55,7 @@ namespace components

void command::main_callback()
{
command::params params(game::is_sp ? game::sp::cmd_args->nesting : NULL); // TODO
command::params params(game::is_sp ? game::sp::cmd_args->nesting : game::mp::cmd_args->nesting);
const std::string command = utils::str_to_lower(params[0]);

if (command::function_map.contains(command))
Expand Down
4 changes: 2 additions & 2 deletions src/components/modules/command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace components
{
public:
params(DWORD id) : command_id(id) {};
params(const params &obj) { this->command_id = obj.command_id; };
params() : params(game::is_sp ? game::sp::cmd_args->nesting : 0) {}; // TODO
params(const params &obj) { this->command_id = obj.command_id; }
params() : params(game::is_sp ? game::sp::cmd_args->nesting : game::mp::cmd_args->nesting) {}

const char* operator[](size_t index);
size_t length();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "std_include.hpp"
using namespace game::sp;

namespace components::sp
namespace components
{
map_settings* map_settings::p_this = nullptr;
map_settings* map_settings::get() { return p_this; }
Expand All @@ -15,9 +14,10 @@ namespace components::sp
return;
}

if (game::sp::rgp->world && game::sp::rgp->world->name)
if (const auto rgp = SELECT(game::mp::rgp, game::sp::rgp);
rgp && rgp->world && rgp->world->name)
{
std::string map_name = game::sp::rgp->world->name;
std::string map_name = rgp->world->name;
utils::replace_all(map_name, std::string("maps/mp/"), ""); // if mp map
utils::replace_all(map_name, std::string("maps/"), ""); // if sp map
utils::replace_all(map_name, std::string(".d3dbsp"), "");
Expand All @@ -30,7 +30,14 @@ namespace components::sp
m_max_distance = s.max_distance;
m_color = s.m_color;

main_module::skysphere_spawn(s.skybox);
if (game::is_sp)
{
sp::main_module::skysphere_spawn(s.skybox);
}
else
{
mp::main_module::skysphere_spawn(s.skybox);
}

found = true;
break;
Expand All @@ -42,9 +49,18 @@ namespace components::sp
m_max_distance = 5000.0f;
m_color.packed = D3DCOLOR_XRGB(200, 200, 220);

if (!flags::has_flag("no_default_sky") && !main_module::skysphere_is_model_valid())
const bool is_skysphere_model_valid = game::is_sp ? sp::main_module::skysphere_is_model_valid() : mp::main_module::skysphere_is_model_valid();
if (!flags::has_flag("no_default_sky") && !is_skysphere_model_valid)
{
main_module::skysphere_spawn(4); // always spawn sunset
// always spawn sunset
if (game::is_sp)
{
sp::main_module::skysphere_spawn(4);
}
else
{
mp::main_module::skysphere_spawn(4);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#pragma once

namespace components::sp
namespace components
{
class map_settings : public component
{
public:
map_settings();
~map_settings() = default;
const char* get_name() override { return "map_settings_sp"; }
const char* get_name() override { return "map_settings"; }

static map_settings* p_this;
static map_settings* get();
Expand Down
Loading

0 comments on commit 7d7fef9

Please sign in to comment.