mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
Duke3d: add a few missing VM_ASSERT checks
This commit is contained in:
parent
1a1112b4c1
commit
8cf064b90c
1 changed files with 16 additions and 0 deletions
|
@ -2384,6 +2384,8 @@ GAMEEXEC_STATIC void VM_Execute(int const loop /*= false*/)
|
||||||
int const labelNum = *insptr++;
|
int const labelNum = *insptr++;
|
||||||
int const lParm2 = (PlayerLabels[labelNum].flags & LABEL_HASPARM2) ? Gv_GetVar(*insptr++) : 0;
|
int const lParm2 = (PlayerLabels[labelNum].flags & LABEL_HASPARM2) ? Gv_GetVar(*insptr++) : 0;
|
||||||
|
|
||||||
|
VM_ASSERT((unsigned)playerNum < MAXPLAYERS, "invalid player %d\n", playerNum);
|
||||||
|
|
||||||
VM_SetPlayer(playerNum, labelNum, lParm2, Gv_GetVar(*insptr++));
|
VM_SetPlayer(playerNum, labelNum, lParm2, Gv_GetVar(*insptr++));
|
||||||
dispatch();
|
dispatch();
|
||||||
}
|
}
|
||||||
|
@ -2395,6 +2397,8 @@ GAMEEXEC_STATIC void VM_Execute(int const loop /*= false*/)
|
||||||
int const labelNum = *insptr++;
|
int const labelNum = *insptr++;
|
||||||
int const lParm2 = (PlayerLabels[labelNum].flags & LABEL_HASPARM2) ? Gv_GetVar(*insptr++) : 0;
|
int const lParm2 = (PlayerLabels[labelNum].flags & LABEL_HASPARM2) ? Gv_GetVar(*insptr++) : 0;
|
||||||
|
|
||||||
|
VM_ASSERT((unsigned)playerNum < MAXPLAYERS, "invalid player %d\n", playerNum);
|
||||||
|
|
||||||
Gv_SetVar(*insptr++, VM_GetPlayer(playerNum, labelNum, lParm2));
|
Gv_SetVar(*insptr++, VM_GetPlayer(playerNum, labelNum, lParm2));
|
||||||
dispatch();
|
dispatch();
|
||||||
}
|
}
|
||||||
|
@ -2408,6 +2412,8 @@ GAMEEXEC_STATIC void VM_Execute(int const loop /*= false*/)
|
||||||
int const newValue = Gv_GetVar(*insptr++);
|
int const newValue = Gv_GetVar(*insptr++);
|
||||||
auto const &wallLabel = WallLabels[labelNum];
|
auto const &wallLabel = WallLabels[labelNum];
|
||||||
|
|
||||||
|
VM_ASSERT((unsigned)wallNum < MAXWALLS, "invalid wall %d\n", wallNum);
|
||||||
|
|
||||||
if (wallLabel.offset == -1 || wallLabel.flags & LABEL_WRITEFUNC)
|
if (wallLabel.offset == -1 || wallLabel.flags & LABEL_WRITEFUNC)
|
||||||
{
|
{
|
||||||
VM_SetWall(wallNum, labelNum, newValue);
|
VM_SetWall(wallNum, labelNum, newValue);
|
||||||
|
@ -2428,6 +2434,8 @@ GAMEEXEC_STATIC void VM_Execute(int const loop /*= false*/)
|
||||||
int const labelNum = *insptr++;
|
int const labelNum = *insptr++;
|
||||||
auto const &wallLabel = WallLabels[labelNum];
|
auto const &wallLabel = WallLabels[labelNum];
|
||||||
|
|
||||||
|
VM_ASSERT((unsigned)wallNum < MAXWALLS, "invalid wall %d\n", wallNum);
|
||||||
|
|
||||||
Gv_SetVar(*insptr++,
|
Gv_SetVar(*insptr++,
|
||||||
(wallLabel.offset != -1 && (wallLabel.flags & LABEL_READFUNC) != LABEL_READFUNC)
|
(wallLabel.offset != -1 && (wallLabel.flags & LABEL_READFUNC) != LABEL_READFUNC)
|
||||||
? VM_GetStruct(wallLabel.flags, (intptr_t *)((char *)&wall[wallNum] + wallLabel.offset))
|
? VM_GetStruct(wallLabel.flags, (intptr_t *)((char *)&wall[wallNum] + wallLabel.offset))
|
||||||
|
@ -2594,6 +2602,8 @@ GAMEEXEC_STATIC void VM_Execute(int const loop /*= false*/)
|
||||||
int const labelNum = *insptr++;
|
int const labelNum = *insptr++;
|
||||||
auto const &tsprLabel = TsprLabels[labelNum];
|
auto const &tsprLabel = TsprLabels[labelNum];
|
||||||
|
|
||||||
|
VM_ASSERT((unsigned)spriteNum < MAXSPRITES, "invalid sprite %d\n", spriteNum);
|
||||||
|
|
||||||
VM_SetStruct(tsprLabel.flags, (intptr_t *)((char *)spriteext[spriteNum].tspr + tsprLabel.offset), Gv_GetVar(*insptr++));
|
VM_SetStruct(tsprLabel.flags, (intptr_t *)((char *)spriteext[spriteNum].tspr + tsprLabel.offset), Gv_GetVar(*insptr++));
|
||||||
dispatch();
|
dispatch();
|
||||||
}
|
}
|
||||||
|
@ -2605,6 +2615,8 @@ GAMEEXEC_STATIC void VM_Execute(int const loop /*= false*/)
|
||||||
int const labelNum = *insptr++;
|
int const labelNum = *insptr++;
|
||||||
auto const &tsprLabel = TsprLabels[labelNum];
|
auto const &tsprLabel = TsprLabels[labelNum];
|
||||||
|
|
||||||
|
VM_ASSERT((unsigned)spriteNum < MAXSPRITES, "invalid sprite %d\n", spriteNum);
|
||||||
|
|
||||||
Gv_SetVar(*insptr++, VM_GetStruct(tsprLabel.flags, (intptr_t *)((char *)spriteext[spriteNum].tspr + tsprLabel.offset)));
|
Gv_SetVar(*insptr++, VM_GetStruct(tsprLabel.flags, (intptr_t *)((char *)spriteext[spriteNum].tspr + tsprLabel.offset)));
|
||||||
dispatch();
|
dispatch();
|
||||||
}
|
}
|
||||||
|
@ -2617,6 +2629,8 @@ GAMEEXEC_STATIC void VM_Execute(int const loop /*= false*/)
|
||||||
auto const §Label = SectorLabels[labelNum];
|
auto const §Label = SectorLabels[labelNum];
|
||||||
int const newValue = Gv_GetVar(*insptr++);
|
int const newValue = Gv_GetVar(*insptr++);
|
||||||
|
|
||||||
|
VM_ASSERT((unsigned)sectNum < MAXSECTORS, "invalid sector %d\n", sectNum);
|
||||||
|
|
||||||
if (sectLabel.offset == -1 || sectLabel.flags & LABEL_WRITEFUNC)
|
if (sectLabel.offset == -1 || sectLabel.flags & LABEL_WRITEFUNC)
|
||||||
{
|
{
|
||||||
VM_SetSector(sectNum, labelNum, newValue);
|
VM_SetSector(sectNum, labelNum, newValue);
|
||||||
|
@ -2634,6 +2648,8 @@ GAMEEXEC_STATIC void VM_Execute(int const loop /*= false*/)
|
||||||
int const labelNum = *insptr++;
|
int const labelNum = *insptr++;
|
||||||
auto const §Label = SectorLabels[labelNum];
|
auto const §Label = SectorLabels[labelNum];
|
||||||
|
|
||||||
|
VM_ASSERT((unsigned)sectNum < MAXSECTORS, "invalid sector %d\n", sectNum);
|
||||||
|
|
||||||
Gv_SetVar(*insptr++,
|
Gv_SetVar(*insptr++,
|
||||||
(sectLabel.offset != -1 && (sectLabel.flags & LABEL_READFUNC) != LABEL_READFUNC)
|
(sectLabel.offset != -1 && (sectLabel.flags & LABEL_READFUNC) != LABEL_READFUNC)
|
||||||
? VM_GetStruct(sectLabel.flags, (intptr_t *)((char *)§or[sectNum] + sectLabel.offset))
|
? VM_GetStruct(sectLabel.flags, (intptr_t *)((char *)§or[sectNum] + sectLabel.offset))
|
||||||
|
|
Loading…
Reference in a new issue