Skip to content

Commit d041454

Browse files
committed
zoom works
1 parent 4b02b4e commit d041454

File tree

5 files changed

+250
-191
lines changed

5 files changed

+250
-191
lines changed

Infernity.zip

1.72 KB
Binary file not shown.

Source/automap.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void __cdecl InitAutomap()
133133

134134
void __cdecl StartAutomap()
135135
{
136-
AutoMapXOfs = -(ScreenWidth-640)*20/640;
136+
AutoMapXOfs = 0;
137137
AutoMapYOfs = 0;
138138
automapflag = 1;
139139
}
@@ -515,7 +515,7 @@ void __cdecl DrawAutomap()
515515
++v2;
516516
}
517517
while ( v2 < 0 );
518-
//AutoMapXOfs = v0;
518+
AutoMapXOfs = v0;
519519
}
520520
v3 = v0 + v1;
521521
if ( v0 + v1 >= 40 )
@@ -526,7 +526,7 @@ void __cdecl DrawAutomap()
526526
--v3;
527527
}
528528
while ( v3 >= 40);
529-
//AutoMapXOfs = v0;
529+
AutoMapXOfs = v0;
530530
}
531531
v4 = v0 + v1;
532532
AMdword_4B7E40 = v4;

Source/scrollrt.cpp

Lines changed: 92 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -670,8 +670,8 @@ void __fastcall DrawView(int StartX, int StartY)
670670
if ( zoomflag )
671671
DrawGame2(StartX, StartY);
672672
else
673-
DrawGame2(StartX, StartY);
674-
//DrawZoom(StartX, StartY);
673+
//DrawGame2(StartX, StartY);
674+
DrawZoom2(StartX, StartY);
675675

676676
if ( automapflag )
677677
DrawAutomap();
@@ -3061,11 +3061,96 @@ void __fastcall scrollrt_draw_e_flag(char *buffer, int x, int y, int a4, int a5,
30613061
cel_transparency_active = v10;
30623062
level_piece_id = v22;
30633063
}
3064-
// 69BEF8: using guessed type int light_table_index;
3065-
// 69CF14: using guessed type int level_cel_block;
3066-
// 69CF20: using guessed type char arch_draw_type;
3067-
// 69CF94: using guessed type int cel_transparency_active;
3068-
// 69CF98: using guessed type int level_piece_id;
3064+
void __fastcall DrawZoom2(int x, int y)
3065+
{
3066+
int yofs = 143;
3067+
int posx = x - ScreenWidth / 64;
3068+
int posy = y - 1;
3069+
int offsetX = ScrollInfo._sxoff + 64;
3070+
int offsetY = ScrollInfo._syoff + yofs;
3071+
int HorCellDrawCount = ScreenWidth / 64;
3072+
switch (ScrollInfo._sdir)
3073+
{
3074+
case DIR_SW: {
3075+
offsetY = ScrollInfo._syoff + yofs - 32;
3076+
--posx;
3077+
--posy;
3078+
break;
3079+
}
3080+
case DIR_W: {
3081+
offsetY = ScrollInfo._syoff + yofs - 32;
3082+
--posx;
3083+
--posy;
3084+
++HorCellDrawCount;
3085+
break;
3086+
}
3087+
case DIR_NW:
3088+
case DIR_N:
3089+
case DIR_NE:
3090+
{
3091+
++HorCellDrawCount;
3092+
break;
3093+
}
3094+
case DIR_E:
3095+
case DIR_SE: {
3096+
offsetX -= 64;
3097+
--posx;
3098+
++posy;
3099+
++HorCellDrawCount;
3100+
break;
3101+
}
3102+
case DIR_OMNI: {
3103+
offsetX -= 64;
3104+
offsetY = ScrollInfo._syoff + yofs - 32;
3105+
posx -= 2;
3106+
++HorCellDrawCount;
3107+
break;
3108+
}
3109+
default:
3110+
break;
3111+
}
3112+
int screenCellRow = 0;
3113+
gpBufEnd = (unsigned char *)gpBuffer + screen_y_times_width[160];
3114+
do {
3115+
scrollrt_draw_upper(posx, posy++, offsetX, offsetY, HorCellDrawCount, screenCellRow, 0);
3116+
scrollrt_draw_upper(posx++, posy, offsetX - 32, offsetY + 16, HorCellDrawCount, screenCellRow, 1);
3117+
offsetY += 32;
3118+
++screenCellRow;
3119+
} while (offsetY <= WorkingHeight + 256);
3120+
gpBufEnd = (unsigned char *)gpBuffer + screen_y_times_width[WorkingWidth + 32];
3121+
yofs -= 32;
3122+
3123+
for (int i = ScreenHeight - 1; i >= yofs; --i) {
3124+
for (int j = ScreenWidth - 1; j >= 0; --j) {
3125+
gpBuffer->row[i].pixels[j] = gpBuffer->row[i - yofs].pixels[j];
3126+
}
3127+
}
3128+
3129+
for (int i = ScreenHeight / 4 - 1; i >= 0; --i) {
3130+
for (int j = ScreenWidth / 4 - 1; j >= 0; --j) {
3131+
int hd2 = ScreenHeight >> 1;
3132+
int hd3 = ScreenHeight >> 1;
3133+
int wd2 = ScreenWidth >> 1;
3134+
3135+
gpBuffer->row[hd3 - i * 2].pixels[wd2 - j * 2 - 1] = gpBuffer->row[hd2 - i].pixels[wd2 - j];
3136+
gpBuffer->row[hd3 + i * 2].pixels[wd2 - j * 2 - 1] = gpBuffer->row[hd2 + i].pixels[wd2 - j];
3137+
gpBuffer->row[hd3 - i * 2 - 1].pixels[wd2 - j * 2 - 1] = gpBuffer->row[hd2 - i].pixels[wd2 - j];
3138+
gpBuffer->row[hd3 + i * 2 + 1].pixels[wd2 - j * 2 - 1] = gpBuffer->row[hd2 + i].pixels[wd2 - j];
3139+
gpBuffer->row[hd3 - i * 2].pixels[wd2 - j * 2] = gpBuffer->row[hd2 - i].pixels[wd2 - j];
3140+
gpBuffer->row[hd3 + i * 2].pixels[wd2 - j * 2] = gpBuffer->row[hd2 + i].pixels[wd2 - j];
3141+
gpBuffer->row[hd3 - i * 2 - 1].pixels[wd2 - j * 2] = gpBuffer->row[hd2 - i].pixels[wd2 - j];
3142+
gpBuffer->row[hd3 + i * 2 + 1].pixels[wd2 - j * 2] = gpBuffer->row[hd2 + i].pixels[wd2 - j];
3143+
gpBuffer->row[hd3 + i * 2 + 1].pixels[wd2 + j * 2 + 1] = gpBuffer->row[hd2 + i].pixels[wd2 + j];
3144+
gpBuffer->row[hd3 - i * 2 - 1].pixels[wd2 + j * 2 + 1] = gpBuffer->row[hd2 - i].pixels[wd2 + j];
3145+
gpBuffer->row[hd3 + i * 2].pixels[wd2 + j * 2 + 1] = gpBuffer->row[hd2 + i].pixels[wd2 + j];
3146+
gpBuffer->row[hd3 - i * 2].pixels[wd2 + j * 2 + 1] = gpBuffer->row[hd2 - i].pixels[wd2 + j];
3147+
gpBuffer->row[hd3 + i * 2].pixels[wd2 + j * 2] = gpBuffer->row[hd2 + i].pixels[wd2 + j];
3148+
gpBuffer->row[hd3 - i * 2].pixels[wd2 + j * 2] = gpBuffer->row[hd2 - i].pixels[wd2 + j];
3149+
gpBuffer->row[hd3 + i * 2 + 1].pixels[wd2 + j * 2] = gpBuffer->row[hd2 + i].pixels[wd2 + j];
3150+
gpBuffer->row[hd3 - i * 2 - 1].pixels[wd2 + j * 2] = gpBuffer->row[hd2 - i].pixels[wd2 + j];
3151+
}
3152+
}
3153+
}
30693154
void __fastcall DrawZoom(int x, int y)
30703155
{
30713156
int v2; // edi

Source/scrollrt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ void __fastcall DrawMonster(int x, int y, int a3, int a4, int mon_id, int a6, in
4747
void __fastcall DrawObject(int x, int y, int a3, int a4, int pre_flag, int a6, int dir);
4848
void __fastcall scrollrt_draw_e_flag(char *buffer, int x, int y, int a4, int a5, int sx, int sy);
4949
void __fastcall DrawZoom(int x, int y);
50+
void __fastcall DrawZoom2(int x, int y);
5051
void __fastcall T_DrawZoom2(int x, int y);
5152
void __cdecl ClearScreenBuffer();
5253
#ifdef _DEBUG

0 commit comments

Comments
 (0)