mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 06:53:40 +00:00
- Fixed: DSBarInfo::updateState() sprung leaks and didn't allocate enough
space for the fullStateName string. SVN r1003 (trunk)
This commit is contained in:
parent
3839ef14d5
commit
496e28aa7a
2 changed files with 15 additions and 11 deletions
|
@ -1,4 +1,6 @@
|
||||||
May 30, 2008
|
May 30, 2008
|
||||||
|
- Fixed: DSBarInfo::updateState() sprung leaks and didn't allocate enough
|
||||||
|
space for the fullStateName string.
|
||||||
- Disabled DUMB's mono destination mixers. It's not like I'm ever going to
|
- Disabled DUMB's mono destination mixers. It's not like I'm ever going to
|
||||||
target an original SoundBlaster, so they're a waste of space to have around.
|
target an original SoundBlaster, so they're a waste of space to have around.
|
||||||
This trims resample.obj down to ~60k now.
|
This trims resample.obj down to ~60k now.
|
||||||
|
|
|
@ -1359,7 +1359,10 @@ void DSBarInfo::DrawFace(FString &defaultFace, int accuracy, bool xdth, bool ani
|
||||||
{
|
{
|
||||||
int angle = updateState(xdth, animatedgodmode);
|
int angle = updateState(xdth, animatedgodmode);
|
||||||
int level = 0;
|
int level = 0;
|
||||||
for(level = 0;CPlayer->health < (accuracy-level-1)*(CPlayer->mo->GetMaxHealth()/accuracy);level++);
|
while (CPlayer->health < (accuracy-level-1)*(CPlayer->mo->GetMaxHealth()/accuracy))
|
||||||
|
{
|
||||||
|
level++;
|
||||||
|
}
|
||||||
if(currentState != NULL)
|
if(currentState != NULL)
|
||||||
{
|
{
|
||||||
FPlayerSkin *skin = &skins[CPlayer->morphTics ? CPlayer->MorphedPlayerClass : CPlayer->userinfo.skin];
|
FPlayerSkin *skin = &skins[CPlayer->morphTics ? CPlayer->MorphedPlayerClass : CPlayer->userinfo.skin];
|
||||||
|
@ -1420,7 +1423,7 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool setOuch = false;
|
bool setOuch = false;
|
||||||
const char* stateName = new char[5];
|
const char *stateName;
|
||||||
if ((mugshotHealth != -1 && CPlayer->health - mugshotHealth > 20) || ouchActive)
|
if ((mugshotHealth != -1 && CPlayer->health - mugshotHealth > 20) || ouchActive)
|
||||||
{
|
{
|
||||||
setOuch = true;
|
setOuch = true;
|
||||||
|
@ -1428,8 +1431,8 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
stateName = "pain";
|
stateName = "pain";
|
||||||
char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1];
|
FString fullStateName;
|
||||||
sprintf(fullStateName, "%s.%s", stateName, (const char*) CPlayer->LastDamageType);
|
fullStateName << stateName << '.' << CPlayer->LastDamageType;
|
||||||
if(FindMugShotState(fullStateName) != NULL)
|
if(FindMugShotState(fullStateName) != NULL)
|
||||||
SetMugShotState(fullStateName);
|
SetMugShotState(fullStateName);
|
||||||
else
|
else
|
||||||
|
@ -1446,7 +1449,7 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool setOuch = false;
|
bool setOuch = false;
|
||||||
const char* stateName = new char[5];
|
const char *stateName;
|
||||||
if ((mugshotHealth != -1 && CPlayer->health - mugshotHealth > 20) || ouchActive)
|
if ((mugshotHealth != -1 && CPlayer->health - mugshotHealth > 20) || ouchActive)
|
||||||
{
|
{
|
||||||
setOuch = true;
|
setOuch = true;
|
||||||
|
@ -1454,8 +1457,8 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
stateName = "pain";
|
stateName = "pain";
|
||||||
char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1];
|
FString fullStateName;
|
||||||
sprintf(fullStateName, "%s.%s", stateName, (const char*) CPlayer->LastDamageType);
|
fullStateName << stateName << '.' << CPlayer->LastDamageType;
|
||||||
if(FindMugShotState(fullStateName) != NULL)
|
if(FindMugShotState(fullStateName) != NULL)
|
||||||
SetMugShotState(fullStateName);
|
SetMugShotState(fullStateName);
|
||||||
else
|
else
|
||||||
|
@ -1487,14 +1490,13 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char* stateName = new char[7];
|
const char *stateName;
|
||||||
if(!xdth || !(CPlayer->cheats & CF_EXTREMELYDEAD))
|
if(!xdth || !(CPlayer->cheats & CF_EXTREMELYDEAD))
|
||||||
stateName = "death";
|
stateName = "death";
|
||||||
else
|
else
|
||||||
stateName = "xdeath";
|
stateName = "xdeath";
|
||||||
//new string the size of stateName and the damage type put together
|
FString fullStateName;
|
||||||
char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1];
|
fullStateName << stateName << '.' << CPlayer->LastDamageType;
|
||||||
sprintf(fullStateName, "%s.%s", stateName, (const char*) CPlayer->LastDamageType);
|
|
||||||
if(FindMugShotState(fullStateName) != NULL)
|
if(FindMugShotState(fullStateName) != NULL)
|
||||||
SetMugShotState(fullStateName);
|
SetMugShotState(fullStateName);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue