new cvar: gl_conalpha, defaults to 0.6, guess what it does?

Speaking of conalpha, it works again, even in Mesa 3.1(!)
Don't build half of qw-client twice!  I thought I fixed that already?
UQuake-style quit dialogs in qw-client, beginnings of a menu.[ch] merge
This commit is contained in:
Joseph Carter 2000-03-05 15:48:23 +00:00
parent 3f6a8ade82
commit 56fd8d964a
7 changed files with 128 additions and 143 deletions

View file

@ -636,9 +636,9 @@ void Draw_ConsoleBackground (int lines)
qpic_t *conback;
static char saveback[320*8];
#ifdef QUAKEWORLD
char ver[] = "QuakeForge (Software QW) " QF_VERSION;
char ver[] = "QuakeForge (QW client) " QF_VERSION;
#else
char ver[] = "QuakeForge (Software UQ) " QF_VERSION;
char ver[] = "QuakeForge (UQuake) " QF_VERSION;
#endif
conback = Draw_CachePic ("gfx/conback.lmp");

View file

@ -39,6 +39,7 @@ cvar_t *gl_nobind;
cvar_t *gl_max_size;
cvar_t *gl_picmip;
cvar_t *gl_conspin;
cvar_t *gl_conalpha;
byte *draw_chars; // 8*8 graphic characters
qpic_t *draw_disc;
@ -50,10 +51,6 @@ int cs_texture; // crosshair 2 texture
int cs_texture3; // crosshair 3 texture
int bc_texture; // used for noclip
static byte bc_data[4] = {
0xfe, 0xfe, 0xfe, 0xfe
};
static byte cs_data[64] = {
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@ -96,8 +93,8 @@ typedef struct
float sl, tl, sh, th;
} glpic_t;
byte conback_buffer[sizeof(qpic_t) + sizeof(glpic_t)];
qpic_t *conback = (qpic_t *)conback_buffer;
//byte conback_buffer[sizeof(qpic_t) + sizeof(glpic_t)];
//qpic_t *conback = (qpic_t *)conback_buffer;
int gl_lightmap_format = 4;
int gl_solid_format = 3;
@ -390,15 +387,16 @@ Draw_Init
void Draw_Init (void)
{
int i;
qpic_t *cb;
glpic_t *gl;
int start;
byte *ncdata;
// qpic_t *cb;
// glpic_t *gl;
// int start;
// byte *ncdata;
gl_nobind = Cvar_Get ("gl_nobind","0",0,"None");
gl_max_size = Cvar_Get ("gl_max_size","1024",0,"None");
gl_picmip = Cvar_Get ("gl_picmip","0",0,"None");
gl_conspin = Cvar_Get ("gl_conspin", "0", CVAR_NONE, "None");
gl_conalpha = Cvar_Get ("gl_conalpha", "0.6", CVAR_NONE, "None");
// 3dfx can only handle 256 wide textures
if (!Q_strncasecmp ((char *)gl_renderer, "3dfx",4) ||
@ -421,73 +419,16 @@ void Draw_Init (void)
cs_texture3 = GL_LoadTexture ("crosshair3", 16, 16, cs_data3,
false, true);
cs_texture = GL_LoadTexture ("crosshair", 8, 8, cs_data, false, true);
bc_texture = GL_LoadTexture ("bctex", 2, 2, bc_data, false, true);
// For some reason which I cannot claim to fathom, it seems to be
// necessary to call GL_LoadTexture() here in descending (in terms
// of size) order else things don't work right. No idea why this
// is so.
// - knghtbrd (2 Jan 2000)
start = Hunk_LowMark ();
cb = (qpic_t *)COM_LoadHunkFile ("gfx/conback.lmp");
if (!cb)
Sys_Error ("Couldn't load gfx/conback.lmp");
SwapPic (cb);
#if 0
conback->width = vid.conwidth;
conback->height = vid.conheight;
// scale console to vid size
dest = ncdata = Hunk_AllocName(vid.conwidth * vid.conheight, "conback");
for (y=0 ; y<vid.conheight ; y++, dest += vid.conwidth)
{
src = cb->data + cb->width * (y*cb->height/vid.conheight);
if (vid.conwidth == cb->width)
memcpy (dest, src, vid.conwidth);
else
{
f = 0;
fstep = cb->width*0x10000/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x+=4)
{
dest[x] = src[f>>16];
f += fstep;
dest[x+1] = src[f>>16];
f += fstep;
dest[x+2] = src[f>>16];
f += fstep;
dest[x+3] = src[f>>16];
f += fstep;
}
}
}
#else
conback->width = cb->width;
conback->height = cb->height;
ncdata = cb->data;
#endif
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
gl = (glpic_t *)conback->data;
gl->texnum = GL_LoadTexture ("conback", conback->width, conback->height, ncdata, false, false);
gl->sl = 0;
gl->sh = 1;
gl->tl = 0;
gl->th = 1;
conback->width = vid.conwidth;
conback->height = vid.conheight;
// free loaded console
Hunk_FreeToLowMark (start);
// save a texture slot for translated picture
translate_texture = texture_extension_number++;
// save slots for scraps
scrap_texnum = texture_extension_number;
texture_extension_number += MAX_SCRAPS;
@ -500,7 +441,6 @@ void Draw_Init (void)
}
/*
================
Draw_Character
@ -812,8 +752,6 @@ void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation)
glEnd ();
}
#define SPIN_HACK 1
/*
================
Draw_ConsoleBackground
@ -823,12 +761,27 @@ Draw_ConsoleBackground
void Draw_ConsoleBackground (int lines)
{
#ifdef QUAKEWORLD
char ver[] = "QuakeForge (GL QW) " QF_VERSION;
char ver[] = "QuakeForge (QW client) " QF_VERSION;
#else
char ver[] = "QuakeForge (GL UQ) " QF_VERSION;
char ver[] = "QuakeForge (UQuake) " QF_VERSION;
#endif
int x, i;
int y;
int x, i;
int y;
qpic_t *conback;
glpic_t *gl;
float alpha;
int ofs;
conback = Draw_CachePic ("gfx/conback.lmp");
gl = (glpic_t *)conback->data;
y = (vid.height * 3) >> 2;
if (lines > y)
alpha = 1;
else
alpha = (float)(gl_conalpha->value * 2 * lines)/y;
ofs = vid.height == lines ? 0: 0-lines;
if (gl_conspin->value)
{
@ -848,12 +801,36 @@ void Draw_ConsoleBackground (int lines)
glScalef (xfactor, xfactor, xfactor);
}
y = (vid.height * 3) >> 2;
if (lines > y)
Draw_Pic(0, lines-vid.height, conback);
else
Draw_AlphaPic (0, lines - vid.height, conback,
(float)(1.2 * lines)/y);
GL_Bind (gl->texnum);
glColor4f (1,1,1,alpha);
if (alpha < 1.0)
{
glDisable(GL_ALPHA_TEST);
glEnable (GL_BLEND);
glCullFace(GL_FRONT);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
glBegin (GL_QUADS);
glTexCoord2f (gl->sl, gl->tl);
glVertex2f (0, ofs);
glTexCoord2f (gl->sh, gl->tl);
glVertex2f (vid.width, ofs);
glTexCoord2f (gl->sh, gl->th);
glVertex2f (vid.width, lines);
glTexCoord2f (gl->sl, gl->th);
glVertex2f (0, lines);
glEnd ();
if (alpha < 1.0)
{
glColor4f (1,1,1,1);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable(GL_ALPHA_TEST);
glDisable (GL_BLEND);
}
if (gl_conspin->value) {
glPopMatrix ();
glMatrixMode (GL_MODELVIEW);

View file

@ -24,8 +24,8 @@ BUILD_DIR := $(TARGET_DIR)/qw_client
OBJ_PATTERN := $(BUILD_DIR)/common_lib/%.@OBJEXT@ \
$(BUILD_DIR)/%.@OBJEXT@
DEP_PATTERN := $(BUILD_DIR)/%.d $(BUILD_DIR)/common_lib/%.d
GL_OBJ_PATTERN := $(BUILD_DIR)/gl/%.@OBJEXT@
GL_DEP_PATTERN := $(BUILD_DIR)/gl/%.d
#GL_OBJ_PATTERN := $(BUILD_DIR)/gl/%.@OBJEXT@
#GL_DEP_PATTERN := $(BUILD_DIR)/gl/%.d
LDFLAGS = @LDFLAGS@ @SOUND_LIBS@ @NET_LIBS@ -lm
LIBS = @LIBS@
@ -265,29 +265,29 @@ $(OBJ_PATTERN): $(QW_COMMON_DIR)/%.c
$(OBJ_PATTERN): $(QW_COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(GL_OBJ_PATTERN): $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
#$(GL_OBJ_PATTERN): $(SRC_DIR)/%.c
# $(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(GL_OBJ_PATTERN): $(SRC_DIR)/%.s
$(CC) $(CFLAGS) $(GL_CFLAGS) -x assembler-with-cpp -o $@ -c $<
#$(GL_OBJ_PATTERN): $(SRC_DIR)/%.s
# $(CC) $(CFLAGS) $(GL_CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(GL_OBJ_PATTERN): $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
#$(GL_OBJ_PATTERN): $(COMMON_DIR)/%.c
# $(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(GL_OBJ_PATTERN): $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) $(GL_CFLAGS) -x assembler-with-cpp -o $@ -c $<
#$(GL_OBJ_PATTERN): $(COMMON_DIR)/%.s
# $(CC) $(CFLAGS) $(GL_CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(GL_OBJ_PATTERN): $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
#$(GL_OBJ_PATTERN): $(QW_COMMON_DIR)/%.c
# $(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(GL_OBJ_PATTERN): $(QW_COMMON_DIR)/%.s
$(CC) $(CFLAGS) $(GL_CFLAGS) -x assembler-with-cpp -o $@ -c $<
#$(GL_OBJ_PATTERN): $(QW_COMMON_DIR)/%.s
# $(CC) $(CFLAGS) $(GL_CFLAGS) -x assembler-with-cpp -o $@ -c $<
client_DIR:
@DIR=client; $(MAKE_SURE_DIR)
gl_DIR:
@DIR=gl; $(MAKE_SURE_DIR)
#gl_DIR:
# @DIR=gl; $(MAKE_SURE_DIR)
###########################################################################
#
@ -456,8 +456,10 @@ ifneq ($(GLQUAKE),)
GLX_GL_SRC = gl_vidglx.c dga_check.c in_x11.c context_x11.c
ALL_GL_SRC = $(GL_REND_SRC) $(GLX_GL_SRC)
GL_REND_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
GL_REND_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\
$(basename $(GL_REND_SRC) .c .s)))
#GL_REND_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
# $(basename $(GL_REND_SRC) .c .s)))
GLX_GL_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\
$(basename $(GLX_GL_SRC) .c .s)))
@ -474,7 +476,7 @@ $(BUILD_DIR)/gl_vidglx.@OBJEXT@: $(COMMON_DIR)/gl_vidglx.c
$(BUILD_DIR)/dga_check.@OBJEXT@: $(COMMON_DIR)/dga_check.c
$(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $<
$(GLQUAKE): gl_DIR $(BUILD_DIR)/../$(GLQUAKE)
$(GLQUAKE): client_DIR $(BUILD_DIR)/../$(GLQUAKE)
$(BUILD_DIR)/../$(GLQUAKE): $(ALL_GL_OBJS)
$(CC) $(CFLAGS) $(ALL_GL_OBJS) $(GL_LDFLAGS) $(LDFLAGS) $(LIBS) \
@ -499,7 +501,7 @@ TDFX_LDFLAGS = @SVGA_LIBS@ @TDFXGL_LIBS@
$(BUILD_DIR)/gl_vidlinux_3dfx.@OBJEXT@: $(COMMON_DIR)/gl_vidlinux_3dfx.c
$(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $<
$(TDFXQUAKE): gl_DIR $(BUILD_DIR)/../$(TDFXQUAKE)
$(TDFXQUAKE): client_DIR $(BUILD_DIR)/../$(TDFXQUAKE)
$(BUILD_DIR)/../$(TDFXQUAKE): $(ALL_TDFX_OBJS)
$(CC) $(CFLAGS) $(ALL_TDFX_OBJS) $(TDFX_LDFLAGS) $(LDFLAGS) $(LIBS) \

View file

@ -1,4 +1,5 @@
/*
menu.c - menu system
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999-2000 Nelson Rush.
Copyright (C) 1999-2000 contributors of the QuakeForge project
@ -21,22 +22,27 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#include "winquake.h"
#include "qtypes.h"
#include "draw.h"
#include "keys.h"
#include "console.h"
#include "common.h"
#include "client.h"
#include "screen.h"
#include "cvar.h"
#include "menu.h"
#include "view.h"
#include "sound.h"
#include <quakedef.h>
#include <winquake.h>
#include <qtypes.h>
#include <draw.h>
#include <keys.h>
#include <console.h>
#include <common.h>
#include <client.h>
#include <screen.h>
#include <cvar.h>
#include <menu.h>
#include <view.h>
#include <sound.h>
enum {m_none, m_main, m_singleplayer, m_load, m_save, m_multiplayer, m_setup, m_net, m_options, m_video, m_keys, m_help, m_quit, m_serialconfig, m_modemconfig, m_lanconfig, m_gameoptions, m_search, m_slist} m_state;
enum {
m_none, m_main, m_singleplayer, m_load, m_save, m_multiplayer,
m_setup, m_net, m_options, m_video, m_keys, m_help, m_quit,
m_serialconfig, m_modemconfig, m_lanconfig, m_gameoptions,
m_search, m_slist
} m_state;
void M_Menu_Main_f (void);
void M_Menu_SinglePlayer_f (void);
@ -95,20 +101,20 @@ void M_GameOptions_Key (int key);
void M_Search_Key (int key);
void M_ServerList_Key (int key);
qboolean m_entersound; // play after drawing a frame, so caching
// won't disrupt the sound
qboolean m_entersound; // play after drawing a frame, so
// caching won't disrupt the sound
qboolean m_recursiveDraw;
int m_return_state;
int m_return_state;
qboolean m_return_onerror;
char m_return_reason [32];
#define StartingGame (m_multiplayer_cursor == 1)
#define JoiningGame (m_multiplayer_cursor == 0)
#define JoiningGame (m_multiplayer_cursor == 0)
#define SerialConfig (m_net_cursor == 0)
#define DirectConfig (m_net_cursor == 1)
#define IPXConfig (m_net_cursor == 2)
#define TCPIPConfig (m_net_cursor == 3)
#define IPXConfig (m_net_cursor == 2)
#define TCPIPConfig (m_net_cursor == 3)
void M_ConfigureNetSubsystem(void);
@ -162,7 +168,7 @@ byte translationTable[256];
void M_BuildTranslationTable(int top, int bottom)
{
int j;
int j;
byte *dest, *source;
for (j = 0; j < 256; j++)
@ -187,7 +193,8 @@ void M_BuildTranslationTable(int top, int bottom)
void M_DrawTransPicTranslate (int x, int y, qpic_t *pic)
{
Draw_TransPicTranslate (x + ((vid.width - 320)>>1), y, pic, translationTable);
Draw_TransPicTranslate (x + ((vid.width - 320)>>1), y, pic,
translationTable);
}
@ -304,7 +311,7 @@ void M_Menu_Main_f (void)
void M_Main_Draw (void)
{
int f;
qpic_t *p;
qpic_t *p;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
p = Draw_CachePic ("gfx/ttl_main.lmp");
@ -502,12 +509,6 @@ void M_DrawSlider (int x, int y, float range)
void M_DrawCheckbox (int x, int y, int on)
{
#if 0
if (on)
M_DrawCharacter (x, y, 131);
else
M_DrawCharacter (x, y, 129);
#endif
if (on)
M_Print (x, y, "on");
else
@ -855,7 +856,7 @@ void M_Keys_Key (int k)
static void
vid_menudraw(void)
{
qpic_t *p;
qpic_t *p;
p = Draw_CachePic("gfx/vidmodes.lmp");
M_DrawPic((320-p->width)/2,4,p);
@ -1106,7 +1107,7 @@ void M_Quit_Draw (void)
{
#define VSTR(x) #x
#define VSTR2(x) VSTR(x)
char *cmsg[] = {
/* char *cmsg[] = {
// 0123456789012345678901234567890123456789
"0 QuakeWorld",
"1 version " VERSION " by id Software",
@ -1132,7 +1133,7 @@ void M_Quit_Draw (void)
"0All rights reserved. Press y to exit",
NULL };
char **p;
int y;
int y;*/
if (wasInMenus)
{
@ -1141,7 +1142,7 @@ void M_Quit_Draw (void)
M_Draw ();
m_state = m_quit;
}
#if 1
#if 0
M_DrawTextBox (0, 0, 38, 23);
y = 12;
for (p = cmsg; *p; p++, y += 8) {

View file

@ -1,4 +1,5 @@
/*
menu.h - menu interface
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
@ -19,9 +20,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MENU_H
#define __MENU_H
#include "qtypes.h"
#include "draw.h"
#include <qtypes.h>
#include <draw.h>
//
// the net drivers should just set the apropriate bits in m_activenet,
@ -43,4 +46,5 @@ qpic_t *M_CachePic (char *path);
void M_DrawTextBox (int x, int y, int width, int lines);
void M_Menu_Quit_f (void);
#endif // __MENU_H

View file

@ -1206,12 +1206,6 @@ void M_DrawSlider (int x, int y, float range)
void M_DrawCheckbox (int x, int y, int on)
{
#if 0
if (on)
M_DrawCharacter (x, y, 131);
else
M_DrawCharacter (x, y, 129);
#endif
if (on)
M_Print (x, y, "on");
else

View file

@ -1,5 +1,8 @@
/*
menu.h - menu interface
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -18,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MENU_H
#define __MENU_H
//
// the net drivers should just set the apropriate bits in m_activenet,
// instead of having the menu code look through their internal tables
@ -35,4 +41,5 @@ void M_Keydown (int key);
void M_Draw (void);
void M_ToggleMenu_f (void);
#endif // __MENU_H