Bugfix: func_door_rotating with spawnflags SF_DOOR_START_OPEN (working incorrectly)

Bugfix: func_breakable not precached some sound files.
This commit is contained in:
s1lentq 2016-08-03 23:39:05 +07:00
parent 611344ed05
commit 5864d1ea34
2 changed files with 58 additions and 43 deletions

View File

@ -856,11 +856,15 @@ void CRotDoor::__MAKE_VHOOK(Restart)()
if (pev->spawnflags & SF_DOOR_START_OPEN)
{
#ifdef REGAMEDLL_FIXES
pev->angles = m_vecAngle1;
#else
pev->angles = m_vecAngle2;
Vector vecSav = m_vecAngle1;
m_vecAngle2 = m_vecAngle1;
m_vecAngle1 = vecSav;
#endif
pev->movedir = pev->movedir * -1;
}
@ -908,9 +912,13 @@ void CRotDoor::__MAKE_VHOOK(Spawn)()
// swap pos1 and pos2, put door at pos2, invert movement direction
pev->angles = m_vecAngle2;
#ifdef REGAMEDLL_FIXES
SWAP(m_vecAngle1, m_vecAngle2);
#else
Vector vecSav = m_vecAngle1;
m_vecAngle2 = m_vecAngle1;
m_vecAngle1 = vecSav;
#endif
pev->movedir = pev->movedir * -1;
}

View File

@ -123,14 +123,14 @@ void CBreakable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
}
else if (FStrEq(pkvd->szKeyName, "material"))
{
int i = Q_atoi(pkvd->szValue);
Materials type = (Materials)Q_atoi(pkvd->szValue);
// 0:glass, 1:metal, 2:flesh, 3:wood
// 0:glass, 1:wood, 2:metal, 3:flesh etc
if (i < 0 || i >= matLastMaterial)
if (type < 0 || type >= matLastMaterial)
m_Material = matWood;
else
m_Material = (Materials)i;
m_Material = type;
pkvd->fHandled = TRUE;
}
@ -244,48 +244,49 @@ void CBreakable::__MAKE_VHOOK(Restart)()
const char **CBreakable::MaterialSoundList(Materials precacheMaterial, int &soundCount)
{
const char **pSoundList = NULL;
const char **pSoundList;
switch (precacheMaterial)
{
case matWood:
{
pSoundList = pSoundsWood;
soundCount = ARRAYSIZE(pSoundsWood);
break;
}
case matFlesh:
{
pSoundList = pSoundsFlesh;
soundCount = ARRAYSIZE(pSoundsFlesh);
break;
}
case matGlass:
case matComputer:
case matUnbreakableGlass:
{
pSoundList = pSoundsGlass;
soundCount = ARRAYSIZE(pSoundsGlass);
break;
}
case matMetal:
{
pSoundList = pSoundsMetal;
soundCount = ARRAYSIZE(pSoundsMetal);
break;
}
case matCinderBlock:
case matRocks:
{
pSoundList = pSoundsConcrete;
soundCount = ARRAYSIZE(pSoundsConcrete);
break;
}
case matCeilingTile:
case matNone:
default:
soundCount = 0;
break;
case matWood:
{
pSoundList = pSoundsWood;
soundCount = ARRAYSIZE(pSoundsWood);
break;
}
case matFlesh:
{
pSoundList = pSoundsFlesh;
soundCount = ARRAYSIZE(pSoundsFlesh);
break;
}
case matGlass:
case matComputer:
case matUnbreakableGlass:
{
pSoundList = pSoundsGlass;
soundCount = ARRAYSIZE(pSoundsGlass);
break;
}
case matMetal:
{
pSoundList = pSoundsMetal;
soundCount = ARRAYSIZE(pSoundsMetal);
break;
}
case matCinderBlock:
case matRocks:
{
pSoundList = pSoundsConcrete;
soundCount = ARRAYSIZE(pSoundsConcrete);
break;
}
case matCeilingTile:
case matNone:
default:
pSoundList = nullptr;
soundCount = 0;
break;
}
return pSoundList;
@ -407,8 +408,10 @@ void CBreakable::DamageSound()
fvol = RANDOM_FLOAT(0.75, 1.0);
#ifndef REGAMEDLL_FIXES
if (material == matComputer && RANDOM_LONG(0, 1))
material = matMetal;
#endif
switch (material)
{
@ -432,7 +435,11 @@ void CBreakable::DamageSound()
rgpsz[0] = "debris/metal1.wav";
rgpsz[1] = "debris/metal3.wav";
rgpsz[2] = "debris/metal2.wav";
#ifdef REGAMEDLL_FIXES
i = 3;
#else
i = 2;
#endif
break;
case matFlesh: