mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- I finally managed to test the translucency options for composite texture
definitions in HIRESTEX. The feature should be complete now. - Fixed: A_CheckTargetInLOS used BAM angles instead of degrees which is the DECORATE convention. - Added Snowkate709's A_CheckTargetInLOS addition. - Added listmaps CCMD. SVN r974 (trunk)
This commit is contained in:
parent
5a066788b5
commit
4de3741a05
8 changed files with 130 additions and 25 deletions
|
@ -1,3 +1,11 @@
|
|||
May 15, 2008 (Changes by Graf Zahl)
|
||||
- I finally managed to test the translucency options for composite texture
|
||||
definitions in HIRESTEX. The feature should be complete now.
|
||||
- Fixed: A_CheckTargetInLOS used BAM angles instead of degrees which is the
|
||||
DECORATE convention.
|
||||
- Added Snowkate709's A_CheckTargetInLOS addition.
|
||||
- Added listmaps CCMD.
|
||||
|
||||
May 14, 2008
|
||||
- Revised underwater effect now uses a lowpass filter in combination with an
|
||||
optional freeverb unit.
|
||||
|
|
|
@ -3330,3 +3330,16 @@ int FSkillInfo::GetTextColor() const
|
|||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
CCMD(listmaps)
|
||||
{
|
||||
for(unsigned i = 0; i < wadlevelinfos.Size(); i++)
|
||||
{
|
||||
level_info_t *info = &wadlevelinfos[i];
|
||||
|
||||
if (P_CheckMapData(info->mapname))
|
||||
{
|
||||
Printf("%s: '%s'\n", info->mapname, G_MaybeLookupLevelName(info));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "r_sky.h"
|
||||
#include "r_main.h"
|
||||
#include "r_defs.h"
|
||||
#include "p_setup.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -141,6 +142,39 @@ static void Decrypt (void *to, const void *from, int len, int key);
|
|||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
bool P_IsBuildMap(MapData *map)
|
||||
{
|
||||
DWORD len = map->Size(ML_LABEL);
|
||||
if (len < 4) return false;
|
||||
|
||||
BYTE *data = new BYTE[len];
|
||||
|
||||
map->Seek(ML_LABEL);
|
||||
map->Read(ML_LABEL, data);
|
||||
|
||||
// Check for a Blood map.
|
||||
if (*(DWORD *)data == MAKE_ID('B','L','M','\x1a'))
|
||||
{
|
||||
delete[] data;
|
||||
return true;
|
||||
}
|
||||
|
||||
numsectors = LittleShort(*(WORD *)(data + 20));
|
||||
int numwalls;
|
||||
|
||||
if (len < 26 + numsectors*sizeof(sectortype) ||
|
||||
(numwalls = LittleShort(*(WORD *)(data + 22 + numsectors*sizeof(sectortype))),
|
||||
len < 24 + numsectors*sizeof(sectortype) + numwalls*sizeof(walltype)) ||
|
||||
LittleLong(*(DWORD *)data) != 7 ||
|
||||
LittleShort(*(WORD *)(data + 16)) >= 2048)
|
||||
{ // Can't possibly be a version 7 BUILD map
|
||||
delete[] data;
|
||||
return false;
|
||||
}
|
||||
delete[] data;
|
||||
return true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// P_LoadBuildMap
|
||||
|
|
|
@ -83,6 +83,7 @@ CVAR (Bool, showloadtimes, false, 0);
|
|||
static void P_InitTagLists ();
|
||||
static void P_Shutdown ();
|
||||
|
||||
bool P_IsBuildMap(MapData *map);
|
||||
|
||||
|
||||
//
|
||||
|
@ -286,6 +287,13 @@ MapData *P_OpenMapData(const char * mapname)
|
|||
{
|
||||
// The following lump is from a different file so whatever this is,
|
||||
// it is not a multi-lump Doom level so let's assume it is a Build map.
|
||||
map->MapLumps[0].FilePos = Wads.GetLumpOffset(lump_name);
|
||||
map->MapLumps[0].Size = Wads.LumpLength(lump_name);
|
||||
if (!P_IsBuildMap(map))
|
||||
{
|
||||
delete map;
|
||||
return NULL;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@ -301,6 +309,11 @@ MapData *P_OpenMapData(const char * mapname)
|
|||
|
||||
if (map->Encrypted)
|
||||
{ // If it's encrypted, then it's a Blood file, presumably a map.
|
||||
if (!P_IsBuildMap(map))
|
||||
{
|
||||
delete map;
|
||||
return NULL;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@ -474,6 +487,11 @@ MapData *P_OpenMapData(const char * mapname)
|
|||
{
|
||||
// This is a Build map and not subject to WAD consistency checks.
|
||||
map->MapLumps[0].Size = map->file->GetLength();
|
||||
if (!P_IsBuildMap(map))
|
||||
{
|
||||
delete map;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -63,12 +63,13 @@ struct MapData
|
|||
}
|
||||
}
|
||||
|
||||
void Read(unsigned int lumpindex, void * buffer)
|
||||
void Read(unsigned int lumpindex, void * buffer, int size = -1)
|
||||
{
|
||||
if (lumpindex<countof(MapLumps))
|
||||
{
|
||||
if (size == -1) size = MapLumps[lumpindex].Size;
|
||||
file->Seek(MapLumps[lumpindex].FilePos, SEEK_SET);
|
||||
file->Read(buffer, MapLumps[lumpindex].Size);
|
||||
file->Read(buffer, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -357,24 +357,35 @@ void FMultiPatchTexture::MakeTexture ()
|
|||
// a power of 2, in case somebody accidentally makes it repeat vertically.
|
||||
int numpix = Width * Height + (1 << HeightBits) - Height;
|
||||
BYTE blendwork[256];
|
||||
static BYTE NullMap[256] = {0};
|
||||
bool hasTranslucent = false;
|
||||
|
||||
Pixels = new BYTE[numpix];
|
||||
memset (Pixels, 0, numpix);
|
||||
|
||||
if (!bTranslucentPatches)
|
||||
// This is not going to be easy for paletted output. Using the
|
||||
// real time mixing tables gives results that just look bad and
|
||||
// downconverting a true color image also has its problems so the only
|
||||
// real choice is to do normal compositing with any translucent patch
|
||||
// just masking the affected pixels, then do a full true color composition
|
||||
// and merge these pixels in.
|
||||
for (int i = 0; i < NumParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < NumParts; ++i)
|
||||
BYTE *trans = Parts[i].Translation? Parts[i].Translation->Remap : NULL;
|
||||
if (Parts[i].op != OP_COPY)
|
||||
{
|
||||
BYTE *trans = Parts[i].Translation? Parts[i].Translation->Remap : NULL;
|
||||
if (Parts[i].Blend != BLEND_NONE)
|
||||
{
|
||||
trans = GetBlendMap(Parts[i].Blend, blendwork);
|
||||
}
|
||||
Parts[i].Texture->CopyToBlock (Pixels, Width, Height,
|
||||
Parts[i].OriginX, Parts[i].OriginY, Parts[i].Rotate, trans);
|
||||
trans = NullMap;
|
||||
hasTranslucent = true;
|
||||
}
|
||||
else if (Parts[i].Blend != BLEND_NONE)
|
||||
{
|
||||
trans = GetBlendMap(Parts[i].Blend, blendwork);
|
||||
}
|
||||
Parts[i].Texture->CopyToBlock (Pixels, Width, Height,
|
||||
Parts[i].OriginX, Parts[i].OriginY, Parts[i].Rotate, trans);
|
||||
}
|
||||
else
|
||||
|
||||
if (hasTranslucent)
|
||||
{
|
||||
// In case there are translucent patches let's do the composition in
|
||||
// True color to keep as much precision as possible before downconverting to the palette.
|
||||
|
@ -384,10 +395,12 @@ void FMultiPatchTexture::MakeTexture ()
|
|||
{
|
||||
BYTE *in = buffer + Width * y * 4;
|
||||
BYTE *out = Pixels + y;
|
||||
for (int x = 0; x < Width; x--)
|
||||
for (int x = 0; x < Width; x++)
|
||||
{
|
||||
// I don't know if this is precise enough...
|
||||
*out = RGB32k[in[2]>>3][in[1]>>3][in[0]>>3];
|
||||
if (*out == 0 && in[3] != 0)
|
||||
{
|
||||
*out = RGB32k[in[2]>>3][in[1]>>3][in[0]>>3];
|
||||
}
|
||||
out += Height;
|
||||
in += 4;
|
||||
}
|
||||
|
@ -1015,7 +1028,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part)
|
|||
}
|
||||
else if (sc.Compare("style"))
|
||||
{
|
||||
static const char *styles[] = {"copy", "blend", "add", "subtract", "reversesubtract", "modulate", "copyalpha", NULL };
|
||||
static const char *styles[] = {"copy", "translucent", "add", "subtract", "reversesubtract", "modulate", "copyalpha", NULL };
|
||||
sc.MustGetString();
|
||||
part.op = sc.MustMatchString(styles);
|
||||
bComplex = (part.op != OP_COPY);
|
||||
|
|
|
@ -2124,27 +2124,46 @@ void A_ClearTarget(AActor * self)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// A_JumpIfTargetInLOS (state label, optional fixed fov)
|
||||
// A_JumpIfTargetInLOS (state label, optional fixed fov, optional bool
|
||||
// projectiletarget)
|
||||
//
|
||||
// Jumps if the actor can see its target, or if the player has a linetarget.
|
||||
// ProjectileTarget affects how projectiles are treated. If set, it will use
|
||||
// the target of the projectile for seekers, and ignore the target for
|
||||
// normal projectiles. If not set, it will use the missile's owner instead
|
||||
// (the default).
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void A_JumpIfTargetInLOS(AActor * self)
|
||||
{
|
||||
FState * CallingState;
|
||||
int index = CheckIndex(2, &CallingState);
|
||||
int index = CheckIndex(3, &CallingState);
|
||||
angle_t an;
|
||||
angle_t fov = angle_t(EvalExpressionF (StateParameters[index+1], self) * FRACUNIT);
|
||||
AActor * target;
|
||||
angle_t fov = angle_t(EvalExpressionF (StateParameters[index+1], self) * ANGLE_1);
|
||||
INTBOOL projtarg = EvalExpressionI (StateParameters[index+2], self);
|
||||
AActor *target;
|
||||
|
||||
if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains!
|
||||
|
||||
if (!self->player)
|
||||
{
|
||||
target=self->target;
|
||||
if (self->flags & MF_MISSILE && projtarg)
|
||||
{
|
||||
if (self->flags2 & MF2_SEEKERMISSILE)
|
||||
target = self->tracer;
|
||||
else
|
||||
target = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
target = self->target;
|
||||
}
|
||||
|
||||
if (!target) return; // [KS] Let's not call P_CheckSight unnecessarily in this case.
|
||||
|
||||
if (!P_CheckSight (self, target, 1))
|
||||
return; // [KS] Cannot see target - return
|
||||
return;
|
||||
|
||||
if (fov && (fov < ANGLE_MAX))
|
||||
{
|
||||
|
@ -2167,8 +2186,7 @@ void A_JumpIfTargetInLOS(AActor * self)
|
|||
P_BulletSlope(self, &target);
|
||||
}
|
||||
|
||||
// No target - return
|
||||
if (target==NULL) return;
|
||||
if (!target) return;
|
||||
|
||||
DoJump(self, CallingState, StateParameters[index]);
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ class Actor extends Thinker
|
|||
action native A_DeQueueCorpse();
|
||||
action native A_LookEx(optional eval int flags, optional eval float minseedist, optional eval float maxseedist, optional eval float maxheardist, optional eval float fov, optional state label);
|
||||
action native A_ClearTarget();
|
||||
action native A_JumpIfTargetInLOS (state label, optional eval float fov);
|
||||
action native A_JumpIfTargetInLOS (state label, optional eval float fov, optional eval bool projectiletarget);
|
||||
action native A_DamageMaster(eval int amount, optional name damagetype);
|
||||
action native A_DamageChildren(eval int amount, optional name damagetype);
|
||||
action native A_SelectWeapon(class<Weapon> whichweapon);
|
||||
|
|
Loading…
Reference in a new issue