CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

SHAPE.INC (10354B)


      1 ;
      2 ; Copyright 2020 Electronic Arts Inc.
      3 ;
      4 ; TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 ; software: you can redistribute it and/or modify it under the terms of 
      6 ; the GNU General Public License as published by the Free Software Foundation, 
      7 ; either version 3 of the License, or (at your option) any later version.
      8 
      9 ; TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 ; in the hope that it will be useful, but with permitted additional restrictions 
     11 ; under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 ; distributed with this program. You should have received a copy of the 
     13 ; GNU General Public License along with permitted additional restrictions 
     14 ; with this program. If not, see [https://github.com/electronicarts/CnC_Remastered_Collection]>.
     15 
     16 ;***************************************************************************
     17 ;**   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        **
     18 ;***************************************************************************
     19 ;*                                                                         *
     20 ;*                 Project Name : WWLIB32                                  *
     21 ;*                                                                         *
     22 ;*                    File Name : SHAPE.INC                                *
     23 ;*                                                                         *
     24 ;*                   Programmer : Scott Bowen				   *
     25 ;*                                                                         *
     26 ;*                   Start Date : May 25, 1994                             *
     27 ;*                                                                         *
     28 ;*                  Last Update : September 14, 1994   [IML]               *
     29 ;*                                                                         *
     30 ;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
     31 ;****************************** Equates ************************************
     32 ;
     33 
     34 
     35 
     36 
     37 
     38 
     39 ;............................ Shape Types ..................................
     40 ;
     41 TRUE	equ	1			; Boolean 'true' value
     42 FALSE	equ	0			; Boolean 'false' value
     43 
     44 MAKESHAPE_NORMAL		EQU	0	; 256-color compressed shape
     45 MAKESHAPE_COMPACT		EQU	1	; 16-color shape (built-in color table)
     46 MAKESHAPE_NOCOMP		EQU	2	; non-wwcomped shape
     47 MAKESHAPE_VARIABLE	EQU	4	; <16-color shape with variable #
     48 					; of colors (ColorTable[0] = # of colors)
     49 ; old names:
     50 ;COLOR_SHAPE		EQU	1	; flag which determines a color shape
     51 ;NORM_SHAPE			EQU	2	; flag that indicates non wwcomped shp
     52 ;NORM_SHAPE_16		EQU	4	; flag that tells us if we have a variable sized table
     53 					;  variable sized table
     54 ;
     55 ;...........................................................................
     56 ; Drawing flags:
     57 ; The low byte is for coordinate transformations.
     58 ; The high byte is for drawing effects.
     59 ;...........................................................................
     60 ;
     61 SHAPE_NORMAL			EQU	0000h	; no options; just a copy
     62 SHAPE_HORZ_REV			EQU	0001h	; reverse horizontally
     63 SHAPE_VERT_REV			EQU	0002h	; reverse vertically
     64 SHAPE_SCALING			EQU	0004h	; scale
     65 SHAPE_VIEWPORT_REL	EQU	0010h	; viewport-relative coordinates
     66 SHAPE_CENTER			EQU	0020h	; use centered coordinates
     67 SHAPE_BOTTOM			EQU 0040h	; Y coord is based on shape bottom pt
     68 SHAPE_FADING			EQU	0100h	; fading effect shape
     69 SHAPE_PREDATOR			EQU	0200h	; predator effect shape
     70 SHAPE_COMPACT			EQU	0400h	; shape is in 16 colors
     71 SHAPE_PRIORITY			EQU	0800h	; priority draw shape
     72 SHAPE_GHOST				EQU	1000h	; ghosting effect
     73 SHAPE_SHADOW			EQU	2000h	; shadow effect
     74 SHAPE_PARTIAL			EQU	4000h	; partial predator effect
     75 SHAPE_COLOR				EQU	8000h	; use alternative color table effect
     76 
     77 SHAPE_EFFECTS			EQU    03F00h	; shape effect flags
     78 
     79 ;
     80 ;.......................... Shadow Effect ..................................
     81 ;
     82 SHADOW_COL		EQU	00FFh	; magic number for shadows
     83 
     84 ;......................... Priority System .................................
     85 ;
     86 CLEAR_UNUSED_BITS  	EQU	0007h	; and with 0000-0111 to clear
     87 					;  non-walkable high bit and
     88 					;  scaling id bits
     89 NON_WALKABLE_BIT  	EQU	0080h	; and with 1000-0000 to clear all
     90 					;  but non-walkable bit
     91 ;
     92 ;......................... Predator Effect .................................
     93 ;
     94 PRED_MASK		EQU	0007h	; mask used for predator pixel puts
     95 
     96 ;---------------------------------------------------------------------------
     97 ; This table is a list of the local stack variables in the function
     98 ; Draw_Shape.  Many other functions in other modules access these variables
     99 ; on the stack.  Since the BP is not changed when these other functions are
    100 ; called by Draw_Shape (possibly indirectly), they can also access these
    101 ; stack varibles.  When adding or removing from the table, one must be very
    102 ; careful to change the offsets.
    103 ;---------------------------------------------------------------------------
    104 ;.......................... proc addresses .................................
    105 LSkipRout	EQU DWORD PTR ebp - 04h		;DWORD  pointer to the skip routine
    106 RSkipRout	EQU DWORD PTR ebp - 08h		;DWORD  pointer to the skip routine
    107 DrawRout	EQU DWORD PTR ebp - 0Ch			;DWORD  pointer to the draw routine
    108 ;........................ optional arguments ...............................
    109 ColorTable	EQU DWORD PTR ebp - 10h		;DWORD	ptr to the shapes color table
    110 FadingTable	EQU DWORD PTR ebp - 14h		;DWORD  ptr to the fading table
    111 
    112 FadingNum	EQU DWORD PTR ebp - 18h		;DWORD  number of times to fade
    113 IsTranslucent	EQU DWORD PTR ebp - 1Ch	;DWORD	ptr to is_translucent table
    114 Translucent	EQU DWORD PTR ebp - 20h		;DWORD	ptr to actual translucent tbl
    115 PriLevel	EQU BYTE  PTR ebp - 24h			;BYTE	priority level of the object
    116 ScaleX		EQU DWORD PTR ebp - 28h		;DWORD  the x increment to scale by
    117 ScaleY		EQU DWORD PTR ebp - 2Ch		;DWORD  the y increment to scale by
    118 ShadowingTable	EQU DWORD PTR ebp - 30h	;DWORD	ptr to the shadowing table
    119 ;........................ Shape header values ..............................
    120 ShapeType	EQU DWORD PTR ebp - 34h 	;DWORD	shape type
    121 ShapeWidth	EQU DWORD PTR ebp - 38h 	;DWORD	shape's unscaled width
    122 ShapeHeight	EQU DWORD PTR ebp - 3Ch 	;DWORD	shape's unscaled height
    123 UncompDataLen	EQU DWORD PTR ebp - 40h ;DWORD	uncompressed data length
    124 ShapeData	EQU DWORD PTR ebp - 44h 	;DWORD	pointer to shape data
    125 ;...................... Scaled shape dimensions ............................
    126 ScaledWidth	EQU DWORD PTR ebp - 48h 	;DWORD	shape's scaled width
    127 ScaledHeight	EQU DWORD PTR ebp - 4Ch ;DWORD	shape's scaled height
    128 ;...................... Pixel clipping variables ...........................
    129 LeftClipPixels	EQU DWORD PTR ebp - 50h ;DWORD	# left-clipped pixels
    130 RightClipPixels	EQU DWORD PTR ebp - 54h ;DWORD	# right-clipped pixels
    131 TopClipPixels	EQU DWORD PTR ebp - 58h ;DWORD	# top-clipped pixels
    132 BotClipPixels	EQU DWORD PTR ebp - 5Ch ;DWORD	# bottom-clipped pixels
    133 PixelWidth	EQU DWORD PTR ebp - 60h 	;DWORD	drawable area in pixels
    134 PixelHeight	EQU DWORD PTR ebp - 64h 	;DWORD	drawable area in pixels
    135 ;......................... Drawing variables ...............................
    136 NumColors	EQU DWORD PTR ebp - 68h ;DWORD	# colors for 16-color shapes
    137 StartDraw	EQU DWORD PTR ebp - 6Ch ;DWORD	offset of drawing start pos
    138 NextLine	EQU DWORD PTR ebp - 70h ;DWORD	offset of next drawing line
    139 LeftClipBytes	EQU DWORD PTR ebp - 74h ;DWORD	# left-clipped bytes
    140 XTotal		EQU DWORD PTR ebp - 78h ;DWORD	accumulated x-pixels
    141 XTotalInit	EQU DWORD PTR ebp - 7Ch ;DWORD	initial roundoff for XTotal
    142 YTotal		EQU DWORD PTR ebp - 80h ;DWORD	accumulated y-pixels
    143 HeightCount	EQU DWORD PTR ebp - 84h ;DWORD	ht counter for drawing lines
    144 LineStart	EQU DWORD PTR ebp - 88h ;DWORD	address of start of line
    145 WidthCount	EQU DWORD PTR ebp - 8Ch ;DWORD	counts down # bytes skipped
    146 StashReg	EQU DWORD PTR ebp - 90h 	;DWORD	temp variable for draw routines
    147 MaskAdjust	EQU DWORD PTR ebp - 94h ;DWORD  priority buffer offset
    148 BackAdjust	EQU DWORD PTR ebp - 98h ;DWORD  background buffer offset
    149 StashECX	EQU DWORD PTR ebp - 9Ch 	;DWORD  temp variable for ECX register
    150 StashEDX	EQU DWORD PTR ebp -0A0h 	;DWORD  temp variable for EDX register
    151 
    152 Local_Size	EQU 00A4h		; Amt of data on stack: 4+last offset
    153 
    154 ;****************************** Declarations *******************************
    155 ;---------------------------------------------------------------------------
    156 ; Global variables used by the shape routines, defined in drawshp.asm
    157 ;---------------------------------------------------------------------------
    158 GLOBAL C ShapeBuffer:DWORD
    159 GLOBAL C ShapeBufferSize:DWORD
    160 GLOBAL C _MaskPage:DWORD
    161 GLOBAL C _BackGroundPage:DWORD
    162 GLOBAL C PredCount:DWORD
    163 GLOBAL C PredTable:BYTE
    164 GLOBAL C PredValue:DWORD
    165 GLOBAL C PartialPred:DWORD
    166 GLOBAL C PartialCount:DWORD
    167 GLOBAL C Flags:DWORD
    168 
    169 ;---------------------------------------------------------------------------
    170 ; External tables that are defined in ds_table.asm.
    171 ;---------------------------------------------------------------------------
    172 GLOBAL LSkipTable:DWORD
    173 GLOBAL RSkipTable:DWORD
    174 GLOBAL DrawTable:DWORD
    175 
    176 ;------------------------------------------------------------------------------
    177 ; Public functions, declared in the order they appear in the function tables.
    178 ;--------------------------------------------------------------------------------
    179 GLOBAL	C Not_Supported:NEAR
    180 ;	LSkipTable:
    181 GLOBAL Left_Skip:NEAR						; ds_ls
    182 GLOBAL Left_Reverse_Skip:NEAR				; ds_lrs
    183 GLOBAL Left_Skip:NEAR						; ds_ls
    184 GLOBAL Left_Reverse_Skip:NEAR				; ds_lrs
    185 GLOBAL Left_Scale_Skip:NEAR				; ds_lss
    186 GLOBAL Left_Scale_Reverse_Skip:NEAR		; ds_lsrs
    187 GLOBAL Left_Scale_Skip:NEAR				; ds_lss
    188 GLOBAL Left_Scale_Reverse_Skip:NEAR		; ds_lsrs
    189 
    190 ;	RSkipTable:
    191 GLOBAL Right_Skip:NEAR					   ; ds_rs
    192 GLOBAL Right_Reverse_Skip:NEAR			; ds_rrs
    193 GLOBAL Right_Skip:NEAR					   ; ds_rs
    194 GLOBAL Right_Reverse_Skip:NEAR			; ds_rrs
    195 GLOBAL Right_Scale_Skip:NEAR				; ds_rss
    196 GLOBAL Right_Scale_Reverse_Skip:NEAR	; ds_rsrs
    197 GLOBAL Right_Scale_Skip:NEAR				; ds_rss
    198 GLOBAL Right_Scale_Reverse_Skip:NEAR	; ds_rsrs
    199 
    200 ;	DrawTable:
    201 GLOBAL Draw_Normal:NEAR					; ds_dn
    202 GLOBAL Draw_Reverse:NEAR				; ds_dr
    203 GLOBAL Draw_Normal:NEAR					; ds_dn
    204 GLOBAL Draw_Reverse:NEAR				; ds_dr
    205 GLOBAL Draw_Scale:NEAR					; ds_ds
    206 GLOBAL Draw_Scale_Reverse:NEAR		; ds_dsr
    207 GLOBAL Draw_Scale:NEAR					; ds_ds
    208 GLOBAL Draw_Scale_Reverse:NEAR		; ds_dsr
    209 
    210 
    211 ;************************* End of shape.inc ********************************
    212