From: sparky4 Date: Thu, 8 Sep 2016 15:20:10 +0000 (-0500) Subject: wwww yakuji wwww ca use to load maps w hmmm cachemap wwww X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=db43d7e01f6d3c2fbf5cfd7b4c163e3a6b16888a wwww yakuji wwww ca use to load maps w hmmm cachemap wwww --- diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index 6511ef17..762a6bb7 100755 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -724,7 +724,7 @@ dinorm: = ====================== */ -/*++++ + #define NEARTAG 0xa7 #define FARTAG 0xa8 @@ -747,13 +747,13 @@ void CAL_CarmackExpand (unsigned far *source, unsigned far *dest, unsigned lengt count = ch&0xff; if (!count) { // have to insert a word containing the tag byte - ch |= *((unsigned char far *)inptr)++; + ch |= *(/*(unsigned char far *)*/inptr)++; *outptr++ = ch; length--; } else { - offset = *((unsigned char far *)inptr)++; + offset = *(/*(unsigned char far *)*/inptr)++; copyptr = outptr - offset; length -= count; while (count--) @@ -765,7 +765,7 @@ void CAL_CarmackExpand (unsigned far *source, unsigned far *dest, unsigned lengt count = ch&0xff; if (!count) { // have to insert a word containing the tag byte - ch |= *((unsigned char far *)inptr)++; + ch |= *(/*(unsigned char far *)*/inptr)++; *outptr++ = ch; length --; } @@ -785,7 +785,6 @@ void CAL_CarmackExpand (unsigned far *source, unsigned far *dest, unsigned lengt } } } -*/ /* @@ -795,7 +794,7 @@ void CAL_CarmackExpand (unsigned far *source, unsigned far *dest, unsigned lengt = ====================== */ -/*++++ + long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest, unsigned rlewtag) { @@ -842,7 +841,7 @@ long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest, complength = 2*(dest-start); return complength; } -*/ + /* ====================== @@ -852,7 +851,7 @@ long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest, = ====================== */ -/*++++ + void CA_RLEWexpand (unsigned huge *source, unsigned huge *dest,long length, unsigned rlewtag) { @@ -903,64 +902,88 @@ void CA_RLEWexpand (unsigned huge *source, unsigned huge *dest,long length, // // NOTE: A repeat count that produces 0xfff0 bytes can blow this! // - -asm mov bx,rlewtag -asm mov si,sourceoff -asm mov di,destoff -asm mov es,destseg -asm mov ds,sourceseg - + __asm{ + mov bx,rlewtag + mov si,sourceoff + mov di,destoff + mov es,destseg + mov ds,sourceseg +#ifdef __BORLANDC__ + } +#endif expand: -asm lodsw -asm cmp ax,bx -asm je repeat -asm stosw -asm jmp next - +#ifdef __BORLANDC__ + __asm { +#endif + lodsw + cmp ax,bx + je repeat + stosw + jmp next +#ifdef __BORLANDC__ + } +#endif repeat: -asm lodsw -asm mov cx,ax // repeat count -asm lodsw // repeat value -asm rep stosw - +#ifdef __BORLANDC__ + __asm { +#endif + lodsw + mov cx,ax // repeat count + lodsw // repeat value + rep stosw +#ifdef __BORLANDC__ + } +#endif next: - -asm cmp si,0x10 // normalize ds:si -asm jb sinorm -asm mov ax,si -asm shr ax,1 -asm shr ax,1 -asm shr ax,1 -asm shr ax,1 -asm mov dx,ds -asm add dx,ax -asm mov ds,dx -asm and si,0xf +#ifdef __BORLANDC__ + __asm { +#endif + cmp si,0x10 // normalize ds:si + jb sinorm + mov ax,si + shr ax,1 + shr ax,1 + shr ax,1 + shr ax,1 + mov dx,ds + add dx,ax + mov ds,dx + and si,0xf +#ifdef __BORLANDC__ + } +#endif sinorm: -asm cmp di,0x10 // normalize es:di -asm jb dinorm -asm mov ax,di -asm shr ax,1 -asm shr ax,1 -asm shr ax,1 -asm shr ax,1 -asm mov dx,es -asm add dx,ax -asm mov es,dx -asm and di,0xf +#ifdef __BORLANDC__ + __asm { +#endif + cmp di,0x10 // normalize es:di + jb dinorm + mov ax,di + shr ax,1 + shr ax,1 + shr ax,1 + shr ax,1 + mov dx,es + add dx,ax + mov es,dx + and di,0xf +#ifdef __BORLANDC__ + } +#endif dinorm: +#ifdef __BORLANDC__ + __asm { +#endif + cmp di,ss:endoff + jne expand + mov ax,es + cmp ax,ss:endseg + jb expand -asm cmp di,ss:endoff -asm jne expand -asm mov ax,es -asm cmp ax,ss:endseg -asm jb expand - -asm mov ax,ss -asm mov ds,ax - + mov ax,ss + mov ds,ax + } } -*/ /* diff --git a/src/lib/16_ca.h b/src/lib/16_ca.h index 54a125ae..5d8675ca 100755 --- a/src/lib/16_ca.h +++ b/src/lib/16_ca.h @@ -90,9 +90,9 @@ boolean CA_ReadFile (char *filename, memptr *ptr, mminfo_t *mm); boolean CA_WriteFile (char *filename, void far *ptr, long length, mminfo_t *mm); boolean CA_LoadFile (char *filename, memptr *ptr, mminfo_t *mm, mminfotype *mmi); -//long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest,unsigned rlewtag); +long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest,unsigned rlewtag); -//void CA_RLEWexpand (unsigned huge *source, unsigned huge *dest,long length,unsigned rlewtag); +void CA_RLEWexpand (unsigned huge *source, unsigned huge *dest,long length,unsigned rlewtag); void CA_Startup (global_game_variables_t *gvar); void CA_Shutdown (global_game_variables_t *gvar);