From 197cc6b518bbaceff3bf873301a5fd8ef588c1ae Mon Sep 17 00:00:00 2001 From: jndean Date: Sat, 27 Aug 2022 21:57:07 +0000 Subject: [PATCH] AM_Init uses vertex data form IPU. Added FPS counter trace --- src/d_loop.c | 2 +- src/i_video.c | 31 ++++++++++++++++++++++--------- src/ipu/am_map.c | 43 ++++++++++++++++++++++++++++++++++++++++--- src/p_setup.c | 3 --- 4 files changed, 63 insertions(+), 16 deletions(-) diff --git a/src/d_loop.c b/src/d_loop.c index e12aeaa..830eef9 100644 --- a/src/d_loop.c +++ b/src/d_loop.c @@ -790,7 +790,7 @@ void TryRunTics (void) memcpy(local_playeringame, set->ingame, sizeof(local_playeringame)); - // loop_interface->RunTic(set->cmds, set->ingame); + // JOSEF: loop_interface->RunTic(set->cmds, set->ingame); D_RunTic(set->cmds, set->ingame); // JOSEF gametic++; diff --git a/src/i_video.c b/src/i_video.c index 230c843..fcfe8cb 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -762,18 +762,31 @@ void I_FinishUpdate (void) if (display_fps_dots) { - i = I_GetTime(); - tics = i - lasttic; - lasttic = i; - if (tics > 20) tics = 20; + i = I_GetTime(); + tics = i - lasttic; + lasttic = i; + if (tics > 20) tics = 20; - for (i=0 ; iformat->palette, palette, 0, 256); diff --git a/src/ipu/am_map.c b/src/ipu/am_map.c index 881b391..1c1ff28 100644 --- a/src/ipu/am_map.c +++ b/src/ipu/am_map.c @@ -1,8 +1,7 @@ #include "m_fixed.h" - #include "p_local.h" - +#include "r_state.h" #include "st_stuff.h" @@ -205,6 +204,44 @@ cheatseq_t cheat_amap = CHEAT("iddt", 0); static boolean stopped = true; +// +// Determines bounding box of all vertices, +// sets global variables controlling zoom range. +// +void AM_findMinMaxBoundaries(void) { + int i; + fixed_t a; + fixed_t b; + + min_x = min_y = INT_MAX; + max_x = max_y = -INT_MAX; + + for (i = 0; i < numvertexes; i++) { + if (vertexes[i].x < min_x) + min_x = vertexes[i].x; + else if (vertexes[i].x > max_x) + max_x = vertexes[i].x; + + if (vertexes[i].y < min_y) + min_y = vertexes[i].y; + else if (vertexes[i].y > max_y) + max_y = vertexes[i].y; + } + + max_w = max_x - min_x; + max_h = max_y - min_y; + + min_w = 2 * PLAYERRADIUS; // const? never changed? + min_h = 2 * PLAYERRADIUS; + + a = FixedDiv(f_w << FRACBITS, max_w); + b = FixedDiv(f_h << FRACBITS, max_h); + + min_scale_mtof = a < b ? a : b; + max_scale_mtof = FixedDiv(f_h << FRACBITS, 2 * PLAYERRADIUS); +} + + void AM_clearMarks(void) { int i; @@ -226,7 +263,7 @@ void AM_LevelInit(void) { AM_clearMarks(); - //AM_findMinMaxBoundaries(); // LATER + AM_findMinMaxBoundaries(); scale_mtof = FixedDiv(min_scale_mtof, (int)(0.7 * FRACUNIT)); if (scale_mtof > max_scale_mtof) scale_mtof = min_scale_mtof; diff --git a/src/p_setup.c b/src/p_setup.c index a6d16cd..b6833d7 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -137,9 +137,6 @@ void P_LoadVertexes(int lump) { li->y = SHORT(ml->y) << FRACBITS; } - printf("[CPU] numvertexes: %d, 1x: %d, -1y:%d\n", - numvertexes, vertexes[0].x, vertexes[numvertexes-1].y); - // Free buffer memory. W_ReleaseLumpNum(lump); }