Subversion Repositories pentevo

Rev

Rev 796 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. #include "std.h"
  2.  
  3. #include "emul.h"
  4. #include "vars.h"
  5. #include "draw.h"
  6. #include "dxrframe.h"
  7. #include "dxrcopy.h"
  8. #include "util.h"
  9.  
  10. void _render_black(unsigned char *dst, unsigned pitch)
  11. {
  12.    unsigned dx = ((temp.rflags & RF_OVR) ? temp.ox : temp.rsx)*temp.obpp/8;
  13.    unsigned filler = (temp.rflags & RF_OVR)? WORD4(0,0x80,0,0x80) : 0;
  14.    for (unsigned y = (temp.rflags & (RF_OVR|RF_CLIP)) ? temp.oy : temp.rsy; y; y--) {
  15.       for (unsigned x = 0; x < dx; x += 4)
  16.          *(unsigned*)(dst+x) = filler;
  17.       dst += pitch;
  18.    }
  19. }
  20.  
  21. void rend_frame8(unsigned char *dst, unsigned pitch)
  22. {
  23.    if (!conf.updateb) return;
  24.    unsigned char *src = rbuf; unsigned scx = temp.scx, delta = scx/4;
  25.    unsigned y; //Alone Coder 0.36.7
  26.    for (/*unsigned*/ y = 0; y < temp.b_top; y++) {
  27.       line8(dst, src, t.sctab8[0]); dst += pitch;
  28.       src += delta;
  29.    }
  30.    temp.scx = (scx-256)/2;
  31.    unsigned d1 = (temp.b_left+256)/4, offs = d1*8;
  32.    for (y = 0; y < 192; y++) {
  33.       line8(dst, src, t.sctab8[0]);
  34.       line8(dst+offs, src + d1, t.sctab8[0]);
  35.       dst += pitch; src += delta;
  36.    }
  37.    temp.scx = scx;
  38.    for (y = 0; y < temp.b_bottom; y++) {
  39.       line8(dst, src, t.sctab8[0]); dst += pitch;
  40.       src += delta;
  41.    }
  42. }
  43.  
  44. void rend_frame_8d1(unsigned char *dst, unsigned pitch)
  45. {
  46.    if (!conf.updateb) return;
  47.    unsigned char *src = rbuf; unsigned scx = temp.scx, delta = scx/4;
  48.    unsigned y; //Alone Coder 0.36.7
  49.    for (/*unsigned*/ y = 0; y < temp.b_top; y++) {
  50.       line8d(dst, src, t.sctab8d[0]); dst += pitch;
  51.       src += delta;
  52.    }
  53.    temp.scx = (scx-256)/2;
  54.    unsigned d1 = (temp.b_left+256)/4, offs = d1*8;
  55.    for (y = 0; y < 192; y++) {
  56.       line8d(dst, src, t.sctab8d[0]);
  57.       line8d(dst+offs, src + d1, t.sctab8d[0]);
  58.       dst += pitch; src += delta;
  59.    }
  60.    temp.scx = scx;
  61.    for (y = 0; y < temp.b_bottom; y++) {
  62.       line8d(dst, src, t.sctab8d[0]); dst += pitch;
  63.       src += delta;
  64.    }
  65. }
  66.  
  67. void rend_frame_8d(unsigned char *dst, unsigned pitch)
  68. {
  69.    if (!conf.updateb) return;
  70.    unsigned char *src = rbuf; unsigned scx = temp.scx, delta = scx/4;
  71.    unsigned y; //Alone Coder 0.36.7
  72.    for (/*unsigned*/ y = 0; y < temp.b_top; y++) {
  73.       line8d(dst, src, t.sctab8d[0]); dst += pitch;
  74.       line8d(dst, src, t.sctab8d[1]); dst += pitch;
  75.       src += delta;
  76.    }
  77.    temp.scx = (scx-256)/2;
  78.    unsigned d1 = (temp.b_left+256)/4, offs = d1*8;
  79.    for (y = 0; y < 192; y++) {
  80.       line8d(dst, src, t.sctab8d[0]);
  81.       line8d(dst+offs, src + d1, t.sctab8d[0]);
  82.       dst += pitch;
  83.       line8d(dst, src, t.sctab8d[1]);
  84.       line8d(dst+offs, src + d1, t.sctab8d[1]);
  85.       dst += pitch;
  86.       src += delta;
  87.    }
  88.    temp.scx = scx;
  89.    for (y = 0; y < temp.b_bottom; y++) {
  90.       line8d(dst, src, t.sctab8d[0]); dst += pitch;
  91.       line8d(dst, src, t.sctab8d[1]); dst += pitch;
  92.       src += delta;
  93.    }
  94. }
  95.  
  96. void rend_frame16(unsigned char *dst, unsigned pitch)
  97. {
  98.    if (!conf.updateb) return;
  99.    unsigned char *src = rbuf; unsigned scx = temp.scx, delta = scx/4;
  100.    unsigned y; //Alone Coder 0.36.7
  101.    for (/*unsigned*/ y = 0; y < temp.b_top; y++) {
  102.       line16(dst, src, t.sctab16[0]);
  103.       dst += pitch; src += delta;
  104.    }
  105.    temp.scx = (scx-256)/2;
  106.    unsigned d1 = (temp.b_left+256)/4, offs = d1*8;
  107.    for (y = 0; y < 192; y++) {
  108.       line16(dst, src, t.sctab16[0]);
  109.       line16(dst+offs, src + d1, t.sctab16[0]);
  110.       dst += pitch; src += delta;
  111.    }
  112.    temp.scx = scx;
  113.    for (y = 0; y < temp.b_bottom; y++) {
  114.       line16(dst, src, t.sctab16[0]);
  115.       dst += pitch; src += delta;
  116.    }
  117. }
  118.  
  119. void rend_frame_16d1(unsigned char *dst, unsigned pitch)
  120. {
  121.    if (!conf.updateb) return;
  122.    unsigned char *src = rbuf; unsigned scx = temp.scx, delta = scx/4;
  123.    unsigned y; //Alone Coder 0.36.7
  124.    for (/*unsigned*/ y = 0; y < temp.b_top; y++) {
  125.       line16d(dst, src, t.sctab16d[0]); dst += pitch;
  126.       src += delta;
  127.    }
  128.    temp.scx = (scx-256)/2;
  129.    unsigned d1 = (temp.b_left+256)/4, offs = d1*16;
  130.    for (y = 0; y < 192; y++) {
  131.       line16d(dst, src, t.sctab16d[0]);
  132.       line16d(dst+offs, src + d1, t.sctab16d[0]);
  133.       dst += pitch; src += delta;
  134.    }
  135.    temp.scx = scx;
  136.    for (y = 0; y < temp.b_bottom; y++) {
  137.       line16d(dst, src, t.sctab16d[0]); dst += pitch;
  138.       src += delta;
  139.    }
  140. }
  141.  
  142. void rend_frame_16d(unsigned char *dst, unsigned pitch)
  143. {
  144.    if (!conf.updateb) return;
  145.    unsigned char *src = rbuf; unsigned scx = temp.scx, delta = scx/4;
  146.    unsigned y; //Alone Coder 0.36.7
  147.    for (/*unsigned*/ y = 0; y < temp.b_top; y++) {
  148.       line16d(dst, src, t.sctab16d[0]); dst += pitch;
  149.       line16d(dst, src, t.sctab16d[1]); dst += pitch;
  150.       src += delta;
  151.    }
  152.    temp.scx = (scx-256)/2;
  153.    unsigned d1 = (temp.b_left+256)/4, offs = d1*16;
  154.    for (y = 0; y < 192; y++) {
  155.       line16d(dst, src, t.sctab16d[0]);
  156.       line16d(dst+offs, src + d1, t.sctab16d[0]);
  157.       dst += pitch;
  158.       line16d(dst, src, t.sctab16d[1]);
  159.       line16d(dst+offs, src + d1, t.sctab16d[1]);
  160.       dst += pitch;
  161.       src += delta;
  162.    }
  163.    temp.scx = scx;
  164.    for (y = 0; y < temp.b_bottom; y++) {
  165.       line16d(dst, src, t.sctab16d[0]); dst += pitch;
  166.       line16d(dst, src, t.sctab16d[1]); dst += pitch;
  167.       src += delta;
  168.    }
  169. }
  170.  
  171. void rend_frame32(unsigned char *dst, unsigned pitch)
  172. {
  173.    if (!conf.updateb) return;
  174.    unsigned char *src = rbuf; unsigned scx = temp.scx, delta = scx/4;
  175.    unsigned y; //Alone Coder 0.36.7
  176.    for (/*unsigned*/ y = 0; y < temp.b_top; y++) {
  177.       line32(dst, src, t.sctab32[0]); dst += pitch;
  178.       src += delta;
  179.    }
  180.    temp.scx = (scx-256)/2;
  181.    unsigned d1 = (temp.b_left+256)/4, offs = d1*32;
  182.    for (y = 0; y < 192; y++) {
  183.       line32(dst, src, t.sctab32[0]);
  184.       line32(dst+offs, src + d1, t.sctab32[0]);
  185.       dst += pitch; src += delta;
  186.    }
  187.    temp.scx = scx;
  188.    for (y = 0; y < temp.b_bottom; y++) {
  189.       line32(dst, src, t.sctab32[0]); dst += pitch;
  190.       src += delta;
  191.    }
  192. }
  193.  
  194. void rend_frame_32d1(unsigned char *dst, unsigned pitch)
  195. {
  196.    if (!conf.updateb) return;
  197.    unsigned char *src = rbuf; unsigned scx = temp.scx, delta = scx/4;
  198.    unsigned y; //Alone Coder 0.36.7
  199.    for (/*unsigned*/ y = 0; y < temp.b_top; y++) {
  200.       line32d(dst, src, t.sctab32[0]); dst += pitch;
  201.       src += delta;
  202.    }
  203.    temp.scx = (scx-256)/2;
  204.    unsigned d1 = (temp.b_left+256)/4, offs = d1*32;
  205.    for (y = 0; y < 192; y++) {
  206.       line32d(dst, src, t.sctab32[0]);
  207.       line32d(dst+offs, src + d1, t.sctab32[0]);
  208.       dst += pitch; src += delta;
  209.    }
  210.    temp.scx = scx;
  211.    for (y = 0; y < temp.b_bottom; y++) {
  212.       line32d(dst, src, t.sctab32[0]); dst += pitch;
  213.       src += delta;
  214.    }
  215. }
  216.  
  217. void rend_frame_32d(unsigned char *dst, unsigned pitch)
  218. {
  219.    if (!conf.updateb) return;
  220.    unsigned char *src = rbuf; unsigned scx = temp.scx, delta = scx/4;
  221.    unsigned y; //Alone Coder 0.36.7
  222.    for (/*unsigned*/ y = 0; y < temp.b_top; y++) {
  223.       line32d(dst, src, t.sctab32[0]); dst += pitch;
  224.       line32d(dst, src, t.sctab32[1]); dst += pitch;
  225.       src += delta;
  226.    }
  227.    temp.scx = (scx-256)/2;
  228.    unsigned d1 = (temp.b_left+256)/4, offs = d1*32;
  229.    for (y = 0; y < 192; y++) {
  230.       line32d(dst, src, t.sctab32[0]);
  231.       line32d(dst+offs, src + d1, t.sctab32[0]);
  232.       dst += pitch;
  233.       line32d(dst, src, t.sctab32[1]);
  234.       line32d(dst+offs, src + d1, t.sctab32[1]);
  235.       dst += pitch;
  236.       src += delta;
  237.    }
  238.    temp.scx = scx;
  239.    for (y = 0; y < temp.b_bottom; y++) {
  240.       line32d(dst, src, t.sctab32[0]); dst += pitch;
  241.       line32d(dst, src, t.sctab32[1]); dst += pitch;
  242.       src += delta;
  243.    }
  244. }
  245.  
  246. void gdi_frame()
  247. {
  248.    RECT rc, r0;
  249.    GetClientRect(wnd, &rc);
  250.    HBRUSH black = (HBRUSH)GetStockObject(BLACK_BRUSH);
  251.    if (temp.oy < temp.gdy)
  252.    {
  253.       r0.top = rc.top; r0.left = rc.left; r0.right = rc.right; r0.bottom = LONG(temp.gy);
  254.       FillRect(temp.gdidc, &r0, black);
  255.       r0.top = LONG(temp.gy+temp.oy); r0.bottom = rc.bottom;
  256.       FillRect(temp.gdidc, &r0, black);
  257.    }
  258.    if (temp.ox < temp.gdx)
  259.    {
  260.       r0.top = rc.top; r0.bottom = rc.bottom; r0.left = rc.left; r0.right = LONG(temp.gx);
  261.       FillRect(temp.gdidc, &r0, black);
  262.       r0.left = LONG(temp.gx + temp.ox); r0.right = rc.right;
  263.       FillRect(temp.gdidc, &r0, black);
  264.    }
  265.    memset(gdibuf, 0, temp.ox*temp.oy*temp.obpp/8);
  266. }
  267.