diff --git a/Source/gendung.cpp b/Source/gendung.cpp index bcf49c0c8..5942581ef 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -13,7 +13,6 @@ BYTE *pSpeedCels; int nlevel_frames; BYTE pdungeon[DMAXX][DMAXY]; char dDead[MAXDUNX][MAXDUNY]; -MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; char dPreLight[MAXDUNX][MAXDUNY]; char TransVal; int MicroTileLen; @@ -334,27 +333,6 @@ void SwapTile(int f1, int f2) level_frame_sizes[f2] = swap; } -int IsometricCoord(int x, int y) -{ - if (x < MAXDUNY - y) - return (y + y * y + x * (x + 2 * y + 3)) / 2; - - x = MAXDUNX - x - 1; - y = MAXDUNY - y - 1; - return MAXDUNX * MAXDUNY - ((y + y * y + x * (x + 2 * y + 3)) / 2) - 1; -} - -void SetSpeedCels() -{ - int x, y; - - for (x = 0; x < MAXDUNX; x++) { - for (y = 0; y < MAXDUNY; y++) { - dpiece_defs_map_1[IsometricCoord(x, y)] = dpiece_defs_map_2[x][y]; - } - } -} - void SetDungeonMicros() { int i, x, y, lv, blocks; @@ -389,7 +367,6 @@ void SetDungeonMicros() } MakeSpeedCels(); - SetSpeedCels(); if (zoomflag) { scr_pix_width = SCREEN_WIDTH; diff --git a/Source/gendung.h b/Source/gendung.h index 344a9e916..262464106 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -13,7 +13,6 @@ extern BYTE *pSpeedCels; extern int nlevel_frames; extern BYTE pdungeon[DMAXX][DMAXY]; extern char dDead[MAXDUNX][MAXDUNY]; -extern MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; extern char dPreLight[MAXDUNX][MAXDUNY]; extern char TransVal; extern int MicroTileLen; @@ -73,8 +72,6 @@ void FillSolidBlockTbls(); void MakeSpeedCels(); void SortTiles(int frames); void SwapTile(int f1, int f2); -int IsometricCoord(int x, int y); -void SetSpeedCels(); void SetDungeonMicros(); void DRLG_InitTrans(); void DRLG_MRectTrans(int x1, int y1, int x2, int y2); diff --git a/Source/objects.cpp b/Source/objects.cpp index b16044dfa..90fec4911 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -1816,7 +1816,7 @@ void ObjSetMicro(int dx, int dy, int pn) dPiece[dx][dy] = pn; pn--; - defs = &dpiece_defs_map_1[IsometricCoord(dx, dy)]; + defs = &dpiece_defs_map_2[dx][dy]; if (leveltype != DTYPE_HELL) { v = (WORD *)pLevelPieces + 10 * pn; for (i = 0; i < 10; i++) { @@ -1839,8 +1839,8 @@ void objects_set_door_piece(int x, int y) v1 = *((WORD *)pLevelPieces + 10 * pn + 8); v2 = *((WORD *)pLevelPieces + 10 * pn + 9); - dpiece_defs_map_1[IsometricCoord(x, y)].mt[0] = SDL_SwapLE16(v1); - dpiece_defs_map_1[IsometricCoord(x, y)].mt[1] = SDL_SwapLE16(v2); + dpiece_defs_map_2[x][y].mt[0] = SDL_SwapLE16(v1); + dpiece_defs_map_2[x][y].mt[1] = SDL_SwapLE16(v2); } void ObjSetMini(int x, int y, int v) diff --git a/Source/player.cpp b/Source/player.cpp index c58346982..028b24a4f 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -967,7 +967,7 @@ void CheckEFlag(int pnum, BOOL flag) x = plr[pnum].WorldX - 1; y = plr[pnum].WorldY + 1; bitflags = 0; - pieces = &dpiece_defs_map_1[IsometricCoord(x, y)]; + pieces = &dpiece_defs_map_2[x][y]; for (i = 2; i < 10; i++) { bitflags |= pieces->mt[i]; @@ -986,7 +986,7 @@ void CheckEFlag(int pnum, BOOL flag) x = plr[pnum].WorldX; y = plr[pnum].WorldY + 2; bitflags = 0; - pieces = &dpiece_defs_map_1[IsometricCoord(x, y)]; + pieces = &dpiece_defs_map_2[x][y]; for (i = 2; i < 10; i++) { bitflags |= pieces->mt[i]; @@ -999,7 +999,7 @@ void CheckEFlag(int pnum, BOOL flag) x = plr[pnum].WorldX - 2; y = plr[pnum].WorldY + 1; bitflags = 0; - pieces = &dpiece_defs_map_1[IsometricCoord(x, y)]; + pieces = &dpiece_defs_map_2[x][y]; for (i = 2; i < 10; i++) { bitflags |= pieces->mt[i]; diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 375932456..07132e7e6 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -432,7 +432,7 @@ static void scrollrt_draw_e_flag(BYTE *pBuff, int x, int y, int sx, int sy) light_table_index = dLight[x][y]; dst = pBuff; cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); - pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; + pMap = &dpiece_defs_map_2[x][y]; arch_draw_type = 1; level_cel_block = pMap->mt[0]; @@ -683,7 +683,6 @@ static void scrollrt_draw(int x, int y, int sx, int sy, int chunks, int dPieceRo chunks++; } - pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; for (j = 0; j < chunks; j++) { if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { @@ -691,6 +690,7 @@ static void scrollrt_draw(int x, int y, int sx, int sy, int chunks, int dPieceRo light_table_index = dLight[x][y]; if (level_piece_id != 0) { 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]; @@ -722,7 +722,6 @@ static void scrollrt_draw(int x, int y, int sx, int sy, int chunks, int dPieceRo x++; y--; sx += 64; - pMap++; } } diff --git a/Source/town.cpp b/Source/town.cpp index a6b9c7904..6f31fea98 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -46,7 +46,7 @@ void town_draw_e_flag(BYTE *pBuff, int x, int y, int capChunks, int sx, int sy) MICROS *pMap; dst = pBuff; - pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; + pMap = &dpiece_defs_map_2[x][y]; for (i = 0; i < 7; i++) { if (capChunks >= i) { @@ -154,7 +154,7 @@ void town_draw(int x, int y, int sx, int sy, int chunks, int dPieceRow) level_cel_block = dPiece[x][y]; if (level_cel_block != 0) { dst = &gpBuffer[sx + BUFFER_WIDTH * sy]; - pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; + 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) { @@ -190,7 +190,7 @@ void SetTownMicros() for (y = 0; y < MAXDUNY; y++) { for (x = 0; x < MAXDUNX; x++) { lv = dPiece[x][y]; - pMap = &dpiece_defs_map_1[IsometricCoord(x, y)]; + pMap = &dpiece_defs_map_2[x][y]; if (lv != 0) { lv--; pPiece = (WORD *)&pLevelPieces[32 * lv];