WSA.H 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 A S S O C I A T E S **
  20. ***************************************************************************
  21. * *
  22. * Project Name : WSA 32bit LIbrary *
  23. * *
  24. * File Name : WSA.H *
  25. * *
  26. * Programmer : Scott K. Bowen *
  27. * *
  28. * Start Date : May 23, 1994 *
  29. * *
  30. * Last Update : May 25, 1994 [SKB] *
  31. * *
  32. *-------------------------------------------------------------------------*
  33. * Functions: *
  34. * Open_Animation -- file name and flags, system allocates buffer. *
  35. * Open_Animation -- file name, flags, palette, system allocates buffer. *
  36. * Open_Animation -- file_name, graphic buffer, flags. *
  37. * Open_Animation -- file name, bufferclass, flags, palette. *
  38. * Open_Animation -- filename, ptr, size, flags, no palette. *
  39. * Animate_Frame -- Animate a frame to a page with magic colors. *
  40. * Animate_Frame -- Animate a frame to a viewport with magic colors. *
  41. * Animate_Frame -- Animate a frame to a page. *
  42. * Animate_Frame -- Animate a frame to a viewport. *
  43. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  44. #ifndef WSA_H
  45. #define WSA_H
  46. #ifndef WWSTD_H
  47. #include "wwstd.h"
  48. #endif
  49. #ifndef GBUFFER_H
  50. #include "gbuffer.h"
  51. #endif
  52. #ifndef VBUFFER_H
  53. #include "vbuffer.h"
  54. #endif
  55. //lint -strong(AJX,WSAType)
  56. typedef enum {
  57. WSA_NORMAL, // Normal WSA animation
  58. WSA_GHOST = 0x1000, // Or'd with the above flags to get ghosting
  59. WSA_PRIORITY2 = 0x2000, // Copy using a priority (or in the priority)
  60. WSA_TRANS = 0x4000, // Copy frame, ignoring transparent colors
  61. WSA_PRIORITY = 0x8000 // Copy using a priority (or in the priority)
  62. } WSAType;
  63. //lint -strong(AJX,WSAOpenType)
  64. typedef enum {
  65. WSA_OPEN_FROM_MEM = 0x0000, // Try to load entire anim into memory.
  66. WSA_OPEN_INDIRECT = 0x0000, // First animate to internal buffer, then copy to page/viewport.
  67. WSA_OPEN_FROM_DISK = 0x0001, // Force the animation to be disk based.
  68. WSA_OPEN_DIRECT = 0x0002, // Animate directly to page or viewport.
  69. // These next two have been added for the 32 bit library to give a better idea of what is
  70. // happening. You may want to animate directly to the destination or indirectly to the
  71. // destination by using the animations buffer. Indirecly is best if the dest is a seenpage
  72. // and the animation is not linear or if the destination is modified between frames.
  73. WSA_OPEN_TO_PAGE = WSA_OPEN_DIRECT ,
  74. WSA_OPEN_TO_BUFFER= WSA_OPEN_INDIRECT ,
  75. } WSAOpenType;
  76. /*=========================================================================*/
  77. /* The following prototypes are for the file: WSA.CPP */
  78. /*=========================================================================*/
  79. VOID * cdecl Open_Animation(BYTE const *file_name, BYTE *user_buffer, LONG user_buffer_size, WSAOpenType user_flags, UBYTE *palette=NULL);
  80. VOID cdecl Close_Animation( VOID *handle );
  81. BOOL cdecl Animate_Frame(VOID *handle, GraphicViewPortClass& view,
  82. WORD frame_number, WORD x_pixel=0, WORD y_pixel=0,
  83. WSAType flags_and_prio = WSA_NORMAL, VOID *magic_cols=NULL, VOID *magic=NULL);
  84. WORD cdecl Get_Animation_Frame_Count(VOID *handle);
  85. BOOL cdecl Animate_Frame(VOID *handle, VideoViewPortClass& view,
  86. WORD frame_number, WORD x_pixel=0, WORD y_pixel=0,
  87. WSAType flags_and_prio = WSA_NORMAL, VOID *magic_cols=NULL, VOID *magic=NULL);
  88. WORD cdecl Get_Animation_Frame_Count(VOID *handle);
  89. WORD cdecl Get_Animation_X(VOID const *handle);
  90. WORD cdecl Get_Animation_Y(VOID const *handle);
  91. WORD cdecl Get_Animation_Width(VOID const *handle);
  92. WORD cdecl Get_Animation_Height(VOID const *handle);
  93. WORD cdecl Get_Animation_Palette(VOID const *handle);
  94. ULONG cdecl Get_Animation_Size(VOID const *handle);
  95. /***************************************************************************
  96. * OPEN_ANIMATION -- file name, flags, palette, system allocates buffer. *
  97. * *
  98. * *
  99. * INPUT: BYTE *file_name - name of file to open. *
  100. * WSAOpenType user_flags - flags on how to open. *
  101. * UBYTE *palette - pointer to a palette buffer to fill. *
  102. * *
  103. * OUTPUT: VOID *pointer to animation data. Must be used for all *
  104. * other WSA calls. *
  105. * *
  106. * WARNINGS: *
  107. * *
  108. * HISTORY: *
  109. * 05/24/1994 SKB : Created. *
  110. *=========================================================================*/
  111. inline VOID *cdecl Open_Animation(BYTE *file_name, WSAOpenType user_flags, UBYTE *palette=NULL)
  112. {
  113. return (Open_Animation(file_name, NULL, 0L, user_flags, palette));
  114. }
  115. /***************************************************************************
  116. * OPEN_ANIMATION -- file_name, bufferclass, flags. *
  117. * *
  118. * *
  119. * INPUT: BYTE *file_name - name of file to open. *
  120. * GraphicBufferClass - pointer to a buffer. *
  121. * WSAOpenType user_flags - flags on how to open. *
  122. * UBYTE *palette - pointer to a palette buffer to fill. *
  123. * *
  124. * OUTPUT: VOID *pointer to animation data. Must be used for all *
  125. * other WSA calls. *
  126. * *
  127. * WARNINGS: *
  128. * *
  129. * HISTORY: *
  130. * 05/24/1994 SKB : Created. *
  131. *=========================================================================*/
  132. inline VOID *cdecl Open_Animation(BYTE *file_name, BufferClass& buffer, WSAOpenType user_flags, UBYTE *palette=NULL)
  133. {
  134. return (Open_Animation(file_name, (BYTE *)buffer.Get_Buffer(), buffer.Get_Size(), user_flags, palette));
  135. }
  136. /*=========================================================================*/
  137. /* The following prototypes are for the file: LP_ASM.ASM */
  138. /*=========================================================================*/
  139. extern "C" {
  140. UWORD Apply_XOR_Delta(BYTE *source_ptr, BYTE *delta_ptr);
  141. VOID Apply_XOR_Delta_To_Page_Or_Viewport(VOID *target, VOID *delta, WORD width, WORD nextrow, WORD copy);
  142. }
  143. #endif // WSA_H