diff -uwr sourceold/CTF/CTF.cpp source/CTF/CTF.cpp
--- sourceold/CTF/CTF.cpp	2011-10-11 21:33:14.455078100 +0800
+++ source/CTF/CTF.cpp	2011-12-07 11:55:00.500000000 +0800
@@ -55,19 +55,15 @@
 class CTF : public Plugin
 {
 public:
-	int CTFClass;
-	StringClass CTFClassName;
-	bool CTFEnableReverse;
-	bool CTFReverse;
+	struct Configuration {
+		int CTFCapLimit;
+		Vector3 CTFFlagOffset;
 	bool CTFRegenForHolder;
 	float CTFRegenAmount;
 	StringClass CTFFlagPreset;
 	StringClass CTFFlagModel[2];
 	StringClass CTFFlagBackPreset;
 	StringClass CTFPedPreset[2];
-	int CTFCapLimit;
-	Vector3 CTFFlagOffset;
-	Vector3 CTFPedPos[2];
 	float CTFCapPoints;
 	float CTFCapPointsTeam;
 	float CTFCapMoney;
@@ -75,12 +71,46 @@
 	float CTFReturnTime;
 	bool CTFFriendlyFlagRadar;
 	bool CTFEnemyFlagRadar;
+		bool CTFEnableReverse;
+		int CTFClass;
+		StringClass CTFClassName;
+		bool CTFReverse;
+		Vector3 CTFPedPos[2];
+		void setToDefaults()
+		{
+			CTFCapLimit = 3;
+			CTFFlagOffset = Vector3(0,0,0);
+			CTFRegenForHolder = false;
+			CTFRegenAmount = 2.0;
+			CTFFlagPreset = "POW_Data_Disc";
+			CTFFlagModel[0] = "o_flag";
+			CTFFlagModel[1] = "o_flag";
+			CTFFlagBackPreset = "CtfFlag";
+			CTFPedPreset[0] = "CtfPedestalRed";
+			CTFPedPreset[1] = "CtfPedestalGold";
+			CTFCapPoints = 0;
+			CTFCapPointsTeam = 0;
+			CTFCapMoney = 0;
+			CTFCapMoneyTeam = 0;
+			CTFReturnTime = 120;
+			CTFFriendlyFlagRadar = false;
+			CTFEnemyFlagRadar = false;
+			CTFEnableReverse = false;
+			CTFClass = 0;
+			CTFClassName = "NULL";
+			CTFReverse = false;
+			CTFPedPos[0] = Vector3(0,0,0);
+			CTFPedPos[1] = Vector3(0,0,0);
+		}
+	};
 	int CTFFlagHolder[2];
 	int CTFFlagAttached[2][2];
 	int CTFCaps[2];
 	int CTFFlagLoc[2];
 	int CTFFlagIcon[2];
-	CTF() : CTFCapLimit(0), CTFRegenForHolder(false), CTFRegenAmount(0), CTFCapPoints(0), CTFCapPointsTeam(0), CTFCapMoney(0), CTFCapMoneyTeam(0), CTFReturnTime(0), CTFFriendlyFlagRadar(false), CTFEnemyFlagRadar(false), CTFEnableReverse(false)
+	Configuration globalConfiguration;
+	Configuration mapConfiguration;
+	CTF()
 	{
 		CTFFlagHolder[0] = 0;
 		CTFFlagHolder[1] = 0;
@@ -93,6 +123,7 @@
 		RegisterEvent(EVENT_CHAT_HOOK,this);
 		RegisterEvent(EVENT_GAME_OVER_HOOK,this);
 		RegisterEvent(EVENT_GLOBAL_INI,this);
+		RegisterEvent(EVENT_MAP_INI,this);
 		RegisterEvent(EVENT_LOAD_LEVEL_HOOK,this);
 		RegisterEvent(EVENT_OBJECT_CREATE_HOOK,this);
 		RegisterEvent(EVENT_PLAYER_JOIN_HOOK,this);
@@ -102,34 +133,45 @@
 		UnregisterEvent(EVENT_CHAT_HOOK,this);
 		UnregisterEvent(EVENT_GAME_OVER_HOOK,this);
 		UnregisterEvent(EVENT_GLOBAL_INI,this);
+		UnregisterEvent(EVENT_MAP_INI,this);
 		UnregisterEvent(EVENT_LOAD_LEVEL_HOOK,this);
 		UnregisterEvent(EVENT_OBJECT_CREATE_HOOK,this);
 		UnregisterEvent(EVENT_PLAYER_JOIN_HOOK,this);
 	}
+	void LoadGenericINISettings(INIClass *SSGMIni, const char* key, Configuration& configuration)
+	{
+		configuration.CTFCapLimit = SSGMIni->Get_Int("CTF","CaptureLimit",configuration.CTFCapLimit);
+		configuration.CTFFlagOffset.X = SSGMIni->Get_Float("CTF","FlagOffsetx",configuration.CTFFlagOffset.X);
+		configuration.CTFFlagOffset.Y = SSGMIni->Get_Float("CTF","FlagOffsety",configuration.CTFFlagOffset.Y);
+		configuration.CTFFlagOffset.Z = SSGMIni->Get_Float("CTF","FlagOffsetz",configuration.CTFFlagOffset.Z);
+		configuration.CTFRegenForHolder = SSGMIni->Get_Bool("CTF","EnableRegenForHolder",configuration.CTFRegenForHolder);
+		configuration.CTFRegenAmount = SSGMIni->Get_Float("CTF","RegenAmount",configuration.CTFRegenAmount);
+		SSGMIni->Get_String(configuration.CTFFlagPreset,"CTF","FlagPresetName",configuration.CTFFlagPreset);
+		SSGMIni->Get_String(configuration.CTFFlagModel[0],"CTF","FlagModelName0",configuration.CTFFlagModel[0]);
+		SSGMIni->Get_String(configuration.CTFFlagModel[1],"CTF","FlagModelName1",configuration.CTFFlagModel[1]);
+		SSGMIni->Get_String(configuration.CTFFlagBackPreset,"CTF","CarriedFlagPresetName",configuration.CTFFlagBackPreset);
+		SSGMIni->Get_String(configuration.CTFPedPreset[0],"CTF","PedestalPresetName0",configuration.CTFPedPreset[0]);
+		SSGMIni->Get_String(configuration.CTFPedPreset[1],"CTF","PedestalPresetName1",configuration.CTFPedPreset[1]);
+		configuration.CTFCapPoints = SSGMIni->Get_Float("CTF","CapturePoints",configuration.CTFCapPoints);
+		configuration.CTFCapPointsTeam = SSGMIni->Get_Float("CTF","CapturePointsTeam",configuration.CTFCapPointsTeam);
+		configuration.CTFCapMoney = SSGMIni->Get_Float("CTF","CaptureMoney",configuration.CTFCapMoney);
+		configuration.CTFCapMoneyTeam = SSGMIni->Get_Float("CTF","CaptureMoneyTeam",configuration.CTFCapMoneyTeam);
+		configuration.CTFReturnTime = SSGMIni->Get_Float("CTF","ReturnDropFlagTime",configuration.CTFReturnTime);
+		configuration.CTFFriendlyFlagRadar = SSGMIni->Get_Bool("CTF","ShowFriendlyFlagRadar",configuration.CTFFriendlyFlagRadar);
+		configuration.CTFEnemyFlagRadar = SSGMIni->Get_Bool("CTF","ShowEnemyFlagRadar",configuration.CTFEnemyFlagRadar);
+		configuration.CTFEnableReverse = SSGMIni->Get_Bool("CTF","EnableReverseCTF",configuration.CTFEnableReverse);
+	}
 	virtual void OnLoadGlobalINISettings(INIClass *SSGMIni)
 	{
-		CTFCapLimit = SSGMIni->Get_Int("CTF","CaptureLimit",3);
-		CTFFlagOffset.X = SSGMIni->Get_Float("CTF","FlagOffsetx",0);
-		CTFFlagOffset.Y = SSGMIni->Get_Float("CTF","FlagOffsety",0);
-		CTFFlagOffset.Z = SSGMIni->Get_Float("CTF","FlagOffsetz",0);
-		CTFRegenForHolder = SSGMIni->Get_Bool("CTF","EnableRegenForHolder",false);
-		CTFRegenAmount = SSGMIni->Get_Float("CTF","RegenAmount",2.0);
-		SSGMIni->Get_String(CTFFlagPreset,"CTF","FlagPresetName","POW_Data_Disc");
-		SSGMIni->Get_String(CTFFlagModel[0],"CTF","FlagModelName0","o_flag");
-		SSGMIni->Get_String(CTFFlagModel[1],"CTF","FlagModelName1","o_flag");
-		SSGMIni->Get_String(CTFFlagBackPreset,"CTF","CarriedFlagPresetName","CtfFlag");
-		SSGMIni->Get_String(CTFPedPreset[0],"CTF","PedestalPresetName0","CtfPedestalRed");
-		SSGMIni->Get_String(CTFPedPreset[1],"CTF","PedestalPresetName1","CtfPedestalGold");
-		CTFCapPoints = SSGMIni->Get_Float("CTF","CapturePoints",0);
-		CTFCapPointsTeam = SSGMIni->Get_Float("CTF","CapturePointsTeam",0);
-		CTFCapMoney = SSGMIni->Get_Float("CTF","CaptureMoney",0);
-		CTFCapMoneyTeam = SSGMIni->Get_Float("CTF","CaptureMoneyTeam",0);
-		CTFReturnTime = SSGMIni->Get_Float("CTF","ReturnDropFlagTime",120);
-		CTFFriendlyFlagRadar = SSGMIni->Get_Bool("CTF","ShowFriendlyFlagRadar",false);
-		CTFEnemyFlagRadar = SSGMIni->Get_Bool("CTF","ShowEnemyFlagRadar",false);
-		CTFEnableReverse = SSGMIni->Get_Bool("CTF","EnableReverseCTF",false);
-
-		int Class = SSGMIni->Get_Int("CTF","ForceClass",0);
+		globalConfiguration.setToDefaults();
+		LoadGenericINISettings(SSGMIni, "CTF", globalConfiguration);
+	}
+	virtual void OnLoadMapINISettings(INIClass *SSGMIni)
+	{
+		mapConfiguration = globalConfiguration;
+		const StringClass key = StringClass(The_Game()->Get_Map_Name()).AsLower() + "_CTF";
+		LoadGenericINISettings(SSGMIni, key, mapConfiguration);
+		int Class = SSGMIni->Get_Int(key,"ForceClass",0);
 		if (!Class)
 		{
 			DynamicVectorClass<int> Classes;
@@ -137,18 +179,18 @@
 				StringClass Value;
 				StringClass v;
 				v.Format("CTF_C%02d_Name",z);
-				SSGMIni->Get_String(Value,"CTF",v,"NULL");
+				SSGMIni->Get_String(Value,key,v,"NULL");
 				if (Value == "NULL") {
 					break;
 				}
 				bool Enabled,Reverse;
 				v.Format("CTF_C%02d_Enabled",z);
-				Enabled = SSGMIni->Get_Bool("CTF",v,true);
+				Enabled = SSGMIni->Get_Bool(key,v,true);
 				v.Format("CTF_C%02d_Reverse",z);
-				Reverse = SSGMIni->Get_Bool("CTF",v,false);
+				Reverse = SSGMIni->Get_Bool(key,v,false);
 				if (Enabled) {
 					if (Reverse) {
-						if (CTFEnableReverse) {
+						if (mapConfiguration.CTFEnableReverse) {
 							Classes.Add(z);
 						}
 					}
@@ -169,26 +211,26 @@
 			}
 		}
 
-		CTFClass = Class;
+		mapConfiguration.CTFClass = Class;
 		StringClass v;
-		v.Format("CTF_C%02d_Name",CTFClass);
-		SSGMIni->Get_String(CTFClassName,v,"NULL");
-		v.Format("CTF_C%02d_Reverse",CTFClass);
-		CTFReverse = SSGMIni->Get_Bool("CTF",v,false);
-		v.Format("CTF_C%02d_CaptureLimit",CTFClass);
-		CTFCapLimit = SSGMIni->Get_Int("CTF",v,CTFCapLimit);
-		v.Format("CTF_C%02d_Team0x",CTFClass);
-		CTFPedPos[0].X = SSGMIni->Get_Float("CTF",v,0.0f);
-		v.Format("CTF_C%02d_Team0y",CTFClass);
-		CTFPedPos[0].Y = SSGMIni->Get_Float("CTF",v,0.0f);
-		v.Format("CTF_C%02d_Team0z",CTFClass);
-		CTFPedPos[0].Z = SSGMIni->Get_Float("CTF",v,0.0f);
-		v.Format("CTF_C%02d_Team1x",CTFClass);
-		CTFPedPos[1].X = SSGMIni->Get_Float("CTF",v,0.0f);
-		v.Format("CTF_C%02d_Team1y",CTFClass);
-		CTFPedPos[1].Y = SSGMIni->Get_Float("CTF",v,0.0f);
-		v.Format("CTF_C%02d_Team1z",CTFClass);
-		CTFPedPos[1].Z = SSGMIni->Get_Float("CTF",v,0.0f);
+		v.Format("CTF_C%02d_Name",mapConfiguration.CTFClass);
+		SSGMIni->Get_String(mapConfiguration.CTFClassName,v,mapConfiguration.CTFClassName);
+		v.Format("CTF_C%02d_Reverse",mapConfiguration.CTFClass);
+		mapConfiguration.CTFReverse = SSGMIni->Get_Bool(key,v,mapConfiguration.CTFReverse);
+		v.Format("CTF_C%02d_CaptureLimit",mapConfiguration.CTFClass);
+		mapConfiguration.CTFCapLimit = SSGMIni->Get_Int(key,v,mapConfiguration.CTFCapLimit);
+		v.Format("CTF_C%02d_Team0x",mapConfiguration.CTFClass);
+		mapConfiguration.CTFPedPos[0].X = SSGMIni->Get_Float(key,v,mapConfiguration.CTFPedPos[0].X);
+		v.Format("CTF_C%02d_Team0y",mapConfiguration.CTFClass);
+		mapConfiguration.CTFPedPos[0].Y = SSGMIni->Get_Float(key,v,mapConfiguration.CTFPedPos[0].Y);
+		v.Format("CTF_C%02d_Team0z",mapConfiguration.CTFClass);
+		mapConfiguration.CTFPedPos[0].Z = SSGMIni->Get_Float(key,v,mapConfiguration.CTFPedPos[0].Z);
+		v.Format("CTF_C%02d_Team1x",mapConfiguration.CTFClass);
+		mapConfiguration.CTFPedPos[1].X = SSGMIni->Get_Float(key,v,mapConfiguration.CTFPedPos[1].X);
+		v.Format("CTF_C%02d_Team1y",mapConfiguration.CTFClass);
+		mapConfiguration.CTFPedPos[1].Y = SSGMIni->Get_Float(key,v,mapConfiguration.CTFPedPos[1].Y);
+		v.Format("CTF_C%02d_Team1z",mapConfiguration.CTFClass);
+		mapConfiguration.CTFPedPos[1].Z = SSGMIni->Get_Float(key,v,mapConfiguration.CTFPedPos[1].Z);
 	}
 	void Set_Flag_Location(int Team, int Loc)
 	{
@@ -211,10 +253,10 @@
 		CTFFlagAttached[Team][0] = 0;
 		CTFFlagAttached[Team][1] = 0;
 		Vector3 FlagLoc = Position;
-		FlagLoc += CTFFlagOffset;
-		GameObject *Flag = Commands->Create_Object(CTFFlagPreset,FlagLoc);
+		FlagLoc += mapConfiguration.CTFFlagOffset;
+		GameObject *Flag = Commands->Create_Object(mapConfiguration.CTFFlagPreset,FlagLoc);
 		Commands->Set_Player_Type(Flag,Team);
-		Commands->Set_Model(Flag,CTFFlagModel[Team]);
+		Commands->Set_Model(Flag,mapConfiguration.CTFFlagModel[Team]);
 		Commands->Attach_Script(Flag,"SSGM_CTF_DropFlag","");
 		Commands->Attach_Script(Flag,"KAK_Prevent_Kill","");
 		Set_Flag_Location(Team,3);
@@ -229,11 +271,11 @@
 		CTFFlagHolder[Team] = 0;
 		CTFFlagAttached[Team][0] = 0;
 		CTFFlagAttached[Team][1] = 0;
-		Vector3 FlagLoc = CTFPedPos[Team];
-		FlagLoc += CTFFlagOffset;
-		GameObject *Flag = Commands->Create_Object(CTFFlagPreset,FlagLoc);
+		Vector3 FlagLoc = mapConfiguration.CTFPedPos[Team];
+		FlagLoc += mapConfiguration.CTFFlagOffset;
+		GameObject *Flag = Commands->Create_Object(mapConfiguration.CTFFlagPreset,FlagLoc);
 		Commands->Set_Player_Type(Flag,Team);
-		Commands->Set_Model(Flag,CTFFlagModel[Team]);
+		Commands->Set_Model(Flag,mapConfiguration.CTFFlagModel[Team]);
 		Commands->Attach_Script(Flag,"MDB_SSGM_CTF_Flag","");
 		Commands->Attach_Script(Flag,"KAK_Prevent_Kill","");
 		Set_Flag_Location(Team,1);
@@ -245,12 +287,12 @@
 		{
 			return 0;
 		}
-		Vector3 PedPos = CTFPedPos[Team];
-		GameObject *Ped = Commands->Create_Object(CTFPedPreset[Team],PedPos);
+		Vector3 PedPos = mapConfiguration.CTFPedPos[Team];
+		GameObject *Ped = Commands->Create_Object(mapConfiguration.CTFPedPreset[Team],PedPos);
 		Commands->Set_Player_Type(Ped,Team);
 		Commands->Attach_Script(Ped,"KAK_Prevent_Kill","");
 		Create_CTF_PedFlag(Team);
-		PedPos.Z += CTFFlagOffset.Z;
+		PedPos.Z += mapConfiguration.CTFFlagOffset.Z;
 		PedPos.Z += 1.25f;
 		GameObject *Icon = Commands->Create_Object("Invisible_Object",PedPos);
 		CTFFlagIcon[Team] = Commands->Get_ID(Icon);
@@ -331,12 +373,12 @@
 			StringClass tmp;
 			tmp.Format("msg %s",Msg.Peek_Buffer());
 			Console_Input(tmp);
-			if (CTFCapLimit > 0)
+			if (mapConfiguration.CTFCapLimit > 0)
 			{
-				if ((CTFCapLimit - CTFCaps[Get_Object_Type(Player1)]) > 0) {
+				if ((mapConfiguration.CTFCapLimit - CTFCaps[Get_Object_Type(Player1)]) > 0) {
 					const char *str = Get_Team_Name(Get_Object_Type(Player1));
 					const char *str2 = Get_Team_Name(Team);
-					Msg.Format("%s needs to capture the %s flag %d more time(s) to win.",str,str2,(CTFCapLimit - CTFCaps[Get_Object_Type(Player1)]));
+					Msg.Format("%s needs to capture the %s flag %d more time(s) to win.",str,str2,(mapConfiguration.CTFCapLimit - CTFCaps[Get_Object_Type(Player1)]));
 					delete[] str;
 					delete[] str2;
 					SSGMGameLog::Log_Message(Msg,"_CTF");
@@ -348,7 +390,7 @@
 				{
 					const char *str = Get_Team_Name(Get_Object_Type(Player1));
 					const char *str2 = Get_Team_Name(Team);
-					Msg.Format("%s has won the game by capturing the %s flag %d time(s)!",str,str2,CTFCapLimit);
+					Msg.Format("%s has won the game by capturing the %s flag %d time(s)!",str,str2,mapConfiguration.CTFCapLimit);
 					delete[] str;
 					delete[] str2;
 					SSGMGameLog::Log_Message(Msg,"_CTF");
@@ -402,7 +444,7 @@
 				StringClass tmp;
 				const char *str = Get_Team_Name(0);
 				const char *str2 = Get_Team_Name(1);
-				tmp.Format("ppage %d %s Flag Captures: %d/%d - %s Flag Captures: %d/%d",PlayerID,str,CTFCaps[0],CTFCapLimit,str2,CTFCaps[1],CTFCapLimit);
+				tmp.Format("ppage %d %s Flag Captures: %d/%d - %s Flag Captures: %d/%d",PlayerID,str,CTFCaps[0],mapConfiguration.CTFCapLimit,str2,CTFCaps[1],mapConfiguration.CTFCapLimit);
 				delete[] str;
 				delete[] str2;
 				return false;
@@ -432,7 +474,7 @@
 				StringClass tmp;
 				const char *str = Get_Team_Name(0);
 				const char *str2 = Get_Team_Name(1);
-				tmp.Format("ppage %d The %s flag is %s. The %s flag is %s. The class is '%s'.",PlayerID,str,Msg[0].Peek_Buffer(),str2,Msg[1].Peek_Buffer(),CTFClassName);
+				tmp.Format("ppage %d The %s flag is %s. The %s flag is %s. The class is '%s'.",PlayerID,str,Msg[0].Peek_Buffer(),str2,Msg[1].Peek_Buffer(),mapConfiguration.CTFClassName);
 				delete[] str;
 				delete[] str2;
 				Console_Input(tmp);
@@ -453,15 +495,15 @@
 	{
 		PickedUp = false;
 		int Team = Get_Object_Type(obj);
-		if (ctf.CTFFriendlyFlagRadar) {
-			GameObject *AttachedFlag = Commands->Create_Object_At_Bone(obj,ctf.CTFFlagBackPreset,"Origin");
+		if (ctf.mapConfiguration.CTFFriendlyFlagRadar) {
+			GameObject *AttachedFlag = Commands->Create_Object_At_Bone(obj,ctf.mapConfiguration.CTFFlagBackPreset,"Origin");
 			Commands->Attach_To_Object_Bone(AttachedFlag, obj,"Origin");
 			Commands->Disable_All_Collisions(AttachedFlag);
 			Commands->Set_Player_Type(AttachedFlag,Team);
 			Commands->Set_Model(AttachedFlag,"null");
 			ctf.CTFFlagAttached[Team][0] = Commands->Get_ID(AttachedFlag);
 		}
-		if (ctf.CTFEnemyFlagRadar) {
+		if (ctf.mapConfiguration.CTFEnemyFlagRadar) {
 			GameObject *AttachedFlag2 = Commands->Create_Object_At_Bone(obj,"Invisible_Object","Origin");
 			Commands->Attach_To_Object_Bone(AttachedFlag2, obj, "Origin");
 			Commands->Disable_All_Collisions(AttachedFlag2);
@@ -501,16 +543,16 @@
 					ctf.CTFFlagAttached[OtherTeam][0] = 0;
 					ctf.CTFCaps[Team]++;
 					ctf.CTF_Message(6,OtherTeam,sender,0);	
-					Commands->Give_Points(sender,ctf.CTFCapPoints,false);
-					Commands->Give_Money(sender,(ctf.CTFCapPoints*-1.0f),false);
-					Commands->Give_Points(sender,ctf.CTFCapPointsTeam,true);
-					Commands->Give_Money(sender,(ctf.CTFCapPointsTeam*-1.0f),true);
-					Commands->Give_Money(sender,ctf.CTFCapMoney,false);	
-					Commands->Give_Money(sender,ctf.CTFCapMoneyTeam,true);
+					Commands->Give_Points(sender,ctf.mapConfiguration.CTFCapPoints,false);
+					Commands->Give_Money(sender,(ctf.mapConfiguration.CTFCapPoints*-1.0f),false);
+					Commands->Give_Points(sender,ctf.mapConfiguration.CTFCapPointsTeam,true);
+					Commands->Give_Money(sender,(ctf.mapConfiguration.CTFCapPointsTeam*-1.0f),true);
+					Commands->Give_Money(sender,ctf.mapConfiguration.CTFCapMoney,false);	
+					Commands->Give_Money(sender,ctf.mapConfiguration.CTFCapMoneyTeam,true);
 					int AnimSize = (sizeof(CTFAnimations)/sizeof(char*));
 					int Animation2Play = Commands->Get_Random_Int(0,AnimSize);
 					Commands->Set_Animation(sender,CTFAnimations[Animation2Play],false,0,0.0f,-1.0f,false);
-					if (ctf.CTFCaps[Team] >= ctf.CTFCapLimit)
+					if (ctf.CTFCaps[Team] >= ctf.mapConfiguration.CTFCapLimit)
 					{
 						StringClass str;
 						str.Format("WIN %d\n",Team);
@@ -532,16 +574,16 @@
 	{
 		PickedUp = false;
 		int Team = Get_Object_Type(obj);
-		if (ctf.CTFFriendlyFlagRadar)
+		if (ctf.mapConfiguration.CTFFriendlyFlagRadar)
 		{
-			GameObject *AttachedFlag = Commands->Create_Object_At_Bone(obj,ctf.CTFFlagBackPreset,"Origin");
+			GameObject *AttachedFlag = Commands->Create_Object_At_Bone(obj,ctf.mapConfiguration.CTFFlagBackPreset,"Origin");
 			Commands->Attach_To_Object_Bone(AttachedFlag, obj,"Origin");
 			Commands->Disable_All_Collisions(AttachedFlag);
 			Commands->Set_Player_Type(AttachedFlag,Team);
 			Commands->Set_Model(AttachedFlag,"null");
 			ctf.CTFFlagAttached[Team][0] = Commands->Get_ID(AttachedFlag);
 		}	
-		if (ctf.CTFEnemyFlagRadar)
+		if (ctf.mapConfiguration.CTFEnemyFlagRadar)
 		{
 			GameObject *AttachedFlag2 = Commands->Create_Object_At_Bone(obj,"Invisible_Object","Origin");
 			Commands->Attach_To_Object_Bone(AttachedFlag2, obj, "Origin");
@@ -552,9 +594,9 @@
 			Commands->Set_Obj_Radar_Blip_Color(AttachedFlag2,Team);
 			ctf.CTFFlagAttached[Team][1] = Commands->Get_ID(AttachedFlag2);
 		}
-		if (ctf.CTFReturnTime > 0.0f)
+		if (ctf.mapConfiguration.CTFReturnTime > 0.0f)
 		{
-			Commands->Start_Timer(obj,this,ctf.CTFReturnTime,1);
+			Commands->Start_Timer(obj,this,ctf.mapConfiguration.CTFReturnTime,1);
 		}
 		((PowerUpGameObjDef &)(obj->As_PhysicalGameObj()->As_PowerUpGameObj()->Get_Definition())).Persistent = true;
 		((PowerUpGameObjDef &)(obj->As_PhysicalGameObj()->As_PowerUpGameObj()->Get_Definition())).AlwaysAllowGrant = true;
@@ -609,10 +651,10 @@
 		int Team = PTTEAM(Get_Object_Type(obj));
 		Commands->Destroy_Object(Commands->Find_Object(ctf.CTFFlagAttached[Team][0]));
 		Commands->Destroy_Object(Commands->Find_Object(ctf.CTFFlagAttached[Team][1]));
-		GameObject *AttachedFlag = Commands->Create_Object_At_Bone(obj,ctf.CTFFlagBackPreset,"bone for bag");
+		GameObject *AttachedFlag = Commands->Create_Object_At_Bone(obj,ctf.mapConfiguration.CTFFlagBackPreset,"bone for bag");
 		Commands->Attach_To_Object_Bone(AttachedFlag,obj,"bone for bag");
 		Commands->Disable_All_Collisions(AttachedFlag);
-		if (ctf.CTFFriendlyFlagRadar)
+		if (ctf.mapConfiguration.CTFFriendlyFlagRadar)
 		{
 			Commands->Set_Player_Type(AttachedFlag,Team);
 		}
@@ -620,9 +662,9 @@
 		{
 			Commands->Set_Player_Type(AttachedFlag,-2);
 		}
-		Commands->Set_Model(AttachedFlag,ctf.CTFFlagModel[Team]);
+		Commands->Set_Model(AttachedFlag,ctf.mapConfiguration.CTFFlagModel[Team]);
 		ctf.CTFFlagAttached[Team][0] = Commands->Get_ID(AttachedFlag);
-		if (ctf.CTFEnemyFlagRadar)
+		if (ctf.mapConfiguration.CTFEnemyFlagRadar)
 		{
 			GameObject *AttachedFlag2 = Commands->Create_Object_At_Bone(obj,"Invisible_Object","bone for bag");
 			Commands->Attach_To_Object_Bone(AttachedFlag2,obj,"bone for bag");
@@ -633,7 +675,7 @@
 			Commands->Set_Obj_Radar_Blip_Color(AttachedFlag2,Team);
 			ctf.CTFFlagAttached[Team][1] = Commands->Get_ID(AttachedFlag2);
 		}
-		if (ctf.CTFRegenForHolder)
+		if (ctf.mapConfiguration.CTFRegenForHolder)
 		{
 			Commands->Start_Timer(obj,this,1.0f,1);
 		}
@@ -670,7 +712,7 @@
 	{
 		if (number == 1 && Commands->Get_Health(obj) > 0.0f)
 		{
-			Commands->Apply_Damage(obj,(ctf.CTFRegenAmount * -1.0f),"Repair",0);
+			Commands->Apply_Damage(obj,(ctf.mapConfiguration.CTFRegenAmount * -1.0f),"Repair",0);
 			Commands->Start_Timer(obj,this,1.0f,1);
 		}
 		else if (number == 2)
@@ -700,8 +742,8 @@
 	void Timer_Expired(GameObject *obj, int number)
 	{
 		StringClass str;
-		str.Format("msg Running in Capture The Flag mode. This rounds CTF class will be '%s' with a capture limit of %d.",ctf.CTFClassName.Peek_Buffer(),ctf.CTFCapLimit);
-		if (ctf.CTFReverse)
+		str.Format("msg Running in Capture The Flag mode. This rounds CTF class will be '%s' with a capture limit of %d.",ctf.mapConfiguration.CTFClassName.Peek_Buffer(),ctf.mapConfiguration.CTFCapLimit);
+		if (ctf.mapConfiguration.CTFReverse)
 		{
 			Console_Input("msg This is a Reverse CTF game. Your objective is to take the enemy flag from your base and run it to your pedestal in the enemy base.");
 			Console_Input("msg Keep in mind that returning your own flag is not always the best course of action!");
diff -uwr sourceold/ExtraConsoleCommands/ExtraConsoleCommands.cpp source/ExtraConsoleCommands/ExtraConsoleCommands.cpp
--- sourceold/ExtraConsoleCommands/ExtraConsoleCommands.cpp	2011-10-11 21:33:41.248046800 +0800
+++ source/ExtraConsoleCommands/ExtraConsoleCommands.cpp	2011-11-07 20:10:56.345703100 +0800
@@ -632,18 +632,19 @@
 	~EXTRACONSOLECOMMANDS()
 	{
 		Console_Output("Un-loading Extra Console Commands Plugin; written by Reborn from MP-Gaming.COM\n");
-		const DynamicVectorClass<ConsoleFunctionClass*> consoleFunctions(ConsoleFunctionList);
-		TT_FOREACH(consoleFunction, consoleFunctions)
-		{
-			const char* name = (*consoleFunction)->Get_Name();
-			if (name)
-			{
-				if (strcmp(name, "GiveCredits") == 0 || strcmp(name, "TakeCredits") == 0 || strcmp(name, "Kill") == 0 || strcmp(name, "Fly") == 0 || strcmp(name, "GivePoints") == 0 || strcmp(name, "TakePoints") == 0 || strcmp(name, "GivePow") == 0 || strcmp(name, "ChangeChar") == 0 || strcmp(name, "AttachScript") == 0 || strcmp(name, "UnAttachScript") == 0 || strcmp(name, "FreezePlayer") == 0 || strcmp(name, "UnFreezePlayer") == 0 || strcmp(name, "ListPlayersObjectIDs") == 0)
-				{
-					ConsoleFunctionList.Delete(consoleFunction);
-				}
-			}
-		}
+		Delete_Console_Function("GiveCredits");
+		Delete_Console_Function("TakeCredits");
+		Delete_Console_Function("Kill");
+		Delete_Console_Function("Fly");
+		Delete_Console_Function("GivePoints");
+		Delete_Console_Function("TakePoints");
+		Delete_Console_Function("GivePow");
+		Delete_Console_Function("ChangeChar");
+		Delete_Console_Function("AttachScript");
+		Delete_Console_Function("UnAttachScript");
+		Delete_Console_Function("FreezePlayer");
+		Delete_Console_Function("UnFreezePlayer");
+		Delete_Console_Function("ListPlayersObjectIDs");
 	}
 	
 };
diff -uwr sourceold/Mute/Mute.cpp source/Mute/Mute.cpp
--- sourceold/Mute/Mute.cpp	2011-10-11 21:35:34.633789000 +0800
+++ source/Mute/Mute.cpp	2011-11-07 20:10:56.260742100 +0800
@@ -126,19 +126,8 @@
 		UnregisterEvent(EVENT_CHAT_HOOK,this);
 		UnregisterEvent(EVENT_RADIO_HOOK,this);
 		UnregisterEvent(EVENT_PLAYER_LEAVE_HOOK,this);
-		const DynamicVectorClass<ConsoleFunctionClass*> consoleFunctions(ConsoleFunctionList);
-		TT_FOREACH(consoleFunction, consoleFunctions)
-		{
-			const char* name = (*consoleFunction)->Get_Name();
-			if (name)
-			{
-				if (strcmp(name, "Mute") == 0 ||
-					strcmp(name, "UnMute") == 0)
-				{
-					ConsoleFunctionList.Delete(consoleFunction);
-				}
-			}
-		}
+		Delete_Console_Function("Mute");
+		Delete_Console_Function("UnMute");
 	}
 
 
diff -uwr sourceold/PointsDistribution/DamagePoints.cpp source/PointsDistribution/DamagePoints.cpp
--- sourceold/PointsDistribution/DamagePoints.cpp	2011-10-11 21:36:03.346679600 +0800
+++ source/PointsDistribution/DamagePoints.cpp	2011-11-26 08:54:08.804687500 +0800
@@ -16,6 +16,16 @@
  
 void CollectDamage::Created(GameObject *obj)
 {
+	/*
+	if((strcmp(Commands->Get_Preset_Name(obj),"Destructible_Under_Pass"))== 0)
+	{
+		Set_Death_Points(obj, 0);
+		Set_Damage_Points(obj, 0);
+		StringClass msg;
+		msg.Format("Fixing broken preset values for \"Destructible_Under_Pass\".\n");
+		Console_Output(msg);
+	}
+	*/
 	if(Get_Death_Points(obj) == 0 && Get_Damage_Points(obj) == 0)
 	{
 		return;
@@ -41,6 +51,8 @@
  
 void CollectDamage::Killed(GameObject *obj, GameObject *Killer)
 {
+	if(Commands->Get_Player_Type(obj) == 0 || Commands->Get_Player_Type(obj) == 1)
+	{
 	float TotalDamage;
 	TotalDamage = 0;
 	for(int i = 0; i < 128; i++)
@@ -60,6 +72,7 @@
 		}
 	}
 }
+}
 
 
 ScriptRegistrant<CollectDamage> CollectDamage_Registrant("CollectDamage","");
diff -uwr sourceold/PointsDistribution/PointsDistribution.cpp source/PointsDistribution/PointsDistribution.cpp
--- sourceold/PointsDistribution/PointsDistribution.cpp	2011-10-11 21:36:13.567382800 +0800
+++ source/PointsDistribution/PointsDistribution.cpp	2011-11-26 08:54:08.823242100 +0800
@@ -65,6 +65,11 @@
 		{
 			Attach_Script_Once(obj,"CollectDamage","");
 		}
+		/*
+		StringClass msg;
+		msg.Format("Preset name:%s\nDeath Points: %f\nDamage Points:%f\nHealth: %f\nArmor: %f\nSkin: %s\n", Commands->Get_Preset_Name(obj), Get_Death_Points(obj), Get_Damage_Points(obj), Commands->Get_Health(obj), Commands->Get_Shield_Strength(obj), Get_Skin(obj));
+		Console_Output(msg);
+		*/
 	}
 };
 
diff -uwr sourceold/Spectate/Spectate.cpp source/Spectate/Spectate.cpp
--- sourceold/Spectate/Spectate.cpp	2011-10-11 23:03:06.380859300 +0800
+++ source/Spectate/Spectate.cpp	2011-11-07 20:10:56.307617100 +0800
@@ -126,18 +126,8 @@
 	~SPECTATE()
 	{
 		Console_Output("Un-loading Spectate Plugin; written by Reborn from MP-Gaming.COM\n");
-		const DynamicVectorClass<ConsoleFunctionClass*> consoleFunctions(ConsoleFunctionList);
-		TT_FOREACH(consoleFunction, consoleFunctions)
-		{
-			const char* name = (*consoleFunction)->Get_Name();
-			if (name)
-			{
-				if (strcmp(name, "Spectate") == 0 || strcmp(name, "SpectateSpeed") == 0)
-				{
-					ConsoleFunctionList.Delete(consoleFunction);
-				}
-			}
-		}
+		Delete_Console_Function("Spectate");
+		Delete_Console_Function("SpectateSpeed");
 	}
 	
 };
diff -uwr sourceold/SuddenDeath/SuddenDeath.cpp source/SuddenDeath/SuddenDeath.cpp
--- sourceold/SuddenDeath/SuddenDeath.cpp	2011-10-11 23:03:00.555664000 +0800
+++ source/SuddenDeath/SuddenDeath.cpp	2011-11-07 20:10:56.581054600 +0800
@@ -76,18 +76,7 @@
 	~SUDDENDEATH()
 	{
 		Console_Output("Un-Loading Sudden Death Plugin; written by Reborn from MP-Gaming.COM\n");
-		const DynamicVectorClass<ConsoleFunctionClass*> consoleFunctions(ConsoleFunctionList);
-		TT_FOREACH(consoleFunction, consoleFunctions)
-		{
-			const char* name = (*consoleFunction)->Get_Name();
-			if (name)
-			{
-				if (strcmp(name, "SuddenDeath") == 0)
-				{
-					ConsoleFunctionList.Delete(consoleFunction);
-				}
-			}
-		}
+		Delete_Console_Function("SuddenDeath");
 		UnregisterEvent(EVENT_GLOBAL_INI,this);
 		UnregisterEvent(EVENT_LOAD_LEVEL_HOOK,this);
 		UnregisterEvent(EVENT_OBJECT_CREATE_HOOK,this);
diff -uwr sourceold/bansystem/bansystem.cpp source/bansystem/bansystem.cpp
--- sourceold/bansystem/bansystem.cpp	2011-10-11 21:31:27.529296800 +0800
+++ source/bansystem/bansystem.cpp	2011-11-07 20:10:56.543945300 +0800
@@ -119,20 +119,9 @@
 BanSystem::~BanSystem()
 {
 	UnregisterEvent(EVENT_GLOBAL_INI,this);
-	const DynamicVectorClass<ConsoleFunctionClass*> consoleFunctions(ConsoleFunctionList);
-	TT_FOREACH(consoleFunction, consoleFunctions)
-	{
-		const char* name = (*consoleFunction)->Get_Name();
-		if (name)
-		{
-			if (strcmp(name, "kick") == 0 ||
-				strcmp(name, "ban") == 0 ||
-				strcmp(name, "rehash_ban_list") == 0)
-			{
-				ConsoleFunctionList.Delete(consoleFunction);
-			}
-		}
-	}
+	Delete_Console_Function("kick");
+	Delete_Console_Function("ban");
+	Delete_Console_Function("rehash_ban_list");
 	
 	removeConnectionAcceptanceFilter(this);
 }
Files sourceold/bin/Debug/shaders.lib and source/bin/Debug/shaders.lib differ
Files sourceold/bin/Release/shaders.lib and source/bin/Release/shaders.lib differ
diff -uwr sourceold/crates/GDICRATE.txt source/crates/GDICRATE.txt
--- sourceold/crates/GDICRATE.txt	2010-07-16 20:23:54.750000000 +0800
+++ source/crates/GDICRATE.txt	2011-11-07 20:16:25.418945300 +0800
@@ -8,7 +8,7 @@
 ; ****************************** Transport
 
 -1	Create_Real_Object,	2, "CnC_GDI_Transport", 1, "BN_Trajectory"
--1	Attach_Script,		2, "KAK_Prevent_Destruction_Until_Entered"
+-1	Attach_Script,		2, "SSGM_Prevent_Destruction_Until_Entered"
 -1	Set_Primary,		2
 -1	Attach_to_Bone,		2, 1, "BN_Trajectory"
 -1	Play_Animation,		2, "v_GDI_trnspt.XG_HD_Transport",1
diff -uwr sourceold/crates/NODCRATE.txt source/crates/NODCRATE.txt
--- sourceold/crates/NODCRATE.txt	2010-07-16 20:23:54.718750000 +0800
+++ source/crates/NODCRATE.txt	2011-11-07 20:16:26.226562500 +0800
@@ -8,7 +8,7 @@
 ; ****************************** Transport
 
 -1	Create_Real_Object,	2, "CnC_Nod_Transport", 1, "BN_Trajectory"
--1	Attach_Script,		2, "KAK_Prevent_Destruction_Until_Entered"
+-1	Attach_Script,		2, "SSGM_Prevent_Destruction_Until_Entered"
 -1	Set_Primary,		2
 -1	Attach_to_Bone,		2, 1, "BN_Trajectory"
 -1	Play_Animation,		2, "v_GDI_trnspt.XG_HD_Transport",1
diff -uwr sourceold/crates/crates.cpp source/crates/crates.cpp
--- sourceold/crates/crates.cpp	2011-10-11 21:32:46.643554600 +0800
+++ source/crates/crates.cpp	2011-12-05 15:38:18.435078100 +0800
@@ -22,6 +22,8 @@
 class Crate : public Plugin
 {
 public:
+	struct Configuration
+	{
 	bool EnableCrates;
 	bool EnableNewCrates;
 	bool VehCrate;
@@ -42,18 +44,35 @@
 	int	CrateSpy;
 	int	CrateStealth;
 	int	CrateThief;
-	bool CrateExists;
-	int	CrateLastPickup;
 	int CrateAmmoRegen;
 	int CrateHumanSilo;
 	int CrateUberWire;
-	int CrateID;
-	Crate() : CrateExists(false), CrateLastPickup(-181), CrateID(0), EnableCrates(false), EnableNewCrates(false), VehCrate(false)
+
+		void setToDefaults()
 	{
+			EnableCrates = true;
+			EnableNewCrates = false;
+			VehCrate = false;
 		CrateVehSpawnPos[0] = Vector3(0,0,0);
 		CrateVehSpawnPos[1] = Vector3(0,0,0);
+		}
+	};
+
+	Configuration globalConfiguration;
+	Configuration mapConfiguration;
+	int CrateID;
+	int CrateLastPickup;
+	bool CrateExists;
+
+	Crate()
+	{
+		CrateID = 0;
+		CrateExists = false;
+		CrateLastPickup = -181;
+
 		RegisterEvent(EVENT_GAME_OVER_HOOK,this);
 		RegisterEvent(EVENT_GLOBAL_INI,this);
+		RegisterEvent(EVENT_MAP_INI,this);
 		RegisterEvent(EVENT_LOAD_LEVEL_HOOK,this);
 		RegisterEvent(EVENT_OBJECT_CREATE_HOOK,this);
 	}
@@ -61,42 +80,51 @@
 	{
 		UnregisterEvent(EVENT_GAME_OVER_HOOK,this);
 		UnregisterEvent(EVENT_GLOBAL_INI,this);
+		UnregisterEvent(EVENT_MAP_INI,this);
 		UnregisterEvent(EVENT_LOAD_LEVEL_HOOK,this);
 		UnregisterEvent(EVENT_OBJECT_CREATE_HOOK,this);
 	}
+	void LoadGenericINISettings(INIClass *SSGMIni, const char* key, Configuration& configuration)
+	{
+		configuration.EnableCrates       = SSGMIni->Get_Bool(key, "EnableCrates",    configuration.EnableCrates);
+		configuration.EnableNewCrates    = SSGMIni->Get_Bool(key, "EnableNewCrates", configuration.EnableNewCrates);
+		configuration.VehCrate           = SSGMIni->Get_Bool(key, "AllowVehCrates",  configuration.VehCrate);
+		configuration.CrateWeapon        = SSGMIni->Get_Int (key, "Weapon",          configuration.CrateWeapon);
+		configuration.CrateMoney         = SSGMIni->Get_Int (key, "Money",           configuration.CrateMoney);
+		configuration.CratePoints        = SSGMIni->Get_Int (key, "Points",          configuration.CratePoints);
+		configuration.CrateVehicle       = SSGMIni->Get_Int (key, "Vehicle",         configuration.CrateVehicle);
+		configuration.CrateDeath         = SSGMIni->Get_Int (key, "Death",           configuration.CrateDeath);
+		configuration.CrateTiberium      = SSGMIni->Get_Int (key, "Tiberium",        configuration.CrateTiberium);
+		configuration.CrateAmmo          = SSGMIni->Get_Int (key, "Ammo",            configuration.CrateAmmo);
+		configuration.CrateArmor         = SSGMIni->Get_Int (key, "Armor",           configuration.CrateArmor);
+		configuration.CrateHealth        = SSGMIni->Get_Int (key, "Health",          configuration.CrateHealth);
+		configuration.CrateCharacter     = SSGMIni->Get_Int (key, "Character",       configuration.CrateCharacter);
+		configuration.CrateButterFingers = SSGMIni->Get_Int (key, "ButterFingers",   configuration.CrateButterFingers);
+		configuration.CrateRefill        = SSGMIni->Get_Int (key, "Refill",          configuration.CrateRefill);
+		configuration.CrateBeacon        = SSGMIni->Get_Int (key, "Beacon",          configuration.CrateBeacon);
+		configuration.CrateSpy           = SSGMIni->Get_Int (key, "Spy",             configuration.CrateSpy);
+		configuration.CrateStealth       = SSGMIni->Get_Int (key, "Stealth",         configuration.CrateStealth);
+		configuration.CrateThief         = SSGMIni->Get_Int (key, "Thief",           configuration.CrateThief);
+		configuration.CrateAmmoRegen     = SSGMIni->Get_Int (key, "AmmoRegen",       configuration.CrateAmmoRegen);
+		configuration.CrateHumanSilo     = SSGMIni->Get_Int (key, "HumanSilo",       configuration.CrateHumanSilo);
+		configuration.CrateUberWire      = SSGMIni->Get_Int (key, "UberWire",        configuration.CrateUberWire);
+	}
 	virtual void OnLoadGlobalINISettings(INIClass *SSGMIni)
 	{
-		EnableCrates = SSGMIni->Get_Bool("Crates","EnableCrates",true);
-		EnableNewCrates = SSGMIni->Get_Bool("Crates","EnableNewCrates",false);
-		if (EnableNewCrates)
-		{
-			VehCrate = SSGMIni->Get_Bool("Crates","AllowVehCrates",false);
-			CrateVehSpawnPos[0].X = SSGMIni->Get_Float("Crates","NodRVCx",0.0f);
-			CrateVehSpawnPos[0].Y = SSGMIni->Get_Float("Crates","NodRVCy",0.0f);
-			CrateVehSpawnPos[0].Z = SSGMIni->Get_Float("Crates","NodRVCz",0.0f);
-			CrateVehSpawnPos[1].X = SSGMIni->Get_Float("Crates","GDIRVCx",0.0f);
-			CrateVehSpawnPos[1].Y = SSGMIni->Get_Float("Crates","GDIRVCy",0.0f);
-			CrateVehSpawnPos[1].Z = SSGMIni->Get_Float("Crates","GDIRVCz",0.0f);
-			CrateWeapon = SSGMIni->Get_Int("Crates","Weapon",0);
-			CrateMoney = SSGMIni->Get_Int("Crates","Money",0);
-			CratePoints = SSGMIni->Get_Int("Crates","Points",0);
-			CrateVehicle = SSGMIni->Get_Int("Crates","Vehicle",0);
-			CrateDeath = SSGMIni->Get_Int("Crates","Death",0);
-			CrateTiberium = SSGMIni->Get_Int("Crates","Tiberium",0);
-			CrateAmmo = SSGMIni->Get_Int("Crates","Ammo",0);
-			CrateArmor = SSGMIni->Get_Int("Crates","Armor",0);
-			CrateHealth = SSGMIni->Get_Int("Crates","Health",0);
-			CrateCharacter = SSGMIni->Get_Int("Crates","Character",0);
-			CrateButterFingers = SSGMIni->Get_Int("Crates","ButterFingers",0);
-			CrateRefill = SSGMIni->Get_Int("Crates","Refill",0);
-			CrateBeacon = SSGMIni->Get_Int("Crates","Beacon",0);
-			CrateSpy = SSGMIni->Get_Int("Crates","Spy",0);
-			CrateStealth = SSGMIni->Get_Int("Crates","Stealth",0);
-			CrateThief = SSGMIni->Get_Int("Crates","Thief",0);
-			CrateAmmoRegen = SSGMIni->Get_Int("Crates","AmmoRegen",0);
-			CrateHumanSilo = SSGMIni->Get_Int("Crates","HumanSilo",0);
-			CrateUberWire = SSGMIni->Get_Int("Crates","UberWire",0);
+		globalConfiguration.setToDefaults();
+		LoadGenericINISettings(SSGMIni, "Crates", globalConfiguration);
 		}
+	virtual void OnLoadMapINISettings(INIClass *SSGMIni)
+	{
+		mapConfiguration = globalConfiguration;
+		const StringClass key = StringClass(The_Game()->Get_Map_Name()).AsLower() + "_Crates";
+		LoadGenericINISettings(SSGMIni, key, mapConfiguration);
+		mapConfiguration.CrateVehSpawnPos[0].X = SSGMIni->Get_Float(key, "NodRVCx", mapConfiguration.CrateVehSpawnPos[0].X);
+		mapConfiguration.CrateVehSpawnPos[0].Y = SSGMIni->Get_Float(key, "NodRVCy", mapConfiguration.CrateVehSpawnPos[0].Y);
+		mapConfiguration.CrateVehSpawnPos[0].Z = SSGMIni->Get_Float(key, "NodRVCz", mapConfiguration.CrateVehSpawnPos[0].Z);
+		mapConfiguration.CrateVehSpawnPos[1].X = SSGMIni->Get_Float(key, "GDIRVCx", mapConfiguration.CrateVehSpawnPos[1].X);
+		mapConfiguration.CrateVehSpawnPos[1].Y = SSGMIni->Get_Float(key, "GDIRVCy", mapConfiguration.CrateVehSpawnPos[1].Y);
+		mapConfiguration.CrateVehSpawnPos[1].Z = SSGMIni->Get_Float(key, "GDIRVCz", mapConfiguration.CrateVehSpawnPos[1].Z);
 	}
 	virtual void OnObjectCreate(void *data,GameObject *obj)
 	{
@@ -105,38 +133,34 @@
 			if (stristr(Commands->Get_Preset_Name(obj),"crate"))
 			{
 				Attach_Script_Once(obj,"SSGM_Crate","");
-				if (EnableNewCrates)
-				{
-					Remove_Script(obj,"M00_CNC_Crate");
-				}
 			}
 		}
 	}
 	virtual void OnLoadLevel()
 	{
-		if (EnableNewCrates)
+		if (mapConfiguration.EnableNewCrates)
 		{
-			int	Total = CrateUberWire + CrateHumanSilo + CrateAmmoRegen + CrateDeath + CrateVehicle + CrateWeapon + CrateCharacter + CrateMoney + CratePoints + CrateTiberium + CrateAmmo + CrateHealth + CrateArmor + CrateRefill + CrateButterFingers + CrateSpy + CrateThief + CrateBeacon + CrateStealth;
+			int	Total = mapConfiguration.CrateUberWire + mapConfiguration.CrateHumanSilo + mapConfiguration.CrateAmmoRegen + mapConfiguration.CrateDeath + mapConfiguration.CrateVehicle + mapConfiguration.CrateWeapon + mapConfiguration.CrateCharacter + mapConfiguration.CrateMoney + mapConfiguration.CratePoints + mapConfiguration.CrateTiberium + mapConfiguration.CrateAmmo + mapConfiguration.CrateHealth + mapConfiguration.CrateArmor + mapConfiguration.CrateRefill + mapConfiguration.CrateButterFingers + mapConfiguration.CrateSpy + mapConfiguration.CrateThief + mapConfiguration.CrateBeacon + mapConfiguration.CrateStealth;
 			if (Total != 100) {
-				CrateWeapon = 10;
-				CrateMoney = 10;
-				CratePoints = 10;
-				CrateVehicle = 8;
-				CrateDeath = 8;
-				CrateTiberium = 6;
-				CrateAmmo = 5;
-				CrateArmor = 5;
-				CrateHealth = 5;
-				CrateCharacter = 8;
-				CrateButterFingers = 3;
-				CrateSpy = 3;
-				CrateStealth = 3;
-				CrateRefill = 6;
-				CrateBeacon = 4;
-				CrateThief = 2;
-				CrateAmmoRegen = 2;
-				CrateHumanSilo = 1;
-				CrateUberWire = 1;
+				mapConfiguration.CrateWeapon = 10;
+				mapConfiguration.CrateMoney = 10;
+				mapConfiguration.CratePoints = 10;
+				mapConfiguration.CrateVehicle = 8;
+				mapConfiguration.CrateDeath = 8;
+				mapConfiguration.CrateTiberium = 6;
+				mapConfiguration.CrateAmmo = 5;
+				mapConfiguration.CrateArmor = 5;
+				mapConfiguration.CrateHealth = 5;
+				mapConfiguration.CrateCharacter = 8;
+				mapConfiguration.CrateButterFingers = 3;
+				mapConfiguration.CrateSpy = 3;
+				mapConfiguration.CrateStealth = 3;
+				mapConfiguration.CrateRefill = 6;
+				mapConfiguration.CrateBeacon = 4;
+				mapConfiguration.CrateThief = 2;
+				mapConfiguration.CrateAmmoRegen = 2;
+				mapConfiguration.CrateHumanSilo = 1;
+				mapConfiguration.CrateUberWire = 1;
 				StringClass msg;
 				msg.Format("Total crate percentages equal %d instead of 100. Using default percentages.",Total);
 				SSGMGameLog::Log_Message(msg,"_ERROR");
@@ -230,10 +254,10 @@
 	{
 		Vector3	pos	= Commands->Get_Position(obj);
 		SSGMGameLog::Log_Gamelog("CREATED;CRATE;%d;%s;%d;%d;%d;%d;%d;%d;%d", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), int(pos.Y),int(pos.X),int(pos.Z), int(Commands->Get_Facing(obj)), int(Commands->Get_Max_Health(obj)),int(Commands->Get_Max_Shield_Strength(obj)), int(Commands->Get_Player_Type(obj)));
-		if (!crate.EnableCrates) {
+		if (!crate.mapConfiguration.EnableCrates) {
 			Commands->Destroy_Object(obj);
 		}
-		else if (crate.EnableNewCrates) {
+		else if (crate.mapConfiguration.EnableNewCrates) {
 			if (crate.CrateExists || (The_Game()->Get_Game_Duration_S() - crate.CrateLastPickup) < 180)
 			{
 				Commands->Destroy_Object(obj);
@@ -254,7 +278,7 @@
 	void Custom(GameObject *obj,int type,int param,GameObject *sender)
 	{
 		if (type == CUSTOM_EVENT_POWERUP_GRANTED && !PickedUp) {
-			if (crate.VehCrate || !Get_Vehicle(sender)) {
+			if (crate.mapConfiguration.VehCrate || !Get_Vehicle(sender)) {
 				int Team = Get_Object_Type(sender);
 				if (Team > 1 || Team < 0) {
 					return;
@@ -271,7 +295,7 @@
 				CrateStart:
 				int RandomIntCrate = Commands->Get_Random_Int(1,101);
 				int	percent	= 0;
-				if ((RandomIntCrate	<= (percent+=crate.CrateWeapon)) && (crate.CrateWeapon > 0)) {
+				if ((RandomIntCrate	<= (percent+=crate.mapConfiguration.CrateWeapon)) && (crate.mapConfiguration.CrateWeapon > 0)) {
 					Reselect:
 					int	Rnd	= Commands->Get_Random_Int(1,101);
 					int	Index = 0;
@@ -300,12 +324,12 @@
 					if (RandomWeapon[Index][2][0] != '\0') {
 						Create_2D_WAV_Sound_Player(sender,RandomWeapon[Index][2]);
 					}
-					message1.Format("ppage %d [Crate] You just got a %s from the Random Weapon Crate.",Get_Player_ID(sender),RandomWeapon[Index][0]);
-					message2.Format("%ls picked up a Random Weapon Crate.",Get_Wide_Player_Name(sender));
+					message1.Format("ppage %d [Crate] You just got a %s from the Random Weapon crate.mapConfiguration.",Get_Player_ID(sender),RandomWeapon[Index][0]);
+					message2.Format("%ls picked up a Random Weapon crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 					Vector3 pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;WEAPON;%s;%d;%s;%f;%f;%f;%f;%f;%f;%d",RandomWeapon[Index][0],Commands->Get_ID(sender),Commands->Get_Preset_Name(sender),pos.Y,pos.X,pos.Z,Commands->Get_Facing(sender),Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateMoney))	&& (crate.CrateMoney	> 0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateMoney))	&& (crate.mapConfiguration.CrateMoney	> 0)) {
 					int	Amount = Commands->Get_Random_Int(1,1000);
 					int	RndGood	= Commands->Get_Random_Int(1,2);
 					if (RndGood	== 1) {
@@ -318,18 +342,18 @@
 					}
 					if (RndGood == 1) {
 						message1.Format("ppage %d [Crate] You just got the Money Crate, you have gained %d credits.",Get_Player_ID(sender),(int)Amount);
-						message2.Format("%ls picked up a Money Crate.",Get_Wide_Player_Name(sender));
+						message2.Format("%ls picked up a Money crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 						Vector3 pos = Commands->Get_Position(obj);
 						message3.Format("CRATE;MONEY;%d;%d;%s;%f;%f;%f;%f;%f;%f;%d", int(Amount),	Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z,	Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					}
 					else {
 						message1.Format("ppage %d [Crate] You just got the Demoney Crate, you have lost %d credits.",Get_Player_ID(sender),(int)Amount);
-						message2.Format("%ls picked up a Demoney Crate.",Get_Wide_Player_Name(sender));
+						message2.Format("%ls picked up a Demoney crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 						Vector3 pos = Commands->Get_Position(obj);
 						message3.Format("CRATE;MONEY;%d;%d;%s;%f;%f;%f;%f;%f;%f;%d", int(Amount) * -1, Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					}			
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CratePoints)) &&	(crate.CratePoints >	0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CratePoints)) &&	(crate.mapConfiguration.CratePoints >	0)) {
 					int	Amount = Commands->Get_Random_Int(1,500);
 					int	RndGood	= Commands->Get_Random_Int(1,2);
 					if (RndGood	== 1) {
@@ -340,7 +364,7 @@
 					}
 
 					if (RndGood == 1) {
-						message2.Format("%ls picked up a Points Crate.",Get_Wide_Player_Name(sender));
+						message2.Format("%ls picked up a Points crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 						message1.Format("ppage %d [Crate] You just got the Points Crate, you have gained %d points.",Get_Player_ID(sender),(int)Amount);
 						StringClass msg;
 						const char *str = Get_Team_Name(Team);
@@ -351,7 +375,7 @@
 						message3.Format("CRATE;POINTS;%d;%d;%s;%f;%f;%f;%f;%f;%f;%d",int(Amount), Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					}
 					else {
-						message2.Format("%ls picked up a Depoints Crate.",Get_Wide_Player_Name(sender));
+						message2.Format("%ls picked up a Depoints crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 						message1.Format("ppage %d [Crate] You just got the Depoints Crate, you lost %d points.",Get_Player_ID(sender),(int)Amount);
 						StringClass msg;
 						const char *str = Get_Team_Name(Team);
@@ -362,11 +386,11 @@
 						message3.Format("CRATE;POINTS;%d;%d;%s;%f;%f;%f;%f;%f;%f;%d",int(Amount)	* -1, Commands->Get_ID(sender),	Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender),	Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					}		
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateVehicle)) && (crate.CrateVehicle	> 0)) {
-					if (Get_Vehicle(sender) || crate.CrateVehSpawnPos[0].X == 0.0f || crate.CrateVehSpawnPos[0].Y == 0.0f || crate.CrateVehSpawnPos[0].Z == 0.0f || crate.CrateVehSpawnPos[1].X == 0.0f || crate.CrateVehSpawnPos[1].Y == 0.0f || crate.CrateVehSpawnPos[1].Z == 0.0f) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateVehicle)) && (crate.mapConfiguration.CrateVehicle	> 0)) {
+					if (Get_Vehicle(sender) || crate.mapConfiguration.CrateVehSpawnPos[0].X == 0.0f || crate.mapConfiguration.CrateVehSpawnPos[0].Y == 0.0f || crate.mapConfiguration.CrateVehSpawnPos[0].Z == 0.0f || crate.mapConfiguration.CrateVehSpawnPos[1].X == 0.0f || crate.mapConfiguration.CrateVehSpawnPos[1].Y == 0.0f || crate.mapConfiguration.CrateVehSpawnPos[1].Z == 0.0f) {
 						goto CrateStart;
 					}
-					Vector3	Pos = crate.CrateVehSpawnPos[Get_Object_Type(sender)];
+					Vector3	Pos = crate.mapConfiguration.CrateVehSpawnPos[Get_Object_Type(sender)];
 					Damage_All_Vehicles_Area(999999.0f,"Laser_NoBuilding",Pos,2.0f,obj,0);
 					Commands->Set_Position(sender,Pos);
 
@@ -387,10 +411,10 @@
 					else if	(Rnd <=	190) Index = 10;
 					else Index = 11;
 					if (IsPresetDisabled(Get_Definition_ID(RandomVehicle[Index][2]))) goto Reselect2;		
-					message2.Format("%ls picked up a Random Vehicle Crate.",Get_Wide_Player_Name(sender));
-					message1.Format("ppage %d [Crate] You got a %s from the Random Vehicle Crate.",Get_Player_ID(sender), RandomVehicle[Index][0]);
+					message2.Format("%ls picked up a Random Vehicle crate.mapConfiguration.",Get_Wide_Player_Name(sender));
+					message1.Format("ppage %d [Crate] You got a %s from the Random Vehicle crate.mapConfiguration.",Get_Player_ID(sender), RandomVehicle[Index][0]);
 					StringClass cine;
-					cine.Format("CRATE%s.txt",Commands->Get_Player_Type(sender)	== 0?"Nod":"GDI");
+					cine.Format("%scrate.mapConfiguration.txt",Commands->Get_Player_Type(sender)	== 0?"Nod":"GDI");
 					Commands->Attach_Script(Temp,"Test_Cinematic",cine);
 					GameObject *veh = Commands->Create_Object(RandomVehicle[Index][3],Vector3(0,0,0));
 					Commands->Send_Custom_Event(Temp,Temp,CUSTOM_EVENT_CINEMATIC_SET_FIRST_SLOT+4,Commands->Get_Preset_ID(veh),0);
@@ -402,8 +426,8 @@
 					Vector3 pos = Commands->Get_Position(sender);
 					message3.Format("CRATE;VEHICLE;%s;%d;%s;%f;%f;%f;%f;%f;%f;%d", RandomVehicle[Index][0], Commands->Get_ID(sender),	Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender),	Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateDeath))	&& (crate.CrateDeath	> 0)) {
-					message2.Format("%ls picked up a Death Crate.",Get_Wide_Player_Name(sender));
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateDeath))	&& (crate.mapConfiguration.CrateDeath	> 0)) {
+					message2.Format("%ls picked up a Death crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 					Commands->Apply_Damage(Get_Vehicle(sender),99999,"Shrapnel",0);
 					Commands->Apply_Damage(sender,99999,"Shrapnel",0);
 					Commands->Create_Explosion("Explosion_Mine_Proximity_01",Commands->Get_Position(obj),0);
@@ -417,8 +441,8 @@
 					pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;DEATH;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateTiberium)) && (crate.CrateTiberium >	0)) {
-					message2.Format("%ls picked up a Tiberium Death Crate.",Get_Wide_Player_Name(sender));
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateTiberium)) && (crate.mapConfiguration.CrateTiberium >	0)) {
+					message2.Format("%ls picked up a Tiberium Death crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 					Commands->Apply_Damage(Get_Vehicle(sender),99999,"Shrapnel",0);
 					Commands->Apply_Damage(sender,99999,"TiberiumRaw",false);
 					Commands->Create_Object("CnC_Visceroid",Commands->Get_Position(sender));
@@ -427,55 +451,55 @@
 					Vector3	pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;TIBERIUMDEATH;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateAmmo)) && (crate.CrateAmmo > 0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateAmmo)) && (crate.mapConfiguration.CrateAmmo > 0)) {
 					Commands->Give_PowerUp(sender,"CnC_POW_Ammo_ClipMax",false);
 					Commands->Give_PowerUp(sender,"CnC_POW_Ammo_ClipMax",false);
 					Commands->Give_PowerUp(sender,"CnC_POW_Ammo_ClipMax",false);
 					Commands->Give_PowerUp(sender,"CnC_POW_Ammo_ClipMax",false);
-					message2.Format("%ls picked up a Full Ammo Crate.",Get_Wide_Player_Name(sender));
+					message2.Format("%ls picked up a Full Ammo crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 					message1.Format("ppage %d [Crate] You just got the Full Ammo Crate, your ammo has been refilled.",Get_Player_ID(sender));
 					Create_2D_WAV_Sound_Player(sender,"m00puar_aqob0002i1evag_snd.wav");
 					Vector3	pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;FULLAMMO;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z,	Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateArmor)) && (crate.CrateArmor > 0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateArmor)) && (crate.mapConfiguration.CrateArmor > 0)) {
 					int	RndGood	= Commands->Get_Random_Int(1,3);
 					if (Commands->Get_Shield_Strength(sender) <	2) RndGood = 1;
 					if (RndGood	== 1) {
 						Commands->Give_PowerUp(sender,"POW_Medal_Armor",true);
-						message2.Format("%ls picked up an Armor Crate.",Get_Wide_Player_Name(sender));
+						message2.Format("%ls picked up an Armor crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 						message1.Format("ppage %d [Crate] You just got the Armor Crate, your max armor has been increased!",Get_Player_ID(sender));
 						Vector3	pos	= Commands->Get_Position(sender);
 						message3.Format("CRATE;ARMORINCREASE;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					}
 					else {
 						Commands->Set_Shield_Strength(sender,1);
-						message2.Format("%ls picked up a Dearmor Crate.",Get_Wide_Player_Name(sender));
+						message2.Format("%ls picked up a Dearmor crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 						message1.Format("ppage %d [Crate] You just got the Dearmor Crate, your armor has been set to 1.",Get_Player_ID(sender));
 						Vector3	pos	= Commands->Get_Position(sender);
 						message3.Format("CRATE;ARMORLOST;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					}
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateHealth)) &&	(crate.CrateHealth >	0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateHealth)) &&	(crate.mapConfiguration.CrateHealth >	0)) {
 					int	RndGood	= Commands->Get_Random_Int(1,3);
 					if (Commands->Get_Health(sender) ==	1) RndGood = 1;
 					if (RndGood	== 1) {
 						Commands->Give_PowerUp(sender,"POW_Medal_Health",true);
-						message2.Format("%ls picked up a Health Crate.",Get_Wide_Player_Name(sender));
+						message2.Format("%ls picked up a Health crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 						message1.Format("ppage %d [Crate] You just got the Health Crate, your max health has been increased!",Get_Player_ID(sender));
 						Vector3	pos	= Commands->Get_Position(sender);
 						message3.Format("CRATE;HEALTHUPGRADE;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					}
 					else {
 						Commands->Set_Health(sender,1);
-						message2.Format("%ls picked up a Dehealth Crate.",Get_Wide_Player_Name(sender));
+						message2.Format("%ls picked up a Dehealth crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 						message1.Format("ppage %d [Crate] You just got the Dehealth Crate, your health has been set to 1.",Get_Player_ID(sender));
 						Create_2D_WAV_Sound_Player(sender,"m00evag_dsgn0026i1evag_snd.wav");
 						Vector3 pos = Commands->Get_Position(sender);
 						message3.Format("CRATE;HEALTHREDUCE;;%d;%s;%f;%f;%f;%f;%f;%f;%d",	Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z,	Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					}
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateCharacter))	&& (crate.CrateCharacter	> 0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateCharacter))	&& (crate.mapConfiguration.CrateCharacter	> 0)) {
 					if (Get_Vehicle(sender)) {
 						goto CrateStart;
 					}
@@ -498,21 +522,21 @@
 					else if (Team == 0 && IsPresetDisabled(Get_Definition_ID(RandomNodChar[Index][1]))) {
 						goto Reselect3;
 					}
-					message2.Format("%ls picked up a Random Character Crate.",Get_Wide_Player_Name(sender));
+					message2.Format("%ls picked up a Random Character crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 					if (Commands->Get_Player_Type(sender) == 1) {
 						Change_Character(sender,RandomGDIChar[Index][1]);
-						message1.Format("ppage %d [Crate] You have been transformed into a %s by the Random Character Crate.",Get_Player_ID(sender),RandomGDIChar[Index][0]);
+						message1.Format("ppage %d [Crate] You have been transformed into a %s by the Random Character crate.mapConfiguration.",Get_Player_ID(sender),RandomGDIChar[Index][0]);
 						Vector3	pos	= Commands->Get_Position(sender);
 						message3.Format("CRATE;CHARACTER;%s;%d;%s;%f;%f;%f;%f;%f;%f;%d", RandomGDIChar[Index][0],	Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z,	Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					}
 					else {
 						Change_Character(sender,RandomNodChar[Index][1]);
-						message1.Format("ppage %d [Crate] You have been transformed into a %s by the Random Character Crate.",Get_Player_ID(sender),RandomNodChar[Index][0]);
+						message1.Format("ppage %d [Crate] You have been transformed into a %s by the Random Character crate.mapConfiguration.",Get_Player_ID(sender),RandomNodChar[Index][0]);
 						Vector3	pos	= Commands->Get_Position(sender);
 						message3.Format("CRATE;CHARACTER;%s;%d;%s;%f;%f;%f;%f;%f;%f;%d", RandomNodChar[Index][0],	Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z,	Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					}
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateButterFingers))	&& (crate.CrateButterFingers	> 0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateButterFingers))	&& (crate.mapConfiguration.CrateButterFingers	> 0)) {
 					Commands->Clear_Weapons(sender);
 					int	Rnd	= Commands->Get_Random_Int(1,3);
 					if (Rnd	== 1) {
@@ -523,26 +547,26 @@
 						Commands->Give_PowerUp(sender,"CnC_POW_MineTimed_Player_01",false);
 						Commands->Select_Weapon(sender,"CnC_Weapon_MineTimed_Player");
 					}
-					message2.Format("%ls picked up the Butter Fingers Crate.",Get_Wide_Player_Name(sender));
+					message2.Format("%ls picked up the Butter Fingers crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 					message1.Format("ppage %d [Crate] You picked up the Butter Fingers Crate, you have dropped most of your weapons.",Get_Player_ID(sender));
 					Vector3	pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;BUTTERFINGER;;%d;%s;%f;%f;%f;%f;%f;%f;%d",Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z,	Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateRefill)) &&	(crate.CrateRefill >	0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateRefill)) &&	(crate.mapConfiguration.CrateRefill >	0)) {
 					Grant_Refill(sender);
-					message2.Format("%ls picked up the Refill Crate.",Get_Wide_Player_Name(sender));
+					message2.Format("%ls picked up the Refill crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 					message1.Format("ppage %d [Crate] You just got the Refill Crate, your health, armor, and ammo have all been refilled.",Get_Player_ID(sender));
 					Create_2D_WAV_Sound_Player(sender,"m00puar_aqob0002i1evag_snd.wav");
 					Vector3	pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;REFILL;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender),	Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender),	Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateBeacon)) &&	(crate.CrateBeacon >	0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateBeacon)) &&	(crate.mapConfiguration.CrateBeacon >	0)) {
 					if (DisableBeacons) {
 						goto CrateStart;
 					}
 					int	RndGood	= Commands->Get_Random_Int(1,3);
 					if (RndGood	== 1) {
-						message2.Format("%ls picked up a Beacon Crate.",Get_Wide_Player_Name(sender));
+						message2.Format("%ls picked up a Beacon crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 						if (Commands->Get_Player_Type(sender) == 1) {
 							TeamPurchaseSettingsDefClass *PT = TeamPurchaseSettingsDefClass::Get_Definition(TeamPurchaseSettingsDefClass::TEAM_GDI);
 							Commands->Give_PowerUp(sender,Get_Definition_Name(PT->Get_Beacon_Definition()),true);
@@ -562,7 +586,7 @@
 						Commands->Create_Object("Beacon_Nuke_Strike_Anim_Post",Commands->Get_Position(obj));
 						Commands->Create_Explosion("Explosion_NukeBeacon",Commands->Get_Position(obj),0);
 						Damage_All_Objects_Area(2500.0f,"None",Commands->Get_Position(obj),15.0f,obj,0);
-						message2.Format("%ls picked up a Nuclear Bomb Crate.",Get_Wide_Player_Name(sender));
+						message2.Format("%ls picked up a Nuclear Bomb crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 						message1.Format("ppage %d [Crate] You just got a Nuclear Bomb Crate, you have been killed. Sorry :(",Get_Player_ID(sender));
 						StringClass msg;
 						const char *str = Get_Team_Name(Team);
@@ -573,11 +597,11 @@
 						message3.Format("CRATE;BEACONDEATH;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender),	pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					}
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateSpy)) && (crate.CrateSpy > 0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateSpy)) && (crate.mapConfiguration.CrateSpy > 0)) {
 					Change_Character(sender,"CnC_Nod_FlameThrower_2SF");
 					Commands->Set_Is_Visible(sender,false);
 					const char *str3 = Get_Team_Name(Team);
-					message2.Format("A %s player picked up a Spy Crate.",str3);
+					message2.Format("A %s player picked up a Spy crate.mapConfiguration.",str3);
 					delete[] str3;
 					message1.Format("ppage %d [Crate] You got the Spy Crate, base defenses will ignore you until you die, buy a new character or destroy a building.",Get_Player_ID(sender));
 					StringClass msg;
@@ -590,42 +614,42 @@
 					Vector3 pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;SPY;;0;0;%f;%f;%f;%f;%f;%f;%d",pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateStealth)) && (crate.CrateStealth	> 0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateStealth)) && (crate.mapConfiguration.CrateStealth	> 0)) {
 					Commands->Enable_Stealth(sender,true);
-					message2.Format("%ls picked up a Stealth Crate.",Get_Wide_Player_Name(sender));
+					message2.Format("%ls picked up a Stealth crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 					message1.Format("ppage %d [Crate] You got the stealth crate! You have been given a stealth suit.",Get_Player_ID(sender));
 					Vector3	pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;STEALTH;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender),	pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateThief))	&& (crate.CrateThief	> 0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateThief))	&& (crate.mapConfiguration.CrateThief	> 0)) {
 					Commands->Give_Money(sender,(Commands->Get_Money(sender) * -1),false);
-					message2.Format("%ls picked up a Thief Crate.",Get_Wide_Player_Name(sender));
+					message2.Format("%ls picked up a Thief crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 					message1.Format("ppage %d [Crate] You got the Thief Crate, you have lost all of your credits.",Get_Player_ID(sender));
 					Create_2D_Sound_Player(sender,"m00evag_dsgn0028i1evag_snd.wav");
 					Vector3	pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;THIEF;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateAmmoRegen))	&& (crate.CrateAmmoRegen	> 0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateAmmoRegen))	&& (crate.mapConfiguration.CrateAmmoRegen	> 0)) {
 					Commands->Send_Custom_Event(obj,sender,100100,1,1);//enable regeneration of ammo on player
-					message2.Format("%ls picked up a Ammo Regeneration Crate.",Get_Wide_Player_Name(sender));
+					message2.Format("%ls picked up a Ammo Regeneration crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 					message1.Format("ppage %d [Crate] You got the Ammo Reneration Crate, your ammo will be refilled every minute.",Get_Player_ID(sender));
 					Create_2D_Sound_Player(sender,"m00puar_aqob0002i1evag_snd.wav");//ammo regen sound
 					Vector3	pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;AMMOREGEN;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateHumanSilo))	&& (crate.CrateHumanSilo	> 0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateHumanSilo))	&& (crate.mapConfiguration.CrateHumanSilo	> 0)) {
 					int team = Commands->Get_Player_Type(sender);
 					Commands->Send_Custom_Event(obj,sender,100101,1,1);//enable generating of money on player
-					message2.Format("%ls picked up a Human Silo Crate.",Get_Wide_Player_Name(sender));
+					message2.Format("%ls picked up a Human Silo crate.mapConfiguration.",Get_Wide_Player_Name(sender));
 					message1.Format("ppage %d [Crate] You got the Human Silo Crate, your entier team will be granted an additional $1 credit a second until you die or change character.",Get_Player_ID(sender));
 					Create_2D_WAV_Sound_Team("m00pc$$_aqob0002i1evag_snd.wav",team);//credits acquired
 					Vector3	pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;HUMANSILO;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 				}
-				else if	((RandomIntCrate <=	(percent+=crate.CrateUberWire))	&& (crate.CrateUberWire	> 0)) {
+				else if	((RandomIntCrate <=	(percent+=crate.mapConfiguration.CrateUberWire))	&& (crate.mapConfiguration.CrateUberWire	> 0)) {
 					char ubermsg[250]; sprintf(ubermsg,"[CRATE] %s got the UberWire crate! Beware!",Get_Player_Name(sender)); Send_Message(255,255,255,ubermsg);
-					message2.Format("%ls picked up a UberWire Crate.",Get_Wide_Player_Name(sender));
-					message1.Format("ppage %d [Crate] You got the UberWire Crate.",Get_Player_ID(sender));
+					message2.Format("%ls picked up a UberWire crate.mapConfiguration.",Get_Wide_Player_Name(sender));
+					message1.Format("ppage %d [Crate] You got the UberWire crate.mapConfiguration.",Get_Player_ID(sender));
 					Vector3	pos	= Commands->Get_Position(sender);
 					message3.Format("CRATE;UBERWIRE;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
 					Change_Character(sender,"GDI_Engineer_2SF");
@@ -697,3 +721,17 @@
 
 ScriptRegistrant<SSGM_Prevent_Destruction_Until_Entered> SSGM_Prevent_Destruction_Until_Entered_Registrant("SSGM_Prevent_Destruction_Until_Entered","");
 ScriptRegistrant<SSGM_Crate> SSGM_Crate_Registrant("SSGM_Crate","");
+
+
+class SSGM_M00_CnC_Crate :
+	public ScriptImpClass
+{
+	void SSGM_M00_CnC_Crate::Custom(GameObject* obj, int type, int param, GameObject* sender)
+	{
+		if (type == CUSTOM_EVENT_POWERUP_GRANTED && sender && !crate.mapConfiguration.EnableNewCrates)
+		{
+			Commands->Give_Money(sender, 100, false);
+		}
+	}
+};
+ScriptRegistrant<SSGM_M00_CnC_Crate> M00_CnC_Crate_Registrant("M00_CnC_Crate","");
diff -uwr sourceold/makemix/makemix.cpp source/makemix/makemix.cpp
--- sourceold/makemix/makemix.cpp	2011-10-14 21:00:12.913085900 +0800
+++ source/makemix/makemix.cpp	2011-11-26 13:48:43.054687500 +0800
@@ -83,7 +83,7 @@
 	{
 		printf("makemix tool to generate a renegade mix file from a folder full of files");
 		printf("usage:\n");
-		printf("makemix filename folder\n");
+		printf("makemix folder filename\n");
 		printf("filename is the name of the mix file to create\n");
 		printf("folder is the path to the folder containing the files to add\n");
 		printf("The mix file will be created in the folder containing makemix.exe\n");
@@ -93,15 +93,31 @@
 	char path[MAX_PATH];
 	GetCurrentDirectory(MAX_PATH, path);
 	SetCurrentDirectory(argv[1]);
-	ParseFolder(argv[1],0);
+	StringClass bp;
+	if (argv[1][1] != ':')
+	{
+		bp.Format("%s\\%s",path,argv[1]);
+	}
+	else
+	{
+		bp = argv[1];
+	}
+	ParseFolder(bp,0);
 	qsort(&Filenames[0],Filenames.Count(),sizeof(FileStruct),File_Info_Compare);
 	StringClass mp;
+	if (argv[2][1] != ':')
+	{
 	mp.Format("%s\\%s",path,argv[2]);
+	}
+	else
+	{
+		mp = argv[2];
+	}
 	MixFileCreator mix(mp);
 	for (int i = 0;i < Filenames.Count();i++)
 	{
 		StringClass str;
-		str.Format("%s\\%s",argv[1],Filenames[i].filename);
+		str.Format("%s\\%s",bp,Filenames[i].filename);
 		mix.Add_File(str,Filenames[i].filename);
 	}
 	return 0;
diff -uwr sourceold/scripts/FileFactoryListClass.cpp source/scripts/FileFactoryListClass.cpp
--- sourceold/scripts/FileFactoryListClass.cpp	2011-10-11 23:04:17.790039000 +0800
+++ source/scripts/FileFactoryListClass.cpp	2011-11-23 11:19:35.956054600 +0800
@@ -80,7 +80,7 @@
 #pragma warning(disable: 4073) //warning C4073: initializers put in library initialization area - That's EXACTLY why I put that pragma in...
 #pragma init_seg(lib) // Move this files static initializers up a level
 #pragma warning(default: 4073)
-REF_DEF2(FileFactoryListClass::Instance, FileFactoryListClass *, 0x0085DB70, 0x0085CD58);
+REF_DEF3(FileFactoryListClass::Instance, FileFactoryListClass *, 0x0085DB70, 0x0085CD58, 0x0085CE48);
 #else
 FileFactoryListClass *FileFactoryListClass::Instance = 0;
 #endif
diff -uwr sourceold/scripts/FileFactoryListClass.h source/scripts/FileFactoryListClass.h
--- sourceold/scripts/FileFactoryListClass.h	2011-10-11 21:53:04.629882800 +0800
+++ source/scripts/FileFactoryListClass.h	2011-11-23 11:19:35.885742100 +0800
@@ -18,7 +18,7 @@
 class FileFactoryListClass : public FileFactoryClass
 {
 #if !defined(WWCONFIG) && !defined(PACKAGEEDITOR)
-	static REF_DECL2(Instance, FileFactoryListClass *);
+	static REF_DECL3(Instance, FileFactoryListClass *);
 #else
 	static FileFactoryListClass *Instance;
 #endif
diff -uwr sourceold/scripts/MixFileFactoryClass.cpp source/scripts/MixFileFactoryClass.cpp
--- sourceold/scripts/MixFileFactoryClass.cpp	2011-10-11 23:05:44.881835900 +0800
+++ source/scripts/MixFileFactoryClass.cpp	2011-11-23 11:13:31.482421800 +0800
@@ -16,7 +16,6 @@
 #include "Crc32.h"
 #include <algorithm>
 
-#ifndef TTLE_EXPORTS
 MixFileFactoryClass::MixFileFactoryClass
    (const char* filePath, FileFactoryClass *parentFileFactory) : FileFactoryClass(), Factory(0), UnkOffset(0), FileCount(0), MixFilenameOffset(0), IsValid(false), FileAdded(false)
 {
@@ -137,7 +136,6 @@
 		Factory->Return_File(f);
 	}
 }
-#endif
 SimpleFileFactoryClass SimpleFileFactory;
 
 MixFileCreator::MixFileCreator(const char *name)
Only in source/scripts: ScriptManager.h
diff -uwr sourceold/scripts/Vector3.h source/scripts/Vector3.h
--- sourceold/scripts/Vector3.h	2011-10-11 21:41:06.523437500 +0800
+++ source/scripts/Vector3.h	2011-11-22 14:49:49.197265600 +0800
@@ -72,15 +72,12 @@
 	}
 	TT_INLINE void Normalize()
 	{
-		float len2 = Length2();
-		if (len2 != 0.0f)
-		{
+		float len2 = WWMATH_FLOAT_TINY + Length2();
 			float oolen = WWMath::Inv_Sqrt(len2);
 			X *= oolen;
 			Y *= oolen;
 			Z *= oolen;
 		}
-	}
 	TT_INLINE float Length() const
 	{
 		return WWMath::Sqrt(Length2());
@@ -386,13 +383,8 @@
 }
 TT_INLINE Vector3 Normalize(const Vector3 &vec)
 {
-	float len2 = vec.Length2();
-	if (len2 != 0.0f)
-	{
-		float oolen = WWMath::Inv_Sqrt(len2);
-		return vec * oolen;
-	}
-	return vec;
+	float len2 = WWMATH_FLOAT_TINY + vec.Length2();
+	return vec * WWMath::Inv_Sqrt(len2);
 }
 TT_INLINE void Swap(Vector3 &a,Vector3 &b)
 {
diff -uwr sourceold/scripts/WeaponClass.h source/scripts/WeaponClass.h
--- sourceold/scripts/WeaponClass.h	2011-10-11 21:40:34.213867100 +0800
+++ source/scripts/WeaponClass.h	2011-11-22 14:49:49.184570300 +0800
@@ -101,8 +101,8 @@
 	float				Get_Recoil_Scale( void )	{ return Definition->RecoilScale; }
 	void				Set_Total_Rounds( int num );
 	int				Get_Total_Rounds( void );
-	void Import_Ammo_Info(int ammoInfo);
-	int Export_Ammo_Info();
+	void Import_Ammo_Info(int16 ammoInfo);
+	int16 Export_Ammo_Info();
 	void				Add_Rounds( int num );
 	void				Add_Rounds_Client( int num );
 	void				Set_Clip_Rounds( int rounds );
diff -uwr sourceold/scripts/anticheat.ini source/scripts/anticheat.ini
--- sourceold/scripts/anticheat.ini	2011-10-09 21:43:06.337890600 +0800
+++ source/scripts/anticheat.ini	2011-12-05 15:24:43.332539100 +0800
@@ -48,3 +48,6 @@
 0f43be4f2fecf73539d5b72217d05804=M08.mix
 d36d8b57f2919c12688355179542ed96=hud_sniper.dds
 352af7c3b9673ae59ba5ff430a6c036c=stealth_effect.dds
+cbc396725a03305b6b6f5ce7ea699b17=always3.dat
+fc9931e6588e44d620ba233caf4004c8=mnatr_mct.w3d
+5bc57e1d26b07fd553a703c18616f405=mnatr_mct.w3d
Only in sourceold/scripts: d3dx9.h
diff -uwr sourceold/scripts/dp88_ar.cpp source/scripts/dp88_ar.cpp
--- sourceold/scripts/dp88_ar.cpp	2011-10-25 07:50:47.750976500 +0800
+++ source/scripts/dp88_ar.cpp	2011-12-01 12:13:35.659179600 +0800
@@ -1805,14 +1805,40 @@
 	if ( m_nChargeTime > 0 )
 	{
 		Commands->Start_Timer( obj, this, 1.0f, TIMER_REMOTECONTROL_CHARGETICK);
-		Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
+		animstate = 0;
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
 	}
 	else
-		Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
+	{
+		animstate = 1;
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
+	}
 
 	Commands->Enable_HUD_Pokable_Indicator(obj, (m_nChargeTime == 0));
 }
 
+void dp88_RemoteControlConsole::Animation_Complete ( GameObject *obj, const char *animation_name )
+{
+	switch(animstate)
+	{
+	case 0:
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
+		break;
+	case 1:
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
+		break;
+	case 2:
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameActive1"), (float)Get_Int_Parameter("animFrameActive2"), false );
+		break;
+	case 3:
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameDisabled1"), (float)Get_Int_Parameter("animFrameDisabled2"), false );
+		break;
+	case 4:
+		Commands->Set_Animation(obj, Get_Parameter("animFrameIdle1"), false, NULL, (float)Get_Int_Parameter("animFrameIdle2"), (float)Get_Int_Parameter("animFrameActive2"), false );
+		break;
+	}
+}
+
 void dp88_RemoteControlConsole::Poked ( GameObject *obj, GameObject *poker )
 {
 	//Console_Output ( "[%d:%s:%s] Poked\n", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), this->Get_Name() );
@@ -1957,10 +1983,14 @@
 			if ( m_nChargeTime > 0 )
 			{
 				Commands->Start_Timer( obj, this, 1.0f, TIMER_REMOTECONTROL_CHARGETICK);
-				Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
+				animstate = 0;
+				Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
 			}
 			else
-				Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
+			{
+				animstate = 1;
+				Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
+			}
 		}
 
 		Commands->Enable_HUD_Pokable_Indicator(obj, (m_bEnabled && m_nChargeTime == 0));
@@ -2015,7 +2045,8 @@
 			Create_2D_Sound_Player(pilot, Get_Parameter("connectionEstablishedSound") );
 
 			// Set animation frame
-			Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameActive1"), (float)Get_Int_Parameter("animFrameActive2"), false );
+			animstate = 2;
+			Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameActive1"), (float)Get_Int_Parameter("animFrameActive2"), false );
 		}
 		else	// This should never actually happen... but just in case...
 		{
@@ -2047,7 +2078,8 @@
 				Commands->Start_Timer( obj, this, 1.0f, TIMER_REMOTECONTROL_CHARGETICK);
 			else
 			{
-				Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
+				animstate = 1;
+				Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
 				Commands->Enable_HUD_Pokable_Indicator(obj, true);
 			}
 		}
@@ -2078,14 +2110,21 @@
 
 	// Update the animation frame state
 	if ( !m_bEnabled )
-		Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameDisabled1"), (float)Get_Int_Parameter("animFrameDisabled2"), false );
+	{
+		animstate = 3;
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameDisabled1"), (float)Get_Int_Parameter("animFrameDisabled2"), false );
+	}
 	else if ( m_nChargeTime > 0 )
 	{
 		Commands->Start_Timer( obj, this, 1.0f, TIMER_REMOTECONTROL_CHARGETICK);
-		Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
+		animstate = 0;
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
 	}
 	else
-		Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
+	{
+		animstate = 1;
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
+	}
 }
 
 void dp88_RemoteControlConsole::CreateDummy ( GameObject* pilot, Vector3 position, float facing )
@@ -2149,16 +2188,26 @@
 
 	// Set animation frame
 	if ( !m_bEnabled )
-		Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameDisabled1"), (float)Get_Int_Parameter("animFrameDisabled2"), false );
+	{
+		animstate = 3;
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameDisabled1"), (float)Get_Int_Parameter("animFrameDisabled2"), false );
+	}
 	else if ( vehicle )
-		Commands->Set_Animation(obj, Get_Parameter("animFrameIdle1"), true, NULL, (float)Get_Int_Parameter("animFrameIdle2"), (float)Get_Int_Parameter("animFrameActive2"), false );
+	{
+		animstate = 4;
+		Commands->Set_Animation(obj, Get_Parameter("animFrameIdle1"), false, NULL, (float)Get_Int_Parameter("animFrameIdle2"), (float)Get_Int_Parameter("animFrameActive2"), false );
+	}
 	else if ( m_nChargeTime > 0 )
 	{
 		Commands->Start_Timer( obj, this, 1.0f, TIMER_REMOTECONTROL_CHARGETICK);
-		Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
+		animstate = 0;
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameCharging1"), (float)Get_Int_Parameter("animFrameCharging2"), false );
 	}
 	else
-		Commands->Set_Animation(obj, Get_Parameter("animationName"), true, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
+	{
+		animstate = 1;
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)Get_Int_Parameter("animFrameAvailable1"), (float)Get_Int_Parameter("animFrameAvailable2"), false );
+	}
 }
 
 
diff -uwr sourceold/scripts/dp88_ar.h source/scripts/dp88_ar.h
--- sourceold/scripts/dp88_ar.h	2011-10-25 07:50:47.747070300 +0800
+++ source/scripts/dp88_ar.h	2011-12-01 12:10:36.260742100 +0800
@@ -389,6 +389,7 @@
 	void Custom( GameObject *obj, int type, int param, GameObject *sender );
 	void Timer_Expired( GameObject *obj, int number );
 	void SetEnabled ( GameObject* obj, bool state );
+	void Animation_Complete ( GameObject *obj, const char *animation_name );
 
 	int vehicleID;
 	int pilotID;
@@ -396,6 +397,7 @@
 	Vector3 pilotDummyPos;
 	bool m_bEnabled;
 	int m_nChargeTime;
+	int animstate;
 
 	void CreateDummy ( GameObject* pilot, Vector3 position, float facing );
 	void DestroyDummy();
diff -uwr sourceold/scripts/dp88_buildingScripts.cpp source/scripts/dp88_buildingScripts.cpp
--- sourceold/scripts/dp88_buildingScripts.cpp	2011-10-25 15:38:28.234375000 +0800
+++ source/scripts/dp88_buildingScripts.cpp	2011-12-01 12:48:42.641601500 +0800
@@ -547,6 +547,18 @@
 Base Class For Generic Weakpoints
 --------------------------*/
 
+void MinorWeakpointScriptClass::Animation_Complete ( GameObject *obj, const char *animation_name )
+{
+	if (animstate == 0 && Get_Int_Parameter("animLoop"))
+	{
+		Commands->Set_Animation ( obj, Get_Parameter("animName"), false, NULL, (float)Get_Int_Parameter("animStartFrame"), (float)Get_Int_Parameter("animEndFrame"), false );
+	}
+	if (animstate == 1 && Get_Int_Parameter("destroyedAnimLoop"))
+	{
+		Commands->Set_Animation ( obj, Get_Parameter("destroyedAnimName"), false, NULL, (float)Get_Int_Parameter("destroyedAnimStartFrame"), (float)Get_Int_Parameter("destroyedAnimEndFrame"), false );
+	}
+}
+
 void MinorWeakpointScriptClass::Created ( GameObject *obj )
 {
 	// Set variables
@@ -564,8 +576,8 @@
 		// Set animation
 		if ( strlen(Get_Parameter("animName")) > 0 )
 		{
-			bool loop = ( Get_Int_Parameter("animLoop") > 0 ) ? true : false;
-			Commands->Set_Animation ( obj, Get_Parameter("animName"), loop, NULL, (float)Get_Int_Parameter("animStartFrame"), (float)Get_Int_Parameter("animEndFrame"), false );
+			animstate = 0;
+			Commands->Set_Animation ( obj, Get_Parameter("animName"), false, NULL, (float)Get_Int_Parameter("animStartFrame"), (float)Get_Int_Parameter("animEndFrame"), false );
 		}
 	}
 	else
@@ -594,8 +606,8 @@
 		// Set animation
 		if ( strlen(Get_Parameter("destroyedAnimName")) > 0 )
 		{
-			bool loop = ( Get_Int_Parameter("destroyedAnimLoop") > 0 ) ? true : false;
-			Commands->Set_Animation ( obj, Get_Parameter("destroyedAnimName"), loop, NULL, (float)Get_Int_Parameter("destroyedAnimStartFrame"), (float)Get_Int_Parameter("destroyedAnimEndFrame"), false );
+			animstate = 1;
+			Commands->Set_Animation ( obj, Get_Parameter("destroyedAnimName"), false, NULL, (float)Get_Int_Parameter("destroyedAnimStartFrame"), (float)Get_Int_Parameter("destroyedAnimEndFrame"), false );
 		}
 	}
 
@@ -616,8 +628,8 @@
 		// Set animation
 		if ( strlen(Get_Parameter("animName")) > 0 )
 		{
-			bool loop = ( Get_Int_Parameter("animLoop") > 0 ) ? true : false;
-			Commands->Set_Animation ( obj, Get_Parameter("animName"), loop, NULL, (float)Get_Int_Parameter("animStartFrame"), (float)Get_Int_Parameter("animEndFrame"), false );
+			animstate = 0;
+			Commands->Set_Animation ( obj, Get_Parameter("animName"), false, NULL, (float)Get_Int_Parameter("animStartFrame"), (float)Get_Int_Parameter("animEndFrame"), false );
 		}
 	}
 }
diff -uwr sourceold/scripts/dp88_buildingScripts.h source/scripts/dp88_buildingScripts.h
--- sourceold/scripts/dp88_buildingScripts.h	2011-10-22 18:09:56.484375000 +0800
+++ source/scripts/dp88_buildingScripts.h	2011-12-01 12:29:48.027343700 +0800
@@ -117,6 +117,7 @@
 	void Damaged ( GameObject *obj, GameObject *damager, float amount );
 	void Killed( GameObject *obj, GameObject *killer );
 	void Custom( GameObject *obj, int type, int param, GameObject *sender );
+	void Animation_Complete ( GameObject *obj, const char *animation_name );
 
 	// ID of the building controller we belong to
 	int parentId;
@@ -124,6 +125,7 @@
 	// We use this to remember when we are in the destroyed state, so we know
 	// that when we next reach 100% health we need to trigger the repaired event
 	bool isDestroyed;
+	int animstate;
 
 	// Abstract functions
 	virtual void applyEffect ( GameObject *obj, GameObject *parent ) = 0;
diff -uwr sourceold/scripts/dp88_misc.cpp source/scripts/dp88_misc.cpp
--- sourceold/scripts/dp88_misc.cpp	2011-10-11 23:03:39.628906200 +0800
+++ source/scripts/dp88_misc.cpp	2011-12-01 11:52:12.948242100 +0800
@@ -642,6 +642,14 @@
 	}
 }
 
+void dp88_damageAnimation::Animation_Complete ( GameObject *obj, const char *animation_name )
+{
+	if (loopAnimation)
+	{
+		SetDamageAnimation(obj);
+	}
+}
+
 void dp88_damageAnimation::Damaged( GameObject *obj, GameObject *damager, float amount )
 {
 	if ( amount >= 0 )
@@ -686,9 +694,9 @@
 void dp88_damageAnimation::SetDamageAnimation ( GameObject* obj )
 {
 	if ( basePowerState || damageLevelLowPowerStartFrames[currentDamageLevel] < 0 )
-		Commands->Set_Animation(obj, Get_Parameter("animationName"), loopAnimation, NULL, (float)damageLevelStartFrames[currentDamageLevel], (float)damageLevelEndFrames[currentDamageLevel], false );
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)damageLevelStartFrames[currentDamageLevel], (float)damageLevelEndFrames[currentDamageLevel], false );
 	else
-		Commands->Set_Animation(obj, Get_Parameter("animationName"), loopAnimation, NULL, (float)damageLevelLowPowerStartFrames[currentDamageLevel], (float)damageLevelLowPowerEndFrames[currentDamageLevel], false );
+		Commands->Set_Animation(obj, Get_Parameter("animationName"), false, NULL, (float)damageLevelLowPowerStartFrames[currentDamageLevel], (float)damageLevelLowPowerEndFrames[currentDamageLevel], false );
 }
 
 
diff -uwr sourceold/scripts/dp88_misc.h source/scripts/dp88_misc.h
--- sourceold/scripts/dp88_misc.h	2011-10-14 22:27:32.112304600 +0800
+++ source/scripts/dp88_misc.h	2011-12-01 11:52:12.871093700 +0800
@@ -113,6 +113,7 @@
 	void Created ( GameObject* obj );
 	void Damaged( GameObject *obj, GameObject *damager, float amount );
 	void Timer_Expired ( GameObject* obj, int number );
+	void Animation_Complete ( GameObject *obj, const char *animation_name );
 
 	void SetDamageAnimation ( GameObject* obj );
 
diff -uwr sourceold/scripts/engine_3dre.h source/scripts/engine_3dre.h
--- sourceold/scripts/engine_3dre.h	2011-10-11 21:54:26.711914000 +0800
+++ source/scripts/engine_3dre.h	2011-11-07 15:17:05.800781200 +0800
@@ -36,6 +36,8 @@
 class FontCharsClass;
 class RenderInfoClass;
 
+#define FOURCC_INTZ ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z')))
+
 enum WW3DFormat {
 	WW3D_FORMAT_UNKNOWN = 0x0,
 	WW3D_FORMAT_R8G8B8 = 0x1,
@@ -76,6 +78,8 @@
 	WW3D_FORMAT_R32F,
 	WW3D_FORMAT_GR32F,
 	WW3D_FORMAT_ABGR32F,
+	// Vendor hack formats
+	WW3D_FORMAT_INTZ,
 
 	WW3D_FORMAT_COUNT,
 };
@@ -94,6 +98,7 @@
 	case WW3D_FORMAT_X8L8V8U8:
 	case WW3D_FORMAT_R32F:	
 	case WW3D_FORMAT_GR16F:
+	case WW3D_FORMAT_INTZ:
 		return 4;
 	case WW3D_FORMAT_R8G8B8:
 		return 3;
@@ -141,6 +146,7 @@
 	static bool SupportDXTC; // is DXTC supported
 	static bool SupportTextureFormat[WW3D_FORMAT_COUNT]; // texture format support
 	static bool SupportGamma;
+	static bool SupportINTZ; // is native depth buffer access supported
 };
 
 enum ShaderShiftConstants
@@ -507,7 +513,7 @@
 	TextureMapperClass(TextureMapperClass& src);
 	TextureMapperClass(unsigned int stage=0);
 	TextureMapperClass(INIClass& ini,char* section,unsigned int stage);
-	SHADERS_API void Set_Shader(const char* shader_name, ProgrammableShader* shader);
+	SHADERS_API void Set_Shader(const char* shader_name, ProgrammableShader* shader = nullptr);
 	ProgrammableShader *Peek_Shader()
 	{
 		return Shader;
diff -uwr sourceold/scripts/engine_tt.cpp source/scripts/engine_tt.cpp
--- sourceold/scripts/engine_tt.cpp	2011-10-20 22:43:20.420898400 +0800
+++ source/scripts/engine_tt.cpp	2011-11-07 20:07:04.130859300 +0800
@@ -27,6 +27,7 @@
 #include "VehicleFactoryGameObj.h"
 #include "VehicleFactoryGameObjDef.h"
 #include "AirFactoryGameObj.h"
+#include "Iterator.h"
 class WideStringClass;
 
 
@@ -816,6 +817,22 @@
 
 SCRIPTS_API REF_DEF2(ConsoleFunctionList,DynamicVectorClass<ConsoleFunctionClass *>,0x0081DEB8,0x0081D098);
 
+SCRIPTS_API void Delete_Console_Function(const char *name)
+{
+	const DynamicVectorClass<ConsoleFunctionClass*> consoleFunctions(ConsoleFunctionList);
+	TT_FOREACH(consoleFunction, consoleFunctions)
+	{
+		const char* fname = (*consoleFunction)->Get_Name();
+		if (fname)
+		{
+			if (strcmp(fname,name) == 0)
+			{
+				ConsoleFunctionList.Delete(consoleFunction);
+			}
+		}
+	}
+}
+
 RENEGADE_FUNCTION
 SCRIPTS_API void Sort_Function_List()
 AT2(0x004282F0,0x00428470);
diff -uwr sourceold/scripts/engine_tt.h source/scripts/engine_tt.h
--- sourceold/scripts/engine_tt.h	2011-10-11 21:53:26.168945300 +0800
+++ source/scripts/engine_tt.h	2011-11-07 20:07:04.007812500 +0800
@@ -347,5 +347,6 @@
 SCRIPTS_API void SendShaderParamObjPlayer(GameObject* player, const char* parameter, Vector3 value, GameObject* object);
 SCRIPTS_API void SendShaderParamObjPlayer(GameObject* player, const char* parameter, Vector4 value, GameObject* object);
 SCRIPTS_API extern REF_DECL2(ConsoleFunctionList,DynamicVectorClass<ConsoleFunctionClass *>);
+SCRIPTS_API void Delete_Console_Function(const char *name);
 SCRIPTS_API void Sort_Function_List();
 SCRIPTS_API void Verbose_Help_File();
diff -uwr sourceold/scripts/engine_vector.h source/scripts/engine_vector.h
--- sourceold/scripts/engine_vector.h	2011-10-12 09:16:51.028320300 +0800
+++ source/scripts/engine_vector.h	2011-11-28 09:12:59.829890600 +0800
@@ -686,6 +686,15 @@
 		}
 		return true;
 	}
+
+	void Uninitialized_Resize(int newsize)
+	{
+		assert(newsize > 0);
+		delete[] Vector;
+		Vector = new T[newsize];
+		VectorMax = newsize;
+	}
+
 	int Length() const
 	{
 		return VectorMax;
diff -uwr sourceold/scripts/gmgame.cpp source/scripts/gmgame.cpp
--- sourceold/scripts/gmgame.cpp	2011-10-14 21:29:00.915039000 +0800
+++ source/scripts/gmgame.cpp	2011-11-07 20:41:54.807617100 +0800
@@ -28,6 +28,7 @@
 #include "gmlog.h"
 #include "GameObjManager.h"
 #include "C4GameObj.h"
+#include "ScriptManager.h"
 
 SimpleDynVecClass<Plugin *> RegisteredEvents[EVENT_COUNT];
 SimpleDynVecClass<Plugin *> Plugins;
@@ -402,6 +403,7 @@
 			{
 				deleteobservers[i]->Destroy_Script();
 			}
+			ScriptManager::Destroy_Pending();
 		}
 		Attach_Script_Once(obj,"SSGM_Soldier","");
 	}
Only in source/scripts: iran_scripts.cpp
Only in source/scripts: iran_scripts.h
diff -uwr sourceold/scripts/jfwcust.cpp source/scripts/jfwcust.cpp
--- sourceold/scripts/jfwcust.cpp	2011-10-11 23:05:21.089843700 +0800
+++ source/scripts/jfwcust.cpp	2011-12-01 12:26:58.960937500 +0800
@@ -485,7 +485,7 @@
 			{
 				firstframe = Get_Animation_Frame(obj);
 			}
-			Commands->Set_Animation(obj,Get_Parameter("Animation"),true,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+			Commands->Set_Animation(obj,Get_Parameter("Animation"),true,subobject,firstframe,-1,Get_Int_Parameter("Blended"));
 		}
 	}
 	if (type == Get_Int_Parameter("Disable"))
diff -uwr sourceold/scripts/jfwpow.cpp source/scripts/jfwpow.cpp
--- sourceold/scripts/jfwpow.cpp	2011-10-11 23:05:01.913085900 +0800
+++ source/scripts/jfwpow.cpp	2011-12-01 12:52:17.931640600 +0800
@@ -111,6 +111,21 @@
 	}
 }
 
+void JFW_Change_Character_Powerup_2::Custom(GameObject *obj,int type,int param,GameObject *sender)
+{
+	if (type == CUSTOM_EVENT_POWERUP_GRANTED)
+	{
+		if (Commands->Get_Player_Type(sender) == 0)
+		{
+			Change_Character(sender,Get_Parameter("Nod_Preset"));
+		}
+		else if (Commands->Get_Player_Type(sender) == 1)
+		{
+			Change_Character(sender,Get_Parameter("GDI_Preset"));
+		}
+	}
+}
+
 void JFW_Clear_Money_Create::Created(GameObject *obj)
 {
 	Commands->Give_Money(obj,-Commands->Get_Money(obj),false);
@@ -141,4 +156,5 @@
 ScriptRegistrant<JFW_Powerup_Send_Custom> JFW_Powerup_Send_Custom_Registrant("JFW_Powerup_Send_Custom","ID:int,Message:int");
 ScriptRegistrant<JFW_Powerup_Send_Custom_Team> JFW_Powerup_Send_Custom_Team_Registrant("JFW_Powerup_Send_Custom_Team","GDIID:int,GDIMessage:int,NodID:int,NodMessage:int");
 ScriptRegistrant<JFW_Change_Character_Powerup> JFW_Change_Character_Powerup_Registrant("JFW_Change_Character_Powerup","Preset:string");
+ScriptRegistrant<JFW_Change_Character_Powerup_2> JFW_Change_Character_Powerup_2_Registrant("JFW_Change_Character_Powerup_2","GDI_Preset:string,Nod_Preset:string");
 ScriptRegistrant<JFW_Soldier_Powerup> JFW_Soldier_Powerup_Registrant("JFW_Soldier_Powerup","Message:int");
diff -uwr sourceold/scripts/jfwpow.h source/scripts/jfwpow.h
--- sourceold/scripts/jfwpow.h	2011-10-14 22:27:32.207031200 +0800
+++ source/scripts/jfwpow.h	2011-11-07 21:25:39.128906200 +0800
@@ -55,6 +55,10 @@
 	void Custom(GameObject *obj,int type,int param,GameObject *sender);
 };
 
+class JFW_Change_Character_Powerup_2 : public ScriptImpClass {
+	void Custom(GameObject *obj,int type,int param,GameObject *sender);
+};
+
 class JFW_Give_Money : public ScriptImpClass {
 	void Custom(GameObject *obj,int type,int param,GameObject *sender);
 };
diff -uwr sourceold/scripts/jfwveh.cpp source/scripts/jfwveh.cpp
--- sourceold/scripts/jfwveh.cpp	2011-10-11 23:05:04.906250000 +0800
+++ source/scripts/jfwveh.cpp	2011-12-01 12:47:58.142578100 +0800
@@ -129,7 +129,7 @@
 			{
 				firstframe = Get_Animation_Frame(obj);
 			}
-			Commands->Set_Animation(obj,Get_Parameter("Animation"),true,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+			Commands->Set_Animation(obj,Get_Parameter("Animation"),false,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
 		}
 	}
 	else 
@@ -140,6 +140,24 @@
 	Commands->Start_Timer(obj,this,Get_Float_Parameter("Time"),Get_Int_Parameter("TimerNum"));
 }
 
+void JFW_Vechicle_Animation::Animation_Complete ( GameObject *obj, const char *animation_name )
+{
+	if (!_stricmp(animation_name,Get_Parameter("Animation")))
+	{
+		const char *subobject = Get_Parameter("Subobject");
+		if (!_stricmp(subobject,"0"))
+		{
+			subobject = 0;
+		}
+		float firstframe = Get_Float_Parameter("FirstFrame");
+		if (firstframe == -1)
+		{
+			firstframe = Get_Animation_Frame(obj);
+		}
+		Commands->Set_Animation(obj,Get_Parameter("Animation"),false,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+	}
+}
+
 void JFW_Vechicle_Animation::Created(GameObject *obj)
 {
 	xpos = 0;
@@ -176,7 +194,7 @@
 		{
 			firstframe = Get_Animation_Frame(obj);
 		}
-		Commands->Set_Animation(object,Get_Parameter("Animation"),true,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+		Commands->Set_Animation(object,Get_Parameter("Animation"),false,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
 	}
 	if (type == CUSTOM_EVENT_VEHICLE_EXITED)
 	{
@@ -224,7 +242,7 @@
 			{
 				firstframe = Get_Animation_Frame(obj);
 			}
-			Commands->Set_Animation(object,Get_Parameter("Animation1"),true,subobject,firstframe,Get_Float_Parameter("LastFrame1"),Get_Int_Parameter("Blended1"));
+			Commands->Set_Animation(object,Get_Parameter("Animation1"),false,subobject,firstframe,Get_Float_Parameter("LastFrame1"),Get_Int_Parameter("Blended1"));
 		}
 		else
 		{
@@ -245,7 +263,7 @@
 				{
 					firstframe = Get_Animation_Frame(obj);
 				}
-				Commands->Set_Animation(object,Get_Parameter("Animation2"),true,subobject,firstframe,Get_Float_Parameter("LastFrame2"),Get_Int_Parameter("Blended2"));
+				Commands->Set_Animation(object,Get_Parameter("Animation2"),false,subobject,firstframe,Get_Float_Parameter("LastFrame2"),Get_Int_Parameter("Blended2"));
 			}
 		}
 	}
@@ -415,7 +433,7 @@
 		{
 			firstframe = Get_Animation_Frame(obj);
 		}
-		Commands->Set_Animation(object,Get_Parameter("Animation"),true,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+		Commands->Set_Animation(object,Get_Parameter("Animation"),false,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
 	}
 }
 
@@ -478,7 +496,7 @@
 
 void JFW_Vechicle_Animation_2::Animation_Complete(GameObject *obj,const char *animation_name)
 {
-	if (!_stricmp(animation_name,Get_Parameter("UpAnimation")))
+	if (!_stricmp(animation_name,Get_Parameter("UpAnimation")) || !_stricmp(animation_name,Get_Parameter("Animation")))
 	{
 		const char *subobject = Get_Parameter("Subobject");
 		if (!_stricmp(subobject,"0"))
@@ -488,9 +506,9 @@
 		float firstframe = Get_Float_Parameter("FirstFrame");
 		if (firstframe == -1)
 		{
-			firstframe = Get_Animation_Frame(obj);
+			firstframe = Get_Animation_Frame(Commands->Find_Object(ID));
 		}
-		Commands->Set_Animation(obj,Get_Parameter("Animation"),true,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+		Commands->Set_Animation(Commands->Find_Object(ID),Get_Parameter("Animation"),false,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
 	}
 }
 
@@ -555,7 +573,7 @@
 			{
 				firstframe = Get_Animation_Frame(obj);
 			}
-			Commands->Set_Animation(obj,Get_Parameter("Animation"),true,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+			Commands->Set_Animation(obj,Get_Parameter("Animation"),false,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
 		}
 	}
 	else 
@@ -566,6 +584,24 @@
 	Commands->Start_Timer(obj,this,Get_Float_Parameter("Time"),Get_Int_Parameter("TimerNum"));
 }
 
+void JFW_Vechicle_Animation_Trigger::Animation_Complete ( GameObject *obj, const char *animation_name )
+{
+	if (!_stricmp(animation_name,Get_Parameter("Animation")))
+	{
+		const char *subobject = Get_Parameter("Subobject");
+		if (!_stricmp(subobject,"0"))
+		{
+			subobject = 0;
+		}
+		float firstframe = Get_Float_Parameter("FirstFrame");
+		if (firstframe == -1)
+		{
+			firstframe = Get_Animation_Frame(obj);
+		}
+		Commands->Set_Animation(obj,Get_Parameter("Animation"),false,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+	}
+}
+
 void JFW_Vechicle_Animation_Trigger::Created(GameObject *obj)
 {
 	xpos = 0;
@@ -766,7 +802,7 @@
 			{
 				firstframe = Get_Animation_Frame(obj);
 			}
-			Commands->Set_Animation(obj,Get_Parameter("Animation"),true,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+			Commands->Set_Animation(obj,Get_Parameter("Animation"),false,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
 		}
 	}
 	if (type == CUSTOM_EVENT_VEHICLE_EXITED)
@@ -780,6 +816,24 @@
 	}
 }
 
+void JFW_Vehicle_Effect_Animation::Animation_Complete ( GameObject *obj, const char *animation_name )
+{
+	if (!_stricmp(animation_name,Get_Parameter("Animation")))
+	{
+		const char *subobject = Get_Parameter("Subobject");
+		if (!_stricmp(subobject,"0"))
+		{
+			subobject = 0;
+		}
+		float firstframe = Get_Float_Parameter("FirstFrame");
+		if (firstframe == -1)
+		{
+			firstframe = Get_Animation_Frame(obj);
+		}
+		Commands->Set_Animation(obj,Get_Parameter("Animation"),false,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+	}
+}
+
 void JFW_Vehicle_Effect_Animation::Created(GameObject *obj)
 {
 	enabled = false;
diff -uwr sourceold/scripts/jfwveh.h source/scripts/jfwveh.h
--- sourceold/scripts/jfwveh.h	2011-10-14 22:27:32.110351500 +0800
+++ source/scripts/jfwveh.h	2011-12-01 12:47:58.083984300 +0800
@@ -38,6 +38,7 @@
 	void Created(GameObject *obj);
 	void Timer_Expired(GameObject *obj,int number);
 	public: void Register_Auto_Save_Variables();
+	void Animation_Complete ( GameObject *obj, const char *animation_name );
 };
 
 class JFW_Visible_Person_In_Vechicle : public ScriptImpClass {
@@ -110,6 +111,7 @@
 	void Timer_Expired(GameObject *obj,int number);
 	public: void Register_Auto_Save_Variables();
 	void Custom(GameObject *obj,int type,int param,GameObject *sender);
+	void Animation_Complete ( GameObject *obj, const char *animation_name );
 };
 
 class JFW_Vehicle_Block_Preset : public ScriptImpClass {
@@ -151,6 +153,7 @@
 	void Custom(GameObject *obj,int type,int param,GameObject *sender);
 	void Created(GameObject *obj);
 	public: void Register_Auto_Save_Variables();
+	void Animation_Complete ( GameObject *obj, const char *animation_name );
 };
 
 class JFW_Vehicle_Regen_2 : public ScriptImpClass {
diff -uwr sourceold/scripts/jfwws.cpp source/scripts/jfwws.cpp
--- sourceold/scripts/jfwws.cpp	2011-10-11 23:04:59.768554600 +0800
+++ source/scripts/jfwws.cpp	2011-11-07 20:33:46.811523400 +0800
@@ -687,6 +687,7 @@
 ScriptRegistrant<JFW_Permanent_No_Falling_Damage> JFW_Permanent_No_Falling_Damage_Registrant("JFW_Permanent_No_Falling_Damage","");
 ScriptRegistrant<JFW_Death_Powerup> JFW_Death_Powerup_Registrant("JFW_Death_Powerup","");
 ScriptRegistrant<JFW_GrantPowerup_Created> JFW_GrantPowerup_Created_Registrant("JFW_GrantPowerup_Created","WeaponDef:string");
+ScriptRegistrant<JFW_GrantPowerup_Created> M00_GrantPowerup_Created_Registrant("M00_GrantPowerup_Created","WeaponDef:string");
 ScriptRegistrant<JFW_CnC_Crate> JFW_CnC_Crate_Registrant("JFW_CnC_Crate","");
 ScriptRegistrant<JFW_Tiberium_Refinery> JFW_Tiberium_Refinery_Registrant("JFW_Tiberium_Refinery","MoneyAmount:int,TimerLength:int");
 ScriptRegistrant<JFW_GrantMoney_Powerup> JFW_GrantMoney_Powerup_Registrant("JFW_GrantMoney_Powerup","ScoreAmount:float,Entire_Team=0:int,Randomizer=1:int");
diff -uwr sourceold/scripts/jfwzone.cpp source/scripts/jfwzone.cpp
--- sourceold/scripts/jfwzone.cpp	2011-10-25 16:01:41.291015600 +0800
+++ source/scripts/jfwzone.cpp	2011-12-01 12:21:47.211914000 +0800
@@ -1174,7 +1174,7 @@
 
 void JFW_Zone_Animation::Animation_Complete(GameObject *obj,const char *animation_name)
 {
-	if (!_stricmp(animation_name,Get_Parameter("UpAnimation")))
+	if (!_stricmp(animation_name,Get_Parameter("UpAnimation")) || !_stricmp(animation_name,Get_Parameter("Animation")))
 	{
 		const char *subobject = Get_Parameter("Subobject");
 		if (!_stricmp(subobject,"0"))
@@ -1186,7 +1186,7 @@
 		{
 			firstframe = Get_Animation_Frame(Commands->Find_Object(ID));
 		}
-		Commands->Set_Animation(Commands->Find_Object(ID),Get_Parameter("Animation"),true,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+		Commands->Set_Animation(Commands->Find_Object(ID),Get_Parameter("Animation"),false,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
 	}
 }
 
@@ -1897,7 +1897,7 @@
 
 void JFW_Vehicle_Zone_Animation::Animation_Complete(GameObject *obj,const char *animation_name)
 {
-	if (!_stricmp(animation_name,Get_Parameter("UpAnimation")))
+	if (!_stricmp(animation_name,Get_Parameter("UpAnimation")) || !_stricmp(animation_name,Get_Parameter("Animation")))
 	{
 		const char *subobject = Get_Parameter("Subobject");
 		if (!_stricmp(subobject,"0"))
@@ -1909,7 +1909,7 @@
 		{
 			firstframe = Get_Animation_Frame(Commands->Find_Object(ID));
 		}
-		Commands->Set_Animation(Commands->Find_Object(ID),Get_Parameter("Animation"),true,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
+		Commands->Set_Animation(Commands->Find_Object(ID),Get_Parameter("Animation"),false,subobject,firstframe,Get_Float_Parameter("LastFrame"),Get_Int_Parameter("Blended"));
 	}
 }
 
diff -uwr sourceold/scripts/scripts.vcxproj source/scripts/scripts.vcxproj
--- sourceold/scripts/scripts.vcxproj	2011-10-14 22:25:11.455078100 +0800
+++ source/scripts/scripts.vcxproj	2011-11-26 13:18:44.188476500 +0800
@@ -441,6 +441,7 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="iran_scripts.cpp" />
     <ClCompile Include="jfwcine.cpp" />
     <ClCompile Include="jfwcust.cpp" />
     <ClCompile Include="jfwdef.cpp" />
@@ -665,6 +666,7 @@
     <ClInclude Include="GridCull.h" />
     <ClInclude Include="HarvesterClass.h" />
     <ClInclude Include="inttest.h" />
+    <ClInclude Include="iran_scripts.h" />
     <ClInclude Include="jfwcine.h" />
     <ClInclude Include="jfwcust.h" />
     <ClInclude Include="jfwdef.h" />
@@ -733,6 +735,7 @@
     <ClInclude Include="SceneClass.h" />
     <ClInclude Include="ScriptableGameObj.h" />
     <ClInclude Include="ScriptableGameObjDef.h" />
+    <ClInclude Include="ScriptManager.h" />
     <ClInclude Include="scripts.h" />
     <ClInclude Include="ScriptZoneGameObj.h" />
     <ClInclude Include="ScriptZoneGameObjDef.h" />
diff -uwr sourceold/scripts/scripts.vcxproj.filters source/scripts/scripts.vcxproj.filters
--- sourceold/scripts/scripts.vcxproj.filters	2011-10-14 22:25:11.498046800 +0800
+++ source/scripts/scripts.vcxproj.filters	2011-11-22 14:49:49.159179600 +0800
@@ -464,6 +464,9 @@
     <ClCompile Include="tcw_zone.cpp">
       <Filter>01. Sources\Tib. Crystal War</Filter>
     </ClCompile>
+    <ClCompile Include="iran_scripts.cpp">
+      <Filter>01. Sources</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="scripts.rc">
@@ -1410,6 +1413,12 @@
     <ClInclude Include="tcw_defence.h">
       <Filter>02. Headers\Tib. Crystal War</Filter>
     </ClInclude>
+    <ClInclude Include="ScriptManager.h">
+      <Filter>03. New Sources</Filter>
+    </ClInclude>
+    <ClInclude Include="iran_scripts.h">
+      <Filter>02. Headers</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="console.txt">
diff -uwr sourceold/scripts/vector2.h source/scripts/vector2.h
--- sourceold/scripts/vector2.h	2011-10-11 21:41:08.434570300 +0800
+++ source/scripts/vector2.h	2011-11-22 14:49:49.190429600 +0800
@@ -92,14 +92,11 @@
 	}
 	TT_INLINE void Normalize(void)
 	{
-		float len2 = Length2();
-		if (len2 != 0.0f)
-		{
+		float len2 = WWMATH_FLOAT_TINY + Length2();
 			float oolen = WWMath::Inv_Sqrt(len2);
 			X *= oolen;
 			Y *= oolen;
 		}
-	}
 	TT_INLINE float Length(void) const
 	{
 		return (float)WWMath::Sqrt(Length2());
@@ -284,13 +281,8 @@
 }
 TT_INLINE Vector2 Normalize(const Vector2 &vec)
 {
-		float len2 = vec.Length2();
-		if (len2 != 0.0f)
-		{
-			float oolen = WWMath::Inv_Sqrt(len2);
-			return vec / oolen;
-		}
-		return Vector2(0.0f,0.0f);
+		float len2 = WWMATH_FLOAT_TINY + vec.Length2();
+		return vec * WWMath::Inv_Sqrt(len2);
 }
 TT_INLINE void Swap(Vector2 & a,Vector2 & b)
 {
diff -uwr sourceold/scripts/vector4.h source/scripts/vector4.h
--- sourceold/scripts/vector4.h	2011-10-11 21:41:02.434570300 +0800
+++ source/scripts/vector4.h	2011-11-22 14:49:49.204101500 +0800
@@ -39,16 +39,13 @@
 	TT_INLINE const float& operator[](int i) const { return (&X)[i]; };
 	TT_INLINE void Normalize(void)
 	{
-		float len2 = Length2();
-		if (len2 != 0.0f)
-		{
+		float len2 = WWMATH_FLOAT_TINY + Length2();
 			float oolen = WWMath::Inv_Sqrt(len2);
 			X *= oolen;
 			Y *= oolen;
 			Z *= oolen;
 			W *= oolen;
 		}
-	}
 	TT_INLINE float Length(void) const
 	{
 		return WWMath::Sqrt(Length2());
@@ -140,13 +137,8 @@
 
 TT_INLINE Vector4 Normalize(const Vector4 & vec)
 {
-	float len2 = vec.Length2();
-	if (len2 != 0.0f)
-	{
-		float oolen = WWMath::Inv_Sqrt(len2);
-		return vec * oolen;
-	}
-	return Vector4(0.0f,0.0f,0.0f,0.0f);
+	float len2 = WWMATH_FLOAT_TINY + vec.Length2();
+	return vec * WWMath::Inv_Sqrt(len2);
 }
 
 TT_INLINE void Swap(Vector4 & a,Vector4 & b)
diff -uwr sourceold/scripts/wwmath.h source/scripts/wwmath.h
--- sourceold/scripts/wwmath.h	2011-10-11 21:40:22.365234300 +0800
+++ source/scripts/wwmath.h	2011-11-22 14:49:49.161132800 +0800
@@ -18,6 +18,7 @@
 #define WWMATH_PI				3.141592654f
 #define WWMATH_FLOAT_MAX	(FLT_MAX)
 #define WWMATH_FLOAT_MIN	(FLT_MIN)
+#define WWMATH_FLOAT_TINY	(1.0e-37f)
 #define WWMATH_SQRT2			1.414213562f
 #define WWMATH_SQRT3			1.732050808f
 #define WWMATH_OOSQRT2		0.707106781f
