palcommon.h 2.7 KB

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