From 689a8aef1d7a99f28e042165d812a0b77ac0ffbf Mon Sep 17 00:00:00 2001 From: helixhorned Date: Wed, 5 Mar 2014 21:12:54 +0000 Subject: [PATCH] Propagate 'blend' to rotatesprite_(), but don't hook it up to scripting yet. git-svn-id: https://svn.eduke32.com/eduke32@4360 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 10 +++---- polymer/eduke32/build/src/engine.c | 30 +++++++++++-------- polymer/eduke32/source/game.c | 2 +- polymer/eduke32/source/gameexec.c | 2 +- polymer/eduke32/source/lunatic/control.lua | 2 +- .../eduke32/source/lunatic/defs_common.lua | 4 +-- polymer/eduke32/source/m32exec.c | 2 +- 7 files changed, 29 insertions(+), 23 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index bb5efa385..11990baf3 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -1102,8 +1102,8 @@ void clearview(int32_t dacol); void clearallviews(int32_t dacol); void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang); 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, uint8_t daalpha, - int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2); + int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, + int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2); void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col); int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize) ATTRIBUTE((nonnull(5))); @@ -1115,19 +1115,19 @@ static inline void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, in 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); + rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 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) { - rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0,0,xdim-1,ydim-1); + rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, 0,0,xdim-1,ydim-1); } static inline void rotatesprite_win(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, int32_t dastat) { - rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, windowx1,windowy1,windowx2,windowy2); + rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, windowx1,windowy1,windowx2,windowy2); } void bfirst_search_init(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int32_t maxnum, int16_t firstelt); diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 5d99cd437..ff4066644 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -2396,7 +2396,7 @@ typedef struct int16_t a, picnum; int8_t dashade; char dapalnum, dastat; - uint8_t daalpha; + uint8_t daalpha, dablend; char pagesleft; int32_t cx1, cy1, cx2, cy2; int32_t uniqid; //JF extension @@ -7253,7 +7253,7 @@ void dorotspr_handle_bit2(int32_t *sxptr, int32_t *syptr, int32_t *z, int32_t da // //JBF 20031206: Thanks to Ken's hunting, s/(rx1|ry1|rx2|ry2)/n\1/ in this function static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, - int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha, + int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, int32_t uniqid) { @@ -7712,7 +7712,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t #else tsetupspritevline(palookupoffs,xv,yv,ysiz); #endif - setup_blend(0, dastat & RS_TRANS2); + setup_blend(dablend, dastat & RS_TRANS2); } for (x=x1; xpagesleft > 0) && (per->pagesleft <= numpages)) dorotatesprite(per->sx,per->sy,per->z,per->a,per->picnum, - per->dashade,per->dapalnum,per->dastat,per->daalpha, + per->dashade,per->dapalnum,per->dastat,per->daalpha,per->dablend, per->cx1,per->cy1,per->cx2,per->cy2,per->uniqid); } enddrawing(); //}}} @@ -11344,7 +11344,7 @@ void nextpage(void) per = &permfifo[i]; if (per->pagesleft >= 130) dorotatesprite(per->sx,per->sy,per->z,per->a,per->picnum, - per->dashade,per->dapalnum,per->dastat,per->daalpha, + per->dashade,per->dapalnum,per->dastat,per->daalpha,per->dablend, per->cx1,per->cy1,per->cx2,per->cy2,per->uniqid); if (per->pagesleft&127) per->pagesleft--; @@ -14688,11 +14688,10 @@ void flushperms(void) // rotatesprite // 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, uint8_t daalpha, - int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2) + int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, + int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2) { int32_t i; - permfifotype *per, *per2; if ((unsigned)picnum >= MAXTILES) return; @@ -14709,7 +14708,7 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, if (((dastat & RS_PERM) == 0) || (numpages < 2) || (beforedrawrooms != 0)) { begindrawing(); //{{{ - dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,daalpha,cx1,cy1,cx2,cy2,guniqhudid); + dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,daalpha,dablend,cx1,cy1,cx2,cy2,guniqhudid); enddrawing(); //}}} } @@ -14722,12 +14721,14 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, if (numpages >= 2) { - per = &permfifo[permhead]; + permfifotype *per = &permfifo[permhead]; + per->sx = sx; per->sy = sy; per->z = z; per->a = a; per->picnum = picnum; per->dashade = dashade; per->dapalnum = dapalnum; per->dastat = dastat; per->daalpha = daalpha; + per->dablend = dablend; per->pagesleft = numpages+((beforedrawrooms&1)<<7); per->cx1 = cx1; per->cy1 = cy1; per->cx2 = cx2; per->cy2 = cy2; per->uniqid = guniqhudid; //JF extension @@ -14737,7 +14738,8 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, { for (i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) { - per2 = &permfifo[i]; + permfifotype *per2 = &permfifo[i]; + if ((per2->pagesleft&127) == 0) continue; if (per2->sx != per->sx) continue; if (per2->sy != per->sy) continue; @@ -14749,12 +14751,15 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, if (per2->cy1 < per->cy1) continue; if (per2->cx2 > per->cx2) continue; if (per2->cy2 > per->cy2) continue; + per2->pagesleft = 0; } + if ((per->z == 65536) && (per->a == 0)) for (i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) { - per2 = &permfifo[i]; + permfifotype *per2 = &permfifo[i]; + if ((per2->pagesleft&127) == 0) continue; if (per2->z != 65536) continue; if (per2->a != 0) continue; @@ -14766,6 +14771,7 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, if ((per2->sy>>16) < (per->sy>>16)) continue; if ((per2->sx>>16)+tilesizx[per2->picnum] > (per->sx>>16)+tilesizx[per->picnum]) continue; if ((per2->sy>>16)+tilesizy[per2->picnum] > (per->sy>>16)+tilesizy[per->picnum]) continue; + per2->pagesleft = 0; } } diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 0c5a21945..69f38ad47 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -929,7 +929,7 @@ vec2_t G_ScreenText(const int32_t font, G_AddCoordsFromRotation(&location, &Xdirection, pos.x); G_AddCoordsFromRotation(&location, &Ydirection, pos.y); - rotatesprite_(location.x, location.y, z, angle, tile, shade, pal, orientation, alpha, x1, y1, x2, y2); + rotatesprite_(location.x, location.y, z, angle, tile, shade, pal, orientation, alpha, 0, x1, y1, x2, y2); break; } diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 7937970d7..160970015 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -2732,7 +2732,7 @@ nullquote: orientation &= (ROTATESPRITE_MAX-1); - rotatesprite_(x,y,z,a,tilenum,shade,pal,2|orientation,alpha,x1,y1,x2,y2); + rotatesprite_(x,y,z,a,tilenum,shade,pal,2|orientation,alpha,0,x1,y1,x2,y2); continue; } diff --git a/polymer/eduke32/source/lunatic/control.lua b/polymer/eduke32/source/lunatic/control.lua index cf14c7419..4188bf3e2 100644 --- a/polymer/eduke32/source/lunatic/control.lua +++ b/polymer/eduke32/source/lunatic/control.lua @@ -409,7 +409,7 @@ function _rotspr(x, y, zoom, ang, tilenum, shade, pal, orientation, end ffiC.rotatesprite_(x, y, zoom, ang, tilenum, shade, pal, bor(2,orientation), - alpha, cx1, cy1, cx2, cy2) + alpha, 0, cx1, cy1, cx2, cy2) end -- The external legacy tile drawing function for Lunatic. diff --git a/polymer/eduke32/source/lunatic/defs_common.lua b/polymer/eduke32/source/lunatic/defs_common.lua index c66939214..7f3e95bcc 100644 --- a/polymer/eduke32/source/lunatic/defs_common.lua +++ b/polymer/eduke32/source/lunatic/defs_common.lua @@ -479,8 +479,8 @@ void updatesectorbreadth(int32_t x, int32_t y, int16_t *sectnum); void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum); void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, - int8_t dashade, unsigned char dapalnum, int32_t dastat, uint8_t alpha, - int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2); + int8_t dashade, unsigned char dapalnum, int32_t dastat, uint8_t alpha, uint8_t dablend, + int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2); void setaspect(int32_t daxrange, int32_t daaspect); ]] diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index ed11437cb..ba8161fdb 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -2935,7 +2935,7 @@ dodefault: orientation &= (ROTATESPRITE_MAX-1); - rotatesprite_(x,y,z,a,tilenum,shade,pal,2|orientation,alpha,x1,y1,x2,y2); + rotatesprite_(x,y,z,a,tilenum,shade,pal,2|orientation,alpha,0,x1,y1,x2,y2); continue; }