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
|
||||
- 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
|
||||
target an original SoundBlaster, so they're a waste of space to have around.
|
||||
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 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)
|
||||
{
|
||||
FPlayerSkin *skin = &skins[CPlayer->morphTics ? CPlayer->MorphedPlayerClass : CPlayer->userinfo.skin];
|
||||
|
@ -1420,7 +1423,7 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
|
|||
}
|
||||
}
|
||||
bool setOuch = false;
|
||||
const char* stateName = new char[5];
|
||||
const char *stateName;
|
||||
if ((mugshotHealth != -1 && CPlayer->health - mugshotHealth > 20) || ouchActive)
|
||||
{
|
||||
setOuch = true;
|
||||
|
@ -1428,8 +1431,8 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
|
|||
}
|
||||
else
|
||||
stateName = "pain";
|
||||
char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1];
|
||||
sprintf(fullStateName, "%s.%s", stateName, (const char*) CPlayer->LastDamageType);
|
||||
FString fullStateName;
|
||||
fullStateName << stateName << '.' << CPlayer->LastDamageType;
|
||||
if(FindMugShotState(fullStateName) != NULL)
|
||||
SetMugShotState(fullStateName);
|
||||
else
|
||||
|
@ -1446,7 +1449,7 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
|
|||
else
|
||||
{
|
||||
bool setOuch = false;
|
||||
const char* stateName = new char[5];
|
||||
const char *stateName;
|
||||
if ((mugshotHealth != -1 && CPlayer->health - mugshotHealth > 20) || ouchActive)
|
||||
{
|
||||
setOuch = true;
|
||||
|
@ -1454,8 +1457,8 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
|
|||
}
|
||||
else
|
||||
stateName = "pain";
|
||||
char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1];
|
||||
sprintf(fullStateName, "%s.%s", stateName, (const char*) CPlayer->LastDamageType);
|
||||
FString fullStateName;
|
||||
fullStateName << stateName << '.' << CPlayer->LastDamageType;
|
||||
if(FindMugShotState(fullStateName) != NULL)
|
||||
SetMugShotState(fullStateName);
|
||||
else
|
||||
|
@ -1487,14 +1490,13 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
|
|||
}
|
||||
else
|
||||
{
|
||||
const char* stateName = new char[7];
|
||||
const char *stateName;
|
||||
if(!xdth || !(CPlayer->cheats & CF_EXTREMELYDEAD))
|
||||
stateName = "death";
|
||||
else
|
||||
stateName = "xdeath";
|
||||
//new string the size of stateName and the damage type put together
|
||||
char* fullStateName = new char[sizeof(stateName)+sizeof((const char*) CPlayer->LastDamageType) + 1];
|
||||
sprintf(fullStateName, "%s.%s", stateName, (const char*) CPlayer->LastDamageType);
|
||||
FString fullStateName;
|
||||
fullStateName << stateName << '.' << CPlayer->LastDamageType;
|
||||
if(FindMugShotState(fullStateName) != NULL)
|
||||
SetMugShotState(fullStateName);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue