Improve DJUI scaling and other fixes

This commit is contained in:
Agent X 2023-11-24 19:48:46 -05:00
parent 7610fb2d02
commit 8dc10406be
7 changed files with 24 additions and 32 deletions

View file

@ -160,7 +160,7 @@ void first_person_update(void) {
Vec3f camDir = {
m->area->camera->focus[0] - m->area->camera->pos[0],
m->area->camera->focus[1] - m->area->camera->pos[1],
m->area->camera->focus[2] - m->area->camera->pos[2],
m->area->camera->focus[2] - m->area->camera->pos[2]
};
vec3f_normalize(camDir);
vec3f_mul(camDir, 100);

View file

@ -627,9 +627,7 @@ void configfile_load(void) {
void configfile_save(const char *filename) {
FILE *file;
#ifdef DEVELOPMENT
printf("Saving configuration to '%s'\n", filename);
#endif
file = fopen(fs_get_write_path(filename), "w");
if (file == NULL) {

View file

@ -48,11 +48,10 @@ f32 djui_gfx_get_scale(void) {
u32 windowWidth, windowHeight;
wm_api->get_dimensions(&windowWidth, &windowHeight);
switch (configDjuiScale) {
case 0: return 0.85f;
case 1: return 1.0f;
case 2: return 1.25f;
case 3: return 1.5f;
default: return 1.0f;
case 0: return 0.85f;
case 1: return 1.0f;
case 2: return 1.5f;
default: return 1.0f;
}
}
/////////////////////////////////////////////

View file

@ -80,7 +80,7 @@ static void djui_panel_host_do_host(struct DjuiBase* caller) {
if (gNetworkType == NT_SERVER) {
network_rehost_begin();
} else if (configNetworkSystem == NS_COOPNET) {
} else if (configNetworkSystem == NS_COOPNET || configAmountofPlayers == 1) {
extern void djui_panel_do_host(bool reconnecting);
network_reset_reconnect_and_rehost();
djui_panel_do_host(false);

View file

@ -2,13 +2,17 @@
#include "djui_theme.h"
#include "djui_panel.h"
#include "djui_panel_menu.h"
#include "djui_panel_pause.h"
#include "djui_panel_main.h"
#include "djui_panel_options.h"
#include "djui_panel_misc.h"
#include "src/pc/utils/misc.h"
#include "src/pc/configfile.h"
#include "src/game/level_update.h"
static struct DjuiSelectionbox* sLevelBox = NULL;
void djui_panel_main_menu_create(struct DjuiBase* caller);
static void djui_panel_level_menu(UNUSED struct DjuiBase* caller) {
djui_base_set_enabled(&sLevelBox->base, !(configMenuRandom || configMenuStaffRoll));
if (configMenuStaffRoll) {
@ -18,22 +22,16 @@ static void djui_panel_level_menu(UNUSED struct DjuiBase* caller) {
}
static void djui_panel_misc_djui_setting_change(UNUSED struct DjuiBase* caller) {
// god this is so hacky and terrible - djoslin0, 2023
if (gDjuiInMainMenu) {
djui_panel_shutdown();
gDjuiInMainMenu = true;
djui_panel_main_create(NULL);
djui_panel_options_create(NULL);
djui_panel_misc_create(NULL);
} else if (gDjuiPanelPauseCreated) {
djui_panel_shutdown();
djui_panel_pause_create(NULL);
djui_panel_options_create(NULL);
djui_panel_misc_create(NULL);
djui_panel_main_menu_create(NULL);
} else {
djui_panel_shutdown();
}
}
void djui_panel_main_menu_create(struct DjuiBase* caller) {
@ -62,7 +60,15 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) {
"WDW"
};
char* djuiScaleChoices[4] = {"x0.85", "x1.0", "x1.25", "x1.5"};
char* themeChoices[DJUI_THEME_MAX];
for (int i = 0; i < DJUI_THEME_MAX; i++) {
themeChoices[i] = (char*)gDjuiThemes[i]->name;
}
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_THEME), themeChoices, DJUI_THEME_MAX, &configDjuiTheme, djui_panel_misc_djui_setting_change);
char* djuiScaleChoices[3] = {"x0.85", "x1.0", "x1.5"};
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_SCALE), djuiScaleChoices, 3, &configDjuiScale, djui_panel_misc_djui_setting_change);
djui_checkbox_create(body, DLANG(DJUI_THEMES, CENTER), &configDjuiThemeCenter, djui_panel_misc_djui_setting_change);
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 18, &configMenuLevel, NULL);
djui_base_set_enabled(&selectionbox1->base, !(configMenuRandom || configMenuStaffRoll));
@ -73,16 +79,6 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) {
djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_level_menu);
djui_checkbox_create(body, DLANG(MENU_OPTIONS, PLAY_VANILLA_DEMOS), &configMenuDemos, stop_demo);
char* themeChoices[DJUI_THEME_MAX];
for (int i = 0; i < DJUI_THEME_MAX; i++) {
themeChoices[i] = (char*)gDjuiThemes[i]->name;
}
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_THEME), themeChoices, DJUI_THEME_MAX, &configDjuiTheme, djui_panel_misc_djui_setting_change);
djui_checkbox_create(body, DLANG(DJUI_THEMES, CENTER), &configDjuiThemeCenter, djui_panel_misc_djui_setting_change);
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_SCALE), djuiScaleChoices, 4, &configDjuiScale, djui_panel_misc_djui_setting_change);
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
}

View file

@ -4,7 +4,6 @@
#include "djui_panel_menu_options.h"
#include "djui_panel_main.h"
#include "djui_panel_options.h"
//#include "djui_panel_pause.h"
#include "djui_panel_language.h"
#include "djui_panel_info.h"
#include "pc/utils/misc.h"

View file

@ -172,9 +172,9 @@ struct DjuiTheme* gDjuiThemes[] = {
};
struct DjuiColor djui_theme_shade_color(struct DjuiColor color) {
color.r *= 0.75f;
color.g *= 0.75f;
color.b *= 0.75f;
color.r *= 0.6f;
color.g *= 0.6f;
color.b *= 0.6f;
return color;
}