- Changed FImageCollection to return translated texture indices so

that animated icons can be done with it.
- Changed FImageCollection to use a TArray to hold its data.
- Fixed: SetChanHeadSettings did an assignment instead of comparing
  the channel ID witg CHAN_CEILING.
- Changed sound sequence names for animated doors to FNames.
- Automatically fixed: DCeiling didn't properly serialize its texture id.
- Replaced integers as texture ID representation with a specific new type
  to track down all potentially incorrect uses and remaining WORDs used
  for texture IDs so that more than 32767 or 65535 textures can be defined.


SVN r1036 (trunk)
This commit is contained in:
Christoph Oelckers 2008-06-15 18:36:26 +00:00
parent 7c40cf9ce0
commit 8ca7c05e9d
82 changed files with 1225 additions and 1141 deletions

View file

@ -1,3 +1,15 @@
June 15, 2008 (Changes by Graf Zahl)
- Changed FImageCollection to return translated texture indices so
that animated icons can be done with it.
- Changed FImageCollection to use a TArray to hold its data.
- Fixed: SetChanHeadSettings did an assignment instead of comparing
the channel ID witg CHAN_CEILING.
- Changed sound sequence names for animated doors to FNames.
- Automatically fixed: DCeiling didn't properly serialize its texture id.
- Replaced integers as texture ID representation with a specific new type
to track down all potentially incorrect uses and remaining WORDs used
for texture IDs so that more than 32767 or 65535 textures can be defined.
June 14, 2008
- Increased the duration of respawn invulnerability by one second.
- DF2_YES_RESPAWN_INVUL and DF_FORCE_RESPAWN now apply to all multiplayer

View file

@ -40,6 +40,7 @@
#include "info.h"
#include "doomdef.h"
#include "textures/textures.h"
#include "r_blend.h"
#include "s_sound.h"
@ -624,7 +625,7 @@ public:
fixed_t scaleX, scaleY; // Scaling values; FRACUNIT is normal size
FRenderStyle RenderStyle; // Style to draw this actor with
DWORD renderflags; // Different rendering flags
int picnum; // Draw this instead of sprite if != 0xffff
FTextureID picnum; // Draw this instead of sprite if valid
SWORD TIDtoHate; // TID of things to hate (0 if none)
DWORD effects; // [RH] see p_effect.h
fixed_t alpha;
@ -638,9 +639,9 @@ public:
fixed_t dropoffz; // killough 11/98: the lowest floor over all contacted Sectors.
struct sector_t *floorsector;
SDWORD floorpic; // contacted sec floorpic
FTextureID floorpic; // contacted sec floorpic
struct sector_t *ceilingsector;
SDWORD ceilingpic; // contacted sec ceilingpic
FTextureID ceilingpic; // contacted sec ceilingpic
fixed_t radius, height; // for movement checking
fixed_t momx, momy, momz; // momentums
SDWORD tics; // state tic counter

View file

@ -331,7 +331,7 @@ static fixed_t old_m_x, old_m_y;
// old location used by the Follower routine
static mpoint_t f_oldloc;
static int marknums[10]; // numbers used for marking by the automap
static FTextureID marknums[10]; // numbers used for marking by the automap
static mpoint_t markpoints[AM_NUMMARKPOINTS]; // where the points are
static int markpointnum = 0; // next point to be assigned
@ -429,7 +429,7 @@ void AM_restoreScaleAndLoc ()
//
bool AM_addMark ()
{
if (marknums[0] != -1)
if (marknums[0].isValid())
{
markpoints[markpointnum].x = m_x + m_w/2;
markpoints[markpointnum].y = m_y + m_h/2;
@ -761,7 +761,7 @@ bool AM_clearMarks ()
for (int i = AM_NUMMARKPOINTS-1; i >= 0; i--)
markpoints[i].x = -1; // means empty
markpointnum = 0;
return marknums[0] != -1;
return marknums[0].isValid();
}
//
@ -1690,11 +1690,11 @@ void AM_drawAuthorMarkers ()
continue;
}
int picnum;
FTextureID picnum;
FTexture *tex;
WORD flip = 0;
if (mark->picnum != 0xFFFF)
if (mark->picnum.isValid())
{
tex = TexMan(mark->picnum);
if (tex->Rotations != 0xFFFF)

View file

@ -80,7 +80,7 @@ static bool TabbedLast; // True if last key pressed was tab
static bool TabbedList; // True if tab list was shown
CVAR (Bool, con_notablist, false, CVAR_ARCHIVE)
static int conback;
static FTextureID conback;
static DWORD conshade;
static bool conline;
@ -302,7 +302,7 @@ void C_InitConsole (int width, int height, bool ingame)
{
conback = TexMan.CheckForTexture ("CONBACK", FTexture::TEX_MiscPatch);
if (conback <= 0)
if (!conback.isValid())
{
conback = TexMan.GetTexture (gameinfo.titlePage, FTexture::TEX_MiscPatch);
conshade = MAKEARGB(175,0,0,0);

View file

@ -348,7 +348,7 @@ CUSTOM_CVAR (Int, dmflags, 0, CVAR_SERVERINFO)
{
// In case DF_NO_FREELOOK was changed, reinitialize the sky
// map. (If no freelook, then no need to stretch the sky.)
if (sky1texture != 0)
if (sky1texture.isValid())
R_InitSkyMap ();
if (self & DF_NO_FREELOOK)
@ -656,10 +656,10 @@ void D_Display ()
// [RH] Draw icon, if any
if (D_DrawIcon)
{
int picnum = TexMan.CheckForTexture (D_DrawIcon, FTexture::TEX_MiscPatch);
FTextureID picnum = TexMan.CheckForTexture (D_DrawIcon, FTexture::TEX_MiscPatch);
D_DrawIcon = NULL;
if (picnum >= 0)
if (picnum.isValid())
{
FTexture *tex = TexMan[picnum];
screen->DrawTexture (tex, 160-tex->GetWidth()/2, 100-tex->GetHeight()/2,

View file

@ -114,7 +114,7 @@ public:
fixed_t ViewHeight;
fixed_t ForwardMove1, ForwardMove2;
fixed_t SideMove1, SideMove2;
int ScoreIcon;
FTextureID ScoreIcon;
int SpawnMask;
FNameNoInit MorphWeapon;
fixed_t AttackZOffset; // attack height, relative to player center

View file

@ -429,7 +429,9 @@ void FDecalLib::ParseDecal (FScanner &sc)
FString decalName;
WORD decalNum;
FDecalTemplate newdecal;
int code, picnum;
int code;
FTextureID picnum;
int lumpnum;
sc.MustGetString ();
decalName = sc.String;
@ -437,7 +439,7 @@ void FDecalLib::ParseDecal (FScanner &sc)
sc.MustGetStringName ("{");
memset (&newdecal, 0, sizeof(newdecal));
newdecal.PicNum = 0xffff;
newdecal.PicNum.SetInvalid();
newdecal.ScaleX = newdecal.ScaleY = FRACUNIT;
newdecal.RenderFlags = RF_WALLSPRITE;
newdecal.RenderStyle = STYLE_Normal;
@ -464,9 +466,9 @@ void FDecalLib::ParseDecal (FScanner &sc)
case DECAL_PIC:
sc.MustGetString ();
picnum = TexMan.CheckForTexture (sc.String, FTexture::TEX_Any);
if (picnum < 0 && (picnum = Wads.CheckNumForName (sc.String, ns_graphics)) >= 0)
if (!picnum.Exists() && (lumpnum = Wads.CheckNumForName (sc.String, ns_graphics)) >= 0)
{
picnum = TexMan.CreateTexture (picnum, FTexture::TEX_Decal);
picnum = TexMan.CreateTexture (lumpnum, FTexture::TEX_Decal);
}
newdecal.PicNum = picnum;
break;

View file

@ -79,7 +79,7 @@ public:
DWORD ShadeColor;
DWORD Translation;
FRenderStyle RenderStyle;
WORD PicNum;
FTextureID PicNum;
WORD RenderFlags;
WORD Alpha; // same as (actor->alpha >> 1)
const FDecalAnimator *Animator;

View file

@ -240,7 +240,6 @@ extern int bodyqueslot;
// Needed to store the number of the dummy sky flat.
// Used for rendering,
// as well as tracking projectiles etc.
extern int skyflatnum;

View file

@ -1219,8 +1219,8 @@ void F_Drawer (void)
// erase the entire screen to a tiled background (or picture)
if (!FinaleHasPic)
{
int picnum = TexMan.CheckForTexture (FinaleFlat, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
if (picnum >= 0)
FTextureID picnum = TexMan.CheckForTexture (FinaleFlat, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
if (picnum.isValid())
{
screen->FlatFill (0,0, SCREENWIDTH, SCREENHEIGHT, TexMan(picnum));
}

View file

@ -577,7 +577,7 @@ private:
for (item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory)
{
if (item->Icon > 0 && item->IsKindOf (RUNTIME_CLASS(AKey)))
if (item->Icon.isValid() && item->IsKindOf (RUNTIME_CLASS(AKey)))
{
FTexture *keypic = TexMan(item->Icon);
if (keypic != NULL)

View file

@ -357,7 +357,7 @@ void AArtiPoisonBag::BeginPlay ()
{
Super::BeginPlay ();
// If a subclass's specific icon is not defined, let it use the base class's.
if (Icon <= 0)
if (!Icon.isValid())
{
AInventory *defbag;
// Why doesn't this work?

View file

@ -764,7 +764,7 @@ private:
item != NULL && i < 5;
item = item->Inventory)
{
if (item->Icon > 0 &&
if (item->Icon.isValid() &&
item->IsKindOf (RUNTIME_CLASS(AKey)) &&
item->GetClass() != RUNTIME_CLASS(AKey))
{

View file

@ -790,7 +790,7 @@ static void G_DoParseMapInfo (int lump)
SetLevelNum (levelinfo, levelinfo->levelnum); // Wipe out matching levelnums from other maps.
if (levelinfo->pname[0] != 0)
{
if (TexMan.AddPatch(levelinfo->pname) < 0)
if (!TexMan.AddPatch(levelinfo->pname).Exists())
{
levelinfo->pname[0] = 0;
}

View file

@ -55,7 +55,7 @@ void ABasicArmor::Serialize (FArchive &arc)
void ABasicArmor::Tick ()
{
Super::Tick ();
if (Icon == 0)
if (!Icon.isValid())
{
switch (gameinfo.gametype)
{

View file

@ -220,7 +220,7 @@ void APowerup::Destroy ()
bool APowerup::DrawPowerup (int x, int y)
{
if (Icon <= 0)
if (!Icon.isValid())
{
return false;
}
@ -1043,10 +1043,10 @@ bool APowerFlight::DrawPowerup (int x, int y)
{
if (EffectTics > BLINKTHRESHOLD || !(EffectTics & 16))
{
int picnum = TexMan.CheckForTexture ("SPFLY0", FTexture::TEX_MiscPatch);
FTextureID picnum = TexMan.CheckForTexture ("SPFLY0", FTexture::TEX_MiscPatch);
int frame = (level.time/3) & 15;
if (picnum <= 0)
if (!picnum.isValid())
{
return false;
}

View file

@ -61,25 +61,28 @@ IMPLEMENT_CLASS (DImpactDecal)
DBaseDecal::DBaseDecal ()
: DThinker(STAT_DECAL),
WallNext(0), WallPrev(0), LeftDistance(0), Z(0), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT),
AlphaColor(0), Translation(0), PicNum(0xFFFF), RenderFlags(0)
AlphaColor(0), Translation(0), RenderFlags(0)
{
RenderStyle = STYLE_None;
PicNum.SetInvalid();
}
DBaseDecal::DBaseDecal (fixed_t z)
: DThinker(STAT_DECAL),
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT),
AlphaColor(0), Translation(0), PicNum(0xFFFF), RenderFlags(0)
AlphaColor(0), Translation(0), RenderFlags(0)
{
RenderStyle = STYLE_None;
PicNum.SetInvalid();
}
DBaseDecal::DBaseDecal (int statnum, fixed_t z)
: DThinker(statnum),
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT),
AlphaColor(0), Translation(0), PicNum(0xFFFF), RenderFlags(0)
AlphaColor(0), Translation(0), RenderFlags(0)
{
RenderStyle = STYLE_None;
PicNum.SetInvalid();
}
DBaseDecal::DBaseDecal (const AActor *basis)
@ -201,7 +204,7 @@ void DBaseDecal::SetShade (int r, int g, int b)
}
// Returns the texture the decal stuck to.
int DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y)
FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y)
{
// Stick the decal at the end of the chain so it appears on top
DBaseDecal *next, **prev;
@ -225,7 +228,7 @@ int DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y)
*/
sector_t *front, *back;
line_t *line;
int tex;
FTextureID tex;
line = &lines[wall->linenum];
if (line->sidenum[0] == DWORD(wall - sides))
@ -624,7 +627,7 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, fixed_t x,
DImpactDecal::CheckMax();
decal = new DImpactDecal (z);
int stickypic = decal->StickToWall (wall, x, y);
FTextureID stickypic = decal->StickToWall (wall, x, y);
FTexture *tex = TexMan[stickypic];
if (tex != NULL && tex->bNoDecals)
@ -643,7 +646,7 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, fixed_t x,
decal->SetShade (color.r, color.g, color.b);
}
if (!cl_spreaddecals || decal->PicNum == 0xffff)
if (!cl_spreaddecals || !decal->PicNum.isValid())
{
return decal;
}
@ -727,7 +730,7 @@ void ADecal::BeginPlay ()
// If no decal is specified, don't try to create one.
if (decalid != 0 && (tpl = DecalLibrary.GetDecalByNum (decalid)) != 0)
{
if (tpl->PicNum == 65535)
if (!tpl->PicNum.Exists())
{
Printf("Decal actor at (%d,%d) does not have a valid texture\n", x>>FRACBITS, y>>FRACBITS);

View file

@ -6,6 +6,7 @@
#include "templates.h"
#include "s_sound.h"
#include "p_acs.h"
#include "r_sky.h"
static FRandom pr_lightning ("Lightning");

View file

@ -465,16 +465,7 @@ void AInventory::Tick ()
void AInventory::Serialize (FArchive &arc)
{
Super::Serialize (arc);
arc << Owner << Amount << MaxAmount << RespawnTics << ItemFlags;
if (arc.IsStoring ())
{
TexMan.WriteTexture (arc, Icon);
}
else
{
Icon = TexMan.ReadTexture (arc);
}
arc << PickupSound;
arc << Owner << Amount << MaxAmount << RespawnTics << ItemFlags << Icon << PickupSound;
}
//===========================================================================

View file

@ -135,7 +135,7 @@ public:
int Amount; // Amount of item this instance has
int MaxAmount; // Max amount of item this instance can have
int RespawnTics; // Tics from pickup time to respawn time
int Icon; // Icon to show on status bar or HUD
FTextureID Icon; // Icon to show on status bar or HUD
int DropTime; // Countdown after dropping
DWORD ItemFlags;

View file

@ -24,7 +24,7 @@ public:
void Serialize (FArchive &arc);
void Destroy ();
int StickToWall (side_t *wall, fixed_t x, fixed_t y);
FTextureID StickToWall (side_t *wall, fixed_t x, fixed_t y);
fixed_t GetRealZ (const side_t *wall) const;
void SetShade (DWORD rgb);
void SetShade (int r, int g, int b);
@ -40,8 +40,8 @@ public:
fixed_t ScaleX, ScaleY;
fixed_t Alpha;
DWORD AlphaColor;
WORD Translation;
WORD PicNum;
int Translation;
FTextureID PicNum;
DWORD RenderFlags;
FRenderStyle RenderStyle;

View file

@ -105,7 +105,8 @@ struct SBarInfoCommand
int x;
int y;
int value;
int sprite;
int image_index;
FTextureID sprite_index;
FString string[2];
FFont *font;
EColorRange translation;

View file

@ -466,7 +466,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
else if((cmd.flags & DRAWIMAGE_WEAPONICON))
{
AWeapon *weapon = CPlayer->ReadyWeapon;
if(weapon != NULL && weapon->Icon > 0)
if(weapon != NULL && weapon->Icon.isValid())
{
texture = TexMan[weapon->Icon];
}
@ -478,9 +478,9 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
texture = TexMan[item->Icon];
}
else if((cmd.flags & DRAWIMAGE_INVENTORYICON))
texture = TexMan[cmd.sprite];
else if(cmd.sprite != -1)
texture = Images[cmd.sprite];
texture = TexMan[cmd.sprite_index];
else if(cmd.image_index > 0)
texture = Images[cmd.image_index];
DrawGraphic(texture, cmd.x, cmd.y, xOffset, yOffset, alpha, !!(cmd.flags & DRAWIMAGE_TRANSLATABLE), false, !!(cmd.flags & DRAWIMAGE_OFFSET_CENTER));
break;
@ -671,7 +671,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
}
case SBARINFO_DRAWBAR:
{
if(cmd.sprite == -1 || Images[cmd.sprite] == NULL)
if(cmd.image_index == -1 || Images[cmd.image_index] == NULL)
break; //don't draw anything.
bool horizontal = !!((cmd.special2 & DRAWBAR_HORIZONTAL));
bool reverse = !!((cmd.special2 & DRAWBAR_REVERSE));
@ -821,9 +821,9 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
{
value = 0;
}
assert(Images[cmd.sprite] != NULL);
assert(Images[cmd.image_index] != NULL);
FTexture *fg = Images[cmd.sprite];
FTexture *fg = Images[cmd.image_index];
FTexture *bg = (cmd.special != -1) ? Images[cmd.special] : NULL;
int x, y, w, h;
int cx, cy, cw, ch, cr, cb;
@ -956,7 +956,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
{
wiggle = !!(cmd.flags & DRAWGEM_WIGGLE);
}
DrawGem(Images[cmd.special], Images[cmd.sprite], value, cmd.x, cmd.y, xOffset, yOffset, alpha, cmd.special2, cmd.special3, cmd.special4+1, wiggle, translate);
DrawGem(Images[cmd.special], Images[cmd.image_index], value, cmd.x, cmd.y, xOffset, yOffset, alpha, cmd.special2, cmd.special3, cmd.special4+1, wiggle, translate);
break;
}
case SBARINFO_DRAWSHADER:
@ -993,7 +993,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
break;
for(int i = 0;i < cmd.value;i++)
{
while(item->Icon <= 0 || item->GetClass() == RUNTIME_CLASS(AKey) || !item->IsKindOf(RUNTIME_CLASS(AKey)))
while(!item->Icon.isValid() || !item->IsKindOf(RUNTIME_CLASS(AKey)))
{
item = item->Inventory;
if(item == NULL)

View file

@ -453,13 +453,15 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
{
sc.ScriptError("'%s' is not a type of inventory item.", sc.String);
}
cmd.sprite = ((AInventory *)GetDefaultByType(item))->Icon;
cmd.sprite_index = ((AInventory *)GetDefaultByType(item))->Icon;
cmd.image_index = -1;
}
}
if(getImage)
{
sc.MustGetToken(TK_StringConst);
cmd.sprite = newImage(sc.String);
cmd.image_index = newImage(sc.String);
cmd.sprite_index.SetInvalid();
}
sc.MustGetToken(',');
this->getCoordinates(sc, cmd);
@ -785,7 +787,8 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
break;
case SBARINFO_DRAWBAR:
sc.MustGetToken(TK_StringConst);
cmd.sprite = newImage(sc.String);
cmd.image_index = newImage(sc.String);
cmd.sprite_index.SetInvalid();
sc.MustGetToken(',');
sc.MustGetToken(TK_StringConst);
cmd.special = newImage(sc.String);
@ -909,7 +912,8 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
cmd.special = newImage(sc.String);
sc.MustGetToken(',');
sc.MustGetToken(TK_StringConst); //gem
cmd.sprite = newImage(sc.String);
cmd.image_index = newImage(sc.String);
cmd.sprite_index.SetInvalid();
sc.MustGetToken(',');
cmd.special2 = this->getSignedInteger(sc);
sc.MustGetToken(',');
@ -1318,7 +1322,8 @@ SBarInfoCommand::SBarInfoCommand() //sets the default values for more predicable
x = 0;
y = 0;
value = 0;
sprite = 0;
image_index = 0;
sprite_index.SetInvalid();
translation = CR_UNTRANSLATED;
translation2 = CR_UNTRANSLATED;
translation3 = CR_UNTRANSLATED;

View file

@ -98,6 +98,19 @@ static int hudwidth, hudheight; // current width/height for HUD display
void AM_GetPosition(fixed_t & x, fixed_t & y);
FTextureID GetHUDIcon(const PClass *cls)
{
FTextureID tex;
tex.texnum = cls->Meta.GetMetaInt(HUMETA_AltIcon, 0);
return tex;
}
void SetHUDIcon(PClass *cls, FTextureID tex)
{
cls->Meta.SetMetaInt(HUMETA_AltIcon, tex.GetIndex());
}
//---------------------------------------------------------------------------
//
// Draws an image into a box with its bottom center at the bottom
@ -340,7 +353,7 @@ static void SetKeyTypes()
{
AKey * key = (AKey*)GetDefaultByType(ti);
if (key->Icon!=0 && key->KeyNumber>0)
if (key->Icon.isValid() && key->KeyNumber>0)
{
KeyTypes.Push(ti);
}
@ -375,12 +388,12 @@ static void SetKeyTypes()
static void DrawOneKey(int xo, int & x, int & y, int & c, AInventory * inv)
{
int icon=0;
int AltIcon = inv->GetClass()->Meta.GetMetaInt(HUMETA_AltIcon, 0);
FTextureID icon = FNullTextureID();
FTextureID AltIcon = GetHUDIcon(inv->GetClass());
if (AltIcon==-1) return;
if (!AltIcon.Exists()) return;
if (AltIcon>0)
if (AltIcon.isValid())
{
icon = AltIcon;
}
@ -394,9 +407,9 @@ static void DrawOneKey(int xo, int & x, int & y, int & c, AInventory * inv)
icon = sprframe->Texture[0];
}
}
if (icon == 0) icon = inv->Icon;
if (icon.isNull()) icon = inv->Icon;
if (icon > 0)
if (icon.isValid())
{
x -= 9;
DrawImageToBox(TexMan[icon], x, y, 8, 10);
@ -526,9 +539,9 @@ static int DrawAmmo(player_t * CPlayer, int x, int y)
AAmmo * ammoitem = (AAmmo*)CPlayer->mo->FindInventory(type);
AAmmo * inv = ammoitem? ammoitem : (AAmmo*)GetDefaultByType(orderedammos[i]);
int AltIcon = type->Meta.GetMetaInt(HUMETA_AltIcon, 0);
int icon = AltIcon != 0? AltIcon : inv->Icon;
if (icon<=0) continue;
FTextureID AltIcon = GetHUDIcon(type);
FTextureID icon = !AltIcon.isNull()? AltIcon : inv->Icon;
if (!icon.isValid()) continue;
int trans= (wi && (type==wi->AmmoType1 || type==wi->AmmoType2)) ? 0xc000:0x6000;
@ -560,7 +573,7 @@ static int DrawAmmo(player_t * CPlayer, int x, int y)
static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon)
{
int trans;
int picnum=-1;
FTextureID picnum;
// Powered up weapons and inherited sister weapons are not displayed.
if (weapon->WeaponFlags & WIF_POWERED_UP) return;
@ -574,10 +587,10 @@ static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon)
FState * state=NULL, *ReadyState;
int AltIcon = weapon->GetClass()->Meta.GetMetaInt(HUMETA_AltIcon, 0);
picnum = AltIcon? AltIcon : weapon->Icon;
FTextureID AltIcon = GetHUDIcon(weapon->GetClass());
picnum = AltIcon.isValid()? AltIcon : weapon->Icon;
if (picnum == 0)
if (picnum.isNull())
{
if (weapon->SpawnState && weapon->SpawnState->sprite.index!=0)
{
@ -597,7 +610,7 @@ static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon)
}
}
if (picnum > 0)
if (picnum.isValid())
{
FTexture * tex = TexMan[picnum];
int w = tex->GetWidth();
@ -668,13 +681,13 @@ static void DrawInventory(player_t * CPlayer, int x,int y)
{
if (rover->Amount>0)
{
int AltIcon = rover->GetClass()->Meta.GetMetaInt(HUMETA_AltIcon, 0);
FTextureID AltIcon = GetHUDIcon(rover->GetClass());
if (AltIcon>=0 && (rover->Icon>0 || AltIcon>0) )
if (AltIcon.Exists() && (rover->Icon.isValid() || AltIcon.isValid()) )
{
int trans = rover==CPlayer->mo->InvSel ? FRACUNIT : 0x6666;
DrawImageToBox(TexMan[AltIcon? AltIcon : rover->Icon], x, y, 19, 25, trans);
DrawImageToBox(TexMan[AltIcon.isValid()? AltIcon : rover->Icon], x, y, 19, 25, trans);
if (rover->Amount>1)
{
char buffer[10];
@ -934,8 +947,8 @@ void HUD_InitHud()
if (sc.Compare("Health"))
{
sc.MustGetString();
int tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
if (tex > 0) healthpic = TexMan[tex];
FTextureID tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
if (tex.isValid()) healthpic = TexMan[tex];
}
else
{
@ -950,15 +963,15 @@ void HUD_InitHud()
ti=NULL;
}
sc.MustGetString();
int tex=0;
FTextureID tex;
if (!sc.Compare("0") && !sc.Compare("NULL") && !sc.Compare(""))
{
tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
}
else tex=-1;
else tex.SetInvalid();
if (ti) const_cast<PClass*>(ti)->Meta.SetMetaInt(HUMETA_AltIcon, tex);
if (ti) SetHUDIcon(const_cast<PClass*>(ti), tex);
}
}
}

View file

@ -72,8 +72,8 @@ void A_RemoveForceField (AActor *self)
{
line->flags &= ~(ML_BLOCKING|ML_BLOCKEVERYTHING);
line->special = 0;
sides[line->sidenum[0]].SetTexture(side_t::mid, 0);
sides[line->sidenum[1]].SetTexture(side_t::mid, 0);
sides[line->sidenum[0]].SetTexture(side_t::mid, FNullTextureID());
sides[line->sidenum[1]].SetTexture(side_t::mid, FNullTextureID());
}
}
}

View file

@ -444,7 +444,7 @@ private:
DTA_Alpha, FRACUNIT - ItemFlash,
TAG_DONE);
}
if (item->Icon != 0)
if (item->Icon.isValid())
{
DrawDimImage (TexMan(item->Icon), 48 + 35*i, 14, item->Amount <= 0);
}
@ -540,7 +540,7 @@ private:
DTA_Alpha, TRANSLUC75,
TAG_DONE);
}
if (item->Icon != 0)
if (item->Icon.isValid())
{
screen->DrawTexture (TexMan(item->Icon), -94 + i*35, -19,
DTA_HUDRules, HUD_HorizCenter,

View file

@ -335,7 +335,7 @@ static void HU_DrawPlayer (player_t *player, bool highlight, int x, int y, int h
DTA_CleanNoMove, true, TAG_DONE);
}
if (player->mo->ScoreIcon > 0)
if (player->mo->ScoreIcon.isValid())
{
screen->DrawTexture (TexMan[player->mo->ScoreIcon], SCREENWIDTH * 4 / 9, y,
DTA_CleanNoMove, true, TAG_DONE);

View file

@ -181,7 +181,7 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint)
case ADEF_Inventory_Icon:
item->Icon = TexMan.AddPatch (datastr);
if (item->Icon <= 0)
if (!item->Icon.isValid())
{
item->Icon = TexMan.AddPatch (datastr, ns_sprites);
}
@ -334,7 +334,7 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint)
break;
case ADEF_PlayerPawn_ScoreIcon:
player->ScoreIcon = TexMan.AddPatch (datastr);
if (player->ScoreIcon <= 0)
if (!player->ScoreIcon.isValid())
{
player->ScoreIcon = TexMan.AddPatch (datastr, ns_sprites);
}

View file

@ -673,7 +673,7 @@ void cht_Give (player_t *player, const char *name, int amount)
if (type->IsDescendantOf (RUNTIME_CLASS(AInventory)))
{
AInventory *def = (AInventory*)GetDefaultByType (type);
if (def->Icon > 0 && def->MaxAmount > 1 &&
if (def->Icon.isValid() && def->MaxAmount > 1 &&
!type->IsDescendantOf (RUNTIME_CLASS(APuzzleItem)) &&
!type->IsDescendantOf (RUNTIME_CLASS(APowerup)) &&
!type->IsDescendantOf (RUNTIME_CLASS(AArmor)))
@ -694,7 +694,7 @@ void cht_Give (player_t *player, const char *name, int amount)
if (type->IsDescendantOf (RUNTIME_CLASS(APuzzleItem)))
{
AInventory *def = (AInventory*)GetDefaultByType (type);
if (def->Icon > 0)
if (def->Icon.isValid())
{
GiveSpawner (player, type, 1);
}

View file

@ -214,10 +214,11 @@ void P_Attach3dMidtexLinesToSector(sector_t *sector, int lineid, int tag, bool c
bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, fixed_t *ptexbot)
{
side_t *side = &sides[line->sidenum[sideno]];
FTextureID texnum = side->GetTexture(side_t::mid);
if (line->sidenum[0]==NO_SIDE || line->sidenum[1]==NO_SIDE || !side->GetTexture(side_t::mid)) return false;
if (line->sidenum[0]==NO_SIDE || line->sidenum[1]==NO_SIDE || !texnum.isValid()) return false;
FTexture * tex= TexMan(side->GetTexture(side_t::mid));
FTexture * tex= TexMan(texnum);
if (!tex) return false;
fixed_t y_offset = side->GetTextureYOffset(side_t::mid);

View file

@ -1886,7 +1886,8 @@ do_count:
void DLevelScript::ChangeFlat (int tag, int name, bool floorOrCeiling)
{
int flat, secnum = -1;
FTextureID flat;
int secnum = -1;
const char *flatname = FBehavior::StaticLookupString (name);
if (flatname == NULL)
@ -1924,7 +1925,8 @@ int DLevelScript::CountPlayers ()
void DLevelScript::SetLineTexture (int lineid, int side, int position, int name)
{
int texture, linenum = -1;
FTextureID texture;
int linenum = -1;
const char *texname = FBehavior::StaticLookupString (name);
if (texname == NULL)
@ -1964,7 +1966,7 @@ void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, int flags)
{
const char *fromname = FBehavior::StaticLookupString (fromnamei);
const char *toname = FBehavior::StaticLookupString (tonamei);
int picnum1, picnum2;
FTextureID picnum1, picnum2;
if (fromname == NULL)
return;
@ -5094,8 +5096,8 @@ int DLevelScript::RunScript ()
if (camera != NULL)
{
int picnum = TexMan.CheckForTexture (picname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
if (picnum < 0)
FTextureID picnum = TexMan.CheckForTexture (picname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
if (!picnum.Exists())
{
Printf ("SetCameraToTexture: %s is not a texture\n", picname);
}

View file

@ -479,7 +479,7 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
for (i = 0; i < numwalls; ++i)
{
char tnam[9];
int overpic, pic;
FTextureID overpic, pic;
sprintf (tnam, "BTIL%04d", LittleShort(walls[i].picnum));
pic = TexMan.GetTexture (tnam, FTexture::TEX_Build);
@ -508,7 +508,7 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
}
else
{
sides[i].SetTexture(side_t::mid, 0);
sides[i].SetTexture(side_t::mid, FNullTextureID());
}
sides[i].TexelLength = walls[i].xrepeat * 8;
@ -642,8 +642,6 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
static int LoadSprites (spritetype *sprites, int numsprites, sectortype *bsectors,
FMapThing *mapthings)
{
char name[9];
int picnum;
int count = 0;
for (int i = 0; i < numsprites; ++i)
@ -651,9 +649,6 @@ static int LoadSprites (spritetype *sprites, int numsprites, sectortype *bsector
if (sprites[i].cstat & (16|32|32768)) continue;
if (sprites[i].xrepeat == 0 || sprites[i].yrepeat == 0) continue;
sprintf (name, "BTIL%04d", sprites[i].picnum);
picnum = TexMan.GetTexture (name, FTexture::TEX_Build);
mapthings[count].thingid = 0;
mapthings[count].x = (sprites[i].x << 12);
mapthings[count].y = -(sprites[i].y << 12);
@ -665,8 +660,8 @@ static int LoadSprites (spritetype *sprites, int numsprites, sectortype *bsector
mapthings[count].flags = MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH;
mapthings[count].special = 0;
mapthings[count].args[0] = picnum & 255;
mapthings[count].args[1] = picnum >> 8;
mapthings[count].args[0] = sprites[i].picnum & 255;
mapthings[count].args[1] = sprites[i].picnum >> 8;
mapthings[count].args[2] = sprites[i].xrepeat;
mapthings[count].args[3] = sprites[i].yrepeat;
mapthings[count].args[4] = (sprites[i].cstat & 14) | ((sprites[i].cstat >> 9) & 1);
@ -810,8 +805,12 @@ END_DEFAULTS
void ACustomSprite::BeginPlay ()
{
char name[9];
Super::BeginPlay ();
picnum = args[0] + args[1]*256;
sprintf (name, "BTIL%04d", (args[0] + args[1]*256) & 0xffff);
picnum = TexMan.GetTexture (name, FTexture::TEX_Build);
scaleX = args[2] * (FRACUNIT/64);
scaleY = args[3] * (FRACUNIT/64);

View file

@ -392,7 +392,7 @@ static FStrifeDialogueNode *ReadTeaserNode (FileReader *lump, DWORD &prevSpeaker
node->Dialogue = ncopystring (speech.Dialogue);
// The Teaser version doesn't have portraits.
node->Backdrop = -1;
node->Backdrop.SetInvalid();
// The speaker's voice for this node, if any.
if (speech.VoiceNumber != 0)
@ -848,7 +848,7 @@ static void DrawConversationMenu ()
menuactive = MENU_On;
}
if (CurNode->Backdrop >= 0)
if (CurNode->Backdrop.isValid())
{
screen->DrawTexture (TexMan(CurNode->Backdrop), 0, 0, DTA_320x200, true, TAG_DONE);
}
@ -871,7 +871,7 @@ static void DrawConversationMenu ()
}
// Dim the screen behind the dialogue (but only if there is no backdrop).
if (CurNode->Backdrop <= 0)
if (!CurNode->Backdrop.isValid())
{
for (i = 0; DialogueLines[i].Width >= 0; ++i)
{ }

View file

@ -22,7 +22,7 @@ struct FStrifeDialogueNode
const PClass *SpeakerType;
char *SpeakerName;
FSoundID SpeakerVoice;
int Backdrop;
FTextureID Backdrop;
char *Dialogue;
FStrifeDialogueReply *Children;

View file

@ -489,7 +489,7 @@ void P_SpawnDoorRaiseIn5Mins (sector_t *sec)
new DDoor (sec, DDoor::doorRaiseIn5Mins, 2*FRACUNIT, TICRATE*30/7, 0);
}
// Strife's animated doors. Based on Doom's unused sliding doors, but slightly different.
// Strife's animated doors. Based on Doom's unused sliding doors, but significantly improved.
class DeletingDoorArray : public TArray<FDoorAnimation>
{
@ -504,16 +504,6 @@ public:
delete [] ani->TextureFrames;
ani->TextureFrames = NULL;
}
if (ani->OpenSound != NULL)
{
delete [] ani->OpenSound;
ani->OpenSound = NULL;
}
if (ani->CloseSound != NULL)
{
delete [] ani->CloseSound;
ani->CloseSound = NULL;
}
}
}
};
@ -527,7 +517,7 @@ DeletingDoorArray DoorAnimations;
//
// Return index into "DoorAnimations" array for which door type to use
//
static int P_FindSlidingDoorType (int picnum)
static int P_FindSlidingDoorType (FTextureID picnum)
{
unsigned int i;
@ -560,7 +550,7 @@ bool DAnimatedDoor::StartClosing ()
m_Line1->flags |= ML_BLOCKING;
m_Line2->flags |= ML_BLOCKING;
if (ani.CloseSound != NULL)
if (ani.CloseSound != NAME_None)
{
SN_StartSequence (m_Sector, CHAN_CEILING, ani.CloseSound, 1);
}
@ -664,22 +654,21 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec)
void DAnimatedDoor::Serialize (FArchive &arc)
{
Super::Serialize (arc);
FTextureID basetex = DoorAnimations[m_WhichDoorIndex].BaseTexture;
arc << m_Line1 << m_Line2
<< m_Frame
<< m_Timer
<< m_BotDist
<< m_Status
<< m_Speed
<< m_Delay;
<< m_Delay
<< basetex;
if (arc.IsStoring())
if (arc.IsLoading())
{
TexMan.WriteTexture (arc, DoorAnimations[m_WhichDoorIndex].BaseTexture);
}
else
{
int picnum = TexMan.ReadTexture (arc);
m_WhichDoorIndex = P_FindSlidingDoorType (picnum);
m_WhichDoorIndex = P_FindSlidingDoorType (basetex);
if (m_WhichDoorIndex == -1)
{ // Oh no! The door animation doesn't exist anymore!
m_WhichDoorIndex = 0;
@ -691,7 +680,7 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay)
: DMovingCeiling (sec)
{
fixed_t topdist;
int picnum;
FTextureID picnum;
// The DMovingCeiling constructor automatically sets up an interpolation for us.
// Stop it, since the ceiling is moving instantly here.
@ -738,7 +727,7 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay)
m_Line2->flags |= ML_BLOCKING;
m_BotDist = m_Sector->ceilingplane.d;
MoveCeiling (2048*FRACUNIT, topdist, 1);
if (DoorAnimations[m_WhichDoorIndex].OpenSound != NULL)
if (DoorAnimations[m_WhichDoorIndex].OpenSound != NAME_None)
{
SN_StartSequence (m_Sector, CHAN_FULLHEIGHT, DoorAnimations[m_WhichDoorIndex].OpenSound, 1);
}
@ -817,16 +806,14 @@ void P_ParseAnimatedDoor(FScanner &sc)
{
const BITFIELD texflags = FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny;
FDoorAnimation anim;
TArray<int> frames;
TArray<FTextureID> frames;
bool error = false;
int v;
FTextureID v;
sc.MustGetString();
anim.BaseTexture = TexMan.CheckForTexture (sc.String, FTexture::TEX_Wall, texflags);
anim.OpenSound = NULL;
anim.CloseSound = NULL;
if (anim.BaseTexture == -1)
if (!anim.BaseTexture.Exists())
{
error = true;
}
@ -836,24 +823,24 @@ void P_ParseAnimatedDoor(FScanner &sc)
if (sc.Compare ("opensound"))
{
sc.MustGetString ();
anim.OpenSound = copystring (sc.String);
anim.OpenSound = sc.String;
}
else if (sc.Compare ("closesound"))
{
sc.MustGetString ();
anim.CloseSound = copystring (sc.String);
anim.CloseSound = sc.String;
}
else if (sc.Compare ("pic"))
{
sc.MustGetString ();
if (IsNum (sc.String))
{
v = atoi(sc.String) + anim.BaseTexture -1;
v = anim.BaseTexture + (atoi(sc.String) - 1);
}
else
{
v = TexMan.CheckForTexture (sc.String, FTexture::TEX_Wall, texflags);
if (v == -1 && anim.BaseTexture >= 0 && !error)
if (!v.Exists() && anim.BaseTexture.Exists() && !error)
{
sc.ScriptError ("Unknown texture %s", sc.String);
}
@ -868,14 +855,9 @@ void P_ParseAnimatedDoor(FScanner &sc)
}
if (!error)
{
anim.TextureFrames = new int[frames.Size()];
memcpy (anim.TextureFrames, &frames[0], sizeof(int) * frames.Size());
anim.TextureFrames = new FTextureID[frames.Size()];
memcpy (anim.TextureFrames, &frames[0], sizeof(FTextureID) * frames.Size());
anim.NumTextureFrames = frames.Size();
DoorAnimations.Push (anim);
}
else
{
if (anim.OpenSound!=NULL) delete [] anim.OpenSound;
if (anim.CloseSound!=NULL) delete [] anim.CloseSound;
}
}

View file

@ -2054,7 +2054,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
// CANTLEAVEFLOORPIC handling was completely missing in the non-serpent functions.
fixed_t oldX = actor->x;
fixed_t oldY = actor->y;
int oldFloor = actor->floorpic;
FTextureID oldFloor = actor->floorpic;
// chase towards player
if (--actor->movecount < 0 || !P_Move (actor))

View file

@ -517,7 +517,7 @@ manual_floor:
floor->m_FloorDestDist = sec->floorplane.PointToDist (0, 0, newheight);
if (line != NULL)
{
int oldpic = sec->floorpic;
FTextureID oldpic = sec->floorpic;
sec->floorpic = line->frontsector->floorpic;
sec->special = (sec->special & SECRET_MASK) | (line->frontsector->special & ~SECRET_MASK);
if (oldpic != sec->floorpic)
@ -659,7 +659,7 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag)
rtn = true;
// handle trigger or numeric change type
int oldpic = sec->floorpic;
FTextureID oldpic = sec->floorpic;
switch(changetype)
{
@ -717,7 +717,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
fixed_t stairstep;
int i;
int newsecnum = -1;
int texture;
FTextureID texture;
int ok;
int persteptime;
bool rtn = false;

View file

@ -2766,8 +2766,8 @@ FUNC(LS_ClearForceField)
{
line->flags &= ~(ML_BLOCKING|ML_BLOCKEVERYTHING);
line->special = 0;
sides[line->sidenum[0]].SetTexture(side_t::mid, 0);
sides[line->sidenum[1]].SetTexture(side_t::mid, 0);
sides[line->sidenum[0]].SetTexture(side_t::mid, FNullTextureID());
sides[line->sidenum[1]].SetTexture(side_t::mid, FNullTextureID());
}
}
}

View file

@ -223,8 +223,8 @@ struct FLineOpening
fixed_t lowfloor;
sector_t *bottomsec;
sector_t *topsec;
int ceilingpic;
int floorpic;
FTextureID ceilingpic;
FTextureID floorpic;
bool touchmidtex;
};
@ -328,9 +328,9 @@ struct FCheckPosition
fixed_t floorz;
fixed_t ceilingz;
fixed_t dropoffz;
fixed_t floorpic;
FTextureID floorpic;
sector_t *floorsector;
fixed_t ceilingpic;
FTextureID ceilingpic;
sector_t *ceilingsector;
bool touchmidtex;
bool floatok;

View file

@ -1845,6 +1845,7 @@ void FSlide::HitSlideLine (line_t* ld)
//
void FSlide::SlideTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy)
{
FLineOpening open;
FPathTraverse it(startx, starty, endx, endy, PT_ADDLINES);
intercept_t *in;
@ -1883,7 +1884,6 @@ void FSlide::SlideTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_
goto isblocking;
}
FLineOpening open;
// set openrange, opentop, openbottom
P_LineOpening (open, slidemo, li, it.Trace().x + FixedMul (it.Trace().dx, in->frac),
it.Trace().y + FixedMul (it.Trace().dy, in->frac));
@ -2160,6 +2160,7 @@ bool P_CheckSlopeWalk (AActor *actor, fixed_t &xmove, fixed_t &ymove)
bool FSlide::BounceTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy)
{
FLineOpening open;
FPathTraverse it(startx, starty, endx, endy, PT_ADDLINES);
intercept_t *in;
@ -2187,7 +2188,6 @@ bool FSlide::BounceTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed
goto bounceblocking;
}
FLineOpening open;
P_LineOpening (open, slidemo, li, it.Trace().x + FixedMul (it.Trace().dx, in->frac),
it.Trace().y + FixedMul (it.Trace().dy, in->frac)); // set openrange, opentop, openbottom
@ -3012,9 +3012,9 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
{
fixed_t savex, savey, savez;
fixed_t savefloor, saveceil, savedropoff;
int savefloorpic;
FTextureID savefloorpic;
sector_t *savefloorsec;
int saveceilingpic;
FTextureID saveceilingpic;
sector_t *saveceilingsec;
savex = source->x;

View file

@ -56,6 +56,7 @@
#include "g_game.h"
#include "teaminfo.h"
#include "r_translate.h"
#include "r_sky.h"
// MACROS ------------------------------------------------------------------
@ -197,51 +198,14 @@ void AActor::Serialize (FArchive &arc)
<< scaleX
<< scaleY
<< RenderStyle
<< renderflags;
if (arc.IsStoring ())
{
BYTE ff;
if (picnum == 0xFFFF)
{
ff = 0xFF;
arc << ff;
}
else
{
ff = 0;
arc << ff;
TexMan.WriteTexture (arc, picnum);
}
TexMan.WriteTexture (arc, floorpic);
TexMan.WriteTexture (arc, ceilingpic);
}
else
{
BYTE ff;
arc << ff;
if (ff == 0xFF)
{
picnum = 0xFFFF;
}
else
{
picnum = TexMan.ReadTexture (arc);
}
floorpic = TexMan.ReadTexture (arc);
ceilingpic = TexMan.ReadTexture (arc);
}
arc << TIDtoHate;
if (TIDtoHate == 0)
{
arc << LastLookPlayerNumber;
LastLookActor = NULL;
}
else
{
arc << LastLookActor;
LastLookPlayerNumber = -1;
}
arc << effects
<< renderflags
<< picnum
<< floorpic
<< ceilingpic
<< TIDtoHate
<< LastLookPlayerNumber
<< LastLookActor
<< effects
<< alpha
<< fillcolor
<< pitch
@ -3206,7 +3170,7 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t
actor->x = actor->PrevX = ix;
actor->y = actor->PrevY = iy;
actor->z = actor->PrevZ = iz;
actor->picnum = 0xffff;
actor->picnum.SetInvalid();
FRandom &rng = bglobal.m_Thinking ? pr_botspawnmobj : pr_spawnmobj;
@ -3257,9 +3221,9 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t
actor->floorz = FIXED_MIN;
actor->dropoffz = FIXED_MIN;
actor->ceilingz = FIXED_MAX;
actor->floorpic = 0;
actor->floorpic = actor->Sector->floorpic;
actor->floorsector = actor->Sector;
actor->ceilingpic = 0;
actor->ceilingpic = actor->Sector->ceilingpic;
actor->ceilingsector = actor->Sector;
}
@ -4291,7 +4255,7 @@ void P_RipperBlood (AActor *mo, AActor *bleeder)
int P_GetThingFloorType (AActor *thing)
{
if (thing->floorpic)
if (thing->floorpic.isValid())
{
return TerrainTypes[thing->floorpic];
}

View file

@ -286,19 +286,10 @@ void P_SerializeWorld (FArchive &arc)
arc << sec->floorplane
<< sec->ceilingplane
<< sec->floortexz
<< sec->ceilingtexz;
if (arc.IsStoring ())
{
TexMan.WriteTexture (arc, sec->floorpic);
TexMan.WriteTexture (arc, sec->ceilingpic);
}
else
{
sec->floorpic = TexMan.ReadTexture (arc);
sec->ceilingpic = TexMan.ReadTexture (arc);
}
arc << sec->lightlevel
<< sec->ceilingtexz
<< sec->floorpic
<< sec->ceilingpic
<< sec->lightlevel
<< sec->special
<< sec->tag
<< sec->soundtraversed
@ -411,15 +402,7 @@ void extsector_t::Serialize(FArchive &arc)
FArchive &operator<< (FArchive &arc, side_t::part &p)
{
arc << p.xoffset << p.yoffset << p.interpolation;// << p.Light;
if (arc.IsStoring ())
{
TexMan.WriteTexture (arc, p.texture);
}
else
{
p.texture = TexMan.ReadTexture (arc);
}
arc << p.xoffset << p.yoffset << p.interpolation << p.texture;// << p.Light;
return arc;
}

View file

@ -450,9 +450,9 @@ fixed_t sector_t::FindHighestCeilingSurrounding (vertex_t **v) const
// jff 02/03/98 Add routine to find shortest lower texture
//
static inline void CheckShortestTex (int texnum, fixed_t &minsize)
static inline void CheckShortestTex (FTextureID texnum, fixed_t &minsize)
{
if (texnum > 0 || (texnum == 0 && (i_compatflags & COMPATF_SHORTTEX)))
if (texnum.isValid() || (texnum.isNull() && (i_compatflags & COMPATF_SHORTTEX)))
{
FTexture *tex = TexMan[texnum];
if (tex != NULL)
@ -758,4 +758,4 @@ void sector_t::ClosestPoint(fixed_t fx, fixed_t fy, fixed_t &ox, fixed_t &oy) co
}
ox = fixed_t(bestx);
oy = fixed_t(besty);
}
}

View file

@ -61,6 +61,7 @@
#include "p_setup.h"
#include "r_translate.h"
#include "r_interpolate.h"
#include "r_sky.h"
void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt);
void P_SetSlopes ();
@ -519,19 +520,19 @@ static void SetTexture (side_t *side, int position, DWORD *blend, char *name8)
char name[9];
strncpy (name, name8, 8);
name[8] = 0;
int texture;
FTextureID texture;
if ((*blend = R_ColormapNumForName (name)) == 0)
{
if ((texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny)
) == -1)
texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!texture.Exists())
{
char name2[9];
char *stop;
strncpy (name2, name, 8);
name2[8] = 0;
*blend = strtoul (name2, &stop, 16);
texture = 0;
texture = FNullTextureID();
}
else
{
@ -540,7 +541,7 @@ static void SetTexture (side_t *side, int position, DWORD *blend, char *name8)
}
else
{
texture = 0;
texture = FNullTextureID();
}
side->SetTexture(position, texture);
}
@ -548,19 +549,20 @@ static void SetTexture (side_t *side, int position, DWORD *blend, char *name8)
static void SetTextureNoErr (side_t *side, int position, DWORD *color, char *name8, bool *validcolor)
{
char name[9];
int texture;
FTextureID texture;
strncpy (name, name8, 8);
name[8] = 0;
if ((texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny)
) == -1)
texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!texture.Exists())
{
char name2[9];
char *stop;
strncpy (name2, name, 8);
name2[8] = 0;
*color = strtoul (name2, &stop, 16);
texture = 0;
texture = FNullTextureID();
*validcolor = (*stop == 0) && (stop >= name2 + 2) && (stop <= name2 + 6);
}
else
@ -2101,13 +2103,13 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapside
if (strnicmp ("TRANMAP", msd->midtexture, 8) == 0)
{
// The translator set the alpha argument already; no reason to do it again.
sd->SetTexture(side_t::mid, 0);
sd->SetTexture(side_t::mid, FNullTextureID());
}
else if ((lumpnum = Wads.CheckNumForName (msd->midtexture)) > 0 &&
Wads.LumpLength (lumpnum) == 65536)
{
*alpha = (short)P_DetermineTranslucency (lumpnum);
sd->SetTexture(side_t::mid, 0);
sd->SetTexture(side_t::mid, FNullTextureID());
}
else
{

View file

@ -601,11 +601,11 @@ inline FArchive &operator<< (FArchive &arc, DDoor::EVlDoor &type)
struct FDoorAnimation
{
int BaseTexture;
int *TextureFrames;
FTextureID BaseTexture;
FTextureID *TextureFrames;
int NumTextureFrames;
char *OpenSound;
char *CloseSound;
FName OpenSound;
FName CloseSound;
};
void P_ParseAnimatedDoor (FScanner &sc);
@ -703,7 +703,7 @@ protected:
int m_Direction; // 1 = up, 0 = waiting, -1 = down
// [RH] Need these for BOOM-ish transferring ceilings
int m_Texture;
FTextureID m_Texture;
int m_NewSpecial;
// ID
@ -800,8 +800,8 @@ protected:
int m_Crush;
bool m_Hexencrush;
int m_Direction;
short m_NewSpecial;
short m_Texture;
int m_NewSpecial;
FTextureID m_Texture;
fixed_t m_FloorDestDist;
fixed_t m_Speed;

View file

@ -78,7 +78,7 @@ protected:
struct FSwitchDef
{
int PreTexture; // texture to switch from
FTextureID PreTexture; // texture to switch from
WORD PairIndex; // switch def to use to return to PreTexture
WORD NumFrames; // # of animation frames
FSoundID Sound; // sound to play at start of animation
@ -86,7 +86,7 @@ struct FSwitchDef
struct frame // Array of times followed by array of textures
{ // actual length of each array is <NumFrames>
DWORD Time;
int Texture;
FTextureID Texture;
} u[1];
};
@ -146,7 +146,7 @@ void P_InitSwitchList ()
// [RH] Skip this switch if its texture can't be found.
if (((gameinfo.maxSwitch & 15) >= (list_p[18] & 15)) &&
((gameinfo.maxSwitch & ~15) == (list_p[18] & ~15)) &&
TexMan.CheckForTexture (list_p /* .name1 */, FTexture::TEX_Wall, texflags) >= 0)
TexMan.CheckForTexture (list_p /* .name1 */, FTexture::TEX_Wall, texflags).Exists())
{
def1 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef));
def2 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef));
@ -203,7 +203,7 @@ void P_ProcessSwitchDef (FScanner &sc)
const BITFIELD texflags = FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny;
FString picname;
FSwitchDef *def1, *def2;
SWORD picnum;
FTextureID picnum;
BYTE max;
bool quest = false;
@ -255,7 +255,7 @@ void P_ProcessSwitchDef (FScanner &sc)
{
sc.ScriptError ("Switch already has an on state");
}
def1 = ParseSwitchDef (sc, picnum == -1);
def1 = ParseSwitchDef (sc, !picnum.Exists());
}
else if (sc.Compare ("off"))
{
@ -263,7 +263,7 @@ void P_ProcessSwitchDef (FScanner &sc)
{
sc.ScriptError ("Switch already has an off state");
}
def2 = ParseSwitchDef (sc, picnum == -1);
def2 = ParseSwitchDef (sc, !picnum.Exists());
}
else
{
@ -277,7 +277,7 @@ void P_ProcessSwitchDef (FScanner &sc)
sc.ScriptError ("Switch must have an on state");
}
*/
if (def1 == NULL || picnum == -1 ||
if (def1 == NULL || !picnum.Exists() ||
((max & 240) != 240 &&
((gameinfo.maxSwitch & 240) != (max & 240) ||
(gameinfo.maxSwitch & 15) < (max & 15))))
@ -321,7 +321,7 @@ FSwitchDef *ParseSwitchDef (FScanner &sc, bool ignoreBad)
FSwitchDef *def;
TArray<FSwitchDef::frame> frames;
FSwitchDef::frame thisframe;
int picnum;
FTextureID picnum;
bool bad;
FSoundID sound;
@ -342,7 +342,7 @@ FSwitchDef *ParseSwitchDef (FScanner &sc, bool ignoreBad)
{
sc.MustGetString ();
picnum = TexMan.CheckForTexture (sc.String, FTexture::TEX_Wall, texflags);
if (picnum < 0 && !ignoreBad)
if (!picnum.Exists() && !ignoreBad)
{
//Printf ("Unknown switch texture %s\n", sc.String);
bad = true;
@ -442,7 +442,7 @@ static int TryFindSwitch (side_t *side, int Where)
{
int mid, low, high;
int texture = side->GetTexture(Where);
FTextureID texture = side->GetTexture(Where);
high = (int)(SwitchList.Size () - 1);
if (high >= 0)
{

View file

@ -130,7 +130,7 @@ static void ParseFriction (FScanner &sc, int keyword, void *fields);
// PUBLIC DATA DEFINITIONS -------------------------------------------------
TArray<BYTE> TerrainTypes;
FTerrainTypeArray TerrainTypes;
TArray<FSplashDef> Splashes;
TArray<FTerrainDef> Terrains;
@ -554,7 +554,7 @@ static void GenericParse (FScanner &sc, FGenericParse *parser, const char **keyw
{
bool notdone = true;
int keyword;
int val;
int val = 0;
const PClass *info;
do
@ -575,11 +575,13 @@ static void GenericParse (FScanner &sc, FGenericParse *parser, const char **keyw
case GEN_Sound:
sc.MustGetString ();
SET_FIELD (FSoundID, FSoundID(sc.String));
/* unknown sounds never produce errors anywhere else so they shouldn't here either.
if (val == 0)
{
Printf ("Unknown sound %s in %s %s\n",
sc.String, type, name.GetChars());
}
*/
break;
case GEN_Byte:
@ -656,12 +658,12 @@ static void GenericParse (FScanner &sc, FGenericParse *parser, const char **keyw
static void ParseFloor (FScanner &sc)
{
int picnum;
FTextureID picnum;
int terrain;
sc.MustGetString ();
picnum = TexMan.CheckForTexture (sc.String, FTexture::TEX_Flat);
if (picnum == -1)
if (!picnum.Exists())
{
Printf ("Unknown flat %s\n", sc.String);
sc.MustGetString ();

View file

@ -39,8 +39,30 @@
#include "tarray.h"
#include "name.h"
#include "s_sound.h"
#include "textures/textures.h"
extern TArray<BYTE> TerrainTypes;
// This is just a wrapper class so that I don't have to expose FTextureID's implementation
// to anything that doesn't really need it.
class FTerrainTypeArray
{
public:
TArray<BYTE> Types;
BYTE &operator [](FTextureID tex)
{
return Types[tex.GetIndex()];
}
BYTE &operator [](int texnum)
{
return Types[texnum];
}
void Resize(unsigned newsize)
{
Types.Resize(newsize);
}
};
extern FTerrainTypeArray TerrainTypes;
// at game start
void P_InitTerrainTypes ();

View file

@ -35,6 +35,7 @@
#include "p_trace.h"
#include "p_local.h"
#include "i_system.h"
#include "r_sky.h"
struct FTraceInfo
{

View file

@ -41,6 +41,7 @@
#include "templates.h"
#include "i_system.h"
#include "gi.h"
#include "r_sky.h"
//===========================================================================
//

View file

@ -127,7 +127,7 @@ static int WriteLINEDEFS (FILE *file)
return numlines * sizeof(mld);
}
static const char *GetTextureName (int texnum)
static const char *GetTextureName (FTextureID texnum)
{
FTexture *tex = TexMan[texnum];

View file

@ -55,7 +55,7 @@
struct FAnimDef
{
WORD BasePic;
FTextureID BasePic;
WORD NumFrames;
WORD CurFrame;
BYTE AnimType;
@ -64,7 +64,7 @@ struct FAnimDef
{
DWORD SpeedMin; // Speeds are in ms, not tics
DWORD SpeedRange;
WORD FramePic;
FTextureID FramePic;
} Frames[1];
enum
{
@ -91,11 +91,11 @@ public:
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
static void R_InitAnimDefs ();
static void R_AddComplexAnim (int picnum, const TArray<FAnimDef::FAnimFrame> &frames);
static void R_AddComplexAnim (FTextureID picnum, const TArray<FAnimDef::FAnimFrame> &frames);
static void ParseAnim (FScanner &sc, bool istex);
static void ParseRangeAnim (FScanner &sc, int picnum, int usetype, bool missing);
static void ParsePicAnim (FScanner &sc, int picnum, int usetype, bool missing, TArray<FAnimDef::FAnimFrame> &frames);
static int ParseFramenum (FScanner &sc, int basepicnum, int usetype, bool allowMissing);
static void ParseRangeAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing);
static void ParsePicAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing, TArray<FAnimDef::FAnimFrame> &frames);
static FTextureID ParseFramenum (FScanner &sc, FTextureID basepicnum, int usetype, bool allowMissing);
static void ParseTime (FScanner &sc, DWORD &min, DWORD &max);
// PUBLIC DATA DEFINITIONS -------------------------------------------------
@ -149,7 +149,7 @@ void R_InitPicAnims (void)
FMemLump animatedlump = Wads.ReadLump ("ANIMATED");
const char *animdefs = (const char *)animatedlump.GetMem();
const char *anim_p;
int pic1, pic2;
FTextureID pic1, pic2;
int animtype;
DWORD animspeed;
@ -161,8 +161,8 @@ void R_InitPicAnims (void)
if (*anim_p /* .istexture */ & 1)
{
// different episode ?
if ((pic1 = TexMan.CheckForTexture (anim_p + 10 /* .startname */, FTexture::TEX_Wall, texflags)) == -1 ||
(pic2 = TexMan.CheckForTexture (anim_p + 1 /* .endname */, FTexture::TEX_Wall, texflags)) == -1)
if (!(pic1 = TexMan.CheckForTexture (anim_p + 10 /* .startname */, FTexture::TEX_Wall, texflags)).Exists() ||
!(pic2 = TexMan.CheckForTexture (anim_p + 1 /* .endname */, FTexture::TEX_Wall, texflags)).Exists())
continue;
// [RH] Bit 1 set means allow decals on walls with this texture
@ -170,8 +170,8 @@ void R_InitPicAnims (void)
}
else
{
if ((pic1 = TexMan.CheckForTexture (anim_p + 10 /* .startname */, FTexture::TEX_Flat, texflags)) == -1 ||
(pic2 = TexMan.CheckForTexture (anim_p + 1 /* .startname */, FTexture::TEX_Flat, texflags)) == -1)
if (!(pic1 = TexMan.CheckForTexture (anim_p + 10 /* .startname */, FTexture::TEX_Flat, texflags)).Exists() ||
!(pic2 = TexMan.CheckForTexture (anim_p + 1 /* .startname */, FTexture::TEX_Flat, texflags)).Exists())
continue;
}
if (pic1 == pic2)
@ -182,7 +182,7 @@ void R_InitPicAnims (void)
}
FTexture *tex1 = TexMan[pic1];
FTexture *tex2 = TexMan[pic1];
FTexture *tex2 = TexMan[pic2];
if (tex1->UseType != tex2->UseType)
{
@ -193,8 +193,8 @@ void R_InitPicAnims (void)
if (debuganimated)
{
Printf("Defining animation '%s' (texture %d, lump %d, file %d) to '%s' (texture %d, lump %d, file %d)\n",
tex1->Name, pic1, tex1->GetSourceLump(), Wads.GetLumpFile(tex1->GetSourceLump()),
tex2->Name, pic2, tex2->GetSourceLump(), Wads.GetLumpFile(tex2->GetSourceLump()));
tex1->Name, pic1.GetIndex(), tex1->GetSourceLump(), Wads.GetLumpFile(tex1->GetSourceLump()),
tex2->Name, pic2.GetIndex(), tex2->GetSourceLump(), Wads.GetLumpFile(tex2->GetSourceLump()));
}
/* FIXME: doesn't work with hires texture replacements.
@ -240,7 +240,7 @@ void R_InitPicAnims (void)
//
//==========================================================================
void R_AddSimpleAnim (int picnum, int animcount, int animtype, DWORD speedmin, DWORD speedrange)
void R_AddSimpleAnim (FTextureID picnum, int animcount, int animtype, DWORD speedmin, DWORD speedrange)
{
FAnimDef *anim = (FAnimDef *)M_Malloc (sizeof(FAnimDef));
anim->CurFrame = 0;
@ -262,7 +262,7 @@ void R_AddSimpleAnim (int picnum, int animcount, int animtype, DWORD speedmin, D
//
//==========================================================================
static void R_AddComplexAnim (int picnum, const TArray<FAnimDef::FAnimFrame> &frames)
static void R_AddComplexAnim (FTextureID picnum, const TArray<FAnimDef::FAnimFrame> &frames)
{
FAnimDef *anim = (FAnimDef *)M_Malloc (sizeof(FAnimDef) + (frames.Size()-1) * sizeof(frames[0]));
anim->BasePic = picnum;
@ -325,8 +325,8 @@ static void R_InitAnimDefs ()
{
sc.ScriptError (NULL);
}
int picnum = TexMan.CheckForTexture (sc.String, isflat ? FTexture::TEX_Flat : FTexture::TEX_Wall, texflags);
if (picnum != -1)
FTextureID picnum = TexMan.CheckForTexture (sc.String, isflat ? FTexture::TEX_Flat : FTexture::TEX_Wall, texflags);
if (picnum.isValid())
{
FTexture * warper = TexMan[picnum];
@ -374,9 +374,9 @@ static void R_InitAnimDefs ()
width = sc.Number;
sc.MustGetNumber ();
height = sc.Number;
int picnum = TexMan.CheckForTexture (picname, FTexture::TEX_Flat, texflags);
FTextureID picnum = TexMan.CheckForTexture (picname, FTexture::TEX_Flat, texflags);
FTexture *viewer = new FCanvasTexture (picname, width, height);
if (picnum != -1)
if (picnum.Exists())
{
FTexture *oldtex = TexMan[picnum];
fitwidth = oldtex->GetScaledWidth ();
@ -433,7 +433,7 @@ static void ParseAnim (FScanner &sc, bool istex)
{
const BITFIELD texflags = FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny;
TArray<FAnimDef::FAnimFrame> frames (32);
int picnum;
FTextureID picnum;
int usetype;
int defined = 0;
bool optional = false, missing = false;
@ -448,7 +448,7 @@ static void ParseAnim (FScanner &sc, bool istex)
}
picnum = TexMan.CheckForTexture (sc.String, usetype, texflags);
if (picnum < 0)
if (!picnum.Exists())
{
if (optional)
{
@ -461,7 +461,7 @@ static void ParseAnim (FScanner &sc, bool istex)
}
// no decals on animating textures, by default
if (picnum >= 0)
if (picnum.isValid())
{
TexMan[picnum]->bNoDecals = true;
}
@ -470,7 +470,7 @@ static void ParseAnim (FScanner &sc, bool istex)
{
if (sc.Compare ("allowdecals"))
{
if (picnum >= 0)
if (picnum.isValid())
{
TexMan[picnum]->bNoDecals = false;
}
@ -507,7 +507,7 @@ static void ParseAnim (FScanner &sc, bool istex)
// If base pic is not present, don't add this anim
// ParseRangeAnim adds the anim itself, but ParsePicAnim does not.
if (picnum >= 0 && defined == 2)
if (picnum.isValid() && defined == 2)
{
if (frames.Size() < 2)
{
@ -526,16 +526,17 @@ static void ParseAnim (FScanner &sc, bool istex)
//
//==========================================================================
static void ParseRangeAnim (FScanner &sc, int picnum, int usetype, bool missing)
static void ParseRangeAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing)
{
int type, framenum;
int type;
FTextureID framenum;
DWORD min, max;
type = FAnimDef::ANIM_Forward;
framenum = ParseFramenum (sc, picnum, usetype, missing);
ParseTime (sc, min, max);
if (framenum == picnum || picnum < 0)
if (framenum == picnum || !picnum.Exists())
{
return; // Animation is only one frame or does not exist
}
@ -567,15 +568,15 @@ static void ParseRangeAnim (FScanner &sc, int picnum, int usetype, bool missing)
//
//==========================================================================
static void ParsePicAnim (FScanner &sc, int picnum, int usetype, bool missing, TArray<FAnimDef::FAnimFrame> &frames)
static void ParsePicAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing, TArray<FAnimDef::FAnimFrame> &frames)
{
int framenum;
FTextureID framenum;
DWORD min, max;
framenum = ParseFramenum (sc, picnum, usetype, missing);
ParseTime (sc, min, max);
if (picnum >= 0)
if (picnum.isValid())
{
FAnimDef::FAnimFrame frame;
@ -595,20 +596,20 @@ static void ParsePicAnim (FScanner &sc, int picnum, int usetype, bool missing, T
//
//==========================================================================
static int ParseFramenum (FScanner &sc, int basepicnum, int usetype, bool allowMissing)
static FTextureID ParseFramenum (FScanner &sc, FTextureID basepicnum, int usetype, bool allowMissing)
{
const BITFIELD texflags = FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny;
int framenum;
FTextureID framenum;
sc.MustGetString ();
if (IsNum (sc.String))
{
framenum = basepicnum + atoi(sc.String) - 1;
framenum = basepicnum + (atoi(sc.String) - 1);
}
else
{
framenum = TexMan.CheckForTexture (sc.String, usetype, texflags);
if (framenum < 0 && !allowMissing)
if (!framenum.Exists() && !allowMissing)
{
sc.ScriptError ("Unknown texture %s", sc.String);
}

View file

@ -49,6 +49,7 @@
#include "r_state.h"
#include "r_bsp.h"
#include "v_palette.h"
#include "r_sky.h"
int WallMost (short *mostbuf, const secplane_t &plane);
@ -728,8 +729,8 @@ void R_AddLine (seg_t *line)
&& rw_backcz1 <= rw_backfz1 && rw_backcz2 <= rw_backfz2
// preserve a kind of transparent door/lift special effect:
&& ((rw_backcz1 >= rw_frontcz1 && rw_backcz2 >= rw_frontcz2) || line->sidedef->GetTexture(side_t::top) != 0)
&& ((rw_backfz1 <= rw_frontfz1 && rw_backfz2 <= rw_frontfz2) || line->sidedef->GetTexture(side_t::bottom) != 0))
&& ((rw_backcz1 >= rw_frontcz1 && rw_backcz2 >= rw_frontcz2) || line->sidedef->GetTexture(side_t::top).isValid())
&& ((rw_backfz1 <= rw_frontfz1 && rw_backfz2 <= rw_frontfz2) || line->sidedef->GetTexture(side_t::bottom).isValid()))
{
// killough 1/18/98 -- This function is used to fix the automap bug which
// showed lines behind closed doors simply because the door had a dropoff.
@ -751,7 +752,7 @@ void R_AddLine (seg_t *line)
else if (backsector->lightlevel != frontsector->lightlevel
|| backsector->floorpic != frontsector->floorpic
|| backsector->ceilingpic != frontsector->ceilingpic
|| curline->sidedef->GetTexture(side_t::mid) != 0
|| curline->sidedef->GetTexture(side_t::mid).isValid()
// killough 3/7/98: Take flats offsets into account:
|| backsector->GetXOffset(sector_t::floor) != frontsector->GetXOffset(sector_t::floor)
@ -1046,15 +1047,14 @@ void R_Subsector (subsector_t *sub)
!(frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) &&
frontsector->heightsec->floorpic == skyflatnum) ?
R_FindPlane(frontsector->ceilingplane, // killough 3/8/98
frontsector->ceilingpic == skyflatnum && // killough 10/98
frontsector->sky & PL_SKYFLAT ? frontsector->sky :
frontsector->ceilingpic,
frontsector->ceilingpic,
ceilinglightlevel + r_actualextralight, // killough 4/11/98
frontsector->GetXOffset(sector_t::ceiling), // killough 3/7/98
frontsector->GetYOffset(sector_t::ceiling), // killough 3/7/98
frontsector->GetXScale(sector_t::ceiling),
frontsector->GetYScale(sector_t::ceiling),
frontsector->GetAngle(sector_t::ceiling),
frontsector->sky,
frontsector->CeilingSkyBox
) : NULL;
@ -1071,15 +1071,14 @@ void R_Subsector (subsector_t *sub)
!(frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) &&
frontsector->heightsec->ceilingpic == skyflatnum) ?
R_FindPlane(frontsector->floorplane,
frontsector->floorpic == skyflatnum && // killough 10/98
frontsector->sky & PL_SKYFLAT ? frontsector->sky :
frontsector->floorpic,
frontsector->floorpic,
floorlightlevel + r_actualextralight, // killough 3/16/98
frontsector->GetXOffset(sector_t::floor), // killough 3/7/98
frontsector->GetYOffset(sector_t::floor), // killough 3/7/98
frontsector->GetXScale(sector_t::floor),
frontsector->GetYScale(sector_t::floor),
frontsector->GetAngle(sector_t::floor),
frontsector->sky,
frontsector->FloorSkyBox
) : NULL;

View file

@ -443,10 +443,10 @@ void R_PrecacheLevel (void)
for (k = 0; k < 16; k++)
{
int pic = frame->Texture[k];
if (pic != 0xFFFF)
FTextureID pic = frame->Texture[k];
if (pic.isValid())
{
hitlist[pic] = 1;
hitlist[pic.GetIndex()] = 1;
}
}
}
@ -457,14 +457,14 @@ void R_PrecacheLevel (void)
for (i = numsectors - 1; i >= 0; i--)
{
hitlist[sectors[i].floorpic] = hitlist[sectors[i].ceilingpic] |= 2;
hitlist[sectors[i].floorpic.GetIndex()] = hitlist[sectors[i].ceilingpic.GetIndex()] |= 2;
}
for (i = numsides - 1; i >= 0; i--)
{
hitlist[sides[i].GetTexture(side_t::top)] =
hitlist[sides[i].GetTexture(side_t::mid)] =
hitlist[sides[i].GetTexture(side_t::bottom)] |= 1;
hitlist[sides[i].GetTexture(side_t::top).GetIndex()] =
hitlist[sides[i].GetTexture(side_t::mid).GetIndex()] =
hitlist[sides[i].GetTexture(side_t::bottom).GetIndex()] |= 1;
}
// Sky texture is always present.
@ -474,18 +474,18 @@ void R_PrecacheLevel (void)
// a wall texture, with an episode dependant
// name.
if (sky1texture >= 0)
if (sky1texture.isValid())
{
hitlist[sky1texture] |= 1;
hitlist[sky1texture.GetIndex()] |= 1;
}
if (sky2texture >= 0)
if (sky2texture.isValid())
{
hitlist[sky2texture] |= 1;
hitlist[sky2texture.GetIndex()] |= 1;
}
for (i = TexMan.NumTextures() - 1; i >= 0; i--)
{
screen->PrecacheTexture(TexMan[i], hitlist[i]);
screen->PrecacheTexture(TexMan.ByIndex(i), hitlist[i]);
}
delete[] hitlist;
@ -516,8 +516,8 @@ CCMD (printspans)
if (argv.argc() != 2)
return;
int picnum = TexMan.CheckForTexture (argv[1], FTexture::TEX_Any);
if (picnum < 0)
FTextureID picnum = TexMan.CheckForTexture (argv[1], FTexture::TEX_Any);
if (!picnum.Exists())
{
Printf ("Unknown texture %s\n", argv[1]);
return;
@ -539,7 +539,7 @@ CCMD (printspans)
CCMD (picnum)
{
int picnum = TexMan.GetTexture (argv[1], FTexture::TEX_Any);
Printf ("%d: %s - %s\n", picnum, TexMan[picnum]->Name, TexMan(picnum)->Name);
//int picnum = TexMan.GetTexture (argv[1], FTexture::TEX_Any);
//Printf ("%d: %s - %s\n", picnum, TexMan[picnum]->Name, TexMan(picnum)->Name);
}
#endif

View file

@ -109,10 +109,10 @@ struct FCanvasTextureInfo
FCanvasTextureInfo *Next;
TObjPtr<AActor> Viewpoint;
FCanvasTexture *Texture;
int PicNum;
FTextureID PicNum;
int FOV;
static void Add (AActor *viewpoint, int picnum, int fov);
static void Add (AActor *viewpoint, FTextureID picnum, int fov);
static void UpdateAll ();
static void EmptyList ();
static void Serialize (FArchive &arc);

View file

@ -55,9 +55,6 @@ enum
extern size_t MaxDrawSegs;
//
// INTERNAL MAP TYPES
// used by play and refresh
@ -257,6 +254,11 @@ enum
SECF_FLOORDROP = 4, // all actors standing on this floor will remain on it when it lowers very fast.
};
enum
{
PL_SKYFLAT = 0x40000000
};
struct FDynamicColormap;
struct FLightStack
@ -471,7 +473,7 @@ struct sector_t
BYTE FloorLight, CeilingLight;
BYTE FloorFlags, CeilingFlags;
int floorpic, ceilingpic;
FTextureID floorpic, ceilingpic;
BYTE lightlevel;
TObjPtr<AActor> SoundTarget;
@ -588,7 +590,7 @@ struct side_t
{
fixed_t xoffset;
fixed_t yoffset;
int texture;
FTextureID texture;
TObjPtr<DInterpolation> interpolation;
//int Light;
};
@ -609,11 +611,11 @@ struct side_t
Light = l;
}
int GetTexture(int which) const
FTextureID GetTexture(int which) const
{
return textures[which].texture;
}
void SetTexture(int which, int tex)
void SetTexture(int which, FTextureID tex)
{
textures[which].texture = tex;
}
@ -830,292 +832,6 @@ struct column_t
typedef BYTE lighttable_t; // This could be wider for >8 bit display.
// Patches.
// A patch holds one or more columns.
// Patches are used for sprites and all masked pictures, and we compose
// textures from the TEXTURE1/2 lists of patches.
struct patch_t
{
SWORD width; // bounding box size
SWORD height;
SWORD leftoffset; // pixels to the left of origin
SWORD topoffset; // pixels below the origin
DWORD columnofs[8]; // only [width] used
// the [0] is &columnofs[width]
};
class FileReader;
// All FTextures present their data to the world in 8-bit format, but if
// the source data is something else, this is it.
enum FTextureFormat
{
TEX_Pal,
TEX_Gray,
TEX_RGB, // Actually ARGB
TEX_DXT1,
TEX_DXT2,
TEX_DXT3,
TEX_DXT4,
TEX_DXT5,
};
class FNativeTexture;
// Base texture class
class FTexture
{
public:
static FTexture *CreateTexture(int lumpnum, int usetype);
virtual ~FTexture ();
SWORD LeftOffset, TopOffset;
BYTE WidthBits, HeightBits;
fixed_t xScale;
fixed_t yScale;
char Name[9];
BYTE UseType; // This texture's primary purpose
BYTE bNoDecals:1; // Decals should not stick to texture
BYTE bNoRemap0:1; // Do not remap color 0 (used by front layer of parallax skies)
BYTE bWorldPanning:1; // Texture is panned in world units rather than texels
BYTE bMasked:1; // Texture (might) have holes
BYTE bAlphaTexture:1; // Texture is an alpha channel without color information
BYTE bHasCanvas:1; // Texture is based off FCanvasTexture
BYTE bWarped:2; // This is a warped texture. Used to avoid multiple warps on one texture
BYTE bComplex:1; // Will be used to mark extended MultipatchTextures that have to be
// fully composited before subjected to any kinf of postprocessing instead of
// doing it per patch.
WORD Rotations;
enum // UseTypes
{
TEX_Any,
TEX_Wall,
TEX_Flat,
TEX_Sprite,
TEX_WallPatch,
TEX_Build,
TEX_SkinSprite,
TEX_Decal,
TEX_MiscPatch,
TEX_FontChar,
TEX_Override, // For patches between TX_START/TX_END
TEX_Autopage, // Automap background - used to enable the use of FAutomapTexture
TEX_Null,
TEX_FirstDefined,
};
struct Span
{
WORD TopOffset;
WORD Length; // A length of 0 terminates this column
};
// Returns a single column of the texture
virtual const BYTE *GetColumn (unsigned int column, const Span **spans_out) = 0;
// Returns the whole texture, stored in column-major order
virtual const BYTE *GetPixels () = 0;
virtual int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate=0, FCopyInfo *inf = NULL);
int CopyTrueColorTranslated(FBitmap *bmp, int x, int y, int rotate, FRemapTable *remap, FCopyInfo *inf = NULL);
virtual bool UseBasePalette();
virtual int GetSourceLump() { return -1; }
virtual void Unload () = 0;
// Returns the native pixel format for this image
virtual FTextureFormat GetFormat();
// Returns a native 3D representation of the texture
FNativeTexture *GetNative(bool wrapping);
// Frees the native 3D representation of the texture
void KillNative();
// Fill the native texture buffer with pixel data for this image
virtual void FillBuffer(BYTE *buff, int pitch, int height, FTextureFormat fmt);
int GetWidth () { return Width; }
int GetHeight () { return Height; }
int GetScaledWidth () { int foo = (Width << 17) / xScale; return (foo >> 1) + (foo & 1); }
int GetScaledHeight () { int foo = (Height << 17) / yScale; return (foo >> 1) + (foo & 1); }
int GetScaledLeftOffset () { int foo = (LeftOffset << 17) / xScale; return (foo >> 1) + (foo & 1); }
int GetScaledTopOffset () { int foo = (TopOffset << 17) / yScale; return (foo >> 1) + (foo & 1); }
virtual void SetFrontSkyLayer();
void CopyToBlock (BYTE *dest, int dwidth, int dheight, int x, int y, const BYTE *translation=NULL)
{
CopyToBlock(dest, dwidth, dheight, x, y, 0, translation);
}
void CopyToBlock (BYTE *dest, int dwidth, int dheight, int x, int y, int rotate, const BYTE *translation=NULL);
// Returns true if the next call to GetPixels() will return an image different from the
// last call to GetPixels(). This should be considered valid only if a call to CheckModified()
// is immediately followed by a call to GetPixels().
virtual bool CheckModified ();
static void InitGrayMap();
void CopySize(FTexture *BaseTexture)
{
Width = BaseTexture->GetWidth();
Height = BaseTexture->GetHeight();
TopOffset = BaseTexture->TopOffset;
LeftOffset = BaseTexture->LeftOffset;
WidthBits = BaseTexture->WidthBits;
HeightBits = BaseTexture->HeightBits;
xScale = BaseTexture->xScale;
yScale = BaseTexture->yScale;
WidthMask = (1 << WidthBits) - 1;
}
void SetScaledSize(int fitwidth, int fitheight)
{
xScale = DivScale16(Width, fitwidth);
yScale = DivScale16(Height,fitheight);
// compensate for roundoff errors
if (MulScale16(xScale, fitwidth) != Width) xScale++;
if (MulScale16(yScale, fitheight) != Height) yScale++;
}
virtual void HackHack (int newheight); // called by FMultipatchTexture to discover corrupt patches.
protected:
WORD Width, Height, WidthMask;
static BYTE GrayMap[256];
FNativeTexture *Native;
FTexture ();
Span **CreateSpans (const BYTE *pixels) const;
void FreeSpans (Span **spans) const;
void CalcBitSize ();
static void FlipSquareBlock (BYTE *block, int x, int y);
static void FlipSquareBlockRemap (BYTE *block, int x, int y, const BYTE *remap);
static void FlipNonSquareBlock (BYTE *blockto, const BYTE *blockfrom, int x, int y, int srcpitch);
static void FlipNonSquareBlockRemap (BYTE *blockto, const BYTE *blockfrom, int x, int y, int srcpitch, const BYTE *remap);
friend class D3DTex;
};
// Texture manager
class FTextureManager
{
public:
FTextureManager ();
~FTextureManager ();
// Get texture without translation
FTexture *operator[] (int texnum)
{
if ((size_t)texnum >= Textures.Size()) return NULL;
return Textures[texnum].Texture;
}
FTexture *operator[] (const char *texname)
{
int texnum = GetTexture (texname, FTexture::TEX_MiscPatch);
if (texnum==-1) return NULL;
return Textures[texnum].Texture;
}
FTexture *FindTexture(const char *texname, int usetype = FTexture::TEX_MiscPatch, BITFIELD flags = TEXMAN_TryAny);
// Get texture with translation
FTexture *operator() (int texnum)
{
if ((size_t)texnum >= Textures.Size()) return NULL;
return Textures[Translation[texnum]].Texture;
}
FTexture *operator() (const char *texname)
{
int texnum = GetTexture (texname, FTexture::TEX_MiscPatch);
if (texnum==-1) return NULL;
return Textures[Translation[texnum]].Texture;
}
void SetTranslation (int fromtexnum, int totexnum)
{
if ((size_t)fromtexnum < Translation.Size())
{
if ((size_t)totexnum >= Textures.Size())
{
totexnum = fromtexnum;
}
Translation[fromtexnum] = totexnum;
}
}
enum
{
TEXMAN_TryAny = 1,
TEXMAN_Overridable = 2,
TEXMAN_ReturnFirst = 4,
};
int CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny);
int GetTexture (const char *name, int usetype, BITFIELD flags=0);
int ListTextures (const char *name, TArray<int> &list);
void WriteTexture (FArchive &arc, int picnum);
int ReadTexture (FArchive &arc);
void AddTexturesLump (const void *lumpdata, int lumpsize, int deflumpnum, int patcheslump, int firstdup=0, bool texture1=false);
void AddTexturesLumps (int lump1, int lump2, int patcheslump);
void AddGroup(int wadnum, const char * startlump, const char * endlump, int ns, int usetype);
void AddPatches (int lumpnum);
void AddTiles (void *tileFile);
void AddHiresTextures (int wadnum);
void LoadTextureDefs(int wadnum, const char *lumpname);
void ParseXTexture(FScanner &sc, int usetype);
void SortTexturesByType(int start, int end);
int CreateTexture (int lumpnum, int usetype=FTexture::TEX_Any); // Also calls AddTexture
int AddTexture (FTexture *texture);
int AddPatch (const char *patchname, int namespc=0, bool tryany = false);
void LoadTextureX(int wadnum);
void AddTexturesForWad(int wadnum);
void Init();
// Replaces one texture with another. The new texture will be assigned
// the same name, slot, and use type as the texture it is replacing.
// The old texture will no longer be managed. Set free true if you want
// the old texture to be deleted or set it false if you want it to
// be left alone in memory. You will still need to delete it at some
// point, because the texture manager no longer knows about it.
// This function can be used for such things as warping textures.
void ReplaceTexture (int picnum, FTexture *newtexture, bool free);
void UnloadAll ();
int NumTextures () const { return (int)Textures.Size(); }
private:
struct TextureHash
{
FTexture *Texture;
int HashNext;
};
enum { HASH_END = -1, HASH_SIZE = 1027 };
TArray<TextureHash> Textures;
TArray<int> Translation;
int HashFirst[HASH_SIZE];
int DefaultTexture;
};
extern FTextureManager TexMan;
// A vissprite_t is a thing
// that will be drawn during a refresh.
@ -1164,7 +880,7 @@ enum
//
struct spriteframe_t
{
WORD Texture[16]; // texture to use for view angles 0-15
FTextureID Texture[16]; // texture to use for view angles 0-15
WORD Flip; // flip (1 = flip) to use for view angles 0-15.
};

View file

@ -1819,7 +1819,7 @@ void tmvline4_revsubclamp ()
void R_DrawBorder (int x1, int y1, int x2, int y2)
{
int picnum;
FTextureID picnum;
if (level.info != NULL)
{
@ -1830,7 +1830,7 @@ void R_DrawBorder (int x1, int y1, int x2, int y2)
picnum = TexMan.CheckForTexture (gameinfo.borderFlat, FTexture::TEX_Flat);
}
if (picnum >= 0)
if (picnum.isValid())
{
screen->FlatFill (x1, y1, x2, y2, TexMan(picnum));
}

View file

@ -46,7 +46,7 @@
// r_anim.cpp
void R_InitPicAnims ();
void R_AddSimpleAnim (int picnum, int animcount, int animtype, DWORD animspeed /* in ms */, DWORD speedrange=0);
void R_AddSimpleAnim (FTextureID picnum, int animcount, int animtype, DWORD animspeed /* in ms */, DWORD speedrange=0);
void R_UpdateAnimations (DWORD mstime);
#endif // __R_LOCAL_H__

View file

@ -1629,12 +1629,12 @@ void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas,
//
//==========================================================================
void FCanvasTextureInfo::Add (AActor *viewpoint, int picnum, int fov)
void FCanvasTextureInfo::Add (AActor *viewpoint, FTextureID picnum, int fov)
{
FCanvasTextureInfo *probe;
FCanvasTexture *texture;
if (picnum < 0)
if (!picnum.isValid())
{
return;
}
@ -1730,8 +1730,7 @@ void FCanvasTextureInfo::Serialize (FArchive &arc)
{
if (probe->Texture != NULL && probe->Viewpoint != NULL)
{
arc << probe->Viewpoint << probe->FOV;
TexMan.WriteTexture (arc, probe->PicNum);
arc << probe->Viewpoint << probe->FOV << probe->PicNum;
}
}
AActor *nullactor = NULL;
@ -1740,16 +1739,14 @@ void FCanvasTextureInfo::Serialize (FArchive &arc)
else
{
AActor *viewpoint;
int picnum, fov;
int fov;
FTextureID picnum;
EmptyList ();
arc << viewpoint;
while (viewpoint != NULL)
while (arc << viewpoint, viewpoint != NULL)
{
arc << fov;
picnum = TexMan.ReadTexture (arc);
arc << fov << picnum;
Add (viewpoint, picnum, fov);
arc << viewpoint;
}
}
}

View file

@ -513,17 +513,17 @@ static visplane_t *new_visplane (unsigned hash)
// killough 2/28/98: Add offsets
//==========================================================================
visplane_t *R_FindPlane (const secplane_t &height, int picnum, int lightlevel,
visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightlevel,
fixed_t xoffs, fixed_t yoffs,
fixed_t xscale, fixed_t yscale, angle_t angle,
ASkyViewpoint *skybox)
int sky, ASkyViewpoint *skybox)
{
secplane_t plane;
visplane_t *check;
unsigned hash; // killough
bool isskybox;
if (picnum == skyflatnum || picnum & PL_SKYFLAT) // killough 10/98
if (picnum == skyflatnum) // killough 10/98
{ // most skies map together
lightlevel = 0;
xoffs = 0;
@ -550,10 +550,11 @@ visplane_t *R_FindPlane (const secplane_t &height, int picnum, int lightlevel,
{
plane = height;
isskybox = false;
sky = 0; // not skyflatnum so it can't be a sky
}
// New visplane algorithm uses hash table -- killough
hash = isskybox ? MAXVISPLANES : visplane_hash (picnum, lightlevel, height);
hash = isskybox ? MAXVISPLANES : visplane_hash (picnum.GetIndex(), lightlevel, height);
for (check = visplanes[hash]; check; check = check->next) // killough
{
@ -589,7 +590,8 @@ visplane_t *R_FindPlane (const secplane_t &height, int picnum, int lightlevel,
basecolormap == check->colormap && // [RH] Add more checks
xscale == check->xscale &&
yscale == check->yscale &&
angle == check->angle
angle == check->angle &&
sky == check->sky
)
{
return check;
@ -607,6 +609,7 @@ visplane_t *R_FindPlane (const secplane_t &height, int picnum, int lightlevel,
check->yscale = yscale;
check->angle = angle;
check->colormap = basecolormap; // [RH] Save colormap
check->sky = sky;
check->skybox = skybox;
check->minx = viewwidth; // Was SCREENWIDTH -- killough 11/98
check->maxx = -1;
@ -679,7 +682,7 @@ visplane_t *R_CheckPlane (visplane_t *pl, int start, int stop)
}
else
{
hash = visplane_hash (pl->picnum, pl->lightlevel, pl->height);
hash = visplane_hash (pl->picnum.GetIndex(), pl->lightlevel, pl->height);
}
visplane_t *new_pl = new_visplane (hash);
@ -951,7 +954,7 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool masked)
ds_color += 4;
R_MapVisPlane (pl, R_MapColoredPlane);
}
else if (pl->picnum == skyflatnum || pl->picnum & PL_SKYFLAT)
else if (pl->picnum == skyflatnum)
{ // sky flat
R_DrawSkyPlane (pl);
}
@ -1238,7 +1241,7 @@ ADD_STAT(skyboxes)
void R_DrawSkyPlane (visplane_t *pl)
{
int sky1tex, sky2tex;
FTextureID sky1tex, sky2tex;
if ((level.flags & LEVEL_SWAPSKIES) && !(level.flags & LEVEL_DOUBLESKY))
{
@ -1251,66 +1254,69 @@ void R_DrawSkyPlane (visplane_t *pl)
sky2tex = sky2texture;
if (pl->picnum == skyflatnum)
{ // use sky1
sky1:
frontskytex = TexMan(sky1tex);
if (level.flags & LEVEL_DOUBLESKY)
backskytex = TexMan(sky2tex);
else
{
if (!(pl->sky & PL_SKYFLAT))
{ // use sky1
sky1:
frontskytex = TexMan(sky1tex);
if (level.flags & LEVEL_DOUBLESKY)
backskytex = TexMan(sky2tex);
else
backskytex = NULL;
skyflip = 0;
frontpos = sky1pos;
backpos = sky2pos;
}
else if (pl->sky == PL_SKYFLAT)
{ // use sky2
frontskytex = TexMan(sky2tex);
backskytex = NULL;
skyflip = 0;
frontpos = sky1pos;
backpos = sky2pos;
}
else if (pl->picnum == PL_SKYFLAT)
{ // use sky2
frontskytex = TexMan(sky2tex);
backskytex = NULL;
skyflip = 0;
frontpos = sky2pos;
}
else
{ // MBF's linedef-controlled skies
// Sky Linedef
const line_t *l = &lines[(pl->picnum & ~PL_SKYFLAT)-1];
// Sky transferred from first sidedef
const side_t *s = *l->sidenum + sides;
int pos;
// Texture comes from upper texture of reference sidedef
// [RH] If swapping skies, then use the lower sidedef
if (level.flags & LEVEL_SWAPSKIES && s->GetTexture(side_t::bottom) != 0)
{
pos = side_t::bottom;
skyflip = 0;
frontpos = sky2pos;
}
else
{
pos = side_t::top;
{ // MBF's linedef-controlled skies
// Sky Linedef
const line_t *l = &lines[(pl->sky & ~PL_SKYFLAT)-1];
// Sky transferred from first sidedef
const side_t *s = *l->sidenum + sides;
int pos;
// Texture comes from upper texture of reference sidedef
// [RH] If swapping skies, then use the lower sidedef
if (level.flags & LEVEL_SWAPSKIES && s->GetTexture(side_t::bottom).isValid())
{
pos = side_t::bottom;
}
else
{
pos = side_t::top;
}
frontskytex = TexMan(s->GetTexture(pos));
if (frontskytex->UseType == FTexture::TEX_Null)
{ // [RH] The blank texture: Use normal sky instead.
goto sky1;
}
backskytex = NULL;
// Horizontal offset is turned into an angle offset,
// to allow sky rotation as well as careful positioning.
// However, the offset is scaled very small, so that it
// allows a long-period of sky rotation.
frontpos = (-s->GetTextureXOffset(pos)) >> 6;
// Vertical offset allows careful sky positioning.
dc_texturemid = s->GetTextureYOffset(pos) - 28*FRACUNIT;
// We sometimes flip the picture horizontally.
//
// Doom always flipped the picture, so we make it optional,
// to make it easier to use the new feature, while to still
// allow old sky textures to be used.
skyflip = l->args[2] ? 0u : ~0u;
}
frontskytex = TexMan(s->GetTexture(pos));
if (frontskytex->UseType == FTexture::TEX_Null)
{ // [RH] The blank texture: Use normal sky instead.
goto sky1;
}
backskytex = NULL;
// Horizontal offset is turned into an angle offset,
// to allow sky rotation as well as careful positioning.
// However, the offset is scaled very small, so that it
// allows a long-period of sky rotation.
frontpos = (-s->GetTextureXOffset(pos)) >> 6;
// Vertical offset allows careful sky positioning.
dc_texturemid = s->GetTextureYOffset(pos) - 28*FRACUNIT;
// We sometimes flip the picture horizontally.
//
// Doom always flipped the picture, so we make it optional,
// to make it easier to use the new feature, while to still
// allow old sky textures to be used.
skyflip = l->args[2] ? 0u : ~0u;
}
bool fakefixed = false;

View file

@ -36,13 +36,14 @@ struct visplane_s
struct visplane_s *next; // Next visplane in hash chain -- killough
secplane_t height;
int picnum;
FTextureID picnum;
int lightlevel;
fixed_t xoffs, yoffs; // killough 2/28/98: Support scrolling flats
int minx, maxx;
FDynamicColormap *colormap; // [RH] Support multiple colormaps
fixed_t xscale, yscale; // [RH] Support flat scaling
angle_t angle; // [RH] Support flat rotation
int sky;
ASkyViewpoint *skybox; // [RH] Support sky boxes
// [RH] This set of variables copies information from the time when the
@ -62,9 +63,6 @@ typedef struct visplane_s visplane_t;
// killough 10/98: special mask indicates sky flat comes from sidedef
#define PL_SKYFLAT 0x10000
// Visplane related.
extern ptrdiff_t lastopening; // type short
@ -92,13 +90,14 @@ void R_MapVisPlane (visplane_t *pl, void (*mapfunc)(int y, int x1));
visplane_t *R_FindPlane
( const secplane_t &height,
int picnum,
FTextureID picnum,
int lightlevel,
fixed_t xoffs, // killough 2/28/98: add x-y offsets
fixed_t yoffs,
fixed_t xscale,
fixed_t yscale,
angle_t angle,
int sky,
ASkyViewpoint *skybox);
visplane_t *R_CheckPlane (visplane_t *pl, int start, int stop);

View file

@ -76,6 +76,7 @@ Low priority:
#include "r_main.h"
#include "r_draw.h"
#include "templates.h"
#include "r_sky.h"
EXTERN_CVAR (Int, r_polymost)
@ -1275,7 +1276,7 @@ void RP_AddLine (seg_t *line)
// preserve a kind of transparent door/lift special effect:
&& bcz0 >= fcz0 && bcz1 >= fcz1
&& ((bfz0 <= ffz0 && bfz1 <= ffz1) || line->sidedef->GetTexture(side_t::bottom) != 0))
&& ((bfz0 <= ffz0 && bfz1 <= ffz1) || line->sidedef->GetTexture(side_t::bottom).isValid()))
{
// killough 1/18/98 -- This function is used to fix the automap bug which
// showed lines behind closed doors simply because the door had a dropoff.
@ -1297,7 +1298,7 @@ void RP_AddLine (seg_t *line)
else if (backsector->lightlevel != frontsector->lightlevel
|| backsector->floorpic != frontsector->floorpic
|| backsector->ceilingpic != frontsector->ceilingpic
|| curline->sidedef->GetTexture(side_t::mid) != 0
|| curline->sidedef->GetTexture(side_t::mid).isValid()
// killough 3/7/98: Take flats offsets into account:
|| backsector->GetXOffset(sector_t::floor) != frontsector->GetXOffset(sector_t::floor)
@ -1416,15 +1417,14 @@ void RP_Subsector (subsector_t *sub)
!(frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) &&
frontsector->heightsec->floorpic == skyflatnum) ?
R_FindPlane(frontsector->ceilingplane, // killough 3/8/98
frontsector->ceilingpic == skyflatnum && // killough 10/98
frontsector->sky & PL_SKYFLAT ? frontsector->sky :
frontsector->ceilingpic,
frontsector->ceilingpic,
ceilinglightlevel + r_actualextralight, // killough 4/11/98
frontsector->ceiling_xoffs, // killough 3/7/98
frontsector->ceiling_yoffs + frontsector->base_ceiling_yoffs,
frontsector->ceiling_xscale,
frontsector->ceiling_yscale,
frontsector->ceiling_angle + frontsector->base_ceiling_angle,
frontsector->sky,
frontsector->CeilingSkyBox
) : NULL;*/
@ -1441,15 +1441,14 @@ void RP_Subsector (subsector_t *sub)
!(frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) &&
frontsector->heightsec->ceilingpic == skyflatnum) ?
R_FindPlane(frontsector->floorplane,
frontsector->floorpic == skyflatnum && // killough 10/98
frontsector->sky & PL_SKYFLAT ? frontsector->sky :
frontsector->floorpic,
frontsector->floorpic,
floorlightlevel + r_actualextralight, // killough 3/16/98
frontsector->floor_xoffs, // killough 3/7/98
frontsector->floor_yoffs + frontsector->base_floor_yoffs,
frontsector->floor_xscale,
frontsector->floor_yscale,
frontsector->floor_angle + frontsector->base_floor_angle,
frontsector->sky,
frontsector->FloorSkyBox
) : NULL;*/

View file

@ -1286,7 +1286,7 @@ void R_NewWall (bool needlights)
|| backsector->GetAngle(sector_t::floor) != frontsector->GetAngle(sector_t::floor)
|| (sidedef->GetTexture(side_t::mid) && linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX))
|| (sidedef->GetTexture(side_t::mid).isValid() && linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX))
;
markceiling = (frontsector->ceilingpic != skyflatnum ||
@ -1315,7 +1315,7 @@ void R_NewWall (bool needlights)
|| backsector->GetAngle(sector_t::ceiling) != frontsector->GetAngle(sector_t::ceiling)
|| (sidedef->GetTexture(side_t::mid) && linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX))
|| (sidedef->GetTexture(side_t::mid).isValid() && linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX))
);
}
@ -1583,8 +1583,8 @@ void R_StoreWallRange (int start, int stop)
// allocate space for masked texture tables, if needed
// [RH] Don't just allocate the space; fill it in too.
if ((TexMan(sidedef->GetTexture(side_t::mid))->UseType != FTexture::TEX_Null || IsFogBoundary (frontsector, backsector)) &&
(rw_ceilstat != 12 || sidedef->GetTexture(side_t::top) == 0) &&
(rw_floorstat != 3 || sidedef->GetTexture(side_t::bottom) == 0) &&
(rw_ceilstat != 12 || !sidedef->GetTexture(side_t::top).isValid()) &&
(rw_floorstat != 3 || !sidedef->GetTexture(side_t::bottom).isValid()) &&
(WallSZ1 >= TOO_CLOSE_Z && WallSZ2 >= TOO_CLOSE_Z))
{
fixed_t *swal;
@ -1594,7 +1594,7 @@ void R_StoreWallRange (int start, int stop)
maskedtexture = true;
ds_p->bFogBoundary = IsFogBoundary (frontsector, backsector);
if (sidedef->GetTexture(side_t::mid) != 0)
if (sidedef->GetTexture(side_t::mid).isValid())
{
ds_p->maskedtexturecol = R_NewOpening ((stop - start) * 2);
ds_p->swall = R_NewOpening ((stop - start) * 2);
@ -1681,7 +1681,7 @@ void R_StoreWallRange (int start, int stop)
memcpy (openings + ds_p->sprbottomclip, &floorclip[start], sizeof(short)*(stop-start));
}
if (maskedtexture && curline->sidedef->GetTexture(side_t::mid) != 0)
if (maskedtexture && curline->sidedef->GetTexture(side_t::mid).isValid())
{
ds_p->silhouette |= SIL_TOP | SIL_BOTTOM;
}
@ -2130,7 +2130,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
int needrepeat = 0;
sector_t *front, *back;
if (decal->RenderFlags & RF_INVISIBLE || !viewactive || decal->PicNum == 0xFFFF)
if (decal->RenderFlags & RF_INVISIBLE || !viewactive || !decal->PicNum.isValid())
return;
// Determine actor z

View file

@ -39,8 +39,8 @@
//
// sky mapping
//
int skyflatnum;
int sky1texture, sky2texture;
FTextureID skyflatnum;
FTextureID sky1texture, sky2texture;
fixed_t skytexturemid;
fixed_t skyscale;
int skystretch;

View file

@ -22,9 +22,12 @@
#ifndef __R_SKY_H__
#define __R_SKY_H__
#include "textures/textures.h"
extern int sky1shift, sky2shift;
extern int sky1texture, sky2texture;
extern FTextureID skyflatnum;
extern FTextureID sky1texture, sky2texture;
extern fixed_t sky1pos, sky2pos;
extern fixed_t skytexturemid;
extern int skystretch;

View file

@ -43,6 +43,7 @@
#include "s_sound.h"
#include "sbar.h"
#include "gi.h"
#include "r_sky.h"
extern FTexture *CrosshairImage;
extern fixed_t globaluclip, globaldclip;
@ -121,7 +122,7 @@ CVAR (Bool, r_particles, true, 0);
// [RH] Removed checks for coexistance of rotation 0 with other
// rotations and made it look more like BOOM's version.
//
static void R_InstallSpriteLump (int lump, unsigned frame, char rot, bool flipped)
static void R_InstallSpriteLump (FTextureID lump, unsigned frame, char rot, bool flipped)
{
unsigned rotation;
@ -153,9 +154,9 @@ static void R_InstallSpriteLump (int lump, unsigned frame, char rot, bool flippe
for (r = 14; r >= 0; r -= 2)
{
if (sprtemp[frame].Texture[r] == 0xFFFF)
if (!sprtemp[frame].Texture[r].isValid())
{
sprtemp[frame].Texture[r] = (short)(lump);
sprtemp[frame].Texture[r] = lump;
if (flipped)
{
sprtemp[frame].Flip |= 1 << r;
@ -175,7 +176,7 @@ static void R_InstallSpriteLump (int lump, unsigned frame, char rot, bool flippe
rotation = (rotation - 9) * 2 + 1;
}
if (sprtemp[frame].Texture[rotation] == 0xFFFF)
if (!sprtemp[frame].Texture[rotation].isValid())
{
// the lump is only used for one rotation
sprtemp[frame].Texture[rotation] = lump;
@ -245,7 +246,7 @@ static void R_InstallSprite (int num)
// must have all 8 frame pairs
for (rot = 0; rot < 8; ++rot)
{
if (sprtemp[frame].Texture[rot*2+1] == 0xFFFF)
if (!sprtemp[frame].Texture[rot*2+1].isValid())
{
sprtemp[frame].Texture[rot*2+1] = sprtemp[frame].Texture[rot*2];
if (sprtemp[frame].Flip & (1 << (rot*2)))
@ -253,7 +254,7 @@ static void R_InstallSprite (int num)
sprtemp[frame].Flip |= 1 << (rot*2+1);
}
}
if (sprtemp[frame].Texture[rot*2] == 0xFFFF)
if (!sprtemp[frame].Texture[rot*2].isValid())
{
sprtemp[frame].Texture[rot*2] = sprtemp[frame].Texture[rot*2+1];
if (sprtemp[frame].Flip & (1 << (rot*2+1)))
@ -265,7 +266,7 @@ static void R_InstallSprite (int num)
}
for (rot = 0; rot < 16; ++rot)
{
if (sprtemp[frame].Texture[rot] == 0xFFFF)
if (!sprtemp[frame].Texture[rot].isValid())
I_FatalError ("R_InstallSprite: Sprite %s frame %c is missing rotations",
sprites[num].name, frame+'A');
}
@ -323,7 +324,7 @@ void R_InitSpriteDefs ()
{
struct Hasher
{
WORD Head, Next;
int Head, Next;
} *hashes;
unsigned int i, max;
DWORD intname;
@ -333,11 +334,11 @@ void R_InitSpriteDefs ()
hashes = (Hasher *)alloca (sizeof(Hasher) * max);
for (i = 0; i < max; ++i)
{
hashes[i].Head = 0xFFFF;
hashes[i].Head = -1;
}
for (i = 0; i < max; ++i)
{
FTexture *tex = TexMan[i];
FTexture *tex = TexMan.ByIndex(i);
if (tex->UseType == FTexture::TEX_Sprite && strlen (tex->Name) >= 6)
{
DWORD bucket = *(DWORD *)tex->Name % max;
@ -358,20 +359,17 @@ void R_InitSpriteDefs ()
maxframe = -1;
intname = *(DWORD *)sprites[i].name;
if (intname == MAKE_ID('B','O','S','2'))
{
intname=intname;}
// scan the lumps, filling in the frames for whatever is found
int hash = hashes[intname % max].Head;
while (hash != 0xFFFF)
while (hash != -1)
{
FTexture *tex = TexMan[hash];
if (*(DWORD *)tex->Name == intname)
{
R_InstallSpriteLump (hash, tex->Name[4] - 'A', tex->Name[5], false);
R_InstallSpriteLump (FTextureID(hash), tex->Name[4] - 'A', tex->Name[5], false);
if (tex->Name[6])
R_InstallSpriteLump (hash, tex->Name[6] - 'A', tex->Name[7], true);
R_InstallSpriteLump (FTextureID(hash), tex->Name[6] - 'A', tex->Name[7], true);
}
hash = hashes[hash].Next;
}
@ -700,7 +698,7 @@ void R_InitSkins (void)
Wads.GetLumpName (lname, k);
if (*(DWORD *)lname == intname)
{
int picnum = TexMan.CreateTexture(k, FTexture::TEX_SkinSprite);
FTextureID picnum = TexMan.CreateTexture(k, FTexture::TEX_SkinSprite);
R_InstallSpriteLump (picnum, lname[4] - 'A', lname[5], false);
if (lname[6])
@ -1190,7 +1188,7 @@ void R_ProjectSprite (AActor *thing, int fakeside)
int x1;
int x2;
int picnum;
FTextureID picnum;
FTexture *tex;
WORD flip;
@ -1241,7 +1239,7 @@ void R_ProjectSprite (AActor *thing, int fakeside)
xscale = DivScale12 (centerxfrac, tz);
if (thing->picnum != 0xFFFF)
if (thing->picnum.isValid())
{
picnum = thing->picnum;
@ -1530,7 +1528,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
int x2;
spritedef_t* sprdef;
spriteframe_t* sprframe;
int picnum;
FTextureID picnum;
WORD flip;
FTexture* tex;
vissprite_t* vis;
@ -2374,8 +2372,8 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
const secplane_t *topplane;
const secplane_t *botplane;
int toppic;
int botpic;
FTextureID toppic;
FTextureID botpic;
if (heightsec) // only clip things which are in special sectors
{

View file

@ -893,6 +893,16 @@ DSeqNode *SN_StartSequence (sector_t *sec, int chan, const char *seqname, int mo
return NULL;
}
DSeqNode *SN_StartSequence (sector_t *sec, int chan, FName seqname, int modenum)
{
int seqnum = FindSequence (seqname);
if (seqnum >= 0)
{
return SN_StartSequence (sec, chan, seqnum, SEQ_NOTRANS, modenum);
}
return NULL;
}
DSeqNode *SN_StartSequence (FPolyObj *poly, const char *seqname, int modenum)
{
int seqnum = FindSequence (seqname);

View file

@ -84,6 +84,7 @@ DSeqNode *SN_StartSequence (AActor *mobj, const char *name, int modenum);
DSeqNode *SN_StartSequence (AActor *mobj, FName seqname, int modenum);
DSeqNode *SN_StartSequence (sector_t *sector, int chan, int sequence, seqtype_t type, int modenum, bool nostop=false);
DSeqNode *SN_StartSequence (sector_t *sector, int chan, const char *name, int modenum);
DSeqNode *SN_StartSequence (sector_t *sec, int chan, FName seqname, int modenum);
DSeqNode *SN_StartSequence (FPolyObj *poly, int sequence, seqtype_t type, int modenum, bool nostop=false);
DSeqNode *SN_StartSequence (FPolyObj *poly, const char *name, int modenum);
void SN_StopSequence (AActor *mobj);

View file

@ -1563,7 +1563,7 @@ FMOD_MODE FMODSoundRenderer::SetChanHeadSettings(FMOD::Channel *chan, sfxinfo_t
{
cz = MIN(sec->floorplane.ZatPoint(cx, cy), players[consoleplayer].camera->z);
}
else if (channum = CHAN_CEILING)
else if (channum == CHAN_CEILING)
{
cz = MAX(sec->ceilingplane.ZatPoint(cx, cy), players[consoleplayer].camera->z);
}

View file

@ -177,7 +177,7 @@ static void AddTiles (void *tiles)
int xoffs = (SBYTE)((anm >> 8) & 255) + width/2;
int yoffs = (SBYTE)((anm >> 16) & 255) + height/2;
int size = width*height;
int texnum;
FTextureID texnum;
FTexture *tex;
if (width <= 0 || height <= 0) continue;

View file

@ -780,7 +780,7 @@ FMultiPatchTexture::TexPart::TexPart()
void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int deflumpnum, int patcheslump, int firstdup, bool texture1)
{
FPatchLookup *patchlookup;
int i, j;
int i;
DWORD numpatches;
if (firstdup == 0)
@ -819,10 +819,10 @@ void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int d
pnames.Read (patchlookup[i].Name, 8);
patchlookup[i].Name[8] = 0;
j = CheckForTexture (patchlookup[i].Name, FTexture::TEX_WallPatch);
if (j >= 0)
FTextureID j = CheckForTexture (patchlookup[i].Name, FTexture::TEX_WallPatch);
if (j.isValid())
{
patchlookup[i].Texture = Textures[j].Texture;
patchlookup[i].Texture = Textures[j.GetIndex()].Texture;
}
else
{
@ -899,6 +899,7 @@ void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int d
// If this texture was defined already in this lump, skip it
// This could cause problems with animations that use the same name for intermediate
// textures. Should I be worried?
int j;
for (j = (int)Textures.Size() - 1; j >= firstdup; --j)
{
if (strnicmp (Textures[j].Texture->Name, (const char *)maptex + offset, 8) == 0)
@ -957,10 +958,10 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part)
FString patchname;
sc.MustGetString();
int texno = TexMan.CheckForTexture(sc.String, TEX_WallPatch);
FTextureID texno = TexMan.CheckForTexture(sc.String, TEX_WallPatch);
int Mirror = 0;
if (texno < 0)
if (!texno.isValid())
{
int lumpnum = Wads.CheckNumForFullName(sc.String);
if (lumpnum >= 0)

View file

@ -86,7 +86,7 @@ FTextureManager::~FTextureManager ()
//
//==========================================================================
int FTextureManager::CheckForTexture (const char *name, int usetype, BITFIELD flags)
FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITFIELD flags)
{
int i;
int firstfound = -1;
@ -94,14 +94,14 @@ int FTextureManager::CheckForTexture (const char *name, int usetype, BITFIELD fl
if (name == NULL || name[0] == '\0')
{
return -1;
return FTextureID(-1);
}
// [RH] Doom counted anything beginning with '-' as "no texture".
// Hopefully nobody made use of that and had textures like "-EMPTY",
// because -NOFLAT- is a valid graphic for ZDoom.
if (name[0] == '-' && name[1] == '\0')
{
return 0;
return FTextureID(0);
}
i = HashFirst[MakeKey (name) % HASH_SIZE];
@ -116,25 +116,25 @@ int FTextureManager::CheckForTexture (const char *name, int usetype, BITFIELD fl
{
// All NULL textures should actually return 0
if (tex->UseType == FTexture::TEX_FirstDefined && !(flags & TEXMAN_ReturnFirst)) return 0;
return tex->UseType==FTexture::TEX_Null? 0 : i;
return FTextureID(tex->UseType==FTexture::TEX_Null? 0 : i);
}
else if ((flags & TEXMAN_Overridable) && tex->UseType == FTexture::TEX_Override)
{
return i;
return FTextureID(i);
}
else if (tex->UseType == usetype)
{
return i;
return FTextureID(i);
}
else if (tex->UseType == FTexture::TEX_FirstDefined && usetype == FTexture::TEX_Wall)
{
if (!(flags & TEXMAN_ReturnFirst)) return 0;
else return i;
if (!(flags & TEXMAN_ReturnFirst)) return FTextureID(0);
else return FTextureID(i);
}
else if (tex->UseType == FTexture::TEX_Null && usetype == FTexture::TEX_Wall)
{
// We found a NULL texture on a wall -> return 0
return 0;
return FTextureID(0);
}
else
{
@ -155,13 +155,13 @@ int FTextureManager::CheckForTexture (const char *name, int usetype, BITFIELD fl
// Never return the index of NULL textures.
if (firstfound != -1)
{
if (firsttype == FTexture::TEX_Null) return 0;
if (firsttype == FTexture::TEX_FirstDefined && !(flags & TEXMAN_ReturnFirst)) return 0;
if (firsttype == FTexture::TEX_Null) return FTextureID(0);
if (firsttype == FTexture::TEX_FirstDefined && !(flags & TEXMAN_ReturnFirst)) return FTextureID(0);
}
return firstfound;
return FTextureID(firstfound);
}
return -1;
return FTextureID(-1);
}
//==========================================================================
@ -170,7 +170,7 @@ int FTextureManager::CheckForTexture (const char *name, int usetype, BITFIELD fl
//
//==========================================================================
int FTextureManager::ListTextures (const char *name, TArray<int> &list)
int FTextureManager::ListTextures (const char *name, TArray<FTextureID> &list)
{
int i;
@ -200,9 +200,9 @@ int FTextureManager::ListTextures (const char *name, TArray<int> &list)
for(j = 0; j < list.Size(); j++)
{
// Check for overriding definitions from newer WADs
if (Textures[list[j]].Texture->UseType == tex->UseType) break;
if (Textures[list[j].GetIndex()].Texture->UseType == tex->UseType) break;
}
if (j==list.Size()) list.Push(i);
if (j==list.Size()) list.Push(FTextureID(i));
}
}
i = Textures[i].HashNext;
@ -216,26 +216,26 @@ int FTextureManager::ListTextures (const char *name, TArray<int> &list)
//
//==========================================================================
int FTextureManager::GetTexture (const char *name, int usetype, BITFIELD flags)
FTextureID FTextureManager::GetTexture (const char *name, int usetype, BITFIELD flags)
{
int i;
FTextureID i;
if (name == NULL || name[0] == 0)
{
return 0;
return FTextureID(0);
}
else
{
i = CheckForTexture (name, usetype, flags | TEXMAN_TryAny);
}
if (i == -1)
if (!i.Exists())
{
// Use a default texture instead of aborting like Doom did
Printf ("Unknown texture: \"%s\"\n", name);
i = DefaultTexture;
}
return i;
return FTextureID(i);
}
//==========================================================================
@ -246,48 +246,8 @@ int FTextureManager::GetTexture (const char *name, int usetype, BITFIELD flags)
FTexture *FTextureManager::FindTexture(const char *texname, int usetype, BITFIELD flags)
{
int texnum = CheckForTexture (texname, usetype, flags);
return texnum <= 0? NULL : Textures[texnum].Texture;
}
//==========================================================================
//
// FTextureManager :: WriteTexture
//
//==========================================================================
void FTextureManager::WriteTexture (FArchive &arc, int picnum)
{
FTexture *pic;
if ((size_t)picnum >= Textures.Size())
{
pic = Textures[0].Texture;
}
else
{
pic = Textures[picnum].Texture;
}
arc.WriteCount (pic->UseType);
arc.WriteName (pic->Name);
}
//==========================================================================
//
// FTextureManager :: ReadTexture
//
//==========================================================================
int FTextureManager::ReadTexture (FArchive &arc)
{
int usetype;
const char *name;
usetype = arc.ReadCount ();
name = arc.ReadName ();
return GetTexture (name, usetype);
FTextureID texnum = CheckForTexture (texname, usetype, flags);
return !texnum.isValid()? NULL : Textures[texnum.GetIndex()].Texture;
}
//==========================================================================
@ -310,7 +270,7 @@ void FTextureManager::UnloadAll ()
//
//==========================================================================
int FTextureManager::AddTexture (FTexture *texture)
FTextureID FTextureManager::AddTexture (FTexture *texture)
{
// Later textures take precedence over earlier ones
size_t bucket = MakeKey (texture->Name) % HASH_SIZE;
@ -318,7 +278,7 @@ int FTextureManager::AddTexture (FTexture *texture)
int trans = Textures.Push (hasher);
Translation.Push (trans);
HashFirst[bucket] = trans;
return trans;
return FTextureID(trans);
}
//==========================================================================
@ -329,7 +289,7 @@ int FTextureManager::AddTexture (FTexture *texture)
//
//==========================================================================
int FTextureManager::CreateTexture (int lumpnum, int usetype)
FTextureID FTextureManager::CreateTexture (int lumpnum, int usetype)
{
if (lumpnum != -1)
{
@ -339,10 +299,10 @@ int FTextureManager::CreateTexture (int lumpnum, int usetype)
else
{
Printf (TEXTCOLOR_ORANGE "Invalid data encountered for texture %s\n", Wads.GetLumpFullPath(lumpnum).GetChars());
return -1;
return FTextureID(-1);
}
}
return -1;
return FTextureID(-1);
}
//==========================================================================
@ -351,16 +311,17 @@ int FTextureManager::CreateTexture (int lumpnum, int usetype)
//
//==========================================================================
void FTextureManager::ReplaceTexture (int picnum, FTexture *newtexture, bool free)
void FTextureManager::ReplaceTexture (FTextureID picnum, FTexture *newtexture, bool free)
{
if ((size_t)picnum >= Textures.Size())
int index = picnum.GetIndex();
if (unsigned(index) >= Textures.Size())
return;
FTexture *oldtexture = Textures[picnum].Texture;
FTexture *oldtexture = Textures[index].Texture;
strcpy (newtexture->Name, oldtexture->Name);
newtexture->UseType = oldtexture->UseType;
Textures[picnum].Texture = newtexture;
Textures[index].Texture = newtexture;
if (free)
{
@ -374,22 +335,22 @@ void FTextureManager::ReplaceTexture (int picnum, FTexture *newtexture, bool fre
//
//==========================================================================
int FTextureManager::AddPatch (const char *patchname, int namespc, bool tryany)
FTextureID FTextureManager::AddPatch (const char *patchname, int namespc, bool tryany)
{
if (patchname == NULL)
{
return -1;
return FTextureID(-1);
}
int lumpnum = CheckForTexture (patchname, FTexture::TEX_MiscPatch, tryany);
FTextureID texnum = CheckForTexture (patchname, FTexture::TEX_MiscPatch, tryany);
if (lumpnum >= 0)
if (texnum.Exists())
{
return lumpnum;
return texnum;
}
lumpnum = Wads.CheckNumForName (patchname, namespc==ns_global? ns_graphics:namespc);
int lumpnum = Wads.CheckNumForName (patchname, namespc==ns_global? ns_graphics:namespc);
if (lumpnum < 0)
{
return -1;
return FTextureID(-1);
}
return CreateTexture (lumpnum, FTexture::TEX_MiscPatch);
@ -458,7 +419,7 @@ void FTextureManager::AddHiresTextures (int wadnum)
int firsttx = Wads.CheckNumForName ("HI_START");
int lasttx = Wads.CheckNumForName ("HI_END");
char name[9];
TArray<int> tlist;
TArray<FTextureID> tlist;
if (firsttx == -1 || lasttx == -1)
{
@ -479,8 +440,8 @@ void FTextureManager::AddHiresTextures (int wadnum)
int amount = ListTextures(name, tlist);
if (amount == 0)
{
int oldtex = AddPatch(name);
if (oldtex >= 0) tlist.Push(oldtex);
FTextureID oldtex = AddPatch(name);
if (oldtex.Exists()) tlist.Push(oldtex);
}
if (tlist.Size() == 0)
{
@ -499,15 +460,14 @@ void FTextureManager::AddHiresTextures (int wadnum)
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
if (newtex != NULL)
{
int oldtexno = tlist[i];
FTexture * oldtex = Textures[oldtexno].Texture;
FTexture * oldtex = Textures[tlist[i].GetIndex()].Texture;
// Replace the entire texture and adjust the scaling and offset factors.
newtex->bWorldPanning = true;
newtex->SetScaledSize(oldtex->GetScaledWidth(), oldtex->GetScaledHeight());
newtex->LeftOffset = FixedMul(oldtex->GetScaledLeftOffset(), newtex->xScale);
newtex->TopOffset = FixedMul(oldtex->GetScaledTopOffset(), newtex->yScale);
ReplaceTexture(oldtexno, newtex, true);
ReplaceTexture(tlist[i], newtex, true);
}
}
}
@ -530,7 +490,7 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
bool is32bit;
int width, height;
int type, mode;
TArray<int> tlist;
TArray<FTextureID> tlist;
lastLump = 0;
src[8] = '\0';
@ -560,8 +520,8 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
int amount = ListTextures(sc.String, tlist);
if (amount == 0)
{
int oldtex = AddPatch(sc.String);
if (oldtex >= 0) tlist.Push(oldtex);
FTextureID oldtex = AddPatch(sc.String);
if (oldtex.Exists()) tlist.Push(FTextureID(oldtex));
}
FName texname = sc.String;
@ -583,7 +543,7 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
{
for(unsigned int i = 0; i < tlist.Size(); i++)
{
FTexture * oldtex = Textures[tlist[i]].Texture;
FTexture * oldtex = Textures[tlist[i].GetIndex()].Texture;
int sl;
// only replace matching types. For sprites also replace any MiscPatches
@ -636,8 +596,8 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
newtex->SetScaledSize(width, height);
memcpy(newtex->Name, src, sizeof(newtex->Name));
int oldtex = TexMan.CheckForTexture(src, FTexture::TEX_MiscPatch);
if (oldtex>=0)
FTextureID oldtex = TexMan.CheckForTexture(src, FTexture::TEX_MiscPatch);
if (oldtex.isValid())
{
ReplaceTexture(oldtex, newtex, true);
newtex->UseType = FTexture::TEX_Override;
@ -792,7 +752,7 @@ void FTextureManager::AddTexturesForWad(int wadnum)
if (Wads.CheckNumForName(name, ns_graphics) != i) continue;
// skip this if it has already been added as a wall patch.
if (CheckForTexture(name, FTexture::TEX_WallPatch, 0) >= 0) continue;
if (CheckForTexture(name, FTexture::TEX_WallPatch, 0).Exists()) continue;
}
else if (ns == ns_graphics)
{
@ -822,7 +782,7 @@ void FTextureManager::AddTexturesForWad(int wadnum)
//
// FTextureManager :: SortTexturesByType
// sorts newly added textures by UseType so that anything defined
// in HIRESTEX gets in its proper place.
// in TEXTURES and HIRESTEX gets in its proper place.
//
//==========================================================================
@ -882,7 +842,6 @@ void FTextureManager::SortTexturesByType(int start, int end)
void FTextureManager::Init()
{
int i;
int wadcnt = Wads.GetNumWads();
for(int i = 0; i< wadcnt; i++)
{
@ -895,10 +854,13 @@ void FTextureManager::Init()
// The Hexen scripts use BLANK as a blank texture, even though it's really not.
// I guess the Doom renderer must have clipped away the line at the bottom of
// the texture so it wasn't visible. I'll just map it to 0, so it really is blank.
if (gameinfo.gametype == GAME_Hexen &&
0 <= (i = CheckForTexture ("BLANK", FTexture::TEX_Wall, false)))
if (gameinfo.gametype == GAME_Hexen)
{
SetTranslation (i, 0);
FTextureID tex = CheckForTexture ("BLANK", FTexture::TEX_Wall, false);
if (tex.Exists())
{
SetTranslation (tex, 0);
}
}
// Hexen parallax skies use color 0 to indicate transparency on the front
@ -908,11 +870,92 @@ void FTextureManager::Init()
{
if (wadlevelinfos[i].flags & LEVEL_DOUBLESKY)
{
int picnum = CheckForTexture (wadlevelinfos[i].skypic1, FTexture::TEX_Wall, false);
if (picnum > 0)
FTextureID picnum = CheckForTexture (wadlevelinfos[i].skypic1, FTexture::TEX_Wall, false);
if (picnum.isValid())
{
Textures[picnum].Texture->SetFrontSkyLayer ();
Textures[picnum.GetIndex()].Texture->SetFrontSkyLayer ();
}
}
}
}
//==========================================================================
//
// FTextureManager :: WriteTexture
//
//==========================================================================
void FTextureManager::WriteTexture (FArchive &arc, int picnum)
{
FTexture *pic;
if (picnum < 0)
{
arc.WriteName(NULL);
return;
}
else if ((size_t)picnum >= Textures.Size())
{
pic = Textures[0].Texture;
}
else
{
pic = Textures[picnum].Texture;
}
arc.WriteName (pic->Name);
arc.WriteCount (pic->UseType);
}
//==========================================================================
//
// FTextureManager :: ReadTexture
//
//==========================================================================
int FTextureManager::ReadTexture (FArchive &arc)
{
int usetype;
const char *name;
name = arc.ReadName ();
if (name != NULL)
{
usetype = arc.ReadCount ();
return GetTexture (name, usetype).GetIndex();
}
else return -1;
}
//==========================================================================
//
// operator<<
//
//==========================================================================
FArchive &operator<< (FArchive &arc, FTextureID &tex)
{
if (arc.IsStoring())
{
TexMan.WriteTexture(arc, tex.texnum);
}
else
{
tex.texnum = TexMan.ReadTexture(arc);
}
return arc;
}
//==========================================================================
//
// FTextureID::operator+
// Does not return incvalid texture IDs
//
//==========================================================================
FTextureID FTextureID::operator +(int offset)
{
if (!isValid()) return *this;
if (texnum + offset >= TexMan.NumTextures()) return FTextureID(-1);
return FTextureID(texnum + offset);
}

348
src/textures/textures.h Normal file
View file

@ -0,0 +1,348 @@
#ifndef __TEXTURES_H
#define __TEXTURES_H
#include "doomtype.h"
#include "m_fixed.h"
class FBitmap;
struct FRemapTable;
struct FCopyInfo;
class FScanner;
// Texture IDs
class FTextureManager;
class FTerrainTypeArray;
class FTextureID
{
friend class FTextureManager;
friend FArchive &operator<< (FArchive &arc, FTextureID &tex);
friend FTextureID GetHUDIcon(const PClass *cls);
friend void R_InitSpriteDefs ();
public:
FTextureID() {}
bool isNull() const { return texnum == 0; }
bool isValid() const { return texnum > 0; }
bool Exists() const { return texnum >= 0; }
void SetInvalid() { texnum = -1; }
bool operator ==(const FTextureID &other) const { return texnum == other.texnum; }
bool operator !=(const FTextureID &other) const { return texnum != other.texnum; }
FTextureID operator +(int offset);
int GetIndex() const { return texnum; } // Use this only if you absolutely need the index!
// The switch list needs these to sort the switches by texture index
int operator -(FTextureID other) const { return texnum - other.texnum; }
bool operator < (FTextureID other) const { return texnum < other.texnum; }
bool operator > (FTextureID other) const { return texnum > other.texnum; }
protected:
FTextureID(int num) { texnum = num; }
private:
int texnum;
};
class FNullTextureID : public FTextureID
{
public:
FNullTextureID() : FTextureID(0) {}
};
FArchive &operator<< (FArchive &arc, FTextureID &tex);
// Patches.
// A patch holds one or more columns.
// Patches are used for sprites and all masked pictures, and we compose
// textures from the TEXTURE1/2 lists of patches.
struct patch_t
{
SWORD width; // bounding box size
SWORD height;
SWORD leftoffset; // pixels to the left of origin
SWORD topoffset; // pixels below the origin
DWORD columnofs[8]; // only [width] used
// the [0] is &columnofs[width]
};
class FileReader;
// All FTextures present their data to the world in 8-bit format, but if
// the source data is something else, this is it.
enum FTextureFormat
{
TEX_Pal,
TEX_Gray,
TEX_RGB, // Actually ARGB
TEX_DXT1,
TEX_DXT2,
TEX_DXT3,
TEX_DXT4,
TEX_DXT5,
};
class FNativeTexture;
// Base texture class
class FTexture
{
public:
static FTexture *CreateTexture(int lumpnum, int usetype);
virtual ~FTexture ();
SWORD LeftOffset, TopOffset;
BYTE WidthBits, HeightBits;
fixed_t xScale;
fixed_t yScale;
char Name[9];
BYTE UseType; // This texture's primary purpose
BYTE bNoDecals:1; // Decals should not stick to texture
BYTE bNoRemap0:1; // Do not remap color 0 (used by front layer of parallax skies)
BYTE bWorldPanning:1; // Texture is panned in world units rather than texels
BYTE bMasked:1; // Texture (might) have holes
BYTE bAlphaTexture:1; // Texture is an alpha channel without color information
BYTE bHasCanvas:1; // Texture is based off FCanvasTexture
BYTE bWarped:2; // This is a warped texture. Used to avoid multiple warps on one texture
BYTE bComplex:1; // Will be used to mark extended MultipatchTextures that have to be
// fully composited before subjected to any kinf of postprocessing instead of
// doing it per patch.
WORD Rotations;
enum // UseTypes
{
TEX_Any,
TEX_Wall,
TEX_Flat,
TEX_Sprite,
TEX_WallPatch,
TEX_Build,
TEX_SkinSprite,
TEX_Decal,
TEX_MiscPatch,
TEX_FontChar,
TEX_Override, // For patches between TX_START/TX_END
TEX_Autopage, // Automap background - used to enable the use of FAutomapTexture
TEX_Null,
TEX_FirstDefined,
};
struct Span
{
WORD TopOffset;
WORD Length; // A length of 0 terminates this column
};
// Returns a single column of the texture
virtual const BYTE *GetColumn (unsigned int column, const Span **spans_out) = 0;
// Returns the whole texture, stored in column-major order
virtual const BYTE *GetPixels () = 0;
virtual int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate=0, FCopyInfo *inf = NULL);
int CopyTrueColorTranslated(FBitmap *bmp, int x, int y, int rotate, FRemapTable *remap, FCopyInfo *inf = NULL);
virtual bool UseBasePalette();
virtual int GetSourceLump() { return -1; }
virtual void Unload () = 0;
// Returns the native pixel format for this image
virtual FTextureFormat GetFormat();
// Returns a native 3D representation of the texture
FNativeTexture *GetNative(bool wrapping);
// Frees the native 3D representation of the texture
void KillNative();
// Fill the native texture buffer with pixel data for this image
virtual void FillBuffer(BYTE *buff, int pitch, int height, FTextureFormat fmt);
int GetWidth () { return Width; }
int GetHeight () { return Height; }
int GetScaledWidth () { int foo = (Width << 17) / xScale; return (foo >> 1) + (foo & 1); }
int GetScaledHeight () { int foo = (Height << 17) / yScale; return (foo >> 1) + (foo & 1); }
int GetScaledLeftOffset () { int foo = (LeftOffset << 17) / xScale; return (foo >> 1) + (foo & 1); }
int GetScaledTopOffset () { int foo = (TopOffset << 17) / yScale; return (foo >> 1) + (foo & 1); }
virtual void SetFrontSkyLayer();
void CopyToBlock (BYTE *dest, int dwidth, int dheight, int x, int y, const BYTE *translation=NULL)
{
CopyToBlock(dest, dwidth, dheight, x, y, 0, translation);
}
void CopyToBlock (BYTE *dest, int dwidth, int dheight, int x, int y, int rotate, const BYTE *translation=NULL);
// Returns true if the next call to GetPixels() will return an image different from the
// last call to GetPixels(). This should be considered valid only if a call to CheckModified()
// is immediately followed by a call to GetPixels().
virtual bool CheckModified ();
static void InitGrayMap();
void CopySize(FTexture *BaseTexture)
{
Width = BaseTexture->GetWidth();
Height = BaseTexture->GetHeight();
TopOffset = BaseTexture->TopOffset;
LeftOffset = BaseTexture->LeftOffset;
WidthBits = BaseTexture->WidthBits;
HeightBits = BaseTexture->HeightBits;
xScale = BaseTexture->xScale;
yScale = BaseTexture->yScale;
WidthMask = (1 << WidthBits) - 1;
}
void SetScaledSize(int fitwidth, int fitheight)
{
xScale = DivScale16(Width, fitwidth);
yScale = DivScale16(Height,fitheight);
// compensate for roundoff errors
if (MulScale16(xScale, fitwidth) != Width) xScale++;
if (MulScale16(yScale, fitheight) != Height) yScale++;
}
virtual void HackHack (int newheight); // called by FMultipatchTexture to discover corrupt patches.
protected:
WORD Width, Height, WidthMask;
static BYTE GrayMap[256];
FNativeTexture *Native;
FTexture ();
Span **CreateSpans (const BYTE *pixels) const;
void FreeSpans (Span **spans) const;
void CalcBitSize ();
static void FlipSquareBlock (BYTE *block, int x, int y);
static void FlipSquareBlockRemap (BYTE *block, int x, int y, const BYTE *remap);
static void FlipNonSquareBlock (BYTE *blockto, const BYTE *blockfrom, int x, int y, int srcpitch);
static void FlipNonSquareBlockRemap (BYTE *blockto, const BYTE *blockfrom, int x, int y, int srcpitch, const BYTE *remap);
friend class D3DTex;
};
// Texture manager
class FTextureManager
{
public:
FTextureManager ();
~FTextureManager ();
// Get texture without translation
FTexture *operator[] (FTextureID texnum)
{
if ((unsigned)texnum.GetIndex() >= Textures.Size()) return NULL;
return Textures[texnum.GetIndex()].Texture;
}
FTexture *operator[] (const char *texname)
{
FTextureID texnum = GetTexture (texname, FTexture::TEX_MiscPatch);
if (!texnum.Exists()) return NULL;
return Textures[texnum.GetIndex()].Texture;
}
FTexture *ByIndex(int i)
{
if (unsigned(i) >= Textures.Size()) return NULL;
return Textures[i].Texture;
}
FTexture *FindTexture(const char *texname, int usetype = FTexture::TEX_MiscPatch, BITFIELD flags = TEXMAN_TryAny);
// Get texture with translation
FTexture *operator() (FTextureID texnum)
{
if ((size_t)texnum.texnum >= Textures.Size()) return NULL;
return Textures[Translation[texnum.texnum]].Texture;
}
FTexture *operator() (const char *texname)
{
FTextureID texnum = GetTexture (texname, FTexture::TEX_MiscPatch);
if (texnum.texnum==-1) return NULL;
return Textures[Translation[texnum.texnum]].Texture;
}
void SetTranslation (FTextureID fromtexnum, FTextureID totexnum)
{
if ((size_t)fromtexnum.texnum < Translation.Size())
{
if ((size_t)totexnum.texnum >= Textures.Size())
{
totexnum.texnum = fromtexnum.texnum;
}
Translation[fromtexnum.texnum] = totexnum.texnum;
}
}
enum
{
TEXMAN_TryAny = 1,
TEXMAN_Overridable = 2,
TEXMAN_ReturnFirst = 4,
};
FTextureID CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny);
FTextureID GetTexture (const char *name, int usetype, BITFIELD flags=0);
int ListTextures (const char *name, TArray<FTextureID> &list);
void AddTexturesLump (const void *lumpdata, int lumpsize, int deflumpnum, int patcheslump, int firstdup=0, bool texture1=false);
void AddTexturesLumps (int lump1, int lump2, int patcheslump);
void AddGroup(int wadnum, const char * startlump, const char * endlump, int ns, int usetype);
void AddPatches (int lumpnum);
void AddTiles (void *tileFile);
void AddHiresTextures (int wadnum);
void LoadTextureDefs(int wadnum, const char *lumpname);
void ParseXTexture(FScanner &sc, int usetype);
void SortTexturesByType(int start, int end);
FTextureID CreateTexture (int lumpnum, int usetype=FTexture::TEX_Any); // Also calls AddTexture
FTextureID AddTexture (FTexture *texture);
FTextureID AddPatch (const char *patchname, int namespc=0, bool tryany = false);
void LoadTextureX(int wadnum);
void AddTexturesForWad(int wadnum);
void Init();
// Replaces one texture with another. The new texture will be assigned
// the same name, slot, and use type as the texture it is replacing.
// The old texture will no longer be managed. Set free true if you want
// the old texture to be deleted or set it false if you want it to
// be left alone in memory. You will still need to delete it at some
// point, because the texture manager no longer knows about it.
// This function can be used for such things as warping textures.
void ReplaceTexture (FTextureID picnum, FTexture *newtexture, bool free);
void UnloadAll ();
int NumTextures () const { return (int)Textures.Size(); }
void WriteTexture (FArchive &arc, int picnum);
int ReadTexture (FArchive &arc);
private:
struct TextureHash
{
FTexture *Texture;
int HashNext;
};
enum { HASH_END = -1, HASH_SIZE = 1027 };
TArray<TextureHash> Textures;
TArray<int> Translation;
int HashFirst[HASH_SIZE];
FTextureID DefaultTexture;
};
extern FTextureManager TexMan;
#endif

View file

@ -1866,10 +1866,10 @@ static void InventoryIcon (FScanner &sc, AInventory *defaults, Baggage &bag)
{
sc.MustGetString();
defaults->Icon = TexMan.AddPatch (sc.String);
if (defaults->Icon <= 0)
if (!defaults->Icon.isValid())
{
defaults->Icon = TexMan.AddPatch (sc.String, ns_sprites);
if (defaults->Icon<=0)
if (!defaults->Icon.isValid())
{
// Don't print warnings if the item is for another game or if this is a shareware IWAD.
// Strife's teaser doesn't contain all the icon graphics of the full game.
@ -2393,10 +2393,10 @@ static void PlayerScoreIcon (FScanner &sc, APlayerPawn *defaults, Baggage &bag)
{
sc.MustGetString ();
defaults->ScoreIcon = TexMan.AddPatch (sc.String);
if (defaults->ScoreIcon <= 0)
if (!defaults->ScoreIcon.isValid())
{
defaults->ScoreIcon = TexMan.AddPatch (sc.String, ns_sprites);
if (defaults->ScoreIcon <= 0)
if (!defaults->ScoreIcon.isValid())
{
Printf("Icon '%s' for '%s' not found\n", sc.String, bag.Info->Class->TypeName.GetChars ());
}

View file

@ -39,76 +39,49 @@
#include "w_wad.h"
FImageCollection::FImageCollection ()
: NumImages (0), ImageMap (0)
{
}
FImageCollection::FImageCollection (const char **patchNames, int numPatches)
{
Init (patchNames, numPatches);
}
FImageCollection::~FImageCollection ()
{
Uninit ();
Add (patchNames, numPatches);
}
void FImageCollection::Init (const char **patchNames, int numPatches, int namespc)
{
NumImages = numPatches;
ImageMap = new int[numPatches];
for (int i = 0; i < numPatches; ++i)
{
int picnum = TexMan.AddPatch (patchNames[i], namespc, true);
if (picnum == -1 && namespc != ns_sprites)
{
picnum = TexMan.AddPatch (patchNames[i], ns_sprites);
}
ImageMap[i] = picnum;
}
ImageMap.Clear();
Add(patchNames, numPatches, namespc);
}
// [MH] Mainly for mugshots with skins and SBARINFO
void FImageCollection::Add (const char **patchNames, int numPatches, int namespc)
{
int NewNumImages = NumImages + numPatches;
int *NewImageMap = new int[NewNumImages];
int OldCount = ImageMap.Size();
memcpy(NewImageMap, ImageMap, (NumImages * sizeof(int)));
ImageMap.Resize(OldCount + numPatches);
for (int i = 0; i < numPatches; ++i)
{
int picnum = TexMan.AddPatch (patchNames[i], namespc, true);
FTextureID picnum = TexMan.AddPatch (patchNames[i], namespc, true);
if (picnum == -1 && namespc != ns_sprites)
if (!picnum.Exists() && namespc != ns_sprites)
{
picnum = TexMan.AddPatch (patchNames[i], ns_sprites);
}
NewImageMap[NumImages + i] = picnum;
ImageMap[OldCount + i] = picnum;
}
delete[] ImageMap;
ImageMap = NewImageMap;
NumImages = NewNumImages;
}
void FImageCollection::Uninit ()
{
if (ImageMap != NULL)
{
delete[] ImageMap;
ImageMap = NULL;
}
NumImages = 0;
ImageMap.Clear();
}
FTexture *FImageCollection::operator[] (int index) const
{
if ((unsigned int)index >= (unsigned int)NumImages)
if ((unsigned int)index >= ImageMap.Size())
{
return NULL;
}
return ImageMap[index] < 0 ? NULL : TexMan[ImageMap[index]];
return ImageMap[index].Exists()? TexMan(ImageMap[index]) : NULL;
}

View file

@ -42,7 +42,6 @@ class FImageCollection
public:
FImageCollection ();
FImageCollection (const char **patchNames, int numPatches);
~FImageCollection ();
void Init (const char **patchnames, int numPatches, int namespc=0);
void Add (const char **patchnames, int numPatches, int namespc=0);
@ -51,8 +50,7 @@ public:
FTexture *operator[] (int index) const;
protected:
int NumImages;
int *ImageMap;
TArray<FTextureID> ImageMap;
};
#endif //__V_COLLECTION_H__

View file

@ -233,8 +233,8 @@ FFont *V_GetFont(const char *name)
}
if (font == NULL)
{
int picnum = TexMan.CheckForTexture (name, FTexture::TEX_Any);
if (picnum > 0)
FTextureID picnum = TexMan.CheckForTexture (name, FTexture::TEX_Any);
if (picnum.isValid())
{
font = new FSinglePicFont (name);
}
@ -845,7 +845,7 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump)
//
//==========================================================================
void FSingleLumpFont::CreateFontFromPic (int picnum)
void FSingleLumpFont::CreateFontFromPic (FTextureID picnum)
{
FTexture *pic = TexMan[picnum];
@ -1129,9 +1129,9 @@ void FSingleLumpFont::FixupPalette (BYTE *identity, double *luminosity, const BY
FSinglePicFont::FSinglePicFont(const char *picname)
{
int picnum = TexMan.CheckForTexture (picname, FTexture::TEX_Any);
FTextureID picnum = TexMan.CheckForTexture (picname, FTexture::TEX_Any);
if (picnum <= 0)
if (!picnum.isValid())
{
I_FatalError ("%s is not a font or texture", picname);
}

View file

@ -36,9 +36,9 @@
#include "doomtype.h"
#include "farchive.h"
#include "textures/textures.h"
class DCanvas;
class FTexture;
struct FRemapTable;
enum EColorRange
@ -149,7 +149,7 @@ protected:
bool rescale, PalEntry *out_palette);
void LoadFON1 (int lump, const BYTE *data);
void LoadFON2 (int lump, const BYTE *data);
void CreateFontFromPic (int picnum);
void CreateFontFromPic (FTextureID picnum);
};
class FSinglePicFont : public FFont
@ -162,7 +162,7 @@ public:
int GetCharWidth (int code) const;
protected:
int PicNum;
FTextureID PicNum;
};
void RecordTextureColors (FTexture *pic, BYTE *colorsused);

View file

@ -75,7 +75,7 @@
// SAVESIG should match SAVEVER.
// MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 1034
#define MINSAVEVER 1036
#if SVN_REVISION_NUMBER < MINSAVEVER
// Never write a savegame with a version lower than what we need

View file

@ -293,10 +293,11 @@ void WI_LoadBackground(bool isenterpic)
char buffer[10];
in_anim_t an;
lnode_t pt;
int texture = -1;
FTextureID texture;
bcnt=0;
texture.SetInvalid();
if (isenterpic)
{
level_info_t * li = FindLevelInfo(wbs->next);

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="zdoom"
ProjectGUID="{8049475B-5C87-46F9-9358-635218A4EF18}"
RootNamespace=" zdoom"
@ -135,6 +135,112 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
Description="Checking svnrevision.h..."
CommandLine="$(OutDir)\updaterevision.exe src src/svnrevision.h"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/zdoom.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="src\win32;src\sound;src;zlib;src\g_shared;src\g_doom;src\g_raven;src\g_heretic;src\g_hexen;src\g_strife;jpeg-6b;snes_spc\snes_spc"
PreprocessorDefinitions="WIN32,_DEBUG,_WIN32,_WINDOWS,USEASM,_CRTDBG_MAP_ALLOC,HAVE_STRUPR,HAVE_FILELENGTH"
MinimalRebuild="true"
RuntimeLibrary="1"
EnableFunctionLevelLinking="true"
ForceConformanceInForLoopScope="true"
PrecompiledHeaderFile=""
AssemblerOutput="0"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="0"
DisableSpecificWarnings="4996"
ForcedIncludeFiles=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="gdi32.lib user32.lib comctl32.lib shell32.lib advapi32.lib comdlg32.lib ole32.lib dxguid.lib dsound.lib dinput8.lib strmiids.lib wsock32.lib winmm.lib fmodex_vc.lib setupapi.lib ws2_32.lib"
OutputFile="../zdoomd.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=""
IgnoreDefaultLibraryNames="libcmt;msvcrtd;msvcrt"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/zdoomd.pdb"
SubSystem="2"
StackReserveSize="0"
TerminalServerAware="2"
SetChecksum="false"
TargetMachine="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
@ -246,112 +352,6 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
Description="Checking svnrevision.h..."
CommandLine="$(OutDir)\updaterevision.exe src src/svnrevision.h"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/zdoom.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="src\win32;src\sound;src;zlib;src\g_shared;src\g_doom;src\g_raven;src\g_heretic;src\g_hexen;src\g_strife;jpeg-6b;snes_spc\snes_spc"
PreprocessorDefinitions="WIN32,_DEBUG,_WIN32,_WINDOWS,USEASM,_CRTDBG_MAP_ALLOC,HAVE_STRUPR,HAVE_FILELENGTH"
MinimalRebuild="true"
RuntimeLibrary="1"
EnableFunctionLevelLinking="true"
ForceConformanceInForLoopScope="true"
PrecompiledHeaderFile=""
AssemblerOutput="0"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="0"
DisableSpecificWarnings="4996"
ForcedIncludeFiles=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="gdi32.lib user32.lib comctl32.lib shell32.lib advapi32.lib comdlg32.lib ole32.lib dxguid.lib dsound.lib dinput8.lib strmiids.lib wsock32.lib winmm.lib fmodex_vc.lib setupapi.lib ws2_32.lib"
OutputFile="../zdoomd.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=""
IgnoreDefaultLibraryNames="libcmt;msvcrtd;msvcrt"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/zdoomd.pdb"
SubSystem="2"
StackReserveSize="0"
TerminalServerAware="2"
SetChecksum="false"
TargetMachine="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
@ -930,16 +930,6 @@
Outputs="&quot;src/$(InputName).h&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCustomBuildTool"
Description="Creating $(InputName).h from src/$(InputFileName)"
CommandLine="tools\re2c\re2c -s -o &quot;src/$(InputName).h&quot; &quot;src/$(InputFileName)&quot;&#x0D;&#x0A;"
Outputs="&quot;src/$(InputName).h&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
@ -950,6 +940,16 @@
Outputs="&quot;src/$(InputName).h&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCustomBuildTool"
Description="Creating $(InputName).h from src/$(InputFileName)"
CommandLine="tools\re2c\re2c -s -o &quot;src/$(InputName).h&quot; &quot;src/$(InputFileName)&quot;&#x0D;&#x0A;"
Outputs="&quot;src/$(InputName).h&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1544,6 +1544,16 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasm -g -o &quot;$(IntDir)\$(InputName).obj&quot; -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;$(OutDir)\fixrtext &quot;$(IntDir)\$(InputName).obj&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
@ -1555,16 +1565,6 @@
Outputs="$(IntDir)/$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasm -g -o &quot;$(IntDir)\$(InputName).obj&quot; -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;$(OutDir)\fixrtext &quot;$(IntDir)\$(InputName).obj&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
@ -1590,6 +1590,16 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasm -g -o &quot;$(IntDir)\$(InputName).obj&quot; -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;$(OutDir)\fixrtext &quot;$(IntDir)\$(InputName).obj&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
@ -1601,16 +1611,6 @@
Outputs="$(IntDir)/$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasm -g -o &quot;$(IntDir)\$(InputName).obj&quot; -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;$(OutDir)\fixrtext &quot;$(IntDir)\$(InputName).obj&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
@ -1636,6 +1636,16 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasm -g -o &quot;$(IntDir)\$(InputName).obj&quot; -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;$(OutDir)\fixrtext &quot;$(IntDir)\$(InputName).obj&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
@ -1647,16 +1657,6 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasm -g -o &quot;$(IntDir)\$(InputName).obj&quot; -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;$(OutDir)\fixrtext &quot;$(IntDir)\$(InputName).obj&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
@ -1682,6 +1682,16 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasm -g -o &quot;$(IntDir)\$(InputName).obj&quot; -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;$(OutDir)\fixrtext &quot;$(IntDir)\$(InputName).obj&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
@ -1693,16 +1703,6 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasm -g -o &quot;$(IntDir)\$(InputName).obj&quot; -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;$(OutDir)\fixrtext &quot;$(IntDir)\$(InputName).obj&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
@ -1728,6 +1728,16 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasm -g -o &quot;$(IntDir)\$(InputName).obj&quot; -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;$(OutDir)\fixrtext &quot;$(IntDir)\$(InputName).obj&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
@ -1739,16 +1749,6 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputPath)..."
CommandLine="nasm -g -o &quot;$(IntDir)\$(InputName).obj&quot; -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;$(OutDir)\fixrtext &quot;$(IntDir)\$(InputName).obj&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
@ -1914,14 +1914,6 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
@ -1932,6 +1924,14 @@
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
@ -2724,6 +2724,10 @@
RelativePath=".\src\textures\texturemanager.cpp"
>
</File>
<File
RelativePath=".\src\textures\textures.h"
>
</File>
<File
RelativePath=".\src\textures\tgatexture.cpp"
>
@ -2801,14 +2805,6 @@
AdditionalIncludeDirectories="src\win32;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCResourceCompilerTool"
AdditionalIncludeDirectories="src\win32;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
@ -2818,6 +2814,14 @@
AdditionalIncludeDirectories="src\win32;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCResourceCompilerTool"
AdditionalIncludeDirectories="src\win32;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -3092,7 +3096,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3100,7 +3104,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3132,7 +3136,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3140,7 +3144,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3169,7 +3173,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3178,7 +3182,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3208,7 +3212,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3216,7 +3220,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3245,7 +3249,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3254,7 +3258,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3285,7 +3289,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3294,7 +3298,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3324,7 +3328,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3332,7 +3336,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3361,7 +3365,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3370,7 +3374,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3401,7 +3405,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3410,7 +3414,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3441,7 +3445,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3450,7 +3454,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3480,7 +3484,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3488,7 +3492,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3516,7 +3520,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3524,7 +3528,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3552,7 +3556,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3560,7 +3564,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3588,7 +3592,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3596,7 +3600,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3626,7 +3630,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3636,7 +3640,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3680,7 +3684,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
@ -3688,7 +3692,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
@ -3722,7 +3726,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
@ -3732,7 +3736,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
Name="Release|x64"
>
<Tool
Name="VCCustomBuildTool"