| 617 | tce->age += frametime; |
| 618 | } |
| 619 | void RenderBmpInvert(tceffect *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 620 | ASSERT(tce->type == EFX_BMP_INVERT); |
| 621 | int srcbmph = tce->bmpinfo.bm_handle; |
| 622 | bool changed = true; |
| 623 | if (!ok_to_render && tce->flags & TC_NOEARLYRENDER) |
| 624 | return; |
| 625 | float k; |
| 626 | |
| 627 | if (ok_to_render) { |
| 628 | k = tce->age / tce->speed; |
| 629 | } else { |
| 630 | k = 0; |
| 631 | } |
| 632 | int inv; |
| 633 | if (k > 1.0) { |
| 634 | k = 1.0; |
| 635 | changed = false; |
| 636 | } else if (k < 0) { |
| 637 | mprintf(0, "k<0 on inverse bitmap...bashing (%.2f/%.2f)\n", tce->age, tce->speed); |
| 638 | if (tce->age < 0) |
| 639 | Int3(); |
| 640 | if (tce->speed < 0) |
| 641 | tce->speed = 0.1f; |
| 642 | k = 0; |
| 643 | changed = false; |
| 644 | } |
| 645 | if (tce->flags == TC_BMPF_OUT) |
| 646 | k = 1 - k; |
| 647 | inv = 255 - (255.0f * k); |
| 648 | uint8_t r, g, b; |
| 649 | int bh = bm_h(srcbmph, 0); |
| 650 | int bw = bm_w(srcbmph, 0); |
| 651 | int how_many = tce->bmpinfo.chunk_bmp.w * tce->bmpinfo.chunk_bmp.h; |
| 652 | int how_many_across = tce->bmpinfo.chunk_bmp.w; |
| 653 | int dim = bm_h(tce->bmpinfo.chunk_bmp.bm_array[0], 0); |
| 654 | int shift; // speed up (since dim is always a power of 2) |
| 655 | switch (dim) { |
| 656 | case 32: |
| 657 | shift = 5; |
| 658 | break; |
| 659 | case 64: |
| 660 | shift = 6; |
| 661 | break; |
| 662 | case 128: |
| 663 | shift = 7; |
| 664 | break; |
| 665 | } |
| 666 | uint16_t *src_data = bm_data(srcbmph, 0); |
| 667 | uint16_t *sdata; |
| 668 | uint16_t *ddata; |
| 669 | uint16_t pix; |
| 670 | int maxx, maxy; |
| 671 | int windex, hindex; |
| 672 | int s_y, s_x, d_y, d_x; |
| 673 | // is there any need to do this if !changed!?!? |
| 674 | for (hindex = 0; hindex < tce->bmpinfo.chunk_bmp.h; hindex++) { |
| 675 | for (windex = 0; windex < tce->bmpinfo.chunk_bmp.w; windex++) { |
| 676 | // loop through the chunks |
no test coverage detected