palcommon.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /* -*- mode: c; tab-width: 4; c-basic-offset: 3; c-file-style: "linux" -*- */
  2. //
  3. // Copyright (c) 2009, Wei Mingzhi <whistler_wmz@users.sf.net>.
  4. // All rights reserved.
  5. //
  6. // This file is part of SDLPAL.
  7. //
  8. // SDLPAL is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. #ifndef _PALUTILS_H
  22. #define _PALUTILS_H
  23. #include "common.h"
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. typedef LPBYTE LPSPRITE, LPBITMAPRLE;
  29. typedef LPCBYTE LPCSPRITE, LPCBITMAPRLE;
  30. typedef DWORD PAL_POS;
  31. #define PAL_XY(x, y) (PAL_POS)(((((WORD)(y)) << 16) & 0xFFFF0000) | (((WORD)(x)) & 0xFFFF))
  32. #define PAL_X(xy) (SHORT)((xy) & 0xFFFF)
  33. #define PAL_Y(xy) (SHORT)(((xy) >> 16) & 0xFFFF)
  34. typedef enum tagPALDIRECTION
  35. {
  36. kDirSouth = 0,
  37. kDirWest,
  38. kDirNorth,
  39. kDirEast,
  40. kDirUnknown
  41. } PALDIRECTION, *LPPALDIRECTION;
  42. INT
  43. PAL_RLEBlitToSurface(
  44. LPCBITMAPRLE lpBitmapRLE,
  45. SDL_Surface *lpDstSurface,
  46. PAL_POS pos
  47. );
  48. INT
  49. PAL_RLEBlitWithColorShift(
  50. LPCBITMAPRLE lpBitmapRLE,
  51. SDL_Surface *lpDstSurface,
  52. PAL_POS pos,
  53. INT iColorShift
  54. );
  55. INT
  56. PAL_RLEBlitMonoColor(
  57. LPCBITMAPRLE lpBitmapRLE,
  58. SDL_Surface *lpDstSurface,
  59. PAL_POS pos,
  60. BYTE bColor,
  61. INT iColorShift
  62. );
  63. INT
  64. PAL_FBPBlitToSurface(
  65. LPBYTE lpBitmapFBP,
  66. SDL_Surface *lpDstSurface
  67. );
  68. INT
  69. PAL_RLEGetWidth(
  70. LPCBITMAPRLE lpBitmapRLE
  71. );
  72. INT
  73. PAL_RLEGetHeight(
  74. LPCBITMAPRLE lpBitmapRLE
  75. );
  76. WORD
  77. PAL_SpriteGetNumFrames(
  78. LPCSPRITE lpSprite
  79. );
  80. LPCBITMAPRLE
  81. PAL_SpriteGetFrame(
  82. LPCSPRITE lpSprite,
  83. INT iFrameNum
  84. );
  85. INT
  86. PAL_MKFGetChunkCount(
  87. FILE *fp
  88. );
  89. INT
  90. PAL_MKFGetChunkSize(
  91. UINT uiChunkNum,
  92. FILE *fp
  93. );
  94. INT
  95. PAL_MKFReadChunk(
  96. LPBYTE lpBuffer,
  97. UINT uiBufferSize,
  98. UINT uiChunkNum,
  99. FILE *fp
  100. );
  101. INT
  102. PAL_MKFGetDecompressedSize(
  103. UINT uiChunkNum,
  104. FILE *fp
  105. );
  106. INT
  107. PAL_MKFDecompressChunk(
  108. LPBYTE lpBuffer,
  109. UINT uiBufferSize,
  110. UINT uiChunkNum,
  111. FILE *fp
  112. );
  113. // From yj1.c:
  114. extern INT
  115. (*Decompress)(
  116. LPCVOID Source,
  117. LPVOID Destination,
  118. INT DestSize
  119. );
  120. INT
  121. YJ1_Decompress(
  122. LPCVOID Source,
  123. LPVOID Destination,
  124. INT DestSize
  125. );
  126. INT
  127. YJ2_Decompress(
  128. LPCVOID Source,
  129. LPVOID Destination,
  130. INT DestSize
  131. );
  132. #ifdef __cplusplus
  133. }
  134. #endif
  135. #endif // _PALUTILS_H