ack3d/ack_lib/ACKOVER.C
Gered 865b466995 initial commit
sources taken from book CD:

ack_lib -> /ACK/WIN/ACK_LIB
fdemo -> /ACK/DOS/FDEMO/SOURCE (and /ACK/DOS/BORLAND as needed)
mall -> /ACK/DOS/MALL/SOURCE (and /ACK/DOS/BORLAND as needed)

some source files were missing for the demo projects and needed to be
copied from /ACK/DOS/BORLAND (as indicated above)
2019-11-02 13:17:24 -04:00

73 lines
1.5 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <mem.h>
#include <io.h>
#include <fcntl.h>
#include <time.h>
#include <string.h>
#include <sys\stat.h>
#include "ack3d.h"
#include "ackeng.h"
//±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
// Creates an overlay buffer that contains non-transparent information
// about the image. Position and length of the non-transparent areas is
// stored for later processing after the drawing phase. Theoretically the
// amount of information stored in the overlay buffer could exceed the
// actual size of the image.
//±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
short AckCreateOverlay(ACKENG *ae,UCHAR *sBuf)
{
USHORT bPos,vPos,vLen;
USHORT len,sPos,sPos1;
vLen = (ae->WinEndY - ae->WinStartY) * BYTES_PER_ROW;
vPos = ae->WinStartY * BYTES_PER_ROW;
bPos = 0;
sPos = vPos;
while (vLen > 0)
{
if (sBuf[sPos])
{
sPos1 = sPos;
while (vLen > 0 && sBuf[sPos1++])
vLen--;
len = (sPos1 - sPos) - 1;
(*(short *)&ae->ScreenBuffer[bPos]) = len;
bPos += 2;
(*(short *)&ae->ScreenBuffer[bPos]) = sPos;
bPos += 2;
memmove(&ae->ScreenBuffer[bPos],&sBuf[sPos],len);
bPos += len;
sPos = sPos1;
}
else
{
sPos++;
vLen--;
}
}
(*(short *)&ae->ScreenBuffer[bPos]) = 0;
bPos += 2;
ae->OverlayBuffer = AckMalloc(bPos);
if (ae->OverlayBuffer != NULL)
{
memmove(ae->OverlayBuffer,ae->ScreenBuffer,bPos);
return(0);
}
return(ERR_NOMEMORY);
}
// **** End of Source ****