From 3bfed33608d82d0ba9a5c0fa1bd54e5b04803ac5 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Tue, 13 Aug 2019 02:53:38 +0000 Subject: [PATCH] Add voxels option to menu, if at least one has been defined git-svn-id: https://svn.eduke32.com/eduke32@7961 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/engine.cpp --- source/build/include/build.h | 1 + source/build/src/engine.cpp | 10 ++++++---- source/duke3d/src/menus.cpp | 11 +++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 1b540a573..5bb0c6617 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -913,6 +913,7 @@ extern float debug1, debug2; extern int16_t tiletovox[MAXTILES]; extern int32_t usevoxels, voxscale[MAXVOXELS]; +extern char g_haveVoxels; #ifdef USE_OPENGL extern int32_t usemodels, usehightile; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index b85d79583..5586b36f5 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -102,8 +102,9 @@ void (*loadvoxel_replace)(int32_t voxindex) = NULL; int16_t tiletovox[MAXTILES]; int32_t usevoxels = 1; #ifdef USE_OPENGL -static char *voxfilenames[MAXVOXELS], g_haveVoxels=0; // for deferred voxel->model conversion +static char *voxfilenames[MAXVOXELS]; #endif +char g_haveVoxels; //#define kloadvoxel loadvoxel int32_t novoxmips = 1; @@ -10382,10 +10383,10 @@ static void videoAllocateBuffers(void) void (*PolymostProcessVoxels_Callback)(void) = NULL; static void PolymostProcessVoxels(void) { - if (!g_haveVoxels) + if (g_haveVoxels != 1) return; - g_haveVoxels = 0; + g_haveVoxels = 2; OSD_Printf("Generating voxel models for Polymost. This may take a while...\n"); videoNextPage(); @@ -10626,9 +10627,10 @@ int32_t qloadkvx(int32_t voxindex, const char *filename) Xfree(voxfilenames[voxindex]); voxfilenames[voxindex] = Xstrdup(filename); - g_haveVoxels = 1; #endif + g_haveVoxels = 1; + return 0; } diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index 2057cab40..566f0ec86 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -567,6 +567,9 @@ static MenuOption_t MEO_DISPLAYSETUP_ASPECTRATIO = MAKE_MENUOPTION(&MF_Redfont, static MenuEntry_t ME_DISPLAYSETUP_ASPECTRATIO = MAKE_MENUENTRY( "Widescreen:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_ASPECTRATIO, Option ); #endif +static MenuOption_t MEO_DISPLAYSETUP_VOXELS = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &usevoxels); +static MenuEntry_t ME_DISPLAYSETUP_VOXELS = MAKE_MENUENTRY( "Voxels:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_VOXELS, Option ); + static MenuRangeInt32_t MEO_DISPLAYSETUP_FOV = MAKE_MENURANGE( &ud.fov, &MF_Redfont, 70, 120, 0, 11, 1 ); static MenuEntry_t ME_DISPLAYSETUP_FOV = MAKE_MENUENTRY( "FOV:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_FOV, RangeInt32 ); @@ -741,6 +744,7 @@ static MenuEntry_t *MEL_DISPLAYSETUP[] = { #ifndef EDUKE32_ANDROID_MENU &ME_DISPLAYSETUP_VIDEOSETUP, &ME_DISPLAYSETUP_ASPECTRATIO, + &ME_DISPLAYSETUP_VOXELS, &ME_DISPLAYSETUP_FOV, #endif &ME_DISPLAYSETUP_UPSCALING, @@ -753,6 +757,7 @@ static MenuEntry_t *MEL_DISPLAYSETUP_GL[] = { #ifndef EDUKE32_ANDROID_MENU &ME_DISPLAYSETUP_VIDEOSETUP, &ME_DISPLAYSETUP_ASPECTRATIO, + &ME_DISPLAYSETUP_VOXELS, &ME_DISPLAYSETUP_FOV, #endif #ifndef EDUKE32_STANDALONE @@ -782,6 +787,7 @@ static MenuEntry_t *MEL_DISPLAYSETUP_GL_POLYMER[] = { #ifndef EDUKE32_ANDROID_MENU &ME_DISPLAYSETUP_VIDEOSETUP, &ME_DISPLAYSETUP_FOV, + &ME_DISPLAYSETUP_VOXELS, #endif #ifdef TEXFILTER_MENU_OPTIONS &ME_DISPLAYSETUP_TEXFILTER, @@ -1988,8 +1994,9 @@ static void Menu_Pre(MenuID_t cm) MenuEntry_DisableOnCondition(&ME_GAMESETUP_DEMOREC, (ps->gm&MODE_GAME) && ud.m_recstat != 1); break; -#ifdef USE_OPENGL case MENU_DISPLAYSETUP: + MenuEntry_HideOnCondition(&ME_DISPLAYSETUP_VOXELS, !g_haveVoxels); +#ifdef USE_OPENGL if (videoGetRenderMode() == REND_CLASSIC) MenuMenu_ChangeEntryList(M_DISPLAYSETUP, MEL_DISPLAYSETUP); #ifdef POLYMER @@ -2045,8 +2052,8 @@ static void Menu_Pre(MenuID_t cm) MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_DETAILTEX, !usehightile); MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_GLOWTEX, !usehightile); # endif - break; #endif + break; case MENU_VIDEOSETUP: {