Browse Source

Add black text color

pull/1288/head
Anders Jenbo 5 years ago
parent
commit
2362ff82f7
  1. 26
      Source/control.cpp
  2. 14
      Source/control.h
  3. 6
      Source/help.cpp
  4. 2
      Source/inv.cpp
  5. 16
      Source/items.cpp
  6. 59
      Source/plrmsg.cpp
  7. 1
      Source/plrmsg.h
  8. 8
      Source/quests.cpp
  9. 32
      Source/stores.cpp
  10. 4
      Source/stores.h
  11. 7
      enums.h

26
Source/control.cpp

@ -41,7 +41,7 @@ int pnumlines;
BOOL pinfoflag;
BOOL talkbtndown[3];
spell_id pSpell;
char infoclr;
text_color infoclr;
int sgbPlrTalkTbl;
BYTE *pGBoxBuff;
BYTE *pSBkBtnCel;
@ -533,7 +533,7 @@ void ToggleSpell(int slot)
}
}
void PrintChar(CelOutputBuffer out, int sx, int sy, int nCel, char col)
void PrintChar(CelOutputBuffer out, int sx, int sy, int nCel, text_color col)
{
int i;
BYTE pix;
@ -561,7 +561,7 @@ void PrintChar(CelOutputBuffer out, int sx, int sy, int nCel, char col)
tbl[i] = pix;
}
break;
default:
case COL_GOLD:
for (i = 0; i < 256; i++) {
pix = i;
if (pix >= PAL16_GRAY) {
@ -573,6 +573,10 @@ void PrintChar(CelOutputBuffer out, int sx, int sy, int nCel, char col)
tbl[i] = pix;
}
break;
case COL_BLACK:
light_table_index = 15;
CelDrawLightTo(out, sx, sy, pPanelText, nCel, 13, NULL);
return;
}
CelDrawLightTo(out, sx, sy, pPanelText, nCel, 13, tbl);
}
@ -1325,7 +1329,7 @@ void DrawInfoBox(CelOutputBuffer out)
#define ADD_PlrStringXY(out, x, y, width, pszStr, col) MY_PlrStringXY(out, x, y, width, pszStr, col, 1)
void PrintGameStr(CelOutputBuffer out, int x, int y, const char *str, int color)
void PrintGameStr(CelOutputBuffer out, int x, int y, const char *str, text_color color)
{
while (*str) {
BYTE c = gbFontTransTbl[(BYTE)*str++];
@ -1346,7 +1350,7 @@ void PrintGameStr(CelOutputBuffer out, int x, int y, const char *str, int color)
* @param col text_color color value
* @param base Letter spacing
*/
static void MY_PlrStringXY(CelOutputBuffer out, int x, int y, int endX, const char *pszStr, char col, int base)
static void MY_PlrStringXY(CelOutputBuffer out, int x, int y, int endX, const char *pszStr, text_color col, int base)
{
BYTE c;
const char *tmp;
@ -1377,7 +1381,7 @@ static void MY_PlrStringXY(CelOutputBuffer out, int x, int y, int endX, const ch
void DrawChr(CelOutputBuffer out)
{
char col;
text_color col = COL_WHITE;
char chrstr[64];
int mindam, maxdam;
@ -1777,7 +1781,7 @@ void RedBack(CelOutputBuffer out)
}
}
static void PrintSBookStr(CelOutputBuffer out, int x, int y, BOOL cjustflag, const char *pszStr, char col)
static void PrintSBookStr(CelOutputBuffer out, int x, int y, BOOL cjustflag, const char *pszStr, text_color col)
{
BYTE c;
const char *tmp;
@ -2032,7 +2036,7 @@ void control_set_gold_curs(int pnum)
NewCursor(plr[pnum].HoldItem._iCurs + CURSOR_FIRSTITEM);
}
static char *control_print_talk_msg(CelOutputBuffer out, char *msg, int *x, int y, int color)
static char *control_print_talk_msg(CelOutputBuffer out, char *msg, int *x, int y, text_color color)
{
BYTE c;
int width;
@ -2058,7 +2062,7 @@ static char *control_print_talk_msg(CelOutputBuffer out, char *msg, int *x, int
void DrawTalkPan(CelOutputBuffer out)
{
int i, off, talk_btn, color, nCel, x;
int i, off, talk_btn, nCel, x;
char *msg;
if (!talkflag)
@ -2078,7 +2082,7 @@ void DrawTalkPan(CelOutputBuffer out)
msg = sgszTalkMsg;
for (i = 0; i < 39; i += 13) {
x = 0 + PANEL_LEFT;
msg = control_print_talk_msg(out, msg, &x, i, 0);
msg = control_print_talk_msg(out, msg, &x, i, COL_WHITE);
if (!msg)
break;
}
@ -2089,6 +2093,7 @@ void DrawTalkPan(CelOutputBuffer out)
for (i = 0; i < 4; i++) {
if (i == myplr)
continue;
text_color color = COL_RED;
if (whisper[i]) {
color = COL_GOLD;
if (talkbtndown[talk_btn]) {
@ -2099,7 +2104,6 @@ void DrawTalkPan(CelOutputBuffer out)
CelDrawTo(out, 172 + PANEL_X, 84 + 18 * talk_btn + PANEL_Y, pTalkBtns, nCel, 61);
}
} else {
color = COL_RED;
if (talk_btn != 0)
nCel = 2;
else

14
Source/control.h

@ -14,6 +14,14 @@ DEVILUTION_BEGIN_NAMESPACE
extern "C" {
#endif
typedef enum text_color {
COL_WHITE,
COL_BLUE,
COL_RED,
COL_GOLD,
COL_BLACK,
} text_color;
typedef struct RECT32 {
int x;
int y;
@ -32,7 +40,7 @@ extern BYTE *pPanelText;
extern int pnumlines;
extern BOOL pinfoflag;
extern spell_id pSpell;
extern char infoclr;
extern text_color infoclr;
extern char tempstr[256];
extern int sbooktab;
extern spell_type pSplType;
@ -60,7 +68,7 @@ void ToggleSpell(int slot);
* @param nCel Number of letter in Windows-1252
* @param col text_color color value
*/
void PrintChar(CelOutputBuffer out, int sx, int sy, int nCel, char col);
void PrintChar(CelOutputBuffer out, int sx, int sy, int nCel, text_color col);
void AddPanelString(const char *str, BOOL just);
void ClearPanel();
@ -111,7 +119,7 @@ BOOL control_WriteStringToBuffer(BYTE *str);
*/
void DrawInfoBox(CelOutputBuffer out);
void PrintGameStr(CelOutputBuffer out, int x, int y, const char *str, int color);
void PrintGameStr(CelOutputBuffer out, int x, int y, const char *str, text_color color);
void DrawChr(CelOutputBuffer out);
void CheckLvlBtn();
void ReleaseLvlBtn();

6
Source/help.cpp

@ -453,7 +453,7 @@ void InitHelp()
helpflag = FALSE;
}
static void DrawHelpLine(CelOutputBuffer out, int x, int y, char *text, char color)
static void DrawHelpLine(CelOutputBuffer out, int x, int y, char *text, text_color color)
{
int sx, sy, width;
BYTE c;
@ -477,7 +477,6 @@ static void DrawHelpLine(CelOutputBuffer out, int x, int y, char *text, char col
void DrawHelp(CelOutputBuffer out)
{
int i, c, w;
char col;
const char *s;
DrawSTextHelp();
@ -530,11 +529,10 @@ void DrawHelp(CelOutputBuffer out)
while (*s == '\0') {
s++;
}
text_color col = COL_WHITE;
if (*s == '$') {
s++;
col = COL_RED;
} else {
col = COL_WHITE;
}
if (*s == '&') {
HelpTop = help_select_line;

2
Source/inv.cpp

@ -577,7 +577,7 @@ void DrawInvBelt(CelOutputBuffer out)
&& plr[myplr].SpdList[i]._itype != ITYPE_GOLD) {
fi = i + 49;
ff = fontframe[gbFontTransTbl[fi]];
PrintChar(out, InvRect[i + SLOTXY_BELT_FIRST].X + PANEL_X + INV_SLOT_SIZE_PX - fontkern[ff], InvRect[i + SLOTXY_BELT_FIRST].Y + PANEL_Y - 1, ff, 0);
PrintChar(out, InvRect[i + SLOTXY_BELT_FIRST].X + PANEL_X + INV_SLOT_SIZE_PX - fontkern[ff], InvRect[i + SLOTXY_BELT_FIRST].Y + PANEL_Y - 1, ff, COL_WHITE);
}
}
}

16
Source/items.cpp

@ -3964,7 +3964,7 @@ static void DrawUTextBack(CelOutputBuffer out)
DrawHalfTransparentRectTo(out, RIGHT_PANEL_X - SPANEL_WIDTH + 27, 28, 265, 297);
}
void PrintUString(CelOutputBuffer out, int x, int y, BOOL cjustflag, const char *str, int col)
void PrintUString(CelOutputBuffer out, int x, int y, BOOL cjustflag, const char *str, text_color col)
{
int len, width, sx, sy, i, k;
BYTE c;
@ -4008,30 +4008,30 @@ void DrawUniqueInfo(CelOutputBuffer out)
if ((!chrflag && !questlog) || gnScreenWidth >= SPANEL_WIDTH * 3) {
uid = curruitem._iUid;
DrawUTextBack(GlobalBackBuffer());
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, 2, TRUE, UniqueItemList[uid].UIName, 3);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, 2, TRUE, UniqueItemList[uid].UIName, COL_GOLD);
DrawULine(out, 5);
PrintItemPower(UniqueItemList[uid].UIPower1, &curruitem);
y = 6 - UniqueItemList[uid].UINumPL + 8;
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y, TRUE, tempstr, 0);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y, TRUE, tempstr, COL_WHITE);
if (UniqueItemList[uid].UINumPL > 1) {
PrintItemPower(UniqueItemList[uid].UIPower2, &curruitem);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y + 2, TRUE, tempstr, 0);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y + 2, TRUE, tempstr, COL_WHITE);
}
if (UniqueItemList[uid].UINumPL > 2) {
PrintItemPower(UniqueItemList[uid].UIPower3, &curruitem);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y + 4, TRUE, tempstr, 0);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y + 4, TRUE, tempstr, COL_WHITE);
}
if (UniqueItemList[uid].UINumPL > 3) {
PrintItemPower(UniqueItemList[uid].UIPower4, &curruitem);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y + 6, TRUE, tempstr, 0);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y + 6, TRUE, tempstr, COL_WHITE);
}
if (UniqueItemList[uid].UINumPL > 4) {
PrintItemPower(UniqueItemList[uid].UIPower5, &curruitem);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y + 8, TRUE, tempstr, 0);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y + 8, TRUE, tempstr, COL_WHITE);
}
if (UniqueItemList[uid].UINumPL > 5) {
PrintItemPower(UniqueItemList[uid].UIPower6, &curruitem);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y + 10, TRUE, tempstr, 0);
PrintUString(out, 0 + RIGHT_PANEL - SPANEL_WIDTH, y + 10, TRUE, tempstr, COL_WHITE);
}
}
}

59
Source/plrmsg.cpp

@ -11,7 +11,7 @@ static BYTE plr_msg_slot;
_plrmsg plr_msgs[PMSG_COUNT];
/** Maps from player_num to text color, as used in chat messages. */
const char text_color_from_player_num[MAX_PLRS + 1] = { COL_WHITE, COL_WHITE, COL_WHITE, COL_WHITE, COL_GOLD };
const text_color text_color_from_player_num[MAX_PLRS + 1] = { COL_WHITE, COL_WHITE, COL_WHITE, COL_WHITE, COL_GOLD };
void plrmsg_delay(BOOL delay)
{
@ -84,35 +84,7 @@ void InitPlrMsg()
plr_msg_slot = 0;
}
void DrawPlrMsg(CelOutputBuffer out)
{
int i;
DWORD x = 10;
DWORD y = 70;
DWORD width = gnScreenWidth - 20;
_plrmsg *pMsg;
if (chrflag || questlog) {
x += SPANEL_WIDTH;
width -= SPANEL_WIDTH;
}
if (invflag || sbookflag)
width -= SPANEL_WIDTH;
if (width < 300)
return;
pMsg = plr_msgs;
for (i = 0; i < PMSG_COUNT; i++) {
if (pMsg->str[0])
PrintPlrMsg(out, x, y, width, pMsg->str, text_color_from_player_num[pMsg->player]);
pMsg++;
y += 35;
}
}
// TODO: Can be made static
void PrintPlrMsg(CelOutputBuffer out, DWORD x, DWORD y, DWORD width, const char *str, BYTE col)
static void PrintPlrMsg(CelOutputBuffer out, DWORD x, DWORD y, DWORD width, const char *str, text_color col)
{
int line = 0;
@ -153,4 +125,31 @@ void PrintPlrMsg(CelOutputBuffer out, DWORD x, DWORD y, DWORD width, const char
}
}
void DrawPlrMsg(CelOutputBuffer out)
{
int i;
DWORD x = 10;
DWORD y = 70;
DWORD width = gnScreenWidth - 20;
_plrmsg *pMsg;
if (chrflag || questlog) {
x += SPANEL_WIDTH;
width -= SPANEL_WIDTH;
}
if (invflag || sbookflag)
width -= SPANEL_WIDTH;
if (width < 300)
return;
pMsg = plr_msgs;
for (i = 0; i < PMSG_COUNT; i++) {
if (pMsg->str[0])
PrintPlrMsg(out, x, y, width, pMsg->str, text_color_from_player_num[pMsg->player]);
pMsg++;
y += 35;
}
}
DEVILUTION_END_NAMESPACE

1
Source/plrmsg.h

@ -27,7 +27,6 @@ void SendPlrMsg(int pnum, const char *pszStr);
void ClearPlrMsg();
void InitPlrMsg();
void DrawPlrMsg(CelOutputBuffer out);
void PrintPlrMsg(CelOutputBuffer out, DWORD x, DWORD y, DWORD width, const char *str, BYTE col);
#ifdef __cplusplus
}

8
Source/quests.cpp

@ -806,7 +806,7 @@ void ResyncQuests()
}
}
static void PrintQLString(CelOutputBuffer out, int x, int y, BOOL cjustflag, const char *str, int col)
static void PrintQLString(CelOutputBuffer out, int x, int y, BOOL cjustflag, const char *str, text_color col)
{
int len, width, i, k, sx, sy;
BYTE c;
@ -843,14 +843,14 @@ void DrawQuestLog(CelOutputBuffer out)
{
int y, i;
PrintQLString(out, 0, 2, TRUE, "Quest Log", 3);
PrintQLString(out, 0, 2, TRUE, "Quest Log", COL_GOLD);
CelDrawTo(out, 0, 351, pQLogCel, 1, SPANEL_WIDTH);
y = qtopline;
for (i = 0; i < numqlines; i++) {
PrintQLString(out, 0, y, TRUE, questlist[qlist[i]]._qlstr, 0);
PrintQLString(out, 0, y, TRUE, questlist[qlist[i]]._qlstr, COL_WHITE);
y += 2;
}
PrintQLString(out, 0, 22, TRUE, "Close Quest Log", 0);
PrintQLString(out, 0, 22, TRUE, "Close Quest Log", COL_WHITE);
}
void StartQuestlog()

32
Source/stores.cpp

@ -115,7 +115,7 @@ void OffsetSTextY(int y, int yo)
stext[y]._syoff = yo;
}
void AddSText(int x, int y, bool j, const char *str, char clr, BOOL sel)
void AddSText(int x, int y, bool j, const char *str, text_color clr, BOOL sel)
{
stext[y]._sx = x;
stext[y]._syoff = 0;
@ -126,7 +126,7 @@ void AddSText(int x, int y, bool j, const char *str, char clr, BOOL sel)
stext[y]._ssel = sel;
}
void PrintStoreItem(ItemStruct *x, int l, char iclr)
void PrintStoreItem(ItemStruct *x, int l, text_color iclr)
{
char sstr[128];
char str, dex;
@ -288,7 +288,6 @@ void S_StartSmith()
void S_ScrollSBuy(int idx)
{
int l, ls;
char iclr;
ls = idx;
ClearSText(5, 21);
@ -296,7 +295,7 @@ void S_ScrollSBuy(int idx)
for (l = 5; l < 20; l += 4) {
if (!smithitem[ls].isEmpty()) {
iclr = COL_WHITE;
text_color iclr = COL_WHITE;
if (smithitem[ls]._iMagical) {
iclr = COL_BLUE;
}
@ -349,7 +348,6 @@ void S_StartSBuy()
void S_ScrollSPBuy(int idx)
{
int l, boughtitems;
char iclr;
ClearSText(5, 21);
boughtitems = idx;
@ -362,7 +360,7 @@ void S_ScrollSPBuy(int idx)
for (l = 5; l < 20 && idx < SMITH_PREMIUM_ITEMS; l += 4) {
if (!premiumitem[idx].isEmpty()) {
iclr = COL_WHITE;
text_color iclr = COL_WHITE;
if (premiumitem[idx]._iMagical)
iclr = COL_BLUE;
if (!premiumitem[idx]._iStatFlag)
@ -448,7 +446,6 @@ BOOL SmithSellOk(int i)
void S_ScrollSSell(int idx)
{
int l;
char iclr;
ClearSText(5, 21);
stextup = 5;
@ -457,7 +454,7 @@ void S_ScrollSSell(int idx)
if (idx >= storenumh)
break;
if (!storehold[idx].isEmpty()) {
iclr = COL_WHITE;
text_color iclr = COL_WHITE;
if (storehold[idx]._iMagical) {
iclr = COL_BLUE;
}
@ -657,7 +654,6 @@ void S_StartWitch()
void S_ScrollWBuy(int idx)
{
int l, ls;
char iclr;
ls = idx;
ClearSText(5, 21);
@ -665,7 +661,7 @@ void S_ScrollWBuy(int idx)
for (l = 5; l < 20; l += 4) {
if (!witchitem[ls].isEmpty()) {
iclr = COL_WHITE;
text_color iclr = COL_WHITE;
if (witchitem[ls]._iMagical) {
iclr = COL_BLUE;
}
@ -909,12 +905,11 @@ void S_StartNoRoom()
void S_StartConfirm()
{
BOOL idprint;
char iclr;
StartStore(stextshold);
stextscrl = false;
ClearSText(5, 23);
iclr = COL_WHITE;
text_color iclr = COL_WHITE;
if (plr[myplr].HoldItem._iMagical != ITEM_QUALITY_NORMAL)
iclr = COL_BLUE;
@ -993,15 +988,13 @@ void S_StartBoy()
void S_StartBBoy()
{
int iclr;
stextsize = true;
stextscrl = false;
sprintf(tempstr, "I have this item for sale: Your gold: %i", plr[myplr]._pGold);
AddSText(0, 1, TRUE, tempstr, COL_GOLD, FALSE);
AddSLine(3);
AddSLine(21);
iclr = COL_WHITE;
text_color iclr = COL_WHITE;
if (boyitem._iMagical != ITEM_QUALITY_NORMAL)
iclr = COL_BLUE;
@ -1049,13 +1042,12 @@ void S_StartHealer()
void S_ScrollHBuy(int idx)
{
int l;
char iclr;
ClearSText(5, 21);
stextup = 5;
for (l = 5; l < 20; l += 4) {
if (!healitem[idx].isEmpty()) {
iclr = COL_WHITE;
text_color iclr = COL_WHITE;
if (!healitem[idx]._iStatFlag) {
iclr = COL_RED;
}
@ -1202,12 +1194,10 @@ void S_StartSIdentify()
void S_StartIdShow()
{
char iclr;
StartStore(stextshold);
stextscrl = false;
ClearSText(5, 23);
iclr = COL_WHITE;
text_color iclr = COL_WHITE;
if (plr[myplr].HoldItem._iMagical != ITEM_QUALITY_NORMAL)
iclr = COL_BLUE;
@ -2275,7 +2265,7 @@ void FreeStoreMem()
MemFreeDbg(pSTextSlidCels);
}
void PrintSString(CelOutputBuffer out, int x, int y, bool cjustflag, const char *str, char col, int val)
void PrintSString(CelOutputBuffer out, int x, int y, bool cjustflag, const char *str, text_color col, int val)
{
int len, width, sx, sy, i, k, s;
int xx, yy;

4
Source/stores.h

@ -46,7 +46,7 @@ typedef struct STextStruct {
int _syoff;
char _sstr[128];
bool _sjust;
char _sclr;
text_color _sclr;
int _sline;
bool _ssel;
int _sval;
@ -97,7 +97,7 @@ void InitStores();
int PentSpn2Spin();
void SetupTownStores();
void FreeStoreMem();
void PrintSString(CelOutputBuffer out, int x, int y, bool cjustflag, const char *str, char col, int val);
void PrintSString(CelOutputBuffer out, int x, int y, bool cjustflag, const char *str, text_color col, int val);
void DrawSLine(CelOutputBuffer out, int y);
void DrawSTextHelp();
void ClearSText(int s, int e);

7
enums.h

@ -1869,13 +1869,6 @@ typedef enum event_type {
EVENT_TYPE_15 = 15,
} event_type;
typedef enum text_color {
COL_WHITE = 0x0,
COL_BLUE = 0x1,
COL_RED = 0x2,
COL_GOLD = 0x3,
} text_color;
typedef enum _difficulty {
DIFF_NORMAL = 0x0,
DIFF_NIGHTMARE = 0x1,

Loading…
Cancel
Save