Complete dpi->zoom_level == 0

This commit is contained in:
Marijn van der Werf 2016-02-26 10:33:19 +01:00
parent ebb2ab3b0c
commit 0519130b94
1 changed files with 121 additions and 48 deletions

View File

@ -2232,6 +2232,8 @@ struct paint_string_struct {
uint8 *y_offsets; // 0x1A uint8 *y_offsets; // 0x1A
}; };
void loc_6791B8_6795E4(rct_g1_element *image, uint8 *esi, uint8 **new_source_pointer_start, uint8 **esi_end);
static void draw_pixel_info_crop_by_zoom(rct_drawpixelinfo *dpi) static void draw_pixel_info_crop_by_zoom(rct_drawpixelinfo *dpi)
{ {
int zoom = dpi->zoom_level; int zoom = dpi->zoom_level;
@ -2742,9 +2744,8 @@ void sub_679074(rct_drawpixelinfo *dpi, int imageId, sint16 x, sint16 y)
return; return;
} }
sint16 ax = image->width;
_xStartPoint = 0; _xStartPoint = 0;
_xEndPoint = ax; _xEndPoint = image->width;
x += image->x_offset; x += image->x_offset;
x -= dpi->x; x -= dpi->x;
if (x < 0) { if (x < 0) {
@ -2765,12 +2766,82 @@ void sub_679074(rct_drawpixelinfo *dpi, int imageId, sint16 x, sint16 y)
} }
// TODO: refactor in sub_67933B // TODO: refactor in sub_67933B
// ebp might be dpi // EDI: dpi
// EBP: dpi
RCT2_CALLPROC_X(0x0067933B, 0, 0, 0, 0, (int) image->offset, 0xEEEEEEEE, 0xFFFFFFFF); RCT2_CALLPROC_X(0x0067933B, 0, 0, 0, 0, (int) image->offset, 0xEEEEEEEE, 0xFFFFFFFF);
return; return;
} }
// TODO: loc_6790A0: rct_drawpixelinfo *ebp = dpi;
uint8 *esi = image->offset;
y += image->y_offset;
_yEndPoint = image->height;
y -= dpi->y;
if (y < 0) {
_yEndPoint += y;
if (_yEndPoint <= 0) {
return;
}
y = 0;
esi += (image->width * -y) & 0xFFFF;
} else {
// bx = y;
}
y += _yEndPoint;
y--;
if (y > 0) {
_yEndPoint -= y;
if (_yEndPoint <= 0) {
return;
}
}
sint8 ax = image->width;
_xEndPoint = ax;
RCT2_GLOBAL(0x009ABDAE, sint16) = 0;
x += image->x_offset;
x -= dpi->x;
if (x < 0) {
_xEndPoint += x;
if (_xEndPoint <= 0) {
return;
}
RCT2_GLOBAL(0x009ABDAE, sint16) -= x;
esi -= x;
x = 0;
}
x += _xEndPoint;
x--;
if (x > 0) {
_xEndPoint -= x;
if (_xEndPoint <= 0) {
return;
}
}
RCT2_GLOBAL(0x009ABDAE, sint16) += x;
if (!(image->flags & 2)) {
sint8 ah = (_yEndPoint >> 8) & 0xFF;
int edx = RCT2_GLOBAL(0x009ABDAE, sint16);
uint32 ebx = RCT2_GLOBAL(0x00EDF81C, uint32);
// ah and edx don't seem to be used by this function...
do_sub(0x00679236, ebx, image, esi);
return;
}
uint8 *new_source_pointer_start, *esi_end;
loc_6791B8_6795E4(image, esi, &new_source_pointer_start, &esi_end);
do_sub(0x00679236, RCT2_GLOBAL(0x00EDF81C, uint32), image, esi_end);
free(new_source_pointer_start);
break; break;
case 1: case 1:
@ -2961,15 +3032,33 @@ void sub_679074(rct_drawpixelinfo *dpi, int imageId, sint16 x, sint16 y)
return; return;
} }
// loc_6795E4: uint8 *new_source_pointer_start, *esi_end;
loc_6791B8_6795E4(image, esi, &new_source_pointer_start, &esi_end);
do_sub(0x00679662, RCT2_GLOBAL(0x00EDF81C, uint32), image, esi_end);
free(new_source_pointer_start);
}
break;
case 2:
// TODO: loc_6798F5
break;
default:
// TODO: loc_679DEE
break;
}
RCT2_CALLPROC_X(0x00679074, 0, imageId, x, y, 0, (int) dpi, 0);
}
void loc_6791B8_6795E4(rct_g1_element *g1_source, uint8 *esi, uint8 **new_source_pointer_start, uint8 **esi_end) {
uint8 *ebp = esi; uint8 *ebp = esi;
rct_g1_element *g1_source = image;
uint8 *source_pointer; uint8 *source_pointer;
int total_no_pixels = g1_source->width * g1_source->height; int total_no_pixels = g1_source->width * g1_source->height;
source_pointer = g1_source->offset; source_pointer = g1_source->offset;
uint8 *new_source_pointer_start = malloc(total_no_pixels); (*new_source_pointer_start) = malloc(total_no_pixels);
uint8 *new_source_pointer = new_source_pointer_start;// 0x9E3D28; uint8 *new_source_pointer = (*new_source_pointer_start);// 0x9E3D28;
int ebx, ecx; int ebx, ecx;
while (total_no_pixels > 0) { while (total_no_pixels > 0) {
sint8 no_pixels = *source_pointer; sint8 no_pixels = *source_pointer;
@ -2999,25 +3088,9 @@ void sub_679074(rct_drawpixelinfo *dpi, int imageId, sint16 x, sint16 y)
source_pointer = (uint8 *) ebx; source_pointer = (uint8 *) ebx;
} }
uint8 *esi_end = new_source_pointer_start + (uint32) ebp; (*esi_end) = new_source_pointer_start + (uint32) ebp;
sint8 ah = (_yEndPoint >> 8) & 0xFF; sint8 ah = (_yEndPoint >> 8) & 0xFF;
int edx = RCT2_GLOBAL(0x009ABDAE, sint16); int edx = RCT2_GLOBAL(0x009ABDAE, sint16);
do_sub(0x00679662, RCT2_GLOBAL(0x00EDF81C, uint32), image, esi_end);
free(new_source_pointer_start);
return;
}
break;
case 2:
// TODO: loc_6798F5
break;
default:
// TODO: loc_679DEE
break;
}
RCT2_CALLPROC_X(0x00679074, 0, imageId, x, y, 0, (int)dpi, 0);
} }
/** /**