summaryrefslogtreecommitdiff
path: root/source/r_shared.h
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2010-07-03 16:01:48 +0000
committerAndrey Nazarov <skuller@skuller.net>2010-07-03 16:01:48 +0000
commit7a914ef872a436adcdb36d21ceddba6bb24eb993 (patch)
treedafc86024742e7bbced8ef897754beff5160f1ae /source/r_shared.h
parent1acd69e9a128e4f3abf06b5ae97c968c87663864 (diff)
Yet another huge commit.
Implemented new error reporting framework based on errno and custom error codes. Converted filesystem code, image and model managers, BSP loader to use the new framework and report errors more accurately. Replaced fileHandle_t with qhandle_t. Removed INVALID_LENGTH definition. Killed USE_LOADBUF code. Defined FS_FileExists(Ex) macro, implemented FS_EasyOpenFile and FS_WriteFile helper functions. When testing for free screenshot slots, open the file with O_EXCL flag to avoid race conditions (works only on glibc yet). Don't allow quake paths with high bits set. Don't tolerate any fatal errors encountered when searching for files and pass errors back to the caller. FS_Seek() now fails on files from packs instead of returning an invalid position. Fixed ‘mvdskip’ command not working properly. Avoid inefficient usage of MakeColor macro in image loading functions. Prevent memory leak in JPEG and PNG image functions after calling longjmp() by marking some local variables volatile. Added support for loading monochrome JPEG images. Fixed signed integer overflow in GetWavinfo(). Fixed missing return statement in BSP_LoadSurfEdges() causing out of range edge indices to be left uncaught. Fixed possible access to uninitialized memory in BSP_LoadLeafs() for maps with no leafs. Properly NUL terminate the buffer in SCR_ScoreDump_f(), also check for being in a level. Always free latched_string when cvar is set back to current value. Fixed a crash in ‘mvdplay’ command possible when demo file is invalid.
Diffstat (limited to 'source/r_shared.h')
-rw-r--r--source/r_shared.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/source/r_shared.h b/source/r_shared.h
index ae0fea5..7d4336e 100644
--- a/source/r_shared.h
+++ b/source/r_shared.h
@@ -79,8 +79,7 @@ typedef enum {
it_wall,
it_pic,
it_sky,
- it_charset,
- it_tmp
+ it_charset
} imagetype_t;
#define EXTENSION_PNG MakeRawLong( '.', 'p', 'n', 'g' )
@@ -133,24 +132,31 @@ qhandle_t R_RegisterSkin( const char *name );
qhandle_t R_RegisterPic( const char *name );
qhandle_t R_RegisterFont( const char *name );
-qboolean IMG_LoadPCX( const char *filename, byte **pic, byte *palette,
+qerror_t IMG_LoadPCX( const char *filename, byte **pic, byte *palette,
int *width, int *height );
+qerror_t IMG_WritePCX( qhandle_t f, const char *filename, const byte *data, int width,
+ int height, int rowbytes, byte *palette );
+
+#if USE_TGA || USE_JPG || USE_PNG
+typedef qerror_t (img_load_t)( const char *, byte **, int *, int * );
+typedef qerror_t (img_save_t)( qhandle_t, const char *, const byte *, int, int, int );
+#endif
#if USE_TGA
-void IMG_LoadTGA( const char *filename, byte **pic, int *width, int *height );
-qboolean IMG_WriteTGA( const char *filename, const byte *rgb,
- int width, int height );
+qerror_t IMG_LoadTGA( const char *filename, byte **pic, int *width, int *height );
+qerror_t IMG_SaveTGA( qhandle_t f, const char *filename, const byte *bgr,
+ int width, int height, int unused );
#endif
#if USE_JPG
-void IMG_LoadJPG( const char *filename, byte **pic, int *width, int *height );
-qboolean IMG_WriteJPG( const char *filename, const byte *rgb,
+qerror_t IMG_LoadJPG( const char *filename, byte **pic, int *width, int *height );
+qerror_t IMG_SaveJPG( qhandle_t f, const char *filename, const byte *rgb,
int width, int height, int quality );
#endif
#if USE_PNG
-void IMG_LoadPNG( const char *filename, byte **pic, int *width, int *height );
-qboolean IMG_WritePNG( const char *filename, const byte *rgb,
+qerror_t IMG_LoadPNG( const char *filename, byte **pic, int *width, int *height );
+qerror_t IMG_SavePNG( qhandle_t f, const char *filename, const byte *rgb,
int width, int height, int compression );
#endif