Initial commit of Command & Conquer Red Alert source code.
This commit is contained in:
460
WWFLAT32/MCGAPRIM/BITBLIT.ASM
Normal file
460
WWFLAT32/MCGAPRIM/BITBLIT.ASM
Normal file
@@ -0,0 +1,460 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : BITBLIT.ASM *
|
||||
;* *
|
||||
;* Programmer : Julio R. Jerez *
|
||||
;* *
|
||||
;* Start Date : Feb 6, 1995 *
|
||||
;* *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
LOCALS ??
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE "gbuffer.inc"
|
||||
|
||||
CODESEG
|
||||
|
||||
PROC Linear_Blit_To_Linear C near
|
||||
USES ebx,ecx,edx,esi,edi
|
||||
|
||||
;*===================================================================
|
||||
;* define the arguements that our function takes.
|
||||
;*===================================================================
|
||||
ARG this :DWORD ; this is a member function
|
||||
ARG dest :DWORD ; what are we blitting to
|
||||
ARG x_pixel :DWORD ; x pixel position in source
|
||||
ARG y_pixel :DWORD ; y pixel position in source
|
||||
ARG dest_x0 :dword
|
||||
ARG dest_y0 :dword
|
||||
ARG pixel_width :DWORD ; width of rectangle to blit
|
||||
ARG pixel_height:DWORD ; height of rectangle to blit
|
||||
ARG trans :DWORD ; do we deal with transparents?
|
||||
|
||||
;*===================================================================
|
||||
; Define some locals so that we can handle things quickly
|
||||
;*===================================================================
|
||||
LOCAL x1_pixel :dword
|
||||
LOCAL y1_pixel :dword
|
||||
LOCAL dest_x1 : dword
|
||||
LOCAL dest_y1 : dword
|
||||
LOCAL scr_ajust_width:DWORD
|
||||
LOCAL dest_ajust_width:DWORD
|
||||
LOCAL source_area : dword
|
||||
LOCAL dest_area : 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, display rectangle)
|
||||
; - trivially rejected (return with no action)
|
||||
; - retangle must be iteratively clipped again edges of the clipping window
|
||||
; and the remaining retangle is display.
|
||||
|
||||
; Clip Source Rectangle against source Window boundaries.
|
||||
mov esi,[this] ; get ptr to src
|
||||
xor ecx,ecx ; Set sutherland code to zero
|
||||
xor edx,edx ; Set sutherland code to zero
|
||||
|
||||
; compute the difference in the X axis and get the bit signs into ecx , edx
|
||||
mov edi,[(VideoViewPort esi).VIVPWidth] ; get width into register
|
||||
mov ebx,[x_pixel] ; Get first end point x_pixel into register
|
||||
mov eax,[x_pixel] ; Get second end point x_pixel into register
|
||||
add ebx,[pixel_width] ; second point x1_pixel = x + width
|
||||
shld ecx, eax,1 ; the sign bit of x_pixel is sutherland code0 bit4
|
||||
mov [x1_pixel],ebx ; save second for future use
|
||||
inc edi ; move the right edge by one unit
|
||||
shld edx,ebx,1 ; the sign bit of x1_pixel is sutherland code0 bit4
|
||||
sub eax,edi ; compute the difference x0_pixel - width
|
||||
sub ebx,edi ; compute the difference x1_pixel - width
|
||||
shld ecx,eax,1 ; the sign bit of the difference is sutherland code0 bit3
|
||||
shld edx,ebx,1 ; the sign bit of the difference is sutherland code0 bit3
|
||||
|
||||
; the following code is just a repeticion of the above code
|
||||
; in the Y axis.
|
||||
mov edi,[(VideoViewPort esi).VIVPHeight] ; get height into register
|
||||
mov ebx,[y_pixel]
|
||||
mov eax,[y_pixel]
|
||||
add ebx,[pixel_height]
|
||||
shld ecx,eax,1
|
||||
mov [y1_pixel ],ebx
|
||||
inc edi
|
||||
shld edx,ebx,1
|
||||
sub eax,edi
|
||||
sub ebx,edi
|
||||
shld ecx,eax,1
|
||||
shld edx,ebx,1
|
||||
|
||||
; Here we have the to Sutherland code into cl and dl
|
||||
xor cl,5 ; bit 2 and 0 are complented, reverse then
|
||||
xor dl,5 ; bit 2 and 0 are complented, reverse then
|
||||
mov al,cl ; save code1 in case we have to clip iteratively
|
||||
test dl,cl ; if any bit in code0 and its counter bit
|
||||
jnz ??real_out ; in code1 is set then the rectangle in outside
|
||||
or al,dl ; if all bit of code0 the counter bit in
|
||||
jz ??clip_against_dest ; in code1 is set to zero, then all
|
||||
; end points of the rectangle are
|
||||
; inside the clipping window
|
||||
|
||||
; if we are here the polygon have to be clip iteratively
|
||||
test cl,1000b ; if bit 4 in code0 is set then
|
||||
jz ??scr_left_ok ; x_pixel is smaller than zero
|
||||
mov [x_pixel],0 ; set x_pixel to cero.
|
||||
|
||||
??scr_left_ok:
|
||||
test cl,0010b ; if bit 2 in code0 is set then
|
||||
jz ??scr_bottom_ok ; y_pixel is smaller than zero
|
||||
mov [ y_pixel ],0 ; set y_pixel to cero.
|
||||
|
||||
??scr_bottom_ok:
|
||||
test dl,0100b ; if bit 3 in code1 is set then
|
||||
jz ??scr_right_ok ; x1_pixel is greater than the width
|
||||
mov eax,[(VideoViewPort esi).VIVPWidth] ; get width into register
|
||||
mov [ x1_pixel ],eax ; set x1_pixel to width.
|
||||
??scr_right_ok:
|
||||
test dl,0001b ; if bit 0 in code1 is set then
|
||||
jz ??clip_against_dest ; y1_pixel is greater than the width
|
||||
mov eax,[(VideoViewPort esi).VIVPHeight] ; get height into register
|
||||
mov [ y1_pixel ],eax ; set y1_pixel to height.
|
||||
|
||||
; Clip Source Rectangle against destination Window boundaries.
|
||||
??clip_against_dest:
|
||||
|
||||
; build the destination rectangle before clipping
|
||||
; dest_x1 = dest_x0 + ( x1_pixel - x_pixel )
|
||||
; dest_y1 = dest_y0 + ( y1_pixel - y_pixel )
|
||||
mov eax,[dest_x0] ; get dest_x0 into eax
|
||||
mov ebx,[dest_y0] ; get dest_y0 into ebx
|
||||
sub eax,[x_pixel] ; subtract x_pixel from eax
|
||||
sub ebx,[y_pixel] ; subtract y_pixel from ebx
|
||||
add eax,[x1_pixel] ; add x1_pixel to eax
|
||||
add ebx,[y1_pixel] ; add y1_pixel to ebx
|
||||
mov [dest_x1],eax ; save eax into dest_x1
|
||||
mov [dest_y1],ebx ; save eax into dest_y1
|
||||
|
||||
|
||||
; The followin code is a repeticion of the Sutherland clipping
|
||||
; descrived above.
|
||||
mov esi,[dest] ; get ptr to src
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
mov edi,[(VideoViewPort esi).VIVPWidth] ; get width into register
|
||||
mov eax,[dest_x0]
|
||||
mov ebx,[dest_x1]
|
||||
shld ecx,eax,1
|
||||
inc edi
|
||||
shld edx,ebx,1
|
||||
sub eax,edi
|
||||
sub ebx,edi
|
||||
shld ecx,eax,1
|
||||
shld edx,ebx,1
|
||||
|
||||
mov edi,[( VideoViewPort esi) . VIVPHeight ] ; get height into register
|
||||
mov eax,[dest_y0]
|
||||
mov ebx,[dest_y1]
|
||||
shld ecx,eax,1
|
||||
inc edi
|
||||
shld edx,ebx,1
|
||||
sub eax,edi
|
||||
sub ebx,edi
|
||||
shld ecx,eax,1
|
||||
shld edx,ebx,1
|
||||
|
||||
xor cl,5
|
||||
xor dl,5
|
||||
mov al,cl
|
||||
test dl,cl
|
||||
jnz ??real_out
|
||||
or al,dl
|
||||
jz ??do_blit
|
||||
|
||||
test cl,1000b
|
||||
jz ??dest_left_ok
|
||||
mov eax,[ dest_x0 ]
|
||||
mov [ dest_x0 ],0
|
||||
sub [ x_pixel ],eax
|
||||
|
||||
??dest_left_ok:
|
||||
test cl,0010b
|
||||
jz ??dest_bottom_ok
|
||||
mov eax,[ dest_y0 ]
|
||||
mov [ dest_y0 ],0
|
||||
sub [ y_pixel ],eax
|
||||
|
||||
|
||||
??dest_bottom_ok:
|
||||
test dl,0100b
|
||||
jz ??dest_right_ok
|
||||
mov ebx,[ (VideoViewPort esi) . VIVPWidth ] ; get width into register
|
||||
mov eax,[ dest_x1 ]
|
||||
mov [ dest_x1 ],ebx
|
||||
sub eax,ebx
|
||||
sub [ x1_pixel ],eax
|
||||
|
||||
??dest_right_ok:
|
||||
test dl,0001b
|
||||
jz ??do_blit
|
||||
mov ebx,[ (VideoViewPort esi) . VIVPHeight ] ; get width into register
|
||||
mov eax,[ dest_y1 ]
|
||||
mov [ dest_y1 ],ebx
|
||||
sub eax,ebx
|
||||
sub [ y1_pixel ],eax
|
||||
|
||||
|
||||
; Here is where we do the actual blit
|
||||
??do_blit:
|
||||
cld
|
||||
mov ebx,[this]
|
||||
mov esi,[(VideoViewPort ebx).VIVPOffset]
|
||||
mov eax,[(VideoViewPort ebx).VIVPXAdd]
|
||||
add eax,[(VideoViewPort ebx).VIVPWidth]
|
||||
mov ecx,eax
|
||||
mul [y_pixel]
|
||||
add esi,[x_pixel]
|
||||
mov [source_area],ecx
|
||||
add esi,eax
|
||||
|
||||
add ecx,[x_pixel ]
|
||||
sub ecx,[x1_pixel ]
|
||||
mov [scr_ajust_width ],ecx
|
||||
|
||||
mov ebx,[dest]
|
||||
mov edi,[(VideoViewPort ebx).VIVPOffset]
|
||||
mov eax,[(VideoViewPort ebx).VIVPXAdd]
|
||||
add eax,[ (VideoViewPort ebx).VIVPWidth]
|
||||
mov ecx,eax
|
||||
mul [ dest_y0 ]
|
||||
add edi,[ dest_x0 ]
|
||||
mov [ dest_area ],ecx
|
||||
add edi,eax
|
||||
|
||||
mov eax,[ dest_x1 ]
|
||||
sub eax,[ dest_x0 ]
|
||||
jle ??real_out
|
||||
sub ecx,eax
|
||||
mov [ dest_ajust_width ],ecx
|
||||
|
||||
mov edx,[ dest_y1 ]
|
||||
sub edx,[ dest_y0 ]
|
||||
jle ??real_out
|
||||
|
||||
cmp esi,edi
|
||||
jz ??real_out
|
||||
jl ??backupward_blit
|
||||
|
||||
; ********************************************************************
|
||||
; Forward bitblit
|
||||
|
||||
test [ trans ],1
|
||||
jnz ??forward_Blit_trans
|
||||
|
||||
|
||||
; the inner loop is so efficient that
|
||||
; the optimal consept no longer apply because
|
||||
; the optimal byte have to by a number greather than 9 bytes
|
||||
cmp eax,10
|
||||
jl ??forward_loop_bytes
|
||||
|
||||
??forward_loop_dword:
|
||||
mov ecx,edi
|
||||
mov ebx,eax
|
||||
neg ecx
|
||||
and ecx,3
|
||||
sub ebx,ecx
|
||||
rep movsb
|
||||
mov ecx,ebx
|
||||
shr ecx,2
|
||||
rep movsd
|
||||
mov ecx,ebx
|
||||
and ecx,3
|
||||
rep movsb
|
||||
add esi,[ scr_ajust_width ]
|
||||
add edi,[ dest_ajust_width ]
|
||||
dec edx
|
||||
jnz ??forward_loop_dword
|
||||
ret
|
||||
|
||||
??forward_loop_bytes:
|
||||
mov ecx,eax
|
||||
rep movsb
|
||||
add esi,[ scr_ajust_width ]
|
||||
add edi,[ dest_ajust_width ]
|
||||
dec edx
|
||||
jnz ??forward_loop_bytes
|
||||
ret
|
||||
|
||||
??forward_Blit_trans:
|
||||
mov ecx,eax
|
||||
and ecx,01fh
|
||||
lea ecx,[ ecx + ecx * 4 ]
|
||||
neg ecx
|
||||
shr eax,5
|
||||
lea ecx,[ ??transp_reference + ecx * 2 ]
|
||||
mov [ y1_pixel ],ecx
|
||||
|
||||
??forward_loop_trans:
|
||||
mov ecx,eax
|
||||
jmp [ y1_pixel ]
|
||||
??forward_trans_line:
|
||||
REPT 32
|
||||
local transp_pixel
|
||||
mov bl,[ esi ]
|
||||
test bl,bl
|
||||
jz transp_pixel
|
||||
mov [ edi ],bl
|
||||
transp_pixel:
|
||||
inc esi
|
||||
inc edi
|
||||
ENDM
|
||||
??transp_reference:
|
||||
dec ecx
|
||||
jge ??forward_trans_line
|
||||
add esi,[ scr_ajust_width ]
|
||||
add edi,[ dest_ajust_width ]
|
||||
dec edx
|
||||
jnz ??forward_loop_trans
|
||||
ret
|
||||
|
||||
|
||||
; ************************************************************************
|
||||
; backward bitblit
|
||||
|
||||
??backupward_blit:
|
||||
|
||||
mov ebx,[ source_area ]
|
||||
dec edx
|
||||
add esi,eax
|
||||
imul ebx,edx
|
||||
std
|
||||
lea esi,[ esi + ebx - 1 ]
|
||||
|
||||
mov ebx,[ dest_area ]
|
||||
add edi,eax
|
||||
imul ebx,edx
|
||||
lea edi,[ edi + ebx - 1]
|
||||
|
||||
test [ trans ],1
|
||||
jnz ??backward_Blit_trans
|
||||
|
||||
cmp eax,15
|
||||
jl ??backward_loop_bytes
|
||||
|
||||
??backward_loop_dword:
|
||||
push edi
|
||||
push esi
|
||||
lea ecx,[edi+1]
|
||||
mov ebx,eax
|
||||
and ecx,3 ; Get non aligned bytes.
|
||||
sub ebx,ecx ; remove that from the total size to be copied later.
|
||||
rep movsb ; do the copy.
|
||||
sub esi,3
|
||||
mov ecx,ebx ; Get number of bytes left.
|
||||
sub edi,3
|
||||
shr ecx,2 ; Do 4 bytes at a time.
|
||||
rep movsd ; do the dword copy.
|
||||
mov ecx,ebx
|
||||
add esi,3
|
||||
add edi,3
|
||||
and ecx,03h
|
||||
rep movsb ; finnish the remaining bytes.
|
||||
pop esi
|
||||
pop edi
|
||||
sub esi,[ source_area ]
|
||||
sub edi,[ dest_area ]
|
||||
dec edx
|
||||
jge ??backward_loop_dword
|
||||
cld
|
||||
ret
|
||||
|
||||
??backward_loop_bytes:
|
||||
push edi
|
||||
mov ecx,eax ; remove that from the total size to be copied later.
|
||||
push esi
|
||||
rep movsb ; do the copy.
|
||||
pop esi
|
||||
pop edi
|
||||
sub esi,[ source_area ]
|
||||
sub edi,[ dest_area ]
|
||||
dec edx
|
||||
jge ??backward_loop_bytes
|
||||
cld
|
||||
ret
|
||||
|
||||
??backward_Blit_trans:
|
||||
mov ecx,eax
|
||||
and ecx,01fh
|
||||
lea ecx,[ ecx + ecx * 4 ]
|
||||
neg ecx
|
||||
shr eax,5
|
||||
lea ecx,[ ??back_transp_reference + ecx * 2 ]
|
||||
mov [ y1_pixel ],ecx
|
||||
|
||||
??backward_loop_trans:
|
||||
mov ecx,eax
|
||||
push edi
|
||||
push esi
|
||||
jmp [ y1_pixel ]
|
||||
??backward_trans_line:
|
||||
REPT 32
|
||||
local transp_pixel
|
||||
mov bl,[ esi ]
|
||||
test bl,bl
|
||||
jz transp_pixel
|
||||
mov [ edi ],bl
|
||||
transp_pixel:
|
||||
dec esi
|
||||
dec edi
|
||||
ENDM
|
||||
??back_transp_reference:
|
||||
dec ecx
|
||||
jge ??backward_trans_line
|
||||
pop esi
|
||||
pop edi
|
||||
sub esi,[ source_area ]
|
||||
sub edi,[ dest_area ]
|
||||
dec edx
|
||||
jge ??backward_loop_trans
|
||||
cld
|
||||
ret
|
||||
|
||||
??real_out:
|
||||
ret
|
||||
ENDP Linear_Blit_To_Linear
|
||||
|
||||
|
||||
|
||||
END
|
131
WWFLAT32/MCGAPRIM/BUFFER.CPP
Normal file
131
WWFLAT32/MCGAPRIM/BUFFER.CPP
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** 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 : Westwood 32 Bit Library *
|
||||
* *
|
||||
* File Name : BUFFER.CPP *
|
||||
* *
|
||||
* Programmer : Phil W. Gorrow *
|
||||
* *
|
||||
* Start Date : May 18, 1994 *
|
||||
* *
|
||||
* Last Update : June 1, 1994 [PWG] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* BC::BufferClass -- The default (void) constructor for a buffer class *
|
||||
* BC::~BufferClass -- The destructor for the buffer class *
|
||||
* BC::BufferClass -- The standard constructor for a buffer class *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef BUFFER_H
|
||||
#include "buffer.h"
|
||||
#endif
|
||||
|
||||
/*=========================================================================*/
|
||||
/* The following PRIVATE functions are in this file: */
|
||||
/*=========================================================================*/
|
||||
|
||||
|
||||
/*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
|
||||
|
||||
/***************************************************************************
|
||||
* BC::BufferClass -- The standard constructor for a buffer class *
|
||||
* *
|
||||
* INPUT: VOID * buffer to which should be included in buffer class *
|
||||
* LONG size of the buffer which we included *
|
||||
* *
|
||||
* OUTPUT: NONE *
|
||||
* *
|
||||
* WARNINGS: If the buffer passed to this function is equal to NULL, *
|
||||
* the buffer will be allocated using new. *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
BufferClass::BufferClass(VOID *buffer, LONG size)
|
||||
{
|
||||
Size = size; // find size of physical buffer
|
||||
|
||||
if (buffer) { // if buffer is specified
|
||||
Buffer = (BYTE *)buffer; // point to it and mark
|
||||
Allocated = FALSE; // it as user allocated
|
||||
} else {
|
||||
Buffer = new BYTE[Size]; // otherwise allocate it and
|
||||
Allocated = TRUE; // mark it system alloced
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* BC::BufferClass -- constructor for BufferClass with size only *
|
||||
* *
|
||||
* INPUT: LONG the size of the buffer that needs to be allocated *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
BufferClass::BufferClass(LONG size)
|
||||
{
|
||||
Size = size;
|
||||
Buffer = new BYTE[Size]; // otherwise allocate it and
|
||||
Allocated = TRUE; // mark it system alloced
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* BC::BufferClass -- The default (void) constructor for a buffer class *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* NOTES: The primary function of this class is to be called by a *
|
||||
* derived class which will fill in the values after the *
|
||||
* fact. *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
BufferClass::BufferClass(VOID)
|
||||
{
|
||||
Buffer = NULL;
|
||||
Size = 0;
|
||||
Allocated = FALSE;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* BC::~BUFFERCLASS -- The destructor for the buffer class *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
BufferClass::~BufferClass(VOID)
|
||||
{
|
||||
if (Allocated) {
|
||||
delete[] Buffer;
|
||||
}
|
||||
}
|
129
WWFLAT32/MCGAPRIM/BUFFER.H
Normal file
129
WWFLAT32/MCGAPRIM/BUFFER.H
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** 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 : Westwood 32 Bit Library *
|
||||
* *
|
||||
* File Name : GBUFFER.H *
|
||||
* *
|
||||
* Programmer : Phil W. Gorrow *
|
||||
* *
|
||||
* Start Date : May 26, 1994 *
|
||||
* *
|
||||
* Last Update : July 5, 1994 [PWG] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* BC::Get_Size -- Returns the buffer size of the BufferClass instance *
|
||||
* BC::Get_Buffer -- Returns pointer to buffer inherent to BufferClass *
|
||||
* BC::BufferClass -- inline constructor for BufferClass with size only *
|
||||
* BC::To_Page -- Copys a buffer class to a page with definable x, y, w, h*
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef BUFFER_H
|
||||
#define BUFFER_H
|
||||
|
||||
|
||||
/*=========================================================================*/
|
||||
/* If we have not already loaded the standard library header, than we can */
|
||||
/* load it. */
|
||||
/*=========================================================================*/
|
||||
#ifndef WWSTD_H
|
||||
#include "wwstd.h"
|
||||
#endif
|
||||
|
||||
class GraphicViewPortClass;
|
||||
class VideoViewPortClass;
|
||||
|
||||
/*=========================================================================*/
|
||||
/* BufferClass - A base class which holds buffer information including a */
|
||||
/* pointer and the size of the buffer. */
|
||||
/*=========================================================================*/
|
||||
class BufferClass {
|
||||
public:
|
||||
/*===================================================================*/
|
||||
/* Define the base constructor and destructors for the class */
|
||||
/*===================================================================*/
|
||||
BufferClass(void *ptr, long size);
|
||||
BufferClass(long size);
|
||||
BufferClass();
|
||||
~BufferClass();
|
||||
/*===================================================================*/
|
||||
/* Define functions which work with the buffer class. */
|
||||
/*===================================================================*/
|
||||
long To_Page(GraphicViewPortClass &view);
|
||||
long To_Page(int w, int h, GraphicViewPortClass &view);
|
||||
long To_Page(int x, int y, int w, int h, GraphicViewPortClass &view);
|
||||
long To_Page(VideoViewPortClass &view);
|
||||
long To_Page(int w, int h, VideoViewPortClass &view);
|
||||
long To_Page(int x, int y, int w, int h, VideoViewPortClass &view);
|
||||
|
||||
/*===================================================================*/
|
||||
/* define functions to get at the protected data members */
|
||||
/*===================================================================*/
|
||||
void *Get_Buffer(void);
|
||||
long Get_Size(void);
|
||||
|
||||
private:
|
||||
/*===================================================================*/
|
||||
/* Define the operators we do not want to happen which are the copy */
|
||||
/* and equal constructors. These are bad because the Allocated flag */
|
||||
/* could be copied and the associated buffer freed. If this were to */
|
||||
/* gappen it could cause weird general protection fault. */
|
||||
/*===================================================================*/
|
||||
BufferClass(BufferClass const &);
|
||||
BufferClass &operator=(BufferClass const &);
|
||||
|
||||
protected:
|
||||
void *Buffer;
|
||||
long Size;
|
||||
BOOL Allocated;
|
||||
};
|
||||
/***************************************************************************
|
||||
* BC::GET_SIZE -- Returns the buffer size of the BufferClass instance *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: long the size of the buffer *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long BufferClass::Get_Size(void)
|
||||
{
|
||||
return(Size);
|
||||
}
|
||||
/***************************************************************************
|
||||
* BC::GET_BUFFER -- Returns pointer to buffer inherent to BufferClass *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: void * to the inherent buffer. *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline void *BufferClass::Get_Buffer(void)
|
||||
{
|
||||
return(Buffer);
|
||||
}
|
||||
#endif
|
||||
|
77
WWFLAT32/MCGAPRIM/BUFFGLBL.CPP
Normal file
77
WWFLAT32/MCGAPRIM/BUFFGLBL.CPP
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** 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 Library *
|
||||
* *
|
||||
* File Name : BUFFGLBL.CPP *
|
||||
* *
|
||||
* Programmer : Phil W. Gorrow *
|
||||
* *
|
||||
* Start Date : January 10, 1995 *
|
||||
* *
|
||||
* Last Update : January 10, 1995 [PWG] *
|
||||
* *
|
||||
* This module holds the global fixup tables for the MCGA buffer class. *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "wwstd.h"
|
||||
#include "gbuffer.h"
|
||||
#include "vbuffer.h"
|
||||
|
||||
/*=========================================================================*/
|
||||
/* The following PRIVATE functions are in this file: */
|
||||
/*=========================================================================*/
|
||||
|
||||
|
||||
/*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
|
||||
|
||||
/*=========================================================================*/
|
||||
/* Globals required by GraphicBufferClass for function pointers. These */
|
||||
/* pointers will be set to the proper function when set mode is called. */
|
||||
/*=========================================================================*/
|
||||
BOOL (*GVPC_Blit_to_VVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
|
||||
BOOL (*GVPC_Scale_To_VVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
|
||||
|
||||
/*=========================================================================*/
|
||||
/* Globals required by VideoBufferClass for function pointers. These */
|
||||
/* pointers will be set to the proper function when set mode is called. */
|
||||
/*=========================================================================*/
|
||||
void (*VVPC_Clear_Func)(void *, unsigned char);
|
||||
long (*VVPC_To_Buffer_Func)(void *,int x, int y, int w, int h, void *buff, long size);
|
||||
void (*VVPC_Put_Pixel_Func)(void *,int x, int y, unsigned char color);
|
||||
int (*VVPC_Get_Pixel_Func)(void *, int x, int y);
|
||||
long (*VVPC_Buffer_To_Page)(int x, int y, int w, int h, void *Buffer, void *view);
|
||||
BOOL (*VVPC_Blit_to_GVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
|
||||
BOOL (*VVPC_Blit_to_VVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
|
||||
BOOL (*VVPC_Scale_To_GVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
|
||||
BOOL (*VVPC_Scale_To_VVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
|
||||
LONG (*VVPC_Print_Func)( void *, const char *, int, int, int, int);
|
||||
void (*VVPC_Draw_Stamp)(void *, void *, int, int, int, void *);
|
||||
long (*VVPC_Size_Of_Region)(void *, int, int);
|
||||
|
||||
/*=========================================================================*/
|
||||
/* We need to keep a pointer to the logic page hanging around somewhere */
|
||||
/*=========================================================================*/
|
||||
GraphicBufferClass *LogicPage;
|
||||
|
127
WWFLAT32/MCGAPRIM/CLEAR.ASM
Normal file
127
WWFLAT32/MCGAPRIM/CLEAR.ASM
Normal file
@@ -0,0 +1,127 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Clear the Full Mcga Screen *
|
||||
;* *
|
||||
;* File Name : CLEAR.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 7, 1994 *
|
||||
;* *
|
||||
;* Last Update : August 23, 1994 [SKB] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* VVPC::Clear -- Clears a virtual viewport instance *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* VVPC::CLEAR -- Clears a virtual viewport instance *
|
||||
;* *
|
||||
;* INPUT: UBYTE the color (optional) to clear the view port to *
|
||||
;* *
|
||||
;* OUTPUT: none *
|
||||
;* *
|
||||
;* NOTE: This function is optimized to handle viewport with no XAdd *
|
||||
;* value. It also handles DWORD aligning the destination *
|
||||
;* when speed can be gained by doing it. *
|
||||
;* HISTORY: *
|
||||
;* 06/07/1994 PWG : Created. *
|
||||
;* 08/23/1994 SKB : Clear the direction flag to always go forward. *
|
||||
;*=========================================================================*
|
||||
PROC MCGA_Clear C near
|
||||
USES eax,ebx,ecx,edx,esi,edi
|
||||
|
||||
ARG this:DWORD ; this is a member function
|
||||
ARG color:BYTE ; what color should we clear to
|
||||
|
||||
cld ; always go forward
|
||||
|
||||
mov ebx,[this] ; get a pointer to viewport
|
||||
mov edi,[(GraphicViewPort ebx).GVPOffset] ; get the correct offset
|
||||
mov edx,[(GraphicViewPort ebx).GVPHeight] ; ecx = height of viewport
|
||||
mov esi,[(GraphicViewPort ebx).GVPWidth] ; edx = width of viewport
|
||||
mov ebx,[(GraphicViewPort ebx).GVPXAdd] ; esi = add for each line
|
||||
|
||||
;*===================================================================
|
||||
; Convert the color byte to a DWORD for fast storing
|
||||
;*===================================================================
|
||||
mov al,[color] ; get color to clear to
|
||||
mov ah,al ; extend across WORD
|
||||
mov ecx,eax ; extend across DWORD in
|
||||
shl eax,16 ; several steps
|
||||
mov ax,cx
|
||||
|
||||
;*===================================================================
|
||||
; Find out if we should bother to align the row.
|
||||
;*===================================================================
|
||||
|
||||
cmp esi , OPTIMAL_BYTE_COPY ; is it worth aligning them?
|
||||
jl ??byte_by_byte ; if not then skip
|
||||
|
||||
;*===================================================================
|
||||
; Figure out the alignment offset if there is any
|
||||
;*===================================================================
|
||||
push ebx
|
||||
??dword_aligned_loop:
|
||||
mov ecx , edi
|
||||
mov ebx , esi
|
||||
neg ecx
|
||||
and ecx , 3
|
||||
sub ebx , ecx
|
||||
rep stosb
|
||||
mov ecx , ebx
|
||||
shr ecx , 2
|
||||
rep stosd
|
||||
mov ecx , ebx
|
||||
and ecx , 3
|
||||
rep stosb
|
||||
add edi , [ esp ]
|
||||
dec edx ; decrement the height
|
||||
jnz ??dword_aligned_loop ; if more to do than do it
|
||||
pop eax
|
||||
ret
|
||||
|
||||
;*===================================================================
|
||||
; If not enough bytes to bother aligning copy each line across a byte
|
||||
; at a time.
|
||||
;*===================================================================
|
||||
??byte_by_byte:
|
||||
mov ecx,esi ; get total width in bytes
|
||||
rep stosb ; store the width
|
||||
add edi,ebx ; handle the xadd
|
||||
dec edx ; decrement the height
|
||||
jnz ??byte_by_byte ; if any left then next line
|
||||
??exit:
|
||||
ret
|
||||
ENDP MCGA_Clear
|
||||
END
|
430
WWFLAT32/MCGAPRIM/DRAWLINE.ASM
Normal file
430
WWFLAT32/MCGAPRIM/DRAWLINE.ASM
Normal file
@@ -0,0 +1,430 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : DRAWLINE.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 16, 1994 *
|
||||
;* *
|
||||
;* Last Update : August 30, 1994 [IML] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* VVC::Scale -- Scales a virtual viewport to another virtual viewport *
|
||||
;* Normal_Draw -- jump loc for drawing scaled line of normal pixel *
|
||||
;* __DRAW_LINE -- Assembly routine to draw a line *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* VVC::DRAW_LINE -- Scales a virtual viewport to another virtual viewport *
|
||||
;* *
|
||||
;* INPUT: WORD sx_pixel - the starting x pixel position *
|
||||
;* WORD sy_pixel - the starting y pixel position *
|
||||
;* WORD dx_pixel - the destination x pixel position *
|
||||
;* WORD dy_pixel - the destination y pixel position *
|
||||
;* WORD color - the color of the line to draw *
|
||||
;* *
|
||||
;* Bounds Checking: Compares sx_pixel, sy_pixel, dx_pixel and dy_pixel *
|
||||
;* with the graphic viewport it has been assigned to. *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 06/16/1994 PWG : Created. *
|
||||
;* 08/30/1994 IML : Fixed clipping bug. *
|
||||
;*=========================================================================*
|
||||
PROC MCGA_Draw_Line C NEAR
|
||||
USES eax,ebx,ecx,edx,esi,edi
|
||||
|
||||
;*==================================================================
|
||||
;* Define the arguements that the function takes.
|
||||
;*==================================================================
|
||||
ARG this:DWORD ; associated graphic view port
|
||||
ARG x1_pixel:DWORD ; the start x pixel position
|
||||
ARG y1_pixel:DWORD ; the start y pixel position
|
||||
ARG x2_pixel:DWORD ; the dest x pixel position
|
||||
ARG y2_pixel:DWORD ; the dest y pixel position
|
||||
ARG color:DWORD ; the color we are drawing
|
||||
|
||||
;*==================================================================
|
||||
;* Define the local variables that we will use on the stack
|
||||
;*==================================================================
|
||||
LOCAL clip_min_x:DWORD
|
||||
LOCAL clip_max_x:DWORD
|
||||
LOCAL clip_min_y:DWORD
|
||||
LOCAL clip_max_y:DWORD
|
||||
LOCAL clip_var:DWORD
|
||||
LOCAL accum:DWORD
|
||||
LOCAL bpr:DWORD
|
||||
|
||||
;*==================================================================
|
||||
;* Take care of find the clip minimum and maximums
|
||||
;*==================================================================
|
||||
mov ebx,[this]
|
||||
xor eax,eax
|
||||
mov [clip_min_x],eax
|
||||
mov [clip_min_y],eax
|
||||
mov eax,[(GraphicViewPort ebx).GVPWidth]
|
||||
mov [clip_max_x],eax
|
||||
add eax,[(GraphicViewPort ebx).GVPXAdd]
|
||||
mov [bpr],eax
|
||||
mov eax,[(GraphicViewPort ebx).GVPHeight]
|
||||
mov [clip_max_y],eax
|
||||
|
||||
;*==================================================================
|
||||
;* Adjust max pixels as they are tested inclusively.
|
||||
;*==================================================================
|
||||
dec [clip_max_x]
|
||||
dec [clip_max_y]
|
||||
|
||||
;*==================================================================
|
||||
;* Set the registers with the data for drawing the line
|
||||
;*==================================================================
|
||||
mov eax,[x1_pixel] ; eax = start x pixel position
|
||||
mov ebx,[y1_pixel] ; ebx = start y pixel position
|
||||
mov ecx,[x2_pixel] ; ecx = dest x pixel position
|
||||
mov edx,[y2_pixel] ; edx = dest y pixel position
|
||||
|
||||
;*==================================================================
|
||||
;* This is the section that "pushes" the line into bounds.
|
||||
;* I have marked the section with PORTABLE start and end to signify
|
||||
;* how much of this routine is 100% portable between graphics modes.
|
||||
;* It was just as easy to have variables as it would be for constants
|
||||
;* so the global vars ClipMaxX,ClipMinY,ClipMaxX,ClipMinY are used
|
||||
;* to clip the line (default is the screen)
|
||||
;* PORTABLE start
|
||||
;*==================================================================
|
||||
|
||||
cmp eax,[clip_min_x]
|
||||
jl short ??clip_it
|
||||
cmp eax,[clip_max_x]
|
||||
jg short ??clip_it
|
||||
cmp ebx,[clip_min_y]
|
||||
jl short ??clip_it
|
||||
cmp ebx,[clip_max_y]
|
||||
jg short ??clip_it
|
||||
cmp ecx,[clip_min_x]
|
||||
jl short ??clip_it
|
||||
cmp ecx,[clip_max_x]
|
||||
jg short ??clip_it
|
||||
cmp edx,[clip_min_y]
|
||||
jl short ??clip_it
|
||||
cmp edx,[clip_max_y]
|
||||
jle short ??on_screen
|
||||
|
||||
;*==================================================================
|
||||
;* Takes care off clipping the line.
|
||||
;*==================================================================
|
||||
??clip_it:
|
||||
call NEAR PTR ??set_bits
|
||||
xchg eax,ecx
|
||||
xchg ebx,edx
|
||||
mov edi,esi
|
||||
call NEAR PTR ??set_bits
|
||||
mov [clip_var],edi
|
||||
or [clip_var],esi
|
||||
jz short ??on_screen
|
||||
test edi,esi
|
||||
jne short ??off_screen
|
||||
shl esi,2
|
||||
call [DWORD PTR cs:??clip_tbl+esi]
|
||||
jc ??clip_it
|
||||
xchg eax,ecx
|
||||
xchg ebx,edx
|
||||
shl edi,2
|
||||
call [DWORD PTR cs:??clip_tbl+edi]
|
||||
jmp ??clip_it
|
||||
|
||||
??on_screen:
|
||||
jmp ??draw_it
|
||||
|
||||
??off_screen:
|
||||
jmp ??out
|
||||
|
||||
;*==================================================================
|
||||
;* Jump table for clipping conditions
|
||||
;*==================================================================
|
||||
??clip_tbl DD ??nada,??a_up,??a_dwn,??nada
|
||||
DD ??a_lft,??a_lft,??a_dwn,??nada
|
||||
DD ??a_rgt,??a_up,??a_rgt,??nada
|
||||
DD ??nada,??nada,??nada,??nada
|
||||
|
||||
??nada:
|
||||
clc
|
||||
retn
|
||||
|
||||
??a_up:
|
||||
mov esi,[clip_min_y]
|
||||
call NEAR PTR ??clip_vert
|
||||
stc
|
||||
retn
|
||||
|
||||
??a_dwn:
|
||||
mov esi,[clip_max_y]
|
||||
neg esi
|
||||
neg ebx
|
||||
neg edx
|
||||
call NEAR PTR ??clip_vert
|
||||
neg ebx
|
||||
neg edx
|
||||
stc
|
||||
retn
|
||||
|
||||
;*==================================================================
|
||||
;* xa'=xa+[(miny-ya)(xb-xa)/(yb-ya)]
|
||||
;*==================================================================
|
||||
??clip_vert:
|
||||
push edx
|
||||
push eax
|
||||
mov [clip_var],edx ; clip_var = yb
|
||||
sub [clip_var],ebx ; clip_var = (yb-ya)
|
||||
neg eax ; eax=-xa
|
||||
add eax,ecx ; (ebx-xa)
|
||||
mov edx,esi ; edx=miny
|
||||
sub edx,ebx ; edx=(miny-ya)
|
||||
imul edx
|
||||
idiv [clip_var]
|
||||
pop edx
|
||||
add eax,edx
|
||||
pop edx
|
||||
mov ebx,esi
|
||||
retn
|
||||
|
||||
??a_lft:
|
||||
mov esi,[clip_min_x]
|
||||
call NEAR PTR ??clip_horiz
|
||||
stc
|
||||
retn
|
||||
|
||||
??a_rgt:
|
||||
mov esi,[clip_max_x]
|
||||
neg eax
|
||||
neg ecx
|
||||
neg esi
|
||||
call NEAR PTR ??clip_horiz
|
||||
neg eax
|
||||
neg ecx
|
||||
stc
|
||||
retn
|
||||
|
||||
;*==================================================================
|
||||
;* ya'=ya+[(minx-xa)(yb-ya)/(xb-xa)]
|
||||
;*==================================================================
|
||||
??clip_horiz:
|
||||
push edx
|
||||
mov [clip_var],ecx ; clip_var = xb
|
||||
sub [clip_var],eax ; clip_var = (xb-xa)
|
||||
sub edx,ebx ; edx = (yb-ya)
|
||||
neg eax ; eax = -xa
|
||||
add eax,esi ; eax = (minx-xa)
|
||||
imul edx ; eax = (minx-xa)(yb-ya)
|
||||
idiv [clip_var] ; eax = (minx-xa)(yb-ya)/(xb-xa)
|
||||
add ebx,eax ; ebx = xa+[(minx-xa)(yb-ya)/(xb-xa)]
|
||||
pop edx
|
||||
mov eax,esi
|
||||
retn
|
||||
|
||||
;*==================================================================
|
||||
;* Sets the condition bits
|
||||
;*==================================================================
|
||||
??set_bits:
|
||||
xor esi,esi
|
||||
cmp ebx,[clip_min_y] ; if y >= top its not up
|
||||
jge short ??a_not_up
|
||||
or esi,1
|
||||
|
||||
??a_not_up:
|
||||
cmp ebx,[clip_max_y] ; if y <= bottom its not down
|
||||
jle short ??a_not_down
|
||||
or esi,2
|
||||
|
||||
??a_not_down:
|
||||
cmp eax,[clip_min_x] ; if x >= left its not left
|
||||
jge short ??a_not_left
|
||||
or esi,4
|
||||
|
||||
??a_not_left:
|
||||
cmp eax,[clip_max_x] ; if x <= right its not right
|
||||
jle short ??a_not_right
|
||||
or esi,8
|
||||
|
||||
??a_not_right:
|
||||
retn
|
||||
|
||||
;*==================================================================
|
||||
;* Draw the line to the screen.
|
||||
;* PORTABLE end
|
||||
;*==================================================================
|
||||
??draw_it:
|
||||
sub edx,ebx ; see if line is being draw down
|
||||
jnz short ??not_hline ; if not then its not a hline
|
||||
jmp short ??hline ; do special case h line
|
||||
|
||||
??not_hline:
|
||||
jg short ??down ; if so there is no need to rev it
|
||||
neg edx ; negate for actual pixel length
|
||||
xchg eax,ecx ; swap x's to rev line draw
|
||||
sub ebx,edx ; get old edx
|
||||
|
||||
??down:
|
||||
push edx
|
||||
push eax
|
||||
mov eax,[bpr]
|
||||
mul ebx
|
||||
mov ebx,eax
|
||||
mov eax,[this]
|
||||
add ebx,[(GraphicViewPort eax).GVPOffset]
|
||||
pop eax
|
||||
pop edx
|
||||
|
||||
mov esi,1 ; assume a right mover
|
||||
sub ecx,eax ; see if line is right
|
||||
jnz short ??not_vline ; see if its a vertical line
|
||||
jmp ??vline
|
||||
|
||||
??not_vline:
|
||||
jg short ??right ; if so, the difference = length
|
||||
|
||||
??left:
|
||||
neg ecx ; else negate for actual pixel length
|
||||
neg esi ; negate counter to move left
|
||||
|
||||
??right:
|
||||
cmp ecx,edx ; is it a horiz or vert line
|
||||
jge short ??horiz ; if ecx > edx then |x|>|y| or horiz
|
||||
|
||||
??vert:
|
||||
xchg ecx,edx ; make ecx greater and edx lesser
|
||||
mov edi,ecx ; set greater
|
||||
mov [accum],ecx ; set accumulator to 1/2 greater
|
||||
shr [accum],1
|
||||
|
||||
;*==================================================================
|
||||
;* at this point ...
|
||||
;* eax=xpos ; ebx=page line offset; ecx=counter; edx=lesser; edi=greater;
|
||||
;* esi=adder; accum=accumulator
|
||||
;* in a vertical loop the adder is conditional and the inc constant
|
||||
;*==================================================================
|
||||
??vert_loop:
|
||||
add ebx,eax
|
||||
mov eax,[color]
|
||||
|
||||
??v_midloop:
|
||||
mov [ebx],al
|
||||
dec ecx
|
||||
jl short ??out
|
||||
add ebx,[bpr]
|
||||
sub [accum],edx ; sub the lesser
|
||||
jge ??v_midloop ; any line could be new
|
||||
add [accum],edi ; add greater for new accum
|
||||
add ebx,esi ; next pixel over
|
||||
jmp ??v_midloop
|
||||
|
||||
??horiz:
|
||||
mov edi,ecx ; set greater
|
||||
mov [accum],ecx ; set accumulator to 1/2 greater
|
||||
shr [accum],1
|
||||
|
||||
;*==================================================================
|
||||
;* at this point ...
|
||||
;* eax=xpos ; ebx=page line offset; ecx=counter; edx=lesser; edi=greater;
|
||||
;* esi=adder; accum=accumulator
|
||||
;* in a vertical loop the adder is conditional and the inc constant
|
||||
;*==================================================================
|
||||
??horiz_loop:
|
||||
add ebx,eax
|
||||
mov eax,[color]
|
||||
|
||||
??h_midloop:
|
||||
mov [ebx],al
|
||||
dec ecx ; dec counter
|
||||
jl short ??out ; end of line
|
||||
add ebx,esi
|
||||
sub [accum],edx ; sub the lesser
|
||||
jge ??h_midloop
|
||||
add [accum],edi ; add greater for new accum
|
||||
add ebx,[bpr] ; goto next line
|
||||
jmp ??h_midloop
|
||||
|
||||
;*==================================================================
|
||||
;* Special case routine for horizontal line draws
|
||||
;*==================================================================
|
||||
??hline:
|
||||
cmp eax,ecx ; make eax < ecx
|
||||
jl short ??hl_ac
|
||||
xchg eax,ecx
|
||||
|
||||
??hl_ac:
|
||||
sub ecx,eax ; get len
|
||||
inc ecx
|
||||
|
||||
push edx
|
||||
push eax
|
||||
mov eax,[bpr]
|
||||
mul ebx
|
||||
mov ebx,eax
|
||||
mov eax,[this]
|
||||
add ebx,[(GraphicViewPort eax).GVPOffset]
|
||||
pop eax
|
||||
pop edx
|
||||
add ebx,eax
|
||||
mov edi,ebx
|
||||
mov eax,[color]
|
||||
mov ah,al ; make it a word of color
|
||||
shr ecx,1 ; convert to number of words to write
|
||||
rep stosw ; write as many words as possible
|
||||
adc ecx,ecx ; add the carry flag back in
|
||||
rep stosb ; move odd one if any are odd
|
||||
jmp short ??out ; get outt
|
||||
|
||||
;*==================================================================
|
||||
;* a special case routine for vertical line draws
|
||||
;*==================================================================
|
||||
??vline:
|
||||
mov ecx,edx ; get length of line to draw
|
||||
inc ecx
|
||||
add ebx,eax
|
||||
mov eax,[color]
|
||||
|
||||
??vl_loop:
|
||||
mov [ebx],al ; store bit
|
||||
add ebx,[bpr]
|
||||
dec ecx
|
||||
jnz ??vl_loop
|
||||
|
||||
??out:
|
||||
ret
|
||||
ENDP MCGA_Draw_Line
|
||||
|
||||
|
||||
END
|
66
WWFLAT32/MCGAPRIM/DRAWRECT.CPP
Normal file
66
WWFLAT32/MCGAPRIM/DRAWRECT.CPP
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** 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 : Westwood 32 Bit Library *
|
||||
* *
|
||||
* File Name : DRAWRECT.C *
|
||||
* *
|
||||
* Programmer : Christopher Yates *
|
||||
* *
|
||||
* Last Update : August 20, 1993 [JLB] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* Draw_Rect -- Draws a rectangle to the LogicPage. *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "gbuffer.h"
|
||||
|
||||
/***************************************************************************
|
||||
* Draw_Rect -- Draws a rectangle to the LogicPage. *
|
||||
* *
|
||||
* This routine will draw a rectangle to the LogicPage. The rectangle *
|
||||
* doesn't have to be aligned on the vertical or horizontal axis. In *
|
||||
* fact, it doesn't even have to be a rectangle. The "square" can be *
|
||||
* skewed. *
|
||||
* *
|
||||
* INPUT: x1_pixel, y1_pixel -- One corner. *
|
||||
* *
|
||||
* x2_pixel, y2_pixel -- The other corner. *
|
||||
* *
|
||||
* color -- The color to draw the lines. *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* WARNINGS: None, but the rectangle will be clipped to the current *
|
||||
* draw line clipping rectangle. *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 08/20/1993 JLB : Created. *
|
||||
*=========================================================================*/
|
||||
VOID GraphicViewPortClass::Draw_Rect(int x1_pixel, int y1_pixel, int x2_pixel, int y2_pixel, unsigned char color)
|
||||
{
|
||||
Draw_Line(x1_pixel, y1_pixel, x2_pixel, y1_pixel, color);
|
||||
Draw_Line(x1_pixel, y2_pixel, x2_pixel, y2_pixel, color);
|
||||
Draw_Line(x1_pixel, y1_pixel, x1_pixel, y2_pixel, color);
|
||||
Draw_Line(x2_pixel, y1_pixel, x2_pixel, y2_pixel, color);
|
||||
}
|
66
WWFLAT32/MCGAPRIM/DRAWRECT.CPP.BAK
Normal file
66
WWFLAT32/MCGAPRIM/DRAWRECT.CPP.BAK
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** 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 : Westwood 32 Bit Library *
|
||||
* *
|
||||
* File Name : DRAWRECT.C *
|
||||
* *
|
||||
* Programmer : Christopher Yates *
|
||||
* *
|
||||
* Last Update : August 20, 1993 [JLB] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* Draw_Rect -- Draws a rectangle to the LogicPage. *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "gbuffer.h"
|
||||
|
||||
/***************************************************************************
|
||||
* Draw_Rect -- Draws a rectangle to the LogicPage. *
|
||||
* *
|
||||
* This routine will draw a rectangle to the LogicPage. The rectangle *
|
||||
* doesn't have to be aligned on the vertical or horizontal axis. In *
|
||||
* fact, it doesn't even have to be a rectangle. The "square" can be *
|
||||
* skewed. *
|
||||
* *
|
||||
* INPUT: x1_pixel, y1_pixel -- One corner. *
|
||||
* *
|
||||
* x2_pixel, y2_pixel -- The other corner. *
|
||||
* *
|
||||
* color -- The color to draw the lines. *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* WARNINGS: None, but the rectangle will be clipped to the current *
|
||||
* draw line clipping rectangle. *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 08/20/1993 JLB : Created. *
|
||||
*=========================================================================*/
|
||||
VOID GraphicViewPortClass::Draw_Rect(int x1_pixel, int y1_pixel, int x2_pixel, int y2_pixel, unsigned char color)
|
||||
{
|
||||
Draw_Line(x1_pixel, y1_pixel, x2_pixel, y1_pixel, color);
|
||||
Draw_Line(x1_pixel, y2_pixel, x2_pixel, y2_pixel, color);
|
||||
Draw_Line(x1_pixel, y1_pixel, x1_pixel, y2_pixel, color);
|
||||
Draw_Line(x2_pixel, y1_pixel, x2_pixel, y2_pixel, color);
|
||||
}
|
666
WWFLAT32/MCGAPRIM/FILLQUAD.ASM
Normal file
666
WWFLAT32/MCGAPRIM/FILLQUAD.ASM
Normal file
@@ -0,0 +1,666 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : FILLQUAD.ASM *
|
||||
;* *
|
||||
;* Programmer : Ian M. Leslie *
|
||||
;* *
|
||||
;* Start Date : August 11, 1994 *
|
||||
;* *
|
||||
;* Last Update : August 30, 1994 [IML] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Fill_Quad -- Flood fills an arbitrary convex quadrilateral *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
SLOT_VACANT EQU 80008000h
|
||||
NULL EQU 0h
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* VVC::FILL_QUAD -- Flood fills an arbitrary convex quadrilateral *
|
||||
;* *
|
||||
;* INPUT: DWORD this - associated graphic viewport *
|
||||
;* DWORD span_buff - pointer to span array *
|
||||
;* DWORD x0_pixel - the zeroth x pixel position *
|
||||
;* DWORD y0_pixel - the zeroth y pixel position *
|
||||
;* DWORD x1_pixel - the first x pixel position *
|
||||
;* DWORD y1_pixel - the first y pixel position *
|
||||
;* DWORD x2_pixel - the second x pixel position *
|
||||
;* DWORD y2_pixel - the second y pixel position *
|
||||
;* DWORD x3_pixel - the third x pixel position *
|
||||
;* DWORD y3_pixel - the third y pixel position *
|
||||
;* DWORD color - the color of the quad to fill *
|
||||
;* *
|
||||
;* Bounds Checking: Compares quad points with the graphic viewport it *
|
||||
;* has been assigned to. *
|
||||
;* *
|
||||
;* Rasterization Rules: FILL_QUAD is designed to be used within a quad *
|
||||
;* mesh. There is no pixel overlapping or stitching *
|
||||
;* effects at shared borders. FILL_QUAD is NOT *
|
||||
;* recommended for isolated quads. * *
|
||||
;* HISTORY: *
|
||||
;* 08/11/1994 IML : Created. *
|
||||
;* 08/26/1994 IML : Various optimizations. *
|
||||
;* 08/30/1994 IML : Added rasterization rules for shared borders. *
|
||||
;*=========================================================================*
|
||||
PROC MCGA_Fill_Quad C NEAR
|
||||
USES eax,ebx,ecx,edx,esi,edi
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Define the arguments that the function takes.
|
||||
;*==================================================================
|
||||
ARG this:DWORD ; associated graphic viewport
|
||||
ARG span_buff:DWORD ; pointer to span array
|
||||
ARG x0_pixel:DWORD ; the zeroth x pixel position
|
||||
ARG y0_pixel:DWORD ; the zeroth y pixel position
|
||||
ARG x1_pixel:DWORD ; the first x pixel position
|
||||
ARG y1_pixel:DWORD ; the first y pixel position
|
||||
ARG x2_pixel:DWORD ; the second x pixel position
|
||||
ARG y2_pixel:DWORD ; the second y pixel position
|
||||
ARG x3_pixel:DWORD ; the third x pixel position
|
||||
ARG y3_pixel:DWORD ; the third y pixel position
|
||||
ARG color:DWORD ; the color of the quad
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Define the local variables that we will use on the stack.
|
||||
;*==================================================================
|
||||
LOCAL clip_min_x:DWORD ; boundary of viewport
|
||||
LOCAL clip_max_x:DWORD ;
|
||||
LOCAL clip_min_y:DWORD ;
|
||||
LOCAL clip_max_y:DWORD ;
|
||||
LOCAL clip_var:DWORD
|
||||
LOCAL left_clip_base:DWORD:2 ; storage for additional edges
|
||||
LOCAL left_clip_index:DWORD ; generated by clipping
|
||||
LOCAL right_clip_base:DWORD:2 ;
|
||||
LOCAL right_clip_index:DWORD ;
|
||||
LOCAL scanline_min:DWORD ; vertical extent of quad
|
||||
LOCAL scanline_max:DWORD
|
||||
LOCAL realignment:DWORD
|
||||
LOCAL bpr:DWORD ; bytes per row of associated buffer
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Extract essential GraphicViewPort info.
|
||||
;*==================================================================
|
||||
mov ebx,[this]
|
||||
mov [clip_min_x],eax
|
||||
mov [clip_min_y],eax
|
||||
mov eax,[(GraphicViewPort ebx).GVPWidth]
|
||||
mov [clip_max_x],eax
|
||||
add eax,[(GraphicViewPort ebx).GVPXAdd]
|
||||
mov [bpr],eax
|
||||
mov eax,[(GraphicViewPort ebx).GVPHeight]
|
||||
mov [clip_max_y],eax
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Adjust top and right edges of viewport for rasterization rules.
|
||||
;*==================================================================
|
||||
dec [clip_max_y]
|
||||
dec [clip_min_y]
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Find the vertical extent of the quad BEFORE clipping.
|
||||
;* y0_pixel = y0, y1_pixel = y1, y2_pixel = y2, y3_pixel = y3
|
||||
;*==================================================================
|
||||
mov eax,[y0_pixel]
|
||||
cmp eax,[y1_pixel]
|
||||
jle short ??y1_not_smaller
|
||||
mov eax,[y1_pixel]
|
||||
|
||||
??y1_not_smaller:
|
||||
cmp eax,[y2_pixel]
|
||||
jle short ??y2_not_smaller
|
||||
mov eax,[y2_pixel]
|
||||
|
||||
??y2_not_smaller:
|
||||
cmp eax,[y3_pixel]
|
||||
jle short ??y3_not_smaller
|
||||
mov eax,[y3_pixel]
|
||||
|
||||
??y3_not_smaller:
|
||||
cmp eax,[clip_min_y]
|
||||
jge short ??no_clamp_min_min
|
||||
mov eax,[clip_min_y]
|
||||
|
||||
??no_clamp_min_min:
|
||||
cmp eax,[clip_max_y]
|
||||
jle short ??no_clamp_max_min
|
||||
mov eax,[clip_max_y]
|
||||
; scanline_min = MIN (y0, y1, y2, y3)
|
||||
??no_clamp_max_min: ; scanline_min = MAX (scanline_min, clip_min_y)
|
||||
mov [scanline_min],eax ; scanline_min = MIN (scanline_min, clip_max_y)
|
||||
|
||||
mov eax,[y0_pixel]
|
||||
cmp eax,[y1_pixel]
|
||||
jge short ??y1_not_greater
|
||||
mov eax,[y1_pixel]
|
||||
|
||||
??y1_not_greater:
|
||||
cmp eax,[y2_pixel]
|
||||
jge short ??y2_not_greater
|
||||
mov eax,[y2_pixel]
|
||||
|
||||
??y2_not_greater:
|
||||
cmp eax,[y3_pixel]
|
||||
jge short ??y3_not_greater
|
||||
mov eax,[y3_pixel]
|
||||
|
||||
??y3_not_greater:
|
||||
cmp eax,[clip_min_y]
|
||||
jge short ??no_clamp_min_max
|
||||
mov eax,[clip_min_y]
|
||||
|
||||
??no_clamp_min_max:
|
||||
cmp eax,[clip_max_y]
|
||||
jle short ??no_clamp_max_max
|
||||
mov eax,[clip_max_y]
|
||||
; scanline_max = MAX (y0, y1, y2, y3)
|
||||
??no_clamp_max_max: ; scanline_max = MAX (scanline_max, clip_min_y)
|
||||
mov [scanline_max],eax ; scanline_max = MIN (scanline_max, clip_max_y)
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Initialize memory for spans.
|
||||
;*==================================================================
|
||||
sub eax,[scanline_min]
|
||||
je ??abort_fill_quad ; don't render quads with zero height
|
||||
mov ebx,eax
|
||||
mov eax,[span_buff] ; check span_buff for NULL ptr
|
||||
cmp eax,NULL
|
||||
je ??abort_fill_quad
|
||||
sal ebx,2
|
||||
|
||||
??span_initialize_loop:
|
||||
mov [DWORD PTR eax + ebx],SLOT_VACANT
|
||||
sub ebx,4
|
||||
jl short ??exit_span_initialize
|
||||
mov [DWORD PTR eax + ebx],SLOT_VACANT
|
||||
sub ebx,4
|
||||
jl short ??exit_span_initialize
|
||||
mov [DWORD PTR eax + ebx],SLOT_VACANT
|
||||
sub ebx,4
|
||||
jl short ??exit_span_initialize
|
||||
mov [DWORD PTR eax + ebx],SLOT_VACANT
|
||||
sub ebx,4
|
||||
jge short ??span_initialize_loop
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Clip and scan convert the four edges defining the quad.
|
||||
;*==================================================================
|
||||
??exit_span_initialize:
|
||||
mov [left_clip_index],0
|
||||
mov [right_clip_index],0
|
||||
|
||||
mov eax,[x0_pixel]
|
||||
mov ebx,[y0_pixel]
|
||||
mov ecx,[x1_pixel]
|
||||
mov edx,[y1_pixel]
|
||||
call NEAR PTR ??clip_and_scan_convert
|
||||
mov eax,[x1_pixel]
|
||||
mov ebx,[y1_pixel]
|
||||
mov ecx,[x2_pixel]
|
||||
mov edx,[y2_pixel]
|
||||
call NEAR PTR ??clip_and_scan_convert
|
||||
mov eax,[x2_pixel]
|
||||
mov ebx,[y2_pixel]
|
||||
mov ecx,[x3_pixel]
|
||||
mov edx,[y3_pixel]
|
||||
call NEAR PTR ??clip_and_scan_convert
|
||||
mov eax,[x3_pixel]
|
||||
mov ebx,[y3_pixel]
|
||||
mov ecx,[x0_pixel]
|
||||
mov edx,[y0_pixel]
|
||||
call NEAR PTR ??clip_and_scan_convert
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Scan convert up to 2 additional left and right vertical edges
|
||||
;* generated by the clipping process.
|
||||
;*==================================================================
|
||||
cmp [left_clip_index],0
|
||||
je short ??no_left_edge
|
||||
mov eax,[clip_min_x]
|
||||
mov ebx,[left_clip_base]
|
||||
mov ecx,eax
|
||||
mov edx,[left_clip_base + 4]
|
||||
call NEAR PTR ??scan_convert
|
||||
|
||||
??no_left_edge:
|
||||
cmp [right_clip_index],0
|
||||
je short ??no_right_edge
|
||||
mov eax,[clip_max_x]
|
||||
mov ebx,[right_clip_base]
|
||||
mov ecx,eax
|
||||
mov edx,[right_clip_base + 4]
|
||||
call NEAR PTR ??scan_convert
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Fill the quad with specified color. Use DWORD copies where
|
||||
;* appropriate.
|
||||
;*==================================================================
|
||||
??no_right_edge:
|
||||
mov eax,[this]
|
||||
mov edi,[(GraphicViewPort eax).GVPOffset]
|
||||
mov eax,[scanline_min] ; eax = scanline_min
|
||||
|
||||
mov ebx,[scanline_max]
|
||||
sub ebx,[scanline_min] ; ebx = span count
|
||||
|
||||
mov esi,[span_buff] ; esi = address of top span
|
||||
|
||||
mul [bpr]
|
||||
add edi,eax ; edi = address of top scanline
|
||||
; containing quad
|
||||
mov al,[BYTE PTR color] ; extend pixel color into eax ready
|
||||
mov ah,al ; for DWORD copies
|
||||
mov edx,eax
|
||||
shl eax,16
|
||||
mov ax,dx
|
||||
|
||||
cld ; only fill forwards
|
||||
|
||||
jmp ??skip_span ; rasterization rule: don't
|
||||
; render topmost span
|
||||
|
||||
??quad_fill_loop:
|
||||
cmp [DWORD PTR esi],SLOT_VACANT ; test for unused spans due to clipping
|
||||
je ??skip_span
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
mov cx,[WORD PTR esi]
|
||||
mov dx,[WORD PTR esi + 2]
|
||||
sub ecx,edx
|
||||
push edi
|
||||
jns short ??not_negative_count
|
||||
add edi,ecx
|
||||
neg ecx ; ecx = span width
|
||||
|
||||
??not_negative_count:
|
||||
add edi,edx ; edi = address of start of span
|
||||
cmp ecx,OPTIMAL_BYTE_COPY ; does span width justify DWORD copies?
|
||||
jl short ??byte_copy
|
||||
mov edx,ecx
|
||||
mov ecx,edi
|
||||
and ecx,3 ; if (ecx == 0) edi is already
|
||||
jz short ??dword_copy_no_alignment ; DWORD aligned
|
||||
xor ecx,3
|
||||
inc ecx ; ecx = number of pixels before alignment
|
||||
sub edx,ecx
|
||||
rep stosb
|
||||
|
||||
??dword_copy_no_alignment:
|
||||
mov ecx,edx ; ecx = remaining pixels on span
|
||||
shr ecx,2 ; copy (ecx / 4) DWORDS
|
||||
rep stosd
|
||||
mov ecx,edx
|
||||
and ecx,3 ; ecx = remaining pixels on span
|
||||
|
||||
??byte_copy:
|
||||
rep stosb ; byte copy remaining pixels on span
|
||||
pop edi
|
||||
|
||||
??skip_span:
|
||||
add edi,[bpr] ; edi = address of start of next scanline
|
||||
add esi,4 ; esi = address of next span
|
||||
dec ebx
|
||||
jge short ??quad_fill_loop ; is span count >= 0?
|
||||
|
||||
??abort_fill_quad:
|
||||
ret
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* This is the section that "pushes" the edge into bounds.
|
||||
;* I have marked the section with PORTABLE start and end to signify
|
||||
;* how much of this routine is 100% portable between graphics modes.
|
||||
;* It was just as easy to have variables as it would be for constants
|
||||
;* so the global vars clip_min_x, clip_min_y, clip_max_x, clip_max_y
|
||||
;* are used to clip the edge (default is the screen).
|
||||
;* PORTABLE start.
|
||||
;*==================================================================
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Clip an edge against the viewport.
|
||||
;*==================================================================
|
||||
??clip_and_scan_convert:
|
||||
call NEAR PTR ??set_left_right_bits
|
||||
xchg eax,ecx
|
||||
xchg ebx,edx
|
||||
mov edi,esi
|
||||
call NEAR PTR ??set_left_right_bits
|
||||
mov [clip_var],edi
|
||||
or [clip_var],esi
|
||||
jz ??clip_up_down ; trivial acceptance?
|
||||
test edi,esi
|
||||
jne ??exit ; trivial rejection?
|
||||
shl esi,2
|
||||
call [DWORD PTR cs:??clip_tbl+esi]
|
||||
xchg eax,ecx
|
||||
xchg ebx,edx
|
||||
shl edi,2
|
||||
call [DWORD PTR cs:??clip_tbl+edi]
|
||||
|
||||
??clip_up_down:
|
||||
call NEAR PTR ??set_up_down_bits
|
||||
xchg eax,ecx
|
||||
xchg ebx,edx
|
||||
mov edi,esi
|
||||
call NEAR PTR ??set_up_down_bits
|
||||
mov [clip_var],edi
|
||||
or [clip_var],esi
|
||||
jz ??scan_convert ; trivial acceptance?
|
||||
test edi,esi
|
||||
jne ??exit ; trivial rejection?
|
||||
shl esi,2
|
||||
call [DWORD PTR cs:??clip_tbl+esi]
|
||||
xchg eax,ecx
|
||||
xchg ebx,edx
|
||||
shl edi,2
|
||||
call [DWORD PTR cs:??clip_tbl+edi]
|
||||
jmp ??scan_convert
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Subroutine table for clipping conditions.
|
||||
;*==================================================================
|
||||
??clip_tbl DD ??nada,??a_lft,??a_rgt,??nada
|
||||
DD ??a_up,??nada,??nada,??nada
|
||||
DD ??a_dwn
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Subroutines for clipping conditions.
|
||||
;*==================================================================
|
||||
??nada:
|
||||
retn
|
||||
|
||||
??a_up:
|
||||
mov esi,[clip_min_y]
|
||||
call NEAR PTR ??clip_vert
|
||||
retn
|
||||
|
||||
??a_dwn:
|
||||
mov esi,[clip_max_y]
|
||||
call NEAR PTR ??clip_vert
|
||||
retn
|
||||
|
||||
??a_lft:
|
||||
mov esi,[clip_min_x]
|
||||
call NEAR PTR ??clip_horiz
|
||||
push ebx
|
||||
mov esi,[left_clip_index]
|
||||
cmp ebx,[clip_min_y]
|
||||
jge ??no_left_min_clip
|
||||
mov ebx,[clip_min_y]
|
||||
|
||||
??no_left_min_clip:
|
||||
cmp ebx,[clip_max_y]
|
||||
jle ??no_left_max_clip
|
||||
mov ebx,[clip_max_y]
|
||||
|
||||
??no_left_max_clip:
|
||||
mov [left_clip_base + esi],ebx ; a left edge will be generated
|
||||
mov [left_clip_index],4 ; store off yb
|
||||
pop ebx
|
||||
retn
|
||||
|
||||
??a_rgt:
|
||||
mov esi,[clip_max_x]
|
||||
call NEAR PTR ??clip_horiz
|
||||
push ebx
|
||||
mov esi,[right_clip_index]
|
||||
cmp ebx,[clip_min_y]
|
||||
jge ??no_right_min_clip
|
||||
mov ebx,[clip_min_y]
|
||||
|
||||
??no_right_min_clip:
|
||||
cmp ebx,[clip_max_y]
|
||||
jle ??no_right_max_clip
|
||||
mov ebx,[clip_max_y]
|
||||
|
||||
??no_right_max_clip:
|
||||
mov [right_clip_base + esi],ebx ; a right edge will be generated
|
||||
mov [right_clip_index],4 ; store off yb
|
||||
pop ebx
|
||||
retn
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Clip a line against a horizontal edge at clip_y.
|
||||
;* (eax,ebx) = (xa,ya), (ecx,edx) = (xb,yb)
|
||||
;* xa' = xa+[(clip_y-ya)(xb-xa)/(yb-ya)]
|
||||
;* ya' = clip_y
|
||||
;*==================================================================
|
||||
??clip_vert:
|
||||
push edx
|
||||
push eax
|
||||
mov [clip_var],edx ; clip_var = yb
|
||||
sub [clip_var],ebx ; clip_var = (yb-ya)
|
||||
neg eax ; eax = -xa
|
||||
add eax,ecx ; eax = (xb-xa)
|
||||
mov edx,esi ; edx = clip_y
|
||||
sub edx,ebx ; edx = (clip_y-ya)
|
||||
imul edx ; eax = (clip_y-ya)(xb-xa)
|
||||
idiv [clip_var] ; eax = (clip_y-ya)(xb-xa)/(yb-ya)
|
||||
pop edx
|
||||
add eax,edx ; eax = xa+[(clip_y-ya)(xb-xa)/(yb-ya)]
|
||||
pop edx
|
||||
mov ebx,esi ; ebx = clip_y
|
||||
retn
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Clip a line against a vertical edge at clip_x.
|
||||
;* (eax,ebxx) = (xa,ya), (ecx,edxx) = (xb,yb)
|
||||
;* ya' = ya+[(clip_x-xa)(yb-ya)/(xb-xa)]
|
||||
;* xa' = clip_x
|
||||
;*==================================================================
|
||||
??clip_horiz:
|
||||
push edx
|
||||
mov [clip_var],ecx ; clip_var = xb
|
||||
sub [clip_var],eax ; clip_var = (xb-xa)
|
||||
sub edx,ebx ; edx = (yb-ya)
|
||||
neg eax ; eax = -xa
|
||||
add eax,esi ; eax = (clip_x-xa)
|
||||
imul edx ; eax = (clip_x-xa)(yb-ya)
|
||||
idiv [clip_var] ; eax = (clip_x-xa)(yb-ya)/(xb-xa)
|
||||
add ebx,eax ; ebx = ya+[(clip_x-xa)(yb-ya)/(xb-xa)]
|
||||
pop edx
|
||||
mov eax,esi ; eax = clip_x
|
||||
retn
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Set the condition bits for the subroutine table.
|
||||
;*==================================================================
|
||||
??set_left_right_bits:
|
||||
xor esi,esi
|
||||
cmp eax,[clip_min_x] ; if x >= left its not left
|
||||
jge short ??a_not_left
|
||||
or esi,1
|
||||
|
||||
??a_not_left:
|
||||
cmp eax,[clip_max_x] ; if x <= right its not right
|
||||
jle short ??a_not_right
|
||||
or esi,2
|
||||
|
||||
??a_not_right:
|
||||
retn
|
||||
|
||||
??set_up_down_bits:
|
||||
xor esi,esi
|
||||
cmp ebx,[clip_min_y] ; if y >= top its not up
|
||||
jge short ??a_not_up
|
||||
or esi,4
|
||||
|
||||
??a_not_up:
|
||||
cmp ebx,[clip_max_y] ; if y <= bottom its not down
|
||||
jle short ??a_not_down
|
||||
or esi,8
|
||||
|
||||
??a_not_down:
|
||||
retn
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* PORTABLE end.
|
||||
;*==================================================================
|
||||
|
||||
;*==================================================================
|
||||
;* Scan convert an edge.
|
||||
;* (eax,ebx) = (xa,ya), (ecx,edx) = (xb,yb)
|
||||
;*==================================================================
|
||||
??scan_convert:
|
||||
cmp ebx,edx
|
||||
je ??exit ; if (ya == yb) don't scan convert
|
||||
jl short ??no_swap ; if (ya < yb) swap vertices
|
||||
xchg eax,ecx
|
||||
xchg ebx,edx
|
||||
|
||||
??no_swap:
|
||||
sub edx,ebx ; edx = (yb - ya)
|
||||
sub ebx,[scanline_min]
|
||||
sal ebx,2
|
||||
add ebx,[span_buff] ; ebx = span_buff + 4(ya - clip_min_y)
|
||||
sub ecx,eax ; ecx = (xb - xa)
|
||||
je ??v_scan ; if the edge is vertical use a
|
||||
; special case routine
|
||||
push eax
|
||||
mov eax,ecx ; eax = (xb - xa)
|
||||
mov ecx,edx ; ecx = (yb - ya)
|
||||
sal edx,1
|
||||
mov [realignment],edx ; realignment = 2(yb - ya)
|
||||
cwd
|
||||
idiv cx
|
||||
cwde
|
||||
movsx edx,dx
|
||||
mov edi,eax ; edi = (xb - xa) / (yb - ya)
|
||||
mov esi,edx
|
||||
mov edx,ecx
|
||||
pop eax ; eax = xa
|
||||
neg edx ; edx = -(yb - ya)
|
||||
sal esi,1 ; esi = 2[(xb - xa) % (yb - ya)]
|
||||
jns short ??r_scan ; scan to the left or right?
|
||||
neg esi
|
||||
|
||||
;*==================================================================
|
||||
;* Edge scan conversion DDA moving down and to the left.
|
||||
;* eax = xpos, ebx = span to reference
|
||||
;*==================================================================
|
||||
cmp ebx,[span_buff]
|
||||
jg ??l_scan_convert
|
||||
|
||||
??l_scan_convert_loop:
|
||||
cmp [DWORD PTR ebx],SLOT_VACANT ; if the left slot of span is
|
||||
jne short ??l_next_slot ; vacant fill it with xpos
|
||||
mov [ebx],ax
|
||||
|
||||
??l_next_slot:
|
||||
mov [ebx + 2],ax ; otherwise fill the right slot
|
||||
; with xpos
|
||||
??l_scan_convert:
|
||||
dec ecx
|
||||
jl short ??exit
|
||||
add ebx,4
|
||||
add eax,edi
|
||||
add edx,esi
|
||||
jle short ??l_scan_convert_loop
|
||||
dec eax
|
||||
sub edx,[realignment]
|
||||
jmp ??l_scan_convert_loop
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Edge scan conversion DDA moving down and to the right.
|
||||
;* eax = xpos, ebx = span to reference
|
||||
;*==================================================================
|
||||
??r_scan:
|
||||
cmp ebx,[span_buff]
|
||||
jg ??r_scan_convert
|
||||
|
||||
??r_scan_convert_loop:
|
||||
cmp [DWORD PTR ebx],SLOT_VACANT ; if the left slot of span is
|
||||
jne short ??r_next_slot ; vacant fill it with xpos
|
||||
mov [ebx],ax
|
||||
|
||||
??r_next_slot:
|
||||
mov [ebx + 2],ax ; otherwise fill the right slot
|
||||
; with xpos
|
||||
??r_scan_convert:
|
||||
dec ecx
|
||||
jl short ??exit
|
||||
add ebx,4
|
||||
add eax,edi
|
||||
add edx,esi
|
||||
jle short ??r_scan_convert_loop
|
||||
inc eax
|
||||
sub edx,[realignment]
|
||||
jmp ??r_scan_convert_loop
|
||||
|
||||
|
||||
;*==================================================================
|
||||
;* Scan convert a vertical edge.
|
||||
;* eax = xpos, ebx = span to reference
|
||||
;*==================================================================
|
||||
??v_scan:
|
||||
cmp ebx,[span_buff]
|
||||
jg ??v_scan_convert
|
||||
|
||||
??v_scan_convert_loop:
|
||||
cmp [DWORD PTR ebx],SLOT_VACANT ; if the left slot of span is
|
||||
jne short ??v_next_slot ; vacant fill it with xpos
|
||||
mov [ebx],ax
|
||||
|
||||
??v_next_slot:
|
||||
mov [ebx + 2],ax ; otherwise fill the right slot
|
||||
; with xpos
|
||||
??v_scan_convert:
|
||||
add ebx,4
|
||||
dec edx
|
||||
jge ??v_scan_convert_loop
|
||||
|
||||
??exit:
|
||||
retn
|
||||
|
||||
ENDP MCGA_Fill_Quad
|
||||
|
||||
END
|
274
WWFLAT32/MCGAPRIM/FILLRECT.ASM
Normal file
274
WWFLAT32/MCGAPRIM/FILLRECT.ASM
Normal file
@@ -0,0 +1,274 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Clear the Full Mcga Screen *
|
||||
;* *
|
||||
;* File Name : CLEAR.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 7, 1994 *
|
||||
;* *
|
||||
;* Last Update : June 7, 1994 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* VVPC::Clear -- Clears a virtual viewport instance *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* GVPC::FILL_RECT -- Fills a rectangular region of a graphic view port *
|
||||
;* *
|
||||
;* INPUT: WORD the left hand x pixel position of region *
|
||||
;* WORD the upper x pixel position of region *
|
||||
;* WORD the right hand x pixel position of region *
|
||||
;* WORD the lower x pixel position of region *
|
||||
;* UBYTE the color (optional) to clear the view port to *
|
||||
;* *
|
||||
;* OUTPUT: none *
|
||||
;* *
|
||||
;* NOTE: This function is optimized to handle viewport with no XAdd *
|
||||
;* value. It also handles DWORD aligning the destination *
|
||||
;* when speed can be gained by doing it. *
|
||||
;* HISTORY: *
|
||||
;* 06/07/1994 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC MCGA_Fill_Rect C near
|
||||
USES eax,ebx,ecx,edx,esi,edi,ebp
|
||||
|
||||
;*===================================================================
|
||||
;* define the arguements that our function takes.
|
||||
;*===================================================================
|
||||
ARG this:DWORD ; this is a member function
|
||||
ARG x1_pixel:WORD
|
||||
ARG y1_pixel:WORD
|
||||
ARG x2_pixel:WORD
|
||||
ARG y2_pixel:WORD
|
||||
ARG color:BYTE ; what color should we clear to
|
||||
;*===================================================================
|
||||
; Define some locals so that we can handle things quickly
|
||||
;*===================================================================
|
||||
LOCAL VPwidth:DWORD ; the width of the viewport
|
||||
LOCAL VPheight:DWORD ; the height of the viewport
|
||||
LOCAL VPxadd:DWORD ; the additional x offset of viewport
|
||||
LOCAL VPbpr:DWORD ; the number of bytes per row of viewport
|
||||
|
||||
;*===================================================================
|
||||
;* save off the viewport characteristics on the stack
|
||||
;*===================================================================
|
||||
mov ebx,[this] ; get a pointer to viewport
|
||||
mov eax,[(GraphicViewPort ebx).GVPWidth] ; get width from viewport
|
||||
mov ecx,[(GraphicViewPort ebx).GVPHeight] ; get height from viewport
|
||||
mov edx,[(GraphicViewPort ebx).GVPXAdd] ; get xadd from viewport
|
||||
mov [VPwidth],eax ; store the width of locally
|
||||
mov [VPheight],ecx
|
||||
mov [VPxadd],edx
|
||||
add eax,edx
|
||||
mov [VPbpr],eax
|
||||
|
||||
;*===================================================================
|
||||
;* move the important parameters into local registers
|
||||
;*===================================================================
|
||||
movsx eax,[x1_pixel]
|
||||
movsx ebx,[y1_pixel]
|
||||
movsx ecx,[x2_pixel]
|
||||
movsx edx,[y2_pixel]
|
||||
|
||||
;*===================================================================
|
||||
;* Convert the x2 and y2 pixel to a width and height
|
||||
;*===================================================================
|
||||
cmp eax,ecx
|
||||
jl ??no_swap_x
|
||||
xchg eax,ecx
|
||||
|
||||
??no_swap_x:
|
||||
sub ecx,eax
|
||||
cmp ebx,edx
|
||||
jl ??no_swap_y
|
||||
xchg ebx,edx
|
||||
??no_swap_y:
|
||||
sub edx,ebx
|
||||
inc ecx
|
||||
inc edx
|
||||
|
||||
;*===================================================================
|
||||
;* Bounds check source X.
|
||||
;*===================================================================
|
||||
cmp eax, [VPwidth] ; compare with the max
|
||||
jge ??out ; starts off screen, then later
|
||||
jb short ??sx_done ; if it's not negative, it's ok
|
||||
|
||||
;------ Clip source X to left edge of screen.
|
||||
add ecx, eax ; Reduce width (add in negative src X).
|
||||
xor eax, eax ; Clip to left of screen.
|
||||
??sx_done:
|
||||
|
||||
;*===================================================================
|
||||
;* Bounds check source Y.
|
||||
;*===================================================================
|
||||
cmp ebx, [VPheight] ; compare with the max
|
||||
jge ??out ; starts off screen, then later
|
||||
jb short ??sy_done ; if it's not negative, it's ok
|
||||
|
||||
;------ Clip source Y to top edge of screen.
|
||||
add edx, ebx ; Reduce height (add in negative src Y).
|
||||
xor ebx, ebx ; Clip to top of screen.
|
||||
|
||||
??sy_done:
|
||||
;*===================================================================
|
||||
;* Bounds check width versus width of source and dest view ports
|
||||
;*===================================================================
|
||||
push ebx ; save off ebx for later use
|
||||
mov ebx,[VPwidth] ; get the source width
|
||||
sub ebx, eax ; Maximum allowed pixel width (given coordinates).
|
||||
sub ebx, ecx ; Pixel width undershoot.
|
||||
jns short ??width_ok ; if not signed no adjustment necessary
|
||||
add ecx, ebx ; Reduce width to screen limits.
|
||||
|
||||
??width_ok:
|
||||
pop ebx ; restore ebx to old value
|
||||
|
||||
;*===================================================================
|
||||
;* Bounds check height versus height of source view port
|
||||
;*===================================================================
|
||||
push eax ; save of eax for later use
|
||||
mov eax, [VPheight] ; get the source height
|
||||
sub eax, ebx ; Maximum allowed pixel height (given coordinates).
|
||||
sub eax, edx ; Pixel height undershoot.
|
||||
jns short ??height_ok ; if not signed no adjustment necessary
|
||||
add edx, eax ; Reduce height to screen limits.
|
||||
??height_ok:
|
||||
pop eax ; restore eax to old value
|
||||
|
||||
;*===================================================================
|
||||
;* Perform the last minute checks on the width and height
|
||||
;*===================================================================
|
||||
or ecx,ecx
|
||||
jz ??out
|
||||
|
||||
or edx,edx
|
||||
jz ??out
|
||||
|
||||
cmp ecx,[VPwidth]
|
||||
ja ??out
|
||||
cmp edx,[VPheight]
|
||||
ja ??out
|
||||
|
||||
;*===================================================================
|
||||
;* Get the offset into the virtual viewport.
|
||||
;*===================================================================
|
||||
xchg edi,eax ; save off the contents of eax
|
||||
xchg esi,edx ; and edx for size test
|
||||
mov eax,ebx ; move the y pixel into eax
|
||||
mul [VPbpr] ; multiply by bytes per row
|
||||
add edi,eax ; add the result into the x position
|
||||
mov ebx,[this]
|
||||
add edi,[(GraphicViewPort ebx).GVPOffset]
|
||||
|
||||
mov edx,esi ; restore edx back to real value
|
||||
mov eax,ecx ; store total width in ecx
|
||||
sub eax,[VPwidth] ; modify xadd value to include clipped
|
||||
sub [VPxadd],eax ; width bytes (subtract a negative number)
|
||||
|
||||
;*===================================================================
|
||||
; Convert the color byte to a DWORD for fast storing
|
||||
;*===================================================================
|
||||
mov al,[color] ; get color to clear to
|
||||
mov ah,al ; extend across WORD
|
||||
mov ebx,eax ; extend across DWORD in
|
||||
shl eax,16 ; several steps
|
||||
mov ax,bx
|
||||
|
||||
;*===================================================================
|
||||
; If there is no row offset then adjust the width to be the size of
|
||||
; the entire viewport and adjust the height to be 1
|
||||
;*===================================================================
|
||||
mov esi,[VPxadd]
|
||||
or esi,esi ; set the flags for esi
|
||||
jnz ??row_by_row_aligned ; and act on them
|
||||
|
||||
xchg eax,ecx ; switch bit pattern and width
|
||||
mul edx ; multiply by edx to get size
|
||||
xchg eax,ecx ; switch size and bit pattern
|
||||
mov edx,1 ; only 1 line off view port size to do
|
||||
|
||||
;*===================================================================
|
||||
; Find out if we should bother to align the row.
|
||||
;*===================================================================
|
||||
??row_by_row_aligned:
|
||||
mov ebp,ecx ; width saved in ebp
|
||||
cmp ecx,OPTIMAL_BYTE_COPY ; is it worth aligning them?
|
||||
jl ??row_by_row ; if not then skip
|
||||
|
||||
;*===================================================================
|
||||
; Figure out the alignment offset if there is any
|
||||
;*===================================================================
|
||||
mov ebx,edi ; get output position
|
||||
and ebx,3 ; is there a remainder?
|
||||
jz ??aligned_loop ; if not we are aligned
|
||||
xor ebx,3 ; find number of align bytes
|
||||
inc ebx ; this number is off by one
|
||||
sub ebp,ebx ; subtract from width
|
||||
|
||||
;*===================================================================
|
||||
; Now that we have the alignment offset copy each row
|
||||
;*===================================================================
|
||||
??aligned_loop:
|
||||
mov ecx,ebx ; get number of bytes to align
|
||||
rep stosb ; and move them over
|
||||
mov ecx,ebp ; get number of aligned bytes
|
||||
shr ecx,2 ; convert to DWORDS
|
||||
rep stosd ; and move them over
|
||||
mov ecx,ebp ; get number of aligned bytes
|
||||
and ecx,3 ; find the remainder
|
||||
rep stosb ; and move it over
|
||||
add edi,esi ; fix the line offset
|
||||
dec edx ; decrement the height
|
||||
jnz ??aligned_loop ; if more to do than do it
|
||||
jmp ??exit ; we are all done
|
||||
|
||||
;*===================================================================
|
||||
; If not enough bytes to bother aligning copy each line across a byte
|
||||
; at a time.
|
||||
;*===================================================================
|
||||
??row_by_row:
|
||||
mov ecx,ebp ; get total width in bytes
|
||||
rep stosb ; store the width
|
||||
add edi,esi ; handle the xadd
|
||||
dec edx ; decrement the height
|
||||
jnz ??row_by_row ; if any left then next line
|
||||
??out:
|
||||
??exit:
|
||||
ret
|
||||
ENDP MCGA_Fill_Rect
|
||||
|
||||
END
|
315
WWFLAT32/MCGAPRIM/GBUFFER.CPP
Normal file
315
WWFLAT32/MCGAPRIM/GBUFFER.CPP
Normal file
@@ -0,0 +1,315 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** 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 : Westwood 32 bit Library *
|
||||
* *
|
||||
* File Name : GBUFFER.CPP *
|
||||
* *
|
||||
* Programmer : Phil W. Gorrow *
|
||||
* *
|
||||
* Start Date : May 3, 1994 *
|
||||
* *
|
||||
* Last Update : February 23, 1995 [PWG] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* VVPC::VirtualViewPort -- Default constructor for a virtual viewport *
|
||||
* VVPC:~VirtualViewPortClass -- Destructor for a virtual viewport *
|
||||
* VVPC::Clear -- Clears a graphic page to correct color *
|
||||
* VBC::VideoBufferClass -- Lowlevel constructor for video buffer class *
|
||||
* GVPC::Change -- Changes position and size of a Graphic View Port *
|
||||
* VVPC::Change -- Changes position and size of a Video View Port *
|
||||
* Set_Logic_Page -- Sets LogicPage to new buffer *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef GBUFFER_H
|
||||
#include "gbuffer.h"
|
||||
#endif
|
||||
#pragma inline
|
||||
|
||||
|
||||
/*=========================================================================*/
|
||||
/* The following PRIVATE functions are in this file: */
|
||||
/*=========================================================================*/
|
||||
|
||||
|
||||
/*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GRAPHICVIEWPORTCLASS -- Constructor for basic view port class *
|
||||
* m *
|
||||
* INPUT: GraphicBufferClass * gbuffer - buffer to attach to *
|
||||
* int x - x offset into buffer *
|
||||
* int y - y offset into buffer *
|
||||
* int w - view port width in pixels *
|
||||
* int h - view port height in pixels *
|
||||
* *
|
||||
* OUTPUT: Constructors may not have a return value *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/09/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
GraphicViewPortClass::GraphicViewPortClass(GraphicBufferClass *gbuffer, int x, int y, int w, int h)
|
||||
{
|
||||
Attach(gbuffer, x, y, w, h);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GRAPHICVIEWPORTCLASS -- Default constructor for view port class *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/09/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
GraphicViewPortClass::GraphicViewPortClass(void)
|
||||
{
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::~GRAPHICVIEWPORTCLASS -- Destructor for GraphicViewPortClass *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: A destructor may not return a value. *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/10/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
GraphicViewPortClass::~GraphicViewPortClass(void)
|
||||
{
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::ATTACH -- Attaches a viewport to a buffer class *
|
||||
* *
|
||||
* INPUT: GraphicBufferClass *g_buff - pointer to gbuff to attach to *
|
||||
* int x - x position to attach to *
|
||||
* int y - y position to attach to *
|
||||
* int w - width of the view port *
|
||||
* int h - height of the view port *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/10/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
void GraphicViewPortClass::Attach(GraphicBufferClass *gbuffer, int x, int y, int w, int h)
|
||||
{
|
||||
/*======================================================================*/
|
||||
/* Verify that the x and y coordinates are valid and placed within the */
|
||||
/* physical buffer. */
|
||||
/*======================================================================*/
|
||||
if (x < 0) // you cannot place view port off
|
||||
x = 0; // the left edge of physical buf
|
||||
if (x >= gbuffer->Get_Width()) // you cannot place left edge off
|
||||
x = gbuffer->Get_Width() - 1; // the right edge of physical buf
|
||||
if (y < 0) // you cannot place view port off
|
||||
y = 0; // the top edge of physical buf
|
||||
if (y >= gbuffer->Get_Height()) // you cannot place view port off
|
||||
y = gbuffer->Get_Height() - 1; // bottom edge of physical buf
|
||||
|
||||
/*======================================================================*/
|
||||
/* Adjust the width and height of necessary */
|
||||
/*======================================================================*/
|
||||
if (x + w > gbuffer->Get_Width()) // if the x plus width is larger
|
||||
w = gbuffer->Get_Width() - x; // than physical, fix width
|
||||
|
||||
if (y + h > gbuffer->Get_Height()) // if the y plus height is larger
|
||||
h = gbuffer->Get_Height() - y; // than physical, fix height
|
||||
|
||||
/*======================================================================*/
|
||||
/* Get a pointer to the top left edge of the buffer. */
|
||||
/*======================================================================*/
|
||||
Offset = gbuffer->Get_Offset() + (gbuffer->Get_Width() * y) + x;
|
||||
|
||||
/*======================================================================*/
|
||||
/* Copy over all of the variables that we need to store. */
|
||||
/*======================================================================*/
|
||||
XPos = x;
|
||||
YPos = y;
|
||||
XAdd = gbuffer->Get_Width() - w;
|
||||
Width = w;
|
||||
Height = h;
|
||||
GraphicBuff = gbuffer;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::CHANGE -- Changes position and size of a Graphic View Port *
|
||||
* *
|
||||
* INPUT: int the new x pixel position of the graphic view port *
|
||||
* int the new y pixel position of the graphic view port *
|
||||
* int the new width of the viewport in pixels *
|
||||
* int the new height of the viewport in pixels *
|
||||
* *
|
||||
* OUTPUT: BOOL whether the Graphic View Port could be sucessfully *
|
||||
* resized. *
|
||||
* *
|
||||
* WARNINGS: You may not resize a Graphic View Port which is derived *
|
||||
* from a Graphic View Port Buffer, *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/14/1994 SKB : Created. *
|
||||
*=========================================================================*/
|
||||
BOOL GraphicViewPortClass::Change(int x, int y, int w, int h)
|
||||
{
|
||||
/*======================================================================*/
|
||||
/* Can not change a Graphic View Port if it is actually the physical */
|
||||
/* representation of a Graphic Buffer. */
|
||||
/*======================================================================*/
|
||||
if (this == Get_Graphic_Buffer()) {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/*======================================================================*/
|
||||
/* Since there is no allocated information, just re-attach it to the */
|
||||
/* existing graphic buffer as if we were creating the */
|
||||
/* GraphicViewPort. */
|
||||
/*======================================================================*/
|
||||
Attach(Get_Graphic_Buffer(), x, y, w, h);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GBC::GRAPHICBUFFERCLASS -- Constructor for fixed size buffers *
|
||||
* *
|
||||
* INPUT: long size - size of the buffer to create *
|
||||
* int w - width of buffer in pixels (default = 320) *
|
||||
* int h - height of buffer in pixels (default = 200) *
|
||||
* void *buffer - a pointer to the buffer if any (optional) *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/13/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
GraphicBufferClass::GraphicBufferClass(long size, int w, int h, void *buffer)
|
||||
{
|
||||
Size = size; // find size of physical buffer
|
||||
|
||||
if (buffer) { // if buffer is specified
|
||||
Buffer = (BYTE *)buffer; // point to it and mark
|
||||
Allocated = FALSE; // it as user allocated
|
||||
} else {
|
||||
Buffer = new BYTE[Size]; // otherwise allocate it and
|
||||
Allocated = TRUE; // mark it system alloced
|
||||
}
|
||||
|
||||
Offset = (long)Buffer; // Get offset to the buffer
|
||||
Width = w; // Record width of Buffer
|
||||
Height = h; // Record height of Buffer
|
||||
XAdd = 0; // Record XAdd of Buffer
|
||||
XPos = 0; // Record XPos of Buffer
|
||||
YPos = 0; // Record YPos of Buffer
|
||||
GraphicBuff = this; // Get a pointer to our self
|
||||
}
|
||||
/*=========================================================================*
|
||||
* GBC::GRAPHICBUFFERCLASS -- inline constructor for GraphicBufferClass *
|
||||
* *
|
||||
* INPUT: int w - width of buffer in pixels (default = 320) *
|
||||
* int h - height of buffer in pixels (default = 200) *
|
||||
* void *buffer - a pointer to the buffer if any (optional) *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/03/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
GraphicBufferClass::GraphicBufferClass(int w, int h, void *buffer)
|
||||
{
|
||||
Size = w * h; // find size of physical buffer
|
||||
|
||||
if (buffer) { // if buffer is specified
|
||||
Buffer = (BYTE *)buffer; // point to it and mark
|
||||
Allocated = FALSE; // it as user allocated
|
||||
} else {
|
||||
Buffer = new BYTE[Size]; // otherwise allocate it and
|
||||
Allocated = TRUE; // mark it system alloced
|
||||
}
|
||||
|
||||
Offset = (long)Buffer; // Get offset to the buffer
|
||||
Width = w; // Record width of Buffer
|
||||
Height = h; // Record height of Buffer
|
||||
XAdd = 0; // Record XAdd of Buffer
|
||||
XPos = 0; // Record XPos of Buffer
|
||||
YPos = 0; // Record YPos of Buffer
|
||||
GraphicBuff = this; // Get a pointer to our self
|
||||
}
|
||||
/*=========================================================================*
|
||||
* GBC::~GRAPHICBUFFERCLASS -- Destructor for the graphic buffer class *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/03/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
GraphicBufferClass::~GraphicBufferClass()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* SET_LOGIC_PAGE -- Sets LogicPage to new buffer *
|
||||
* *
|
||||
* INPUT: GraphicBufferClass * the buffer we are going to set *
|
||||
* *
|
||||
* OUTPUT: GraphicBufferClass * the previous buffer type *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 02/23/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass *ptr)
|
||||
{
|
||||
GraphicBufferClass *old = LogicPage;
|
||||
LogicPage = ptr;
|
||||
return(old);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* SET_LOGIC_PAGE -- Sets LogicPage to new buffer *
|
||||
* *
|
||||
* INPUT: GraphicBufferClass & the buffer we are going to set *
|
||||
* *
|
||||
* OUTPUT: GraphicBufferClass * the previous buffer type *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 02/23/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass &ptr)
|
||||
{
|
||||
GraphicBufferClass *old = LogicPage;
|
||||
LogicPage = &ptr;
|
||||
return(old);
|
||||
}
|
892
WWFLAT32/MCGAPRIM/GBUFFER.CPP.BAK
Normal file
892
WWFLAT32/MCGAPRIM/GBUFFER.CPP.BAK
Normal file
@@ -0,0 +1,892 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** 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 : Westwood 32 Bit Library *
|
||||
* *
|
||||
* File Name : GBUFFER.H *
|
||||
* *
|
||||
* Programmer : Phil W. Gorrow *
|
||||
* *
|
||||
* Start Date : May 26, 1994 *
|
||||
* *
|
||||
* Last Update : January 17, 1995 [PWG] *
|
||||
* *
|
||||
***************************************************************************
|
||||
* *
|
||||
* This module contains the definition for the graphic buffer class. The *
|
||||
* primary functionality of the graphic buffer class is handled by inline *
|
||||
* functions that make a call through function pointers to the correct *
|
||||
* routine. This has two benefits: *
|
||||
* *
|
||||
* *
|
||||
* 1) C++ name mangling is not a big deal since the function pointers *
|
||||
* point to functions in standard C format. *
|
||||
* 2) The function pointers can be changed when we set a different *
|
||||
* graphic mode. This allows us to have both supervga and mcga *
|
||||
* routines present in memory at once. *
|
||||
* *
|
||||
* In the basic library, these functions point to stub routines which just *
|
||||
* return. This makes a product that just uses a graphic buffer take the *
|
||||
* minimum amount of code space. For programs that require MCGA or VESA *
|
||||
* support, all that is necessary to do is link either the MCGA or VESA *
|
||||
* specific libraries in, previous to WWLIB32. The linker will then *
|
||||
* overide the the necessary stub functions automatically. *
|
||||
* *
|
||||
* In addition, there are helpful inline function calls for parameter *
|
||||
* ellimination. This header file gives the defintion for all *
|
||||
* GraphicViewPort and GraphicBuffer classes. *
|
||||
* *
|
||||
* Terminology: *
|
||||
* *
|
||||
* Buffer Class - A class which consists of a pointer to an allocated *
|
||||
* buffer and the size of the buffer that was allocated. *
|
||||
* *
|
||||
* Graphic ViewPort - The Graphic ViewPort defines a window into a *
|
||||
* Graphic Buffer. This means that although a Graphic Buffer *
|
||||
* represents linear memory, this may not be true with a Graphic *
|
||||
* Viewport. All low level functions that act directly on a graphic *
|
||||
* viewport are included within this class. This includes but is not *
|
||||
* limited to most of the functions which can act on a Video Viewport *
|
||||
* Video Buffer. *
|
||||
* *
|
||||
* Graphic Buffer - A Graphic Buffer is an instance of an allocated buffer *
|
||||
* used to represent a rectangular region of graphics memory. *
|
||||
* The HidBuff and BackBuff are excellent examples of a Graphic Buffer. *
|
||||
* *
|
||||
* Below is a tree which shows the relationship of the VideoBuffer and *
|
||||
* Buffer classes to the GraphicBuffer class: *
|
||||
* *
|
||||
* BUFFER.H GBUFFER.H BUFFER.H VBUFFER.H *
|
||||
* ---------- ---------- ---------- ---------- *
|
||||
* | Buffer | | Graphic | | Buffer | | Video | *
|
||||
* | Class | | ViewPort | | Class | | ViewPort | *
|
||||
* ---------- ---------- ---------- ---------- *
|
||||
* \ / \ / *
|
||||
* \ / \ / *
|
||||
* ---------- ---------- *
|
||||
* | Graphic | | Video | *
|
||||
* | Buffer | | Buffer | *
|
||||
* ---------- ---------- *
|
||||
* GBUFFER.H VBUFFER.H *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* GBC::GraphicBufferClass -- inline constructor for GraphicBufferClass *
|
||||
* GVPC::Remap -- Short form to remap an entire graphic view port *
|
||||
* GVPC::Get_XPos -- Returns x offset for a graphic viewport class *
|
||||
* GVPC::Get_Ypos -- Return y offset in a GraphicViewPortClass *
|
||||
* VVPC::Get_XPos -- Get the x pos of the VP on the Video *
|
||||
* VVPC::Get_YPos -- Get the y pos of the VP on the video *
|
||||
* GBC::Get_Graphic_Buffer -- Get the graphic buffer of the VP. *
|
||||
* GVPC::Draw_Line -- Stub function to draw line in Graphic Viewport Class*
|
||||
* GVPC::Fill_Rect -- Stub function to fill rectangle in a GVPC *
|
||||
* GVPC::Remap -- Stub function to remap a GVPC *
|
||||
* GVPC::Print -- stub func to print a text string *
|
||||
* GVPC::Print -- Stub function to print an integer *
|
||||
* GVPC::Print -- Stub function to print a short to a graphic viewport *
|
||||
* GVPC::Print -- stub function to print a long on a graphic view port *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "window.h"
|
||||
|
||||
#ifndef GBUFFER_H
|
||||
#define GBUFFER_H
|
||||
|
||||
/*=========================================================================*/
|
||||
/* If we have not already loaded the standard library header, than we can */
|
||||
/* load it. */
|
||||
/*=========================================================================*/
|
||||
|
||||
#ifndef WWSTD_H
|
||||
#include "wwstd.h"
|
||||
#endif
|
||||
|
||||
#ifndef MCGAPRIM_H
|
||||
#include "mcgaprim.h"
|
||||
#endif
|
||||
|
||||
#ifndef BUFFER_H
|
||||
#include "buffer.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/*=========================================================================*/
|
||||
/* Define the screen width and height to make portability to other modules */
|
||||
/* easier. */
|
||||
/*=========================================================================*/
|
||||
#define DEFAULT_SCREEN_WIDTH 320
|
||||
#define DEFAULT_SCREEN_HEIGHT 200
|
||||
|
||||
/*=========================================================================*/
|
||||
/* Let the compiler know that a GraphicBufferClass exists so that it can */
|
||||
/* keep a pointer to it in a VideoViewPortClass. */
|
||||
/*=========================================================================*/
|
||||
class GraphicViewPortClass;
|
||||
class GraphicBufferClass;
|
||||
class VideoViewPortClass;
|
||||
class VideoBufferClass;
|
||||
|
||||
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass *ptr);
|
||||
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass &ptr);
|
||||
|
||||
/*=========================================================================*/
|
||||
/* GraphicViewPortClass - Holds viewport information on a viewport which */
|
||||
/* has been attached to a GraphicBuffer. A viewport is effectively a */
|
||||
/* rectangular subset of the full buffer which is used for clipping and */
|
||||
/* the like. */
|
||||
/* */
|
||||
/* char *Buffer - is the offset to view port buffer */
|
||||
/* int Width - is the width of view port */
|
||||
/* int Height - is the height of view port */
|
||||
/* int XAdd - is add value to go from the end of a line */
|
||||
/* to the beginning of the next line */
|
||||
/* int XPos; - x offset into its associated VideoBuffer */
|
||||
/* int YPos; - y offset into its associated VideoBuffer */
|
||||
/*=========================================================================*/
|
||||
class GraphicViewPortClass {
|
||||
public:
|
||||
/*===================================================================*/
|
||||
/* Define the base constructor and destructors for the class */
|
||||
/*===================================================================*/
|
||||
GraphicViewPortClass(GraphicBufferClass* graphic_buff, int x, int y, int w, int h);
|
||||
GraphicViewPortClass();
|
||||
~GraphicViewPortClass();
|
||||
|
||||
/*===================================================================*/
|
||||
/* define functions to get at the private data members */
|
||||
/*===================================================================*/
|
||||
long Get_Offset(void);
|
||||
int Get_Height(void);
|
||||
int Get_Width(void);
|
||||
int Get_XAdd(void);
|
||||
int Get_XPos(void);
|
||||
int Get_YPos(void);
|
||||
GraphicBufferClass *Get_Graphic_Buffer(void);
|
||||
|
||||
int Lock(void) const {return(TRUE);}
|
||||
void Unlock(void) const {}
|
||||
|
||||
/*===================================================================*/
|
||||
/* Define a function which allows us to change a video viewport on */
|
||||
/* the fly. */
|
||||
/*===================================================================*/
|
||||
BOOL Change(int x, int y, int w, int h);
|
||||
|
||||
/*===================================================================*/
|
||||
/* Define the set of common graphic functions that are supported by */
|
||||
/* both Graphic ViewPorts and VideoViewPorts. */
|
||||
/*===================================================================*/
|
||||
long Size_Of_Region(int w, int h);
|
||||
void Put_Pixel(int x, int y, unsigned char color);
|
||||
int Get_Pixel(int x, int y);
|
||||
void Clear(unsigned char color = 0);
|
||||
long To_Buffer(int x, int y, int w, int h, void *buff, long size);
|
||||
long To_Buffer(int x, int y, int w, int h, BufferClass *buff);
|
||||
long To_Buffer(BufferClass *buff);
|
||||
BOOL Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
|
||||
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
|
||||
BOOL Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
|
||||
BOOL Blit( GraphicViewPortClass& dest, BOOL trans = FALSE);
|
||||
BOOL Blit( VideoViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
|
||||
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
|
||||
BOOL Blit( VideoViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
|
||||
BOOL Blit( VideoViewPortClass& dest, BOOL trans = FALSE);
|
||||
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL);
|
||||
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap);
|
||||
BOOL Scale( GraphicViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL);
|
||||
BOOL Scale( GraphicViewPortClass &dest, char *remap);
|
||||
BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL);
|
||||
BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap);
|
||||
BOOL Scale( VideoViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL);
|
||||
BOOL Scale( VideoViewPortClass &dest, char *remap);
|
||||
unsigned long Print(char const *string, int x_pixel, int y_pixel, int fcolor, int bcolor);
|
||||
unsigned long Print(short num, int x_pixel, int y_pixel, int fcol, int bcol);
|
||||
unsigned long Print(int num, int x_pixel, int y_pixel, int fcol, int bcol);
|
||||
unsigned long Print(long num, int x_pixel, int y_pixel, int fcol, int bcol);
|
||||
|
||||
/*===================================================================*/
|
||||
/* Define the list of graphic functions which work only with a */
|
||||
/* graphic buffer. */
|
||||
/*===================================================================*/
|
||||
VOID Draw_Line(int sx, int sy, int dx, int dy, unsigned char color);
|
||||
VOID Draw_Rect(int sx, int sy, int dx, int dy, unsigned char color);
|
||||
VOID Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color);
|
||||
VOID Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1,
|
||||
int x2, int y2, int x3, int y3, int color);
|
||||
VOID Remap(int sx, int sy, int width, int height, VOID *remap);
|
||||
VOID Remap(VOID *remap);
|
||||
void Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap);
|
||||
void Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int clip_window);
|
||||
VOID Grey_Out_Region(int x, int y, int width, int height, int color);
|
||||
protected:
|
||||
/*===================================================================*/
|
||||
/* Define functions to attach the viewport to a graphicbuffer */
|
||||
/*===================================================================*/
|
||||
VOID Attach(GraphicBufferClass *graphic_buff, int x, int y, int w, int h);
|
||||
void Attach(GraphicBufferClass *video_buff, int w, int h);
|
||||
|
||||
/*===================================================================*/
|
||||
/* Define the data used by a GraphicViewPortClass */
|
||||
/*===================================================================*/
|
||||
long Offset; // offset to graphic page
|
||||
int Width; // width of graphic page
|
||||
int Height; // height of graphic page
|
||||
int XAdd; // xadd for graphic page (0)
|
||||
int XPos; // x offset in relation to graphicbuff
|
||||
int YPos; // y offset in relation to graphicbuff
|
||||
GraphicBufferClass *GraphicBuff; // related graphic buff
|
||||
};
|
||||
|
||||
/*=========================================================================*/
|
||||
/* GraphicBufferClass - A GraphicBuffer refers to an actual instance of an */
|
||||
/* allocated buffer. The GraphicBuffer may be drawn to directly */
|
||||
/* becuase it inherits a ViewPort which represents its physcial size. */
|
||||
/* */
|
||||
/* BYTE *Buffer - is the offset to graphic buffer */
|
||||
/* int Width - is the width of graphic buffer */
|
||||
/* int Height - is the height of graphic buffer */
|
||||
/* int XAdd - is the xadd of graphic buffer */
|
||||
/* int XPos; - will be 0 because it is graphicbuff */
|
||||
/* int YPos; - will be 0 because it is graphicbuff */
|
||||
/*=========================================================================*/
|
||||
class GraphicBufferClass : public GraphicViewPortClass, public BufferClass {
|
||||
public:
|
||||
GraphicBufferClass( long size = 64500, int w = DEFAULT_SCREEN_WIDTH, int h = DEFAULT_SCREEN_HEIGHT,
|
||||
VOID *buffer = 0);
|
||||
GraphicBufferClass(int w, int h, void *buffer = 0);
|
||||
~GraphicBufferClass();
|
||||
|
||||
// void Scale_Rotate(BitmapClass &bmp,const TPoint2D &pt,long scale=0x0100,unsigned char angle=0);
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_OFFSET -- Get offset for virtual view port class instance *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: long the offset for the virtual viewport instance *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/07/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long GraphicViewPortClass::Get_Offset(void)
|
||||
{
|
||||
return(Offset);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_HEIGHT -- Gets the height of a virtual viewport instance *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: WORD the height of the virtual viewport instance *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/07/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_Height(void)
|
||||
{
|
||||
return(Height);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_WIDTH -- Get the width of a virtual viewport instance *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: WORD the width of the virtual viewport instance *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/07/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_Width(void)
|
||||
{
|
||||
return(Width);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_XADD -- Get the X add offset for virtual viewport instance *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: WORD the xadd for a virtual viewport instance *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/07/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_XAdd(void)
|
||||
{
|
||||
return(XAdd);
|
||||
}
|
||||
/***************************************************************************
|
||||
* GVPC::GET_XPOS -- Get the x pos of the VP on the Video *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: WORD the x offset to VideoBufferClass *
|
||||
* *
|
||||
* HISTORY: *
|
||||
;* 08/22/1994 SKB : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_XPos(void)
|
||||
{
|
||||
return(XPos);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_YPOS -- Get the y pos of the VP on the video *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: WORD the x offset to VideoBufferClass *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
;* 08/22/1994 SKB : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_YPos(void)
|
||||
{
|
||||
return(YPos);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_GRAPHIC_BUFFER -- Get the graphic buffer of the VP. *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 08/22/1994 SKB : Created. *
|
||||
*=========================================================================*/
|
||||
inline GraphicBufferClass *GraphicViewPortClass::Get_Graphic_Buffer(void)
|
||||
{
|
||||
return (GraphicBuff);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::SIZE_OF_REGION -- stub to call curr graphic mode Size_Of_Region *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 03/01/1995 BWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long GraphicViewPortClass::Size_Of_Region(int w, int h)
|
||||
{
|
||||
return MCGA_Size_Of_Region(this, w, h);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::PUT_PIXEL -- stub to call curr graphic mode Put_Pixel *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline void GraphicViewPortClass::Put_Pixel(int x, int y, unsigned char color)
|
||||
{
|
||||
MCGA_Put_Pixel(this, x, y, color);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_PIXEL -- stub to call curr graphic mode Get_Pixel *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_Pixel(int x, int y)
|
||||
{
|
||||
return(MCGA_Get_Pixel(this, x, y));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::CLEAR -- stub to call curr graphic mode Clear *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline void GraphicViewPortClass::Clear(unsigned char color)
|
||||
{
|
||||
MCGA_Clear(this, color);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::TO_BUFFER -- stub 1 to call curr graphic mode To_Buffer *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, void *buff, long size)
|
||||
{
|
||||
return(MCGA_To_Buffer(this, x, y, w, h, buff, size));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::TO_BUFFER -- stub 2 to call curr graphic mode To_Buffer *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, BufferClass *buff)
|
||||
{
|
||||
return(MCGA_To_Buffer(this, x, y, w, h, buff->Get_Buffer(), buff->Get_Size()));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::TO_BUFFER -- stub 3 to call curr graphic mode To_Buffer *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long GraphicViewPortClass::To_Buffer(BufferClass *buff)
|
||||
{
|
||||
return(MCGA_To_Buffer(this, 0, 0, Width, Height, buff->Get_Buffer(), buff->Get_Size()));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::BLIT -- stub 1 to call curr graphic mode Blit to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
|
||||
int dy_pixel, int pixel_width, int pixel_height, BOOL trans)
|
||||
{
|
||||
return(Linear_Blit_To_Linear(this, &dest, x_pixel, y_pixel, dx_pixel, dy_pixel, pixel_width, pixel_height, trans));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::BLIT -- Stub 2 to call curr graphic mode Blit to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans)
|
||||
{
|
||||
return(Linear_Blit_To_Linear(this, &dest, 0, 0, dx, dy, Width, Height, trans));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::BLIT -- stub 3 to call curr graphic mode Blit to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, BOOL trans)
|
||||
{
|
||||
return(Linear_Blit_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, trans));
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::SCALE -- stub 1 to call curr graphic mode Scale to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans, char *remap)
|
||||
{
|
||||
return(Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, trans, remap));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::SCALE -- stub 2 to call curr graphic mode Scale to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap)
|
||||
{
|
||||
return(Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, FALSE, remap));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::SCALE -- stub 3 to call curr graphic mode Scale to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, BOOL trans, char *remap)
|
||||
{
|
||||
return(Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), trans, remap));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::SCALE -- stub 4 to call curr graphic mode Scale to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, char *remap)
|
||||
{
|
||||
return(Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), FALSE, remap));
|
||||
}
|
||||
/***************************************************************************
|
||||
* GVPC::PRINT -- stub func to print a text string *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/17/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline unsigned long GraphicViewPortClass::Print(char const *str, int x, int y, int fcol, int bcol)
|
||||
{
|
||||
return(MCGA_Print(this, str, x, y, fcol, bcol));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::PRINT -- Stub function to print an integer *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
*=========================================================================*/
|
||||
inline unsigned long GraphicViewPortClass::Print(int num, int x, int y, int fcol, int bcol)
|
||||
{
|
||||
char str[17];
|
||||
|
||||
|
||||
return(MCGA_Print(this, itoa(num, str, 10), x, y, fcol, bcol));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::PRINT -- Stub function to print a short to a graphic viewport *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
*=========================================================================*/
|
||||
inline unsigned long GraphicViewPortClass::Print(short num, int x, int y, int fcol, int bcol)
|
||||
{
|
||||
char str[17];
|
||||
|
||||
return(MCGA_Print(this, itoa(num, str, 10), x, y, fcol, bcol));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::PRINT -- stub function to print a long on a graphic view port *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
*=========================================================================*/
|
||||
inline unsigned long GraphicViewPortClass::Print(long num, int x, int y, int fcol, int bcol)
|
||||
{
|
||||
char str[33];
|
||||
|
||||
return(MCGA_Print(this, ltoa(num, str,10), x, y, fcol, bcol));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::DRAW_STAMP -- stub function to draw a tile on a graphic view port *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
*=========================================================================*/
|
||||
inline void GraphicViewPortClass::Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap)
|
||||
{
|
||||
MCGA_Draw_Stamp(this, icondata, icon, x_pixel, y_pixel, remap);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::DRAW_STAMP -- stub function to draw a tile on a graphic view port *
|
||||
* This version clips the tile to a window *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/31/1995 BWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline void GraphicViewPortClass::Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int clip_window)
|
||||
{
|
||||
MCGA_Draw_Stamp_Clip(this, icondata, icon, x_pixel, y_pixel, remap, WindowList[clip_window][WINDOWX]<<3, WindowList[clip_window][WINDOWY], WindowList[clip_window][WINDOWWIDTH]<<3, WindowList[clip_window][WINDOWHEIGHT]);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::DRAW_LINE -- Stub function to draw line in Graphic Viewport Class *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/16/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline VOID GraphicViewPortClass::Draw_Line(int sx, int sy, int dx, int dy, unsigned char color)
|
||||
{
|
||||
MCGA_Draw_Line(this, sx, sy, dx, dy, color);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::FILL_RECT -- Stub function to fill rectangle in a GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/16/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline VOID GraphicViewPortClass::Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color)
|
||||
{
|
||||
MCGA_Fill_Rect(this, sx, sy, dx, dy, color);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::REMAP -- Stub function to remap a GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/16/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline VOID GraphicViewPortClass::Remap(int sx, int sy, int width, int height, VOID *remap)
|
||||
{
|
||||
MCGA_Remap(this, sx, sy, width, height, remap);
|
||||
}
|
||||
inline VOID GraphicViewPortClass::Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1,
|
||||
int x2, int y2, int x3, int y3, int color)
|
||||
{
|
||||
MCGA_Fill_Quad(this, span_buff, x0, y0, x1, y1, x2, y2, x3, y3, color);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::REMAP -- Short form to remap an entire graphic view port *
|
||||
* *
|
||||
* INPUT: BYTE * to the remap table to use *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline VOID GraphicViewPortClass::Remap(VOID *remap)
|
||||
{
|
||||
MCGA_Remap(this, 0, 0, Width, Height, remap);
|
||||
}
|
||||
/*=========================================================================*/
|
||||
/* The following BufferClass functions are defined here because they act */
|
||||
/* on graphic viewports. */
|
||||
/*=========================================================================*/
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* BUFFER_TO_PAGE -- Generic 'c' callable form of Buffer_To_Page *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/12/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long Buffer_To_Page(int x, int y, int w, int h, void *Buffer, GraphicViewPortClass &view)
|
||||
{
|
||||
return(MCGA_Buffer_To_Page(x, y, w, h, Buffer, &view));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* BC::TO_PAGE -- Copys a buffer class to a page with definable w, h *
|
||||
* *
|
||||
* INPUT: int width - the width of copy region *
|
||||
* int height - the height of copy region *
|
||||
* GVPC& dest - virtual viewport to copy to *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* WARNINGS: x and y position are the upper left corner of the dest *
|
||||
* viewport *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long BufferClass::To_Page(int w, int h, GraphicViewPortClass &view)
|
||||
{
|
||||
return(MCGA_Buffer_To_Page(0, 0, w, h, Buffer, &view));
|
||||
}
|
||||
/***************************************************************************
|
||||
* BC::TO_PAGE -- Copys a buffer class to a page with definable w, h *
|
||||
* *
|
||||
* INPUT: GVPC& dest - virtual viewport to copy to *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* WARNINGS: x and y position are the upper left corner of the dest *
|
||||
* viewport. width and height are assumed to be the *
|
||||
* viewport's width and height. *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long BufferClass::To_Page(GraphicViewPortClass &view)
|
||||
{
|
||||
return(MCGA_Buffer_To_Page(0, 0, view.Get_Width(), view.Get_Height(), Buffer, &view));
|
||||
}
|
||||
/***************************************************************************
|
||||
* BC::TO_PAGE -- Copys a buffer class to a page with definable x, y, w, h *
|
||||
* *
|
||||
* INPUT: int x - x pixel on viewport to copy from *
|
||||
* int y - y pixel on viewport to copy from *
|
||||
* int width - the width of copy region *
|
||||
* int height - the height of copy region *
|
||||
* GVPC& dest - virtual viewport to copy to *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long BufferClass::To_Page(int x, int y, int w, int h, GraphicViewPortClass &view)
|
||||
{
|
||||
return(MCGA_Buffer_To_Page(x, y, w, h, Buffer, &view));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
892
WWFLAT32/MCGAPRIM/GBUFFER.H
Normal file
892
WWFLAT32/MCGAPRIM/GBUFFER.H
Normal file
@@ -0,0 +1,892 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** 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 : Westwood 32 Bit Library *
|
||||
* *
|
||||
* File Name : GBUFFER.H *
|
||||
* *
|
||||
* Programmer : Phil W. Gorrow *
|
||||
* *
|
||||
* Start Date : May 26, 1994 *
|
||||
* *
|
||||
* Last Update : January 17, 1995 [PWG] *
|
||||
* *
|
||||
***************************************************************************
|
||||
* *
|
||||
* This module contains the definition for the graphic buffer class. The *
|
||||
* primary functionality of the graphic buffer class is handled by inline *
|
||||
* functions that make a call through function pointers to the correct *
|
||||
* routine. This has two benefits: *
|
||||
* *
|
||||
* *
|
||||
* 1) C++ name mangling is not a big deal since the function pointers *
|
||||
* point to functions in standard C format. *
|
||||
* 2) The function pointers can be changed when we set a different *
|
||||
* graphic mode. This allows us to have both supervga and mcga *
|
||||
* routines present in memory at once. *
|
||||
* *
|
||||
* In the basic library, these functions point to stub routines which just *
|
||||
* return. This makes a product that just uses a graphic buffer take the *
|
||||
* minimum amount of code space. For programs that require MCGA or VESA *
|
||||
* support, all that is necessary to do is link either the MCGA or VESA *
|
||||
* specific libraries in, previous to WWLIB32. The linker will then *
|
||||
* overide the the necessary stub functions automatically. *
|
||||
* *
|
||||
* In addition, there are helpful inline function calls for parameter *
|
||||
* ellimination. This header file gives the defintion for all *
|
||||
* GraphicViewPort and GraphicBuffer classes. *
|
||||
* *
|
||||
* Terminology: *
|
||||
* *
|
||||
* Buffer Class - A class which consists of a pointer to an allocated *
|
||||
* buffer and the size of the buffer that was allocated. *
|
||||
* *
|
||||
* Graphic ViewPort - The Graphic ViewPort defines a window into a *
|
||||
* Graphic Buffer. This means that although a Graphic Buffer *
|
||||
* represents linear memory, this may not be true with a Graphic *
|
||||
* Viewport. All low level functions that act directly on a graphic *
|
||||
* viewport are included within this class. This includes but is not *
|
||||
* limited to most of the functions which can act on a Video Viewport *
|
||||
* Video Buffer. *
|
||||
* *
|
||||
* Graphic Buffer - A Graphic Buffer is an instance of an allocated buffer *
|
||||
* used to represent a rectangular region of graphics memory. *
|
||||
* The HidBuff and BackBuff are excellent examples of a Graphic Buffer. *
|
||||
* *
|
||||
* Below is a tree which shows the relationship of the VideoBuffer and *
|
||||
* Buffer classes to the GraphicBuffer class: *
|
||||
* *
|
||||
* BUFFER.H GBUFFER.H BUFFER.H VBUFFER.H *
|
||||
* ---------- ---------- ---------- ---------- *
|
||||
* | Buffer | | Graphic | | Buffer | | Video | *
|
||||
* | Class | | ViewPort | | Class | | ViewPort | *
|
||||
* ---------- ---------- ---------- ---------- *
|
||||
* \ / \ / *
|
||||
* \ / \ / *
|
||||
* ---------- ---------- *
|
||||
* | Graphic | | Video | *
|
||||
* | Buffer | | Buffer | *
|
||||
* ---------- ---------- *
|
||||
* GBUFFER.H VBUFFER.H *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* GBC::GraphicBufferClass -- inline constructor for GraphicBufferClass *
|
||||
* GVPC::Remap -- Short form to remap an entire graphic view port *
|
||||
* GVPC::Get_XPos -- Returns x offset for a graphic viewport class *
|
||||
* GVPC::Get_Ypos -- Return y offset in a GraphicViewPortClass *
|
||||
* VVPC::Get_XPos -- Get the x pos of the VP on the Video *
|
||||
* VVPC::Get_YPos -- Get the y pos of the VP on the video *
|
||||
* GBC::Get_Graphic_Buffer -- Get the graphic buffer of the VP. *
|
||||
* GVPC::Draw_Line -- Stub function to draw line in Graphic Viewport Class*
|
||||
* GVPC::Fill_Rect -- Stub function to fill rectangle in a GVPC *
|
||||
* GVPC::Remap -- Stub function to remap a GVPC *
|
||||
* GVPC::Print -- stub func to print a text string *
|
||||
* GVPC::Print -- Stub function to print an integer *
|
||||
* GVPC::Print -- Stub function to print a short to a graphic viewport *
|
||||
* GVPC::Print -- stub function to print a long on a graphic view port *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "window.h"
|
||||
|
||||
#ifndef GBUFFER_H
|
||||
#define GBUFFER_H
|
||||
|
||||
/*=========================================================================*/
|
||||
/* If we have not already loaded the standard library header, than we can */
|
||||
/* load it. */
|
||||
/*=========================================================================*/
|
||||
|
||||
#ifndef WWSTD_H
|
||||
#include "wwstd.h"
|
||||
#endif
|
||||
|
||||
#ifndef MCGAPRIM_H
|
||||
#include "mcgaprim.h"
|
||||
#endif
|
||||
|
||||
#ifndef BUFFER_H
|
||||
#include "buffer.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/*=========================================================================*/
|
||||
/* Define the screen width and height to make portability to other modules */
|
||||
/* easier. */
|
||||
/*=========================================================================*/
|
||||
#define DEFAULT_SCREEN_WIDTH 320
|
||||
#define DEFAULT_SCREEN_HEIGHT 200
|
||||
|
||||
/*=========================================================================*/
|
||||
/* Let the compiler know that a GraphicBufferClass exists so that it can */
|
||||
/* keep a pointer to it in a VideoViewPortClass. */
|
||||
/*=========================================================================*/
|
||||
class GraphicViewPortClass;
|
||||
class GraphicBufferClass;
|
||||
class VideoViewPortClass;
|
||||
class VideoBufferClass;
|
||||
|
||||
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass *ptr);
|
||||
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass &ptr);
|
||||
|
||||
/*=========================================================================*/
|
||||
/* GraphicViewPortClass - Holds viewport information on a viewport which */
|
||||
/* has been attached to a GraphicBuffer. A viewport is effectively a */
|
||||
/* rectangular subset of the full buffer which is used for clipping and */
|
||||
/* the like. */
|
||||
/* */
|
||||
/* char *Buffer - is the offset to view port buffer */
|
||||
/* int Width - is the width of view port */
|
||||
/* int Height - is the height of view port */
|
||||
/* int XAdd - is add value to go from the end of a line */
|
||||
/* to the beginning of the next line */
|
||||
/* int XPos; - x offset into its associated VideoBuffer */
|
||||
/* int YPos; - y offset into its associated VideoBuffer */
|
||||
/*=========================================================================*/
|
||||
class GraphicViewPortClass {
|
||||
public:
|
||||
/*===================================================================*/
|
||||
/* Define the base constructor and destructors for the class */
|
||||
/*===================================================================*/
|
||||
GraphicViewPortClass(GraphicBufferClass* graphic_buff, int x, int y, int w, int h);
|
||||
GraphicViewPortClass();
|
||||
~GraphicViewPortClass();
|
||||
|
||||
/*===================================================================*/
|
||||
/* define functions to get at the private data members */
|
||||
/*===================================================================*/
|
||||
long Get_Offset(void);
|
||||
int Get_Height(void);
|
||||
int Get_Width(void);
|
||||
int Get_XAdd(void);
|
||||
int Get_XPos(void);
|
||||
int Get_YPos(void);
|
||||
GraphicBufferClass *Get_Graphic_Buffer(void);
|
||||
|
||||
int Lock(void) const {return(TRUE);}
|
||||
void Unlock(void) const {}
|
||||
|
||||
/*===================================================================*/
|
||||
/* Define a function which allows us to change a video viewport on */
|
||||
/* the fly. */
|
||||
/*===================================================================*/
|
||||
BOOL Change(int x, int y, int w, int h);
|
||||
|
||||
/*===================================================================*/
|
||||
/* Define the set of common graphic functions that are supported by */
|
||||
/* both Graphic ViewPorts and VideoViewPorts. */
|
||||
/*===================================================================*/
|
||||
long Size_Of_Region(int w, int h);
|
||||
void Put_Pixel(int x, int y, unsigned char color);
|
||||
int Get_Pixel(int x, int y);
|
||||
void Clear(unsigned char color = 0);
|
||||
long To_Buffer(int x, int y, int w, int h, void *buff, long size);
|
||||
long To_Buffer(int x, int y, int w, int h, BufferClass *buff);
|
||||
long To_Buffer(BufferClass *buff);
|
||||
BOOL Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
|
||||
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
|
||||
BOOL Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
|
||||
BOOL Blit( GraphicViewPortClass& dest, BOOL trans = FALSE);
|
||||
BOOL Blit( VideoViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
|
||||
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
|
||||
BOOL Blit( VideoViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
|
||||
BOOL Blit( VideoViewPortClass& dest, BOOL trans = FALSE);
|
||||
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL);
|
||||
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap);
|
||||
BOOL Scale( GraphicViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL);
|
||||
BOOL Scale( GraphicViewPortClass &dest, char *remap);
|
||||
BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL);
|
||||
BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap);
|
||||
BOOL Scale( VideoViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL);
|
||||
BOOL Scale( VideoViewPortClass &dest, char *remap);
|
||||
unsigned long Print(char const *string, int x_pixel, int y_pixel, int fcolor, int bcolor);
|
||||
unsigned long Print(short num, int x_pixel, int y_pixel, int fcol, int bcol);
|
||||
unsigned long Print(int num, int x_pixel, int y_pixel, int fcol, int bcol);
|
||||
unsigned long Print(long num, int x_pixel, int y_pixel, int fcol, int bcol);
|
||||
|
||||
/*===================================================================*/
|
||||
/* Define the list of graphic functions which work only with a */
|
||||
/* graphic buffer. */
|
||||
/*===================================================================*/
|
||||
VOID Draw_Line(int sx, int sy, int dx, int dy, unsigned char color);
|
||||
VOID Draw_Rect(int sx, int sy, int dx, int dy, unsigned char color);
|
||||
VOID Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color);
|
||||
VOID Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1,
|
||||
int x2, int y2, int x3, int y3, int color);
|
||||
VOID Remap(int sx, int sy, int width, int height, VOID *remap);
|
||||
VOID Remap(VOID *remap);
|
||||
void Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap);
|
||||
void Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int clip_window);
|
||||
VOID Grey_Out_Region(int x, int y, int width, int height, int color);
|
||||
protected:
|
||||
/*===================================================================*/
|
||||
/* Define functions to attach the viewport to a graphicbuffer */
|
||||
/*===================================================================*/
|
||||
VOID Attach(GraphicBufferClass *graphic_buff, int x, int y, int w, int h);
|
||||
void Attach(GraphicBufferClass *video_buff, int w, int h);
|
||||
|
||||
/*===================================================================*/
|
||||
/* Define the data used by a GraphicViewPortClass */
|
||||
/*===================================================================*/
|
||||
long Offset; // offset to graphic page
|
||||
int Width; // width of graphic page
|
||||
int Height; // height of graphic page
|
||||
int XAdd; // xadd for graphic page (0)
|
||||
int XPos; // x offset in relation to graphicbuff
|
||||
int YPos; // y offset in relation to graphicbuff
|
||||
GraphicBufferClass *GraphicBuff; // related graphic buff
|
||||
};
|
||||
|
||||
/*=========================================================================*/
|
||||
/* GraphicBufferClass - A GraphicBuffer refers to an actual instance of an */
|
||||
/* allocated buffer. The GraphicBuffer may be drawn to directly */
|
||||
/* becuase it inherits a ViewPort which represents its physcial size. */
|
||||
/* */
|
||||
/* BYTE *Buffer - is the offset to graphic buffer */
|
||||
/* int Width - is the width of graphic buffer */
|
||||
/* int Height - is the height of graphic buffer */
|
||||
/* int XAdd - is the xadd of graphic buffer */
|
||||
/* int XPos; - will be 0 because it is graphicbuff */
|
||||
/* int YPos; - will be 0 because it is graphicbuff */
|
||||
/*=========================================================================*/
|
||||
class GraphicBufferClass : public GraphicViewPortClass, public BufferClass {
|
||||
public:
|
||||
GraphicBufferClass( long size = 64500, int w = DEFAULT_SCREEN_WIDTH, int h = DEFAULT_SCREEN_HEIGHT,
|
||||
VOID *buffer = 0);
|
||||
GraphicBufferClass(int w, int h, void *buffer = 0);
|
||||
~GraphicBufferClass();
|
||||
|
||||
// void Scale_Rotate(BitmapClass &bmp,const TPoint2D &pt,long scale=0x0100,unsigned char angle=0);
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_OFFSET -- Get offset for virtual view port class instance *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: long the offset for the virtual viewport instance *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/07/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long GraphicViewPortClass::Get_Offset(void)
|
||||
{
|
||||
return(Offset);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_HEIGHT -- Gets the height of a virtual viewport instance *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: WORD the height of the virtual viewport instance *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/07/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_Height(void)
|
||||
{
|
||||
return(Height);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_WIDTH -- Get the width of a virtual viewport instance *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: WORD the width of the virtual viewport instance *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/07/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_Width(void)
|
||||
{
|
||||
return(Width);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_XADD -- Get the X add offset for virtual viewport instance *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: WORD the xadd for a virtual viewport instance *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/07/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_XAdd(void)
|
||||
{
|
||||
return(XAdd);
|
||||
}
|
||||
/***************************************************************************
|
||||
* GVPC::GET_XPOS -- Get the x pos of the VP on the Video *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: WORD the x offset to VideoBufferClass *
|
||||
* *
|
||||
* HISTORY: *
|
||||
;* 08/22/1994 SKB : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_XPos(void)
|
||||
{
|
||||
return(XPos);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_YPOS -- Get the y pos of the VP on the video *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: WORD the x offset to VideoBufferClass *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
;* 08/22/1994 SKB : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_YPos(void)
|
||||
{
|
||||
return(YPos);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_GRAPHIC_BUFFER -- Get the graphic buffer of the VP. *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 08/22/1994 SKB : Created. *
|
||||
*=========================================================================*/
|
||||
inline GraphicBufferClass *GraphicViewPortClass::Get_Graphic_Buffer(void)
|
||||
{
|
||||
return (GraphicBuff);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::SIZE_OF_REGION -- stub to call curr graphic mode Size_Of_Region *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 03/01/1995 BWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long GraphicViewPortClass::Size_Of_Region(int w, int h)
|
||||
{
|
||||
return MCGA_Size_Of_Region(this, w, h);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::PUT_PIXEL -- stub to call curr graphic mode Put_Pixel *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline void GraphicViewPortClass::Put_Pixel(int x, int y, unsigned char color)
|
||||
{
|
||||
MCGA_Put_Pixel(this, x, y, color);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::GET_PIXEL -- stub to call curr graphic mode Get_Pixel *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline int GraphicViewPortClass::Get_Pixel(int x, int y)
|
||||
{
|
||||
return(MCGA_Get_Pixel(this, x, y));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::CLEAR -- stub to call curr graphic mode Clear *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline void GraphicViewPortClass::Clear(unsigned char color)
|
||||
{
|
||||
MCGA_Clear(this, color);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::TO_BUFFER -- stub 1 to call curr graphic mode To_Buffer *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, void *buff, long size)
|
||||
{
|
||||
return(MCGA_To_Buffer(this, x, y, w, h, buff, size));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::TO_BUFFER -- stub 2 to call curr graphic mode To_Buffer *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, BufferClass *buff)
|
||||
{
|
||||
return(MCGA_To_Buffer(this, x, y, w, h, buff->Get_Buffer(), buff->Get_Size()));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::TO_BUFFER -- stub 3 to call curr graphic mode To_Buffer *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long GraphicViewPortClass::To_Buffer(BufferClass *buff)
|
||||
{
|
||||
return(MCGA_To_Buffer(this, 0, 0, Width, Height, buff->Get_Buffer(), buff->Get_Size()));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::BLIT -- stub 1 to call curr graphic mode Blit to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
|
||||
int dy_pixel, int pixel_width, int pixel_height, BOOL trans)
|
||||
{
|
||||
return(Linear_Blit_To_Linear(this, &dest, x_pixel, y_pixel, dx_pixel, dy_pixel, pixel_width, pixel_height, trans));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::BLIT -- Stub 2 to call curr graphic mode Blit to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans)
|
||||
{
|
||||
return(Linear_Blit_To_Linear(this, &dest, 0, 0, dx, dy, Width, Height, trans));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::BLIT -- stub 3 to call curr graphic mode Blit to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, BOOL trans)
|
||||
{
|
||||
return(Linear_Blit_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, trans));
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::SCALE -- stub 1 to call curr graphic mode Scale to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans, char *remap)
|
||||
{
|
||||
return(Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, trans, remap));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::SCALE -- stub 2 to call curr graphic mode Scale to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
|
||||
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap)
|
||||
{
|
||||
return(Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, FALSE, remap));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::SCALE -- stub 3 to call curr graphic mode Scale to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, BOOL trans, char *remap)
|
||||
{
|
||||
return(Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), trans, remap));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::SCALE -- stub 4 to call curr graphic mode Scale to GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/06/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, char *remap)
|
||||
{
|
||||
return(Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), FALSE, remap));
|
||||
}
|
||||
/***************************************************************************
|
||||
* GVPC::PRINT -- stub func to print a text string *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/17/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline unsigned long GraphicViewPortClass::Print(char const *str, int x, int y, int fcol, int bcol)
|
||||
{
|
||||
return(MCGA_Print(this, str, x, y, fcol, bcol));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::PRINT -- Stub function to print an integer *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
*=========================================================================*/
|
||||
inline unsigned long GraphicViewPortClass::Print(int num, int x, int y, int fcol, int bcol)
|
||||
{
|
||||
char str[17];
|
||||
|
||||
|
||||
return(MCGA_Print(this, itoa(num, str, 10), x, y, fcol, bcol));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::PRINT -- Stub function to print a short to a graphic viewport *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
*=========================================================================*/
|
||||
inline unsigned long GraphicViewPortClass::Print(short num, int x, int y, int fcol, int bcol)
|
||||
{
|
||||
char str[17];
|
||||
|
||||
return(MCGA_Print(this, itoa(num, str, 10), x, y, fcol, bcol));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::PRINT -- stub function to print a long on a graphic view port *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
*=========================================================================*/
|
||||
inline unsigned long GraphicViewPortClass::Print(long num, int x, int y, int fcol, int bcol)
|
||||
{
|
||||
char str[33];
|
||||
|
||||
return(MCGA_Print(this, ltoa(num, str,10), x, y, fcol, bcol));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::DRAW_STAMP -- stub function to draw a tile on a graphic view port *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
*=========================================================================*/
|
||||
inline void GraphicViewPortClass::Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap)
|
||||
{
|
||||
MCGA_Draw_Stamp(this, icondata, icon, x_pixel, y_pixel, remap);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::DRAW_STAMP -- stub function to draw a tile on a graphic view port *
|
||||
* This version clips the tile to a window *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/31/1995 BWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline void GraphicViewPortClass::Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int clip_window)
|
||||
{
|
||||
MCGA_Draw_Stamp_Clip(this, icondata, icon, x_pixel, y_pixel, remap, WindowList[clip_window][WINDOWX], WindowList[clip_window][WINDOWY], WindowList[clip_window][WINDOWWIDTH], WindowList[clip_window][WINDOWHEIGHT]);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::DRAW_LINE -- Stub function to draw line in Graphic Viewport Class *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/16/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline VOID GraphicViewPortClass::Draw_Line(int sx, int sy, int dx, int dy, unsigned char color)
|
||||
{
|
||||
MCGA_Draw_Line(this, sx, sy, dx, dy, color);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::FILL_RECT -- Stub function to fill rectangle in a GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/16/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline VOID GraphicViewPortClass::Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color)
|
||||
{
|
||||
MCGA_Fill_Rect(this, sx, sy, dx, dy, color);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::REMAP -- Stub function to remap a GVPC *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/16/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline VOID GraphicViewPortClass::Remap(int sx, int sy, int width, int height, VOID *remap)
|
||||
{
|
||||
MCGA_Remap(this, sx, sy, width, height, remap);
|
||||
}
|
||||
inline VOID GraphicViewPortClass::Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1,
|
||||
int x2, int y2, int x3, int y3, int color)
|
||||
{
|
||||
MCGA_Fill_Quad(this, span_buff, x0, y0, x1, y1, x2, y2, x3, y3, color);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* GVPC::REMAP -- Short form to remap an entire graphic view port *
|
||||
* *
|
||||
* INPUT: BYTE * to the remap table to use *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline VOID GraphicViewPortClass::Remap(VOID *remap)
|
||||
{
|
||||
MCGA_Remap(this, 0, 0, Width, Height, remap);
|
||||
}
|
||||
/*=========================================================================*/
|
||||
/* The following BufferClass functions are defined here because they act */
|
||||
/* on graphic viewports. */
|
||||
/*=========================================================================*/
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* BUFFER_TO_PAGE -- Generic 'c' callable form of Buffer_To_Page *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/12/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long Buffer_To_Page(int x, int y, int w, int h, void *Buffer, GraphicViewPortClass &view)
|
||||
{
|
||||
return(MCGA_Buffer_To_Page(x, y, w, h, Buffer, &view));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* BC::TO_PAGE -- Copys a buffer class to a page with definable w, h *
|
||||
* *
|
||||
* INPUT: int width - the width of copy region *
|
||||
* int height - the height of copy region *
|
||||
* GVPC& dest - virtual viewport to copy to *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* WARNINGS: x and y position are the upper left corner of the dest *
|
||||
* viewport *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long BufferClass::To_Page(int w, int h, GraphicViewPortClass &view)
|
||||
{
|
||||
return(MCGA_Buffer_To_Page(0, 0, w, h, Buffer, &view));
|
||||
}
|
||||
/***************************************************************************
|
||||
* BC::TO_PAGE -- Copys a buffer class to a page with definable w, h *
|
||||
* *
|
||||
* INPUT: GVPC& dest - virtual viewport to copy to *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* WARNINGS: x and y position are the upper left corner of the dest *
|
||||
* viewport. width and height are assumed to be the *
|
||||
* viewport's width and height. *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long BufferClass::To_Page(GraphicViewPortClass &view)
|
||||
{
|
||||
return(MCGA_Buffer_To_Page(0, 0, view.Get_Width(), view.Get_Height(), Buffer, &view));
|
||||
}
|
||||
/***************************************************************************
|
||||
* BC::TO_PAGE -- Copys a buffer class to a page with definable x, y, w, h *
|
||||
* *
|
||||
* INPUT: int x - x pixel on viewport to copy from *
|
||||
* int y - y pixel on viewport to copy from *
|
||||
* int width - the width of copy region *
|
||||
* int height - the height of copy region *
|
||||
* GVPC& dest - virtual viewport to copy to *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 07/01/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
inline long BufferClass::To_Page(int x, int y, int w, int h, GraphicViewPortClass &view)
|
||||
{
|
||||
return(MCGA_Buffer_To_Page(x, y, w, h, Buffer, &view));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
60
WWFLAT32/MCGAPRIM/GBUFFER.INC
Normal file
60
WWFLAT32/MCGAPRIM/GBUFFER.INC
Normal file
@@ -0,0 +1,60 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 Bit Library *
|
||||
;* *
|
||||
;* File Name : GBUFFER.INC *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : May 26, 1994 *
|
||||
;* *
|
||||
;* Last Update : May 26, 1994 [PWG] *
|
||||
;* *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
;******************************************************************************
|
||||
; Much testing was done to determine that only when there are 14 or more bytes
|
||||
; being copied does it speed the time it takes to do copies in this algorithm.
|
||||
; For this reason and because 1 and 2 byte copies crash, is the special case
|
||||
; used. SKB 4/21/94. Tested on 486 66mhz. Copied by PWG 6/7/04.
|
||||
OPTIMAL_BYTE_COPY equ 14
|
||||
|
||||
STRUC GraphicViewPort
|
||||
GVPOffset DD ? ; offset to virtual viewport
|
||||
GVPWidth DD ? ; width of virtual viewport
|
||||
GVPHeight DD ? ; height of virtual viewport
|
||||
GVPXAdd DD ? ; x mod to get to next line
|
||||
GVPXPos DD ? ; x pos relative to Graphic Buff
|
||||
GVPYPos DD ? ; y pos relative to Graphic Buff
|
||||
GVPBuffPtr DD ? ; ptr to associated Graphic Buff
|
||||
ENDS
|
||||
|
||||
STRUC VideoViewPort
|
||||
VIVPOffset DD ? ; offset to virtual viewport
|
||||
VIVPWidth DD ? ; width of virtual viewport
|
||||
VIVPHeight DD ? ; height of virtual viewport
|
||||
VIVPXAdd DD ? ; x mod to get to next line
|
||||
VIVPXPos DD ? ; x pos relative to Graphic Buff
|
||||
VIVPYPos DD ? ; y pos relative to Graphic Buff
|
||||
VIVPBuffPtr DD ? ; ptr to associated Graphic Buff
|
||||
ENDS
|
115
WWFLAT32/MCGAPRIM/GETCLIP.ASM
Normal file
115
WWFLAT32/MCGAPRIM/GETCLIP.ASM
Normal file
@@ -0,0 +1,115 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : BITBLIT.ASM *
|
||||
;* *
|
||||
;* Programmer : Julio R. Jerez *
|
||||
;* *
|
||||
;* Start Date : Feb 6, 1995 *
|
||||
;* *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
LOCALS ??
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE "gbuffer.inc"
|
||||
|
||||
|
||||
; typedef struct {
|
||||
; int x0 , y0 ;
|
||||
; int x1 , y1 ;
|
||||
; } CLIP_WIN ;
|
||||
; Note for efficiency reasons x1 must be >= x0 and y1 >= y0
|
||||
; int get_clip ( CLIP_WIN * window , CLIP_WIN * sorce_rect ) ;
|
||||
|
||||
CODESEG
|
||||
|
||||
PROC get_clip C near
|
||||
USES eax , ebx
|
||||
|
||||
;*===================================================================
|
||||
;* define the arguements that our function takes.
|
||||
;*===================================================================
|
||||
ARG win : dword
|
||||
ARG rect : dword
|
||||
|
||||
|
||||
mov edi , [ rect ]
|
||||
mov esi , [ win ]
|
||||
xor eax , eax
|
||||
xor edx , edx
|
||||
|
||||
mov ecx , [ (RECTANGLE edi) . x0 ]
|
||||
mov ebx , [ (RECTANGLE edi) . x1 ]
|
||||
sub ecx , [ (RECTANGLE esi) . x0 ]
|
||||
sub ebx , [ (RECTANGLE esi) . x0 ]
|
||||
shld eax , ecx , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
; mov ebx , [ (RECTANGLE esi) . x1 ]
|
||||
; inc ebx
|
||||
; mov [ rect ] , ebx
|
||||
mov ecx , [ (RECTANGLE edi) . x0 ]
|
||||
mov ebx , [ (RECTANGLE edi) . x1 ]
|
||||
sub ecx , [ (RECTANGLE esi) . x1 ]
|
||||
sub ebx , [ (RECTANGLE esi) . x1 ]
|
||||
dec ecx
|
||||
dec ebx
|
||||
shld eax , ecx , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
mov ecx , [ (RECTANGLE edi) . y0 ]
|
||||
mov ebx , [ (RECTANGLE edi) . y1 ]
|
||||
sub ecx , [ (RECTANGLE esi) . y0 ]
|
||||
sub ebx , [ (RECTANGLE esi) . y0 ]
|
||||
shld eax , ecx , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
; mov ebx , [ (RECTANGLE esi) . y1 ]
|
||||
; inc ebx
|
||||
; mov [ rect ] , ebx
|
||||
mov ecx , [ (RECTANGLE edi) . y0 ]
|
||||
mov ebx , [ (RECTANGLE edi) . y1 ]
|
||||
sub ecx , [ (RECTANGLE esi) . y1 ]
|
||||
sub ebx , [ (RECTANGLE esi) . y1 ]
|
||||
dec ecx
|
||||
dec ebx
|
||||
shld eax , ecx , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
xor al , 5
|
||||
xor dl , 5
|
||||
mov ah , dl
|
||||
ret
|
||||
ENDP get_clip
|
||||
|
||||
|
||||
|
||||
END
|
105
WWFLAT32/MCGAPRIM/GETPIX.ASM
Normal file
105
WWFLAT32/MCGAPRIM/GETPIX.ASM
Normal file
@@ -0,0 +1,105 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Clear the Full Mcga Screen *
|
||||
;* *
|
||||
;* File Name : GETPIXEL.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 7, 1994 *
|
||||
;* *
|
||||
;* Last Update : June 7, 1994 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* VVPC::Clear -- Clears a virtual viewport instance *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* VVPC::GET_PIXEL -- Gets a pixel from the current view port *
|
||||
;* *
|
||||
;* INPUT: WORD the x pixel on the screen. *
|
||||
;* WORD the y pixel on the screen. *
|
||||
;* *
|
||||
;* OUTPUT: UBYTE the pixel at the specified location *
|
||||
;* *
|
||||
;* WARNING: If pixel is to be placed outside of the viewport then *
|
||||
;* this routine will abort. *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 06/07/1994 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC MCGA_Get_Pixel C near
|
||||
USES ebx,ecx,edx,edi
|
||||
|
||||
ARG this:DWORD ; this is a member function
|
||||
ARG x_pixel:DWORD ; x position of pixel to set
|
||||
ARG y_pixel:DWORD ; y position of pixel to set
|
||||
|
||||
;*===================================================================
|
||||
; Get the viewport information and put bytes per row in ecx
|
||||
;*===================================================================
|
||||
mov ebx,[this] ; get a pointer to viewport
|
||||
xor eax,eax
|
||||
mov edi,[(GraphicViewPort ebx).GVPOffset] ; get the correct offset
|
||||
mov ecx,[(GraphicViewPort ebx).GVPHeight] ; edx = height of viewport
|
||||
mov edx,[(GraphicViewPort ebx).GVPWidth] ; ecx = width of viewport
|
||||
|
||||
;*===================================================================
|
||||
; Verify that the X pixel offset if legal
|
||||
;*===================================================================
|
||||
mov eax,[x_pixel] ; find the x position
|
||||
cmp eax,edx ; is it out of bounds
|
||||
jae short ??exit ; if so then get out
|
||||
add edi,eax ; otherwise add in offset
|
||||
|
||||
;*===================================================================
|
||||
; Verify that the Y pixel offset if legal
|
||||
;*===================================================================
|
||||
mov eax,[y_pixel] ; get the y position
|
||||
cmp eax,ecx ; is it out of bounds
|
||||
jae ??exit ; if so then get out
|
||||
add edx,[(GraphicViewPort ebx).GVPXAdd] ; otherwise find bytes per row
|
||||
mul edx ; offset = bytes per row * y
|
||||
add edi,eax ; add it into the offset
|
||||
|
||||
;*===================================================================
|
||||
; Write the pixel to the screen
|
||||
;*===================================================================
|
||||
xor eax,eax ; clear the word
|
||||
mov al,[edi] ; read in the pixel
|
||||
??exit:
|
||||
ret
|
||||
ENDP MCGA_Get_Pixel
|
||||
|
||||
END
|
214
WWFLAT32/MCGAPRIM/MAKEFILE
Normal file
214
WWFLAT32/MCGAPRIM/MAKEFILE
Normal file
@@ -0,0 +1,214 @@
|
||||
#
|
||||
# Command & Conquer Red Alert(tm)
|
||||
# Copyright 2025 Electronic Arts Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#***************************************************************************
|
||||
#** 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 Library .LIB makefile *
|
||||
#* *
|
||||
#* File Name : MAKEFILE *
|
||||
#* *
|
||||
#* Programmer : Julio R. Jerez *
|
||||
#* *
|
||||
#* Start Date : Jan 26, 1995 *
|
||||
#* *
|
||||
#* *
|
||||
#*-------------------------------------------------------------------------*
|
||||
#* *
|
||||
#* Required environment variables: *
|
||||
#* WWFLAT = your root WWFLAT path *
|
||||
#* WWVCS = root directory for wwlib version control archive *
|
||||
#* WATCOM = your Watcom installation path *
|
||||
#* *
|
||||
#* Required changes to makefile: *
|
||||
#* PROJ_NAME = name of the library you're building *
|
||||
#* OBJECTS = list of objects in your library *
|
||||
#* *
|
||||
#* Optional changes to makefile: *
|
||||
#* PROJ_DIR = full pathname of your working directory *
|
||||
#* .path.xxx = full pathname where various file types live *
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Verify user's environment
|
||||
#---------------------------------------------------------------------------
|
||||
!ifndef %WWFLAT
|
||||
!error WWFLAT Environment var not configured.
|
||||
!endif
|
||||
|
||||
|
||||
!ifndef %WWVCS
|
||||
!error WWVCS Environment var not configured.
|
||||
!endif
|
||||
|
||||
!ifndef %WATCOM
|
||||
!error WATCOM Environment var not configured.
|
||||
!endif
|
||||
|
||||
|
||||
#===========================================================================
|
||||
# User-defined section: the user should tailor this section for each project
|
||||
#===========================================================================
|
||||
|
||||
PROJ_NAME = mcgaprim
|
||||
PROJ_DIR = $(%WWFLAT)\$(PROJ_NAME)
|
||||
LIB_DIR = $(%WWFLAT)\lib
|
||||
|
||||
!include $(%WWFLAT)\project.cfg
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project-dependent variables
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
OBJECTS = &
|
||||
bitblit.obj &
|
||||
buffer.obj &
|
||||
buffglbl.obj &
|
||||
clear.obj &
|
||||
drawline.obj &
|
||||
drawrect.obj &
|
||||
fillquad.obj &
|
||||
fillrect.obj &
|
||||
gbuffer.obj &
|
||||
getclip.obj &
|
||||
getpix.obj &
|
||||
putpix.obj &
|
||||
remap.obj &
|
||||
scale.obj &
|
||||
shadow.obj &
|
||||
stamp.obj &
|
||||
szregion.obj &
|
||||
tobuff.obj &
|
||||
topage.obj &
|
||||
txtprnt.obj &
|
||||
vbuffer.obj &
|
||||
vclear.obj &
|
||||
vesa.obj &
|
||||
vgetpix.obj &
|
||||
vlbtove.obj &
|
||||
vputpix.obj &
|
||||
vscale.obj &
|
||||
vscltove.obj &
|
||||
vtobuff.obj &
|
||||
vtopage.obj &
|
||||
vtxtprnt.obj &
|
||||
vvblit.obj &
|
||||
vvetolb.obj &
|
||||
vvetoscl.obj
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Path macros: one path for each file type.
|
||||
# These paths are used to tell make where to find/put each file type.
|
||||
#---------------------------------------------------------------------------
|
||||
.asm: $(PROJ_DIR)
|
||||
.c: $(PROJ_DIR)
|
||||
.cpp: $(PROJ_DIR)
|
||||
.h: $(PROJ_DIR)
|
||||
.obj: $(PROJ_DIR)
|
||||
.lib: $(%WWFLAT)\lib
|
||||
.exe: $(PROJ_DIR)
|
||||
|
||||
#===========================================================================
|
||||
# Pre-defined section: there should be little need to modify this section.
|
||||
#===========================================================================
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Tools/commands
|
||||
#---------------------------------------------------------------------------
|
||||
C_CMD = wcc386
|
||||
CPP_CMD = wpp386
|
||||
LIB_CMD = wlib
|
||||
LINK_CMD = wlink
|
||||
ASM_CMD = tasm32
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Include & library paths
|
||||
# If LIB & INCLUDE are already defined, they are used in addition to the
|
||||
# WWLIB32 lib & include; otherwise, they're constructed from
|
||||
# BCDIR & TNTDIR
|
||||
#---------------------------------------------------------------------------
|
||||
LIBPATH = $(%WWFLAT)\LIB;$(%WATCOM)\LIB
|
||||
INCLUDEPATH = $(%WWFLAT)\INCLUDE;$(%WATCOM)\H
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Implicit rules
|
||||
# Compiler:
|
||||
# ($< = full dependent with path)
|
||||
# Assembler:
|
||||
# output obj's are constructed from .obj: & the $& macro
|
||||
# ($< = full dependent with path)
|
||||
# tasm's cfg file is not invoked as a response file.
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
.c.obj: $(%WWFLAT)\project.cfg .AUTODEPEND
|
||||
$(C_CMD) $(CC_CFG) $<
|
||||
|
||||
.cpp.obj: $(%WWFLAT)\project.cfg .AUTODEPEND
|
||||
$(CPP_CMD) $(CC_CFG) $<
|
||||
|
||||
.asm.obj: $(%WWFLAT)\project.cfg
|
||||
$(ASM_CMD) $(ASM_CFG) $<
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Default target: configuration files & library (in that order)
|
||||
#---------------------------------------------------------------------------
|
||||
all: $(LIB_DIR)\$(PROJ_NAME).lib .SYMBOLIC
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build the library
|
||||
# The original library is deleted by the librarian
|
||||
# Lib objects & -+ commands are constructed by substituting within the
|
||||
# $^@ macro (which expands to all target dependents, separated with
|
||||
# spaces)
|
||||
# Tlib's cfg file is not invoked as a response file.
|
||||
# All headers & source files are copied into WWFLAT\SRCDEBUG, for debugging
|
||||
#---------------------------------------------------------------------------
|
||||
$(LIB_DIR)\$(PROJ_NAME).lib: $(OBJECTS) objects.lbc
|
||||
copy *.h $(%WWFLAT)\include
|
||||
copy *.inc $(%WWFLAT)\include
|
||||
copy *.cpp $(%WWFLAT)\srcdebug
|
||||
copy *.asm $(%WWFLAT)\srcdebug
|
||||
$(LIB_CMD) $(LIB_CFG) $^@ @objects.lbc
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Objects now have a link file which is NOT generated everytime. Instead
|
||||
# it just has its own dependacy rule.
|
||||
#---------------------------------------------------------------------------
|
||||
objects.lbc : $(OBJECTS)
|
||||
%create $^@
|
||||
for %index in ($(OBJECTS)) do %append $^@ +%index
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Create the test directory and make it.
|
||||
#---------------------------------------------------------------------------
|
||||
test:
|
||||
mkdir test
|
||||
cd test
|
||||
copy $(%WWVCS)\$(PROJ_NAME)\test\vcs.cfg
|
||||
update
|
||||
wmake
|
||||
cd ..
|
||||
|
||||
#**************************** End of makefile ******************************
|
||||
|
107
WWFLAT32/MCGAPRIM/MCGAPRIM.H
Normal file
107
WWFLAT32/MCGAPRIM/MCGAPRIM.H
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef MCGAPRIM_H
|
||||
#define MCGAPRIM_H
|
||||
|
||||
|
||||
#ifndef WWSTD_H
|
||||
#include "wwstd.h"
|
||||
#endif
|
||||
|
||||
class GraphicViewPortClass;
|
||||
class GraphicBufferClass;
|
||||
class VideoBufferClass;
|
||||
/*=========================================================================*/
|
||||
/* Define functions which have not under-gone name mangling */
|
||||
/*=========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*======================================================================*/
|
||||
/* Externs for all of the common functions between the video buffer */
|
||||
/* class and the graphic buffer class. */
|
||||
/*======================================================================*/
|
||||
extern long MCGA_Size_Of_Region(void *thisptr, int w, int h);
|
||||
|
||||
extern void MCGA_Put_Pixel(void * thisptr, int x, int y, unsigned char color);
|
||||
extern int MCGA_Get_Pixel(void * thisptr, int x, int y);
|
||||
extern void MCGA_Clear(void *thisptr, unsigned char color);
|
||||
extern long MCGA_To_Buffer(void *thisptr, int x, int y, int w, int h, void *buff, long size);
|
||||
extern long MCGA_Buffer_To_Page(int x, int y, int w, int h, void *Buffer, void *view);
|
||||
extern BOOL Linear_Blit_To_Linear( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
|
||||
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
|
||||
extern BOOL Linear_Scale_To_Linear( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
|
||||
|
||||
extern void Vesa_Put_Pixel(void * thisptr, int x, int y, unsigned char color);
|
||||
extern int Vesa_Get_Pixel(void * thisptr, int x, int y);
|
||||
extern void Vesa_Clear(void *thisptr, unsigned char color);
|
||||
extern long Vesa_To_Buffer(void *thisptr, int x, int y, int w, int h, void *buff, long size);
|
||||
extern long Vesa_Buffer_To_Page(int x, int y, int w, int h, void *Buffer, void *view);
|
||||
|
||||
extern BOOL Linear_Blit_To_Vesa( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
|
||||
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
|
||||
extern BOOL Vesa_Blit_To_Linear( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
|
||||
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
|
||||
extern BOOL Vesa_Blit_To_Vesa( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
|
||||
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
|
||||
extern BOOL Linear_Scale_To_Vesa( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
|
||||
extern BOOL Vesa_Scale_To_Linear( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
|
||||
extern BOOL Vesa_Scale_To_Vesa( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
|
||||
extern LONG MCGA_Print( void *thisptr, const char *str, int x, int y, int fcolor, int bcolor);
|
||||
extern LONG Vesa_Print( void *thisptr, const char *str, int x, int y, int fcolor, int bcolor);
|
||||
|
||||
/*======================================================================*/
|
||||
/* Externs for all of the graphic buffer class only functions */
|
||||
/*======================================================================*/
|
||||
extern VOID MCGA_Draw_Line(void *thisptr, int sx, int sy, int dx, int dy, unsigned char color);
|
||||
extern VOID MCGA_Fill_Rect(void *thisptr, int sx, int sy, int dx, int dy, unsigned char color);
|
||||
extern VOID MCGA_Remap(void * thisptr, int sx, int sy, int width, int height, void *remap);
|
||||
extern VOID MCGA_Fill_Quad(void * thisptr, VOID *span_buff, int x0, int y0, int x1, int y1,
|
||||
int x2, int y2, int x3, int y3, int color);
|
||||
extern void MCGA_Draw_Stamp(void const *thisptr, void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap);
|
||||
extern void MCGA_Draw_Stamp_Clip(void const *thisptr, void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int min_x, int min_y, int max_x, int max_y);
|
||||
|
||||
extern void Shadow_Blit(long int xpix, long int ypix, long int width, long int height, GraphicViewPortClass &src, VideoBufferClass &dst, void *shadowbuff);
|
||||
|
||||
extern void *Get_Font_Palette_Ptr(void);
|
||||
// extern int Get_Standard_Selector(VOID);
|
||||
// extern VOID Set_Selector(UWORD sel);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
extern BOOL (*VVPC_Blit_to_GVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
|
||||
extern BOOL (*VVPC_Blit_to_VVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
|
||||
extern void (*VVPC_Clear_Func)(void *, unsigned char);
|
||||
extern long (*VVPC_To_Buffer_Func)(void *,int x, int y, int w, int h, void *buff, long size);
|
||||
extern void (*VVPC_Put_Pixel_Func)(void *,int x, int y, unsigned char color);
|
||||
extern int (*VVPC_Get_Pixel_Func)(void *, int x, int y);
|
||||
extern long (*VVPC_Buffer_To_Page)(int x, int y, int w, int h, void *buffer, void *view);
|
||||
extern BOOL (*GVPC_Blit_to_VVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
|
||||
extern BOOL (*VVPC_Blit_to_GVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
|
||||
extern BOOL (*VVPC_Blit_to_VVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
|
||||
extern BOOL (*VVPC_Scale_To_GVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
|
||||
extern BOOL (*VVPC_Scale_To_VVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
|
||||
extern BOOL (*GVPC_Scale_To_VVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
|
||||
extern LONG (*VVPC_Print_Func)(void *, const char *, int, int, int, int);
|
||||
extern GraphicBufferClass *LogicPage;
|
||||
#endif
|
124
WWFLAT32/MCGAPRIM/MCGAPRIM.INC
Normal file
124
WWFLAT32/MCGAPRIM/MCGAPRIM.INC
Normal file
@@ -0,0 +1,124 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 Library *
|
||||
;* *
|
||||
;* File Name : MCGAPRIM.INC *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : January 16, 1995 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
; Externs from REGIONSZ.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_Size_Of_Region :NEAR
|
||||
|
||||
; Externs from GETPIX.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_Get_Pixel :NEAR
|
||||
|
||||
; Externs from VGETPIX.ASM module of the SVGA/MCGAPRIM library
|
||||
GLOBAL Vesa_Get_Pixel :NEAR
|
||||
|
||||
; Externs from PUTPIX.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_Put_Pixel :NEAR
|
||||
|
||||
; Externs from VPUTTPIX.ASM module of the SVGA/MCGAPRIM library
|
||||
GLOBAL Vesa_Put_Pixel :NEAR
|
||||
|
||||
; Externs from CLEAR.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_Clear :NEAR
|
||||
|
||||
; Externs from VCLEAR.ASM module of the MCGA/SVGAPRIM library
|
||||
GLOBAL Vesa_Clear :NEAR
|
||||
; Externs from BITBLIT.ASM module of the MCGAPRIM library
|
||||
GLOBAL Linear_Blit_To_Linear :NEAR
|
||||
|
||||
; Externs from VBITBLIT.ASM module of the MCGA/SVGAPRIM library
|
||||
GLOBAL Linear_Blit_To_Vesa :NEAR
|
||||
GLOBAL Vesa_Blit_To_Linear :NEAR
|
||||
GLOBAL Vesa_Blit_To_Vesa :NEAR
|
||||
|
||||
; Externs from TOBUFF.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_To_Buffer :NEAR
|
||||
|
||||
; Externs from VTOBUFF.ASM module of the SVGA/MCGAPRIM library
|
||||
GLOBAL Vesa_To_Buffer :NEAR
|
||||
|
||||
; Externs from TOPAGE.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_Buffer_To_Page :NEAR
|
||||
|
||||
; Externs from VTOPAGE.ASM module of the SVGA/MCGAPRIM library
|
||||
GLOBAL Vesa_Buffer_To_Page :NEAR
|
||||
|
||||
; Externs from SCALE.ASM module of the MCGAPRIM library
|
||||
GLOBAL Linear_Scale_To_Linear :NEAR
|
||||
|
||||
; Externs from VSCALE.ASM module of the SVGA/MCGAPRIM library
|
||||
GLOBAL Linear_Scale_To_Vesa :NEAR
|
||||
GLOBAL Vesa_Scale_To_Linear :NEAR
|
||||
GLOBAL Vesa_Scale_To_Vesa :NEAR
|
||||
|
||||
; Externs from TXTPRNT.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_Print :NEAR
|
||||
GLOBAL C Get_Font_Palette_Ptr :NEAR
|
||||
|
||||
; Externs from VTXTPRNT.ASM module of the SVGA/MCGAPRIM library
|
||||
GLOBAL Vesa_Print :NEAR
|
||||
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Define MCGA only assembly GLOBALS *
|
||||
;*-------------------------------------------------------------------------*
|
||||
|
||||
; Externs from DRAWLINE.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_Draw_Line :NEAR
|
||||
|
||||
; Externs from FILLQUAD.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_Fill_Quad :NEAR
|
||||
|
||||
; Externs from FILLRECT.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_Fill_Rect :NEAR
|
||||
|
||||
; Externs from REMAP.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_Remap :NEAR
|
||||
|
||||
; Externs from STAMP.ASM module of the MCGAPRIM library
|
||||
GLOBAL MCGA_Draw_Stamp :NEAR
|
||||
GLOBAL MCGA_Draw_Stamp_Clip :NEAR
|
||||
|
||||
GLOBAL get_clip : NEAR
|
||||
|
||||
struc RECTANGLE
|
||||
x0 dd ?
|
||||
y0 dd ?
|
||||
x1 dd ?
|
||||
y1 dd ?
|
||||
ends RECTANGLE
|
||||
|
||||
|
||||
|
||||
|
||||
|
101
WWFLAT32/MCGAPRIM/MCGAPRIM.PJT
Normal file
101
WWFLAT32/MCGAPRIM/MCGAPRIM.PJT
Normal file
@@ -0,0 +1,101 @@
|
||||
;Codewright Project File (do not remove or modify this line)
|
||||
[ProjInit]
|
||||
ProjSetConfigFlags=0x00010140
|
||||
|
||||
[Files]
|
||||
d:\wwflat32\mcgaprim\bitblit.asm
|
||||
d:\wwflat32\mcgaprim\buffer.cpp
|
||||
d:\wwflat32\mcgaprim\buffer.h
|
||||
d:\wwflat32\mcgaprim\buffglbl.cpp
|
||||
d:\wwflat32\mcgaprim\clear.asm
|
||||
d:\wwflat32\mcgaprim\drawline.asm
|
||||
d:\wwflat32\mcgaprim\drawrect.cpp
|
||||
d:\wwflat32\mcgaprim\fillquad.asm
|
||||
d:\wwflat32\mcgaprim\fillrect.asm
|
||||
d:\wwflat32\mcgaprim\gbuffer.cpp
|
||||
d:\wwflat32\mcgaprim\gbuffer.h
|
||||
d:\wwflat32\mcgaprim\gbuffer.inc
|
||||
d:\wwflat32\mcgaprim\getclip.asm
|
||||
d:\wwflat32\mcgaprim\getpix.asm
|
||||
d:\wwflat32\mcgaprim\mcgaprim.h
|
||||
d:\wwflat32\mcgaprim\mcgaprim.inc
|
||||
d:\wwflat32\mcgaprim\putpix.asm
|
||||
d:\wwflat32\mcgaprim\regionsz.cpp
|
||||
d:\wwflat32\mcgaprim\remap.asm
|
||||
d:\wwflat32\mcgaprim\scale.asm
|
||||
d:\wwflat32\mcgaprim\shadow.asm
|
||||
d:\wwflat32\mcgaprim\stamp.asm
|
||||
d:\wwflat32\mcgaprim\stamp.inc
|
||||
d:\wwflat32\mcgaprim\szregion.asm
|
||||
d:\wwflat32\mcgaprim\tobuff.asm
|
||||
d:\wwflat32\mcgaprim\topage.asm
|
||||
d:\wwflat32\mcgaprim\txtprnt.asm
|
||||
d:\wwflat32\mcgaprim\vbitblit.asm
|
||||
d:\wwflat32\mcgaprim\vbuffer.cpp
|
||||
d:\wwflat32\mcgaprim\vbuffer.h
|
||||
d:\wwflat32\mcgaprim\vclear.asm
|
||||
d:\wwflat32\mcgaprim\vesa.asm
|
||||
d:\wwflat32\mcgaprim\vgetpix.asm
|
||||
d:\wwflat32\mcgaprim\vlbtove.asm
|
||||
d:\wwflat32\mcgaprim\vputpix.asm
|
||||
d:\wwflat32\mcgaprim\vscale.asm
|
||||
d:\wwflat32\mcgaprim\vscltove.asm
|
||||
d:\wwflat32\mcgaprim\vtobuff.asm
|
||||
d:\wwflat32\mcgaprim\vtopage.asm
|
||||
d:\wwflat32\mcgaprim\vtxtprnt.asm
|
||||
d:\wwflat32\mcgaprim\vvblit.asm
|
||||
d:\wwflat32\mcgaprim\vvetolb.asm
|
||||
d:\wwflat32\mcgaprim\vvetoscl.asm
|
||||
|
||||
|
||||
[State]
|
||||
SysSetCwd='C:\PROJECTS\C&CZERO\WWFLAT32\MCGAPRIM'
|
||||
SrchSetFlags=0x20aa
|
||||
FileSortMode=0x0
|
||||
StateWindowFrame=69,91,417,932,0x6989f5fa
|
||||
_OutputWindowPosition=1,-3,-3,1286,1030,0,0
|
||||
_StateWindow=87,87,990,623,0x00000118,'c:\projects\c&czero\wwflat32\mcgaprim\stamp.inc',240,7,244,32,32,0,32,32,32,32,8,65535,65535,1,0,'Terminal',65520,255,49,0,4,243,14,15,247,247,253,2,1,400,0,246,252,245,242,241,247,0,0,0
|
||||
_StateBuffer='c:\projects\c&czero\wwflat32\mcgaprim\stamp.inc',0x0400048e,2,1,25,'9 17','',0x0,''
|
||||
_StateBuffer='c:\projects\c&czero\wwflat32\mcgaprim\stamp.asm',0x0400048e,1,9,25,'9 17','',0x0,''
|
||||
WrapEnable=0
|
||||
_StateHistory=FILELIST,'d:\wwflat32\mcgaprim\stamp.asm','c:\projects\c&czero\wwflat32\mcgaprim\stamp.asm','c:\projects\c&czero\wwflat32\mcgaprim\stamp.inc'
|
||||
_StateHistory=DIRECTORY,'C:\PROJECTS\C&CZERO\WWFLAT32\MCGAPRIM'
|
||||
|
||||
[Editor]
|
||||
ClipboardSetTermStr='\r\n',0
|
||||
ClipboardEnableTermStr=1
|
||||
ClipboardSetSepStr='\r\n',0
|
||||
ClipboardEnableSepStr=1
|
||||
ScrapSetCount=1
|
||||
_RestoreSysFlags=0x6989f5fa, 0xfffffffc
|
||||
|
||||
[Compiler]
|
||||
BrowseSetFile='c:\projects\c&czero\wwflat32\mcgaprim\mcgaprim.ptg'
|
||||
TagSetFile='c:\projects\c&czero\wwflat32\mcgaprim\mcgaprim.tag'
|
||||
CompilerAddBuild='Microsoft Assembler',1073741880,'ftee masm -w2 -zi %r%e;','','','','','_MicrosoftErrorInfo','','%v%p','','','','','',0
|
||||
CompilerAddResponse='Microsoft Assembler',
|
||||
CompilerAddBuild='Borland C++',1073741880,'ftee bcc -S %r.c','ftee make %r.obj','ftee make %r.obj','','','_BorlandCppErrorInfo','','%v%p','','','','','',0
|
||||
CompilerAddResponse='Borland C++',
|
||||
CompilerAddBuild='Borland Turbo Assembler',1073741880,'ftee make %r.obj','ftee make %r.obj','','','','_TasmErrorInfo','','%v%p','','','','','',0
|
||||
CompilerAddResponse='Borland Turbo Assembler',
|
||||
CompilerAddBuild='$_cw_proj_hash_$',1073741873,'','ftee wmake %r.obj','ftee wmake ','','','_MSLinkErrorInfo','proj.err','c:\projects\c&czero\wwflat32\mcgaprim','','_MicrosoftErrorInfo','_NMakeErrorInfo','','',197376
|
||||
CompilerAddResponse='$_cw_proj_hash_$',
|
||||
CompilerAddBuild='Default Project',1073741880,'','ftee make','ftee make','','','_ErrorInfoDefault','proj.err','%v%p','','','','','',0
|
||||
CompilerAddResponse='Default Project',
|
||||
CompilerAddBuild='Microsoft C',1073741880,'ftee cl -c -AL -Gsw -Ow -Zpe %r%e','','','','','_MicrosoftErrorInfo','','%v%p','','','','','',0
|
||||
CompilerAddResponse='Microsoft C',
|
||||
CompilerAddBuild='Script',1073741880,'ftee make %r.inf','ftee make','ftee make','','','_BorlandCppErrorInfo','','','','','','','',0
|
||||
CompilerAddResponse='Script',
|
||||
CompilerAddBuild='Zortech C++',1073741880,'ftee ztc -a -b -c -g -ml -W %r%e','','','','','_ZortechCppErrorInfo','','%v%p','','','','','',0
|
||||
CompilerAddResponse='Zortech C++',
|
||||
CompilerAssign='Borland C++','.scr'
|
||||
CompilerNewExt=.bas
|
||||
CompilerAssign='Borland C++','.int'
|
||||
CompilerAssign='Borland C++','.c'
|
||||
CompilerNewExt=.prg
|
||||
CompilerAssign='Microsoft C','.h'
|
||||
CompilerAssign='Borland C++','.cpp'
|
||||
CompilerAssign='Default Project','.*'
|
||||
CompilerAssign='Zortech C++','.cxx'
|
||||
CompilerAssign='Borland Turbo Assembler','.asm'
|
||||
CompilerAssign='Borland C++','.hpp'
|
109
WWFLAT32/MCGAPRIM/PUTPIX.ASM
Normal file
109
WWFLAT32/MCGAPRIM/PUTPIX.ASM
Normal file
@@ -0,0 +1,109 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Clear the Full Mcga Screen *
|
||||
;* *
|
||||
;* File Name : PUTPIXEL.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 7, 1994 *
|
||||
;* *
|
||||
;* Last Update : June 8, 1994 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* VVPC::Put_Pixel -- Puts a pixel on a virtual viewport *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* VVPC::PUT_PIXEL -- Puts a pixel on a virtual viewport *
|
||||
;* *
|
||||
;* INPUT: WORD the x position for the pixel relative to the upper *
|
||||
;* left corner of the viewport *
|
||||
;* WORD the y pos for the pixel relative to the upper left *
|
||||
;* corner of the viewport *
|
||||
;* UBYTE the color of the pixel to write *
|
||||
;* *
|
||||
;* OUTPUT: none *
|
||||
;* *
|
||||
;* WARNING: If pixel is to be placed outside of the viewport then *
|
||||
;* this routine will abort. *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 06/08/1994 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC MCGA_Put_Pixel C near
|
||||
USES eax,ebx,ecx,edx,edi
|
||||
|
||||
ARG this:DWORD ; this is a member function
|
||||
ARG x_pixel:DWORD ; x position of pixel to set
|
||||
ARG y_pixel:DWORD ; y position of pixel to set
|
||||
ARG color:BYTE ; what color should we clear to
|
||||
|
||||
;*===================================================================
|
||||
; Get the viewport information and put bytes per row in ecx
|
||||
;*===================================================================
|
||||
mov ebx,[this] ; get a pointer to viewport
|
||||
xor eax,eax
|
||||
mov edi,[(GraphicViewPort ebx).GVPOffset] ; get the correct offset
|
||||
mov ecx,[(GraphicViewPort ebx).GVPHeight] ; edx = height of viewport
|
||||
mov edx,[(GraphicViewPort ebx).GVPWidth] ; ecx = width of viewport
|
||||
|
||||
;*===================================================================
|
||||
; Verify that the X pixel offset if legal
|
||||
;*===================================================================
|
||||
mov eax,[x_pixel] ; find the x position
|
||||
cmp eax,edx ; is it out of bounds
|
||||
jae short ??exit ; if so then get out
|
||||
add edi,eax ; otherwise add in offset
|
||||
|
||||
;*===================================================================
|
||||
; Verify that the Y pixel offset if legal
|
||||
;*===================================================================
|
||||
mov eax,[y_pixel] ; get the y position
|
||||
cmp eax,ecx ; is it out of bounds
|
||||
jae ??exit ; if so then get out
|
||||
add edx,[(GraphicViewPort ebx).GVPXAdd] ; otherwise find bytes per row
|
||||
mul edx ; offset = bytes per row * y
|
||||
add edi,eax ; add it into the offset
|
||||
|
||||
;*===================================================================
|
||||
; Write the pixel to the screen
|
||||
;*===================================================================
|
||||
mov al,[color] ; read in color value
|
||||
mov [edi],al ; write it to the screen
|
||||
??exit:
|
||||
ret
|
||||
ENDP MCGA_Put_Pixel
|
||||
|
||||
END
|
60
WWFLAT32/MCGAPRIM/REGIONSZ.CPP
Normal file
60
WWFLAT32/MCGAPRIM/REGIONSZ.CPP
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** 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 : WWLIB 32 *
|
||||
* *
|
||||
* File Name : REGIONSZ.CPP *
|
||||
* *
|
||||
* Programmer : Phil W. Gorrow *
|
||||
* *
|
||||
* Start Date : November 3, 1994 *
|
||||
* *
|
||||
* Last Update : November 3, 1994 [PWG] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* Size_Of_Region -- Calculates the size of a given region *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
/*=========================================================================*/
|
||||
/* The following PRIVATE functions are in this file: */
|
||||
/*=========================================================================*/
|
||||
|
||||
|
||||
/*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* SIZE_OF_REGION -- Calculates the size of a given region *
|
||||
* *
|
||||
* INPUT: int width - the width of the region *
|
||||
* int height - the height of the region *
|
||||
* *
|
||||
* OUTPUT: long - the size of the region *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/03/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
long Size_Of_Region(int width, int height)
|
||||
{
|
||||
return(width * height);
|
||||
}
|
174
WWFLAT32/MCGAPRIM/REMAP.ASM
Normal file
174
WWFLAT32/MCGAPRIM/REMAP.ASM
Normal file
@@ -0,0 +1,174 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : REMAP.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : July 1, 1994 *
|
||||
;* *
|
||||
;* Last Update : July 1, 1994 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
PROC MCGA_Remap C NEAR
|
||||
USES eax,ebx,ecx,edx,esi,edi
|
||||
|
||||
;*===================================================================
|
||||
;* Define the arguements that our function takes.
|
||||
;*===================================================================
|
||||
ARG this :DWORD
|
||||
ARG x0_pixel:DWORD
|
||||
ARG y0_pixel:DWORD
|
||||
ARG width :DWORD
|
||||
ARG height :DWORD
|
||||
ARG remap :DWORD
|
||||
|
||||
;*===================================================================
|
||||
; Define some locals so that we can handle things quickly
|
||||
;*===================================================================
|
||||
local x1_pixel : DWORD
|
||||
local y1_pixel : DWORD
|
||||
local win_width : dword
|
||||
local counter_x : dword
|
||||
|
||||
|
||||
cmp [ remap ] , 0
|
||||
jz ??real_out
|
||||
|
||||
; Clip Source Rectangle against source Window boundaries.
|
||||
mov esi , [ this ] ; get ptr to src
|
||||
xor ecx , ecx
|
||||
xor edx , edx
|
||||
mov edi , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
|
||||
mov ebx , [ x0_pixel ]
|
||||
mov eax , [ x0_pixel ]
|
||||
add ebx , [ width ]
|
||||
shld ecx , eax , 1
|
||||
mov [ x1_pixel ] , ebx
|
||||
inc edi
|
||||
shld edx , ebx , 1
|
||||
sub eax , edi
|
||||
sub ebx , edi
|
||||
shld ecx , eax , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
mov edi,[ ( VideoViewPort esi) . VIVPHeight ] ; get height into register
|
||||
mov ebx , [ y0_pixel ]
|
||||
mov eax , [ y0_pixel ]
|
||||
add ebx , [ height ]
|
||||
shld ecx , eax , 1
|
||||
mov [ y1_pixel ] , ebx
|
||||
inc edi
|
||||
shld edx , ebx , 1
|
||||
sub eax , edi
|
||||
sub ebx , edi
|
||||
shld ecx , eax , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
xor cl , 5
|
||||
xor dl , 5
|
||||
mov al , cl
|
||||
test dl , cl
|
||||
jnz ??real_out
|
||||
or al , dl
|
||||
jz ??do_remap
|
||||
|
||||
test cl , 1000b
|
||||
jz ??scr_left_ok
|
||||
mov [ x0_pixel ] , 0
|
||||
|
||||
??scr_left_ok:
|
||||
test cl , 0010b
|
||||
jz ??scr_bottom_ok
|
||||
mov [ y0_pixel ] , 0
|
||||
|
||||
??scr_bottom_ok:
|
||||
test dl , 0100b
|
||||
jz ??scr_right_ok
|
||||
mov eax , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
|
||||
mov [ x1_pixel ] , eax
|
||||
??scr_right_ok:
|
||||
test dl , 0001b
|
||||
jz ??do_remap
|
||||
mov eax , [ (VideoViewPort esi) . VIVPHeight ] ; get width into register
|
||||
mov [ y1_pixel ] , eax
|
||||
|
||||
|
||||
??do_remap:
|
||||
cld
|
||||
mov edi , [ (VideoViewPort esi) . VIVPOffset ]
|
||||
mov eax , [ (VideoViewPort esi) . VIVPXAdd ]
|
||||
mov ebx , [ x1_pixel ]
|
||||
add eax , [ (VideoViewPort esi) . VIVPWidth ]
|
||||
mov esi , eax
|
||||
mul [ y0_pixel ]
|
||||
add edi , [ x0_pixel ]
|
||||
sub ebx , [ x0_pixel ]
|
||||
jle ??real_out
|
||||
add edi , eax
|
||||
sub esi , ebx
|
||||
|
||||
mov ecx , [ y1_pixel ]
|
||||
sub ecx , [ y0_pixel ]
|
||||
jle ??real_out
|
||||
mov eax , [ remap ]
|
||||
mov [ counter_x ] , ebx
|
||||
xor edx , edx
|
||||
|
||||
??outer_loop:
|
||||
mov ebx , [ counter_x ]
|
||||
??inner_loop:
|
||||
mov dl , [ edi ]
|
||||
mov dl , [ eax + edx ]
|
||||
mov [ edi ] , dl
|
||||
inc edi
|
||||
dec ebx
|
||||
jnz ??inner_loop
|
||||
add edi , esi
|
||||
dec ecx
|
||||
jnz ??outer_loop
|
||||
|
||||
|
||||
|
||||
|
||||
??real_out:
|
||||
ret
|
||||
|
||||
ENDP MCGA_Remap
|
||||
|
||||
END
|
568
WWFLAT32/MCGAPRIM/SCALE.ASM
Normal file
568
WWFLAT32/MCGAPRIM/SCALE.ASM
Normal file
@@ -0,0 +1,568 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : SCALE.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 16, 1994 *
|
||||
;* *
|
||||
;* Last Update : June 21, 1994 [PWG] *
|
||||
;* New version : feb 12, 1995 [JRJ] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* VVC::Scale -- Scales a virtual viewport to another virtual viewport *
|
||||
;* Normal_Draw -- jump loc for drawing scaled line of normal pixel *
|
||||
;* Normal_Remapped_Draw -- jump loc for draw scaled line of remap pixel *
|
||||
;* Transparent_Draw -- jump loc for scaled line of transparent pixels *
|
||||
;* Transparent_Remapped_Draw -- jump loc for scaled remap trans pixels *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
;* VVC::SCALE -- Scales a virtual viewport to another virtual viewport *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 06/16/1994 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Linear_Scale_To_Linear C NEAR
|
||||
USES eax,ebx,ecx,edx,esi,edi
|
||||
|
||||
;*===================================================================
|
||||
;* Define the arguements that our function takes.
|
||||
;*===================================================================
|
||||
ARG this:DWORD ; pointer to source view port
|
||||
ARG dest:DWORD ; pointer to destination view port
|
||||
ARG src_x:DWORD ; source x offset into view port
|
||||
ARG src_y:DWORD ; source y offset into view port
|
||||
ARG dst_x:DWORD ; dest x offset into view port
|
||||
ARG dst_y:DWORD ; dest y offset into view port
|
||||
ARG src_width:DWORD ; width of source rectangle
|
||||
ARG src_height:DWORD ; height of source rectangle
|
||||
ARG dst_width:DWORD ; width of dest rectangle
|
||||
ARG dst_height:DWORD ; width of dest height
|
||||
ARG trans:DWORD ; is this transparent?
|
||||
ARG remap:DWORD ; pointer to table to remap source
|
||||
|
||||
;*===================================================================
|
||||
;* Define local variables to hold the viewport characteristics
|
||||
;*===================================================================
|
||||
local src_x0 : dword
|
||||
local src_y0 : dword
|
||||
local src_x1 : dword
|
||||
local src_y1 : dword
|
||||
|
||||
local dst_x0 : dword
|
||||
local dst_y0 : dword
|
||||
local dst_x1 : dword
|
||||
local dst_y1 : dword
|
||||
|
||||
local src_win_width : dword
|
||||
local dst_win_width : dword
|
||||
local dy_intr : dword
|
||||
local dy_frac : dword
|
||||
local dy_acc : dword
|
||||
local dx_frac : dword
|
||||
|
||||
local counter_x : dword
|
||||
local counter_y : dword
|
||||
local remap_counter :dword
|
||||
local entry : dword
|
||||
|
||||
;*===================================================================
|
||||
;* Check for scale error when to or from size 0,0
|
||||
;*===================================================================
|
||||
cmp [dst_width],0
|
||||
je ??all_done
|
||||
cmp [dst_height],0
|
||||
je ??all_done
|
||||
cmp [src_width],0
|
||||
je ??all_done
|
||||
cmp [src_height],0
|
||||
je ??all_done
|
||||
|
||||
mov eax , [ src_x ]
|
||||
mov ebx , [ src_y ]
|
||||
mov [ src_x0 ] , eax
|
||||
mov [ src_y0 ] , ebx
|
||||
add eax , [ src_width ]
|
||||
add ebx , [ src_height ]
|
||||
mov [ src_x1 ] , eax
|
||||
mov [ src_y1 ] , ebx
|
||||
|
||||
mov eax , [ dst_x ]
|
||||
mov ebx , [ dst_y ]
|
||||
mov [ dst_x0 ] , eax
|
||||
mov [ dst_y0 ] , ebx
|
||||
add eax , [ dst_width ]
|
||||
add ebx , [ dst_height ]
|
||||
mov [ dst_x1 ] , eax
|
||||
mov [ dst_y1 ] , ebx
|
||||
|
||||
; Clip Source Rectangle against source Window boundaries.
|
||||
mov esi , [ this ] ; get ptr to src
|
||||
xor ecx , ecx
|
||||
xor edx , edx
|
||||
mov edi , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
|
||||
mov eax , [ src_x0 ]
|
||||
mov ebx , [ src_x1 ]
|
||||
shld ecx , eax , 1
|
||||
inc edi
|
||||
shld edx , ebx , 1
|
||||
sub eax , edi
|
||||
sub ebx , edi
|
||||
shld ecx , eax , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
mov edi,[ ( VideoViewPort esi) . VIVPHeight ] ; get height into register
|
||||
mov eax , [ src_y0 ]
|
||||
mov ebx , [ src_y1 ]
|
||||
shld ecx , eax , 1
|
||||
inc edi
|
||||
shld edx , ebx , 1
|
||||
sub eax , edi
|
||||
sub ebx , edi
|
||||
shld ecx , eax , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
xor cl , 5
|
||||
xor dl , 5
|
||||
mov al , cl
|
||||
test dl , cl
|
||||
jnz ??all_done
|
||||
or al , dl
|
||||
jz ??clip_against_dest
|
||||
mov bl , dl
|
||||
test cl , 1000b
|
||||
jz ??src_left_ok
|
||||
xor eax , eax
|
||||
mov [ src_x0 ] , eax
|
||||
sub eax , [ src_x ]
|
||||
imul [ dst_width ]
|
||||
idiv [ src_width ]
|
||||
add eax , [ dst_x ]
|
||||
mov [ dst_x0 ] , eax
|
||||
|
||||
??src_left_ok:
|
||||
test cl , 0010b
|
||||
jz ??src_bottom_ok
|
||||
xor eax , eax
|
||||
mov [ src_y0 ] , eax
|
||||
sub eax , [ src_y ]
|
||||
imul [ dst_height ]
|
||||
idiv [ src_height ]
|
||||
add eax , [ dst_y ]
|
||||
mov [ dst_y0 ] , eax
|
||||
|
||||
??src_bottom_ok:
|
||||
test bl , 0100b
|
||||
jz ??src_right_ok
|
||||
mov eax , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
|
||||
mov [ src_x1 ] , eax
|
||||
sub eax , [ src_x ]
|
||||
imul [ dst_width ]
|
||||
idiv [ src_width ]
|
||||
add eax , [ dst_x ]
|
||||
mov [ dst_x1 ] , eax
|
||||
|
||||
??src_right_ok:
|
||||
test bl , 0001b
|
||||
jz ??clip_against_dest
|
||||
mov eax , [ (VideoViewPort esi) . VIVPHeight ] ; get width into register
|
||||
mov [ src_y1 ] , eax
|
||||
sub eax , [ src_y ]
|
||||
imul [ dst_height ]
|
||||
idiv [ src_height ]
|
||||
add eax , [ dst_y ]
|
||||
mov [ dst_y1 ] , eax
|
||||
|
||||
; Clip destination Rectangle against source Window boundaries.
|
||||
??clip_against_dest:
|
||||
mov esi , [ dest ] ; get ptr to src
|
||||
xor ecx , ecx
|
||||
xor edx , edx
|
||||
mov edi , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
|
||||
mov eax , [ dst_x0 ]
|
||||
mov ebx , [ dst_x1 ]
|
||||
shld ecx , eax , 1
|
||||
inc edi
|
||||
shld edx , ebx , 1
|
||||
sub eax , edi
|
||||
sub ebx , edi
|
||||
shld ecx , eax , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
mov edi,[ ( VideoViewPort esi) . VIVPHeight ] ; get height into register
|
||||
mov eax , [ dst_y0 ]
|
||||
mov ebx , [ dst_y1 ]
|
||||
shld ecx , eax , 1
|
||||
inc edi
|
||||
shld edx , ebx , 1
|
||||
sub eax , edi
|
||||
sub ebx , edi
|
||||
shld ecx , eax , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
xor cl , 5
|
||||
xor dl , 5
|
||||
mov al , cl
|
||||
test dl , cl
|
||||
jnz ??all_done
|
||||
or al , dl
|
||||
jz ??do_scaling
|
||||
mov bl , dl
|
||||
test cl , 1000b
|
||||
jz ??dst_left_ok
|
||||
xor eax , eax
|
||||
mov [ dst_x0 ] , eax
|
||||
sub eax , [ dst_x ]
|
||||
imul [ src_width ]
|
||||
idiv [ dst_width ]
|
||||
add eax , [ src_x ]
|
||||
mov [ src_x0 ] , eax
|
||||
|
||||
??dst_left_ok:
|
||||
test cl , 0010b
|
||||
jz ??dst_bottom_ok
|
||||
xor eax , eax
|
||||
mov [ dst_y0 ] , eax
|
||||
sub eax , [ dst_y ]
|
||||
imul [ src_height ]
|
||||
idiv [ dst_height ]
|
||||
add eax , [ src_y ]
|
||||
mov [ src_y0 ] , eax
|
||||
|
||||
??dst_bottom_ok:
|
||||
test bl , 0100b
|
||||
jz ??dst_right_ok
|
||||
mov eax , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
|
||||
mov [ dst_x1 ] , eax
|
||||
sub eax , [ dst_x ]
|
||||
imul [ src_width ]
|
||||
idiv [ dst_width ]
|
||||
add eax , [ src_x ]
|
||||
mov [ src_x1 ] , eax
|
||||
|
||||
??dst_right_ok:
|
||||
test bl , 0001b
|
||||
jz ??do_scaling
|
||||
|
||||
mov eax , [ (VideoViewPort esi) . VIVPHeight ] ; get width into register
|
||||
mov [ dst_y1 ] , eax
|
||||
sub eax , [ dst_y ]
|
||||
imul [ src_height ]
|
||||
idiv [ dst_height ]
|
||||
add eax , [ src_y ]
|
||||
mov [ src_y1 ] , eax
|
||||
|
||||
??do_scaling:
|
||||
|
||||
cld
|
||||
mov ebx , [ this ]
|
||||
mov esi , [ (VideoViewPort ebx) . VIVPOffset ]
|
||||
mov eax , [ (VideoViewPort ebx) . VIVPXAdd ]
|
||||
add eax , [ (VideoViewPort ebx) . VIVPWidth ]
|
||||
mov [ src_win_width ] , eax
|
||||
mul [ src_y0 ]
|
||||
add esi , [ src_x0 ]
|
||||
add esi , eax
|
||||
|
||||
mov ebx , [ dest ]
|
||||
mov edi , [ (VideoViewPort ebx) . VIVPOffset ]
|
||||
mov eax , [ (VideoViewPort ebx) . VIVPXAdd ]
|
||||
add eax , [ (VideoViewPort ebx) . VIVPWidth ]
|
||||
mov [ dst_win_width ] , eax
|
||||
mul [ dst_y0 ]
|
||||
add edi , [ dst_x0 ]
|
||||
add edi , eax
|
||||
|
||||
mov eax , [ src_height ]
|
||||
xor edx , edx
|
||||
mov ebx , [ dst_height ]
|
||||
idiv [ dst_height ]
|
||||
imul eax , [ src_win_width ]
|
||||
neg ebx
|
||||
mov [ dy_intr ] , eax
|
||||
mov [ dy_frac ] , edx
|
||||
mov [ dy_acc ] , ebx
|
||||
|
||||
mov eax , [ src_width ]
|
||||
xor edx , edx
|
||||
shl eax , 16
|
||||
idiv [ dst_width ]
|
||||
xor edx , edx
|
||||
shld edx , eax , 16
|
||||
shl eax , 16
|
||||
|
||||
mov ecx , [ dst_y1 ]
|
||||
mov ebx , [ dst_x1 ]
|
||||
sub ecx , [ dst_y0 ]
|
||||
jle ??all_done
|
||||
sub ebx , [ dst_x0 ]
|
||||
jle ??all_done
|
||||
|
||||
mov [ counter_y ] , ecx
|
||||
|
||||
cmp [ trans ] , 0
|
||||
jnz ??transparency
|
||||
|
||||
cmp [ remap ] , 0
|
||||
jnz ??normal_remap
|
||||
|
||||
; *************************************************************************
|
||||
; normal scale
|
||||
mov ecx , ebx
|
||||
and ecx , 01fh
|
||||
lea ecx , [ ecx + ecx * 2 ]
|
||||
shr ebx , 5
|
||||
neg ecx
|
||||
mov [ counter_x ] , ebx
|
||||
lea ecx , [ ??ref_point + ecx + ecx * 2 ]
|
||||
mov [ entry ] , ecx
|
||||
|
||||
??outter_loop:
|
||||
push esi
|
||||
push edi
|
||||
xor ecx , ecx
|
||||
mov ebx , [ counter_x ]
|
||||
jmp [ entry ]
|
||||
??inner_loop:
|
||||
REPT 32
|
||||
mov cl , [ esi ]
|
||||
add ecx , eax
|
||||
adc esi , edx
|
||||
mov [ edi ] , cl
|
||||
inc edi
|
||||
ENDM
|
||||
??ref_point:
|
||||
dec ebx
|
||||
jge ??inner_loop
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
add edi , [ dst_win_width ]
|
||||
add esi , [ dy_intr ]
|
||||
|
||||
mov ebx , [ dy_acc ]
|
||||
add ebx , [ dy_frac ]
|
||||
jle ??skip_line
|
||||
add esi , [ src_win_width ]
|
||||
sub ebx , [ dst_height ]
|
||||
??skip_line:
|
||||
dec [ counter_y ]
|
||||
mov [ dy_acc ] , ebx
|
||||
jnz ??outter_loop
|
||||
ret
|
||||
|
||||
|
||||
; *************************************************************************
|
||||
; normal scale with remap
|
||||
|
||||
??normal_remap:
|
||||
mov ecx , ebx
|
||||
mov [ dx_frac ], eax
|
||||
and ecx , 01fh
|
||||
mov eax , [ remap ]
|
||||
shr ebx , 5
|
||||
imul ecx , - 13
|
||||
mov [ counter_x ] , ebx
|
||||
lea ecx , [ ??remapref_point + ecx ]
|
||||
mov [ entry ] , ecx
|
||||
|
||||
??remapoutter_loop:
|
||||
mov ebx , [ counter_x ]
|
||||
push esi
|
||||
mov [ remap_counter ] , ebx
|
||||
push edi
|
||||
xor ecx , ecx
|
||||
xor ebx , ebx
|
||||
jmp [ entry ]
|
||||
??remapinner_loop:
|
||||
REPT 32
|
||||
mov bl , [ esi ]
|
||||
add ecx , [ dx_frac ]
|
||||
adc esi , edx
|
||||
mov cl , [ eax + ebx ]
|
||||
mov [ edi ] , cl
|
||||
inc edi
|
||||
ENDM
|
||||
??remapref_point:
|
||||
dec [ remap_counter ]
|
||||
jge ??remapinner_loop
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
add edi , [ dst_win_width ]
|
||||
add esi , [ dy_intr ]
|
||||
|
||||
mov ebx , [ dy_acc ]
|
||||
add ebx , [ dy_frac ]
|
||||
jle ??remapskip_line
|
||||
add esi , [ src_win_width ]
|
||||
sub ebx , [ dst_height ]
|
||||
??remapskip_line:
|
||||
dec [ counter_y ]
|
||||
mov [ dy_acc ] , ebx
|
||||
jnz ??remapoutter_loop
|
||||
ret
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
; scale with trnsparency
|
||||
|
||||
??transparency:
|
||||
cmp [ remap ] , 0
|
||||
jnz ??trans_remap
|
||||
|
||||
; *************************************************************************
|
||||
; normal scale with transparency
|
||||
mov ecx , ebx
|
||||
and ecx , 01fh
|
||||
imul ecx , -13
|
||||
shr ebx , 5
|
||||
mov [ counter_x ] , ebx
|
||||
lea ecx , [ ??trans_ref_point + ecx ]
|
||||
mov [ entry ] , ecx
|
||||
|
||||
??trans_outter_loop:
|
||||
xor ecx , ecx
|
||||
push esi
|
||||
push edi
|
||||
mov ebx , [ counter_x ]
|
||||
jmp [ entry ]
|
||||
??trans_inner_loop:
|
||||
REPT 32
|
||||
local trans_pixel
|
||||
mov cl , [ esi ]
|
||||
test cl , cl
|
||||
jz trans_pixel
|
||||
mov [ edi ] , cl
|
||||
trans_pixel:
|
||||
add ecx , eax
|
||||
adc esi , edx
|
||||
inc edi
|
||||
ENDM
|
||||
??trans_ref_point:
|
||||
dec ebx
|
||||
jge ??trans_inner_loop
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
add edi , [ dst_win_width ]
|
||||
add esi , [ dy_intr ]
|
||||
|
||||
mov ebx , [ dy_acc ]
|
||||
add ebx , [ dy_frac ]
|
||||
jle ??trans_skip_line
|
||||
add esi , [ src_win_width ]
|
||||
sub ebx , [ dst_height ]
|
||||
??trans_skip_line:
|
||||
dec [ counter_y ]
|
||||
mov [ dy_acc ] , ebx
|
||||
jnz ??trans_outter_loop
|
||||
ret
|
||||
|
||||
|
||||
; *************************************************************************
|
||||
; normal scale with remap
|
||||
|
||||
??trans_remap:
|
||||
mov ecx , ebx
|
||||
mov [ dx_frac ], eax
|
||||
and ecx , 01fh
|
||||
mov eax , [ remap ]
|
||||
shr ebx , 5
|
||||
imul ecx , - 17
|
||||
mov [ counter_x ] , ebx
|
||||
lea ecx , [ ??trans_remapref_point + ecx ]
|
||||
mov [ entry ] , ecx
|
||||
|
||||
??trans_remapoutter_loop:
|
||||
mov ebx , [ counter_x ]
|
||||
push esi
|
||||
mov [ remap_counter ] , ebx
|
||||
push edi
|
||||
xor ecx , ecx
|
||||
xor ebx , ebx
|
||||
jmp [ entry ]
|
||||
??trans_remapinner_loop:
|
||||
REPT 32
|
||||
local trans_pixel
|
||||
mov bl , [ esi ]
|
||||
test bl , bl
|
||||
jz trans_pixel
|
||||
mov cl , [ eax + ebx ]
|
||||
mov [ edi ] , cl
|
||||
trans_pixel:
|
||||
add ecx , [ dx_frac ]
|
||||
adc esi , edx
|
||||
inc edi
|
||||
ENDM
|
||||
??trans_remapref_point:
|
||||
dec [ remap_counter ]
|
||||
jge ??trans_remapinner_loop
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
add edi , [ dst_win_width ]
|
||||
add esi , [ dy_intr ]
|
||||
|
||||
mov ebx , [ dy_acc ]
|
||||
add ebx , [ dy_frac ]
|
||||
jle ??trans_remapskip_line
|
||||
add esi , [ src_win_width ]
|
||||
sub ebx , [ dst_height ]
|
||||
??trans_remapskip_line:
|
||||
dec [ counter_y ]
|
||||
mov [ dy_acc ] , ebx
|
||||
jnz ??trans_remapoutter_loop
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
??all_done:
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
END
|
210
WWFLAT32/MCGAPRIM/SHADOW.ASM
Normal file
210
WWFLAT32/MCGAPRIM/SHADOW.ASM
Normal file
@@ -0,0 +1,210 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
; $Header: g:/library/source/rcs/./shadow.asm 1.9 1994/05/20 15:30:49 joe_bostic Exp $
|
||||
;***************************************************************************
|
||||
;** 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 : LIBRARY *
|
||||
;* *
|
||||
;* File Name : SHADOW.ASM *
|
||||
;* *
|
||||
;* Programmer : Christopher Yates *
|
||||
;* *
|
||||
;* Last Update : February 28, 1995 [BG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* *
|
||||
;* void Shadow_Blit(int xpix, int ypix, int width, int height, GVPC src, GVPC dst, void *shadowbuff);
|
||||
;* *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
INCLUDE ".\keystruc.inc"
|
||||
|
||||
GLOBAL Shadow_Blit : NEAR
|
||||
|
||||
GLOBAL RealModePtr : DWORD
|
||||
GLOBAL Hide_Mouse : NEAR
|
||||
GLOBAL Show_Mouse : NEAR
|
||||
|
||||
CODESEG
|
||||
|
||||
; void Shadow_Blit(int xpix, int ypix, int width, int height, GVPC src, VBC dst, void *shadowbuff);
|
||||
; Warning: Shadow_Blit appears to be relatively stupid, in that while it is
|
||||
; optimized to perform word or dword blits, it only does so if the
|
||||
; entire region is word or dword-sized. In other words, if you blit
|
||||
; a region that is 200 pixels wide (clearly dword-sized), then it
|
||||
; will use the dword loop. However, if you blit a region that is
|
||||
; 201 pixels wide, the dumb thing will use the byte loop for the
|
||||
; entire blit.
|
||||
PROC Shadow_Blit C near
|
||||
USES eax,ebx,ecx,edx,esi,edi
|
||||
|
||||
ARG x:DWORD
|
||||
ARG y:DWORD
|
||||
ARG width:DWORD
|
||||
ARG height:DWORD
|
||||
ARG srcpage:DWORD
|
||||
ARG dstpage:DWORD
|
||||
ARG shadow:DWORD
|
||||
|
||||
LOCAL modulo:DWORD ; Row modulo
|
||||
LOCAL hidemouse:DWORD ; Was the mouse hidden?
|
||||
LOCAL dwordwidth:DWORD
|
||||
LOCAL bytewidth:DWORD
|
||||
|
||||
cld ; Always move forward.
|
||||
mov [hidemouse],0 ; Presume mouse hasn't been hidden.
|
||||
|
||||
; Fetch the segment of the seenpage.
|
||||
mov ebx,[dstpage]
|
||||
mov ebx,[(GraphicViewPort ebx).GVPOffset]
|
||||
|
||||
; Determine if the mouse needs to be hidden at all. If this happens to be
|
||||
; a shadow blit to non visible page (who knows why!?) then don't bother to
|
||||
; hide the mouse since it isn't necessary.
|
||||
; cmp ebx,0A0000h
|
||||
; setne [BYTE PTR hidemouse] ; Flag that mouse need not be hidden.
|
||||
; jne short ??itsok
|
||||
mov esi,[RealModePtr]
|
||||
cmp [(KeyboardType esi).MState],0
|
||||
je short ??itsok
|
||||
mov [hidemouse],1
|
||||
call Hide_Mouse C ; Hides mouse again (just to be sure).
|
||||
??itsok:
|
||||
mov edi,[srcpage]
|
||||
mov esi,[(GraphicViewPort edi).GVPOffset]
|
||||
|
||||
mov eax,[(GraphicViewPort edi).GVPWidth]
|
||||
add eax,[(GraphicViewPort edi).GVPXAdd]
|
||||
push eax ; save width+xadd for later calc
|
||||
mov edx,[y]
|
||||
mul edx
|
||||
add eax,[x]
|
||||
add esi,eax
|
||||
; At this point, esi points to the source page and ebx points to the dest page
|
||||
sub ebx,esi ; esi+ebx == dest page pointer
|
||||
|
||||
mov edi,[shadow] ; EDI points to shadow buffer.
|
||||
|
||||
mov ecx,[height] ; get the height of the window in cx
|
||||
|
||||
mov edx,[RealModePtr]
|
||||
|
||||
; Calculate the row add module.
|
||||
pop eax ; restore width+xadd
|
||||
sub eax,[width]
|
||||
mov [modulo],eax
|
||||
|
||||
mov eax,[width]
|
||||
shr eax,2
|
||||
mov [dwordwidth],eax
|
||||
mov eax,[width]
|
||||
and eax,3
|
||||
mov [bytewidth],eax
|
||||
|
||||
;---------------------------------------
|
||||
; DOUBLE WORD shadow blit if possible.
|
||||
;---------------------------------------
|
||||
??dloop_top:
|
||||
push ecx
|
||||
mov ecx,[dwordwidth]
|
||||
|
||||
??lcontinue:
|
||||
repe cmpsd ; check the entire row for changed longs
|
||||
je short ??loop_top
|
||||
|
||||
; If this row would interfere with the mouse image, then hide it.
|
||||
cmp [hidemouse],0
|
||||
jnz short ??dok
|
||||
mov eax,[(KeyboardType edx).MouseY]
|
||||
sub eax,[(KeyboardType edx).MouseYHot]
|
||||
cmp eax,[y]
|
||||
jg short ??dok
|
||||
add eax,[(KeyboardType edx).MouseHeight]
|
||||
cmp eax,[y]
|
||||
jb short ??dok
|
||||
mov [hidemouse],1 ; Manual hide of the mouse.
|
||||
call Hide_Mouse C
|
||||
??dok:
|
||||
|
||||
mov eax,[esi-4]
|
||||
mov [ebx+esi-4],eax ; Update destination page.
|
||||
mov [edi-4],eax ; Update shadow buffer.
|
||||
or ecx,ecx
|
||||
jne short ??lcontinue
|
||||
|
||||
;---------------------------------------
|
||||
; Row loop start for BYTES.
|
||||
;---------------------------------------
|
||||
??loop_top:
|
||||
mov ecx,[bytewidth]
|
||||
|
||||
; Column loop start -- by bytes.
|
||||
??continue:
|
||||
repe cmpsb ; check the entire row for changed longs
|
||||
je short ??done_x
|
||||
|
||||
; If this row would interfere with the mouse image, then hide it.
|
||||
cmp [hidemouse],0
|
||||
jnz short ??bok
|
||||
mov eax,[(KeyboardType edx).MouseY]
|
||||
sub eax,[(KeyboardType edx).MouseYHot]
|
||||
cmp eax,[y]
|
||||
jg short ??bok
|
||||
add eax,[(KeyboardType edx).MouseHeight]
|
||||
cmp eax,[y]
|
||||
jl short ??bok
|
||||
mov [hidemouse],1 ; Manual hide of the mouse.
|
||||
call Hide_Mouse C
|
||||
??bok:
|
||||
|
||||
mov al,[esi-1]
|
||||
mov [ebx+esi-1],al ; Update destination page.
|
||||
mov [edi-1],al ; Update shadow buffer.
|
||||
|
||||
or ecx,ecx
|
||||
jne short ??continue
|
||||
|
||||
??done_x:
|
||||
inc [y]
|
||||
add esi,[modulo]
|
||||
pop ecx
|
||||
loop ??dloop_top
|
||||
|
||||
??fini:
|
||||
; Re show the mouse if it was hidden by this routine.
|
||||
cmp [hidemouse],0
|
||||
je short ??reallyfini
|
||||
call Show_Mouse C
|
||||
??reallyfini:
|
||||
ret
|
||||
|
||||
ENDP Shadow_Blit
|
||||
|
||||
END
|
||||
|
||||
|
578
WWFLAT32/MCGAPRIM/STAMP.ASM
Normal file
578
WWFLAT32/MCGAPRIM/STAMP.ASM
Normal file
@@ -0,0 +1,578 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 Library *
|
||||
;* *
|
||||
;* File Name : STAMP.ASM *
|
||||
;* *
|
||||
;* Programmer : Joe L. Bostic *
|
||||
;* *
|
||||
;* Start Date : August 23, 1993 *
|
||||
;* *
|
||||
;* Last Update : August 23, 1993 [JLB] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
INCLUDE "stamp.inc"
|
||||
|
||||
DATASEG
|
||||
|
||||
|
||||
LastIconset DD 0 ; Pointer to last iconset initialized.
|
||||
StampPtr DD 0 ; Pointer to icon data.
|
||||
|
||||
IsTrans DD 0 ; Pointer to transparent icon flag table.
|
||||
|
||||
MapPtr DD 0 ; Pointer to icon map.
|
||||
IconWidth DD 0 ; Width of icon in pixels.
|
||||
IconHeight DD 0 ; Height of icon in pixels.
|
||||
IconSize DD 0 ; Number of bytes for each icon data.
|
||||
IconCount DD 0 ; Number of icons in the set.
|
||||
|
||||
EVEN
|
||||
|
||||
CODESEG
|
||||
|
||||
; 256 color icon system.
|
||||
|
||||
;***********************************************************
|
||||
; INIT_STAMPS
|
||||
;
|
||||
; VOID cdecl Init_Stamps(VOID *icondata);
|
||||
;
|
||||
; This routine initializes the stamp data.
|
||||
; Bounds Checking: NONE
|
||||
;
|
||||
;*
|
||||
PROC Init_Stamps C near USES eax ebx edi
|
||||
ARG icondata:DWORD
|
||||
|
||||
; Verify legality of parameter.
|
||||
cmp [icondata],0
|
||||
je short ??fini
|
||||
|
||||
; Don't initialize if already initialized to this set (speed reasons).
|
||||
mov edi,[icondata]
|
||||
cmp [LastIconset],edi
|
||||
je short ??fini
|
||||
mov [LastIconset],edi
|
||||
|
||||
; Record number of icons in set.
|
||||
movzx eax,[(IControl_Type edi).Count]
|
||||
mov [IconCount],eax
|
||||
|
||||
; Record width of icon.
|
||||
movzx eax,[(IControl_Type edi).Width]
|
||||
mov [IconWidth],eax
|
||||
|
||||
; Record height of icon.
|
||||
movzx ebx,[(IControl_Type edi).Height]
|
||||
mov [IconHeight],ebx
|
||||
|
||||
; Record size of icon (in bytes).
|
||||
mul ebx
|
||||
mov [IconSize],eax
|
||||
|
||||
; Record hard pointer to icon map data.
|
||||
mov eax,[(IControl_Type edi).Map]
|
||||
add eax,edi
|
||||
mov [MapPtr],eax
|
||||
|
||||
??nomap:
|
||||
; Record hard pointer to icon data.
|
||||
mov eax,edi
|
||||
add eax,[(IControl_Type edi).Icons]
|
||||
mov [StampPtr],eax
|
||||
|
||||
; Record the transparent table.
|
||||
mov eax,edi
|
||||
add eax,[(IControl_Type edi).TransFlag]
|
||||
mov [IsTrans],eax
|
||||
|
||||
??fini:
|
||||
ret
|
||||
|
||||
ENDP Init_Stamps
|
||||
|
||||
|
||||
;***********************************************************
|
||||
|
||||
|
||||
;***********************************************************
|
||||
; DRAW_STAMP
|
||||
;
|
||||
; VOID cdecl MCGA_Draw_Stamp(VOID *icondata, WORD icon, WORD x_pixel, WORD y_pixel, VOID *remap);
|
||||
;
|
||||
; This routine renders the icon at the given coordinate.
|
||||
;
|
||||
; The remap table is a 256 byte simple pixel translation table to use when
|
||||
; drawing the icon. Transparency check is performed AFTER the remap so it is possible to
|
||||
; remap valid colors to be invisible (for special effect reasons).
|
||||
; This routine is fastest when no remap table is passed in.
|
||||
;*
|
||||
PROC MCGA_Draw_Stamp C near
|
||||
|
||||
ARG this:DWORD ; this is a member function
|
||||
ARG icondata:DWORD ; Pointer to icondata.
|
||||
ARG icon:DWORD ; Icon number to draw.
|
||||
ARG x_pixel:DWORD ; X coordinate of icon.
|
||||
ARG y_pixel:DWORD ; Y coordinate of icon.
|
||||
ARG remap:DWORD ; Remap table.
|
||||
|
||||
LOCAL modulo:DWORD ; Modulo to get to next row.
|
||||
LOCAL iwidth:DWORD ; Icon width (here for speedy access).
|
||||
LOCAL doremap:BYTE ; Should remapping occur?
|
||||
|
||||
pushad
|
||||
cmp [icondata],0
|
||||
je ??out
|
||||
|
||||
; Initialize the stamp data if necessary.
|
||||
mov eax,[icondata]
|
||||
cmp [LastIconset],eax
|
||||
je short ??noreset
|
||||
call Init_Stamps C,eax
|
||||
??noreset:
|
||||
|
||||
; Determine if the icon number requested is actually in the set.
|
||||
; Perform the logical icon to actual icon number remap if necessary.
|
||||
mov ebx,[icon]
|
||||
cmp [MapPtr],0
|
||||
je short ??notmap
|
||||
mov edi,[MapPtr]
|
||||
mov bl,[edi+ebx]
|
||||
??notmap:
|
||||
cmp ebx,[IconCount]
|
||||
jae ??out
|
||||
mov [icon],ebx ; Updated icon number.
|
||||
|
||||
; If the remap table pointer passed in is NULL, then flag this condition
|
||||
; so that the faster (non-remapping) icon draw loop will be used.
|
||||
cmp [remap],0
|
||||
setne [doremap]
|
||||
|
||||
; Get pointer to position to render icon. EDI = ptr to destination page.
|
||||
mov ebx,[this]
|
||||
mov edi,[(GraphicViewPort ebx).GVPOffset]
|
||||
mov eax,[(GraphicViewPort ebx).GVPWidth]
|
||||
add eax,[(GraphicViewPort ebx).GVPXAdd]
|
||||
push eax ; save viewport full width for lower
|
||||
mul [y_pixel]
|
||||
add edi,eax
|
||||
add edi,[x_pixel]
|
||||
|
||||
; Determine row modulo for advancing to next line.
|
||||
pop eax ; retrieve viewport width
|
||||
sub eax,[IconWidth]
|
||||
mov [modulo],eax
|
||||
|
||||
; Setup some working variables.
|
||||
mov ecx,[IconHeight] ; Row counter.
|
||||
mov eax,[IconWidth]
|
||||
mov [iwidth],eax ; Stack copy of byte width for easy BP access.
|
||||
|
||||
; Fetch pointer to start of icon's data. ESI = ptr to icon data.
|
||||
mov eax,[icon]
|
||||
mul [IconSize]
|
||||
mov esi,[StampPtr]
|
||||
add esi,eax
|
||||
|
||||
; Determine whether simple icon draw is sufficient or whether the
|
||||
; extra remapping icon draw is needed.
|
||||
cmp [BYTE PTR doremap],0
|
||||
je short ??istranscheck
|
||||
|
||||
;************************************************************
|
||||
; Complex icon draw -- extended remap.
|
||||
; EBX = Palette pointer (ready for XLAT instruction).
|
||||
; EDI = Pointer to icon destination in page.
|
||||
; ESI = Pointer to icon data.
|
||||
; ECX = Number of pixel rows.
|
||||
;;; mov edx,[remap]
|
||||
mov ebx,[remap]
|
||||
xor eax,eax
|
||||
??xrowloop:
|
||||
push ecx
|
||||
mov ecx,[iwidth]
|
||||
|
||||
??xcolumnloop:
|
||||
lodsb
|
||||
;;; mov ebx,edx
|
||||
;;; add ebx,eax
|
||||
;;; mov al,[ebx] ; New real color to draw.
|
||||
xlatb
|
||||
or al,al
|
||||
jz short ??xskip1 ; Transparency skip check.
|
||||
mov [edi],al
|
||||
??xskip1:
|
||||
inc edi
|
||||
loop ??xcolumnloop
|
||||
|
||||
pop ecx
|
||||
add edi,[modulo]
|
||||
loop ??xrowloop
|
||||
jmp short ??out
|
||||
|
||||
|
||||
;************************************************************
|
||||
; Check to see if transparent or generic draw is necessary.
|
||||
??istranscheck:
|
||||
mov ebx,[IsTrans]
|
||||
add ebx,[icon]
|
||||
cmp [BYTE PTR ebx],0
|
||||
jne short ??rowloop
|
||||
|
||||
;************************************************************
|
||||
; Fast non-transparent icon draw routine.
|
||||
; ES:DI = Pointer to icon destination in page.
|
||||
; DS:SI = Pointer to icon data.
|
||||
; CX = Number of pixel rows.
|
||||
mov ebx,ecx
|
||||
shr ebx,2
|
||||
mov edx,[modulo]
|
||||
mov eax,[iwidth]
|
||||
shr eax,2
|
||||
??loop1:
|
||||
mov ecx,eax
|
||||
rep movsd
|
||||
add edi,edx
|
||||
|
||||
mov ecx,eax
|
||||
rep movsd
|
||||
add edi,edx
|
||||
|
||||
mov ecx,eax
|
||||
rep movsd
|
||||
add edi,edx
|
||||
|
||||
mov ecx,eax
|
||||
rep movsd
|
||||
add edi,edx
|
||||
|
||||
dec ebx
|
||||
jnz ??loop1
|
||||
jmp short ??out
|
||||
|
||||
;************************************************************
|
||||
; Transparent icon draw routine -- no extended remap.
|
||||
; ES:DI = Pointer to icon destination in page.
|
||||
; DS:SI = Pointer to icon data.
|
||||
; CX = Number of pixel rows.
|
||||
??rowloop:
|
||||
push ecx
|
||||
mov ecx,[iwidth]
|
||||
|
||||
??columnloop:
|
||||
lodsb
|
||||
or al,al
|
||||
jz short ??skip1 ; Transparency check.
|
||||
mov [edi],al
|
||||
??skip1:
|
||||
inc edi
|
||||
loop ??columnloop
|
||||
|
||||
pop ecx
|
||||
add edi,[modulo]
|
||||
loop ??rowloop
|
||||
|
||||
; Cleanup and exit icon drawing routine.
|
||||
??out:
|
||||
popad
|
||||
ret
|
||||
|
||||
ENDP MCGA_Draw_Stamp
|
||||
|
||||
;***********************************************************
|
||||
; DRAW_STAMP_CLIP
|
||||
;
|
||||
; VOID cdecl MCGA_Draw_Stamp_Clip(VOID *icondata, WORD icon, WORD x_pixel, WORD y_pixel, VOID *remap, LONG min_x, LONG min_y, LONG max_x, LONG max_y);
|
||||
;
|
||||
; This routine renders the icon at the given coordinate.
|
||||
;
|
||||
; The remap table is a 256 byte simple pixel translation table to use when
|
||||
; drawing the icon. Transparency check is performed AFTER the remap so it is possible to
|
||||
; remap valid colors to be invisible (for special effect reasons).
|
||||
; This routine is fastest when no remap table is passed in.
|
||||
;*
|
||||
PROC MCGA_Draw_Stamp_Clip C near
|
||||
|
||||
ARG this:DWORD ; this is a member function
|
||||
ARG icondata:DWORD ; Pointer to icondata.
|
||||
ARG icon:DWORD ; Icon number to draw.
|
||||
ARG x_pixel:DWORD ; X coordinate of icon.
|
||||
ARG y_pixel:DWORD ; Y coordinate of icon.
|
||||
ARG remap:DWORD ; Remap table.
|
||||
ARG min_x:DWORD ; Clipping rectangle boundary
|
||||
ARG min_y:DWORD ; Clipping rectangle boundary
|
||||
ARG max_x:DWORD ; Clipping rectangle boundary
|
||||
ARG max_y:DWORD ; Clipping rectangle boundary
|
||||
|
||||
LOCAL modulo:DWORD ; Modulo to get to next row.
|
||||
LOCAL iwidth:DWORD ; Icon width (here for speedy access).
|
||||
LOCAL skip:DWORD ; amount to skip per row of icon data
|
||||
LOCAL doremap:BYTE ; Should remapping occur?
|
||||
|
||||
pushad
|
||||
cmp [icondata],0
|
||||
je ??out2
|
||||
|
||||
; Initialize the stamp data if necessary.
|
||||
mov eax,[icondata]
|
||||
cmp [LastIconset],eax
|
||||
je short ??noreset2
|
||||
call Init_Stamps C,eax
|
||||
??noreset2:
|
||||
|
||||
; Determine if the icon number requested is actually in the set.
|
||||
; Perform the logical icon to actual icon number remap if necessary.
|
||||
mov ebx,[icon]
|
||||
cmp [MapPtr],0
|
||||
je short ??notmap2
|
||||
mov edi,[MapPtr]
|
||||
mov bl,[edi+ebx]
|
||||
??notmap2:
|
||||
cmp ebx,[IconCount]
|
||||
jae ??out2
|
||||
mov [icon],ebx ; Updated icon number.
|
||||
|
||||
; Setup some working variables.
|
||||
mov ecx,[IconHeight] ; Row counter.
|
||||
mov eax,[IconWidth]
|
||||
mov [iwidth],eax ; Stack copy of byte width for easy BP access.
|
||||
|
||||
; Fetch pointer to start of icon's data. ESI = ptr to icon data.
|
||||
mov eax,[icon]
|
||||
mul [IconSize]
|
||||
mov esi,[StampPtr]
|
||||
add esi,eax
|
||||
|
||||
; Update the clipping window coordinates to be valid maxes instead of width & height
|
||||
; , and change the coordinates to be window-relative
|
||||
mov ebx,[min_x]
|
||||
add [max_x],ebx
|
||||
add [x_pixel],ebx ; make it window-relative
|
||||
mov ebx,[min_y]
|
||||
add [max_y],ebx
|
||||
add [y_pixel],ebx ; make it window-relative
|
||||
|
||||
; See if the icon is within the clipping window
|
||||
; First, verify that the icon position is less than the maximums
|
||||
mov ebx,[x_pixel]
|
||||
cmp ebx,[max_x]
|
||||
jge ??out2
|
||||
mov ebx,[y_pixel]
|
||||
cmp ebx,[max_y]
|
||||
jge ??out2
|
||||
; Now verify that the icon position is >= the minimums
|
||||
add ebx,[IconHeight]
|
||||
cmp ebx,[min_y]
|
||||
jle ??out2
|
||||
mov ebx,[x_pixel]
|
||||
add ebx,[IconWidth]
|
||||
cmp ebx,[min_x]
|
||||
jle ??out2
|
||||
|
||||
; Now, clip the x, y, width, and height variables to be within the
|
||||
; clipping rectangle
|
||||
mov ebx,[x_pixel]
|
||||
cmp ebx,[min_x]
|
||||
jge ??nominxclip
|
||||
; x < minx, so must clip
|
||||
mov ebx,[min_x]
|
||||
sub ebx,[x_pixel]
|
||||
add esi,ebx ; source ptr += (minx - x)
|
||||
sub [iwidth],ebx ; icon width -= (minx - x)
|
||||
mov ebx,[min_x]
|
||||
mov [x_pixel],ebx
|
||||
|
||||
??nominxclip:
|
||||
mov eax,[IconWidth]
|
||||
sub eax,[iwidth]
|
||||
mov [skip],eax
|
||||
|
||||
; Check for x+width > max_x
|
||||
mov eax,[x_pixel]
|
||||
add eax,[iwidth]
|
||||
cmp eax,[max_x]
|
||||
jle ??nomaxxclip
|
||||
; x+width is greater than max_x, so must clip width down
|
||||
mov eax,[iwidth] ; eax = old width
|
||||
mov ebx,[max_x]
|
||||
sub ebx,[x_pixel]
|
||||
mov [iwidth],ebx ; iwidth = max_x - xpixel
|
||||
sub eax,ebx
|
||||
add [skip],eax ; skip += (old width - iwidth)
|
||||
??nomaxxclip:
|
||||
; check if y < miny
|
||||
mov eax,[min_y]
|
||||
cmp eax,[y_pixel] ; if(miny <= y_pixel), no clip needed
|
||||
jle ??nominyclip
|
||||
sub eax,[y_pixel]
|
||||
sub ecx,eax ; height -= (miny - y)
|
||||
mul [IconWidth]
|
||||
add esi,eax ; icon source ptr += (width * (miny - y))
|
||||
mov eax,[min_y]
|
||||
mov [y_pixel],eax ; y = miny
|
||||
??nominyclip:
|
||||
; check if (y+height) > max y
|
||||
mov eax,[y_pixel]
|
||||
add eax,ecx
|
||||
cmp eax,[max_y] ; if (y + height <= max_y), no clip needed
|
||||
jle ??nomaxyclip
|
||||
mov ecx,[max_y] ; height = max_y - y_pixel
|
||||
sub ecx,[y_pixel]
|
||||
??nomaxyclip:
|
||||
|
||||
; If the remap table pointer passed in is NULL, then flag this condition
|
||||
; so that the faster (non-remapping) icon draw loop will be used.
|
||||
cmp [remap],0
|
||||
setne [doremap]
|
||||
|
||||
; Get pointer to position to render icon. EDI = ptr to destination page.
|
||||
mov ebx,[this]
|
||||
mov edi,[(GraphicViewPort ebx).GVPOffset]
|
||||
mov eax,[(GraphicViewPort ebx).GVPWidth]
|
||||
add eax,[(GraphicViewPort ebx).GVPXAdd]
|
||||
push eax ; save viewport full width for lower
|
||||
mul [y_pixel]
|
||||
add edi,eax
|
||||
add edi,[x_pixel]
|
||||
|
||||
; Determine row modulo for advancing to next line.
|
||||
pop eax ; retrieve viewport width
|
||||
sub eax,[iwidth]
|
||||
mov [modulo],eax
|
||||
|
||||
; Determine whether simple icon draw is sufficient or whether the
|
||||
; extra remapping icon draw is needed.
|
||||
cmp [BYTE PTR doremap],0
|
||||
je short ??istranscheck2
|
||||
|
||||
;************************************************************
|
||||
; Complex icon draw -- extended remap.
|
||||
; EBX = Palette pointer (ready for XLAT instruction).
|
||||
; EDI = Pointer to icon destination in page.
|
||||
; ESI = Pointer to icon data.
|
||||
; ECX = Number of pixel rows.
|
||||
mov ebx,[remap]
|
||||
xor eax,eax
|
||||
??xrowloopc:
|
||||
push ecx
|
||||
mov ecx,[iwidth]
|
||||
|
||||
??xcolumnloopc:
|
||||
lodsb
|
||||
xlatb
|
||||
or al,al
|
||||
jz short ??xskip1c ; Transparency skip check.
|
||||
mov [edi],al
|
||||
??xskip1c:
|
||||
inc edi
|
||||
loop ??xcolumnloopc
|
||||
|
||||
pop ecx
|
||||
add edi,[modulo]
|
||||
add esi,[skip]
|
||||
loop ??xrowloopc
|
||||
jmp short ??out2
|
||||
|
||||
|
||||
;************************************************************
|
||||
; Check to see if transparent or generic draw is necessary.
|
||||
??istranscheck2:
|
||||
mov ebx,[IsTrans]
|
||||
add ebx,[icon]
|
||||
cmp [BYTE PTR ebx],0
|
||||
jne short ??rowloopc
|
||||
|
||||
;************************************************************
|
||||
; Fast non-transparent icon draw routine.
|
||||
; ES:DI = Pointer to icon destination in page.
|
||||
; DS:SI = Pointer to icon data.
|
||||
; CX = Number of pixel rows.
|
||||
mov ebx,ecx
|
||||
mov edx,[modulo]
|
||||
mov eax,[iwidth]
|
||||
|
||||
; Check for dword-optimized loop possible
|
||||
test eax,3
|
||||
jnz ??loop1c ; if eax & 3, must use byte loop
|
||||
shr eax,2
|
||||
??loop1dw:
|
||||
mov ecx,eax
|
||||
rep movsd
|
||||
add edi,edx
|
||||
add esi,[skip]
|
||||
dec ebx
|
||||
jnz ??loop1dw
|
||||
jmp short ??out2
|
||||
|
||||
??loop1c:
|
||||
mov ecx,eax
|
||||
rep movsb
|
||||
add edi,edx
|
||||
add esi,[skip]
|
||||
|
||||
dec ebx
|
||||
jnz ??loop1c
|
||||
jmp short ??out2
|
||||
|
||||
;************************************************************
|
||||
; Transparent icon draw routine -- no extended remap.
|
||||
; ES:DI = Pointer to icon destination in page.
|
||||
; DS:SI = Pointer to icon data.
|
||||
; CX = Number of pixel rows.
|
||||
??rowloopc:
|
||||
push ecx
|
||||
mov ecx,[iwidth]
|
||||
|
||||
??columnloopc:
|
||||
lodsb
|
||||
or al,al
|
||||
jz short ??skip1c ; Transparency check.
|
||||
mov [edi],al
|
||||
??skip1c:
|
||||
inc edi
|
||||
loop ??columnloopc
|
||||
|
||||
pop ecx
|
||||
add edi,[modulo]
|
||||
add esi,[skip]
|
||||
loop ??rowloopc
|
||||
|
||||
; Cleanup and exit icon drawing routine.
|
||||
??out2:
|
||||
popad
|
||||
ret
|
||||
|
||||
ENDP MCGA_Draw_Stamp_Clip
|
||||
|
||||
END
|
38
WWFLAT32/MCGAPRIM/STAMP.BAK
Normal file
38
WWFLAT32/MCGAPRIM/STAMP.BAK
Normal file
@@ -0,0 +1,38 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
; This is the control structure at the start of a loaded icon set. It must match
|
||||
; the structure in ICONSET.C! This structure MUST be a multiple of 16 bytes long.
|
||||
STRUC IControl_Type
|
||||
Width DW ? ; Width in pixels (per icon).
|
||||
Height DW ? ; Height in pixels (per icon).
|
||||
Count DW ? ; Number of icons in this set.
|
||||
Allocated DW ? ; Was this iconset allocated?
|
||||
MapWidth DW ? ; Width of icon map (in icons).
|
||||
MapHeight DW ? ; Height of icon map (in icons).
|
||||
Size DD ? ; Size of entire iconset memory block.
|
||||
Icons DD ? ; Offset from buffer start to icon data.
|
||||
Palettes DD ? ; Offset from buffer start to palette data.
|
||||
Remaps DD ? ; Offset from buffer start to remap index data.
|
||||
TransFlag DD ? ; Offset for transparency flag data.
|
||||
ColorMap DD ? ; Color control map offset.
|
||||
Map DD ? ; Icon map offset.
|
||||
ENDS
|
||||
|
||||
ICON256 EQU 1
|
||||
|
38
WWFLAT32/MCGAPRIM/STAMP.INC
Normal file
38
WWFLAT32/MCGAPRIM/STAMP.INC
Normal file
@@ -0,0 +1,38 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
; This is the control structure at the start of a loaded icon set. It must match
|
||||
; the structure in ICONSET.C!
|
||||
STRUC IControl_Type
|
||||
Width DW ? ; Width in pixels (per icon).
|
||||
Height DW ? ; Height in pixels (per icon).
|
||||
Count DW ? ; Number of icons in this set.
|
||||
Allocated DW ? ; Was this iconset allocated?
|
||||
MapWidth DW ? ; Width of icon map (in icons).
|
||||
MapHeight DW ? ; Height of icon map (in icons).
|
||||
Size DD ? ; Size of entire iconset memory block.
|
||||
Icons DD ? ; Offset from buffer start to icon data.
|
||||
Palettes DD ? ; Offset from buffer start to palette data.
|
||||
Remaps DD ? ; Offset from buffer start to remap index data.
|
||||
TransFlag DD ? ; Offset for transparency flag data.
|
||||
ColorMap DD ? ; Color control map offset.
|
||||
Map DD ? ; Icon map offset.
|
||||
ENDS
|
||||
|
||||
ICON256 EQU 1
|
||||
|
103
WWFLAT32/MCGAPRIM/SZREGION.ASM
Normal file
103
WWFLAT32/MCGAPRIM/SZREGION.ASM
Normal file
@@ -0,0 +1,103 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Calculate size of an MCGA region *
|
||||
;* *
|
||||
;* File Name : REGIONSZ.ASM *
|
||||
;* *
|
||||
;* Programmer : Barry W. Green *
|
||||
;* *
|
||||
;* Start Date : March 1, 1995 *
|
||||
;* *
|
||||
;* Last Update : March 1, 1995 [BWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* VVPC::Size_Of_Region - calculate MCGA region size *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
GLOBAL MCGA_Size_Of_Region : NEAR
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* VVPC::Size_Of_Region - calculate MCGA region size *
|
||||
;* *
|
||||
;* INPUT: DWORD the width of the region *
|
||||
;* *
|
||||
;* DWORD the height of the region *
|
||||
;* *
|
||||
;* OUTPUT: calculated size of the region (MCGA = width * height) *
|
||||
;* *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 03/01/1995 BWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC MCGA_Size_Of_Region C near
|
||||
USES ebx,ecx,edx
|
||||
|
||||
ARG this:DWORD ; this is a member function
|
||||
ARG width:DWORD ; width of region
|
||||
ARG height:DWORD ; height of region
|
||||
|
||||
;*===================================================================
|
||||
; Get the viewport information
|
||||
;*===================================================================
|
||||
mov ebx,[this] ; get a pointer to viewport
|
||||
xor eax,eax
|
||||
mov ecx,[(GraphicViewPort ebx).GVPHeight] ; ecx = height of viewport
|
||||
mov edx,[(GraphicViewPort ebx).GVPWidth] ; edx = width of viewport
|
||||
|
||||
;*===================================================================
|
||||
; Verify that the width is legal
|
||||
;*===================================================================
|
||||
mov eax,[width] ; find the width
|
||||
cmp eax,edx ; is it too wide?
|
||||
jb short ??wok ; if not, leave it alone
|
||||
mov eax,edx ; otherwise clip it
|
||||
|
||||
;*===================================================================
|
||||
; Verify that the height is ok
|
||||
;*===================================================================
|
||||
??wok: mov ebx,[height] ; get the height
|
||||
cmp ebx,ecx ; is it too tall?
|
||||
jb ??hok ; if not, leave it alone
|
||||
mov ebx,ecx ; otherwise clip it
|
||||
|
||||
;*===================================================================
|
||||
; Now multiply 'em to calculate the size of the region
|
||||
;*===================================================================
|
||||
??hok: mul ebx ; size = w * h
|
||||
|
||||
ret
|
||||
ENDP MCGA_Size_Of_Region
|
||||
|
||||
END
|
||||
|
||||
|
292
WWFLAT32/MCGAPRIM/TOBUFF.ASM
Normal file
292
WWFLAT32/MCGAPRIM/TOBUFF.ASM
Normal file
@@ -0,0 +1,292 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : TOBUFFER.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 8, 1994 *
|
||||
;* Last Update : Feb 10, 1995 [jrj] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* VVC::TOBUFFER -- Copies a virtual viewport to a linear buffer *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
LOCALS ??
|
||||
|
||||
|
||||
TRANSP equ 0
|
||||
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
;* VIVC::TOBUFFER -- Copies a virtual viewport to a linear buffer *
|
||||
;* *
|
||||
;* INPUT: BYTE * dest - buffer to copy to *
|
||||
;* size - size of the buffer to copy to *
|
||||
;* x_pixel - x pixel on viewport to copy from *
|
||||
;* y_pixel - y pixel on viewport to copy from *
|
||||
;* pixel_width - the width of copy region *
|
||||
;* pixel_height - the height of copy region *
|
||||
;* *
|
||||
;* OUTPUT: none *
|
||||
;* *
|
||||
;* WARNINGS: Coordinates and dimensions will be adjusted if they exceed *
|
||||
;* the boundaries. In the event that no adjustment is *
|
||||
;* possible this routine will abort. If the size of the *
|
||||
;* region to copy exceeds the size passed in for the buffer *
|
||||
;* the routine will automatically abort. *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 06/15/1994 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC MCGA_To_Buffer C near
|
||||
USES ebx,ecx,edx,esi,edi
|
||||
|
||||
;*===================================================================
|
||||
;* define the arguements that our function takes.
|
||||
;*===================================================================
|
||||
ARG this:DWORD ; this is a class member function
|
||||
ARG x_pixel:DWORD ; Page X pixel coordinate.
|
||||
ARG y_pixel:DWORD ; Page Y pixel coordinate.
|
||||
ARG pixel_width:DWORD ; Width of region in pixels.
|
||||
ARG pixel_height:DWORD ; Height of region in pixels.
|
||||
ARG dest:DWORD ; the buffer to copy to
|
||||
ARG size:DWORD ; the size of the buffer
|
||||
|
||||
;*===================================================================
|
||||
; Define some locals so that we can handle things quickly
|
||||
;*===================================================================
|
||||
LOCAL x1_pixel :dword
|
||||
LOCAL y1_pixel :dword
|
||||
LOCAL dest_x1 : dword
|
||||
LOCAL dest_y1 : dword
|
||||
LOCAL dest_ajust_width:DWORD
|
||||
LOCAL scr_ajust_width:DWORD
|
||||
LOCAL dest_area : dword
|
||||
|
||||
; Clip dest Rectangle against source Window boundaries.
|
||||
|
||||
mov [ dest_x1 ] , 0
|
||||
mov [ dest_y1 ] , 0
|
||||
|
||||
mov esi , [ this ] ; get ptr to dest
|
||||
xor ecx , ecx
|
||||
xor edx , edx
|
||||
mov edi , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
|
||||
mov ebx , [ x_pixel ]
|
||||
mov eax , [ x_pixel ]
|
||||
add ebx , [ pixel_width ]
|
||||
shld ecx , eax , 1
|
||||
mov [ x1_pixel ] , ebx
|
||||
inc edi
|
||||
shld edx , ebx , 1
|
||||
sub eax , edi
|
||||
sub ebx , edi
|
||||
shld ecx , eax , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
mov edi,[ ( VideoViewPort esi) . VIVPHeight ] ; get height into register
|
||||
mov ebx , [ y_pixel ]
|
||||
mov eax , [ y_pixel ]
|
||||
add ebx , [ pixel_height ]
|
||||
shld ecx , eax , 1
|
||||
mov [ y1_pixel ] , ebx
|
||||
inc edi
|
||||
shld edx , ebx , 1
|
||||
sub eax , edi
|
||||
sub ebx , edi
|
||||
shld ecx , eax , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
xor cl , 5
|
||||
xor dl , 5
|
||||
mov al , cl
|
||||
test dl , cl
|
||||
jnz ??real_out
|
||||
or al , dl
|
||||
jz ??do_blit
|
||||
|
||||
test cl , 1000b
|
||||
jz ??scr_left_ok
|
||||
mov eax , [ x_pixel ]
|
||||
neg eax
|
||||
mov [ x_pixel ] , 0
|
||||
mov [ dest_x1 ] , eax
|
||||
|
||||
??scr_left_ok:
|
||||
test cl , 0010b
|
||||
jz ??scr_bottom_ok
|
||||
mov eax , [ y_pixel ]
|
||||
neg eax
|
||||
mov [ y_pixel ] , 0
|
||||
mov [ dest_y1 ] , eax
|
||||
|
||||
??scr_bottom_ok:
|
||||
test dl , 0100b
|
||||
jz ??scr_right_ok
|
||||
mov eax , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
|
||||
mov [ x1_pixel ] , eax
|
||||
??scr_right_ok:
|
||||
test dl , 0001b
|
||||
jz ??do_blit
|
||||
mov eax , [ (VideoViewPort esi) . VIVPHeight ] ; get width into register
|
||||
mov [ y1_pixel ] , eax
|
||||
|
||||
??do_blit:
|
||||
|
||||
cld
|
||||
|
||||
mov eax , [ (VideoViewPort esi) . VIVPXAdd ]
|
||||
add eax , [ (VideoViewPort esi) . VIVPWidth ]
|
||||
mov esi , [ (VideoViewPort esi) . VIVPOffset ]
|
||||
|
||||
mov ecx , eax
|
||||
mul [ y_pixel ]
|
||||
add esi , [ x_pixel ]
|
||||
add esi , eax
|
||||
|
||||
add ecx , [ x_pixel ]
|
||||
sub ecx , [ x1_pixel ]
|
||||
mov [ scr_ajust_width ] , ecx
|
||||
|
||||
mov edi , [ dest ]
|
||||
mov eax , [ pixel_width ]
|
||||
sub eax , [ x1_pixel ]
|
||||
add eax , [ x_pixel ]
|
||||
mov [ dest_ajust_width ] , eax
|
||||
|
||||
mov eax , [ dest_y1 ]
|
||||
mul [ pixel_width ]
|
||||
add eax , [ dest_x1 ]
|
||||
add edi , eax
|
||||
|
||||
mov edx , [ y1_pixel ]
|
||||
mov eax , [ x1_pixel ]
|
||||
sub edx , [ y_pixel ]
|
||||
jle ??real_out
|
||||
sub eax , [ x_pixel ]
|
||||
jle ??real_out
|
||||
|
||||
mov ebx , [ pixel_width ]
|
||||
imul ebx , edx
|
||||
cmp ebx , [ size ]
|
||||
jg ??real_out
|
||||
|
||||
|
||||
; ********************************************************************
|
||||
; Forward bitblit only
|
||||
|
||||
IF TRANSP
|
||||
cmp [ transp ] , 0
|
||||
jnz ??forward_Blit_trans
|
||||
ENDIF
|
||||
|
||||
; the inner loop is so efficient that
|
||||
; the optimal consept no longer apply because
|
||||
; the optimal byte have to by a number greather than 9 bytes
|
||||
cmp eax , 10
|
||||
jl ??forward_loop_bytes
|
||||
|
||||
??forward_loop_dword:
|
||||
mov ecx , edi
|
||||
mov ebx , eax
|
||||
neg ecx
|
||||
and ecx , 3
|
||||
sub ebx , ecx
|
||||
rep movsb
|
||||
mov ecx , ebx
|
||||
shr ecx , 2
|
||||
rep movsd
|
||||
mov ecx , ebx
|
||||
and ecx , 3
|
||||
rep movsb
|
||||
add esi , [ scr_ajust_width ]
|
||||
add edi , [ dest_ajust_width ]
|
||||
dec edx
|
||||
jnz ??forward_loop_dword
|
||||
ret
|
||||
|
||||
??forward_loop_bytes:
|
||||
mov ecx , eax
|
||||
rep movsb
|
||||
add esi , [ scr_ajust_width ]
|
||||
add edi , [ dest_ajust_width ]
|
||||
dec edx ; decrement the height
|
||||
jnz ??forward_loop_bytes
|
||||
ret
|
||||
|
||||
|
||||
IF TRANSP
|
||||
|
||||
??forward_Blit_trans:
|
||||
mov ecx , eax
|
||||
and ecx , 01fh
|
||||
lea ecx , [ ecx + ecx * 4 ]
|
||||
neg ecx
|
||||
shr eax , 5
|
||||
lea ecx , [ ??transp_reference + ecx * 2 ]
|
||||
mov [ y1_pixel ] , ecx
|
||||
|
||||
??forward_loop_trans:
|
||||
mov ecx , eax
|
||||
jmp [ y1_pixel ]
|
||||
??forward_trans_line:
|
||||
REPT 32
|
||||
local transp_pixel
|
||||
mov bl , [ esi ]
|
||||
test bl , bl
|
||||
jz transp_pixel
|
||||
mov [ edi ] , bl
|
||||
transp_pixel:
|
||||
inc esi
|
||||
inc edi
|
||||
ENDM
|
||||
??transp_reference:
|
||||
dec ecx
|
||||
jge ??forward_trans_line
|
||||
add esi , [ scr_ajust_width ]
|
||||
add edi , [ dest_ajust_width ]
|
||||
dec edx
|
||||
jnz ??forward_loop_trans
|
||||
ret
|
||||
ENDIF
|
||||
|
||||
??real_out:
|
||||
ret
|
||||
|
||||
ENDP MCGA_To_Buffer
|
||||
|
||||
END
|
||||
|
294
WWFLAT32/MCGAPRIM/TOPAGE.ASM
Normal file
294
WWFLAT32/MCGAPRIM/TOPAGE.ASM
Normal file
@@ -0,0 +1,294 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : TOPAGE.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 8, 1994 *
|
||||
;* *
|
||||
;* Last Update : June 15, 1994 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Buffer_To_Page -- Copies a linear buffer to a virtual viewport *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
TRANSP equ 0
|
||||
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* VVC::TOPAGE -- Copies a linear buffer to a virtual viewport *
|
||||
;* *
|
||||
;* INPUT: WORD x_pixel - x pixel on viewport to copy from *
|
||||
;* WORD y_pixel - y pixel on viewport to copy from *
|
||||
;* WORD pixel_width - the width of copy region *
|
||||
;* WORD pixel_height - the height of copy region *
|
||||
;* BYTE * src - buffer to copy from *
|
||||
;* VVPC * dest - virtual viewport to copy to *
|
||||
;* *
|
||||
;* OUTPUT: none *
|
||||
;* *
|
||||
;* WARNINGS: Coordinates and dimensions will be adjusted if they exceed *
|
||||
;* the boundaries. In the event that no adjustment is *
|
||||
;* possible this routine will abort. If the size of the *
|
||||
;* region to copy exceeds the size passed in for the buffer *
|
||||
;* the routine will automatically abort. *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 06/15/1994 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC MCGA_Buffer_To_Page C near
|
||||
USES eax,ebx,ecx,edx,esi,edi
|
||||
|
||||
;*===================================================================
|
||||
;* define the arguements that our function takes.
|
||||
;*===================================================================
|
||||
ARG x_pixel :DWORD ; x pixel position in source
|
||||
ARG y_pixel :DWORD ; y pixel position in source
|
||||
ARG pixel_width :DWORD ; width of rectangle to blit
|
||||
ARG pixel_height:DWORD ; height of rectangle to blit
|
||||
ARG src :DWORD ; this is a member function
|
||||
ARG dest :DWORD ; what are we blitting to
|
||||
|
||||
; ARG trans :DWORD ; do we deal with transparents?
|
||||
|
||||
;*===================================================================
|
||||
; Define some locals so that we can handle things quickly
|
||||
;*===================================================================
|
||||
LOCAL x1_pixel :dword
|
||||
LOCAL y1_pixel :dword
|
||||
local scr_x : dword
|
||||
local scr_y : dword
|
||||
LOCAL dest_ajust_width:DWORD
|
||||
LOCAL scr_ajust_width:DWORD
|
||||
LOCAL dest_area : dword
|
||||
|
||||
cmp [ src ] , 0
|
||||
jz ??real_out
|
||||
|
||||
|
||||
; Clip dest Rectangle against source Window boundaries.
|
||||
|
||||
mov [ scr_x ] , 0
|
||||
mov [ scr_y ] , 0
|
||||
mov esi , [ dest ] ; get ptr to dest
|
||||
xor ecx , ecx
|
||||
xor edx , edx
|
||||
mov edi , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
|
||||
mov ebx , [ x_pixel ]
|
||||
mov eax , [ x_pixel ]
|
||||
add ebx , [ pixel_width ]
|
||||
shld ecx , eax , 1
|
||||
mov [ x1_pixel ] , ebx
|
||||
inc edi
|
||||
shld edx , ebx , 1
|
||||
sub eax , edi
|
||||
sub ebx , edi
|
||||
shld ecx , eax , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
mov edi,[ ( VideoViewPort esi) . VIVPHeight ] ; get height into register
|
||||
mov ebx , [ y_pixel ]
|
||||
mov eax , [ y_pixel ]
|
||||
add ebx , [ pixel_height ]
|
||||
shld ecx , eax , 1
|
||||
mov [ y1_pixel ] , ebx
|
||||
inc edi
|
||||
shld edx , ebx , 1
|
||||
sub eax , edi
|
||||
sub ebx , edi
|
||||
shld ecx , eax , 1
|
||||
shld edx , ebx , 1
|
||||
|
||||
xor cl , 5
|
||||
xor dl , 5
|
||||
mov al , cl
|
||||
test dl , cl
|
||||
jnz ??real_out
|
||||
or al , dl
|
||||
jz ??do_blit
|
||||
|
||||
test cl , 1000b
|
||||
jz ??dest_left_ok
|
||||
mov eax , [ x_pixel ]
|
||||
neg eax
|
||||
mov [ x_pixel ] , 0
|
||||
mov [ scr_x ] , eax
|
||||
|
||||
??dest_left_ok:
|
||||
test cl , 0010b
|
||||
jz ??dest_bottom_ok
|
||||
mov eax , [ y_pixel ]
|
||||
neg eax
|
||||
mov [ y_pixel ] , 0
|
||||
mov [ scr_y ] , eax
|
||||
|
||||
??dest_bottom_ok:
|
||||
test dl , 0100b
|
||||
jz ??dest_right_ok
|
||||
mov eax , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
|
||||
mov [ x1_pixel ] , eax
|
||||
??dest_right_ok:
|
||||
test dl , 0001b
|
||||
jz ??do_blit
|
||||
mov eax , [ (VideoViewPort esi) . VIVPHeight ] ; get width into register
|
||||
mov [ y1_pixel ] , eax
|
||||
|
||||
??do_blit:
|
||||
|
||||
cld
|
||||
|
||||
mov eax , [ (VideoViewPort esi) . VIVPXAdd ]
|
||||
add eax , [ (VideoViewPort esi) . VIVPWidth ]
|
||||
mov edi , [ (VideoViewPort esi) . VIVPOffset ]
|
||||
|
||||
mov ecx , eax
|
||||
mul [ y_pixel ]
|
||||
add edi , [ x_pixel ]
|
||||
add edi , eax
|
||||
|
||||
add ecx , [ x_pixel ]
|
||||
sub ecx , [ x1_pixel ]
|
||||
mov [ dest_ajust_width ] , ecx
|
||||
|
||||
|
||||
mov esi , [ src ]
|
||||
mov eax , [ pixel_width ]
|
||||
sub eax , [ x1_pixel ]
|
||||
add eax , [ x_pixel ]
|
||||
mov [ scr_ajust_width ] , eax
|
||||
|
||||
mov eax , [ scr_y ]
|
||||
mul [ pixel_width ]
|
||||
add eax , [ scr_x ]
|
||||
add esi , eax
|
||||
|
||||
mov edx , [ y1_pixel ]
|
||||
mov eax , [ x1_pixel ]
|
||||
|
||||
sub edx , [ y_pixel ]
|
||||
jle ??real_out
|
||||
sub eax , [ x_pixel ]
|
||||
jle ??real_out
|
||||
|
||||
|
||||
; ********************************************************************
|
||||
; Forward bitblit only
|
||||
|
||||
IF TRANSP
|
||||
test [ trans ] , 1
|
||||
jnz ??forward_Blit_trans
|
||||
ENDIF
|
||||
|
||||
|
||||
; the inner loop is so efficient that
|
||||
; the optimal consept no longer apply because
|
||||
; the optimal byte have to by a number greather than 9 bytes
|
||||
cmp eax , 10
|
||||
jl ??forward_loop_bytes
|
||||
|
||||
??forward_loop_dword:
|
||||
mov ecx , edi
|
||||
mov ebx , eax
|
||||
neg ecx
|
||||
and ecx , 3
|
||||
sub ebx , ecx
|
||||
rep movsb
|
||||
mov ecx , ebx
|
||||
shr ecx , 2
|
||||
rep movsd
|
||||
mov ecx , ebx
|
||||
and ecx , 3
|
||||
rep movsb
|
||||
add esi , [ scr_ajust_width ]
|
||||
add edi , [ dest_ajust_width ]
|
||||
dec edx
|
||||
jnz ??forward_loop_dword
|
||||
ret
|
||||
|
||||
??forward_loop_bytes:
|
||||
mov ecx , eax
|
||||
rep movsb
|
||||
add esi , [ scr_ajust_width ]
|
||||
add edi , [ dest_ajust_width ]
|
||||
dec edx ; decrement the height
|
||||
jnz ??forward_loop_bytes
|
||||
ret
|
||||
|
||||
IF TRANSP
|
||||
|
||||
|
||||
??forward_Blit_trans:
|
||||
|
||||
|
||||
mov ecx , eax
|
||||
and ecx , 01fh
|
||||
lea ecx , [ ecx + ecx * 4 ]
|
||||
neg ecx
|
||||
shr eax , 5
|
||||
lea ecx , [ ??transp_reference + ecx * 2 ]
|
||||
mov [ y1_pixel ] , ecx
|
||||
|
||||
|
||||
??forward_loop_trans:
|
||||
mov ecx , eax
|
||||
jmp [ y1_pixel ]
|
||||
??forward_trans_line:
|
||||
REPT 32
|
||||
local transp_pixel
|
||||
mov bl , [ esi ]
|
||||
inc esi
|
||||
test bl , bl
|
||||
jz transp_pixel
|
||||
mov [ edi ] , bl
|
||||
transp_pixel:
|
||||
inc edi
|
||||
ENDM
|
||||
??transp_reference:
|
||||
dec ecx
|
||||
jge ??forward_trans_line
|
||||
add esi , [ scr_ajust_width ]
|
||||
add edi , [ dest_ajust_width ]
|
||||
dec edx
|
||||
jnz ??forward_loop_trans
|
||||
ret
|
||||
ENDIF
|
||||
|
||||
??real_out:
|
||||
ret
|
||||
|
||||
|
||||
ENDP MCGA_Buffer_To_Page
|
||||
END
|
||||
|
465
WWFLAT32/MCGAPRIM/TXTPRNT.ASM
Normal file
465
WWFLAT32/MCGAPRIM/TXTPRNT.ASM
Normal file
@@ -0,0 +1,465 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 Library *
|
||||
;* *
|
||||
;* File Name : TXTPRNT.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : January 17, 1995 *
|
||||
;* *
|
||||
;* Last Update : January 17, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* MCGA_Print -- Assembly MCGA text print routine *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
;*=========================================================================*
|
||||
;* Extern the font pointer which is defined by the font class *
|
||||
;*=========================================================================*
|
||||
GLOBAL FontPtr:DWORD
|
||||
GLOBAL FontXSpacing:DWORD
|
||||
GLOBAL FontYSpacing:DWORD
|
||||
GLOBAL ColorXlat:BYTE
|
||||
|
||||
;*=========================================================================*
|
||||
;* Define the necessary equates for structures and bounds checking *
|
||||
;*=========================================================================*
|
||||
; The header of the font file looks like this:
|
||||
; UWORD FontLength; 0
|
||||
; BYTE FontCompress; 2
|
||||
; BYTE FontDataBlocks; 3
|
||||
; UWORD InfoBlockOffset; 4
|
||||
; UWORD OffsetBlockOffset; 6
|
||||
; UWORD WidthBlockOffset; 8
|
||||
; UWORD DataBlockOffset; 10
|
||||
; UWORD HeightOffset; 12
|
||||
; For this reason the following equates have these values:
|
||||
FONTINFOBLOCK EQU 4
|
||||
FONTOFFSETBLOCK EQU 6
|
||||
FONTWIDTHBLOCK EQU 8
|
||||
FONTDATABLOCK EQU 10
|
||||
FONTHEIGHTBLOCK EQU 12
|
||||
|
||||
FONTINFOMAXHEIGHT EQU 4
|
||||
FONTINFOMAXWIDTH EQU 5
|
||||
|
||||
|
||||
LOCALS ??
|
||||
;*=========================================================================*
|
||||
;* Define the color xlate table in the data segment *
|
||||
;*=========================================================================*
|
||||
DATASEG
|
||||
|
||||
ColorXlat DB 000H,001H,002H,003H,004H,005H,006H,007H
|
||||
DB 008H,009H,00AH,00BH,00CH,00DH,00EH,00FH
|
||||
|
||||
DB 001H,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 002H,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 003H,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 004H,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 005H,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 006H,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 007H,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 008H,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 009H,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 00AH,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 00BH,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 00CH,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 00DH,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 00EH,000H,000H,000H,000H,000H,000H,000H
|
||||
DB 000H,000H,000H,000H,000H,000H,000H,000H
|
||||
|
||||
DB 00FH
|
||||
|
||||
CODESEG
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
;* MCGA_PRINT -- Assembly MCGA text print routine *
|
||||
;* *
|
||||
;* *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/17/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC MCGA_Print C near
|
||||
USES ebx,ecx,edx,esi,edi
|
||||
|
||||
ARG this:DWORD
|
||||
ARG string:DWORD
|
||||
ARG x_pixel:DWORD
|
||||
ARG y_pixel:DWORD
|
||||
ARG fcolor:DWORD
|
||||
ARG bcolor:DWORD
|
||||
|
||||
LOCAL infoblock:DWORD ; pointer to info block
|
||||
LOCAL offsetblock:DWORD ; pointer to offset block (UWORD *)
|
||||
LOCAL widthblock:DWORD ; pointer to width block (BYTE *)
|
||||
LOCAL heightblock:DWORD ; pointer to height block (UWORD *)
|
||||
|
||||
LOCAL curline:DWORD ; pointer to first column of current row.
|
||||
LOCAL bufferwidth:DWORD ; width of buffer (vpwidth + Xadd)
|
||||
LOCAL nextdraw:DWORD ; bufferwidth - width of cur character.
|
||||
LOCAL startdraw:DWORD ; where next character will start being drawn.
|
||||
|
||||
LOCAL char:DWORD ; current character value.
|
||||
local ptr_string:dword ; pointer to string
|
||||
LOCAL maxheight:BYTE ; max height of characters in font.
|
||||
LOCAL bottomblank:BYTE ; amount of empty space below current character.
|
||||
LOCAL charheight:BYTE ; true height of current character.
|
||||
LOCAL vpwidth:DWORD
|
||||
LOCAL vpheight:DWORD
|
||||
|
||||
mov eax,[string] ; check that the string is not NULL
|
||||
mov [ptr_string],eax
|
||||
cmp eax,0
|
||||
jz ??done
|
||||
|
||||
;-------------------------------- Where to draw -----------------------------------------------
|
||||
; Set up memory location to start drawing.
|
||||
mov ebx,[this] ; get a pointer to dest
|
||||
mov eax,[(GraphicViewPort ebx).GVPHeight] ; get height of viewport
|
||||
mov [vpheight],eax ; save off height of viewport
|
||||
mov eax,[(GraphicViewPort ebx).GVPWidth] ; get width of viewport
|
||||
mov [vpwidth],eax ; save it off for later
|
||||
add eax,[(GraphicViewPort ebx).GVPXAdd] ; add in xadd for bytes_per_line
|
||||
mov [bufferwidth],eax ; save it off for later use.
|
||||
|
||||
mul [y_pixel] ; multiply rowsize * y_pixel start.
|
||||
mov edi,[(GraphicViewPort ebx).GVPOffset] ; get start of the viewport
|
||||
add edi,eax ; add y position to start of vp
|
||||
mov [curline],edi ; save 0,y address for line feed stuff.
|
||||
add edi,[x_pixel] ; add to get starting column in starting row.
|
||||
mov [startdraw],edi ; save it off.
|
||||
|
||||
|
||||
;-------------------------------- Create block pointers ----------------------------------------
|
||||
; Get the pointer to the font.
|
||||
; We could check for NULL but why waste the time.
|
||||
; It is up to programmer to make sure it is set.
|
||||
mov esi,[FontPtr] ; Get the font pointer
|
||||
or esi,esi
|
||||
jz ??done
|
||||
|
||||
; Set up some pointers to the different memory blocks.
|
||||
; esi (FontPtr) is added to each to get the true address of each block.
|
||||
; Many registers are used for P5 optimizations.
|
||||
; ebx is used for InfoBlock which is then used in the next section.
|
||||
movzx eax,[WORD PTR esi+FONTOFFSETBLOCK] ; get offset to offset block
|
||||
movzx ebx,[WORD PTR esi+FONTINFOBLOCK] ; get offset to info block (must be ebx for height test)
|
||||
movzx ecx,[WORD PTR esi+FONTWIDTHBLOCK] ; get offset to width block
|
||||
movzx edx,[WORD PTR esi+FONTHEIGHTBLOCK] ; get offset to height block
|
||||
|
||||
add eax,esi ; add offset of FontPtr to offset block
|
||||
add ebx,esi ; add offset of FontPtr to info block
|
||||
add ecx,esi ; add offset of FontPtr to width block
|
||||
add edx,esi ; add offset of FontPtr to height block
|
||||
|
||||
mov [offsetblock],eax ; save offset to offset block
|
||||
mov [infoblock],ebx ; save offset to info block
|
||||
mov [widthblock],ecx ; save offset to width block
|
||||
mov [heightblock],edx ; save offset to height block
|
||||
|
||||
;------------------------------------------ Test for fit ----------------------------------------------
|
||||
; Test x_pixel and y_pixel for negative values
|
||||
mov edx,[y_pixel] ; get position y
|
||||
mov ecx,[x_pixel] ; get position x
|
||||
cmp edx,0 ; check for negative
|
||||
jl ??done ; if so, we're out let here.
|
||||
cmp ecx,0 ; check for negative
|
||||
jl ??done ; if so, we're out let here.
|
||||
|
||||
; Test to make sure the height of the max character will fit on this line
|
||||
; and and not fall out of the viewport.
|
||||
; remember we set ebx to FONTINFOBLOCK above.
|
||||
movzx eax,[BYTE PTR ebx + FONTINFOMAXHEIGHT]; get the max height in font.
|
||||
mov [maxheight],al ; save it for later use.
|
||||
add eax,edx ; add current y_value.
|
||||
cmp eax,[vpheight] ; are we over the edge?
|
||||
jge ??done ; if so, we're outa here.
|
||||
mov [y_pixel],eax ; save for next line feed. y value for next line.
|
||||
cld ; Make sure we are always forward copying.
|
||||
|
||||
;------------------------ Set palette foreground and background ----------------------------------
|
||||
mov eax,[fcolor] ; foreground color
|
||||
mov [ColorXlat+1],al
|
||||
mov [ColorXlat+16],al
|
||||
|
||||
mov eax,[bcolor] ; background color
|
||||
mov [ColorXlat],al
|
||||
|
||||
;-------------------------------------------------------------------------------------------------
|
||||
;----------------------------------------- Main loop ----------------------------------------------
|
||||
; Now we go into the main loop of reading each character in the string and doing
|
||||
; something with it.
|
||||
??next_char:
|
||||
; while (*string++)
|
||||
xor eax,eax ; zero out since we will just load al.
|
||||
mov esi,[string] ; get address on next character.
|
||||
lodsb ; load the character into al.
|
||||
test eax,0FFH ; test to see if character is a NULL
|
||||
jz ??done ; character is NULL, get outa here.
|
||||
|
||||
mov edi,[startdraw] ; Load the starting address.
|
||||
|
||||
mov [string],esi ; save index into string. (incremented by lodsb)
|
||||
|
||||
cmp al,10 ; is the character a carry return?
|
||||
je ??line_feed ; if so, go to special case.
|
||||
|
||||
cmp eax,13 ; is the character a line feed?
|
||||
je ??line_feed ; if so, go to special case.
|
||||
|
||||
mov [char],eax ; save the character off for later reference.
|
||||
mov ebx,eax ; save it in ebx for later use also.
|
||||
|
||||
add eax,[widthblock] ; figure address of width of character.
|
||||
mov ecx,[x_pixel] ; get current x_pixel.
|
||||
movzx edx,[BYTE PTR eax] ; get the width of the character in dl.
|
||||
add ecx,edx ; add width of char to current x_pixel.
|
||||
mov eax,[FontXSpacing]
|
||||
add ecx,eax
|
||||
add [startdraw],edx ; save start draw for next character.
|
||||
add [startdraw],eax ; adjust for the font spacing value
|
||||
|
||||
cmp ecx,[vpwidth] ; is the pixel greater then the vp width?
|
||||
jg ??force_line_feed ; if so, force a line feed.
|
||||
|
||||
mov [x_pixel],ecx ; save value of start of next character.
|
||||
mov ecx,[bufferwidth] ; get amount to next y same x (one row down)
|
||||
sub ecx,edx ; take the current width off.
|
||||
mov [nextdraw],ecx ; save it to add to edi when done with a row.
|
||||
|
||||
; At this point we got the character. It is now time to find out specifics
|
||||
; about drawing the darn thing.
|
||||
; ebx = char so they can be used as an indexes.
|
||||
; edx = width of character for loop later.
|
||||
|
||||
; get offset of data for character into esi.
|
||||
shl ebx,1 ; mult by 2 to later use as a WORD index.
|
||||
mov esi,[offsetblock] ; get pointer to begining of offset block.
|
||||
add esi,ebx ; index into offset block.
|
||||
movzx esi,[WORD PTR esi] ; get true offset into data block from FontPtr.
|
||||
add esi,[FontPtr] ; Now add FontPtr address to get true address.
|
||||
|
||||
; Get top and bottom blank sizes and the true height of the character.
|
||||
add ebx,[heightblock] ; point ebx to element in height array.
|
||||
mov al,[ebx+1] ; load the data height into dl.
|
||||
mov cl,[ebx] ; load the first data row into cl.
|
||||
mov bl,[maxheight] ; get the max height of characters.
|
||||
mov [charheight],al ; get number of rows with data.
|
||||
add al,cl ; add the two heights.
|
||||
sub bl,al ; subract topblank + char height from maxheight.
|
||||
mov [bottomblank],bl ; save off the number of blank rows on the bottom.
|
||||
; leaving this section:
|
||||
; dl is still the width of the character.
|
||||
; cl is the height of the top blank area.
|
||||
|
||||
mov ebx,OFFSET ColorXlat ; setup ebx for xlat commands.
|
||||
mov dh,dl ; save the width of the character to restore each loop.
|
||||
|
||||
cmp cl,0 ; is there any blank rows on top?
|
||||
jz ??draw_char ; if not go and draw the real character.
|
||||
|
||||
xor eax,eax ; get color 0 for background.
|
||||
xlat [ebx] ; get translated color into al
|
||||
test al,al ; is it transparent black
|
||||
jnz ??loop_top ; if not go and write the color
|
||||
|
||||
;----------------------------------------- skip Top blank area ----------------------------------------
|
||||
; this case, the top is transparrent, but we need to increase our dest pointer to correct row.
|
||||
movzx eax,cl ; get number of rows into eax;
|
||||
mov ecx,edx ; save width since edx will be destroyed by mul.
|
||||
mul [bufferwidth] ; multiply that by the width of the buffer.
|
||||
mov edx,ecx ; restore the width
|
||||
add edi,eax ; update the pointer.
|
||||
jmp short ??draw_char ; now go draw the character.
|
||||
|
||||
;----------------------------------------- fill Top blank area ----------------------------------------
|
||||
; edi was set a long time ago.
|
||||
; al is the translated color
|
||||
??loop_top:
|
||||
stosb ; store the value
|
||||
dec dh ; decrement our width.
|
||||
jnz ??loop_top ; if more width, continue on.
|
||||
|
||||
add edi,[nextdraw] ; add amount for entire row.
|
||||
|
||||
dec cl ; decrement or row count
|
||||
mov dh,dl ; restore width in dh for loop.
|
||||
jz ??draw_char ; we are done here, go draw the character.
|
||||
jmp short ??loop_top ; go back to top of loop.
|
||||
|
||||
|
||||
;----------------------------------------- Draw character ----------------------------------------------
|
||||
??draw_char:
|
||||
movzx ecx,[charheight] ; get the height of character to count down rows.
|
||||
test ecx,ecx ; is there any data? (blank would not have any)
|
||||
jz ??next_char ; if no data, go on to next character.
|
||||
|
||||
??while_data:
|
||||
lodsb ; get byte value from font data
|
||||
mov ah,al ; save hinibble
|
||||
and eax,0F00FH ; mask of low nibble in al hi nibble in ah.
|
||||
xlat [ebx] ; get new color
|
||||
|
||||
test al,al ; is it a transparent?
|
||||
jz short ??skiplo ; skip over write
|
||||
mov [es:edi],al ; write it out
|
||||
??skiplo:
|
||||
inc edi
|
||||
dec dh ; decrement our width.
|
||||
jz short ??nextrow ; check if done with width of char
|
||||
|
||||
mov al,ah ; restore to get
|
||||
; test the time difference between looking up in a large table when shr al,4 is not done as
|
||||
; compared to using only a 16 byte table when using the shr al,4
|
||||
;shr al,4 ; shift the hi nibble down to low nibble
|
||||
xlat [ebx] ; get new color
|
||||
|
||||
test al,al ; is it a transparent?
|
||||
jz short ??skiphi ; skip over write
|
||||
mov [es:edi],al ; write it out
|
||||
??skiphi:
|
||||
|
||||
inc edi
|
||||
dec dh ; decrement our width.
|
||||
jnz short ??while_data ; check if done with width of char
|
||||
|
||||
??nextrow:
|
||||
add edi,[nextdraw] ; go to next line.
|
||||
dec ecx ; decrement the number of rows to go
|
||||
mov dh,dl ; restore our column count for row.
|
||||
jnz ??while_data ; more data for character.
|
||||
|
||||
; Now it is time to setup for clearing out the bottom of the character.
|
||||
movzx ecx,[bottomblank] ; get amount on bottom that is blank
|
||||
cmp ecx,0 ; if there is no blank bottom...
|
||||
jz ??next_char ; then skip to go to next character
|
||||
|
||||
xor eax,eax ; get color 0 for background.
|
||||
xlat [ebx] ; get translated color into al
|
||||
test al,al ; is it transparent black
|
||||
jz ??next_char ; skip the top black section to let the background through
|
||||
|
||||
mov dh,dl ; restore width in dh for loop.
|
||||
|
||||
;----------------------------------------- Blank below character -----------------------------------
|
||||
??loop_bottom:
|
||||
stosb ; store the value
|
||||
dec dh ; decrement our width.
|
||||
jnz ??loop_bottom ; if more width, continue on.
|
||||
|
||||
add edi,[nextdraw] ; add amount for entire row.
|
||||
|
||||
mov dh,dl ; restore width in dh for loop.
|
||||
dec cl ; decrement or row count
|
||||
jz ??next_char ; we are done here, go to the next character.
|
||||
jmp short ??loop_bottom ; go back to top of loop.
|
||||
|
||||
;----------------------------------- end of next_char (main) loop ------------------------------------
|
||||
;-------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
;----------------------------------- special case line feeds ----------------------------------------
|
||||
; JRJ 05/01/95 This is the problem However made this change introduced
|
||||
; a error in the code, this function is not supposed to handle
|
||||
; Text wrapping
|
||||
??force_line_feed:
|
||||
; decrement pointer *string so that it will be back at same character
|
||||
; when it goes through the loop.
|
||||
dec [dword ptr string] ; overflow by one charater
|
||||
jmp ??done
|
||||
|
||||
; Now go into the line feed code.....
|
||||
??line_feed:
|
||||
mov edx,[y_pixel] ; get the current y pixel value.
|
||||
movzx ecx,[maxheight] ; get max height for later use.
|
||||
add ecx,[FontYSpacing]
|
||||
add edx,ecx ; add max height to y_pixel
|
||||
cmp edx,[vpheight] ; are we over the edge?
|
||||
jg ??done ; if so, we are outa here.
|
||||
|
||||
mov eax,[bufferwidth] ; get bytes to next line.
|
||||
mov edi,[curline] ; get start of current line.
|
||||
mul ecx ; mult max height * next line.
|
||||
|
||||
add edi,eax ; add adjustment to current line.
|
||||
add [y_pixel],ecx ; increment to our next y position.
|
||||
mov [curline],edi ; save it off for next line_feed.
|
||||
mov [startdraw],edi ; save it off so we know where to draw next char.w
|
||||
|
||||
mov [x_pixel],0 ; zero out x_pixel
|
||||
jmp ??next_char
|
||||
|
||||
??done:
|
||||
mov eax,[string] ; return the number of charaters
|
||||
sub eax,[ptr_string] ; printed
|
||||
ret
|
||||
|
||||
ENDP MCGA_Print
|
||||
|
||||
END
|
111
WWFLAT32/MCGAPRIM/VBITBLIT.ASM
Normal file
111
WWFLAT32/MCGAPRIM/VBITBLIT.ASM
Normal file
@@ -0,0 +1,111 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : VBITBLIT.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 8, 1994 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Linear_Blit_To_Vesa -- copies graphic buffer to vesa screen *
|
||||
;* Vesa_Blit_To_Linear -- Copies vesa screen to graphic buffer *
|
||||
;* Vesa_Blit_To_Vesa -- Copies a section of vesa screen to vesa screen *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
GLOBAL Linear_Blit_To_Vesa :NEAR
|
||||
GLOBAL Vesa_Blit_To_Linear :NEAR
|
||||
GLOBAL Vesa_Blit_To_Vesa :NEAR
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* LINEAR_BLIT_TO_VESA -- copies graphic buffer to vesa screen *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Linear_Blit_To_Vesa C near
|
||||
ret
|
||||
ENDP Linear_Blit_To_Vesa
|
||||
|
||||
;***************************************************************************
|
||||
;* VESA_BLIT_TO_LINEAR -- Copies vesa screen to graphic buffer *
|
||||
;* *
|
||||
;* *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_Blit_To_Linear C near
|
||||
ret
|
||||
ENDP Vesa_Blit_To_Linear
|
||||
|
||||
;***************************************************************************
|
||||
;* VESA_BLIT_TO_VESA -- Copies a section of vesa screen to vesa screen *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_Blit_To_Vesa C near
|
||||
ret
|
||||
ENDP Vesa_Blit_To_Vesa
|
||||
END
|
||||
|
||||
|
250
WWFLAT32/MCGAPRIM/VBUFFER.CPP
Normal file
250
WWFLAT32/MCGAPRIM/VBUFFER.CPP
Normal file
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** 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 Library *
|
||||
* *
|
||||
* File Name : VBUFFER.CPP *
|
||||
* *
|
||||
* Programmer : Phil W. Gorrow *
|
||||
* *
|
||||
* Start Date : January 9, 1995 *
|
||||
* *
|
||||
* Last Update : January 9, 1995 [PWG] *
|
||||
* *
|
||||
* This module contains the C++ class definitions for the video buffer *
|
||||
* class. This include routines for class creation and modification *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* VVPC::VideoViewPortClass -- Constructor for basic view port class *
|
||||
* VVPC::VideoViewPortClass -- Default constructor for view port class *
|
||||
* VVPC::~VideoViewPortClass -- Destructor for GraphicViewPortClass *
|
||||
* VVPC::Attach -- Attaches a viewport to a buffer class *
|
||||
* VVPC::Change -- Changes position and size of a Video View Port *
|
||||
* VBC::VideoBufferClass -- Default constuctor for video buffers *
|
||||
* VBC::VideoBufferClass -- Lowlevel constructor for video buffer class *
|
||||
* VBC::~VideoBufferClass -- Destructor for the video buffer class *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "vbuffer.h"
|
||||
|
||||
/*=========================================================================*/
|
||||
/* The following PRIVATE functions are in this file: */
|
||||
/*=========================================================================*/
|
||||
|
||||
|
||||
/*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* VVPC::VIDEOVIEWPORTCLASS -- Constructor for basic view port class *
|
||||
* *
|
||||
* INPUT: VideoBufferClass * vbuffer - buffer to attach to *
|
||||
* WORD x - x offset into buffer *
|
||||
* WORD y - y offset into buffer *
|
||||
* WORD w - view port width in pixels *
|
||||
* WORD h - view port height in pixels *
|
||||
* *
|
||||
* OUTPUT: Constructors may not have a return value *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/09/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
VideoViewPortClass::VideoViewPortClass(VideoBufferClass *vbuffer, int x, int y, int w, int h)
|
||||
{
|
||||
Attach(vbuffer, x, y, w, h);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* VVPC::VIDEOVIEWPORTCLASS -- Default constructor for view port class *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/09/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
VideoViewPortClass::VideoViewPortClass(void)
|
||||
{
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* VVPC::~VIDEOVIEWPORTCLASS -- Destructor for GraphicViewPortClass *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: A destructor may not return a value. *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/10/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
VideoViewPortClass::~VideoViewPortClass(void)
|
||||
{
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* VVPC::ATTACH -- Attaches a viewport to a buffer class *
|
||||
* *
|
||||
* INPUT: GraphicBufferClass *g_buff - pointer to gbuff to attach to *
|
||||
* WORD x - x position to attach to *
|
||||
* WORD y - y position to attach to *
|
||||
* WORD w - width of the view port *
|
||||
* WORD h - height of the view port *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/10/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
void VideoViewPortClass::Attach(VideoBufferClass *vbuffer, int x, int y, int w, int h)
|
||||
{
|
||||
/*======================================================================*/
|
||||
/* Verify that the x and y coordinates are valid and placed within the */
|
||||
/* physical buffer. */
|
||||
/*======================================================================*/
|
||||
if (x < 0) // you cannot place view port off
|
||||
x = 0; // the left edge of physical buf
|
||||
if (x >= vbuffer->Get_Width()) // you cannot place left edge off
|
||||
x = vbuffer->Get_Width() - 1; // the right edge of physical buf
|
||||
if (y < 0) // you cannot place view port off
|
||||
y = 0; // the top edge of physical buf
|
||||
if (y >= vbuffer->Get_Height()) // you cannot place view port off
|
||||
y = vbuffer->Get_Height() - 1; // bottom edge of physical buf
|
||||
|
||||
/*======================================================================*/
|
||||
/* Adjust the width and height of necessary */
|
||||
/*======================================================================*/
|
||||
if (x + w > vbuffer->Get_Width()) // if the x plus width is larger
|
||||
w = vbuffer->Get_Width() - x; // than physical, fix width
|
||||
|
||||
if (y + h > vbuffer->Get_Height()) // if the y plus height is larger
|
||||
h = vbuffer->Get_Height() - y; // than physical, fix height
|
||||
|
||||
/*======================================================================*/
|
||||
/* Get a pointer to the top left edge of the buffer. */
|
||||
/*======================================================================*/
|
||||
Offset = vbuffer->Get_Offset() + (vbuffer->Get_Width() * y) + x;
|
||||
|
||||
/*======================================================================*/
|
||||
/* Copy over all of the variables that we need to store. */
|
||||
/*======================================================================*/
|
||||
XPos = x;
|
||||
YPos = y;
|
||||
XAdd = vbuffer->Get_Width() - w;
|
||||
Width = w;
|
||||
Height = h;
|
||||
VideoBuff = vbuffer;
|
||||
}
|
||||
/***************************************************************************
|
||||
* VVPC::CHANGE -- Changes position and size of a Video View Port *
|
||||
* *
|
||||
* INPUT: WORD the new x pixel position of the Video view port *
|
||||
* WORD the new y pixel position of the Video view port *
|
||||
* WORD the new width of the viewport in pixels *
|
||||
* WORD the new height of the viewport in pixels *
|
||||
* *
|
||||
* OUTPUT: BOOL whether the Video View Port could be sucessfully *
|
||||
* resized. *
|
||||
* *
|
||||
* WARNINGS: You may not resize a Video View Port which is derived *
|
||||
* from a Video View Port Buffer, *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 09/14/1994 SKB : Created. *
|
||||
*=========================================================================*/
|
||||
BOOL VideoViewPortClass::Change(int x, int y, int w, int h)
|
||||
{
|
||||
/*======================================================================*/
|
||||
/* Can not change a Video View Port if it is actually the physical */
|
||||
/* representation of a Video Buffer. */
|
||||
/*======================================================================*/
|
||||
if (this == Get_Video_Buffer()) {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/*======================================================================*/
|
||||
/* Since there is no allocated information, just re-attach it to the */
|
||||
/* existing Video buffer as if we were creating the */
|
||||
/* VideoViewPort. */
|
||||
/*======================================================================*/
|
||||
Attach(Get_Video_Buffer(), x, y, w, h);
|
||||
return(TRUE);
|
||||
}
|
||||
/***************************************************************************
|
||||
* VBC::VIDEOBUFFERCLASS -- Default constuctor for video buffers *
|
||||
* *
|
||||
* INPUT: WORD w - width of buffer in pixels (default = 320) *
|
||||
* WORD h - height of buffer in pixels (default = 200) *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/13/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
VideoBufferClass::VideoBufferClass(int w, int h)
|
||||
{
|
||||
Offset = 0xa0000; // Get offset to the buffer
|
||||
Width = w; // Record width of Buffer
|
||||
Height = h; // Record height of Buffer
|
||||
XAdd = 0; // Record XAdd of Buffer
|
||||
XPos = 0; // Record XPos of Buffer
|
||||
YPos = 0; // Record YPos of Buffer
|
||||
VideoBuff = this; // Get a pointer to our self
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* VBC::VIDEOBUFFERCLASS -- Lowlevel constructor for video buffer class *
|
||||
* *
|
||||
* INPUT: UWORD the selector of the memory reference *
|
||||
* long the offset of the memory reference *
|
||||
* WORD the width of the video buffer *
|
||||
* WORD the height of the video buffer *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/07/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
VideoBufferClass::VideoBufferClass(unsigned short selector, long offset, int w, int h)
|
||||
{
|
||||
Offset = offset; // Get offset to the buffer
|
||||
Width = w; // Record width of Buffer
|
||||
Height = h; // Record height of Buffer
|
||||
XAdd = 0; // Record XAdd of Buffer
|
||||
XPos = 0; // Record XPos of Buffer
|
||||
YPos = 0; // Record YPos of Buffer
|
||||
VideoBuff = this; // Get a pointer to our self
|
||||
}
|
||||
/*=========================================================================*
|
||||
* VBC::~VIDEOBUFFERCLASS -- Destructor for the video buffer class *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 05/03/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
VideoBufferClass::~VideoBufferClass()
|
||||
{
|
||||
}
|
||||
|
1034
WWFLAT32/MCGAPRIM/VBUFFER.H
Normal file
1034
WWFLAT32/MCGAPRIM/VBUFFER.H
Normal file
File diff suppressed because it is too large
Load Diff
66
WWFLAT32/MCGAPRIM/VCLEAR.ASM
Normal file
66
WWFLAT32/MCGAPRIM/VCLEAR.ASM
Normal file
@@ -0,0 +1,66 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Clear the Full Mcga Screen *
|
||||
;* *
|
||||
;* File Name : CLEAR.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 7, 1994 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Vesa_Clear -- Clears a vesa video viewport *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
;* VESA_CLEAR -- Clears a vesa video viewport *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_Clear C near
|
||||
ret
|
||||
ENDP Vesa_Clear
|
||||
END
|
71
WWFLAT32/MCGAPRIM/VESA.ASM
Normal file
71
WWFLAT32/MCGAPRIM/VESA.ASM
Normal file
@@ -0,0 +1,71 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 Library *
|
||||
;* *
|
||||
;* File Name : VESA.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : December 8, 1994 *
|
||||
;* *
|
||||
;* Last Update : December 8, 1994 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Vesa_Asm_Set_Win -- Sets the current vesa window from Asm *
|
||||
;* Vesa_Asm_Next_Window -- Sets to the next vesa window *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
LOCALS ??
|
||||
|
||||
|
||||
GLOBAL Vesa_Asm_Set_Win :near
|
||||
|
||||
DATASEG
|
||||
|
||||
CODESEG
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
;* VESA_ASM_SET_WIN -- Sets the current vesa window from Asm *
|
||||
;* *
|
||||
;* INPUT: edi - offset to set the window for *
|
||||
;* *
|
||||
;* OUTPUT: edi - adjusted offset for window *
|
||||
;* *
|
||||
;* PROTO: void Vesa_Asm_Set_Win(void); *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 12/08/1994 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_Asm_Set_Win C near
|
||||
|
||||
ret
|
||||
ENDP Vesa_Asm_Set_Win
|
||||
|
||||
|
||||
|
||||
END
|
65
WWFLAT32/MCGAPRIM/VGETPIX.ASM
Normal file
65
WWFLAT32/MCGAPRIM/VGETPIX.ASM
Normal file
@@ -0,0 +1,65 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Clear the Full Mcga Screen *
|
||||
;* *
|
||||
;* File Name : GETPIXEL.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 7, 1994 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* VVPC::Clear -- Clears a virtual viewport instance *
|
||||
;* Vesa_Get_Pixel -- Gets a pixel from a video viewport *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
CODESEG
|
||||
;***************************************************************************
|
||||
;* VESA_GET_PIXEL -- Gets a pixel from a video viewport *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
|
||||
PROC Vesa_Get_Pixel C near
|
||||
ret
|
||||
ENDP Vesa_Get_Pixel
|
||||
END
|
72
WWFLAT32/MCGAPRIM/VLBTOVE.ASM
Normal file
72
WWFLAT32/MCGAPRIM/VLBTOVE.ASM
Normal file
@@ -0,0 +1,72 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : VBITBLIT.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 8, 1994 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Linear_Blit_To_Vesa -- copies graphic buffer to vesa screen *
|
||||
;* Vesa_Blit_To_Linear -- Copies vesa screen to graphic buffer *
|
||||
;* Vesa_Blit_To_Vesa -- Copies a section of vesa screen to vesa screen *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
GLOBAL Linear_Blit_To_Vesa :NEAR
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* LINEAR_BLIT_TO_VESA -- copies graphic buffer to vesa screen *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Linear_Blit_To_Vesa C near
|
||||
ret
|
||||
ENDP Linear_Blit_To_Vesa
|
||||
|
||||
END
|
||||
|
||||
|
66
WWFLAT32/MCGAPRIM/VPUTPIX.ASM
Normal file
66
WWFLAT32/MCGAPRIM/VPUTPIX.ASM
Normal file
@@ -0,0 +1,66 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Clear the Full Mcga Screen *
|
||||
;* *
|
||||
;* File Name : PUTPIXEL.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 7, 1994 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Vesa_Put_Pixel -- Puts a pixel on a video viewport *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
;* VESA_PUT_PIXEL -- Puts a pixel on a video viewport *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_Put_Pixel C near
|
||||
ret
|
||||
ENDP Vesa_Put_Pixel
|
||||
END
|
68
WWFLAT32/MCGAPRIM/VSCALE.ASM
Normal file
68
WWFLAT32/MCGAPRIM/VSCALE.ASM
Normal file
@@ -0,0 +1,68 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 Library *
|
||||
;* *
|
||||
;* File Name : VSCALE.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : January 16, 1995 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Vesa_Scale_To_Vesa -- Scales a vesa viewport to a vesa viewport *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE "gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
;* VESA_SCALE_TO_VESA -- Scales a vesa viewport to a vesa viewport *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_Scale_To_Vesa C near
|
||||
ret
|
||||
ENDP Vesa_Scale_To_Vesa
|
||||
|
||||
|
||||
END
|
69
WWFLAT32/MCGAPRIM/VSCLTOVE.ASM
Normal file
69
WWFLAT32/MCGAPRIM/VSCLTOVE.ASM
Normal file
@@ -0,0 +1,69 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 Library *
|
||||
;* *
|
||||
;* File Name : VSCALE.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : January 16, 1995 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Linear_Scale_To_Vesa -- Scales a graphic viewport to a vesa viewport *
|
||||
;* Vesa_Scale_To_Linear -- Scales a Vesa viewport to a graphic viewport *
|
||||
;* Vesa_Scale_To_Vesa -- Scales a vesa viewport to a vesa viewport *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE "gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
;* LINEAR_SCALE_TO_VESA -- Scales a graphic viewport to a vesa viewport *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Linear_Scale_To_Vesa C near
|
||||
ret
|
||||
ENDP Linear_Scale_To_Vesa
|
||||
|
||||
END
|
66
WWFLAT32/MCGAPRIM/VTOBUFF.ASM
Normal file
66
WWFLAT32/MCGAPRIM/VTOBUFF.ASM
Normal file
@@ -0,0 +1,66 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 Library *
|
||||
;* *
|
||||
;* File Name : VTOBUFF.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : January 16, 1995 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Vesa_To_Buffer -- Copies a vesa viewport to a linear buffer *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
;* VESA_TO_BUFFER -- Copies a vesa viewport to a linear buffer *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_To_Buffer C near
|
||||
ret
|
||||
ENDP Vesa_To_Buffer
|
||||
END
|
65
WWFLAT32/MCGAPRIM/VTOPAGE.ASM
Normal file
65
WWFLAT32/MCGAPRIM/VTOPAGE.ASM
Normal file
@@ -0,0 +1,65 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 Library *
|
||||
;* *
|
||||
;* File Name : VTOPAGE.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : January 16, 1995 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Vesa_Buffer_To_Page -- Copies a linear buffer to a vesa page *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* VESA_BUFFER_TO_PAGE -- Copies a linear buffer to a vesa page *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_Buffer_To_Page C near
|
||||
ret
|
||||
ENDP Vesa_Buffer_To_Page
|
||||
END
|
68
WWFLAT32/MCGAPRIM/VTXTPRNT.ASM
Normal file
68
WWFLAT32/MCGAPRIM/VTXTPRNT.ASM
Normal file
@@ -0,0 +1,68 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 Library *
|
||||
;* *
|
||||
;* File Name : VTXTPRNT.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : January 17, 1995 *
|
||||
;* *
|
||||
;* Last Update : January 17, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Vesa_Print -- Prints a text string to a Vesa Viewport *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE "gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
;* VESA_PRINT -- Prints a text string to a Vesa Viewport *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/17/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_Print C near
|
||||
ret
|
||||
ENDP Vesa_Print
|
||||
|
||||
|
||||
END
|
71
WWFLAT32/MCGAPRIM/VVBLIT.ASM
Normal file
71
WWFLAT32/MCGAPRIM/VVBLIT.ASM
Normal file
@@ -0,0 +1,71 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : VBITBLIT.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 8, 1994 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Linear_Blit_To_Vesa -- copies graphic buffer to vesa screen *
|
||||
;* Vesa_Blit_To_Linear -- Copies vesa screen to graphic buffer *
|
||||
;* Vesa_Blit_To_Vesa -- Copies a section of vesa screen to vesa screen *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
GLOBAL Vesa_Blit_To_Vesa :NEAR
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* VESA_BLIT_TO_VESA -- Copies a section of vesa screen to vesa screen *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_Blit_To_Vesa C near
|
||||
ret
|
||||
ENDP Vesa_Blit_To_Vesa
|
||||
END
|
||||
|
||||
|
74
WWFLAT32/MCGAPRIM/VVETOLB.ASM
Normal file
74
WWFLAT32/MCGAPRIM/VVETOLB.ASM
Normal file
@@ -0,0 +1,74 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 : Westwood 32 bit Library *
|
||||
;* *
|
||||
;* File Name : VBITBLIT.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : June 8, 1994 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Linear_Blit_To_Vesa -- copies graphic buffer to vesa screen *
|
||||
;* Vesa_Blit_To_Linear -- Copies vesa screen to graphic buffer *
|
||||
;* Vesa_Blit_To_Vesa -- Copies a section of vesa screen to vesa screen *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE ".\gbuffer.inc"
|
||||
|
||||
|
||||
GLOBAL Vesa_Blit_To_Linear :NEAR
|
||||
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* VESA_BLIT_TO_LINEAR -- Copies vesa screen to graphic buffer *
|
||||
;* *
|
||||
;* *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_Blit_To_Linear C near
|
||||
ret
|
||||
ENDP Vesa_Blit_To_Linear
|
||||
|
||||
END
|
||||
|
||||
|
65
WWFLAT32/MCGAPRIM/VVETOSCL.ASM
Normal file
65
WWFLAT32/MCGAPRIM/VVETOSCL.ASM
Normal file
@@ -0,0 +1,65 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; This program is free software: you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation, either version 3 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 Library *
|
||||
;* *
|
||||
;* File Name : VSCALE.ASM *
|
||||
;* *
|
||||
;* Programmer : Phil W. Gorrow *
|
||||
;* *
|
||||
;* Start Date : January 16, 1995 *
|
||||
;* *
|
||||
;* Last Update : January 16, 1995 [PWG] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* Vesa_Scale_To_Linear -- Scales a Vesa viewport to a graphic viewport *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "mcgaprim.inc"
|
||||
INCLUDE "gbuffer.inc"
|
||||
|
||||
|
||||
CODESEG
|
||||
;***************************************************************************
|
||||
;* VESA_SCALE_TO_LINEAR -- Scales a Vesa viewport to a graphic viewport *
|
||||
;* *
|
||||
;* INPUT: *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* PROTO: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 01/16/1995 PWG : Created. *
|
||||
;*=========================================================================*
|
||||
PROC Vesa_Scale_To_Linear C near
|
||||
ret
|
||||
ENDP Vesa_Scale_To_Linear
|
||||
|
||||
END
|
Reference in New Issue
Block a user