Colorful view messages (#173)

This commit is contained in:
CommonLoon102 2019-09-18 10:58:45 +00:00 committed by Christoph Oelckers
parent 16e1b39fb3
commit 9be59caef8
6 changed files with 11 additions and 9 deletions

View file

@ -330,14 +330,15 @@ void CGameMessageMgr::SetState(char state)
at0 = 1;
}
void CGameMessageMgr::Add(const char *a1, char a2)
void CGameMessageMgr::Add(const char *pText, char a2, const int pal)
{
if (a2 && at21)
{
messageStruct *pMessage = &at2e[at2a];
strncpy(pMessage->at4, a1, 80);
strncpy(pMessage->at4, pText, 80);
pMessage->at4[80] = 0;
pMessage->at0 = gFrameClock + at1d*120;
pMessage->pal = pal;
at2a = (at2a+1)%16;
at22++;
if (at22 > at19)
@ -368,7 +369,7 @@ void CGameMessageMgr::Display(void)
at22--;
continue;
}
viewDrawText(at11, pMessage->at4, v14, v8, vc, 0, 0, false, 256);
viewDrawText(at11, pMessage->at4, v14, v8, vc, pMessage->pal, 0, false, 256);
if (gViewMode == 3)
{
int height;

View file

@ -33,6 +33,7 @@ public:
{
ClockTicks at0;
char at4[81];
int pal;
};
char at0;
int at1;
@ -50,7 +51,7 @@ public:
messageStruct at2e[16];
CGameMessageMgr();
void SetState(char state);
void Add(const char *, char);
void Add(const char *pText, char a2, const int pal = 0);
void Display(void);
void Clear();
void SetMaxMessages(int nMessages);

View file

@ -502,7 +502,7 @@ void netGetPackets(void)
if (*pPacket != '/' || (*pPacket == 0 && *(pPacket+1) == 0) || (*(pPacket+1) >= '1' && *(pPacket+1) <= '8' && *(pPacket+1)-'1' == myconnectindex))
{
sprintf(buffer, "%s: %s", gProfile[nPlayer].name, pPacket);
viewSetMessage(buffer);
viewSetMessage(buffer, VanillaMode() ? 0 : 10); // 10: dark blue
sndStartSample("DMRADIO", 128, -1);
}
break;

View file

@ -3835,7 +3835,7 @@ void trTextOver(int nId)
{
char *pzMessage = levelGetMessage(nId);
if (pzMessage)
viewSetMessage(pzMessage);
viewSetMessage(pzMessage, VanillaMode() ? 0 : 8); // 8: gold
}
void InitGenerator(int nSprite)

View file

@ -2783,10 +2783,10 @@ void viewBurnTime(int gScale)
}
}
void viewSetMessage(const char *pMessage)
void viewSetMessage(const char *pMessage, const int pal)
{
OSD_Printf("%s\n", pMessage);
gGameMessageMgr.Add(pMessage, 15);
gGameMessageMgr.Add(pMessage, 15, pal);
}
void viewDisplayMessage(void)

View file

@ -143,7 +143,7 @@ uspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect);
void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smooth);
void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, int zm);
void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, int zm);
void viewSetMessage(const char *pMessage);
void viewSetMessage(const char *pMessage, const int pal = 0);
void viewDisplayMessage(void);
void viewSetErrorMessage(const char *pMessage);
void DoLensEffect(void);