Browse Source

Merge town_draw() with scrollrt_draw()

This require calling DRLG_InitTrans() during CreateTown() to clear out
the transparancy flags after having been to the duntion. Else the
mausoleum will be transparent.
pull/380/head
Anders Jenbo 7 years ago
parent
commit
16820106bc
  1. 16
      Source/gendung.cpp
  2. 4
      Source/gendung.h
  3. 17
      Source/render.cpp
  4. 2
      Source/render.h
  5. 34
      Source/scrollrt.cpp
  6. 54
      Source/town.cpp

16
Source/gendung.cpp

@ -33,10 +33,6 @@ ScrollStruct ScrollInfo;
BYTE *pDungeonCels;
THEME_LOC themeLoc[MAXTHEMES];
char dPlayer[MAXDUNX][MAXDUNY];
int dword_5C2FF8;
int dword_5C2FFC;
int scr_pix_width;
int scr_pix_height;
char dArch[MAXDUNX][MAXDUNY];
BOOLEAN nBlockTable[2049];
BYTE *pSpecialCels;
@ -147,18 +143,6 @@ void SetDungeonMicros()
}
}
}
if (zoomflag) {
scr_pix_width = SCREEN_WIDTH;
scr_pix_height = VIEWPORT_HEIGHT;
dword_5C2FF8 = SCREEN_WIDTH / 64;
dword_5C2FFC = VIEWPORT_HEIGHT / 32;
} else {
scr_pix_width = ZOOM_WIDTH;
scr_pix_height = ZOOM_HEIGHT;
dword_5C2FF8 = ZOOM_WIDTH / 64;
dword_5C2FFC = ZOOM_HEIGHT / 32;
}
}
void DRLG_InitTrans()

4
Source/gendung.h

@ -33,10 +33,6 @@ extern ScrollStruct ScrollInfo;
extern BYTE *pDungeonCels;
extern THEME_LOC themeLoc[MAXTHEMES];
extern char dPlayer[MAXDUNX][MAXDUNY];
extern int dword_5C2FF8;
extern int dword_5C2FFC;
extern int scr_pix_width;
extern int scr_pix_height;
extern char dArch[MAXDUNX][MAXDUNY];
extern BOOLEAN nBlockTable[2049];
extern BYTE *pSpecialCels;

17
Source/render.cpp

@ -264,26 +264,27 @@ void RenderTile(BYTE *pBuff)
}
}
void world_draw_black_tile(BYTE *pBuff)
void world_draw_black_tile(int sx, int sy)
{
int i, j, k;
BYTE *dst;
dst = pBuff;
if (sx >= SCREEN_WIDTH - 64 || sy >= SCREEN_HEIGHT - 32)
return;
dst = &gpBuffer[sx + BUFFER_WIDTH * sy];
for (i = 30, j = 1; i >= 0; i -= 2, j++, dst -= BUFFER_WIDTH + 64) {
dst += i;
if (dst < gpBufEnd) {
for (k = 0; k < 4 * j; k++)
*dst++ = 0;
for (k = 0; k < 4 * j; k++) {
*dst++ = 0;
}
dst += i;
}
for (i = 2, j = 15; i != 32; i += 2, j--, dst -= BUFFER_WIDTH + 64) {
dst += i;
if (dst < gpBufEnd) {
for (k = 0; k < 4 * j; k++)
*dst++ = 0;
for (k = 0; k < 4 * j; k++) {
*dst++ = 0;
}
dst += i;
}

2
Source/render.h

@ -4,6 +4,6 @@
void RenderTile(BYTE *pBuff);
#define drawUpperScreen(p) RenderTile(p)
#define drawLowerScreen(p) RenderTile(p)
void world_draw_black_tile(BYTE *pBuff);
void world_draw_black_tile(int sx, int sy);
#endif /* __RENDER_H__ */

34
Source/scrollrt.cpp

@ -683,7 +683,6 @@ static void scrollrt_draw(int x, int y, int sx, int sy, int chunks, int dPieceRo
chunks++;
}
for (j = 0; j < chunks; j++) {
if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) {
level_piece_id = dPiece[x][y];
@ -692,32 +691,29 @@ static void scrollrt_draw(int x, int y, int sx, int sy, int chunks, int dPieceRo
dst = &gpBuffer[sx + sy * BUFFER_WIDTH];
pMap = &dpiece_defs_map_2[x][y];
cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]);
arch_draw_type = 1;
level_cel_block = pMap->mt[0];
if (level_cel_block != 0) {
drawUpperScreen(dst);
}
arch_draw_type = 2;
level_cel_block = pMap->mt[1];
if (level_cel_block != 0) {
drawUpperScreen(dst + 32);
}
arch_draw_type = 0;
for (i = 1; i < (MicroTileLen >> 1) - 1; i++) {
dst -= BUFFER_WIDTH * 32;
for (i = 0; i<MicroTileLen>> 1; i++) {
arch_draw_type = i == 0 ? 1 : 0;
level_cel_block = pMap->mt[2 * i];
if (level_cel_block != 0) {
drawUpperScreen(dst);
}
arch_draw_type = i == 0 ? 2 : 0;
level_cel_block = pMap->mt[2 * i + 1];
if (level_cel_block != 0) {
drawUpperScreen(dst + 32);
}
dst -= BUFFER_WIDTH * 32;
}
if (leveltype != DTYPE_TOWN) {
scrollrt_draw_dungeon(&gpBuffer[sx + BUFFER_WIDTH * sy], x, y, sx, sy, 1);
} else {
town_draw_town_all(&gpBuffer[sx + BUFFER_WIDTH * sy], x, y, sx, sy, 1);
}
scrollrt_draw_dungeon(&gpBuffer[sx + BUFFER_WIDTH * sy], x, y, sx, sy, 1);
} else {
world_draw_black_tile(&gpBuffer[sx + BUFFER_WIDTH * sy]);
world_draw_black_tile(sx, sy);
}
} else {
world_draw_black_tile(sx, sy);
}
x++;
y--;
@ -815,11 +811,7 @@ static void DrawGame(int x, int y)
/// ASSERT: assert(gpBuffer);
gpBufEnd = &gpBuffer[BUFFER_WIDTH * (VIEWPORT_HEIGHT + SCREEN_Y)];
for (i = 0; i < (blocks << 1); i++) {
if (leveltype != DTYPE_TOWN) {
scrollrt_draw(x, y, sx, sy, chunks, i);
} else {
town_draw(x, y, sx, sy, chunks, i);
}
scrollrt_draw(x, y, sx, sy, chunks, i);
sy += 16;
if (i & 1)
y++;

54
Source/town.cpp

@ -109,51 +109,6 @@ void town_draw_town_all(BYTE *pBuff, int x, int y, int sx, int sy, int eflag)
}
}
void town_draw(int x, int y, int sx, int sy, int chunks, int dPieceRow)
{
int i, j;
BYTE *dst;
MICROS *pMap;
/// ASSERT: assert(gpBuffer);
if (dPieceRow & 1) {
x--;
y++;
sx -= 32;
chunks++;
}
for (j = 0; j < chunks; j++) {
if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) {
level_cel_block = dPiece[x][y];
if (level_cel_block != 0) {
dst = &gpBuffer[sx + BUFFER_WIDTH * sy];
pMap = &dpiece_defs_map_2[x][y];
for (i = 0; i < MicroTileLen >> 1; i++) {
level_cel_block = pMap->mt[2 * i];
if (level_cel_block != 0) {
drawUpperScreen(dst);
}
level_cel_block = pMap->mt[2 * i + 1];
if (level_cel_block != 0) {
drawUpperScreen(dst + 32);
}
dst -= BUFFER_WIDTH * 32;
}
town_draw_town_all(&gpBuffer[sx + BUFFER_WIDTH * sy], x, y, sx, sy, 1);
} else {
world_draw_black_tile(&gpBuffer[sx + BUFFER_WIDTH * sy]);
}
} else {
world_draw_black_tile(&gpBuffer[sx + BUFFER_WIDTH * sy]);
}
x++;
y--;
sx += 64;
}
}
void SetTownMicros()
{
int i, x, y, lv;
@ -179,14 +134,6 @@ void SetTownMicros()
}
}
}
if (zoomflag) {
scr_pix_width = SCREEN_WIDTH;
scr_pix_height = VIEWPORT_HEIGHT;
} else {
scr_pix_width = ZOOM_WIDTH;
scr_pix_height = ZOOM_HEIGHT;
}
}
void T_FillSector(BYTE *P3Tiles, BYTE *pSector, int xi, int yi, int w, int h)
@ -313,6 +260,7 @@ void CreateTown(int entry)
dminy = 10;
dmaxx = 84;
dmaxy = 84;
DRLG_InitTrans();
if (entry == 0) {
ViewX = 75;

Loading…
Cancel
Save