add makefile for building map_edit, get rid of unneeded sources
the map_edit sources from the cd seemed to include two different versions of a map editor. the sources i've left here seem to most closely match the version of mapedit.exe included on the book's cd
This commit is contained in:
parent
cf7cd898cd
commit
40bab9e61b
|
@ -1,96 +0,0 @@
|
|||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#define LONG unsigned long
|
||||
#define ULONG unsigned long
|
||||
#define UBYTE unsigned char
|
||||
#define UWORD unsigned short
|
||||
#define DWORD unsigned long
|
||||
|
||||
long ByteFlipLong(long);
|
||||
UCHAR *Readiff(char *); /* this returns back a bitmap with a picture in it*/
|
||||
|
||||
typedef LONG ID; /* An ID is four printable ASCII chars like FORM or DPPV */
|
||||
|
||||
#define MakeID(d,c,b,a) ((DWORD)(a)<<24 | (DWORD)(b)<<16 | (DWORD)(c)<<8 | (DWORD)(d) )
|
||||
|
||||
#define FORM MakeID('F','O','R','M')
|
||||
#define PROP MakeID('P','R','O','P')
|
||||
#define LIST MakeID('L','I','S','T')
|
||||
#define CAT MakeID('C','A','T',' ')
|
||||
#define FILLER MakeID(' ',' ',' ',' ')
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ID type;
|
||||
long cksize;
|
||||
ID subtype;
|
||||
} form_chunk;
|
||||
|
||||
typedef struct {
|
||||
ID ckID;
|
||||
LONG ckSize;
|
||||
} ChunkHeader;
|
||||
|
||||
typedef struct {
|
||||
ID ckID;
|
||||
LONG ckSize;
|
||||
UBYTE ckData[ 1 /*REALLY: ckSize*/ ];
|
||||
} Chunk;
|
||||
|
||||
#define ID_PBM MakeID('P','B','M',' ')
|
||||
#define ID_ILBM MakeID('I','L','B','M')
|
||||
#define ID_BMHD MakeID('B','M','H','D')
|
||||
#define ID_CMAP MakeID('C','M','A','P')
|
||||
#define ID_GRAB MakeID('G','R','A','B')
|
||||
#define ID_DEST MakeID('D','E','S','T')
|
||||
#define ID_SPRT MakeID('S','P','R','T')
|
||||
#define ID_CAMG MakeID('C','A','M','G')
|
||||
#define ID_BODY MakeID('B','O','D','Y')
|
||||
|
||||
/* ---------- BitMapHeader ---------------------------------------------*/
|
||||
|
||||
typedef UBYTE Masking; /* Choice of masking technique.*/
|
||||
#define mskNone 0
|
||||
#define mskHasMask 1
|
||||
#define mskHasTransparentColor 2
|
||||
#define mskLasso 3
|
||||
|
||||
#define cmpNone 0
|
||||
#define cmpByteRun1 1
|
||||
|
||||
/* A BitMapHeader is stored in a BMHD chunk. */
|
||||
typedef struct {
|
||||
UWORD w, h; /* raster width & height in pixels */
|
||||
UWORD x, y; /* position for this image */
|
||||
UBYTE nPlanes; /* # source bitplanes */
|
||||
UBYTE masking; /* masking technique */
|
||||
UBYTE compression; /* compression algoithm */
|
||||
UBYTE pad1; /* UNUSED. For consistency, put 0 here.*/
|
||||
UWORD transparentColor; /* transparent "color number" */
|
||||
UBYTE xAspect, yAspect; /* aspect ratio, a rational number x/y */
|
||||
UWORD pageWidth, pageHeight; /* source "page" size in pixels */
|
||||
} BitMapHeader;
|
||||
/* RowBytes computes the number of bytes in a row, from the width in pixels.*/
|
||||
#define RowBytes(w) (((w) + 15) >> 4 << 1)
|
||||
|
||||
/* A CMAP chunk is a packed array of ColorRegisters (3 bytes each). */
|
||||
typedef struct {
|
||||
UBYTE red, green, blue; /* MUST be UBYTEs so ">> 4" won't sign extend.*/
|
||||
} ColorRegister;
|
||||
|
||||
/* Use this constant instead of sizeof(ColorRegister). */
|
||||
#define sizeofColorRegister 3
|
||||
|
||||
long ByteFlipLong(long);
|
||||
void ByteFlipShort(short *);
|
||||
short iffswab(unsigned short);
|
||||
short swab(unsigned short);
|
||||
|
||||
|
73
map_edit/makefile
Normal file
73
map_edit/makefile
Normal file
|
@ -0,0 +1,73 @@
|
|||
target_config = debug
|
||||
|
||||
test_map_files_dir = fdemo
|
||||
test_map_file = fdemo.l01
|
||||
|
||||
target_name = mapedit
|
||||
|
||||
mapedit_dtf = medit.dtf
|
||||
bpic_exe = ..\bpic\bpic.exe
|
||||
acklib_incdir = ..\ack_lib
|
||||
acklib_lib = ..\ack_lib\acklib.lib
|
||||
|
||||
object_files = &
|
||||
m1.obj &
|
||||
m1read.obj &
|
||||
m1util.obj &
|
||||
measm.obj &
|
||||
mouse.obj
|
||||
|
||||
|
||||
cc_flags_debug = /d2 /zp1 /4r /fp3 /j
|
||||
cc_flags_release = /d1+ /zp1 /4r /fp3 /ontx /oe=40 /j
|
||||
cc_flags = /mf /i=$(acklib_incdir) $(cc_flags_$(target_config))
|
||||
|
||||
link_flags_debug = debug all
|
||||
link_flags_release = debug all
|
||||
link_flags = $(link_flags_$(target_config))
|
||||
|
||||
.c.obj: .AUTODEPEND
|
||||
wcc386 $[. /zq $(cc_flags)
|
||||
|
||||
.asm.obj: .AUTODEPEND
|
||||
tasm $[. /t $(asm_flags)
|
||||
|
||||
$(mapedit_dtf):
|
||||
$(bpic_exe) m1files.dat $^.
|
||||
|
||||
$(target_name).lnk: $(object_files)
|
||||
%create $^@
|
||||
%append $^@ NAME $(target_name).exe
|
||||
%append $^@ SYSTEM DOS4G
|
||||
%append $^@ OPTION QUIET
|
||||
%append $^@ OPTION STACK=16k
|
||||
%append $^@ LIBRARY $(acklib_lib)
|
||||
@for %i in ($(object_files)) do %append $^@ FILE %i
|
||||
|
||||
$(target_name).exe: $(object_files) $(target_name).lnk $(mapedit_dtf)
|
||||
wlink $(link_flags) @$(target_name).lnk
|
||||
|
||||
clean : .SYMBOLIC
|
||||
del *.obj
|
||||
del *.err
|
||||
del $(mapedit_dtf)
|
||||
del $(target_name).exe
|
||||
del $(target_name).lnk
|
||||
|
||||
.NOCHECK
|
||||
build : $(target_name).exe
|
||||
|
||||
.NOCHECK
|
||||
run : $(target_name).exe
|
||||
copy $(target_name).exe $(test_map_files_dir)
|
||||
copy $(mapedit_dtf) $(test_map_files_dir)
|
||||
cd $(test_map_files_dir)
|
||||
$(target_name).exe $(test_map_file)
|
||||
|
||||
.NOCHECK
|
||||
debug : $(target_name).exe
|
||||
copy $(target_name).exe $(test_map_files_dir)
|
||||
copy $(mapedit_dtf) $(test_map_files_dir)
|
||||
cd $(test_map_files_dir)
|
||||
wd /swap /trap=rsi $(target_name).exe $(test_map_file)
|
||||
|
1981
map_edit/medit.c
1981
map_edit/medit.c
File diff suppressed because it is too large
Load diff
Binary file not shown.
296
map_edit/mgif.c
296
map_edit/mgif.c
|
@ -1,296 +0,0 @@
|
|||
/*****************************************************************************
|
||||
MGIF.C
|
||||
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
Routine to load a 256 color .GIF file into a memory buffer. *Only* 256
|
||||
color images are supported here! Sorry, no routines to SAVE .GIFs...
|
||||
Memory required is allocated on the fly.
|
||||
|
||||
Mark Morley
|
||||
morley@camosun.bc.ca
|
||||
|
||||
Modified for use in the ACK environment by Lary Myers
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <process.h>
|
||||
#include <bios.h>
|
||||
#include <fcntl.h>
|
||||
#include <malloc.h>
|
||||
#include "ack3d.h"
|
||||
#include "ackeng.h"
|
||||
|
||||
#define MAX_CODES 4096
|
||||
|
||||
extern unsigned char colordat[]; // Palette buffer in AckReadiff module
|
||||
extern short rsHandle;
|
||||
extern short ErrorCode;
|
||||
|
||||
static FILE* fp;
|
||||
static short curr_size;
|
||||
static short clear;
|
||||
static short ending;
|
||||
static short newcodes;
|
||||
static short top_slot;
|
||||
static short slot;
|
||||
static short navail_bytes = 0;
|
||||
static short nbits_left = 0;
|
||||
static unsigned char b1;
|
||||
static unsigned char byte_buff[257];
|
||||
static unsigned char* pbytes;
|
||||
static unsigned char* stack;
|
||||
static unsigned char* suffix;
|
||||
static unsigned short* prefix;
|
||||
|
||||
static unsigned long rbaTable[10];
|
||||
|
||||
static unsigned long code_mask[13] =
|
||||
{
|
||||
0L,
|
||||
0x0001L, 0x0003L,
|
||||
0x0007L, 0x000FL,
|
||||
0x001FL, 0x003FL,
|
||||
0x007FL, 0x00FFL,
|
||||
0x01FFL, 0x03FFL,
|
||||
0x07FFL, 0x0FFFL
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
static short get_next_code(void)
|
||||
{
|
||||
short i;
|
||||
static unsigned long ret;
|
||||
|
||||
if (!nbits_left)
|
||||
{
|
||||
if (navail_bytes <= 0)
|
||||
{
|
||||
pbytes = byte_buff;
|
||||
navail_bytes = getc(fp);
|
||||
|
||||
if (navail_bytes)
|
||||
{
|
||||
for (i = 0; i < navail_bytes; ++i )
|
||||
*(byte_buff + i) = getc( fp );
|
||||
}
|
||||
}
|
||||
b1 = *pbytes++;
|
||||
nbits_left = 8;
|
||||
--navail_bytes;
|
||||
}
|
||||
|
||||
ret = b1 >> (8 - nbits_left);
|
||||
while (curr_size > nbits_left)
|
||||
{
|
||||
if (navail_bytes <= 0)
|
||||
{
|
||||
pbytes = byte_buff;
|
||||
navail_bytes = getc(fp);
|
||||
if (navail_bytes)
|
||||
{
|
||||
for( i = 0; i < navail_bytes; ++i )
|
||||
*(byte_buff + i) = getc( fp );
|
||||
}
|
||||
}
|
||||
b1 = *pbytes++;
|
||||
ret |= b1 << nbits_left;
|
||||
nbits_left += 8;
|
||||
--navail_bytes;
|
||||
}
|
||||
|
||||
nbits_left -= curr_size;
|
||||
|
||||
return((short)(ret & *(code_mask + curr_size)));
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
unsigned char *AckReadgif(char *picname)
|
||||
{
|
||||
unsigned char *sp;
|
||||
unsigned char *buffer,*OrgBuffer;
|
||||
short code, fc, oc;
|
||||
short i;
|
||||
unsigned char size;
|
||||
short c;
|
||||
unsigned short wt,ht;
|
||||
int bSize;
|
||||
unsigned char buf[1028];
|
||||
unsigned char red;
|
||||
unsigned char grn;
|
||||
unsigned char blu;
|
||||
|
||||
|
||||
if (!rsHandle)
|
||||
{
|
||||
fp = fopen(picname,"rb");
|
||||
if( !fp )
|
||||
{
|
||||
ErrorCode = ERR_BADFILE;
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fp = fdopen(rsHandle,"rb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
ErrorCode = ERR_BADPICNAME;
|
||||
return(0L);
|
||||
}
|
||||
|
||||
fseek(fp,rbaTable[(ULONG)picname],SEEK_SET);
|
||||
}
|
||||
|
||||
fread(buf,1,6,fp);
|
||||
if( strncmp( buf, "GIF", 3 ) )
|
||||
{
|
||||
if (!rsHandle)
|
||||
fclose(fp);
|
||||
|
||||
ErrorCode = ERR_INVALIDFORM;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
fread(buf,1,7,fp);
|
||||
for (i = 0; i < 768;)
|
||||
{
|
||||
red = getc(fp);
|
||||
grn = getc(fp);
|
||||
blu = getc(fp);
|
||||
colordat[i++] = red >> 2;
|
||||
colordat[i++] = grn >> 2;
|
||||
colordat[i++] = blu >> 2;
|
||||
}
|
||||
|
||||
fread(buf,1,5,fp);
|
||||
fread(buf,1,2,fp);
|
||||
wt = (*(short *)buf);
|
||||
fread(buf,1,2,fp);
|
||||
ht = (*(short *)buf);
|
||||
//wt = getw(fp);
|
||||
//ht = getw(fp);
|
||||
bSize = (ht * wt) + (sizeof(short) * 2);
|
||||
buffer = (UCHAR *)malloc(bSize);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
if (!rsHandle)
|
||||
fclose(fp);
|
||||
|
||||
ErrorCode = ERR_NOMEMORY;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
OrgBuffer = buffer;
|
||||
|
||||
(*(short *)buffer) = wt;
|
||||
buffer += sizeof(short);
|
||||
(*(short *)buffer) = ht;
|
||||
buffer += sizeof(short);
|
||||
|
||||
fread(buf,1,1,fp);
|
||||
size = getc(fp);
|
||||
|
||||
if (size < 2 || 9 < size)
|
||||
{
|
||||
if (!rsHandle)
|
||||
fclose(fp);
|
||||
free(OrgBuffer);
|
||||
ErrorCode = ERR_INVALIDFORM;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
stack = (unsigned char *) malloc(MAX_CODES + 1);
|
||||
suffix = (unsigned char *) malloc(MAX_CODES + 1);
|
||||
prefix = (unsigned short *) malloc(sizeof(short) * (MAX_CODES + 1));
|
||||
|
||||
if (stack == NULL || suffix == NULL || prefix == NULL)
|
||||
{
|
||||
if (!rsHandle)
|
||||
fclose(fp);
|
||||
free(OrgBuffer);
|
||||
ErrorCode = ERR_NOMEMORY;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
curr_size = size + 1;
|
||||
top_slot = 1 << curr_size;
|
||||
clear = 1 << size;
|
||||
ending = clear + 1;
|
||||
slot = newcodes = ending + 1;
|
||||
navail_bytes = nbits_left = 0;
|
||||
oc = fc = 0;
|
||||
sp = stack;
|
||||
|
||||
while ( (c = get_next_code()) != ending )
|
||||
{
|
||||
if (c == clear)
|
||||
{
|
||||
curr_size = size + 1;
|
||||
slot = newcodes;
|
||||
top_slot = 1 << curr_size;
|
||||
while ( (c = get_next_code()) == clear );
|
||||
|
||||
if( c == ending )
|
||||
break;
|
||||
|
||||
if( c >= slot )
|
||||
c = 0;
|
||||
|
||||
oc = fc = c;
|
||||
*buffer++ = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
code = c;
|
||||
if (code >= slot)
|
||||
{
|
||||
code = oc;
|
||||
*sp++ = fc;
|
||||
}
|
||||
|
||||
while (code >= newcodes)
|
||||
{
|
||||
*sp++ = *(suffix + code);
|
||||
code = *(prefix + code);
|
||||
}
|
||||
|
||||
*sp++ = code;
|
||||
if (slot < top_slot)
|
||||
{
|
||||
*(suffix + slot) = fc = code;
|
||||
*(prefix + slot++) = oc;
|
||||
oc = c;
|
||||
}
|
||||
|
||||
if (slot >= top_slot && curr_size < 12)
|
||||
{
|
||||
top_slot <<= 1;
|
||||
++curr_size;
|
||||
}
|
||||
|
||||
while (sp > stack)
|
||||
{
|
||||
--sp;
|
||||
*buffer++ = *sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(stack);
|
||||
free(suffix);
|
||||
free(prefix);
|
||||
|
||||
if (!rsHandle)
|
||||
fclose(fp);
|
||||
|
||||
return(OrgBuffer);
|
||||
}
|
250
map_edit/miff.c
250
map_edit/miff.c
|
@ -1,250 +0,0 @@
|
|||
/******************* ( Animation Construction Kit 3D ) ***********************/
|
||||
/* Deluxe Paint file reader */
|
||||
/* CopyRight (c) 1993 Authors: Jaimi McEntire, Lary Myers */
|
||||
/*****************************************************************************/
|
||||
//
|
||||
// This function will return a pointer to a buffer that holds the raw image.
|
||||
// just free the pointer to delete this buffer. After returning, the array
|
||||
// colordat will hold the adjusted palette of this pic.
|
||||
//
|
||||
// Also, this has been modified to only read in form PBM brushes. form ILBM's
|
||||
// (the "old" type) are not supported. use the "new" deluxe paint .lbm type
|
||||
// and do not choose "old".
|
||||
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <process.h>
|
||||
#include <bios.h>
|
||||
#include <fcntl.h>
|
||||
#include <malloc.h>
|
||||
#include <mem.h>
|
||||
#include "ack3d.h"
|
||||
#include "ackeng.h"
|
||||
#include "iff.h"
|
||||
|
||||
extern int ErrorCode;
|
||||
|
||||
unsigned char colordat[768]; /* maximum it can be...256 colors */
|
||||
|
||||
unsigned char cplanes[8][80]; /* setting max at 640 pixels width */
|
||||
/* thats 8 pixels per byte per plane */
|
||||
unsigned char *pplanes= (char far *) &cplanes[0][0]; /* for a form pbm */
|
||||
|
||||
#define MAX_BUF_POS 4096
|
||||
|
||||
int rdbufpos;
|
||||
int rdSize;
|
||||
UCHAR rdBuffer[MAX_BUF_POS+2];
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
short ReadNxtBlock(short handle)
|
||||
{
|
||||
short retlen;
|
||||
|
||||
retlen = read(handle,rdBuffer,MAX_BUF_POS);
|
||||
rdbufpos = 0;
|
||||
|
||||
return(retlen);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
int aRead(short handle,void *dest,int size)
|
||||
{
|
||||
int count = 0;
|
||||
UCHAR *d = (UCHAR *)dest;
|
||||
|
||||
while (size--)
|
||||
{
|
||||
if (rdbufpos >= MAX_BUF_POS)
|
||||
{
|
||||
if (rdSize != MAX_BUF_POS)
|
||||
{
|
||||
return(count);
|
||||
}
|
||||
|
||||
rdSize = read(handle,rdBuffer,MAX_BUF_POS);
|
||||
rdbufpos = 0;
|
||||
}
|
||||
|
||||
d[count++] = rdBuffer[rdbufpos++];
|
||||
}
|
||||
|
||||
return(count);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//=============================================================================
|
||||
unsigned char *Readiff(char *picname)
|
||||
{
|
||||
FILE *pic;
|
||||
short handle;
|
||||
form_chunk fchunk;
|
||||
ChunkHeader chunk;
|
||||
BitMapHeader bmhd;
|
||||
long length;
|
||||
char value; // must remain signed, no matter what. ignore any warnings.
|
||||
short sofar;
|
||||
short width,height,planes;
|
||||
short pixw;
|
||||
unsigned char *destx, *savedestx;
|
||||
|
||||
rdbufpos = MAX_BUF_POS + 1;
|
||||
rdSize = MAX_BUF_POS;
|
||||
|
||||
if ((pic = fopen(picname,"rb")) == NULL)
|
||||
{
|
||||
ErrorCode = ERR_BADPICNAME;
|
||||
return(0L);
|
||||
}
|
||||
fread(&fchunk,1,sizeof(form_chunk),pic); /* read in the first 12 bytes*/
|
||||
// aRead(pic,&fchunk,sizeof(form_chunk));
|
||||
|
||||
if (fchunk.type != FORM)
|
||||
{
|
||||
fclose(pic);
|
||||
ErrorCode = ERR_INVALIDFORM;
|
||||
return(0L);
|
||||
}
|
||||
|
||||
if (fchunk.subtype != ID_PBM)
|
||||
{
|
||||
printf("Error: Not form PBM!");
|
||||
fclose(pic);
|
||||
ErrorCode = ERR_NOPBM;
|
||||
return(0L);
|
||||
}
|
||||
// now lets loop...Because the Chunks can be in any order!
|
||||
while(1)
|
||||
{
|
||||
fread(&chunk,1,sizeof(ChunkHeader),pic);
|
||||
// aRead(pic,&chunk,sizeof(ChunkHeader));
|
||||
chunk.ckSize = ByteFlipLong(chunk.ckSize);
|
||||
if (chunk.ckSize & 1) chunk.ckSize ++; // must be word aligned
|
||||
if(chunk.ckID == ID_BMHD)
|
||||
{
|
||||
fread(&bmhd,1,sizeof(BitMapHeader),pic);
|
||||
// aRead(pic,&bmhd,sizeof(BitMapHeader));
|
||||
bmhd.w=iffswab(bmhd.w); // the only things we need.
|
||||
bmhd.h=iffswab(bmhd.h);
|
||||
destx = (unsigned char *)malloc((bmhd.w * bmhd.h)+4);
|
||||
if ( !destx )
|
||||
{
|
||||
fclose(pic);
|
||||
ErrorCode = ERR_NOMEMORY;
|
||||
return(0L);
|
||||
}
|
||||
|
||||
savedestx = destx;
|
||||
|
||||
destx[0] = bmhd.w%256;
|
||||
destx[1] = bmhd.w/256;
|
||||
destx[2] = bmhd.h%256;
|
||||
destx[3] = bmhd.h/256;
|
||||
destx += 4;
|
||||
continue;
|
||||
}
|
||||
if(chunk.ckID == ID_CMAP)
|
||||
{
|
||||
short i;
|
||||
unsigned char r,g;
|
||||
|
||||
fread(colordat,1,chunk.ckSize,pic);
|
||||
// aRead(pic,colordat,chunk.ckSize);
|
||||
for (i=0;i<768;i++)
|
||||
{
|
||||
r = colordat[i]; // r,g do not stand for red and green
|
||||
g = r >> 2;
|
||||
colordat[i] = g;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(chunk.ckID == ID_BODY)
|
||||
{
|
||||
for(height = 0; height<bmhd.h; height ++)
|
||||
{
|
||||
unsigned char *dest;
|
||||
dest = (unsigned char *)&(pplanes[0]); /* point at first char */
|
||||
sofar = bmhd.w; /* number of bytes = 8 */
|
||||
if (sofar&1) sofar++;
|
||||
while (sofar)
|
||||
{
|
||||
if (bmhd.compression)
|
||||
{
|
||||
// aRead(pic,&value,1);
|
||||
value=fgetc(pic); /* get the next byte */
|
||||
// if (value == 128) continue; /* NOP..just get another*/
|
||||
if (value > 0)
|
||||
{
|
||||
short len;
|
||||
len = value +1;
|
||||
sofar -= len;
|
||||
if(!(fread(dest,len,1,pic)))
|
||||
// if(!(aRead(pic,dest,len)))
|
||||
{
|
||||
fclose(pic);
|
||||
ErrorCode = ERR_BADPICFILE;
|
||||
free(savedestx);
|
||||
return(0L);
|
||||
}
|
||||
dest +=len;
|
||||
}
|
||||
else
|
||||
{
|
||||
short count;
|
||||
count = -value; /* get amount to dup */
|
||||
count ++;
|
||||
sofar -= count;
|
||||
value=fgetc(pic);
|
||||
// aRead(pic,&value,1);
|
||||
while (--count >= 0) *dest++ = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fread(dest,sofar,1,pic); /* just throw on plane */
|
||||
// aRead(pic,dest,sofar); /* just throw on plane */
|
||||
sofar = 0;
|
||||
}
|
||||
}
|
||||
if (sofar < 0)
|
||||
{
|
||||
fclose(pic);
|
||||
}
|
||||
_fmemcpy(destx,pplanes,bmhd.w);
|
||||
destx += bmhd.w;
|
||||
}
|
||||
break; /* leave if we've unpacked the BODY*/
|
||||
}
|
||||
|
||||
fseek(pic,chunk.ckSize,SEEK_CUR);
|
||||
}
|
||||
|
||||
fclose(pic);
|
||||
return((char *)savedestx);
|
||||
}
|
||||
|
||||
long ByteFlipLong(long NUMBER)
|
||||
{
|
||||
// Hey, I didn;t write this function!!!
|
||||
long Y, T;
|
||||
short I;
|
||||
|
||||
T = NUMBER;
|
||||
Y=0;for (I=0;I<4;I++){Y = Y | (T & 0xFF);if (I<3) {Y = Y << 8;T = T >> 8;}}
|
||||
return(Y);
|
||||
}
|
||||
|
||||
short iffswab(unsigned short number)
|
||||
{
|
||||
unsigned short xx1,xx2;
|
||||
unsigned short result;
|
||||
|
||||
xx1 = number <<8; xx2 = number >>8; result = xx1|xx2;
|
||||
return(result);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
bpic m1files.dat medit.dtf
|
Loading…
Reference in a new issue