diff --git a/configure.in b/configure.in index 6c831b6b7..729724091 100644 --- a/configure.in +++ b/configure.in @@ -101,7 +101,7 @@ AC_HEADER_SYS_WAIT AC_CHECK_HEADERS( arpa/inet.h asm/io.h assert.h conio.h ctype.h ddraw.h dinput.h \ direct.h dirent.h dlfcn.h dmedia/audio.h dmedia/cdaudio.h dpmi.h \ - dsound.h errno.h fcntl.h fnmatch.h ggi/ggi.h glide/sst1vid.h io.h \ + dsound.h errno.h fcntl.h fnmatch.h glide/sst1vid.h io.h \ libc.h limits.h linux/cdrom.h linux/joystick.h linux/soundcard.h \ machine/soundcard.h malloc.h math.h mgraph.h _mingw.h netdb.h \ netinet/in.h pwd.h setjmp.h signal.h stdarg.h stdio.h stdlib.h \ @@ -371,39 +371,6 @@ AC_SUBST(HAVE_MGL) AC_SUBST(MGL_CFLAGS) AC_SUBST(MGL_LIBS) -dnl Checks for LibGGI support -AC_ARG_WITH(ggi, -[ --with-ggi[=DIR] use LibGGI found in DIR], -HAVE_GGI=$withval, HAVE_GGI=auto) -if test "x$HAVE_GGI" != xno; then - if test "x$HAVE_GGI" != xauto; then - GGI_CFLAGS="$GGI_CFLAGS= -I$withval/include" - GGI_LIBS="$GGI_LIBS -L$withval/lib" - dnl The default system location is /usr/include or /usr/local/include - dnl and we (obviously) do not need to set CFLAGS for that - fi - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $GGI_CFLAGS" - AC_CHECK_HEADER(ggi/ggi.h, HAVE_GGI=yes, HAVE_GGI=no) - CPPFLAGS="$save_CPPFLAGS" - - dnl Make sure -lggi works - if test "x$HAVE_GGI" = xyes; then - AC_CHECK_LIB(ggi, ggiEventsQueued, - GGI_LIBS="$GGI_LIBS -lggi" - HAVE_GGI=yes, - HAVE_GGI=no, - [$GGI_LIBS] - ) - fi - if test "x$HAVE_GGI" != xyes; then - GGI_CFLAGS="" GGI_LIBS="" - fi -fi -AC_SUBST(HAVE_GGI) -AC_SUBST(GGI_CFLAGS) -AC_SUBST(GGI_LIBS) - dnl Checks for Linux FBDev support AC_ARG_WITH(fbdev, [ --with-fbdev use Linux framebuffer device], @@ -1290,14 +1257,13 @@ dnl ================================================================== AC_ARG_WITH(clients, [ --with-clients= compile clients in ; - 3dfx,fbdev,ggi,glx,mgl,sdl,sgl,svga,x11], + 3dfx,fbdev,glx,mgl,sdl,sgl,svga,x11], clients="$withval", clients="all" ) if test "$clients" = "all"; then ENABLE_3DFX=yes ENABLE_FBDEV=yes - ENABLE_GGI=yes ENABLE_GLX=yes ENABLE_MGL=yes ENABLE_SDL=yes @@ -1307,7 +1273,6 @@ if test "$clients" = "all"; then else ENABLE_3DFX=no ENABLE_FBDEV=no - ENABLE_GGI=no ENABLE_GLX=no ENABLE_MGL=no ENABLE_SDL=no @@ -1323,9 +1288,6 @@ else fbdev) ENABLE_FBDEV=yes ;; - ggi) - ENABLE_GGI=yes - ;; glx) ENABLE_GLX=yes ;; @@ -1367,11 +1329,6 @@ if test "x$HAVE_FBDEV" = xyes -a "x$ENABLE_FBDEV" = xyes; then NQ_TARGETS="$NQ_TARGETS nq-fbdev\$(EXEEXT)" CL_TARGETS="$CL_TARGETS FBDEV" fi -if test "x$HAVE_GGI" = xyes -a "x$ENABLE_GGI" = xyes; then - QW_TARGETS="$QW_TARGETS qw-client-ggi\$(EXEEXT)" - NQ_TARGETS="$NQ_TARGETS nq-ggi\$(EXEEXT)" - CL_TARGETS="$CL_TARGETS GGI" -fi if test "x$HAVE_X" = xyes; then if test "x$HAVE_GLX" = xyes -a "x$ENABLE_GLX" = xyes; then QW_TARGETS="$QW_TARGETS qw-client-glx\$(EXEEXT)" diff --git a/debian/Makefile.am b/debian/Makefile.am index 6ef6f7d05..45bfbd413 100644 --- a/debian/Makefile.am +++ b/debian/Makefile.am @@ -5,8 +5,6 @@ EXTRA_DIST= changelog control copyright rules \ quakeforge.conf \ qf-client-3dfx.dirs qf-client-3dfx.docs qf-client-3dfx.files \ qf-client-3dfx.suid qf-client-3dfx.undocumented \ - qf-client-ggi.dirs qf-client-ggi.docs qf-client-ggi.files \ - qf-client-ggi.undocumented \ qf-client-glx.dirs qf-client-glx.docs qf-client-glx.files \ qf-client-glx.undocumented \ qf-client-sdl.dirs qf-client-sdl.docs qf-client-sdl.files \ diff --git a/debian/control b/debian/control index 212398d23..53a076286 100644 --- a/debian/control +++ b/debian/control @@ -27,19 +27,6 @@ Description: First-person shooter Internet game - common files . This package contains files common to all QuakeForge packages. -Package: qf-client-ggi -Architecture: any -Depends: ${shlibs:Depends}, quake-game -Suggests: joystick -Provides: qf-client -Description: First-person shooter Internet game - GGI client - QuakeForge is a source port of Quake and QuakeWorld, the successors to id - Software's very popular DOOM series. Its primary development goal is to - remain compatible with the original games released by id Software while - adding portability and optional extensions to enhance gameplay. - . - This package contains the GGI version of the QuakeForge client. - Package: qf-client-sdl Architecture: i386 Depends: ${shlibs:Depends}, libsdl1.1, quake-game diff --git a/debian/qf-client-ggi.dirs b/debian/qf-client-ggi.dirs deleted file mode 100644 index 33359b876..000000000 --- a/debian/qf-client-ggi.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/games diff --git a/debian/qf-client-ggi.docs b/debian/qf-client-ggi.docs deleted file mode 100644 index e9a45a6e6..000000000 --- a/debian/qf-client-ggi.docs +++ /dev/null @@ -1,3 +0,0 @@ -INSTALL -README -NEWS diff --git a/debian/qf-client-ggi.files b/debian/qf-client-ggi.files deleted file mode 100644 index f28d9ed95..000000000 --- a/debian/qf-client-ggi.files +++ /dev/null @@ -1 +0,0 @@ -usr/games/qf-client-ggi diff --git a/debian/qf-client-ggi.undocumented b/debian/qf-client-ggi.undocumented deleted file mode 100644 index 3165a3cbb..000000000 --- a/debian/qf-client-ggi.undocumented +++ /dev/null @@ -1 +0,0 @@ -qf-client-ggi.6 diff --git a/doc/qf-client-ggi-cvar.txt b/doc/qf-client-ggi-cvar.txt deleted file mode 100644 index dd2eaacee..000000000 --- a/doc/qf-client-ggi-cvar.txt +++ /dev/null @@ -1,157 +0,0 @@ - * _snd_mixahead : Delay time for sounds - * _windowed_mouse : Have Quake grab the mouse from X when you play - ambient_fade : How quickly ambient sounds fade in or out - ambient_level : Ambient sounds' volume - baseskin : default base skin name - * bgmvolume : Volume of CD music - brighten : User-created cvar - * brightness : Brightness level - cl_anglespeedkey : turn `run' speed multiplier -r cl_autoexec : exec autoexec.cfg on gamedir change - * cl_backspeed : backward speed - cl_bob : How much your weapon moves up and down when walking - cl_bobcycle : How quickly your weapon moves up and down when walking - cl_bobup : How long your weapon stays up before cycling when walking - cl_camera_maxpitch : highest camera pitch in spectator mode - cl_camera_maxyaw : highest camera yaw in spectator mode - cl_chasecam : get first person view of the person you are tracking in spectator mode - cl_chatmode : Controls when console text will be treated as a chat message - * cl_crossx : Sets the position of the crosshair on the X-axis - * cl_crossy : Sets the position of the crosshair on the Y-axis - * cl_cshift_bonus : Show bonus flash on item pickup - * cl_cshift_content : Shift view colors for contents (water, slime, etc) - * cl_cshift_damage : Shift view colors on damage - * cl_cshift_powerup : Shift view colors for powerups - cl_deadbodyfilter : Hide dead player models - * cl_forwardspeed : forward speed - cl_gibfilter : Hide gibs - cl_hightrack : view the player with the highest frags while in spectator mode. - * cl_hudswap : new HUD on left side? - * cl_maxfps : maximum frames rendered in one second. 0 == 32 - cl_movespeedkey : move `run' speed multiplier - cl_nodelta : disable player delta compression.set to 1 if you have a poor ISP and get a lot of U_REMOVE warnings. - cl_nofake : Unhide fake messages - cl_nopred : Set to turn off client prediction - cl_parsesay : Use .loc files to find your present location when you put %l in messages - cl_pitchspeed : look up/down speed - cl_predict_players : If this and cl_predict_players2 is 0, no player prediction is done - cl_predict_players2 : If this and cl_predict_players is 0, no player prediction is done - cl_rollangle : How much your screen tilts when strafing - cl_rollspeed : How quickly you straighten out after strafing - * cl_sbar : status bar mode - * cl_sbar_separator : turns on status bar separator - cl_shownet : show network packets. 0=off, 1=basic, 2=verbose - cl_sidespeed : strafe speed - cl_solid_players : Are players solid? If off, you can walk through them with difficulty - * cl_timeout : server connection timeout (since last packet received) - cl_upspeed : swim/fly up/down speed - cl_verstring : Client version string - cl_warncmd : inform when execing a command - cl_yawspeed : turning speed - con_notifytime : How long in seconds messages are displayed on screen registered : Is the game the registered version. 1 yes 0 no - * confirm_quit : confirm quit command - * contrast : Contrast level - * crosshair : Crosshair type. 0 off, 1 old, 2 new with color - * crosshaircolor : Crosshair 2's color - d_mipcap : Detail level. 0 is highest, 3 is lowest. - d_mipscale : Detail level of objects. 0 is highest, 3 is lowest. - d_subdiv16 : Set to enable extreme perspective correction - developer : show info interesting to developers -0 - never, 1 - always, 2 - smart - fov : field of view. 90 is normal, smaller numbers zoom - * freelook : force +mlook -r fs_basegame : game to use by default -r fs_globalcfg : global configuration file -r fs_sharepath : location of shared (read only) game directories -r fs_userpath : location of your game directories - gl_affinemodels : User-created cvar - gl_colorlights : User-created cvar - gl_flashblend : Toggles the type of lighting for objects - * gl_sky_divide : subdivide sky polys - * gl_subdivide_size : Sets the division value for the sky brushes. - gl_texturemode : User-created cvar - gl_triplebuffer : User-created cvar - host_speeds : display host processing times - in_dga : User-created cvar -r joy_device : Joystick device - * joy_enable : Joystick enable flag - * joy_sensitivity : Joystick sensitivity - loadas8bit : Toggles if sounds are loaded as 8-bit samples - localid : FIXME: nobody knows what this does. - * lookspring : Snap view to center when moving and no mlook/klook - * lookstrafe : when mlook/klook on player will strafe - * m_filter : Mouse input filtering - m_forward : mouse forward/back speed - * m_pitch : mouse pitch (up/down) multipier - m_side : mouse strafe speed - m_yaw : mouse yaw (left/right) multiplier - *u name : Player name - s no_pogo_stick : disable the ability to pogo stick - *u noaim : Auto aiteam : Team player is on. - noskins : set to 1 to not download new skins - nosound : Set to turn sound off - u password : Server password - precache : Toggle the use of a precache - pushlatency : How much prediction should the client make - qport : The internal port number for the game networking code.Useful for clients who use multiple connections through one IP address (NAT/IP-MASQ) because default port is random. - r_aliastransadj : Determines how much of an alias model is clipped away and how much is viewable. - r_aliastransbase : Determines how much of an alias model is clipped away and how much is viewable - r_ambient : Determines the ambient lighting for a level - r_clearcolor : This sets the color for areas outside of the current map - r_drawentities : Toggles the drawing of entities. - r_drawflat : Toggles the drawing of textures - r_draworder : Toggles drawing order - * r_drawviewmodel : Toggles the drawing of your weapon - r_dspeeds : Toggles the display of drawing speed information - * r_firecolor : color of rocket and lava ball fires - r_graphheight : Set the number of lines displayed in the various graphs - r_maxedges : Sets the maximum number of surfaces - r_maxsurfs : Sets the maximum number of surfaces - r_netgraph : Toggle the display of a graph showing network performance - r_numedges : Toggles the displaying of number of edges currently being viewed - r_numsurfs : Toggles the displaying of number of surfaces currently being viewed - r_polymodelstats : Toggles the displays of number of polygon models current being viewed - r_reportedgeout : Toggle the display of how many edges where not displayed - r_reportsurfout : Toggle the display of how many surfaces where not displayed - r_speeds : Toggles the displaying of drawing time andstatistics of what is currently being viewed - r_timegraph : Toggle the display of a performance graph - r_waterwarp : Toggles whether surfaces are warped in a liquid. - r_zgraph : Toggle the graph that reports the changes of z-axis position - rcon_address : server IP address when client not connected - for sending rcon commands - rcon_password : remote control password - scr_centertime : How long in seconds the screen hints are displayed on the screen - scr_conspeed : How quickly in the console screen scrolls up and down - scr_printspeed : How fast the text is displayed at the end of the single player episodes - * sensitivity : mouse sensitivity multiplier - show_fps : display realtime frames per second - show_time : display the current time - showdrop : Toggle the display of how many packets you are dropping - showpackets : Show all network packets - showpause : Show paused graphic when paused - showram : Show ram icon when low on ram in game - showturtle : Show turtle icon when fps is lower than 10 - *u skin : Players skin - * snd_interp : control sample interpolation - * snd_phasesep : max stereo phase separation in ms. 0.6 is for 20cm head - snd_show : Toggles the display of sounds currently being played snd_noextraupdate : Toggles the correct value display in host_speeds. Usually messes up sound playback when in effect - * snd_volumesep : max stereo volume separation in ms. 1.0 is max - u spectator : Set to 1 before connecting to become a spectator - sys_nostdout : set to disable std out - v_centermove : How far the player must move forward before the view re-centers - v_centerspeed : How quickly you return to a center view after a lookup or lookdown - v_idlescale : Toggles whether the view remains idle - v_ipitch_cycle : How quickly you lean forwards and backwards when v_idlescale is enabled - v_ipitch_level : How far you lean forwards and backwards when v_idlescale is enabled - v_iroll_cycle : How quickly you tilt right and left when v_idlescale is enabled - v_iroll_level : How far you tilt right and left when v_idlescale is enabled - v_iyaw_cycle : How far you tilt right and left when v_idlescale is enabled - v_iyaw_level : How far you tilt right and left when v_idlescale is enabled - v_kickpitch : How much you look up when hit - v_kickroll : How much you lean when hit - v_kicktime : How long the kick from an attack lasts - vid_fullscreen : User-created cvar -r vid_height : screen height - vid_use8bit : User-created cvar -r vid_width : screen width - * viewsize : Set the screen size 30 minimum, 120 maximum - * volume : Set the volume for sound playback diff --git a/nq/source/.gitignore b/nq/source/.gitignore index f9fe0adff..d64e5307b 100644 --- a/nq/source/.gitignore +++ b/nq/source/.gitignore @@ -5,7 +5,6 @@ *.obj Makefile Makefile.in -nq-ggi nq-glx nq-sdl nq-svga diff --git a/nq/source/Makefile.am b/nq/source/Makefile.am index 4910f48f9..c17c4f9a9 100644 --- a/nq/source/Makefile.am +++ b/nq/source/Makefile.am @@ -30,11 +30,11 @@ # # Stuff that is common to both client and server # -INCLUDES= -I$(top_srcdir)/include -I$(top_srcdir)/nq/include $(GGI_CFLAGS) $(MGL_CFLAGS) $(SDL_CFLAGS) $(SVGA_CFLAGS) $(X_CFLAGS) $(GLX_CFLAGS) $(TDFXGL_CFLAGS) +INCLUDES= -I$(top_srcdir)/include -I$(top_srcdir)/nq/include $(MGL_CFLAGS) $(SDL_CFLAGS) $(SVGA_CFLAGS) $(X_CFLAGS) $(GLX_CFLAGS) $(TDFXGL_CFLAGS) bin_PROGRAMS = @NQ_TARGETS@ -EXTRA_PROGRAMS= nq-ggi nq-mgl nq-sdl \ +EXTRA_PROGRAMS= nq-mgl nq-sdl \ nq-svga nq-x11 nq-3dfx \ nq-glx nq-sgl nq-wgl nq-server @@ -154,15 +154,6 @@ soft_SOURCES= d_edge.c d_fill.c d_init.c d_modech.c d_part.c d_polyse.c \ r_surf.c r_vars.c screen.c sw_model_alias.c sw_model_brush.c \ sw_model_sprite.c sw_view.c $(soft_ASM) -# -# ... GGI -# -ggi_SOURCES= vid_ggi.c - -nq_ggi_SOURCES= $(combined_SOURCES) $(soft_SOURCES) $(ggi_SOURCES) -nq_ggi_LDADD= $(client_LIBS) $(GGI_LIBS) -nq_ggi_DEPENDENCIES=libqfsys.a libqfsnd.a libqfcd.a libqfjs.a libqfnet.a - # # ... SciTech MGL # diff --git a/nq/source/gl_screen.c b/nq/source/gl_screen.c index 448e7fc82..1361f6d03 100644 --- a/nq/source/gl_screen.c +++ b/nq/source/gl_screen.c @@ -883,6 +883,7 @@ void SCR_BringDownConsole (void) void SCR_TileClear (void) { +#if 0 if (r_refdef.vrect.x > 0) { // left Draw_TileClear (0, 0, r_refdef.vrect.x, vid.height - sb_lines); @@ -903,6 +904,7 @@ void SCR_TileClear (void) vid.height - sb_lines - (r_refdef.vrect.height + r_refdef.vrect.y)); } +#endif } float oldsbar = 0; diff --git a/nq/source/vid_ggi.c b/nq/source/vid_ggi.c deleted file mode 100644 index f309e3d70..000000000 --- a/nq/source/vid_ggi.c +++ /dev/null @@ -1,1027 +0,0 @@ -/* - vid_ggi.c - - general LibGGI video driver - - Copyright (C) 1996-1997 Id Software, Inc. - Copyright (C) 1999 Marcus Sundberg [mackan@stacken.kth.se] - - 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$ -*/ - -#define _BSD - - -#ifdef HAVE_CONFIG_H -# include -#endif -#include -#include -#include -#include -#include - -#include "bspfile.h" // needed by: glquake.h -#include "vid.h" -#include "sys.h" -#include "mathlib.h" // needed by: protocol.h, render.h, client.h, - // modelgen.h, glmodel.h -#include "wad.h" -#include "draw.h" -#include "cvar.h" -#include "net.h" // needed by: client.h -#include "protocol.h" // needed by: client.h -#include "cmd.h" -#include "keys.h" -#include "sbar.h" -#include "sound.h" -#include "render.h" // needed by: client.h, gl_model.h, glquake.h -#include "client.h" // need cls in this file -#include "host.h" -#include "model.h" // needed by: glquake.h -#include "console.h" -#include "qendian.h" -#include "qargs.h" -#include "compat.h" -#include "d_local.h" -#include "input.h" -#include "view.h" -#include "joystick.h" - -extern viddef_t vid; // global video state -unsigned short d_8to16table[256]; - -cvar_t *m_filter; -cvar_t *_windowed_mouse; - -/* Unused */ -int VGA_width, VGA_height, VGA_rowbytes, VGA_bufferrowbytes, VGA_planar; -byte *VGA_pagebase; - -#define NUM_STDBUTTONS 3 -#define NUM_BUTTONS 10 - -static qboolean mouse_avail; -static float mouse_x, mouse_y; -static float old_mouse_x, old_mouse_y; -static int p_mouse_x, p_mouse_y; -static float old_windowed_mouse; - -static ggi_visual_t ggivis = NULL; -static ggi_mode mode; -static const ggi_directbuffer *dbuf1 = NULL, *dbuf2 = NULL; - -static uint8 *drawptr = NULL; -static void *frameptr[2] = { NULL, NULL }; -static void *oneline = NULL; -static void *palette = NULL; -static int curframe = 0; - -static int realwidth, realheight; -static int doublebuffer; -static int scale; -static int stride, drawstride; -static int pixelsize; -static int usedbuf, havedbuf; - -int VID_options_items = 1; - -static void -do_scale8(int xsize, int ysize, uint8 *dest, uint8 *src) -{ - int i, j, destinc = stride*2-xsize*2; - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; /* i is incremented below */) { - register uint32 pix1 = src[i++], pix2 = src[i++]; -#ifdef GGI_LITTLE_ENDIAN - *((uint32 *) (dest + stride)) - = *((uint32 *) dest) - = (pix1 | (pix1 << 8) - | (pix2 << 16) | (pix2 << 24)); -#else - *((uint32 *) (dest + stride)) - = *((uint32 *) dest) - = (pix2 | (pix2 << 8) - | (pix1 << 16) | (pix1 << 24)); -#endif - dest += 4; - } - dest += destinc; - src += xsize; - } -} - -static void -do_scale16(int xsize, int ysize, uint8 *dest, uint8 *src) -{ - int i, j, destinc = stride*2-xsize*4; - uint16 *palptr = palette; - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; /* i is incremented below */) { - register uint32 pixel = palptr[src[i++]]; - *((uint32 *) (dest + stride)) - = *((uint32 *) dest) - = pixel | (pixel << 16); - dest += 4; - } - dest += destinc; - src += xsize; - } -} - -static void -do_scale32(int xsize, int ysize, uint8 *dest, uint8 *src) -{ - int i, j, destinc = stride*2-xsize*8; - uint32 *palptr = palette; - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; /* i is incremented below */) { - register uint32 pixel = palptr[src[i++]]; - *((uint32 *) (dest + stride)) - = *((uint32 *) (dest)) = pixel; - dest += 4; - *((uint32 *) (dest + stride)) - = *((uint32 *) (dest)) = pixel; - dest += 4; - } - dest += destinc; - src += xsize; - } -} - - -static void -do_copy8(int xsize, int ysize, uint8 *dest, uint8 *src) -{ - int i, j; - uint8 *palptr = palette; - - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; i++) { - dest[i] = palptr[src[i]]; - } - dest += stride; - src += xsize; - } -} - -static void -do_copy16(int xsize, int ysize, void *destptr, uint8 *src) -{ - int i, j, destinc = (stride/2 - xsize)/2; - uint16 *palptr = palette; - uint32 *dest = destptr; - - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; /* i is incremented below */) { - register uint32 pixel = palptr[src[i++]]; -#ifdef GGI_LITTLE_ENDIAN - *(dest++) = pixel | (palptr[src[i++]] << 16); -#else - *(dest++) = (palptr[src[i++]] << 16) | pixel; -#endif - } - dest += destinc; - src += xsize; - } -} - -static void -do_copy32(int xsize, int ysize, uint32 *dest, uint8 *src) -{ - int i, j, destinc = stride/4; - uint32 *palptr = palette; - - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; i++) { - dest[i] = palptr[src[i]]; - } - dest += destinc; - src += xsize; - } -} - - -void -ResetFrameBuffer(void) -{ - int tbuffersize, tcachesize; - void *vid_surfcache; - - // Calculate the sizes we want first - tbuffersize = vid.width * vid.height * sizeof (*d_pzbuffer); - tcachesize = D_SurfaceCacheForRes(vid.width, vid.height); - - // Free the old z-buffer - if (d_pzbuffer) { - free (d_pzbuffer); - d_pzbuffer = NULL; - } - - // Free the old surface cache - vid_surfcache = D_SurfaceCacheAddress (); - if (vid_surfcache) { - D_FlushCaches (); - free (vid_surfcache); - vid_surfcache = NULL; - } - - // Allocate the new z-buffer - d_pzbuffer = calloc (tbuffersize, 1); - if (!d_pzbuffer) { - Sys_Error ("Not enough memory for video mode\n"); - } - - // Allocate the new surface cache; free the z-buffer if we fail - vid_surfcache = calloc (tcachesize, 1); - if (!vid_surfcache) { - free (d_pzbuffer); - d_pzbuffer = NULL; - Sys_Error ("Not enough memory for video mode\n"); - } - - D_InitCaches (vid_surfcache, tcachesize); -} - - -// Called at startup to set up translation tables, takes 256 8 bit RGB values -// the palette data will go away after the call, so it must be copied off if -// the video driver will need it again - -void -VID_Init (unsigned char *pal) -{ - int pnum; - - vid.width = GGI_AUTO; - vid.height = GGI_AUTO; - - srandom(getpid()); - - if (ggiInit() < 0) { - Sys_Error("VID: Unable to init LibGGI\n"); - } - ggivis = ggiOpen(NULL); - if (!ggivis) { - Sys_Error("VID: Unable to open default visual\n"); - } - - /* Go into async mode */ - ggiSetFlags(ggivis, GGIFLAG_ASYNC); - - /* check for command-line window size */ - if ((pnum=COM_CheckParm("-winsize"))) - { - if (pnum >= com_argc-2) - Sys_Error("VID: -winsize \n"); - vid.width = atoi(com_argv[pnum+1]); - vid.height = atoi(com_argv[pnum+2]); - if (!vid.width || !vid.height) - Sys_Error("VID: Bad window width/height\n"); - } - if ((pnum=COM_CheckParm("-width"))) { - if (pnum >= com_argc-1) - Sys_Error("VID: -width \n"); - vid.width = atoi(com_argv[pnum+1]); - if (!vid.width) - Sys_Error("VID: Bad window width\n"); - } - if ((pnum=COM_CheckParm("-height"))) { - if (pnum >= com_argc-1) - Sys_Error("VID: -height \n"); - vid.height = atoi(com_argv[pnum+1]); - if (!vid.height) - Sys_Error("VID: Bad window height\n"); - } - - scale = COM_CheckParm("-scale"); - - /* specify a LibGGI mode */ - if ((pnum=COM_CheckParm("-ggimode"))) - { - if (pnum >= com_argc-1) - Sys_Error("VID: -ggimode \n"); - ggiParseMode(com_argv[pnum+1], &mode); - } else { - /* This will give the default mode */ - ggiParseMode("", &mode); - /* Now put in any parameters given above */ - mode.visible.x = vid.width; - mode.visible.y = vid.height; - } - - if (scale) { - mode.visible.x *= 2; - mode.visible.y *= 2; - } - - /* We prefer 8 bit mode unless otherwise specified */ - if (mode.graphtype == GT_AUTO) mode.graphtype = GT_8BIT; - - /* We want double buffering if possible */ - if (mode.frames == GGI_AUTO) { - ggi_mode tmpmode = mode; - - tmpmode.frames = 2; - if (ggiCheckMode(ggivis, &tmpmode) == 0) { - mode = tmpmode; - } else { - tmpmode.frames = 2; - if (ggiCheckMode(ggivis, &tmpmode) == 0) { - mode = tmpmode; - } - } - } - - if (ggiSetMode(ggivis, &mode) != 0) { - /* Try again with suggested mode */ - if (ggiSetMode(ggivis, &mode) != 0) { - Sys_Error("VID: LibGGI can't set any modes!\n"); - } - } - - /* Pixel size must be 1, 2 or 4 bytes */ - if (GT_SIZE(mode.graphtype) != 8 && - GT_SIZE(mode.graphtype) != 16 && - GT_SIZE(mode.graphtype) != 32) { - if (GT_SIZE(mode.graphtype) == 24) { - Sys_Error("VID: 24 bits per pixel not supported - try using the palemu target.\n"); - } else { - Sys_Error("VID: %d bits per pixel not supported by GGI Quake.\n", - GT_SIZE(mode.graphtype)); - } - } - - realwidth = mode.visible.x; - realheight = mode.visible.y; - if (scale) { - vid.width = realwidth / 2; - vid.height = realheight / 2; - } else { - vid.width = realwidth; - vid.height = realheight; - } - - if (mode.frames >= 2) doublebuffer = 1; - else doublebuffer = 0; - - pixelsize = (GT_SIZE(mode.graphtype)+7) / 8; - if (mode.graphtype != GT_8BIT) { - if ((palette = malloc(pixelsize*256)) == NULL) { - Sys_Error("VID: Unable to allocate palette table\n"); - } - } - - VID_SetPalette(pal); - - usedbuf = havedbuf = 0; - drawstride = vid.width; - stride = realwidth*pixelsize; - if ((dbuf1 = ggiDBGetBuffer(ggivis, 0)) != NULL && - (dbuf1->type & GGI_DB_SIMPLE_PLB)) { - havedbuf = 1; - stride = dbuf1->buffer.plb.stride; - if (doublebuffer) { - if ((dbuf2 = ggiDBGetBuffer(ggivis, 1)) == NULL || - !(dbuf2->type & GGI_DB_SIMPLE_PLB)) { - /* Only one DB? No double buffering then */ - doublebuffer = 0; - } - } - if (doublebuffer) { - fprintf(stderr, "VID: Got two DirectBuffers\n"); - } else { - fprintf(stderr, "VID: Got one DirectBuffer\n"); - } - if (doublebuffer && !scale && !palette) { - usedbuf = 1; - drawstride = stride; - frameptr[0] = dbuf1->write; - if (doublebuffer) { - frameptr[1] = dbuf2->write; - } else { - frameptr[1] = frameptr[0]; - } - drawptr = frameptr[0]; - fprintf(stderr, "VID: Drawing into DirectBuffer\n"); - } - } - - if (!usedbuf) { - if ((drawptr = malloc(vid.width * vid.height)) == NULL) { - Sys_Error("VID: Unable to allocate draw buffer\n"); - } - if (!havedbuf && (scale || palette)) { - int linesize = pixelsize*realwidth; - if (scale) linesize *= 4; - if ((oneline = malloc(linesize)) == NULL) { - Sys_Error("VID: Unable to allocate line buffer\n"); - } - } - fprintf(stderr, - "VID: Drawing into offscreen memory\n"); - } - - ResetFrameBuffer(); - - curframe = 0; - vid.maxwarpwidth = WARP_WIDTH; - vid.maxwarpheight = WARP_HEIGHT; - vid.numpages = doublebuffer ? 2 : 1; - vid.colormap = host_colormap; - vid.buffer = drawptr; - vid.rowbytes = drawstride; - vid.direct = drawptr; - vid.conbuffer = vid.buffer; - vid.conrowbytes = vid.rowbytes; - vid.conwidth = vid.width; - vid.conheight = vid.height; - vid.aspect = ((float)vid.height / (float)vid.width) * (320.0 / 240.0); - vid.fullbright = 256 - LittleLong (*((int *)vid.colormap + 2048)); -} - -void -VID_ShiftPalette(unsigned char *pal) -{ - VID_SetPalette(pal); -} - - -void -VID_SetPalette (unsigned char *pal) -{ - - int i; - ggi_color colors[256]; - - for (i=0 ; i<256 ; i++) { - colors[i].r = pal[i*3] * 257; - colors[i].g = pal[i*3+1] * 257; - colors[i].b = pal[i*3+2] * 257; - } - if (palette) { - ggiPackColors(ggivis, palette, colors, 256); - } else { - ggiSetPalette(ggivis, 0, 256, colors); - } -} - -// Called at shutdown - -void -VID_Shutdown (void) -{ - Con_Printf("VID_Shutdown\n"); - - if (!usedbuf) { - free(drawptr); - drawptr = NULL; - } - if (oneline) { - free(oneline); - oneline = NULL; - } - if (palette) { - free(palette); - palette = NULL; - } - if (ggivis) { - ggiClose(ggivis); - ggivis = NULL; - } - ggiExit(); -} - - -// flushes the given rectangles from the view buffer to the screen - -void -VID_Update (vrect_t *rects) -{ - int height = 0; - -#if 0 -// if the window changes dimension, skip this frame - - if (config_notify) - { - fprintf(stderr, "config notify\n"); - config_notify = 0; - vid.width = config_notify_width & ~7; - vid.height = config_notify_height; - if (doShm) - ResetSharedFrameBuffers(); - else - ResetFrameBuffer(); - vid.rowbytes = x_framebuffer[0]->bytes_per_line; - vid.buffer = x_framebuffer[curframe]->data; - vid.conbuffer = vid.buffer; - vid.conwidth = vid.width; - vid.conheight = vid.height; - vid.conrowbytes = vid.rowbytes; - vid.recalc_refdef = 1; // force a surface cache flush - Con_CheckResize(); - Con_Clear_f(); - return; - } - - // force full update if not 8bit - if (x_visinfo->depth != 8) { - extern int scr_fullupdate; - - scr_fullupdate = 0; - } -#endif - - while (rects) { - int y = rects->y + rects->height; - if (y > height) height = y; - rects = rects->pnext; - } - - if (!usedbuf) { - int i; - - if (havedbuf) { - if (ggiResourceAcquire(dbuf1->resource, - GGI_ACTYPE_WRITE) != 0 || - (doublebuffer ? - ggiResourceAcquire(dbuf2->resource, - GGI_ACTYPE_WRITE) != 0 - : 0)) { - ggiPanic("Unable to acquire DirectBuffer!\n"); - } - /* ->write is allowed to change at acquire time */ - frameptr[0] = dbuf1->write; - if (doublebuffer) { - frameptr[1] = dbuf2->write; - } else { - frameptr[1] = frameptr[0]; - } - } - if (scale) { - switch (pixelsize) { - case 1: if (havedbuf) { - do_scale8(vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - for (i=0; i < height; i++) { - do_scale8(vid.width, 1, oneline,buf); - ggiPutBox(ggivis, 0, i*2, realwidth, - 2, oneline); - buf += vid.width; - } - } - break; - case 2: if (havedbuf) { - do_scale16(vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - for (i=0; i < height; i++) { - do_scale16(vid.width, 1, - oneline, buf); - ggiPutBox(ggivis, 0, i*2, realwidth, - 2, oneline); - buf += vid.width; - } - } - break; - case 4: if (havedbuf) { - do_scale32(vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - for (i=0; i < height; i++) { - do_scale32(vid.width, 1, - oneline, buf); - ggiPutBox(ggivis, 0, i*2, realwidth, - 2, oneline); - buf += vid.width; - } - } - break; - } - } else if (palette) { - switch (pixelsize) { - case 1: if (havedbuf) { - do_copy8(vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - for (i=0; i < height; i++) { - do_copy8(vid.width, 1, oneline,buf); - ggiPutBox(ggivis, 0, i, realwidth, - 1, oneline); - buf += vid.width; - } - } - break; - case 2: if (havedbuf) { - do_copy16(vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - for (i=0; i < height; i++) { - do_copy16(vid.width, 1, - oneline, buf); - ggiPutBox(ggivis, 0, i, realwidth, - 1, oneline); - buf += vid.width; - } - } - break; - case 4: if (havedbuf) { - do_copy32(vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - for (i=0; i < height; i++) { - do_copy32(vid.width, 1, - oneline, buf); - ggiPutBox(ggivis, 0, i, realwidth, - 1, oneline); - buf += vid.width; - } - } - break; - } - } else { - ggiPutBox(ggivis, 0, 0, vid.width, height, - drawptr); - } - if (havedbuf) { - ggiResourceRelease(dbuf1->resource); - if (doublebuffer) { - ggiResourceRelease(dbuf2->resource); - } - } - - } - - if (doublebuffer) { - ggiSetDisplayFrame(ggivis, curframe); - curframe = !curframe; - if (usedbuf) { - vid.buffer = vid.conbuffer = vid.direct - = drawptr = frameptr[curframe]; - } - ggiSetWriteFrame(ggivis, curframe); - } - -#if 0 - if (GT_SIZE(mode.graphtype) == 16) { - do_copy16(vid.width, height, - (uint16*)frameptr, drawptr); - } else if (GT_SIZE(mode.graphtype) == 32) { - do_copy32(vid.width, height, - (uint32*)frameptr, drawptr); - } -#endif - - ggiFlush(ggivis); -} - -void D_BeginDirectRect(int x, int y, byte *pbitmap, int width, int height) -{ -// direct drawing of the "accessing disk" icon isn't supported under Linux -} - -void D_EndDirectRect (int x, int y, int width, int height) -{ -// direct drawing of the "accessing disk" icon isn't supported under Linux -} - - -/* -*************************************************************************** - Input handling -*************************************************************************** -*/ - -static int XLateKey(ggi_key_event *ev) -{ - int key = 0; - - if (GII_KTYP(ev->label) == GII_KT_DEAD) { - ev->label = GII_KVAL(ev->label); - } - switch(ev->label) { - case GIIK_P9: key = KP_PGUP; break; - case GIIK_PageUp: key = K_PGUP; break; - - case GIIK_P3: key = KP_PGDN; break; - case GIIK_PageDown: key = K_PGDN; break; - - case GIIK_P7: key = KP_HOME; break; - case GIIK_Home: key = K_HOME; break; - - case GIIK_P1: key = KP_END; break; - case GIIK_End: key = K_END; break; - - case GIIK_P4: key = KP_LEFTARROW; break; - case GIIK_Left: key = K_LEFTARROW; break; - - case GIIK_P6: key = KP_RIGHTARROW; break; - case GIIK_Right: key = K_RIGHTARROW; break; - - case GIIK_P2: key = KP_DOWNARROW; break; - case GIIK_Down: key = K_DOWNARROW; break; - - case GIIK_P8: key = KP_UPARROW; break; - case GIIK_Up: key = K_UPARROW; break; - - case GIIK_P5: key = KP_5; break; - case GIIK_PBegin: key = K_AUX32; break; - - case GIIK_P0: key = KP_INS; break; - case GIIK_Insert: key = K_INS; break; - - case GIIK_PSeparator: - case GIIK_PDecimal: key = KP_DEL; break; - case GIIUC_Delete: key = K_DEL; break; - - case GIIK_PStar: key = KP_MULTIPLY; break; - case GIIK_PPlus: key = KP_PLUS; break; - case GIIK_PMinus: key = KP_MINUS; break; - case GIIK_PSlash: key = KP_DIVIDE; break; - - case GIIK_PEnter: key = KP_ENTER; break; - case GIIUC_Return: key = K_ENTER; break; - - case GIIUC_Escape: key = K_ESCAPE; break; - - case GIIUC_Tab: key = K_TAB; break; - - case GIIK_F1: key = K_F1; break; - case GIIK_F2: key = K_F2; break; - case GIIK_F3: key = K_F3; break; - case GIIK_F4: key = K_F4; break; - case GIIK_F5: key = K_F5; break; - case GIIK_F6: key = K_F6; break; - case GIIK_F7: key = K_F7; break; - case GIIK_F8: key = K_F8; break; - case GIIK_F9: key = K_F9; break; - case GIIK_F10: key = K_F10; break; - case GIIK_F11: key = K_F11; break; - case GIIK_F12: key = K_F12; break; - - case GIIUC_BackSpace: key = K_BACKSPACE; break; - - case GIIK_ShiftL: - case GIIK_ShiftR: key = K_SHIFT; break; - - case GIIK_Execute: - case GIIK_CtrlL: - case GIIK_CtrlR: key = K_CTRL; break; - - case GIIK_AltL: - case GIIK_MetaL: - case GIIK_AltR: - case GIIK_MetaR: - case GIIK_AltGr: - case GIIK_ModeSwitch: key = K_ALT; break; - - case GIIK_Caps: key = K_CAPSLOCK; break; - case GIIK_PrintScreen: key = K_PRNTSCR; break; - case GIIK_ScrollLock: key = K_SCRLCK; break; - case GIIK_Pause: key = K_PAUSE; break; - case GIIK_NumLock: key = KP_NUMLCK; break; - - case GIIUC_Comma: case GIIUC_Minus: case GIIUC_Period: - key = ev->label; - break; - case GIIUC_Section: key = '~'; break; - - default: - if (ev->label >= 0 && ev->label <= 9) return ev->label; - if (ev->label >= 'A' && ev->label <= 'Z') { - return ev->label - 'A' + 'a'; - } - if (ev->label >= 'a' && ev->label <= 'z') return ev->label; - - if (ev->sym <= 0x7f) { - key = ev->sym; - if (key >= 'A' && key <= 'Z') { - key = key - 'A' + 'a'; - } - return key; - } - if (ev->label <= 0x7f) { - return ev->label; - } - break; - } - - return key; -} - -static void GetEvent(void) -{ - ggi_event ev; - uint32 b; - - ggiEventRead(ggivis, &ev, emAll); - switch(ev.any.type) { - case evKeyPress: - Key_Event(XLateKey(&ev.key), true); - break; - - case evKeyRelease: - Key_Event(XLateKey(&ev.key), false); - break; - - case evPtrRelative: - mouse_x += (float) ev.pmove.x; - mouse_y += (float) ev.pmove.y; - break; - - case evPtrAbsolute: - mouse_x += (float) (ev.pmove.x-p_mouse_x); - mouse_y += (float) (ev.pmove.y-p_mouse_y); - p_mouse_x = ev.pmove.x; - p_mouse_y = ev.pmove.y; - break; - - case evPtrButtonPress: - if (!mouse_avail) return; - - b = ev.pbutton.button - 1; - - if (b < NUM_STDBUTTONS) { - Key_Event(K_MOUSE1 + b, true); - } else if (b < NUM_BUTTONS) { - Key_Event(K_AUX32 - NUM_BUTTONS + b, true); - } - break; - - case evPtrButtonRelease: - if (!mouse_avail) return; - - b = ev.pbutton.button - 1; - - if (b < NUM_STDBUTTONS) { - Key_Event(K_MOUSE1 + b, false); - } else if (b < NUM_BUTTONS) { - Key_Event(K_AUX32 - NUM_BUTTONS + b, false); - } - break; - -#if 0 - case ConfigureNotify: -//printf("config notify\n"); - config_notify_width = ev.xconfigure.width; - config_notify_height = ev.xconfigure.height; - config_notify = 1; - break; - - default: -#endif - } -} - - -void IN_SendKeyEvents(void) -{ - /* Get events from LibGGI */ - if (ggivis) { - struct timeval t = {0,0}; - - if (ggiEventPoll(ggivis, emAll, &t)) { - int i = ggiEventsQueued(ggivis, emAll); - while (i--) GetEvent(); - } - } -} - - -void -IN_Init(void) -{ - JOY_Init (); - - old_windowed_mouse = -1; /* Force update */ - if (COM_CheckParm ("-nomouse")) return; - - mouse_x = mouse_y = 0.0; - mouse_avail = 1; -} - -void -IN_Init_Cvars(void) -{ - JOY_Init_Cvars (); - - _windowed_mouse = Cvar_Get("_windowed_mouse", "0", CVAR_ARCHIVE, "None"); - m_filter = Cvar_Get("m_filter", "0", CVAR_ARCHIVE, "None"); -} - - -void -IN_Shutdown(void) -{ - JOY_Shutdown (); - - Con_Printf("IN_Shutdown\n"); - mouse_avail = 0; -} - - -void -IN_Commands (void) -{ - JOY_Command (); - - /* Only supported by LibGII 0.7 or later. */ -#ifdef GII_CMDCODE_PREFER_RELPTR - if (old_windowed_mouse != _windowed_mouse->int_val) { - gii_event ev; - - old_windowed_mouse = _windowed_mouse->int_val; - - ev.cmd.size = sizeof(gii_cmd_nodata_event); - ev.cmd.type = evCommand; - ev.cmd.target = GII_EV_TARGET_ALL; - ev.cmd.code = _windowed_mouse->int_val ? GII_CMDCODE_PREFER_RELPTR - : GII_CMDCODE_PREFER_ABSPTR; - - ggiEventSend(ggivis, &ev); - } -#endif -} - - -void -IN_Move(usercmd_t *cmd) -{ - JOY_Move (cmd); - - if (!mouse_avail) - return; - - if (m_filter->int_val) { - mouse_x = (mouse_x + old_mouse_x) * 0.5; - mouse_y = (mouse_y + old_mouse_y) * 0.5; - } - - old_mouse_x = mouse_x; - old_mouse_y = mouse_y; - - mouse_x *= sensitivity->value; - mouse_y *= sensitivity->value; - - if ( (in_strafe.state & 1) || (lookstrafe->int_val && freelook)) - cmd->sidemove += m_side->value * mouse_x; - else - cl.viewangles[YAW] -= m_yaw->value * mouse_x; - if (freelook) - V_StopPitchDrift (); - - if (freelook && !(in_strafe.state & 1)) { - cl.viewangles[PITCH] += m_pitch->value * mouse_y; - cl.viewangles[PITCH] = bound (-70, cl.viewangles[PITCH], 80); - } else { - if ((in_strafe.state & 1) && noclip_anglehack) - cmd->upmove -= m_forward->value * mouse_y; - else - cmd->forwardmove -= m_forward->value * mouse_y; - } - mouse_x = mouse_y = 0.0; -} - - -void VID_Init_Cvars(void) {} -void VID_LockBuffer(void) {} -void VID_UnlockBuffer(void) {} - -void VID_SetCaption (char *text) -{ -} - -void VID_HandlePause (qboolean paused) -{ -} - -void -IN_HandlePause (qboolean paused) -{ -} diff --git a/qw/source/.gitignore b/qw/source/.gitignore index dd1badd1b..e19660a74 100644 --- a/qw/source/.gitignore +++ b/qw/source/.gitignore @@ -11,8 +11,6 @@ Makefile.in client.exe qw-client-3dfx qw-client-3dfx.exe -qw-client-ggi -qw-client-ggi.exe qw-client-fbdev qw-client-glx qw-client-glx.exe diff --git a/qw/source/Makefile.am b/qw/source/Makefile.am index cdd7edb91..a908099f3 100644 --- a/qw/source/Makefile.am +++ b/qw/source/Makefile.am @@ -31,11 +31,11 @@ AUTOMAKE_OPTIONS= foreign # # Stuff that is common to both client and server # -INCLUDES= -I$(top_srcdir)/include -I$(top_srcdir)/qw/include $(GGI_CFLAGS) $(MGL_CFLAGS) $(SDL_CFLAGS) $(SVGA_CFLAGS) $(X_CFLAGS) $(GLX_CFLAGS) $(TDFXGL_CFLAGS) +INCLUDES= -I$(top_srcdir)/include -I$(top_srcdir)/qw/include $(MGL_CFLAGS) $(SDL_CFLAGS) $(SVGA_CFLAGS) $(X_CFLAGS) $(GLX_CFLAGS) $(TDFXGL_CFLAGS) bin_PROGRAMS = @QW_TARGETS@ -EXTRA_PROGRAMS= qw-client-3dfx qw-client-fbdev qw-client-ggi \ +EXTRA_PROGRAMS= qw-client-3dfx qw-client-fbdev \ qw-client-glx qw-client-mgl qw-client-sdl \ qw-client-sgl qw-client-svga qw-client-wgl \ qw-client-x11 qw-server @@ -217,15 +217,6 @@ qw_client_fbdev_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES) $(f qw_client_fbdev_LDADD= $(CLIENT_LIBS) qw_client_fbdev_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a -# -# ... GGI -# -ggi_SOURCES= vid_ggi.c in_ggi.c - -qw_client_ggi_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES) $(ggi_SOURCES) -qw_client_ggi_LDADD= $(GGI_LIBS) $(CLIENT_LIBS) -qw_client_ggi_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a - # # ... SciTech MGL # diff --git a/qw/source/in_ggi.c b/qw/source/in_ggi.c deleted file mode 100644 index e6f04a534..000000000 --- a/qw/source/in_ggi.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - in_ggi.c - - Input handling for ggi renderer. - - Copyright (C) 1996-1997 Id Software, Inc. - Copyright (C) 1999 Marcus Sundberg [mackan@stacken.kth.se] - - 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$ -*/ - -#define _BSD - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif -#ifdef HAVE_STRING_H -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif - -#include -#include -#include -#include - -#include "cl_input.h" -#include "client.h" -#include "cmd.h" -#include "console.h" -#include "cvar.h" -#include "host.h" -#include "input.h" -#include "joystick.h" -#include "keys.h" -#include "qargs.h" -#include "sys.h" -#include "view.h" - -cvar_t *m_filter; -cvar_t *_windowed_mouse; - -#define NUM_STDBUTTONS 3 -#define NUM_BUTTONS 10 - -static qboolean mouse_avail; -static float mouse_x, mouse_y; -static float old_mouse_x, old_mouse_y; -static int p_mouse_x, p_mouse_y; -static float old_windowed_mouse; - -static ggi_visual_t ggivis = NULL; - - -static int -XLateKey (ggi_key_event * ev) -{ - int key = 0; - - if (GII_KTYP (ev->label) == GII_KT_DEAD) { - ev->label = GII_KVAL (ev->label); - } - switch (ev->label) { - case GIIK_P9: - key = KP_PGUP; - break; - case GIIK_PageUp: - key = K_PGUP; - break; - - case GIIK_P3: - key = KP_PGDN; - break; - case GIIK_PageDown: - key = K_PGDN; - break; - - case GIIK_P7: - key = KP_HOME; - break; - case GIIK_Home: - key = K_HOME; - break; - - case GIIK_P1: - key = KP_END; - break; - case GIIK_End: - key = K_END; - break; - - case GIIK_P4: - key = KP_LEFTARROW; - break; - case GIIK_Left: - key = K_LEFTARROW; - break; - - case GIIK_P6: - key = KP_RIGHTARROW; - break; - case GIIK_Right: - key = K_RIGHTARROW; - break; - - case GIIK_P2: - key = KP_DOWNARROW; - break; - case GIIK_Down: - key = K_DOWNARROW; - break; - - case GIIK_P8: - key = KP_UPARROW; - break; - case GIIK_Up: - key = K_UPARROW; - break; - - case GIIK_P5: - key = KP_5; - break; - case GIIK_PBegin: - key = K_AUX32; - break; - - case GIIK_P0: - key = KP_INS; - break; - case GIIK_Insert: - key = K_INS; - break; - - case GIIK_PSeparator: - case GIIK_PDecimal: - key = KP_DEL; - break; - case GIIUC_Delete: - key = K_DEL; - break; - - case GIIK_PStar: - key = KP_MULTIPLY; - break; - case GIIK_PPlus: - key = KP_PLUS; - break; - case GIIK_PMinus: - key = KP_MINUS; - break; - case GIIK_PSlash: - key = KP_DIVIDE; - break; - - case GIIK_PEnter: - key = KP_ENTER; - break; - case GIIUC_Return: - key = K_ENTER; - break; - - case GIIUC_Escape: - key = K_ESCAPE; - break; - - case GIIUC_Tab: - key = K_TAB; - break; - - case GIIK_F1: - key = K_F1; - break; - case GIIK_F2: - key = K_F2; - break; - case GIIK_F3: - key = K_F3; - break; - case GIIK_F4: - key = K_F4; - break; - case GIIK_F5: - key = K_F5; - break; - case GIIK_F6: - key = K_F6; - break; - case GIIK_F7: - key = K_F7; - break; - case GIIK_F8: - key = K_F8; - break; - case GIIK_F9: - key = K_F9; - break; - case GIIK_F10: - key = K_F10; - break; - case GIIK_F11: - key = K_F11; - break; - case GIIK_F12: - key = K_F12; - break; - - case GIIUC_BackSpace: - key = K_BACKSPACE; - break; - - case GIIK_ShiftL: - case GIIK_ShiftR: - key = K_SHIFT; - break; - - case GIIK_Execute: - case GIIK_CtrlL: - case GIIK_CtrlR: - key = K_CTRL; - break; - - case GIIK_AltL: - case GIIK_MetaL: - case GIIK_AltR: - case GIIK_MetaR: - case GIIK_AltGr: - case GIIK_ModeSwitch: - key = K_ALT; - break; - - case GIIK_Caps: - key = K_CAPSLOCK; - break; - case GIIK_PrintScreen: - key = K_PRNTSCR; - break; - case GIIK_ScrollLock: - key = K_SCRLCK; - break; - case GIIK_Pause: - key = K_PAUSE; - break; - case GIIK_NumLock: - key = KP_NUMLCK; - break; - - case GIIUC_Comma: - case GIIUC_Minus: - case GIIUC_Period: - key = ev->label; - break; - case GIIUC_Section: - key = '~'; - break; - - default: - if (ev->label >= 0 && ev->label <= 9) - return ev->label; - if (ev->label >= 'A' && ev->label <= 'Z') { - return ev->label - 'A' + 'a'; - } - if (ev->label >= 'a' && ev->label <= 'z') - return ev->label; - - if (ev->sym <= 0x7f) { - key = ev->sym; - if (key >= 'A' && key <= 'Z') { - key = key - 'A' + 'a'; - } - return key; - } - if (ev->label <= 0x7f) { - return ev->label; - } - break; - } - - return key; -} - -static void -GetEvent (void) -{ - ggi_event ev; - uint32 b; - - ggiEventRead (ggivis, &ev, emAll); - switch (ev.any.type) { - case evKeyPress: - Key_Event (XLateKey (&ev.key), 0, true); - break; - - case evKeyRelease: - Key_Event (XLateKey (&ev.key), 0, false); - break; - - case evPtrRelative: - mouse_x += (float) ev.pmove.x; - mouse_y += (float) ev.pmove.y; - break; - - case evPtrAbsolute: - mouse_x += (float) (ev.pmove.x - p_mouse_x); - mouse_y += (float) (ev.pmove.y - p_mouse_y); - p_mouse_x = ev.pmove.x; - p_mouse_y = ev.pmove.y; - break; - - case evPtrButtonPress: - if (!mouse_avail) - return; - - b = ev.pbutton.button - 1; - - if (b < NUM_STDBUTTONS) { - Key_Event (K_MOUSE1 + b, 0, true); - } else if (b < NUM_STDBUTTONS + 2) { - b -= 3; - if (b) - Key_Event (K_MWHEELDOWN, 0, true); - else - Key_Event (K_MWHEELUP, 0, true); - } else if (b < NUM_BUTTONS) { - Key_Event (K_AUX32 - NUM_BUTTONS + b, 0, true); - } - break; - - case evPtrButtonRelease: - if (!mouse_avail) - return; - - b = ev.pbutton.button - 1; - - if (b < NUM_STDBUTTONS) { - Key_Event (K_MOUSE1 + b, 0, false); - } else if (b < NUM_STDBUTTONS + 2) { - b -= 3; - if (b) - Key_Event (K_MWHEELDOWN, 0, false); - else - Key_Event (K_MWHEELUP, 0, false); - } else if (b < NUM_BUTTONS) { - Key_Event (K_AUX32 - NUM_BUTTONS + b, 0, false); - } - break; - -#if 0 - case ConfigureNotify: -//printf("config notify\n"); - config_notify_width = ev.xconfigure.width; - config_notify_height = ev.xconfigure.height; - config_notify = 1; - break; - - default: -#endif - } -} - - -void -IN_SendKeyEvents (void) -{ - /* Get events from LibGGI */ - if (ggivis) { - struct timeval t = { 0, 0 }; - - if (ggiEventPoll (ggivis, emAll, &t)) { - int i = ggiEventsQueued (ggivis, emAll); - - while (i--) - GetEvent (); - } - } -} - - -void -IN_Init (void) -{ - JOY_Init (); - - old_windowed_mouse = -1; /* Force update */ - if (COM_CheckParm ("-nomouse")) - return; - - mouse_x = mouse_y = 0.0; - mouse_avail = 1; -} - -void -IN_Init_Cvars (void) -{ - JOY_Init_Cvars (); - - _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "Have Quake grab the mouse from X when you play"); - m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, "Mouse input filtering"); -} - - -void -IN_Shutdown (void) -{ - JOY_Shutdown (); - - Con_Printf ("IN_Shutdown\n"); - mouse_avail = 0; -} - - -void -IN_Commands (void) -{ - JOY_Command (); - - /* Only supported by LibGII 0.7 or later. */ -#ifdef GII_CMDCODE_PREFER_RELPTR - if (old_windowed_mouse != _windowed_mouse->int_val) { - gii_event ev; - - old_windowed_mouse = _windowed_mouse->int_val; - - ev.cmd.size = sizeof (gii_cmd_nodata_event); - ev.cmd.type = evCommand; - ev.cmd.target = GII_EV_TARGET_ALL; - ev.cmd.code = _windowed_mouse->int_val ? GII_CMDCODE_PREFER_RELPTR - : GII_CMDCODE_PREFER_ABSPTR; - - ggiEventSend (ggivis, &ev); - } -#endif -} - - -void -IN_Move (usercmd_t *cmd) -{ - JOY_Move (cmd); - - if (!mouse_avail) - return; - - if (m_filter->int_val) { - mouse_x = (mouse_x + old_mouse_x) * 0.5; - mouse_y = (mouse_y + old_mouse_y) * 0.5; - } - - old_mouse_x = mouse_x; - old_mouse_y = mouse_y; - - mouse_x *= sensitivity->value; - mouse_y *= sensitivity->value; - - if ((in_strafe.state & 1) || (lookstrafe->int_val && freelook)) - cmd->sidemove += m_side->value * mouse_x; - else - cl.viewangles[YAW] -= m_yaw->value * mouse_x; - if (freelook) - V_StopPitchDrift (); - - if (freelook && !(in_strafe.state & 1)) { - cl.viewangles[PITCH] += m_pitch->value * mouse_y; - cl.viewangles[PITCH] = bound (-70, cl.viewangles[PITCH], 80); - } else { - if ((in_strafe.state & 1) && noclip_anglehack) - cmd->upmove -= m_forward->value * mouse_y; - else - cmd->forwardmove -= m_forward->value * mouse_y; - } - mouse_x = mouse_y = 0.0; -} diff --git a/qw/source/vid_ggi.c b/qw/source/vid_ggi.c deleted file mode 100644 index 281ec43c3..000000000 --- a/qw/source/vid_ggi.c +++ /dev/null @@ -1,694 +0,0 @@ -/* - vid_ggi.c - - general LibGGI video driver - - Copyright (C) 1996-1997 Id Software, Inc. - Copyright (C) 1999 Marcus Sundberg [mackan@stacken.kth.se] - - 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$ -*/ - -#define _BSD - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif -#ifdef HAVE_STRING_H -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif - -#include -#include -#include -#include - -#include "client.h" -#include "cmd.h" -#include "console.h" -#include "cvar.h" -#include "d_local.h" -#include "draw.h" -#include "host.h" -#include "qargs.h" -#include "qendian.h" -#include "sys.h" - -extern viddef_t vid; // global video state -unsigned short d_8to16table[256]; - -/* Unused */ -int VGA_width, VGA_height, VGA_rowbytes, VGA_bufferrowbytes, VGA_planar; -byte *VGA_pagebase; - -cvar_t *m_filter; -cvar_t *_windowed_mouse; -#define NUM_STDBUTTONS 3 -#define NUM_BUTTONS 10 - -static ggi_visual_t ggivis = NULL; -static ggi_mode mode; -static const ggi_directbuffer *dbuf1 = NULL, *dbuf2 = NULL; - -static uint8 *drawptr = NULL; -static void *frameptr[2] = { NULL, NULL }; -static void *oneline = NULL; -static void *palette = NULL; -static int curframe = 0; - -static int realwidth, realheight; -static int doublebuffer; -static int scale; -static int stride, drawstride; -static int pixelsize; -static int usedbuf, havedbuf; - -int VID_options_items = 1; - -static void -do_scale8 (int xsize, int ysize, uint8 * dest, uint8 * src) -{ - int i, j, destinc = stride * 2 - xsize * 2; - - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; /* i is incremented below */ ) { - register uint32 pix1 = src[i++], pix2 = src[i++]; - -#ifdef GGI_LITTLE_ENDIAN - *((uint32 *) (dest + stride)) - = *((uint32 *) dest) - = (pix1 | (pix1 << 8) - | (pix2 << 16) | (pix2 << 24)); -#else - *((uint32 *) (dest + stride)) - = *((uint32 *) dest) - = (pix2 | (pix2 << 8) - | (pix1 << 16) | (pix1 << 24)); -#endif - dest += 4; - } - dest += destinc; - src += xsize; - } -} - -static void -do_scale16 (int xsize, int ysize, uint8 * dest, uint8 * src) -{ - int i, j, destinc = stride * 2 - xsize * 4; - uint16 *palptr = palette; - - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; /* i is incremented below */ ) { - register uint32 pixel = palptr[src[i++]]; - - *((uint32 *) (dest + stride)) - = *((uint32 *) dest) - = pixel | (pixel << 16); - dest += 4; - } - dest += destinc; - src += xsize; - } -} - -static void -do_scale32 (int xsize, int ysize, uint8 * dest, uint8 * src) -{ - int i, j, destinc = stride * 2 - xsize * 8; - uint32 *palptr = palette; - - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; /* i is incremented below */ ) { - register uint32 pixel = palptr[src[i++]]; - - *((uint32 *) (dest + stride)) - = *((uint32 *) (dest)) = pixel; - dest += 4; - *((uint32 *) (dest + stride)) - = *((uint32 *) (dest)) = pixel; - dest += 4; - } - dest += destinc; - src += xsize; - } -} - -static void -do_copy8 (int xsize, int ysize, uint8 * dest, uint8 * src) -{ - int i, j; - uint8 *palptr = palette; - - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; i++) { - dest[i] = palptr[src[i]]; - } - dest += stride; - src += xsize; - } -} - -static void -do_copy16 (int xsize, int ysize, void *destptr, uint8 * src) -{ - int i, j, destinc = (stride / 2 - xsize) / 2; - uint16 *palptr = palette; - uint32 *dest = destptr; - - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; /* i is incremented below */ ) { - register uint32 pixel = palptr[src[i++]]; - -#ifdef GGI_LITTLE_ENDIAN - *(dest++) = pixel | (palptr[src[i++]] << 16); -#else - *(dest++) = (palptr[src[i++]] << 16) | pixel; -#endif - } - dest += destinc; - src += xsize; - } -} - -static void -do_copy32 (int xsize, int ysize, uint32 * dest, uint8 * src) -{ - int i, j, destinc = stride / 4; - uint32 *palptr = palette; - - for (j = 0; j < ysize; j++) { - for (i = 0; i < xsize; i++) { - dest[i] = palptr[src[i]]; - } - dest += destinc; - src += xsize; - } -} - -void -ResetFrameBuffer (void) -{ - int tbuffersize, tcachesize; - void *vid_surfcache; - - // Calculate the sizes we want first - tbuffersize = vid.width * vid.height * sizeof (*d_pzbuffer); - tcachesize = D_SurfaceCacheForRes (vid.width, vid.height); - - // Free the old z-buffer - if (d_pzbuffer) { - free (d_pzbuffer); - d_pzbuffer = NULL; - } - // Free the old surface cache - vid_surfcache = D_SurfaceCacheAddress (); - if (vid_surfcache) { - D_FlushCaches (); - free (vid_surfcache); - vid_surfcache = NULL; - } - // Allocate the new z-buffer - d_pzbuffer = calloc (tbuffersize, 1); - if (!d_pzbuffer) { - Sys_Error ("Not enough memory for video mode\n"); - } - // Allocate the new surface cache; free the z-buffer if we fail - vid_surfcache = calloc (tcachesize, 1); - if (!vid_surfcache) { - free (d_pzbuffer); - d_pzbuffer = NULL; - Sys_Error ("Not enough memory for video mode\n"); - } - - D_InitCaches (vid_surfcache, tcachesize); -} - - -// Called at startup to set up translation tables, takes 256 8 bit RGB values -// the palette data will go away after the call, so it must be copied off if -// the video driver will need it again - -void -VID_Init (unsigned char *pal) -{ - int pnum; - - vid.width = GGI_AUTO; - vid.height = GGI_AUTO; - - srandom (getpid ()); - - if (ggiInit () < 0) { - Sys_Error ("VID: Unable to init LibGGI\n"); - } - ggivis = ggiOpen (NULL); - if (!ggivis) { - Sys_Error ("VID: Unable to open default visual\n"); - } - - /* Go into async mode */ - ggiSetFlags (ggivis, GGIFLAG_ASYNC); - - VID_GetWindowSize (320, 200); - - scale = COM_CheckParm ("-scale"); - - /* specify a LibGGI mode */ - if ((pnum = COM_CheckParm ("-ggimode"))) { - if (pnum >= com_argc - 1) - Sys_Error ("VID: -ggimode \n"); - ggiParseMode (com_argv[pnum + 1], &mode); - } else { - /* This will give the default mode */ - ggiParseMode ("", &mode); - /* Now put in any parameters given above */ - mode.visible.x = vid.width; - mode.visible.y = vid.height; - } - - if (scale) { - mode.visible.x *= 2; - mode.visible.y *= 2; - } - - /* We prefer 8 bit mode unless otherwise specified */ - if (mode.graphtype == GT_AUTO) - mode.graphtype = GT_8BIT; - - /* We want double buffering if possible */ - if (mode.frames == GGI_AUTO) { - ggi_mode tmpmode = mode; - - tmpmode.frames = 2; - if (ggiCheckMode (ggivis, &tmpmode) == 0) { - mode = tmpmode; - } else { - tmpmode.frames = 2; - if (ggiCheckMode (ggivis, &tmpmode) == 0) { - mode = tmpmode; - } - } - } - - if (ggiSetMode (ggivis, &mode) != 0) { - /* Try again with suggested mode */ - if (ggiSetMode (ggivis, &mode) != 0) { - Sys_Error ("VID: LibGGI can't set any modes!\n"); - } - } - - /* Pixel size must be 1, 2 or 4 bytes */ - if (GT_SIZE (mode.graphtype) != 8 && - GT_SIZE (mode.graphtype) != 16 && GT_SIZE (mode.graphtype) != 32) { - if (GT_SIZE (mode.graphtype) == 24) { - Sys_Error - ("VID: 24 bits per pixel not supported - try using the palemu target.\n"); - } else { - Sys_Error ("VID: %d bits per pixel not supported by GGI Quake.\n", - GT_SIZE (mode.graphtype)); - } - } - - realwidth = mode.visible.x; - realheight = mode.visible.y; - if (scale) { - vid.width = realwidth / 2; - vid.height = realheight / 2; - } else { - vid.width = realwidth; - vid.height = realheight; - } - Con_CheckResize (); // Now that we have a window size, fix console - - if (mode.frames >= 2) - doublebuffer = 1; - else - doublebuffer = 0; - - pixelsize = (GT_SIZE (mode.graphtype) + 7) / 8; - if (mode.graphtype != GT_8BIT) { - if ((palette = malloc (pixelsize * 256)) == NULL) { - Sys_Error ("VID: Unable to allocate palette table\n"); - } - } - - VID_SetPalette (pal); - - usedbuf = havedbuf = 0; - drawstride = vid.width; - stride = realwidth * pixelsize; - if ((dbuf1 = ggiDBGetBuffer (ggivis, 0)) != NULL && - (dbuf1->type & GGI_DB_SIMPLE_PLB)) { - havedbuf = 1; - stride = dbuf1->buffer.plb.stride; - if (doublebuffer) { - if ((dbuf2 = ggiDBGetBuffer (ggivis, 1)) == NULL || - !(dbuf2->type & GGI_DB_SIMPLE_PLB)) { - /* Only one DB? No double buffering then */ - doublebuffer = 0; - } - } - if (doublebuffer) { - fprintf (stderr, "VID: Got two DirectBuffers\n"); - } else { - fprintf (stderr, "VID: Got one DirectBuffer\n"); - } - if (doublebuffer && !scale && !palette) { - usedbuf = 1; - drawstride = stride; - frameptr[0] = dbuf1->write; - if (doublebuffer) { - frameptr[1] = dbuf2->write; - } else { - frameptr[1] = frameptr[0]; - } - drawptr = frameptr[0]; - fprintf (stderr, "VID: Drawing into DirectBuffer\n"); - } - } - - if (!usedbuf) { - if ((drawptr = malloc (vid.width * vid.height)) == NULL) { - Sys_Error ("VID: Unable to allocate draw buffer\n"); - } - if (!havedbuf && (scale || palette)) { - int linesize = pixelsize * realwidth; - - if (scale) - linesize *= 4; - if ((oneline = malloc (linesize)) == NULL) { - Sys_Error ("VID: Unable to allocate line buffer\n"); - } - } - fprintf (stderr, "VID: Drawing into offscreen memory\n"); - } - - ResetFrameBuffer (); - - curframe = 0; - vid.maxwarpwidth = WARP_WIDTH; - vid.maxwarpheight = WARP_HEIGHT; - vid.numpages = doublebuffer ? 2 : 1; - vid.colormap = host_colormap; - vid.buffer = drawptr; - vid.rowbytes = drawstride; - vid.direct = drawptr; - vid.conbuffer = vid.buffer; - vid.conrowbytes = vid.rowbytes; - vid.conwidth = vid.width; - vid.conheight = vid.height; - vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0); - vid.fullbright = 256 - LittleLong (*((int *) vid.colormap + 2048)); -} - -void -VID_ShiftPalette (unsigned char *pal) -{ - VID_SetPalette (pal); -} - - -void -VID_SetPalette (unsigned char *pal) -{ - int i; - ggi_color colors[256]; - - for (i = 0; i < 256; i++) { - colors[i].r = pal[i * 3] * 257; - colors[i].g = pal[i * 3 + 1] * 257; - colors[i].b = pal[i * 3 + 2] * 257; - } - if (palette) { - ggiPackColors (ggivis, palette, colors, 256); - } else { - ggiSetPalette (ggivis, 0, 256, colors); - } -} - -// Called at shutdown -void -VID_Shutdown (void) -{ - Con_Printf ("VID_Shutdown\n"); - - if (!usedbuf) { - free (drawptr); - drawptr = NULL; - } - if (oneline) { - free (oneline); - oneline = NULL; - } - if (palette) { - free (palette); - palette = NULL; - } - if (ggivis) { - ggiClose (ggivis); - ggivis = NULL; - } - ggiExit (); -} - - -// flushes the given rectangles from the view buffer to the screen - -void -VID_Update (vrect_t *rects) -{ - int height = 0; - -#if 0 -// if the window changes dimension, skip this frame - - if (config_notify) { - fprintf (stderr, "config notify\n"); - config_notify = 0; - vid.width = config_notify_width & ~7; - vid.height = config_notify_height; - if (doShm) - ResetSharedFrameBuffers (); - else - ResetFrameBuffer (); - vid.rowbytes = x_framebuffer[0]->bytes_per_line; - vid.buffer = x_framebuffer[curframe]->data; - vid.conbuffer = vid.buffer; - vid.conwidth = vid.width; - vid.conheight = vid.height; - vid.conrowbytes = vid.rowbytes; - vid.recalc_refdef = 1; // force a surface cache flush - Con_CheckResize (); - Con_Clear_f (); - return; - } - // force full update if not 8bit - if (x_visinfo->depth != 8) { - extern int scr_fullupdate; - - scr_fullupdate = 0; - } -#endif - - while (rects) { - int y = rects->y + rects->height; - - if (y > height) - height = y; - rects = rects->pnext; - } - - if (!usedbuf) { - int i; - - if (havedbuf) { - if (ggiResourceAcquire (dbuf1->resource, - GGI_ACTYPE_WRITE) != 0 || - (doublebuffer ? - ggiResourceAcquire (dbuf2->resource, - GGI_ACTYPE_WRITE) != 0 : 0)) { - ggiPanic ("Unable to acquire DirectBuffer!\n"); - } - /* ->write is allowed to change at acquire time */ - frameptr[0] = dbuf1->write; - if (doublebuffer) { - frameptr[1] = dbuf2->write; - } else { - frameptr[1] = frameptr[0]; - } - } - if (scale) { - switch (pixelsize) { - case 1: - if (havedbuf) { - do_scale8 (vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - - for (i = 0; i < height; i++) { - do_scale8 (vid.width, 1, oneline, buf); - ggiPutBox (ggivis, 0, i * 2, realwidth, 2, oneline); - buf += vid.width; - } - } - break; - case 2: - if (havedbuf) { - do_scale16 (vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - - for (i = 0; i < height; i++) { - do_scale16 (vid.width, 1, oneline, buf); - ggiPutBox (ggivis, 0, i * 2, realwidth, 2, oneline); - buf += vid.width; - } - } - break; - case 4: - if (havedbuf) { - do_scale32 (vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - - for (i = 0; i < height; i++) { - do_scale32 (vid.width, 1, oneline, buf); - ggiPutBox (ggivis, 0, i * 2, realwidth, 2, oneline); - buf += vid.width; - } - } - break; - } - } else if (palette) { - switch (pixelsize) { - case 1: - if (havedbuf) { - do_copy8 (vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - - for (i = 0; i < height; i++) { - do_copy8 (vid.width, 1, oneline, buf); - ggiPutBox (ggivis, 0, i, realwidth, 1, oneline); - buf += vid.width; - } - } - break; - case 2: - if (havedbuf) { - do_copy16 (vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - - for (i = 0; i < height; i++) { - do_copy16 (vid.width, 1, oneline, buf); - ggiPutBox (ggivis, 0, i, realwidth, 1, oneline); - buf += vid.width; - } - } - break; - case 4: - if (havedbuf) { - do_copy32 (vid.width, height, - frameptr[curframe], drawptr); - } else { - uint8 *buf = drawptr; - - for (i = 0; i < height; i++) { - do_copy32 (vid.width, 1, oneline, buf); - ggiPutBox (ggivis, 0, i, realwidth, 1, oneline); - buf += vid.width; - } - } - break; - } - } else { - ggiPutBox (ggivis, 0, 0, vid.width, height, drawptr); - } - if (havedbuf) { - ggiResourceRelease (dbuf1->resource); - if (doublebuffer) { - ggiResourceRelease (dbuf2->resource); - } - } - - } - - if (doublebuffer) { - ggiSetDisplayFrame (ggivis, curframe); - curframe = !curframe; - if (usedbuf) { - vid.buffer = vid.conbuffer = vid.direct - = drawptr = frameptr[curframe]; - } - ggiSetWriteFrame (ggivis, curframe); - } -#if 0 - if (GT_SIZE (mode.graphtype) == 16) { - do_copy16 (vid.width, height, (uint16 *) frameptr, drawptr); - } else if (GT_SIZE (mode.graphtype) == 32) { - do_copy32 (vid.width, height, (uint32 *) frameptr, drawptr); - } -#endif - - ggiFlush (ggivis); -} - -void -D_BeginDirectRect (int x, int y, byte * pbitmap, int width, int height) -{ -// direct drawing of the "accessing disk" icon isn't supported under Linux -} - -void -D_EndDirectRect (int x, int y, int width, int height) -{ -// direct drawing of the "accessing disk" icon isn't supported under Linux -} - -void -VID_Init_Cvars (void) -{ -} - -void -VID_LockBuffer (void) -{ -} - -void -VID_UnlockBuffer (void) -{ -} - -void -VID_SetCaption (char *text) -{ -}