Parallax Sky:
WL_DRAW.CPP:
- Code: Select all
/*
==============
=
= DrawParallax
=
= by Ripper
=
==============
*/
#define TEXTURESHIFT 6
#define TEXTURESIZE (1<<TEXTURESHIFT)
#define TEXTUREMASK (TEXTURESIZE*(TEXTURESIZE-1))
#define NUMPARALLAXTEX 16
static inline byte *PM_GetTexture(int wallpic)
{
return Pages+wallpic*PMPageSize;
}
void DrawParallax(int startpage)
{
word xtex,nextxtex,offs;
byte *skytex;
byte *destbuf=(byte *)(vbuf); // + 0xa0000000L
int i,x=0,x2,curtex,nextx=0,texoffs,t,tend;
byte mask;
int midangle=player->angle*(FINEANGLES/ANGLES);
int skyheight=viewheight>>1;
startpage += NUMPARALLAXTEX - 1;
t=pixelangle[0]+midangle;
while(t<0) t+=FINEANGLES;
while(t>=FINEANGLES) t-=FINEANGLES;
xtex=(word)((((long)t) * NUMPARALLAXTEX * TEXTURESIZE)/FINEANGLES);
do
{
curtex=xtex>>TEXTURESHIFT;
//skytex=Pages+((startpage-curtex)<<14);
skytex=PM_GetTexture(startpage-curtex);
nextx=0x7fff;
for(i=0;i<4;i++)
{
mask=1<<((x+i)&3);
VGAMAPMASK(mask);
for(x2=x+i;x2<viewwidth;x2+=4)
{
t=pixelangle[x2]+midangle;
while(t<0) t+=FINEANGLES;
while(t>=FINEANGLES) t-=FINEANGLES;
xtex=(word)((((long)t) * NUMPARALLAXTEX * TEXTURESIZE)/FINEANGLES);
t=xtex>>TEXTURESHIFT;
if(t!=curtex)
{
if(x2<nextx) nextx=x2,nextxtex=xtex;
break;
}
texoffs= TEXTUREMASK -((xtex & (TEXTURESIZE - 1) ) << TEXTURESHIFT);
tend=skyheight-(wallheight[x2]>>3);
if(tend<=0) continue;
for(t=0,offs=x2>>2;t<tend;t++,offs+=80)
destbuf[offs]=skytex[texoffs+((t*TEXTURESIZE)/skyheight)];
}
if(x2>=viewwidth+3) nextx=viewwidth;
}
x=nextx;
xtex=nextxtex;
}
while(x<viewwidth);
}
unsigned parallax=1;
if(parallax)
DrawParallax(mapsegs[0][63]);
If I change wall number to parallax sky then it doesn't change to actually wall graphic as in Wolf4SDL.
Clone Enemy:
WL_ACT2.CPP:
- Code: Select all
if (ob->obclass == officerobj)
{
if (gamestate.weapon == wp_pistol)
ob->state = &s_ofcchase1;
else if (gamestate.weapon == wp_machinegun)
ob->state = &s_ofc2chase1;
}
2nd code I test in Mod pack. I added these codes in 4GW. When player uses machinegun and officer too,but it shoot then uses pistol at shooting.