say hello to TEI_SHOWLMP2

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@95 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-09-01 00:01:08 +00:00
parent 4f6b0592b7
commit cc9d8d71d8
5 changed files with 226 additions and 2 deletions

View file

@ -312,6 +312,8 @@ void CL_SendConnectPacket (
fteprotextsupported |= PEXT_HEXEN2; fteprotextsupported |= PEXT_HEXEN2;
fteprotextsupported |= PEXT_CUSTOMTEMPEFFECTS; fteprotextsupported |= PEXT_CUSTOMTEMPEFFECTS;
fteprotextsupported |= PEXT_256PACKETENTITIES; fteprotextsupported |= PEXT_256PACKETENTITIES;
// fteprotextsupported |= PEXT_64PLAYERS;
fteprotextsupported |= PEXT_SHOWPIC;
fteprotextsupported &= ftepext; fteprotextsupported &= ftepext;
@ -681,6 +683,7 @@ void CL_ClearState (void)
CL_ClearTEnts (); CL_ClearTEnts ();
CL_ClearCustomTEnts(); CL_ClearCustomTEnts();
SCR_ShowPic_Clear();
if (cl.playernum[0] == -1) if (cl.playernum[0] == -1)
{ //left over from q2 connect. { //left over from q2 connect.

View file

@ -3622,6 +3622,19 @@ void CL_ParseServerMessage (void)
CMQ2_SetAreaPortalState(i, j!=0); CMQ2_SetAreaPortalState(i, j!=0);
break; break;
#endif #endif
case svc_showpic:
SCR_ShowPic_Create();
break;
case svc_hidepic:
SCR_ShowPic_Hide();
break;
case svc_movepic:
SCR_ShowPic_Move();
break;
case svc_updatepic:
SCR_ShowPic_Update();
break;
} }
} }
} }

View file

@ -302,6 +302,208 @@ extern qboolean sb_showscores;
} }
} }
////////////////////////////////////////////////////////////////
//TEI_SHOWLMP2 (not 3)
//
typedef struct showpic_s {
struct showpic_s *next;
qbyte zone;
short x, y;
char *name;
char *picname;
} showpic_t;
showpic_t *showpics;
static void SP_RecalcXY ( float *xx, float *yy, int origin )
{
int midx, midy;
float x,y;
x = xx[0];
y = yy[0];
midy = vid.height * 0.5;// >>1
midx = vid.width * 0.5;// >>1
// Tei - new showlmp
switch ( origin )
{
case SL_ORG_NW:
break;
case SL_ORG_NE:
x = vid.width - x;//Inv
break;
case SL_ORG_SW:
y = vid.height - y;//Inv
break;
case SL_ORG_SE:
y = vid.height - y;//inv
x = vid.width - x;//Inv
break;
case SL_ORG_CC:
y = midy + (y - 8000);//NegCoded
x = midx + (x - 8000);//NegCoded
break;
case SL_ORG_CN:
x = midx + (x - 8000);//NegCoded
break;
case SL_ORG_CS:
x = midx + (x - 8000);//NegCoded
y = vid.height - y;//Inverse
break;
case SL_ORG_CW:
y = midy + (y - 8000);//NegCoded
break;
case SL_ORG_CE:
y = midy + (y - 8000);//NegCoded
x = vid.height - x; //Inverse
break;
default:
break;
}
xx[0] = x;
yy[0] = y;
}
void SCR_ShowPics_Draw(void)
{
float x, y;
showpic_t *sp;
qpic_t *p;
for (sp = showpics; sp; sp = sp->next)
{
x = sp->x;
y = sp->y;
SP_RecalcXY(&x, &y, sp->zone);
p = Draw_SafeCachePic(sp->picname);
if (!*sp->picname)
continue;
if (!p)
continue;
Draw_Pic(x, y, p);
}
}
void SCR_ShowPic_Clear(void)
{
showpic_t *sp;
while(sp = showpics)
{
showpics = sp->next;
Z_Free(sp->name);
Z_Free(sp->picname);
Z_Free(sp);
}
}
showpic_t *SCR_ShowPic_Find(char *name)
{
showpic_t *sp, *last;
for (sp = showpics; sp; sp = sp->next)
{
if (!strcmp(sp->name, name))
return sp;
}
if (showpics)
{
for (last = showpics; last->next; last = last->next)
;
}
else
last = NULL;
sp = Z_Malloc(sizeof(showpic_t));
if (last)
{
last->next = sp;
sp->next = NULL;
}
else
{
sp->next = showpics;
showpics = sp;
}
sp->name = Z_Malloc(strlen(name)+1);
strcpy(sp->name, name);
sp->picname = Z_Malloc(1);
sp->x = 0;
sp->y = 0;
sp->zone = 0;
return sp;
}
void SCR_ShowPic_Create(void)
{
int zone = MSG_ReadByte();
showpic_t *sp;
char *s;
sp = SCR_ShowPic_Find(MSG_ReadString());
s = MSG_ReadString();
Z_Free(sp->picname);
sp->picname = Z_Malloc(strlen(s)+1);
strcpy(sp->picname, s);
sp->zone = zone;
sp->x = MSG_ReadShort();
sp->y = MSG_ReadShort();
CL_CheckOrDownloadFile(sp->picname, false);
}
void SCR_ShowPic_Hide(void)
{
showpic_t *sp, *prev;
sp = SCR_ShowPic_Find(MSG_ReadString());
if (sp == showpics)
showpics = sp->next;
else
{
for (prev = showpics; prev->next != sp; prev = prev->next)
;
prev->next = sp->next;
}
Z_Free(sp->name);
Z_Free(sp->picname);
Z_Free(sp);
}
void SCR_ShowPic_Move(void)
{
int zone = MSG_ReadByte();
showpic_t *sp;
sp = SCR_ShowPic_Find(MSG_ReadString());
sp->zone = zone;
sp->x = MSG_ReadShort();
sp->y = MSG_ReadShort();
}
void SCR_ShowPic_Update(void)
{
int zone = MSG_ReadByte();
showpic_t *sp;
char *s;
sp = SCR_ShowPic_Find(MSG_ReadString());
s = MSG_ReadString();
Z_Free(sp->picname);
sp->picname = Z_Malloc(strlen(s)+1);
strcpy(sp->picname, s);
CL_CheckOrDownloadFile(sp->picname, false);
}
//============================================================================= //=============================================================================
/* /*

View file

@ -177,6 +177,7 @@ void GLSCR_UpdateScreen (void)
if (scr_drawdialog) if (scr_drawdialog)
{ {
Sbar_Draw (); Sbar_Draw ();
SCR_ShowPics_Draw();
Draw_FadeScreen (); Draw_FadeScreen ();
SCR_DrawNotifyString (); SCR_DrawNotifyString ();
scr_copyeverything = true; scr_copyeverything = true;
@ -185,6 +186,7 @@ void GLSCR_UpdateScreen (void)
{ {
SCR_DrawLoading (); SCR_DrawLoading ();
Sbar_Draw (); Sbar_Draw ();
SCR_ShowPics_Draw();
} }
else if (cl.intermission == 1 && key_dest == key_game) else if (cl.intermission == 1 && key_dest == key_game)
{ {
@ -205,8 +207,9 @@ void GLSCR_UpdateScreen (void)
SCR_DrawFPS (); SCR_DrawFPS ();
SCR_DrawTurtle (); SCR_DrawTurtle ();
SCR_DrawPause (); SCR_DrawPause ();
SCR_CheckDrawCenterString ();
Sbar_Draw (); Sbar_Draw ();
SCR_ShowPics_Draw();
SCR_CheckDrawCenterString ();
glTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); glTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
#ifdef TEXTEDITOR #ifdef TEXTEDITOR
if (editoractive) if (editoractive)

View file

@ -161,10 +161,12 @@ void SWSCR_UpdateScreen (void)
{ {
SCR_DrawLoading (); SCR_DrawLoading ();
Sbar_Draw (); Sbar_Draw ();
SCR_ShowPics_Draw();
} }
else if (scr_drawdialog) else if (scr_drawdialog)
{ {
Sbar_Draw (); Sbar_Draw ();
SCR_ShowPics_Draw();
Draw_FadeScreen (); Draw_FadeScreen ();
SCR_DrawNotifyString (); SCR_DrawNotifyString ();
scr_copyeverything = true; scr_copyeverything = true;
@ -187,8 +189,9 @@ void SWSCR_UpdateScreen (void)
SCR_DrawTurtle (); SCR_DrawTurtle ();
SCR_DrawPause (); SCR_DrawPause ();
SCR_DrawFPS (); SCR_DrawFPS ();
SCR_CheckDrawCenterString ();
Sbar_Draw (); Sbar_Draw ();
SCR_ShowPics_Draw();
SCR_CheckDrawCenterString ();
#ifdef TEXTEDITOR #ifdef TEXTEDITOR
if (editoractive) if (editoractive)
Editor_Draw(); Editor_Draw();