Subversion Repositories Games.Carmageddon

Rev

Rev 18 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #ifndef _UTILITY_H_
  2. #define _UTILITY_H_
  3.  
  4. #include "brender/br_types.h"
  5. #include "dr_types.h"
  6.  
  7. extern int gIn_check_quit;
  8. extern tU32 gLost_time;
  9. //extern tU32 gLong_key[4]; // Pierre-Marie Baty -- not needed elsewhere
  10. //extern tU32 gOther_long_key[4]; // Pierre-Marie Baty -- not needed elsewhere
  11. extern int gEncryption_method;
  12. extern char* gMisc_strings[250];
  13. extern br_pixelmap* g16bit_palette;
  14. extern br_pixelmap* gSource_for_16bit_palette;
  15.  
  16. typedef br_uint_32 recurse_with_mat_cbfn(br_actor*, br_material*, void*);
  17.  
  18. int CheckQuit(void);
  19.  
  20. double sqr(double pN);
  21.  
  22. void EncodeLine(char* pS);
  23.  
  24. int IRandomBetween(int pA, int pB);
  25.  
  26. int PercentageChance(int pC);
  27.  
  28. int IRandomPosNeg(int pN);
  29.  
  30. float FRandomBetween(float pA, float pB);
  31.  
  32. float FRandomPosNeg(float pN);
  33.  
  34. br_scalar SRandomBetween(br_scalar pA, br_scalar pB);
  35.  
  36. br_scalar SRandomPosNeg(br_scalar pN);
  37.  
  38. char* GetALineWithNoPossibleService(FILE* pF, unsigned char* pS);
  39.  
  40. char* GetALineAndDontArgue(FILE* pF, char* pS);
  41.  
  42. void PathCat(char* pDestn_str, char* pStr_1, char* pStr_2);
  43.  
  44. int Chance(float pChance_per_second, int pPeriod);
  45.  
  46. float tandeg(float pAngle);
  47.  
  48. tU32 GetFileLength(FILE* pF);
  49.  
  50. int BooleanTo1Or0(int pB);
  51.  
  52. br_pixelmap* DRPixelmapAllocate(br_uint_8 pType, br_uint_16 pW, br_uint_16 pH, void* pPixels, int pFlags);
  53.  
  54. br_pixelmap* DRPixelmapAllocateSub(br_pixelmap* pPm, br_uint_16 pX, br_uint_16 pY, br_uint_16 pW, br_uint_16 pH);
  55.  
  56. br_pixelmap* DRPixelmapMatchSized(br_pixelmap* pSrc, tU8 pMatch_type, tS32 pWidth, tS32 pHeight);
  57.  
  58. void CopyDoubled8BitTo16BitRectangle(br_pixelmap* pDst, br_pixelmap* pSrc, int pSrc_width, int pSrc_height, int pDst_x, int pDst_y, br_pixelmap* pPalette);
  59.  
  60. br_pixelmap* Scale8BitPixelmap(br_pixelmap* pSrc, int pWidth, int pHeight);
  61.  
  62. br_pixelmap* Tile8BitPixelmap(br_pixelmap* pSrc, int pN);
  63.  
  64. tException_list FindExceptionInList(char* pName, tException_list pList);
  65.  
  66. br_pixelmap* PurifiedPixelmap(br_pixelmap* pSrc);
  67.  
  68. br_pixelmap* DRPixelmapLoad(char* pFile_name);
  69.  
  70. br_uint_32 DRPixelmapLoadMany(char* pFile_name, br_pixelmap** pPixelmaps, br_uint_16 pNum);
  71.  
  72. void WaitFor(tU32 pDelay);
  73.  
  74. intptr_t DRActorEnumRecurse(br_actor* pActor, br_actor_enum_cbfn* callback, void* arg);
  75.  
  76. intptr_t CompareActorID(br_actor* pActor, void* pArg);
  77.  
  78. br_actor* DRActorFindRecurse(br_actor* pSearch_root, char* pName);
  79.  
  80. br_uint_32 DRActorEnumRecurseWithMat(br_actor* pActor, br_material* pMat, br_uint_32 (*pCall_back)(br_actor*, br_material*, void*), void* pArg);
  81.  
  82. br_uint_32 DRActorEnumRecurseWithTrans(br_actor* pActor, br_matrix34* pMatrix, br_uint_32 (*pCall_back)(br_actor*, br_matrix34*, void*), void* pArg);
  83.  
  84. int sign(int pNumber);
  85.  
  86. float fsign(float pNumber);
  87.  
  88. FILE* OpenUniqueFileB(char* pPrefix, char* pExtension);
  89.  
  90. void PrintScreenFile(FILE* pF);
  91.  
  92. void PrintScreenFile16(FILE* pF);
  93.  
  94. void PrintScreen(void);
  95.  
  96. tU32 GetTotalTime(void);
  97.  
  98. tU32 GetRaceTime(void);
  99.  
  100. void AddLostTime(tU32 pLost_time);
  101.  
  102. void TimerString(tU32 pTime, char* pStr, int pFudge_colon, int pForce_colon);
  103.  
  104. char* GetMiscString(int pIndex);
  105.  
  106. void GetCopyOfMiscString(int pIndex, char* pStr);
  107.  
  108. int Flash(tU32 pPeriod, tU32* pLast_change, int* pCurrent_state);
  109.  
  110. void MaterialCopy(br_material* pDst, br_material* pSrc);
  111.  
  112. double RGBDifferenceSqr(tRGB_colour* pColour_1, tRGB_colour* pColour_2);
  113.  
  114. int FindBestMatch(tRGB_colour* pRGB_colour, br_pixelmap* pPalette);
  115.  
  116. void BuildShadeTablePath(char* pThe_path, int pR, int pG, int pB);
  117.  
  118. br_pixelmap* LoadGeneratedShadeTable(int pR, int pG, int pB);
  119.  
  120. void SaveGeneratedShadeTable(br_pixelmap* pThe_table, int pR, int pG, int pB);
  121.  
  122. br_pixelmap* GenerateShadeTable(int pHeight, br_pixelmap* pPalette, int pRed_mix, int pGreen_mix, int pBlue_mix, float pQuarter, float pHalf, float pThree_quarter);
  123.  
  124. br_pixelmap* GenerateDarkenedShadeTable(int pHeight, br_pixelmap* pPalette, int pRed_mix, int pGreen_mix, int pBlue_mix, float pQuarter, float pHalf, float pThree_quarter, br_scalar pDarken);
  125.  
  126. void PossibleService(void);
  127.  
  128. void DRMatrix34TApplyP(br_vector3* pA, br_vector3* pB, br_matrix34* pC);
  129.  
  130. tU16 PaletteEntry16Bit(br_pixelmap* pPal, int pEntry);
  131.  
  132. br_pixelmap* PaletteOf16Bits(br_pixelmap* pSrc);
  133.  
  134. void Copy8BitTo16Bit(br_pixelmap* pDst, br_pixelmap* pSrc, br_pixelmap* pPalette);
  135.  
  136. void Copy8BitTo16BitRectangle(br_pixelmap* pDst, tS16 pDst_x, tS16 pDst_y, br_pixelmap* pSrc, tS16 pSrc_x, tS16 pSrc_y, tS16 pWidth, tS16 pHeight, br_pixelmap* pPalette);
  137.  
  138. void Copy8BitTo16BitRectangleWithTransparency(br_pixelmap* pDst, tS16 pDst_x, tS16 pDst_y, br_pixelmap* pSrc, tS16 pSrc_x, tS16 pSrc_y, tS16 pWidth, tS16 pHeight, br_pixelmap* pPalette);
  139.  
  140. void Copy8BitToOnscreen16BitRectangleWithTransparency(br_pixelmap* pDst, tS16 pDst_x, tS16 pDst_y, br_pixelmap* pSrc, tS16 pSrc_x, tS16 pSrc_y, tS16 pWidth, tS16 pHeight, br_pixelmap* pPalette);
  141.  
  142. void Copy8BitRectangleTo16BitRhombusWithTransparency(br_pixelmap* pDst, tS16 pDst_x, tS16 pDst_y, br_pixelmap* pSrc, tS16 pSrc_x, tS16 pSrc_y, tS16 pWidth, tS16 pHeight, tX1616 pShear, br_pixelmap* pPalette);
  143.  
  144. void DRPixelmapRectangleCopy(br_pixelmap* dst, br_int_16 dx, br_int_16 dy, br_pixelmap* src, br_int_16 sx, br_int_16 sy, br_uint_16 w, br_uint_16 h);
  145.  
  146. void DRPixelmapCopy(br_pixelmap* dst, br_pixelmap* src);
  147.  
  148. void DRPixelmapRectangleFill(br_pixelmap* dst, br_int_16 x, br_int_16 y, br_uint_16 w, br_uint_16 h, br_uint_32 colour);
  149.  
  150. int NormalSideOfPlane(br_vector3* pPoint, br_vector3* pNormal, br_scalar pD);
  151.  
  152. br_material* DRMaterialClone(br_material* pMaterial);
  153.  
  154. void StripCR(char* s);
  155.  
  156. void SubsStringJob(char* pStr, ...);
  157.  
  158. void DecodeLine2(char* pS);
  159.  
  160. void EncodeLine2(char* pS);
  161.  
  162. void EncodeFile(char* pThe_path);
  163.  
  164. void EncodeFileWrapper(char* pThe_path);
  165.  
  166. void EncodeAllFilesInDirectory(char* pThe_path);
  167.  
  168. void SkipNLines(FILE* pF);
  169.  
  170. int DRStricmp(char* p1, char* p2);
  171.  
  172. void GlorifyMaterial(br_material** pArray, int pCount);
  173.  
  174. void WhitenVertexRGB(br_model** pArray, int pN);
  175.  
  176. void NobbleNonzeroBlacks(br_pixelmap* pPalette);
  177.  
  178. int PDCheckDriveExists(char* pThe_path);
  179.  
  180. int OpacityInPrims(br_token_value* pPrims);
  181.  
  182. int AlreadyBlended(br_material* pMaterial);
  183.  
  184. void BlendifyMaterialTablishly(br_material* pMaterial, int pPercent);
  185.  
  186. void BlendifyMaterialPrimitively(br_material* pMaterial, int pPercent);
  187.  
  188. void BlendifyMaterial(br_material* pMaterial, int pPercent);
  189.  
  190. #endif
  191.