From aabde35b19947b4cb10b1fe716a9a603031b2809 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 29 Jan 2010 09:59:56 +0000 Subject: [PATCH] fix line endings (CRLF -> LF) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9878 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=fcbf1cc594589ae561a2e4070664480acee218a3 --- cl_dyntexture.c | 186 ++++++++++++++++++++++++------------------------ cl_dyntexture.h | 40 +++++------ cl_gecko.h | 78 ++++++++++---------- 3 files changed, 152 insertions(+), 152 deletions(-) diff --git a/cl_dyntexture.c b/cl_dyntexture.c index cd310aab..fb378def 100644 --- a/cl_dyntexture.c +++ b/cl_dyntexture.c @@ -1,93 +1,93 @@ -// Andreas Kirsch 07 - -#include "quakedef.h" -#include "cl_dyntexture.h" - -typedef struct dyntexture_s { - // everything after DYNAMIC_TEXTURE_PATH_PREFIX - char name[ MAX_QPATH + 32 ]; - // texture pointer (points to r_texture_white at first) - rtexture_t *texture; -} dyntexture_t; - -static dyntexture_t dyntextures[ MAX_DYNAMIC_TEXTURE_COUNT ]; -static unsigned dyntexturecount; - -#define DEFAULT_DYNTEXTURE r_texture_grey128 - -static dyntexture_t * cl_finddyntexture( const char *name, qboolean warnonfailure ) { - unsigned i; - dyntexture_t *dyntexture = NULL; - - // sanity checks - make sure its actually a dynamic texture path - if( !name || !*name || strncmp( name, CLDYNTEXTUREPREFIX, sizeof( CLDYNTEXTUREPREFIX ) - 1 ) != 0 ) { - // TODO: print a warning or something - if (warnonfailure) - Con_Printf( "cl_finddyntexture: Bad dynamic texture name '%s'\n", name ); - return NULL; - } - - for( i = 0 ; i < dyntexturecount ; i++ ) { - dyntexture = &dyntextures[ i ]; - if( dyntexture->name && strcmp( dyntexture->name, name ) == 0 ) { - return dyntexture; - } - } - - if( dyntexturecount == MAX_DYNAMIC_TEXTURE_COUNT ) { - // TODO: warn or expand the array, etc. - return NULL; - } - dyntexture = &dyntextures[ dyntexturecount++ ]; - strlcpy( dyntexture->name, name, sizeof( dyntexture->name ) ); - dyntexture->texture = DEFAULT_DYNTEXTURE; - return dyntexture; -} - -rtexture_t * CL_GetDynTexture( const char *name ) { - dyntexture_t *dyntexture = cl_finddyntexture( name, false ); - if( dyntexture ) { - return dyntexture->texture; - } else { - return NULL; - } -} - -void CL_LinkDynTexture( const char *name, rtexture_t *texture ) { - dyntexture_t *dyntexture; - cachepic_t *cachepic; - skinframe_t *skinframe; - - dyntexture = cl_finddyntexture( name, true ); - if( !dyntexture ) { - Con_Printf( "CL_LinkDynTexture: internal error in cl_finddyntexture!\n" ); - return; - } - // TODO: assert dyntexture != NULL! - if( dyntexture->texture != texture ) { - dyntexture->texture = texture; - - cachepic = Draw_CachePic_Flags( name, CACHEPICFLAG_NOTPERSISTENT ); - // TODO: assert cachepic and skinframe should be valid pointers... - // TODO: assert cachepic->tex = dyntexture->texture - cachepic->tex = texture; - // update cachepic's size, too - cachepic->width = R_TextureWidth( texture ); - cachepic->height = R_TextureHeight( texture ); - - // update skinframes - skinframe = NULL; - while( (skinframe = R_SkinFrame_FindNextByName( skinframe, name )) != NULL ) { - skinframe->base = texture; - // simply reset the compare* attributes of skinframe - skinframe->comparecrc = 0; - skinframe->comparewidth = skinframe->compareheight = 0; - // this is kind of hacky - } - } -} - -void CL_UnlinkDynTexture( const char *name ) { - CL_LinkDynTexture( name, DEFAULT_DYNTEXTURE ); -} - +// Andreas Kirsch 07 + +#include "quakedef.h" +#include "cl_dyntexture.h" + +typedef struct dyntexture_s { + // everything after DYNAMIC_TEXTURE_PATH_PREFIX + char name[ MAX_QPATH + 32 ]; + // texture pointer (points to r_texture_white at first) + rtexture_t *texture; +} dyntexture_t; + +static dyntexture_t dyntextures[ MAX_DYNAMIC_TEXTURE_COUNT ]; +static unsigned dyntexturecount; + +#define DEFAULT_DYNTEXTURE r_texture_grey128 + +static dyntexture_t * cl_finddyntexture( const char *name, qboolean warnonfailure ) { + unsigned i; + dyntexture_t *dyntexture = NULL; + + // sanity checks - make sure its actually a dynamic texture path + if( !name || !*name || strncmp( name, CLDYNTEXTUREPREFIX, sizeof( CLDYNTEXTUREPREFIX ) - 1 ) != 0 ) { + // TODO: print a warning or something + if (warnonfailure) + Con_Printf( "cl_finddyntexture: Bad dynamic texture name '%s'\n", name ); + return NULL; + } + + for( i = 0 ; i < dyntexturecount ; i++ ) { + dyntexture = &dyntextures[ i ]; + if( dyntexture->name && strcmp( dyntexture->name, name ) == 0 ) { + return dyntexture; + } + } + + if( dyntexturecount == MAX_DYNAMIC_TEXTURE_COUNT ) { + // TODO: warn or expand the array, etc. + return NULL; + } + dyntexture = &dyntextures[ dyntexturecount++ ]; + strlcpy( dyntexture->name, name, sizeof( dyntexture->name ) ); + dyntexture->texture = DEFAULT_DYNTEXTURE; + return dyntexture; +} + +rtexture_t * CL_GetDynTexture( const char *name ) { + dyntexture_t *dyntexture = cl_finddyntexture( name, false ); + if( dyntexture ) { + return dyntexture->texture; + } else { + return NULL; + } +} + +void CL_LinkDynTexture( const char *name, rtexture_t *texture ) { + dyntexture_t *dyntexture; + cachepic_t *cachepic; + skinframe_t *skinframe; + + dyntexture = cl_finddyntexture( name, true ); + if( !dyntexture ) { + Con_Printf( "CL_LinkDynTexture: internal error in cl_finddyntexture!\n" ); + return; + } + // TODO: assert dyntexture != NULL! + if( dyntexture->texture != texture ) { + dyntexture->texture = texture; + + cachepic = Draw_CachePic_Flags( name, CACHEPICFLAG_NOTPERSISTENT ); + // TODO: assert cachepic and skinframe should be valid pointers... + // TODO: assert cachepic->tex = dyntexture->texture + cachepic->tex = texture; + // update cachepic's size, too + cachepic->width = R_TextureWidth( texture ); + cachepic->height = R_TextureHeight( texture ); + + // update skinframes + skinframe = NULL; + while( (skinframe = R_SkinFrame_FindNextByName( skinframe, name )) != NULL ) { + skinframe->base = texture; + // simply reset the compare* attributes of skinframe + skinframe->comparecrc = 0; + skinframe->comparewidth = skinframe->compareheight = 0; + // this is kind of hacky + } + } +} + +void CL_UnlinkDynTexture( const char *name ) { + CL_LinkDynTexture( name, DEFAULT_DYNTEXTURE ); +} + diff --git a/cl_dyntexture.h b/cl_dyntexture.h index 29783cf6..130dc167 100644 --- a/cl_dyntexture.h +++ b/cl_dyntexture.h @@ -1,20 +1,20 @@ -// Andreas 'Black' Kirsch 07 -#ifndef CL_DYNTEXTURE_H -#define CL_DYNTEXTURE_H - -#define CLDYNTEXTUREPREFIX "_dynamic/" - -// always path fully specified names to the dynamic texture functions! (ie. with the _dynamic/ prefix, etc.!) - -// return a valid texture handle for a dynamic texture (might be filler texture if it hasnt been initialized yet) -// or NULL if its not a valid dynamic texture name -rtexture_t * CL_GetDynTexture( const char *name ); - -// link a texture handle as dynamic texture and update texture handles in the renderer and draw_* accordingly -void CL_LinkDynTexture( const char *name, rtexture_t *texture ); - -// unlink a texture handle from its name -void CL_UnlinkDynTexture( const char *name ); - -#endif - +// Andreas 'Black' Kirsch 07 +#ifndef CL_DYNTEXTURE_H +#define CL_DYNTEXTURE_H + +#define CLDYNTEXTUREPREFIX "_dynamic/" + +// always path fully specified names to the dynamic texture functions! (ie. with the _dynamic/ prefix, etc.!) + +// return a valid texture handle for a dynamic texture (might be filler texture if it hasnt been initialized yet) +// or NULL if its not a valid dynamic texture name +rtexture_t * CL_GetDynTexture( const char *name ); + +// link a texture handle as dynamic texture and update texture handles in the renderer and draw_* accordingly +void CL_LinkDynTexture( const char *name, rtexture_t *texture ); + +// unlink a texture handle from its name +void CL_UnlinkDynTexture( const char *name ); + +#endif + diff --git a/cl_gecko.h b/cl_gecko.h index 22ab2fa5..c95b410b 100644 --- a/cl_gecko.h +++ b/cl_gecko.h @@ -1,39 +1,39 @@ -// Andreas Kirsch 07 - -#ifndef CL_GECKO_H -#define CL_GECKO_H - -#include "cl_dyntexture.h" - -#define CLGECKOPREFIX CLDYNTEXTUREPREFIX "gecko/" - -typedef enum clgecko_buttoneventtype_e { - CLG_BET_DOWN, - CLG_BET_UP, - CLG_BET_DOUBLECLICK, - // use for up + down (but dont use both) - CLG_BET_PRESS -} clgecko_buttoneventtype_t; - -typedef struct clgecko_s clgecko_t; - -void CL_Gecko_Frame( void ); -void CL_Gecko_Init( void ); -void CL_Gecko_Shutdown( void ); - -clgecko_t * CL_Gecko_CreateBrowser( const char *name, int ownerProg ); -clgecko_t * CL_Gecko_FindBrowser( const char *name ); -void CL_Gecko_DestroyBrowser( clgecko_t *instance ); - -void CL_Gecko_NavigateToURI( clgecko_t *instance, const char *URI ); -// x and y between 0.0 and 1.0 (0.0 is top-left?) -void CL_Gecko_Event_CursorMove( clgecko_t *instance, float x, float y ); - -// returns whether the key/button event was handled or not -qboolean CL_Gecko_Event_Key( clgecko_t *instance, keynum_t key, clgecko_buttoneventtype_t eventtype ); - -void CL_Gecko_Resize( clgecko_t *instance, int width, int height ); -// get the ratio between gecko instance's size in the texture and the actual texture size.. -void CL_Gecko_GetTextureExtent( clgecko_t *instance, float* pwidth, float* pheight ); -#endif - +// Andreas Kirsch 07 + +#ifndef CL_GECKO_H +#define CL_GECKO_H + +#include "cl_dyntexture.h" + +#define CLGECKOPREFIX CLDYNTEXTUREPREFIX "gecko/" + +typedef enum clgecko_buttoneventtype_e { + CLG_BET_DOWN, + CLG_BET_UP, + CLG_BET_DOUBLECLICK, + // use for up + down (but dont use both) + CLG_BET_PRESS +} clgecko_buttoneventtype_t; + +typedef struct clgecko_s clgecko_t; + +void CL_Gecko_Frame( void ); +void CL_Gecko_Init( void ); +void CL_Gecko_Shutdown( void ); + +clgecko_t * CL_Gecko_CreateBrowser( const char *name, int ownerProg ); +clgecko_t * CL_Gecko_FindBrowser( const char *name ); +void CL_Gecko_DestroyBrowser( clgecko_t *instance ); + +void CL_Gecko_NavigateToURI( clgecko_t *instance, const char *URI ); +// x and y between 0.0 and 1.0 (0.0 is top-left?) +void CL_Gecko_Event_CursorMove( clgecko_t *instance, float x, float y ); + +// returns whether the key/button event was handled or not +qboolean CL_Gecko_Event_Key( clgecko_t *instance, keynum_t key, clgecko_buttoneventtype_t eventtype ); + +void CL_Gecko_Resize( clgecko_t *instance, int width, int height ); +// get the ratio between gecko instance's size in the texture and the actual texture size.. +void CL_Gecko_GetTextureExtent( clgecko_t *instance, float* pwidth, float* pheight ); +#endif + -- 2.39.2