mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2025-03-01 18:47:03 +00:00
port DrawQuad
This commit is contained in:
parent
2b90bf9f0e
commit
25e28034d4
@ -69,10 +69,10 @@
|
||||
</g>
|
||||
<g transform="translate(0 116)">
|
||||
<text x="0" y="7.50">Tomb2.exe progress according to the physical function order:</text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">39.57% (482)</tspan> · <tspan class="known">57.96% (706)</tspan> · <tspan class="todo">0.41% (5)</tspan> · <tspan class="unused">2.05% (25)</tspan></tspan></text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">39.66% (483)</tspan> · <tspan class="known">57.88% (705)</tspan> · <tspan class="todo">0.41% (5)</tspan> · <tspan class="unused">2.05% (25)</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="295.61" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="432.99" height="6" x="295.61" y="0" class="known"/>
|
||||
<rect width="296.22" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="432.38" height="6" x="296.22" y="0" class="known"/>
|
||||
<rect width="3.07" height="6" x="728.60" y="0" class="todo"/>
|
||||
<rect width="15.33" height="6" x="731.67" y="0" class="unused"/>
|
||||
</g>
|
||||
@ -875,7 +875,7 @@
|
||||
<rect width="12" height="12" x="675" y="225" class="decompiled"><title>int32_t __cdecl BGND_AddTexture(int32_t tile_idx, BYTE *bitmap, int32_t pal_index, RGB_888 *bmp_pal);</title></rect>
|
||||
<rect width="12" height="12" x="690" y="225" class="decompiled"><title>void __cdecl BGND_GetPageHandles(void);</title></rect>
|
||||
<rect width="12" height="12" x="705" y="225" class="decompiled"><title>void __cdecl BGND_DrawInGameBlack(void);</title></rect>
|
||||
<rect width="12" height="12" x="720" y="225" class="known"><title>void __cdecl DrawQuad(float sx, float sy, float width, float height, D3DCOLOR color);</title></rect>
|
||||
<rect width="12" height="12" x="720" y="225" class="decompiled"><title>void __cdecl DrawQuad(float sx, float sy, float width, float height, D3DCOLOR color);</title></rect>
|
||||
<rect width="12" height="12" x="735" y="225" class="known"><title>void __cdecl BGND_DrawInGameBackground(void);</title></rect>
|
||||
<rect width="12" height="12" x="0" y="240" class="known"><title>void __cdecl DrawTextureTile(int32_t sx, int32_t sy, int32_t width, int32_t height, HWR_TEX_HANDLE tex_source, int32_t tu, int32_t tv, int32_t t_width, int32_t t_height, D3DCOLOR color0, D3DCOLOR color1, D3DCOLOR color2, D3DCOLOR color3);</title></rect>
|
||||
<rect width="12" height="12" x="15" y="240" class="known"><title>D3DCOLOR __cdecl BGND_CenterLighting(int32_t x, int32_t y, int32_t width, int32_t height);</title></rect>
|
||||
@ -1299,10 +1299,10 @@
|
||||
</g>
|
||||
<g transform="translate(0 546)">
|
||||
<text x="0" y="7.50">Tomb2.exe progress according to the function sizes:</text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">37.16%</tspan> · <tspan class="known">62.51%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.32%</tspan></tspan></text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">37.22%</tspan> · <tspan class="known">62.45%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.32%</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="277.58" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="466.98" height="6" x="277.58" y="0" class="known"/>
|
||||
<rect width="278.06" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="466.50" height="6" x="278.06" y="0" class="known"/>
|
||||
<rect width="0.10" height="6" x="744.56" y="0" class="todo"/>
|
||||
<rect width="2.40" height="6" x="744.60" y="0" class="unused"/>
|
||||
</g>
|
||||
@ -1715,7 +1715,7 @@
|
||||
<rect width="10.41" height="10.74" x="617.36" y="122.81" class="known"><title>void __cdecl ControlHotLiquid(int16_t fx_num);</title></rect>
|
||||
<rect width="10.29" height="10.74" x="630.77" y="122.81" class="decompiled"><title>void __cdecl CutscenePlayer_Control(int16_t item_num);</title></rect>
|
||||
<rect width="10.29" height="10.74" x="644.06" y="122.81" class="known"><title>void __cdecl SmashIceControl(int16_t item_num);</title></rect>
|
||||
<rect width="10.29" height="10.74" x="657.34" y="122.81" class="known"><title>void __cdecl DrawQuad(float sx, float sy, float width, float height, D3DCOLOR color);</title></rect>
|
||||
<rect width="10.29" height="10.74" x="657.34" y="122.81" class="decompiled"><title>void __cdecl DrawQuad(float sx, float sy, float width, float height, D3DCOLOR color);</title></rect>
|
||||
<rect width="10.29" height="10.74" x="670.63" y="122.81" class="known"><title>INT_PTR __stdcall SE_AdvancedDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);</title></rect>
|
||||
<rect width="10.23" height="10.74" x="683.92" y="122.81" class="known"><title>void __cdecl EarthQuake(int16_t item_num);</title></rect>
|
||||
<rect width="10.23" height="10.74" x="697.15" y="122.81" class="known"><title>void __cdecl ModifyStartInfo(int32_t level_num);</title></rect>
|
||||
|
Before Width: | Height: | Size: 360 KiB After Width: | Height: | Size: 360 KiB |
@ -2986,7 +2986,7 @@ typedef struct {
|
||||
0x00443B50 0x00B9 +R int32_t __cdecl BGND_AddTexture(int32_t tile_idx, BYTE *bitmap, int32_t pal_index, RGB_888 *bmp_pal);
|
||||
0x00443C10 0x0032 +R void __cdecl BGND_GetPageHandles(void);
|
||||
0x00443C50 0x005F +R void __cdecl BGND_DrawInGameBlack(void);
|
||||
0x00443CB0 0x00DC -R void __cdecl DrawQuad(float sx, float sy, float width, float height, D3DCOLOR color);
|
||||
0x00443CB0 0x00DC +R void __cdecl DrawQuad(float sx, float sy, float width, float height, D3DCOLOR color);
|
||||
0x00443D90 0x0220 -R void __cdecl BGND_DrawInGameBackground(void);
|
||||
0x00443FB0 0x0251 -R void __cdecl DrawTextureTile(int32_t sx, int32_t sy, int32_t width, int32_t height, HWR_TEX_HANDLE tex_source, int32_t tu, int32_t tv, int32_t t_width, int32_t t_height, D3DCOLOR color0, D3DCOLOR color1, D3DCOLOR color2, D3DCOLOR color3);
|
||||
0x00444210 0x008B -R D3DCOLOR __cdecl BGND_CenterLighting(int32_t x, int32_t y, int32_t width, int32_t height);
|
||||
|
@ -78,8 +78,8 @@ dll_sources = [
|
||||
'src/game/console_cmd.c',
|
||||
'src/game/creature.c',
|
||||
'src/game/effects.c',
|
||||
'src/game/hwr.c',
|
||||
'src/game/input.c',
|
||||
'src/game/room.c',
|
||||
'src/game/inventory.c',
|
||||
'src/game/items.c',
|
||||
'src/game/lara/lara_col.c',
|
||||
@ -91,13 +91,14 @@ dll_sources = [
|
||||
'src/game/math.c',
|
||||
'src/game/math_misc.c',
|
||||
'src/game/matrix.c',
|
||||
'src/game/music/music_main.c',
|
||||
'src/game/music/music_backend_files.c',
|
||||
'src/game/music/music_backend_cdaudio.c',
|
||||
'src/game/music/music_backend_files.c',
|
||||
'src/game/music/music_main.c',
|
||||
'src/game/objects/creatures/bird.c',
|
||||
'src/game/output.c',
|
||||
'src/game/overlay.c',
|
||||
'src/game/random.c',
|
||||
'src/game/room.c',
|
||||
'src/game/shell.c',
|
||||
'src/game/sound.c',
|
||||
'src/game/text.c',
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "game/background.h"
|
||||
|
||||
#include "game/hwr.h"
|
||||
#include "global/funcs.h"
|
||||
#include "global/vars.h"
|
||||
|
||||
@ -85,3 +86,33 @@ void __cdecl BGND_DrawInGameBlack(void)
|
||||
(float)g_PhdWinHeight, 0);
|
||||
HWR_EnableZBuffer(true, true);
|
||||
}
|
||||
|
||||
void __cdecl DrawQuad(
|
||||
const float sx, const float sy, const float width, const float height,
|
||||
const D3DCOLOR color)
|
||||
{
|
||||
D3DTLVERTEX vertex[4];
|
||||
|
||||
vertex[0].sx = sx;
|
||||
vertex[0].sy = sy;
|
||||
|
||||
vertex[1].sx = sx + width;
|
||||
vertex[1].sy = sy;
|
||||
|
||||
vertex[2].sx = sx;
|
||||
vertex[2].sy = sy + height;
|
||||
|
||||
vertex[3].sx = sx + width;
|
||||
vertex[3].sy = sy + height;
|
||||
|
||||
for (int32_t i = 0; i < 4; i++) {
|
||||
vertex[i].sz = 0;
|
||||
vertex[i].rhw = g_FltRhwONearZ;
|
||||
vertex[i].color = RGBA_SETALPHA(color, 0xFF);
|
||||
vertex[i].specular = 0;
|
||||
}
|
||||
|
||||
HWR_TexSource(0);
|
||||
HWR_EnableColorKey(false);
|
||||
HWR_DrawPrimitive(D3DPT_TRIANGLESTRIP, &vertex, 4, true);
|
||||
}
|
||||
|
@ -10,3 +10,5 @@ int32_t __cdecl BGND_AddTexture(
|
||||
const RGB_888 *bmp_pal);
|
||||
void __cdecl BGND_GetPageHandles(void);
|
||||
void __cdecl BGND_DrawInGameBlack(void);
|
||||
void __cdecl DrawQuad(
|
||||
float sx, float sy, float width, float height, D3DCOLOR color);
|
||||
|
14
src/game/hwr.c
Normal file
14
src/game/hwr.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include "game/hwr.h"
|
||||
|
||||
#include "global/vars.h"
|
||||
|
||||
#include <d3d.h>
|
||||
|
||||
HRESULT HWR_DrawPrimitive(
|
||||
D3DPRIMITIVETYPE primitive_type, LPVOID vertices, DWORD vtx_count,
|
||||
bool is_no_clip)
|
||||
{
|
||||
return g_D3DDev->lpVtbl->DrawPrimitive(
|
||||
g_D3DDev, primitive_type, D3DVT_TLVERTEX, vertices, vtx_count,
|
||||
is_no_clip ? D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTCLIP : 0);
|
||||
}
|
9
src/game/hwr.h
Normal file
9
src/game/hwr.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <d3dtypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <windows.h>
|
||||
|
||||
HRESULT HWR_DrawPrimitive(
|
||||
D3DPRIMITIVETYPE primitive_type, LPVOID vertices, DWORD vtx_count,
|
||||
bool is_no_clip);
|
@ -1,5 +1,6 @@
|
||||
#include "game/output.h"
|
||||
|
||||
#include "game/hwr.h"
|
||||
#include "game/math.h"
|
||||
#include "game/matrix.h"
|
||||
#include "game/shell.h"
|
||||
@ -3054,9 +3055,7 @@ void __cdecl Output_InsertGT3_ZBuffered(
|
||||
HWR_TexSource(g_HWR_PageHandles[texture->tex_page]);
|
||||
HWR_EnableColorKey(texture->draw_type != DRAW_OPAQUE);
|
||||
|
||||
g_D3DDev->lpVtbl->DrawPrimitive(
|
||||
g_D3DDev, D3DPT_TRIANGLELIST, D3DVT_TLVERTEX, g_VBufferD3D, 3,
|
||||
D3DDP_DONOTCLIP | D3DDP_DONOTUPDATEEXTENTS);
|
||||
HWR_DrawPrimitive(D3DPT_TRIANGLELIST, g_VBufferD3D, 3, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3205,9 +3204,7 @@ void __cdecl Output_InsertGT4_ZBuffered(
|
||||
|
||||
HWR_TexSource(g_HWR_PageHandles[texture->tex_page]);
|
||||
HWR_EnableColorKey(texture->draw_type != DRAW_OPAQUE);
|
||||
g_D3DDev->lpVtbl->DrawPrimitive(
|
||||
g_D3DDev, D3DPT_TRIANGLEFAN, D3DVT_TLVERTEX, g_VBufferD3D, 4,
|
||||
D3DDP_DONOTCLIP | D3DDP_DONOTUPDATEEXTENTS);
|
||||
HWR_DrawPrimitive(D3DPT_TRIANGLEFAN, g_VBufferD3D, 4, true);
|
||||
}
|
||||
|
||||
void __cdecl Output_InsertFlatRect_ZBuffered(
|
||||
@ -3247,9 +3244,7 @@ void __cdecl Output_InsertFlatRect_ZBuffered(
|
||||
|
||||
HWR_TexSource(0);
|
||||
HWR_EnableColorKey(0);
|
||||
g_D3DDev->lpVtbl->DrawPrimitive(
|
||||
g_D3DDev, D3DPT_TRIANGLESTRIP, D3DVT_TLVERTEX, g_VBufferD3D, 4,
|
||||
D3DDP_DONOTCLIP | D3DDP_DONOTUPDATEEXTENTS);
|
||||
HWR_DrawPrimitive(D3DPT_TRIANGLESTRIP, g_VBufferD3D, 4, true);
|
||||
}
|
||||
|
||||
void __cdecl Output_InsertLine_ZBuffered(
|
||||
@ -3281,9 +3276,7 @@ void __cdecl Output_InsertLine_ZBuffered(
|
||||
|
||||
HWR_TexSource(0);
|
||||
HWR_EnableColorKey(0);
|
||||
g_D3DDev->lpVtbl->DrawPrimitive(
|
||||
g_D3DDev, D3DPT_LINESTRIP, D3DVT_TLVERTEX, g_VBufferD3D, 2,
|
||||
D3DDP_DONOTCLIP | D3DDP_DONOTUPDATEEXTENTS);
|
||||
HWR_DrawPrimitive(D3DPT_LINESTRIP, g_VBufferD3D, 2, true);
|
||||
}
|
||||
|
||||
const int16_t *__cdecl Output_InsertObjectG3_Sorted(
|
||||
@ -4182,9 +4175,7 @@ void __cdecl Output_DrawClippedPoly_Textured(const int32_t vtx_count)
|
||||
vbuf_d3d->tu = tu;
|
||||
}
|
||||
|
||||
g_D3DDev->lpVtbl->DrawPrimitive(
|
||||
g_D3DDev, D3DPT_TRIANGLEFAN, D3DVT_TLVERTEX, g_VBufferD3D, vtx_count,
|
||||
D3DDP_DONOTCLIP | D3DDP_DONOTUPDATEEXTENTS);
|
||||
HWR_DrawPrimitive(D3DPT_TRIANGLEFAN, g_VBufferD3D, vtx_count, true);
|
||||
}
|
||||
|
||||
void __cdecl Output_DrawPoly_Gouraud(
|
||||
@ -4202,9 +4193,7 @@ void __cdecl Output_DrawPoly_Gouraud(
|
||||
Output_ShadeLightColor(vbuf->g, red, green, blue, 0xFF);
|
||||
}
|
||||
|
||||
g_D3DDev->lpVtbl->DrawPrimitive(
|
||||
g_D3DDev, D3DPT_TRIANGLEFAN, D3DVT_TLVERTEX, g_VBufferD3D, vtx_count,
|
||||
D3DDP_DONOTCLIP | D3DDP_DONOTUPDATEEXTENTS);
|
||||
HWR_DrawPrimitive(D3DPT_TRIANGLEFAN, g_VBufferD3D, vtx_count, true);
|
||||
}
|
||||
|
||||
void __cdecl Output_DrawSprite(
|
||||
|
@ -443,7 +443,6 @@
|
||||
#define ControlLavaBlob ((void __cdecl (*)(int16_t fx_num))0x00442F40)
|
||||
#define GiantYetiControl ((void __cdecl (*)(int16_t item_num))0x00443050)
|
||||
#define YetiControl ((void __cdecl (*)(int16_t item_num))0x00443350)
|
||||
#define DrawQuad ((void __cdecl (*)(float sx, float sy, float width, float height, D3DCOLOR color))0x00443CB0)
|
||||
#define BGND_DrawInGameBackground ((void __cdecl (*)(void))0x00443D90)
|
||||
#define DrawTextureTile ((void __cdecl (*)(int32_t sx, int32_t sy, int32_t width, int32_t height, HWR_TEX_HANDLE tex_source, int32_t tu, int32_t tv, int32_t t_width, int32_t t_height, D3DCOLOR color0, D3DCOLOR color1, D3DCOLOR color2, D3DCOLOR color3))0x00443FB0)
|
||||
#define BGND_CenterLighting ((D3DCOLOR __cdecl (*)(int32_t x, int32_t y, int32_t width, int32_t height))0x00444210)
|
||||
|
@ -145,6 +145,7 @@ static void Inject_Background(const bool enable)
|
||||
INJECT(enable, 0x00443B50, BGND_AddTexture);
|
||||
INJECT(enable, 0x00443C10, BGND_GetPageHandles);
|
||||
INJECT(enable, 0x00443C50, BGND_DrawInGameBlack);
|
||||
INJECT(enable, 0x00443CB0, DrawQuad);
|
||||
}
|
||||
|
||||
static void Inject_Camera(const bool enable)
|
||||
|
Loading…
x
Reference in New Issue
Block a user