diff --git a/polymer/build/Makefile.msvc b/polymer/build/Makefile.msvc index 41dd6258e..3d8b647d6 100644 --- a/polymer/build/Makefile.msvc +++ b/polymer/build/Makefile.msvc @@ -9,7 +9,7 @@ OBJ=obj.msc !endif INC=include\ # !ifndef CFLAGS -CFLAGS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DKSFORBUILD +CFLAGS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DKSFORBUILD /DPOLYMER !endif o=obj @@ -71,7 +71,9 @@ ENGINEOBJS= \ $(OBJ)\pragmas.$o \ $(OBJ)\scriptfile.$o \ $(OBJ)\winlayer.$o \ +!ifdef POLYMER $(OBJ)\polymer.$o +!endif EDITOROBJS=$(OBJ)\build.$o \ $(OBJ)\startwin.editor.$o \ diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index e6585f76b..f276ab2da 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -56,6 +56,12 @@ void _printmessage16(char name[82]); int vel, svel, angvel; +// 0 1 2 3 4 5 6 7 +// up, down, left, right, lshift, rctrl, lctrl, space +// 8 9 10 11 12 13 +// a, z, pgdn, pgup, [,], [.] +// 14 15 16 17 18 19 +// kpenter, enter, =, -, tab, ` unsigned char buildkeys[NUMBUILDKEYS] = { 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, @@ -123,6 +129,7 @@ unsigned char tempshade, temppal, tempvis, tempxrepeat, tempyrepeat; unsigned char somethingintab = 255; char mlook = 0; +char unrealedlook=0, quickmapcycling=0; //PK static char boardfilename[BMAX_PATH], selectedboardfilename[BMAX_PATH]; @@ -159,6 +166,9 @@ static char scantoascwithshift[128] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; */ +int pk_turnaccel=16; +int pk_turndecel=12; +int pk_uedaccel=3; char changechar(char dachar, int dadir, char smooshyalign, char boundcheck); int adjustmark(int *xplc, int *yplc, short danumwalls); @@ -192,6 +202,9 @@ void AutoAlignWalls(int nWall0, int ply); int gettile(int tilenum); int menuselect(void); + +int menuselect_pk(int); //PK + int getfilenames(char *path, char *kind); void clearfilenames(void); void loadmhk(); @@ -571,10 +584,13 @@ void editinput(void) 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, hiz, loz; + 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 { keystatus[0x57] = 0; @@ -598,7 +614,78 @@ void editinput(void) ld = ldiv((int)(mousy), (1<<16)); mousy = ld.quot; mouseysurp = ld.rem; } - if (mlook) + // UnrealEd: + // rmb: mouselook + // lbm: x:turn y:fwd/back local x + // lmb&rmb: x:strafe y:up/dn (move in local yz plane) + // mmb: fwd/back in viewing vector + + if (unrealedlook) //PK + { + if ((bstatus&1) && !(bstatus&(2|4))) + { + ang += (mousx>>1)*msens; + if (mousx && !(mousx>>1)) + ang++; + xvect = -((mousy*(int)sintable[(ang+2560)&2047])<>14; + posy += yvect>>14; + updatesector(posx,posy,&cursectnum); + } + else clipmove(&posx,&posy,&posz,&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK0); + } + else if (!mlook && (bstatus&2) && !(bstatus&(1|4))) + { + mlook=2; + } + else if ((bstatus&1) && (bstatus&2) && !(bstatus&4)) + { + zmode = 2; + xvect = -((mousx*(int)sintable[(ang+2048)&2047])<>14; + posy += yvect>>14; + updatesectorz(posx,posy,posz,&cursectnum); + } + else clipmove(&posx,&posy,&posz,&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK0); + } + else if (bstatus&4) + { + zmode = 2; + + // horiz-100 of 200 is viewing at 326.4 build angle units (=atan(200/128)) upward + tempint = getangle(128, horiz-100); + + xvect = -((mousy* + ((int)sintable[(ang+2560)&2047]>>6)* + ((int)sintable[(tempint+512)&2047])>>6) + <>6)* + ((int)sintable[(tempint+512)&2047])>>6) + <>(10-pk_uedaccel)); + + posz += zvect; + if (noclip) + { + posx += xvect>>16; + posy += yvect>>16; + updatesectorz(posx,posy,posz,&cursectnum); + } + else clipmove(&posx,&posy,&posz,&cursectnum,xvect>>2,yvect>>2,128L,4L<<8,4L<<8,CLIPMASK0); + } + } + + if (mlook && !(unrealedlook && bstatus&(1|4))) { ang += (mousx>>1)*msens; horiz -= (mousy>>2)*msens; @@ -619,7 +706,7 @@ void editinput(void) osearchx = searchx-mousx; osearchy = searchy-mousy; } - else + else if (!(unrealedlook && (bstatus&(1|2|4)))) { osearchx = searchx; osearchy = searchy; @@ -693,6 +780,7 @@ 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) { zmode++; @@ -5587,8 +5675,70 @@ void overheadeditor(void) else printmessage16("Arrow must be inside a sector before entering 3D mode."); } + +// vvv PK ------------------------------------ (LShift) Ctrl-X: (prev) next map +// this is copied from 'L' (load map), but without copying the highlighted sectors + + if (quickmapcycling && (keystatus[0x2d] > 0)) //X + { + if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //Ctrl + { +// bad = 0; + i = menuselect_pk(keystatus[0x2a]>0 ? 0:1); // Left Shift: prev map + if (i < 0) + { + if (i == -2) + printmessage16("No .MAP files found."); + else if (i == -3) + printmessage16("Load map first!"); + } + else + { + Bstrcpy(boardfilename, selectedboardfilename); + + highlightcnt = -1; + sectorhighlightstat = -1; + newnumwalls = -1; + joinsector[0] = -1; + circlewall = -1; + circlepoints = 7; + + for (i=0;i 0 && joinsector[0] >= 0){keystatus[1]=0;joinsector[0]=-1;} + if (keystatus[1] > 0 && joinsector[0] >= 0) {keystatus[1]=0;joinsector[0]=-1;} if (keystatus[1] > 0) { keystatus[1] = 0; @@ -6663,16 +6813,59 @@ int getfilenames(char *path, char *kind) return(0); } +// vvv PK ------------------------------------ +// copied off menuselect + +const char *g_oldpath=NULL; +int menuselect_pk(int direction) // 20080104: jump to next (direction!=0) or prev (direction==0) file +{ + const char *chptr; + + if (!g_oldpath) return -3; + else Bmemcpy(selectedboardfilename, g_oldpath, BMAX_PATH); + + if (pathsearchmode) + Bcanonicalisefilename(selectedboardfilename, 1); // clips off the last token and compresses relative path + else + Bcorrectfilename(selectedboardfilename, 1); + + getfilenames(selectedboardfilename, "*.map"); + + chptr = strrchr(boardfilename,'/'); // PK + if (!chptr) chptr=boardfilename; else chptr++; + for (; findfileshigh; findfileshigh=findfileshigh->next) + { + if (!Bstrcmp(findfileshigh->name,chptr)) break; + } + + if (!findfileshigh) findfileshigh=findfiles; + + if (direction) + { + if (findfileshigh->next) findfileshigh=findfileshigh->next; + } + else + { + if (findfileshigh->prev) findfileshigh=findfileshigh->prev; + } + + Bstrcat(selectedboardfilename, findfileshigh->name); + + return(0); +} +// ^^^ PK ------------------------------------ + int menuselect(void) { int listsize; int i; - char ch, buffer[78]; + char ch, buffer[78], /*PK*/ *chptr; static char oldpath[BMAX_PATH]; CACHE1D_FIND_REC *dir; - int bakpathsearchmode = pathsearchmode; + g_oldpath=oldpath; //PK: need it in menuselect_pk + listsize = (ydim16-32)/8; Bstrcpy(selectedboardfilename, oldpath); @@ -6683,6 +6876,15 @@ int menuselect(void) getfilenames(selectedboardfilename, "*.map"); + // PK 20080103: start with last selected map + chptr = strrchr(boardfilename,'/'); + if (!chptr) chptr=boardfilename; else chptr++; + for (; findfileshigh; findfileshigh=findfileshigh->next) + { + if (!Bstrcmp(findfileshigh->name,chptr)) break; + } + if (!findfileshigh) findfileshigh=findfiles; + begindrawing(); printmessage16("Select map file with arrow keys and enter."); enddrawing(); @@ -6713,7 +6915,7 @@ int menuselect(void) for (i=listsize/2-1; i>=0; i--) if (!dir->prev) break; else dir=dir->prev; for (i=0; inext) { - int c = dir->type == CACHE1D_FIND_DIR ? 4 : 3; + int c = dir->type == CACHE1D_FIND_DIR ? 2/*4*/ : 3; //PK memset(buffer,0,sizeof(buffer)); strncpy(buffer,dir->name,25); if (strlen(buffer) == 25) @@ -6788,7 +6990,8 @@ int menuselect(void) else if ((keystatus[0xc9]|keystatus[0xd1]) > 0) // page up/down { seeker = currentlist?findfileshigh:finddirshigh; - i = (ydim2d-STATUS2DSIZ-48)>>3; + i = (ydim2d-STATUS2DSIZ-48)>>5/*3*/; //PK + while (i>0) { if (keystatus[0xd1]?seeker->next:seeker->prev) @@ -7487,8 +7690,9 @@ void keytimerstuff(void) if (keystatus[buildkeys[5]] == 0) { - if (keystatus[buildkeys[2]] > 0) angvel = max(angvel-16,-128); - if (keystatus[buildkeys[3]] > 0) angvel = min(angvel+16,127); + // PK: With GCC and Polymost, keyboard turning lags + if (keystatus[buildkeys[2]] > 0) angvel = max(angvel-pk_turnaccel /* 16 */,-128); + if (keystatus[buildkeys[3]] > 0) angvel = min(angvel+pk_turnaccel /* 16 */,127); } else { @@ -7500,8 +7704,8 @@ void keytimerstuff(void) /* if (keystatus[buildkeys[12]] > 0) svel = min(svel+8,127); if (keystatus[buildkeys[13]] > 0) svel = max(svel-8,-128); */ - if (angvel < 0) angvel = min(angvel+12,0); - if (angvel > 0) angvel = max(angvel-12,0); + if (angvel < 0) angvel = min(angvel+pk_turndecel /*12*/,0); + if (angvel > 0) angvel = max(angvel-pk_turndecel /*12*/,0); if (svel < 0) svel = min(svel+6,0); if (svel > 0) svel = max(svel-6,0); if (vel < 0) vel = min(vel+6,0); diff --git a/polymer/build/src/defs.c b/polymer/build/src/defs.c index 7caba29f2..d7b73df38 100644 --- a/polymer/build/src/defs.c +++ b/polymer/build/src/defs.c @@ -1006,8 +1006,8 @@ static int defsparser(scriptfile *script) #endif } break; - case T_SKIN: case T_DETAIL: case T_GLOW: -case T_REDPAL: case T_BLUEPAL: case T_BROWNPAL: case T_GREYPAL: case T_GREENPAL: case T_SPECPAL: + case T_SKIN: case T_DETAIL: case T_GLOW: + case T_REDPAL: case T_BLUEPAL: case T_BROWNPAL: case T_GREYPAL: case T_GREENPAL: case T_SPECPAL: { char *skintokptr = script->ltextptr; char *skinend, *skinfn = 0; @@ -1398,8 +1398,8 @@ case T_REDPAL: case T_BLUEPAL: case T_BROWNPAL: case T_GREYPAL: case T_GREENPAL: if (pal<30)palbits|=1<ltextptr, *detailend; int pal = 0, i; diff --git a/polymer/build/src/mdsprite.c b/polymer/build/src/mdsprite.c index 68dbd216b..5bb0b276b 100644 --- a/polymer/build/src/mdsprite.c +++ b/polymer/build/src/mdsprite.c @@ -8,7 +8,7 @@ int addtileP(int model,int tile,int pallet) { UNREFERENCED_PARAMETER(model); if (curextra==MAXTILES+EXTRATILES-2)return curextra; - if (tile2model[tile].modelid==-1){tile2model[tile].pal=pallet;return tile;} + if (tile2model[tile].modelid==-1) {tile2model[tile].pal=pallet;return tile;} if (tile2model[tile].pal==pallet)return tile; while (tile2model[tile].next!=-1) { diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index f4e77ce90..897cb484d 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -225,7 +225,7 @@ static inline void ftol(float f, int *a) #if 0 //(__GNUC__ >= 3) "flds %1; fistpl %0;" #else -"flds %1; fistpl (%0);" + "flds %1; fistpl (%0);" #endif : "=r"(a) : "m"(f) : "memory","cc"); } @@ -236,7 +236,7 @@ static inline void dtol(double d, int *a) #if 0 //(__GNUC__ >= 3) "fldl %1; fistpl %0;" #else -"fldl %1; fistpl (%0);" + "fldl %1; fistpl (%0);" #endif : "=r"(a) : "m"(d) : "memory","cc"); } @@ -6055,8 +6055,8 @@ int dxtfilter(int fil, texcachepicture *pict, char *pic, void *midbuf, char *pac } else writebuf = packbuf; #else - cleng = lzwcompress(midbuf,(miplen/stride)*8,packbuf); - writebuf = packbuf; + cleng = lzwcompress(midbuf,(miplen/stride)*8,packbuf); + writebuf = packbuf; #endif } else @@ -6086,8 +6086,8 @@ int dxtfilter(int fil, texcachepicture *pict, char *pic, void *midbuf, char *pac } else writebuf = packbuf; #else - cleng = lzwcompress(midbuf,(miplen/stride)*4,packbuf); - writebuf = packbuf; + cleng = lzwcompress(midbuf,(miplen/stride)*4,packbuf); + writebuf = packbuf; #endif } else @@ -6122,8 +6122,8 @@ int dxtfilter(int fil, texcachepicture *pict, char *pic, void *midbuf, char *pac } else writebuf = packbuf; #else - cleng = lzwcompress(midbuf,(miplen/stride)*4,packbuf); - writebuf = packbuf; + cleng = lzwcompress(midbuf,(miplen/stride)*4,packbuf); + writebuf = packbuf; #endif } else @@ -6177,8 +6177,8 @@ int dedxtfilter(int fil, texcachepicture *pict, char *pic, void *midbuf, char *p if (ispacked && cleng < j) if (lzf_decompress(packbuf,cleng,midbuf,j) == 0) return -1; #else - if (kread(fil,inbuf,cleng) < cleng) return -1; - if (ispacked && lzwuncompress(packbuf,cleng,midbuf,j) != j) return -1; + if (kread(fil,inbuf,cleng) < cleng) return -1; + if (ispacked && lzwuncompress(packbuf,cleng,midbuf,j) != j) return -1; #endif cptr = midbuf; for (k=0;k<8;k++) pic[k] = *cptr++; diff --git a/polymer/eduke32/Makefile.msvc b/polymer/eduke32/Makefile.msvc index 65bb041dc..060cf9fc1 100644 --- a/polymer/eduke32/Makefile.msvc +++ b/polymer/eduke32/Makefile.msvc @@ -27,7 +27,7 @@ DXROOT=c:\sdks\dx6 MSSDKROOT="C:\Program Files\Microsoft Visual Studio 8\VC PLATFORMSDK="C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK -ENGINEOPTS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DUSE_OPENAL +ENGINEOPTS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DUSE_OPENAL /DPOLYMER CC=cl AS=ml diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 7e0091a5e..466cb31a0 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -723,15 +723,15 @@ void ExtShowSectorData(short sectnum) //F5 printext16(x*8,ydim16+y*8,11,-1,"Item Count",0); enddrawing(); PrintStatus("10%health=",numsprite[COLA],x,y+2,11); - PrintStatus("",multisprite[COLA],x2,y+2,1); + PrintStatus("",multisprite[COLA],x2,y+2,9); PrintStatus("30%health=",numsprite[SIXPAK],x,y+3,11); - PrintStatus("",multisprite[SIXPAK],x2,y+3,1); + PrintStatus("",multisprite[SIXPAK],x2,y+3,9); PrintStatus("Med-Kit =",numsprite[FIRSTAID],x,y+4,11); - PrintStatus("",multisprite[FIRSTAID],x2,y+4,1); + PrintStatus("",multisprite[FIRSTAID],x2,y+4,9); PrintStatus("Atom =",numsprite[ATOMICHEALTH],x,y+5,11); - PrintStatus("",multisprite[ATOMICHEALTH],x2,y+5,1); + PrintStatus("",multisprite[ATOMICHEALTH],x2,y+5,9); PrintStatus("Shields =",numsprite[SHIELD],x,y+6,11); - PrintStatus("",multisprite[SHIELD],x2,y+6,1); + PrintStatus("",multisprite[SHIELD],x2,y+6,9); x=17; x2=30; @@ -740,17 +740,17 @@ void ExtShowSectorData(short sectnum) //F5 printext16(x*8,ydim16+y*8,11,-1,"Inventory",0); enddrawing(); PrintStatus("Steroids =",numsprite[STEROIDS],x,y+2,11); - PrintStatus("",multisprite[STEROIDS],x2,y+2,1); + PrintStatus("",multisprite[STEROIDS],x2,y+2,9); PrintStatus("Airtank =",numsprite[AIRTANK],x,y+3,11); - PrintStatus("",multisprite[AIRTANK],x2,y+3,1); + PrintStatus("",multisprite[AIRTANK],x2,y+3,9); PrintStatus("Jetpack =",numsprite[JETPACK],x,y+4,11); - PrintStatus("",multisprite[JETPACK],x2,y+4,1); + PrintStatus("",multisprite[JETPACK],x2,y+4,9); PrintStatus("Goggles =",numsprite[HEATSENSOR],x,y+5,11); - PrintStatus("",multisprite[HEATSENSOR],x2,y+5,1); + PrintStatus("",multisprite[HEATSENSOR],x2,y+5,9); PrintStatus("Boots =",numsprite[BOOTS],x,y+6,11); - PrintStatus("",multisprite[BOOTS],x2,y+6,1); + PrintStatus("",multisprite[BOOTS],x2,y+6,9); PrintStatus("HoloDuke =",numsprite[HOLODUKE],x,y+7,11); - PrintStatus("",multisprite[HOLODUKE],x2,y+7,1); + PrintStatus("",multisprite[HOLODUKE],x2,y+7,9); PrintStatus("Multi D =",numsprite[APLAYER],x,y+8,11); x=33; @@ -760,23 +760,23 @@ void ExtShowSectorData(short sectnum) //F5 printext16(x*8,ydim16+y*8,11,-1,"Weapon Count",0); enddrawing(); PrintStatus("Pistol =",numsprite[FIRSTGUNSPRITE],x,y+2,11); - PrintStatus("",multisprite[FIRSTGUNSPRITE],x2,y+2,1); + PrintStatus("",multisprite[FIRSTGUNSPRITE],x2,y+2,9); PrintStatus("Shotgun =",numsprite[SHOTGUNSPRITE],x,y+3,11); - PrintStatus("",multisprite[SHOTGUNSPRITE],x2,y+3,1); + PrintStatus("",multisprite[SHOTGUNSPRITE],x2,y+3,9); PrintStatus("Chaingun =",numsprite[CHAINGUNSPRITE],x,y+4,11); - PrintStatus("",multisprite[CHAINGUNSPRITE],x2,y+4,1); + PrintStatus("",multisprite[CHAINGUNSPRITE],x2,y+4,9); PrintStatus("RPG =",numsprite[RPGSPRITE],x,y+5,11); - PrintStatus("",multisprite[RPGSPRITE],x2,y+5,1); + PrintStatus("",multisprite[RPGSPRITE],x2,y+5,9); PrintStatus("Pipe Bomb=",numsprite[HEAVYHBOMB],x,y+6,11); - PrintStatus("",multisprite[HEAVYHBOMB],x2,y+6,1); + PrintStatus("",multisprite[HEAVYHBOMB],x2,y+6,9); PrintStatus("Shrinker =",numsprite[SHRINKERSPRITE],x,y+7,11); - PrintStatus("",multisprite[SHRINKERSPRITE],x2,y+7,1); + PrintStatus("",multisprite[SHRINKERSPRITE],x2,y+7,9); PrintStatus("Devastatr=",numsprite[DEVISTATORSPRITE],x,y+8,11); - PrintStatus("",multisprite[DEVISTATORSPRITE],x2,y+8,1); + PrintStatus("",multisprite[DEVISTATORSPRITE],x2,y+8,9); PrintStatus("Trip mine=",numsprite[TRIPBOMBSPRITE],x,y+9,11); - PrintStatus("",multisprite[TRIPBOMBSPRITE],x2,y+9,1); + PrintStatus("",multisprite[TRIPBOMBSPRITE],x2,y+9,9); PrintStatus("Freezeray=",numsprite[FREEZESPRITE],x,y+10,11); - PrintStatus("",multisprite[FREEZESPRITE],x2,y+10,1); + PrintStatus("",multisprite[FREEZESPRITE],x2,y+10,9); x=49; x2=62; @@ -785,23 +785,23 @@ void ExtShowSectorData(short sectnum) //F5 printext16(x*8,ydim16+y*8,11,-1,"Ammo Count",0); enddrawing(); PrintStatus("Pistol =",numsprite[AMMO],x,y+2,11); - PrintStatus("",multisprite[AMMO],x2,y+2,1); + PrintStatus("",multisprite[AMMO],x2,y+2,9); PrintStatus("Shot =",numsprite[SHOTGUNAMMO],x,y+3,11); - PrintStatus("",multisprite[SHOTGUNAMMO],x2,y+3,1); + PrintStatus("",multisprite[SHOTGUNAMMO],x2,y+3,9); PrintStatus("Chain =",numsprite[BATTERYAMMO],x,y+4,11); - PrintStatus("",multisprite[BATTERYAMMO],x2,y+4,1); + PrintStatus("",multisprite[BATTERYAMMO],x2,y+4,9); PrintStatus("RPG Box =",numsprite[RPGAMMO],x,y+5,11); - PrintStatus("",multisprite[RPGAMMO],x2,y+5,1); + PrintStatus("",multisprite[RPGAMMO],x2,y+5,9); PrintStatus("Pipe Bomb=",numsprite[HBOMBAMMO],x,y+6,11); - PrintStatus("",multisprite[HBOMBAMMO],x2,y+6,1); + PrintStatus("",multisprite[HBOMBAMMO],x2,y+6,9); PrintStatus("Shrinker =",numsprite[CRYSTALAMMO],x,y+7,11); - PrintStatus("",multisprite[CRYSTALAMMO],x2,y+7,1); + PrintStatus("",multisprite[CRYSTALAMMO],x2,y+7,9); PrintStatus("Devastatr=",numsprite[DEVISTATORAMMO],x,y+8,11); - PrintStatus("",multisprite[DEVISTATORAMMO],x2,y+8,1); + PrintStatus("",multisprite[DEVISTATORAMMO],x2,y+8,9); PrintStatus("Expander =",numsprite[GROWAMMO],x,y+9,11); - PrintStatus("",multisprite[GROWAMMO],x2,y+9,1); + PrintStatus("",multisprite[GROWAMMO],x2,y+9,9); PrintStatus("Freezeray=",numsprite[FREEZEAMMO],x,y+10,11); - PrintStatus("",multisprite[FREEZEAMMO],x2,y+10,1); + PrintStatus("",multisprite[FREEZEAMMO],x2,y+10,9); begindrawing(); printext16(65*8,ydim16+4*8,11,-1,"MISC",0); @@ -2156,7 +2156,7 @@ static int OnGotoTile(int iTile) bflushchars(); - iNewTile = iTemp = iTile; + iNewTile = iTemp = 0; //iTile; //PK while (keystatus[1] == 0) { @@ -2435,6 +2435,8 @@ static int DrawTiles(int iTopLeft, int iSelected, int nXTiles, int nYTiles, int } +extern char unrealedlook; //PK + static void Keys3d(void) { int i,count,rate,nexti; @@ -2634,6 +2636,15 @@ static void Keys3d(void) keystatus[KEYSC_F3] = 0; } +// PK + if (keystatus[KEYSC_F5]) + { + unrealedlook = 1-unrealedlook; + Bsprintf(tempbuf,"UnrealEd mouse navigation: %d",unrealedlook); + message(tempbuf); + keystatus[KEYSC_F5] = 0; + } + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x0e]==1) // ' del { keystatus[0x0e] = 0; @@ -3074,12 +3085,15 @@ static void Keys3d(void) if (mlook == 2) mlook = 0; - if (bstatus&4) + if (!unrealedlook && (bstatus&4)) mlook = 2; + +// if (bstatus&4) + if (bstatus&(16|32) && !(bstatus&(1|2|4))) // PK: no btn: wheel changes shade { - if (bstatus&1) - { - mlook = 2; - } +// if (bstatus&1) +// { +// mlook = 2; +// } if (bstatus&32) // - { mouseb &= ~32; @@ -3092,7 +3106,7 @@ static void Keys3d(void) } else { - if ((keystatus[0x2a]|keystatus[0x36]) == 0) + if ((keystatus[0x2a]|keystatus[0x36]) == 0) //not SHIFT k = 16; else k = 1; @@ -3258,7 +3272,9 @@ static void Keys3d(void) } } - if ((keystatus[KEYSC_DASH]|keystatus[KEYSC_EQUAL]|((bstatus&(16|32)) && !(bstatus&2))) > 0) // mousewheel, -, and +, cycle picnum +// if ((keystatus[KEYSC_DASH]|keystatus[KEYSC_EQUAL]|((bstatus&(16|32)) && !(bstatus&2))) > 0) // mousewheel, -, and +, cycle picnum + if (keystatus[KEYSC_DASH] | keystatus[KEYSC_EQUAL] | (bstatus&(16|32) && (bstatus&1) && !(bstatus&2))) // PK: lmb only & mousewheel, -, and +, cycle picnum + { j = i = (keystatus[KEYSC_EQUAL]|(bstatus&16))?1:-1; switch (searchstat) @@ -3357,7 +3373,7 @@ static void Keys3d(void) if (searchstat == 2) { sector[searchsector].floorstat ^= 64; - sprintf(getmessage,"Sector %d ceiling texture relativity %s",searchsector,sector[searchsector].floorstat&64?"ON":"OFF"); + sprintf(getmessage,"Sector %d floor texture relativity %s",searchsector,sector[searchsector].floorstat&64?"ON":"OFF"); //PK (was ceiling in string) message(getmessage); asksave = 1; } @@ -3532,7 +3548,8 @@ static void Keys3d(void) else updownunits = 1024; - if ((keystatus[0xc9] > 0) || ((bstatus&2) && (bstatus&16))) // PGUP +// if ((keystatus[0xc9] > 0) || ((bstatus&2) && (bstatus&16))) // PGUP + if ((keystatus[0xc9] > 0) || ((bstatus&2) && (bstatus&16) && !(bstatus&1))) // PK: PGUP, rmb only & mwheel { k = 0; if (highlightsectorcnt >= 0) @@ -3668,7 +3685,8 @@ static void Keys3d(void) keystatus[0xc9] = 0; mouseb &= ~16; } - if ((keystatus[0xd1] > 0) || ((bstatus&2) && (bstatus&32))) // PGDN +// if ((keystatus[0xd1] > 0) || ((bstatus&2) && (bstatus&32))) // PGDN + if ((keystatus[0xd1] > 0) || ((bstatus&2) && (bstatus&32) && !(bstatus&1))) // PK: PGDN, rmb only & mwheel { k = 0; if (highlightsectorcnt >= 0) @@ -3830,15 +3848,16 @@ static void Keys3d(void) clockcnt = ((clockcnt+1)&15); tempbuf[0] = 0; - if (bstatus&4) + if (bstatus&4 && !(bstatus&(1|2)) && !unrealedlook) //PK { - if (bstatus&1) Bsprintf(tempbuf,"VIEW"); - else Bsprintf(tempbuf,"SHADE"); + Bsprintf(tempbuf,"VIEW"); +// else Bsprintf(tempbuf,"SHADE"); } - else if (bstatus&2) + else if (bstatus&2 && !(bstatus&1)) Bsprintf(tempbuf,"Z"); - else if (bstatus&1) + else if (bstatus&1 && !(bstatus&2)) Bsprintf(tempbuf,"LOCK"); + if (tempbuf[0] != 0) { i = (Bstrlen(tempbuf)<<3)+6; @@ -5399,6 +5418,54 @@ static int osdcmd_noclip(const osdfuncparm_t *parm) return OSDCMD_OK; } +//PK vvv ------------ +extern int pk_turnaccel, pk_turndecel, pk_uedaccel; +extern char quickmapcycling; + +static int osdcmd_vars_pk(const osdfuncparm_t *parm) +{ + int showval = (parm->numparms < 1); + + // this is something of a misnomer, since it's actually accel+decel + if (!Bstrcasecmp(parm->name, "pk_turnaccel")) + { + if (showval) { OSD_Printf("Turning acceleration+declaration is %d\n", pk_turnaccel); } + else + { + pk_turnaccel = atoi(parm->parms[0]); + pk_turnaccel = pk_turnaccel<=pk_turndecel ? (pk_turndecel+1):pk_turnaccel; + pk_turnaccel = pk_turnaccel>256 ? 256:pk_turnaccel; + } + } + else if (!Bstrcasecmp(parm->name, "pk_turndecel")) + { + if (showval) { OSD_Printf("Turning deceleration is %d\n", pk_turndecel); } + else + { + pk_turndecel = atoi(parm->parms[0]); + pk_turndecel = pk_turndecel<=0 ? 1:pk_turndecel; + pk_turndecel = pk_turndecel>=pk_turnaccel ? (pk_turnaccel-1):pk_turndecel; + pk_turndecel = pk_turndecel>128 ? 128:pk_turndecel; + } + } + else if (!Bstrcasecmp(parm->name, "pk_quickmapcycling")) + { + OSD_Printf("Quick map cycling ((LShift-)Ctrl-X): %s\n", + (quickmapcycling = !quickmapcycling) ? "on":"off"); + } + else if (!Bstrcasecmp(parm->name, "pk_uedaccel")) + { + if (showval) { OSD_Printf("UnrealEd mouse navigation acceleration is %d\n", pk_uedaccel); } + else + { + pk_uedaccel = atoi(parm->parms[0]); + pk_uedaccel = pk_uedaccel<0 ? 0:pk_uedaccel; + pk_uedaccel = pk_uedaccel>5 ? 5:pk_uedaccel; + } + } + return OSDCMD_OK; +} + static int registerosdcommands(void) { OSD_RegisterFunction("addpath","addpath : adds path to game filesystem", osdcmd_addpath); @@ -5419,6 +5486,11 @@ static int registerosdcommands(void) OSD_RegisterFunction("sensitivity","sensitivity : changes the mouse sensitivity", osdcmd_sensitivity); + //PK + OSD_RegisterFunction("pk_turnaccel", "pk_turnaccel: sets turning acceleration", osdcmd_vars_pk); + OSD_RegisterFunction("pk_turndecel", "pk_turndecel: sets turning deceleration", osdcmd_vars_pk); + OSD_RegisterFunction("pk_uedaccel", "pk_uedaccel: sets UnrealEd movement speed factor (0-5, exponentially)", osdcmd_vars_pk); + OSD_RegisterFunction("pk_quickmapcycling", "pk_quickmapcycling: allows cycling of maps with (Shift-)Ctrl-X", osdcmd_vars_pk); return 0; } diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index bf5debcb6..dcd3cc0f8 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -3885,7 +3885,7 @@ static int parsecommand(void) { t=tempscrptr[i];n=i; for (j=i+2;j<3+tempscrptr[1]*2;j+=2) - if (tempscrptr[j] 8) { - int i; - i = ud.screen_size; - barsm(d+8,yy+7, (short *)&ud.screen_size,-4,x==io,MENUHIGHLIGHT(io),PHX(-5)); - if (i < ud.screen_size && i == 8 && ud.statusbarmode == 1 && bpp > 8) + ud.statusbarmode = 0; + if (ud.statusbarscale != 100) + ud.screen_size = i; + } + else if (i > ud.screen_size && i == 8 && ud.statusbarmode == 0 && bpp > 8) + { + if (ud.statusbarscale != 100) { - ud.statusbarmode = 0; - if (ud.statusbarscale != 100) - ud.screen_size = i; - } - else if (i > ud.screen_size && i == 8 && ud.statusbarmode == 0 && bpp > 8) - { - if (ud.statusbarscale != 100) - { - ud.statusbarmode = 1; - ud.screen_size = i; - } + ud.statusbarmode = 1; + ud.screen_size = i; } } - break; + } + break; case 3: + { + short sbs, sbsl; + sbs = sbsl = ud.statusbarscale-37; + barsm(d+8,yy+7, (short *)&sbs,8,x==io,MENUHIGHLIGHT(io),PHX(-5)); + if (x == io && sbs != sbsl) { - short sbs, sbsl; - sbs = sbsl = ud.statusbarscale-37; - barsm(d+8,yy+7, (short *)&sbs,8,x==io,MENUHIGHLIGHT(io),PHX(-5)); - if (x == io && sbs != sbsl) - { - sbs += 37; - setstatusbarscale(sbs); - } + sbs += 37; + setstatusbarscale(sbs); } - break; + } + break; case 4: if (x==io) ud.runkey_mode = 1-ud.runkey_mode; modval(0,1,(int *)&ud.runkey_mode,1,probey==io); @@ -2897,37 +2897,37 @@ cheat_for_port_credits: break; case 2: - { - int dax = xdim, day = ydim, daz; - curvidmode = newvidmode = checkvideomode(&dax,&day,bpp,fullscreen,0); - if (newvidmode == 0x7fffffffl) newvidmode = validmodecnt; - newfullscreen = fullscreen; - changesmade = 0; + { + int dax = xdim, day = ydim, daz; + curvidmode = newvidmode = checkvideomode(&dax,&day,bpp,fullscreen,0); + if (newvidmode == 0x7fffffffl) newvidmode = validmodecnt; + newfullscreen = fullscreen; + changesmade = 0; - dax = 0; - for (day = 0; day < validmodecnt; day++) + dax = 0; + for (day = 0; day < validmodecnt; day++) + { + if (dax == sizeof(vidsets)/sizeof(vidsets[1])) break; + for (daz = 0; daz < dax; daz++) + if ((validmode[day].bpp|((validmode[day].fs&1)<<16)) == (vidsets[daz]&0x1ffffl)) break; + if (vidsets[daz] != -1) continue; + if (validmode[day].bpp == 8) { - if (dax == sizeof(vidsets)/sizeof(vidsets[1])) break; - for (daz = 0; daz < dax; daz++) - if ((validmode[day].bpp|((validmode[day].fs&1)<<16)) == (vidsets[daz]&0x1ffffl)) break; - if (vidsets[daz] != -1) continue; - if (validmode[day].bpp == 8) - { - vidsets[dax++] = 8|((validmode[day].fs&1)<<16); + vidsets[dax++] = 8|((validmode[day].fs&1)<<16); // 8-bit Polymost can diaf // vidsets[dax++] = 0x20000|8|((validmode[day].fs&1)<<16); - } - else - vidsets[dax++] = 0x20000|validmode[day].bpp|((validmode[day].fs&1)<<16); } - for (dax = 0; dax < (int)(sizeof(vidsets)/sizeof(vidsets[1])) && vidsets[dax] != -1; dax++) - if (vidsets[dax] == (((getrendermode()>=2)<<17)|(fullscreen<<16)|bpp)) break; - if (dax < (int)(sizeof(vidsets)/sizeof(vidsets[1]))) newvidset = dax; - curvidset = newvidset; - - cmenu(203); + else + vidsets[dax++] = 0x20000|validmode[day].bpp|((validmode[day].fs&1)<<16); } - break; + for (dax = 0; dax < (int)(sizeof(vidsets)/sizeof(vidsets[1])) && vidsets[dax] != -1; dax++) + if (vidsets[dax] == (((getrendermode()>=2)<<17)|(fullscreen<<16)|bpp)) break; + if (dax < (int)(sizeof(vidsets)/sizeof(vidsets[1]))) newvidset = dax; + curvidset = newvidset; + + cmenu(203); + } + break; case 3: if (ud.recstat != 1) cmenu(20002); @@ -3007,64 +3007,64 @@ cheat_for_port_credits: break; case 1: + { + int lastvidset, lastvidmode, safevidmode = -1; + lastvidset = newvidset; + lastvidmode = newvidmode; + // find the next vidset compatible with the current fullscreen setting + while (vidsets[0] != -1) { - int lastvidset, lastvidmode, safevidmode = -1; - lastvidset = newvidset; - lastvidmode = newvidmode; - // find the next vidset compatible with the current fullscreen setting - while (vidsets[0] != -1) + newvidset++; + if (newvidset == sizeof(vidsets)/sizeof(vidsets[0]) || vidsets[newvidset] == -1) { - newvidset++; - if (newvidset == sizeof(vidsets)/sizeof(vidsets[0]) || vidsets[newvidset] == -1) - { - newvidset = -1; - continue; - } - if (((vidsets[newvidset]>>16)&1) != newfullscreen) continue; - break; + newvidset = -1; + continue; } - - if ((vidsets[newvidset] & 0x0ffff) != (vidsets[lastvidset] & 0x0ffff)) - { - // adjust the video mode to something legal for the new vidset - do - { - newvidmode++; - if (newvidmode == lastvidmode) break; // end of cycle - if (newvidmode >= validmodecnt) - { - if (safevidmode != -1) - break; - newvidmode = 0; - } - if (validmode[newvidmode].bpp == (vidsets[newvidset]&0x0ffff) && - validmode[newvidmode].fs == newfullscreen && - validmode[newvidmode].xdim <= validmode[lastvidmode].xdim && - (safevidmode==-1?1:(validmode[newvidmode].xdim>=validmode[safevidmode].xdim)) && - validmode[newvidmode].ydim <= validmode[lastvidmode].ydim && - (safevidmode==-1?1:(validmode[newvidmode].ydim>=validmode[safevidmode].ydim)) - ) - safevidmode = newvidmode; - } - while (1); - if (safevidmode == -1) - { - //OSD_Printf("No best fit!\n"); - newvidmode = lastvidmode; - newvidset = lastvidset; - } - else - { - //OSD_Printf("Best fit is %dx%dx%d-%d %d\n",validmode[safevidmode].xdim,validmode[safevidmode].ydim,validmode[safevidmode].bpp,validmode[safevidmode].fs,safevidmode); - newvidmode = safevidmode; - } - } - if (newvidset != curvidset) changesmade |= 4; - else changesmade &= ~4; - if (newvidmode != curvidmode) changesmade |= 1; - else changesmade &= ~1; + if (((vidsets[newvidset]>>16)&1) != newfullscreen) continue; + break; } - break; + + if ((vidsets[newvidset] & 0x0ffff) != (vidsets[lastvidset] & 0x0ffff)) + { + // adjust the video mode to something legal for the new vidset + do + { + newvidmode++; + if (newvidmode == lastvidmode) break; // end of cycle + if (newvidmode >= validmodecnt) + { + if (safevidmode != -1) + break; + newvidmode = 0; + } + if (validmode[newvidmode].bpp == (vidsets[newvidset]&0x0ffff) && + validmode[newvidmode].fs == newfullscreen && + validmode[newvidmode].xdim <= validmode[lastvidmode].xdim && + (safevidmode==-1?1:(validmode[newvidmode].xdim>=validmode[safevidmode].xdim)) && + validmode[newvidmode].ydim <= validmode[lastvidmode].ydim && + (safevidmode==-1?1:(validmode[newvidmode].ydim>=validmode[safevidmode].ydim)) + ) + safevidmode = newvidmode; + } + while (1); + if (safevidmode == -1) + { + //OSD_Printf("No best fit!\n"); + newvidmode = lastvidmode; + newvidset = lastvidset; + } + else + { + //OSD_Printf("Best fit is %dx%dx%d-%d %d\n",validmode[safevidmode].xdim,validmode[safevidmode].ydim,validmode[safevidmode].bpp,validmode[safevidmode].fs,safevidmode); + newvidmode = safevidmode; + } + } + if (newvidset != curvidset) changesmade |= 4; + else changesmade &= ~4; + if (newvidmode != curvidmode) changesmade |= 1; + else changesmade &= ~1; + } + break; case 2: newfullscreen = !newfullscreen; @@ -3382,44 +3382,44 @@ cheat_for_port_credits: break; case 210: + { + int32 sc; + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"KEYBOARD SETUP"); + + gametext(320>>1,90,"PRESS THE KEY TO ASSIGN AS",0,2+8+16); + sprintf(tempbuf,"%s FOR \"%s\"", whichkey?"SECONDARY":"PRIMARY", CONFIG_FunctionNumToName(function)); + gametext(320>>1,90+9,tempbuf,0,2+8+16); + gametext(320>>1,90+9+9+9,"PRESS \"ESCAPE\" TO CANCEL",0,2+8+16); + + sc = KB_GetLastScanCode(); + if (sc != sc_None || RMB) { - int32 sc; - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"KEYBOARD SETUP"); - - gametext(320>>1,90,"PRESS THE KEY TO ASSIGN AS",0,2+8+16); - sprintf(tempbuf,"%s FOR \"%s\"", whichkey?"SECONDARY":"PRIMARY", CONFIG_FunctionNumToName(function)); - gametext(320>>1,90+9,tempbuf,0,2+8+16); - gametext(320>>1,90+9+9+9,"PRESS \"ESCAPE\" TO CANCEL",0,2+8+16); - - sc = KB_GetLastScanCode(); - if (sc != sc_None || RMB) + if (sc == sc_Escape || RMB) { - if (sc == sc_Escape || RMB) - { - sound(EXITMENUSOUND); - } + sound(EXITMENUSOUND); + } + else + { + sound(PISTOL_BODYHIT); + + ud.config.KeyboardKeys[function][whichkey] = KB_GetLastScanCode(); + if (function == gamefunc_Show_Console) + OSD_CaptureKey(KB_GetLastScanCode()); else - { - sound(PISTOL_BODYHIT); - - ud.config.KeyboardKeys[function][whichkey] = KB_GetLastScanCode(); - if (function == gamefunc_Show_Console) - OSD_CaptureKey(KB_GetLastScanCode()); - else - CONTROL_MapKey(function, ud.config.KeyboardKeys[function][0], ud.config.KeyboardKeys[function][1]); - } - - cmenu(204); - - currentlist = whichkey; - probey = function; - - KB_ClearKeyDown(sc); + CONTROL_MapKey(function, ud.config.KeyboardKeys[function][0], ud.config.KeyboardKeys[function][1]); } - break; + cmenu(204); + + currentlist = whichkey; + probey = function; + + KB_ClearKeyDown(sc); } + + break; + } case 205: rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); menutext(320>>1,24,0,0,"MOUSE SETUP"); @@ -3946,252 +3946,252 @@ cheat_for_port_credits: case 220: case 221: case 222: + { + int thispage, twothispage; + + rotatesprite(320<<15,10<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,15,0,0,"JOYSTICK AXES"); + + thispage = (current_menu < 217) ? (current_menu-208) : (current_menu-217)+2; + twothispage = (thispage*2+1 < joynumaxes); + + onbar = 0; + switch (probey) { - int thispage, twothispage; - - rotatesprite(320<<15,10<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,15,0,0,"JOYSTICK AXES"); - - thispage = (current_menu < 217) ? (current_menu-208) : (current_menu-217)+2; - twothispage = (thispage*2+1 < joynumaxes); - - onbar = 0; - switch (probey) - { - case 0: - case 4: - onbar = 1; - x = probe(88,45+(probey==4)*64,0,1+(4< 2) - { - if (thispage == ((joynumaxes+1)/2)-1) cmenu(208); - else - { - if (current_menu == 209) cmenu(217); - else cmenu(current_menu+1); - } - } - break; - - case 4: // bar - if (!twothispage && joynumaxes > 2) - cmenu(208); - case 0: - break; - - case 1: // digitals - case 2: - case 5: - case 6: - function = 3; - whichkey = ((thispage*2+(x==5||x==6)) << 1) + (x==2||x==6); - cmenu(211); - probey = ud.config.JoystickDigitalFunctions[whichkey>>1][whichkey&1]; - if (probey < 0) probey = NUMGAMEFUNCTIONS-1; - break; - - case 3: // analogues - case 7: - l = ud.config.JoystickAnalogueAxes[thispage*2+(x==7)]; - if (l == analog_turning) l = analog_strafing; - else if (l == analog_strafing) l = analog_lookingupanddown; - else if (l == analog_lookingupanddown) l = analog_moving; - else if (l == analog_moving) l = -1; - else l = analog_turning; - ud.config.JoystickAnalogueAxes[thispage*2+(x==7)] = l; - CONTROL_MapAnalogAxis(thispage*2+(x==7),l,controldevice_joystick); - { - extern int32 mouseyaxismode; // player.c - mouseyaxismode = -1; - } - break; - default: - break; - } - - Bsprintf(tempbuf,(char *)getjoyname(0,thispage*2)); - menutext(42,32,0,0,tempbuf); - if (twothispage) - { - Bsprintf(tempbuf,(char *)getjoyname(0,thispage*2+1)); - menutext(42,32+64,0,0,tempbuf); - } - gametext(76,38,"SCALE",0,2+8+16); - l = (ud.config.JoystickAnalogueScale[thispage*2]+262144) >> 13; - bar(140+56,38+8,(short *)&l,1,x==0,0,0); - l = (l<<13)-262144; - if (l != ud.config.JoystickAnalogueScale[thispage*2]) - { - CONTROL_SetAnalogAxisScale(thispage*2, l, controldevice_joystick); - ud.config.JoystickAnalogueScale[thispage*2] = l; - } - Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); - gametext(140,38,tempbuf,0,2+8+16); - - gametext(76,38+15,"DIGITAL",0,2+8+16); - if (ud.config.JoystickDigitalFunctions[thispage*2][0] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2][0])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitext(140+12,38+15,tempbuf,0,10+16); - - if (ud.config.JoystickDigitalFunctions[thispage*2][1] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2][1])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitext(140+12+72,38+15,tempbuf,0,10+16); - - gametext(76,38+15+15,"ANALOG",0,2+8+16); - if (CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2])) - { - p = CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2]); - if (p) - { - gametext(140+12,38+15+15, strchr(p,'_')+1, 0, 2+8+16); - } - } - - if (twothispage) - { - gametext(76,38+64,"SCALE",0,2+8+16); - l = (ud.config.JoystickAnalogueScale[thispage*2+1]+262144) >> 13; - bar(140+56,38+8+64,(short *)&l,1,x==4,0,0); - l = (l<<13)-262144; - if (l != ud.config.JoystickAnalogueScale[thispage*2+1]) - { - CONTROL_SetAnalogAxisScale(thispage*2+1, l, controldevice_joystick); - ud.config.JoystickAnalogueScale[thispage*2+1] = l; - } - Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); - gametext(140,38+64,tempbuf,0,2+8+16); - - gametext(76,38+64+15,"DIGITAL",0,2+8+16); - if (ud.config.JoystickDigitalFunctions[thispage*2+1][0] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2+1][0])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitext(140+12,38+15+64,tempbuf,0,10+16); - - if (ud.config.JoystickDigitalFunctions[thispage*2+1][1] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2+1][1])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitext(140+12+72,38+15+64,tempbuf,0,10+16); - - gametext(76,38+64+15+15,"ANALOG",0,2+8+16); - if (CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2+1])) - { - p = CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2+1]); - if (p) - { - gametext(140+12,38+64+15+15, strchr(p,'_')+1, 0, 2+8+16); - } - } - } - - if (joynumaxes > 2) - { - menutext(320>>1,twothispage?158:108,SHX(-10),(joynumaxes<=2),"NEXT..."); - sprintf(tempbuf,"Page %d of %d",thispage+1,(joynumaxes+1)/2); - gametext(320-100,158,tempbuf,0,2+8+16); - } + case 0: + case 4: + onbar = 1; + x = probe(88,45+(probey==4)*64,0,1+(4< 2) + { + if (thispage == ((joynumaxes+1)/2)-1) cmenu(208); + else + { + if (current_menu == 209) cmenu(217); + else cmenu(current_menu+1); + } + } + break; + + case 4: // bar + if (!twothispage && joynumaxes > 2) + cmenu(208); + case 0: + break; + + case 1: // digitals + case 2: + case 5: + case 6: + function = 3; + whichkey = ((thispage*2+(x==5||x==6)) << 1) + (x==2||x==6); + cmenu(211); + probey = ud.config.JoystickDigitalFunctions[whichkey>>1][whichkey&1]; + if (probey < 0) probey = NUMGAMEFUNCTIONS-1; + break; + + case 3: // analogues + case 7: + l = ud.config.JoystickAnalogueAxes[thispage*2+(x==7)]; + if (l == analog_turning) l = analog_strafing; + else if (l == analog_strafing) l = analog_lookingupanddown; + else if (l == analog_lookingupanddown) l = analog_moving; + else if (l == analog_moving) l = -1; + else l = analog_turning; + ud.config.JoystickAnalogueAxes[thispage*2+(x==7)] = l; + CONTROL_MapAnalogAxis(thispage*2+(x==7),l,controldevice_joystick); + { + extern int32 mouseyaxismode; // player.c + mouseyaxismode = -1; + } + break; + default: + break; + } + + Bsprintf(tempbuf,(char *)getjoyname(0,thispage*2)); + menutext(42,32,0,0,tempbuf); + if (twothispage) + { + Bsprintf(tempbuf,(char *)getjoyname(0,thispage*2+1)); + menutext(42,32+64,0,0,tempbuf); + } + gametext(76,38,"SCALE",0,2+8+16); + l = (ud.config.JoystickAnalogueScale[thispage*2]+262144) >> 13; + bar(140+56,38+8,(short *)&l,1,x==0,0,0); + l = (l<<13)-262144; + if (l != ud.config.JoystickAnalogueScale[thispage*2]) + { + CONTROL_SetAnalogAxisScale(thispage*2, l, controldevice_joystick); + ud.config.JoystickAnalogueScale[thispage*2] = l; + } + Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); + gametext(140,38,tempbuf,0,2+8+16); + + gametext(76,38+15,"DIGITAL",0,2+8+16); + if (ud.config.JoystickDigitalFunctions[thispage*2][0] < 0) + strcpy(tempbuf, " -NONE-"); + else + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2][0])); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitext(140+12,38+15,tempbuf,0,10+16); + + if (ud.config.JoystickDigitalFunctions[thispage*2][1] < 0) + strcpy(tempbuf, " -NONE-"); + else + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2][1])); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitext(140+12+72,38+15,tempbuf,0,10+16); + + gametext(76,38+15+15,"ANALOG",0,2+8+16); + if (CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2])) + { + p = CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2]); + if (p) + { + gametext(140+12,38+15+15, strchr(p,'_')+1, 0, 2+8+16); + } + } + + if (twothispage) + { + gametext(76,38+64,"SCALE",0,2+8+16); + l = (ud.config.JoystickAnalogueScale[thispage*2+1]+262144) >> 13; + bar(140+56,38+8+64,(short *)&l,1,x==4,0,0); + l = (l<<13)-262144; + if (l != ud.config.JoystickAnalogueScale[thispage*2+1]) + { + CONTROL_SetAnalogAxisScale(thispage*2+1, l, controldevice_joystick); + ud.config.JoystickAnalogueScale[thispage*2+1] = l; + } + Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); + gametext(140,38+64,tempbuf,0,2+8+16); + + gametext(76,38+64+15,"DIGITAL",0,2+8+16); + if (ud.config.JoystickDigitalFunctions[thispage*2+1][0] < 0) + strcpy(tempbuf, " -NONE-"); + else + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2+1][0])); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitext(140+12,38+15+64,tempbuf,0,10+16); + + if (ud.config.JoystickDigitalFunctions[thispage*2+1][1] < 0) + strcpy(tempbuf, " -NONE-"); + else + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2+1][1])); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitext(140+12+72,38+15+64,tempbuf,0,10+16); + + gametext(76,38+64+15+15,"ANALOG",0,2+8+16); + if (CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2+1])) + { + p = CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2+1]); + if (p) + { + gametext(140+12,38+64+15+15, strchr(p,'_')+1, 0, 2+8+16); + } + } + } + + if (joynumaxes > 2) + { + menutext(320>>1,twothispage?158:108,SHX(-10),(joynumaxes<=2),"NEXT..."); + sprintf(tempbuf,"Page %d of %d",thispage+1,(joynumaxes+1)/2); + gametext(320-100,158,tempbuf,0,2+8+16); + } + break; + } + case 213: case 214: case 215: case 216: + { + // Pray this is enough pages for now :-| + int first,last; + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"JOY DEAD ZONES"); + + first = 4*(current_menu-213); + last = min(4*(current_menu-213)+4,joynumaxes); + + onbar = 1; + x = probe(320,48,15,2*(last-first)+(joynumaxes>4)); + + if (x==-1) { - // Pray this is enough pages for now :-| - int first,last; - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"JOY DEAD ZONES"); - - first = 4*(current_menu-213); - last = min(4*(current_menu-213)+4,joynumaxes); - - onbar = 1; - x = probe(320,48,15,2*(last-first)+(joynumaxes>4)); - - if (x==-1) - { - cmenu(206); - probey = 2; - break; - } - else if (x==2*(last-first) && joynumaxes>4) - { - cmenu((current_menu-213) == (joynumaxes/4) ? 213 : (current_menu+1)); - probey = 0; - break; - } - - for (m=first;m4) - { - menutext(32,48+30*(last-first),0,0,"NEXT..."); - sprintf(tempbuf,"Page %d of %d", 1+(current_menu-213), (joynumaxes+3)/4); - gametext(320-100,158,tempbuf,0,2+8+16); - } + cmenu(206); + probey = 2; break; } + else if (x==2*(last-first) && joynumaxes>4) + { + cmenu((current_menu-213) == (joynumaxes/4) ? 213 : (current_menu+1)); + probey = 0; + break; + } + + for (m=first;m4) + { + menutext(32,48+30*(last-first),0,0,"NEXT..."); + sprintf(tempbuf,"Page %d of %d", 1+(current_menu-213), (joynumaxes+3)/4); + gametext(320-100,158,tempbuf,0,2+8+16); + } + break; + } case 700: case 701: @@ -4724,104 +4724,104 @@ VOLUME_ALL_40x: } case 603: + { + int plrvotes = 0, j = 0; + + x = probe(186,124,0,0); + + if (voting != myconnectindex) + g_player[myconnectindex].ps->gm &= ~MODE_MENU; + + if (x == -1) { - int plrvotes = 0, j = 0; - - x = probe(186,124,0,0); - - if (voting != myconnectindex) - g_player[myconnectindex].ps->gm &= ~MODE_MENU; - - if (x == -1) + if (voting == myconnectindex) { - if (voting == myconnectindex) + for (i=0;i=0;c=connectpoint2[c]) - { - if (c != myconnectindex) sendpacket(c,tempbuf,3); - if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master - } - voting = -1; + g_player[i].vote = 0; + g_player[i].gotvote = 0; } - cmenu(0); - } - for (i=0;ii || (plrvotes > (numplayers>>1)) || (!networkmode && myconnectindex == connecthead)) - { - if (plrvotes > (numplayers>>1) || !g_player[myconnectindex].ps->i || (!networkmode && myconnectindex == connecthead)) + tempbuf[0] = 18; + tempbuf[1] = 2; + tempbuf[2] = myconnectindex; + + for (c=connecthead;c>=0;c=connectpoint2[c]) { - if (ud.m_player_skill == 3) ud.m_respawn_monsters = 1; - else ud.m_respawn_monsters = 0; - - if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_ITEMRESPAWN)) ud.m_respawn_items = 1; - else ud.m_respawn_items = 0; - - ud.m_respawn_inventory = 1; - - for (c=connecthead;c>=0;c=connectpoint2[c]) - { - resetweapons(c); - resetinventory(c); - - } - - mpchangemap(ud.m_volume_number,ud.m_level_number); - - if (voting == myconnectindex) - adduserquote("VOTE SUCCEEDED"); - - newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill+1); - if (enterlevel(MODE_GAME)) backtomenu(); - - return; - } - else if (j == numplayers) - { - for (i=0;i=0;c=connectpoint2[c]) - { - if (c != myconnectindex) sendpacket(c,tempbuf,4); - if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master - } - - Bsprintf(fta_quotes[116],"VOTE FAILED"); - FTA(116,g_player[myconnectindex].ps); - g_player[myconnectindex].ps->gm &= ~MODE_MENU; + if (c != myconnectindex) sendpacket(c,tempbuf,3); + if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master } + voting = -1; } - else - { - gametext(160,90,"WAITING FOR VOTES",0,2); - } - break; + cmenu(0); } + + for (i=0;ii || (plrvotes > (numplayers>>1)) || (!networkmode && myconnectindex == connecthead)) + { + if (plrvotes > (numplayers>>1) || !g_player[myconnectindex].ps->i || (!networkmode && myconnectindex == connecthead)) + { + if (ud.m_player_skill == 3) ud.m_respawn_monsters = 1; + else ud.m_respawn_monsters = 0; + + if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_ITEMRESPAWN)) ud.m_respawn_items = 1; + else ud.m_respawn_items = 0; + + ud.m_respawn_inventory = 1; + + for (c=connecthead;c>=0;c=connectpoint2[c]) + { + resetweapons(c); + resetinventory(c); + + } + + mpchangemap(ud.m_volume_number,ud.m_level_number); + + if (voting == myconnectindex) + adduserquote("VOTE SUCCEEDED"); + + newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill+1); + if (enterlevel(MODE_GAME)) backtomenu(); + + return; + } + else if (j == numplayers) + { + for (i=0;i=0;c=connectpoint2[c]) + { + if (c != myconnectindex) sendpacket(c,tempbuf,4); + if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master + } + + Bsprintf(fta_quotes[116],"VOTE FAILED"); + FTA(116,g_player[myconnectindex].ps); + g_player[myconnectindex].ps->gm &= ~MODE_MENU; + } + } + else + { + gametext(160,90,"WAITING FOR VOTES",0,2); + } + break; + } case 600: c = (320>>1) - 120; if ((g_player[myconnectindex].ps->gm&MODE_GAME) != MODE_GAME)