#define cgArray 0xE22F18
int CG_GetLocalClientGlobals(int mod)
{
return *(int*)cgArray + mod; // cg_t
}
int CG_GetLocalClientTime()
{
return *(int*)(CG_GetLocalClientGlobals(0x4838C));
}
struct GfxCmdHeader
{
unsigned short byteCount;
char id;
char ui3d;
};
union GfxColor
{
unsigned int packed;
char array[4];
};
struct GfxCmdDrawText2D
{
GfxCmdHeader header;
int type;
float x;
float y;
float w;
float h;
float rotation;
void *font;
float xScale;
float yScale;
GfxColor color;
int maxChars;
int renderFlags;
int cursorPos;
char cursorLetter;
GfxColor glowForceColor;
int fxBirthTime;
int fxLetterTime;
int fxDecayStartTime;
int fxDecayDuration;
int fxRedactDecayStartTime;
int fxRedactDecayDuration;
void *fxMaterial;
void *fxMaterialGlow;
float padding;
char text[3];
};
struct GfxCmdStretchPic
{
GfxCmdHeader header;
void *material;
float x;
float y;
float w0;
float w;
float h;
float s0;
float t0;
float s1;
float t1;
GfxColor color;
};
0x794980 - void R_ConvertColorToBytes(const float *colorFloat, char *colorBytes);
0x769F6C - GfxCmdHeader * R_GetCommandBuffer(int renderCmd, int bytes);
0x76A9B8 - bool SetDrawText2DGlowParms(GfxCmdDrawText2D *cmd, const float *color, const float *glowColor);
0x763220 - void * Material_RegisterHandle(const char *name, int imageTrack, bool errorIfMissing, int waitTime)
0x75A2C0 - void * R_RegisterFont(const char * name, int imageTrack);
0x3DA948 - bool Dvar_GetBool(dvar_t * dvar);
0x3DA628 - dvar_t * Dvar_FindMalleableVar(const char *dvarName);
bool DvarGetBool(const char *dvarName)
{
if (Dvar_GetBool(Dvar_FindMalleableVar(dvarName)))
return true;
else
return false;
}
void R_AddCmdDrawTextInternal(const char *text, const char *fontName, float x, float y, float scale, const float *color)
{
if (*text)
{
int len = strlen(text);
GfxCmdDrawText2D * cmd = (GfxCmdDrawText2D *)R_GetCommandBuffer(0x10, (len + 0x6 & 0xFFFFFFFC);
if (cmd)
{
cmd->type = 0;
cmd->x = x;
cmd->y = y;
cmd->w = 1;
cmd->rotation = 0;
cmd->xScale = scale;
cmd->yScale = scale;
cmd->font = R_RegisterFont(fontName, 0);
if (DvarGetBool("r_dualPlayActive"))
cmd->yScale = (cmd->yScale) * .5;
R_ConvertColorToBytes(color, (char *)&cmd->color);
cmd->maxChars = 0x7FFFFFFF;
cmd->renderFlags = 0;
memcpy(cmd->text, (char *)text, len);
cmd->text[len] = 0;
}
}
}
void R_AddCmdDrawTextWithEffectsInternal(const char *text, const char *fontName, float x, float y, float scale, const float *color, const float *glowColor, int fxBirthTime, int fxLetterTime, int fxDecayStartTime, int fxDecayDuration)
{
if (*text)
{
int len = strlen(text);
GfxCmdDrawText2D * cmd = (GfxCmdDrawText2D *)R_GetCommandBuffer(0x10, (len + 0x6 & 0xFFFFFFFC);
if (cmd)
{
cmd->type = 0;
cmd->x = x;
cmd->y = y;
cmd->w = 1;
cmd->rotation = 0;
cmd->xScale = scale;
cmd->yScale = scale;
cmd->font = R_RegisterFont(fontName, 0);
if (DvarGetBool("r_dualPlayActive"))
cmd->yScale = (cmd->yScale) * .5;
R_ConvertColorToBytes(color, (char *)&cmd->color);
cmd->maxChars = 0x7FFFFFFF;
cmd->renderFlags = 0;
memcpy(cmd->text, (char *)text, len);
cmd->text[len] = 0;
if (SetDrawText2DGlowParms(cmd, color, glowColor))
{
if (fxBirthTime)
{
cmd->renderFlags |= 0x880;
cmd->fxMaterial = NULL;
cmd->fxMaterialGlow = NULL;
cmd->fxBirthTime = fxBirthTime;
cmd->fxLetterTime = fxLetterTime;
cmd->fxDecayStartTime = fxDecayStartTime;
cmd->fxDecayDuration = fxDecayDuration;
cmd->padding = 0;
}
}
}
}
}
void R_AddCmdDrawStretchPicInternal(float x, float y, float width, float height, const float *color, const char *material)
{
GfxCmdStretchPic * cmd = (GfxCmdStretchPic *)R_GetCommandBuffer(0xA, 0x30);
if (cmd)
{
cmd->material = Material_RegisterHandle(material, 0, 0, 0);
cmd->x = x;
cmd->y = y;
cmd->w0 = 1;
cmd->w = width;
cmd->h = height;
cmd->s0 = 0;
cmd->t0 = 0;
cmd->s1 = 1;
cmd->t1 = 1;
R_ConvertColorToBytes(color, (char *)&cmd->color);
}
}
#define cgArray 0xE22F18
int CG_GetLocalClientGlobals(int mod)
{
return *(int*)cgArray + mod; // cg_s
}
int GetLocalLevelTime()
{
return *(int*)(CG_GetLocalClientGlobals(0x69D1);
}
struct GfxCmdHeader
{
unsigned short byteCount;
char id;
char ui3d;
};
union GfxColor
{
unsigned int packed;
char array[4];
};
struct GfxCmdDrawText2D
{
GfxCmdHeader header;
int type;
float x;
float y;
float w;
float h;
float rotation;
void *font;
float xScale;
float yScale;
GfxColor color;
int maxChars;
int renderFlags;
int cursorPos;
char cursorLetter;
GfxColor glowForceColor;
int fxBirthTime;
int fxLetterTime;
int fxDecayStartTime;
int fxDecayDuration;
int fxRedactDecayStartTime;
int fxRedactDecayDuration;
void *fxMaterial;
void *fxMaterialGlow;
float padding;
char text[3];
};
struct GfxCmdStretchPic
{
GfxCmdHeader header;
void *material;
float x;
float y;
float w0;
float w;
float h;
float s0;
float t0;
float s1;
float t1;
GfxColor color;
};
0x794980 - void R_ConvertColorToBytes(const float *colorFloat, char *colorBytes);
0x769F6C - GfxCmdHeader * R_GetCommandBuffer(int renderCmd, int bytes);
0x76A9B8 - bool SetDrawText2DGlowParms(GfxCmdDrawText2D *cmd, const float *color, const float *glowColor);
0x763220 - void * Material_RegisterHandle(const char *name, int imageTrack, bool errorIfMissing, int waitTime)
0x75A2C0 - void * R_RegisterFont(const char * name, int imageTrack);
0x3DA948 - bool Dvar_GetBool(dvar_t * dvar);
0x3DA628 - dvar_t * Dvar_FindMalleableVar(const char *dvarName);
bool DvarGetBool(const char *dvarName)
{
if (Dvar_GetBool(Dvar_FindMalleableVar(dvarName)))
return true;
else
return false;
}
void R_AddCmdDrawTextInternal(const char *text, const char *fontName, float x, float y, float scale, const float *color)
{
if (*text)
{
int len = strlen(text);
GfxCmdDrawText2D * cmd = (GfxCmdDrawText2D *)R_GetCommandBuffer(0x10, (len + 0x6 & 0xFFFFFFFC);
if (cmd)
{
cmd->type = 0;
cmd->x = x;
cmd->y = y;
cmd->w = 1;
cmd->rotation = 0;
cmd->xScale = scale;
cmd->yScale = scale;
cmd->font = R_RegisterFont(fontName, 0);
if (DvarGetBool("r_dualPlayActive"))
cmd->yScale = (cmd->yScale) * .5;
R_ConvertColorToBytes(color, (char *)&cmd->color);
cmd->maxChars = 0x7FFFFFFF;
cmd->renderFlags = 0;
memcpy(cmd->text, (char *)text, len);
cmd->text[len] = 0;
}
}
}
void R_AddCmdDrawTextWithEffectsInternal(const char *text, const char *fontName, float x, float y, float scale, const float *color, const float *glowColor, int fxBirthTime, int fxLetterTime, int fxDecayStartTime, int fxDecayDuration)
{
if (*text)
{
int len = strlen(text);
GfxCmdDrawText2D * cmd = (GfxCmdDrawText2D *)R_GetCommandBuffer(0x10, (len + 0x6 & 0xFFFFFFFC);
if (cmd)
{
cmd->type = 0;
cmd->x = x;
cmd->y = y;
cmd->w = 1;
cmd->rotation = 0;
cmd->xScale = scale;
cmd->yScale = scale;
cmd->font = R_RegisterFont(fontName, 0);
if (DvarGetBool("r_dualPlayActive"))
cmd->yScale = (cmd->yScale) * .5;
R_ConvertColorToBytes(color, (char *)&cmd->color);
cmd->maxChars = 0x7FFFFFFF;
cmd->renderFlags = 0;
memcpy(cmd->text, (char *)text, len);
cmd->text[len] = 0;
if (SetDrawText2DGlowParms(cmd, color, glowColor))
{
if (fxBirthTime)
{
cmd->renderFlags |= 0x880;
cmd->fxMaterial = NULL;
cmd->fxMaterialGlow = NULL;
cmd->fxBirthTime = fxBirthTime;
cmd->fxLetterTime = fxLetterTime;
cmd->fxDecayStartTime = fxDecayStartTime;
cmd->fxDecayDuration = fxDecayDuration;
cmd->padding = 0;
}
}
}
}
}
void R_AddCmdDrawStretchPicInternal(float x, float y, float width, float height, const float *color, const char *material)
{
GfxCmdStretchPic * cmd = (GfxCmdStretchPic *)R_GetCommandBuffer(0xA, 0x30);
if (cmd)
{
cmd->material = Material_RegisterHandle(material, 0, 0, 0);
cmd->x = x;
cmd->y = y;
cmd->w0 = 1;
cmd->w = width;
cmd->h = height;
cmd->s0 = 0;
cmd->t0 = 0;
cmd->s1 = 1;
cmd->t1 = 1;
R_ConvertColorToBytes(color, (char *)&cmd->color);
}
}
Copyright © 2024, NextGenUpdate.
All Rights Reserved.