drop menus.cc

This commit is contained in:
q66 2020-05-13 00:30:58 +02:00
parent a3cd090fb8
commit a986fdb2df
6 changed files with 23 additions and 99 deletions

View file

@ -15,7 +15,6 @@ client_src = [
'../engine/light.cc',
'../engine/main.cc',
'../engine/material.cc',
'../engine/menus.cc',
'../engine/movie.cc',
'../engine/normal.cc',
'../engine/octa.cc',

View file

@ -225,6 +225,11 @@ extern void writebinds(stream *f);
extern void writecompletions(stream *f);
// main
extern int mainmenu;
extern void clearmainmenu();
enum
{
NOT_INITING = 0,
@ -234,13 +239,7 @@ enum
};
extern int initing, numcpus;
enum
{
CHANGE_GFX = 1<<0,
CHANGE_SOUND = 1<<1,
CHANGE_SHADERS = 1<<2
};
extern bool initwarning(const char *desc, int level = INIT_RESET, int type = CHANGE_GFX);
extern bool initwarning(const char *desc, int level = INIT_RESET, int type = 0);
extern bool grabinput, minimized;
@ -340,15 +339,6 @@ extern bool hasskybox();
extern bool limitsky();
extern void cleanupsky();
// menus
extern int mainmenu;
extern void addchange(const char *desc, int type);
extern void clearchanges(int type);
extern void menuprocess();
extern void clearmainmenu();
// grass
extern void loadgrassshaders();
extern void generategrass();

View file

@ -10,6 +10,8 @@
#include "engine.hh"
VAR(mainmenu, 1, 1, 0);
void clientkeepalive() {}
bool multiplayer(bool msg)
@ -22,6 +24,15 @@ bool isconnected(bool attempt, bool local)
return haslocalclients();
}
void clearmainmenu()
{
if(mainmenu && isconnected())
{
mainmenu = 0;
//UI::hideui(NULL);
}
}
void localdisconnect(bool cleanup)
{
game::gamedisconnect(cleanup);
@ -114,7 +125,7 @@ bool initwarning(const char *desc, int level, int type)
{
if(initing < level)
{
addchange(desc, type);
//addchange(desc, type);
return true;
}
return false;
@ -606,7 +617,7 @@ void setupscreen()
void resetgl()
{
clearchanges(CHANGE_GFX|CHANGE_SHADERS);
//clearchanges(CHANGE_GFX|CHANGE_SHADERS);
renderbackground("resetting OpenGL");
@ -1178,7 +1189,7 @@ int main(int argc, char **argv)
checkinput();
//UI::update();
menuprocess();
//menuprocess();
tryedit();
if(lastmillis) game::updateworld();

View file

@ -1,78 +0,0 @@
#include "engine.hh"
void notifywelcome()
{
//UI::hideui("servers");
}
struct change
{
int type;
const char *desc;
change() {}
change(int type, const char *desc) : type(type), desc(desc) {}
};
static vector<change> needsapply;
VARP(applydialog, 0, 1, 1);
VAR(hidechanges, 0, 0, 1);
void addchange(const char *desc, int type)
{
if(!applydialog) return;
loopv(needsapply) if(!strcmp(needsapply[i].desc, desc)) return;
needsapply.add(change(type, desc));
//if(!hidechanges) UI::showui("changes");
}
void clearchanges(int type)
{
loopvrev(needsapply)
{
change &c = needsapply[i];
if(c.type&type)
{
c.type &= ~type;
if(!c.type) needsapply.remove(i);
}
}
//if(needsapply.empty()) UI::hideui("changes");
}
void applychanges()
{
int changetypes = 0;
loopv(needsapply) changetypes |= needsapply[i].type;
if(changetypes&CHANGE_GFX) execident("resetgl");
else if(changetypes&CHANGE_SHADERS) execident("resetshaders");
if(changetypes&CHANGE_SOUND) execident("resetsound");
}
COMMAND(applychanges, "");
ICOMMAND(pendingchanges, "b", (int *idx), { if(needsapply.inrange(*idx)) result(needsapply[*idx].desc); else if(*idx < 0) intret(needsapply.length()); });
static int lastmainmenu = -1;
void menuprocess()
{
if(lastmainmenu != mainmenu)
{
lastmainmenu = mainmenu;
execident("mainmenutoggled");
}
//if(mainmenu && !isconnected(true) && !UI::hascursor()) UI::showui("main");
}
VAR(mainmenu, 1, 1, 0);
void clearmainmenu()
{
hidechanges = 0;
if(mainmenu && isconnected())
{
mainmenu = 0;
//UI::hideui(NULL);
}
}

View file

@ -9,6 +9,8 @@
#include "engine.hh"
#define CHANGE_SHADERS 0
int gw = -1, gh = -1, bloomw = -1, bloomh = -1, lasthdraccum = 0;
GLuint gfbo = 0, gdepthtex = 0, gcolortex = 0, gnormaltex = 0, gglowtex = 0, gdepthrb = 0, gstencilrb = 0;
bool gdepthinit = false;

View file

@ -1559,7 +1559,7 @@ void reloadshaders()
void resetshaders()
{
clearchanges(CHANGE_SHADERS);
//clearchanges(CHANGE_SHADERS);
cleanuplights();
cleanupmodels();