Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions prboom2/src/MUSIC/flplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,8 @@ static void fl_writesamples_ex (short *dest, int nsamp)
if (nsamp * 2 > fbuff_siz)
{
float *newfbuff = (float*)realloc (fbuff, nsamp * 2 * sizeof (float));
if (!newfbuff) return;
fbuff = newfbuff;
if (!newfbuff) return;
fbuff = newfbuff;
fbuff_siz = nsamp * 2;
}

Expand All @@ -448,7 +448,7 @@ static void fl_writesamples_ex (short *dest, int nsamp)
for (i = 0; i < nsamp * 2; i++)
{
// data is NOT already clipped
float f = fbuff[i];
float f = fbuff[i];
if (f > 1.0f)
f = 1.0f;
if (f < -1.0f)
Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/SDL/i_sndfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
#include "SDL_audio.h"

void *Load_SNDFile(const void *data, SDL_AudioSpec *sample, void **sampledata,
Uint32 *samplelen);
Uint32 *samplelen);

#endif
2 changes: 1 addition & 1 deletion prboom2/src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ void D_SetPage(const char* name, int tics, int music)

static void D_DrawTitle1(const char *name)
{
D_SetPage(name, TICRATE * 170 / 35, mus_intro);
D_SetPage(name, TICRATE * 170 / 35, mus_intro); // 35 * 170 / 35, is that correct math?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make this just be 170 ig

}

static void D_DrawTitle2(const char *name)
Expand Down
12 changes: 6 additions & 6 deletions prboom2/src/dsda.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,17 @@ void dsda_DisplayNotifications(void) {
}

void dsda_DecomposeILTime(dsda_level_time_t* level_time) {
level_time->m = dsda_last_leveltime / 35 / 60;
level_time->s = (dsda_last_leveltime % (60 * 35)) / 35;
level_time->t = round(100.f * (dsda_last_leveltime % 35) / 35);
level_time->m = dsda_last_leveltime / TICRATE / 60;
level_time->s = (dsda_last_leveltime % (60 * TICRATE)) / TICRATE;
level_time->t = round(100.f * (dsda_last_leveltime % TICRATE) / TICRATE);
}

void dsda_DecomposeMovieTime(dsda_movie_time_t* total_time) {
extern int totalleveltimes;

total_time->h = totalleveltimes / 35 / 60 / 60;
total_time->m = (totalleveltimes % (60 * 60 * 35)) / 35 / 60;
total_time->s = (totalleveltimes % (60 * 35)) / 35;
total_time->h = totalleveltimes / TICRATE / 60 / 60;
total_time->m = (totalleveltimes % (60 * 60 * TICRATE)) / TICRATE / 60;
total_time->s = (totalleveltimes % (60 * TICRATE)) / TICRATE;
}

void dsda_DisplayNotification(const char* msg) {
Expand Down
8 changes: 4 additions & 4 deletions prboom2/src/dsda/ambient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void dsda_UpdateAmbientSource(ambient_source_t* source) {

// looping
if (source->data.min_tics < 0) {
source->wait_tics = 35;
source->wait_tics = TICRATE;

if (!source->data.attenuation) {
S_AdjustVolume(source->data.volume);
Expand Down Expand Up @@ -146,13 +146,13 @@ static void dsda_ParseAmbient(Scanner &scanner) {
}
else if (scanner.StringMatch("random")) {
scanner.MustGetFloat();
amb_sfx.min_tics = 35 * scanner.decimal;
amb_sfx.min_tics = TICRATE * scanner.decimal;
scanner.MustGetFloat();
amb_sfx.max_tics = 35 * scanner.decimal;
amb_sfx.max_tics = TICRATE * scanner.decimal;
}
else if (scanner.StringMatch("periodic")) {
scanner.MustGetFloat();
amb_sfx.min_tics = 35 * scanner.decimal;
amb_sfx.min_tics = TICRATE * scanner.decimal;
amb_sfx.max_tics = amb_sfx.min_tics;
}

Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/dsda/endoom.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static const char* cp437_to_utf8[256] = {
"\xc3\xb9",
"\xc3\xbf",
"\xc3\x96",
"\xc3\x9c ",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This surprised me. It is a tab but without visible whitespace characters, it looks like a space. Found it only while looking for \t indentation. Did not check whenever or not it makes sense there, but there are other strings with 3 characters in the array, just no tab.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's in a conversion table between two binary text formats, so it's probably supposed to be there, and definitely shouldn't be changed without understanding the data thoroughly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing it to explicit \t does not change any behavior, just makes it easier to recognize for the character it is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's totally reasonable, then. I'd apparently misunderstood the diff.

"\xc3\x9c\t",
"\xc2\xa2",
"\xc2\xa3",
"\xc2\xa5",
Expand Down
16 changes: 8 additions & 8 deletions prboom2/src/dsda/hud_components/composite_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ static void dsda_UpdateComponentText(char* str, size_t max_size) {
"%s%s%d:%02d %s%d:%05.2f ",
local->label,
dsda_TextColor(dsda_tc_exhud_total_time),
total_time / 35 / 60,
(total_time % (60 * 35)) / 35,
total_time / TICRATE / 60,
(total_time % (60 * TICRATE)) / TICRATE,
dsda_TextColor(dsda_tc_exhud_level_time),
leveltime / 35 / 60,
(float) (leveltime % (60 * 35)) / 35
leveltime / TICRATE / 60,
(float) (leveltime % (60 * TICRATE)) / TICRATE
);
else
length = snprintf(
Expand All @@ -56,8 +56,8 @@ static void dsda_UpdateComponentText(char* str, size_t max_size) {
"%s%s%d:%05.2f ",
local->label,
dsda_TextColor(dsda_tc_exhud_level_time),
leveltime / 35 / 60,
(float) (leveltime % (60 * 35)) / 35
leveltime / TICRATE / 60,
(float) (leveltime % (60 * TICRATE)) / TICRATE
);

if (dsda_reborn && (demorecording || demoplayback)) {
Expand All @@ -68,8 +68,8 @@ static void dsda_UpdateComponentText(char* str, size_t max_size) {
max_size - length,
"%s%d:%02d ",
dsda_TextColor(dsda_tc_exhud_demo_length),
demo_tic / 35 / 60,
(demo_tic % (60 * 35)) / 35
demo_tic / TICRATE / 60,
(demo_tic % (60 * TICRATE)) / TICRATE
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions prboom2/src/dsda/hud_components/event_split.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ void dsda_AddSplit(dsda_split_class_t split_class, int lifetime) {
ticks = lifetime;

// To match the timer, we use the leveltime value at the end of the frame
minutes = (leveltime + 1) / 35 / 60;
seconds = (float)((leveltime + 1) % (60 * 35)) / 35;
minutes = (leveltime + 1) / TICRATE / 60;
seconds = (float)((leveltime + 1) % (60 * TICRATE)) / TICRATE;
snprintf(
local->component.msg, sizeof(local->component.msg), "%s%d:%05.2f - %s",
dsda_TextColor(dsda_tc_exhud_event_split),
Expand Down
4 changes: 2 additions & 2 deletions prboom2/src/dsda/hud_components/fps.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ static void dsda_UpdateComponentText(char* str, size_t max_size) {
str,
max_size,
"%s%4d",
dsda_render_stats_fps < 35 ? dsda_TextColor(dsda_tc_exhud_fps_bad) :
dsda_TextColor(dsda_tc_exhud_fps_fine),
dsda_render_stats_fps < TICRATE ? dsda_TextColor(dsda_tc_exhud_fps_bad) :
dsda_TextColor(dsda_tc_exhud_fps_fine),
dsda_render_stats_fps
);
}
Expand Down
14 changes: 7 additions & 7 deletions prboom2/src/dsda/hud_components/level_splits.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ static void dsda_UpdateIntermissionTime(dsda_split_t* split) {
snprintf(
delta, sizeof(delta),
" (%s%d:%05.2f)",
sign, diff / 35 / 60, (float)(diff % (60 * 35)) / 35
sign, diff / TICRATE / 60, (float)(diff % (60 * TICRATE)) / TICRATE
);
}
else {
snprintf(
delta, sizeof(delta),
" (%s%04.2f)",
sign, (float)(diff % (60 * 35)) / 35
sign, (float)(diff % (60 * TICRATE)) / TICRATE
);
}
}
Expand All @@ -72,8 +72,8 @@ static void dsda_UpdateIntermissionTime(dsda_split_t* split) {
local->time_component.msg,
sizeof(local->time_component.msg),
"%s%d:%05.2f",
color, leveltime / 35 / 60,
(float)(leveltime % (60 * 35)) / 35
color, leveltime / TICRATE / 60,
(float)(leveltime % (60 * TICRATE)) / TICRATE
);

strcat(local->time_component.msg, delta);
Expand All @@ -92,7 +92,7 @@ static void dsda_UpdateIntermissionTotal(dsda_split_t* split) {
const char* sign;
int diff;

diff = dsda_SplitComparisonDelta(&split->totalleveltimes) / 35;
diff = dsda_SplitComparisonDelta(&split->totalleveltimes) / TICRATE;
sign = diff >= 0 ? "+" : "-";
color = diff >= 0 ? dsda_TextColor(dsda_tc_inter_split_normal) :
dsda_TextColor(dsda_tc_inter_split_good);
Expand All @@ -118,8 +118,8 @@ static void dsda_UpdateIntermissionTotal(dsda_split_t* split) {
local->total_component.msg,
sizeof(local->total_component.msg),
"%s%d:%02d",
color, totalleveltimes / 35 / 60,
(totalleveltimes / 35) % 60
color, totalleveltimes / TICRATE / 60,
(totalleveltimes / TICRATE) % 60
);

strcat(local->total_component.msg, delta);
Expand Down
4 changes: 2 additions & 2 deletions prboom2/src/dsda/hud_components/map_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ static void dsda_UpdateComponentText(char* str, size_t max_size) {
totalleveltimes + leveltime;
level_time = leveltime;

total_time /= 35;
level_time /= 35;
total_time /= TICRATE;
level_time /= TICRATE;

length = snprintf(
str,
Expand Down
4 changes: 2 additions & 2 deletions prboom2/src/dsda/hud_components/render_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ static void dsda_UpdateCurrentComponentText(char* str, size_t max_size) {
str, max_size,
"%sFPS %s%4d %sSEGS %s%4d %sPLANES %s%4d %sSPRITES %s%4d",
dsda_TextColor(dsda_tc_exhud_render_label),
dsda_render_stats_fps < 35 ? dsda_TextColor(dsda_tc_exhud_render_bad) :
dsda_TextColor(dsda_tc_exhud_render_good),
dsda_render_stats_fps < TICRATE ? dsda_TextColor(dsda_tc_exhud_render_bad) :
dsda_TextColor(dsda_tc_exhud_render_good),
dsda_render_stats_fps,
dsda_TextColor(dsda_tc_exhud_render_label),
dsda_render_stats.drawsegs > 256 ? dsda_TextColor(dsda_tc_exhud_render_bad) :
Expand Down
4 changes: 2 additions & 2 deletions prboom2/src/dsda/key_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void dsda_RestoreKeyFrame(dsda_key_frame_t* key_frame, dboolean skip_wipe) {

dsda_RestoreCommandHistory();

restore_key_frame_index = (totalleveltimes + leveltime) / (35 * autoKeyFrameInterval());
restore_key_frame_index = (totalleveltimes + leveltime) / (TICRATE * autoKeyFrameInterval());

G_AfterLoad();

Expand Down Expand Up @@ -384,7 +384,7 @@ void dsda_UpdateAutoKeyFrames(void) {
) return;

current_time = totalleveltimes + leveltime;
interval_tics = 35 * autoKeyFrameInterval();
interval_tics = TICRATE * autoKeyFrameInterval();

// Automatically save a key frame each interval
if (current_time % interval_tics == 0) {
Expand Down
3 changes: 2 additions & 1 deletion prboom2/src/dsda/render_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
#include "dsda/utility.h"

#include "render_stats.h"
#include "doomdef.h"

static dsda_render_stats_t frame_stats;
static dsda_render_stats_t interval_stats;
static int frame_count;

dsda_render_stats_t dsda_render_stats;
dsda_render_stats_t dsda_render_stats_max;
int dsda_render_stats_fps = 35;
int dsda_render_stats_fps = TICRATE;

static void dsda_UpdateMaxValues(dsda_render_stats_t* x, dsda_render_stats_t* y) {
if (x->visplanes < y->visplanes)
Expand Down
8 changes: 4 additions & 4 deletions prboom2/src/dsda/text_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ static char* dsda_TextFileTime(void) {
text_file_time,
16,
"%d:%05.2f",
dsda_last_leveltime / 35 / 60,
(float)(dsda_last_leveltime % (60 * 35)) / 35
dsda_last_leveltime / TICRATE / 60,
(float)(dsda_last_leveltime % (60 * TICRATE)) / TICRATE
);
else
snprintf(
text_file_time,
16,
"%d:%02d",
totalleveltimes / 35 / 60,
(totalleveltimes / 35) % 60
totalleveltimes / TICRATE / 60,
(totalleveltimes / TICRATE) % 60
);

return text_file_time;
Expand Down
3 changes: 1 addition & 2 deletions prboom2/src/dsda/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "dsda/configuration.h"

#include "time.h"
#include "doomdef.h"

// clock_gettime implementation for msvc
// NOTE: Only supports CLOCK_MONOTONIC
Expand Down Expand Up @@ -121,8 +122,6 @@ void dsda_LimitFPS(void) {
}
}

#define TICRATE 35

int dsda_GameSpeed(void);

static unsigned long long dsda_RealTime(void) {
Expand Down
6 changes: 3 additions & 3 deletions prboom2/src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ void G_DoCompleted (void)
if (hexen)
totalleveltimes = players[consoleplayer].worldTimer;
else
totalleveltimes += leveltime - leveltime % 35;
totalleveltimes += leveltime - leveltime % TICRATE;
++levels_completed;

gameaction = ga_nothing;
Expand Down Expand Up @@ -4279,7 +4279,7 @@ static dboolean InventoryMoveLeft(void)
return true;
}

inventoryTics = 5 * 35;
inventoryTics = 5 * TICRATE;
if (!inventory)
{
inventory = true;
Expand Down Expand Up @@ -4320,7 +4320,7 @@ static dboolean InventoryMoveRight(void)
return true;
}

inventoryTics = 5 * 35;
inventoryTics = 5 * TICRATE;
if (!inventory)
{
inventory = true;
Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/g_overflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ void SpechitOverrun(spechit_overrun_param_t *params)

default:
fprintf(stderr, "SpechitOverrun: Warning: unable to emulate"
"an overrun where numspechit=%i\n",
" an overrun where numspechit=%i\n",
numspechit);
break;
}
Expand Down
46 changes: 23 additions & 23 deletions prboom2/src/gl_opengl.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,29 +287,29 @@ void gld_InitOpenGL(void)
isExtensionSupported ("GL_ARB_shading_language_100");
if (gl_arb_shader_objects)
{
GLEXT_glDeleteObjectARB = SDL_GL_GetProcAddress("glDeleteObjectARB");
GLEXT_glGetHandleARB = SDL_GL_GetProcAddress("glGetHandleARB");
GLEXT_glDetachObjectARB = SDL_GL_GetProcAddress("glDetachObjectARB");
GLEXT_glCreateShaderObjectARB = SDL_GL_GetProcAddress("glCreateShaderObjectARB");
GLEXT_glShaderSourceARB = SDL_GL_GetProcAddress("glShaderSourceARB");
GLEXT_glCompileShaderARB = SDL_GL_GetProcAddress("glCompileShaderARB");
GLEXT_glCreateProgramObjectARB = SDL_GL_GetProcAddress("glCreateProgramObjectARB");
GLEXT_glAttachObjectARB = SDL_GL_GetProcAddress("glAttachObjectARB");
GLEXT_glLinkProgramARB = SDL_GL_GetProcAddress("glLinkProgramARB");
GLEXT_glUseProgramObjectARB = SDL_GL_GetProcAddress("glUseProgramObjectARB");
GLEXT_glValidateProgramARB = SDL_GL_GetProcAddress("glValidateProgramARB");

GLEXT_glUniform1fARB = SDL_GL_GetProcAddress("glUniform1fARB");
GLEXT_glUniform2fARB = SDL_GL_GetProcAddress("glUniform2fARB");
GLEXT_glUniform1iARB = SDL_GL_GetProcAddress("glUniform1iARB");

GLEXT_glGetObjectParameterfvARB = SDL_GL_GetProcAddress("glGetObjectParameterfvARB");
GLEXT_glGetObjectParameterivARB = SDL_GL_GetProcAddress("glGetObjectParameterivARB");
GLEXT_glGetInfoLogARB = SDL_GL_GetProcAddress("glGetInfoLogARB");
GLEXT_glGetAttachedObjectsARB = SDL_GL_GetProcAddress("glGetAttachedObjectsARB");
GLEXT_glGetUniformLocationARB = SDL_GL_GetProcAddress("glGetUniformLocationARB");
GLEXT_glGetActiveUniformARB = SDL_GL_GetProcAddress("glGetActiveUniformARB");
GLEXT_glGetUniformfvARB = SDL_GL_GetProcAddress("glGetUniformfvARB");
GLEXT_glDeleteObjectARB = SDL_GL_GetProcAddress("glDeleteObjectARB");
GLEXT_glGetHandleARB = SDL_GL_GetProcAddress("glGetHandleARB");
GLEXT_glDetachObjectARB = SDL_GL_GetProcAddress("glDetachObjectARB");
GLEXT_glCreateShaderObjectARB = SDL_GL_GetProcAddress("glCreateShaderObjectARB");
GLEXT_glShaderSourceARB = SDL_GL_GetProcAddress("glShaderSourceARB");
GLEXT_glCompileShaderARB = SDL_GL_GetProcAddress("glCompileShaderARB");
GLEXT_glCreateProgramObjectARB = SDL_GL_GetProcAddress("glCreateProgramObjectARB");
GLEXT_glAttachObjectARB = SDL_GL_GetProcAddress("glAttachObjectARB");
GLEXT_glLinkProgramARB = SDL_GL_GetProcAddress("glLinkProgramARB");
GLEXT_glUseProgramObjectARB = SDL_GL_GetProcAddress("glUseProgramObjectARB");
GLEXT_glValidateProgramARB = SDL_GL_GetProcAddress("glValidateProgramARB");

GLEXT_glUniform1fARB = SDL_GL_GetProcAddress("glUniform1fARB");
GLEXT_glUniform2fARB = SDL_GL_GetProcAddress("glUniform2fARB");
GLEXT_glUniform1iARB = SDL_GL_GetProcAddress("glUniform1iARB");

GLEXT_glGetObjectParameterfvARB = SDL_GL_GetProcAddress("glGetObjectParameterfvARB");
GLEXT_glGetObjectParameterivARB = SDL_GL_GetProcAddress("glGetObjectParameterivARB");
GLEXT_glGetInfoLogARB = SDL_GL_GetProcAddress("glGetInfoLogARB");
GLEXT_glGetAttachedObjectsARB = SDL_GL_GetProcAddress("glGetAttachedObjectsARB");
GLEXT_glGetUniformLocationARB = SDL_GL_GetProcAddress("glGetUniformLocationARB");
GLEXT_glGetActiveUniformARB = SDL_GL_GetProcAddress("glGetActiveUniformARB");
GLEXT_glGetUniformfvARB = SDL_GL_GetProcAddress("glGetUniformfvARB");

if (!GLEXT_glDeleteObjectARB || !GLEXT_glGetHandleARB ||
!GLEXT_glDetachObjectARB || !GLEXT_glCreateShaderObjectARB ||
Expand Down
Loading