1 #include "Directories.h"
2 #include "Text.h"
3 #include "Text_Utils.h"
4 #include "FileMan.h"
5 #include "GameSettings.h"
6 
7 #include "game/GameRes.h"
8 #include "ContentManager.h"
9 #include "GameInstance.h"
10 
11 #include <string_theory/string>
12 
13 
14 #define ITEMSTRINGFILENAME BINARYDATADIR "/itemdesc.edt"
15 
16 
LoadItemInfo(UINT16 const ubIndex)17 ST::string LoadItemInfo(UINT16 const ubIndex)
18 {
19 	UINT32 Seek = (SIZE_SHORT_ITEM_NAME + SIZE_ITEM_NAME + SIZE_ITEM_INFO) * ubIndex;
20 	return GCM->loadEncryptedString(ITEMSTRINGFILENAME, Seek + SIZE_ITEM_NAME + SIZE_SHORT_ITEM_NAME, SIZE_ITEM_INFO);
21 }
22 
23 
LoadAllItemNames(void)24 static void LoadAllItemNames(void)
25 {
26 	AutoSGPFile File(GCM->openGameResForReading(ITEMSTRINGFILENAME));
27 	for (UINT32 i = 0; i < MAXITEMS; i++)
28 	{
29 		UINT32 Seek = (SIZE_SHORT_ITEM_NAME + SIZE_ITEM_NAME + SIZE_ITEM_INFO) * i;
30 		ShortItemNames[i] = GCM->loadEncryptedString(File, Seek, SIZE_SHORT_ITEM_NAME);
31 		ItemNames[i] = GCM->loadEncryptedString(File, Seek + SIZE_SHORT_ITEM_NAME, SIZE_ITEM_NAME);
32 	}
33 }
34 
35 
LoadAllExternalText(void)36 void LoadAllExternalText( void )
37 {
38 	LoadAllItemNames();
39 }
40 
GetWeightUnitString(void)41 ST::string GetWeightUnitString( void )
42 {
43 	if ( gGameSettings.fOptions[ TOPTION_USE_METRIC_SYSTEM ] ) // metric
44 	{
45 		return( pMessageStrings[ MSG_KILOGRAM_ABBREVIATION ] );
46 	}
47 	else
48 	{
49 		return( pMessageStrings[ MSG_POUND_ABBREVIATION ] );
50 	}
51 }
52 
GetWeightBasedOnMetricOption(UINT32 uiObjectWeight)53 FLOAT GetWeightBasedOnMetricOption( UINT32 uiObjectWeight )
54 {
55 	FLOAT fWeight = 0.0f;
56 
57 	//if the user is smart and wants things displayed in 'metric'
58 	if ( gGameSettings.fOptions[ TOPTION_USE_METRIC_SYSTEM ] ) // metric
59 	{
60 		fWeight = (FLOAT)uiObjectWeight;
61 	}
62 
63 	//else the user is a caveman and display it in pounds
64 	else
65 	{
66 		fWeight = uiObjectWeight * 2.2f;
67 	}
68 
69 	return( fWeight );
70 }
71