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) if (pev->spawnflags & SF_DOOR_START_OPEN)
{ {
#ifdef REGAMEDLL_FIXES
pev->angles = m_vecAngle1;
#else
pev->angles = m_vecAngle2; pev->angles = m_vecAngle2;
Vector vecSav = m_vecAngle1; Vector vecSav = m_vecAngle1;
m_vecAngle2 = m_vecAngle1; m_vecAngle2 = m_vecAngle1;
m_vecAngle1 = vecSav; m_vecAngle1 = vecSav;
#endif
pev->movedir = pev->movedir * -1; 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 // swap pos1 and pos2, put door at pos2, invert movement direction
pev->angles = m_vecAngle2; pev->angles = m_vecAngle2;
#ifdef REGAMEDLL_FIXES
SWAP(m_vecAngle1, m_vecAngle2);
#else
Vector vecSav = m_vecAngle1; Vector vecSav = m_vecAngle1;
m_vecAngle2 = m_vecAngle1; m_vecAngle2 = m_vecAngle1;
m_vecAngle1 = vecSav; m_vecAngle1 = vecSav;
#endif
pev->movedir = pev->movedir * -1; pev->movedir = pev->movedir * -1;
} }

View File

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