- 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:
Randy Heit 2006-07-20 05:13:39 +00:00
parent 6d389c6b7d
commit 361f855de0
7 changed files with 101 additions and 8 deletions

View file

@ -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 July 18, 2006
- Fixed: C_midPrint() needs a NULL status bar check. - Fixed: C_midPrint() needs a NULL status bar check.

View file

@ -212,6 +212,7 @@ void A_SkullPop (AActor *actor)
// Attach player mobj to bloody skull // Attach player mobj to bloody skull
player = actor->player; player = actor->player;
actor->player = NULL; actor->player = NULL;
mo->ObtainInventory (actor);
mo->player = player; mo->player = player;
mo->health = actor->health; mo->health = actor->health;
mo->angle = actor->angle; mo->angle = actor->angle;

View file

@ -284,6 +284,7 @@ void A_FreezeDeathChunks (AActor *actor)
head->momy = pr_freeze.Random2 () << (FRACBITS-7); head->momy = pr_freeze.Random2 () << (FRACBITS-7);
head->player = actor->player; head->player = actor->player;
actor->player = NULL; actor->player = NULL;
head->ObtainInventory (actor);
head->health = actor->health; head->health = actor->health;
head->angle = actor->angle; head->angle = actor->angle;
head->player->mo = head; head->player->mo = head;

View file

@ -120,6 +120,7 @@ struct sidei_t // [RH] Only keep BOOM sidedef init stuff around for init
struct struct
{ {
short tag, special; short tag, special;
short alpha;
DWORD map; DWORD map;
} a; } a;
@ -1715,12 +1716,18 @@ void P_FinishLoadingLineDefs ()
switch (ld->special) switch (ld->special)
{ // killough 4/11/98: handle special types { // killough 4/11/98: handle special types
int j; int j;
int alpha;
case TranslucentLine: // killough 4/11/98: translucent 2s textures case TranslucentLine: // killough 4/11/98: translucent 2s textures
// [RH] Second arg controls how opaque it is. // [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]) if (!ld->args[0])
{ {
ld->alpha = (byte)ld->args[1]; ld->alpha = (BYTE)alpha;
if (ld->args[2] == 1) if (ld->args[2] == 1)
{ {
sides[ld->sidenum[0]].Flags |= WALLF_ADDTRANS; sides[ld->sidenum[0]].Flags |= WALLF_ADDTRANS;
@ -1736,7 +1743,7 @@ void P_FinishLoadingLineDefs ()
{ {
if (lines[j].id == ld->args[0]) 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) if (lines[j].args[2] == 1)
{ {
sides[lines[j].sidenum[0]].Flags |= WALLF_ADDTRANS; sides[lines[j].sidenum[0]].Flags |= WALLF_ADDTRANS;
@ -1930,6 +1937,7 @@ static void P_AllocateSideDefs (int count)
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
sidetemp[i].a.special = sidetemp[i].a.tag = 0; sidetemp[i].a.special = sidetemp[i].a.tag = 0;
sidetemp[i].a.alpha = -1;
sidetemp[i].a.map = NO_SIDE; sidetemp[i].a.map = NO_SIDE;
} }
if (count < numsides) if (count < numsides)
@ -2075,6 +2083,28 @@ static void P_LoopSidedefs ()
sidetemp = NULL; 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 // killough 4/4/98: delay using texture names until
// after linedefs are loaded, to allow overloading. // after linedefs are loaded, to allow overloading.
// killough 5/3/98: reformatted, cleaned up // killough 5/3/98: reformatted, cleaned up
@ -2171,8 +2201,37 @@ void P_LoadSideDefs2 (MapData * map)
} }
break; 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->midtexture = strncasecmp("TRANMAP", msd->midtexture, 8) ?
(sd->special = W_CheckNumForName(msd->midtexture)) < 0 || (sd->special = W_CheckNumForName(msd->midtexture)) < 0 ||
W_LumpLength(sd->special) != 65536 ? W_LumpLength(sd->special) != 65536 ?
@ -2180,8 +2239,8 @@ void P_LoadSideDefs2 (MapData * map)
(sd->special++, 0) : (sd->special=0); (sd->special++, 0) : (sd->special=0);
sd->toptexture = R_TextureNumForName(msd->toptexture); sd->toptexture = R_TextureNumForName(msd->toptexture);
sd->bottomtexture = R_TextureNumForName(msd->bottomtexture); sd->bottomtexture = R_TextureNumForName(msd->bottomtexture);
break; #endif
*/
default: // normal cases default: // normal cases
strncpy (name, msd->midtexture, 8); strncpy (name, msd->midtexture, 8);
sd->midtexture = TexMan.GetTexture (name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); sd->midtexture = TexMan.GetTexture (name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);

View file

@ -148,6 +148,12 @@ void FPalette::SetPalette (const BYTE *colors)
BaseColors[i] = PalEntry (colors[0], colors[1], colors[2]); BaseColors[i] = PalEntry (colors[0], colors[1], colors[2]);
Remap[i] = i; 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. // In ZDoom's new texture system, color 0 is used as the transparent color.

View file

@ -54,10 +54,12 @@ struct FPalette
void MakeGoodRemap (); void MakeGoodRemap ();
//PalEntry Colors[256]; // gamma corrected palette
PalEntry BaseColors[256]; // non-gamma corrected palette PalEntry BaseColors[256]; // non-gamma corrected palette
BYTE Remap[256]; // remap original palette indices to in-game indices 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 // Given an array of colors, fills in remap with values to remap the
// passed array of colors to this palette. // passed array of colors to this palette.
void MakeRemap (const DWORD *colors, BYTE *remap, const BYTE *useful, int numcolors) const; void MakeRemap (const DWORD *colors, BYTE *remap, const BYTE *useful, int numcolors) const;

View file

@ -616,6 +616,7 @@ void I_PrintStr (const char *cp, bool lineBreak)
} }
EXTERN_CVAR (Bool, queryiwad); EXTERN_CVAR (Bool, queryiwad);
CVAR (String, queryiwad_key, "shift", CVAR_GLOBALCONFIG|CVAR_ARCHIVE);
static WadStuff *WadList; static WadStuff *WadList;
static int NumWads; static int NumWads;
static int DefaultWad; 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) 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; WadList = wads;
NumWads = numwads; NumWads = numwads;