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.
Maikel de Vries 2010-12-13 22:46:42 +01:00
parent fb28777c70
commit 92bd67f250
8 changed files with 10 additions and 19 deletions

View File

@ -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>

View File

@ -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>

View File

@ -132,7 +132,7 @@ Flutter = {
};
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);

View File

@ -419,7 +419,7 @@ Dead = {
};
local Name = "$Name$";
local MaxEnergy = 50000;
local MaxBreath = 50000;
local MaxBreath = 125;
local JumpSpeed = 350;
local ThrowSpeed = 294;

View File

@ -2072,7 +2072,7 @@ HangOnto = {
};
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;

View File

@ -201,7 +201,7 @@ public func UpdateBreathBar()
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)

View File

@ -1035,7 +1035,7 @@ bool C4Object::ExecLife()
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 @@ bool C4Object::ExecLife()
{
// Take breath
int32_t takebreath = GetPropertyInt(P_MaxBreath) - Breath;
takebreath = 100 * takebreath / C4MaxPhysical;
if (takebreath > 0) DoBreath(takebreath);
}
}
@ -1392,8 +1391,6 @@ void C4Object::UpdatLastEnergyLossCause(int32_t iNewCausePlr)
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;

View File

@ -953,7 +953,7 @@ static long FnGetEnergy(C4AulObjectContext *cthr)
static long FnGetBreath(C4AulObjectContext *cthr)
{
return 100*cthr->Obj->Breath/C4MaxPhysical;
return cthr->Obj->Breath;
}
static long FnGetMass(C4AulContext *cthr)