Now compiles and works fine in linux.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1300 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-09-09 23:40:55 +00:00
parent eb06704511
commit 348a1024be
19 changed files with 81 additions and 60 deletions

View File

@ -192,6 +192,7 @@ GLQUAKE_OBJS = \
gl_rlight.o \
gl_rmain.o \
gl_rmisc.o \
gl_heightmap.o \
gl_rsurf.o \
ltface.o \
gl_screen.o \
@ -275,6 +276,7 @@ COMMON_OBJS = $(COMMON_ASM_OBJS) \
cvar.o \
cmd.o \
crc.o \
fs.o \
mathlib.o \
huff.o \
md4.o \

View File

@ -3054,7 +3054,9 @@ void Host_Init (quakeparms_t *parms)
if (qrenderer == QR_NONE)
Con_Printf("Use the setrenderer command to use a gui\n");
#ifdef VM_UI
UI_Init();
#endif
#ifndef NOMEDIA
if (!cls.demofile && !cls.state && !media_filmtype)
@ -3118,7 +3120,9 @@ void Host_Shutdown(void)
}
isdown = true;
#ifdef VM_UI
UI_Stop();
#endif
Host_WriteConfiguration ();

View File

@ -2051,7 +2051,9 @@ void CLQ2_ParseConfigString (void)
CLQ2_ParseClientinfo (i-Q2CS_PLAYERSKINS, s);
}
#ifdef VM_UI
UI_StringChanged(i);
#endif
}
@ -3860,7 +3862,9 @@ void CLQ2_ParseServerMessage (void)
case svcq2_layout:
s = MSG_ReadString ();
Q_strncpyz (cl.q2layout, s, sizeof(cl.q2layout));
#ifdef VM_UI
UI_Q2LayoutChanged();
#endif
break;
case svcq2_inventory:
CLQ2_ParseInventory();

View File

@ -1254,7 +1254,9 @@ void SCR_SetUpToDrawConsole (void)
#ifdef TEXTEDITOR
&& !editoractive
#endif
#ifdef VM_UI
&& !UI_MenuState()
#endif
)
{
scr_conlines = vid.height; // full screen

View File

@ -1,11 +1,10 @@
#include "quakedef.h"
#ifdef VM_UI
#include "ui_public.h"
#include "cl_master.h"
int keycatcher;
#ifdef VM_UI
#include "clq3defs.h"
void GLDraw_ShaderImage (int x, int y, int w, int h, float s1, float t1, float s2, float t2, struct shader_s *pic);
@ -1629,25 +1628,5 @@ void UI_Init (void)
Cmd_AddRemCommand("ui_restart", UI_Restart_f);
UI_Start();
}
#else
qboolean UI_DrawStatusBar(int scores) {return false;}
qboolean UI_DrawFinale(void) {return false;}
qboolean UI_DrawIntermission(void) {return false;}
void UI_DrawMenu(void) {}
qboolean UI_CenterPrint(char *text, qboolean finale) {return false;}
qboolean UI_Q2LayoutChanged(void) {return false;}
void UI_StringChanged(int num) {}
void UI_Reset(void) {}
int UI_MenuState(void)
{
return false;
}
qboolean UI_KeyPress(int key, qboolean down) {return false;}
void UI_MousePosition(int xpos, int ypos) {}
void UI_Start (void){}
void UI_Stop (void) {}
void UI_Init (void) {}
#endif

View File

@ -320,7 +320,11 @@ void Con_ToggleConsole_f (void)
if (key_dest == key_console)
{
if (cls.state == ca_active || media_filmtype || UI_MenuState())
if (cls.state == ca_active || media_filmtype
#ifdef VM_UI
|| UI_MenuState()
#endif
)
key_dest = key_game;
}
else

View File

@ -1240,6 +1240,7 @@ void Key_Event (int key, qboolean down)
//
if (key == K_ESCAPE)
{
#ifdef VM_UI
#ifdef TEXTEDITOR
if (key_dest == key_game)
#endif
@ -1247,6 +1248,7 @@ void Key_Event (int key, qboolean down)
if (UI_KeyPress(key, down)) //Allow the UI to see the escape key. It is possible that a developer may get stuck at a menu.
return;
}
#endif
if (!down)
{
@ -1335,14 +1337,14 @@ void Key_Event (int key, qboolean down)
//
// if not a consolekey, send to the interpreter no matter what mode is
//
#ifdef VM_UI
if (key != '`' && key != '~')
if (key_dest == key_game || !down)
{
if (UI_KeyPress(key, down) && down) //UI is allowed to take these keydowns. Keyups are always maintained.
return;
}
#endif
if ( (key_dest == key_menu && menubound[key])
|| (key_dest == key_console && !consolekeys[key])

View File

@ -920,9 +920,9 @@ void M_Draw (int uimenu)
{
if (uimenu == 2)
Draw_FadeScreen ();
#ifdef VM_UI
UI_DrawMenu();
#endif
VID_UnlockBuffer ();
S_ExtraUpdate ();
VID_LockBuffer ();

View File

@ -1606,7 +1606,9 @@ TRACE(("dbg: R_ApplyRenderer: reloading ALL models\n"));
Con_Printf ("You may need to download or purchase a client "
"pack in order to play on this server.\n\n");
CL_Disconnect ();
#ifdef VM_UI
UI_Reset();
#endif
return false;
}
}
@ -1627,7 +1629,9 @@ TRACE(("dbg: R_ApplyRenderer: reloading ALL models\n"));
Con_Printf ("You may need to download or purchase a client "
"pack in order to play on this server.\n\n");
CL_Disconnect ();
#ifdef VM_UI
UI_Reset();
#endif
return false;
}
}
@ -1638,7 +1642,9 @@ TRACE(("dbg: R_ApplyRenderer: done the models\n"));
if (loadmodel->needload)
{
CL_Disconnect ();
#ifdef VM_UI
UI_Reset();
#endif
memcpy(&currentrendererstate, newr, sizeof(currentrendererstate));
return true;
}
@ -1658,8 +1664,10 @@ TRACE(("dbg: R_ApplyRenderer: efrags\n"));
}
}
}
#ifdef VM_UI
else
UI_Reset();
#endif
switch (qrenderer)
{

View File

@ -1581,10 +1581,12 @@ void Sbar_Draw (void)
return;
#endif
#ifdef VM_UI
if (UI_DrawStatusBar((sb_showscores?1:0) + (sb_showteamscores?2:0))>0)
return;
if (UI_MenuState())
return;
#endif
headsup = !(cl_sbar.value || (scr_viewsize.value<100&&cl.splitclients==1));
if ((sb_updates >= vid.numpages) && !headsup)
@ -2326,10 +2328,10 @@ void Sbar_IntermissionOverlay (void)
{
scr_copyeverything = 1;
scr_fullupdate = 0;
#ifdef VM_UI
if (UI_DrawIntermission()>0)
return;
#endif
if (cls.gamemode != GAME_DEATHMATCH)
Sbar_CoopIntermission();
else if (cl.teamplay > 0 && !sb_showscores)
@ -2350,10 +2352,10 @@ void Sbar_FinaleOverlay (void)
mpic_t *pic;
scr_copyeverything = 1;
#ifdef VM_UI
if (UI_DrawFinale()>0)
return;
#endif
pic = Draw_CachePic ("gfx/finale.lmp");
Draw_TransPic ( (vid.width-pic->width)/2, 16, pic);
}

View File

@ -114,7 +114,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define Q2CLIENT //client can connect to q2 servers
#define NQPROT //server and client are capable of using quake1/netquake protocols. (qw is still prefered. uses the command 'nqconnect')
#define FISH //sw rendering only
#define VM_UI //support userinterfaces within Q3 Virtual Machines
#define ZLIB //zip/pk3 support
#define WEBSERVER //http/ftp servers
#define WEBCLIENT //http/ftp clients.
@ -218,8 +217,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef Q3CLIENT
#undef VM_CG // :(
#undef VM_UI
#else
#define VM_CG
#define VM_UI
#endif
#if defined(VM_UI) || defined(VM_CG) || defined(Q3SERVER) || defined(PLUGINS)

View File

@ -259,7 +259,7 @@ char *VARGS va(char *format, ...);
//============================================================================
extern int com_file_copyprotected;
extern qboolean com_file_copyprotected;
extern int com_filesize;
struct cache_user_s;

View File

@ -2259,7 +2259,7 @@ void R_DrawMeshBumpmap(mesh_t *mesh, galiastexnum_t *skin, vec3_t lightdir)
else
{ //we don't support 3tmus, so draw the bumps, and multiply the rest over the top
qglDrawElements(GL_TRIANGLES, mesh->numindexes, GL_UNSIGNED_INT, mesh->indexes);
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
qglDisable(GL_TEXTURE_CUBE_MAP_ARB);
GL_MBind(mtexid0, skin->base);
}
GL_TexEnv(GL_MODULATE);
@ -2276,7 +2276,7 @@ void R_DrawMeshBumpmap(mesh_t *mesh, galiastexnum_t *skin, vec3_t lightdir)
qglDisable(GL_TEXTURE_2D);
GL_SelectTexture(mtexid1);
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
qglDisable(GL_TEXTURE_CUBE_MAP_ARB);
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
GL_TexEnv(GL_MODULATE);

View File

@ -1554,16 +1554,10 @@ void GLDraw_ShaderImage (int x, int y, int w, int h, float s1, float t1, float s
*/
draw_mesh.colors_array = draw_mesh_colors;
__try
{
R_PushMesh(&draw_mesh, mb.shader->features | MF_COLORS | MF_NONBATCHED);
R_RenderMeshBuffer ( &mb, false );
draw_mesh.colors_array = NULL;
qglEnable(GL_BLEND);
} __except(EXCEPTION_EXECUTE_HANDLER)
{
return;
};
R_PushMesh(&draw_mesh, mb.shader->features | MF_COLORS | MF_NONBATCHED);
R_RenderMeshBuffer ( &mb, false );
draw_mesh.colors_array = NULL;
qglEnable(GL_BLEND);
}
#endif

View File

@ -27,7 +27,6 @@ typedef struct {
unsigned short mins[SECTIONS*SECTIONS], maxs[SECTIONS*SECTIONS];
} heightmap_t;
#pragma comment(lib, "opengl32.lib")
#define DISPLISTS
//#define MULTITEXTURE //ATI suck. I don't know about anyone else.
@ -59,30 +58,30 @@ void GL_DrawHeightmapModel (entity_t *e)
mins[2] = 0;//hm->mins[x+y*SECTIONS];
mins[2] = 65535;//hm->maxs[x+y*SECTIONS];
// if (!BoundsIntersect(mins, maxs, r_refdef.vieworg, r_refdef.vieworg))
// if (!BoundsIntersect(mins, maxs, r_refdef.vieworg, r_refdef.vieworg))
// if (R_CullBox(mins, maxs))
// continue;
#ifdef DISPLISTS
if (!hm->displaylist[x+y*SECTIONS])
{
hm->displaylist[x+y*SECTIONS] = glGenLists(1);
glNewList(hm->displaylist[x+y*SECTIONS], GL_COMPILE_AND_EXECUTE);
hm->displaylist[x+y*SECTIONS] = qglGenLists(1);
qglNewList(hm->displaylist[x+y*SECTIONS], GL_COMPILE_AND_EXECUTE);
#endif
#ifdef MULTITEXTURE
if (qglActiveTextureARB)
{
qglActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, hm->textures[x+y*SECTIONS]);
bindTexFunc(GL_TEXTURE_2D, hm->textures[x+y*SECTIONS]);
qglActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, hm->detailtexture);
bindTexFunc(GL_TEXTURE_2D, hm->detailtexture);
qglEnable(GL_TEXTURE_2D);
subsize = hm->terrainsize/SECTIONS;
minx = x*subsize;
miny = y*subsize;
qglBegin(GL_QUADS);
for (vx = minx; vx < minx+hm->terrainsize/hm->numsegs; vx++)
{
@ -109,7 +108,7 @@ void GL_DrawHeightmapModel (entity_t *e)
else
#endif
{ //single texture
glBindTexture(GL_TEXTURE_2D, hm->textures[x+y*SECTIONS]);
bindTexFunc(GL_TEXTURE_2D, hm->textures[x+y*SECTIONS]);
qglBegin(GL_QUADS);
subsize = hm->terrainsize/hm->numsegs;
minx = x*subsize;
@ -130,7 +129,7 @@ void GL_DrawHeightmapModel (entity_t *e)
}
qglEnd();
glBindTexture(GL_TEXTURE_2D, hm->detailtexture);
bindTexFunc(GL_TEXTURE_2D, hm->detailtexture);
qglEnable(GL_BLEND);
qglBlendFunc (GL_ZERO, GL_SRC_COLOR);
@ -154,11 +153,11 @@ void GL_DrawHeightmapModel (entity_t *e)
qglDisable(GL_BLEND);
}
#ifdef DISPLISTS
glEndList();
qglEndList();
}
else
{
glCallList(hm->displaylist[x+y*SECTIONS]);
qglCallList(hm->displaylist[x+y*SECTIONS]);
}
#endif
}

View File

@ -1030,7 +1030,9 @@ TRACE(("dbg: GLR_NewMap: that skybox thang\n"));
R_LoadSkys ();
//#endif
TRACE(("dbg: GLR_NewMap: ui\n"));
#ifdef VM_UI
UI_Reset();
#endif
TRACE(("dbg: GLR_NewMap: tp\n"));
TP_NewMap();

View File

@ -203,7 +203,11 @@ void GLSCR_UpdateScreen (void)
return; // not initialized yet
}
#ifdef VM_UI
uimenu = UI_MenuState();
#else
uimenu = 0;
#endif
if (oldsbar != cl_sbar.value) {

View File

@ -6,6 +6,7 @@
void (APIENTRY *qglAlphaFunc) (GLenum func, GLclampf ref);
void (APIENTRY *qglBegin) (GLenum mode);
void (APIENTRY *qglBlendFunc) (GLenum sfactor, GLenum dfactor);
void (APIENTRY *qglCallList) (GLuint list);
void (APIENTRY *qglClear) (GLbitfield mask);
void (APIENTRY *qglClearColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void (APIENTRY *qglClearDepth) (GLclampd depth);
@ -27,9 +28,11 @@ void (APIENTRY *qglDrawBuffer) (GLenum mode);
void (APIENTRY *qglDrawPixels) (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
void (APIENTRY *qglEnable) (GLenum cap);
void (APIENTRY *qglEnd) (void);
void (APIENTRY *qglEndList) (void);
void (APIENTRY *qglFinish) (void);
void (APIENTRY *qglFlush) (void);
void (APIENTRY *qglFrustum) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
GLuint (APIENTRY *qglGenLists) (GLsizei range);
GLenum (APIENTRY *qglGetError) (void);
void (APIENTRY *qglGetFloatv) (GLenum pname, GLfloat *params);
void (APIENTRY *qglGetIntegerv) (GLenum pname, GLint *params);
@ -41,6 +44,7 @@ void (APIENTRY *qglNormal3f) (GLfloat nx, GLfloat ny, GLfloat nz);
void (APIENTRY *qglNormal3fv) (const GLfloat *v);
void (APIENTRY *qglMatrixMode) (GLenum mode);
void (APIENTRY *qglMultMatrixf) (const GLfloat *m);
void (APIENTRY *qglNewList) (GLuint list, GLenum mode);
void (APIENTRY *qglOrtho) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
void (APIENTRY *qglPolygonMode) (GLenum face, GLenum mode);
void (APIENTRY *qglPolygonOffset) (GLfloat factor, GLfloat units);
@ -231,7 +235,7 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
qglActiveTextureARB = (void *) getglext("glActiveTextureARB");
qglClientActiveTextureARB = (void *) getglext("glClientActiveTextureARB");
qglMultiTexCoord2fARB = (void *) getglext("glMultiTexCoord2fARB");
qglMultiTexCoord3fARB = (void *) getglext("glMultiTexCoord3fARB");
qglMultiTexCoord3fARB = (void *) getglext("glMultiTexCoord3fARB");
qglGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_mtexarbable);
gl_mtexable = true;
@ -548,6 +552,11 @@ void GL_Init(void *(*getglfunction) (char *name))
qglPolygonOffset = (void *)getglext("glPolygonOffset");
//used by heightmaps
qglGenLists = (void*)getglcore("glGenLists");
qglNewList = (void*)getglcore("glNewList");
qglEndList = (void*)getglcore("glEndList");
qglCallList = (void*)getglcore("glCallList");
gl_vendor = qglGetString (GL_VENDOR);

View File

@ -940,7 +940,11 @@ void IN_MouseMove (usercmd_t *cmd, int pnum)
mx = mouse_x;
my = mouse_y;
if (mouseusedforgui || (key_dest == key_menu && m_state == m_complex) || UI_MenuState())
if (mouseusedforgui || (key_dest == key_menu && m_state == m_complex)
#ifdef VM_UI
|| UI_MenuState()
#endif
)
{
mousemove_x += mouse_x;
mousemove_y += mouse_y;
@ -958,8 +962,9 @@ void IN_MouseMove (usercmd_t *cmd, int pnum)
if (mousecursor_y >= vid.height)
mousecursor_y = vid.height - 1;
mouse_x=mouse_y=0;
#ifdef VM_UI
UI_MousePosition(mousecursor_x, mousecursor_y);
#endif
}
if (m_filter.value)