Skip to content

Instantly share code, notes, and snippets.

@Langerz82
Created July 1, 2019 19:30
Show Gist options
  • Select an option

  • Save Langerz82/a174cca1937093acc97f92d2adb3b2ca to your computer and use it in GitHub Desktop.

Select an option

Save Langerz82/a174cca1937093acc97f92d2adb3b2ca to your computer and use it in GitHub Desktop.
diff --git a/Source/cursor.cpp b/Source/cursor.cpp
index 923f07c3..1aa6a318 100644
--- a/Source/cursor.cpp
+++ b/Source/cursor.cpp
@@ -196,8 +196,8 @@ void CheckCursMove()
sy = VIEWPORT_HEIGHT - 1;
}
if (!zoomflag) {
- sx >>= 1;
- sy >>= 1;
+ sx >>= zoomflag;
+ sy >>= zoomflag;
}
sx -= ScrollInfo._sxoff;
@@ -225,7 +225,20 @@ void CheckCursMove()
ty = sy >> 5;
px = sx & 0x3F;
py = sy & 0x1F;
- mx = ViewX + tx + ty - (zoomflag ? 10 : 5);
+ int zoom = 0;
+ switch (zoomflag) {
+ case 0:
+ zoom = 5;
+ break;
+ case 1:
+ zoom = 10;
+ break;
+ case 2:
+ zoom = 20;
+ break;
+ }
+
+ mx = ViewX + tx + ty - zoom;
my = ViewY + ty - tx;
flipy = py<px>> 1;
diff --git a/Source/diablo.cpp b/Source/diablo.cpp
index ffd284eb..2dcea326 100644
--- a/Source/diablo.cpp
+++ b/Source/diablo.cpp
@@ -1335,7 +1335,7 @@ void PressChar(int vkey)
return;
case 'Z':
case 'z':
- zoomflag = zoomflag == 0;
+ zoomflag = ++zoomflag % 3;
return;
case 'S':
case 's':
diff --git a/Source/gendung.cpp b/Source/gendung.cpp
index 35d3da3f..a000037e 100644
--- a/Source/gendung.cpp
+++ b/Source/gendung.cpp
@@ -543,17 +543,24 @@ void SetDungeonMicros()
MakeSpeedCels();
SetSpeedCels();
- if (zoomflag) {
- scr_pix_width = 640;
- scr_pix_height = VIEWPORT_HEIGHT;
- dword_5C2FF8 = 10;
- dword_5C2FFC = 11;
- } else {
+ if (zoomflag == 0) {
scr_pix_width = 384;
scr_pix_height = 224;
dword_5C2FF8 = 6;
dword_5C2FFC = 7;
}
+ if (zoomflag == 1) {
+ scr_pix_width = 640;
+ scr_pix_height = VIEWPORT_HEIGHT;
+ dword_5C2FF8 = 10;
+ dword_5C2FFC = 11;
+ }
+ if (zoomflag == 2) {
+ scr_pix_width = 640;
+ scr_pix_height = VIEWPORT_HEIGHT;
+ dword_5C2FF8 = 10;
+ dword_5C2FFC = 11;
+ }
}
// 52569C: using guessed type int zoomflag;
// 5C2FF8: using guessed type int dword_5C2FF8;
diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp
index ec9d4d27..c1c95e18 100644
--- a/Source/scrollrt.cpp
+++ b/Source/scrollrt.cpp
@@ -4,7 +4,7 @@
DEVILUTION_BEGIN_NAMESPACE
int light_table_index;
-int PitchTbl[1024];
+int PitchTbl[4096];
DWORD sgdwCursWdtOld;
DWORD sgdwCursX;
DWORD sgdwCursY;
@@ -374,11 +374,14 @@ void DrawClippedPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, i
void DrawView(int StartX, int StartY)
{
- if(zoomflag) {
- DrawGame(StartX, StartY);
- } else {
- DrawZoom(StartX, StartY);
- }
+ DrawGame(StartX, StartY);
+
+ //if(zoomflag) {
+ // DrawGame(StartX, StartY);
+ //} else {
+ // DrawZoom(StartX, StartY);
+ //}
+
if(automapflag) {
DrawAutomap();
}
@@ -433,17 +436,46 @@ void DrawGame(int x, int y)
{
int i, sx, sy, chunks, blocks;
- scr_pix_width = 640;
- scr_pix_height = VIEWPORT_HEIGHT;
- dword_5C2FF8 = 10;
- dword_5C2FFC = 11;
+ //scr_pix_width = 640;
+ //scr_pix_height = VIEWPORT_HEIGHT;
+ //dword_5C2FF8 = 10;
+ //dword_5C2FFC = 11;
+ if (zoomflag == 0) {
+ scr_pix_width = 384;
+ scr_pix_height = VIEWPORT_HEIGHT / 2;
+ dword_5C2FF8 = 5;
+ dword_5C2FFC = 6;
+ }
+ if (zoomflag == 1) {
+ scr_pix_width = 640;
+ scr_pix_height = VIEWPORT_HEIGHT;
+ dword_5C2FF8 = 10;
+ dword_5C2FFC = 12;
+ }
+ if (zoomflag == 2) {
+ scr_pix_width = 1280;
+ scr_pix_height = VIEWPORT_HEIGHT2;
+ dword_5C2FF8 = 20;
+ dword_5C2FFC = 24;
+ }
sx = ScrollInfo._sxoff + 64;
sy = ScrollInfo._syoff + 175;
x -= 10;
y--;
- chunks = 10;
- blocks = 8;
+
+ if (zoomflag == 0) {
+ chunks = 5;
+ blocks = 4;
+ }
+ else if (zoomflag == 1) {
+ chunks = 10;
+ blocks = 8;
+ }
+ else if (zoomflag == 2) {
+ chunks = 10;
+ blocks = 8;
+ }
if (chrflag || questlog) {
x += 2;
@@ -507,7 +539,7 @@ void DrawGame(int x, int y)
sy += 16;
}
/// ASSERT: assert(gpBuffer);
- gpBufEnd = &gpBuffer[PitchTbl[VIEWPORT_HEIGHT + SCREEN_Y]];
+ gpBufEnd = &gpBuffer[PitchTbl[scr_pix_height + SCREEN_Y]];
for (i = 0; i < blocks; i++) {
scrollrt_draw_lower(x, y, sx, sy, chunks, 0);
y++;
diff --git a/Source/scrollrt.h b/Source/scrollrt.h
index baeac29b..5dcfaf1f 100644
--- a/Source/scrollrt.h
+++ b/Source/scrollrt.h
@@ -3,7 +3,7 @@
#define __SCROLLRT_H__
extern int light_table_index;
-extern int PitchTbl[1024];
+extern int PitchTbl[4096];
extern BYTE *gpBufEnd;
extern DWORD level_cel_block;
extern char arch_draw_type;
diff --git a/Source/town.cpp b/Source/town.cpp
index a4cfb8b3..6b178e8b 100644
--- a/Source/town.cpp
+++ b/Source/town.cpp
@@ -4,7 +4,7 @@ DEVILUTION_BEGIN_NAMESPACE
void town_clear_upper_buf(BYTE *pBuff)
{
- /// ASSERT: assert(gpBuffer);
+/// ASSERT: assert(gpBuffer);
#ifdef USE_ASM
__asm {
@@ -66,7 +66,7 @@ void town_clear_upper_buf(BYTE *pBuff)
void town_clear_low_buf(BYTE *pBuff)
{
- /// ASSERT: assert(gpBuffer);
+/// ASSERT: assert(gpBuffer);
#ifdef USE_ASM
__asm {
@@ -1041,6 +1041,127 @@ void T_DrawGame(int x, int y)
}
}
+void T_DrawZoom2(int x, int y)
+{
+ int i, sx, sy, chunks, blocks;
+
+ scr_pix_width = 1280;
+ scr_pix_height = VIEWPORT_HEIGHT * 2;
+ dword_5C2FF8 = 20;
+ dword_5C2FFC = 20;
+
+ sx = ScrollInfo._sxoff + 64;
+ sy = ScrollInfo._syoff + 175;
+ x -= 20;
+ y--;
+ chunks = 20;
+ blocks = 10;
+
+ if (chrflag || questlog) {
+ x += 2;
+ y -= 2;
+ sx += 288;
+ chunks = 6;
+ }
+ if (invflag || sbookflag) {
+ x += 2;
+ y -= 2;
+ sx -= 32;
+ chunks = 6;
+ }
+
+ switch (ScrollInfo._sdir) {
+ case SDIR_NONE:
+ break;
+ case SDIR_N:
+ sy -= 8;
+ x--;
+ y--;
+ blocks++;
+ break;
+ case SDIR_NE:
+ sy -= 8;
+ x--;
+ y--;
+ chunks++;
+ blocks++;
+ break;
+ case SDIR_E:
+ chunks++;
+ break;
+ case SDIR_SE:
+ chunks++;
+ blocks++;
+ break;
+ case SDIR_S:
+ blocks++;
+ break;
+ case SDIR_SW:
+ sx -= 16;
+ x--;
+ y++;
+ chunks++;
+ blocks++;
+ break;
+ case SDIR_W:
+ sx -= 16;
+ x--;
+ y++;
+ chunks++;
+ break;
+ case SDIR_NW:
+ sx -= 16;
+ sy -= 8;
+ x -= 2;
+ chunks++;
+ blocks++;
+ break;
+ }
+
+ /// ASSERT: assert(gpBuffer);
+ int buffendindex = BORDER_TOP;
+
+ gpBufEnd = &gpBuffer[PitchTbl[buffendindex]];
+ for (i = 0; i < 7; i++) {
+ town_draw_upper(x, y, sx, sy, chunks, i, 0);
+ y++;
+ sx -= 16;
+ sy += 8;
+
+ town_draw_upper(x, y, sx, sy, chunks, i, 1);
+ x++;
+ sx += 16;
+ sy += 8;
+ }
+
+ /// ASSERT: assert(gpBuffer);
+ buffendindex = BORDER_TOP + SCREEN_HEIGHT + BORDER_BOTTOM;
+
+ gpBufEnd = &gpBuffer[PitchTbl[buffendindex]];
+ for (i = 0; i < blocks; i++) {
+ town_draw_lower(x, y, sx, sy, chunks, 0);
+ y++;
+ sx -= 16;
+ sy += 8;
+
+ town_draw_lower(x, y, sx, sy, chunks, 1);
+ x++;
+ sx += 16;
+ sy += 8;
+ }
+ for (i = 0; i < 7; i++) {
+ town_draw_lower_2(x, y, sx, sy, chunks, i, 0);
+ y++;
+ sx -= 16;
+ sy += 8;
+
+ town_draw_lower_2(x, y, sx, sy, chunks, i, 1);
+ x++;
+ sx += 16;
+ sy += 8;
+ }
+}
+
void T_DrawZoom(int x, int y)
{
int i, sx, sy, chunks, blocks;
@@ -1155,7 +1276,7 @@ void T_DrawZoom(int x, int y)
wdt = 320;
}
- /// ASSERT: assert(gpBuffer);
+ /// ASSERT: assert(gpBuffer);
#ifdef USE_ASM
__asm {
@@ -1213,10 +1334,14 @@ void T_DrawView(int StartX, int StartY)
{
light_table_index = 0;
cel_transparency_active = 0;
- if (zoomflag)
- T_DrawGame(StartX, StartY);
- else
+
+ if (zoomflag == 0)
T_DrawZoom(StartX, StartY);
+ else if (zoomflag == 1)
+ T_DrawGame(StartX, StartY);
+ else if (zoomflag == 2)
+ T_DrawZoom2(StartX, StartY);
+
if (automapflag)
DrawAutomap();
if (stextflag && !qtextflag)
@@ -1280,17 +1405,24 @@ void SetTownMicros()
}
}
- if (zoomflag) {
- scr_pix_width = 640;
- scr_pix_height = VIEWPORT_HEIGHT;
- dword_5C2FF8 = 10;
- dword_5C2FFC = 11;
- } else {
+ if (zoomflag == 0) {
scr_pix_width = 384;
scr_pix_height = 224;
dword_5C2FF8 = 6;
dword_5C2FFC = 7;
}
+ if (zoomflag == 1) {
+ scr_pix_width = 640;
+ scr_pix_height = VIEWPORT_HEIGHT;
+ dword_5C2FF8 = 10;
+ dword_5C2FFC = 11;
+ }
+ if (zoomflag == 2) {
+ scr_pix_width = 1280;
+ scr_pix_height = VIEWPORT_HEIGHT * 2;
+ dword_5C2FF8 = 10;
+ dword_5C2FFC = 11;
+ }
}
void T_FillSector(unsigned char *P3Tiles, unsigned char *pSector, int xi, int yi, int w, int h)
diff --git a/defs.h b/defs.h
index 962ed34b..bcfdbb48 100644
--- a/defs.h
+++ b/defs.h
@@ -116,6 +116,7 @@
#define TILE_SIZE 32
#define VIEWPORT_HEIGHT 352
+#define VIEWPORT_HEIGHT2 704
#define SCREENXY(x, y) ((x) + SCREEN_X + ((y) + SCREEN_Y) * BUFFER_WIDTH)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment