mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- Duke/RR: fixed: animates array must be cleared on map change.
There was also some undefined behavior when an entry was deleted, this seems to originate from the original code.
This commit is contained in:
parent
dc41057984
commit
7d82ae28f4
3 changed files with 13 additions and 3 deletions
|
@ -81,6 +81,15 @@ MapRecord *FindMapByName(const char *nm)
|
||||||
return map.Data();
|
return map.Data();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// retry with the path being removed.
|
||||||
|
FString s = ExtractFileBase(nm);
|
||||||
|
for (auto& map : mapList)
|
||||||
|
{
|
||||||
|
if (map->labelName.CompareNoCase(s) == 0)
|
||||||
|
{
|
||||||
|
return map.Data();
|
||||||
|
}
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -426,6 +426,7 @@ void resetprestat(int snum,int g)
|
||||||
paused = 0;
|
paused = 0;
|
||||||
ud.cameraactor =nullptr;
|
ud.cameraactor =nullptr;
|
||||||
mspos.Clear();
|
mspos.Clear();
|
||||||
|
animates.Clear();
|
||||||
camsprite =nullptr;
|
camsprite =nullptr;
|
||||||
earthquaketime = 0;
|
earthquaketime = 0;
|
||||||
|
|
||||||
|
|
|
@ -355,6 +355,7 @@ void doanimations(void)
|
||||||
double a = getanimatevalue(i);
|
double a = getanimatevalue(i);
|
||||||
double const v = animates[i].vel * TICSPERFRAME;
|
double const v = animates[i].vel * TICSPERFRAME;
|
||||||
auto dasectp = animates[i].sect;
|
auto dasectp = animates[i].sect;
|
||||||
|
int type = animates[i].type;
|
||||||
|
|
||||||
if (a == animates[i].goal)
|
if (a == animates[i].goal)
|
||||||
{
|
{
|
||||||
|
@ -362,9 +363,8 @@ void doanimations(void)
|
||||||
|
|
||||||
animates[i] = animates.Last();
|
animates[i] = animates.Last();
|
||||||
animates.Pop();
|
animates.Pop();
|
||||||
dasectp = animates[i].sect;
|
|
||||||
if (dasectp->lotag == ST_18_ELEVATOR_DOWN || dasectp->lotag == ST_19_ELEVATOR_UP)
|
if (dasectp->lotag == ST_18_ELEVATOR_DOWN || dasectp->lotag == ST_19_ELEVATOR_UP)
|
||||||
if (animates[i].type == anim_ceilingz)
|
if (type == anim_ceilingz)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((dasectp->lotag & 0xff) != ST_22_SPLITTING_DOOR)
|
if ((dasectp->lotag & 0xff) != ST_22_SPLITTING_DOOR)
|
||||||
|
@ -376,7 +376,7 @@ void doanimations(void)
|
||||||
if (v > 0) { a = min(a + v, animates[i].goal); }
|
if (v > 0) { a = min(a + v, animates[i].goal); }
|
||||||
else { a = max(a + v, animates[i].goal); }
|
else { a = max(a + v, animates[i].goal); }
|
||||||
|
|
||||||
if (animates[i].type == anim_floorz)
|
if (type == anim_floorz)
|
||||||
{
|
{
|
||||||
for (auto p = connecthead; p >= 0; p = connectpoint2[p])
|
for (auto p = connecthead; p >= 0; p = connectpoint2[p])
|
||||||
if (ps[p].cursector == dasectp)
|
if (ps[p].cursector == dasectp)
|
||||||
|
|
Loading…
Reference in a new issue