V_DrawCroppedPatch(...) Lua exposure and improvements
This merge request separates
pscale into separate
pscale (X scale) and
vscale (Y scale) arguments, and gives it a
colormap argument. It now has the same arguments as
V_DrawStretchyFixedPatch(...), except with
sx,sy,w,h tacked on at the end.
V_PERPLAYER video flag support have been added for it too, matching the exact way that
V_DrawStretchyFixedPatch(...) handles those flags.
V_PERPLAYER does not auto-crop at splitscreen borders
V_PERPLAYER auto-crops at splitscreen borders now, though only when using
V_DrawCroppedPatch(...), not the other patch drawers.
sx,sy,w,h have been changed from raw integers into fixed-point values, like
x,y,pscale,vscale already are.
I have tested the parameters moderately, to make sure that both renderers handle the function the same way, and that neither of them do anything unexpected (as long as
h are all 0 or more; negative values will crash in software, and cause strange results in OpenGL).
Ultimately, this leads up to the next topic:
V_DrawCroppedPatch(...) is now exposed to Lua as
v.drawCropped(x,y,hscale,vscale,patch,flags,c,sx,sy,w,h), allowing scripters to draw patches where the top, bottom, left, and/or right sides can be cropped away. A vanilla in-game example is how the bottom of the Emerald Token coin disappears into the special stage box in intermission screens. Wiki-like usage explanation (feel free to copy to the wiki once merged, and/or edit to clear up confusion):
|v.drawCropped(fixed x, fixed y, fixed hscale, fixed vscale, patch_t patch, int flags, colormap c, fixed sx, fixed sy, fixed w, fixed h)||Draws a patch at the screen coordinates given, but at a specific horizontal (
* Coordinates are required to be fixed point values (e.g.:
Example Lua script, using convars called
h to control the cropped patch drawn while in-level, and
crop to choose between
(On a slightly related note, OpenGL's
V_DrawStretchyFixedPatch(...) now supports
vscale being adjusted even if
pscale is the default
FRACUNIT. Software already supported that, and this was just an oversight from back when there was only a single scale value.)
Note that this merge request intentionally undoes !1297 (merged), and fixes that problem more appropriately.
For Lua scripters:
- New HUD function
v.drawCropped(x,y,hscale,vscale,patch,flags,c,sx,sy,w,h), for drawing patches where the sides are partially cropped away.
- (Additionally, bug fix,
v.drawStretched(...) now supports
vscale in OpenGL even when
FRACUNIT. Software already supported it.)
V_DrawCroppedPatch(...) has had
pscale split into separate X and Y scales, given a
colormap argument, and had
sx,sy,w,h turned into fixed-point values. I did not rename the function nor make backwards-compatibility defines, given how little-used
For changelog authors?:
- New Lua HUD function,
marked as a Work In ProgressToggle commit list
Marked as WIP until I solve merge conflicts (very easy) and handle auto-cropping at splitscreen borders (the scale-patch flags are mocking me in this regard), but I'm trying to finishing that as soon as possible, don't worry.
unmarked as a Work In ProgressToggle commit list
Merge conflicts solved, and
V_DrawCroppedPatch(...)auto-crop at splitscreen borders.
This has been tested in both software and OpenGL, both with and without scale-patch flags, both with and without a custom