mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- Changed DTA_Translation parameter for DrawTexture to an integer to avoid
passing renderer specific data to the function. Also added DTA_Font so that the renderer can fetch font translations from the proper font. DIM_MAP/ConShade had to be made a regular translation table to make it work. - Added Karate Chris's fix for scoreboard displaying team play related data in non teamplay games. - Fixed: The team selection menu didn't work. - Fixed: UpdateTeam passed an FString to Printf. SVN r623 (trunk)
This commit is contained in:
parent
e419cc246f
commit
eb2e40cde0
19 changed files with 156 additions and 103 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
December 23, 2007 (Changes by Graf Zahl)
|
||||||
|
- Changed DTA_Translation parameter for DrawTexture to an integer to avoid
|
||||||
|
passing renderer specific data to the function. Also added DTA_Font so
|
||||||
|
that the renderer can fetch font translations from the proper font.
|
||||||
|
DIM_MAP/ConShade had to be made a regular translation table to make it
|
||||||
|
work.
|
||||||
|
- Added Karate Chris's fix for scoreboard displaying team play related data
|
||||||
|
in non teamplay games.
|
||||||
|
- Fixed: The team selection menu didn't work.
|
||||||
|
- Fixed: UpdateTeam passed an FString to Printf.
|
||||||
|
|
||||||
December 22, 2007
|
December 22, 2007
|
||||||
- Had a look at sbarinfo.cpp and noticed a few places where it allocated
|
- Had a look at sbarinfo.cpp and noticed a few places where it allocated
|
||||||
character arrays and never freed them. Those have been replaced with
|
character arrays and never freed them. Those have been replaced with
|
||||||
|
|
|
@ -2119,7 +2119,7 @@ static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust,
|
||||||
DTA_ClipLeft, f_x,
|
DTA_ClipLeft, f_x,
|
||||||
DTA_ClipRight, f_x + f_w,
|
DTA_ClipRight, f_x + f_w,
|
||||||
DTA_FlipX, flip,
|
DTA_FlipX, flip,
|
||||||
DTA_Translation, translation != 0 ? translationtables[(translation&0xff00)>>8] + (translation&0x00ff)*256 : NULL,
|
DTA_Translation, translation,
|
||||||
DTA_Alpha, alpha,
|
DTA_Alpha, alpha,
|
||||||
DTA_FillColor, alphacolor,
|
DTA_FillColor, alphacolor,
|
||||||
DTA_RenderStyle, renderstyle,
|
DTA_RenderStyle, renderstyle,
|
||||||
|
|
|
@ -80,7 +80,7 @@ static bool TabbedList; // True if tab list was shown
|
||||||
CVAR (Bool, con_notablist, false, CVAR_ARCHIVE)
|
CVAR (Bool, con_notablist, false, CVAR_ARCHIVE)
|
||||||
|
|
||||||
static int conback;
|
static int conback;
|
||||||
static BYTE conshade[256];
|
static int conshade;
|
||||||
static bool conline;
|
static bool conline;
|
||||||
|
|
||||||
extern int gametic;
|
extern int gametic;
|
||||||
|
@ -292,38 +292,17 @@ void C_InitConsole (int width, int height, bool ingame)
|
||||||
{
|
{
|
||||||
if (!gotconback)
|
if (!gotconback)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
conback = TexMan.CheckForTexture ("CONBACK", FTexture::TEX_MiscPatch);
|
conback = TexMan.CheckForTexture ("CONBACK", FTexture::TEX_MiscPatch);
|
||||||
|
|
||||||
if (conback <= 0)
|
if (conback <= 0)
|
||||||
{
|
{
|
||||||
BYTE unremap[256];
|
conshade = DIM_MAP;
|
||||||
BYTE shadetmp[256];
|
|
||||||
|
|
||||||
conback = TexMan.GetTexture (gameinfo.titlePage, FTexture::TEX_MiscPatch);
|
conback = TexMan.GetTexture (gameinfo.titlePage, FTexture::TEX_MiscPatch);
|
||||||
|
|
||||||
FWadLump palookup = Wads.OpenLumpName ("COLORMAP");
|
|
||||||
palookup.Seek (22*256, SEEK_CUR);
|
|
||||||
palookup.Read (shadetmp, 256);
|
|
||||||
memset (unremap, 0, 256);
|
|
||||||
for (i = 0; i < 256; ++i)
|
|
||||||
{
|
|
||||||
unremap[GPalette.Remap[i]] = i;
|
|
||||||
}
|
|
||||||
for (i = 0; i < 256; ++i)
|
|
||||||
{
|
|
||||||
conshade[i] = GPalette.Remap[shadetmp[unremap[i]]];
|
|
||||||
}
|
|
||||||
conline = true;
|
conline = true;
|
||||||
conshade[0] = GPalette.Remap[0];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < 256; ++i)
|
conshade = 0;
|
||||||
{
|
|
||||||
conshade[i] = i;
|
|
||||||
}
|
|
||||||
conline = false;
|
conline = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ static void UpdateTeam (int pnum, int team, bool update)
|
||||||
if (update && oldteam != info->team)
|
if (update && oldteam != info->team)
|
||||||
{
|
{
|
||||||
if (TEAMINFO_IsValidTeam (info->team))
|
if (TEAMINFO_IsValidTeam (info->team))
|
||||||
Printf ("%s joined the %s team\n", info->netname, teams[info->team].name);
|
Printf ("%s joined the %s team\n", info->netname, teams[info->team].name.GetChars());
|
||||||
else
|
else
|
||||||
Printf ("%s is now a loner\n", info->netname);
|
Printf ("%s is now a loner\n", info->netname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,7 +377,6 @@ void F_TextWrite (void)
|
||||||
int c;
|
int c;
|
||||||
int cx;
|
int cx;
|
||||||
int cy;
|
int cy;
|
||||||
const BYTE *range;
|
|
||||||
int leftmargin;
|
int leftmargin;
|
||||||
int rowheight;
|
int rowheight;
|
||||||
bool scale;
|
bool scale;
|
||||||
|
@ -403,7 +402,6 @@ void F_TextWrite (void)
|
||||||
ch = FinaleText.GetChars();
|
ch = FinaleText.GetChars();
|
||||||
|
|
||||||
count = (FinaleCount - 10)/TEXTSPEED;
|
count = (FinaleCount - 10)/TEXTSPEED;
|
||||||
range = screen->Font->GetColorTranslation (CR_UNTRANSLATED);
|
|
||||||
|
|
||||||
for ( ; count ; count-- )
|
for ( ; count ; count-- )
|
||||||
{
|
{
|
||||||
|
@ -427,7 +425,8 @@ void F_TextWrite (void)
|
||||||
screen->DrawTexture (pic,
|
screen->DrawTexture (pic,
|
||||||
cx + 320 / 2,
|
cx + 320 / 2,
|
||||||
cy + 200 / 2,
|
cy + 200 / 2,
|
||||||
DTA_Translation, range,
|
DTA_Font, screen->Font,
|
||||||
|
DTA_Translation, CR_UNTRANSLATED,
|
||||||
DTA_Clean, true,
|
DTA_Clean, true,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
|
@ -436,7 +435,8 @@ void F_TextWrite (void)
|
||||||
screen->DrawTexture (pic,
|
screen->DrawTexture (pic,
|
||||||
cx + 320 / 2,
|
cx + 320 / 2,
|
||||||
cy + 200 / 2,
|
cy + 200 / 2,
|
||||||
DTA_Translation, range,
|
DTA_Font, screen->Font,
|
||||||
|
DTA_Translation, CR_UNTRANSLATED,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,7 +522,7 @@ static struct
|
||||||
int castnum;
|
int castnum;
|
||||||
int casttics;
|
int casttics;
|
||||||
int castsprite; // [RH] For overriding the player sprite with a skin
|
int castsprite; // [RH] For overriding the player sprite with a skin
|
||||||
const BYTE * casttranslation; // [RH] Draw "our hero" with their chosen suit color
|
int casttranslation; // [RH] Draw "our hero" with their chosen suit color
|
||||||
FState* caststate;
|
FState* caststate;
|
||||||
bool castdeath;
|
bool castdeath;
|
||||||
int castframes;
|
int castframes;
|
||||||
|
@ -582,7 +582,7 @@ void F_StartCast (void)
|
||||||
castnum = 0;
|
castnum = 0;
|
||||||
caststate = castorder[castnum].info->SeeState;
|
caststate = castorder[castnum].info->SeeState;
|
||||||
castsprite = caststate->sprite.index;
|
castsprite = caststate->sprite.index;
|
||||||
casttranslation = NULL;
|
casttranslation = 0;
|
||||||
casttics = caststate->GetTics ();
|
casttics = caststate->GetTics ();
|
||||||
castdeath = false;
|
castdeath = false;
|
||||||
FinaleStage = 3;
|
FinaleStage = 3;
|
||||||
|
@ -632,12 +632,12 @@ void F_CastTicker (void)
|
||||||
if (castnum == 16)
|
if (castnum == 16)
|
||||||
{
|
{
|
||||||
castsprite = skins[players[consoleplayer].userinfo.skin].sprite;
|
castsprite = skins[players[consoleplayer].userinfo.skin].sprite;
|
||||||
casttranslation = translationtables[TRANSLATION_Players] + 256*consoleplayer;
|
casttranslation = TRANSLATION(TRANSLATION_Players, consoleplayer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
castsprite = caststate->sprite.index;
|
castsprite = caststate->sprite.index;
|
||||||
casttranslation = NULL;
|
casttranslation = 0;
|
||||||
}
|
}
|
||||||
castframes = 0;
|
castframes = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,7 @@ private:
|
||||||
DrawImage (Images[imgCHAINBACK], 0, 32);
|
DrawImage (Images[imgCHAINBACK], 0, 32);
|
||||||
DrawImage (Images[imgCHAIN], 2+(healthPos%17), chainY);
|
DrawImage (Images[imgCHAIN], 2+(healthPos%17), chainY);
|
||||||
DrawImage (Images[imgLIFEGEM], 17+healthPos, chainY, multiplayer ?
|
DrawImage (Images[imgLIFEGEM], 17+healthPos, chainY, multiplayer ?
|
||||||
translationtables[TRANSLATION_PlayersExtra] + (CPlayer-players)*256 : NULL);
|
TRANSLATION(TRANSLATION_PlayersExtra, BYTE(CPlayer-players)) : 0);
|
||||||
DrawImage (Images[imgLTFACE], 0, 32);
|
DrawImage (Images[imgLTFACE], 0, 32);
|
||||||
DrawImage (Images[imgRTFACE], 276, 32);
|
DrawImage (Images[imgRTFACE], 276, 32);
|
||||||
screen->DrawTexture (&ChainShade, ST_X+19, ST_Y+32,
|
screen->DrawTexture (&ChainShade, ST_X+19, ST_Y+32,
|
||||||
|
|
|
@ -367,7 +367,7 @@ private:
|
||||||
healthPos = clamp (HealthMarker, 0, 100);
|
healthPos = clamp (HealthMarker, 0, 100);
|
||||||
DrawImage (ClassImages[lifeClass][imgCHAIN], 35+((healthPos*196/100)%9), 31);
|
DrawImage (ClassImages[lifeClass][imgCHAIN], 35+((healthPos*196/100)%9), 31);
|
||||||
DrawImage (ClassImages[lifeClass][imgLIFEGEM], 7+(healthPos*11/5), 31, multiplayer ?
|
DrawImage (ClassImages[lifeClass][imgLIFEGEM], 7+(healthPos*11/5), 31, multiplayer ?
|
||||||
translationtables[TRANSLATION_PlayersExtra] + (CPlayer-players)*256 : NULL);
|
TRANSLATION(TRANSLATION_PlayersExtra, BYTE(CPlayer-players)) : 0);
|
||||||
DrawImage (Images[imgLFEDGE], 0, 31);
|
DrawImage (Images[imgLFEDGE], 0, 31);
|
||||||
DrawImage (Images[imgRTEDGE], 277, 31);
|
DrawImage (Images[imgRTEDGE], 277, 31);
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ protected:
|
||||||
void DrawPowerups ();
|
void DrawPowerups ();
|
||||||
|
|
||||||
void UpdateRect (int x, int y, int width, int height) const;
|
void UpdateRect (int x, int y, int width, int height) const;
|
||||||
void DrawImage (FTexture *image, int x, int y, BYTE *translation=NULL) const;
|
void DrawImage (FTexture *image, int x, int y, int translation=0, FFont *font=NULL) const;
|
||||||
void DrawFadedImage (FTexture *image, int x, int y, fixed_t shade) const;
|
void DrawFadedImage (FTexture *image, int x, int y, fixed_t shade) const;
|
||||||
void DrawPartialImage (FTexture *image, int wx, int ww) const;
|
void DrawPartialImage (FTexture *image, int wx, int ww) const;
|
||||||
|
|
||||||
|
|
|
@ -1524,7 +1524,7 @@ private:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
x += (character->LeftOffset+1); //ignore x offsets since we adapt to character size
|
x += (character->LeftOffset+1); //ignore x offsets since we adapt to character size
|
||||||
DrawImage(character, x, y, drawingFont->GetColorTranslation(translation));
|
DrawImage(character, x, y, translation, drawingFont);
|
||||||
x += width + spacing - (character->LeftOffset+1);
|
x += width + spacing - (character->LeftOffset+1);
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
|
@ -1734,14 +1734,13 @@ private:
|
||||||
DrawImage(chain, x+(offset%chainsize), y);
|
DrawImage(chain, x+(offset%chainsize), y);
|
||||||
}
|
}
|
||||||
if(gem != NULL)
|
if(gem != NULL)
|
||||||
DrawImage(gem, x+padleft+offset, y, translate ? getTranslation() : NULL);
|
DrawImage(gem, x+padleft+offset, y, translate ? getTranslation() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE* getTranslation()
|
int getTranslation()
|
||||||
{
|
{
|
||||||
if(gameinfo.gametype & GAME_Raven)
|
if(gameinfo.gametype & GAME_Raven) return TRANSLATION(TRANSLATION_PlayersExtra, BYTE(CPlayer - players));
|
||||||
return translationtables[TRANSLATION_PlayersExtra] + (CPlayer - players)*256;
|
else return TRANSLATION(TRANSLATION_Players, BYTE(CPlayer - players));
|
||||||
return translationtables[TRANSLATION_Players] + (CPlayer - players)*256;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FImageCollection Images;
|
FImageCollection Images;
|
||||||
|
|
|
@ -408,11 +408,12 @@ void FBaseStatusBar::ShowPlayerName ()
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void FBaseStatusBar::DrawImage (FTexture *img,
|
void FBaseStatusBar::DrawImage (FTexture *img,
|
||||||
int x, int y, BYTE *translation) const
|
int x, int y, int translation, FFont *font) const
|
||||||
{
|
{
|
||||||
if (img != NULL)
|
if (img != NULL)
|
||||||
{
|
{
|
||||||
screen->DrawTexture (img, x + ST_X, y + ST_Y,
|
screen->DrawTexture (img, x + ST_X, y + ST_Y,
|
||||||
|
DTA_Font, font,
|
||||||
DTA_Translation, translation,
|
DTA_Translation, translation,
|
||||||
DTA_320x200, Scaled,
|
DTA_320x200, Scaled,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
@ -795,11 +796,13 @@ void FBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size)
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Alpha, HR_SHADOW,
|
DTA_Alpha, HR_SHADOW,
|
||||||
DTA_FillColor, 0,
|
DTA_FillColor, 0,
|
||||||
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
DTA_Font, BigFont,
|
||||||
|
DTA_TranslationPtr, CR_UNTRANSLATED,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
screen->DrawTexture (pic, xpos - v/2, y,
|
screen->DrawTexture (pic, xpos - v/2, y,
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
DTA_Font, BigFont,
|
||||||
|
DTA_TranslationPtr, CR_UNTRANSLATED,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -820,7 +823,8 @@ void FBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size)
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Alpha, HR_SHADOW,
|
DTA_Alpha, HR_SHADOW,
|
||||||
DTA_FillColor, 0,
|
DTA_FillColor, 0,
|
||||||
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
DTA_Font, BigFont,
|
||||||
|
DTA_TranslationPtr, CR_UNTRANSLATED,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
val /= 10;
|
val /= 10;
|
||||||
xpos -= w;
|
xpos -= w;
|
||||||
|
@ -834,7 +838,8 @@ void FBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size)
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Alpha, HR_SHADOW,
|
DTA_Alpha, HR_SHADOW,
|
||||||
DTA_FillColor, 0,
|
DTA_FillColor, 0,
|
||||||
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
DTA_Font, BigFont,
|
||||||
|
DTA_TranslationPtr, CR_UNTRANSLATED,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -847,7 +852,8 @@ void FBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size)
|
||||||
pic = BigFont->GetChar ('0' + val % 10, &v);
|
pic = BigFont->GetChar ('0' + val % 10, &v);
|
||||||
screen->DrawTexture (pic, xpos - v/2, y,
|
screen->DrawTexture (pic, xpos - v/2, y,
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
DTA_Font, BigFont,
|
||||||
|
DTA_TranslationPtr, CR_UNTRANSLATED,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
val /= 10;
|
val /= 10;
|
||||||
xpos -= w;
|
xpos -= w;
|
||||||
|
@ -859,7 +865,8 @@ void FBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size)
|
||||||
{
|
{
|
||||||
screen->DrawTexture (pic, xpos - v/2, y,
|
screen->DrawTexture (pic, xpos - v/2, y,
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
DTA_Font, BigFont,
|
||||||
|
DTA_TranslationPtr, CR_UNTRANSLATED,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,10 +179,15 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (teamplay)
|
||||||
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 3.5 : y = SCREENHEIGHT / 16;
|
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 3.5 : y = SCREENHEIGHT / 16;
|
||||||
|
else
|
||||||
|
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 4 : y = SCREENHEIGHT / 16;
|
||||||
|
|
||||||
HU_DrawTimeRemaining (ST_Y - height);
|
HU_DrawTimeRemaining (ST_Y - height);
|
||||||
|
|
||||||
|
if (teamplay)
|
||||||
|
{
|
||||||
for (i = 0; i < teams.Size (); i++)
|
for (i = 0; i < teams.Size (); i++)
|
||||||
{
|
{
|
||||||
teams[i].players = 0;
|
teams[i].players = 0;
|
||||||
|
@ -219,6 +224,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
|
||||||
}
|
}
|
||||||
|
|
||||||
gamestate == GS_INTERMISSION ? y += 0 : y += SCREENWIDTH / 32;
|
gamestate == GS_INTERMISSION ? y += 0 : y += SCREENWIDTH / 32;
|
||||||
|
}
|
||||||
|
|
||||||
screen->SetFont (SmallFont);
|
screen->SetFont (SmallFont);
|
||||||
|
|
||||||
|
@ -234,6 +240,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
|
||||||
x = (SCREENWIDTH >> 1) - (((maxwidth + 32 + 32 + 16) * CleanXfac) >> 1);
|
x = (SCREENWIDTH >> 1) - (((maxwidth + 32 + 32 + 16) * CleanXfac) >> 1);
|
||||||
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 3.5 : y = SCREENHEIGHT / 10;
|
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 3.5 : y = SCREENHEIGHT / 10;
|
||||||
|
|
||||||
|
if (teamplay)
|
||||||
y += SCREENWIDTH / 32;
|
y += SCREENWIDTH / 32;
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS && y < ST_Y - 12 * CleanYfac; i++)
|
for (i = 0; i < MAXPLAYERS && y < ST_Y - 12 * CleanYfac; i++)
|
||||||
|
|
|
@ -2134,7 +2134,7 @@ static void M_PlayerSetupDrawer ()
|
||||||
(PSetupDef.y + LINEHEIGHT*3 + 57 - 104)*CleanYfac + (SCREENHEIGHT/2),
|
(PSetupDef.y + LINEHEIGHT*3 + 57 - 104)*CleanYfac + (SCREENHEIGHT/2),
|
||||||
DTA_DestWidth, MulScale16 (tex->GetWidth() * CleanXfac, Scale),
|
DTA_DestWidth, MulScale16 (tex->GetWidth() * CleanXfac, Scale),
|
||||||
DTA_DestHeight, MulScale16 (tex->GetHeight() * CleanYfac, Scale),
|
DTA_DestHeight, MulScale16 (tex->GetHeight() * CleanYfac, Scale),
|
||||||
DTA_Translation, translationtables[TRANSLATION_Players] + 256 * MAXPLAYERS,
|
DTA_Translation, TRANSLATION(TRANSLATION_Players, 0),
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2547,7 +2547,7 @@ static void M_ChangePlayerTeam (int choice)
|
||||||
{
|
{
|
||||||
team = TEAM_None;
|
team = TEAM_None;
|
||||||
}
|
}
|
||||||
else if (team == TEAM_None)
|
else if (!TEAMINFO_IsValidTeam (team))
|
||||||
{
|
{
|
||||||
team = teams.Size () - 1;
|
team = teams.Size () - 1;
|
||||||
}
|
}
|
||||||
|
@ -2558,11 +2558,7 @@ static void M_ChangePlayerTeam (int choice)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (team == teams.Size () - 1)
|
if (!TEAMINFO_IsValidTeam (team))
|
||||||
{
|
|
||||||
team = TEAM_None;
|
|
||||||
}
|
|
||||||
else if (team == TEAM_None)
|
|
||||||
{
|
{
|
||||||
team = 0;
|
team = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1423,6 +1423,7 @@ void R_InitTranslationTables ()
|
||||||
+8 // Standard (7 for Strife, 3 for the rest)
|
+8 // Standard (7 for Strife, 3 for the rest)
|
||||||
+MAX_ACS_TRANSLATIONS // LevelScripted
|
+MAX_ACS_TRANSLATIONS // LevelScripted
|
||||||
+BODYQUESIZE // PlayerCorpses
|
+BODYQUESIZE // PlayerCorpses
|
||||||
|
+1
|
||||||
)];
|
)];
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
@ -1450,9 +1451,13 @@ void R_InitTranslationTables ()
|
||||||
translationtables[TRANSLATION_PlayerCorpses] =
|
translationtables[TRANSLATION_PlayerCorpses] =
|
||||||
translationtables[TRANSLATION_LevelScripted] + MAX_ACS_TRANSLATIONS*256;
|
translationtables[TRANSLATION_LevelScripted] + MAX_ACS_TRANSLATIONS*256;
|
||||||
|
|
||||||
|
translationtables[TRANSLATION_Dim] =
|
||||||
|
translationtables[TRANSLATION_PlayerCorpses] + BODYQUESIZE*256;
|
||||||
|
|
||||||
translationtables[TRANSLATION_Decorate] = decorate_translations;
|
translationtables[TRANSLATION_Decorate] = decorate_translations;
|
||||||
translationtables[TRANSLATION_Blood] = decorate_translations + MAX_DECORATE_TRANSLATIONS*256;
|
translationtables[TRANSLATION_Blood] = decorate_translations + MAX_DECORATE_TRANSLATIONS*256;
|
||||||
|
|
||||||
|
|
||||||
// [RH] Each player now gets their own translation table. These are set
|
// [RH] Each player now gets their own translation table. These are set
|
||||||
// up during netgame arbitration and as-needed rather than in here.
|
// up during netgame arbitration and as-needed rather than in here.
|
||||||
|
|
||||||
|
@ -1597,6 +1602,27 @@ void R_InitTranslationTables ()
|
||||||
table += 256;
|
table += 256;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dim map
|
||||||
|
{
|
||||||
|
BYTE *dim_map = translationtables[TRANSLATION_Dim];
|
||||||
|
BYTE unremap[256];
|
||||||
|
BYTE shadetmp[256];
|
||||||
|
|
||||||
|
FWadLump palookup = Wads.OpenLumpName ("COLORMAP");
|
||||||
|
palookup.Seek (22*256, SEEK_CUR);
|
||||||
|
palookup.Read (shadetmp, 256);
|
||||||
|
memset (unremap, 0, 256);
|
||||||
|
for (i = 0; i < 256; ++i)
|
||||||
|
{
|
||||||
|
unremap[GPalette.Remap[i]] = i;
|
||||||
|
}
|
||||||
|
for (i = 0; i < 256; ++i)
|
||||||
|
{
|
||||||
|
dim_map[i] = GPalette.Remap[shadetmp[unremap[i]]];
|
||||||
|
}
|
||||||
|
dim_map[0] = GPalette.Remap[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// [RH] Create a player's translation table based on a given mid-range color.
|
// [RH] Create a player's translation table based on a given mid-range color.
|
||||||
|
|
|
@ -212,6 +212,7 @@ enum
|
||||||
TRANSLATION_PlayerCorpses,
|
TRANSLATION_PlayerCorpses,
|
||||||
TRANSLATION_Decorate,
|
TRANSLATION_Decorate,
|
||||||
TRANSLATION_Blood,
|
TRANSLATION_Blood,
|
||||||
|
TRANSLATION_Dim,
|
||||||
|
|
||||||
NUM_TRANSLATION_TABLES
|
NUM_TRANSLATION_TABLES
|
||||||
};
|
};
|
||||||
|
@ -228,6 +229,8 @@ inline int GetTranslationType(WORD trans)
|
||||||
return trans >> 8;
|
return trans >> 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DIM_MAP TRANSLATION(TRANSLATION_Dim, 0)
|
||||||
|
|
||||||
const int MAX_ACS_TRANSLATIONS = 255;
|
const int MAX_ACS_TRANSLATIONS = 255;
|
||||||
const int MAX_DECORATE_TRANSLATIONS = 255;
|
const int MAX_DECORATE_TRANSLATIONS = 255;
|
||||||
|
|
||||||
|
|
|
@ -90,9 +90,13 @@ void STACK_ARGS DCanvas::DrawTextureV(FTexture *img, int x, int y, uint32 tag, v
|
||||||
|
|
||||||
if (parms.style != STYLE_Shaded)
|
if (parms.style != STYLE_Shaded)
|
||||||
{
|
{
|
||||||
if (parms.translation != NULL)
|
if (parms.font != NULL)
|
||||||
{
|
{
|
||||||
dc_colormap = (lighttable_t *)parms.translation;
|
dc_colormap = parms.font->GetColorTranslation (EColorRange(parms.translation));
|
||||||
|
}
|
||||||
|
else if (parms.translation != 0)
|
||||||
|
{
|
||||||
|
dc_colormap = translationtables[(parms.translation&0xff00)>>8] + (parms.translation&0x00ff)*256;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -251,6 +255,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l
|
||||||
{
|
{
|
||||||
INTBOOL boolval;
|
INTBOOL boolval;
|
||||||
int intval;
|
int intval;
|
||||||
|
bool translationset = false;
|
||||||
|
|
||||||
if (img == NULL || img->UseType == FTexture::TEX_Null)
|
if (img == NULL || img->UseType == FTexture::TEX_Null)
|
||||||
{
|
{
|
||||||
|
@ -272,7 +277,8 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l
|
||||||
parms->left = img->GetScaledLeftOffset();
|
parms->left = img->GetScaledLeftOffset();
|
||||||
parms->alpha = FRACUNIT;
|
parms->alpha = FRACUNIT;
|
||||||
parms->fillcolor = -1;
|
parms->fillcolor = -1;
|
||||||
parms->translation = NULL;
|
parms->font = NULL;
|
||||||
|
parms->translation = 0;
|
||||||
parms->alphaChannel = false;
|
parms->alphaChannel = false;
|
||||||
parms->flipX = false;
|
parms->flipX = false;
|
||||||
parms->shadowAlpha = 0;
|
parms->shadowAlpha = 0;
|
||||||
|
@ -397,8 +403,19 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l
|
||||||
parms->fillcolor = va_arg (tags, int);
|
parms->fillcolor = va_arg (tags, int);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DTA_Font:
|
||||||
|
parms->font = va_arg(tags, FFont*);
|
||||||
|
if (!translationset)
|
||||||
|
{
|
||||||
|
// default translation for fonts should be untranslated which unfortunately is not 0.
|
||||||
|
parms->translation = CR_UNTRANSLATED;
|
||||||
|
translationset = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case DTA_Translation:
|
case DTA_Translation:
|
||||||
parms->translation = va_arg (tags, const BYTE *);
|
parms->translation = va_arg(tags, int);
|
||||||
|
translationset = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTA_FlipX:
|
case DTA_FlipX:
|
||||||
|
|
|
@ -89,9 +89,6 @@ extern "C" {
|
||||||
extern FDynamicColormap NormalLight;
|
extern FDynamicColormap NormalLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The translation to use for depleted items
|
|
||||||
#define DIM_MAP &NormalLight.Maps[NUMCOLORMAPS*2/3*256]
|
|
||||||
|
|
||||||
extern int Near255; // A color near 255 in appearance, but not 255
|
extern int Near255; // A color near 255 in appearance, but not 255
|
||||||
|
|
||||||
int BestColor (const uint32 *pal, int r, int g, int b, int first=1, int num=255);
|
int BestColor (const uint32 *pal, int r, int g, int b, int first=1, int num=255);
|
||||||
|
|
|
@ -70,10 +70,9 @@ void STACK_ARGS DCanvas::DrawChar (int normalcolor, int x, int y, BYTE character
|
||||||
|
|
||||||
if (NULL != (pic = Font->GetChar (character, &dummy)))
|
if (NULL != (pic = Font->GetChar (character, &dummy)))
|
||||||
{
|
{
|
||||||
const BYTE *range = Font->GetColorTranslation ((EColorRange)normalcolor);
|
|
||||||
va_list taglist;
|
va_list taglist;
|
||||||
va_start (taglist, character);
|
va_start (taglist, character);
|
||||||
DrawTexture (pic, x, y, DTA_Translation, range, TAG_MORE, &taglist);
|
DrawTexture (pic, x, y, DTA_Font, Font, DTA_Translation, normalcolor, TAG_MORE, &taglist);
|
||||||
va_end (taglist);
|
va_end (taglist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,11 +95,13 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st
|
||||||
int cx;
|
int cx;
|
||||||
int cy;
|
int cy;
|
||||||
int boldcolor;
|
int boldcolor;
|
||||||
const BYTE *range;
|
int range;
|
||||||
int height;
|
int height;
|
||||||
int forcedwidth = 0;
|
int forcedwidth = 0;
|
||||||
int scalex, scaley;
|
int scalex, scaley;
|
||||||
int kerning;
|
int kerning;
|
||||||
|
FFont *Font = this->Font;
|
||||||
|
|
||||||
FTexture *pic;
|
FTexture *pic;
|
||||||
|
|
||||||
if (Font == NULL || string == NULL)
|
if (Font == NULL || string == NULL)
|
||||||
|
@ -110,7 +111,7 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st
|
||||||
normalcolor = CR_UNTRANSLATED;
|
normalcolor = CR_UNTRANSLATED;
|
||||||
boldcolor = normalcolor ? normalcolor - 1 : NumTextColors - 1;
|
boldcolor = normalcolor ? normalcolor - 1 : NumTextColors - 1;
|
||||||
|
|
||||||
range = Font->GetColorTranslation ((EColorRange)normalcolor);
|
range = normalcolor;
|
||||||
height = Font->GetHeight () + 1;
|
height = Font->GetHeight () + 1;
|
||||||
kerning = Font->GetDefaultKerning ();
|
kerning = Font->GetDefaultKerning ();
|
||||||
|
|
||||||
|
@ -129,7 +130,6 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st
|
||||||
{
|
{
|
||||||
va_list *more_p;
|
va_list *more_p;
|
||||||
DWORD data;
|
DWORD data;
|
||||||
void *ptrval;
|
|
||||||
|
|
||||||
switch (tag)
|
switch (tag)
|
||||||
{
|
{
|
||||||
|
@ -158,7 +158,12 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st
|
||||||
// Translation is specified explicitly by the text.
|
// Translation is specified explicitly by the text.
|
||||||
case DTA_Translation:
|
case DTA_Translation:
|
||||||
*(DWORD *)tags = TAG_IGNORE;
|
*(DWORD *)tags = TAG_IGNORE;
|
||||||
ptrval = va_arg (tags, void*);
|
data = va_arg (tags, int);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DTA_Font:
|
||||||
|
*(DWORD *)tags = TAG_IGNORE;
|
||||||
|
Font = va_arg (tags, FFont*);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTA_CleanNoMove:
|
case DTA_CleanNoMove:
|
||||||
|
@ -214,7 +219,7 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st
|
||||||
EColorRange newcolor = V_ParseFontColor (ch, normalcolor, boldcolor);
|
EColorRange newcolor = V_ParseFontColor (ch, normalcolor, boldcolor);
|
||||||
if (newcolor != CR_UNDEFINED)
|
if (newcolor != CR_UNDEFINED)
|
||||||
{
|
{
|
||||||
range = Font->GetColorTranslation (newcolor);
|
range = newcolor;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -234,6 +239,7 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st
|
||||||
{
|
{
|
||||||
w = forcedwidth;
|
w = forcedwidth;
|
||||||
DrawTexture (pic, cx, cy,
|
DrawTexture (pic, cx, cy,
|
||||||
|
DTA_Font, Font,
|
||||||
DTA_Translation, range,
|
DTA_Translation, range,
|
||||||
DTA_DestWidth, forcedwidth,
|
DTA_DestWidth, forcedwidth,
|
||||||
DTA_DestHeight, height,
|
DTA_DestHeight, height,
|
||||||
|
@ -242,6 +248,7 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawTexture (pic, cx, cy,
|
DrawTexture (pic, cx, cy,
|
||||||
|
DTA_Font, Font,
|
||||||
DTA_Translation, range,
|
DTA_Translation, range,
|
||||||
TAG_MORE, &taglist);
|
TAG_MORE, &taglist);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,9 @@ enum
|
||||||
DTA_DestHeight, // height of area to draw to
|
DTA_DestHeight, // height of area to draw to
|
||||||
DTA_Alpha, // alpha value for translucency
|
DTA_Alpha, // alpha value for translucency
|
||||||
DTA_FillColor, // color to stencil onto the destination
|
DTA_FillColor, // color to stencil onto the destination
|
||||||
|
DTA_Font, // For characters: Font it belongs to
|
||||||
DTA_Translation, // translation table to recolor the source
|
DTA_Translation, // translation table to recolor the source
|
||||||
|
DTA_TranslationPtr, // translation table to recolor the source
|
||||||
DTA_AlphaChannel, // bool: the source is an alpha channel; used with DTA_FillColor
|
DTA_AlphaChannel, // bool: the source is an alpha channel; used with DTA_FillColor
|
||||||
DTA_Clean, // bool: scale texture size and position by CleanXfac and CleanYfac
|
DTA_Clean, // bool: scale texture size and position by CleanXfac and CleanYfac
|
||||||
DTA_320x200, // bool: scale texture size and position to fit on a virtual 320x200 screen
|
DTA_320x200, // bool: scale texture size and position to fit on a virtual 320x200 screen
|
||||||
|
@ -204,7 +206,8 @@ protected:
|
||||||
int left;
|
int left;
|
||||||
fixed_t alpha;
|
fixed_t alpha;
|
||||||
int fillcolor;
|
int fillcolor;
|
||||||
const BYTE *translation;
|
FFont *font;
|
||||||
|
int translation;
|
||||||
INTBOOL alphaChannel;
|
INTBOOL alphaChannel;
|
||||||
INTBOOL flipX;
|
INTBOOL flipX;
|
||||||
fixed_t shadowAlpha;
|
fixed_t shadowAlpha;
|
||||||
|
|
|
@ -698,7 +698,8 @@ static void WI_DrawCharPatch (FTexture *patch, int x, int y)
|
||||||
screen->DrawTexture (patch, x, y,
|
screen->DrawTexture (patch, x, y,
|
||||||
DTA_Clean, true,
|
DTA_Clean, true,
|
||||||
DTA_ShadowAlpha, (gameinfo.gametype == GAME_Doom) ? 0 : FRACUNIT/2,
|
DTA_ShadowAlpha, (gameinfo.gametype == GAME_Doom) ? 0 : FRACUNIT/2,
|
||||||
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED), // otherwise it doesn't look good in Strife!
|
DTA_Font, BigFont,
|
||||||
|
DTA_Translation, CR_UNTRANSLATED, // otherwise it doesn't look good in Strife!
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1583,13 +1584,13 @@ void WI_drawNetgameStats ()
|
||||||
x = NG_STATSX;
|
x = NG_STATSX;
|
||||||
// [RH] Only use one graphic for the face backgrounds
|
// [RH] Only use one graphic for the face backgrounds
|
||||||
screen->DrawTexture (p, x - p->GetWidth(), y,
|
screen->DrawTexture (p, x - p->GetWidth(), y,
|
||||||
DTA_Translation, translationtables[TRANSLATION_Players] + i*256,
|
DTA_Translation, TRANSLATION(TRANSLATION_Players, i),
|
||||||
DTA_Clean, true,
|
DTA_Clean, true,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
|
||||||
if (i == me)
|
if (i == me)
|
||||||
screen->DrawTexture (star, x - p->GetWidth(), y,
|
screen->DrawTexture (star, x - p->GetWidth(), y,
|
||||||
DTA_Translation, translationtables[TRANSLATION_Players] + i*256,
|
DTA_Translation, TRANSLATION(TRANSLATION_Players, i),
|
||||||
DTA_Clean, true,
|
DTA_Clean, true,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
|
||||||
|
@ -1633,7 +1634,7 @@ void WI_drawNetgameStats ()
|
||||||
if (gameinfo.gametype == GAME_Heretic)
|
if (gameinfo.gametype == GAME_Heretic)
|
||||||
{
|
{
|
||||||
screen->DrawTexture (star, 25, y,
|
screen->DrawTexture (star, 25, y,
|
||||||
DTA_Translation, translationtables[TRANSLATION_Players] + i*256,
|
DTA_Translation, TRANSLATION(TRANSLATION_Players, i),
|
||||||
DTA_Clean, true,
|
DTA_Clean, true,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue