mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-22 03:51:32 +00:00
fix ezhud text scaling.
fix ezhud gameclock. fix fteqcc treating somearray as somearray[0] instead of &somearray[0] fix sometype*foo[]; issues. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4907 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
cc8ceb4894
commit
1337503fe8
10 changed files with 197 additions and 42 deletions
|
@ -292,6 +292,25 @@ static qintptr_t VARGS Plug_Draw_Character(void *offset, quintptr_t mask, const
|
|||
Font_EndString(font_default);
|
||||
return 0;
|
||||
}
|
||||
static qintptr_t VARGS Plug_Draw_CharacterH(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
float x = VM_FLOAT(arg[0]);
|
||||
float y = VM_FLOAT(arg[1]);
|
||||
float h = VM_FLOAT(arg[2]);
|
||||
unsigned int flags = VM_LONG(arg[3]);
|
||||
unsigned int charc = VM_LONG(arg[4]);
|
||||
conchar_t cmask = CON_WHITEMASK;
|
||||
if (qrenderer == QR_NONE)
|
||||
return 0;
|
||||
if (flags & 1)
|
||||
cmask |= CON_2NDCHARSETTEXT;
|
||||
if (!(flags & 2))
|
||||
cmask |= 0xe000;
|
||||
Font_BeginScaledString(font_default, x, y, h, h, &x, &y);
|
||||
Font_DrawScaleChar(x, y, cmask | charc);
|
||||
Font_EndString(font_default);
|
||||
return 0;
|
||||
}
|
||||
static qintptr_t VARGS Plug_Draw_String(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
int ipx, px, py;
|
||||
|
@ -315,6 +334,39 @@ static qintptr_t VARGS Plug_Draw_String(void *offset, quintptr_t mask, const qin
|
|||
Font_EndString(font_default);
|
||||
return 0;
|
||||
}
|
||||
static qintptr_t VARGS Plug_Draw_StringH(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
float x = VM_FLOAT(arg[0]);
|
||||
float y = VM_FLOAT(arg[1]);
|
||||
float h = VM_FLOAT(arg[2]);
|
||||
unsigned int flags = VM_LONG(arg[3]);
|
||||
char *instr = VM_POINTER(arg[4]);
|
||||
float ipx;
|
||||
conchar_t buffer[2048], *str, cmask = CON_WHITEMASK;
|
||||
unsigned int parseflags = 0;
|
||||
if (qrenderer == QR_NONE)
|
||||
return 0;
|
||||
if (flags & 1)
|
||||
cmask |= CON_2NDCHARSETTEXT;
|
||||
if (flags & 2)
|
||||
parseflags |= PFS_FORCEUTF8;
|
||||
COM_ParseFunString(CON_WHITEMASK, instr, buffer, sizeof(buffer), parseflags);
|
||||
str = buffer;
|
||||
Font_BeginScaledString(font_default, x, y, h, h, &x, &y);
|
||||
ipx = x;
|
||||
while(*str)
|
||||
{
|
||||
if ((*str & CON_CHARMASK) == '\n')
|
||||
y += Font_CharScaleHeight();
|
||||
else if ((*str & CON_CHARMASK) == '\r')
|
||||
x = ipx;
|
||||
else
|
||||
x = Font_DrawScaleChar(x, y, *str);
|
||||
str++;
|
||||
}
|
||||
Font_EndString(font_default);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static qintptr_t VARGS Plug_Draw_Fill(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
|
@ -331,10 +383,21 @@ static qintptr_t VARGS Plug_Draw_Fill(void *offset, quintptr_t mask, const qintp
|
|||
}
|
||||
static qintptr_t VARGS Plug_Draw_ColourP(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
if (arg[0]<0 || arg[0]>255)
|
||||
int p = VM_LONG(arg[0]);
|
||||
if (p<0 || p>255)
|
||||
return false;
|
||||
|
||||
R2D_ImagePaletteColour(arg[0], 1);
|
||||
R2D_ImagePaletteColour(p, 1);
|
||||
return 1;
|
||||
}
|
||||
static qintptr_t VARGS Plug_Draw_ColourPA(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
int p = VM_LONG(arg[0]);
|
||||
float a = VM_FLOAT(arg[1]);
|
||||
if (p<0 || p>255)
|
||||
return false;
|
||||
|
||||
R2D_ImagePaletteColour(p, a);
|
||||
return 1;
|
||||
}
|
||||
static qintptr_t VARGS Plug_Draw_Colour3f(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
|
@ -512,6 +575,11 @@ static qintptr_t VARGS Plug_GetServerInfo(void *offset, quintptr_t mask, const q
|
|||
}
|
||||
Q_strncatz(outptr, va("\\demotime\\%f", demtime-cls.demostarttime), outlen);
|
||||
|
||||
if (cl.playerview[0].statsf[STAT_MATCHSTARTTIME])
|
||||
Q_strncatz(outptr, va("\\matchstart\\%f", cl.playerview[0].statsf[STAT_MATCHSTARTTIME]), outlen);
|
||||
else
|
||||
Q_strncatz(outptr, va("\\matchstart\\%f", cl.matchgametimestart), outlen);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -966,10 +1034,13 @@ void Plug_Client_Init(void)
|
|||
Plug_RegisterBuiltin("Draw_Image", Plug_Draw_Image, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_ImageSize", Plug_Draw_ImageSize, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_Character", Plug_Draw_Character, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_CharacterH", Plug_Draw_CharacterH, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_String", Plug_Draw_String, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_StringH", Plug_Draw_StringH, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_Fill", Plug_Draw_Fill, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_Line", Plug_Draw_Line, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_Colourp", Plug_Draw_ColourP, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_Colourpa", Plug_Draw_ColourPA, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_Colour3f", Plug_Draw_Colour3f, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_Colour4f", Plug_Draw_Colour4f, PLUG_BIF_NEEDSRENDERER);
|
||||
|
||||
|
|
|
@ -1314,6 +1314,9 @@ void CLMaster_AddMaster_Worker_Resolve(void *ctx, void *data, size_t a, size_t b
|
|||
for (i = 1; i < found; i++)
|
||||
{
|
||||
master_t *alt;
|
||||
if (adrs[i].type == NA_INVALID)
|
||||
continue;
|
||||
|
||||
//don't add the same ip twice, because that's silly
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
|
|
|
@ -423,6 +423,7 @@ typedef struct
|
|||
enum{
|
||||
REF_GLOBAL, //(global.ofs) - use vector[2] is an array ref or vector_z
|
||||
REF_ARRAY, //(global.ofs+wordoffset) - constant offsets should be direct references, variable offsets will generally result in function calls
|
||||
REF_ARRAYHEAD,//(global) - like REF_ARRAY, but otherwise convert to a pointer.
|
||||
REF_POINTER,//*(pointerdef+wordindex) - maths...
|
||||
REF_FIELD, //(entity.field) - reading is a single load, writing requires address+storep
|
||||
REF_STRING, //"hello"[1]=='e' - special opcodes, or str2chr builtin, or something
|
||||
|
|
|
@ -3821,7 +3821,7 @@ QCC_ref_t *QCC_PR_GenerateAddressOf(QCC_ref_t *retbuf, QCC_ref_t *operand)
|
|||
QCC_PR_PointerType((operand->index.cast->type == ev_field)?operand->index.cast->aux_type:type_variant),
|
||||
true);
|
||||
}
|
||||
if (operand->type == REF_GLOBAL || operand->type == REF_ARRAY)
|
||||
if (operand->type == REF_ARRAYHEAD || operand->type == REF_GLOBAL || operand->type == REF_ARRAY)
|
||||
{
|
||||
if (!QCC_OPCodeValid(&pr_opcodes[OP_GLOBALADDRESS]))
|
||||
QCC_PR_ParseError (ERR_BADEXTENSION, "Address-of operator is not supported in this form without extensions. Consider the use of: #pragma target fte");
|
||||
|
@ -4615,13 +4615,10 @@ QCC_sref_t QCC_PR_ParseFunctionCall (QCC_ref_t *funcref) //warning, the func cou
|
|||
#if 1
|
||||
QCC_ref_t refbuf, *r;
|
||||
r = QCC_PR_ParseRefValue(&refbuf, pr_classtype, false, false, false);
|
||||
if (r->type == REF_GLOBAL && !r->index.cast)
|
||||
if (r->type == REF_ARRAYHEAD && !r->index.cast)
|
||||
{
|
||||
e = r->base;
|
||||
if (!e.sym->arraysize) //FIXME
|
||||
sz = 1;
|
||||
else
|
||||
sz = e.sym->arraysize;
|
||||
sz = e.sym->arraysize;
|
||||
}
|
||||
else
|
||||
sz = 1;
|
||||
|
@ -5833,10 +5830,10 @@ QCC_ref_t *QCC_PR_ParseRefArrayPointer (QCC_ref_t *retbuf, QCC_ref_t *r, pbool a
|
|||
pbool allowarray;
|
||||
unsigned int arraysize;
|
||||
unsigned int rewindpoint = numstatements;
|
||||
pbool dereference = false;
|
||||
|
||||
t = r->cast;
|
||||
if (r->type == REF_GLOBAL && r->cast == r->base.cast && r->base.sym)
|
||||
//FIXME
|
||||
if (r->type == REF_ARRAYHEAD && r->cast == r->base.cast && r->base.sym)
|
||||
arraysize = r->base.sym->arraysize;
|
||||
else
|
||||
arraysize = 0;
|
||||
|
@ -5881,9 +5878,10 @@ QCC_ref_t *QCC_PR_ParseRefArrayPointer (QCC_ref_t *retbuf, QCC_ref_t *r, pbool a
|
|||
if (!idx.cast && t->type == ev_pointer && !arraysize)
|
||||
t = t->aux_type;
|
||||
|
||||
if (!idx.cast && r->cast->type == ev_pointer)
|
||||
if (!idx.cast && r->cast->type == ev_pointer && !arraysize)
|
||||
{
|
||||
/*no bounds checks on pointer dereferences*/
|
||||
dereference = true;
|
||||
}
|
||||
else if (!idx.cast && r->cast->type == ev_string && !arraysize)
|
||||
{
|
||||
|
@ -5996,7 +5994,7 @@ QCC_ref_t *QCC_PR_ParseRefArrayPointer (QCC_ref_t *retbuf, QCC_ref_t *r, pbool a
|
|||
QCC_FreeTemp(idx);
|
||||
return QCC_PR_BuildRef(retbuf, REF_GLOBAL, QCC_MakeIntConst(arraysize), nullsref, type_integer, true);
|
||||
}
|
||||
else if ((t->type == ev_pointer || t->type == ev_struct || t->type == ev_union) && (QCC_PR_CheckToken(".") || QCC_PR_CheckToken("->")))
|
||||
else if (((t->type == ev_pointer && !arraysize) || t->type == ev_struct || t->type == ev_union) && (QCC_PR_CheckToken(".") || QCC_PR_CheckToken("->")))
|
||||
{
|
||||
char *tname;
|
||||
unsigned int i;
|
||||
|
@ -6046,11 +6044,23 @@ QCC_ref_t *QCC_PR_ParseRefArrayPointer (QCC_ref_t *retbuf, QCC_ref_t *r, pbool a
|
|||
|
||||
if (idx.cast)
|
||||
{
|
||||
//okay, not a pointer, we'll have to read it in somehow
|
||||
if (r->cast->type == ev_pointer)
|
||||
QCC_sref_t base;
|
||||
if (r->type == REF_ARRAYHEAD)
|
||||
{
|
||||
//generate a reference to ptr[x]
|
||||
QCC_PR_BuildRef(retbuf, REF_POINTER, QCC_RefToDef(r, true), idx, t, r->readonly);
|
||||
r->type = REF_ARRAY;
|
||||
base = QCC_RefToDef(r, true);
|
||||
r->type = REF_ARRAYHEAD;
|
||||
}
|
||||
else
|
||||
base = QCC_RefToDef(r, true);
|
||||
|
||||
//okay, not a pointer, we'll have to read it in somehow
|
||||
if (dereference)
|
||||
{
|
||||
r = QCC_PR_BuildRef(retbuf, REF_POINTER, base, idx, t, r->readonly);
|
||||
r = QCC_PR_ParseRefArrayPointer(retbuf, r, allowarrayassign, makearraypointers);
|
||||
r = QCC_PR_ParseField(retbuf, r);
|
||||
return r;
|
||||
}
|
||||
/* else if (d->type->type == ev_vector && d->arraysize == 0)
|
||||
{ //array notation on vectors (non-field)
|
||||
|
@ -6064,7 +6074,7 @@ QCC_ref_t *QCC_PR_ParseRefArrayPointer (QCC_ref_t *retbuf, QCC_ref_t *r, pbool a
|
|||
}
|
||||
*/ else
|
||||
{
|
||||
QCC_PR_BuildRef(retbuf, REF_ARRAY, QCC_RefToDef(r, true), idx, t, r->readonly);
|
||||
QCC_PR_BuildRef(retbuf, REF_ARRAY, base, idx, t, r->readonly);
|
||||
}
|
||||
r = retbuf;
|
||||
|
||||
|
@ -6072,7 +6082,10 @@ QCC_ref_t *QCC_PR_ParseRefArrayPointer (QCC_ref_t *retbuf, QCC_ref_t *r, pbool a
|
|||
r = QCC_PR_ParseRefArrayPointer(retbuf, r, allowarrayassign, makearraypointers);
|
||||
|
||||
if (arraysize && makearraypointers)
|
||||
{
|
||||
QCC_PR_ParseWarning(0, "Is this still needed?");
|
||||
r = QCC_PR_GenerateAddressOf(retbuf, r);
|
||||
}
|
||||
}
|
||||
|
||||
r = QCC_PR_ParseField(retbuf, r);
|
||||
|
@ -6369,6 +6382,20 @@ QCC_ref_t *QCC_PR_ParseRefValue (QCC_ref_t *refbuf, QCC_type_t *assumeclass, pbo
|
|||
return QCC_PR_ParseRefArrayPointer(refbuf, refbuf, allowarrayassign, makearraypointers); //opportunistic vecmember[0] handling
|
||||
}
|
||||
|
||||
if (d.sym->arraysize)
|
||||
{
|
||||
QCC_ref_t *r;
|
||||
QCC_DefToRef(refbuf, d);
|
||||
refbuf->type = REF_ARRAYHEAD;
|
||||
r = QCC_PR_ParseRefArrayPointer(refbuf, refbuf, allowarrayassign, makearraypointers);
|
||||
/*if (r->type == REF_ARRAYHEAD)
|
||||
{
|
||||
r->type = REF_GLOBAL;
|
||||
return QCC_PR_GenerateAddressOf(refbuf, r);
|
||||
}*/
|
||||
return r;
|
||||
}
|
||||
|
||||
return QCC_PR_ParseRefArrayPointer(refbuf, QCC_DefToRef(refbuf, d), allowarrayassign, makearraypointers);
|
||||
}
|
||||
|
||||
|
@ -6578,7 +6605,7 @@ QCC_ref_t *QCC_PR_RefTerm (QCC_ref_t *retbuf, unsigned int exprflags)
|
|||
if (QCC_PR_CheckToken ("*"))
|
||||
{
|
||||
e = QCC_PR_Expression (UNARY_PRIORITY, EXPR_DISALLOW_COMMA);
|
||||
if (e.cast->type == ev_pointer)
|
||||
if (e.cast->type == ev_pointer) //FIXME: arrays
|
||||
return QCC_PR_BuildRef(retbuf, REF_POINTER, e, nullsref, e.cast->aux_type, false);
|
||||
else if (e.cast->accessors)
|
||||
{
|
||||
|
@ -7289,6 +7316,13 @@ QCC_sref_t QCC_RefToDef(QCC_ref_t *ref, pbool freetemps)
|
|||
else
|
||||
QCC_UnFreeTemp(ret);
|
||||
break;
|
||||
case REF_ARRAYHEAD:
|
||||
{
|
||||
QCC_ref_t buf;
|
||||
ref = QCC_PR_GenerateAddressOf(&buf, ref);
|
||||
return QCC_RefToDef(ref, freetemps);
|
||||
}
|
||||
break;
|
||||
case REF_GLOBAL:
|
||||
case REF_ARRAY:
|
||||
if (ref->index.cast)
|
||||
|
@ -7327,10 +7361,15 @@ QCC_sref_t QCC_RefToDef(QCC_ref_t *ref, pbool freetemps)
|
|||
case REF_POINTER:
|
||||
tmp = QCC_GetTemp(ref->cast);
|
||||
if (ref->index.cast)
|
||||
{
|
||||
// if (!freetemps)
|
||||
QCC_UnFreeTemp(ref->index);
|
||||
idx = QCC_SupplyConversion(ref->index, ev_integer, true);
|
||||
}
|
||||
else
|
||||
idx = nullsref;
|
||||
QCC_LoadFromPointer(tmp, ref->base, idx, ref->cast);
|
||||
QCC_FreeTemp(idx);
|
||||
if (freetemps)
|
||||
QCC_PR_DiscardRef(ref);
|
||||
return tmp;
|
||||
|
@ -11732,7 +11771,13 @@ void QCC_PR_ParseInitializerType(int arraysize, QCC_def_t *basedef, QCC_sref_t d
|
|||
if (type->size - i >= 3)
|
||||
{
|
||||
rhs.cast = def.cast = type_vector;
|
||||
QCC_FreeTemp(QCC_PR_StatementFlags(&pr_opcodes[OP_STORE_V], rhs, def, NULL, STFL_PRESERVEA|STFL_PRESERVEB));
|
||||
if (type->size - i == 3)
|
||||
{
|
||||
QCC_FreeTemp(QCC_PR_StatementFlags(&pr_opcodes[OP_STORE_F], rhs, def, NULL, STFL_PRESERVEB));
|
||||
return;
|
||||
}
|
||||
else
|
||||
QCC_FreeTemp(QCC_PR_StatementFlags(&pr_opcodes[OP_STORE_V], rhs, def, NULL, STFL_PRESERVEA|STFL_PRESERVEB));
|
||||
i+=3;
|
||||
def.ofs += 3;
|
||||
rhs.ofs += 3;
|
||||
|
@ -11740,7 +11785,13 @@ void QCC_PR_ParseInitializerType(int arraysize, QCC_def_t *basedef, QCC_sref_t d
|
|||
else
|
||||
{
|
||||
rhs.cast = def.cast = type_float;
|
||||
QCC_FreeTemp(QCC_PR_StatementFlags(&pr_opcodes[OP_STORE_F], rhs, def, NULL, STFL_PRESERVEA|STFL_PRESERVEB));
|
||||
if (type->size - i == 1)
|
||||
{
|
||||
QCC_FreeTemp(QCC_PR_StatementFlags(&pr_opcodes[OP_STORE_F], rhs, def, NULL, STFL_PRESERVEB));
|
||||
return;
|
||||
}
|
||||
else
|
||||
QCC_FreeTemp(QCC_PR_StatementFlags(&pr_opcodes[OP_STORE_F], rhs, def, NULL, STFL_PRESERVEA|STFL_PRESERVEB));
|
||||
i++;
|
||||
def.ofs++;
|
||||
rhs.ofs++;
|
||||
|
|
|
@ -3462,7 +3462,7 @@ pbool QCC_main (int argc, char **argv) //as part of the quake engine
|
|||
MAX_STATEMENTS = 0x80000;
|
||||
MAX_FUNCTIONS = 16384;
|
||||
maxtypeinfos = 16384;
|
||||
MAX_CONSTANTS = 2048;
|
||||
MAX_CONSTANTS = 4096;
|
||||
|
||||
compressoutput = 0;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ float scr_con_current;
|
|||
int sb_showteamscores;
|
||||
int sb_showscores;
|
||||
int host_screenupdatecount;
|
||||
float alphamul;
|
||||
|
||||
cvar_t *scr_newHud;
|
||||
|
||||
|
@ -19,22 +20,23 @@ float infofloat(char *info, char *findkey, float def);
|
|||
|
||||
void Draw_SetOverallAlpha(float a)
|
||||
{
|
||||
alphamul = a;
|
||||
}
|
||||
void Draw_AlphaFillRGB(float x, float y, float w, float h, qbyte r, qbyte g, qbyte b, qbyte a)
|
||||
{
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0);
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0 * alphamul);
|
||||
pDraw_Fill(x, y, w, h);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
void Draw_Fill(float x, float y, float w, float h, qbyte pal)
|
||||
{
|
||||
pDraw_Colourp(pal);
|
||||
pDraw_Colourpa(pal, alphamul);
|
||||
pDraw_Fill(x, y, w, h);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
char *ColorNameToRGBString (const char *newval)
|
||||
const char *ColorNameToRGBString (const char *newval)
|
||||
{
|
||||
return "";
|
||||
return newval;
|
||||
}
|
||||
byte *StringToRGB(const char *str)
|
||||
{
|
||||
|
@ -71,6 +73,14 @@ void Draw_SSubPic(float x, float y, mpic_t *pic, float s1, float t1, float s2, f
|
|||
pDraw_ImageSize(image, &w, &h);
|
||||
pDraw_Image(x, y, (s2-s1)*scale, (t2-t1)*scale, s1/w, t1/h, s2/w, t2/h, image);
|
||||
}
|
||||
void Draw_EZString(float x, float y, char *str, float scale, qboolean red)
|
||||
{
|
||||
unsigned int flags = 0;
|
||||
if (red)
|
||||
flags |= 1;
|
||||
pDraw_StringH(x, y, scale, flags, str);
|
||||
}
|
||||
|
||||
#define Draw_STransPic Draw_SPic
|
||||
void Draw_Character(float x, float y, unsigned int ch)
|
||||
{
|
||||
|
@ -78,7 +88,7 @@ void Draw_Character(float x, float y, unsigned int ch)
|
|||
}
|
||||
void Draw_SCharacter(float x, float y, unsigned int ch, float scale)
|
||||
{
|
||||
pDraw_Character(x, y, ch); //FIXME
|
||||
pDraw_CharacterH(x, y, 8*scale, 0, ch);
|
||||
}
|
||||
|
||||
void SCR_DrawWadString(float x, float y, float scale, char *str)
|
||||
|
@ -91,14 +101,14 @@ void Draw_SAlphaSubPic2(float x, float y, mpic_t *pic, float s1, float t1, float
|
|||
qhandle_t image = (intptr_t)pic;
|
||||
float w, h;
|
||||
pDraw_ImageSize(image, &w, &h);
|
||||
pDraw_Colour4f(1, 1, 1, alpha);
|
||||
pDraw_Colour4f(1, 1, 1, alpha * alphamul);
|
||||
pDraw_Image(x, y, (s2-s1)*sw, (t2-t1)*sh, s1/w, t1/h, s2/w, t2/h, image);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
void Draw_AlphaFill(float x, float y, float w, float h, qbyte pal, float alpha)
|
||||
{
|
||||
pDraw_Colour4f(1, 1, 1, alpha);
|
||||
pDraw_Colour4f(1, 1, 1, alpha * alphamul);
|
||||
pDraw_Colourp(pal);
|
||||
pDraw_Fill(x, y, w, h);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
|
@ -108,7 +118,7 @@ void Draw_AlphaPic(float x, float y, mpic_t *pic, float alpha)
|
|||
qhandle_t image = (intptr_t)pic;
|
||||
float w, h;
|
||||
pDraw_ImageSize(image, &w, &h);
|
||||
pDraw_Colour4f(1, 1, 1, alpha);
|
||||
pDraw_Colour4f(1, 1, 1, alpha * alphamul);
|
||||
pDraw_Image(x, y, w, h, 0, 0, 1, 1, image);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
|
@ -117,7 +127,7 @@ void Draw_AlphaSubPic(float x, float y, mpic_t *pic, float s1, float t1, float s
|
|||
qhandle_t image = (intptr_t)pic;
|
||||
float w, h;
|
||||
pDraw_ImageSize(image, &w, &h);
|
||||
pDraw_Colour4f(1, 1, 1, alpha);
|
||||
pDraw_Colour4f(1, 1, 1, alpha * alphamul);
|
||||
pDraw_Image(x, y, s2-s1, t2-t1, s1/w, t1/h, s2/w, t2/h, image);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
|
@ -131,7 +141,7 @@ void SCR_HUD_DrawBar(int direction, int value, float max_value, float *rgba, int
|
|||
else// left-right
|
||||
amount = Q_rint(abs((width * value) / max_value));
|
||||
|
||||
pDraw_Colour4f(rgba[0]/255.0, rgba[1]/255.0, rgba[2]/255.0, rgba[3]/255.0);
|
||||
pDraw_Colour4f(rgba[0]/255.0, rgba[1]/255.0, rgba[2]/255.0, rgba[3]/255.0 * alphamul);
|
||||
if(direction == 0)
|
||||
// left->right
|
||||
pDraw_Fill(x, y, amount, height);
|
||||
|
@ -149,13 +159,13 @@ void SCR_HUD_DrawBar(int direction, int value, float max_value, float *rgba, int
|
|||
|
||||
void Draw_Polygon(int x, int y, vec3_t *vertices, int num_vertices, qbool fill, byte r, byte g, byte b, byte a)
|
||||
{
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0);
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0 * alphamul);
|
||||
// pDraw_Line(x1, y1, x2, y1);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
void Draw_ColoredString3(float x, float y, const char *str, clrinfo_t *clr, int huh, int wut)
|
||||
{
|
||||
pDraw_Colour4f(clr->c[0]/255.0, clr->c[1]/255.0, clr->c[2]/255.0, clr->c[3]/255.0);
|
||||
pDraw_Colour4f(clr->c[0]/255.0, clr->c[1]/255.0, clr->c[2]/255.0, clr->c[3]/255.0 * alphamul);
|
||||
pDraw_String(x, y, str);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
|
@ -168,7 +178,7 @@ void Draw_AlphaRectangleRGB(int x, int y, int w, int h, int foo, int bar, byte r
|
|||
float x2 = x+w;
|
||||
float y1 = y;
|
||||
float y2 = y+h;
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0);
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0 * alphamul);
|
||||
pDraw_Line(x1, y1, x2, y1);
|
||||
pDraw_Line(x2, y1, x2, y2);
|
||||
pDraw_Line(x1, y2, x2, y2);
|
||||
|
@ -177,7 +187,7 @@ void Draw_AlphaRectangleRGB(int x, int y, int w, int h, int foo, int bar, byte r
|
|||
}
|
||||
void Draw_AlphaLineRGB(float x1, float y1, float x2, float y2, float width, byte r, byte g, byte b, byte a)
|
||||
{
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0);
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0 * alphamul);
|
||||
pDraw_Line(x1, y1, x2, y2);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
|
@ -305,7 +315,7 @@ char *SCR_GetGameTime(int t, char *buffer, size_t buffersize)
|
|||
if (cl.countdown || cl.standby)
|
||||
SecondsToMinutesString(timelimit, buffer, buffersize);
|
||||
else
|
||||
SecondsToMinutesString((int) abs(timelimit - (cl.time - cl.stats[STAT_MATCHSTARTTIME])), buffer, buffersize);
|
||||
SecondsToMinutesString((int) abs(timelimit - (cl.time - cl.matchstart)), buffer, buffersize);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
@ -553,6 +563,7 @@ qintptr_t EZHud_Draw(qintptr_t *args)
|
|||
infostring(cl.serverinfo, "status", val, sizeof(val));
|
||||
cl.standby = !strcmp(val, "standby");
|
||||
cl.countdown = !strcmp(val, "countdown");
|
||||
cl.matchstart = infofloat(cl.serverinfo, "matchstart", 0);
|
||||
cls.state = ca_active;
|
||||
vid.width = pvid.width;
|
||||
vid.height = pvid.height;
|
||||
|
|
|
@ -60,6 +60,7 @@ struct {
|
|||
int tracknum;
|
||||
vec3_t simvel;
|
||||
float time;
|
||||
float matchstart;
|
||||
float faceanimtime;
|
||||
qboolean spectator;
|
||||
qboolean standby;
|
||||
|
@ -87,14 +88,16 @@ struct {
|
|||
void Draw_SetOverallAlpha(float a);
|
||||
void Draw_AlphaFillRGB(float x, float y, float w, float h, qbyte r, qbyte g, qbyte b, qbyte a);
|
||||
void Draw_Fill(float x, float y, float w, float h, qbyte pal);
|
||||
char *ColorNameToRGBString (const char *newval);
|
||||
const char *ColorNameToRGBString (const char *newval);
|
||||
byte *StringToRGB(const char *str);
|
||||
|
||||
#define Draw_String pDraw_String
|
||||
#define Draw_Alt_String pDraw_String //FIXME
|
||||
#define Draw_ColoredString(x,y,str,alt) pDraw_String(x,y,str) //FIXME
|
||||
#define Draw_SString(x,y,str,sc) pDraw_String(x,y,str) //FIXME
|
||||
#define Draw_SAlt_String(x,y,str,sc) pDraw_String(x,y,str) //FIXME
|
||||
|
||||
void Draw_EZString(float x, float y, char *str, float scale, qboolean red);
|
||||
#define Draw_Alt_String(x,y,s) Draw_EZString(x,y,s,8,true)
|
||||
#define Draw_ColoredString(x,y,str,alt) Draw_EZString(x,y,str,8,alt)
|
||||
#define Draw_SString(x,y,str,sc) Draw_EZString(x,y,str,8*sc,false)
|
||||
#define Draw_SAlt_String(x,y,str,sc) Draw_EZString(x,y,str,8*sc,true)
|
||||
|
||||
void Draw_SPic(float x, float y, mpic_t *pic, float scale);
|
||||
void Draw_SSubPic(float x, float y, mpic_t *pic, float s1, float t1, float s2, float t2, float scale);
|
||||
|
|
|
@ -863,7 +863,7 @@ void HUD_CalcFrameExtents(hud_t *hud, int width, int height, // In.
|
|||
void HUD_OnChangeFrameColor(cvar_t *var, char *oldval)
|
||||
{
|
||||
// Converts "red" into "255 0 0", etc. or returns input as it was.
|
||||
char *new_color = ColorNameToRGBString (var->string);
|
||||
const char *new_color = ColorNameToRGBString (var->string);
|
||||
char buf[256], buf2[128];
|
||||
size_t hudname_len;
|
||||
hud_t* hud_elem;
|
||||
|
|
|
@ -194,6 +194,15 @@ BUILTIN(void, Draw_Character, (int x, int y, unsigned int character));
|
|||
#define ARGNAMES ,PASSFLOAT(x),PASSFLOAT(y),string
|
||||
BUILTIN(void, Draw_String, (float x, float y, const char *string));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,PASSFLOAT(x),PASSFLOAT(y),PASSFLOAT(h),flags,character
|
||||
BUILTIN(void, Draw_CharacterH, (float x, float y, float h, unsigned int flags, unsigned int character));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,PASSFLOAT(x),PASSFLOAT(y),PASSFLOAT(h),flags,string
|
||||
BUILTIN(void, Draw_StringH, (float x, float y, float h, unsigned int flags, const char *string));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,palcol,PASSFLOAT(a)
|
||||
BUILTIN(void, Draw_Colourpa, (int palcol, float a));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,palcol
|
||||
BUILTIN(void, Draw_Colourp, (int palcol));
|
||||
#undef ARGNAMES
|
||||
|
@ -426,6 +435,9 @@ void Plug_InitStandardBuiltins(void)
|
|||
CHECKBUILTIN(Draw_Fill);
|
||||
CHECKBUILTIN(Draw_Character);
|
||||
CHECKBUILTIN(Draw_String);
|
||||
CHECKBUILTIN(Draw_CharacterH);
|
||||
CHECKBUILTIN(Draw_StringH);
|
||||
CHECKBUILTIN(Draw_Colourpa);
|
||||
CHECKBUILTIN(Draw_Colourp);
|
||||
CHECKBUILTIN(Draw_Colour3f);
|
||||
CHECKBUILTIN(Draw_Colour4f);
|
||||
|
|
|
@ -292,6 +292,9 @@ EBUILTIN(void, Draw_Fill, (float x, float y, float w, float h));
|
|||
EBUILTIN(void, Draw_Line, (float x1, float y1, float x2, float y2));
|
||||
EBUILTIN(void, Draw_Character, (int x, int y, unsigned int character));
|
||||
EBUILTIN(void, Draw_String, (float x, float y, const char *string));
|
||||
EBUILTIN(void, Draw_CharacterH, (float x, float y, float h, unsigned int flags, unsigned int character));
|
||||
EBUILTIN(void, Draw_StringH, (float x, float y, float h, unsigned int flags, const char *string));
|
||||
EBUILTIN(void, Draw_Colourpa, (int palcol, float a));
|
||||
EBUILTIN(void, Draw_Colourp, (int palcol));
|
||||
EBUILTIN(void, Draw_Colour3f, (float r, float g, float b));
|
||||
EBUILTIN(void, Draw_Colour4f, (float r, float g, float b, float a));
|
||||
|
|
Loading…
Reference in a new issue