SHAPE.INC 10 KB

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