add wrappers for function pointers with default arguments

This commit is contained in:
Jonathan Gray 2013-04-23 18:12:43 +10:00
parent be54255a02
commit e18c1d17b7
9 changed files with 101 additions and 66 deletions

View file

@ -234,10 +234,10 @@ void CL_InitUI( void ) {
uii.R_RegisterShader = re.RegisterShader; uii.R_RegisterShader = re.RegisterShader;
uii.R_RegisterShaderNoMip = re.RegisterShaderNoMip; uii.R_RegisterShaderNoMip = re.RegisterShaderNoMip;
uii.R_RegisterFont = re.RegisterFont; uii.R_RegisterFont = re.RegisterFont;
#ifndef _XBOX #if defined(_XBOX) || defined(__GNUC__)
uii.R_Font_StrLenPixels = re.Font_StrLenPixels; uii._R_Font_StrLenPixels = re._Font_StrLenPixels;
uii.R_Font_HeightPixels = re.Font_HeightPixels; uii._R_Font_HeightPixels = re._Font_HeightPixels;
uii.R_Font_DrawString = re.Font_DrawString; uii._R_Font_DrawString = re._Font_DrawString;
#endif #endif
uii.R_Font_StrLenChars = re.Font_StrLenChars; uii.R_Font_StrLenChars = re.Font_StrLenChars;
uii.Language_IsAsian = re.Language_IsAsian; uii.Language_IsAsian = re.Language_IsAsian;

View file

@ -102,7 +102,7 @@ typedef enum {
#define PMF_FIX_MINS (1<<19)//524288 // Mins raised for dual forward jump, fix them #define PMF_FIX_MINS (1<<19)//524288 // Mins raised for dual forward jump, fix them
#define PMF_ALL_TIMES (PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_KNOCKBACK|PMF_TIME_NOFRICTION) #define PMF_ALL_TIMES (PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_KNOCKBACK|PMF_TIME_NOFRICTION)
#if defined(_XBOX) && !defined(_TRACE_FUNCTOR_T_DEFINED_) #if (defined(_XBOX) || defined(__GNUC__)) && !defined(_TRACE_FUNCTOR_T_DEFINED_)
// Function objects to replace the function pointers used for trace in pmove_t // Function objects to replace the function pointers used for trace in pmove_t
// We can't have default arguments on function pointers, but this allows us to // We can't have default arguments on function pointers, but this allows us to
// do the same thing with minimal impact elsewhere. // do the same thing with minimal impact elsewhere.
@ -153,7 +153,7 @@ typedef struct {
// callbacks to test the world // callbacks to test the world
// these will be different functions during game and cgame // these will be different functions during game and cgame
#ifdef _XBOX #if defined(_XBOX) || defined(__GNUC__)
Trace_Functor_t trace; Trace_Functor_t trace;
#else #else
void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,

View file

@ -108,7 +108,7 @@ Ghoul2 Insert End
//=============================================================== //===============================================================
#if defined(_XBOX) && !defined(_TRACE_FUNCTOR_T_DEFINED_) #if (defined(_XBOX) || defined(__GNUC__)) && !defined(_TRACE_FUNCTOR_T_DEFINED_)
// Function objects to replace the function pointers used for trace // Function objects to replace the function pointers used for trace
// We can't have default arguments on function pointers, but this allows us to // We can't have default arguments on function pointers, but this allows us to
// do the same thing with minimal impact elsewhere. // do the same thing with minimal impact elsewhere.
@ -131,30 +131,6 @@ struct Trace_Functor_t
#define _TRACE_FUNCTOR_T_DEFINED_ #define _TRACE_FUNCTOR_T_DEFINED_
#endif #endif
#ifdef _XBOX
// Declare all the functions that we use in the inlined member functions
/*
extern int G2API_InitGhoul2Model(CGhoul2Info_v &ghoul2, const char *fileName, int modelIndex, qhandle_t customSkin = NULL,
qhandle_t customShader = NULL, int modelFlags = 0, int lodBias = 0);
extern qboolean G2API_SetSkin(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t renderSkin = 0);
extern qboolean G2API_SetBoneAnim(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame,
const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1);
extern qboolean G2API_SetBoneAngles(CGhoul2Info *ghlInfo, const char *boneName, const vec3_t angles, const int flags,
const Eorientations up, const Eorientations right, const Eorientations forward, qhandle_t *modelList,
int blendTime = 0, int currentTime = 0);
extern qboolean G2API_SetBoneAnglesMatrix(CGhoul2Info *ghlInfo, const char *boneName, const mdxaBone_t &matrix, const int flags,
qhandle_t *modelList, int blendTime = 0, int currentTime = 0);
extern void G2API_CopyGhoul2Instance(CGhoul2Info_v &Ghoul2From, CGhoul2Info_v &Ghoul2To, int modelIndex = -1);
extern qboolean G2API_SetBoneAnglesIndex(CGhoul2Info *ghlInfo, const int index, const vec3_t angles, const int flags,
const Eorientations yaw, const Eorientations pitch, const Eorientations roll,
qhandle_t *modelList, int blendTime, int currentTime);
extern qboolean G2API_SetBoneAnimIndex(CGhoul2Info *ghlInfo, const int index, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame, const int blendTime);
*/
#include "../ghoul2/G2.h"
extern int SG_Read (unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr);
extern int SG_ReadOptional (unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr);
#endif
// //
// functions provided by the main engine // functions provided by the main engine
// //
@ -203,20 +179,23 @@ typedef struct {
// Savegame handling // Savegame handling
// //
qboolean (*AppendToSaveGame)(unsigned long chid, const void *data, int length); qboolean (*AppendToSaveGame)(unsigned int chid, const void *data, int length);
#ifdef _XBOX // No default arguments through function pointers #if defined(_XBOX) || defined(__GNUC__) // No default arguments through function pointers
int ReadFromSaveGame(unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL) int (*_ReadFromSaveGame)(unsigned int chid, void *pvAddress, int iLength, void **ppvAddressPtr);
int (*_ReadFromSaveGameOptional)(unsigned int chid, void *pvAddress, int iLength, void **ppvAddressPtr);
int ReadFromSaveGame(unsigned int chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL)
{ {
return SG_Read(chid, pvAddress, iLength, ppvAddressPtr); return (*_ReadFromSaveGame)(chid, pvAddress, iLength, ppvAddressPtr);
} }
int ReadFromSaveGameOptional(unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL) int ReadFromSaveGameOptional(unsigned int chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL)
{ {
return SG_ReadOptional(chid, pvAddress, iLength, ppvAddressPtr); return (*_ReadFromSaveGameOptional)(chid, pvAddress, iLength, ppvAddressPtr);
} }
#else #else
int (*ReadFromSaveGame)(unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL); int (*ReadFromSaveGame)(unsigned int chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL);
int (*ReadFromSaveGameOptional)(unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL); int (*ReadFromSaveGameOptional)(unsigned int chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL);
#endif #endif
// add commands to the console as if they were typed in // add commands to the console as if they were typed in
// for map changing, etc // for map changing, etc
@ -253,7 +232,7 @@ typedef struct {
void (*SetBrushModel)( gentity_t *ent, const char *name ); void (*SetBrushModel)( gentity_t *ent, const char *name );
// collision detection against all linked entities // collision detection against all linked entities
#ifdef _XBOX #if defined(_XBOX) || defined(__GNUC__)
Trace_Functor_t trace; Trace_Functor_t trace;
#else #else
void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,
@ -296,52 +275,70 @@ Ghoul2 Insert Start
*/ */
qhandle_t (*G2API_PrecacheGhoul2Model)(const char *fileName); qhandle_t (*G2API_PrecacheGhoul2Model)(const char *fileName);
#ifdef _XBOX // No default arguments through function pointers #if defined(_XBOX) || defined(__GNUC__) // No default arguments through function pointers
int (*_G2API_InitGhoul2Model)(CGhoul2Info_v &ghoul2, const char *fileName, int modelIndex, qhandle_t customSkin,
qhandle_t customShader, int modelFlags, int lodBias);
qboolean (*_G2API_SetSkin)(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t renderSkin);
qboolean (*_G2API_SetBoneAnim)(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame,
const int flags, const float animSpeed, const int currentTime, const float setFrame, const int blendTime);
qboolean (*_G2API_SetBoneAngles)(CGhoul2Info *ghlInfo, const char *boneName, const vec3_t angles,
const int flags, const Eorientations up, const Eorientations right, const Eorientations forward,
qhandle_t *modelList, int blendTime, int blendStart);
qboolean (*_G2API_SetBoneAnglesIndex)(CGhoul2Info *ghlInfo, const int index, const vec3_t angles, const int flags,
const Eorientations yaw, const Eorientations pitch, const Eorientations roll,
qhandle_t *modelList, int blendTime, int currentTime);
qboolean (*_G2API_SetBoneAnglesMatrix)(CGhoul2Info *ghlInfo, const char *boneName, const mdxaBone_t &matrix, const int flags,
qhandle_t *modelList, int blendTime, int currentTime);
void (*_G2API_CopyGhoul2Instance)(CGhoul2Info_v &ghoul2From, CGhoul2Info_v &ghoul2To, int modelIndex);
qboolean (*_G2API_SetBoneAnimIndex)(CGhoul2Info *ghlInfo, const int index, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame, const int blendTime);
int G2API_InitGhoul2Model(CGhoul2Info_v &ghoul2, const char *fileName, int modelIndex, qhandle_t customSkin = NULL, int G2API_InitGhoul2Model(CGhoul2Info_v &ghoul2, const char *fileName, int modelIndex, qhandle_t customSkin = NULL,
qhandle_t customShader = NULL, int modelFlags = 0, int lodBias = 0) qhandle_t customShader = NULL, int modelFlags = 0, int lodBias = 0)
{ {
return ::G2API_InitGhoul2Model(ghoul2, fileName, modelIndex, customSkin, customShader, modelFlags, lodBias); return (*_G2API_InitGhoul2Model)(ghoul2, fileName, modelIndex, customSkin, customShader, modelFlags, lodBias);
} }
qboolean G2API_SetSkin(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t renderSkin = 0 ) qboolean G2API_SetSkin(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t renderSkin = 0 )
{ {
return ::G2API_SetSkin(ghlInfo, customSkin, renderSkin); return (*_G2API_SetSkin)(ghlInfo, customSkin, renderSkin);
} }
qboolean G2API_SetBoneAnim(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame, qboolean G2API_SetBoneAnim(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame,
const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1) const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1)
{ {
return ::G2API_SetBoneAnim(ghlInfo, boneName, startFrame, endFrame, flags, animSpeed, currentTime, setFrame, blendTime); return (*_G2API_SetBoneAnim)(ghlInfo, boneName, startFrame, endFrame, flags, animSpeed, currentTime, setFrame, blendTime);
} }
qboolean G2API_SetBoneAngles(CGhoul2Info *ghlInfo, const char *boneName, const vec3_t angles, qboolean G2API_SetBoneAngles(CGhoul2Info *ghlInfo, const char *boneName, const vec3_t angles,
const int flags, const Eorientations up, const Eorientations right, const Eorientations forward, const int flags, const Eorientations up, const Eorientations right, const Eorientations forward,
qhandle_t *modelList, int blendTime = 0, int blendStart = 0) qhandle_t *modelList, int blendTime = 0, int blendStart = 0)
{ {
return ::G2API_SetBoneAngles(ghlInfo, boneName, angles, flags, up, right, forward, modelList, blendTime, blendStart); return (*_G2API_SetBoneAngles)(ghlInfo, boneName, angles, flags, up, right, forward, modelList, blendTime, blendStart);
} }
qboolean G2API_SetBoneAnglesMatrix(CGhoul2Info *ghlInfo, const char *boneName, const mdxaBone_t &matrix, const int flags, qboolean G2API_SetBoneAnglesMatrix(CGhoul2Info *ghlInfo, const char *boneName, const mdxaBone_t &matrix, const int flags,
qhandle_t *modelList, int blendTime = 0, int currentTime = 0) qhandle_t *modelList, int blendTime = 0, int currentTime = 0)
{ {
return ::G2API_SetBoneAnglesMatrix(ghlInfo, boneName, matrix, flags, modelList, blendTime, currentTime); return (*_G2API_SetBoneAnglesMatrix)(ghlInfo, boneName, matrix, flags, modelList, blendTime, currentTime);
} }
void G2API_CopyGhoul2Instance(CGhoul2Info_v &ghoul2From, CGhoul2Info_v &ghoul2To, int modelIndex = -1) void G2API_CopyGhoul2Instance(CGhoul2Info_v &ghoul2From, CGhoul2Info_v &ghoul2To, int modelIndex = -1)
{ {
::G2API_CopyGhoul2Instance(ghoul2From, ghoul2To, modelIndex); (*_G2API_CopyGhoul2Instance)(ghoul2From, ghoul2To, modelIndex);
} }
qboolean G2API_SetBoneAnglesIndex(CGhoul2Info *ghlInfo, const int index, const vec3_t angles, const int flags, qboolean G2API_SetBoneAnglesIndex(CGhoul2Info *ghlInfo, const int index, const vec3_t angles, const int flags,
const Eorientations yaw, const Eorientations pitch, const Eorientations roll, const Eorientations yaw, const Eorientations pitch, const Eorientations roll,
qhandle_t *modelList, int blendTime = 0, int currentTime = 0) qhandle_t *modelList, int blendTime = 0, int currentTime = 0)
{ {
return ::G2API_SetBoneAnglesIndex(ghlInfo, index, angles, flags, yaw, pitch, roll, modelList, blendTime, currentTime); return (*_G2API_SetBoneAnglesIndex)(ghlInfo, index, angles, flags, yaw, pitch, roll, modelList, blendTime, currentTime);
} }
qboolean G2API_SetBoneAnimIndex(CGhoul2Info *ghlInfo, const int index, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1) qboolean G2API_SetBoneAnimIndex(CGhoul2Info *ghlInfo, const int index, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1)
{ {
return ::G2API_SetBoneAnimIndex(ghlInfo, index, startFrame, endFrame, flags, animSpeed, currentTime, setFrame, blendTime); return (*_G2API_SetBoneAnimIndex)(ghlInfo, index, startFrame, endFrame, flags, animSpeed, currentTime, setFrame, blendTime);
} }
#else #else

View file

@ -1622,7 +1622,11 @@ refexport_t *GetRefAPI ( int apiVersion ) {
re.GetBModelVerts = RE_GetBModelVerts; re.GetBModelVerts = RE_GetBModelVerts;
re.RegisterFont = RE_RegisterFont; re.RegisterFont = RE_RegisterFont;
#ifndef _XBOX #if defined(_XBOX) || defined(__GNUC__)
re._Font_StrLenPixels = RE_Font_StrLenPixels;
re._Font_HeightPixels = RE_Font_HeightPixels;
re._Font_DrawString = RE_Font_DrawString;
#else
re.Font_StrLenPixels = RE_Font_StrLenPixels; re.Font_StrLenPixels = RE_Font_StrLenPixels;
re.Font_HeightPixels = RE_Font_HeightPixels; re.Font_HeightPixels = RE_Font_HeightPixels;
re.Font_DrawString = RE_Font_DrawString; re.Font_DrawString = RE_Font_DrawString;

View file

@ -113,18 +113,22 @@ typedef struct {
void (*WorldEffectCommand)(const char *command); void (*WorldEffectCommand)(const char *command);
int (*RegisterFont)(const char *name); int (*RegisterFont)(const char *name);
#ifdef _XBOX // No default arguments through function pointers. #if defined(_XBOX) || defined(__GNUC__) // No default arguments through function pointers.
int (*_Font_HeightPixels)(const int index, const float scale);
int (*_Font_StrLenPixels)(const char *s, const int index, const float scale);
void (*_Font_DrawString)(int x, int y, const char *s, const float *rgba, const int iFontHandle, int iMaxPixelWidth, const float scale);
int Font_HeightPixels(const int index, const float scale = 1.0f) int Font_HeightPixels(const int index, const float scale = 1.0f)
{ {
return RE_Font_HeightPixels(index, scale); return (*_Font_HeightPixels)(index, scale);
} }
int Font_StrLenPixels(const char *s, const int index, const float scale = 1.0f) int Font_StrLenPixels(const char *s, const int index, const float scale = 1.0f)
{ {
return RE_Font_StrLenPixels(s, index, scale); return (*_Font_StrLenPixels)(s, index, scale);
} }
void Font_DrawString(int x, int y, const char *s, const float *rgba, const int iFontHandle, int iMaxPixelWidth, const float scale = 1.0f) void Font_DrawString(int x, int y, const char *s, const float *rgba, const int iFontHandle, int iMaxPixelWidth, const float scale = 1.0f)
{ {
return RE_Font_DrawString(x, y, s, rgba, iFontHandle, iMaxPixelWidth, scale); return (*_Font_DrawString)(x, y, s, rgba, iFontHandle, iMaxPixelWidth, scale);
} }
#else #else
int (*Font_HeightPixels)(const int index, const float scale = 1.0f); int (*Font_HeightPixels)(const int index, const float scale = 1.0f);

View file

@ -542,7 +542,10 @@ void SV_InitGameProgs (void) {
import.FS_GetFileList = FS_GetFileList; import.FS_GetFileList = FS_GetFileList;
import.AppendToSaveGame = SG_Append; import.AppendToSaveGame = SG_Append;
#ifndef _XBOX #if defined(_XBOX) || defined(__GNUC__)
import._ReadFromSaveGame = SG_Read;
import._ReadFromSaveGameOptional = SG_ReadOptional;
#else
import.ReadFromSaveGame = SG_Read; import.ReadFromSaveGame = SG_Read;
import.ReadFromSaveGameOptional = SG_ReadOptional; import.ReadFromSaveGameOptional = SG_ReadOptional;
#endif #endif
@ -571,7 +574,16 @@ Ghoul2 Insert Start
import.G2API_GetBoneAnimIndex = G2API_GetBoneAnimIndex; import.G2API_GetBoneAnimIndex = G2API_GetBoneAnimIndex;
import.G2API_AddSurface = G2API_AddSurface; import.G2API_AddSurface = G2API_AddSurface;
import.G2API_HaveWeGhoul2Models =G2API_HaveWeGhoul2Models; import.G2API_HaveWeGhoul2Models =G2API_HaveWeGhoul2Models;
#ifndef _XBOX #if defined(_XBOX) || defined(__GNUC__)
import._G2API_InitGhoul2Model = G2API_InitGhoul2Model;
import._G2API_SetBoneAngles = G2API_SetBoneAngles;
import._G2API_SetBoneAnglesMatrix = G2API_SetBoneAnglesMatrix;
import._G2API_SetBoneAnim = G2API_SetBoneAnim;
import._G2API_SetSkin = G2API_SetSkin;
import._G2API_CopyGhoul2Instance = G2API_CopyGhoul2Instance;
import._G2API_SetBoneAnglesIndex = G2API_SetBoneAnglesIndex;
import._G2API_SetBoneAnimIndex = G2API_SetBoneAnimIndex;
#else
import.G2API_InitGhoul2Model = G2API_InitGhoul2Model; import.G2API_InitGhoul2Model = G2API_InitGhoul2Model;
import.G2API_SetBoneAngles = G2API_SetBoneAngles; import.G2API_SetBoneAngles = G2API_SetBoneAngles;
import.G2API_SetBoneAnglesMatrix = G2API_SetBoneAnglesMatrix; import.G2API_SetBoneAnglesMatrix = G2API_SetBoneAnglesMatrix;

View file

@ -2564,12 +2564,16 @@ void _UI_Init( qboolean inGameLoad )
uiInfo.uiDC.registerSkin = re.RegisterSkin; uiInfo.uiDC.registerSkin = re.RegisterSkin;
#ifndef _XBOX #if defined(_XBOX) || defined(__GNUC__)
uiInfo.uiDC._g2_SetSkin = G2API_SetSkin;
uiInfo.uiDC._g2_SetBoneAnim = G2API_SetBoneAnim;
uiInfo.uiDC._g2_InitGhoul2Model = G2API_InitGhoul2Model;
#else
uiInfo.uiDC.g2_SetSkin = G2API_SetSkin; uiInfo.uiDC.g2_SetSkin = G2API_SetSkin;
uiInfo.uiDC.g2_SetBoneAnim = G2API_SetBoneAnim; uiInfo.uiDC.g2_SetBoneAnim = G2API_SetBoneAnim;
uiInfo.uiDC.g2_InitGhoul2Model = G2API_InitGhoul2Model;
#endif #endif
uiInfo.uiDC.g2_RemoveGhoul2Model = G2API_RemoveGhoul2Model; uiInfo.uiDC.g2_RemoveGhoul2Model = G2API_RemoveGhoul2Model;
uiInfo.uiDC.g2_InitGhoul2Model = G2API_InitGhoul2Model;
uiInfo.uiDC.g2_CleanGhoul2Models = G2API_CleanGhoul2Models; uiInfo.uiDC.g2_CleanGhoul2Models = G2API_CleanGhoul2Models;
uiInfo.uiDC.g2_AddBolt = G2API_AddBolt; uiInfo.uiDC.g2_AddBolt = G2API_AddBolt;
uiInfo.uiDC.g2_GetBoltMatrix = G2API_GetBoltMatrix; uiInfo.uiDC.g2_GetBoltMatrix = G2API_GetBoltMatrix;

View file

@ -48,18 +48,22 @@ typedef struct {
qhandle_t (*R_RegisterShader)( const char *name ); // returns white if not found qhandle_t (*R_RegisterShader)( const char *name ); // returns white if not found
qhandle_t (*R_RegisterShaderNoMip)( const char *name ); // returns white if not found qhandle_t (*R_RegisterShaderNoMip)( const char *name ); // returns white if not found
qhandle_t (*R_RegisterFont)( const char *name ); // returns 0 for bad font qhandle_t (*R_RegisterFont)( const char *name ); // returns 0 for bad font
#ifdef _XBOX // No default arguments on function pointers #if defined(_XBOX) || defined(__GNUC__) // No default arguments on function pointers
int (*_R_Font_StrLenPixels)(const char *text, const int setIndex, const float scale);
int (*_R_Font_HeightPixels)(const int setIndex, const float scale);
void (*_R_Font_DrawString)(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iMaxPixelWidth, const float scale);
int R_Font_StrLenPixels(const char *text, const int setIndex, const float scale = 1.0f) int R_Font_StrLenPixels(const char *text, const int setIndex, const float scale = 1.0f)
{ {
return RE_Font_StrLenPixels(text, setIndex, scale); return (*_R_Font_StrLenPixels)(text, setIndex, scale);
} }
int R_Font_HeightPixels(const int setIndex, const float scale = 1.0f) int R_Font_HeightPixels(const int setIndex, const float scale = 1.0f)
{ {
return RE_Font_HeightPixels(setIndex, scale); return (*_R_Font_HeightPixels)(setIndex, scale);
} }
void R_Font_DrawString(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iMaxPixelWidth, const float scale = 1.0f) void R_Font_DrawString(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iMaxPixelWidth, const float scale = 1.0f)
{ {
RE_Font_DrawString(ox, oy, text, rgba, setIndex, iMaxPixelWidth, scale); (*_R_Font_DrawString)(ox, oy, text, rgba, setIndex, iMaxPixelWidth, scale);
} }
#else #else
int (*R_Font_StrLenPixels)(const char *text, const int setIndex, const float scale = 1.0f); int (*R_Font_StrLenPixels)(const char *text, const int setIndex, const float scale = 1.0f);

View file

@ -214,23 +214,33 @@ typedef struct {
qhandle_t (*registerSkin)( const char *name ); qhandle_t (*registerSkin)( const char *name );
//rww - ghoul2 stuff. Add whatever you need here, remember to set it in _UI_Init or it will crash when you try to use it. //rww - ghoul2 stuff. Add whatever you need here, remember to set it in _UI_Init or it will crash when you try to use it.
#ifdef _XBOX // No default arguments on function pointers #if defined(_XBOX) || defined(__GNUC__) // No default arguments on function pointers
qboolean (*_g2_SetSkin)(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t);
qboolean (*_g2_SetBoneAnim)(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame,
const int flags, const float animSpeed, const int currentTime, const float, const int);
int (*_g2_InitGhoul2Model)(CGhoul2Info_v &ghoul2, const char *fileName, int, qhandle_t customSkin, qhandle_t customShader, int modelFlags, int);
qboolean g2_SetSkin(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t renderSkin = 0) qboolean g2_SetSkin(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t renderSkin = 0)
{ {
return G2API_SetSkin(ghlInfo, customSkin, renderSkin); return (*_g2_SetSkin)(ghlInfo, customSkin, renderSkin);
} }
qboolean g2_SetBoneAnim(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame, qboolean g2_SetBoneAnim(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame,
const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1) const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1)
{ {
return G2API_SetBoneAnim(ghlInfo, boneName, startFrame, endFrame, flags, animSpeed, currentTime, setFrame, blendTime); return (*_g2_SetBoneAnim)(ghlInfo, boneName, startFrame, endFrame, flags, animSpeed, currentTime, setFrame, blendTime);
}
int g2_InitGhoul2Model(CGhoul2Info_v &ghoul2, const char *fileName, int modelIndex, qhandle_t customSkin = NULL, qhandle_t customShader = NULL, int modelFlags = 0, int lodBias = 0)
{
return (*_g2_InitGhoul2Model)(ghoul2, fileName, modelIndex, customSkin, customShader, modelFlags, lodBias);
} }
#else #else
qboolean (*g2_SetSkin)(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t renderSkin = 0); qboolean (*g2_SetSkin)(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t renderSkin = 0);
qboolean (*g2_SetBoneAnim)(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame, qboolean (*g2_SetBoneAnim)(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame,
const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1); const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1);
int (*g2_InitGhoul2Model)(CGhoul2Info_v &ghoul2, const char *fileName, int, qhandle_t customSkin = NULL, qhandle_t customShader = NULL, int modelFlags = 0, int lodBias = 0);
#endif #endif
qboolean (*g2_RemoveGhoul2Model)(CGhoul2Info_v &ghlInfo, const int modelIndex); qboolean (*g2_RemoveGhoul2Model)(CGhoul2Info_v &ghlInfo, const int modelIndex);
int (*g2_InitGhoul2Model)(CGhoul2Info_v &ghoul2, const char *fileName, int, qhandle_t customSkin, qhandle_t customShader, int modelFlags, int lodBias);
void (*g2_CleanGhoul2Models)(CGhoul2Info_v &ghoul2); void (*g2_CleanGhoul2Models)(CGhoul2Info_v &ghoul2);
int (*g2_AddBolt)(CGhoul2Info *ghlInfo, const char *boneName); int (*g2_AddBolt)(CGhoul2Info *ghlInfo, const char *boneName);
qboolean (*g2_GetBoltMatrix)(CGhoul2Info_v &ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix, qboolean (*g2_GetBoltMatrix)(CGhoul2Info_v &ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,