- added safeguards to all 2D drawing functions to throw an exception if used outside a valid 2D draw context.
This is necessary because the hardware accelerated renderers will hide the problem, but with pure software rendering to a locked hardware surface, like DirectDraw can result in a crash. Note that ANY mod that gets caught in this did something wrong!
This commit is contained in:
parent
f3db5f3803
commit
e2e17f575c
6 changed files with 13 additions and 3 deletions
|
|
@ -137,6 +137,8 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawTexture)
|
|||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
|
||||
if (!screen->IsLocked()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
|
||||
FTexture *tex = animate ? TexMan(FSetTextureID(texid)) : TexMan[FSetTextureID(texid)];
|
||||
VMVa_List args = { param + 4, 0, numparam - 4 };
|
||||
screen->DrawTexture(tex, x, y, args);
|
||||
|
|
@ -959,6 +961,7 @@ DEFINE_ACTION_FUNCTION(_Screen, Clear)
|
|||
PARAM_INT(y2);
|
||||
PARAM_INT(color);
|
||||
PARAM_INT_DEF(palcol);
|
||||
if (!screen->IsLocked()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
screen->Clear(x1, y1, x2, y2, palcol, color);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1010,6 +1013,7 @@ DEFINE_ACTION_FUNCTION(_Screen, Dim)
|
|||
PARAM_INT(y1);
|
||||
PARAM_INT(w);
|
||||
PARAM_INT(h);
|
||||
if (!screen->IsLocked()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
screen->Dim(color, float(amount), x1, y1, w, h);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue