SHAPE.H 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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.H *
  25. * *
  26. * Programmer : Bill Randolph *
  27. * *
  28. * Start Date : May 25, 1994 *
  29. * *
  30. * Last Update : September 14, 1994 [IML] *
  31. * *
  32. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  33. #ifndef SHAPE_H
  34. #define SHAPE_H
  35. #ifndef GBUFFER_H
  36. #include "gbuffer.h"
  37. #endif
  38. /*
  39. *********************************** Types ***********************************
  40. */
  41. /*
  42. --------------------------- Shape creation flags ----------------------------
  43. */
  44. typedef enum {
  45. MAKESHAPE_NORMAL = 0x0000, // 256-color compressed shape
  46. MAKESHAPE_COMPACT = 0x0001, // 16-color shape (with built-in color table)
  47. MAKESHAPE_NOCOMP = 0x0002, // Uncompressed shape
  48. MAKESHAPE_VARIABLE = 0x0004 // <16-color shape
  49. } MakeShapeFlags_Type;
  50. /*---------------------------------------------------------------------------
  51. Shape drawing flags:
  52. - The low byte is for coordinate transformations.
  53. - The high byte is for drawing effects.
  54. ---------------------------------------------------------------------------*/
  55. typedef enum {
  56. SHAPE_NORMAL = 0x0000, // Standard shape
  57. SHAPE_HORZ_REV = 0x0001, // Flipped horizontally
  58. SHAPE_VERT_REV = 0x0002, // Flipped vertically
  59. SHAPE_SCALING = 0x0004, // Scaled (WORD scale_x, WORD scale_y)
  60. SHAPE_VIEWPORT_REL = 0x0010, // Coords are window-relative
  61. SHAPE_WIN_REL = 0x0010, // Coordinates are window relative instead of absolute.
  62. SHAPE_CENTER = 0x0020, // Coords are based on shape's center pt
  63. SHAPE_FADING = 0x0100, // Fading effect (void * fading_table,
  64. // WORD fading_num)
  65. SHAPE_PREDATOR = 0x0200, // Transparent warping effect
  66. SHAPE_COMPACT = 0x0400, // Never use this bit
  67. SHAPE_PRIORITY = 0x0800, // Use priority system when drawing
  68. SHAPE_GHOST = 0x1000, // Shape is drawn ghosted
  69. SHAPE_SHADOW = 0x2000,
  70. SHAPE_PARTIAL = 0x4000,
  71. SHAPE_COLOR = 0x8000 // Remap the shape's colors
  72. // (void * color_table)
  73. } ShapeFlags_Type;
  74. /*
  75. ------------------------------- Shape header --------------------------------
  76. */
  77. typedef struct {
  78. unsigned short ShapeType; // 0 = normal, 1 = 16 colors,
  79. // 2 = uncompressed, 4 = <16 colors
  80. unsigned char Height; // Height of the shape in scan lines
  81. unsigned short Width; // Width of the shape in bytes
  82. unsigned char OriginalHeight; // Original height of shape in scan lines
  83. unsigned short ShapeSize; // Size of the shape, including header
  84. unsigned short DataLength; // Size of the uncompressed shape (just data)
  85. unsigned char Colortable[16]; // Optional color table for compact shape
  86. } Shape_Type;
  87. /*
  88. ------------------------------- Shape block ---------------------------------
  89. */
  90. typedef struct {
  91. unsigned short NumShapes; // number of shapes in the block
  92. long Offsets[]; // array of offsets to shape data
  93. // (offsets within the shape block, with
  94. // 0 being the first offset value, not the
  95. // start of the shape block)
  96. } ShapeBlock_Type;
  97. /*
  98. ******************************** Prototypes *********************************
  99. */
  100. /*
  101. -------------------------------- prioinit.c ---------------------------------
  102. */
  103. extern "C" {
  104. extern void *MaskPage;
  105. extern void *BackGroundPage;
  106. extern long _ShapeBufferSize;
  107. extern char *_ShapeBuffer;
  108. }
  109. void __cdecl Init_Priority_System (GraphicBufferClass *mask,
  110. GraphicBufferClass *back);
  111. /*
  112. -------------------------------- drawshp.asm --------------------------------
  113. */
  114. extern "C" {
  115. int Draw_Shape(GraphicViewPortClass *gvp, void const *shape, LONG x, LONG y, LONG flags, ...);
  116. }
  117. /*
  118. ---------------------------------- shape.c ----------------------------------
  119. */
  120. short __cdecl Get_Shape_Data(void const *shape, int data);
  121. int __cdecl Extract_Shape_Count(void const *buffer);
  122. void * __cdecl Extract_Shape(void const *buffer, int shape);
  123. int __cdecl Restore_Shape_Height(void *shape);
  124. int __cdecl Set_Shape_Height(void const *shape, int newheight);
  125. extern "C" {
  126. int __cdecl Get_Shape_Width(void const *shape);
  127. int __cdecl Get_Shape_Height(void const *shape);
  128. int __cdecl Get_Shape_Original_Height(void const *shape);
  129. int __cdecl Get_Shape_Uncomp_Size(void const *shape);
  130. }
  131. /*
  132. ------------------------------- setshape.asm --------------------------------
  133. */
  134. extern "C" {
  135. void __cdecl Set_Shape_Buffer(void const *buffer, int size);
  136. }
  137. /*
  138. ------------------------------- shapeinf.asm --------------------------------
  139. */
  140. int __cdecl Get_Shape_Flags(void const *shape);
  141. int __cdecl Get_Shape_Size(void const *shape);
  142. int __cdecl Get_Shape_Scaled_Width(void const *shape, int scale);
  143. int __cdecl Get_Shape_Scaled_Height(void const *shape, int scale);
  144. #endif // SHAPE_H
  145. /****************************** End of shape.h *****************************/
  146. 
  147.