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