Subversion Repositories pentevo

Rev

Rev 716 | Blame | Last modification | View Log | Download | RSS feed

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