- 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
|
|
@ -116,6 +116,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawChar)
|
|||
PARAM_FLOAT(y);
|
||||
PARAM_INT(chr);
|
||||
|
||||
if (!screen->IsLocked()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
VMVa_List args = { param + 5, 0, numparam - 5 };
|
||||
screen->DrawChar(font, cr, x, y, chr, args);
|
||||
return 0;
|
||||
|
|
@ -241,6 +242,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawText)
|
|||
PARAM_FLOAT(y);
|
||||
PARAM_STRING(chr);
|
||||
|
||||
if (!screen->IsLocked()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
VMVa_List args = { param + 5, 0, numparam - 5 };
|
||||
const char *txt = chr[0] == '$' ? GStrings(&chr[1]) : chr.GetChars();
|
||||
screen->DrawText(font, cr, x, y, txt, args);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue