mapster32: new command-line switch '-namesfile <filename>' for overriding NAMES.H; new 'drawlabel <quotenum> <x> <y> <z> <col> <backcol>' m32script command for drawing small labels, see end of a.m32 for an example; some special handling for sprites whose tile yoffset is greater or equal their pixel height.

git-svn-id: https://svn.eduke32.com/eduke32@1832 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-03-07 16:30:06 +00:00
parent cdb153fd35
commit 148f3cadef
10 changed files with 214 additions and 187 deletions

View file

@ -64,6 +64,7 @@ extern int16_t prefixtiles[16];
extern char program_origcwd[BMAX_PATH]; extern char program_origcwd[BMAX_PATH];
extern char *mapster32_fullpath; extern char *mapster32_fullpath;
extern char *testplay_addparam; extern char *testplay_addparam;
extern const char *g_namesFileName;
extern int32_t m32_osd_tryscript; extern int32_t m32_osd_tryscript;
extern int32_t showheightindicators; extern int32_t showheightindicators;
@ -126,6 +127,8 @@ extern void showsectordata(int16_t sectnum, int16_t small);
extern void showwalldata(int16_t wallnum, int16_t small); extern void showwalldata(int16_t wallnum, int16_t small);
extern void showspritedata(int16_t spritenum, int16_t small); extern void showspritedata(int16_t spritenum, int16_t small);
extern void drawsmallabel(const char *text, char col, char backcol, int32_t dax, int32_t day, int32_t daz);
extern int32_t circlewall; extern int32_t circlewall;
int32_t loadsetup(const char *fn); // from config.c int32_t loadsetup(const char *fn); // from config.c
@ -162,6 +165,7 @@ void update_highlightsector();
int32_t inside_editor(const vec3_t *pos, int32_t searchx, int32_t searchy, int32_t zoom, int32_t inside_editor(const vec3_t *pos, int32_t searchx, int32_t searchy, int32_t zoom,
int32_t x, int32_t y, int16_t sectnum); int32_t x, int32_t y, int16_t sectnum);
void correct_sprite_yoffset(int32_t i);
extern uint8_t hlsectorbitmap[MAXSECTORS>>3]; extern uint8_t hlsectorbitmap[MAXSECTORS>>3];

View file

@ -106,6 +106,7 @@ int16_t localartlookup[MAXTILES], localartlookupnum;
char tempbuf[4096]; char tempbuf[4096];
char names[MAXTILES][25]; char names[MAXTILES][25];
const char *g_namesFileName = "NAMES.H";
int16_t asksave = 0; int16_t asksave = 0;
extern int16_t editstatus, searchit; extern int16_t editstatus, searchit;
@ -229,7 +230,7 @@ void overheadeditor(void);
static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line); static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line);
void fixspritesectors(void); void fixspritesectors(void);
static int32_t movewalls(int32_t start, int32_t offs); static int32_t movewalls(int32_t start, int32_t offs);
int32_t loadnames(void); int32_t loadnames(const char *namesfile);
void updatenumsprites(void); void updatenumsprites(void);
static void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny); static void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny);
static void initcrc(void); static void initcrc(void);
@ -446,7 +447,7 @@ int32_t app_main(int32_t argc, const char **argv)
} }
#endif #endif
loadnames(); loadnames(g_namesFileName);
if (initinput()) return -1; if (initinput()) return -1;
// if (option[3] != 0) moustat = // if (option[3] != 0) moustat =
@ -1132,6 +1133,8 @@ void editinput(void)
else else
sprite[i].cstat |= (tilesizy[sprite[i].picnum]>=32); sprite[i].cstat |= (tilesizy[sprite[i].picnum]>=32);
correct_sprite_yoffset(i);
updatenumsprites(); updatenumsprites();
asksave = 1; asksave = 1;
@ -1285,10 +1288,14 @@ static inline void drawline16base(int32_t bx, int32_t by, int32_t x1, int32_t y1
drawline16(bx+x1, by+y1, bx+x2, by+y2, col); drawline16(bx+x1, by+y1, bx+x2, by+y2, col);
} }
static void drawsmalllabel(const char *text, char col, char backcol, int32_t dax, int32_t day) void drawsmallabel(const char *text, char col, char backcol, int32_t dax, int32_t day, int32_t daz)
{ {
int32_t x1, y1, x2, y2; int32_t x1, y1, x2, y2;
screencoords(&dax,&day, dax-pos.x,day-pos.y, zoom);
if (m32_sideview)
day += getscreenvdisp(daz-pos.z, zoom);
x1 = halfxdim16+dax-(Bstrlen(text)<<1); x1 = halfxdim16+dax-(Bstrlen(text)<<1);
y1 = midydim16+day-4; y1 = midydim16+day-4;
x2 = x1 + (Bstrlen(text)<<2)+2; x2 = x1 + (Bstrlen(text)<<2)+2;
@ -1781,6 +1788,22 @@ static int32_t insert_sprite_common(int32_t sucksect, int32_t dax, int32_t day)
return i; return i;
} }
void correct_sprite_yoffset(int32_t i)
{
int32_t tileyofs = (int8_t)((picanm[sprite[i].picnum]>>16)&255);
int32_t tileysiz = tilesizy[sprite[i].picnum];
if (klabs(tileyofs) >= tileysiz)
{
tileyofs *= -1;
if (tileyofs == 128)
tileyofs = 127;
sprite[i].yoffset = tileyofs;
}
else
sprite[i].yoffset = 0;
}
static void fade_screen() static void fade_screen()
{ {
@ -2186,7 +2209,6 @@ void overheadeditor(void)
} }
draw2dscreen(&pos,cursectnum,ang,zoom,grid); draw2dscreen(&pos,cursectnum,ang,zoom,grid);
VM_OnEvent(EVENT_DRAW2DSCREEN, -1);
begindrawing(); //{{{ begindrawing(); //{{{
if (showtags == 1) if (showtags == 1)
@ -2195,7 +2217,6 @@ void overheadeditor(void)
{ {
for (i=0; i<numsectors; i++) for (i=0; i<numsectors; i++)
{ {
int32_t vdisp = 0;
int16_t secshort = i; int16_t secshort = i;
dabuffer = (char *)ExtGetSectorCaption(i); dabuffer = (char *)ExtGetSectorCaption(i);
@ -2204,13 +2225,8 @@ void overheadeditor(void)
get_sectors_center(&secshort, 1, &dax, &day); get_sectors_center(&secshort, 1, &dax, &day);
if (m32_sideview) drawsmallabel(dabuffer, editorcolors[0], editorcolors[7],
vdisp = getscreenvdisp(getflorzofslope(i,dax,day)-pos.z, zoom); dax, day, getflorzofslope(i,dax,day));
screencoords(&dax,&day, dax-pos.x,day-pos.y, zoom);
if (m32_sideview)
day += vdisp;
drawsmalllabel(dabuffer, editorcolors[0], editorcolors[7], dax, day);
} }
} }
@ -2239,14 +2255,11 @@ void overheadeditor(void)
if ((dax > x3) && (dax < x4) && (day > y3) && (day < y4)) if ((dax > x3) && (dax < x4) && (day > y3) && (day < y4))
{ {
dabuffer = (char *)ExtGetWallCaption(i); dabuffer = (char *)ExtGetWallCaption(i);
if (dabuffer[0] != 0) if (dabuffer[0] == 0)
{ continue;
screencoords(&dax,&day, dax-pos.x,day-pos.y, zoom);
if (m32_sideview)
day += getscreenvdisp(getflorzofslope(sectorofwall(i), dax,day)-pos.z, zoom);
drawsmalllabel(dabuffer, editorcolors[0], editorcolors[31], dax, day); drawsmallabel(dabuffer, editorcolors[0], editorcolors[31],
} dax, day, getflorzofslope(sectorofwall(i), dax,day));
} }
} }
@ -2267,23 +2280,17 @@ void overheadeditor(void)
dabuffer = (char *)ExtGetSpriteCaption(i); dabuffer = (char *)ExtGetSpriteCaption(i);
if (dabuffer[0] != 0) if (dabuffer[0] != 0)
{ {
//Get average point of sprite int32_t blocking = (sprite[i].cstat&1);
screencoords(&dax,&day, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom);
if (m32_sideview)
day += getscreenvdisp(sprite[i].z-pos.z, zoom);
{ col = 3 + 2*blocking;
int32_t blocking = (sprite[i].cstat&1); if (spritecol2d[sprite[i].picnum][blocking])
col = spritecol2d[sprite[i].picnum][blocking];
col = 3 + 2*blocking; if ((i == pointhighlight-16384) && (totalclock & 32))
if (spritecol2d[sprite[i].picnum][blocking]) col += (2<<2);
col = spritecol2d[sprite[i].picnum][blocking];
if ((i == pointhighlight-16384) && (totalclock & 32)) drawsmallabel(dabuffer, editorcolors[0], editorcolors[col],
col += (2<<2); sprite[i].x, sprite[i].y, sprite[i].z);
drawsmalllabel(dabuffer, editorcolors[0], editorcolors[col], dax, day);
}
} }
j--; j--;
} }
@ -2291,14 +2298,23 @@ void overheadeditor(void)
} }
} }
// stick this event right between begin- end enddrawing()...
// also after the above label stuff so users can redefine them
VM_OnEvent(EVENT_DRAW2DSCREEN, -1);
printcoords16(pos.x,pos.y,ang); printcoords16(pos.x,pos.y,ang);
numwalls = tempint; numwalls = tempint;
if (highlightsectorcnt >= 0) if (highlightsectorcnt >= 0)
{
int32_t oydim16 = ydim16;
ydim16 = ydim-STATUS2DSIZ2;
for (i=0; i<numsectors; i++) for (i=0; i<numsectors; i++)
if (hlsectorbitmap[i>>3]&(1<<(i&7))) if (hlsectorbitmap[i>>3]&(1<<(i&7)))
fillsector(i,2); fillsector(i,2);
ydim16 = oydim16;
}
if (keystatus[0x2a]) // FIXME if (keystatus[0x2a]) // FIXME
{ {
@ -2375,7 +2391,7 @@ void overheadeditor(void)
////// Draw the white pixel closest to mouse cursor on linehighlight ////// Draw the white pixel closest to mouse cursor on linehighlight
if (linehighlight>=0 && !m32_sideview) if (linehighlight>=0 && !m32_sideview)
{ {
getclosestpointonwall(mousxplc,mousyplc,(int32_t)linehighlight,&dax,&day); getclosestpointonwall(mousxplc,mousyplc, linehighlight, &dax,&day);
x2 = mulscale14(dax-pos.x,zoom); x2 = mulscale14(dax-pos.x,zoom);
y2 = mulscale14(day-pos.y,zoom); y2 = mulscale14(day-pos.y,zoom);
@ -2660,7 +2676,7 @@ void overheadeditor(void)
keystatus[0x46] = 0; keystatus[0x46] = 0;
asksave = 1; asksave = 1;
} }
#if 1
if (keystatus[0x3f]) //F5 if (keystatus[0x3f]) //F5
{ {
// keystatus[0x3f] = 0; // keystatus[0x3f] = 0;
@ -2730,6 +2746,7 @@ void overheadeditor(void)
ydim16 = ydim-STATUS2DSIZ2; ydim16 = ydim-STATUS2DSIZ2;
} }
} }
#endif
if (keystatus[0x23]) //H (Hi 16 bits of tag) if (keystatus[0x23]) //H (Hi 16 bits of tag)
{ {
@ -4052,6 +4069,8 @@ end_join_sectors:
if (tilesizy[sprite[i].picnum] >= 32) if (tilesizy[sprite[i].picnum] >= 32)
sprite[i].cstat |= 1; sprite[i].cstat |= 1;
correct_sprite_yoffset(i);
printmessage16("Sprite inserted."); printmessage16("Sprite inserted.");
updatenumsprites(); updatenumsprites();
asksave = 1; asksave = 1;
@ -6788,18 +6807,35 @@ static int16_t whitelinescan(int16_t dalinehighlight)
return(tnewnumwalls); return(tnewnumwalls);
} }
int32_t loadnames(void) int32_t loadnames(const char *namesfile)
{ {
char buffer[1024], *p, *name, *number, *endptr; char buffer[1024], *p, *name, *number, *endptr;
int32_t num, syms=0, line=0, a, comment=0; int32_t num, syms=0, line=0, a, comment=0;
BFILE *fp; BFILE *fp;
fp = fopenfrompath("NAMES.H","r"); Bstrncpy(buffer, namesfile, sizeof(buffer));
buffer[sizeof(buffer)-1] = 0;
p = buffer;
while (*p)
{
*p = Btoupper(*p);
p++;
}
fp = fopenfrompath(buffer,"r");
if (!fp) if (!fp)
{ {
if ((fp = fopenfrompath("names.h","r")) == NULL) p = buffer;
while (*p)
{ {
initprintf("Failed to open NAMES.H\n"); *p = Btolower(*p);
p++;
}
if ((fp = fopenfrompath(buffer,"r")) == NULL)
{
initprintf("Failed to open %s\n", buffer);
return -1; return -1;
} }
} }
@ -6807,7 +6843,7 @@ int32_t loadnames(void)
//clearbufbyte(names, sizeof(names), 0); //clearbufbyte(names, sizeof(names), 0);
Bmemset(names,0,sizeof(names)); Bmemset(names,0,sizeof(names));
initprintf("Loading NAMES.H\n"); initprintf("Loading %s\n", buffer);
while (Bfgets(buffer, 1024, fp)) while (Bfgets(buffer, 1024, fp))
{ {

View file

@ -9179,7 +9179,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, const sectortype *sec, hitdat
} }
} }
} }
else if ((how*vz > 0) && (how *sv->z <= how*z)) else if ((how*vz > 0) && (how*sv->z <= how*z))
{ {
z1 = z; i = z1-sv->z; z1 = z; i = z1-sv->z;
if ((klabs(i)>>1) < vz*how) if ((klabs(i)>>1) < vz*how)

View file

@ -24,16 +24,15 @@ define SFACTORSTEPS 100
define PREVIEW_DRAW_COLOR 11 define PREVIEW_DRAW_COLOR 11
gamevar showpal 0 0 gamevar showpal 0 0
// 2d mode corruption checker interval, 120 = 1 second
gamevar checkinterval 1200 0
// whether to use overridden aspect/range values when entering 3d mode (software/Polymost). // whether to use overridden aspect/range values when entering 3d mode (software/Polymost).
// tweak with keys 7,8,9,0 on the top row // tweak with keys 7,8,9,0 on the top row
gamevar use_custom_aspect 0 0 // this is now the same as r_usenewaspect gamevar use_custom_aspect 0 0 // this is now the same as r_usenewaspect
gamevar davr 65536 0 gamevar davr 65536 0
gamevar dayx 65536 0 gamevar dayx 65536 0
// see end of file for user key defs
// see end of file for more user settings and examples
////////// END USER SETTINGS ////////// ////////// END USER SETTINGS //////////
@ -72,18 +71,6 @@ definequote LIGHTQUOTE light %d %d %d %d %d %d %d %d %d %d %d %d %d %d
// sec range radius fade ang horiz prio tile // sec range radius fade ang horiz prio tile
// Corruption checker
definequote 19 PANIC!!! SECTOR OR WALL LIMIT EXCEEDED!!!
definequote 20 SECTOR[%d].WALLPTR=%d out of range: numwalls=%d
definequote 21 SECTOR[%d].WALLPTR=%d inconsistent, expected %d
definequote 22 SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d
definequote 23 WALL[%d].POINT2=%d out of range [%d, %d]
definequote 24 WALL[%d].NEXTWALL=%d out of range: numwalls=%d
definequote 25 WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d
definequote 26 SPRITE[%d].SECTNUM=%d. Expect problems!
definequote 27 SPRITE[%d].PICNUM=%d out of range, resetting to 0
definequote 28 WALL[%d] has nextsector but no nextwall or vice versa!
define PRSCALE 1000 define PRSCALE 1000
define MAXSPECULAR 100000 define MAXSPECULAR 100000
@ -393,7 +380,9 @@ defstate fiddlewithlights
} }
ends ends
defstate userkeys_3d ends // forward-ref // forward refs
defstate userkeys_3d ends
defstate userdrawlabel ends
onevent EVENT_PREKEYS3D onevent EVENT_PREKEYS3D
// state testkeyavail // state testkeyavail
@ -1017,116 +1006,13 @@ defstate jumptosec // (tmp)
updatecursectnum updatecursectnum
ends ends
// Map corruption checker
// now included in Mapster32 natively
/*
defstate corruptchk
var ewall
var endwall
var ok
ifle numsectors MAXSECTORS ifle numwalls MAXWALLS nullop else
{ quote 19 printmessage16 19 return }
set ok 1
set ewall 0 // expected wall index
for i allsectors
{
set k 1
ifge sector[i].wallptr 0 ifl sector[i].wallptr numwalls nullop else
{
qsprintf TQUOTE 20 i sector[i].wallptr numwalls
quote TQUOTE printmessage16 TQUOTE
set k 0
}
ifn ewall sector[i].wallptr
{
qsprintf TQUOTE 21 i sector[i].wallptr ewall
quote TQUOTE printmessage16 TQUOTE
set ewall sector[i].wallptr
}
add ewall sector[i].wallnum
set endwall sector[i].wallptr add endwall sector[i].wallnum
ifg endwall numwalls
{
qsprintf TQUOTE 22 i endwall numwalls
quote TQUOTE printmessage16 TQUOTE
set k 0
}
and ok k
ifn k 0
{
sub endwall 1
for j wallsofsector i
{
ifge wall[j].point2 sector[i].wallptr ifle wall[i].point2 endwall nullop else
{
qsprintf TQUOTE 23 j wall[j].point2 sector[i].wallptr endwall
quote TQUOTE printmessage16 TQUOTE
set ok 0
}
ifge wall[j].nextwall numwalls
{
qsprintf TQUOTE 24 j wall[j].nextwall numwalls
quote TQUOTE printmessage16 TQUOTE
set ok 0
}
ifge wall[j].nextsector numsectors
{
qsprintf TQUOTE 25 j wall[j].nextsector numsectors
quote TQUOTE printmessage16 TQUOTE
set ok 0
}
set k 0
ifge wall[j].nextsector 0, xor k 1
ifge wall[j].nextwall 0, xor k 1
ife k 1
{
qsprintf TQUOTE 28 j
quote TQUOTE printmessage16 TQUOTE
set ok 0
}
}
}
}
for i allsprites
{
ifl .sectnum 0
{
qsprintf TQUOTE 26 i .sectnum
quote TQUOTE printmessage16 TQUOTE
set ok 0
}
ifge .picnum 0 ifl .picnum MAXTILES nullop else
{
qsprintf TQUOTE 27 i .picnum
quote TQUOTE printmessage16 TQUOTE
set .picnum 0
set ok 0
}
}
ife ok 0
print "--"
ends
*/
gamevar d2d_lastcheck 0 0
onevent EVENT_DRAW2DSCREEN onevent EVENT_DRAW2DSCREEN
var tmp var tmp
var xx var xx
state userdrawlabel
ifge cursectnum 0 ifge cursectnum 0
{ {
state connectlocators state connectlocators
@ -1135,14 +1021,6 @@ onevent EVENT_DRAW2DSCREEN
state previewdoors2d state previewdoors2d
ifl checkinterval 120, set checkinterval 120
set tmp totalclock, sub tmp checkinterval
ifl d2d_lastcheck tmp
{
set d2d_lastcheck totalclock
// state corruptchk
}
ifn showpal 0 ifn showpal 0
{ {
set xx 100 set xx 100
@ -1237,7 +1115,23 @@ defstate chselshade
ends ends
////////// USER KEY SETTINGS ////////// ////////// USER AREA //////////
// key settings
defstate userkeys_3d defstate userkeys_3d
ifholdkey KEY_SEMI ifhitkey KEY_C state chselshade ifholdkey KEY_SEMI ifhitkey KEY_C state chselshade
ends ends
/*
// example for custom labels
defstate userdrawlabel
for i allsprites
{
ifactor 2978
{
qsprintf TQUOTE "MOVABLE EX:%d OW:%d", sprite[i].owner, sprite[i].extra
drawlabel TQUOTE .x .y .z 0 31
}
}
ends
*/

View file

@ -152,3 +152,26 @@ defstate consttest
qsprintf TQUOTE "%d %d %d %d" -2147483648 MIN_CONSTANT i j qsprintf TQUOTE "%d %d %d %d" -2147483648 MIN_CONSTANT i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
ends ends
defstate anmtest
var yo
for i range MAXTILES
{
set j tilesizx[i], or j tilesizy[i]
ifn j 0
{
set yo picanm[i]
shiftl yo 8, shiftr yo 24 // sign-extend
ifl yo 0, inv yo
ifge yo tilesizy[i]
{
qsprintf TQUOTE "Tile %d's y offset >= y size" i
quote TQUOTE
}
}
}
ends

View file

@ -400,6 +400,8 @@ void create_map_snapshot(void)
} }
} }
} }
CheckMapCorruption(6, 0);
} }
void map_undoredo_free(void) void map_undoredo_free(void)
@ -3211,7 +3213,6 @@ static int32_t m32gettile(int32_t idInitialTile)
keystatus[KEYSC_ENTER] = 0; keystatus[KEYSC_ENTER] = 0;
return idSelectedTile; return idSelectedTile;
} }
// Dir = 0 (zoom out) or 1 (zoom in) // Dir = 0 (zoom out) or 1 (zoom in)
@ -3671,10 +3672,19 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i
Bsprintf(szT,"%dx%d",tilesizx[idTile],tilesizy[idTile]); Bsprintf(szT,"%dx%d",tilesizx[idTile],tilesizy[idTile]);
printext256(xdim>>2,ydim-10,whitecol,-1,szT,0); printext256(xdim>>2,ydim-10,whitecol,-1,szT,0);
// EditArt animation flags. // EditArt offset flags.
Bsprintf(szT,"%d, %d",(picanm[idTile]>>8)&0xFF,(picanm[idTile]>>16)&0xFF); Bsprintf(szT,"%d, %d", (int8_t)((picanm[idTile]>>8)&0xFF), (int8_t)((picanm[idTile]>>16)&0xFF));
printext256((xdim>>2)+100,ydim-10,whitecol,-1,szT,0); printext256((xdim>>2)+100,ydim-10,whitecol,-1,szT,0);
// EditArt animation flags.
if (picanm[idTile]&0xc0)
{
static const char *anmtype[] = {"", "Osc", "Fwd", "Bck"};
Bsprintf(szT,"%s %d", anmtype[(picanm[idTile]&0xc0)>>6], picanm[idTile]&0x3f);
printext256((xdim>>2)+100+14*8,ydim-10,whitecol,-1,szT,0);
}
if (showmsg) if (showmsg)
TMPERRMSG_SHOW(0); TMPERRMSG_SHOW(0);
@ -4420,7 +4430,8 @@ static void Keys3d(void)
sprite[searchwall].hitag, sprite[searchwall].extra); sprite[searchwall].hitag, sprite[searchwall].extra);
Bsprintf(lines[num++], "Repeat: %d,%d", sprite[searchwall].xrepeat, sprite[searchwall].yrepeat); Bsprintf(lines[num++], "Repeat: %d,%d", sprite[searchwall].xrepeat, sprite[searchwall].yrepeat);
Bsprintf(lines[num++], "PosXY: %d,%d", sprite[searchwall].x, sprite[searchwall].y); Bsprintf(lines[num++], "PosXY: %d,%d%s", sprite[searchwall].x, sprite[searchwall].y,
sprite[searchwall].xoffset|sprite[searchwall].yoffset ? " ^251*":"");
Bsprintf(lines[num++], "PosZ: "" %d", sprite[searchwall].z);// prevents tab character Bsprintf(lines[num++], "PosZ: "" %d", sprite[searchwall].z);// prevents tab character
lines[num++][0]=0; lines[num++][0]=0;
@ -4511,6 +4522,9 @@ static void Keys3d(void)
if (AIMING_AT_MASKWALL && wall[searchwall].nextwall >= 0) if (AIMING_AT_MASKWALL && wall[searchwall].nextwall >= 0)
NEXTWALL(searchwall).overpicnum = tempint; NEXTWALL(searchwall).overpicnum = tempint;
if (AIMING_AT_SPRITE)
correct_sprite_yoffset(searchwall);
if (oldtile != tempint) if (oldtile != tempint)
asksave = 1; asksave = 1;
} }
@ -5023,6 +5037,9 @@ static void Keys3d(void)
j = 0; j = 0;
} }
if (AIMING_AT_SPRITE)
correct_sprite_yoffset(searchwall);
asksave = 1; asksave = 1;
} }
keystatus[KEYSC_DASH] = keystatus[KEYSC_EQUAL] = 0; keystatus[KEYSC_DASH] = keystatus[KEYSC_EQUAL] = 0;
@ -5661,11 +5678,14 @@ static void Keys3d(void)
{ {
if (ASSERT_AIMING) if (ASSERT_AIMING)
{ {
int16_t opicnum = AIMED_CF_SEL(picnum); int16_t opicnum = AIMED_CF_SEL(picnum), aimspr=AIMING_AT_SPRITE;
static const char *Typestr_tmp[5] = { "Wall", "Sector ceiling", "Sector floor", "Sprite", "Masked wall" }; static const char *Typestr_tmp[5] = { "Wall", "Sector ceiling", "Sector floor", "Sprite", "Masked wall" };
Bsprintf(tempbuf, "%s picnum: ", Typestr_tmp[searchstat]); Bsprintf(tempbuf, "%s picnum: ", Typestr_tmp[searchstat]);
getnumberptr256(tempbuf, &AIMED_CF_SEL(picnum), sizeof(int16_t), MAXTILES-1, 0, NULL); getnumberptr256(tempbuf, &AIMED_CF_SEL(picnum), sizeof(int16_t), MAXTILES-1, 0, NULL);
asksave |= (opicnum != AIMED_CF_SEL(picnum)); asksave |= (opicnum != AIMED_CF_SEL(picnum));
if (aimspr)
correct_sprite_yoffset(searchwall);
} }
} }
@ -5765,6 +5785,9 @@ static void Keys3d(void)
{ {
AIMED_SELOVR_PICNUM = temppicnum; AIMED_SELOVR_PICNUM = temppicnum;
message("Pasted picnum only"); message("Pasted picnum only");
if (AIMING_AT_SPRITE)
correct_sprite_yoffset(searchwall);
} }
i = 512; i = 512;
@ -6410,6 +6433,8 @@ static void Keys3d(void)
sprite[searchwall].yvel = tempyvel; sprite[searchwall].yvel = tempyvel;
sprite[searchwall].zvel = tempzvel; sprite[searchwall].zvel = tempzvel;
} }
else
correct_sprite_yoffset(searchwall);
} }
message("Pasted clipboard"); message("Pasted clipboard");
asksave = 1; asksave = 1;
@ -6442,7 +6467,10 @@ static void Keys3d(void)
for (i=0; i<MAXSPRITES; i++) for (i=0; i<MAXSPRITES; i++)
if (sprite[i].statnum < MAXSTATUS) if (sprite[i].statnum < MAXSTATUS)
if (sprite[i].picnum == j) if (sprite[i].picnum == j)
{
sprite[i].picnum = temppicnum; sprite[i].picnum = temppicnum;
correct_sprite_yoffset(i);
}
break; break;
case SEARCH_MASKWALL: case SEARCH_MASKWALL:
j = wall[searchwall].overpicnum; j = wall[searchwall].overpicnum;
@ -6494,6 +6522,8 @@ static void Keys3d(void)
sprite[searchwall].xrepeat = 64; sprite[searchwall].xrepeat = 64;
sprite[searchwall].yrepeat = 64; sprite[searchwall].yrepeat = 64;
} }
correct_sprite_yoffset(searchwall);
} }
if (ASSERT_AIMING) if (ASSERT_AIMING)
@ -7465,6 +7495,12 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
i++; i++;
continue; continue;
} }
if (!Bstrcasecmp(c+1,"namesfile"))
{
g_namesFileName = argv[i+1];
i++;
continue;
}
if (!Bstrcasecmp(c+1,"ww2gi")) if (!Bstrcasecmp(c+1,"ww2gi"))
{ {
Bstrcpy(g_grpNamePtr, "ww2gi.grp"); Bstrcpy(g_grpNamePtr, "ww2gi.grp");

View file

@ -363,6 +363,7 @@ const char *keyw[] =
"printmessage256", "printmessage256",
"printext256", "printext256",
"printext16", "printext16",
"drawlabel",
"getnumber16", "getnumber16",
"getnumber256", "getnumber256",
"qsprintf", "qsprintf",
@ -3266,14 +3267,18 @@ repeatcase:
case CON_QUOTE: case CON_QUOTE:
case CON_ERRORINS: case CON_ERRORINS:
case CON_PRINTMESSAGE16: case CON_PRINTMESSAGE16:
case CON_PRINTMESSAGE256:
case CON_PRINTEXT256: case CON_PRINTEXT256:
case CON_PRINTEXT16: case CON_PRINTEXT16:
case CON_DRAWLABEL:
if (C_GetNextVarOrString()==-1) if (C_GetNextVarOrString()==-1)
return 1; return 1;
if (tw==CON_PRINTMESSAGE256) if (tw==CON_PRINTMESSAGE256)
C_GetManyVars(2); C_GetManyVars(2);
else if (tw==CON_PRINTEXT256 || tw==CON_PRINTEXT16) else if (tw >= CON_PRINTEXT256)
C_GetManyVars(5); C_GetManyVars(5);
return 0; return 0;
case CON_GETNUMBER16: case CON_GETNUMBER16:

View file

@ -467,6 +467,7 @@ enum ScriptKeywords_t
CON_PRINTMESSAGE256, CON_PRINTMESSAGE256,
CON_PRINTEXT256, CON_PRINTEXT256,
CON_PRINTEXT16, CON_PRINTEXT16,
CON_DRAWLABEL,
CON_GETNUMBER16, CON_GETNUMBER16,
CON_GETNUMBER256, CON_GETNUMBER256,
CON_QSPRINTF, CON_QSPRINTF,

View file

@ -2385,6 +2385,7 @@ badindex:
case CON_PRINTMESSAGE256: case CON_PRINTMESSAGE256:
case CON_PRINTEXT256: case CON_PRINTEXT256:
case CON_PRINTEXT16: case CON_PRINTEXT16:
case CON_DRAWLABEL:
insptr++; insptr++;
{ {
int32_t i=*insptr++; int32_t i=*insptr++;
@ -2395,30 +2396,55 @@ badindex:
{ {
int32_t x=(tw>=CON_PRINTMESSAGE256)?Gv_GetVarX(*insptr++):0; int32_t x=(tw>=CON_PRINTMESSAGE256)?Gv_GetVarX(*insptr++):0;
int32_t y=(tw>=CON_PRINTMESSAGE256)?Gv_GetVarX(*insptr++):0; int32_t y=(tw>=CON_PRINTMESSAGE256)?Gv_GetVarX(*insptr++):0;
int32_t col=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0; int32_t col=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
int32_t backcol=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0; int32_t backcol=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
int32_t fontsize=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0; int32_t fontsize=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
if (tw==CON_ERRORINS) vm.flags |= VMFLAG_ERROR;
if (tw==CON_PRINT || tw==CON_ERRORINS) if (tw==CON_PRINT || tw==CON_ERRORINS)
{
OSD_Printf("%s\n", quotetext); OSD_Printf("%s\n", quotetext);
if (tw==CON_ERRORINS)
vm.flags |= VMFLAG_ERROR;
}
else if (tw==CON_QUOTE) else if (tw==CON_QUOTE)
{
message("%s", quotetext); message("%s", quotetext);
}
else if (tw==CON_PRINTMESSAGE16) else if (tw==CON_PRINTMESSAGE16)
printmessage16("%s", quotetext); {
if (qsetmode != 200)
printmessage16("%s", quotetext);
}
else if (tw==CON_PRINTMESSAGE256) else if (tw==CON_PRINTMESSAGE256)
printmessage256(x, y, quotetext); {
if (qsetmode == 200)
printmessage256(x, y, quotetext);
}
else if (tw==CON_PRINTEXT256) else if (tw==CON_PRINTEXT256)
{ {
if (col<0 || col>=256) col=0; if (qsetmode == 200)
if (backcol<0 || backcol>=256) backcol=-1; {
printext256(x, y, col, backcol, quotetext, fontsize); if (col<0 || col>=256) col=0;
if (backcol<0 || backcol>=256) backcol=-1;
printext256(x, y, col, backcol, quotetext, fontsize);
}
} }
else if (tw==CON_PRINTEXT16) else if (tw==CON_PRINTEXT16)
{ {
printext16(x, y, editorcolors[col&15], backcol<0 ? -1 : editorcolors[backcol&15], if (qsetmode != 200)
quotetext, fontsize); printext16(x, y, editorcolors[col&255], backcol<0 ? -1 : editorcolors[backcol&255],
quotetext, fontsize);
}
else if (tw==CON_DRAWLABEL)
{
if (qsetmode != 200)
{
drawsmallabel(quotetext,
editorcolors[backcol&255], // col
fontsize < 0 ? -1 : editorcolors[fontsize&255], // backcol
x, y, col); // x y z
}
} }
} }
} }

View file

@ -668,6 +668,8 @@ static void Gv_AddSystemVars(void)
Gv_NewArray("tilesizx", (void *)tilesizx, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT); Gv_NewArray("tilesizx", (void *)tilesizx, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
Gv_NewArray("tilesizy", (void *)tilesizy, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT); Gv_NewArray("tilesizy", (void *)tilesizy, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
// Gv_NewArray("picsiz", (void *)picsiz, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
Gv_NewArray("picanm", (void *)picanm, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFINT);
Gv_NewArray("show2dsector", (void *)show2dsector, (MAXSECTORS+7)>>3, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR); Gv_NewArray("show2dsector", (void *)show2dsector, (MAXSECTORS+7)>>3, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
Gv_NewArray("show2dwall", (void *)show2dwall, (MAXWALLS+7)>>3, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR); Gv_NewArray("show2dwall", (void *)show2dwall, (MAXWALLS+7)>>3, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);