- Updated Jim's Makefile.linux.

- Added support for wrapping midtextures vertically.
- Since zdoom.wad is now zdoom.pk3, the default mapinfos can use full pathnames.
  So now they do.
- Fixed: The DSimpleCanvas constructor used a pitch too narrow on screens wider
  than 640 pixels when using a non-AMD processor and the processor's L1 cache
  line size could not be determined. I think this should fix the issue of
  weirdly rendered 8 pixel wide borders on the left and right of the screen that
  some people experienced.
- Fixed: The secnodes were never freed.


SVN r93 (trunk)
This commit is contained in:
Randy Heit 2006-05-09 21:30:31 +00:00
parent 7ed597fcbe
commit 981f663319
18 changed files with 1020 additions and 119 deletions

View file

@ -1,6 +1,7 @@
# created on 4/12/2006 by James Bentler # created on 4/12/2006 by James Bentler
CXX ?= g++ CXX ?= g++
CC ?= gcc CC ?= gcc
NASM ?= nasm
ifndef DEBUG ifndef DEBUG
CFLAGS ?= -pipe -Wall -Wno-unused -O2 -fomit-frame-pointer CFLAGS ?= -pipe -Wall -Wno-unused -O2 -fomit-frame-pointer
else else
@ -9,8 +10,6 @@ endif
CFLAGS += -DHAVE_FILELENGTH -D__forceinline=inline -Izlib -IFLAC `sdl-config --cflags` CFLAGS += -DHAVE_FILELENGTH -D__forceinline=inline -Izlib -IFLAC `sdl-config --cflags`
CFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNEED_STRUPR CFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNEED_STRUPR
LDFLAGS += -lFLAC++ -lFLAC -lz -lfmod `sdl-config --libs` LDFLAGS += -lFLAC++ -lFLAC -lz -lfmod `sdl-config --libs`
NASM ?= nasm
NASMFLAGS += -f elf -DM_TARGET_LINUX NASMFLAGS += -f elf -DM_TARGET_LINUX
SRCDIRS = src/ $(addprefix src/,g_doom/ g_heretic/ g_hexen/ g_raven/ g_shared/ g_strife/ oplsynth/ sound/ sdl/) SRCDIRS = src/ $(addprefix src/,g_doom/ g_heretic/ g_hexen/ g_raven/ g_shared/ g_strife/ oplsynth/ sound/ sdl/)
@ -44,6 +43,7 @@ ifndef DEBUG
else else
OBJDIR = $(DEBUGOBJ) OBJDIR = $(DEBUGOBJ)
CFLAGS += -D_DEBUG -g3 CFLAGS += -D_DEBUG -g3
NASMFLAGS += -g
ZDOOMBIN = $(ZDOOMDEBUG) ZDOOMBIN = $(ZDOOMDEBUG)
endif endif
CXXFLAGS += $(CFLAGS) CXXFLAGS += $(CFLAGS)
@ -72,7 +72,7 @@ _obj_: _src_
$(CC) -c $(CFLAGS) -o _obj_ -c _src_ $(CC) -c $(CFLAGS) -o _obj_ -c _src_
endef endef
all: $(ZDOOMBIN) zdoom.wad all: $(ZDOOMBIN) toolsandpk3 zdoom.pk3
$(ZDOOMBIN): $(OBJDIR) $(if $(RESTART),deps) $(OBJS) $(ZDOOMBIN): $(OBJDIR) $(if $(RESTART),deps) $(OBJS)
ifndef RESTART ifndef RESTART
@ -110,10 +110,22 @@ endif
$(OBJDIR): $(OBJDIR):
mkdir $(OBJDIR) mkdir $(OBJDIR)
zdoom.wad: toolsandpk3: tools/makewad/makewad tools/dehsupp/dehsupp tools/xlatcc/xlatcc
make -C wadsrc/ -f Makefile make -C wadsrc/
.PHONY : clean cleandeps cleanobjs distclean deps zdoom.pk3: toolsandpk3
ln -sf wadsrc/zdoom.pk3 ./
tools/makewad/makewad:
make -C tools/makewad/
tools/dehsupp/dehsupp:
make -C tools/dehsupp/
tools/xlatcc/xlatcc:
make -C tools/xlatcc/
.PHONY : clean cleandeps cleanobjs distclean deps toolsandpk3
clean: cleanobjs clean: cleanobjs
rm -f $(ZDOOMDEBUG) $(ZDOOM) $(ZDOOM).map rm -f $(ZDOOMDEBUG) $(ZDOOM) $(ZDOOM).map

View file

@ -1,3 +1,15 @@
May 9, 2006
- Updated Jim's Makefile.linux.
- Added support for wrapping midtextures vertically.
- Since zdoom.wad is now zdoom.pk3, the default mapinfos can use full pathnames.
So now they do.
- Fixed: The DSimpleCanvas constructor used a pitch too narrow on screens wider
than 640 pixels when using a non-AMD processor and the processor's L1 cache
line size could not be determined. I think this should fix the issue of
weirdly rendered 8 pixel wide borders on the left and right of the screen that
some people experienced.
- Fixed: The secnodes were never freed.
May 9, 2006 (Changes by Graf Zahl) May 9, 2006 (Changes by Graf Zahl)
- Fixed: The FSpecialFont constructor created the name string twice. - Fixed: The FSpecialFont constructor created the name string twice.
- Fixed: The animated door parser was still leaking memory when it encountered - Fixed: The animated door parser was still leaking memory when it encountered

242
src/a.nas
View file

@ -22,6 +22,10 @@
%define prevlineasm1 _prevlineasm1 %define prevlineasm1 _prevlineasm1
%define vlineasm1 _vlineasm1 %define vlineasm1 _vlineasm1
%define vlineasm4 _vlineasm4 %define vlineasm4 _vlineasm4
%define setupmvlineasm _setupmvlineasm
%define mvlineasm1 _mvlineasm1
%define mvlineasm4 _mvlineasm4
%endif %endif
EXTERN ylookup ; near EXTERN ylookup ; near
@ -38,14 +42,20 @@ EXTERN dc_dest
EXTERN dc_source EXTERN dc_source
EXTERN dc_texturefrac EXTERN dc_texturefrac
mvlineasm4_counter:
dd 0
SECTION .text SECTION .text
ALIGN 16 ALIGN 16
GLOBAL setvlinebpl_ GLOBAL setvlinebpl_
setvlinebpl_: setvlinebpl_:
mov dword [fixchain1a+2], eax mov [fixchain1a+2], eax
mov dword [fixchain1b+2], eax mov [fixchain1b+2], eax
mov dword [fixchain2a+2], eax mov [fixchain2a+2], eax
mov [fixchain1m+2], eax
mov [fixchain2ma+2], eax
mov [fixchain2mb+2], eax
ret ret
; pass it log2(texheight) ; pass it log2(texheight)
@ -242,9 +252,6 @@ machvsh12: rol ebx, 88h ;sh
mov ecx, esi mov ecx, esi
jmp short beginvlineasm4 jmp short beginvlineasm4
ALIGN 16 ALIGN 16
nop
nop
nop
beginvlineasm4: beginvlineasm4:
machvsh1: shr ecx, 88h ;32-sh machvsh1: shr ecx, 88h ;32-sh
mov ebx, esi mov ebx, esi
@ -300,3 +307,226 @@ machvsh8: shl edx, 88h ;16-sh
pop ebx pop ebx
pop ebp pop ebp
ret ret
;*************************************************************************
;************************* Masked Vertical Lines *************************
;*************************************************************************
; pass it log2(texheight)
ALIGN 16
GLOBAL setupmvlineasm
setupmvlineasm:
mov ecx, dword [esp+4]
mov byte [maskmach3a+2], cl
mov byte [machmv13+2], cl
mov byte [machmv14+2], cl
mov byte [machmv15+2], cl
mov byte [machmv16+2], cl
ret
ALIGN 16
GLOBAL mvlineasm1 ;Masked vline
mvlineasm1:
push ebx
push edi
push esi
push ebp
mov ecx, [dc_count]
mov ebp, [dc_colormap]
mov edi, [dc_dest]
mov eax, [dc_iscale]
mov edx, [dc_texturefrac]
mov esi, [dc_source]
beginmvline:
mov ebx, edx
maskmach3a: shr ebx, 32
mov bl, byte [esi+ebx]
cmp bl, 0
je short skipmask1
maskmach3c: mov bl, byte [ebp+ebx]
mov [edi], bl
skipmask1: add edx, eax
fixchain1m: add edi, 320
dec ecx
jnz short beginmvline
pop ebp
pop esi
pop edi
pop ebx
mov eax, edx
ret
ALIGN 16
GLOBAL mvlineasm4
mvlineasm4:
push ebx
push esi
push edi
push ebp
mov ecx,[dc_count]
mov edi,[dc_dest]
mov eax, [bufplce+0]
mov ebx, [bufplce+4]
mov [machmv1+2], eax
mov [machmv4+2], ebx
mov eax, [bufplce+8]
mov ebx, [bufplce+12]
mov [machmv7+2], eax
mov [machmv10+2], ebx
mov eax, [palookupoffse]
mov ebx, [palookupoffse+4]
mov [machmv2+2], eax
mov [machmv5+2], ebx
mov eax, [palookupoffse+8]
mov ebx, [palookupoffse+12]
mov [machmv8+2], eax
mov [machmv11+2], ebx
mov eax, [vince] ;vince
mov ebx, [vince+4]
xor al, al
xor bl, bl
mov [machmv3+2], eax
mov [machmv6+2], ebx
mov eax, [vince+8]
mov ebx, [vince+12]
mov [machmv9+2], eax
mov [machmv12+2], ebx
inc ecx
push ecx
mov ecx, [vplce+0]
mov edx, [vplce+4]
mov esi, [vplce+8]
mov ebp, [vplce+12]
fixchain2ma: sub edi, 320
jmp short beginmvlineasm4
ALIGN 16
beginmvlineasm4:
dec dword [esp]
jz near endmvlineasm4
mov eax, ebp
mov ebx, esi
machmv16: shr eax, 32
machmv15: shr ebx, 32
machmv12: add ebp, 0x88888888 ;vince[3]
machmv9: add esi, 0x88888888 ;vince[2]
machmv10: mov al, [eax+0x88888888] ;bufplce[3]
machmv7: mov bl, [ebx+0x88888888] ;bufplce[2]
cmp al, 1
adc dl, dl
cmp bl, 1
adc dl, dl
machmv8: mov bl, [ebx+0x88888888] ;palookupoffs[2]
machmv11: mov bh, [eax+0x88888888] ;palookupoffs[3]
mov eax, edx
machmv14: shr eax, 32
shl ebx, 16
machmv4: mov al, [eax+0x88888888] ;bufplce[1]
cmp al, 1
adc dl, dl
machmv6: add edx, 0x88888888 ;vince[1]
machmv5: mov bh, [eax+0x88888888] ;palookupoffs[1]
mov eax, ecx
machmv13: shr eax, 32
machmv3: add ecx, 0x88888888 ;vince[0]
machmv1: mov al, [eax+0x88888888] ;bufplce[0]
cmp al, 1
adc dl, dl
machmv2: mov bl, [eax+0x88888888] ;palookupoffs[0]
shl dl, 4
xor eax, eax
fixchain2mb: add edi, 320
mov al, dl
add eax, mvcase15
jmp eax ;16 byte cases
ALIGN 16
endmvlineasm4:
mov [_vplce], ecx
mov [_vplce+4], edx
mov [_vplce+8], esi
mov [_vplce+12], ebp
pop ecx
pop ebp
pop edi
pop esi
pop ebx
ret
;5,7,8,8,11,13,12,14,11,13,14,14,12,14,15,7
ALIGN 16
mvcase15: mov [edi], ebx
jmp beginmvlineasm4
ALIGN 16
mvcase14: mov [edi+1], bh
shr ebx, 16
mov [edi+2], bx
jmp beginmvlineasm4
ALIGN 16
mvcase13: mov [edi], bl
shr ebx, 16
mov [edi+2], bx
jmp beginmvlineasm4
ALIGN 16
mvcase12: shr ebx, 16
mov [edi+2], bx
jmp beginmvlineasm4
ALIGN 16
mvcase11: mov [edi], bx
shr ebx, 16
mov [edi+3], bh
jmp beginmvlineasm4
ALIGN 16
mvcase10: mov [edi+1], bh
shr ebx, 16
mov [edi+3], bh
jmp beginmvlineasm4
ALIGN 16
mvcase9: mov [edi], bl
shr ebx, 16
mov [edi+3], bh
jmp beginmvlineasm4
ALIGN 16
mvcase8: shr ebx, 16
mov [edi+3], bh
jmp beginmvlineasm4
ALIGN 16
mvcase7: mov [edi], bx
shr ebx, 16
mov [edi+2], bl
jmp beginmvlineasm4
ALIGN 16
mvcase6: shr ebx, 8
mov [edi+1], bx
jmp beginmvlineasm4
ALIGN 16
mvcase5: mov [edi], bl
shr ebx, 16
mov [edi+2], bl
jmp beginmvlineasm4
ALIGN 16
mvcase4: shr ebx, 16
mov [edi+2], bl
jmp beginmvlineasm4
ALIGN 16
mvcase3: mov [edi], bx
jmp beginmvlineasm4
ALIGN 16
mvcase2: mov [edi+1], bh
jmp beginmvlineasm4
ALIGN 16
mvcase1: mov [edi], bl
jmp beginmvlineasm4
ALIGN 16
mvcase0: jmp beginmvlineasm4

View file

@ -170,6 +170,7 @@ static inline int GET_SPAC (int flags)
#define ML_RAILING 0x20000 #define ML_RAILING 0x20000
#define ML_BLOCK_FLOATERS 0x40000 #define ML_BLOCK_FLOATERS 0x40000
#define ML_CLIP_MIDTEX 0x80000 // Automatic for every Strife line #define ML_CLIP_MIDTEX 0x80000 // Automatic for every Strife line
#define ML_WRAP_MIDTEX 0x100000
// Sector definition, from editing // Sector definition, from editing
typedef struct typedef struct

View file

@ -267,6 +267,7 @@ static const char *MapInfoMapLevel[] =
"sndinfo", "sndinfo",
"soundinfo", "soundinfo",
"clipmidtextures", "clipmidtextures",
"wrapmidtextures",
NULL NULL
}; };
@ -379,6 +380,7 @@ MapHandlers[] =
{ MITYPE_LUMPNAME, lioffset(soundinfo), 0 }, { MITYPE_LUMPNAME, lioffset(soundinfo), 0 },
{ MITYPE_LUMPNAME, lioffset(soundinfo), 0 }, { MITYPE_LUMPNAME, lioffset(soundinfo), 0 },
{ MITYPE_SETFLAG, LEVEL_CLIPMIDTEX, 0 }, { MITYPE_SETFLAG, LEVEL_CLIPMIDTEX, 0 },
{ MITYPE_SETFLAG, LEVEL_WRAPMIDTEX, 0 },
}; };
static const char *MapInfoClusterLevel[] = static const char *MapInfoClusterLevel[] =
@ -474,30 +476,30 @@ void G_ParseMapInfo ()
switch (gamemission) switch (gamemission)
{ {
case doom: case doom:
G_DoParseMapInfo (Wads.GetNumForName ("D1INFO")); G_DoParseMapInfo (Wads.GetNumForFullName ("mapinfo/doom1.txt"));
break; break;
case pack_plut: case pack_plut:
G_DoParseMapInfo (Wads.GetNumForName ("PLUTINFO")); G_DoParseMapInfo (Wads.GetNumForFullName ("mapinfo/plutonia.txt"));
break; break;
case pack_tnt: case pack_tnt:
G_DoParseMapInfo (Wads.GetNumForName ("TNTINFO")); G_DoParseMapInfo (Wads.GetNumForFullName ("mapinfo/tnt.txt"));
break; break;
default: default:
G_DoParseMapInfo (Wads.GetNumForName ("D2INFO")); G_DoParseMapInfo (Wads.GetNumForFullName ("mapinfo/doom2.txt"));
break; break;
} }
break; break;
case GAME_Heretic: case GAME_Heretic:
G_DoParseMapInfo (Wads.GetNumForName ("HERINFO")); G_DoParseMapInfo (Wads.GetNumForFullName ("mapinfo/heretic.txt"));
break; break;
case GAME_Hexen: case GAME_Hexen:
G_DoParseMapInfo (Wads.GetNumForName ("HEXNINFO")); G_DoParseMapInfo (Wads.GetNumForFullName ("mapinfo/hexen.txt"));
break; break;
case GAME_Strife: case GAME_Strife:
G_DoParseMapInfo (Wads.GetNumForName ("STRFINFO")); G_DoParseMapInfo (Wads.GetNumForFullName ("mapinfo/strife.txt"));
break; break;
default: default:

View file

@ -101,6 +101,7 @@
#define LEVEL_MUSICDEFINED UCONST64(0x8000000000) // a marker to disable the $map command in SNDINFO for this map #define LEVEL_MUSICDEFINED UCONST64(0x8000000000) // a marker to disable the $map command in SNDINFO for this map
#define LEVEL_MONSTERFALLINGDAMAGE UCONST64(0x10000000000) #define LEVEL_MONSTERFALLINGDAMAGE UCONST64(0x10000000000)
#define LEVEL_CLIPMIDTEX UCONST64(0x20000000000) #define LEVEL_CLIPMIDTEX UCONST64(0x20000000000)
#define LEVEL_WRAPMIDTEX UCONST64(0x40000000000)
struct acsdefered_s; struct acsdefered_s;
class FBehavior; class FBehavior;

View file

@ -509,6 +509,7 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
lines[j].v1 = FindVertex (walls[i].x, walls[i].y); lines[j].v1 = FindVertex (walls[i].x, walls[i].y);
lines[j].v2 = FindVertex (walls[walls[i].point2].x, walls[walls[i].point2].y); lines[j].v2 = FindVertex (walls[walls[i].point2].x, walls[walls[i].point2].y);
lines[j].frontsector = sides[i].sector; lines[j].frontsector = sides[i].sector;
lines[j].flags |= ML_WRAP_MIDTEX;
if (walls[i].nextsector >= 0) if (walls[i].nextsector >= 0)
{ {
lines[j].backsector = sectors + walls[i].nextsector; lines[j].backsector = sectors + walls[i].nextsector;

View file

@ -4240,6 +4240,22 @@ bool P_ChangeSector (sector_t *sector, int crunch, int amt, int floorOrCeil)
msecnode_t *headsecnode = NULL; msecnode_t *headsecnode = NULL;
struct SecnodeKiller
{
~SecnodeKiller()
{
msecnode_t *node = headsecnode;
while (node != NULL)
{
msecnode_t *next = node->m_snext;
free (node);
node = next;
}
headsecnode = NULL;
}
} KillTheSecnodes;
//============================================================================= //=============================================================================
// //
// P_GetSecnode // P_GetSecnode

View file

@ -1477,7 +1477,8 @@ void P_LoadLineDefs (int lump)
P_AdjustLine (ld); P_AdjustLine (ld);
P_SaveLineSpecial (ld); P_SaveLineSpecial (ld);
if (level.flags&LEVEL_CLIPMIDTEX) ld->flags|=ML_CLIP_MIDTEX; if (level.flags & LEVEL_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
if (level.flags & LEVEL_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
} }
} }
@ -1548,7 +1549,8 @@ void P_LoadLineDefs2 (int lump)
P_AdjustLine (ld); P_AdjustLine (ld);
P_SaveLineSpecial (ld); P_SaveLineSpecial (ld);
if (level.flags&LEVEL_CLIPMIDTEX) ld->flags|=ML_CLIP_MIDTEX; if (level.flags & LEVEL_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
if (level.flags & LEVEL_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
} }
} }

View file

@ -88,7 +88,6 @@ void P_TranslateLineDef (line_t *ld, maplinedef_t *mld)
{ {
flags |= ML_BLOCK_FLOATERS; flags |= ML_BLOCK_FLOATERS;
} }
//flags |= ML_CLIP_MIDTEX; moved to MAPINFO
passthrough = 0; passthrough = 0;
} }
else else

View file

@ -988,6 +988,13 @@ DWORD (STACK_ARGS *dovline1)() = vlinec1;
DWORD (STACK_ARGS *doprevline1)() = vlinec1; DWORD (STACK_ARGS *doprevline1)() = vlinec1;
void (STACK_ARGS *dovline4)() = vlinec4; void (STACK_ARGS *dovline4)() = vlinec4;
static DWORD STACK_ARGS mvlinec1();
static void STACK_ARGS mvlinec4();
static int mvlinebits;
DWORD (STACK_ARGS *domvline1)() = mvlinec1;
void (STACK_ARGS *domvline4)() = mvlinec4;
#else #else
extern "C" extern "C"
@ -1001,11 +1008,18 @@ void STACK_ARGS vlinetallasm4 ();
void STACK_ARGS vlinetallasmathlon4 (); void STACK_ARGS vlinetallasmathlon4 ();
void STACK_ARGS setupvlineasm (int); void STACK_ARGS setupvlineasm (int);
void STACK_ARGS setupvlinetallasm (int); void STACK_ARGS setupvlinetallasm (int);
DWORD STACK_ARGS mvlineasm1();
void STACK_ARGS mvlineasm4();
void STACK_ARGS setupmvlineasm (int);
} }
DWORD (STACK_ARGS *dovline1)() = vlinetallasm1; DWORD (STACK_ARGS *dovline1)() = vlinetallasm1;
DWORD (STACK_ARGS *doprevline1)() = prevlinetallasm1; DWORD (STACK_ARGS *doprevline1)() = prevlinetallasm1;
void (STACK_ARGS *dovline4)() = vlinetallasm4; void (STACK_ARGS *dovline4)() = vlinetallasm4;
DWORD (STACK_ARGS *domvline1)() = mvlineasm1;
void (STACK_ARGS *domvline4)() = mvlineasm4;
#endif #endif
void setupvline (int fracbits) void setupvline (int fracbits)
@ -1081,6 +1095,63 @@ void STACK_ARGS vlinec4 ()
} }
#endif #endif
void setupmvline (int fracbits)
{
#if defined(USEASM)
setupmvlineasm (fracbits);
domvline1 = mvlineasm1;
domvline4 = mvlineasm4;
#else
mvlinebits = fracbits;
#endif
}
#ifndef USEASM
DWORD STACK_ARGS mvlinec1 ()
{
DWORD fracstep = dc_iscale;
DWORD frac = dc_texturefrac;
BYTE *colormap = dc_colormap;
int count = dc_count;
const BYTE *source = dc_source;
BYTE *dest = dc_dest;
int bits = mvlinebits;
int pitch = dc_pitch;
do
{
BYTE pix = source[frac>>bits];
if (pix != 0)
{
*dest = colormap[pix];
}
frac += fracstep;
dest += pitch;
} while (--count);
return frac;
}
void STACK_ARGS mvlinec4 ()
{
BYTE *dest = dc_dest;
int count = dc_count;
int bits = mvlinebits;
DWORD place;
do
{
BYTE pix;
pix = bufplce[0][(place=vplce[0])>>bits]; if(pix) dest[0] = palookupoffse[0][pix]; vplce[0] = place+vince[0];
pix = bufplce[1][(place=vplce[1])>>bits]; if(pix) dest[1] = palookupoffse[1][pix]; vplce[1] = place+vince[1];
pix = bufplce[2][(place=vplce[2])>>bits]; if(pix) dest[2] = palookupoffse[2][pix]; vplce[2] = place+vince[2];
pix = bufplce[3][(place=vplce[3])>>bits]; if(pix) dest[3] = palookupoffse[3][pix]; vplce[3] = place+vince[3];
dest += dc_pitch;
} while (--count);
}
#endif
extern "C" short spanend[MAXHEIGHT]; extern "C" short spanend[MAXHEIGHT];
extern fixed_t rw_light; extern fixed_t rw_light;
extern fixed_t rw_lightstep; extern fixed_t rw_lightstep;
@ -1202,6 +1273,139 @@ void R_DrawFogBoundary (int x1, int x2, short *uclip, short *dclip)
} }
} }
int tmvlinebits;
void setuptmvline (int bits)
{
tmvlinebits = bits;
}
fixed_t tmvline1_add ()
{
DWORD fracstep = dc_iscale;
DWORD frac = dc_texturefrac;
BYTE *colormap = dc_colormap;
int count = dc_count;
const BYTE *source = dc_source;
BYTE *dest = dc_dest;
int bits = tmvlinebits;
int pitch = dc_pitch;
DWORD *fg2rgb = dc_srcblend;
DWORD *bg2rgb = dc_destblend;
do
{
BYTE pix = source[frac>>bits];
if (pix != 0)
{
DWORD fg = fg2rgb[colormap[pix]];
DWORD bg = bg2rgb[*dest];
fg = (fg+bg) | 0x1f07c1f;
*dest = RGB32k[0][0][fg & (fg>>15)];
}
frac += fracstep;
dest += pitch;
} while (--count);
return frac;
}
void tmvline4_add ()
{
BYTE *dest = dc_dest;
int count = dc_count;
int bits = tmvlinebits;
DWORD *fg2rgb = dc_srcblend;
DWORD *bg2rgb = dc_destblend;
do
{
for (int i = 0; i < 4; ++i)
{
BYTE pix = bufplce[i][vplce[i] >> bits];
if (pix != 0)
{
DWORD fg = fg2rgb[palookupoffse[i][pix]];
DWORD bg = bg2rgb[dest[i]];
fg = (fg+bg) | 0x1f07c1f;
dest[i] = RGB32k[0][0][fg & (fg>>15)];
}
vplce[i] += vince[i];
}
dest += dc_pitch;
} while (--count);
}
fixed_t tmvline1_addclamp ()
{
DWORD fracstep = dc_iscale;
DWORD frac = dc_texturefrac;
BYTE *colormap = dc_colormap;
int count = dc_count;
const BYTE *source = dc_source;
BYTE *dest = dc_dest;
int bits = tmvlinebits;
int pitch = dc_pitch;
DWORD *fg2rgb = dc_srcblend;
DWORD *bg2rgb = dc_destblend;
do
{
BYTE pix = source[frac>>bits];
if (pix != 0)
{
DWORD a = fg2rgb[colormap[pix]] + bg2rgb[*dest];
DWORD b = a;
a |= 0x01f07c1f;
b &= 0x40100400;
a &= 0x3fffffff;
b = b - (b >> 5);
a |= b;
*dest = RGB32k[0][0][a & (a>>15)];
}
frac += fracstep;
dest += pitch;
} while (--count);
return frac;
}
void tmvline4_addclamp ()
{
BYTE *dest = dc_dest;
int count = dc_count;
int bits = tmvlinebits;
DWORD *fg2rgb = dc_srcblend;
DWORD *bg2rgb = dc_destblend;
do
{
for (int i = 0; i < 4; ++i)
{
BYTE pix = bufplce[i][vplce[i] >> bits];
if (pix != 0)
{
DWORD a = fg2rgb[palookupoffse[i][pix]] + bg2rgb[dest[i]];
DWORD b = a;
a |= 0x01f07c1f;
b &= 0x40100400;
a &= 0x3fffffff;
b = b - (b >> 5);
a |= b;
dest[i] = RGB32k[0][0][a & (a>>15)];
}
vplce[i] += vince[i];
}
dest += dc_pitch;
} while (--count);
}
/****************************************************/ /****************************************************/
/****************************************************/ /****************************************************/
@ -1968,3 +2172,20 @@ void R_FinishSetPatchStyle ()
{ {
basecolormap = basecolormapsave; basecolormap = basecolormapsave;
} }
bool R_GetTransMaskDrawers (fixed_t (**tmvline1)(), void (**tmvline4)())
{
if (colfunc == R_DrawAddColumnP_C)
{
*tmvline1 = tmvline1_add;
*tmvline4 = tmvline4_add;
return true;
}
if (colfunc == R_DrawAddClampColumnP_C)
{
*tmvline1 = tmvline1_addclamp;
*tmvline4 = tmvline4_addclamp;
return true;
}
return false;
}

View file

@ -70,6 +70,12 @@ extern DWORD (STACK_ARGS *doprevline1) ();
extern void (STACK_ARGS *dovline4) (); extern void (STACK_ARGS *dovline4) ();
extern void setupvline (int); extern void setupvline (int);
extern DWORD (STACK_ARGS *domvline1) ();
extern void (STACK_ARGS *domvline4) ();
extern void setupmvline (int);
extern void setuptmvline (int);
// The Spectre/Invisibility effect. // The Spectre/Invisibility effect.
extern void (*R_DrawFuzzColumn)(void); extern void (*R_DrawFuzzColumn)(void);
@ -261,10 +267,19 @@ ESPSResult R_SetPatchStyle (int style, fixed_t alpha, int translation, DWORD col
// style was STYLE_Shade // style was STYLE_Shade
void R_FinishSetPatchStyle (); void R_FinishSetPatchStyle ();
// transmaskwallscan calls this to find out what column drawers to use
bool R_GetTransMaskDrawers (fixed_t (**tmvline1)(), void (**tmvline4)());
// Retrieve column data for wallscan. Should probably be removed // Retrieve column data for wallscan. Should probably be removed
// to just use the texture's GetColumn() method. It just exists // to just use the texture's GetColumn() method. It just exists
// for double-layer skies. // for double-layer skies.
const BYTE *R_GetColumn (FTexture *tex, int col); const BYTE *R_GetColumn (FTexture *tex, int col);
void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, const byte *(*getcol)(FTexture *tex, int col)=R_GetColumn); void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, const byte *(*getcol)(FTexture *tex, int col)=R_GetColumn);
// maskwallscan is exactly like wallscan but does not draw anything where the texture is color 0.
void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, const byte *(*getcol)(FTexture *tex, int col)=R_GetColumn);
// transmaskwallscan is like maskwallscan, but it can also blend to the background
void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, const byte *(*getcol)(FTexture *tex, int col)=R_GetColumn);
#endif #endif

View file

@ -121,7 +121,7 @@ static fixed_t rw_bottomtexturemid;
FTexture *rw_pic; FTexture *rw_pic;
static short *maskedtexturecol; static fixed_t *maskedtexturecol;
static FTexture *WallSpriteTile; static FTexture *WallSpriteTile;
static void R_RenderDecal (side_t *wall, DBaseDecal *first, drawseg_t *clipper, int pass); static void R_RenderDecal (side_t *wall, DBaseDecal *first, drawseg_t *clipper, int pass);
@ -157,10 +157,11 @@ CVAR(Bool, r_drawmirrors, true, 0)
// R_RenderMaskedSegRange // R_RenderMaskedSegRange
// //
fixed_t *MaskedSWall; fixed_t *MaskedSWall;
fixed_t MaskedScaleY;
static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FTexture::Span *spans), FTexture *tex) static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FTexture::Span *spans), FTexture *tex)
{ {
if (maskedtexturecol[dc_x] != SHRT_MAX) if (maskedtexturecol[dc_x] != FIXED_MAX)
{ {
// calculate lighting // calculate lighting
if (!fixedcolormap) if (!fixedcolormap)
@ -168,7 +169,7 @@ static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FText
dc_colormap = basecolormap + (GETPALOOKUP (rw_light, wallshade) << COLORMAPSHIFT); dc_colormap = basecolormap + (GETPALOOKUP (rw_light, wallshade) << COLORMAPSHIFT);
} }
dc_iscale = MaskedSWall[dc_x]; dc_iscale = MulScale5 (MaskedSWall[dc_x], MaskedScaleY);
sprtopscreen = centeryfrac - FixedMul (dc_texturemid, spryscale); sprtopscreen = centeryfrac - FixedMul (dc_texturemid, spryscale);
// killough 1/25/98: here's where Medusa came in, because // killough 1/25/98: here's where Medusa came in, because
@ -181,9 +182,9 @@ static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FText
// draw the texture // draw the texture
const FTexture::Span *spans; const FTexture::Span *spans;
const BYTE *pixels = tex->GetColumn (maskedtexturecol[dc_x], &spans); const BYTE *pixels = tex->GetColumn (maskedtexturecol[dc_x] >> FRACBITS, &spans);
blastfunc (pixels, spans); blastfunc (pixels, spans);
maskedtexturecol[dc_x] = SHRT_MAX; maskedtexturecol[dc_x] = FIXED_MAX;
} }
rw_light += rw_lightstep; rw_light += rw_lightstep;
spryscale += rw_scalestep; spryscale += rw_scalestep;
@ -243,7 +244,8 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
} }
MaskedSWall = (fixed_t *)(openings + ds->swall) - ds->x1; MaskedSWall = (fixed_t *)(openings + ds->swall) - ds->x1;
maskedtexturecol = openings + ds->maskedtexturecol - ds->x1; MaskedScaleY = tex->ScaleY ? tex->ScaleY : ty;
maskedtexturecol = (fixed_t *)(openings + ds->maskedtexturecol) - ds->x1;
spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1); spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1);
rw_scalestep = ds->iscalestep; rw_scalestep = ds->iscalestep;
@ -274,84 +276,102 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
dc_texturemid = MulScale3 (dc_texturemid - viewz, scaley) + curline->sidedef->rowoffset; dc_texturemid = MulScale3 (dc_texturemid - viewz, scaley) + curline->sidedef->rowoffset;
} }
// [RH] Don't bother drawing segs that are completely offscreen
if (MulScale12 (globaldclip, ds->sz1) < -textop &&
MulScale12 (globaldclip, ds->sz2) < -textop)
{ // Texture top is below the bottom of the screen
goto clearfog;
}
if (MulScale12 (globaluclip, ds->sz1) > texheight - textop &&
MulScale12 (globaluclip, ds->sz2) > texheight - textop)
{ // Texture bottom is above the top of the screen
goto clearfog;
}
WallSZ1 = ds->sz1;
WallSZ2 = ds->sz2;
WallSX1 = ds->sx1;
WallSX2 = ds->sx2;
OWallMost (wallupper, textop);
OWallMost (walllower, textop - texheight);
for (i = x1; i <= x2; i++)
{
if (wallupper[i] < mceilingclip[i])
wallupper[i] = mceilingclip[i];
}
for (i = x1; i <= x2; i++)
{
if (walllower[i] > mfloorclip[i])
walllower[i] = mfloorclip[i];
}
mfloorclip = walllower;
mceilingclip = wallupper;
if (fixedlightlev) if (fixedlightlev)
dc_colormap = basecolormap + fixedlightlev; dc_colormap = basecolormap + fixedlightlev;
else if (fixedcolormap) else if (fixedcolormap)
dc_colormap = fixedcolormap; dc_colormap = fixedcolormap;
// draw the columns one at a time if (!(curline->linedef->flags & ML_WRAP_MIDTEX))
if (drawmode == DoDraw0) { // Texture does not wrap vertically.
{
for (dc_x = x1; dc_x <= x2; ++dc_x) // [RH] Don't bother drawing segs that are completely offscreen
if (MulScale12 (globaldclip, ds->sz1) < -textop &&
MulScale12 (globaldclip, ds->sz2) < -textop)
{ // Texture top is below the bottom of the screen
goto clearfog;
}
if (MulScale12 (globaluclip, ds->sz1) > texheight - textop &&
MulScale12 (globaluclip, ds->sz2) > texheight - textop)
{ // Texture bottom is above the top of the screen
goto clearfog;
}
WallSZ1 = ds->sz1;
WallSZ2 = ds->sz2;
WallSX1 = ds->sx1;
WallSX2 = ds->sx2;
OWallMost (wallupper, textop);
OWallMost (walllower, textop - texheight);
for (i = x1; i <= x2; i++)
{ {
BlastMaskedColumn (R_DrawMaskedColumn, tex); if (wallupper[i] < mceilingclip[i])
wallupper[i] = mceilingclip[i];
}
for (i = x1; i <= x2; i++)
{
if (walllower[i] > mfloorclip[i])
walllower[i] = mfloorclip[i];
}
mfloorclip = walllower;
mceilingclip = wallupper;
// draw the columns one at a time
if (drawmode == DoDraw0)
{
for (dc_x = x1; dc_x <= x2; ++dc_x)
{
BlastMaskedColumn (R_DrawMaskedColumn, tex);
}
}
else
{
// [RH] Draw up to four columns at once
int stop = (x2+1) & ~3;
if (x1 > x2)
goto clearfog;
dc_x = x1;
while ((dc_x < stop) && (dc_x & 3))
{
BlastMaskedColumn (R_DrawMaskedColumn, tex);
dc_x++;
}
while (dc_x < stop)
{
rt_initcols();
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex); dc_x++;
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex); dc_x++;
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex); dc_x++;
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex);
rt_draw4cols (dc_x - 3);
dc_x++;
}
while (dc_x <= x2)
{
BlastMaskedColumn (R_DrawMaskedColumn, tex);
dc_x++;
}
} }
} }
else else
{ { // Texture does wrap vertically.
// [RH] Draw up to four columns at once
int stop = (x2+1) & ~3;
if (x1 > x2) rw_offset = 0;
goto clearfog; rw_pic = tex;
if (colfunc == basecolfunc)
dc_x = x1;
while ((dc_x < stop) && (dc_x & 3))
{ {
BlastMaskedColumn (R_DrawMaskedColumn, tex); maskwallscan(x1, x2, mceilingclip, mfloorclip, MaskedSWall, maskedtexturecol);
dc_x++;
} }
else
while (dc_x < stop)
{ {
rt_initcols(); transmaskwallscan(x1, x2, mceilingclip, mfloorclip, MaskedSWall, maskedtexturecol);
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex); dc_x++;
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex); dc_x++;
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex); dc_x++;
BlastMaskedColumn (R_DrawMaskedColumnHoriz, tex);
rt_draw4cols (dc_x - 3);
dc_x++;
}
while (dc_x <= x2)
{
BlastMaskedColumn (R_DrawMaskedColumn, tex);
dc_x++;
} }
} }
@ -411,8 +431,8 @@ ebp = x2
void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal,
const BYTE *(*getcol)(FTexture *tex, int x)) const BYTE *(*getcol)(FTexture *tex, int x))
{ {
long x, shiftval; int x, shiftval;
long y1ve[4], y2ve[4], u4, d4, z; int y1ve[4], y2ve[4], u4, d4, z;
char bad; char bad;
fixed_t light = rw_light - rw_lightstep; fixed_t light = rw_light - rw_lightstep;
SDWORD yrepeat, texturemid, xoffset; SDWORD yrepeat, texturemid, xoffset;
@ -636,6 +656,347 @@ void wallscan_striped (int x1, int x2, short *uwal, short *dwal, fixed_t *swal,
wallshade = startshade; wallshade = startshade;
} }
inline fixed_t mvline1 (fixed_t vince, byte *colormap, int count, fixed_t vplce, const byte *bufplce, byte *dest)
{
dc_iscale = vince;
dc_colormap = colormap;
dc_count = count;
dc_texturefrac = vplce;
dc_source = bufplce;
dc_dest = dest;
return domvline1 ();
}
void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal,
const BYTE *(*getcol)(FTexture *tex, int x))
{
int x, shiftval;
BYTE *p;
int y1ve[4], y2ve[4], u4, d4, startx, dax, z;
char bad;
fixed_t light = rw_light - rw_lightstep;
SDWORD yrepeat, texturemid, xoffset;
if (rw_pic->UseType == FTexture::TEX_Null)
{
return;
}
if (!rw_pic->bMasked)
{ // Textures that aren't masked can use the faster wallscan.
wallscan (x1, x2, uwal, dwal, swal, lwal, getcol);
return;
}
//extern cycle_t WallScanCycles;
//clock (WallScanCycles);
rw_pic->GetHeight(); // Make sure texture size is loaded
shiftval = rw_pic->HeightBits;
setupmvline (32-shiftval);
yrepeat = (rw_pic->ScaleY ? rw_pic->ScaleY : ty) << (11 - shiftval);
texturemid = dc_texturemid << (16 - shiftval);
xoffset = rw_offset;
x = startx = x1;
p = x + dc_destorg;
if (fixedcolormap)
{
palookupoffse[0] = dc_colormap;
palookupoffse[1] = dc_colormap;
palookupoffse[2] = dc_colormap;
palookupoffse[3] = dc_colormap;
}
for(; (x <= x2) && ((size_t)p & 3); ++x, ++p)
{
light += rw_lightstep;
y1ve[0] = uwal[x];//max(uwal[x],umost[x]);
y2ve[0] = dwal[x];//min(dwal[x],dmost[x]);
if (y2ve[0] <= y1ve[0]) continue;
if (!fixedcolormap)
{ // calculate lighting
dc_colormap = basecolormap + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
}
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
dc_dest = ylookup[y1ve[0]] + p;
dc_iscale = swal[x] * yrepeat;
dc_count = y2ve[0] - y1ve[0];
dc_texturefrac = texturemid + FixedMul (dc_iscale, (y1ve[0]<<FRACBITS)-centeryfrac+FRACUNIT);
domvline1();
}
for(; x <= x2-3; x += 4, p+= 4)
{
bad = 0;
for (z = 3, dax = x+3; z >= 0; --z, --dax)
{
y1ve[z] = uwal[dax];
y2ve[z] = dwal[dax];
if (y2ve[z] <= y1ve[z]) { bad += 1<<z; continue; }
bufplce[z] = getcol (rw_pic, (lwal[dax] + xoffset) >> FRACBITS);
vince[z] = swal[dax] * yrepeat;
vplce[z] = texturemid + FixedMul (vince[z], (y1ve[z]<<FRACBITS)-centeryfrac+FRACUNIT);
}
if (bad == 15)
{
light += rw_lightstep << 2;
continue;
}
if (!fixedcolormap)
{
for (z = 0; z < 4; ++z)
{
light += rw_lightstep;
palookupoffse[z] = basecolormap + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
}
}
u4 = MAX(MAX(y1ve[0],y1ve[1]),MAX(y1ve[2],y1ve[3]));
d4 = MIN(MIN(y2ve[0],y2ve[1]),MIN(y2ve[2],y2ve[3]));
if ((bad != 0) || (u4 >= d4))
{
for (z = 0; z < 4; ++z)
{
if (!(bad & 1))
{
mvline1(vince[z],palookupoffse[z],y2ve[z]-y1ve[z],vplce[z],bufplce[z],ylookup[y1ve[z]]+p+z);
}
bad >>= 1;
}
continue;
}
for (z = 0; z < 4; ++z)
{
if (u4 > y1ve[z])
{
vplce[z] = mvline1(vince[z],palookupoffse[z],u4-y1ve[z],vplce[z],bufplce[z],ylookup[y1ve[z]]+p+z);
}
}
if (d4 > u4)
{
dc_count = d4-u4;
dc_dest = ylookup[u4]+p;
domvline4();
}
BYTE *i = p+ylookup[d4];
for (z = 0; z < 4; ++z)
{
if (y2ve[z] > d4)
{
mvline1(vince[z],palookupoffse[0],y2ve[z]-d4,vplce[z],bufplce[z],i+z);
}
}
}
for(; x <= x2; ++x, ++p)
{
light += rw_lightstep;
y1ve[0] = uwal[x];
y2ve[0] = dwal[x];
if (y2ve[0] <= y1ve[0]) continue;
if (!fixedcolormap)
{ // calculate lighting
dc_colormap = basecolormap + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
}
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
dc_dest = ylookup[y1ve[0]] + p;
dc_iscale = swal[x] * yrepeat;
dc_count = y2ve[0] - y1ve[0];
dc_texturefrac = texturemid + FixedMul (dc_iscale, (y1ve[0]<<FRACBITS)-centeryfrac+FRACUNIT);
domvline1();
}
//unclock(WallScanCycles);
NetUpdate ();
}
inline void preptmvline1 (fixed_t vince, byte *colormap, int count, fixed_t vplce, const byte *bufplce, byte *dest)
{
dc_iscale = vince;
dc_colormap = colormap;
dc_count = count;
dc_texturefrac = vplce;
dc_source = bufplce;
dc_dest = dest;
}
void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal,
const BYTE *(*getcol)(FTexture *tex, int x))
{
fixed_t (*tmvline1)();
void (*tmvline4)();
int x, shiftval;
BYTE *p;
int y1ve[4], y2ve[4], u4, d4, startx, dax, z;
char bad;
fixed_t light = rw_light - rw_lightstep;
SDWORD yrepeat, texturemid, xoffset;
if (rw_pic->UseType == FTexture::TEX_Null)
{
return;
}
if (!R_GetTransMaskDrawers (&tmvline1, &tmvline4))
{
// The current translucency is unsupported, so draw with regular maskwallscan instead.
maskwallscan (x1, x2, uwal, dwal, swal, lwal, getcol);
return;
}
//extern cycle_t WallScanCycles;
//clock (WallScanCycles);
rw_pic->GetHeight(); // Make sure texture size is loaded
shiftval = rw_pic->HeightBits;
setuptmvline (32-shiftval);
yrepeat = (rw_pic->ScaleY ? rw_pic->ScaleY : ty) << (11 - shiftval);
texturemid = dc_texturemid << (16 - shiftval);
xoffset = rw_offset;
x = startx = x1;
p = x + dc_destorg;
if (fixedcolormap)
{
palookupoffse[0] = dc_colormap;
palookupoffse[1] = dc_colormap;
palookupoffse[2] = dc_colormap;
palookupoffse[3] = dc_colormap;
}
for(; (x <= x2) && ((size_t)p & 3); ++x, ++p)
{
light += rw_lightstep;
y1ve[0] = uwal[x];//max(uwal[x],umost[x]);
y2ve[0] = dwal[x];//min(dwal[x],dmost[x]);
if (y2ve[0] <= y1ve[0]) continue;
if (!fixedcolormap)
{ // calculate lighting
dc_colormap = basecolormap + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
}
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
dc_dest = ylookup[y1ve[0]] + p;
dc_iscale = swal[x] * yrepeat;
dc_count = y2ve[0] - y1ve[0];
dc_texturefrac = texturemid + FixedMul (dc_iscale, (y1ve[0]<<FRACBITS)-centeryfrac+FRACUNIT);
tmvline1();
}
for(; x <= x2-3; x += 4, p+= 4)
{
bad = 0;
for (z = 3, dax = x+3; z >= 0; --z, --dax)
{
y1ve[z] = uwal[dax];
y2ve[z] = dwal[dax];
if (y2ve[z] <= y1ve[z]) { bad += 1<<z; continue; }
bufplce[z] = getcol (rw_pic, (lwal[dax] + xoffset) >> FRACBITS);
vince[z] = swal[dax] * yrepeat;
vplce[z] = texturemid + FixedMul (vince[z], (y1ve[z]<<FRACBITS)-centeryfrac+FRACUNIT);
}
if (bad == 15)
{
light += rw_lightstep << 2;
continue;
}
if (!fixedcolormap)
{
for (z = 0; z < 4; ++z)
{
light += rw_lightstep;
palookupoffse[z] = basecolormap + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
}
}
u4 = MAX(MAX(y1ve[0],y1ve[1]),MAX(y1ve[2],y1ve[3]));
d4 = MIN(MIN(y2ve[0],y2ve[1]),MIN(y2ve[2],y2ve[3]));
if ((bad != 0) || (u4 >= d4))
{
for (z = 0; z < 4; ++z)
{
if (!(bad & 1))
{
preptmvline1(vince[z],palookupoffse[z],y2ve[z]-y1ve[z],vplce[z],bufplce[z],ylookup[y1ve[z]]+p+z);
tmvline1();
}
bad >>= 1;
}
continue;
}
for (z = 0; z < 4; ++z)
{
if (u4 > y1ve[z])
{
preptmvline1(vince[z],palookupoffse[z],u4-y1ve[z],vplce[z],bufplce[z],ylookup[y1ve[z]]+p+z);
vplce[z] = tmvline1();
}
}
if (d4 > u4)
{
dc_count = d4-u4;
dc_dest = ylookup[u4]+p;
tmvline4();
}
BYTE *i = p+ylookup[d4];
for (z = 0; z < 4; ++z)
{
if (y2ve[z] > d4)
{
preptmvline1(vince[z],palookupoffse[0],y2ve[z]-d4,vplce[z],bufplce[z],i+z);
tmvline1();
}
}
}
for(; x <= x2; ++x, ++p)
{
light += rw_lightstep;
y1ve[0] = uwal[x];
y2ve[0] = dwal[x];
if (y2ve[0] <= y1ve[0]) continue;
if (!fixedcolormap)
{ // calculate lighting
dc_colormap = basecolormap + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
}
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
dc_dest = ylookup[y1ve[0]] + p;
dc_iscale = swal[x] * yrepeat;
dc_count = y2ve[0] - y1ve[0];
dc_texturefrac = texturemid + FixedMul (dc_iscale, (y1ve[0]<<FRACBITS)-centeryfrac+FRACUNIT);
tmvline1();
}
//unclock(WallScanCycles);
NetUpdate ();
}
// //
// R_RenderSegLoop // R_RenderSegLoop
// Draws zero, one, or two textures for walls. // Draws zero, one, or two textures for walls.
@ -929,7 +1290,7 @@ void R_NewWall (bool needlights)
|| (backsector->floor_angle + backsector->base_floor_angle) != (frontsector->floor_angle + frontsector->base_floor_angle) || (backsector->floor_angle + backsector->base_floor_angle) != (frontsector->floor_angle + frontsector->base_floor_angle)
|| (sidedef->midtexture && linedef->flags & ML_CLIP_MIDTEX) || (sidedef->midtexture && linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX))
; ;
markceiling = (frontsector->ceilingpic != skyflatnum || markceiling = (frontsector->ceilingpic != skyflatnum ||
@ -958,7 +1319,7 @@ void R_NewWall (bool needlights)
|| (backsector->ceiling_angle + backsector->base_ceiling_angle) != (frontsector->ceiling_angle + frontsector->base_ceiling_angle) || (backsector->ceiling_angle + backsector->base_ceiling_angle) != (frontsector->ceiling_angle + frontsector->base_ceiling_angle)
|| (sidedef->midtexture && linedef->flags & ML_CLIP_MIDTEX) || (sidedef->midtexture && linedef->flags & (ML_CLIP_MIDTEX|ML_WRAP_MIDTEX))
); );
} }
@ -1235,7 +1596,7 @@ void R_StoreWallRange (int start, int stop)
(WallSZ1 >= TOO_CLOSE_Z && WallSZ2 >= TOO_CLOSE_Z)) (WallSZ1 >= TOO_CLOSE_Z && WallSZ2 >= TOO_CLOSE_Z))
{ {
fixed_t *swal; fixed_t *swal;
short *lwal; fixed_t *lwal;
int i; int i;
maskedtexture = true; maskedtexture = true;
@ -1243,22 +1604,22 @@ void R_StoreWallRange (int start, int stop)
ds_p->bFogBoundary = IsFogBoundary (frontsector, backsector); ds_p->bFogBoundary = IsFogBoundary (frontsector, backsector);
if (sidedef->midtexture != 0) if (sidedef->midtexture != 0)
{ {
ds_p->maskedtexturecol = R_NewOpening (stop - start); ds_p->maskedtexturecol = R_NewOpening ((stop - start) * 2);
ds_p->swall = R_NewOpening ((stop - start) * 2); ds_p->swall = R_NewOpening ((stop - start) * 2);
lwal = openings + ds_p->maskedtexturecol; lwal = (fixed_t *)(openings + ds_p->maskedtexturecol);
swal = (fixed_t *)(openings + ds_p->swall); swal = (fixed_t *)(openings + ds_p->swall);
int scaley = TexMan(sidedef->midtexture)->ScaleY ? int scaley = TexMan(sidedef->midtexture)->ScaleY ?
TexMan(sidedef->midtexture)->ScaleY : ty; TexMan(sidedef->midtexture)->ScaleY : ty;
int xoffset = rw_offset; int xoffset = rw_offset;
for (i = start; i < stop; i++) for (i = start; i < stop; i++)
{ {
*lwal++ = (short)((lwall[i] + xoffset) >> FRACBITS); *lwal++ = lwall[i] + xoffset;
*swal++ = MulScale5 (swall[i], scaley); *swal++ = swall[i];
} }
fixed_t istart = *((fixed_t *)(openings + ds_p->swall)); fixed_t istart = MulScale5 (*((fixed_t *)(openings + ds_p->swall)), scaley);
fixed_t iend = *(swal - 1); fixed_t iend = MulScale5 (*(swal - 1), scaley);
if (istart < 3 && istart >= 0) istart = 3; if (istart < 3 && istart >= 0) istart = 3;
if (istart > -3 && istart < 0) istart = -3; if (istart > -3 && istart < 0) istart = -3;

View file

@ -542,6 +542,12 @@ DSimpleCanvas::DSimpleCanvas (int width, int height)
} }
else else
{ {
// If we couldn't figure out the CPU's L1 cache line size, assume
// it's 32 bytes wide.
if (CPU.DataL1LineSize == 0)
{
CPU.DataL1LineSize = 32;
}
// The Athlon and P3 have very different caches, apparently. // The Athlon and P3 have very different caches, apparently.
// I am going to generalize the Athlon's performance to all AMD // I am going to generalize the Athlon's performance to all AMD
// processors and the P3's to all non-AMD processors. I don't know // processors and the P3's to all non-AMD processors. I don't know
@ -553,7 +559,7 @@ DSimpleCanvas::DSimpleCanvas (int width, int height)
} }
else else
{ {
Pitch = width + CPU.DataL1LineSize - 8; Pitch = width + MAX(0, CPU.DataL1LineSize - 8);
} }
} }
MemBuffer = new BYTE[Pitch * height]; MemBuffer = new BYTE[Pitch * height];

View file

@ -1,8 +1,14 @@
EXE = dehsupp.exe ifeq (Windows_NT,$(OS))
EXE = dehsupp.exe
CCDV = @../../ccdv
CFLAGS = $(LOC) -Os -Wall -fomit-frame-pointer
else
EXE = dehsupp
CCDV =
CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Os -Wall -fomit-frame-pointer
endif
CCDV = @../../ccdv
CC = gcc CC = gcc
CFLAGS = $(LOC) -Os -Wall -fomit-frame-pointer
BISON = bison BISON = bison
BISONFLAGS = BISONFLAGS =
@ -17,8 +23,13 @@ $(EXE): $(OBJS)
.PHONY: clean .PHONY: clean
clean: clean:
ifeq (Windows_NT,$(OS))
-del /q /f $(EXE) 2>nul -del /q /f $(EXE) 2>nul
-del /q /f *.o 2>nul -del /q /f *.o 2>nul
else
rm -f $(EXE)
rm -f *.o
endif
parse.tab.o: parse.tab.c parse.tab.o: parse.tab.c
$(CCDV) $(CC) $(CFLAGS) -c -o $@ $< $(CCDV) $(CC) $(CFLAGS) -c -o $@ $<

View file

@ -1,8 +1,14 @@
EXE = xlatcc.exe ifeq (Windows_NT,$(OS))
EXE = xlatcc.exe
CCDV = @../../ccdv
CFLAGS = $(LOC) -Os -Wall -fomit-frame-pointer
else
EXE = xlatcc
CCDV =
CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp $(LOC) -Os -Wall -fomit-frame-pointer
endif
CCDV = @../../ccdv
CC = gcc CC = gcc
CFLAGS = $(LOC) -Os -Wall -fomit-frame-pointer
BISON = bison BISON = bison
BISONFLAGS = BISONFLAGS =
@ -17,8 +23,13 @@ $(EXE): $(OBJS)
.PHONY: clean .PHONY: clean
clean: clean:
ifeq (Windows_NT,$(OS))
-del /q /f $(EXE) 2>nul -del /q /f $(EXE) 2>nul
-del /q /f *.o 2>nul -del /q /f *.o 2>nul
else
rm -f $(EXE)
rm -f *.o
endif
xlat-parse.tab.o: xlat-parse.tab.c xlat.h xlat-parse.tab.o: xlat-parse.tab.c xlat.h
$(CCDV) $(CC) $(CFLAGS) -c -o $@ $< $(CCDV) $(CC) $(CFLAGS) -c -o $@ $<

View file

@ -165,17 +165,17 @@ sounds/railgf1.flac railgunfire.flac
======== ========
# Mapinfos # Mapinfos
d1info.txt mapinfo/doom1.txt mapinfo/doom1.txt mapinfo/doom1.txt
d2info.txt mapinfo/doom2.txt mapinfo/doom2.txt mapinfo/doom2.txt
plutinfo.txt mapinfo/plutonia.txt mapinfo/plutonia.txt mapinfo/plutonia.txt
tntinfo.txt mapinfo/tnt.txt mapinfo/tnt.txt mapinfo/tnt.txt
herinfo.txt mapinfo/heretic.txt mapinfo/heretic.txt mapinfo/heretic.txt
hexninfo.txt mapinfo/hexen.txt mapinfo/hexen.txt mapinfo/hexen.txt
strfinfo.txt mapinfo/strife.txt mapinfo/strife.txt mapinfo/strife.txt
======== ========
# Strife's helper script # Strife's helper script
acs/strfhelp.o strfhelp.o acs/strfhelp.o strfhelp.o
======== ========