mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-18 15:11:51 +00:00
bugfixes; mark tiles in tile selector for later grouping (press SPACE on a tile); a.m32: convert to CRLF and add [xyz]vel query in 3d mode (Alt-KP1), also different keys for Polymer override var tweaking; some CRLF->LF in LF-only files.
git-svn-id: https://svn.eduke32.com/eduke32@1695 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
9ca26d9736
commit
c354695d60
13 changed files with 1591 additions and 1170 deletions
|
@ -453,6 +453,8 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2);
|
|||
void setaspect(int32_t daxrange, int32_t daaspect);
|
||||
void flushperms(void);
|
||||
|
||||
void plotlines2d(int32_t *xx, int32_t *yy, int32_t numpoints, char col);
|
||||
|
||||
void plotpixel(int32_t x, int32_t y, char col);
|
||||
char getpixel(int32_t x, int32_t y);
|
||||
void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
|
||||
|
|
|
@ -102,6 +102,9 @@ int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char
|
|||
#define getnumber16(namestart, num, maxnumber, sign) _getnumber16(namestart, num, maxnumber, sign, NULL)
|
||||
void printmessage256(int32_t x, int32_t y, const char *name);
|
||||
|
||||
// currently only for 3d mode
|
||||
const char* getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen);
|
||||
|
||||
// like snprintf, but pads the output buffer with 'fill' at the end
|
||||
int32_t snfillprintf(char *outbuf, size_t bufsiz, int32_t fill, const char *fmt, ...);
|
||||
void _printmessage16(const char *fmt, ...);
|
||||
|
|
|
@ -17,8 +17,8 @@ int32_t scriptfile_getsymbol(scriptfile *sf, int32_t *num);
|
|||
int32_t scriptfile_getlinum(scriptfile *sf, char *ptr);
|
||||
int32_t scriptfile_getbraces(scriptfile *sf, char **braceend);
|
||||
|
||||
scriptfile *scriptfile_fromfile(char *fn);
|
||||
scriptfile *scriptfile_fromstring(char *string);
|
||||
scriptfile *scriptfile_fromfile(const char *fn);
|
||||
scriptfile *scriptfile_fromstring(const char *string);
|
||||
void scriptfile_close(scriptfile *sf);
|
||||
int32_t scriptfile_eof(scriptfile *sf);
|
||||
|
||||
|
|
|
@ -417,6 +417,8 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
}
|
||||
//Bcanonicalisefilename(boardfilename,0);
|
||||
|
||||
loadnames(); // should be before ExtInit() because of auto 'Y' tile group
|
||||
|
||||
if ((i = ExtInit()) < 0) return -1;
|
||||
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
|
||||
if (i || forcesetup || cmdsetup)
|
||||
|
@ -437,7 +439,6 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
installusertimercallback(keytimerstuff);
|
||||
|
||||
loadpics("tiles000.art", 1048576*16);
|
||||
loadnames();
|
||||
|
||||
Bstrcpy(kensig,"Uses BUILD technology by Ken Silverman");
|
||||
initcrc();
|
||||
|
@ -679,7 +680,8 @@ void showmouse(void)
|
|||
plotpixel(searchx,searchy-i,whitecol);
|
||||
plotpixel(searchx,searchy+i,whitecol);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
*/
|
||||
|
||||
static int32_t mhk=0;
|
||||
void loadmhk()
|
||||
|
@ -3864,7 +3866,7 @@ SKIP:
|
|||
|
||||
if (newnumwalls >= numwalls)
|
||||
{
|
||||
if (newnumwalls > numwalls)
|
||||
if (newnumwalls > numwalls+1)
|
||||
newnumwalls--;
|
||||
else
|
||||
newnumwalls = -1;
|
||||
|
@ -4445,6 +4447,7 @@ CANCEL:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bad == 1)
|
||||
{
|
||||
Bstrcpy(boardfilename, selectedboardfilename);
|
||||
|
@ -4452,7 +4455,7 @@ CANCEL:
|
|||
printmessage16("Operation cancelled");
|
||||
showframe(1);
|
||||
}
|
||||
if (bad == 2)
|
||||
else if (bad == 2)
|
||||
{
|
||||
char *f; int32_t res;
|
||||
keystatus[0x1c] = 0;
|
||||
|
@ -5319,6 +5322,86 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha
|
|||
return(oldnum);
|
||||
}
|
||||
|
||||
// querystr: e.g. "Name: ", must be !=NULL
|
||||
// defaultstr: can be NULL
|
||||
// NO overflow checks are done when copying them!
|
||||
// maxlen: maximum length of entry string, if ==1, enter single char
|
||||
const char* getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen)
|
||||
{
|
||||
static char buf[128];
|
||||
int32_t ei=0, qrylen=0;
|
||||
char ch;
|
||||
|
||||
bflushchars();
|
||||
clearkeys();
|
||||
|
||||
if (maxlen==0)
|
||||
maxlen = 1000;
|
||||
|
||||
Bmemset(buf, 0, sizeof(buf));
|
||||
|
||||
qrylen = Bstrlen(querystr);
|
||||
Bmemcpy(buf, querystr, qrylen);
|
||||
|
||||
ei = qrylen;
|
||||
|
||||
if (defaultstr)
|
||||
{
|
||||
int32_t deflen = Bstrlen(defaultstr);
|
||||
Bmemcpy(&buf[ei], defaultstr, deflen);
|
||||
ei += deflen;
|
||||
}
|
||||
|
||||
buf[ei] = 0;
|
||||
|
||||
if (maxlen==1)
|
||||
{
|
||||
ei = qrylen;
|
||||
buf[ei+1] = 0;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
printext256(0, 0, whitecol, 0, buf, 0);
|
||||
showframe(1);
|
||||
|
||||
if (handleevents())
|
||||
quitevent = 0;
|
||||
|
||||
idle_waitevent();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
if (ch==13)
|
||||
break;
|
||||
else if (keystatus[1])
|
||||
{
|
||||
clearkeys();
|
||||
return defaultstr;
|
||||
}
|
||||
|
||||
if (maxlen!=1)
|
||||
{
|
||||
if (ei>qrylen && (ch==8 || ch==127))
|
||||
buf[--ei] = ' ';
|
||||
else if ((unsigned)ei<sizeof(buf)-1 && ei-qrylen<maxlen && isalnum(ch))
|
||||
{
|
||||
buf[ei++] = ch;
|
||||
buf[ei] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isalnum(ch) || ch==' ')
|
||||
buf[ei] = Btoupper(ch);
|
||||
}
|
||||
}
|
||||
|
||||
clearkeys();
|
||||
|
||||
return buf+qrylen;
|
||||
}
|
||||
|
||||
static void clearfilenames(void)
|
||||
{
|
||||
klistfree(finddirs);
|
||||
|
|
|
@ -315,26 +315,26 @@ int32_t findfrompath(const char *fn, char **where)
|
|||
*where = Bstrdup(fn);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *tfn = Bstrtolower(Bstrdup(fn));
|
||||
|
||||
if (access(tfn, F_OK) >= 0)
|
||||
{
|
||||
*where = tfn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Bstrupr(tfn);
|
||||
|
||||
if (access(tfn, F_OK) >= 0)
|
||||
{
|
||||
*where = tfn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Bfree(tfn);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *tfn = Bstrtolower(Bstrdup(fn));
|
||||
|
||||
if (access(tfn, F_OK) >= 0)
|
||||
{
|
||||
*where = tfn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Bstrupr(tfn);
|
||||
|
||||
if (access(tfn, F_OK) >= 0)
|
||||
{
|
||||
*where = tfn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Bfree(tfn);
|
||||
}
|
||||
}
|
||||
|
||||
for (pfn = (char*)fn; toupperlookup[*pfn] == '/'; pfn++);
|
||||
|
@ -370,30 +370,30 @@ int32_t findfrompath(const char *fn, char **where)
|
|||
*where = pfn;
|
||||
Bfree(ffn);
|
||||
Bfree(tfn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Check with all lowercase
|
||||
strcpy(pfn, sp->path);
|
||||
Bstrtolower(tfn);
|
||||
strcat(pfn, tfn);
|
||||
if (access(pfn, F_OK) >= 0)
|
||||
{
|
||||
*where = pfn;
|
||||
Bfree(ffn);
|
||||
Bfree(tfn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Check again with uppercase
|
||||
strcpy(pfn, sp->path);
|
||||
Bstrupr(tfn);
|
||||
strcat(pfn, tfn);
|
||||
if (access(pfn, F_OK) >= 0)
|
||||
{
|
||||
*where = pfn;
|
||||
Bfree(ffn);
|
||||
Bfree(tfn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Check with all lowercase
|
||||
strcpy(pfn, sp->path);
|
||||
Bstrtolower(tfn);
|
||||
strcat(pfn, tfn);
|
||||
if (access(pfn, F_OK) >= 0)
|
||||
{
|
||||
*where = pfn;
|
||||
Bfree(ffn);
|
||||
Bfree(tfn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Check again with uppercase
|
||||
strcpy(pfn, sp->path);
|
||||
Bstrupr(tfn);
|
||||
strcat(pfn, tfn);
|
||||
if (access(pfn, F_OK) >= 0)
|
||||
{
|
||||
*where = pfn;
|
||||
Bfree(ffn);
|
||||
Bfree(tfn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ int32_t loadsetup(const char *fn)
|
|||
if (readconfig(fp, "showheightindicators", val, VL) > 0)
|
||||
showheightindicators = min(max(Batoi(val),0),2);
|
||||
if (readconfig(fp, "showambiencesounds", val, VL) > 0)
|
||||
showheightindicators = min(max(Batoi(val),0),2);
|
||||
showambiencesounds = min(max(Batoi(val),0),2);
|
||||
|
||||
if (readconfig(fp, "graphicsmode", val, VL) > 0)
|
||||
graphicsmode = min(max(Batoi(val),0),2);
|
||||
|
|
|
@ -7667,6 +7667,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
|
|||
//bytesperline is set in this function
|
||||
|
||||
j = bpp;
|
||||
|
||||
if (setvideomode(daxdim,daydim,dabpp,davidoption) < 0) return(-1);
|
||||
|
||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
|
@ -9982,6 +9983,18 @@ void setbrightness(char dabrightness, uint8_t *dapal, char noapply)
|
|||
palfadedelta = 0;
|
||||
}
|
||||
|
||||
static inline palette_t getpal(int32_t col)
|
||||
{
|
||||
if (gammabrightness) return curpalette[col];
|
||||
else
|
||||
{
|
||||
palette_t p;
|
||||
p.b = britable[curbrightness][ curpalette[col].b ];
|
||||
p.g = britable[curbrightness][ curpalette[col].g ];
|
||||
p.r = britable[curbrightness][ curpalette[col].r ];
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// setpalettefade
|
||||
|
@ -9998,13 +10011,7 @@ void setpalettefade(char r, char g, char b, char offset)
|
|||
|
||||
for (i=0; i<256; i++)
|
||||
{
|
||||
if (gammabrightness) p = curpalette[i];
|
||||
else
|
||||
{
|
||||
p.b = britable[curbrightness][ curpalette[i].b ];
|
||||
p.g = britable[curbrightness][ curpalette[i].g ];
|
||||
p.r = britable[curbrightness][ curpalette[i].r ];
|
||||
}
|
||||
p = getpal(i);
|
||||
|
||||
curpalettefaded[i].b =
|
||||
p.b + (((palfadergb.b - p.b) * offset) >> 6);
|
||||
|
@ -10032,14 +10039,8 @@ void clearview(int32_t dacol)
|
|||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
if (rendmode >= 3)
|
||||
{
|
||||
palette_t p;
|
||||
if (gammabrightness) p = curpalette[dacol];
|
||||
else
|
||||
{
|
||||
p.r = britable[curbrightness][ curpalette[dacol].r ];
|
||||
p.g = britable[curbrightness][ curpalette[dacol].g ];
|
||||
p.b = britable[curbrightness][ curpalette[dacol].b ];
|
||||
}
|
||||
palette_t p = getpal(dacol);
|
||||
|
||||
bglClearColor(((float)p.r)/255.0,
|
||||
((float)p.g)/255.0,
|
||||
((float)p.b)/255.0,
|
||||
|
@ -10076,14 +10077,8 @@ void clearallviews(int32_t dacol)
|
|||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
if (rendmode >= 3)
|
||||
{
|
||||
palette_t p;
|
||||
if (gammabrightness) p = curpalette[dacol];
|
||||
else
|
||||
{
|
||||
p.r = britable[curbrightness][ curpalette[dacol].r ];
|
||||
p.g = britable[curbrightness][ curpalette[dacol].g ];
|
||||
p.b = britable[curbrightness][ curpalette[dacol].b ];
|
||||
}
|
||||
palette_t p = getpal(dacol);
|
||||
|
||||
bglViewport(0,0,xdim,ydim); glox1 = -1;
|
||||
bglClearColor(((float)p.r)/255.0,
|
||||
((float)p.g)/255.0,
|
||||
|
@ -10112,14 +10107,7 @@ void plotpixel(int32_t x, int32_t y, char col)
|
|||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
if (rendmode >= 3 && qsetmode == 200)
|
||||
{
|
||||
palette_t p;
|
||||
if (gammabrightness) p = curpalette[col];
|
||||
else
|
||||
{
|
||||
p.r = britable[curbrightness][ curpalette[col].r ];
|
||||
p.g = britable[curbrightness][ curpalette[col].g ];
|
||||
p.b = britable[curbrightness][ curpalette[col].b ];
|
||||
}
|
||||
palette_t p = getpal(col);
|
||||
|
||||
setpolymost2dview(); // JBF 20040205: more efficient setup
|
||||
|
||||
|
@ -10130,7 +10118,6 @@ void plotpixel(int32_t x, int32_t y, char col)
|
|||
bglRasterPos4i(x, y, 0, 1);
|
||||
bglDrawPixels(1, 1, GL_RGB, GL_UNSIGNED_BYTE, &p);
|
||||
bglRasterPos4i(0, 0, 0, 1);
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -10140,6 +10127,35 @@ void plotpixel(int32_t x, int32_t y, char col)
|
|||
enddrawing(); //}}}
|
||||
}
|
||||
|
||||
void plotlines2d(int32_t *xx, int32_t *yy, int32_t numpoints, char col)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
if (rendmode >= 3)
|
||||
{
|
||||
palette_t p = getpal(col);
|
||||
|
||||
bglBegin(GL_LINE_STRIP);
|
||||
|
||||
bglColor4ub(p.r, p.g, p.b, 1);
|
||||
|
||||
for (i=0; i<numpoints; i++)
|
||||
bglVertex2i(xx[i], yy[i]);
|
||||
|
||||
bglEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t odrawlinepat = drawlinepat;
|
||||
drawlinepat = 0xffffffff;
|
||||
|
||||
for (i=0; i<numpoints-1; i++)
|
||||
drawline16(xx[i], yy[i], xx[i+1], yy[i+1], col);
|
||||
|
||||
drawlinepat = odrawlinepat;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// getpixel
|
||||
|
@ -11524,22 +11540,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const
|
|||
{
|
||||
int32_t xx, yy;
|
||||
int32_t lc=-1;
|
||||
palette_t p,b;
|
||||
|
||||
if (gammabrightness)
|
||||
{
|
||||
p = curpalette[col];
|
||||
b = curpalette[backcol];
|
||||
}
|
||||
else
|
||||
{
|
||||
p.r = britable[curbrightness][ curpalette[col].r ];
|
||||
p.g = britable[curbrightness][ curpalette[col].g ];
|
||||
p.b = britable[curbrightness][ curpalette[col].b ];
|
||||
b.r = britable[curbrightness][ curpalette[backcol].r ];
|
||||
b.g = britable[curbrightness][ curpalette[backcol].g ];
|
||||
b.b = britable[curbrightness][ curpalette[backcol].b ];
|
||||
}
|
||||
palette_t p=getpal(col), b=getpal(backcol);
|
||||
|
||||
setpolymost2dview();
|
||||
bglDisable(GL_ALPHA_TEST);
|
||||
|
@ -11553,24 +11554,18 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const
|
|||
{
|
||||
char smallbuf[8];
|
||||
int32_t bi=0;
|
||||
|
||||
while (isdigit(name[i+1]) && bi<8)
|
||||
{
|
||||
smallbuf[bi++]=name[i+1];
|
||||
i++;
|
||||
}
|
||||
smallbuf[bi++]=0;
|
||||
if (col)col = atol(smallbuf);
|
||||
if (col)
|
||||
col = atol(smallbuf);
|
||||
|
||||
p = getpal(col);
|
||||
|
||||
if (gammabrightness)
|
||||
{
|
||||
p = curpalette[col];
|
||||
}
|
||||
else
|
||||
{
|
||||
p.r = britable[curbrightness][ curpalette[col].r ];
|
||||
p.g = britable[curbrightness][ curpalette[col].g ];
|
||||
p.b = britable[curbrightness][ curpalette[col].b ];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
letptr = &fontptr[name[i]<<3];
|
||||
|
|
|
@ -261,7 +261,7 @@ void scriptfile_preparse(scriptfile *sf, char *tx, int32_t flen)
|
|||
sf->eof = &sf->textbuf[nflen-1];
|
||||
}
|
||||
|
||||
scriptfile *scriptfile_fromfile(char *fn)
|
||||
scriptfile *scriptfile_fromfile(const char *fn)
|
||||
{
|
||||
int32_t fp;
|
||||
scriptfile *sf;
|
||||
|
@ -298,7 +298,7 @@ scriptfile *scriptfile_fromfile(char *fn)
|
|||
return sf;
|
||||
}
|
||||
|
||||
scriptfile *scriptfile_fromstring(char *string)
|
||||
scriptfile *scriptfile_fromstring(const char *string)
|
||||
{
|
||||
scriptfile *sf;
|
||||
char *tx;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3,161 +3,159 @@
|
|||
|
||||
#include "names.h"
|
||||
|
||||
tilegroup "Player"
|
||||
{
|
||||
hotkey "P"
|
||||
|
||||
// Colors are the colors for Blocking OFF and Blocking ON.
|
||||
colors 2 2
|
||||
|
||||
tiles
|
||||
{
|
||||
APLAYER
|
||||
}
|
||||
}
|
||||
// tilegroup "All named" with the hotkey "Y" is constructed automatically
|
||||
|
||||
tilegroup "Actors"
|
||||
{
|
||||
hotkey "A"
|
||||
|
||||
colors 31 31
|
||||
hotkey "A"
|
||||
|
||||
colors 31 31
|
||||
|
||||
tiles
|
||||
{
|
||||
LIZTROOP LIZTROOPRUNNING LIZTROOPSTAYPUT LIZTROOPSHOOT LIZTROOPJETPACK
|
||||
LIZTROOPONTOILET LIZTROOPJUSTSIT LIZTROOPDUCKING
|
||||
PIGCOP PIGCOPSTAYPUT PIGCOPDIVE
|
||||
LIZMAN LIZMANSTAYPUT LIZMANSPITTING LIZMANFEEDING LIZMANJUMP
|
||||
COMMANDER COMMANDERSTAYPUT
|
||||
OCTABRAIN OCTABRAINSTAYPUT
|
||||
ORGANTIC
|
||||
tiles
|
||||
{
|
||||
LIZTROOP LIZTROOPRUNNING LIZTROOPSTAYPUT LIZTROOPSHOOT LIZTROOPJETPACK
|
||||
LIZTROOPONTOILET LIZTROOPJUSTSIT LIZTROOPDUCKING
|
||||
PIGCOP PIGCOPSTAYPUT PIGCOPDIVE
|
||||
LIZMAN LIZMANSTAYPUT LIZMANSPITTING LIZMANFEEDING LIZMANJUMP
|
||||
COMMANDER COMMANDERSTAYPUT
|
||||
OCTABRAIN OCTABRAINSTAYPUT
|
||||
ORGANTIC
|
||||
DRONE
|
||||
NEWBEAST NEWBEASTSTAYPUT NEWBEASTHANG NEWBEASTJUMP
|
||||
EGG GREENSLIME ROTATEGUN RECON TANK BOUNCEMINE
|
||||
FLOORFLAME
|
||||
// FEMS
|
||||
FEM1 FEM2 FEM3 FEM4 FEM5 FEM6 FEM7 FEM8 FEM9 FEM10 NAKED1
|
||||
// Lil' critters
|
||||
SHARK
|
||||
// BIG critters
|
||||
BOSS1 BOSS1STAYPUT BOSS1SHOOT BOSS1LOB
|
||||
BOSS2
|
||||
BOSS3
|
||||
BOSS4 BOSS4STAYPUT
|
||||
}
|
||||
NEWBEAST NEWBEASTSTAYPUT NEWBEASTHANG NEWBEASTJUMP
|
||||
EGG GREENSLIME ROTATEGUN RECON TANK BOUNCEMINE
|
||||
FLOORFLAME
|
||||
// FEMS
|
||||
FEM1 FEM2 FEM3 FEM4 FEM5 FEM6 FEM7 FEM8 FEM9 FEM10 NAKED1
|
||||
// Lil' critters
|
||||
SHARK
|
||||
// BIG critters
|
||||
BOSS1 BOSS1STAYPUT BOSS1SHOOT BOSS1LOB
|
||||
BOSS2
|
||||
BOSS3
|
||||
BOSS4 BOSS4STAYPUT
|
||||
}
|
||||
}
|
||||
|
||||
tilegroup "Doors"
|
||||
{
|
||||
hotkey "D"
|
||||
hotkey "D"
|
||||
|
||||
tiles
|
||||
{
|
||||
DOORTILE1 DOORTILE2 DOORTILE3 DOORTILE4 DOORTILE5
|
||||
DOORTILE6 DOORTILE7 DOORTILE8 DOORTILE9 DOORTILE10
|
||||
312 313 314 345
|
||||
DOORTILE22 DOORTILE18 DOORTILE19 DOORTILE20
|
||||
450 455 457 458 459 469 470 477
|
||||
DOORTILE14
|
||||
719 735 771
|
||||
DOORTILE16
|
||||
843 858 883
|
||||
DOORTILE15 DOORTILE21
|
||||
1173
|
||||
DOORTILE11 DOORTILE12
|
||||
353 355
|
||||
// Related items
|
||||
DOORSHOCK ACCESSCARD
|
||||
}
|
||||
tiles
|
||||
{
|
||||
DOORTILE1 DOORTILE2 DOORTILE3 DOORTILE4 DOORTILE5
|
||||
DOORTILE6 DOORTILE7 DOORTILE8 DOORTILE9 DOORTILE10
|
||||
312 313 314 345
|
||||
DOORTILE22 DOORTILE18 DOORTILE19 DOORTILE20
|
||||
450 455 457 458 459 469 470 477
|
||||
DOORTILE14
|
||||
719 735 771
|
||||
DOORTILE16
|
||||
843 858 883
|
||||
DOORTILE15 DOORTILE21
|
||||
1173
|
||||
DOORTILE11 DOORTILE12
|
||||
353 355
|
||||
// Related items
|
||||
DOORSHOCK ACCESSCARD
|
||||
}
|
||||
}
|
||||
|
||||
tilegroup "Effectors"
|
||||
{
|
||||
hotkey "E"
|
||||
|
||||
tilerange 1 10
|
||||
|
||||
colors 15 15
|
||||
}
|
||||
hotkey "E"
|
||||
|
||||
tilegroup "Switches"
|
||||
{
|
||||
hotkey "S"
|
||||
|
||||
tiles
|
||||
{
|
||||
ACCESSSWITCH ACCESSSWITCH2 ACCESSCARD SLOTDOOR LIGHTSWITCH SPACEDOORSWITCH SPACELIGHTSWITCH
|
||||
FRANKENSTINESWITCH MULTISWITCH
|
||||
DIPSWITCH DIPSWITCH2 DIPSWITCH3 TECHSWITCH
|
||||
LIGHTSWITCH2 713 // LIGHTSWITCH2+1
|
||||
POWERSWITCH1 LOCKSWITCH1 POWERSWITCH2 HANDSWITCH PULLSWITCH
|
||||
ALIENSWITCH HANDPRINTSWITCH NUKEBUTTON
|
||||
TARGET
|
||||
4083 4954 // Busted switches (Atomic)
|
||||
}
|
||||
colors 15 15
|
||||
|
||||
tilerange 1 10
|
||||
}
|
||||
|
||||
tilegroup "Items"
|
||||
{
|
||||
hotkey "I"
|
||||
|
||||
colors 24 24
|
||||
hotkey "I"
|
||||
|
||||
colors 24 24
|
||||
|
||||
tiles
|
||||
{
|
||||
// Ammo
|
||||
AMMO SHOTGUNAMMO BATTERYAMMO RPGAMMO HEAVYHBOMB FREEZEAMMO GROWAMMO CRYSTALAMMO
|
||||
DEVISTATORAMMO HBOMBAMMO
|
||||
|
||||
// Items (healthetc)
|
||||
COLA SIXPAK FIRSTAID SHIELD STEROIDS AIRTANK JETPACK HEATSENSOR ACCESSCARD
|
||||
BOOTS ATOMICHEALTH HOLODUKE
|
||||
|
||||
// Weapons
|
||||
FIRSTGUNSPRITE CHAINGUNSPRITE RPGSPRITE FREEZESPRITE SHRINKERSPRITE
|
||||
TRIPBOMBSPRITE SHOTGUNSPRITE DEVISTATORSPRITE
|
||||
}
|
||||
}
|
||||
|
||||
tilegroup "Respawn triggers"
|
||||
{
|
||||
hotkey "R"
|
||||
|
||||
tiles
|
||||
{
|
||||
CANWITHSOMETHING CANWITHSOMETHING2 CANWITHSOMETHING3 CANWITHSOMETHING4
|
||||
// FEMS
|
||||
FEM1 FEM2 FEM3 FEM4 FEM5 FEM6 FEM7 FEM8 FEM9 FEM10 NAKED1
|
||||
}
|
||||
}
|
||||
|
||||
tilegroup "Exploding stuff"
|
||||
{
|
||||
hotkey "X"
|
||||
|
||||
tiles
|
||||
{
|
||||
CRACK1 CRACK2 CRACK3 CRACK4
|
||||
FIREEXT SEENINE OOZFILTER
|
||||
EXPLODINGBARREL EXPLODINGBARREL2 FIREBARREL GUNPOWDERBARREL
|
||||
REACTOR2SPARK BOLT1 SIDEBOLT1
|
||||
CEILINGSTEAM
|
||||
FIREVASE 2066 BURNING FIRE BURNING2 FIRE2
|
||||
}
|
||||
tiles
|
||||
{
|
||||
// Ammo
|
||||
AMMO SHOTGUNAMMO BATTERYAMMO RPGAMMO HEAVYHBOMB FREEZEAMMO GROWAMMO CRYSTALAMMO
|
||||
DEVISTATORAMMO HBOMBAMMO
|
||||
|
||||
// Items (healthetc)
|
||||
COLA SIXPAK FIRSTAID SHIELD STEROIDS AIRTANK JETPACK HEATSENSOR ACCESSCARD
|
||||
BOOTS ATOMICHEALTH HOLODUKE
|
||||
|
||||
// Weapons
|
||||
FIRSTGUNSPRITE CHAINGUNSPRITE RPGSPRITE FREEZESPRITE SHRINKERSPRITE
|
||||
TRIPBOMBSPRITE SHOTGUNSPRITE DEVISTATORSPRITE
|
||||
}
|
||||
}
|
||||
|
||||
tilegroup "Letters and numbers"
|
||||
{
|
||||
hotkey "L"
|
||||
|
||||
tilerange 2822 2915
|
||||
tilerange 2929 3022
|
||||
tilerange 3072 3135
|
||||
tilerange 3162 3165
|
||||
tilerange 640 649
|
||||
tilerange 2472 2481
|
||||
hotkey "L"
|
||||
|
||||
tilerange 2822 2915
|
||||
tilerange 2929 3022
|
||||
tilerange 3072 3135
|
||||
tilerange 3162 3165
|
||||
tilerange 640 649
|
||||
tilerange 2472 2481
|
||||
}
|
||||
|
||||
tilegroup "Player"
|
||||
{
|
||||
hotkey "P"
|
||||
|
||||
// Colors are the colors for Blocking OFF and Blocking ON.
|
||||
colors 2 2
|
||||
|
||||
tile APLAYER
|
||||
}
|
||||
|
||||
tilegroup "Respawn triggers"
|
||||
{
|
||||
hotkey "R"
|
||||
|
||||
tiles
|
||||
{
|
||||
CANWITHSOMETHING CANWITHSOMETHING2 CANWITHSOMETHING3 CANWITHSOMETHING4
|
||||
// FEMS
|
||||
FEM1 FEM2 FEM3 FEM4 FEM5 FEM6 FEM7 FEM8 FEM9 FEM10 NAKED1
|
||||
}
|
||||
}
|
||||
|
||||
tilegroup "Switches"
|
||||
{
|
||||
hotkey "S"
|
||||
|
||||
tiles
|
||||
{
|
||||
ACCESSSWITCH ACCESSSWITCH2 ACCESSCARD SLOTDOOR LIGHTSWITCH SPACEDOORSWITCH SPACELIGHTSWITCH
|
||||
FRANKENSTINESWITCH MULTISWITCH
|
||||
DIPSWITCH DIPSWITCH2 DIPSWITCH3 TECHSWITCH
|
||||
LIGHTSWITCH2 713 // LIGHTSWITCH2+1
|
||||
POWERSWITCH1 LOCKSWITCH1 POWERSWITCH2 HANDSWITCH PULLSWITCH
|
||||
ALIENSWITCH HANDPRINTSWITCH NUKEBUTTON
|
||||
TARGET
|
||||
4083 4954 // Busted switches (Atomic)
|
||||
}
|
||||
}
|
||||
|
||||
tilegroup "Exploding stuff"
|
||||
{
|
||||
hotkey "X"
|
||||
|
||||
tiles
|
||||
{
|
||||
CRACK1 CRACK2 CRACK3 CRACK4
|
||||
FIREEXT SEENINE OOZFILTER
|
||||
EXPLODINGBARREL EXPLODINGBARREL2 FIREBARREL GUNPOWDERBARREL
|
||||
REACTOR2SPARK BOLT1 SIDEBOLT1
|
||||
CEILINGSTEAM
|
||||
FIREVASE 2066 BURNING FIRE BURNING2 FIRE2
|
||||
}
|
||||
}
|
||||
|
||||
// Alphabet configuration for text entry tool in 3D mode
|
||||
// (press Ctrl-T on a wall-aligned letter)
|
||||
|
|
|
@ -59,7 +59,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
static int32_t floor_over_floor;
|
||||
|
||||
// static char *startwin_labeltext = "Starting Mapster32...";
|
||||
static char setupfilename[BMAX_PATH]= "mapster32.cfg";
|
||||
static char setupfilename[]= "mapster32.cfg";
|
||||
static char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp";
|
||||
static char *g_grpNamePtr = defaultduke3dgrp;
|
||||
static int32_t fixmapbeforesaving = 1;
|
||||
|
@ -67,8 +67,11 @@ static int32_t lastsave = -180*60;
|
|||
static int32_t NoAutoLoad = 0;
|
||||
static int32_t spnoclip=1;
|
||||
|
||||
static char default_tiles_cfg[] = "tiles.cfg";
|
||||
static int32_t pathsearchmode_oninit;
|
||||
|
||||
// Sound in Mapster32
|
||||
static char defaultgamecon[BMAX_PATH] = "game.con";
|
||||
static char defaultgamecon[] = "game.con";
|
||||
static char *gamecon = defaultgamecon;
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
@ -192,6 +195,10 @@ static char wallpals[MAXWALLS];
|
|||
static char sectorpals[MAXSECTORS][2];
|
||||
static char spritepals[MAXSPRITES];
|
||||
static char wallflag[MAXWALLS];
|
||||
|
||||
// tile marking in tile selector for custom creation of tile groups
|
||||
static int16_t tilemarked[(MAXTILES+7)>>3];
|
||||
|
||||
#ifdef POLYMER
|
||||
static int16_t spritelightid[MAXSPRITES];
|
||||
_prlight *spritelightptr[MAXSPRITES];
|
||||
|
@ -2675,22 +2682,46 @@ static int32_t SelectAllTiles(int32_t iCurrentTile)
|
|||
|
||||
static int32_t OnGotoTile(int32_t iTile);
|
||||
static int32_t OnSelectTile(int32_t iTile);
|
||||
static int32_t OnSaveTileGroup();
|
||||
static int32_t loadtilegroups(const char *fn);
|
||||
static int32_t s_Zoom = INITIAL_ZOOM;
|
||||
static int32_t s_TileZoom = 1;
|
||||
static char tilesel_errmsg[128], tilesel_showerr=0;
|
||||
|
||||
static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, int32_t nYTiles, int32_t TileDim, int32_t offset);
|
||||
|
||||
#define TMPERRMSG_SHOW(alsoOSD) do { \
|
||||
printext256(0, 0, whitecol, 0, tilesel_errmsg, 0); \
|
||||
if (alsoOSD) OSD_Printf("%s\n", tilesel_errmsg); \
|
||||
showframe(1); \
|
||||
} while (0)
|
||||
|
||||
#define TMPERRMSG_PRINT(Msg, ...) do { \
|
||||
Bsprintf(tilesel_errmsg, Msg, __VA_ARGS__); \
|
||||
TMPERRMSG_SHOW(1); \
|
||||
tilesel_showerr = 1; \
|
||||
} while (0)
|
||||
|
||||
#define TMPERRMSG_RETURN(Msg, ...) do \
|
||||
{ \
|
||||
TMPERRMSG_PRINT(Msg, __VA_ARGS__); \
|
||||
return 1; \
|
||||
} while (0)
|
||||
|
||||
|
||||
static int32_t m32gettile(int32_t idInitialTile)
|
||||
{
|
||||
int32_t gap, temp, zoomsz;
|
||||
int32_t nXTiles, nYTiles, nDisplayedTiles;
|
||||
int32_t i;
|
||||
int32_t iTile, iTopLeftTile;
|
||||
int32_t iTile, iTopLeftTile, iLastTile;
|
||||
int32_t idSelectedTile;
|
||||
int32_t scrollmode;
|
||||
int32_t mousedx, mousedy, mtile, omousex=searchx, omousey=searchy, moffset=0;
|
||||
|
||||
int32_t noTilesMarked=1;
|
||||
int32_t mark_lastk = -1;
|
||||
|
||||
// Enable following line for testing. I couldn't work out how to change vidmode on the fly
|
||||
// s_Zoom = NUM_ZOOMS - 1;
|
||||
|
||||
|
@ -2722,7 +2753,7 @@ static int32_t m32gettile(int32_t idInitialTile)
|
|||
localartlookup[i] = i;
|
||||
}
|
||||
|
||||
iTile = idSelectedTile = idInitialTile;
|
||||
iLastTile = iTile = idSelectedTile = idInitialTile;
|
||||
|
||||
switch (searchstat)
|
||||
{
|
||||
|
@ -2839,6 +2870,14 @@ static int32_t m32gettile(int32_t idInitialTile)
|
|||
DrawTiles(iTopLeftTile, (iTile >= localartlookupnum) ? localartlookupnum-1 : iTile,
|
||||
nXTiles, nYTiles, zoomsz, moffset);
|
||||
|
||||
if (tilesel_showerr)
|
||||
{
|
||||
if (iTile == iLastTile)
|
||||
TMPERRMSG_SHOW(0);
|
||||
else
|
||||
tilesel_showerr = 0;
|
||||
}
|
||||
iLastTile = iTile;
|
||||
|
||||
idle_waitevent_timeout(500);
|
||||
// SDL seems to miss mousewheel events when rotated slowly.
|
||||
|
@ -2952,28 +2991,76 @@ static int32_t m32gettile(int32_t idInitialTile)
|
|||
}
|
||||
|
||||
if (PRESSED_KEYSC(LEFT))
|
||||
iTile -= (iTile > 0);
|
||||
{
|
||||
if (eitherCTRL) // same as HOME, for consistency with CTRL-UP/DOWN
|
||||
iTile = (iTile/nXTiles)*nXTiles;
|
||||
else
|
||||
iTile--;
|
||||
}
|
||||
|
||||
if (PRESSED_KEYSC(RIGHT))
|
||||
iTile += (iTile < MAXTILES);
|
||||
{
|
||||
if (eitherCTRL) // same as END, for consistency with CTRL-UP/DOWN
|
||||
iTile = ((iTile+nXTiles)/nXTiles)*nXTiles - 1;
|
||||
else
|
||||
iTile++;
|
||||
}
|
||||
|
||||
if (PRESSED_KEYSC(UP))
|
||||
iTile -= nXTiles;
|
||||
{
|
||||
if (eitherCTRL)
|
||||
while (iTile-nXTiles >= iTopLeftTile)
|
||||
iTile -= nXTiles;
|
||||
else
|
||||
iTile -= nXTiles;
|
||||
}
|
||||
|
||||
if (PRESSED_KEYSC(DOWN))
|
||||
iTile += nXTiles;
|
||||
{
|
||||
if (eitherCTRL)
|
||||
while (iTile+nXTiles < iTopLeftTile + nDisplayedTiles)
|
||||
iTile += nXTiles;
|
||||
else
|
||||
iTile += nXTiles;
|
||||
}
|
||||
|
||||
if (PRESSED_KEYSC(PGUP))
|
||||
iTile -= nDisplayedTiles;
|
||||
{
|
||||
if (eitherCTRL)
|
||||
iTile = 0;
|
||||
else
|
||||
iTile -= nDisplayedTiles;
|
||||
}
|
||||
|
||||
if (PRESSED_KEYSC(PGDN))
|
||||
iTile += nDisplayedTiles;
|
||||
{
|
||||
if (eitherCTRL)
|
||||
iTile = localartlookupnum-1;
|
||||
else
|
||||
iTile += nDisplayedTiles;
|
||||
}
|
||||
|
||||
if (PRESSED_KEYSC(HOME))
|
||||
{
|
||||
if (eitherCTRL)
|
||||
iTile = iTopLeftTile;
|
||||
else
|
||||
iTile = (iTile/nXTiles)*nXTiles;
|
||||
}
|
||||
|
||||
if (PRESSED_KEYSC(END))
|
||||
{
|
||||
if (eitherCTRL)
|
||||
iTile = iTopLeftTile + nDisplayedTiles - 1;
|
||||
else
|
||||
iTile = ((iTile+nXTiles)/nXTiles)*nXTiles - 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Ensure tilenum is within valid range
|
||||
//
|
||||
|
||||
iTile = clamp(iTile, 0, MAXTILES-1); // shouldn't this be the count of num tiles ??
|
||||
iTile = clamp(iTile, 0, localartlookupnum-1);
|
||||
|
||||
// 'V' KEYPRESS
|
||||
if (PRESSED_KEYSC(V))
|
||||
|
@ -2981,7 +3068,20 @@ static int32_t m32gettile(int32_t idInitialTile)
|
|||
|
||||
// 'G' KEYPRESS - Goto frame
|
||||
if (PRESSED_KEYSC(G))
|
||||
iTile = OnGotoTile(iTile);
|
||||
{
|
||||
if (eitherCTRL)
|
||||
{
|
||||
if (OnSaveTileGroup() == 0)
|
||||
{
|
||||
// iTile = SelectAllTiles(iTile);
|
||||
Bmemset(tilemarked, 0, sizeof(tilemarked));
|
||||
mark_lastk = -1;
|
||||
noTilesMarked = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
iTile = OnGotoTile(iTile);
|
||||
}
|
||||
|
||||
// 'U' KEYPRESS : go straight to user defined art
|
||||
if (PRESSED_KEYSC(U))
|
||||
|
@ -2997,10 +3097,6 @@ static int32_t m32gettile(int32_t idInitialTile)
|
|||
iTile = FIRST_ATOMIC_TILE;
|
||||
}
|
||||
|
||||
// 'T' KEYPRESS = Select from pre-defined tileset
|
||||
if (PRESSED_KEYSC(T))
|
||||
iTile = OnSelectTile(iTile);
|
||||
|
||||
// 'E' KEYPRESS : Go straight to start of extended art
|
||||
if (PRESSED_KEYSC(E))
|
||||
{
|
||||
|
@ -3011,6 +3107,10 @@ static int32_t m32gettile(int32_t idInitialTile)
|
|||
else iTile = FIRST_EXTENDED_TILE;
|
||||
}
|
||||
|
||||
// 'T' KEYPRESS = Select from pre-defined tileset
|
||||
if (PRESSED_KEYSC(T))
|
||||
iTile = OnSelectTile(iTile);
|
||||
|
||||
if (PRESSED_KEYSC(Z))
|
||||
s_TileZoom = !s_TileZoom;
|
||||
|
||||
|
@ -3026,6 +3126,51 @@ static int32_t m32gettile(int32_t idInitialTile)
|
|||
|
||||
iTopLeftTile = clamp(iTopLeftTile, 0, MAXTILES - nDisplayedTiles);
|
||||
|
||||
|
||||
// SPACE keypress: mark/unmark selected tile
|
||||
if (PRESSED_KEYSC(SPACE))
|
||||
{
|
||||
if (iTile < localartlookupnum && IsValidTile(localartlookup[iTile]))
|
||||
{
|
||||
if (keystatus[KEYSC_LCTRL] && keystatus[KEYSC_RSHIFT])
|
||||
{
|
||||
Bmemset(tilemarked, 0, sizeof(tilemarked));
|
||||
mark_lastk = -1;
|
||||
noTilesMarked = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t k=iTile, kend, dir;
|
||||
|
||||
if (noTilesMarked)
|
||||
{
|
||||
noTilesMarked = 0;
|
||||
TMPERRMSG_PRINT("%s", "Beginning marking tiles. To group, press Ctrl-G. To reset, press LCtrl-RShift-SPACE.");
|
||||
}
|
||||
|
||||
if (mark_lastk>=0 && eitherCTRL)
|
||||
{
|
||||
kend = mark_lastk;
|
||||
dir = ksgn(mark_lastk-k);
|
||||
}
|
||||
else
|
||||
{
|
||||
kend = k;
|
||||
dir = 0;
|
||||
}
|
||||
|
||||
mark_lastk = k;
|
||||
|
||||
for (; dir==0 || dir*(kend-k)>=1; k+=dir)
|
||||
{
|
||||
tilemarked[localartlookup[k]>>3] ^= (1<<(localartlookup[k]&7));
|
||||
if (dir==0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((keystatus[KEYSC_ENTER] || (bstatus&1)) == 0) // uh ? Not escape key ?
|
||||
{
|
||||
idSelectedTile = idInitialTile;
|
||||
|
@ -3059,7 +3204,7 @@ static int32_t m32gettile(int32_t idInitialTile)
|
|||
keystatus[KEYSC_ESC] = 0;
|
||||
keystatus[KEYSC_ENTER] = 0;
|
||||
|
||||
return(idSelectedTile);
|
||||
return idSelectedTile;
|
||||
|
||||
}
|
||||
|
||||
|
@ -3068,6 +3213,124 @@ static int32_t m32gettile(int32_t idInitialTile)
|
|||
//{
|
||||
//}
|
||||
|
||||
static int32_t OnSaveTileGroup()
|
||||
{
|
||||
int32_t i, n=0;
|
||||
char hotkey;
|
||||
const char *cp, *name;
|
||||
|
||||
if (tile_groups==MAX_TILE_GROUPS)
|
||||
TMPERRMSG_RETURN("Cannot save tile group: maximum number of groups (%d) exceeded.", MAX_TILE_GROUPS);
|
||||
|
||||
for (i=0; i<MAXTILES; i++)
|
||||
n += !!(tilemarked[i>>3]&(1<<(i&7)));
|
||||
|
||||
if (n==0)
|
||||
TMPERRMSG_RETURN("%s", "Cannot save tile group: no tiles marked.");
|
||||
else if (n > MAX_TILE_GROUP_ENTRIES)
|
||||
TMPERRMSG_RETURN("Cannot save tile group: too many tiles in group. Have %d, max is %d.",
|
||||
n, MAX_TILE_GROUP_ENTRIES);
|
||||
|
||||
cp = getstring_simple("Hotkey for new group: ", "", 1);
|
||||
if (!cp || !*cp)
|
||||
return 1;
|
||||
|
||||
hotkey = Btoupper(cp[0]);
|
||||
if (!isalpha(hotkey))
|
||||
TMPERRMSG_RETURN("%s", "Hotkey must be alphabetic.");
|
||||
|
||||
for (i=0; i<tile_groups; i++)
|
||||
if (s_TileGroups[i].key1==hotkey || s_TileGroups[i].key2==Btolower(hotkey))
|
||||
TMPERRMSG_RETURN("Hotkey '%c' already in use by tile group `%s'.", hotkey, s_TileGroups[i].szText);
|
||||
|
||||
name = getstring_simple("Name for new tile group: ", "", 0);
|
||||
if (!name || !*name)
|
||||
return 1;
|
||||
|
||||
{
|
||||
int32_t lasti=-1, col=0, k, opathsearchmode=pathsearchmode;
|
||||
BFILE *fp;
|
||||
|
||||
pathsearchmode = pathsearchmode_oninit; // use the same pathsearchmode as on init
|
||||
fp = fopenfrompath(default_tiles_cfg, "a");
|
||||
pathsearchmode = opathsearchmode;
|
||||
if (!fp)
|
||||
TMPERRMSG_RETURN("Could not open `%s' for appending: %s.", default_tiles_cfg, strerror(errno));
|
||||
|
||||
#define TTAB "\t"
|
||||
#define TBITCHK(i) ((i)<MAXTILES && (tilemarked[(i)>>3]&(1<<((i)&7))))
|
||||
Bfprintf(fp, "\n");
|
||||
Bfprintf(fp, "tilegroup \"%s\"\n{\n", name);
|
||||
Bfprintf(fp, TTAB "hotkey \"%c\"\n\n", hotkey);
|
||||
|
||||
// tileranges for consecutive runs of 3 or more tiles
|
||||
for (i=0; i<MAXTILES; i++)
|
||||
{
|
||||
if (lasti>=0 && !TBITCHK(i))
|
||||
{
|
||||
if (names[lasti][0] && names[i-1][0])
|
||||
Bfprintf(fp, TTAB "tilerange %s %s\n", names[lasti], names[i-1]);
|
||||
else
|
||||
Bfprintf(fp, TTAB "tilerange %d %d\n", lasti, i-1);
|
||||
|
||||
for (k=lasti; k<i; k++)
|
||||
tilemarked[i>>3] &= ~(1<<(i&7));
|
||||
|
||||
lasti = -1;
|
||||
}
|
||||
else if (lasti==-1 && TBITCHK(i))
|
||||
{
|
||||
if (TBITCHK(i+1) && TBITCHK(i+2))
|
||||
{
|
||||
lasti = i;
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lasti>=0)
|
||||
Bfprintf(fp, TTAB "tilerange %d %d\n", lasti, MAXTILES-1);
|
||||
Bfprintf(fp, "\n");
|
||||
|
||||
// throw them all in a tiles{...} group else
|
||||
Bfprintf(fp, TTAB "tiles\n" TTAB "{\n");
|
||||
for (i=0; i<MAXTILES; i++)
|
||||
{
|
||||
if (TBITCHK(i))
|
||||
{
|
||||
if (col==0)
|
||||
Bfprintf(fp, TTAB TTAB), col+=8;
|
||||
|
||||
if (names[i])
|
||||
col+=Bfprintf(fp, "%s ", names[i]);
|
||||
else
|
||||
col+=Bfprintf(fp, "%d ", i);
|
||||
|
||||
if (col>80)
|
||||
{
|
||||
Bfprintf(fp, "\n");
|
||||
col = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (col>0)
|
||||
Bfprintf(fp, "\n");
|
||||
Bfprintf(fp, TTAB "}\n");
|
||||
#undef TBITCHK
|
||||
#undef TTAB
|
||||
Bfprintf(fp, "}\n");
|
||||
|
||||
Bfclose(fp);
|
||||
|
||||
if (loadtilegroups(default_tiles_cfg))
|
||||
TMPERRMSG_PRINT("%s", "Wrote new tile group but failed reloading them.");
|
||||
else
|
||||
TMPERRMSG_PRINT("%s", "Wrote and reloaded new tile group.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int32_t OnGotoTile(int32_t iTile)
|
||||
{
|
||||
int32_t iTemp, iNewTile;
|
||||
|
@ -3116,6 +3379,7 @@ static int32_t OnGotoTile(int32_t iTile)
|
|||
return iTile;
|
||||
}
|
||||
|
||||
|
||||
static int32_t LoadTileSet(const int32_t idCurrentTile, const int32_t *pIds, const int32_t nIds)
|
||||
{
|
||||
int32_t iNewTile = 0;
|
||||
|
@ -3143,15 +3407,12 @@ static int32_t OnSelectTile(int32_t iTile)
|
|||
int32_t i;
|
||||
char ch;
|
||||
|
||||
for (i = 0; (unsigned)i < tile_groups; i++)
|
||||
if (tile_groups <= 0)
|
||||
{
|
||||
if (s_TileGroups[i].pIds != NULL)
|
||||
break;
|
||||
TMPERRMSG_PRINT("No tile groups loaded. Check for existence of `%s'.", default_tiles_cfg);
|
||||
return iTile;
|
||||
}
|
||||
|
||||
if ((unsigned)i == tile_groups) // no tile groups
|
||||
return (iTile);
|
||||
|
||||
SelectAllTiles(iTile);
|
||||
|
||||
bflushchars();
|
||||
|
@ -3176,7 +3437,7 @@ static int32_t OnSelectTile(int32_t iTile)
|
|||
//
|
||||
// Display the description strings for each available tile group
|
||||
//
|
||||
for (i = 0; (unsigned)i < tile_groups; i++)
|
||||
for (i = 0; i < tile_groups; i++)
|
||||
{
|
||||
if (s_TileGroups[i].szText != NULL)
|
||||
{
|
||||
|
@ -3189,7 +3450,7 @@ static int32_t OnSelectTile(int32_t iTile)
|
|||
|
||||
ch = bgetchar();
|
||||
|
||||
for (i = 0; (unsigned)i < tile_groups; i++)
|
||||
for (i = 0; i < tile_groups; i++)
|
||||
{
|
||||
if (s_TileGroups[i].pIds != NULL && s_TileGroups[i].key1)
|
||||
if ((ch == s_TileGroups[i].key1) || (ch == s_TileGroups[i].key2))
|
||||
|
@ -3208,6 +3469,11 @@ static int32_t OnSelectTile(int32_t iTile)
|
|||
return iTile;
|
||||
}
|
||||
|
||||
#undef TMPERRMSG_SHOW
|
||||
#undef TMPERRMSG_PRINT
|
||||
#undef TMPERRMSG_RETURN
|
||||
|
||||
|
||||
static const char *GetTilePixels(int32_t idTile)
|
||||
{
|
||||
char *pPixelData = 0;
|
||||
|
@ -3228,10 +3494,9 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i
|
|||
{
|
||||
int32_t XTile, YTile;
|
||||
int32_t iTile, idTile;
|
||||
int32_t XBox, YBox;
|
||||
int32_t XPos, YPos;
|
||||
int32_t XOffset, YOffset;
|
||||
int32_t i;
|
||||
int32_t i, marked;
|
||||
const char *pRawPixels;
|
||||
int32_t TileSizeX, TileSizeY;
|
||||
int32_t DivInc,MulInc;
|
||||
|
@ -3306,30 +3571,45 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i
|
|||
printext256(XPos, YPos, whitecol, -1, szT, 1);
|
||||
}
|
||||
}
|
||||
|
||||
marked = (IsValidTile(idTile) && tilemarked[idTile>>3]&(1<<(idTile&7)));
|
||||
|
||||
//
|
||||
// Draw white box around currently selected tile or marked tile
|
||||
// p1=(x1, y1), p2=(x1+TileDim-1, y1+TileDim-1)
|
||||
//
|
||||
if (iTile == iSelected || marked)
|
||||
{
|
||||
int32_t x1 = ((iTile-iTopLeft) % nXTiles)*TileDim;
|
||||
int32_t y1 = ((iTile - ((iTile-iTopLeft) % nXTiles) - iTopLeft)/nXTiles)*TileDim + offset;
|
||||
int32_t x2 = x1+TileDim-1;
|
||||
int32_t y2 = y1+TileDim-1;
|
||||
|
||||
char markedcol = editorcolors[14];
|
||||
|
||||
setpolymost2dview();
|
||||
|
||||
y1=max(y1, 0);
|
||||
y2=min(y2, ydim-1);
|
||||
|
||||
// box
|
||||
plotlines2d((int32_t[]){x1, x1, x2, x2, x1},
|
||||
(int32_t[]){y1, y2, y2, y1, y1}, 5, iTile==iSelected ? whitecol : markedcol);
|
||||
// cross
|
||||
if (marked)
|
||||
{
|
||||
plotlines2d((int32_t[]){x1, x2},
|
||||
(int32_t[]){y1, y2}, 2, markedcol);
|
||||
plotlines2d((int32_t[]){x1, x2},
|
||||
(int32_t[]){y2, y1}, 2, markedcol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw white box around currently selected tile
|
||||
//
|
||||
|
||||
XBox = ((iSelected-iTopLeft) % nXTiles) * TileDim;
|
||||
YBox = ((iSelected - ((iSelected-iTopLeft) % nXTiles) - iTopLeft) / nXTiles) * TileDim+offset;
|
||||
|
||||
if (iSelected-iTopLeft>0)
|
||||
for (i = 0; i < TileDim; i++)
|
||||
{
|
||||
if (YBox>=0 && YBox<ydim)
|
||||
plotpixel(XBox+i, YBox, whitecol);
|
||||
if (YBox+TileDim>=0 && YBox+TileDim<ydim)
|
||||
plotpixel(XBox+i, YBox + TileDim, whitecol);
|
||||
if (YBox+i>=0 && YBox+i<ydim)
|
||||
{
|
||||
plotpixel(XBox, YBox + i, whitecol);
|
||||
plotpixel(XBox + TileDim, YBox + i, whitecol);
|
||||
}
|
||||
}
|
||||
if (iSelected < 0 || iSelected >= MAXTILES)
|
||||
return 1;
|
||||
|
||||
idTile = localartlookup[ iSelected ];
|
||||
|
||||
|
@ -8016,7 +8296,7 @@ int32_t parsetilegroups(scriptfile *script)
|
|||
if (scriptfile_getstring(script,&name)) break;
|
||||
if (scriptfile_getbraces(script,&end)) break;
|
||||
|
||||
s_TileGroups[tile_groups].pIds = Bcalloc(MAX_TILE_GROUP_ENTRIES,sizeof(int32_t));
|
||||
s_TileGroups[tile_groups].pIds = Bcalloc(MAX_TILE_GROUP_ENTRIES, sizeof(int32_t));
|
||||
s_TileGroups[tile_groups].szText = Bstrdup(name);
|
||||
|
||||
while (script->textptr < end)
|
||||
|
@ -8090,7 +8370,9 @@ int32_t parsetilegroups(scriptfile *script)
|
|||
}
|
||||
}
|
||||
}
|
||||
s_TileGroups[tile_groups].pIds = Brealloc(s_TileGroups[tile_groups].pIds,s_TileGroups[tile_groups].nIds*sizeof(int32_t));
|
||||
|
||||
s_TileGroups[tile_groups].pIds = Brealloc(s_TileGroups[tile_groups].pIds,
|
||||
s_TileGroups[tile_groups].nIds*sizeof(int32_t));
|
||||
tile_groups++;
|
||||
break;
|
||||
}
|
||||
|
@ -8099,7 +8381,12 @@ int32_t parsetilegroups(scriptfile *script)
|
|||
char *end;
|
||||
int32_t i, j, k;
|
||||
|
||||
if (numalphabets >= MAX_ALPHABETS) break;
|
||||
if (numalphabets >= MAX_ALPHABETS)
|
||||
{
|
||||
OSD_Printf("Too many alphabet definitions (max: %d).\n", MAX_ALPHABETS);
|
||||
break;
|
||||
}
|
||||
|
||||
if (scriptfile_getbraces(script,&end)) break;
|
||||
|
||||
for (i=0; i<NUMPRINTABLES; i++)
|
||||
|
@ -8217,19 +8504,42 @@ int32_t parsetilegroups(scriptfile *script)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t loadtilegroups(char *fn)
|
||||
static int32_t loadtilegroups(const char *fn)
|
||||
{
|
||||
int32_t i, j;
|
||||
scriptfile *script;
|
||||
TileGroup blank = { NULL, 0, NULL, 0, 0, 0, 0};
|
||||
TileGroup blank = { NULL, 0, NULL, 0, 0, 0, 0};
|
||||
|
||||
script = scriptfile_fromfile(fn);
|
||||
if (!script) return -1;
|
||||
|
||||
for (i = MAX_TILE_GROUPS-1; i >= 0; i--)
|
||||
for (i=0; i<tile_groups; i++)
|
||||
{
|
||||
Bmemcpy(&s_TileGroups[i],&blank,sizeof(blank));
|
||||
if (s_TileGroups[i].pIds)
|
||||
Bfree(s_TileGroups[i].pIds);
|
||||
if (s_TileGroups[i].szText)
|
||||
Bfree(s_TileGroups[i].szText);
|
||||
Bmemcpy(&s_TileGroups[i], &blank, sizeof(blank));
|
||||
}
|
||||
tile_groups = 0;
|
||||
|
||||
// ---------- Init hardcoded tile group consisting of all named tiles
|
||||
s_TileGroups[0].szText = Bstrdup("All named");
|
||||
s_TileGroups[0].pIds = Bmalloc(MAXTILES * sizeof(s_TileGroups[0].pIds[0]));
|
||||
if (!s_TileGroups[0].pIds)
|
||||
return -1;
|
||||
j = 0;
|
||||
for (i=0; i<MAXTILES; i++)
|
||||
if (names[i][0])
|
||||
s_TileGroups[0].pIds[j++] = i;
|
||||
if (j)
|
||||
{
|
||||
s_TileGroups[0].nIds = j;
|
||||
s_TileGroups[0].key1 = 'Y';
|
||||
s_TileGroups[0].key2 = 'y';
|
||||
tile_groups++;
|
||||
}
|
||||
// --------------------
|
||||
|
||||
parsetilegroups(script);
|
||||
|
||||
|
@ -8240,9 +8550,8 @@ int32_t loadtilegroups(char *fn)
|
|||
tilegroupActors = getTileGroup("Actors");
|
||||
|
||||
// Apply 2d sprite colors as specified in tiles.cfg.
|
||||
for (i = 0; i < MAX_TILE_GROUPS; i++)
|
||||
for (i=0; i<tile_groups; i++)
|
||||
{
|
||||
if (s_TileGroups[i].szText == NULL) break;
|
||||
// If the colors were specified...
|
||||
if (s_TileGroups[i].color1 && s_TileGroups[i].color2)
|
||||
{
|
||||
|
@ -8255,12 +8564,11 @@ int32_t loadtilegroups(char *fn)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// vvv Parse CON files partially to get sound definitions
|
||||
int32_t parseconsounds(scriptfile *script)
|
||||
static int32_t parseconsounds(scriptfile *script)
|
||||
{
|
||||
int32_t tokn;
|
||||
char *cmdtokptr;
|
||||
|
@ -8399,7 +8707,7 @@ END:
|
|||
return g_numsounds;
|
||||
}
|
||||
|
||||
int32_t loadconsounds(char *fn)
|
||||
static int32_t loadconsounds(const char *fn)
|
||||
{
|
||||
scriptfile *script;
|
||||
int32_t ret;
|
||||
|
@ -8645,7 +8953,10 @@ int32_t ExtInit(void)
|
|||
OSD_SetParameters(0,2, 0,0, 4,0);
|
||||
registerosdcommands();
|
||||
|
||||
loadtilegroups("tiles.cfg");
|
||||
// backup pathsearchmode so that a later open
|
||||
// will hopefully be the same file
|
||||
pathsearchmode_oninit = pathsearchmode;
|
||||
loadtilegroups(default_tiles_cfg);
|
||||
|
||||
ReadHelpFile("m32help.hlp");
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ void VM_OnEvent(register int32_t iEventID, register int32_t iActor)
|
|||
|
||||
// needed since any read access before initialization would cause undefined behaviour
|
||||
if (aEventNumLocals[iEventID] > 0)
|
||||
Bmemset(localvars, aEventNumLocals[iEventID]*sizeof(int32_t), 0);
|
||||
Bmemset(localvars, 0, aEventNumLocals[iEventID]*sizeof(int32_t));
|
||||
|
||||
Bmemcpy(&vm_backup, &vm, sizeof(vmstate_t));
|
||||
|
||||
|
@ -358,7 +358,7 @@ skip_check:
|
|||
|
||||
// needed since any read access before initialization would cause undefined behaviour
|
||||
if (statesinfo[stateidx].numlocals > 0)
|
||||
Bmemset(localvars, statesinfo[stateidx].numlocals*sizeof(int32_t), 0);
|
||||
Bmemset(localvars, 0, statesinfo[stateidx].numlocals*sizeof(int32_t));
|
||||
|
||||
insptr = script + statesinfo[stateidx].ofs;
|
||||
vm.g_st = 1+MAXEVENTS+stateidx;
|
||||
|
|
|
@ -186,7 +186,7 @@ typedef struct
|
|||
static TileGroup s_TileGroups[MAX_TILE_GROUPS];
|
||||
static int32_t tilegroupItems;
|
||||
static int32_t tilegroupActors;
|
||||
static uint32_t tile_groups = 0;
|
||||
static int32_t tile_groups = 0;
|
||||
|
||||
|
||||
#define NUMPRINTABLES 94
|
||||
|
|
Loading…
Reference in a new issue