mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- Added some simple translucency map analysis for BOOM maps to more
intelligently pick the value to use for TranslucentLine's second argument. - Added a queryiwad_key cvar to control which key can force the IWAD selection to appear. It can be either "shift" or "control". Any other value will disable its functionality. - Fixed: A_SkullPop() and A_FreezeDeathChunks() did not transfer the player's inventory to the new dismembered head "player". SVN r268 (trunk)
This commit is contained in:
parent
6d389c6b7d
commit
361f855de0
7 changed files with 101 additions and 8 deletions
|
@ -1,3 +1,12 @@
|
|||
July 19, 2006
|
||||
- Added some simple translucency map analysis for BOOM maps to more
|
||||
intelligently pick the value to use for TranslucentLine's second argument.
|
||||
- Added a queryiwad_key cvar to control which key can force the IWAD selection
|
||||
to appear. It can be either "shift" or "control". Any other value will
|
||||
disable its functionality.
|
||||
- Fixed: A_SkullPop() and A_FreezeDeathChunks() did not transfer the player's
|
||||
inventory to the new dismembered head "player".
|
||||
|
||||
July 18, 2006
|
||||
- Fixed: C_midPrint() needs a NULL status bar check.
|
||||
|
||||
|
|
|
@ -212,6 +212,7 @@ void A_SkullPop (AActor *actor)
|
|||
// Attach player mobj to bloody skull
|
||||
player = actor->player;
|
||||
actor->player = NULL;
|
||||
mo->ObtainInventory (actor);
|
||||
mo->player = player;
|
||||
mo->health = actor->health;
|
||||
mo->angle = actor->angle;
|
||||
|
|
|
@ -284,6 +284,7 @@ void A_FreezeDeathChunks (AActor *actor)
|
|||
head->momy = pr_freeze.Random2 () << (FRACBITS-7);
|
||||
head->player = actor->player;
|
||||
actor->player = NULL;
|
||||
head->ObtainInventory (actor);
|
||||
head->health = actor->health;
|
||||
head->angle = actor->angle;
|
||||
head->player->mo = head;
|
||||
|
|
|
@ -120,6 +120,7 @@ struct sidei_t // [RH] Only keep BOOM sidedef init stuff around for init
|
|||
struct
|
||||
{
|
||||
short tag, special;
|
||||
short alpha;
|
||||
DWORD map;
|
||||
} a;
|
||||
|
||||
|
@ -1715,12 +1716,18 @@ void P_FinishLoadingLineDefs ()
|
|||
switch (ld->special)
|
||||
{ // killough 4/11/98: handle special types
|
||||
int j;
|
||||
int alpha;
|
||||
|
||||
case TranslucentLine: // killough 4/11/98: translucent 2s textures
|
||||
// [RH] Second arg controls how opaque it is.
|
||||
alpha = sidetemp[ld->sidenum[0]].a.alpha;
|
||||
if (alpha < 0)
|
||||
{
|
||||
alpha = ld->args[1];
|
||||
}
|
||||
if (!ld->args[0])
|
||||
{
|
||||
ld->alpha = (byte)ld->args[1];
|
||||
ld->alpha = (BYTE)alpha;
|
||||
if (ld->args[2] == 1)
|
||||
{
|
||||
sides[ld->sidenum[0]].Flags |= WALLF_ADDTRANS;
|
||||
|
@ -1736,7 +1743,7 @@ void P_FinishLoadingLineDefs ()
|
|||
{
|
||||
if (lines[j].id == ld->args[0])
|
||||
{
|
||||
lines[j].alpha = (byte)ld->args[1];
|
||||
lines[j].alpha = (BYTE)alpha;
|
||||
if (lines[j].args[2] == 1)
|
||||
{
|
||||
sides[lines[j].sidenum[0]].Flags |= WALLF_ADDTRANS;
|
||||
|
@ -1930,6 +1937,7 @@ static void P_AllocateSideDefs (int count)
|
|||
for (i = 0; i < count; i++)
|
||||
{
|
||||
sidetemp[i].a.special = sidetemp[i].a.tag = 0;
|
||||
sidetemp[i].a.alpha = -1;
|
||||
sidetemp[i].a.map = NO_SIDE;
|
||||
}
|
||||
if (count < numsides)
|
||||
|
@ -2075,6 +2083,28 @@ static void P_LoopSidedefs ()
|
|||
sidetemp = NULL;
|
||||
}
|
||||
|
||||
int P_DetermineTranslucency (int lumpnum)
|
||||
{
|
||||
FWadLump tranmap = Wads.OpenLumpNum (lumpnum);
|
||||
BYTE index;
|
||||
PalEntry newcolor;
|
||||
|
||||
tranmap.Seek (GPalette.BlackIndex * 256 + GPalette.WhiteIndex, SEEK_SET);
|
||||
tranmap.Read (&index, 1);
|
||||
|
||||
newcolor = GPalette.BaseColors[GPalette.Remap[index]];
|
||||
|
||||
if (developer)
|
||||
{
|
||||
char lumpname[9];
|
||||
lumpname[8] = 0;
|
||||
Wads.GetLumpName (lumpname, lumpnum);
|
||||
Printf ("%s appears to be translucency %d (%d%%)\n", lumpname, newcolor.r,
|
||||
newcolor.r*100/255);
|
||||
}
|
||||
return newcolor.r;
|
||||
}
|
||||
|
||||
// killough 4/4/98: delay using texture names until
|
||||
// after linedefs are loaded, to allow overloading.
|
||||
// killough 5/3/98: reformatted, cleaned up
|
||||
|
@ -2171,8 +2201,37 @@ void P_LoadSideDefs2 (MapData * map)
|
|||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
case TranslucentLine: // killough 4/11/98: apply translucency to 2s normal texture
|
||||
case TranslucentLine: // killough 4/11/98: apply translucency to 2s normal texture
|
||||
if (!map->HasBehavior)
|
||||
{
|
||||
int lumpnum;
|
||||
|
||||
if (strnicmp ("TRANMAP", msd->midtexture, 8) == 0)
|
||||
{
|
||||
// The translator set the alpha argument already; no reason to do it again.
|
||||
sd->midtexture = 0;
|
||||
}
|
||||
else if ((lumpnum = Wads.CheckNumForName (msd->midtexture)) > 0 &&
|
||||
Wads.LumpLength (lumpnum) == 65536)
|
||||
{
|
||||
sidetemp[i].a.alpha = P_DetermineTranslucency (lumpnum);
|
||||
sd->midtexture = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy (name, msd->midtexture, 8);
|
||||
sd->midtexture = TexMan.GetTexture (name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
|
||||
}
|
||||
|
||||
strncpy (name, msd->toptexture, 8);
|
||||
sd->toptexture = TexMan.GetTexture (name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
|
||||
|
||||
strncpy (name, msd->bottomtexture, 8);
|
||||
sd->bottomtexture = TexMan.GetTexture (name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
|
||||
break;
|
||||
}
|
||||
// Fallthrough for Hexen maps is intentional
|
||||
#if 0
|
||||
sd->midtexture = strncasecmp("TRANMAP", msd->midtexture, 8) ?
|
||||
(sd->special = W_CheckNumForName(msd->midtexture)) < 0 ||
|
||||
W_LumpLength(sd->special) != 65536 ?
|
||||
|
@ -2180,8 +2239,8 @@ void P_LoadSideDefs2 (MapData * map)
|
|||
(sd->special++, 0) : (sd->special=0);
|
||||
sd->toptexture = R_TextureNumForName(msd->toptexture);
|
||||
sd->bottomtexture = R_TextureNumForName(msd->bottomtexture);
|
||||
break;
|
||||
*/
|
||||
#endif
|
||||
|
||||
default: // normal cases
|
||||
strncpy (name, msd->midtexture, 8);
|
||||
sd->midtexture = TexMan.GetTexture (name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
|
||||
|
|
|
@ -148,6 +148,12 @@ void FPalette::SetPalette (const BYTE *colors)
|
|||
BaseColors[i] = PalEntry (colors[0], colors[1], colors[2]);
|
||||
Remap[i] = i;
|
||||
}
|
||||
|
||||
// Find white and black from the original palette so that they can be
|
||||
// used to make an educated guess of the translucency % for a BOOM
|
||||
// translucency map.
|
||||
WhiteIndex = BestColor ((DWORD *)BaseColors, 255, 255, 255);
|
||||
BlackIndex = BestColor ((DWORD *)BaseColors, 0, 0, 0);
|
||||
}
|
||||
|
||||
// In ZDoom's new texture system, color 0 is used as the transparent color.
|
||||
|
|
|
@ -54,10 +54,12 @@ struct FPalette
|
|||
|
||||
void MakeGoodRemap ();
|
||||
|
||||
//PalEntry Colors[256]; // gamma corrected palette
|
||||
PalEntry BaseColors[256]; // non-gamma corrected palette
|
||||
BYTE Remap[256]; // remap original palette indices to in-game indices
|
||||
|
||||
BYTE WhiteIndex; // white in original palette index
|
||||
BYTE BlackIndex; // black in original palette index
|
||||
|
||||
// Given an array of colors, fills in remap with values to remap the
|
||||
// passed array of colors to this palette.
|
||||
void MakeRemap (const DWORD *colors, BYTE *remap, const BYTE *useful, int numcolors) const;
|
||||
|
|
|
@ -616,6 +616,7 @@ void I_PrintStr (const char *cp, bool lineBreak)
|
|||
}
|
||||
|
||||
EXTERN_CVAR (Bool, queryiwad);
|
||||
CVAR (String, queryiwad_key, "shift", CVAR_GLOBALCONFIG|CVAR_ARCHIVE);
|
||||
static WadStuff *WadList;
|
||||
static int NumWads;
|
||||
static int DefaultWad;
|
||||
|
@ -698,7 +699,21 @@ BOOL CALLBACK IWADBoxCallback (HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
|
|||
|
||||
int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad)
|
||||
{
|
||||
if (showwin || GetAsyncKeyState(VK_SHIFT))
|
||||
int vkey;
|
||||
|
||||
if (stricmp (queryiwad_key, "shift") == 0)
|
||||
{
|
||||
vkey = VK_SHIFT;
|
||||
}
|
||||
else if (stricmp (queryiwad_key, "control") == 0 || stricmp (queryiwad_key, "ctrl") == 0)
|
||||
{
|
||||
vkey = VK_CONTROL;
|
||||
}
|
||||
else
|
||||
{
|
||||
vkey = 0;
|
||||
}
|
||||
if (showwin || (vkey != 0 && GetAsyncKeyState(vkey)))
|
||||
{
|
||||
WadList = wads;
|
||||
NumWads = numwads;
|
||||
|
|
Loading…
Reference in a new issue