summaryrefslogtreecommitdiff
path: root/hammer/viewersettings.cpp
blob: d3a80ee49770e5a07ecebcd4315e10d810e3406e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//
//=============================================================================//
//
//                 Half-Life Model Viewer (c) 1999 by Mete Ciragan
//
// file:           ViewerSettings.cpp
// last modified:  May 29 1999, Mete Ciragan
// copyright:      The programs and associated files contained in this
//                 distribution were developed by Mete Ciragan. The programs
//                 are not in the public domain, but they are freely
//                 distributable without licensing fees. These programs are
//                 provided without guarantee or warrantee expressed or
//                 implied.
//
// version:        1.2
//
// email:          [email protected]
// web:            http://www.swissquake.ch/chumbalum-soft/
//
#include "ViewerSettings.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>



ViewerSettings g_viewerSettings;



void
InitViewerSettings (void)
{
	memset (&g_viewerSettings, 0, sizeof (ViewerSettings));
	g_viewerSettings.rot[0] = -90.0f;
	//g_viewerSettings.trans[3] = 50.0f;
	g_viewerSettings.renderMode = RM_TEXTURED;
	g_viewerSettings.transparency = 1.0f;

	g_viewerSettings.gColor[0] = 0.85f;
	g_viewerSettings.gColor[1] = 0.85f;
	g_viewerSettings.gColor[2] = 0.69f;

	g_viewerSettings.lColor[0] = 1.0f;
	g_viewerSettings.lColor[1] = 1.0f;
	g_viewerSettings.lColor[2] = 1.0f;

	g_viewerSettings.speedScale = 1.0f;
	g_viewerSettings.textureLimit = 256;

	g_viewerSettings.textureScale = 1.0f;
}



int
LoadViewerSettings (const char *filename)
{
	FILE *file = fopen (filename, "rb");

	if (!file)
		return 0;

	fread (&g_viewerSettings, sizeof (ViewerSettings), 1, file);
	fclose (file);

	return 1;
}



int
SaveViewerSettings (const char *filename)
{
	FILE *file = fopen (filename, "wb");

	if (!file)
		return 0;

	fwrite (&g_viewerSettings, sizeof (ViewerSettings), 1, file);
	fclose (file);

	return 1;
}