TimeServ wanted me to commit this. note that the qrenderer check should be removed.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1727 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-12-20 23:34:06 +00:00
parent 62f7ed5108
commit dc6ff40ad6
2 changed files with 76 additions and 4 deletions

View file

@ -112,12 +112,12 @@ int VARGS Plug_Draw_LoadImage(void *offset, unsigned int mask, const long *arg)
if (qrenderer)
{
if (fromwad)
if (fromwad && Draw_SafePicFromWad)
pic = Draw_SafePicFromWad(name);
else
{
#ifdef RGLQUAKE //GL saves images persistantly (so don't bother with cachepic stuff)
if (qrenderer == QR_OPENGL)
if (qrenderer == QR_OPENGL && Draw_SafeCachePic)
pic = Draw_SafeCachePic(name);
else
#endif
@ -328,7 +328,7 @@ int VARGS Plug_Con_SubPrint(void *offset, unsigned int mask, const long *arg)
if (!con)
{
con = Con_Create(name);
Con_SetVisible(con);
Con_SetActive(con);
if (currentplug->conexecutecommand)
{
@ -353,7 +353,48 @@ int VARGS Plug_Con_RenameSub(void *offset, unsigned int mask, const long *arg)
return 1;
}
int VARGS Plug_Con_IsActive(void *offset, unsigned int mask, const long *arg)
{
char *name = VM_POINTER(arg[0]);
console_t *con;
con = Con_FindConsole(name);
if (!con)
return false;
return Con_IsActive(con);
}
int VARGS Plug_Con_SetActive(void *offset, unsigned int mask, const long *arg)
{
char *name = VM_POINTER(arg[0]);
console_t *con;
con = Con_FindConsole(name);
if (!con)
con = Con_Create(name);
Con_SetActive(con);
return true;
}
int VARGS Plug_Con_Destroy(void *offset, unsigned int mask, const long *arg)
{
char *name = VM_POINTER(arg[0]);
console_t *con;
con = Con_FindConsole(name);
if (!con)
return false;
Con_Destroy(con);
return true;
}
int VARGS Plug_Con_NameForNum(void *offset, unsigned int mask, const long *arg)
{
char num = VM_LONG(arg[0]);
char *buffer = VM_POINTER(arg[1]);
int buffersize = VM_LONG(arg[2]);
if (VM_OOB(arg[1], arg[2]) || buffersize < 1)
return false;
return Con_NameForNum(num, buffer, buffersize);
}
@ -374,6 +415,10 @@ void Plug_Client_Init(void)
Plug_RegisterBuiltin("Con_SubPrint", Plug_Con_SubPrint, 0);
Plug_RegisterBuiltin("Con_RenameSub", Plug_Con_RenameSub, 0);
Plug_RegisterBuiltin("Con_IsActive", Plug_Con_IsActive, 0);
Plug_RegisterBuiltin("Con_SetActive", Plug_Con_SetActive, 0);
Plug_RegisterBuiltin("Con_Destroy", Plug_Con_Destroy, 0);
Plug_RegisterBuiltin("Con_NameForNum", Plug_Con_NameForNum, 0);
Plug_RegisterBuiltin("LocalSound", Plug_LocalSound, 0);
Plug_RegisterBuiltin("SCR_CenterPrint", Plug_SCR_CenterPrint, 0);

View file

@ -94,6 +94,10 @@ qboolean Con_IsActive (console_t *con)
void Con_Destroy (console_t *con)
{
console_t *prev;
if (con == &con_main)
return;
for (prev = &con_main; prev->next; prev = prev->next)
{
if (prev->next == con)
@ -104,6 +108,9 @@ void Con_Destroy (console_t *con)
}
BZ_Free(con);
if (con == con_current)
con = &con_main;
}
console_t *Con_FindConsole(char *name)
{
@ -127,10 +134,26 @@ console_t *Con_Create(char *name)
return con;
}
void Con_SetVisible (console_t *con)
void Con_SetActive (console_t *con)
{
con_current = con;
}
qboolean Con_NameForNum(int num, char *buffer, int buffersize)
{
console_t *con;
for (con = &con_main; con; con = con->next, num--)
{
if (num <= 0)
{
Q_strncpyz(buffer, con->name, buffersize);
return true;
}
}
if (buffersize>0)
*buffer = '\0';
return false;
}
void Con_PrintCon (console_t *con, char *txt);
@ -571,6 +594,8 @@ void Con_PrintCon (console_t *con, char *txt)
int maskstack[4];
int maskstackdepth = 0;
con->unseentext = true;
if (txt[0] == 1 || txt[0] == 2)
{
mask = CON_STANDARDMASK|CON_WHITEMASK; // go to colored text
@ -1204,6 +1229,8 @@ void Con_DrawConsole (int lines, qboolean noback)
if (!noback)
Draw_ConsoleBackground (lines);
con_current->unseentext = false;
// draw the text
con_current->vislines = lines;