Lots of feature upgrades.

This commit is contained in:
Justin Marshall
2026-05-30 02:50:21 -07:00
parent 7806bb8ef8
commit ea74cd9921
13 changed files with 2433 additions and 153 deletions
+481 -70
View File
@@ -71,11 +71,23 @@ void DrawUnit(long xp,long yp,BYTE *pCelBuff,long nCel,long nCelW,long ostart,lo
void DrawUnitOutline(byte ocolor, long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend);
void DrawInfraUnit(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend, char loff);
void DrawLitUnit(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend);
void DrawEnhancedUnit(long xp,long yp,BYTE *pCelBuff,long nCel,long nCelW,long ostart,long oend);
void DrawEnhancedInfraUnit(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend, char loff);
void DrawEnhancedLitUnit(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend);
void DrawUnitLerpOverlay(long xp,long yp,BYTE *pCelBuff,long nCel,long nCelW,long ostart,long oend,int density);
void DrawInfraUnitLerpOverlay(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend, char loff, int density);
void DrawLitUnitLerpOverlay(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend, int density);
void DrawUnitClipped(long xp,long yp,BYTE *pCelBuff,long nCel,long nCelW,long ostart,long oend);
void DrawUnitOutlineClipped(byte ocolor, long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend);
void DrawInfraUnitClipped(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend, char loff);
void DrawLitUnitClipped(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend);
void DrawEnhancedUnitClipped(long xp,long yp,BYTE *pCelBuff,long nCel,long nCelW,long ostart,long oend);
void DrawEnhancedInfraUnitClipped(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend, char loff);
void DrawEnhancedLitUnitClipped(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend);
void DrawUnitLerpOverlayClipped(long xp,long yp,BYTE *pCelBuff,long nCel,long nCelW,long ostart,long oend,int density);
void DrawInfraUnitLerpOverlayClipped(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend, char loff, int density);
void DrawLitUnitLerpOverlayClipped(long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend, int density);
#endif
void DrawHTLXsub (BYTE *pTo, int sx, int sy, int xp, int yp, BOOL chflag);
@@ -98,9 +110,13 @@ extern "C" {
char gbPartialTrans;
DWORD gdwPNum;
long glClipY;
extern BYTE gbWorldGoldShimmerActive;
extern BYTE gbWorldGoldShimmerTable[4][256];
}
int gnMI;
long nBuffWTbl[1024];
int gnRenderFrameInterp;
extern int PlrWalkLenTbl[NUM_CLASSES];
// frame counter
@@ -111,6 +127,340 @@ static BYTE sgfFrameCounterEnabled = FALSE;
bool HighLightAllItems = false;
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static void SetDungeonLightContext(int sx, int sy, int, int)
{
nLVal = dLight[sx][sy];
if (nLVal < lightmax)
nLVal++;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int VisualHalfStep(long velocity, int fixedShift)
{
int interp;
__int64 step;
interp = gnRenderFrameInterp;
if (interp <= 0 || velocity == 0)
return 0;
if (interp > 256)
interp = 256;
step = velocity;
if (step < 0)
return -(int)(((-step) * interp) >> (fixedShift + 8));
return (int)((step * interp) >> (fixedShift + 8));
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static BOOL PlayerUsesVisualLerp(PlayerStruct *pPlayer)
{
return pPlayer->_pmode == PM_WALK
|| pPlayer->_pmode == PM_WALK2
|| pPlayer->_pmode == PM_WALK3;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static BOOL PlayerHasVisualStep(PlayerStruct *pPlayer)
{
int walkLen;
walkLen = 8;
if (currlevel != 0)
walkLen = PlrWalkLenTbl[pPlayer->_pClass];
return pPlayer->_pVar8 < walkLen;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetPlayerDrawX(PlayerStruct *pPlayer, int xp)
{
xp += pPlayer->_pxoff;
if (PlayerUsesVisualLerp(pPlayer) && PlayerHasVisualStep(pPlayer))
xp += VisualHalfStep(pPlayer->_pxvel, 8);
return xp;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetPlayerDrawY(PlayerStruct *pPlayer, int yp)
{
yp += pPlayer->_pyoff;
if (PlayerUsesVisualLerp(pPlayer) && PlayerHasVisualStep(pPlayer))
yp += VisualHalfStep(pPlayer->_pyvel, 8);
return yp;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetScrollDrawX()
{
int sxoff;
PlayerStruct *pPlayer;
sxoff = ScrollInfo._sxoff;
if (ScrollInfo._sdir == SCRL_NONE)
return sxoff;
pPlayer = &plr[myplr];
if (PlayerUsesVisualLerp(pPlayer) && PlayerHasVisualStep(pPlayer))
sxoff -= VisualHalfStep(pPlayer->_pxvel, 8);
return sxoff;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetScrollDrawY()
{
int syoff;
PlayerStruct *pPlayer;
syoff = ScrollInfo._syoff;
if (ScrollInfo._sdir == SCRL_NONE)
return syoff;
pPlayer = &plr[myplr];
if (PlayerUsesVisualLerp(pPlayer) && PlayerHasVisualStep(pPlayer))
syoff -= VisualHalfStep(pPlayer->_pyvel, 8);
return syoff;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static BOOL MonsterUsesVisualLerp(MonsterStruct *pMonster)
{
return pMonster->_mmode == MM_WALK
|| pMonster->_mmode == MM_WALK2
|| pMonster->_mmode == MM_WALK3;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static BOOL MonsterHasVisualStep(MonsterStruct *pMonster)
{
return pMonster->_mVar8 < pMonster->MType->Anims[MA_WALK].Frames;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetMonsterDrawX(MonsterStruct *pMonster, int xp)
{
xp += pMonster->_mxoff;
if (MonsterUsesVisualLerp(pMonster) && MonsterHasVisualStep(pMonster))
xp += VisualHalfStep(pMonster->_mxvel, 4);
return xp;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetMonsterDrawY(MonsterStruct *pMonster, int yp)
{
yp += pMonster->_myoff;
if (MonsterUsesVisualLerp(pMonster) && MonsterHasVisualStep(pMonster))
yp += VisualHalfStep(pMonster->_myvel, 4);
return yp;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetMissileDrawX(MissileStruct *pMiss, int xp)
{
xp += pMiss->_mixoff;
if (!(pMiss->_miAnimFlags & MFF_STATIC))
xp += VisualHalfStep(pMiss->_mixvel, 16);
return xp;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetMissileDrawY(MissileStruct *pMiss, int yp)
{
yp += pMiss->_miyoff;
if (!(pMiss->_miAnimFlags & MFF_STATIC))
yp += VisualHalfStep(pMiss->_miyvel, 16);
return yp;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetVisualLerpDensity(int animCnt, int animDelay)
{
int interp;
int progress;
int density;
if (animDelay <= 1)
return 0;
interp = gnRenderFrameInterp;
if (interp < 0)
interp = 0;
if (interp > 256)
interp = 256;
progress = animCnt * 256 + interp;
density = (progress * 4) / (animDelay * 256);
if (density < 1)
return 0;
if (density > 3)
density = 3;
return density;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetForwardFrame(int frame, int length, int add, BOOL allowWrap)
{
frame += add;
if (frame > length)
return allowWrap ? 1 : 0;
if (frame < 1)
return allowWrap ? length : 0;
return frame;
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetPlayerLerpFrame(PlayerStruct *pPlayer, int *density)
{
*density = GetVisualLerpDensity(pPlayer->_pAnimCnt, pPlayer->_pAnimDelay);
if (*density == 0)
return 0;
return GetForwardFrame(pPlayer->_pAnimFrame, pPlayer->_pAnimLen, 1, FALSE);
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetMonsterLerpFrame(MonsterStruct *pMonster, int *density)
{
int add;
*density = GetVisualLerpDensity(pMonster->_mAnimCnt, pMonster->_mAnimDelay);
if (*density == 0 || (pMonster->_mFlags & MFLAG_STILL))
return 0;
add = (pMonster->_mFlags & MFLAG_BACKWARDS) ? -1 : 1;
return GetForwardFrame(pMonster->_mAnimFrame, pMonster->_mAnimLen, add, FALSE);
}
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static int GetMissileLerpFrame(MissileStruct *pMiss, int *density)
{
*density = GetVisualLerpDensity(pMiss->_miAnimCnt, pMiss->_miAnimDelay);
if (*density == 0 || (pMiss->_miAnimFlags & MFF_STATIC))
return 0;
return GetForwardFrame(pMiss->_miAnimFrame, pMiss->_miAnimLen, pMiss->_miAnimAdd, TRUE);
}
#if RLE_DRAW
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
static void DrawMissileLerpOverlay(MissileStruct *pMiss, int mx, int my, int ds, int de, BOOL clipped)
{
int density, nextFrame;
nextFrame = GetMissileLerpFrame(pMiss, &density);
if (!nextFrame)
return;
if (pMiss->_miUniqTrans) {
if (clipped)
DrawInfraUnitLerpOverlayClipped(mx, my, pMiss->_miAnimData, nextFrame, pMiss->_miAnimWidth, ds, de, LIGHT_U + pMiss->_miUniqTrans - 1, density);
else
DrawInfraUnitLerpOverlay(mx, my, pMiss->_miAnimData, nextFrame, pMiss->_miAnimWidth, ds, de, LIGHT_U + pMiss->_miUniqTrans - 1, density);
} else if (pMiss->_miLightFlag) {
if (clipped)
DrawLitUnitLerpOverlayClipped(mx, my, pMiss->_miAnimData, nextFrame, pMiss->_miAnimWidth, ds, de, density);
else
DrawLitUnitLerpOverlay(mx, my, pMiss->_miAnimData, nextFrame, pMiss->_miAnimWidth, ds, de, density);
} else {
if (clipped)
DrawUnitLerpOverlayClipped(mx, my, pMiss->_miAnimData, nextFrame, pMiss->_miAnimWidth, ds, de, density);
else
DrawUnitLerpOverlay(mx, my, pMiss->_miAnimData, nextFrame, pMiss->_miAnimWidth, ds, de, density);
}
}
#endif
/*-----------------------------------------------------------------------**
**-----------------------------------------------------------------------*/
void ApplyWorldGoldShimmer(ItemStruct *pItem, int itemIndex, int x, int y, int ostart, int oend)
{
int row, col, frame, fleck, run, xx, yy;
int nWidth, nCel;
long RLELen, offval, offval2;
BYTE *pFrame;
BYTE *pRLE;
BYTE *pEnd;
if (!gbWorldGoldShimmerActive || gpBuffer == NULL || pItem->_itype != IT_GOLD)
return;
nCel = pItem->_iAnimFrame;
nWidth = pItem->_iAnimWidth;
if (pItem->_iAnimData == NULL || nCel < 1 || nWidth <= 0)
return;
pFrame = pItem->_iAnimData + *((DWORD *)pItem->_iAnimData + nCel);
offval = *(WORD *)(pFrame + ostart);
if (!offval)
return;
RLELen = *((DWORD *)pItem->_iAnimData + nCel + 1) - *((DWORD *)pItem->_iAnimData + nCel);
offval2 = (oend == 8) ? 0 : *(WORD *)(pFrame + oend);
RLELen = offval2 ? offval2 - offval : RLELen - offval;
pRLE = pFrame + offval;
pEnd = pRLE + RLELen;
y -= ostart << 4;
frame = (GetTickCount() / 130) + itemIndex * 17 + pItem->_ix * 5 + pItem->_iy * 11;
for (row = 0; pRLE < pEnd; row++) {
yy = y - row;
col = 0;
while (col < nWidth && pRLE < pEnd) {
run = (signed char)*pRLE++;
if (run >= 0) {
if (run == 0)
break;
for (int i = 0; i < run; i++) {
xx = x + col + i;
if (xx >= 0 && xx < BUFFERX && yy >= 0 && yy < BUFFERY) {
BYTE *p = gpBuffer + nBuffWTbl[yy] + xx;
fleck = (row * 37 + (col + i) * 53 + frame * 29) & 31;
if (*p != IOUTC)
*p = gbWorldGoldShimmerTable[fleck < 5 ? 1 : 3][*p];
}
}
pRLE += run;
col += run;
} else {
col -= run;
}
}
}
}
//******************************************************************
// savecrsr variables
//******************************************************************
@@ -229,8 +579,8 @@ void DrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
if (dMissile[sx][sy] != -1) {
gnMI = dMissile[sx][sy] - 1;
if(missile[gnMI]._miPreFlag == pre) {
mx = missile[gnMI]._mixoff + xp - missile[gnMI]._miAnimWidth2;
my = missile[gnMI]._miyoff + yp;
mx = GetMissileDrawX(&missile[gnMI], xp) - missile[gnMI]._miAnimWidth2;
my = GetMissileDrawY(&missile[gnMI], yp);
if (missile[gnMI]._miUniqTrans) {
DrawSlabCelI(mx, my, missile[gnMI]._miAnimData, missile[gnMI]._miAnimFrame, missile[gnMI]._miAnimWidth, ds, de, LIGHT_U + missile[gnMI]._miUniqTrans - 1);
}
@@ -250,8 +600,8 @@ void DrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
if ((missile[gnMI]._mix == sx) && (missile[gnMI]._miy == sy)
&& (missile[gnMI]._miPreFlag == pre) && (missile[gnMI]._miDrawFlag == TRUE))
{
mx = missile[gnMI]._mixoff + xp - missile[gnMI]._miAnimWidth2;
my = missile[gnMI]._miyoff + yp;
mx = GetMissileDrawX(&missile[gnMI], xp) - missile[gnMI]._miAnimWidth2;
my = GetMissileDrawY(&missile[gnMI], yp);
if (missile[gnMI]._miUniqTrans) {
DrawSlabCelI(mx, my, missile[gnMI]._miAnimData, missile[gnMI]._miAnimFrame, missile[gnMI]._miAnimWidth, ds, de, LIGHT_U + missile[gnMI]._miUniqTrans - 1);
}
@@ -280,8 +630,8 @@ void CDrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
if (dMissile[sx][sy] != -1) {
gnMI = dMissile[sx][sy] - 1;
if (missile[gnMI]._miPreFlag == pre) {
mx = missile[gnMI]._mixoff + xp - missile[gnMI]._miAnimWidth2;
my = missile[gnMI]._miyoff + yp;
mx = GetMissileDrawX(&missile[gnMI], xp) - missile[gnMI]._miAnimWidth2;
my = GetMissileDrawY(&missile[gnMI], yp);
if (missile[gnMI]._miUniqTrans)
CDrawSlabCelI(mx, my, missile[gnMI]._miAnimData, missile[gnMI]._miAnimFrame, missile[gnMI]._miAnimWidth, ds, de, LIGHT_U + missile[gnMI]._miUniqTrans - 1);
else {
@@ -295,8 +645,8 @@ void CDrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
if ((missile[gnMI]._mix == sx) && (missile[gnMI]._miy == sy)
&& (missile[gnMI]._miPreFlag == pre) && (missile[gnMI]._miDrawFlag == TRUE))
{
mx = missile[gnMI]._mixoff + xp - missile[gnMI]._miAnimWidth2;
my = missile[gnMI]._miyoff + yp;
mx = GetMissileDrawX(&missile[gnMI], xp) - missile[gnMI]._miAnimWidth2;
my = GetMissileDrawY(&missile[gnMI], yp);
if (missile[gnMI]._miUniqTrans)
CDrawSlabCelI(mx, my, missile[gnMI]._miAnimData, missile[gnMI]._miAnimFrame, missile[gnMI]._miAnimWidth, ds, de, LIGHT_U + missile[gnMI]._miUniqTrans - 1);
else {
@@ -353,8 +703,8 @@ void DrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
#endif
// jcm.patch1.end.1/14/97
}
mx = pMiss->_mixoff + xp - pMiss->_miAnimWidth2;
my = pMiss->_miyoff + yp;
mx = GetMissileDrawX(pMiss, xp) - pMiss->_miAnimWidth2;
my = GetMissileDrawY(pMiss, yp);
if (pMiss->_miUniqTrans) {
DrawInfraUnit(
mx, my,
@@ -369,6 +719,7 @@ void DrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
} else {
DrawUnit(mx, my, pMiss->_miAnimData, pMiss->_miAnimFrame, pMiss->_miAnimWidth, ds, de);
}
DrawMissileLerpOverlay(pMiss, mx, my, ds, de, FALSE);
}
return;
}
@@ -398,8 +749,8 @@ void DrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
#endif
// jcm.patch1.end.1/14/97
}
mx = pMiss->_mixoff + xp - pMiss->_miAnimWidth2;
my = pMiss->_miyoff + yp;
mx = GetMissileDrawX(pMiss, xp) - pMiss->_miAnimWidth2;
my = GetMissileDrawY(pMiss, yp);
if (pMiss->_miUniqTrans) {
DrawInfraUnit(
mx, my,
@@ -414,6 +765,7 @@ void DrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
} else {
DrawUnit(mx, my, pMiss->_miAnimData, pMiss->_miAnimFrame, pMiss->_miAnimWidth, ds, de);
}
DrawMissileLerpOverlay(pMiss, mx, my, ds, de, FALSE);
}
#endif
@@ -460,8 +812,8 @@ void CDrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
#endif
// jcm.patch1.end.1/14/97
}
mx = pMiss->_mixoff + xp - pMiss->_miAnimWidth2;
my = pMiss->_miyoff + yp;
mx = GetMissileDrawX(pMiss, xp) - pMiss->_miAnimWidth2;
my = GetMissileDrawY(pMiss, yp);
if (pMiss->_miUniqTrans) {
DrawInfraUnitClipped(
mx, my,
@@ -476,6 +828,7 @@ void CDrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
} else {
DrawUnitClipped(mx,my,pMiss->_miAnimData,pMiss->_miAnimFrame,pMiss->_miAnimWidth,ds,de);
}
DrawMissileLerpOverlay(pMiss, mx, my, ds, de, TRUE);
}
return;
}
@@ -505,8 +858,8 @@ void CDrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
#endif
// jcm.patch1.end.1/14/97
}
mx = pMiss->_mixoff + xp - pMiss->_miAnimWidth2;
my = pMiss->_miyoff + yp;
mx = GetMissileDrawX(pMiss, xp) - pMiss->_miAnimWidth2;
my = GetMissileDrawY(pMiss, yp);
if (pMiss->_miUniqTrans) {
DrawInfraUnitClipped(
mx, my,
@@ -521,6 +874,7 @@ void CDrawMissile(int sx, int sy, int xp, int yp, int ds, int de, BOOL pre)
} else {
DrawUnitClipped(mx,my,pMiss->_miAnimData,pMiss->_miAnimFrame,pMiss->_miAnimWidth,ds,de);
}
DrawMissileLerpOverlay(pMiss, mx, my, ds, de, TRUE);
}
#endif
@@ -605,6 +959,8 @@ inline const char * MonsterActionString(DWORD dwAction) {
#if RLE_DRAW
static void DrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart, int oend)
{
int density, nextFrame;
if ((DWORD)gnMI >= MAXMONSTERS)
// jcm.patch1.start.1/14/97
#ifdef GRACEFUL_EXIT
@@ -639,7 +995,7 @@ static void DrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart,
// jcm.patch1.end.1/14/97
}
if (!(dFlags[sx][sy] & BFLAG_VISIBLE)) {
DrawInfraUnit(
DrawEnhancedInfraUnit(
xp, yp,
monster[gnMI]._mAnimData,
monster[gnMI]._mAnimFrame,
@@ -648,6 +1004,9 @@ static void DrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart,
oend,
LIGHT_INFRA
);
nextFrame = GetMonsterLerpFrame(&monster[gnMI], &density);
if (nextFrame)
DrawInfraUnitLerpOverlay(xp, yp, monster[gnMI]._mAnimData, nextFrame, monster[gnMI].MType->mAnimWidth, ostart, oend, LIGHT_INFRA, density);
return;
}
char dinfra = LIGHT_NORM;
@@ -658,7 +1017,7 @@ static void DrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart,
if (plr[myplr]._pInfraFlag && (nLVal > 8))
dinfra = LIGHT_INFRA;
if (dinfra != LIGHT_NORM)
DrawInfraUnit(
DrawEnhancedInfraUnit(
xp, yp,
monster[gnMI]._mAnimData,
monster[gnMI]._mAnimFrame,
@@ -668,7 +1027,7 @@ static void DrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart,
dinfra
);
else
DrawLitUnit(
DrawEnhancedLitUnit(
xp, yp,
monster[gnMI]._mAnimData,
monster[gnMI]._mAnimFrame,
@@ -676,6 +1035,13 @@ static void DrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart,
ostart,
oend
);
nextFrame = GetMonsterLerpFrame(&monster[gnMI], &density);
if (nextFrame) {
if (dinfra != LIGHT_NORM)
DrawInfraUnitLerpOverlay(xp, yp, monster[gnMI]._mAnimData, nextFrame, monster[gnMI].MType->mAnimWidth, ostart, oend, dinfra, density);
else
DrawLitUnitLerpOverlay(xp, yp, monster[gnMI]._mAnimData, nextFrame, monster[gnMI].MType->mAnimWidth, ostart, oend, density);
}
}
#endif
@@ -685,6 +1051,8 @@ static void DrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart,
#if RLE_DRAW
static void CDrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart, int oend)
{
int density, nextFrame;
if ((DWORD)gnMI >= MAXMONSTERS)
// jcm.patch1.start.1/14/97
#ifdef GRACEFUL_EXIT
@@ -719,7 +1087,7 @@ static void CDrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart
// jcm.patch1.end.1/14/97
}
if (!(dFlags[sx][sy] & BFLAG_VISIBLE)) {
DrawInfraUnitClipped(
DrawEnhancedInfraUnitClipped(
xp, yp,
monster[gnMI]._mAnimData,
monster[gnMI]._mAnimFrame,
@@ -728,6 +1096,9 @@ static void CDrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart
oend,
LIGHT_INFRA
);
nextFrame = GetMonsterLerpFrame(&monster[gnMI], &density);
if (nextFrame)
DrawInfraUnitLerpOverlayClipped(xp, yp, monster[gnMI]._mAnimData, nextFrame, monster[gnMI].MType->mAnimWidth, ostart, oend, LIGHT_INFRA, density);
return;
}
char dinfra = LIGHT_NORM;
@@ -738,7 +1109,7 @@ static void CDrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart
if (plr[myplr]._pInfraFlag && (nLVal > 8))
dinfra = LIGHT_INFRA;
if (dinfra != LIGHT_NORM)
DrawInfraUnitClipped(
DrawEnhancedInfraUnitClipped(
xp, yp,
monster[gnMI]._mAnimData,
monster[gnMI]._mAnimFrame,
@@ -748,7 +1119,7 @@ static void CDrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart
dinfra
);
else
DrawLitUnitClipped(
DrawEnhancedLitUnitClipped(
xp, yp,
monster[gnMI]._mAnimData,
monster[gnMI]._mAnimFrame,
@@ -756,6 +1127,13 @@ static void CDrawMSlabCelL (int sx, int sy, int xp, int yp, int gnMI, int ostart
ostart,
oend
);
nextFrame = GetMonsterLerpFrame(&monster[gnMI], &density);
if (nextFrame) {
if (dinfra != LIGHT_NORM)
DrawInfraUnitLerpOverlayClipped(xp, yp, monster[gnMI]._mAnimData, nextFrame, monster[gnMI].MType->mAnimWidth, ostart, oend, dinfra, density);
else
DrawLitUnitLerpOverlayClipped(xp, yp, monster[gnMI]._mAnimData, nextFrame, monster[gnMI].MType->mAnimWidth, ostart, oend, density);
}
}
#endif
@@ -864,6 +1242,8 @@ inline const char * PlayerActionString(DWORD dwAction) {
static void DrawPSlabCelL (
int nPlayer, int sx, int sy, long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend)
{
int density, nextFrame;
if (!(dFlags[sx][sy] & BFLAG_VISIBLE) && !plr[myplr]._pInfraFlag && (setlevel || currlevel))
return;
if (pCelBuff == NULL)
@@ -895,17 +1275,26 @@ static void DrawPSlabCelL (
DrawUnitOutline(POUTC,xp,yp,pCelBuff,nCel,nCelW,ostart,oend);
if (nPlayer == myplr) {
DrawUnit(xp, yp, pCelBuff, nCel, nCelW, ostart, oend);
DrawEnhancedUnit(xp, yp, pCelBuff, nCel, nCelW, ostart, oend);
nextFrame = GetPlayerLerpFrame(&plr[nPlayer], &density);
if (nextFrame)
DrawUnitLerpOverlay(xp, yp, pCelBuff, nextFrame, nCelW, ostart, oend, density);
}
else if (!(dFlags[sx][sy] & BFLAG_VISIBLE)
|| plr[myplr]._pInfraFlag && (nLVal > 8)) {
DrawInfraUnit(xp, yp, pCelBuff, nCel, nCelW, ostart, oend, LIGHT_INFRA);
DrawEnhancedInfraUnit(xp, yp, pCelBuff, nCel, nCelW, ostart, oend, LIGHT_INFRA);
nextFrame = GetPlayerLerpFrame(&plr[nPlayer], &density);
if (nextFrame)
DrawInfraUnitLerpOverlay(xp, yp, pCelBuff, nextFrame, nCelW, ostart, oend, LIGHT_INFRA, density);
}
else {
// Draw other players slightly brighter than monsters
int templval = nLVal;
nLVal = (nLVal < 5) ? 0 : nLVal - 5;
DrawLitUnit(xp, yp, pCelBuff, nCel, nCelW, ostart, oend);
DrawEnhancedLitUnit(xp, yp, pCelBuff, nCel, nCelW, ostart, oend);
nextFrame = GetPlayerLerpFrame(&plr[nPlayer], &density);
if (nextFrame)
DrawLitUnitLerpOverlay(xp, yp, pCelBuff, nextFrame, nCelW, ostart, oend, density);
nLVal = templval;
}
}
@@ -918,6 +1307,8 @@ static void DrawPSlabCelL (
static void CDrawPSlabCelL (
int nPlayer, int sx, int sy, long xp, long yp, BYTE *pCelBuff, long nCel, long nCelW, long ostart, long oend)
{
int density, nextFrame;
if (!(dFlags[sx][sy] & BFLAG_VISIBLE) && !plr[myplr]._pInfraFlag)
return;
if (pCelBuff == NULL)
@@ -948,15 +1339,29 @@ static void CDrawPSlabCelL (
if (nPlayer == cursplr)
DrawUnitOutlineClipped(POUTC,xp,yp,pCelBuff,nCel,nCelW,ostart,oend);
if (nPlayer == myplr) {
DrawUnitClipped(xp, yp, pCelBuff, nCel, nCelW, ostart, oend);
DrawEnhancedUnitClipped(xp, yp, pCelBuff, nCel, nCelW, ostart, oend);
} else if (!(dFlags[sx][sy] & BFLAG_VISIBLE)
|| plr[myplr]._pInfraFlag && (nLVal > 8)) {
DrawInfraUnitClipped(xp, yp, pCelBuff, nCel, nCelW, ostart, oend, LIGHT_INFRA);
DrawEnhancedInfraUnitClipped(xp, yp, pCelBuff, nCel, nCelW, ostart, oend, LIGHT_INFRA);
} else {
// Draw other players slightly brighter than monsters
int templval = nLVal;
nLVal = (nLVal < 5) ? 0 : nLVal - 5;
DrawLitUnitClipped(xp, yp, pCelBuff, nCel, nCelW, ostart, oend);
DrawEnhancedLitUnitClipped(xp, yp, pCelBuff, nCel, nCelW, ostart, oend);
nLVal = templval;
}
nextFrame = GetPlayerLerpFrame(&plr[nPlayer], &density);
if (!nextFrame)
return;
if (nPlayer == myplr) {
DrawUnitLerpOverlayClipped(xp, yp, pCelBuff, nextFrame, nCelW, ostart, oend, density);
} else if (!(dFlags[sx][sy] & BFLAG_VISIBLE)
|| plr[myplr]._pInfraFlag && (nLVal > 8)) {
DrawInfraUnitLerpOverlayClipped(xp, yp, pCelBuff, nextFrame, nCelW, ostart, oend, LIGHT_INFRA, density);
} else {
int templval = nLVal;
nLVal = (nLVal < 5) ? 0 : nLVal - 5;
DrawLitUnitLerpOverlayClipped(xp, yp, pCelBuff, nextFrame, nCelW, ostart, oend, density);
nLVal = templval;
}
}
@@ -1007,8 +1412,8 @@ void DrawDeadPlr(int sx, int sy, int xp, int yp, int ostart, int oend, BOOL clip
}
dFlags[sx][sy] |= BFLAG_DEADPLR;
PlayerDraw(pnum, sx, sy,
pPlayer->_pxoff + xp - pPlayer->_pAnimWidth2,
pPlayer->_pyoff + yp,
GetPlayerDrawX(pPlayer, xp) - pPlayer->_pAnimWidth2,
GetPlayerDrawY(pPlayer, yp),
pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth,
ostart, oend);
}
@@ -1158,7 +1563,7 @@ static void DrawEFlag1(BYTE *pTo2, int sx, int sy, int xp, int yp)
oldnTrans = nTrans;
oldPieceNum = gnPieceNum;
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
nTrans = TransList[dTransVal[sx][sy]] & nTransTable[gnPieceNum];
mt = &dMT2[CalcRot(sx,sy)].mt[0];
@@ -1361,6 +1766,7 @@ static void DrawHTLXsub (BYTE *pTo, int sx, int sy, int xp, int yp, BOOL chflag)
0,
8
);
ApplyWorldGoldShimmer(pItem, bItem - 1, pxp, yp, 0, 8);
}
// jcm.patch1.start.1/14/97
#ifdef GRACEFUL_EXIT
@@ -1384,8 +1790,8 @@ static void DrawHTLXsub (BYTE *pTo, int sx, int sy, int xp, int yp, BOOL chflag)
#endif
// jcm.patch1.end.1/14/97
PlayerStruct * pPlayer = &plr[nPlayer];
pxp = pPlayer->_pxoff + xp - pPlayer->_pAnimWidth2;
pyp = pPlayer->_pyoff + yp;
pxp = GetPlayerDrawX(pPlayer, xp) - pPlayer->_pAnimWidth2;
pyp = GetPlayerDrawY(pPlayer, yp);
CDrawPSlabCelL(
-(bPlayerAbove + 1),
sx, sy-1,
@@ -1433,8 +1839,8 @@ static void DrawHTLXsub (BYTE *pTo, int sx, int sy, int xp, int yp, BOOL chflag)
app_fatal("Draw Monster \"%s\" Clipped: uninitialized monster",pMonster->mName);
#endif
// jcm.patch1.end.1/14/97
pxp = pMonster->_mxoff + xp - pMonster->MType->mAnimWidth2;
pyp = pMonster->_myoff + yp;
pxp = GetMonsterDrawX(pMonster, xp) - pMonster->MType->mAnimWidth2;
pyp = GetMonsterDrawY(pMonster, yp);
#if RLE_DRAW
if (gnMI == cursmonst)
DrawUnitOutlineClipped(
@@ -1488,8 +1894,8 @@ static void DrawHTLXsub (BYTE *pTo, int sx, int sy, int xp, int yp, BOOL chflag)
#endif
// jcm.patch1.end.1/14/97
PlayerStruct * pPlayer = &plr[nPlayer];
pxp = pPlayer->_pxoff + xp - pPlayer->_pAnimWidth2;
pyp = pPlayer->_pyoff + yp;
pxp = GetPlayerDrawX(pPlayer, xp) - pPlayer->_pAnimWidth2;
pyp = GetPlayerDrawY(pPlayer, yp);
CDrawPSlabCelL(
bPlayer - 1,
sx, sy,
@@ -1537,8 +1943,8 @@ static void DrawHTLXsub (BYTE *pTo, int sx, int sy, int xp, int yp, BOOL chflag)
app_fatal("Draw Monster \"%s\" Clipped: uninitialized monster",pMonster->mName);
#endif
// jcm.patch1.end.1/14/97
pxp = pMonster->_mxoff + xp - pMonster->MType->mAnimWidth2;
pyp = pMonster->_myoff + yp;
pxp = GetMonsterDrawX(pMonster, xp) - pMonster->MType->mAnimWidth2;
pyp = GetMonsterDrawY(pMonster, yp);
#if RLE_DRAW
if (gnMI == cursmonst)
DrawUnitOutlineClipped(
@@ -1639,6 +2045,7 @@ static void DrawHTLXsub (BYTE *pTo, int sx, int sy, int xp, int yp, BOOL chflag)
0,
8
);
ApplyWorldGoldShimmer(pItem, bItem - 1, pxp, yp, 0, 8);
}
// jcm.patch1.start.1/14/97
#ifdef GRACEFUL_EXIT
@@ -1668,7 +2075,7 @@ static void DrawHTileLineX (int sx, int sy, int xp, int yp, int nd, int halfflag
if (halfflag) {
if (((unsigned)sy < DMAXY) && ((unsigned)sx < DMAXX)) {
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
if (gnPieceNum) {
pTo = gpBuffer + nBuffWTbl[yp] + xp + 32;
nTrans = TransList[dTransVal[sx][sy]] & nTransTable[gnPieceNum];
@@ -1717,7 +2124,7 @@ static void DrawHTileLineX (int sx, int sy, int xp, int yp, int nd, int halfflag
if (sy >= DMAXY || sx < 0)
continue;
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
if (!gnPieceNum) {
pTo = gpBuffer + nBuffWTbl[yp] + xp;
DrawBlankMTile(pTo);
@@ -1748,7 +2155,7 @@ static void DrawHTileLineX (int sx, int sy, int xp, int yp, int nd, int halfflag
if (!halfflag || !((unsigned)sy < DMAXY && (unsigned)sx < DMAXX))
return;
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
if (!gnPieceNum) {
pTo = gpBuffer + nBuffWTbl[yp] + xp;
DrawBlankMTile(pTo);
@@ -1794,7 +2201,7 @@ static void DrawEFlag2(BYTE *pTo2, int sx, int sy, int sv, int sv2, int xp, int
oldnTrans = nTrans;
oldPieceNum = gnPieceNum;
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
pTo = pTo2 + (NBUFFWSL5 * sv);
nTrans = TransList[dTransVal[sx][sy]] & nTransTable[gnPieceNum];
mt = &dMT2[CalcRot(sx,sy)].mt[0];
@@ -2005,6 +2412,7 @@ static void DrawHTLXsub2 (BYTE *pTo, int sx, int sy, int sv, int sv2, int xp, in
sv2,
8
);
ApplyWorldGoldShimmer(pItem, bItem - 1, pxp, yp, sv2, 8);
}
// jcm.patch1.start.1/14/97
#ifdef GRACEFUL_EXIT
@@ -2028,8 +2436,8 @@ static void DrawHTLXsub2 (BYTE *pTo, int sx, int sy, int sv, int sv2, int xp, in
#endif
// jcm.patch1.end.1/14/97
PlayerStruct * pPlayer = &plr[nPlayer];
pxp = pPlayer->_pxoff + xp - pPlayer->_pAnimWidth2;
pyp = pPlayer->_pyoff + yp;
pxp = GetPlayerDrawX(pPlayer, xp) - pPlayer->_pAnimWidth2;
pyp = GetPlayerDrawY(pPlayer, yp);
CDrawPSlabCelL(
-(bPlayerAbove + 1),
sx, sy-1,
@@ -2077,8 +2485,8 @@ static void DrawHTLXsub2 (BYTE *pTo, int sx, int sy, int sv, int sv2, int xp, in
app_fatal("Draw Monster \"%s\" Clipped: uninitialized monster",pMonster->mName);
#endif
// jcm.patch1.end.1/14/97
pxp = pMonster->_mxoff + xp - pMonster->MType->mAnimWidth2;
pyp = pMonster->_myoff + yp;
pxp = GetMonsterDrawX(pMonster, xp) - pMonster->MType->mAnimWidth2;
pyp = GetMonsterDrawY(pMonster, yp);
#if RLE_DRAW
if (gnMI == cursmonst)
DrawUnitOutlineClipped(
@@ -2132,8 +2540,8 @@ static void DrawHTLXsub2 (BYTE *pTo, int sx, int sy, int sv, int sv2, int xp, in
#endif
// jcm.patch1.end.1/14/97
PlayerStruct * pPlayer = &plr[nPlayer];
pxp = pPlayer->_pxoff + xp - pPlayer->_pAnimWidth2;
pyp = pPlayer->_pyoff + yp;
pxp = GetPlayerDrawX(pPlayer, xp) - pPlayer->_pAnimWidth2;
pyp = GetPlayerDrawY(pPlayer, yp);
CDrawPSlabCelL(
bPlayer - 1,
sx, sy,
@@ -2181,8 +2589,8 @@ static void DrawHTLXsub2 (BYTE *pTo, int sx, int sy, int sv, int sv2, int xp, in
app_fatal("Draw Monster \"%s\" Clipped: uninitialized monster",pMonster->mName);
#endif
// jcm.patch1.end.1/14/97
pxp = pMonster->_mxoff + xp - pMonster->MType->mAnimWidth2;
pyp = pMonster->_myoff + yp;
pxp = GetMonsterDrawX(pMonster, xp) - pMonster->MType->mAnimWidth2;
pyp = GetMonsterDrawY(pMonster, yp);
#if RLE_DRAW
if (gnMI == cursmonst)
DrawUnitOutlineClipped(
@@ -2283,6 +2691,7 @@ static void DrawHTLXsub2 (BYTE *pTo, int sx, int sy, int sv, int sv2, int xp, in
sv2,
8
);
ApplyWorldGoldShimmer(pItem, bItem - 1, pxp, yp, sv2, 8);
}
// jcm.patch1.start.1/14/97
#ifdef GRACEFUL_EXIT
@@ -2314,7 +2723,7 @@ static void DrawHTLX2 (int sx, int sy, int xp, int yp, int nd, int sv, int halff
if (halfflag != 0) {
if ((sy >= 0) && (sy < DMAXY) && (sx >= 0) && (sx < DMAXX)) {
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
if (gnPieceNum != 0) {
pTo = gpBuffer + nBuffWTbl[yp] + xp - NBUFFWSL5 + 32;
nTrans = TransList[dTransVal[sx][sy]] & nTransTable[gnPieceNum];
@@ -2342,7 +2751,7 @@ static void DrawHTLX2 (int sx, int sy, int xp, int yp, int nd, int sv, int halff
if (sy >= DMAXY || sx < 0)
continue;
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
if (!gnPieceNum)
continue;
pTo = gpBuffer + nBuffWTbl[yp] + xp - NBUFFWSL5;
@@ -2368,7 +2777,7 @@ static void DrawHTLX2 (int sx, int sy, int xp, int yp, int nd, int sv, int halff
return;
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
if (!gnPieceNum)
return;
@@ -2404,7 +2813,7 @@ static void DrawEFlag3(BYTE *pTo2, int sx, int sy, int ev, int ev2, int xp, int
oldnTrans = nTrans;
oldPieceNum = gnPieceNum;
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
pTo = pTo2;
nTrans = TransList[dTransVal[sx][sy]] & nTransTable[gnPieceNum];
mt = &dMT2[CalcRot(sx,sy)].mt[0];
@@ -2605,6 +3014,7 @@ static void DrawHTLXsub3 (BYTE *pTo, int sx, int sy, int ev, int ev2, int xp, in
0,
ev2//diff
);
ApplyWorldGoldShimmer(pItem, bItem - 1, pxp, yp, 0, ev2);
}
// jcm.patch1.start.1/14/97
#ifdef GRACEFUL_EXIT
@@ -2628,8 +3038,8 @@ static void DrawHTLXsub3 (BYTE *pTo, int sx, int sy, int ev, int ev2, int xp, in
#endif
// jcm.patch1.end.1/14/97
PlayerStruct * pPlayer = &plr[nPlayer];
pxp = pPlayer->_pxoff + xp - pPlayer->_pAnimWidth2;
pyp = pPlayer->_pyoff + yp;
pxp = GetPlayerDrawX(pPlayer, xp) - pPlayer->_pAnimWidth2;
pyp = GetPlayerDrawY(pPlayer, yp);
DrawPSlabCelL(
-(bPlayerAbove + 1),
sx, sy-1,
@@ -2677,8 +3087,8 @@ static void DrawHTLXsub3 (BYTE *pTo, int sx, int sy, int ev, int ev2, int xp, in
app_fatal("Draw Monster \"%s\": uninitialized monster",pMonster->mName);
#endif
// jcm.patch1.end.1/14/97
pxp = pMonster->_mxoff + xp - pMonster->MType->mAnimWidth2;
pyp = pMonster->_myoff + yp;
pxp = GetMonsterDrawX(pMonster, xp) - pMonster->MType->mAnimWidth2;
pyp = GetMonsterDrawY(pMonster, yp);
#if RLE_DRAW
if (gnMI == cursmonst)
DrawUnitOutline(
@@ -2732,8 +3142,8 @@ static void DrawHTLXsub3 (BYTE *pTo, int sx, int sy, int ev, int ev2, int xp, in
#endif
// jcm.patch1.end.1/14/97
PlayerStruct * pPlayer = &plr[nPlayer];
pxp = pPlayer->_pxoff + xp - pPlayer->_pAnimWidth2;
pyp = pPlayer->_pyoff + yp;
pxp = GetPlayerDrawX(pPlayer, xp) - pPlayer->_pAnimWidth2;
pyp = GetPlayerDrawY(pPlayer, yp);
DrawPSlabCelL(
bPlayer - 1,
sx, sy,
@@ -2781,8 +3191,8 @@ static void DrawHTLXsub3 (BYTE *pTo, int sx, int sy, int ev, int ev2, int xp, in
app_fatal("Draw Monster \"%s\": uninitialized monster",pMonster->mName);
#endif
// jcm.patch1.end.1/14/97
pxp = pMonster->_mxoff + xp - pMonster->MType->mAnimWidth2;
pyp = pMonster->_myoff + yp;
pxp = GetMonsterDrawX(pMonster, xp) - pMonster->MType->mAnimWidth2;
pyp = GetMonsterDrawY(pMonster, yp);
#if RLE_DRAW
if (gnMI == cursmonst)
DrawUnitOutline(
@@ -2883,6 +3293,7 @@ static void DrawHTLXsub3 (BYTE *pTo, int sx, int sy, int ev, int ev2, int xp, in
0,
ev2
);
ApplyWorldGoldShimmer(pItem, bItem - 1, pxp, yp, 0, ev2);
}
// jcm.patch1.start.1/14/97
#ifdef GRACEFUL_EXIT
@@ -2915,7 +3326,7 @@ static void DrawHTLX3 (int sx, int sy, int xp, int yp, int nd, int ev, int halff
if (halfflag != 0) {
if ((sy >= 0) && (sy < DMAXY) && (sx >= 0) && (sx < DMAXX)) {
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
if (gnPieceNum != 0) {
pTo = gpBuffer + nBuffWTbl[yp] + xp + 32;
nTrans = TransList[dTransVal[sx][sy]] & nTransTable[gnPieceNum];
@@ -2954,7 +3365,7 @@ static void DrawHTLX3 (int sx, int sy, int xp, int yp, int nd, int ev, int halff
for (i = 0; i < nd; ++i) {
if ((sy >= 0) && (sy < DMAXY) && (sx >= 0) && (sx < DMAXX)) {
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
if (gnPieceNum != 0) {
pTo = gpBuffer + nBuffWTbl[yp] + xp;
nTrans = TransList[dTransVal[sx][sy]] & nTransTable[gnPieceNum];
@@ -2990,7 +3401,7 @@ static void DrawHTLX3 (int sx, int sy, int xp, int yp, int nd, int ev, int halff
if (halfflag != 0) {
if ((sy >= 0) && (sy < DMAXY) && (sx >= 0) && (sx < DMAXX)) {
gnPieceNum = dPiece[sx][sy];
nLVal = dLight[sx][sy];
SetDungeonLightContext(sx, sy, xp, yp);
if (gnPieceNum != 0) {
pTo = gpBuffer + nBuffWTbl[yp] + xp;
nTrans = TransList[dTransVal[sx][sy]] & nTransTable[gnPieceNum];
@@ -3032,8 +3443,8 @@ static void SVGADrawView(int StartX, int StartY)
ViewBX = 10;
ViewBY = 11;
xpos = 64 + ScrollInfo._sxoff;
ypos = 175 + ScrollInfo._syoff;
xpos = 64 + GetScrollDrawX();
ypos = 175 + GetScrollDrawY();
StartX -= 10;
StartY -= 1;
width = 10;
@@ -3139,8 +3550,8 @@ static void VGADrawView (int StartX, int StartY)
ViewBX = 6;
ViewBY = 6;
xpos = 64 + ScrollInfo._sxoff;
ypos = 143 + ScrollInfo._syoff;
xpos = 64 + GetScrollDrawX();
ypos = 143 + GetScrollDrawY();
StartX -= 6;
StartY -= 1;
width = 6;