Commits

Gennady Trafimenkov committed 56e78cc Merge with conflicts

Merge branch 'experimental' into mod-pack

Conflicts:
_build/solution-vs10e/ja2.vcxproj
_build/solution-vs10e/ja2.vcxproj.filters

  • Participants
  • Parent commits 7c167a8, ba1859b
  • Branches mod-pack

Comments (0)

Files changed (123)

File Build/Credits.cc

 #include "Cursors.h"
 #include "Debug.h"
 #include "Directories.h"
-#include "Encrypted_File.h"
 #include "English.h"
 #include "Font.h"
 #include "Font_Control.h"
 #include "WordWrap.h"
 #include "UILayout.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 struct CRDT_NODE
 {
 	const UINT32 pos = CREDITS_LINESIZE * guiCurrentCreditRecord++;
 	try
 	{
-		LoadEncryptedDataFromFile(CRDT_NAME_OF_CREDIT_FILE, text, pos, CREDITS_LINESIZE);
+		GCM->loadEncryptedString(CRDT_NAME_OF_CREDIT_FILE, text, pos, CREDITS_LINESIZE);
 	}
 	catch (...) // XXX fishy, should check file size beforehand
 	{

File Build/Editor/EditorItems.cc

 #include "Items.h"
 #include "MemMan.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
+#include "MagazineModel.h"
+#include "WeaponModels.h"
+
 
 #define NUMBER_TRIGGERS			27
 #define PRESSURE_ACTION_ID	(NUMBER_TRIGGERS - 1)
 	INVTYPE const* const item = &Item[obj.usItem];
 	if (item->usItemClass == IC_AMMO)
 	{
-		UINT8 const mag_size = Magazine[item->ubClassIndex].ubMagSize;
+		UINT8 const mag_size = GCM->getMagazine(item->ubClassIndex)->capacity;
 		obj.ubShotsLeft[0] = Random(2) ? mag_size : Random(mag_size);
 	}
 	else
 	}
 	if (item->usItemClass & IC_GUN)
 	{
-		obj.ubGunShotsLeft = obj.usItem == ROCKET_LAUNCHER ? 1 : Random(Weapon[obj.usItem].ubMagSize);
+		obj.ubGunShotsLeft = obj.usItem == ROCKET_LAUNCHER ? 1 : Random(GCM->getWeapon(obj.usItem)->ubMagSize);
 	}
 
 	for (ITEM_POOL* ip = GetItemPool(sGridNo, 0); Assert(ip), ip; ip = ip->pNext)

File Build/Editor/Item_Statistics.cc

 #include "Pits.h"
 #include "UILayout.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
+#include "WeaponModels.h"
 
 GUIButtonRef giBothCheckboxButton;
 GUIButtonRef giRealisticCheckboxButton;
 	//Update the ammo
 	i = GetNumericStrictValueFromField( 2 );
 	if( i == -1 )
-		i = Random( 1 + Weapon[ gpItem->usItem ].ubMagSize );
+		i = Random( 1 + GCM->getWeapon( gpItem->usItem )->ubMagSize );
 	else
-		i = MIN( i, Weapon[ gpItem->usItem ].ubMagSize );
+		i = MIN( i, GCM->getWeapon( gpItem->usItem )->ubMagSize );
 	gpItem->ubGunShotsLeft = (UINT8)i;
 	SetInputFieldStringWithNumericStrictValue( 2, i );
 	//Update the trap level

File Build/GameRes.cc

 
   throw std::runtime_error(FormattedString("Multilanguage resource %d is not found", id));
 }
+
+STRING_ENC_TYPE getStringEncType()
+{
+  if(isRussianVersion() || isRussianGoldVersion())
+  {
+    return SE_RUSSIAN;
+  }
+  else if(isPolishVersion())
+  {
+    return SE_POLISH;
+  }
+  else if(isEnglishVersion())
+  {
+    return SE_ENGLISH;
+  }
+  return SE_NORMAL;
+}

File Build/GameRes.h

 #include "Types.h"
 #include "IEncodingCorrector.h"
 
+#include "StringEncodingTypes.h"
+
 /** List of supported game versions (localizations). */
 enum GameVersion {
   GV_DUTCH,
 /*************************************************************
  *
  ************************************************************/
+
+/** Get current string encoding type. */
+STRING_ENC_TYPE getStringEncType();

File Build/HelpScreen.cc

 #include "Directories.h"
-#include "Encrypted_File.h"
 #include "Font.h"
 #include "HImage.h"
 #include "Interface.h"
 #include "VSurface.h"
 #include "UILayout.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
+
 #ifdef JA2BETAVERSION
 #	include "Debug.h"
 #endif
 
 static void GetHelpScreenText(const UINT32 uiRecordToGet, wchar_t* const pText)
 {
-	LoadEncryptedDataFromFile(BINARYDATADIR "/help.edt", pText, HELPSCREEN_RECORD_SIZE * uiRecordToGet, HELPSCREEN_RECORD_SIZE);
+	GCM->loadEncryptedString(BINARYDATADIR "/help.edt", pText, HELPSCREEN_RECORD_SIZE * uiRecordToGet, HELPSCREEN_RECORD_SIZE);
 }
 
 

File Build/Laptop/AIM.cc

 #include "VObject.h"
 #include "Timer_Control.h"
 #include "WordWrap.h"
-#include "Encrypted_File.h"
 #include "EMail.h"
 #include "Game_Clock.h"
 #include "Text.h"
 #include "Button_System.h"
 #include "Font_Control.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 UINT8			AimMercArray[ MAX_NUMBER_MERCS ];
 
 
 static void LoadAIMText(wchar_t buf[], UINT32 entry)
 {
-	LoadEncryptedDataFromFile(AIMHISTORYFILE, buf, AIM_HISTORY_LINE_SIZE * entry, AIM_HISTORY_LINE_SIZE);
+	GCM->loadEncryptedString(AIMHISTORYFILE, buf, AIM_HISTORY_LINE_SIZE * entry, AIM_HISTORY_LINE_SIZE);
 }
 
 

File Build/Laptop/AIMArchives.cc

 #include "AIM.h"
 #include "VObject.h"
 #include "WordWrap.h"
-#include "Encrypted_File.h"
 #include "Text.h"
 #include "Button_System.h"
 #include "VSurface.h"
 #include "Video.h"
 #include "Font_Control.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 #define AIM_ALUMNI_NAME_FILE BINARYDATADIR "/alumname.edt"
 #define AIM_ALUMNI_FILE      BINARYDATADIR "/alumni.edt"
 
 		// Display the merc's name
 		wchar_t sText[AIM_ALUMNI_NAME_SIZE];
-		LoadEncryptedDataFromFile(AIM_ALUMNI_NAME_FILE, sText, AIM_ALUMNI_NAME_SIZE * face_idx, AIM_ALUMNI_NAME_SIZE);
+		GCM->loadEncryptedString(AIM_ALUMNI_NAME_FILE, sText, AIM_ALUMNI_NAME_SIZE * face_idx, AIM_ALUMNI_NAME_SIZE);
 		DrawTextToScreen(sText, x + AIM_ALUMNI_NAME_OFFSET_X, y + AIM_ALUMNI_NAME_OFFSET_Y, AIM_ALUMNI_NAME_WIDTH, AIM_ALUMNI_NAME_FONT, AIM_ALUMNI_NAME_COLOR, FONT_MCOLOR_BLACK, CENTER_JUSTIFIED);
 	}
 
 	//Load the description
 	wchar_t	sDesc[AIM_ALUMNI_DECRIPTION_SIZE];
 	uiStartLoc = AIM_ALUMNI_FILE_RECORD_SIZE * gubDrawOldMerc + AIM_ALUMNI_FULL_NAME_SIZE;
-	LoadEncryptedDataFromFile(AIM_ALUMNI_FILE, sDesc, uiStartLoc, AIM_ALUMNI_DECRIPTION_SIZE);
+	GCM->loadEncryptedString(AIM_ALUMNI_FILE, sDesc, uiStartLoc, AIM_ALUMNI_DECRIPTION_SIZE);
 
 	usStringPixLength = StringPixLength( sDesc, AIM_ALUMNI_POPUP_FONT);
 	ubNumDescLines = (UINT8) (usStringPixLength / AIM_POPUP_TEXT_WIDTH);
 	//Load and display the name
 	wchar_t	sName[AIM_ALUMNI_FULL_NAME_SIZE];
 	uiStartLoc = AIM_ALUMNI_FILE_RECORD_SIZE * gubDrawOldMerc;
-	LoadEncryptedDataFromFile(AIM_ALUMNI_FILE, sName, uiStartLoc, AIM_ALUMNI_FULL_NAME_SIZE);
+	GCM->loadEncryptedString(AIM_ALUMNI_FILE, sName, uiStartLoc, AIM_ALUMNI_FULL_NAME_SIZE);
 
 	DrawTextToScreen(sName, AIM_ALUMNI_POPUP_NAME_X, AIM_ALUMNI_POPUP_NAME_Y, 0, AIM_ALUMNI_POPUP_NAME_FONT, AIM_ALUMNI_POPUP_NAME_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
 

File Build/Laptop/AIMHistory.cc

 #include "AIM.h"
 #include "VObject.h"
 #include "WordWrap.h"
-#include "Encrypted_File.h"
 #include "Text.h"
 #include "Button_System.h"
 #include "Video.h"
 #include "VSurface.h"
 #include "Font_Control.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 // Defines
 
 
 static void LoadAIMHistoryText(wchar_t buf[], UINT32 entry)
 {
-	LoadEncryptedDataFromFile(AIMHISTORYFILE, buf, AIM_HISTORY_LINE_SIZE * entry, AIM_HISTORY_LINE_SIZE);
+	GCM->loadEncryptedString(AIMHISTORYFILE, buf, AIM_HISTORY_LINE_SIZE * entry, AIM_HISTORY_LINE_SIZE);
 }
 
 

File Build/Laptop/AIMMembers.cc

 #include "SoundMan.h"
 #include "ScreenIDs.h"
 #include "Font_Control.h"
-#include "Encrypted_File.h"
 #include "Strategic_Town_Loyalty.h"
-#include "GameRes.h"
 
+#include "Build/GameRes.h"
+#include "ContentManager.h"
 #include "GameInstance.h"
 #include "policy/GamePolicy.h"
 
 static void LoadMercBioInfo(UINT8 const ubIndex, wchar_t* const pInfoString, wchar_t* const pAddInfo)
 {
 	UINT32 uiStartSeekAmount = (SIZE_MERC_BIO_INFO + SIZE_MERC_ADDITIONAL_INFO) * ubIndex;
-	LoadEncryptedDataFromFile(MERCBIOSFILENAME, pInfoString, uiStartSeekAmount,                      SIZE_MERC_BIO_INFO);
-	LoadEncryptedDataFromFile(MERCBIOSFILENAME, pAddInfo,    uiStartSeekAmount + SIZE_MERC_BIO_INFO, SIZE_MERC_ADDITIONAL_INFO);
+	GCM->loadEncryptedString(MERCBIOSFILENAME, pInfoString, uiStartSeekAmount,                      SIZE_MERC_BIO_INFO);
+	GCM->loadEncryptedString(MERCBIOSFILENAME, pAddInfo,    uiStartSeekAmount + SIZE_MERC_BIO_INFO, SIZE_MERC_ADDITIONAL_INFO);
 }
 
 

File Build/Laptop/AIMPolicies.cc

 #include "AIM.h"
 #include "VObject.h"
 #include "WordWrap.h"
-#include "Encrypted_File.h"
 #include "Text.h"
 #include "Button_System.h"
 #include "Video.h"
 #include "VSurface.h"
 #include "Font_Control.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
+
 
 #define	NUM_AIM_POLICY_PAGES				11
 #define	NUM_AIM_POLICY_TOC_BUTTONS	9
 
 static void LoadAIMPolicyText(wchar_t* Text, UINT32 Offset)
 {
-	LoadEncryptedDataFromFile(AIMPOLICYFILE, Text, Offset * AIM_POLICY_LINE_SIZE, AIM_POLICY_LINE_SIZE);
+	GCM->loadEncryptedString(AIMPOLICYFILE, Text, Offset * AIM_POLICY_LINE_SIZE, AIM_POLICY_LINE_SIZE);
 }
 
 

File Build/Laptop/BobbyRGuns.cc

 #include "WordWrap.h"
 #include "Cursors.h"
 #include "Interface_Items.h"
-#include "Encrypted_File.h"
 #include "Text.h"
 #include "Store_Inventory.h"
 #include "LaptopSave.h"
 #include "ScreenIDs.h"
 #include "Font_Control.h"
 
+#include "CalibreModel.h"
+#include "ContentManager.h"
+#include "GameInstance.h"
+#include "MagazineModel.h"
+#include "WeaponModels.h"
 
 #ifdef JA2BETAVERSION
 #	include "Debug.h"
 	wchar_t	sTemp[20];
 
 	DrawTextToScreen(BobbyRText[BOBBYR_GUNS_DAMAGE], BOBBYR_ITEM_WEIGHT_TEXT_X, usPosY, 0, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
-	swprintf(sTemp, lengthof(sTemp), L"%4d", Weapon[ usIndex ].ubImpact);
+	swprintf(sTemp, lengthof(sTemp), L"%4d", GCM->getWeapon( usIndex )->ubImpact);
 	DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_NUM_X, usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, RIGHT_JUSTIFIED);
 	usPosY += usFontHeight + 2;
 	return(usPosY);
 	wchar_t	sTemp[20];
 
 	DrawTextToScreen(BobbyRText[BOBBYR_GUNS_RANGE], BOBBYR_ITEM_WEIGHT_TEXT_X, usPosY, 0, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
-	swprintf(sTemp, lengthof(sTemp), L"%3d %ls", Weapon[ usIndex ].usRange, pMessageStrings[ MSG_METER_ABBREVIATION ] );
+	swprintf(sTemp, lengthof(sTemp), L"%3d %ls", GCM->getWeapon( usIndex )->usRange, pMessageStrings[ MSG_METER_ABBREVIATION ] );
 	DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_NUM_X, usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, RIGHT_JUSTIFIED);
 	usPosY += usFontHeight + 2;
 	return(usPosY);
 	wchar_t	sTemp[20];
 
 	DrawTextToScreen(BobbyRText[BOBBYR_GUNS_MAGAZINE], BOBBYR_ITEM_WEIGHT_TEXT_X, usPosY, 0, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
-	swprintf(sTemp, lengthof(sTemp), L"%3d %ls", Weapon[usIndex].ubMagSize, pMessageStrings[ MSG_ROUNDS_ABBREVIATION ] );
+	swprintf(sTemp, lengthof(sTemp), L"%3d %ls", GCM->getWeapon(usIndex)->ubMagSize, pMessageStrings[ MSG_ROUNDS_ABBREVIATION ] );
 	DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_NUM_X, usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, RIGHT_JUSTIFIED);
 	usPosY += usFontHeight + 2;
 	return(usPosY);
 	DrawTextToScreen(BobbyRText[BOBBYR_GUNS_CALIBRE], BOBBYR_ITEM_WEIGHT_TEXT_X, usPosY, 0, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
 
 	// ammo or gun?
-	AmmoKind const calibre = item->usItemClass == IC_AMMO ? Magazine[item->ubClassIndex].ubCalibre : Weapon[item->ubClassIndex].ubCalibre;
-	wcslcpy(zTemp, BobbyRayAmmoCaliber[calibre], lengthof(zTemp));
+  const CalibreModel *calibre = item->usItemClass == IC_AMMO ? GCM->getMagazine(item->ubClassIndex)->calibre : GCM->getWeapon(item->ubClassIndex)->calibre;
+	wcslcpy(zTemp, BobbyRayAmmoCaliber[calibre->index], lengthof(zTemp));
 
 	ReduceStringLength(zTemp, lengthof(zTemp), BOBBYR_GRID_PIC_WIDTH, BOBBYR_ITEM_NAME_TEXT_FONT);
 	DrawTextToScreen(zTemp, BOBBYR_ITEM_WEIGHT_NUM_X, usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, RIGHT_JUSTIFIED);
 		//Display Items Name
 		wchar_t sText[BOBBYR_ITEM_DESC_NAME_SIZE];
 		uiStartLoc = BOBBYR_ITEM_DESC_FILE_SIZE * usIndex;
-		LoadEncryptedDataFromFile(BOBBYRDESCFILE, sText, uiStartLoc, BOBBYR_ITEM_DESC_NAME_SIZE);
+		GCM->loadEncryptedString(BOBBYRDESCFILE, sText, uiStartLoc, BOBBYR_ITEM_DESC_NAME_SIZE);
 		ReduceStringLength(sText, lengthof(sText), BOBBYR_GRID_PIC_WIDTH - 6, BOBBYR_ITEM_NAME_TEXT_FONT);
 		DrawTextToScreen(sText, BOBBYR_ITEM_NAME_X, usPosY + BOBBYR_ITEM_NAME_Y_OFFSET, 0, BOBBYR_ITEM_NAME_TEXT_FONT, BOBBYR_ITEM_NAME_TEXT_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
 	}
 		//Display Items description
 		wchar_t sText[BOBBYR_ITEM_DESC_INFO_SIZE];
 		uiStartLoc += BOBBYR_ITEM_DESC_NAME_SIZE;
-		LoadEncryptedDataFromFile(BOBBYRDESCFILE, sText, uiStartLoc, BOBBYR_ITEM_DESC_INFO_SIZE);
+		GCM->loadEncryptedString(BOBBYRDESCFILE, sText, uiStartLoc, BOBBYR_ITEM_DESC_INFO_SIZE);
 		DisplayWrappedString(BOBBYR_ITEM_DESC_START_X, usPosY, BOBBYR_ITEM_DESC_START_WIDTH, 2, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
 	}
 }
 static UINT8 CheckPlayersInventoryForGunMatchingGivenAmmoID(INVTYPE const* const ammo)
 {
 	UINT8	         n_items = 0;
-	AmmoKind const calibre = Magazine[ammo->ubClassIndex].ubCalibre;
+  const CalibreModel *calibre = GCM->getMagazine(ammo->ubClassIndex)->calibre;
 	CFOR_EACH_IN_TEAM(s, OUR_TEAM)
 	{
 		// Loop through all the pockets on the merc
 			// If there is a weapon here
 			if (Item[o.usItem].usItemClass != IC_GUN) continue;
 			// If the weapon uses the same kind of ammo as the one passed in
-			if (Weapon[o.usItem].ubCalibre != calibre) continue;
+			if (!GCM->getWeapon(o.usItem)->matches(calibre)) continue;
 
 			++n_items;
 		}

File Build/Laptop/BobbyRMailOrder.cc

 #include "VObject.h"
 #include "WordWrap.h"
 #include "Cursors.h"
-#include "Encrypted_File.h"
 #include "BobbyRGuns.h"
 #include "Finances.h"
 #include "Game_Clock.h"
 #include "FileMan.h"
 #include "UILayout.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 struct BobbyROrderLocationStruct
 {
 			if( pBobbyRayPurchase[i].fUsed )
 			{
 				wchar_t	sBack[BOBBYR_ITEM_DESC_NAME_SIZE];
-				LoadEncryptedDataFromFile(BOBBYRDESCFILE, sBack, uiStartLoc, BOBBYR_ITEM_DESC_NAME_SIZE);
+				GCM->loadEncryptedString(BOBBYRDESCFILE, sBack, uiStartLoc, BOBBYR_ITEM_DESC_NAME_SIZE);
 				swprintf(sText, lengthof(sText), L"* %ls", sBack);
 			}
 			else
-				LoadEncryptedDataFromFile(BOBBYRDESCFILE, sText, uiStartLoc, BOBBYR_ITEM_DESC_NAME_SIZE);
+				GCM->loadEncryptedString(BOBBYRDESCFILE, sText, uiStartLoc, BOBBYR_ITEM_DESC_NAME_SIZE);
 
 			ReduceStringLength(sText, lengthof(sText), BOBBYR_GRID_THIRD_COLUMN_WIDTH - 4, BOBBYR_ORDER_DYNAMIC_TEXT_FONT);
 

File Build/Laptop/EMail.cc

 #include "Debug.h"
 #include "WordWrap.h"
 #include "Render_Dirty.h"
-#include "Encrypted_File.h"
 #include "Cursors.h"
 #include "Soldier_Profile.h"
 #include "IMP_Compile_Character.h"
 #include "Font_Control.h"
 #include "UILayout.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 #define MAX_MESSAGES_PAGE 18 // max number of messages per page
 
 
 static void LoadEMailText(wchar_t buf[], UINT32 entry)
 {
-	LoadEncryptedDataFromFile(BINARYDATADIR "/email.edt", buf, MAIL_STRING_SIZE * entry, MAIL_STRING_SIZE);
+	GCM->loadEncryptedString(BINARYDATADIR "/email.edt", buf, MAIL_STRING_SIZE * entry, MAIL_STRING_SIZE);
 }
 
 
 
 static void LoadIMPResultText(wchar_t* Text, UINT32 Offset)
 {
-	LoadEncryptedDataFromFile(BINARYDATADIR "/impass.edt", Text, MAIL_STRING_SIZE * Offset, MAIL_STRING_SIZE);
+	GCM->loadEncryptedString(BINARYDATADIR "/impass.edt", Text, MAIL_STRING_SIZE * Offset, MAIL_STRING_SIZE);
 }
 
 

File Build/Laptop/Files.cc

 #include "Debug.h"
 #include "WordWrap.h"
 #include "Render_Dirty.h"
-#include "Encrypted_File.h"
 #include "Cursors.h"
 #include "Text.h"
 #include "Button_System.h"
 	for (; n != 0; ++offset, --n)
 	{
 		wchar_t str[FILE_STRING_SIZE];
-		LoadEncryptedData(f, str, lengthof(str) * offset, lengthof(str));
+		GCM->loadEncryptedString(f, str, lengthof(str) * offset, lengthof(str));
 
 		FileString* const fs = MALLOC(FileString);
 		fs->Next    = 0;

File Build/Laptop/Florist_Cards.cc

 #include "VObject.h"
 #include "WordWrap.h"
 #include "Cursors.h"
-#include "Encrypted_File.h"
 #include "Florist_Gallery.h"
 #include "Text.h"
 #include "Button_System.h"
 #include "VSurface.h"
 #include "Font_Control.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 #define		FLORIST_CARDS_SENTENCE_FONT			FONT12ARIAL
 #define		FLORIST_CARDS_SENTENCE_COLOR		FONT_MCOLOR_WHITE
 			//Get and display the card saying
 			wchar_t sTemp[FLOR_CARD_TEXT_TITLE_SIZE];
 			uiStartLoc = FLOR_CARD_TEXT_TITLE_SIZE * ubCount;
-			LoadEncryptedDataFromFile(FLOR_CARD_TEXT_FILE, sTemp, uiStartLoc, FLOR_CARD_TEXT_TITLE_SIZE);
+			GCM->loadEncryptedString(FLOR_CARD_TEXT_FILE, sTemp, uiStartLoc, FLOR_CARD_TEXT_TITLE_SIZE);
 
 //			DisplayWrappedString(usPosX + 7, usPosY + 15, FLORIST_CARD_TEXT_WIDTH, 2, FLORIST_CARDS_SENTENCE_FONT, FLORIST_CARDS_SENTENCE_COLOR, sTemp, FONT_MCOLOR_BLACK, CENTER_JUSTIFIED);
 				usHeightOffset = IanWrappedStringHeight(FLORIST_CARD_TEXT_WIDTH, 2, FLORIST_CARDS_SENTENCE_FONT, sTemp);

File Build/Laptop/Florist_Gallery.cc

 #include "VObject.h"
 #include "WordWrap.h"
 #include "Cursors.h"
-#include "Encrypted_File.h"
 #include "Text.h"
 #include "Button_System.h"
 #include "Video.h"
 #include "Font_Control.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 #define	FLOR_GALLERY_TITLE_FONT								FONT10ARIAL
 #define	FLOR_GALLERY_TITLE_COLOR							FONT_MCOLOR_WHITE
 			//Display Flower title
 			wchar_t sTemp[FLOR_GALLERY_TEXT_TITLE_SIZE];
 			uiStartLoc = FLOR_GALLERY_TEXT_TOTAL_SIZE * (i + gubCurFlowerIndex);
-			LoadEncryptedDataFromFile(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_TITLE_SIZE);
+			GCM->loadEncryptedString(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_TITLE_SIZE);
 			DrawTextToScreen(sTemp, FLOR_GALLERY_FLOWER_TITLE_X, usPosY + FLOR_GALLERY_FLOWER_TITLE_OFFSET_Y, 0, FLOR_GALLERY_FLOWER_TITLE_FONT, FLOR_GALLERY_FLOWER_TITLE_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
 		}
 
 			//Display Flower Price
 			wchar_t sTemp[FLOR_GALLERY_TEXT_PRICE_SIZE];
 			uiStartLoc += FLOR_GALLERY_TEXT_TITLE_SIZE;
-			LoadEncryptedDataFromFile(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_PRICE_SIZE);
+			GCM->loadEncryptedString(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_PRICE_SIZE);
 			swscanf( sTemp, L"%hu", &usPrice);
 			swprintf(sTemp, lengthof(sTemp), L"$%d.00 %ls", usPrice, pMessageStrings[MSG_USDOLLAR_ABBREVIATION]);
 			DrawTextToScreen(sTemp, FLOR_GALLERY_FLOWER_TITLE_X, usPosY + FLOR_GALLERY_FLOWER_PRICE_OFFSET_Y, 0, FLOR_GALLERY_FLOWER_PRICE_FONT, FLOR_GALLERY_FLOWER_PRICE_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
 			//Display Flower Desc
 			wchar_t sTemp[FLOR_GALLERY_TEXT_DESC_SIZE];
 			uiStartLoc += FLOR_GALLERY_TEXT_PRICE_SIZE;
-			LoadEncryptedDataFromFile(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_DESC_SIZE);
+			GCM->loadEncryptedString(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_DESC_SIZE);
 			DisplayWrappedString(FLOR_GALLERY_FLOWER_TITLE_X, usPosY + FLOR_GALLERY_FLOWER_DESC_OFFSET_Y, FLOR_GALLERY_DESC_WIDTH, 2, FLOR_GALLERY_FLOWER_DESC_FONT, FLOR_GALLERY_FLOWER_DESC_COLOR, sTemp, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
 		}
 

File Build/Laptop/Florist_Order_Form.cc

 #include "WordWrap.h"
 #include "Cursors.h"
 #include "Florist_Gallery.h"
-#include "Encrypted_File.h"
 #include "Florist_Cards.h"
 #include "Text_Input.h"
 #include "Finances.h"
 #include "Font_Control.h"
 #include "Meanwhile.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 #define		FLOWER_ORDEER_TINY_FONT					FONT10ARIAL
 #define		FLOWER_ORDEER_SMALL_FONT				FONT12ARIAL
 	usPosX = StringPixLength( sOrderFormText[FLORIST_ORDER_NAME_BOUQUET], FLOWER_ORDEER_SMALL_FONT) + 5 + FLOWER_ORDER_FLOWER_NAME_X;
 	uiStartLoc = FLOR_GALLERY_TEXT_TOTAL_SIZE * guiCurrentlySelectedFlower;
 	wchar_t sTemp[FLOR_GALLERY_TEXT_TITLE_SIZE];
-	LoadEncryptedDataFromFile(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_TITLE_SIZE);
+	GCM->loadEncryptedString(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_TITLE_SIZE);
 	DrawTextToScreen(sTemp, usPosX, FLOWER_ORDER_FLOWER_NAME_Y, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
 
 
 	//price
 	usPosX = StringPixLength( sOrderFormText[FLORIST_ORDER_PRICE], FLOWER_ORDEER_SMALL_FONT) + 5 + FLOWER_ORDER_BOUQUET_NAME_X;
 	uiStartLoc = FLOR_GALLERY_TEXT_TOTAL_SIZE * guiCurrentlySelectedFlower + FLOR_GALLERY_TEXT_TITLE_SIZE;
-	LoadEncryptedDataFromFile(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_PRICE_SIZE);
+	GCM->loadEncryptedString(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_PRICE_SIZE);
 	swscanf( sTemp, L"%hu", &usPrice);
 
 	//if its the next day delivery
 
 		wchar_t	sTemp[FLOR_CARD_TEXT_TITLE_SIZE];
 		const UINT32 uiStartLoc = FLOR_CARD_TEXT_TITLE_SIZE * gbCurrentlySelectedCard;
-		LoadEncryptedDataFromFile( FLOR_CARD_TEXT_FILE, sTemp, uiStartLoc, FLOR_CARD_TEXT_TITLE_SIZE);
+		GCM->loadEncryptedString( FLOR_CARD_TEXT_FILE, sTemp, uiStartLoc, FLOR_CARD_TEXT_TITLE_SIZE);
 		wchar_t	sText[FLOR_CARD_TEXT_TITLE_SIZE];
 		CleanOutControlCodesFromString(sTemp, sText);
 

File Build/Laptop/History.cc

 #include "Debug.h"
 #include "WordWrap.h"
 #include "Render_Dirty.h"
-#include "Encrypted_File.h"
 #include "Cursors.h"
 #include "Soldier_Profile.h"
 #include "StrategicMap.h"
 static void GetQuestStartedString(const UINT8 ubQuestValue, wchar_t* const sQuestString)
 {
 	// open the file and copy the string
-	LoadEncryptedDataFromFile(BINARYDATADIR "/quests.edt", sQuestString, HISTORY_QUEST_TEXT_SIZE * ubQuestValue * 2, HISTORY_QUEST_TEXT_SIZE);
+	GCM->loadEncryptedString(BINARYDATADIR "/quests.edt", sQuestString, HISTORY_QUEST_TEXT_SIZE * ubQuestValue * 2, HISTORY_QUEST_TEXT_SIZE);
 }
 
 
 static void GetQuestEndedString(const UINT8 ubQuestValue, wchar_t* const sQuestString)
 {
 	// open the file and copy the string
-	LoadEncryptedDataFromFile(BINARYDATADIR "/quests.edt", sQuestString, HISTORY_QUEST_TEXT_SIZE * (ubQuestValue * 2 + 1), HISTORY_QUEST_TEXT_SIZE);
+	GCM->loadEncryptedString(BINARYDATADIR "/quests.edt", sQuestString, HISTORY_QUEST_TEXT_SIZE * (ubQuestValue * 2 + 1), HISTORY_QUEST_TEXT_SIZE);
 }
 
 

File Build/Laptop/IMP_Text_System.cc

 #include "Text.h"
 #include "WordWrap.h"
 #include "Render_Dirty.h"
-#include "Encrypted_File.h"
 #include "IMP_Text_System.h"
 #include "CharProfile.h"
 #include "Laptop.h"
 #include "IMP_MainPage.h"
 #include "Font_Control.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 #define IMP_SEEK_AMOUNT (5 * 80)
 
 	}
 
 	wchar_t sString[IMP_SEEK_AMOUNT];
-	LoadEncryptedDataFromFile(BINARYDATADIR "/imptext.edt", sString, sIMPTextRecordNumber * IMP_SEEK_AMOUNT, IMP_SEEK_AMOUNT);
+	GCM->loadEncryptedString(BINARYDATADIR "/imptext.edt", sString, sIMPTextRecordNumber * IMP_SEEK_AMOUNT, IMP_SEEK_AMOUNT);
 	DisplayWrappedString(sStartX, sStartY, sLineLength, 2, font, ubColor, sString, FONT_BLACK, uiFlags);
 
 	// reset shadow

File Build/Laptop/Insurance.cc

 #include "Cursors.h"
 #include "Line.h"
 #include "Insurance_Text.h"
-#include "Encrypted_File.h"
 #include "Text.h"
 #include "Multi_Language_Graphic_Utils.h"
 #include "Button_System.h"
 #include "Font_Control.h"
 #include "UILayout.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 #define INSURANCE_TEXT_SINGLE_FILE BINARYDATADIR "/insurancesingle.edt"
 #define INSURANCE_TEXT_MULTI_FILE  BINARYDATADIR "/insurancemulti.edt"
 	{
 		//Get and display the card saying
 		uiStartLoc = INSURANCE_TEXT_SINGLE_LINE_SIZE * ubNumber;
-		LoadEncryptedDataFromFile(INSURANCE_TEXT_SINGLE_FILE, pString, uiStartLoc, INSURANCE_TEXT_SINGLE_LINE_SIZE);
+		GCM->loadEncryptedString(INSURANCE_TEXT_SINGLE_FILE, pString, uiStartLoc, INSURANCE_TEXT_SINGLE_LINE_SIZE);
 	}
 	else
 	{
 		//Get and display the card saying
 		uiStartLoc = INSURANCE_TEXT_MULTI_LINE_SIZE * ( ubNumber - INS_MULTI_LINE_BEGINS - 1 );
-		LoadEncryptedDataFromFile(INSURANCE_TEXT_MULTI_FILE, pString, uiStartLoc, INSURANCE_TEXT_MULTI_LINE_SIZE);
+		GCM->loadEncryptedString(INSURANCE_TEXT_MULTI_FILE, pString, uiStartLoc, INSURANCE_TEXT_MULTI_LINE_SIZE);
 	}
 }
 

File Build/Laptop/Mercs_Files.cc

 #include "WordWrap.h"
 #include "Cursors.h"
 #include "Soldier_Profile.h"
-#include "Encrypted_File.h"
 #include "AIMMembers.h"
 #include "Game_Clock.h"
 #include "Soldier_Add.h"
 #include "ScreenIDs.h"
 #include "Cheats.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 #define		MERCBIOFILE												BINARYDATADIR "/mercbios.edt"
 
 		//load and display the merc bio
 		wchar_t	sText[MERC_BIO_INFO_TEXT_SIZE];
 		uiStartLoc = MERC_BIO_SIZE * ubMercID;
-		LoadEncryptedDataFromFile(MERCBIOFILE, sText, uiStartLoc, MERC_BIO_INFO_TEXT_SIZE);
+		GCM->loadEncryptedString(MERCBIOFILE, sText, uiStartLoc, MERC_BIO_INFO_TEXT_SIZE);
 		DisplayWrappedString(MERC_BIO_TEXT_X, MERC_BIO_TEXT_Y, MERC_BIO_WIDTH, 2, MERC_BIO_FONT, MERC_BIO_COLOR, sText, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);
 	}
 
 		//load and display the merc's additioanl info (if any)
 		wchar_t	sText[MERC_BIO_ADD_INFO_TEXT_SIZE];
 		uiStartLoc += MERC_BIO_INFO_TEXT_SIZE;
-		LoadEncryptedDataFromFile(MERCBIOFILE, sText, uiStartLoc, MERC_BIO_ADD_INFO_TEXT_SIZE);
+		GCM->loadEncryptedString(MERCBIOFILE, sText, uiStartLoc, MERC_BIO_ADD_INFO_TEXT_SIZE);
 		if( sText[0] != 0 )
 		{
 			DrawTextToScreen(MercInfo[MERC_FILES_ADDITIONAL_INFO], MERC_ADD_BIO_TITLE_X, MERC_ADD_BIO_TITLE_Y, 0, MERC_TITLE_FONT, MERC_TITLE_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED);

File Build/Laptop/Personnel.cc

 #include "EMail.h"
 #include "Soldier_Macros.h"
 
+#include "CalibreModel.h"
+#include "ContentManager.h"
+#include "GameInstance.h"
+#include "MagazineModel.h"
+#include "WeaponModels.h"
 
 #define INVENTORY_BOX_X (399 + STD_SCREEN_X)
 #define INVENTORY_BOX_Y (205 + STD_SCREEN_Y)
 		{
 			INT32 total_ammo = 0;
 			for (INT32 i = 0; i < o_count; ++i) total_ammo += o.ubShotsLeft[i];
-			swprintf(sString, lengthof(sString), L"%d/%d", total_ammo, o_count * Magazine[item.ubClassIndex].ubMagSize);
+			swprintf(sString, lengthof(sString), L"%d/%d", total_ammo, o_count * GCM->getMagazine(item.ubClassIndex)->capacity);
 		}
 		else
 		{
 
 		if (item.usItemClass & IC_GUN)
 		{
-			wcslcpy(sString, AmmoCaliber[Weapon[item.ubClassIndex].ubCalibre], lengthof(sString));
+			wcslcpy(sString, GCM->getWeapon(item.ubClassIndex)->calibre->getName(), lengthof(sString));
 			ReduceStringLength(sString, lengthof(sString), 171 - 75, FONT10ARIAL);
 			MPrint(PosX + 65, PosY + 15, sString);
 		}

File Build/SaveLoadGame.cc

 static const char g_quicksave_name[] = "QuickSave";
 static const char g_savegame_name[]  = "SaveGame";
 static const char g_savegame_ext[]   = "sav";
-static const char g_savegame_dir[]   = "../SavedGames";
-
 
 //Global variable used
 #ifdef JA2BETAVERSION
 			wcslcpy(desc, GameDesc, lengthof(desc));
 		}
 
-		FileMan::createDir(g_savegame_dir);
+		FileMan::createDir(GCM->getSavedGamesFolder().c_str());
 
 		// Create the save game file
 		char savegame_name[512];
 
 void CreateSavedGameFileNameFromNumber(const UINT8 ubSaveGameID, char* const pzNewFileName)
 {
-	char const* const dir = g_savegame_dir;
+  std::string dir = GCM->getSavedGamesFolder();
 	char const* const ext = g_savegame_ext;
 
 	switch (ubSaveGameID)
 			if (gfUseConsecutiveQuickSaveSlots &&
 					guiCurrentQuickSaveNumber != 0)
 			{
-				sprintf(pzNewFileName, "%s/%s%02d.%s", dir, quick, guiCurrentQuickSaveNumber, ext);
+				sprintf(pzNewFileName, "%s/%s%02d.%s", dir.c_str(), quick, guiCurrentQuickSaveNumber, ext);
 			}
 			else
 #endif
 			{
-				sprintf(pzNewFileName, "%s/%s.%s", dir, quick, ext);
+				sprintf(pzNewFileName, "%s/%s.%s", dir.c_str(), quick, ext);
 			}
 			break;
 		}
 
 		case SAVE__END_TURN_NUM:
-			sprintf(pzNewFileName, "%s/Auto%02d.%s", dir, guiLastSaveGameNum, ext);
+			sprintf(pzNewFileName, "%s/Auto%02d.%s", dir.c_str(), guiLastSaveGameNum, ext);
 			guiLastSaveGameNum = (guiLastSaveGameNum + 1) % 2;
 			break;
 
 		case SAVE__ERROR_NUM:
-			sprintf(pzNewFileName, "%s/error.%s", dir, ext);
+			sprintf(pzNewFileName, "%s/error.%s", dir.c_str(), ext);
 			break;
 
 		default:
-			sprintf(pzNewFileName, "%s/%s%02d.%s", dir, g_savegame_name, ubSaveGameID, ext);
+			sprintf(pzNewFileName, "%s/%s%02d.%s", dir.c_str(), g_savegame_name, ubSaveGameID, ext);
 			break;
 	}
 }
 static void InitSaveGameFilePosition(UINT8 const slot)
 {
 	CHAR8		zFileName[128];
-	sprintf(zFileName, "%s/SaveGameFilePos%2d.txt", g_savegame_dir, slot);
+	sprintf(zFileName, "%s/SaveGameFilePos%2d.txt", GCM->getSavedGamesFolder().c_str(), slot);
 	FileDelete( zFileName );
 }
 
 	UINT32	uiStrLen=0;
 	CHAR8		zFileName[128];
 
-	sprintf(zFileName, "%s/SaveGameFilePos%2d.txt", g_savegame_dir, slot);
+	sprintf(zFileName, "%s/SaveGameFilePos%2d.txt", GCM->getSavedGamesFolder().c_str(), slot);
 
 	// create the save game file
 	AutoSGPFile hFile(FileMan::openForAppend(zFileName));
 static void InitLoadGameFilePosition(UINT8 const slot)
 {
 	CHAR8		zFileName[128];
-	sprintf(zFileName, "%s/LoadGameFilePos%2d.txt", g_savegame_dir, slot);
+	sprintf(zFileName, "%s/LoadGameFilePos%2d.txt", GCM->getSavedGamesFolder().c_str(), slot);
 	FileDelete( zFileName );
 }
 
 	UINT32	uiStrLen=0;
 
 	CHAR8		zFileName[128];
-	sprintf(zFileName, "%s/LoadGameFilePos%2d.txt", g_savegame_dir, slot);
+	sprintf(zFileName, "%s/LoadGameFilePos%2d.txt", GCM->getSavedGamesFolder().c_str(), slot);
 
 	// create the save game file
 	AutoSGPFile hFile(FileMan::openForAppend(zFileName));
 	//strcpy( gzNameOfMapTempFile, pNameOfFile);
 	sprintf( gzNameOfMapTempFile, "%s%d", pNameOfFile, ubSaveGameID );
 
-	sprintf(zFileName, "%s/%s.txt", g_savegame_dir, gzNameOfMapTempFile);
+	sprintf(zFileName, "%s/%s.txt", GCM->getSavedGamesFolder().c_str(), gzNameOfMapTempFile);
 
 	if( fInit )
 	{
 
 	guiSizeOfTempFiles += uiSizeOfFile;
 
-	sprintf(zFileName, "%s/%s.txt", g_savegame_dir, gzNameOfMapTempFile);
+	sprintf(zFileName, "%s/%s.txt", GCM->getSavedGamesFolder().c_str(), gzNameOfMapTempFile);
 
 	// create the save game file
 	AutoSGPFile hFile(FileMan::openForAppend(zFileName));
 
 	//The name of the file
 	char zFileName1[256];
-	sprintf(zFileName1, "%s/Auto%02d.%s", g_savegame_dir, 0, g_savegame_ext);
+	sprintf(zFileName1, "%s/Auto%02d.%s", GCM->getSavedGamesFolder().c_str(), 0, g_savegame_ext);
 	char zFileName2[256];
-	sprintf(zFileName2, "%s/Auto%02d.%s", g_savegame_dir, 1, g_savegame_ext);
+	sprintf(zFileName2, "%s/Auto%02d.%s", GCM->getSavedGamesFolder().c_str(), 1, g_savegame_ext);
 
 	if( GCM->doesGameResExists( zFileName1 ) )
 	{

File Build/Strategic/Auto_Resolve.cc

 #include "MemMan.h"
 #include "Debug.h"
 #include "UILayout.h"
+#include "WeaponModels.h"
 
 #ifdef JA2BETAVERSION
 #	include "Cheats.h"
 #endif
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 //#define INVULNERABILITY
 
 	}
 }
 
+static void PlayAutoResolveSample(const std::string &sample, UINT32 const ubVolume, UINT32 const ubLoops, UINT32 const uiPan)
+{
+	if( gpAR->fSound )
+	{
+		PlayJA2Sample(sample.c_str(), ubVolume, ubLoops, uiPan);
+	}
+}
+
 
 static void EliminateAllMercs(void)
 {
 			pAttacker->bWeaponSlot = (INT8)i;
 			if( gpAR->fUnlimitedAmmo )
 			{
-				PlayAutoResolveSample(Weapon[pItem->usItem].sSound, 50, 1, MIDDLEPAN);
+				PlayAutoResolveSample(GCM->getWeapon(pItem->usItem)->sound, 50, 1, MIDDLEPAN);
 				return TRUE;
 			}
 			if( !pItem->ubGunShotsLeft )
 			{
 				AutoReload( pSoldier );
-				if (pItem->ubGunShotsLeft && Weapon[pItem->usItem].sLocknLoadSound != NO_SOUND)
+				if (pItem->ubGunShotsLeft && GCM->getWeapon(pItem->usItem)->sLocknLoadSound != NO_SOUND)
 				{
-					PlayAutoResolveSample(Weapon[pItem->usItem].sLocknLoadSound, 50, 1, MIDDLEPAN);
+					PlayAutoResolveSample(GCM->getWeapon(pItem->usItem)->sLocknLoadSound, 50, 1, MIDDLEPAN);
 				}
 			}
 			if( pItem->ubGunShotsLeft )
 			{
-				PlayAutoResolveSample(Weapon[pItem->usItem].sSound, 50, 1, MIDDLEPAN);
+				PlayAutoResolveSample(GCM->getWeapon(pItem->usItem)->sound, 50, 1, MIDDLEPAN);
 				if( pAttacker->uiFlags & CELL_MERC )
 				{
 					gMercProfiles[ pAttacker->pSoldier->ubProfile ].usShotsFired++;
 	//Attacker hits
 	if( !fMelee )
 	{
-		ubImpact = Weapon[ pAttacker->pSoldier->inv[ pAttacker->bWeaponSlot ].usItem ].ubImpact;
+		ubImpact = GCM->getWeapon(pAttacker->pSoldier->inv[pAttacker->bWeaponSlot].usItem)->ubImpact;
 		iRandom = PreRandom( 100 );
 		if( iRandom < 15 )
 			ubLocation = AIM_SHOT_HEAD;

File Build/Strategic/Game_Init.cc

 }
 
 
-static BOOLEAN QuickGameMemberHireMerc(UINT8 ubCurrentSoldier);
-static void QuickSetupOfMercProfileItems(UINT32 uiCount, UINT8 ubProfileIndex);
-
-
-static void QuickStartGame(void)
-{
-	INT32		cnt;
-	UINT16	usVal;
-	UINT8 ub1 = 0, ub2 = 0;
-
-	for ( cnt = 0; cnt < 3; cnt++ )
-	{
-		if ( cnt == 0 )
-		{
-			usVal = (UINT16)Random( 40 );
-
-			QuickSetupOfMercProfileItems( cnt, (UINT8)usVal );
-			QuickGameMemberHireMerc( (UINT8)usVal );
-		}
-		else if ( cnt == 1 )
-		{
-			do
-			{
-				usVal = (UINT16)Random( 40 );
-			}
-			while( usVal != ub1 );
-
-			QuickSetupOfMercProfileItems( cnt, (UINT8)usVal );
-			QuickGameMemberHireMerc( (UINT8)usVal );
-		}
-		else if ( cnt == 2 )
-		{
-			do
-			{
-				usVal = (UINT16)Random( 40 );
-			}
-			while( usVal != ub1 && usVal != ub2 );
-
-			QuickSetupOfMercProfileItems( cnt, (UINT8)usVal );
-			QuickGameMemberHireMerc( (UINT8)usVal );
-		}
-
-	}
-}
-
-
-static void GiveItemN(MERCPROFILESTRUCT& p, const UINT pos, const UINT16 item_id, const UINT8 status, const UINT8 count)
-{
-	p.inv[pos]        = item_id;
-	p.bInvStatus[pos] = status;
-	p.bInvNumber[pos] = count;
-}
-
-
-static void GiveItem(MERCPROFILESTRUCT& p, const UINT pos, const UINT16 item_id)
-{
-	GiveItemN(p, pos, item_id, 100, 1);
-}
-
-
-// TEMP FUNCTION!
-static void QuickSetupOfMercProfileItems(const UINT32 uiCount, const UINT8 ubProfileIndex)
-{
-	MERCPROFILESTRUCT& p = GetProfile(ubProfileIndex);
-	// Quickly give some guys we hire some items
-	switch (uiCount)
-	{
-		case 0:
-			p.bSkillTrait = MARTIALARTS;
-
-			//GiveItemN(p, HANDPOS, HAND_GRENADE, 100, 3);
-			GiveItem(p, HANDPOS,       C7);
-			GiveItem(p, BIGPOCK1POS,   CAWS);
-			GiveItem(p, BIGPOCK3POS,   MEDICKIT);
-			GiveItem(p, BIGPOCK4POS,   SHAPED_CHARGE);
-			GiveItem(p, SMALLPOCK3POS, KEY_2);
-			GiveItem(p, SMALLPOCK5POS, LOCKSMITHKIT);
-
-			// TEMP!
-			// make carman's opinion of us high!
-			GetProfile(CARMEN).bMercOpinion[ubProfileIndex] = 25;
-			break;
-
-		case 1:
-			GiveItem(p, HANDPOS,       CAWS);
-			GiveItem(p, SMALLPOCK3POS, KEY_1);
-			break;
-
-		case 2:
-			GiveItem(p, HANDPOS,       GLOCK_17);
-			GiveItem(p, SECONDHANDPOS, SW38);
-			GiveItem(p, SMALLPOCK1POS, SILENCER);
-			GiveItem(p, SMALLPOCK2POS, SNIPERSCOPE);
-			GiveItem(p, SMALLPOCK3POS, LASERSCOPE);
-			GiveItem(p, SMALLPOCK5POS, BIPOD);
-			GiveItem(p, SMALLPOCK6POS, LOCKSMITHKIT);
-			break;
-
-		default:
-			p.inv[HANDPOS]        = Random(30);
-			p.bInvNumber[HANDPOS] = 1;
-			break;
-	}
-
-	GiveItem( p, HELMETPOS,     KEVLAR_HELMET);
-	GiveItem( p, VESTPOS,       KEVLAR_VEST);
-	GiveItemN(p, BIGPOCK2POS,   RDX,           10, 1);
-	GiveItemN(p, SMALLPOCK4POS, HAND_GRENADE, 100, 4);
-
-	// Give special items to some NPCs
-	//GiveItem(GetProfile(CARMEN), SMALLPOCK4POS, TERRORIST_INFO);
-}
-
-
-static BOOLEAN QuickGameMemberHireMerc(UINT8 ubCurrentSoldier)
-{
-	MERC_HIRE_STRUCT HireMercStruct;
-
-	memset(&HireMercStruct, 0, sizeof(MERC_HIRE_STRUCT));
-
-	HireMercStruct.ubProfileID = ubCurrentSoldier;
-
-	HireMercStruct.sSectorX                  = SECTORX(g_merc_arrive_sector);
-	HireMercStruct.sSectorY                  = SECTORY(g_merc_arrive_sector);
-	HireMercStruct.fUseLandingZoneForArrival = TRUE;
-
-	HireMercStruct.fCopyProfileItemsOver =	TRUE;
-	HireMercStruct.ubInsertionCode				= INSERTION_CODE_CHOPPER;
-
-	HireMercStruct.iTotalContractLength = 7;
-
-	//specify when the merc should arrive
-	HireMercStruct.uiTimeTillMercArrives = 0;
-
-	//if we succesfully hired the merc
-	if (!HireMerc(HireMercStruct))
-	{
-		return(FALSE);
-	}
-
-	//add an entry in the finacial page for the hiring of the merc
-	AddTransactionToPlayersBook(HIRED_MERC, ubCurrentSoldier, GetWorldTotalMin(), -(INT32) gMercProfiles[ubCurrentSoldier].uiWeeklySalary );
-
-	if( gMercProfiles[ ubCurrentSoldier ].bMedicalDeposit )
-	{
-		//add an entry in the finacial page for the medical deposit
-		AddTransactionToPlayersBook(MEDICAL_DEPOSIT, ubCurrentSoldier, GetWorldTotalMin(), -(gMercProfiles[ubCurrentSoldier].sMedicalDepositAmount) );
-	}
-
-	//add an entry in the history page for the hiring of the merc
-	AddHistoryToPlayersLog( HISTORY_HIRED_MERC_FROM_AIM, ubCurrentSoldier, GetWorldTotalMin(), -1, -1 );
-
-	return(TRUE);
-}
-
-
-
-
 //This function is called when the game is REstarted.  Things that need to be reinited are placed in here
 void ReStartingGame()
 {

File Build/Strategic/Strategic_Merc_Handler.cc

 #include "Finances.h"
 #include "Quests.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
+#include "WeaponModels.h"
 
 #define		NUM_DAYS_TILL_UNPAID_RPC_QUITS				3
 
 			// Check if it's a gun
 			if ( Item[ usItem ].usItemClass & IC_GUN )
 			{
-				if ( Weapon[ usItem ].ubDeadliness > bBestGun )
+				if ( GCM->getWeapon( usItem )->ubDeadliness > bBestGun )
 				{
-					bBestGun = Weapon[ usItem ].ubDeadliness;
+					bBestGun = GCM->getWeapon( usItem )->ubDeadliness;
 				}
 			}
 

File Build/Strategic/Strategic_Movement.cc

 			if (!MayExecute()) return true;
 
 			SOLDIERTYPE const& s = soldier_;
-			ExecuteCharacterDialogue(s.ubProfile, QUOTE_ENEMY_PRESENCE, s.face, DIALOGUE_TACTICAL_UI, TRUE);
+			ExecuteCharacterDialogue(s.ubProfile, QUOTE_ENEMY_PRESENCE, s.face, DIALOGUE_TACTICAL_UI, TRUE, false);
 
 			// Setup face with data!
 			FACETYPE& f = *gpCurrentTalkingFace;

File Build/Tactical/ArmsDealerInvInit.cc

 #include "Random.h"
 #include "Items.h"
 
+#include "CalibreModel.h"
+#include "ContentManager.h"
+#include "GameInstance.h"
+#include "MagazineModel.h"
+#include "WeaponModels.h"
 
 struct ITEM_SORT_ENTRY
 {
 	if (item1.usItemClass == IC_AMMO && item2.usItemClass == IC_AMMO)
 	{
 		// AMMO is sorted by caliber first
-		AmmoKind const calibre1 = Magazine[item1.ubClassIndex].ubCalibre;
-		AmmoKind const calibre2 = Magazine[item2.ubClassIndex].ubCalibre;
+		uint16_t calibre1 = GCM->getMagazine(item1.ubClassIndex)->calibre->index;
+		uint16_t calibre2 = GCM->getMagazine(item2.ubClassIndex)->calibre->index;
 		if (calibre1 > calibre2) return -1;
 		if (calibre1 < calibre2) return  1;
 
 		// the same caliber - compare size of magazine
-		UINT8 const mag_size1 = Magazine[item1.ubClassIndex].ubMagSize;
-		UINT8 const mag_size2 = Magazine[item2.ubClassIndex].ubMagSize;
+		UINT8 const mag_size1 = GCM->getMagazine(item1.ubClassIndex)->capacity;
+		UINT8 const mag_size2 = GCM->getMagazine(item2.ubClassIndex)->capacity;
 		if (mag_size1 > mag_size2) return -1;
 		if (mag_size1 < mag_size2) return  1;
 	}
 
 	// If it's not a weapon, set no weapon class, as this won't be needed
 	UINT8 const weapon_class = usItemIndex < MAX_WEAPONS ?
-		Weapon[usItemIndex].ubWeaponClass : NOGUNCLASS;
+		GCM->getWeapon(usItemIndex)->ubWeaponClass : NOGUNCLASS;
 
 	// search table until end-of-list marker is encountered
 	for (UINT8 category = 0;; ++category)

File Build/Tactical/Arms_Dealer_Init.cc

 #include "MemMan.h"
 #include "Items.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
+#include "MagazineModel.h"
+#include "WeaponModels.h"
 
 // To reduce memory fragmentation from frequent MemRealloc(), we allocate memory for more than one special slot each
 // time we run out of space.  Odds are that if we need one, we'll need another soon.
 		case IC_NONE: return 0;
 
 		case IC_GUN:
-			switch(  Weapon[ Item[ usItem ].ubClassIndex ].ubWeaponClass )
+			switch(  GCM->getWeapon(Item[usItem].ubClassIndex)->ubWeaponClass )
 			{
 				case HANDGUNCLASS: return ARMS_DEALER_HANDGUNCLASS;
 
 	}
 
 
-	ubMagCapacity = Magazine[ Item[ usItemIndex ].ubClassIndex ].ubMagSize;
+	ubMagCapacity = GCM->getMagazine( Item[ usItemIndex ].ubClassIndex )->capacity;
 
 	if ( ubShotsLeft >= ubMagCapacity )
 	{

File Build/Tactical/Civ_Quotes.cc

 #include "Soldier_Find.h"
 #include "StrategicMap.h"
 #include "Timer_Control.h"
-#include "Encrypted_File.h"
 #include "MessageBoxScreen.h"
 #include "Queen_Command.h"
 #include "Overhead.h"
 #include "FileMan.h"
 #include "UILayout.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
 
 #define CIV_QUOTE_TEXT_SIZE 160
 
 		sprintf(zFileName, NPCDATADIR "/civ%02d.edt", ubCivQuoteID);
 	}
 
-	LoadEncryptedDataFromFile(zFileName, zQuote, CIV_QUOTE_TEXT_SIZE * ubEntryID, CIV_QUOTE_TEXT_SIZE);
+	GCM->loadEncryptedString(zFileName, zQuote, CIV_QUOTE_TEXT_SIZE * ubEntryID, CIV_QUOTE_TEXT_SIZE);
 	return zQuote[0] != L'\0';
 }
 catch (...) { return FALSE; }

File Build/Tactical/Dialogue_Control.cc

 #include "MapScreen.h"
 #include "MessageBoxScreen.h"
 #include "Soldier_Control.h"
-#include "Encrypted_File.h"
 #include "Faces.h"
 #include "VObject.h"
 #include "VSurface.h"
 #include "GameRes.h"
 #include "UILayout.h"
 
-#define DIALOGUESIZE 240
+#include "ContentManager.h"
+#include "GameInstance.h"
+#include "MercProfile.h"
+#include "content/Dialogs.h"
+#include "sgp/UTF8String.h"
+
 #define   QUOTE_MESSAGE_SIZE		520
 
 #define		DIALOGUE_DEFAULT_SUBTITLE_WIDTH		200
 static UINT32         guiScreenIDUsedWhenUICreated;
 static MOUSE_REGION   gTextBoxMouseRegion;
 static MOUSE_REGION   gFacePopupMouseRegion;
-static BOOLEAN        gfUseAlternateDialogueFile = FALSE;
 
 MercPopUpBox* g_dialogue_box;
 
 				gTacticalStatus.ubLastQuoteSaid       = quote_;
 				gTacticalStatus.ubLastQuoteProfileNUm = character_;
 
-				ExecuteCharacterDialogue(character_, quote_, face, dialogue_handler_, from_soldier_);
+				ExecuteCharacterDialogue(character_, quote_, face, dialogue_handler_, from_soldier_, false);
 
 				s = FindSoldierByProfileID(character_);
 				if (s && s->bTeam == OUR_TEAM)
 			{
 				if (!MayExecute()) return true;
 
-				gfUseAlternateDialogueFile = TRUE;
 				SOLDIERTYPE const& s = soldier_;
-				ExecuteCharacterDialogue(s.ubProfile, quote_, s.face, handler_, TRUE);
-				gfUseAlternateDialogueFile = FALSE;
+				ExecuteCharacterDialogue(s.ubProfile, quote_, s.face, handler_, TRUE, true);
 				return false;
 			}
 
 
 
 static void    CreateTalkingUI(DialogueHandler, FACETYPE&, UINT8 ubCharacterNum, const wchar_t* zQuoteStr);
-static BOOLEAN GetDialogue(UINT8 ubCharacterNum, UINT16 usQuoteNum, UINT32 iDataSize, wchar_t* zDialogueText, size_t Length, CHAR8* zSoundString);
+static BOOLEAN GetDialogue(const MercProfile &profile, UINT16 usQuoteNum, wchar_t* zDialogueText, size_t Length, CHAR8* zSoundString, bool useAlternateDialogueFile);
 
 
 // execute specific character dialogue
-BOOLEAN ExecuteCharacterDialogue(UINT8 const ubCharacterNum, UINT16 const usQuoteNum, FACETYPE* const face, DialogueHandler const bUIHandlerID, BOOLEAN const fFromSoldier)
+BOOLEAN ExecuteCharacterDialogue(UINT8 const ubCharacterNum, UINT16 const usQuoteNum, FACETYPE* const face, DialogueHandler const bUIHandlerID, BOOLEAN const fFromSoldier, bool useAlternateDialogueFile)
 {
 	gpCurrentTalkingFace = face;
 	gubCurrentTalkingID  = ubCharacterNum;
 	CHECKF(face != NULL);
 
 	wchar_t gzQuoteStr[QUOTE_MESSAGE_SIZE];
-  if (!GetDialogue(ubCharacterNum, usQuoteNum, DIALOGUESIZE, gzQuoteStr, lengthof(gzQuoteStr), zSoundString))
+  if (!GetDialogue(MercProfile(ubCharacterNum), usQuoteNum, gzQuoteStr, lengthof(gzQuoteStr), zSoundString,
+        useAlternateDialogueFile))
   {
     return( FALSE );
   }
 
-	if( bUIHandlerID == DIALOGUE_EXTERNAL_NPC_UI )
-	{
-		// external NPC
-		SetFaceTalking(*face, zSoundString, gzQuoteStr);
-	}
-	else
-	{
-		// start "talking" system (portrait animation and start wav sample)
-		SetFaceTalking(*face, zSoundString, gzQuoteStr);
-	}
+  SetFaceTalking(*face, zSoundString, gzQuoteStr);
 	CreateTalkingUI(bUIHandlerID, *face, ubCharacterNum, gzQuoteStr);
 
 	// Set global handleer ID value, used when face desides it's done...
 	}
 }
 
-
-const char* GetDialogueDataFilename(UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN fWavFile)
+static BOOLEAN GetDialogue(const MercProfile &profile, UINT16 usQuoteNum, wchar_t* zDialogueText, size_t Length, CHAR8* zSoundString, bool useAlternateDialogueFile)
 {
-	static char zFileName[164];
-	UINT8		ubFileNumID;
-
-	// Are we an NPC OR an RPC that has not been recruited?
-	// ATE: Did the || clause here to allow ANY RPC that talks while the talking menu is up to use an npc quote file
-	if ( gfUseAlternateDialogueFile )
-	{
-		if ( fWavFile )
-		{
-			// build name of wav file (characternum + quotenum)
-			sprintf(zFileName, NPC_SPEECHDIR "/d_%03d_%03d.wav", ubCharacterNum, usQuoteNum);
-		}
-		else
-		{
-			// assume EDT files are in EDT directory on HARD DRIVE
-			sprintf(zFileName, NPCDATADIR "/d_%03d.edt", ubCharacterNum);
-		}
-	}
-	else if ( ubCharacterNum >= FIRST_RPC &&
-			( !( gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED )
-			|| ProfileCurrentlyTalkingInDialoguePanel( ubCharacterNum )
-			|| (gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_FORCENPCQUOTE) )
-			)
-	{
-		ubFileNumID = ubCharacterNum;
-
-		// ATE: If we are merc profile ID #151-154, all use 151's data....
-		if (ubCharacterNum >= HERVE && ubCharacterNum <= CARLO)
-		{
-			ubFileNumID = HERVE;
-		}
-
-		// If we are character #155, check fact!
-		if ( ubCharacterNum == MANNY && !gubFact[FACT_MANNY_IS_BARTENDER] )
-		{
-			ubFileNumID = MANNY;
-		}
-
-
-		if ( fWavFile )
-		{
-			sprintf(zFileName, NPC_SPEECHDIR "/%03d_%03d.wav", ubFileNumID, usQuoteNum);
-		}
-		else
-		{
-		// assume EDT files are in EDT directory on HARD DRIVE
-			sprintf(zFileName, NPCDATADIR "/%03d.edt", ubFileNumID);
-		}
-	}
-	else
-	{
-		if ( fWavFile )
-		{
-      if(isRussianVersion() || isRussianGoldVersion())
-      {
-        if (ubCharacterNum >= FIRST_RPC && gMercProfiles[ubCharacterNum].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED)
-        {
-          sprintf(zFileName, SPEECHDIR "/r_%03d_%03d.wav", ubCharacterNum, usQuoteNum);
-        }
-        else
-        {
-          // build name of wav file (characternum + quotenum)
-          sprintf(zFileName, SPEECHDIR "/%03d_%03d.wav", ubCharacterNum, usQuoteNum);
-        }
-      }
-      else
-      {
-        // build name of wav file (characternum + quotenum)
-				sprintf(zFileName, SPEECHDIR "/%03d_%03d.wav", ubCharacterNum, usQuoteNum);
-      }
-		}
-		else
-		{
-			// assume EDT files are in EDT directory on HARD DRIVE
-			sprintf(zFileName, MERCEDTDIR "/%03d.edt", ubCharacterNum);
-		}
-	}
-
-	return( zFileName );
-}
-
-
-static BOOLEAN GetDialogue(UINT8 ubCharacterNum, UINT16 usQuoteNum, UINT32 iDataSize, wchar_t* zDialogueText, size_t Length, CHAR8* zSoundString)
-{
-   // first things first  - grab the text (if player has SUBTITLE PREFERENCE ON)
+   // first things first  - gDIALOGUESIZErab the text (if player has SUBTITLE PREFERENCE ON)
    //if ( gGameSettings.fOptions[ TOPTION_SUBTITLES ] )
    {
-			const char* pFilename = GetDialogueDataFilename(ubCharacterNum, 0, FALSE);
-			bool success;
+     const char* pFilename = Content::GetDialogueTextFilename(
+       profile,
+       useAlternateDialogueFile,
+       ProfileCurrentlyTalkingInDialoguePanel(profile.getNum()));
+
+			bool success = false;
 			try
 			{
-				LoadEncryptedDataFromFile(pFilename, zDialogueText, usQuoteNum * iDataSize, iDataSize);
-				success = zDialogueText[0] != L'\0';
+        UTF8String* quote = GCM->loadDialogQuoteFromFile(pFilename, usQuoteNum);
+        if(quote)
+        {
+          wcsncpy(zDialogueText, quote->getWCHAR().data(), Length);
+          delete quote;
+          success = zDialogueText[0] != L'\0';
+        }
 			}
 			catch (...) { success = false; }
 			if (!success)
    }
 
 	// CHECK IF THE FILE EXISTS, IF NOT, USE DEFAULT!
-	const char* pFilename = GetDialogueDataFilename(ubCharacterNum, usQuoteNum, TRUE);
+   const char* pFilename = Content::GetDialogueVoiceFilename(
+     profile, usQuoteNum, useAlternateDialogueFile,
+     ProfileCurrentlyTalkingInDialoguePanel(profile.getNum()),
+     isRussianVersion() || isRussianGoldVersion());
+
 	strcpy( zSoundString, pFilename );
  return(TRUE);
 }

File Build/Tactical/Dialogue_Control.h

 #include "Faces.h"
 #include "GameScreen.h"
 
+#include "MercProfile.h"
+
 // An enumeration for dialog quotes
 enum DialogQuoteIDs
 {
 void HandleImportantMercQuote( SOLDIERTYPE * pSoldier, UINT16 usQuoteNumber );
 void HandleImportantMercQuoteLocked(SOLDIERTYPE*, UINT16 quote);
 
-
-const char* GetDialogueDataFilename(UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN fWavFile);
-
 // A higher level function used for tactical quotes
 BOOLEAN TacticalCharacterDialogue(const SOLDIERTYPE* pSoldier, UINT16 usQuoteNum);
 
 
 void CharacterDialogueUsingAlternateFile(SOLDIERTYPE&, UINT16 quote, DialogueHandler);
 
-BOOLEAN ExecuteCharacterDialogue(UINT8 ubCharacterNum, UINT16 usQuoteNum, FACETYPE* face, DialogueHandler, BOOLEAN fFromSoldier);
+BOOLEAN ExecuteCharacterDialogue(UINT8 ubCharacterNum, UINT16 usQuoteNum, FACETYPE* face, DialogueHandler, BOOLEAN fFromSoldier, bool useAlternateDialogueFile);
 
 // Called when a face stops talking...
 void HandleDialogueEnd(FACETYPE&);

File Build/Tactical/DisplayCover.cc

 #include "Render_Fun.h"
 #include "Items.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
+#include "WeaponModels.h"
 
 #define		DC_MAX_COVER_RANGE						31
 
 		}
 
 		INT32  const iGetThrough       = SoldierToLocationChanceToGetThrough(pOpponent, sTargetGridNo, pSoldier->bLevel, bStance, NULL);
-		UINT16 const usMaxRange        = WeaponInHand(pOpponent) ? GunRange(pOpponent->inv[HANDPOS]) : Weapon[GLOCK_18].usRange;
+		UINT16 const usMaxRange        = WeaponInHand(pOpponent) ? GunRange(pOpponent->inv[HANDPOS]) : GCM->getWeapon(GLOCK_18)->usRange;
 		INT32  const iBulletGetThrough = __min(__max((INT32)(((usMaxRange - usRange) / (FLOAT)usMaxRange + .3) * 100), 0), 100);
 		if (iBulletGetThrough > 5 && iGetThrough > 0)
 		{
 	if (WeaponInHand(s))
 	{
 		//display a string with the weapons range, then range to target
-		ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, zNewTacticalMessages[TCTL_MSG__RANGE_TO_TARGET_AND_GUN_RANGE], Weapon[s->inv[HANDPOS].usItem].usRange / 10, usRange);
+		ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, zNewTacticalMessages[TCTL_MSG__RANGE_TO_TARGET_AND_GUN_RANGE], GCM->getWeapon(s->inv[HANDPOS].usItem)->usRange / 10, usRange);
 	}
 	else
 	{

File Build/Tactical/Interface_Items.cc

 #include "Items.h"
 #include "UILayout.h"
 
+#include "CalibreModel.h"
+#include "ContentManager.h"
 #include "GameInstance.h"
+#include "MagazineModel.h"
 #include "Soldier.h"
+#include "WeaponModels.h"
 #include "policy/GamePolicy.h"
 
 #define		ITEMDESC_FONT							BLOCKFONT2
 		}
 	}
 
-	if (Weapon[usItem].ubImpact >= EXCEPTIONAL_DAMAGE)
+	if (GCM->getWeapon(usItem)->ubImpact >= EXCEPTIONAL_DAMAGE)
 	{
 		zTemp = g_langRes->Message[STR_HIGH_DAMAGE];
 		if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) )
 		}
 	}
 
-	if (Weapon[usItem].ubShotsPerBurst >= EXCEPTIONAL_BURST_SIZE || usItem == G11)
+	if (GCM->getWeapon(usItem)->ubShotsPerBurst >= EXCEPTIONAL_BURST_SIZE || usItem == G11)
 	{
 		zTemp = g_langRes->Message[STR_FAST_BURST];
 		if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) )
 		}
 	}
 
-	if (Weapon[usItem].ubMagSize > EXCEPTIONAL_MAGAZINE)
+	if (GCM->getWeapon(usItem)->ubMagSize > EXCEPTIONAL_MAGAZINE)
 	{
 		zTemp = g_langRes->Message[STR_LARGE_AMMO_CAPACITY];
 		if ( ! AttemptToAddSubstring( zItemPros, zTemp, &uiStringLength, uiPixLimit ) )
 		}
 	}
 
-	if (Weapon[usItem].ubImpact <= BAD_DAMAGE)
+	if (GCM->getWeapon(usItem)->ubImpact <= BAD_DAMAGE)
 	{
 		zTemp = g_langRes->Message[STR_LOW_DAMAGE];
 		if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) )
 		}
 	}
 
-	if (Weapon[usItem].ubShotsPerBurst == 0)
+	if (GCM->getWeapon(usItem)->ubShotsPerBurst == 0)
 	{
 		zTemp = g_langRes->Message[STR_NO_BURST];
 		if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) )
 		}
 	}
 
-	if (Weapon[usItem].ubMagSize < BAD_MAGAZINE)
+	if (GCM->getWeapon(usItem)->ubMagSize < BAD_MAGAZINE)
 	{
 		zTemp = g_langRes->Message[STR_SMALL_AMMO_CAPACITY];
 		if ( ! AttemptToAddSubstring( zItemCons, zTemp, &uiStringLength, uiPixLimit ) )
 }
 
 
-static BOOLEAN CompatibleAmmoForGun(const OBJECTTYPE* pTryObject, const OBJECTTYPE* pTestObject)
+static bool CompatibleAmmoForGun(const OBJECTTYPE* pTryObject, const OBJECTTYPE* pTestObject)
 {
 	if ( ( Item[ pTryObject->usItem ].usItemClass & IC_AMMO ) )
 	{
-		// CHECK
-		if (Weapon[ pTestObject->usItem ].ubCalibre == Magazine[Item[pTryObject->usItem].ubClassIndex].ubCalibre )
-		{
-			return( TRUE );
-		}
+    return GCM->getWeapon( pTestObject->usItem )->matches(GCM->getMagazine(Item[pTryObject->usItem].ubClassIndex)->calibre);
 	}
-	return( FALSE );
+	return false;
 }
 
 
-static BOOLEAN CompatibleGunForAmmo(const OBJECTTYPE* pTryObject, const OBJECTTYPE* pTestObject)
+static bool CompatibleGunForAmmo(const OBJECTTYPE* pTryObject, const OBJECTTYPE* pTestObject)
 {
 	if ( ( Item[ pTryObject->usItem ].usItemClass & IC_GUN ) )
 	{
-		// CHECK
-		if (Weapon[ pTryObject->usItem ].ubCalibre == Magazine[Item[pTestObject->usItem].ubClassIndex].ubCalibre )
-		{
-			return( TRUE );
-		}
+    return GCM->getWeapon( pTryObject->usItem )->matches(GCM->getMagazine(Item[pTestObject->usItem].ubClassIndex)->calibre);
 	}
-	return( FALSE );
+	return false;
 }
 
 
 	if (Item[o->usItem].usItemClass & IC_GUN && o->usItem != ROCKET_LAUNCHER)
 	{
 		wchar_t	pStr[10];
-		swprintf(pStr, lengthof(pStr), L"%d/%d", o->ubGunShotsLeft, Weapon[o->usItem].ubMagSize);
+		swprintf(pStr, lengthof(pStr), L"%d/%d", o->ubGunShotsLeft, GCM->getWeapon(o->usItem)->ubMagSize);
 
 		INT32 img;
 		switch (o->ubGunAmmoType)
 			BltVideoObject(guiSAVEBUFFER, guiBullet, 0, x, y);
 		}
 
-		WEAPONTYPE const& w = Weapon[obj.usItem];
-		if (w.ubShotsPerBurst > 0)
+		const WEAPONTYPE * w = GCM->getWeapon(obj.usItem);
+		if (w->ubShotsPerBurst > 0)
 		{
 			INT32       x = in_map ? MAP_BULLET_BURST_X : BULLET_BURST_X;
 			INT32 const y = in_map ? MAP_BULLET_BURST_Y : BULLET_BURST_Y;
-			for (INT32 i = w.ubShotsPerBurst; i != 0; --i)
+			for (INT32 i = w->ubShotsPerBurst; i != 0; --i)
 			{
 				BltVideoObject(guiSAVEBUFFER, guiBullet, 0, x, y);
 				x += BULLET_WIDTH + 1;
 	if (ITEM_PROS_AND_CONS(obj.usItem))
 	{
 		{
-			WEAPONTYPE const& w = Weapon[obj.usItem];
+			const WEAPONTYPE * w = GCM->getWeapon(obj.usItem);
 			size_t            n = 0;
-			if (w.ubCalibre != NOAMMO)
+			if (w->calibre->index != NOAMMO)
 			{
-				n += swprintf(pStr, lengthof(pStr), L"%ls ", AmmoCaliber[w.ubCalibre]);
+				n += swprintf(pStr, lengthof(pStr), L"%ls ", w->calibre->getName());
 			}
-			n += swprintf(pStr + n, lengthof(pStr) - n, L"%ls", WeaponType[w.ubWeaponType]);
+			n += swprintf(pStr + n, lengthof(pStr) - n, L"%ls", WeaponType[w->ubWeaponType]);
 			if (wchar_t const* const imprint = GetObjectImprint(obj))
 			{ // Add name noting imprint
 				n += swprintf(pStr + n, lengthof(pStr) - n, L" (%ls)", imprint);
 		}
 		MPrint(dx + ids[1].sX, dy + ids[1].sY, gWeaponStatsDesc[1]); // status
 
-		WEAPONTYPE const& w = Weapon[obj.usItem];
-		if (w.ubShotsPerBurst > 0)
+    const WEAPONTYPE * w = GCM->getWeapon(obj.usItem);
+    if (w->ubShotsPerBurst > 0)
 		{
 			MPrint(dx + ids[7].sX, dy + ids[7].sY, gWeaponStatsDesc[6]); // = (sic)
 		}
 
 		if (!(item.usItemClass & IC_LAUNCHER) && obj.usItem != ROCKET_LAUNCHER)
 		{ // Damage
-			HighlightIf(w.ubImpact >= EXCEPTIONAL_DAMAGE);
-			swprintf(pStr, lengthof(pStr), L"%2d", w.ubImpact);
+			HighlightIf(w->ubImpact >= EXCEPTIONAL_DAMAGE);
+			swprintf(pStr, lengthof(pStr), L"%2d", w->ubImpact);
 			FindFontRightCoordinates(dx + ids[3].sX + ids[3].sValDx, dy + ids[3].sY, ITEM_STATS_WIDTH, ITEM_STATS_HEIGHT, pStr, BLOCKFONT2, &usX, &usY);
 			MPrint(usX, usY, pStr);
 		}
 		FindFontRightCoordinates(dx + ids[4].sX + ids[4].sValDx, dy + ids[4].sY, ITEM_STATS_WIDTH, ITEM_STATS_HEIGHT, pStr, BLOCKFONT2, &usX, &usY);
 		MPrint(usX, usY, pStr);
 
-		if (w.ubShotsPerBurst > 0)
+		if (w->ubShotsPerBurst > 0)
 		{
-			HighlightIf(w.ubShotsPerBurst >= EXCEPTIONAL_BURST_SIZE || obj.usItem == G11);
+			HighlightIf(w->ubShotsPerBurst >= EXCEPTIONAL_BURST_SIZE || obj.usItem == G11);
 			swprintf(pStr, lengthof(pStr), L"%2d", ubAttackAPs + CalcAPsToBurst(DEFAULT_APS, obj));
 			FindFontRightCoordinates(dx + ids[5].sX + ids[5].sValDx, dy + ids[5].sY, ITEM_STATS_WIDTH, ITEM_STATS_HEIGHT, pStr, BLOCKFONT2, &usX, &usY);
 			MPrint(usX, usY, pStr);
 
 		if (item.usItemClass & IC_AMMO)
 		{ // Ammo - print amount
-			swprintf(pStr, lengthof(pStr), L"%d/%d", obj.ubShotsLeft[0], Magazine[item.ubClassIndex].ubMagSize);
+			swprintf(pStr, lengthof(pStr), L"%d/%d", obj.ubShotsLeft[0], GCM->getMagazine(item.ubClassIndex)->capacity);
 			FindFontRightCoordinates(dx + ids[1].sX + ids[1].sValDx, dy + ids[1].sY, ITEM_STATS_WIDTH, ITEM_STATS_HEIGHT, pStr, BLOCKFONT2, &usX, &usY);
 			MPrint(usX, usY, pStr);
 		}
 	OBJECTTYPE const& weapon = s.inv[HANDPOS];
 	if (!CompatibleAmmoForGun(&ammo, &weapon))
 	{
-		ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ROBOT_NEEDS_GIVEN_CALIBER_STR], AmmoCaliber[Weapon[weapon.usItem].ubCalibre]);
+		ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ROBOT_NEEDS_GIVEN_CALIBER_STR], GCM->getWeapon(weapon.usItem)->calibre->getName());
 		return false;
 	}
 	return true;
 		size_t n = swprintf(dst, length, L"%ls", ItemNames[usItem]);
 		if (!gGameOptions.fGunNut && Item[usItem].usItemClass == IC_GUN)
 		{
-			AmmoKind const calibre = Weapon[usItem].ubCalibre;
-			if (calibre != NOAMMO && calibre != AMMOROCKET)
+			const CalibreModel * calibre = GCM->getWeapon(usItem)->calibre;
+			if (calibre->showInHelpText)
 			{
-				n += swprintf(dst + n, length - n, L" (%ls)", AmmoCaliber[calibre]);
+				n += swprintf(dst + n, length - n, L" (%ls)", AmmoCaliber[calibre->index]);
 			}
 		}
 

File Build/Tactical/Interface_Panels.cc

 #include "ScreenIDs.h"
 #include "UILayout.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
+#include "WeaponModels.h"
 
 // DEFINES FOR VARIOUS PANELS
 #define	SM_ITEMDESC_START_X					214
 	else
 	{
 		// as a minimum
-		if ( (Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass & IC_WEAPON) && Weapon[ pSoldier->inv[ HANDPOS ].usItem ].ubShotsPerBurst == 0 )
+		if ( (Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass & IC_WEAPON) && GCM->getWeapon( pSoldier->inv[ HANDPOS].usItem)->ubShotsPerBurst == 0 )
 		{
 			pSoldier->bDoBurst		= FALSE;
 			pSoldier->bWeaponMode = WM_NORMAL;

File Build/Tactical/Interface_Utils.cc

 #include "ScreenIDs.h"
 #include "UILayout.h"
 
+#include "ContentManager.h"
+#include "GameInstance.h"
+#include "MagazineModel.h"
 
 #define			LIFE_BAR_SHADOW							FROMRGB( 108, 12, 12 )
 #define			LIFE_BAR										FROMRGB( 200, 0, 0 )
 	}
 	else if (item.usItemClass & IC_AMMO)
 	{
-		value = 100 * o.ubShotsLeft[ubStatus] / Magazine[item.ubClassIndex].ubMagSize;
+		value = 100 * o.ubShotsLeft[ubStatus] / GCM->getMagazine(item.ubClassIndex)->capacity;
 		if (value > 100) value = 100;
 	}
 	else if (item.usItemClass & IC_KEY)

File Build/Tactical/Inventory_Choosing.cc

 #include "Map_Screen_Interface_Map.h"
 #include "Debug.h"
 
+#include "AmmoTypeModel.h"
+#include "ContentManager.h"
 #include "GameInstance.h"
+#include "MagazineModel.h"
 #include "policy/GamePolicy.h"
 
 #define ENEMYAMMODROPRATE       50      // % of time enemies drop ammunition
 
 		// check default ammo first...
 		usAmmoIndex = DefaultMagazine( usGunIndex );
-		switch( Magazine[ Item[ usAmmoIndex ].ubClassIndex ].ubAmmoType )
+		switch( GCM->getMagazine(Item[ usAmmoIndex ].ubClassIndex)->ammoType->index )
 		{