mirror of https://github.com/OpenRCT2/OpenRCT2.git
Formatting
This commit is contained in:
parent
6f1421117b
commit
ce0df83298
243
src/gfx.c
243
src/gfx.c
|
@ -127,157 +127,158 @@ void gfx_draw_line(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int y2, int c
|
||||||
void gfx_fill_rect(rct_drawpixelinfo *dpi, int left, int top, int right, int bottom, int colour)
|
void gfx_fill_rect(rct_drawpixelinfo *dpi, int left, int top, int right, int bottom, int colour)
|
||||||
{
|
{
|
||||||
|
|
||||||
int left_, right_, top_, bottom_;
|
int left_, right_, top_, bottom_;
|
||||||
rct_drawpixelinfo* dpi_;
|
rct_drawpixelinfo* dpi_;
|
||||||
left_ = left;
|
left_ = left;
|
||||||
right_ = right;
|
right_ = right;
|
||||||
top_ = top;
|
top_ = top;
|
||||||
bottom_ = bottom;
|
bottom_ = bottom;
|
||||||
dpi_ = dpi;
|
dpi_ = dpi;
|
||||||
|
|
||||||
if ((left > right) || (top > bottom) || (dpi->x > right) || (left >= (dpi->x + dpi->width)) ||
|
if ((left > right) || (top > bottom) || (dpi->x > right) || (left >= (dpi->x + dpi->width)) ||
|
||||||
(bottom < dpi->y) || (top >= (dpi->y + dpi->height)))
|
(bottom < dpi->y) || (top >= (dpi->y + dpi->height)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
colour |= RCT2_GLOBAL(0x009ABD9C, uint32);
|
colour |= RCT2_GLOBAL(0x009ABD9C, uint32);
|
||||||
|
|
||||||
if (!(colour & 0x1000000)) {
|
if (!(colour & 0x1000000)) {
|
||||||
if (!(colour & 0x8000000)) {
|
if (!(colour & 0x8000000)) {
|
||||||
left_ = left - dpi->x;
|
left_ = left - dpi->x;
|
||||||
if (left_ < 0)
|
if (left_ < 0)
|
||||||
left_ = 0;
|
left_ = 0;
|
||||||
|
|
||||||
right_ = right - dpi->x;
|
right_ = right - dpi->x;
|
||||||
right_++;
|
right_++;
|
||||||
if (right_ > dpi->width)
|
if (right_ > dpi->width)
|
||||||
right_ = dpi->width;
|
right_ = dpi->width;
|
||||||
|
|
||||||
right_ -= left_;
|
right_ -= left_;
|
||||||
|
|
||||||
top_ = top - dpi->y;
|
top_ = top - dpi->y;
|
||||||
if (top_ < 0)
|
if (top_ < 0)
|
||||||
top_ = 0;
|
top_ = 0;
|
||||||
|
|
||||||
bottom_ = bottom - dpi->y;
|
bottom_ = bottom - dpi->y;
|
||||||
bottom_++;
|
bottom_++;
|
||||||
|
|
||||||
if (bottom_ > dpi->height)
|
if (bottom_ > dpi->height)
|
||||||
bottom_ = dpi->height;
|
bottom_ = dpi->height;
|
||||||
|
|
||||||
bottom_ -= top_;
|
bottom_ -= top_;
|
||||||
|
|
||||||
if (!(colour & 0x2000000)) {
|
if (!(colour & 0x2000000)) {
|
||||||
if (!(colour & 0x4000000)) {
|
if (!(colour & 0x4000000)) {
|
||||||
uint8* edi;
|
uint8* edi;
|
||||||
edi = (top_ * (dpi->width + dpi->pitch)) + left_ + dpi->bits;
|
edi = (top_ * (dpi->width + dpi->pitch)) + left_ + dpi->bits;
|
||||||
|
|
||||||
uint8 col = colour & 0xFF;
|
uint8 col = colour & 0xFF;
|
||||||
|
|
||||||
int length;
|
int length;
|
||||||
length = dpi->width + dpi->pitch - right_;
|
length = dpi->width + dpi->pitch - right_;
|
||||||
|
|
||||||
for (int i = 0; i < bottom_; ++i) {
|
for (int i = 0; i < bottom_; ++i) {
|
||||||
uint32 ecx;
|
uint32 ecx;
|
||||||
ecx = right_;
|
ecx = right_;
|
||||||
ecx = ecx / 2;
|
ecx = ecx / 2;
|
||||||
if (ecx % 2 != 0) {
|
if (ecx % 2 != 0) {
|
||||||
*edi = col;
|
*edi = col;
|
||||||
edi++;
|
edi++;
|
||||||
}
|
}
|
||||||
ecx = ecx / 2;
|
ecx = ecx / 2;
|
||||||
if (ecx % 2 != 0) {
|
if (ecx % 2 != 0) {
|
||||||
*edi = col;
|
*edi = col;
|
||||||
edi++;
|
edi++;
|
||||||
*edi = col;
|
*edi = col;
|
||||||
edi++;
|
edi++;
|
||||||
// *((uint16*)edi) = ax & 0xffff;
|
// *((uint16*)edi) = ax & 0xffff;
|
||||||
// edi += 2;
|
// edi += 2;
|
||||||
}
|
}
|
||||||
memset(edi, col, ecx*4);
|
memset(edi, col, ecx*4);
|
||||||
edi += length;
|
edi += length;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 00678B8A 00678E38
|
// 00678B8A 00678E38
|
||||||
char* esi;
|
char* esi;
|
||||||
esi = (top_ * (dpi->width + dpi->pitch)) + left_ + dpi->bits;;
|
esi = (top_ * (dpi->width + dpi->pitch)) + left_ + dpi->bits;;
|
||||||
|
|
||||||
int eax, ebp;
|
int eax, ebp;
|
||||||
eax = colour;
|
eax = colour;
|
||||||
ebp = dpi->width + dpi->pitch - right_;
|
ebp = dpi->width + dpi->pitch - right_;
|
||||||
|
|
||||||
RCT2_GLOBAL(0x00EDF810, uint32) = ebp;
|
RCT2_GLOBAL(0x00EDF810, uint32) = ebp;
|
||||||
RCT2_GLOBAL(0x009ABDB2, uint16) = bottom_;
|
RCT2_GLOBAL(0x009ABDB2, uint16) = bottom_;
|
||||||
RCT2_GLOBAL(0x00EDF814, uint32) = right_;
|
RCT2_GLOBAL(0x00EDF814, uint32) = right_;
|
||||||
|
|
||||||
top_ = (top + dpi_->y) & 0xf;
|
top_ = (top + dpi_->y) & 0xf;
|
||||||
right_ = (right + dpi_->x) &0xf;
|
right_ = (right + dpi_->x) &0xf;
|
||||||
|
|
||||||
dpi_ = esi;
|
dpi_ = esi;
|
||||||
|
|
||||||
esi = eax >> 0x1C;
|
esi = eax >> 0x1C;
|
||||||
esi = RCT2_GLOBAL(0x0097FEFC,uint32)[esi]; // or possibly uint8)[esi*4] ?
|
esi = RCT2_GLOBAL(0x0097FEFC,uint32)[esi]; // or possibly uint8)[esi*4] ?
|
||||||
|
|
||||||
for (; RCT2_GLOBAL(0x009ABDB2, uint16) > 0; RCT2_GLOBAL(0x009ABDB2, uint16)--) {
|
for (; RCT2_GLOBAL(0x009ABDB2, uint16) > 0; RCT2_GLOBAL(0x009ABDB2, uint16)--) {
|
||||||
// push ebx
|
// push ebx
|
||||||
// push ecx
|
// push ecx
|
||||||
ebp = *(esi + top_*2);
|
ebp = *(esi + top_*2);
|
||||||
|
|
||||||
// mov bp, [esi+top_*2];
|
// mov bp, [esi+top_*2];
|
||||||
int ecx;
|
int ecx;
|
||||||
ecx = RCT2_GLOBAL(0x00EDF814, uint32);
|
ecx = RCT2_GLOBAL(0x00EDF814, uint32);
|
||||||
|
|
||||||
for (int i = ecx; i >=0; --i) {
|
for (int i = ecx; i >=0; --i) {
|
||||||
if (!(ebp & (1 << right_)))
|
if (!(ebp & (1 << right_)))
|
||||||
dpi_->bits = left_ & 0xFF;
|
dpi_->bits = left_ & 0xFF;
|
||||||
|
|
||||||
right_++;
|
right_++;
|
||||||
right_ = right_ & 0xF;
|
right_ = right_ & 0xF;
|
||||||
dpi_++;
|
dpi_++;
|
||||||
}
|
}
|
||||||
// pop ecx
|
// pop ecx
|
||||||
// pop ebx
|
// pop ebx
|
||||||
top_++;
|
top_++;
|
||||||
top_ = top_ &0xf;
|
top_ = top_ &0xf;
|
||||||
dpi_ += RCT2_GLOBAL(0x00EDF810, uint32);
|
dpi_ += RCT2_GLOBAL(0x00EDF810, uint32);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// 00678B7E 00678C83
|
// 00678B7E 00678C83
|
||||||
if (dpi_->pad_0E < 1) {
|
if (dpi_->pad_0E < 1) {
|
||||||
// Location in screen buffer?
|
// Location in screen buffer?
|
||||||
uint8* edi = top_ * (dpi_->width + dpi_->pitch) + left_ + dpi_->bits;
|
uint8* edi = top_ * (dpi_->width + dpi_->pitch) + left_ + dpi_->bits;
|
||||||
|
|
||||||
// Find colour in colour table?
|
// Find colour in colour table?
|
||||||
uint32 eax = RCT2_ADDRESS(0x0097FCBC, uint32)[(colour & 0xFF)];
|
uint32 eax = RCT2_ADDRESS(0x0097FCBC, uint32)[(colour & 0xFF)];
|
||||||
rct_g1_element* g1_element = &(RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[eax]);
|
rct_g1_element* g1_element = &(RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[eax]);
|
||||||
|
|
||||||
int length = (dpi_->width + dpi_->pitch) - right_;
|
int length = (dpi_->width + dpi_->pitch) - right_;
|
||||||
|
|
||||||
// Fill the rectangle with the colours from the colour table
|
// Fill the rectangle with the colours from the colour table
|
||||||
for (int i = 0; i < bottom_; ++i) {
|
for (int i = 0; i < bottom_; ++i) {
|
||||||
for (int j = 0; j < right_; ++j) {
|
for (int j = 0; j < right_; ++j) {
|
||||||
*edi = *((uint8*)(&g1_element->offset[*edi]));
|
*edi = *((uint8*)(&g1_element->offset[*edi]));
|
||||||
edi++;
|
edi++;
|
||||||
}
|
}
|
||||||
edi += length;
|
edi += length;
|
||||||
}
|
}
|
||||||
} else if (dpi_->pad_0E > 1) {
|
} else if (dpi_->pad_0E > 1) {
|
||||||
// 00678C8A 00678D57
|
// 00678C8A 00678D57
|
||||||
} else if (dpi_->pad_0E == 1) {
|
right_ = right;
|
||||||
// 00678C88 00678CEE
|
} else if (dpi_->pad_0E == 1) {
|
||||||
|
// 00678C88 00678CEE
|
||||||
}
|
right = right;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 00678B3A 00678EC9
|
// 00678B3A 00678EC9
|
||||||
|
right_ = right;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 00678B2E 00678BE5
|
// 00678B2E 00678BE5
|
||||||
}
|
}
|
||||||
|
|
||||||
// RCT2_CALLPROC_X(0x00678AD4, left, right, top, bottom, 0, dpi, colour);
|
// RCT2_CALLPROC_X(0x00678AD4, left, right, top, bottom, 0, dpi, colour);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue