disable interpolation when frame limiter is at 30 (#286)

* fix player connected spam on joining a game

* make it possible to actually disable interpolation

by setting the frame limiter to 30
also move the "Disable Popups" option to misc settings.

* maybe someday ill learn to read.

* one day.
This commit is contained in:
Isaac0-dev 2023-02-21 12:29:23 +10:00 committed by GitHub
parent 761cd5b66b
commit 9f1bf8cc6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 8 deletions

View file

@ -3,7 +3,7 @@
#include "src/pc/configfile.h"
// The checkbox size is determined by the base size they all have and the amount.
#define CHECKBOXES_SIZE 32 * 6
#define CHECKBOXES_SIZE 32 * 5
// The checkbox pad size is determined by half the base size they all have and the amount plus one.
#define CHECKBOXES_PAD_SIZE 16 * 7
// The accumulative size of both the padding size and normal size for the checkboxes.
@ -23,6 +23,7 @@
#define BODY_HEIGHT CHECKBOXES_FULL_SIZE + SELECTION_BOXES_FULL_SIZE + BUTTON_SIZES
static struct DjuiInputbox* sFrameLimitInput = NULL;
static struct DjuiSelectionbox* sInterpolationSelectionBox = NULL;
static void djui_panel_display_apply(UNUSED struct DjuiBase* caller) {
configWindow.settings_changed = true;
@ -30,6 +31,7 @@ static void djui_panel_display_apply(UNUSED struct DjuiBase* caller) {
static void djui_panel_display_uncapped_change(UNUSED struct DjuiBase* caller) {
djui_base_set_enabled(&sFrameLimitInput->base, !configUncappedFramerate);
djui_base_set_enabled(&sInterpolationSelectionBox->base, (configFrameLimit > 30 || (configFrameLimit <= 30 && configUncappedFramerate)));
}
static void djui_panel_display_frame_limit_text_change(struct DjuiBase* caller) {
@ -41,6 +43,7 @@ static void djui_panel_display_frame_limit_text_change(struct DjuiBase* caller)
} else {
djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255);
}
djui_base_set_enabled(&sInterpolationSelectionBox->base, (configFrameLimit > 30 || (configFrameLimit <= 30 && configUncappedFramerate)));
}
void djui_panel_display_create(struct DjuiBase* caller) {
@ -57,10 +60,6 @@ void djui_panel_display_create(struct DjuiBase* caller) {
djui_interactable_hook_value_change(&checkbox1->base, djui_panel_display_apply);
defaultBase = &checkbox1->base;
struct DjuiCheckbox* checkbox5 = djui_checkbox_create(&body->base, "Disable Popups", &configDisablePopups);
djui_base_set_size_type(&checkbox5->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&checkbox5->base, 1.0f, 32);
#ifdef EXTERNAL_DATA
struct DjuiCheckbox* checkbox7 = djui_checkbox_create(&body->base, "Preload Textures", &configPrecacheRes);
djui_base_set_size_type(&checkbox7->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
@ -106,6 +105,8 @@ void djui_panel_display_create(struct DjuiBase* caller) {
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(&body->base, "Interpolation", interpChoices, 2, &configInterpolationMode);
djui_base_set_size_type(&selectionbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&selectionbox1->base, 1.0f, 32);
djui_base_set_enabled(&selectionbox1->base, (configFrameLimit > 30 || (configFrameLimit <= 30 && configUncappedFramerate)));
sInterpolationSelectionBox = selectionbox1;
char* filterChoices[3] = { "Nearest", "Linear", "Tripoint" };
struct DjuiSelectionbox* selectionbox2 = djui_selectionbox_create(&body->base, "Filtering", filterChoices, 3, &configFiltering);

View file

@ -37,9 +37,9 @@ void djui_panel_options_debug_create(struct DjuiBase* caller) {
void djui_panel_misc_create(struct DjuiBase* caller) {
#ifdef DEVELOPMENT
f32 bodyHeight = 64 * 4 + 16 * 3;
f32 bodyHeight = 64 * 5 + 16 * 4;
#else
f32 bodyHeight = 64 * 3 + 16 * 2;
f32 bodyHeight = 64 * 4 + 16 * 3;
#endif
struct DjuiBase* defaultBase = NULL;
@ -52,6 +52,10 @@ void djui_panel_misc_create(struct DjuiBase* caller) {
djui_base_set_size(&checkbox1->base, 1.0f, 32);
defaultBase = &checkbox1->base;
struct DjuiCheckbox* checkbox2 = djui_checkbox_create(&body->base, "Disable Popups", &configDisablePopups);
djui_base_set_size_type(&checkbox2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&checkbox2->base, 1.0f, 32);
struct DjuiButton* button1 = djui_button_create(&body->base, "Menu Options");
djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button1->base, 1.0f, 64);

View file

@ -174,7 +174,7 @@ void produce_interpolation_frames_and_delay(void) {
gfx_start_frame();
f32 delta = MIN((curTime - sFrameTimeStart) / (sFrameTargetTime - sFrameTimeStart), 1);
gRenderingDelta = delta;
if (!skipInterpolationTitleScreen) { patch_interpolations(delta); }
if (!skipInterpolationTitleScreen || configFrameLimit > 30) { patch_interpolations(delta); }
send_display_list(gGfxSPTask);
gfx_end_frame();