From 1e21ea3aae5f201b86b7a9f6327e2f77ff178d82 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 5 Apr 2013 17:52:50 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/include/build.h | 2 +- polymer/eduke32/source/lunatic/con_lang.lua | 2 +- polymer/eduke32/source/lunatic/control.lua | 16 ++++++++-------- polymer/eduke32/source/lunatic/lunacon.lua | 3 ++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 486479998..478ca32e1 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -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))); ////////// 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, int8_t dashade, char dapalnum, int32_t dastat, 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); } +// 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, int8_t dashade, char dapalnum, int32_t dastat) { diff --git a/polymer/eduke32/source/lunatic/con_lang.lua b/polymer/eduke32/source/lunatic/con_lang.lua index 0afd94ad6..80981d157 100644 --- a/polymer/eduke32/source/lunatic/con_lang.lua +++ b/polymer/eduke32/source/lunatic/con_lang.lua @@ -220,7 +220,7 @@ SFLAG = { SFLAG_CACHE = -0x00010000, SFLAG_ROTFIXED = -0x00020000, SFLAG_HARDCODED_BADGUY = -0x00040000, - -- RESERVED for actor.FLAGS.CHAIN_BEG/CHAIN_END/REPLACE: + -- RESERVED for actor.FLAGS.chain_beg/chain_end/replace: -- 0x20000000, 0x40000000 } diff --git a/polymer/eduke32/source/lunatic/control.lua b/polymer/eduke32/source/lunatic/control.lua index dc6dc6af6..f9f42ff92 100644 --- a/polymer/eduke32/source/lunatic/control.lua +++ b/polymer/eduke32/source/lunatic/control.lua @@ -284,22 +284,22 @@ function rotatesprite(x, y, zoom, ang, tilenum, shade, pal, orientation, check_tile_idx(tilenum) 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 x = 65536*x y = 65536*y 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 -- border is outside the screen etc... ffiC.rotatesprite_(x, y, zoom, ang, tilenum, shade, pal, bit.bor(2,orientation), - alpha, cx1, cy1, cx2, cy2) + alpha, cx1, cy1, cx2, cy2) end function _myos(x, y, zoom, tilenum, shade, orientation, pal) diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index 37f72440d..2aacb7c37 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -421,7 +421,8 @@ end function on.event_end(pos, eventidx, codetab) 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(codetab) addcode("end)")