AM_Init uses vertex data form IPU. Added FPS counter trace

This commit is contained in:
jndean
2022-08-27 21:57:07 +00:00
parent aa22391bae
commit 197cc6b518
4 changed files with 63 additions and 16 deletions
+1 -1
View File
@@ -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++;
+22 -9
View File
@@ -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 ; i<tics*4 ; i+=4)
I_VideoBuffer[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff;
for ( ; i<20*4 ; i+=4)
I_VideoBuffer[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
for (i=0 ; i<tics*4 ; i+=4)
I_VideoBuffer[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff;
for ( ; i<20*4 ; i+=4)
I_VideoBuffer[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
{ // JOSEF: debug fps
static int updatecounter = 0;
static int lasttime = -1;
const int period = 50;
if ((++updatecounter) == period) {
int currenttime = I_GetTimeMS();
if (lasttime != -1) {
printf("FPS: %d\n", 1000 * period / (currenttime - lasttime));
}
lasttime = currenttime;
updatecounter = 0;
}
}
}
if (palette_to_set)
{
SDL_SetPaletteColors(screenbuffer->format->palette, palette, 0, 256);
+40 -3
View File
@@ -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;
-3
View File
@@ -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);
}