diff --git a/src/engine/blend.cc b/src/engine/blend.cc index b7ceec7..3aaf397 100644 --- a/src/engine/blend.cc +++ b/src/engine/blend.cc @@ -4,7 +4,7 @@ #include "light.hh" #include "main.hh" // multiplayer #include "octaedit.hh" -#include "rendergl.hh" /* has* */ +#include "rendergl.hh" /* has*, worldpos */ #include "renderva.hh" #include "texture.hh" #include "world.hh" diff --git a/src/engine/dynlight.cc b/src/engine/dynlight.cc index 0a98d8e..d331652 100644 --- a/src/engine/dynlight.cc +++ b/src/engine/dynlight.cc @@ -1,6 +1,7 @@ #include "dynlight.hh" #include "pvs.hh" +#include "rendergl.hh" // camera1 #include "renderva.hh" #include diff --git a/src/engine/physics.cc b/src/engine/physics.cc index 9477983..cf27d7d 100644 --- a/src/engine/physics.cc +++ b/src/engine/physics.cc @@ -7,6 +7,7 @@ #include "console.hh" /* conoutf */ #include "main.hh" // player +#include "rendergl.hh" // camera1 #include "rendermodel.hh" #include "octa.hh" #include "world.hh" diff --git a/src/engine/pvs.cc b/src/engine/pvs.cc index 4e58d24..28461b7 100644 --- a/src/engine/pvs.cc +++ b/src/engine/pvs.cc @@ -4,6 +4,7 @@ #include "main.hh" // numcpus, interceptkey, renderbackground #include "octa.hh" #include "octarender.hh" // valist +#include "rendergl.hh" // camera1 #include "world.hh" #include diff --git a/src/engine/rendergl.cc b/src/engine/rendergl.cc index 751068c..6736de4 100644 --- a/src/engine/rendergl.cc +++ b/src/engine/rendergl.cc @@ -21,6 +21,8 @@ #include +static vec minimapcenter(0, 0, 0), minimapradius(0, 0, 0), minimapscale(0, 0, 0); + bool hasVAO = false, hasTR = false, hasTSW = false, hasPBO = false, hasFBO = false, hasAFBO = false, hasDS = false, hasTF = false, hasCBF = false, hasS3TC = false, hasFXT1 = false, hasLATC = false, hasRGTC = false, hasAF = false, hasFBB = false, hasFBMS = false, hasTMS = false, hasMSS = false, hasFBMSBS = false, hasUBO = false, hasMBR = false, hasDB2 = false, hasDBB = false, hasTG = false, hasTQ = false, hasPF = false, hasTRG = false, hasTI = false, hasHFV = false, hasHFP = false, hasDBT = false, hasDC = false, hasDBGO = false, hasEGPU4 = false, hasGPU4 = false, hasGPU5 = false, hasBFE = false, hasEAL = false, hasCR = false, hasOQ2 = false, hasES3 = false, hasCB = false, hasCI = false; bool mesa = false, intel = false, amd = false, nvidia = false; @@ -1342,7 +1344,8 @@ void pushhudtranslate(float tx, float ty, float sx, float sy) } int vieww = -1, viewh = -1; -float curfov, curavatarfov, fovy, aspect; +static float curfov, curavatarfov, aspect; +float fovy; int farplane; VARP(zoominvel, 0, 40, 500); VARP(zoomoutvel, 0, 50, 500); @@ -1356,12 +1359,6 @@ FVARNP(aspect, forceaspect, 0, 0, 1e3f); static float zoomprogress = 0; VAR(zoom, -1, 0, 1); -void disablezoom() -{ - zoom = 0; - zoomprogress = 0; -} - static void computezoom() { if(!zoom) { zoomprogress = 0; curfov = fov; curavatarfov = avatarfov; return; } @@ -1528,7 +1525,8 @@ matrix4 cammatrix, projmatrix, camprojmatrix, invcammatrix, invcamprojmatrix, in FVAR(nearplane, 0.01f, 0.54f, 2.0f); -vec calcavatarpos(const vec &pos, float dist) +#if 0 +static vec calcavatarpos(const vec &pos, float dist) { vec eyepos; cammatrix.transform(pos, eyepos); @@ -1543,6 +1541,7 @@ vec calcavatarpos(const vec &pos, float dist) vec dir = vec(worldpos).sub(camera1->o).rescale(dist); return dir.add(camera1->o); } +#endif void renderavatar() { @@ -2019,7 +2018,6 @@ static void drawfogoverlay(int fogmat, float fogbelow, float fogblend, int above int drawtex = 0; static GLuint minimaptex = 0; -vec minimapcenter(0, 0, 0), minimapradius(0, 0, 0), minimapscale(0, 0, 0); static void clearminimap() { @@ -2033,10 +2031,12 @@ VARFP(minimapsize, 7, 8, 10, { if(minimaptex) drawminimap(); }); VARFP(showminimap, 0, 1, 1, { if(minimaptex) drawminimap(); }); CVARFP(nominimapcolour, 0x101010, { if(minimaptex && !showminimap) drawminimap(); }); -void bindminimap() +#if 0 +static void bindminimap() { glBindTexture(GL_TEXTURE_2D, minimaptex); } +#endif static void clipminimap(ivec &bbmin, ivec &bbmax, cube *c = worldroot, const ivec &co = ivec(0, 0, 0), int size = worldsize>>1) { diff --git a/src/engine/rendergl.hh b/src/engine/rendergl.hh index bc2bc5c..ec97677 100644 --- a/src/engine/rendergl.hh +++ b/src/engine/rendergl.hh @@ -15,7 +15,7 @@ extern int maxdrawbufs, maxdualdrawbufs; enum { DRAWTEX_NONE = 0, DRAWTEX_ENVMAP, DRAWTEX_MINIMAP, DRAWTEX_MODELPREVIEW }; extern int vieww, viewh; -extern float fovy, aspect, forceaspect; +extern float fovy, forceaspect; extern float nearplane; extern int farplane; extern float ldrscale, ldrscaleb; @@ -37,6 +37,7 @@ extern void glerror(const char *file, int line, GLenum error); struct physent; // FIXME extern physent *camera1; // special ent that acts as camera, same object as player1 in FPS mode +extern vec worldpos, camdir, camright, camup; void gl_checkextensions(); void gl_init(); @@ -78,6 +79,8 @@ namespace modelpreview void end(); } +vec calcmodelpreviewpos(const vec &radius, float &yaw); + struct timer; timer *begintimer(const char *name, bool gpu = true); void endtimer(timer *t); @@ -88,4 +91,13 @@ void drawcubemap(int size, const vec &o, float yaw, float pitch, const cubemapsi void mousemove(int dx, int dy); +extern matrix4 hudmatrix; +void resethudmatrix(); +void pushhudmatrix(); +void flushhudmatrix(bool flushparams = true); +void pophudmatrix(bool flush = true, bool flushparams = true); +void pushhudscale(float sx, float sy = 0); +void pushhudtranslate(float tx, float ty, float sx = 0, float sy = 0); +void resethudshader(); + #endif diff --git a/src/engine/world.cc b/src/engine/world.cc index 32a7f90..10e2f8c 100644 --- a/src/engine/world.cc +++ b/src/engine/world.cc @@ -10,7 +10,7 @@ #include "octarender.hh" #include "physics.hh" #include "pvs.hh" -#include "rendergl.hh" /* fovy */ +#include "rendergl.hh" /* fovy, worldpos */ #include "renderlights.hh" #include "rendermodel.hh" // loadmapmodel #include "renderparticles.hh" diff --git a/src/game/game.cc b/src/game/game.cc index feec8fe..54975a1 100644 --- a/src/game/game.cc +++ b/src/game/game.cc @@ -118,8 +118,6 @@ namespace game void startgame() { - disablezoom(); - execident("mapstart"); } @@ -172,9 +170,6 @@ namespace game void gameplayhud(int w, int h) { - pushhudscale(h/1800.0f); - - pophudmatrix(); } float clipconsole(float w, float h) @@ -198,10 +193,6 @@ namespace game execfile("config/auth.cfg", false); } - void drawminimap(dynent *d, float x, float y, float s) - { - } - void writeclientinfo(stream *f) { } @@ -213,7 +204,6 @@ namespace game void edittoggled(bool on) { - disablezoom(); } void changemap(const char *name) diff --git a/src/shared/iengine.hh b/src/shared/iengine.hh index 02b4a7d..90f8840 100644 --- a/src/shared/iengine.hh +++ b/src/shared/iengine.hh @@ -85,31 +85,6 @@ extern void loopend(ident *id, identstack &stack); static inline void loopiter(ident *id, identstack &stack, int i) { tagval v; v.setint(i); loopiter(id, stack, v); } static inline void loopiter(ident *id, identstack &stack, float f) { tagval v; v.setfloat(f); loopiter(id, stack, v); } -// rendergl -extern physent *camera1; -extern vec worldpos, camdir, camright, camup; -extern float curfov, fovy, aspect; - -extern void disablezoom(); - -extern vec calcavatarpos(const vec &pos, float dist); -extern vec calcmodelpreviewpos(const vec &radius, float &yaw); - -extern void damageblend(int n); -extern void damagecompass(int n, const vec &loc); - -extern vec minimapcenter, minimapradius, minimapscale; -extern void bindminimap(); - -extern matrix4 hudmatrix; -extern void resethudmatrix(); -extern void pushhudmatrix(); -extern void flushhudmatrix(bool flushparams = true); -extern void pophudmatrix(bool flush = true, bool flushparams = true); -extern void pushhudscale(float sx, float sy = 0); -extern void pushhudtranslate(float tx, float ty, float sx = 0, float sy = 0); -extern void resethudshader(); - // physics extern vec collidewall; extern int collideinside;