Skip to content

Commit

Permalink
Fuck Nixxes, Nvidia or whoever did this shitty port
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIndra55 committed Nov 2, 2024
1 parent 8cebf77 commit bbe217e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/modules/Draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "instance/Enemy.h"
#include "level/Markup.h"
#include "level/Trigger.h"
#include "game/Camera.h"

#include "cdc/math/Math.h"

Expand Down Expand Up @@ -95,16 +94,6 @@ void Draw::OnFrame()
Font::SetScale(0.6f, 0.6f);
#endif

// Set the correct transform in Legend for next generation graphics
#if TR7
if (Game::IsInNextGenMode())
{
auto camera = CAMERA_GetCamera();

TRANS_SetTransformMatrixf(&camera->wcTransform2f);
}
#endif

if (m_drawInstances || m_drawEnemyRouting)
{
DrawInstances();
Expand Down
13 changes: 13 additions & 0 deletions src/modules/Patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "patches/ErrorHandler.h"
#include "patches/Multicore.h"
#include "game/Camera.h"
#include "render/Draw.h"

// Instance of patches so we can get it in our hooks without calling GetModule<T> each call
static Patches* s_patches;
Expand Down Expand Up @@ -47,6 +48,16 @@ static void GAMELOOP_HandleScreenWipes()

s_GAMELOOP_HandleScreenWipes();
}

static void TransToDrawVertexV4f(DRAWVERTEX* v, cdc::Vector3* vec)
{
auto camera = CAMERA_GetCamera();
auto transform = Game::IsInNextGenMode() ? camera->wcTransform2f : camera->wcTransformf;

v->x = transform.col0.x * vec->x + transform.col1.x * vec->y + transform.col2.x * vec->z + transform.col3.x;
v->y = transform.col0.y * vec->x + transform.col1.y * vec->y + transform.col2.y * vec->z + transform.col3.y;
v->z = transform.col0.z * vec->x + transform.col1.z * vec->y + transform.col2.z * vec->z + transform.col3.z;
}
#endif

// No death fade code
Expand Down Expand Up @@ -118,6 +129,8 @@ Patches::Patches()
#ifdef TR7
// NOP the exception handler in Legend
Hooking::Nop((void*)0x401F53, 26);

MH_CreateHook((void*)0x402EF0, TransToDrawVertexV4f, nullptr);
#endif

// Patches
Expand Down

0 comments on commit bbe217e

Please sign in to comment.