1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-25 10:07:47 +01:00
This commit is contained in:
FunkyFr3sh 2020-10-13 10:53:30 +02:00
parent da69bc6620
commit b417da74f6
3 changed files with 37 additions and 27 deletions

View File

@ -250,21 +250,21 @@ static BOOL d3d9_set_states()
static BOOL d3d9_update_vertices(BOOL in_cutscene, BOOL stretch)
{
float vpX = stretch ? (float)g_ddraw->render.viewport.x : 0.0f;
float vpY = stretch ? (float)g_ddraw->render.viewport.y : 0.0f;
float vp_x = stretch ? (float)g_ddraw->render.viewport.x : 0.0f;
float vp_y = stretch ? (float)g_ddraw->render.viewport.y : 0.0f;
float vpW = stretch ? (float)(g_ddraw->render.viewport.width + g_ddraw->render.viewport.x) : (float)g_ddraw->width;
float vpH = stretch ? (float)(g_ddraw->render.viewport.height + g_ddraw->render.viewport.y) : (float)g_ddraw->height;
float vp_w = stretch ? (float)(g_ddraw->render.viewport.width + g_ddraw->render.viewport.x) : (float)g_ddraw->width;
float vp_h = stretch ? (float)(g_ddraw->render.viewport.height + g_ddraw->render.viewport.y) : (float)g_ddraw->height;
float sH = in_cutscene ? g_d3d9.scale_h * ((float)CUTSCENE_HEIGHT / g_ddraw->height) : g_d3d9.scale_h;
float sW = in_cutscene ? g_d3d9.scale_w * ((float)CUTSCENE_WIDTH / g_ddraw->width) : g_d3d9.scale_w;
float s_h = in_cutscene ? g_d3d9.scale_h * ((float)CUTSCENE_HEIGHT / g_ddraw->height) : g_d3d9.scale_h;
float s_w = in_cutscene ? g_d3d9.scale_w * ((float)CUTSCENE_WIDTH / g_ddraw->width) : g_d3d9.scale_w;
CUSTOMVERTEX vertices[] =
{
{ vpX - 0.5f, vpH - 0.5f, 0.0f, 1.0f, 0.0f, sH },
{ vpX - 0.5f, vpY - 0.5f, 0.0f, 1.0f, 0.0f, 0.0f },
{ vpW - 0.5f, vpH - 0.5f, 0.0f, 1.0f, sW, sH },
{ vpW - 0.5f, vpY - 0.5f, 0.0f, 1.0f, sW, 0.0f }
{ vp_x - 0.5f, vp_h - 0.5f, 0.0f, 1.0f, 0.0f, s_h },
{ vp_x - 0.5f, vp_y - 0.5f, 0.0f, 1.0f, 0.0f, 0.0f },
{ vp_w - 0.5f, vp_h - 0.5f, 0.0f, 1.0f, s_w, s_h },
{ vp_w - 0.5f, vp_y - 0.5f, 0.0f, 1.0f, s_w, 0.0f }
};
void *data;

View File

@ -175,7 +175,8 @@ static void ogl_create_textures(int width, int height)
g_ogl.surface_tex_height =
height <= 512 ? 512 : height <= 1024 ? 1024 : height <= 2048 ? 2048 : height <= 4096 ? 4096 : height;
g_ogl.surface_tex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, g_ogl.surface_tex_width * g_ogl.surface_tex_height * sizeof(int));
g_ogl.surface_tex =
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, g_ogl.surface_tex_width * g_ogl.surface_tex_height * sizeof(int));
g_ogl.adjust_alignment = (width % 4) != 0;
@ -538,9 +539,13 @@ static void ogl_render()
g_ddraw->render.viewport.width, g_ddraw->render.viewport.height);
if (g_ogl.main_program)
{
glUseProgram(g_ogl.main_program);
}
else if (g_ddraw->bpp == 16)
{
glEnable(GL_TEXTURE_2D);
}
while (g_ogl.use_opengl && g_ddraw->render.run &&
(g_ddraw->render.forcefps || WaitForSingleObject(g_ddraw->render.sem, 200) != WAIT_FAILED))
@ -625,6 +630,7 @@ static void ogl_render()
}
static int error_check_count = 0;
if (error_check_count < 20)
{
glClear(GL_COLOR_BUFFER_BIT);
@ -732,11 +738,15 @@ static void ogl_render()
glBindTexture(GL_TEXTURE_2D, 0);
if (g_ddraw->child_window_exists)
{
glViewport(0, g_ddraw->render.height - g_ddraw->height, g_ddraw->width, g_ddraw->height);
}
else
{
glViewport(
g_ddraw->render.viewport.x, g_ddraw->render.viewport.y,
g_ddraw->render.viewport.width, g_ddraw->render.viewport.height);
}
// apply filter