deffont.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #if defined(_MSC_VER)
  19. #pragma once
  20. #endif
  21. #ifndef DEFFONT_H
  22. #define DEFFONT_H
  23. #include "wwfont.h"
  24. // Default 1 color fonts.
  25. extern WWFontClass DefaultFont;
  26. enum FontStyleEnum {
  27. // Note: Space 6 means that a standard letter uses 6 points - the font is larger then that
  28. // because of overhangs and rises.
  29. // The 4 Color means there are four colors used in this not including transperancy.
  30. SPACE_6_PNT_2_COLOR,
  31. SPACE_8_PNT_3_COLOR,
  32. SPACE_11_PNT_4_COLOR,
  33. NUM_FONT_STYLES,
  34. };
  35. enum FontRemapEnum {
  36. // A temp buffer that programmer can change before each use.
  37. USER_256_COLORS,
  38. DARK_GREEN_3_COLOR,
  39. LIGHT_GREEN_3_COLOR,
  40. DARK_GREEN_4_COLOR,
  41. LIGHT_GREEN_4_COLOR,
  42. DARK_GREEN_2_COLOR,
  43. LIGHT_GREEN_2_COLOR,
  44. DARK_BLUE_2_COLOR,
  45. LIGHT_BLUE_2_COLOR,
  46. DARK_RED_4_COLOR,
  47. // This is a RAMP palette. See/Use Build_Font_Palette_From_Ramp().
  48. RAMP_GREEN_TO_RED_2_COLOR, // For use with 2 color fonts where color 2 is changes. Color 1 is preset to 0.
  49. NUM_FONT_REMAPS,
  50. };
  51. // Two spacy looking fonts that use 8 colors each.
  52. extern void *FontData[NUM_FONT_STYLES];
  53. // For now we have green cause that is all that is needed. Add more as needed.
  54. extern unsigned char *FontRemapTables[NUM_FONT_REMAPS];
  55. // Number of colors (allocated chars) in FontRemapTable. Useful for some of the RAMPS.
  56. extern int FontRemapTablesSize[NUM_FONT_REMAPS];
  57. // Converter class for use with Font*Data and *FontRemapTable.
  58. // You can create a font like this:
  59. // NEW WWFontClass(SpaceFont8Data, true, 1, FontConverter, GreenFontRemapTable);
  60. extern ConvertClass *FontConverter;
  61. // Load font data for fonts listed above.
  62. void Load_Default_Font_Data();
  63. void Release_Default_Font_Data();
  64. // A routine that will load font data from a *.fnt file make from FontMake.exe
  65. void *Load_Font_Data(char *fname);
  66. // Creates a palette from a ramp palette given min and max values.
  67. unsigned char *Build_Font_Palette_From_Ramp(float val_norm, FontRemapEnum remap, unsigned char *ret_remap = &FontRemapTables[USER_256_COLORS][0]);
  68. #endif