SHAPE.INC 9.9 KB

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