Skip to content

Commit 5dd0301

Browse files
committed
improve landscape blending
1 parent 6985097 commit 5dd0301

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/extract.c

+14-6
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,20 @@ void s3dat_blend_handler(s3dat_extracthandler_t* me, s3dat_res_t* res, s3util_ex
335335

336336
s3dat_bitmap_t* bmp = res->res->data.bmp;
337337

338-
uint32_t pixel_count = bmp->width*bmp->height;
339-
for(uint32_t i = 0;i != pixel_count;i++) {
340-
if(bmp->data[i].red == 0
341-
&& bmp->data[i].green == 0xce
342-
&& (bmp->data[i].blue == 0xff || bmp->data[i].blue == 0xee)
343-
&& bmp->data[i].alpha == 0xff) bmp->data[i].alpha = 0;
338+
if(bmp->width != 32 || bmp->height != 32) return;
339+
340+
if(bmp->data[0].red == 0 && bmp->data[0].green == 0xce
341+
&& (bmp->data[0].blue == 0xff || bmp->data[0].blue == 0xee)
342+
&& bmp->data[0].alpha == 0xff) {
343+
for(uint32_t y = 1;y != 17;y++) {
344+
for(uint32_t x = 0;x != y/2;x++) {
345+
bmp->data[(y+15)*32+x].alpha = 0;
346+
bmp->data[(16-y)*32+x].alpha = 0;
347+
348+
bmp->data[(y+15)*32+31-x].alpha = 0;
349+
bmp->data[(16-y)*32+31-x].alpha = 0;
350+
}
351+
}
344352
}
345353
}
346354

0 commit comments

Comments
 (0)