mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
LunaCON: fix rotatesprite coordinate check, gen. events to chain at beginning.
git-svn-id: https://svn.eduke32.com/eduke32@3639 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
9fbab31998
commit
1e21ea3aae
4 changed files with 12 additions and 11 deletions
|
@ -781,13 +781,13 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol,
|
||||||
const char *name, char fontsize) ATTRIBUTE((nonnull(5)));
|
const char *name, char fontsize) ATTRIBUTE((nonnull(5)));
|
||||||
|
|
||||||
////////// specialized rotatesprite wrappers for (very) often used cases //////////
|
////////// specialized rotatesprite wrappers for (very) often used cases //////////
|
||||||
// don't clip at all, i.e. the whole screen real estate is available
|
|
||||||
static inline void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
static inline void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||||
int8_t dashade, char dapalnum, int32_t dastat,
|
int8_t dashade, char dapalnum, int32_t dastat,
|
||||||
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2)
|
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2)
|
||||||
{
|
{
|
||||||
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, cx1, cy1, cx2, cy2);
|
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, cx1, cy1, cx2, cy2);
|
||||||
}
|
}
|
||||||
|
// Don't clip at all, i.e. the whole screen real estate is available:
|
||||||
static inline void rotatesprite_fs(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
static inline void rotatesprite_fs(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||||
int8_t dashade, char dapalnum, int32_t dastat)
|
int8_t dashade, char dapalnum, int32_t dastat)
|
||||||
{
|
{
|
||||||
|
|
|
@ -220,7 +220,7 @@ SFLAG = {
|
||||||
SFLAG_CACHE = -0x00010000,
|
SFLAG_CACHE = -0x00010000,
|
||||||
SFLAG_ROTFIXED = -0x00020000,
|
SFLAG_ROTFIXED = -0x00020000,
|
||||||
SFLAG_HARDCODED_BADGUY = -0x00040000,
|
SFLAG_HARDCODED_BADGUY = -0x00040000,
|
||||||
-- RESERVED for actor.FLAGS.CHAIN_BEG/CHAIN_END/REPLACE:
|
-- RESERVED for actor.FLAGS.chain_beg/chain_end/replace:
|
||||||
-- 0x20000000, 0x40000000
|
-- 0x20000000, 0x40000000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,18 +284,18 @@ function rotatesprite(x, y, zoom, ang, tilenum, shade, pal, orientation,
|
||||||
check_tile_idx(tilenum)
|
check_tile_idx(tilenum)
|
||||||
orientation = bit.band(orientation, 4095) -- ROTATESPRITE_MAX-1
|
orientation = bit.band(orientation, 4095) -- ROTATESPRITE_MAX-1
|
||||||
|
|
||||||
-- XXX: This is the same as the check in gameexec.c, but ideally we'd want
|
|
||||||
-- rotatesprite to accept all coordinates and simply draw nothing if they
|
|
||||||
-- denote an area beyond the screen.
|
|
||||||
if (not (x >= -320 and x < 640) or not (y >= -200 and y < 400)) then
|
|
||||||
error(format("invalid coordinates (%.03f, %.03f)", x, y), 2)
|
|
||||||
end
|
|
||||||
|
|
||||||
if (bit.band(orientation, 2048) ~= 2048) then -- ROTATESPRITE_FULL16
|
if (bit.band(orientation, 2048) ~= 2048) then -- ROTATESPRITE_FULL16
|
||||||
x = 65536*x
|
x = 65536*x
|
||||||
y = 65536*y
|
y = 65536*y
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- XXX: This is the same as the check in gameexec.c, but ideally we'd want
|
||||||
|
-- rotatesprite to accept all coordinates and simply draw nothing if they
|
||||||
|
-- denote an area beyond the screen.
|
||||||
|
if (not (x >= -320*65536 and x < 640*65536) or not (y >= -200*65536 and y < 400*65536)) then
|
||||||
|
error(format("invalid coordinates (%.03f, %.03f)", x, y), 2)
|
||||||
|
end
|
||||||
|
|
||||||
-- TODO: check that it works correctly with all coordinates, also if one
|
-- TODO: check that it works correctly with all coordinates, also if one
|
||||||
-- border is outside the screen etc...
|
-- border is outside the screen etc...
|
||||||
ffiC.rotatesprite_(x, y, zoom, ang, tilenum, shade, pal, bit.bor(2,orientation),
|
ffiC.rotatesprite_(x, y, zoom, ang, tilenum, shade, pal, bit.bor(2,orientation),
|
||||||
|
|
|
@ -421,7 +421,8 @@ end
|
||||||
|
|
||||||
function on.event_end(pos, eventidx, codetab)
|
function on.event_end(pos, eventidx, codetab)
|
||||||
assert(type(codetab)=="table")
|
assert(type(codetab)=="table")
|
||||||
paddcodef(pos, "gameevent(%d, function (_aci, _pli, _dist)", eventidx)
|
-- 0x20000000: actor.FLAGS.chain_beg
|
||||||
|
paddcodef(pos, "gameevent(%d,0x20000000,function (_aci, _pli, _dist)", eventidx)
|
||||||
addcode(get_cache_sap_code())
|
addcode(get_cache_sap_code())
|
||||||
addcode(codetab)
|
addcode(codetab)
|
||||||
addcode("end)")
|
addcode("end)")
|
||||||
|
|
Loading…
Reference in a new issue