File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 1010#include " instance/Enemy.h"
1111#include " level/Markup.h"
1212#include " level/Trigger.h"
13- #include " game/Camera.h"
1413
1514#include " cdc/math/Math.h"
1615
@@ -95,16 +94,6 @@ void Draw::OnFrame()
9594 Font::SetScale (0 .6f , 0 .6f );
9695#endif
9796
98- // Set the correct transform in Legend for next generation graphics
99- #if TR7
100- if (Game::IsInNextGenMode ())
101- {
102- auto camera = CAMERA_GetCamera ();
103-
104- TRANS_SetTransformMatrixf (&camera->wcTransform2f );
105- }
106- #endif
107-
10897 if (m_drawInstances || m_drawEnemyRouting)
10998 {
11099 DrawInstances ();
Original file line number Diff line number Diff line change 1010#include " patches/ErrorHandler.h"
1111#include " patches/Multicore.h"
1212#include " game/Camera.h"
13+ #include " render/Draw.h"
1314
1415// Instance of patches so we can get it in our hooks without calling GetModule<T> each call
1516static Patches* s_patches;
@@ -47,6 +48,16 @@ static void GAMELOOP_HandleScreenWipes()
4748
4849 s_GAMELOOP_HandleScreenWipes ();
4950}
51+
52+ static void TransToDrawVertexV4f (DRAWVERTEX* v, cdc::Vector3* vec)
53+ {
54+ auto camera = CAMERA_GetCamera ();
55+ auto transform = Game::IsInNextGenMode () ? camera->wcTransform2f : camera->wcTransformf ;
56+
57+ v->x = transform.col0 .x * vec->x + transform.col1 .x * vec->y + transform.col2 .x * vec->z + transform.col3 .x ;
58+ v->y = transform.col0 .y * vec->x + transform.col1 .y * vec->y + transform.col2 .y * vec->z + transform.col3 .y ;
59+ v->z = transform.col0 .z * vec->x + transform.col1 .z * vec->y + transform.col2 .z * vec->z + transform.col3 .z ;
60+ }
5061#endif
5162
5263// No death fade code
@@ -118,6 +129,8 @@ Patches::Patches()
118129#ifdef TR7
119130 // NOP the exception handler in Legend
120131 Hooking::Nop ((void *)0x401F53 , 26 );
132+
133+ MH_CreateHook ((void *)0x402EF0 , TransToDrawVertexV4f, nullptr );
121134#endif
122135
123136 // Patches
You can’t perform that action at this time.
0 commit comments