Huge, awesome patch from Hunter_rus

git-svn-id: https://svn.eduke32.com/eduke32@728 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-05-16 19:51:38 +00:00
parent 26de39bc2e
commit 310c7240e1
11 changed files with 3176 additions and 1905 deletions

View file

@ -38,12 +38,14 @@ extern int zmode, kensplayerheight;
extern short defaultspritecstat;
extern short temppicnum, tempcstat, templotag, temphitag, tempextra;
extern unsigned char tempshade, temppal, tempxrepeat, tempyrepeat;
extern unsigned char temppal, tempxrepeat, tempyrepeat;
signed char tempshade;
extern unsigned char somethingintab;
extern unsigned char buildkeys[NUMBUILDKEYS];
extern int ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d, forcesetup;
extern char unrealedlook, quickmapcycling;
extern int ExtInit(void);

View file

@ -122,13 +122,14 @@ short highlight[MAXWALLS];
short highlightsector[MAXSECTORS], highlightsectorcnt = -1;
extern char textfont[128][8];
static char pskysearch[MAXSECTORS];
char pskysearch[MAXSECTORS];
short temppicnum, tempcstat, templotag, temphitag, tempextra;
unsigned char tempshade, temppal, tempvis, tempxrepeat, tempyrepeat;
unsigned char temppal, tempvis, tempxrepeat, tempyrepeat;
signed char tempshade;
unsigned char somethingintab = 255;
char mlook = 0;
char mlook = 0,mskip=0;
char unrealedlook=0, quickmapcycling=0; //PK
static char boardfilename[BMAX_PATH], selectedboardfilename[BMAX_PATH];
@ -137,7 +138,7 @@ static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *fi
static int numdirs=0, numfiles=0;
static int currentlist=0;
static int repeatcountx, repeatcounty;
//static int repeatcountx, repeatcounty;
static int fillist[640];
@ -545,7 +546,7 @@ CANCEL:
Bprintf("%s\n",kensig);
return(0);
}
/*
void showmouse(void)
{
int i;
@ -557,7 +558,7 @@ void showmouse(void)
plotpixel(searchx,searchy-i,whitecol);
plotpixel(searchx,searchy+i,whitecol);
}
}
}*/
int mhk=0;
void loadmhk()
@ -580,18 +581,18 @@ void loadmhk()
void editinput(void)
{
char smooshyalign, repeatpanalign, buffer[80];
short /*sectnum, nextsectnum,*/ startwall, endwall, dasector, daang;
// char smooshyalign, repeatpanalign, buffer[80];
// short sectnum, nextsectnum, startwall, endwall, dasector, daang;
int mousz, bstatus;
int i, j, k, /*cnt,*/ tempint=0, doubvel, changedir/*, wallfind[2], daz[2]*/;
int dashade[2], goalz, xvect, yvect, /*PK*/ zvect, hiz, loz;
int i, j, k, /*cnt,*/ tempint=0, doubvel/*, changedir, wallfind[2], daz[2]*/;
int /*dashade[2],*/ goalz, xvect, yvect,/*PK*/ zvect, hiz, loz;
short hitsect, hitwall, hitsprite;
int hitx, hity, hitz, dax, day, hihit, lohit;
// 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46
// F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL
if (keystatus[0x57] > 0) //F11 - brightness
/* if (keystatus[0x57] > 0) //F11 - brightness
{
keystatus[0x57] = 0;
brightness++;
@ -602,7 +603,7 @@ void editinput(void)
{
screencapture("captxxxx.tga",keystatus[0x2a]|keystatus[0x36]);
keystatus[88] = 0;
}
}*/
mousz = 0;
getmousevalues(&mousx,&mousy,&bstatus);
@ -620,7 +621,7 @@ void editinput(void)
// lmb&rmb: x:strafe y:up/dn (move in local yz plane)
// mmb: fwd/back in viewing vector
if (unrealedlook) //PK
if (unrealedlook && !mskip) //PK
{
if ((bstatus&1) && !(bstatus&(2|4)))
{
@ -685,6 +686,8 @@ void editinput(void)
}
}
if (mskip)mskip=0;else
{
if (mlook && !(unrealedlook && bstatus&(1|4)))
{
ang += (mousx>>1)*msens;
@ -717,8 +720,9 @@ void editinput(void)
if (searchx > xdim-13) searchx = xdim-13;
if (searchy > ydim-13) searchy = ydim-13;
}
}
showmouse();
// showmouse();
// if (keystatus[0x3b] > 0) posx--;
// if (keystatus[0x3c] > 0) posx++;
@ -780,14 +784,13 @@ void editinput(void)
}
getzrange(posx,posy,posz,cursectnum,&hiz,&hihit,&loz,&lohit,128L,CLIPMASK0);
// zmode: 0: normal 1: z-locked 2: free z-movement
if (keystatus[0x3a] > 0)
/* if (keystatus[0x3a] > 0)
{
zmode++;
if (zmode == 3) zmode = 0;
if (zmode == 1) zlock = (loz-posz)&0xfffffc00;
keystatus[0x3a] = 0;
}
}*/
if (zmode == 0)
{
@ -899,7 +902,7 @@ void editinput(void)
{
if ((bstatus&(1|2|4)) > 0)
searchit = 0;
if (keystatus[0x4a] > 0) // -
/* if (keystatus[0x4a] > 0) // -
{
keystatus[0x4a] = 0;
if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT
@ -1875,7 +1878,8 @@ void editinput(void)
{
AutoAlignWalls((int)searchwall,0L);
/*wallfind[0] = searchwall;
#if 0
wallfind[0] = searchwall;
cnt = 4096;
do
{
@ -1950,7 +1954,7 @@ void editinput(void)
cnt--;
}
while ((wall[wallfind[0]].picnum == wall[searchwall].picnum) && (wallfind[0] != searchwall) && (cnt > 0));
*/
#endif
keystatus[0x34] = 0;
}
@ -2091,7 +2095,7 @@ void editinput(void)
}
if (keystatus[0x14] > 0) // T (transluscence for sprites/masked walls)
{
/*if (searchstat == 1) //Set masked/transluscent ceilings/floors
if (searchstat == 1) //Set masked/transluscent ceilings/floors
{
i = (sector[searchsector].ceilingstat&(128+256));
sector[searchsector].ceilingstat &= ~(128+256);
@ -2116,7 +2120,7 @@ void editinput(void)
case 384: sector[searchsector].floorstat |= 0; break;
}
asksave = 1;
}*/
}
if (searchstat == 3)
{
if ((sprite[searchwall].cstat&2) == 0)
@ -2419,7 +2423,7 @@ void editinput(void)
asksave = 1;
}
}
}
}*/
if (keystatus[0x1f]) //S (insert sprite) (3D)
{
dax = 16384;
@ -2530,7 +2534,7 @@ void editinput(void)
keystatus[0x1f] = 0;
}
if (keystatus[0xd3] > 0)
/* if (keystatus[0xd3] > 0)
{
if (searchstat == 3)
{
@ -2539,7 +2543,7 @@ void editinput(void)
asksave = 1;
}
keystatus[0xd3] = 0;
}
}*/
if (keystatus[0x3f]||keystatus[0x40]) //F5,F6
{
@ -2607,6 +2611,7 @@ char changechar(char dachar, int dadir, char smooshyalign, char boundcheck)
return(dachar);
}
#if 0
/*
int gettile(int tilenum)
{
char snotbuf[80], ch;
@ -2915,6 +2920,7 @@ int drawtilescreen(int pictopleft, int picbox)
return(0);
}
*/
#endif
void overheadeditor(void)
@ -3261,6 +3267,8 @@ void overheadeditor(void)
drawline16(searchx+2,searchy+1,searchx+9,searchy+1,col);
//Draw the white pixel closest to mouse cursor on linehighlight
if (linehighlight>=0)
{
getclosestpointonwall(mousxplc,mousyplc,(int)linehighlight,&dax,&day);
x2 = mulscale14(dax-posx,zoom);
y2 = mulscale14(day-posy,zoom);
@ -3268,6 +3276,7 @@ void overheadeditor(void)
drawline16(halfxdim16+x2,midydim16+y2,halfxdim16+x2,midydim16+y2,15);
else
drawline16(halfxdim16+x2,midydim16+y2,halfxdim16+x2,midydim16+y2,5);
}
enddrawing(); //}}}
OSD_Draw();
@ -6237,7 +6246,7 @@ int getlinehighlight(int xplc, int yplc)
if (numwalls == 0)
return(-1);
dist = 1024;
closest = numwalls-1;
closest = -1;
for (i=0;i<numwalls;i++)
{
getclosestpointonwall(xplc,yplc,i,&nx,&ny);
@ -6249,7 +6258,7 @@ int getlinehighlight(int xplc, int yplc)
}
}
if (wall[closest].nextwall >= 0)
if (closest>=0 && wall[closest].nextwall >= 0)
{
//if red line, allow highlighting of both sides
x1 = wall[closest].x;
@ -7301,7 +7310,7 @@ int loadnames(void)
int loadnames(void)
{
char buffer[1024], *p, *name, *number, *endptr;
int num, syms=0, line=0, a;
int num, syms=0, line=0, a, comment=0;
BFILE *fp;
fp = fopenfrompath("NAMES.H","r");
@ -7334,7 +7343,7 @@ int loadnames(void)
while (*p == 32) p++;
if (*p == 0) continue; // blank line
if (*p == '#')
if (*p == '#' && !comment)
{
p++;
while (*p == 32) p++;
@ -7402,8 +7411,14 @@ int loadnames(void)
}
else if (*p == '/')
{
if (*(p+1) == '*') {comment++;continue;}
if (*(p+1) == '/') continue; // comment
}
else if (*p == '*' && p[1] == '/')
{
comment--;continue;
}
else if (comment)continue;
badline:
initprintf("Error: Invalid statement found at character %d on line %d\n", (p-buffer), line-1);
}
@ -7768,7 +7783,7 @@ void printmessage256(char name[82])
void getclosestpointonwall(int x, int y, int dawall, int *nx, int *ny)
{
walltype *wal;
int i, j, dx, dy;
int64 i, j, dx, dy;
wal = &wall[dawall];
dx = wall[wal->point2].x-wal->x;
@ -7777,9 +7792,9 @@ void getclosestpointonwall(int x, int y, int dawall, int *nx, int *ny)
if (i <= 0) { *nx = wal->x; *ny = wal->y; return; }
j = dx*dx+dy*dy;
if (i >= j) { *nx = wal->x+dx; *ny = wal->y+dy; return; }
i = divscale30(i,j);
*nx = wal->x + mulscale30(dx,i);
*ny = wal->y + mulscale30(dy,i);
i=((i<<15)/j)<<15;
*nx = wal->x + ((dx*i)>>30);
*ny = wal->y + ((dy*i)>>30);
}
void initcrc(void)

View file

@ -199,6 +199,10 @@ int loadsetup(const char *fn)
if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL);
if (readconfig(fp, "mousenavigation", val, VL) > 0) unrealedlook = Batoi(val);
if (readconfig(fp, "quickmapcycling", val, VL) > 0) quickmapcycling = Batoi(val);
for (i=0;i<256;i++)remap[i]=i;
remapinit=1;
if (readconfig(fp, "remap", val, VL) > 0)
@ -299,6 +303,12 @@ int writesetup(const char *fn)
"; Mouse sensitivity\n"
"mousesensitivity = %g\n"
"\n"
"; Mouse navigation\n"
"mousenavigation = %d\n"
"\n"
"; Quick map cycling\n"
"quickmapcycling = %d\n"
"\n"
#if 1
"; Key Settings\n"
"; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n"
@ -358,7 +368,7 @@ int writesetup(const char *fn)
#if 0
option[7]>>4, option[2],
#endif
option[3], msens,
option[3], msens, unrealedlook, quickmapcycling,
#if 1
keys[0], keys[1], keys[2], keys[3], keys[4], keys[5],
keys[6], keys[7], keys[8], keys[9], keys[10], keys[11],

View file

@ -11011,6 +11011,7 @@ void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride)
//
char spritecol2d[MAXTILES][2];
int showfirstwall=0;
void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride)
{
@ -11061,6 +11062,7 @@ void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride)
if ((i == linehighlight) || ((linehighlight >= 0) && (i == wall[linehighlight].nextwall)))
if (totalclock & 16) col += (2<<2);
}
if (showfirstwall && (sector[searchsector].wallptr==i||sector[searchsector].wallptr==wall[i].nextwall))col = 14;
xp1 = mulscale14(wal->x-posxe,zoome);
yp1 = mulscale14(wal->y-posye,zoome);
@ -11474,6 +11476,30 @@ void printext256(int xpos, int ypos, short col, short backcol, char *name, char
for (i=0;name[i];i++)
{
if (name[i] == '^' && isdigit(name[i+1]))
{
char smallbuf[8];
int bi=0;
while (isdigit(name[i+1]) && bi<8)
{
smallbuf[bi++]=name[i+1];
i++;
}
smallbuf[bi++]=0;
if (col)col = atol(smallbuf);
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];
xx = stx-fontsize;
yy = ypos+7 + 2; //+1 is hack!
@ -11511,6 +11537,19 @@ void printext256(int xpos, int ypos, short col, short backcol, char *name, char
begindrawing(); //{{{
for (i=0;name[i];i++)
{
if (name[i] == '^' && isdigit(name[i+1]))
{
char smallbuf[8];
int bi=0;
while (isdigit(name[i+1]) && bi<8)
{
smallbuf[bi++]=name[i+1];
i++;
}
smallbuf[bi++]=0;
if (col)col = atol(smallbuf);
continue;
}
letptr = &fontptr[name[i]<<3];
ptr = (char *)(ylookup[ypos+7]+(stx-fontsize)+frameplace);
for (y=7;y>=0;y--)

View file

@ -441,7 +441,7 @@ void applypalmap(char *pic, char *palmap, int size, int pal)
}
}
static void applypalmapSkin(char *pic, int sizx, int sizy, int pal)
static void applypalmapSkin(char *pic, int sizx, int sizy, md2model *m, int number, int pal, int surf)
{
int stage;
@ -449,11 +449,12 @@ static void applypalmapSkin(char *pic, int sizx, int sizy, int pal)
for (stage=0;stage<MAXPALCONV;stage++)
{
int pal1=0,pal2=pal;
mdskinmap_t *sk;
mdskinmap_t *sk=modelhead->skinmap;
getpalmap(&stage,&pal1,&pal2);
if (!pal1)return;
for (sk = modelhead->skinmap; sk; sk = sk->next)
mdloadskin((md2model *)m,number,pal1,surf);
for (; sk; sk = sk->next)
if ((int)sk->palette == pal1&&sk->palmap)break;
if (!sk||sk->size!=sizx*sizy)continue;
@ -461,7 +462,7 @@ static void applypalmapSkin(char *pic, int sizx, int sizy, int pal)
}
}
static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int *osizx, int *osizy, char *hasalpha, int pal, char effect)
static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int *osizx, int *osizy, char *hasalpha, int pal, char effect, md2model *m, int number, int surf)
{
int picfillen, j,y,x;
char *picfil,*cptr,al=255;
@ -498,7 +499,7 @@ static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int
{ free(picfil); free(pic); return -1; }
free(picfil);
applypalmapSkin((char *)pic,tsizx,tsizy,pal);
applypalmapSkin((char *)pic,tsizx,tsizy,m,number,pal,surf);
cptr = &britable[gammabrightness ? 0 : curbrightness][0];
r=(glinfo.bgra)?hictinting[pal].b:hictinting[pal].r;
g=hictinting[pal].g;
@ -763,7 +764,7 @@ int mdloadskin(md2model *m, int number, int pal, int surf)
cachefil = -1; // the compressed version will be saved to disk
if ((filh = kopen4load(fn, 0)) < 0) return -1;
if (daskinloader(filh,&fptr,&bpl,&xsiz,&ysiz,&osizx,&osizy,&hasalpha,pal,(globalnoeffect)?0:hictinting[pal].f))
if (daskinloader(filh,&fptr,&bpl,&xsiz,&ysiz,&osizx,&osizy,&hasalpha,pal,(globalnoeffect)?0:hictinting[pal].f,m,number,surf))
{
kclose(filh);
initprintf("Failed loading skin file \"%s\"\n", fn);
@ -1617,8 +1618,6 @@ static int md3draw(md3model *m, spritetype *tspr)
}
for (surfi=0;surfi<m->head.numsurfs;surfi++)
{
int pal1;
s = &m->head.surfs[surfi];
v0 = &s->xyzn[m->cframe*s->numverts];
v1 = &s->xyzn[m->nframe*s->numverts];
@ -1680,9 +1679,6 @@ static int md3draw(md3model *m, spritetype *tspr)
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat);
// PLAG: End
for (pal1=SPECPAL;pal1<=REDPAL;pal1++)
mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,pal1,surfi);
i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,globalpal,surfi); if (!i) continue;
//i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,surfi); //hack for testing multiple surfaces per MD3
bglBindTexture(GL_TEXTURE_2D, i);

View file

@ -1249,7 +1249,7 @@ void writexcache(char *fn, int len, int dameth, char effect, texcacheheader *hea
unsigned int padx=0, pady=0;
GLuint gi;
if (!glinfo.texcompr || !glusetexcompr || !glusetexcache) return;
if (!glinfo.texcompr || !glusetexcompr || !glusetexcache) {initprintf("\n");return;}
if (!bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB)
{
// lacking the necessary extensions to do this
@ -4118,6 +4118,7 @@ void polymost_drawrooms()
{
short hitsect, hitwall, hitsprite;
int vx, vy, vz, hitx, hity, hitz;
int cz, fz;
ox2 = (searchx-ghalfx)/1.2; oy2 = (searchy-ghoriz)/ 1.2; oz2 = ghalfx;
@ -4139,9 +4140,12 @@ void polymost_drawrooms()
hitallsprites = 1;
hitscan(globalposx,globalposy,globalposz,globalcursectnum, //Start position
vx>>12,vy>>12,vz>>8,&hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,0xffff0030);
getzsofslope(hitsect,hitx,hity,&cz,&fz);
hitallsprites = 0;
searchsector = hitsect;
if (hitz<cz) searchstat = 1;else
if (hitz>fz) searchstat = 2;else
if (hitwall >= 0)
{
searchwall = hitwall; searchstat = 0;
@ -5547,6 +5551,31 @@ int polymost_printext256(int xpos, int ypos, short col, short backcol, char *nam
bglBegin(GL_QUADS);
for (c=0; name[c]; c++)
{
if (name[c] == '^' && isdigit(name[c+1]))
{
char smallbuf[8];
int bi=0;
while (isdigit(name[c+1]) && bi<8)
{
smallbuf[bi++]=name[c+1];
c++;
}
smallbuf[bi++]=0;
if (col)col = atol(smallbuf);
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 ];
}
bglColor4ub(p.r,p.g,p.b,255);
continue;
}
tx = (float)(name[c]%32)/32.0;
ty = (float)((name[c]/32) + (fontsize*8))/16.0;
@ -5932,8 +5961,6 @@ void polymost_precache(int dapicnum, int dapalnum, int datype)
for (i=0;i<=j;i++)
{
int pal1;
for (pal1=SPECPAL;pal1<=REDPAL;pal1++)mdloadskin((md2model*)models[mid],0,pal1,i);
mdloadskin((md2model*)models[mid], 0, dapalnum, i);
}
}

View file

@ -2393,10 +2393,15 @@ static void moveweapons(void)
}
for (f=1;f<=hittype[i].projectile.velmult;f++)
{
dax = s->x;
day = s->y;
daz = s->z;
j = movesprite(i,
(k*(sintable[(s->ang+512)&2047]))>>14,
(k*(sintable[s->ang&2047]))>>14,ll,qq);
if (j)break;
}
if (!(hittype[i].projectile.workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) && s->yvel >= 0)
if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256)

File diff suppressed because it is too large Load diff

View file

@ -6676,6 +6676,10 @@ void animatesprites(int x,int y,int a,int smoothratio)
#if defined(POLYMOST) && defined(USE_OPENGL)
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
{
int v=getangle(t->xvel,t->zvel>>4);
if (v>1023)v-=2048;
spriteext[i].pitch=v;
t->cstat &= ~4;
break;
}

View file

@ -172,7 +172,7 @@ int ReadGameVars(int fil)
{
//Bsprintf(g_szBuf,"Reading value array for %s (%d)",aGameVars[i].szLabel,sizeof(int) * MAXPLAYERS);
//AddLog(g_szBuf);
if (kdfread(aGameArrays[i].plValues,sizeof(intptr_t) * aGameArrays[i].size, 1, fil) != 1) goto corrupt;
if (kdfread(aGameArrays[i].plValues,sizeof(intptr_t) * aGameArrays[i].size, 1, fil) < 1) goto corrupt;
}
// Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__);

View file

@ -44,7 +44,8 @@ extern int searchx, searchy, osearchx, osearchy; //search input
extern short searchsector, searchwall, searchstat; //search output
extern short temppicnum, tempcstat, templotag, temphitag, tempextra;
extern unsigned char tempshade, temppal, tempvis, tempxrepeat, tempyrepeat, somethingintab;
extern unsigned char temppal, tempvis, tempxrepeat, tempyrepeat, somethingintab;
extern signed char tempshade;
static int ototalclock = 0, clockval[16], clockcnt = 0;
@ -74,7 +75,7 @@ extern void fixrepeats(short i);
char autospritehelp=0,autosecthelp=0;
short MinRate=24, MinD=3;
int xoldtimerhandler, lastmessagetime;
int xoldtimerhandler, lastmessagetime=-1;
char tempbuf[1024]; //1024
int numsprite[MAXSPRITES];
@ -135,6 +136,7 @@ extern short startang, startsectnum;
int autosavetimer;
extern int numsprites;
extern int showfirstwall;
extern char spritecol2d[MAXTILES][2];
extern char custom2dcolors;
extern char mlook;