# HG changeset patch
# User Maikel de Vries
# Date 1292276802 -3600
# Node ID a7af6cbcb469bf1f01df5e9740a2a380d6b1d36c
# Parent  18017e4b4b1ac5321c31feded0d7afc189befc34
Physical: Breath value now represents the number of frames an object can hold his breath.
More precise values do not make sense and complicate stuff.

diff -r 18017e4b4b1a -r a7af6cbcb469 docs/sdk/script/fn/DoBreath.xml
--- a/docs/sdk/script/fn/DoBreath.xml	Mon Dec 13 02:58:22 2010 +0100
+++ b/docs/sdk/script/fn/DoBreath.xml	Mon Dec 13 22:46:42 2010 +0100
@@ -14,20 +14,14 @@
         <param>
           <type>int</type>
           <name>change</name>
-          <desc>Change of the breath value (positive or negative) in percent of the maximum value. 100% correspond to the maximum physical value 100,000.</desc>
-        </param>
-        <param>
-          <type>object</type>
-          <name>obj</name>
-          <desc>Object of which you want to change breath. Can be 0 in local calls.</desc>
-          <optional />
+          <desc>Change of the breath value in frames.</desc>
         </param>
       </params>
     </syntax>
     <desc>Changes the breath value of an object.</desc>
     <examples>
       <example>
-        <code>DoBreath(<funclink>GetPhysical</funclink>(&quot;Breath&quot;, 0, <funclink>GetCursor</funclink>(0))*50/100000, <funclink>GetCursor</funclink>(0));</code>
+        <code>GetCursor()->DoBreath(GetCursor().MaxBreath / 2);</code>
         <text>Gives 50% more breath to the selected clonk of the first player.</text>
       </example>
     </examples>
diff -r 18017e4b4b1a -r a7af6cbcb469 docs/sdk/script/fn/GetBreath.xml
--- a/docs/sdk/script/fn/GetBreath.xml	Mon Dec 13 02:58:22 2010 +0100
+++ b/docs/sdk/script/fn/GetBreath.xml	Mon Dec 13 22:46:42 2010 +0100
@@ -9,8 +9,8 @@
     <subcat>Living Beings</subcat>
     <version>4.6.5.0 CP</version>
     <syntax><rtype>int</rtype></syntax>
-    <desc>Returns the current breath value of an object in percent. 100% represent the maximum physical value of 100,000. Also see DefCore section [Physical].</desc>
-    <related><funclink>GetPhysical</funclink></related>
+    <desc>Returns the current breath value of an object, this is the number of frames an object can still hold its breath</desc>
+    <related><funclink>DoBreath</funclink></related>
   </func>
   <author>jwk</author><date>2002-06</date>
 </funcs>
diff -r 18017e4b4b1a -r a7af6cbcb469 planet/Objects.c4d/Animals.c4d/Butterfly.c4d/Script.c
--- a/planet/Objects.c4d/Animals.c4d/Butterfly.c4d/Script.c	Mon Dec 13 02:58:22 2010 +0100
+++ b/planet/Objects.c4d/Animals.c4d/Butterfly.c4d/Script.c	Mon Dec 13 22:46:42 2010 +0100
@@ -132,7 +132,7 @@
 };
 local Name = "Butterfly";
 local MaxEnergy = 40000;
-local MaxBreath = 50000;
+local MaxBreath = 125;
 
 func Definition(def) {
 	SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(20,1,0,0),Trans_Rotate(70,0,1,0)), def);
diff -r 18017e4b4b1a -r a7af6cbcb469 planet/Objects.c4d/Animals.c4d/Wolf.c4d/Script.c
--- a/planet/Objects.c4d/Animals.c4d/Wolf.c4d/Script.c	Mon Dec 13 02:58:22 2010 +0100
+++ b/planet/Objects.c4d/Animals.c4d/Wolf.c4d/Script.c	Mon Dec 13 22:46:42 2010 +0100
@@ -419,7 +419,7 @@
 };
 local Name = "$Name$";
 local MaxEnergy = 50000;
-local MaxBreath = 50000;
+local MaxBreath = 125;
 local JumpSpeed = 350;
 local ThrowSpeed = 294;
 
diff -r 18017e4b4b1a -r a7af6cbcb469 planet/Objects.c4d/Clonk.c4d/Script.c
--- a/planet/Objects.c4d/Clonk.c4d/Script.c	Mon Dec 13 02:58:22 2010 +0100
+++ b/planet/Objects.c4d/Clonk.c4d/Script.c	Mon Dec 13 22:46:42 2010 +0100
@@ -2072,7 +2072,7 @@
 };
 local Name = "Clonk";
 local MaxEnergy = 50000;
-local MaxBreath = 100000;
+local MaxBreath = 252; // Clonk can breathe for 7 seconds under water.
 local JumpSpeed = 400;
 local ThrowSpeed = 294;
 
diff -r 18017e4b4b1a -r a7af6cbcb469 planet/Objects.c4d/HUD.c4d/Elements.c4d/CrewSelector.c4d/Script.c
--- a/planet/Objects.c4d/HUD.c4d/Elements.c4d/CrewSelector.c4d/Script.c	Mon Dec 13 02:58:22 2010 +0100
+++ b/planet/Objects.c4d/HUD.c4d/Elements.c4d/CrewSelector.c4d/Script.c	Mon Dec 13 22:46:42 2010 +0100
@@ -201,7 +201,7 @@
 	var phys = crew.MaxBreath;
 	var promille;
 	if(phys == 0) promille = 0;
-	else promille = 1000 * crew->GetBreath() / (phys / 1000);
+	else promille = 1000 * crew->GetBreath() / phys;
 
 	// remove breath bar if full breath
 	if(promille == 1000)
diff -r 18017e4b4b1a -r a7af6cbcb469 src/game/object/C4Object.cpp
--- a/src/game/object/C4Object.cpp	Mon Dec 13 02:58:22 2010 +0100
+++ b/src/game/object/C4Object.cpp	Mon Dec 13 22:46:42 2010 +0100
@@ -1035,7 +1035,7 @@
 			if (!Breathe)
 			{
 				// Reduce breath, then energy, bubble
-				if (Breath > 0) DoBreath(-2);
+				if (Breath > 0) DoBreath(-5);
 				else DoEnergy(-1,false,C4FxCall_EngAsphyxiation, NO_OWNER);
 			}
 			// Supply
@@ -1043,7 +1043,6 @@
 			{
 				// Take breath
 				int32_t takebreath = GetPropertyInt(P_MaxBreath) - Breath;
-				takebreath = 100 * takebreath / C4MaxPhysical;
 				if (takebreath > 0) DoBreath(takebreath);
 			}
 		}
@@ -1392,8 +1391,6 @@
 
 void C4Object::DoBreath(int32_t iChange)
 {
-	// iChange 100% = Physical 100000
-	iChange=iChange*C4MaxPhysical/100;
 	// Do change
 	iChange = BoundBy<int32_t>(iChange, -Breath, GetPropertyInt(P_MaxBreath) - Breath);
 	Breath += iChange;
diff -r 18017e4b4b1a -r a7af6cbcb469 src/game/script/C4Script.cpp
--- a/src/game/script/C4Script.cpp	Mon Dec 13 02:58:22 2010 +0100
+++ b/src/game/script/C4Script.cpp	Mon Dec 13 22:46:42 2010 +0100
@@ -953,7 +953,7 @@
 
 static long FnGetBreath(C4AulObjectContext *cthr)
 {
-	return 100*cthr->Obj->Breath/C4MaxPhysical;
+	return cthr->Obj->Breath;
 }
 
 static long FnGetMass(C4AulContext *cthr)
