Add "rotatespritea" to CON and M32script.

I hope I didn't bruise Lunatic too much.

git-svn-id: https://svn.eduke32.com/eduke32@3610 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2013-03-25 04:33:03 +00:00
parent 3d46bc1551
commit 30f510d521
13 changed files with 51 additions and 16 deletions

View file

@ -90,6 +90,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] =
{ CON_SETACTORSOUNDPITCH, 20111102 }, { CON_SETACTORSOUNDPITCH, 20111102 },
{ CON_ECHO, 20120304 }, { CON_ECHO, 20120304 },
{ CON_SHOWVIEWUNBIASED, 20120331 }, { CON_SHOWVIEWUNBIASED, 20120331 },
{ CON_ROTATESPRITEA, 20130324 },
}; };
#endif #endif
@ -576,6 +577,7 @@ const char *keyw[] =
"setactorsoundpitch", // 361 "setactorsoundpitch", // 361
"echo", // 362 "echo", // 362
"showviewunbiased", // 363 "showviewunbiased", // 363
"rotatespritea", // 364
"<null>" "<null>"
}; };
#endif #endif
@ -4610,6 +4612,16 @@ static int32_t C_ParseCommand(int32_t loop)
C_GetManyVars(12); C_GetManyVars(12);
continue; 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_SHOWVIEW:
case CON_SHOWVIEWUNBIASED: case CON_SHOWVIEWUNBIASED:
if (g_parsingEventPtr == NULL && g_processingState == 0) if (g_parsingEventPtr == NULL && g_processingState == 0)

View file

@ -936,6 +936,7 @@ enum ScriptKeywords_t
CON_SETACTORSOUNDPITCH, // 361 CON_SETACTORSOUNDPITCH, // 361
CON_ECHO, // 362 CON_ECHO, // 362
CON_SHOWVIEWUNBIASED, // 363 CON_SHOWVIEWUNBIASED, // 363
CON_ROTATESPRITEA, // 364
CON_END CON_END
}; };
#endif #endif

View file

@ -2593,6 +2593,7 @@ nullquote:
continue; continue;
} }
case CON_ROTATESPRITEA:
case CON_ROTATESPRITE16: case CON_ROTATESPRITE16:
case CON_ROTATESPRITE: case CON_ROTATESPRITE:
insptr++; insptr++;
@ -2600,10 +2601,11 @@ nullquote:
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), z=Gv_GetVarX(*insptr++); 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 a=Gv_GetVarX(*insptr++), tilenum=Gv_GetVarX(*insptr++), shade=Gv_GetVarX(*insptr++);
int32_t pal=Gv_GetVarX(*insptr++), orientation=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 x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++);
int32_t x2=Gv_GetVarX(*insptr++), y2=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; x<<=16;
y<<=16; y<<=16;
@ -2623,7 +2625,7 @@ nullquote:
orientation &= (ROTATESPRITE_MAX-1); 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; continue;
} }

View file

@ -968,6 +968,7 @@ lpeg.P(false) +
"savemapstate" + "savemapstate" +
"savegamevar" + "savegamevar" +
"save" + "save" +
"rotatespritea" +
"rotatesprite16" + "rotatesprite16" +
"rotatesprite" + "rotatesprite" +
"rotatepoint" + "rotatepoint" +

View file

@ -280,7 +280,7 @@ function isenemytile(tilenum)
end end
function rotatesprite(x, y, zoom, ang, tilenum, shade, pal, orientation, function rotatesprite(x, y, zoom, ang, tilenum, shade, pal, orientation,
cx1, cy1, cx2, cy2) alpha, cx1, cy1, cx2, cy2)
check_tile_idx(tilenum) check_tile_idx(tilenum)
orientation = bit.band(orientation, 4095) -- ROTATESPRITE_MAX-1 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 -- 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),
cx1, cy1, cx2, cy2) alpha, cx1, cy1, cx2, cy2)
end end
function _myos(x, y, zoom, tilenum, shade, orientation, pal) function _myos(x, y, zoom, tilenum, shade, orientation, pal)

View file

@ -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 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 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, 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, int8_t dashade, unsigned char dapalnum, int32_t dastat, uint8_t alpha,
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2); int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2);
void setaspect(int32_t daxrange, int32_t daaspect); void setaspect(int32_t daxrange, int32_t daaspect);

View file

@ -55,7 +55,7 @@ cansee;
hitscan; hitscan;
neartag; neartag;
getzrange; getzrange;
rotatesprite; rotatesprite_;
setaspect; setaspect;
kopen4load; kopen4load;

View file

@ -55,7 +55,7 @@ cansee;
hitscan; hitscan;
neartag; neartag;
getzrange; getzrange;
rotatesprite; rotatesprite_;
setaspect; setaspect;
kopen4load; kopen4load;

View file

@ -1725,11 +1725,15 @@ local handle =
end, end,
rotatesprite = function(...) 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, end,
rotatesprite16 = function(...) rotatesprite16 = function(...) -- TODO: non <<16 coordinates
return format("_con.rotatesprite(%s/65536,%s/65536,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", ...) 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, end,
-- readgamevar or savegamevar -- readgamevar or savegamevar
@ -2265,6 +2269,8 @@ local Cinner = {
/ handle.rotatesprite, / handle.rotatesprite,
rotatesprite16 = cmd(R,R,R,R,R,R,R,R,R,R,R,R) -- 12R rotatesprite16 = cmd(R,R,R,R,R,R,R,R,R,R,R,R) -- 12R
/ handle.rotatesprite16, / 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) sectorofwall = cmd(W,R,R)
/ handle.NYI, / handle.NYI,
sectclearinterpolation = cmd(R) sectclearinterpolation = cmd(R)

View file

@ -19,7 +19,7 @@ local function draw_hline_dotted(x1, x2, y, pal,stat)
x = x + (pl.ang - 1024)/100 x = x + (pl.ang - 1024)/100
end 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
end end
@ -43,7 +43,7 @@ local function rotatesprite_test()
end end
-- NUKEBUTTON -- 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 end
gameevent(gv.EVENT_DISPLAYREST, rotatesprite_test) gameevent(gv.EVENT_DISPLAYREST, rotatesprite_test)

View file

@ -412,6 +412,7 @@ const char *keyw[] =
"drawcircle16", "drawcircle16",
"drawcircle16b", "drawcircle16b",
"drawcircle16z", "drawcircle16z",
"rotatespritea",
"rotatesprite16", "rotatesprite16",
"rotatesprite", "rotatesprite",
"setgamepalette", "setgamepalette",
@ -3471,6 +3472,15 @@ repeatcase:
C_GetManyVars(12); // get the ID of the DEFs C_GetManyVars(12); // get the ID of the DEFs
break; break;
case CON_ROTATESPRITEA:
if (cs.parsingEventOfs < 0 && cs.currentStateIdx < 0)
{
C_ReportError(ERROR_EVENTONLY);
g_numCompilerErrors++;
}
C_GetManyVars(13);
break;
case CON_SETGAMEPALETTE: case CON_SETGAMEPALETTE:
C_GetNextVar(); C_GetNextVar();
return 0; return 0;

View file

@ -581,6 +581,7 @@ enum ScriptKeywords_t
CON_DRAWCIRCLE16, CON_DRAWCIRCLE16,
CON_DRAWCIRCLE16B, CON_DRAWCIRCLE16B,
CON_DRAWCIRCLE16Z, CON_DRAWCIRCLE16Z,
CON_ROTATESPRITEA,
CON_ROTATESPRITE16, CON_ROTATESPRITE16,
CON_ROTATESPRITE, CON_ROTATESPRITE,
CON_SETGAMEPALETTE, CON_SETGAMEPALETTE,

View file

@ -2911,6 +2911,7 @@ dodefault:
continue; continue;
} }
case CON_ROTATESPRITEA:
case CON_ROTATESPRITE16: case CON_ROTATESPRITE16:
case CON_ROTATESPRITE: case CON_ROTATESPRITE:
insptr++; insptr++;
@ -2918,11 +2919,12 @@ dodefault:
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), z=Gv_GetVarX(*insptr++); 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 a=Gv_GetVarX(*insptr++), tilenum=Gv_GetVarX(*insptr++), shade=Gv_GetVarX(*insptr++);
int32_t pal=Gv_GetVarX(*insptr++), orientation=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 x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++);
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++); int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++);
if (tw == CON_ROTATESPRITE && !(orientation & 256)) {x<<=16; y<<=16;} if (tw != CON_ROTATESPRITE16 && !(orientation & 256)) {x<<=16; y<<=16;}
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; continue;
} }