aboutsummaryrefslogtreecommitdiff
path: root/sword2/driver/language.cpp
blob: 13d482d83438ac50a910aa6ac75f96b856041160 (plain)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* Copyright (C) 1994-2003 Revolution Software Ltd
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header$
 */

//=============================================================================
//
//	Filename	:	language.c
//	Created		:	20th August 1996
//	By			:	P.R.Porter
//
//	Summary		:	This module holds the functions which govern which language
//					version is current.
//
//
//	Version	Date		By		Description
//	------- ---------	---		-----------------------------------------------
//	1.0		16-Sep-96	PRP		Initial language version control functions.
//								Many of the functions are currently stubs, and
//								this will be addressed shortly.
//
//
//	Functions
//	---------
//
//	--------------------------------------------------------------------------
//
//	int32 GetLanguageVersion(uint8 *version)
//
//	This function modifies the 'version' passed in to be the current language.
//	The first time this function is called, it gets the language from the 
//	version.inf file distributed on the game CD.  It returns an RD error code
//	if this file cannot be opened, or the version cannot be obtained from it.
//
//	---------------------------------------------------------------------------
//	
//	int32 SetLanguageVersion(uint8 version)
//
//	This function is useful for debugging.  It sets the version to the one
//	passed in.
//
//	---------------------------------------------------------------------------
//	
//	int32 GetGameName(uint8 *name);
//
//	Fills the string pointed to by name with the title of the game, depending
//	upon what the current language version is.
//
//=============================================================================


#include "stdafx.h"
#include "driver96.h"



uint8 languageVersion = ENGLISH;

static uint8 versionFromFile = 0;




int32 GetLanguageVersion(uint8 *version)

{

	if (versionFromFile)
	{
		*version = languageVersion;
	}
	else
	{
		versionFromFile = 1;
		languageVersion = AMERICAN;
		return(RDERR_OPENVERSIONFILE);
	}
	return(RD_OK);

}


int32 SetLanguageVersion(uint8 version)

{

	languageVersion = version;
	return(RD_OK);

}


int32 GetGameName(uint8 *name)

{

	uint8 version;
	int32 rv;


	rv = GetLanguageVersion(&version);

	switch(version)
	{
	case ENGLISH:
		strcpy((char *)name, "Broken Sword II");
		break;
	case AMERICAN:
		strcpy((char *)name, "Circle of Blood II");
		break;
	case GERMAN:
		strcpy((char *)name, "Baphomet's Fluch II");
		break;
	default:
		strcpy((char *)name, "Some game or other, part 86");
		return(RDERR_INVALIDVERSION);
	}

	return(rv);

}