Finish move of vid.c to libs, kill a few stragglers.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-04-15 05:36:56 +00:00
parent dbf0e3130e
commit 778f0c129c
7 changed files with 13 additions and 1578 deletions

View file

@ -20,7 +20,7 @@ libQFjs_la_CFLAGS= $(JOY_CFLAGS)
# Linux FBdev # Linux FBdev
YFLAGS = -d YFLAGS = -d
libQFfbdev_la_LDFLAGS= -version-info 1:0:0 libQFfbdev_la_LDFLAGS= -version-info 1:0:0
libQFfbdev_la_SOURCES= fbset.c fbset_modes_y.y fbset_modes_l.l vid_fbdev.c in_fbdev.c libQFfbdev_la_SOURCES= fbset.c fbset_modes_y.y fbset_modes_l.l in_fbdev.c vid.c vid_fbdev.c
YACCLEX_CLEANFILES= fbset_modes_y.c fbset_modes_y.h fbset_modes_y.tab.h fbset_modes_l.c YACCLEX_CLEANFILES= fbset_modes_y.c fbset_modes_y.h fbset_modes_y.tab.h fbset_modes_l.c
EXTRA_libQFfbdev_la_SOURCES=fbset_modes_y.h EXTRA_libQFfbdev_la_SOURCES=fbset_modes_y.h
@ -29,23 +29,23 @@ fbset_modes_y.lo: $(srcdir)/fbset_modes_y.c
fbset_modes_l.lo: $(srcdir)/fbset_modes_l.c fbset_modes_l.lo: $(srcdir)/fbset_modes_l.c
$(COMPILE) -Wno-error -c $< $(COMPILE) -Wno-error -c $<
##libQFmgl_la_LDFLAGS= -version-info 1:0:0 libQFmgl_la_LDFLAGS= -version-info 1:0:0
##libQFmgl_la_SOURCES= in_win.c vid_common_sw.c vid_mgl.c libQFmgl_la_SOURCES= in_win.c vid.c vid_common_sw.c vid_mgl.c
libQFsdl_la_LDFLAGS= -version-info 1:0:0 libQFsdl_la_LDFLAGS= -version-info 1:0:0
libQFsdl_la_SOURCES= in_sdl.c vid_common_sw.c vid_sdl.c libQFsdl_la_SOURCES= in_sdl.c vid.c vid_common_sw.c vid_sdl.c
libQFsvga_la_LDFLAGS= -version-info 1:0:0 libQFsvga_la_LDFLAGS= -version-info 1:0:0
libQFsvga_la_SOURCES= d_copy.S in_svgalib.c vid_common_sw.c vid_svgalib.c libQFsvga_la_SOURCES= d_copy.S in_svgalib.c vid.c vid_common_sw.c vid_svgalib.c
libQFx11_la_LDFLAGS= -version-info 1:0:0 libQFx11_la_LDFLAGS= -version-info 1:0:0
libQFx11_la_SOURCES= in_x11.c context_x11.c dga_check.c vid_common_sw.c vid_x11.c libQFx11_la_SOURCES= in_x11.c vid.c context_x11.c dga_check.c vid_common_sw.c vid_x11.c
libQFglx_la_LDFLAGS= -version-info 1:0:0 libQFglx_la_LDFLAGS= -version-info 1:0:0
libQFglx_la_SOURCES= in_x11.c context_x11.c dga_check.c vid_common_gl.c vid_glx.c libQFglx_la_SOURCES= in_x11.c vid.c context_x11.c dga_check.c vid_common_gl.c vid_glx.c
libQFsgl_la_LDFLAGS= -version-info 1:0:0 libQFsgl_la_LDFLAGS= -version-info 1:0:0
libQFsgl_la_SOURCES= in_sdl.c vid_common_gl.c vid_sgl.c libQFsgl_la_SOURCES= in_sdl.c vid.c vid_common_gl.c vid_sgl.c
libQFtdfx_la_LDFLAGS= -version-info 1:0:0 libQFtdfx_la_LDFLAGS= -version-info 1:0:0
libQFtdfx_la_SOURCES= in_svgalib.c vid_common_gl.c vid_3dfxsvga.c libQFtdfx_la_SOURCES= in_svgalib.c vid.c vid_common_gl.c vid_3dfxsvga.c
##libQFwgl_la_LDFLAGS= -version-info 1:0:0 libQFwgl_la_LDFLAGS= -version-info 1:0:0
##libQFwgl_la_SOURCES= in_win.c vid_wgl.c libQFwgl_la_SOURCES= in_win.c vid.c vid_wgl.c
LIBLIST = $(lib_LTLIBRARIES) @LIBRARY_SEARCH_PATH@ LIBLIST = $(lib_LTLIBRARIES) @LIBRARY_SEARCH_PATH@

View file

@ -78,7 +78,7 @@ client_LIB_DEPS= libqfnet.a
client_SOURCES= cl_cam.c cl_cmd.c cl_demo.c cl_input.c cl_main.c cl_parse.c \ client_SOURCES= cl_cam.c cl_cmd.c cl_demo.c cl_input.c cl_main.c cl_parse.c \
cl_tent.c console.c keys.c sbar.c r_part.c r_view.c \ cl_tent.c console.c keys.c sbar.c r_part.c r_view.c \
nonintel.c gib.c gib_instructions.c gib_vars.c \ nonintel.c gib.c gib_instructions.c gib_vars.c \
gib_interpret.c gib_modules.c gib_parse.c gib_stack.c vid.c gib_interpret.c gib_modules.c gib_parse.c gib_stack.c
server_SOURCES= host.c host_cmd.c \ server_SOURCES= host.c host_cmd.c \
pr_cmds.c \ pr_cmds.c \

View file

@ -1,180 +0,0 @@
/*
vid.c
general video driver functions
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <math.h>
#include "QF/compat.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/qargs.h"
#include "QF/sys.h"
#include "QF/va.h"
#include "QF/vid.h"
#include "view.h"
extern viddef_t vid; // global video state
/*
Software and hardware gamma support
*/
byte gammatable[256];
cvar_t *vid_gamma;
cvar_t *vid_system_gamma;
qboolean vid_gamma_avail; // hardware gamma availability
/*
Screen size
*/
int scr_width, scr_height;
cvar_t *vid_width;
cvar_t *vid_height;
void
VID_GetWindowSize (int def_w, int def_h)
{
int pnum;
vid_width = Cvar_Get ("vid_width", va ("%d", def_w), CVAR_NONE, NULL,
"screen width");
vid_height = Cvar_Get ("vid_height", va ("%d", def_h), CVAR_NONE, NULL,
"screen height");
if ((pnum = COM_CheckParm ("-width"))) {
if (pnum >= com_argc - 1)
Sys_Error ("VID: -width <width>\n");
Cvar_Set (vid_width, com_argv[pnum + 1]);
if (!vid_width->int_val)
Sys_Error ("VID: Bad window width\n");
}
if ((pnum = COM_CheckParm ("-height"))) {
if (pnum >= com_argc - 1)
Sys_Error ("VID: -height <height>\n");
Cvar_Set (vid_height, com_argv[pnum + 1]);
if (!vid_height->int_val)
Sys_Error ("VID: Bad window height\n");
}
if ((pnum = COM_CheckParm ("-winsize"))) {
if (pnum >= com_argc - 2)
Sys_Error ("VID: -winsize <width> <height>\n");
Cvar_Set (vid_width, com_argv[pnum + 1]);
Cvar_Set (vid_height, com_argv[pnum + 2]);
if (!vid_width->int_val || !vid_height->int_val)
Sys_Error ("VID: Bad window width/height\n");
}
Cvar_SetFlags (vid_width, vid_width->flags | CVAR_ROM);
Cvar_SetFlags (vid_height, vid_height->flags | CVAR_ROM);
scr_width = vid.width = vid_width->int_val;
scr_height = vid.height = vid_height->int_val;
}
/****************************************************************************
* GAMMA FUNCTIONS *
****************************************************************************/
void
VID_BuildGammaTable (double gamma)
{
int i;
gammatable[0] = 0;
if (gamma == 1.0) { // linear, don't bother with the math
for (i = 1; i < 255; i++) {
gammatable[i] = i;
}
} else {
double g = 1.0 / gamma;
int v;
for (i = 1; i < 255; i++) { // Build/update gamma lookup table
v = (int) ((255.0 * pow ((double) i / 255.0, g)) + 0.5);
gammatable[i] = bound (0, v, 255);
}
}
gammatable[255] = 255;
}
/*
VID_UpdateGamma
This is a callback to update the palette or system gamma whenever the
vid_gamma Cvar is changed.
*/
void
VID_UpdateGamma (cvar_t *vid_gamma)
{
double gamma = bound (0.1, vid_gamma->value, 9.9);
if (vid_gamma->flags & CVAR_ROM) // System gamma unavailable
return;
if (vid_gamma_avail && vid_system_gamma->int_val) { // Have system, use it
Con_DPrintf ("Setting hardware gamma to %g\n", gamma);
VID_BuildGammaTable (1.0); // hardware gamma wants a linear palette
VID_SetGamma (gamma);
} else { // We have to hack the palette
Con_DPrintf ("Setting software gamma to %g\n", gamma);
VID_BuildGammaTable (gamma);
V_UpdatePalette (); // update with the new palette
}
}
/*
VID_InitGamma
Initialize the vid_gamma Cvar, and set up the palette
*/
void
VID_InitGamma (unsigned char *pal)
{
int i;
double gamma = 1.45;
if ((i = COM_CheckParm ("-gamma"))) {
gamma = atof (com_argv[i + 1]);
}
gamma = bound (0.1, gamma, 9.9);
vid_gamma = Cvar_Get ("vid_gamma", va ("%f", gamma), CVAR_ARCHIVE,
VID_UpdateGamma, "Gamma correction");
VID_BuildGammaTable (vid_gamma->value);
}

View file

@ -118,7 +118,7 @@ endif
client_SOURCES= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \ client_SOURCES= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \
cl_main.c cl_misc.c cl_parse.c cl_pred.c cl_slist.c cl_tent.c \ cl_main.c cl_misc.c cl_parse.c cl_pred.c cl_slist.c cl_tent.c \
console.c keys.c locs.c model_alias.c model_sprite.c nonintel.c \ console.c keys.c locs.c model_alias.c model_sprite.c nonintel.c \
pcx.c r_efrag.c r_view.c sbar.c skin.c teamplay.c tga.c wad.c vid.c $(client_ASM) $(syscl_SRC) pcx.c r_efrag.c r_view.c sbar.c skin.c teamplay.c tga.c wad.c $(client_ASM) $(syscl_SRC)
# #
# Software-rendering clients # Software-rendering clients

File diff suppressed because it is too large Load diff

View file

@ -1,138 +0,0 @@
/*
* Linux Frame Buffer Device Configuration
*
* © Copyright 1995-1998 by Geert Uytterhoeven
* (Geert.Uytterhoeven@cs.kuleuven.ac.be)
*
* --------------------------------------------------------------------------
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of the Linux
* distribution for more details.
*/
%{
#define YYSTYPE long
#include <string.h>
#include <stdlib.h>
#define Die Sys_Error
#include "fbset.h"
#include "fbset_modes_y.h"
struct keyword {
const char *name;
int token;
int value;
};
static struct keyword keywords[] = {
{ "mode", MODE, 0 },
{ "geometry", GEOMETRY, 0 },
{ "timings", TIMINGS, 0 },
{ "hsync", HSYNC, 0 },
{ "vsync", VSYNC, 0 },
{ "csync", CSYNC, 0 },
{ "gsync", GSYNC, 0 },
{ "extsync", EXTSYNC, 0 },
{ "bcast", BCAST, 0 },
{ "laced", LACED, 0 },
{ "double", DOUBLE, 0 },
{ "rgba", RGBA, 0 },
{ "nonstd", NONSTD, 0 },
{ "accel", ACCEL, 0 },
{ "grayscale", GRAYSCALE, 0 },
{ "endmode", ENDMODE, 0 },
{ "low", POLARITY, LOW },
{ "high", POLARITY, HIGH },
{ "false", BOOLEAN, FALSE },
{ "true", BOOLEAN, TRUE },
{ "", -1, 0 }
};
int line = 1;
void yyerror(const char *s)
{
Die("%s:%d: %s\n", Opt_modedb, line, s);
}
int yywrap(void)
{
return 1;
}
static int FindToken(const char *s)
{
int i;
for (i = 0; keywords[i].token > 0; i++)
if (!strcasecmp(s, keywords[i].name)) {
return keywords[i].token;
}
Die("%s:%d: Unknown keyword `%s'\n", Opt_modedb, line, s);
}
static const char *CopyString(const char *s)
{
int len;
char *s2;
len = strlen(s)-2;
if (!(s2 = malloc(len+1)))
Die("No memory\n");
strncpy(s2, s+1, len);
s2[len] = '\0';
return s2;
}
%}
keyword [a-zA-Z][a-zA-Z0-9]*
number [0-9]*
string \"[^\"\n]*\"
comment \#([^\n]*)
space [ \t]+
junk .
%%
{keyword} {
yylval = FindToken(yytext);
return yylval;
}
{number} {
yylval = strtoul(yytext, NULL, 0);
return NUMBER;
}
{string} {
yylval = (unsigned long)CopyString(yytext);
return STRING;
}
{comment}$ break;
{space} break;
\n {
line++;
break;
}
{junk} {
Die("%s:%d: Invalid token `%s'\n", Opt_modedb, line, yytext);
}
%%

View file

@ -1,176 +0,0 @@
/*
* Linux Frame Buffer Device Configuration
*
* © Copyright 1995-1998 by Geert Uytterhoeven
* (Geert.Uytterhoeven@cs.kuleuven.ac.be)
*
* --------------------------------------------------------------------------
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of the Linux
* distribution for more details.
*/
%{
#define YYSTYPE long
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Die Sys_Error
#include "fbset.h"
extern int yylex(void);
extern void yyerror(const char *s);
extern int line;
static struct VideoMode VideoMode;
static void ClearVideoMode(void)
{
memset(&VideoMode, 0, sizeof(VideoMode));
VideoMode.accel_flags = FB_ACCELF_TEXT;
}
%}
%start file
%token MODE GEOMETRY TIMINGS HSYNC VSYNC CSYNC GSYNC EXTSYNC BCAST LACED DOUBLE
RGBA NONSTD ACCEL GRAYSCALE
ENDMODE POLARITY BOOLEAN STRING NUMBER
%%
file : vmodes
;
vmodes : /* empty */
| vmodes vmode
;
vmode : MODE STRING geometry timings options ENDMODE
{
VideoMode.name = (char *)$2;
AddVideoMode(&VideoMode);
ClearVideoMode();
}
;
geometry : GEOMETRY NUMBER NUMBER NUMBER NUMBER NUMBER
{
ClearVideoMode();
VideoMode.xres = $2;
VideoMode.yres = $3;
VideoMode.vxres = $4;
VideoMode.vyres = $5;
VideoMode.depth = $6;
}
;
timings : TIMINGS NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER
{
VideoMode.pixclock = $2;
VideoMode.left = $3;
VideoMode.right = $4;
VideoMode.upper = $5;
VideoMode.lower = $6;
VideoMode.hslen = $7;
VideoMode.vslen = $8;
}
;
options : /* empty */
| options hsync
| options vsync
| options csync
| options gsync
| options extsync
| options bcast
| options laced
| options double
| options rgba
| options nonstd
| options accel
| options grayscale
;
hsync : HSYNC POLARITY
{
VideoMode.hsync = $2;
}
;
vsync : VSYNC POLARITY
{
VideoMode.vsync = $2;
}
;
csync : CSYNC POLARITY
{
VideoMode.csync = $2;
}
;
gsync : GSYNC POLARITY
{
VideoMode.gsync = $2;
}
;
extsync : EXTSYNC BOOLEAN
{
VideoMode.extsync = $2;
}
;
bcast : BCAST BOOLEAN
{
VideoMode.bcast = $2;
}
;
laced : LACED BOOLEAN
{
VideoMode.laced = $2;
}
;
double : DOUBLE BOOLEAN
{
VideoMode.dblscan = $2;
}
;
rgba : RGBA STRING
{
makeRGBA(&VideoMode, (const char*)$2);
}
;
nonstd : NONSTD NUMBER
{
VideoMode.nonstd = $2;
}
;
accel : ACCEL BOOLEAN
{
VideoMode.accel_flags = $2;
}
;
grayscale : GRAYSCALE BOOLEAN
{
VideoMode.grayscale = $2;
}
;
%%