Improved screenshotting, misc mouse improvements,

This commit is contained in:
eukos 2015-09-19 15:06:39 +02:00
parent 4385e4fa81
commit 13c4c8206e
3 changed files with 58 additions and 109 deletions

22
README
View file

@ -5,8 +5,8 @@
|_/ |_|____/ \___/|_/ |_|___/_/\_\
This is a novelty engine rendering in software mode, aka on your CPU.
It uses standard X11 functions, so aside from that no dependencies are necessary.
For sound, please get the Open Sound System running.
It uses GTK/GDK functions, aside from that no dependencies are necessary.
For sound, please get the Open Sound System running (or wait until I'm done with the OpenAL backend)
It can run Q1 with all its fancy waterwarping, too.
@ -14,19 +14,19 @@ It can run Q1 with all its fancy waterwarping, too.
Features
************
- Full software-rendered 3D-Engine
- Colored lighting, 8-bit, 16-bit and 24-bit dithered lightmaps
- Fully software-rendered 3D-Engine
- Colored lighting, 8-bit, "16-bit" and "24-bit" dithered lightmaps
- Particle and (non-clipped) decal system
- Coronas with support for light styles
- Model blob shadows
- Sound pitch variation
- Server side QCVM gamecode with enhanced extensions (such as file i/o, traceboxes...)
- Texture filtering on level textures
- Texture filtering on level textures (Fabien Sanglard's)
- Water translucency and refractions
- Low detail modes
- Distance fog
- Video output and window handling done with GDK/GTK
- Music playback via DUMB, X Multimedia System and FModEx if desired
- Video output, window handling and input powered by GDK/GTK (Version 2)
- Music playback via DUMB, X Multimedia System (and FModEx if desired)
*************
Compiling
@ -42,6 +42,9 @@ For a release build (smaller and faster) issue 'make build_release'.
- Originally based on engoo by leileilol
- Carried over soundfixes from reQuiem
- Main sound is done via OSS, not ALSA - aoss will most likely not work
- Caching of lookup tables is done on disk, taking up 1541120 bytes/1.5mb
- Engine contains an integrated palette as well as colormap generation
- It also contains an integrated (fallback) conchars
- If you want to run Q1 with it, launch it with -data id1.
You can get a particles.spr file for Q1 here: http://euksy.oldtimes-software.com/files/NGUNIX/particle.spr
@ -53,5 +56,8 @@ For a release build (smaller and faster) issue 'make build_release'.
- Menu system done primarily using CSQC or similar
- HUD system done primarily using CSQC or similar
- Make the bots less Q1 specific, controllable via SSQC
- Make the engine run without any external content
- Integrate its own GUI toolset to create and edit lumps
- Ship with a game directory that can be used as a base and torn apart for any use
- Ship with a free scratch QC base demo-ing the new engine extensions
- Ship with a free, scratch QC base demo-ing the new engine extensions
- Bring back the Windows version (for those who don't 'get' UNIX)

View file

@ -1018,44 +1018,32 @@ SCR_ScreenShot_f
*/
void SCR_ScreenShot_f (void)
{
int i;
char pcxname[80];
char pcxnametwo[80];
char checkname[MAX_OSPATH];
int i;
//
// find a file name to save it to
//
#ifndef linux
strcpy(pcxname,"scrsh00.pcx");
#else
strcpy(pcxname,"scrsh00.xwd");
#endif
for (i=0 ; i<=99 ; i++)
for (i=0 ; i<=255 ; i++)
{
pcxname[5] = i/10 + '0';
pcxname[6] = i%10 + '0';
sprintf (checkname, "%s/%s", com_gamedir, pcxname);
if(sv.active)
sprintf(pcxname, "%s%03i.pcx", sv.name, i);
else
sprintf(pcxname, "console%03i.pcx", i);
sprintf(checkname, "%s/%s", com_gamedir, pcxname);
if (Sys_FileTime(checkname) == -1)
break; // file doesn't exist
}
if (i==100)
if (i==256)
{
Con_Printf ("[ENGINE] Couldn't dump screenshot!\n");
Con_Printf ("[ENGINE] Couldn't dump screenshot! (limit reached)\n");
return;
}
#ifndef linux
D_EnableBackBufferAccess (); // enable direct drawing of console to back
WritePCXfile (pcxname, vid.buffer, vid.width, vid.height, vid.rowbytes, vid_curpal);
// WritePCXfile (pcxname, vid.buffer, vid.width, vid.height, vid.rowbytes, host_basepal);
D_DisableBackBufferAccess (); // for adapters that can't stay mapped in
#else
sprintf(pcxnametwo, "xwd -name \"NGUNIX X11\" -display :0 -out ./%s/%s", com_gamedir, pcxname);
system(pcxnametwo);
#endif
WritePCXfile (pcxname, vid.buffer, vid.width, vid.height, vid.rowbytes, host_basepal);
D_DisableBackBufferAccess ();
Con_Printf ("[ENGINE] Dumped %s/%s\n", com_gamedir, pcxname);
}

View file

@ -42,19 +42,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
viddef_t vid; // global video state
unsigned short d_8to16table[256];
int num_shades = 32;
int gdk_initialized = 0;
static int gdk_initialized = 0;
static int vid_frame[4];
float mouse_x, mouse_y;
float old_mouse_x, old_mouse_y;
qboolean mouse_enabled;
static float mouse_x, mouse_y;
static float old_mouse_x, old_mouse_y;
static qboolean mouse_enabled;
cvar_t *m_filter;
extern int deathcam_yesiamdead;
int p_mouse_x;
int p_mouse_y;
int d_con_indirect = 0;
int vid_buffersize;
extern vec3_t deathcam_angles;
static GtkWidget *x_win;
static GdkGC *x_gc;
@ -68,26 +64,29 @@ static int verbose = 0;
static long X11_highhunkmark;
static long X11_buffersize;
int vid_surfcachesize;
static int vid_buffersize;
static int vid_surfcachesize;
void *vid_surfcache;
static int vid_center_x, vid_center_y;
static int vid_mouseposx, vid_mouseposy;
void (*vid_menudrawfn) (void);
void (*vid_menukeyfn) (int key);
void VID_MenuKey(int key);
// ========================================================================
// Tragic death handler
// ========================================================================
int config_notify=0;
int config_notify_width;
int config_notify_height;
void TragicDeath(int signal_num)
void VID_HandleDeath(int signal_num)
{
Sys_Error("This death brought to you by the number %d\n", signal_num);
Sys_Error("[VIDEO] This death brought to you by the number %d\n", signal_num);
}
void ResetFrameBuffer(void)
{
if (d_pzbuffer) {
if (d_pzbuffer)
{
D_FlushCaches();
Hunk_FreeToHighMark(X11_highhunkmark);
d_pzbuffer = NULL;
@ -115,18 +114,10 @@ void ResetFrameBuffer(void)
if (!x_framebuffer)
Sys_Error("[VIDE] Failed to reset framebuffer!\n");
//vid.buffer = (byte *) (x_framebuffer);
// vid.conbuffer = vid.buffer;
vid.buffer = (byte *) (x_framebuffer);
vid.conbuffer = vid.buffer;
}
// 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
int config_notify=0;
int config_notify_width;
int config_notify_height;
void VID_Init(unsigned char *palette)
{
int pnum;
@ -175,7 +166,7 @@ void VID_Init(unsigned char *palette)
gdk_initialized = 1;;
sigaction(SIGINT, 0, &sa);
sa.sa_handler = TragicDeath;
sa.sa_handler = VID_HandleDeath;
sigaction(SIGINT, &sa, 0);
sigaction(SIGTERM, &sa, 0);
@ -185,34 +176,13 @@ void VID_Init(unsigned char *palette)
/* create the main window */
x_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(x_win, "NGUNIX X11");
gtk_widget_set_size_request(x_win, vid.width, vid.height);
gtk_window_set_default_size(x_win, vid.width, vid.height);
gtk_widget_set_size_request(x_win, 320, 200);
gtk_window_set_position(x_win,GTK_WIN_POS_CENTER_ALWAYS);
g_signal_connect (x_win, "destroy", G_CALLBACK (exit), NULL);
gtk_widget_set_events(x_win, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
// FOR LATER!
/*
GtkWidget *menubar;
GtkWidget *fileMenu;
GtkWidget *fileMi;
GtkWidget *quitMi;
GtkWidget *vbox;
vbox = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(x_win), vbox);
menubar = gtk_menu_bar_new();
fileMenu = gtk_menu_new();
fileMi = gtk_menu_item_new_with_label("File");
quitMi = gtk_menu_item_new_with_label("Quit");
gtk_menu_item_set_submenu(GTK_MENU_ITEM(fileMi), fileMenu);
gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), quitMi);
gtk_menu_shell_append(GTK_MENU_SHELL(menubar), fileMi);
gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);*/
if ((pnum=COM_CheckParm("-noborder")))
gtk_window_set_decorated(x_win, FALSE);
@ -310,6 +280,7 @@ int XLateKey(int keysym)
key = K_ESCAPE;
break;
case GDK_Return:
case GDK_KEY_KP_Enter:
key = K_ENTER;
break;
case GDK_Tab:
@ -397,9 +368,6 @@ int XLateKey(int keysym)
case GDK_KEY_KP_Delete:
key = ',';
break;
case GDK_KEY_KP_Enter:
key = K_ENTER;
break;
case GDK_KEY_KP_0 :
key = '0';
break;
@ -471,7 +439,10 @@ void GetEvent(void)
case GDK_ENTER_NOTIFY:
break;
case GDK_LEAVE_NOTIFY:
IN_DeactivateMouse();
if(mouse_enabled)
gdk_display_warp_pointer (display, screen, vid_center_x, vid_center_y);
else
IN_DeactivateMouse();
break;
case GDK_CONFIGURE:
gtk_window_get_size(GTK_WINDOW(x_win), &w, &h);
@ -533,10 +504,8 @@ void VID_Update(vrect_t * rects)
vid.conrowbytes = vid.rowbytes;
vid.conwidth = vid.width;
vid.conheight = vid.height;
vid.recalc_refdef = 1;
Con_CheckResize();
//Con_Clear_f();
return;
}
@ -612,11 +581,6 @@ void D_EndDirectRect(int x, int y, int width, int height)
}
/*
===========
VID_HandlePause --eukara
===========
*/
void VID_HandlePause (qboolean pause)
{
if (pause)
@ -631,8 +595,6 @@ void VID_HandlePause (qboolean pause)
}
}
static int vid_mouseposx, vid_mouseposy;
extern vec3_t deathcam_angles; //eukara - deathcam
void IN_Move (usercmd_t *cmd)
{
vec3_t tangles; // eukara - deathcam
@ -715,12 +677,6 @@ void IN_Move (usercmd_t *cmd)
mouse_x = mouse_y = 0;
}
void IN_Commands()
{
}
void IN_Init(){}
void IN_Shutdown(){}
gboolean VID_KillSplash(gpointer data){
gtk_widget_destroy((GtkWidget*)data);
@ -733,8 +689,6 @@ void VID_CreateSplash()
GdkPixmap *splash_image;
GtkWidget *x_splash, *x_splash_image;
GdkPixbuf *icon_image;
GtkWidget *x_icon;
gtk_init(NULL, NULL);
icon_image = gdk_pixbuf_new_from_xpm_data(icon_xpm);
@ -756,16 +710,11 @@ void VID_CreateSplash()
gtk_main ();
}
void VID_Init_Cvars()
{
// Add stuff in here... later
}
void IN_Init_Cvars()
{
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE|CVAR_ORIGINAL);
}
/*
* Mouse related functions
* that have nothing todo with aiming or pushing buttons
@ -793,3 +742,9 @@ void IN_ShowMouse (void)
GdkCursor* cursor_arrow = gdk_cursor_new(GDK_ARROW);
gdk_window_set_cursor(gtk_widget_get_window(x_win), cursor_arrow);
}
// Commdand graveyard TODO: Get rid of this
void IN_Commands(){}
void IN_Init(){}
void IN_Shutdown(){}
void VID_Init_Cvars(){}