Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. //
  9. // Half-Life Model Viewer (c) 1999 by Mete Ciragan
  10. //
  11. // file: ViewerSettings.cpp
  12. // last modified: May 29 1999, Mete Ciragan
  13. // copyright: The programs and associated files contained in this
  14. // distribution were developed by Mete Ciragan. The programs
  15. // are not in the public domain, but they are freely
  16. // distributable without licensing fees. These programs are
  17. // provided without guarantee or warrantee expressed or
  18. // implied.
  19. //
  20. // version: 1.2
  21. //
  22. // email: [email protected]
  23. // web: http://www.swissquake.ch/chumbalum-soft/
  24. //
  25. #include "ViewerSettings.h"
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28. #include <string.h>
  29. // memdbgon must be the last include file in a .cpp file!!!
  30. #include <tier0/memdbgon.h>
  31. ViewerSettings g_viewerSettings;
  32. void
  33. InitViewerSettings (void)
  34. {
  35. memset (&g_viewerSettings, 0, sizeof (ViewerSettings));
  36. g_viewerSettings.rot[0] = -90.0f;
  37. g_viewerSettings.trans[3] = 50.0f;
  38. g_viewerSettings.renderMode = RM_TEXTURED;
  39. g_viewerSettings.transparency = 1.0f;
  40. g_viewerSettings.gColor[0] = 0.85f;
  41. g_viewerSettings.gColor[1] = 0.85f;
  42. g_viewerSettings.gColor[2] = 0.69f;
  43. g_viewerSettings.lColor[0] = 1.0f;
  44. g_viewerSettings.lColor[1] = 1.0f;
  45. g_viewerSettings.lColor[2] = 1.0f;
  46. g_viewerSettings.speedScale = 1.0f;
  47. g_viewerSettings.textureLimit = 256;
  48. g_viewerSettings.textureScale = 1.0f;
  49. }
  50. int
  51. LoadViewerSettings (const char *filename)
  52. {
  53. FILE *file = fopen (filename, "rb");
  54. if (!file)
  55. return 0;
  56. fread (&g_viewerSettings, sizeof (ViewerSettings), 1, file);
  57. fclose (file);
  58. return 1;
  59. }
  60. int
  61. SaveViewerSettings (const char *filename)
  62. {
  63. FILE *file = fopen (filename, "wb");
  64. if (!file)
  65. return 0;
  66. fwrite (&g_viewerSettings, sizeof (ViewerSettings), 1, file);
  67. fclose (file);
  68. return 1;
  69. }