diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 812ad0c00..e69b544bb 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -90,6 +90,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] = { CON_SETACTORSOUNDPITCH, 20111102 }, { CON_ECHO, 20120304 }, { CON_SHOWVIEWUNBIASED, 20120331 }, + { CON_ROTATESPRITEA, 20130324 }, }; #endif @@ -576,6 +577,7 @@ const char *keyw[] = "setactorsoundpitch", // 361 "echo", // 362 "showviewunbiased", // 363 + "rotatespritea", // 364 "" }; #endif @@ -4610,6 +4612,16 @@ static int32_t C_ParseCommand(int32_t loop) C_GetManyVars(12); continue; + case CON_ROTATESPRITEA: + if (g_parsingEventPtr == NULL && g_processingState == 0) + { + C_ReportError(ERROR_EVENTONLY); + g_numCompilerErrors++; + } + + C_GetManyVars(13); + continue; + case CON_SHOWVIEW: case CON_SHOWVIEWUNBIASED: if (g_parsingEventPtr == NULL && g_processingState == 0) diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 370b7aaf8..cf0d7e038 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -936,6 +936,7 @@ enum ScriptKeywords_t CON_SETACTORSOUNDPITCH, // 361 CON_ECHO, // 362 CON_SHOWVIEWUNBIASED, // 363 + CON_ROTATESPRITEA, // 364 CON_END }; #endif diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index dd5e913c5..9873853e6 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -2593,6 +2593,7 @@ nullquote: continue; } + case CON_ROTATESPRITEA: case CON_ROTATESPRITE16: case CON_ROTATESPRITE: insptr++; @@ -2600,10 +2601,11 @@ nullquote: int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), z=Gv_GetVarX(*insptr++); int32_t a=Gv_GetVarX(*insptr++), tilenum=Gv_GetVarX(*insptr++), shade=Gv_GetVarX(*insptr++); int32_t pal=Gv_GetVarX(*insptr++), orientation=Gv_GetVarX(*insptr++); + int32_t alpha = (tw == CON_ROTATESPRITEA) ? Gv_GetVarX(*insptr++) : 0; int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++); int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++); - if (tw == CON_ROTATESPRITE && !(orientation&ROTATESPRITE_FULL16)) + if (tw != CON_ROTATESPRITE16 && !(orientation&ROTATESPRITE_FULL16)) { x<<=16; y<<=16; @@ -2623,7 +2625,7 @@ nullquote: orientation &= (ROTATESPRITE_MAX-1); - rotatesprite(x,y,z,a,tilenum,shade,pal,2|orientation,x1,y1,x2,y2); + rotatesprite_(x,y,z,a,tilenum,shade,pal,2|orientation,alpha,x1,y1,x2,y2); continue; } diff --git a/polymer/eduke32/source/lunatic/con_lang.lua b/polymer/eduke32/source/lunatic/con_lang.lua index 758eb2e53..7ff256a10 100644 --- a/polymer/eduke32/source/lunatic/con_lang.lua +++ b/polymer/eduke32/source/lunatic/con_lang.lua @@ -968,6 +968,7 @@ lpeg.P(false) + "savemapstate" + "savegamevar" + "save" + +"rotatespritea" + "rotatesprite16" + "rotatesprite" + "rotatepoint" + diff --git a/polymer/eduke32/source/lunatic/control.lua b/polymer/eduke32/source/lunatic/control.lua index f83d7befe..21c3eb55c 100644 --- a/polymer/eduke32/source/lunatic/control.lua +++ b/polymer/eduke32/source/lunatic/control.lua @@ -280,7 +280,7 @@ function isenemytile(tilenum) end function rotatesprite(x, y, zoom, ang, tilenum, shade, pal, orientation, - cx1, cy1, cx2, cy2) + alpha, cx1, cy1, cx2, cy2) check_tile_idx(tilenum) orientation = bit.band(orientation, 4095) -- ROTATESPRITE_MAX-1 @@ -298,8 +298,8 @@ function rotatesprite(x, y, zoom, ang, tilenum, shade, pal, orientation, -- 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), - cx1, cy1, cx2, cy2) + ffiC.rotatesprite_(x, y, zoom, ang, tilenum, shade, pal, bit.bor(2,orientation), + alpha, cx1, cy1, cx2, cy2) end function _myos(x, y, zoom, tilenum, shade, orientation, pal) diff --git a/polymer/eduke32/source/lunatic/defs_common.lua b/polymer/eduke32/source/lunatic/defs_common.lua index bcb6844eb..5833048b8 100644 --- a/polymer/eduke32/source/lunatic/defs_common.lua +++ b/polymer/eduke32/source/lunatic/defs_common.lua @@ -286,8 +286,8 @@ void updatesector(int32_t x, int32_t y, int16_t *sectnum); 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, +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); void setaspect(int32_t daxrange, int32_t daaspect); diff --git a/polymer/eduke32/source/lunatic/dynsymlist b/polymer/eduke32/source/lunatic/dynsymlist index ca75a067e..98f5f9ac0 100644 --- a/polymer/eduke32/source/lunatic/dynsymlist +++ b/polymer/eduke32/source/lunatic/dynsymlist @@ -55,7 +55,7 @@ cansee; hitscan; neartag; getzrange; -rotatesprite; +rotatesprite_; setaspect; kopen4load; diff --git a/polymer/eduke32/source/lunatic/dynsymlist_m32 b/polymer/eduke32/source/lunatic/dynsymlist_m32 index aef9d79e3..0e4df0664 100644 --- a/polymer/eduke32/source/lunatic/dynsymlist_m32 +++ b/polymer/eduke32/source/lunatic/dynsymlist_m32 @@ -55,7 +55,7 @@ cansee; hitscan; neartag; getzrange; -rotatesprite; +rotatesprite_; setaspect; kopen4load; diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index 9a0fa83a0..025345351 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -1725,11 +1725,15 @@ local handle = end, rotatesprite = function(...) - return format("_con.rotatesprite(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", ...) + return format("_con.rotatesprite(%s,%s,%s,%s,%s,%s,%s,%s,0,%s,%s,%s,%s)", ...) end, - rotatesprite16 = function(...) - return format("_con.rotatesprite(%s/65536,%s/65536,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", ...) + rotatesprite16 = function(...) -- TODO: non <<16 coordinates + return format("_con.rotatesprite(%s/65536,%s/65536,%s,%s,%s,%s,%s,%s,0,%s,%s,%s,%s)", ...) + end, + + rotatespritea = function(...) + return format("_con.rotatesprite(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", ...) end, -- readgamevar or savegamevar @@ -2265,6 +2269,8 @@ local Cinner = { / handle.rotatesprite, rotatesprite16 = cmd(R,R,R,R,R,R,R,R,R,R,R,R) -- 12R / handle.rotatesprite16, + rotatespritea = cmd(R,R,R,R,R,R,R,R,R,R,R,R,R) -- 13R + / handle.rotatespritea, sectorofwall = cmd(W,R,R) / handle.NYI, sectclearinterpolation = cmd(R) diff --git a/polymer/eduke32/source/lunatic/test/test_rotspr.lua b/polymer/eduke32/source/lunatic/test/test_rotspr.lua index 62e2a751a..7288d9941 100644 --- a/polymer/eduke32/source/lunatic/test/test_rotspr.lua +++ b/polymer/eduke32/source/lunatic/test/test_rotspr.lua @@ -19,7 +19,7 @@ local function draw_hline_dotted(x1, x2, y, pal,stat) x = x + (pl.ang - 1024)/100 end - rs(x,y, 65536, 0, tile, 0,pal,stat, 0,0,gv.xdim-1,gv.ydim-1) + rs(x,y, 65536, 0, tile, 0,pal,stat,0, 0,0,gv.xdim-1,gv.ydim-1) end end @@ -43,7 +43,7 @@ local function rotatesprite_test() end -- NUKEBUTTON - rs(30,170, 32768, 2047*((gv.totalclock/240)%1), 142, 0,0,8+1024, 0,0,gv.xdim-1,gv.ydim-1) + rs(30,170, 32768, 2047*((gv.totalclock/240)%1), 142, 0,0,8+1024,0, 0,0,gv.xdim-1,gv.ydim-1) end gameevent(gv.EVENT_DISPLAYREST, rotatesprite_test) diff --git a/polymer/eduke32/source/m32def.c b/polymer/eduke32/source/m32def.c index 35b9ea8a8..5fe2a1f5d 100644 --- a/polymer/eduke32/source/m32def.c +++ b/polymer/eduke32/source/m32def.c @@ -412,6 +412,7 @@ const char *keyw[] = "drawcircle16", "drawcircle16b", "drawcircle16z", + "rotatespritea", "rotatesprite16", "rotatesprite", "setgamepalette", @@ -3471,6 +3472,15 @@ repeatcase: C_GetManyVars(12); // get the ID of the DEFs break; + case CON_ROTATESPRITEA: + if (cs.parsingEventOfs < 0 && cs.currentStateIdx < 0) + { + C_ReportError(ERROR_EVENTONLY); + g_numCompilerErrors++; + } + C_GetManyVars(13); + break; + case CON_SETGAMEPALETTE: C_GetNextVar(); return 0; diff --git a/polymer/eduke32/source/m32def.h b/polymer/eduke32/source/m32def.h index 15ac98f7b..d686556c6 100644 --- a/polymer/eduke32/source/m32def.h +++ b/polymer/eduke32/source/m32def.h @@ -581,6 +581,7 @@ enum ScriptKeywords_t CON_DRAWCIRCLE16, CON_DRAWCIRCLE16B, CON_DRAWCIRCLE16Z, + CON_ROTATESPRITEA, CON_ROTATESPRITE16, CON_ROTATESPRITE, CON_SETGAMEPALETTE, diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index dc297fe15..bce6bad37 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -2911,6 +2911,7 @@ dodefault: continue; } + case CON_ROTATESPRITEA: case CON_ROTATESPRITE16: case CON_ROTATESPRITE: insptr++; @@ -2918,11 +2919,12 @@ dodefault: int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), z=Gv_GetVarX(*insptr++); int32_t a=Gv_GetVarX(*insptr++), tilenum=Gv_GetVarX(*insptr++), shade=Gv_GetVarX(*insptr++); int32_t pal=Gv_GetVarX(*insptr++), orientation=Gv_GetVarX(*insptr++); + int32_t alpha = (tw == CON_ROTATESPRITEA) ? Gv_GetVarX(*insptr++) : 0; int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++); int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++); - if (tw == CON_ROTATESPRITE && !(orientation & 256)) {x<<=16; y<<=16;} - rotatesprite(x,y,z,a,tilenum,shade,pal,2|orientation,x1,y1,x2,y2); + if (tw != CON_ROTATESPRITE16 && !(orientation & 256)) {x<<=16; y<<=16;} + rotatesprite_(x,y,z,a,tilenum,shade,pal,2|orientation,alpha,x1,y1,x2,y2); continue; }