From c9a666d476618c01eb3193a4383f870e558e9720 Mon Sep 17 00:00:00 2001 From: Jakub Vesely <1251980+tinix0@users.noreply.github.com> Date: Fri, 28 Aug 2026 15:35:34 +0200 Subject: [PATCH] Delete unreachable assembly and its stale declarations No documentation update: the deleted code was unreachable, so no documented behavior is affected. --- code/auduncmp.asm | 361 ------------------------------------------ code/cliprect.asm | 272 ------------------------------- code/dsaudio.cpp | 14 +- code/isoasm.asm | 302 ----------------------------------- code/isotype.cpp | 16 +- code/misc.h | 5 - code/smartdeform.cpp | 10 +- code/smartdeform_.asm | 180 --------------------- code/soundint.h | 5 - code/vqalib/cmp.h | 1 - code/vqalib/unvq.h | 16 -- 11 files changed, 12 insertions(+), 1170 deletions(-) delete mode 100644 code/auduncmp.asm delete mode 100644 code/cliprect.asm delete mode 100644 code/isoasm.asm delete mode 100644 code/smartdeform_.asm diff --git a/code/auduncmp.asm b/code/auduncmp.asm deleted file mode 100644 index d12d6bcc..00000000 --- a/code/auduncmp.asm +++ /dev/null @@ -1,361 +0,0 @@ -;****************************************************************************** -;* O P E N T S -;****************************************************************************** -;* SPDX-License-Identifier: GPL-3.0-or-later -;* Copyright 2025 Electronic Arts Inc. -;* Copyright 2026 OpenTS contributors -;* -;* Contains material derived from Electronic Arts source code. -;* Modified by OpenTS contributors, 2026. -;* EA's GPLv3 Section 7 additional terms and supplemental warranty -;* disclaimers apply; see LICENSE.md. -;****************************************************************************** - -;*************************************************************************** -;** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ** -;*************************************************************************** -;* * -;* Project Name : Westwood 32 bit Audio Library * -;* * -;* File Name : AUDUNCMP.ASM * -;* * -;* Programmer : Phil W. Gorrow * -;* * -;* Start Date : March 14, 1995 * -;* * -;* Last Update : June 26, 1995 [PWG] * -;* * -;*-------------------------------------------------------------------------* -;* Functions: * -;* Decompress_Frame_Lock -- locks the JLB audio decompression code * -;* Decompress_Frame_Unlock -- Unlocks the JLB audio compression code * -;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * - - ;IDEAL - .386P;P386 - .MODEL FLAT, C ;MODEL USE32 FLAT - ;LOCALS ?? - .CODE;CODESEG - -DPMI_INTR equ 31h - -CODE_2BIT EQU 0 -CODE_4BIT EQU 1 -CODE_RAW EQU 2 -CODE_SILENCE EQU 3 -MAGICNUMBER EQU 00000DEAFh -MAGICNUMBER2 EQU 0BABEBABEh - -;*************************************************************************** -;* DECOMPRESS_FRAME -- Uncompresses a WW compressed audio frame * -;* * -;* INPUT: void * source - pointer to encoded audio data * -;* void * dest - pointer to decompression area * -;* long size - the maximum size of destination buffer * -;* * -;* OUTPUT: long - the number of bytes we uncompressed * -;* * -;* PROTO: long Decompress_Frame(void *, void *, long); * -;* * -;* HISTORY: * -;* 03/14/1995 PWG : Created. * -;*=========================================================================* - - PUBLIC Decompress_Frame - Decompress_Frame PROC NEAR USES ebx ecx edx esi edi \ - \ - source:DWORD, \ - dest:DWORD, \ - count:DWORD - - LOCAL previous:BYTE - LOCAL incount:DWORD - - pushfd - cld - mov [incount],0 ;Bytes read from source - - -; Source, Dest and count must be valid. - - cmp [source],0 - je ??fini - - cmp [dest],0 - je ??fini - - cmp [count],0 - je ??fini - - mov esi,[source] ;Pointer to source data. - mov edi,[dest] ;Pointer to destination data. - mov ecx,[count] ;Number of bytes to fill dest buffer. - mov dl,080h ;Previous sample (starting value). - -??mainloop: - cmp ecx,0 ;If dest full then exit - jle ??fini - - xor eax,eax - mov al,[esi] ;Get code byte - inc [incount] - inc esi - shl eax,2 ;AH contains code. - shr al,2 ;AL contains sub-code data. - - cmp ah,CODE_RAW ;Raw sequence? - jne short ??try4bit - -; The code contains either a 5 bit delta or a count of -; raw samples to dump out. - - test al,00100000b - je short ??justraw - -; The lower 5 bits are actually a signed delta. -; Sign extend the delta and add it to the stream. - - shl al,3 - sar al,3 - add dl,al - mov [edi],dl - dec ecx - inc edi - jmp ??mainloop - -; The lower 5 bits hold a count of the number of raw -; samples that follow this code. Dump these samples to -; the output buffer. - -??justraw: - mov ebx,ecx - xor ah,ah - inc al - mov ecx,eax - shr ecx,1 - rep movsw - adc ecx,ecx - rep movsb - mov ecx,ebx - add [incount],eax - sub ecx,eax - dec edi - mov dl,[edi] ;Set "previous" value. - inc edi - jmp ??mainloop - -; Check to see if this is a 4 bit delta code sequence. - -??try4bit: - inc al ;Following codes use AL+1 - cmp ah,CODE_4BIT - jne short ??try2bit - -; A sequence of 4bit deltas follow. AL equals the -; number of nibble packed delta bytes to process. - -??bit4loop: - mov ah,[esi] ;Fetch nibble packed delta codes - mov bl,ah - inc [incount] - inc esi - -; Add first delta to 'previous' sample already in DL. - - and ebx,00001111b - add dl,[_4bitdecode+ebx] - pushfd - cmp [_4bitdecode+ebx],0 - jl short ??neg1 - - popfd - jnc short ??ok1 - mov dl,0FFh - jmp short ??ok1 - -??neg1: - popfd - jc short ??ok1 - - xor dl,dl - -??ok1: - mov dh,dl ;DH now holds new 'previous' sample. - mov bl,ah - shr bl,4 - add dh,[_4bitdecode+ebx] - pushfd - cmp [_4bitdecode+ebx],0 - jl short ??neg2 - - popfd - jnc short ??ok2 - - mov dh,0FFh - jmp short ??ok2 - -??neg2: - popfd - jc short ??ok2 - - xor dh,dh - -??ok2: - mov [edi],dx ;Output the two sample bytes - sub ecx,2 - add edi,2 - -; Put the correct 'previous' sample in DL where it belongs. - - mov dl,dh - -; If there are more deltas to process then loop back. - - dec al - jnz short ??bit4loop - jmp ??mainloop - -; Check to see if 2 bit deltas need to be processed. - -??try2bit: - cmp ah,CODE_2BIT - jne ??zerodelta - -; A sequence of 2bit deltas follow. AL equals the number of -; packed delta bytes to process. - -??bit2loop: - mov ah,[esi] ;Fetch packed delat codes - inc [incount] - inc esi - -; Add first delta to 'previous' sample already in DL. - - mov bl,ah - and ebx,000011b - add dl,[_2bitdecode+ebx] - pushfd - cmp [_2bitdecode+ebx],0 - jl short ??neg3 - - popfd - jnc short ??ok3 - - mov dl,0FFh - jmp short ??ok3 - -??neg3: - popfd - jc short ??ok3 - xor dl,dl - -??ok3: - mov dh,dl - ror edx,8 - mov bl,ah - shr ebx,2 - and bl,00000011b - add dl,[_2bitdecode+ebx] - pushfd - cmp [_2bitdecode+ebx],0 - jl short ??neg4 - - popfd - jnc short ??ok4 - - mov dl,0FFh - jmp short ??ok4 - -??neg4: - popfd - jc short ??ok4 - - xor dl,dl - -??ok4: - mov dh,dl - ror edx,8 - mov bl,ah - shr ebx,4 - and bl,00000011b - add dl,[_2bitdecode+ebx] - pushfd - cmp [_2bitdecode+ebx],0 - jl short ??neg5 - - popfd - jnc short ??ok5 - - mov dl,0FFh - jmp short ??ok5 - -??neg5: - popfd - jc short ??ok5 - - xor dl,dl - -??ok5: - mov dh,dl - ror edx,8 - mov bl,ah - shr ebx,6 - and bl,00000011b - add dl,[_2bitdecode+ebx] - pushfd - cmp [_2bitdecode+ebx],0 - jl short ??neg6 - - popfd - jnc short ??ok6 - - mov dl,0FFh - jmp short ??ok6 - -??neg6: - popfd - jc short ??ok6 - - xor dl,dl - -??ok6: - ror edx,8 - mov [edi],edx ;Output two sample bytes - sub ecx,4 - add edi,4 - -; Put the correct 'previous' sample in DL where it belongs. - - rol edx,8 - -; If there are more deltas to process then loop back. - - dec al - jnz ??bit2loop - jmp ??mainloop - -; There is a run of zero deltas. Zero deltas merely duplicate -; the 'previous' sample the requested number of times. - -??zerodelta: - xor ebx,ebx - mov bl,al - mov al,dl - sub ecx,ebx - xchg ecx,ebx - rep stosb - mov ecx,ebx - jmp ??mainloop - -??fini: - popfd - mov eax,[incount] - ret - - Decompress_Frame ENDP - -_2bitdecode DB -2,-1,0,1 -_4bitdecode DB -9,-8,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,8 - - - END \ No newline at end of file diff --git a/code/cliprect.asm b/code/cliprect.asm deleted file mode 100644 index b158048d..00000000 --- a/code/cliprect.asm +++ /dev/null @@ -1,272 +0,0 @@ -;****************************************************************************** -;* O P E N T S -;****************************************************************************** -;* SPDX-License-Identifier: GPL-3.0-or-later -;* Copyright 2025 Electronic Arts Inc. -;* Copyright 2026 OpenTS contributors -;* -;* Contains material derived from Electronic Arts source code. -;* Modified by OpenTS contributors, 2026. -;* EA's GPLv3 Section 7 additional terms and supplemental warranty -;* disclaimers apply; see LICENSE.md. -;****************************************************************************** - -;*************************************************************************** -;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S ** -;*************************************************************************** -;* * -;* Project Name : Support Library * -;* * -;* File Name : cliprect.asm * -;* * -;* Programmer : Julio R Jerez * -;* * -;* Start Date : Mar, 2 1995 * -;* * -;* * -;*-------------------------------------------------------------------------* -;* Functions: * -;* int Clip_Rect ( int * x , int * y , int * dw , int * dh , * -;* int width , int height ) ; * -;* int Confine_Rect ( int * x , int * y , int * dw , int * dh , * -;* int width , int height ) ; * -;* * -;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * - - -;IDEAL -;P386 -;MODEL USE32 FLAT -.386 -.model flat, C - -;GLOBAL C Clip_Rect :NEAR -;GLOBAL C Confine_Rect :NEAR -PUBLIC Clip_Rect -PUBLIC Confine_Rect - -;CODESEG -.CODE - -;*************************************************************************** -;* Clip_Rect -- clip a given rectangle against a given window * -;* * -;* INPUT: &x , &y , &w , &h -> Pointer to rectangle being clipped * -;* width , height -> dimension of clipping window * -;* * -;* OUTPUT: a) Zero if the rectangle is totally contained by the * -;* clipping window. * -;* b) A negative value if the rectangle is totally outside the * -;* the clipping window * -;* c) A positive value if the rectangle was clipped against the * -;* clipping window, also the values pointed by x, y, w, h will * -;* be modified to new clipped values * -;* * -;* 05/03/1995 JRJ : added comment * -;*=========================================================================* -; int Clip_Rect (int* x, int* y, int* dw, int* dh, int width, int height); * - -Clip_Rect PROC near \ - uses ebx ecx edx esi edi \ - , x:dword \ - , y:dword \ - , w:dword \ - , h:dword \ - , _width:dword \ - , height:dword - - - ;This Clipping algorithm is a derivation of the very well known - ;Cohen-Sutherland Line-Clipping test. Due to its simplicity and efficiency - ;it is probably the most commontly implemented algorithm both in software - ;and hardware for clipping lines, rectangles, and convex polygons against - ;a rectagular clipping window. For reference see - ;"COMPUTER GRAPHICS principles and practice by Foley, Vandam, Feiner, Hughes - ; pages 113 to 177". - ; Briefly consist in computing the Sutherland code for both end point of - ; the rectangle to find out if the rectangle is: - ; - trivially accepted (no further clipping test, return the oroginal data) - ; - trivially rejected (return with no action, return error code) - ; - retangle must be iteratively clipped again edges of the clipping window - ; and return the clipped rectangle - - ; get all four pointer into regisnters - mov esi,[x] ; esi = pointer to x - mov edi,[y] ; edi = pointer to x - mov eax,[w] ; eax = pointer to dw - mov ebx,[h] ; ebx = pointer to dh - - ; load the actual data into reg - mov esi,[esi] ; esi = x0 - mov edi,[edi] ; edi = y0 - mov eax,[eax] ; eax = dw - mov ebx,[ebx] ; ebx = dh - - ; create a wire frame of the type [x0,y0] , [x1,y1] - add eax,esi ; eax = x1 = x0 + dw - add ebx,edi ; ebx = y1 = y0 + dh - - ; we start we suthenland code0 and code1 set to zero - xor ecx,ecx ; cl = sutherland boolean code0 - xor edx,edx ; dl = sutherland boolean code0 - - ; now we start computing the to suthenland boolean code for x0 , x1 - shld ecx,esi,1 ; bit3 of code0 = sign bit of (x0 - 0) - shld edx,eax,1 ; bit3 of code1 = sign bit of (x1 - 0) - sub esi,[_width] ; get the difference (x0 - (width + 1)) - sub eax,[_width] ; get the difference (x1 - (width + 1)) - dec esi - dec eax - shld ecx,esi,1 ; bit2 of code0 = sign bit of (x0 - (width + 1)) - shld edx,eax,1 ; bit2 of code1 = sign bit of (x0 - (width + 1)) - - ; now we start computing the to suthenland boolean code for y0 , y1 - shld ecx,edi,1 ; bit1 of code0 = sign bit of (y0 - 0) - shld edx,ebx,1 ; bit1 of code1 = sign bit of (y0 - 0) - sub edi,[height] ; get the difference (y0 - (height + 1)) - sub ebx,[height] ; get the difference (y1 - (height + 1)) - dec edi - dec ebx - shld ecx,edi,1 ; bit0 of code0 = sign bit of (y0 - (height + 1)) - shld edx,ebx,1 ; bit0 of code1 = sign bit of (y1 - (height + 1)) - - ; Bit 2 and 0 of cl and bl are complemented - xor cl,5 ; reverse bit2 and bit0 in code0 - xor dl,5 ; reverse bit2 and bit0 in code1 - - ; now perform the rejection test - mov eax,-1 ; set return code to false - mov bl,cl ; save code0 for future use - test dl,cl ; if any two pair of bit in code0 and code1 is set - jnz clip_out ; then rectangle is outside the window - - ; now perform the aceptance test - xor eax,eax ; set return code to true - or bl,dl ; if all pair of bits in code0 and code1 are reset - jz clip_out ; then rectangle is insize the window. ' - - ; we need to clip the rectangle iteratively - mov eax,-1 ; set return code to false - test cl,1000b ; if bit3 of code0 is set then the rectangle - jz left_ok ; spill out the left edge of the window - mov edi,[x] ; edi = a pointer to x0 - mov ebx,[w] ; ebx = a pointer to dw - mov esi,[edi] ; esi = x0 - mov dword ptr [edi],0 ; set x0 to 0 "this the left edge value" - add [ebx],esi ; adjust dw by x0, since x0 must be negative - -left_ok: - test cl,0010b ; if bit1 of code0 is set then the rectangle - jz bottom_ok ; spill out the bottom edge of the window - mov edi,[y] ; edi = a pointer to y0 - mov ebx,[h] ; ebx = a pointer to dh - mov esi,[edi] ; esi = y0 - mov dword ptr [edi],0 ; set y0 to 0 "this the bottom edge value" - add [ebx],esi ; adjust dh by y0, since y0 must be negative - -bottom_ok: - test dl,0100b ; if bit2 of code1 is set then the rectangle - jz right_ok ; spill out the right edge of the window - mov edi,[w] ; edi = a pointer to dw - mov esi,[x] ; esi = a pointer to x - mov ebx,[_width] ; ebx = the width of the window - sub ebx,[esi] ; the new dw is the difference (width-x0) - mov [edi],ebx ; adjust dw to (width - x0) - jle clip_out ; if (width-x0) = 0 then the clipped retangle - ; has no width we are done -right_ok: - test dl,0001b ; if bit0 of code1 is set then the rectangle - jz clip_ok ; spill out the top edge of the window - mov edi,[h] ; edi = a pointer to dh - mov esi,[y] ; esi = a pointer to y0 - mov ebx,[height] ; ebx = the height of the window - sub ebx,[esi] ; the new dh is the difference (height-y0) - mov [edi],ebx ; adjust dh to (height-y0) - jle clip_out ; if (width-x0) = 0 then the clipped retangle - ; has no width we are done -clip_ok: - mov eax,1 ; signal the calling program that the rectangle was modify -clip_out: - ret - -Clip_Rect ENDP - - -;*************************************************************************** -;* Confine_Rect -- clip a given rectangle against a given window * -;* * -;* INPUT: &x,&y,w,h -> Pointer to rectangle being clipped * -;* width,height -> dimension of clipping window * -;* * -;* OUTPUT: a) Zero if the rectangle is totally contained by the * -;* clipping window. * -;* c) A positive value if the rectangle was shifted in position * -;* to fix inside the clipping window, also the values pointed * -;* by x, y, will adjusted to a new values * -;* * -;* NOTE: this function make not attempt to verify if the rectangle is * -;* bigger than the clipping window and at the same time wrap around* -;* it. If that is the case the result is meaningless * -;*=========================================================================* -; int Confine_Rect (int* x, int* y, int dw, int dh, int width, int height); * - -Confine_Rect PROC near \ - uses ebx esi edi \ - , x:dword \ - , y:dword \ - , w:dword \ - , h:dword \ - , _width:dword \ - , height:dword - - xor eax,eax - mov ebx,[x] - mov edi,[w] - - mov esi,[ebx] - add edi,[ebx] - - sub edi,[_width] - neg esi - dec edi - - test esi,edi - jl x_axix_ok - mov eax,1 - - test esi,esi - jl shift_right - mov dword ptr [ebx],0 - jmp x_axix_ok -shift_right: - inc edi - sub [ebx],edi -x_axix_ok: - mov ebx,[y] - mov edi,[h] - - mov esi,[ebx] - add edi,[ebx] - - sub edi,[height] - neg esi - dec edi - - test esi,edi - jl confi_out - mov eax,1 - - test esi,esi - jl shift_top - mov dword ptr [ebx],0 - - ret -shift_top: - inc edi - sub [ebx],edi -confi_out: - ret - -Confine_Rect ENDP - -END diff --git a/code/dsaudio.cpp b/code/dsaudio.cpp index 97a3b935..b5aab4aa 100644 --- a/code/dsaudio.cpp +++ b/code/dsaudio.cpp @@ -2662,16 +2662,12 @@ int DSAudio::Sample_Copy(SampleTrackerType *st, void ** source, int * ssize, voi if (s < fsize) { return(datasize); } - if (0/*scomp == SCOMP_WESTWOOD*/) { - //Decompress_Frame(UncompBuffer, dest, dsize); + st->sosinfo.lpSource = (char *)UncompBuffer; + st->sosinfo.lpDest = (char *)dest; + if (st->sosinfo.wBitSize==16 && st->sosinfo.wChannels==1){ + sosCODECDecompressData(&st->sosinfo, dsize); } else { - st->sosinfo.lpSource = (char *)UncompBuffer; - st->sosinfo.lpDest = (char *)dest; - if (st->sosinfo.wBitSize==16 && st->sosinfo.wChannels==1){ - sosCODECDecompressData(&st->sosinfo, dsize); - } else { - General_sosCODECDecompressData(&st->sosinfo, dsize); - } + General_sosCODECDecompressData(&st->sosinfo, dsize); } dest = Audio_Add_Long_To_Pointer(dest, dsize); } diff --git a/code/isoasm.asm b/code/isoasm.asm deleted file mode 100644 index 090af969..00000000 --- a/code/isoasm.asm +++ /dev/null @@ -1,302 +0,0 @@ -;****************************************************************************** -;* O P E N T S -;****************************************************************************** -;* SPDX-License-Identifier: GPL-3.0-or-later -;* Copyright 2026 OpenTS contributors -;* -;* See LICENSE.md for applicable additional terms and warranty disclaimers. -;****************************************************************************** - - .386 - .model flat, c - - - .code - -;----------------------------------------------------------------------------- -; Hand-written x86 inner-loop rasterizers for isometric terrain tile blitting. -; Both functions take a pointer to IsoBlitState (declared in isotype.cpp) and -; walk a rectangular source span, writing a destination surface pixel and a -; z-buffer word per non-transparent/non-rejected source byte. Translation -; pipeline: src byte -> optional shape remap (Func1) -> depth shading LUT -; -> palette-to-16bpp LUT -> dest. -; -; Struct field offsets used (see isotype.cpp IsoBlitState for full map): -; +0x00 InnerCount (byte) - inner span pixel count -; +0x04 OuterCount (byte) - outer row count -; +0x08 ShapeBase - Func1 shape LUT base -; +0x0C ShapeIndexBias - Func1 shape index offset -; +0x10 ZDepthBias - added to z-source byte -; +0x14 ZBufferRowStride - added 2x per row to +0x40 -; +0x18 RemapSourceRowStride - added 2x per row to +0x44 -; +0x1C SurfaceRowStride - added per row to +0x48 -; +0x20 SourceByteStride - Func2 per-row stride for +0x50 and esi -; +0x40 ZBufferCursor (u16*) - walked z-buffer write pointer -; +0x44 RemapIndexCursor (u16*)- walked remap-index source pointer -; +0x48 SurfaceCursor (u16*) - walked dest surface write pointer -; +0x4C SourceByteCursor - walked palette-index source bytes -; +0x50 ZSourceByteCursor - walked z-source bytes -; +0x54 TileShapeRowPtr - Func1 tile-shape row base (advances 0x30) -; +0x58 PaletteToHicolor - palette->16bpp word LUT base -; +0x5C ExtraStrideTable1 - Func1 extra-block stride table (flag 1) -; +0x60 ExtraStrideTable2 - Func1 extra-block stride table (flag 2) -; +0x6C (scratch: saved row ptr - Func1) -; +0x74 (scratch: combined flag - Func1) -; +0x88 ExtraBlockFlag2 - Func1 trigger for path 2 -; +0x8C ExtraBlockFlag1 - Func1 trigger for path 1 -; +0x90 DepthShadingLUT - word LUT (also referenced as [ebp+144] in Func2) -; -; NOTE: The C++ IsoBlitState ends at 0x6A but the ASM accesses up to 0x90. -; The declared struct is undersized; fields 0x74/0x88/0x8C/0x90 are missing. -;----------------------------------------------------------------------------- - - -;----------------------------------------------------------------------------- -; IsoBlitState (ASM-side mirror) -; Documentation only -- the functions below still use raw [ebp+0xNN] offsets, -; not these field names. Packed (1-byte aligned) to match the C++ declaration. -; Extends beyond the C++ struct (which ends at 0x6A) to cover the missing -; fields at 0x74/0x88/0x8C/0x90 that the assembly actually accesses. -;----------------------------------------------------------------------------- -IsoBlitState STRUCT 1 - InnerCount DD ? ; +0x00 inner span pixel count (byte used) - OuterCount DD ? ; +0x04 outer row count (byte used) - ShapeBase DD ? ; +0x08 Func1 shape LUT base - ShapeIndexBias DD ? ; +0x0C Func1 shape index offset - ZDepthBias DD ? ; +0x10 added to z-source byte - ZBufferRowStride DD ? ; +0x14 applied 2x per row to ZBufferCursor - RemapSourceRowStride DD ? ; +0x18 applied 2x per row to RemapIndexCursor - SurfaceRowStride DD ? ; +0x1C applied per row to SurfaceCursor - SourceByteStride DD ? ; +0x20 Func2 per-row stride (esi + ZSourceByteCursor) - _unused_24 DD ? ; +0x24 - _unused_28 DD ? ; +0x28 - _unused_2C DD ? ; +0x2C - _unused_30 DD ? ; +0x30 - _unused_34 DD ? ; +0x34 - _unused_38 DD ? ; +0x38 - _unused_3C DD ? ; +0x3C - ZBufferCursor DD ? ; +0x40 walked z-buffer write ptr (u16*) - RemapIndexCursor DD ? ; +0x44 walked remap-index source ptr (u16*) - SurfaceCursor DD ? ; +0x48 walked dest surface write ptr (u16*) - SourceByteCursor DD ? ; +0x4C walked palette-index source bytes - ZSourceByteCursor DD ? ; +0x50 walked z-source bytes - TileShapeRowPtr DD ? ; +0x54 Func1 tile-shape row base (advances 0x30 per row) - PaletteToHicolor DD ? ; +0x58 palette->16bpp word LUT base - ExtraStrideTable1 DD ? ; +0x5C Func1 extra-block stride table (flag path 1) - ExtraStrideTable2 DD ? ; +0x60 Func1 extra-block stride table (flag path 2) - _unused_64 DD ? ; +0x64 - HalfbrightMask DW ? ; +0x68 (2 bytes) - _pad_6A DW ? ; +0x6A (2 bytes pad to 0x6C) - _scratch_6C DD ? ; +0x6C Func1 saved row ptr scratch - _unused_70 DD ? ; +0x70 - _scratch_74 DD ? ; +0x74 Func1 combined flag scratch (flag1 OR flag2) - _unused_78 DD ? ; +0x78 - _unused_7C DD ? ; +0x7C - _unused_80 DD ? ; +0x80 - _unused_84 DD ? ; +0x84 - ExtraBlockFlag2 DD ? ; +0x88 Func1 trigger for extra path 2 - ExtraBlockFlag1 DD ? ; +0x8C Func1 trigger for extra path 1 - DepthShadingLUT DD ? ; +0x90 word LUT (Func1 [ebp+90h], Func2 [ebp+144]) -IsoBlitState ENDS - - -; Shape-aware iso tile rasterizer (48x23 diamond blit). Per pixel: -; 1. Read span-run byte from [[ebp+54h]]; zero = transparent (skip). -; 2. Read z-byte from [[ebp+50h]], add z-bias, compare vs current z at [[ebp+40h]]. -; 3. If passing depth test, write new z and remap source index through two LUTs -; (shape remap [ebp+90h], then palette->16bpp [ebp+58h]). -; 4. Advance all walked cursors by 2 bytes (pixels) / 1 byte (source). -; At end of row, applies strides and bumps shape-row pointer by 0x30 (48 - tile -; row size). Flags at [ebp+88h]/[ebp+8Ch] trigger extra-block stepping via -; tables at [ebp+5Ch]/[ebp+60h] - shape-diamond pixel layout stepping. -; STATUS: Zero xrefs in binary - dead code / replaced by C++ implementation. -Iso_Blit_Asm1 PROC C uses ebx esi edi ecx ebp \ - arg:DWORD - - mov ebp, [arg] - - mov eax, [ebp+8Ch] - or eax, [ebp+88h] - mov [ebp+74h], eax - xor ch, ch - mov eax, [ebp+54h] - mov [ebp+6Ch], eax - -??loc_6B24F2: - xor cl, cl - mov esi, [ebp+54h] - -??loc_6B24F7: - mov al, [esi] - inc esi - test al, al - jz short ??loc_6B253D - - xor ebx, ebx - mov edi, [ebp+50h] - mov edx, [ebp+40h] - mov bl, [edi] - add ebx, [ebp+10h] - xor eax, eax - cmp bx, [edx] - jnb short ??loc_6B2537 - - mov [edx], bx - mov ebx, [ebp+44h] - mov edx, [ebp+4Ch] - movzx eax, word ptr [ebx] - mov ebx, [ebp+90h] - mov ax, [ebx+eax*2] - mov al, [edx] - mov edx, [ebp+58h] - mov edi, [ebp+48h] - mov ax, [edx+eax*2] - mov [edi], ax - -??loc_6B2537: - inc dword ptr [ebp+50h] - inc dword ptr [ebp+4Ch] - -??loc_6B253D: - inc cl - add dword ptr [ebp+48h], 2 - add dword ptr [ebp+40h], 2 - add dword ptr [ebp+44h], 2 - cmp cl, [ebp+0] - jl short ??loc_6B24F7 - - mov eax, [ebp+1Ch] - add [ebp+48h], eax - mov eax, [ebp+14h] - add [ebp+40h], eax - add [ebp+40h], eax - mov eax, [ebp+18h] - add [ebp+44h], eax - add [ebp+44h], eax - mov eax, [ebp+6Ch] - add eax, 48 - mov [ebp+54h], eax - mov [ebp+6Ch], eax - cmp dword ptr [ebp+74h], 0 - jnz short ??loc_6B258C - - inc ch - cmp ch, [ebp+4] - jl ??loc_6B24F2 - - ret - -??loc_6B258C: - movzx eax, ch - add eax, [ebp+0Ch] - shl eax, 4 - lea ebx, [eax+eax*2] - add ebx, [ebp+8] - mov edx, ebx - cmp dword ptr [ebp+8Ch], 0 - jz short ??loc_6B25B5 - - mov esi, [ebp+60h] - add ebx, [ebp+0] - mov eax, [esi+ebx*4] - add [ebp+4Ch], eax - add [ebp+50h], eax - -??loc_6B25B5: - cmp dword ptr [ebp+88h], 0 - jz short ??loc_6B25CD - - mov esi, [ebp+5Ch] - add edx, 48 - mov eax, [esi+edx*4] - add [ebp+4Ch], eax - add [ebp+50h], eax - -??loc_6B25CD: - inc ch - cmp ch, [ebp+4] - jl ??loc_6B24F2 - - ret - - Iso_Blit_Asm1 endp - - -; Simpler rectangular iso tile rasterizer. No shape-aware stepping, no shape LUT, -; no flag-triggered block skips. Per pixel: -; 1. Read byte from walked esi source; zero = transparent (skip). -; 2. Depth test against [[ebp+40h]] using byte from [[ebp+50h]] + bias. -; 3. If passing, remap through depth-shading LUT at [ebp+144h] (= +0x90), then -; palette->16bpp LUT at [ebp+58h]. Write result to [[ebp+48h]]. -; Per row advances walked cursors by strides at [ebp+14h/18h/1Ch/20h]. -; STATUS: Live code. Called from IsometricTileTypeClass::Draw_Tile. -Iso_Blit_Asm2 PROC C uses ebp \ - arg:DWORD - - mov ebp,[arg] - - xor ch, ch - mov esi, [ebp+4Ch] - - -??loc_6B25EB: - xor cl, cl - - -??loc_6B25ED: - movzx eax, byte ptr [esi] - inc esi - test al, al - jz short ??loc_6B262E - - xor ebx, ebx - mov edi, [ebp+50h] - mov edx, [ebp+40h] - mov bl, [edi] - add ebx, [ebp+10h] - and eax, 0FFh - cmp bx, [edx] - jnb short ??loc_6B262E - - mov [edx], bx - mov ebx, [ebp+44h] - mov edi, [ebp+48h] - movzx edx, word ptr [ebx] - mov ebx, [ebp+144] - mov dx, [ebx+edx*2] - mov dl, al - mov eax, [ebp+58h] - mov ax, [eax+edx*2] - mov [edi], ax - - -??loc_6B262E: - inc cl - inc dword ptr [ebp+50h] - add dword ptr [ebp+48h], 2 - add dword ptr [ebp+40h], 2 - add dword ptr [ebp+44h], 2 - cmp cl, [ebp+0] - jl short ??loc_6B25ED - - mov eax, [ebp+1Ch] - add [ebp+48h], eax - mov eax, [ebp+14h] - add [ebp+40h], eax - add [ebp+40h], eax - mov eax, [ebp+18h] - add [ebp+44h], eax - add [ebp+44h], eax - mov eax, [ebp+20h] - add esi, [ebp+20h] - add [ebp+50h], eax - inc ch - cmp ch, [ebp+4] - jl ??loc_6B25EB - - ret - - Iso_Blit_Asm2 endp - - - end \ No newline at end of file diff --git a/code/isotype.cpp b/code/isotype.cpp index 37b75541..7c34f4e8 100644 --- a/code/isotype.cpp +++ b/code/isotype.cpp @@ -1571,11 +1571,8 @@ Cell const * IsometricTileTypeClass::Shadow_Caster_List(void) const return(NULL); } -/// Scratch state for the iso-tile rasterizer. Shared with the hand-written asm blitters -/// (Iso_Blit_Asm1/Iso_Blit_Asm2 in isoasm.asm), but the asm path is gated behind -/// IsoTileUseAsmDrawFunc which is never enabled, so the live renderer is the C++ loop in -/// IsometricTileTypeClass::Draw_Tile. The field names below describe how that C++ loop uses -/// them; the asm reads the same offsets differently, but that path never runs. +/// Scratch state for the iso-tile rasterizer, the C++ loop in +/// IsometricTileTypeClass::Draw_Tile. The field names below describe how that loop uses them. /// /// The rasterizer walks the iso diamond one scanline at a time using three precomputed span /// tables (RowSrcOffset/RowStartCol/RowRunLength), reading a palette index per pixel, looking @@ -1640,11 +1637,6 @@ unsigned char _iso_start_cols[ISO_DRAW_WIDTH*ISO_DRAW_HEIGHT]; */ unsigned char _iso_run_lengths[ISO_DRAW_WIDTH][ISO_DRAW_WIDTH*ISO_DRAW_HEIGHT]; char IsoSpanTablesBuilt; -char IsoTileUseAsmDrawFunc; - -extern "C" { -void __cdecl Iso_Blit_Asm2(IsoBlitState *state); -} /// @@ -2124,7 +2116,7 @@ void IsometricTileTypeClass::Draw_Tile(LightConvertClass * drawer, int subtile, IsoDrawData.RowRunLength += ISO_DRAW_WIDTH; } } - } else if (!IsoTileUseAsmDrawFunc || depth_only || fill || fog) { + } else { if (fill) { unsigned char * destrow = (unsigned char *)IsoDrawData.DestPtr; for (int row = 0; row < IsoDrawData.SpanHeight; ++row) { @@ -2419,8 +2411,6 @@ void IsometricTileTypeClass::Draw_Tile(LightConvertClass * drawer, int subtile, IsoDrawData.AlphaPtr = &IsoDrawData.AlphaPtr[IsoDrawData.AlphaWidth]; IsoDrawData.AlphaPtr = (unsigned short *)AlphaBuffer->Wrap_Overflow((unsigned int)IsoDrawData.AlphaPtr); } - } else if (IsoTileUseAsmDrawFunc) { - Iso_Blit_Asm2((IsoBlitState *)&IsoDrawData); } else { /* diff --git a/code/misc.h b/code/misc.h index b98b62be..96cad481 100644 --- a/code/misc.h +++ b/code/misc.h @@ -94,11 +94,6 @@ void __cdecl Shake_Screen(int shakes); extern WORD __cdecl Processor(void); extern WORD __cdecl Operating_System(void); -extern int __cdecl Clip_Rect ( int * x , int * y , int * dw , int * dh , - int width , int height ) ; -extern int __cdecl Confine_Rect ( int * x , int * y , int dw , int dh , - int width , int height ) ; - /*=========================================================================*/ diff --git a/code/smartdeform.cpp b/code/smartdeform.cpp index fb42c7d5..8652a167 100644 --- a/code/smartdeform.cpp +++ b/code/smartdeform.cpp @@ -119,13 +119,11 @@ extern "C" { DeformPointStruct * DeformPoints = NULL; -extern int DeformPointXAdd; -extern int DeformPointYAdd; +int DeformPointXAdd = 0; +int DeformPointYAdd = 0; -extern int DeformPointWidth; -extern int DeformPointHeight; - -extern bool Asm_Ripple_Deform_Points(int startpointx, int startpointy, int general_direction, bool forced); +int DeformPointWidth = 0; +int DeformPointHeight = 0; } diff --git a/code/smartdeform_.asm b/code/smartdeform_.asm deleted file mode 100644 index 2c49ae86..00000000 --- a/code/smartdeform_.asm +++ /dev/null @@ -1,180 +0,0 @@ -;****************************************************************************** -;* O P E N T S -;****************************************************************************** -;* SPDX-License-Identifier: GPL-3.0-or-later -;* Copyright 2026 OpenTS contributors -;* -;* See LICENSE.md for applicable additional terms and warranty disclaimers. -;****************************************************************************** - -.386 -.model flat, C - -FALSE equ 0 -TRUE equ 1 - -FLAG_RIGID equ 1 -FLAG_DONE equ 2 - -DeformPointStruct struc - - Height dd 0 - - ;NOTE C++ version of Ripple_Deform_Points passes a struct with bools - ;so this is out of date - Flags dd 0 - -DeformPointStruct ends - -externdef C DeformPoints:dword -externdef C DeformPointHeight:dword -externdef C DeformPointWidth:dword -externdef C DeformPointXAdd:dword -externdef C DeformPointYAdd:dword - -RAMP_HALF_HEIGHT equ 12 - -PUBLIC C Asm_Ripple_Deform_Points - -.CODE - -Asm_Ripple_Deform_Points PROC NEAR USES ESI EDI EBX ECX \ - startpointx:DWORD, startpointy:DWORD, general_direction:DWORD, forced:DWORD - - local startheight:dword - local x:dword - local y:dword - - - assume esi:ptr DeformPointStruct - - mov eax, [startpointy] - mov esi, [DeformPoints] - imul eax, [DeformPointWidth] - add eax, [startpointx] - lea esi, [esi+eax*sizeof(DeformPointStruct)] - mov eax, [esi].Height - mov [startheight], eax - - mov edi, -1 - - setx: - mov ecx, -1 - - check: - - mov eax, edi - or eax, ecx - test eax, eax - je next - - mov eax, [startpointx] - add eax, ecx - mov [x], eax - mov ebx, [startpointy] - add ebx, edi - mov [y], ebx - imul ebx, [DeformPointWidth] - mov esi, [DeformPoints] - add ebx, eax - lea esi, [esi+ebx*sizeof(DeformPointStruct)] - test [esi].Flags, FLAG_RIGID - je adjust1 - - cmp [forced], FALSE - jne next - - mov eax, [esi].Height - sub eax, [startheight] - cdq - xor eax, edx - sub eax, edx - cmp eax, RAMP_HALF_HEIGHT - jbe next - - xor eax, eax - - ret - - adjust1: - - mov eax, [esi].Height - sub eax, [startheight] - cdq - xor eax, edx - sub eax, edx - cmp eax, RAMP_HALF_HEIGHT - jbe next - - cmp [general_direction], TRUE - jne adjust2 - - mov eax, [esi].Height - cmp eax, [startheight] - jnb fixup - - mov eax, [startheight] - sub eax, RAMP_HALF_HEIGHT - mov [esi].Height, eax - or [esi].Flags, FLAG_DONE - jmp fixup - - adjust2: - - mov eax, [esi].Height - cmp eax, [startheight] - jbe fixup - - mov eax, [startheight] - add eax, RAMP_HALF_HEIGHT - mov [esi].Height, eax - or [esi].Flags, FLAG_DONE - - fixup: - push ecx - push edi - - push [forced] - push [general_direction] - push [y] - push [x] - call Asm_Ripple_Deform_Points - lea esp, [esp+010h] - pop edi - pop ecx - - test eax, eax - jne next - - cmp [forced], FALSE - jne next - - xor eax, eax - - ret - - next: - inc ecx - cmp ecx, FLAG_DONE - jl check - - inc edi - cmp edi, FLAG_DONE - jl setx - - mov eax, TRUE - - ret - - Asm_Ripple_Deform_Points ENDP - - -.DATA - - DeformPointHeight dd 0 - DeformPointWidth dd 0 - DeformPointXAdd dd 0 - DeformPointYAdd dd 0 - - -END \ No newline at end of file diff --git a/code/soundint.h b/code/soundint.h index e2ccd0ae..d8f09770 100644 --- a/code/soundint.h +++ b/code/soundint.h @@ -273,10 +273,5 @@ void DPMI_Unlock(VOID const *ptr, int const size); extern "C" { void __cdecl Audio_Mem_Set(void const *ptr, unsigned char value, int size); // void Mem_Copy(void *source, void *dest, unsigned long bytes_to_copy); - int __cdecl Decompress_Frame(void * source, void * dest, int size); - int __cdecl Decompress_Frame_Lock(void); - int __cdecl Decompress_Frame_Unlock(void); - int __cdecl sosCODEC_Lock(void); - int __cdecl sosCODEC_Unlock(void); void __GETDS(void); } diff --git a/code/vqalib/cmp.h b/code/vqalib/cmp.h index b59fdc03..69838687 100644 --- a/code/vqalib/cmp.h +++ b/code/vqalib/cmp.h @@ -43,7 +43,6 @@ long __cdecl AudioUnzap(void *source, void *dest, long); } extern "C" { -void __cdecl sosCODECInitStream_VQASNJ(_VQA_SOS_COMPRESS_INFO *, unsigned short idx, unsigned int pred); void __cdecl VQA_sosCODECInitStream(_VQA_SOS_COMPRESS_INFO *); void __cdecl VQA_sosCODECDecompressData(void *src, void *dst, unsigned short wBitSize, unsigned short wChannels, unsigned long dwUnCompSize, _VQA_SOS_COMPRESS_INFO *sosinfo); } diff --git a/code/vqalib/unvq.h b/code/vqalib/unvq.h index 49acf6f2..d4acfe73 100644 --- a/code/vqalib/unvq.h +++ b/code/vqalib/unvq.h @@ -104,26 +104,10 @@ void __cdecl ASM_UnVQ_4x4_HALF(unsigned char *codebook, unsigned char *pointers, unsigned char *buffer, unsigned long blocksperrow, unsigned long numrows, unsigned long bufwidth); -void __cdecl ASM_UnVQ_6(unsigned char *codebook, unsigned char *pointers, - unsigned char *buffer, unsigned long blocksperrow, - unsigned long numrows, unsigned long bufwidth); - void __cdecl ASM_UnVQ1_C1_4x4(unsigned char *codebook, unsigned char *pointers, unsigned char *buffer, unsigned long blocksperrow, unsigned long numrows, unsigned long bufwidth); -void __cdecl ASM_UnVQ_8(unsigned char *codebook, unsigned char *pointers, - unsigned char *buffer, unsigned long blocksperrow, - unsigned long numrows, unsigned long bufwidth); - -void __cdecl ASM_UnVQ_9(unsigned char *codebook, unsigned char *pointers, - unsigned char *buffer, unsigned long blocksperrow, - unsigned long numrows, unsigned long bufwidth); - -void __cdecl ASM_UnVQ_10(unsigned char *codebook, unsigned char *pointers, - unsigned char *buffer, unsigned long blocksperrow, - unsigned long numrows, unsigned long bufwidth); - #ifdef __cplusplus } #endif