WSA.H 8.7 KB

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