📄 menues.c
字号:
spritesound(DUKE_JETPACK_IDLE,ps[myconnectindex].i);
restorepalette = 1;
setpal(&ps[myconnectindex]);
vscrn();
FX_SetReverb(0);
if(ud.lockout == 0)
{
for(x=0;x<numanimwalls;x++)
if( wall[animwall[x].wallnum].extra >= 0 )
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
}
else
{
for(x=0;x<numanimwalls;x++)
switch(wall[animwall[x].wallnum].picnum)
{
case FEMPIC1:
wall[animwall[x].wallnum].picnum = BLANKSCREEN;
break;
case FEMPIC2:
case FEMPIC3:
wall[animwall[x].wallnum].picnum = SCREENBREAK6;
break;
}
}
numinterpolations = 0;
startofdynamicinterpolations = 0;
k = headspritestat[3];
while(k >= 0)
{
switch(sprite[k].lotag)
{
case 31:
setinterpolation(§or[sprite[k].sectnum].floorz);
break;
case 32:
setinterpolation(§or[sprite[k].sectnum].ceilingz);
break;
case 25:
setinterpolation(§or[sprite[k].sectnum].floorz);
setinterpolation(§or[sprite[k].sectnum].ceilingz);
break;
case 17:
setinterpolation(§or[sprite[k].sectnum].floorz);
setinterpolation(§or[sprite[k].sectnum].ceilingz);
break;
case 0:
case 5:
case 6:
case 11:
case 14:
case 15:
case 16:
case 26:
case 30:
setsectinterpolate(k);
break;
}
k = nextspritestat[k];
}
for(i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
for(i = animatecnt-1;i>=0;i--)
setinterpolation(animateptr[i]);
show_shareware = 0;
everyothertime = 0;
clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101);
resetmys();
ready2send = 1;
flushpackets();
clearfifo();
waitforeverybody();
resettimevars();
return(0);
}
saveplayer(signed char spot)
{
long i, j;
char *fn = "game0.sav";
char *mpfn = "gameA_00.sav";
char *fnptr,scriptptrs[MAXSCRIPTSIZE];
FILE *fil;
long bv = BYTEVERSION;
if(spot < 0)
{
multiflag = 1;
multiwhat = 1;
multipos = -spot-1;
return -1;
}
waitforeverybody();
if( multiflag == 2 && multiwho != myconnectindex )
{
fnptr = mpfn;
mpfn[4] = spot + 'A';
if(ud.multimode > 9)
{
mpfn[6] = (multiwho/10) + '0';
mpfn[7] = multiwho + '0';
}
else mpfn[7] = multiwho + '0';
}
else
{
fnptr = fn;
fn[4] = spot + '0';
}
if ((fil = fopen(fnptr,"wb")) == 0) return(-1);
ready2send = 0;
dfwrite(&bv,4,1,fil);
dfwrite(&ud.multimode,sizeof(ud.multimode),1,fil);
dfwrite(&ud.savegame[spot][0],19,1,fil);
dfwrite(&ud.volume_number,sizeof(ud.volume_number),1,fil);
dfwrite(&ud.level_number,sizeof(ud.level_number),1,fil);
dfwrite(&ud.player_skill,sizeof(ud.player_skill),1,fil);
dfwrite((char *)waloff[MAXTILES-1],160,100,fil);
dfwrite(&numwalls,2,1,fil);
dfwrite(&wall[0],sizeof(walltype),MAXWALLS,fil);
dfwrite(&numsectors,2,1,fil);
dfwrite(§or[0],sizeof(sectortype),MAXSECTORS,fil);
dfwrite(&sprite[0],sizeof(spritetype),MAXSPRITES,fil);
dfwrite(&headspritesect[0],2,MAXSECTORS+1,fil);
dfwrite(&prevspritesect[0],2,MAXSPRITES,fil);
dfwrite(&nextspritesect[0],2,MAXSPRITES,fil);
dfwrite(&headspritestat[0],2,MAXSTATUS+1,fil);
dfwrite(&prevspritestat[0],2,MAXSPRITES,fil);
dfwrite(&nextspritestat[0],2,MAXSPRITES,fil);
dfwrite(&numcyclers,sizeof(numcyclers),1,fil);
dfwrite(&cyclers[0][0],12,MAXCYCLERS,fil);
dfwrite(ps,sizeof(ps),1,fil);
dfwrite(po,sizeof(po),1,fil);
dfwrite(&numanimwalls,sizeof(numanimwalls),1,fil);
dfwrite(&animwall,sizeof(animwall),1,fil);
dfwrite(&msx[0],sizeof(long),sizeof(msx)/sizeof(long),fil);
dfwrite(&msy[0],sizeof(long),sizeof(msy)/sizeof(long),fil);
dfwrite(&spriteqloc,sizeof(short),1,fil);
dfwrite(&spriteqamount,sizeof(short),1,fil);
dfwrite(&spriteq[0],sizeof(short),spriteqamount,fil);
dfwrite(&mirrorcnt,sizeof(short),1,fil);
dfwrite(&mirrorwall[0],sizeof(short),64,fil);
dfwrite(&mirrorsector[0],sizeof(short),64,fil);
dfwrite(&show2dsector[0],sizeof(char),MAXSECTORS>>3,fil);
dfwrite(&actortype[0],sizeof(char),MAXTILES,fil);
dfwrite(&boardfilename[0],sizeof(boardfilename),1,fil);
dfwrite(&numclouds,sizeof(numclouds),1,fil);
dfwrite(&clouds[0],sizeof(short)<<7,1,fil);
dfwrite(&cloudx[0],sizeof(short)<<7,1,fil);
dfwrite(&cloudy[0],sizeof(short)<<7,1,fil);
for(i=0;i<MAXSCRIPTSIZE;i++)
{
if( (long)script[i] >= (long)(&script[0]) && (long)script[i] < (long)(&script[MAXSCRIPTSIZE]) )
{
scriptptrs[i] = 1;
j = (long)script[i] - (long)&script[0];
script[i] = j;
}
else scriptptrs[i] = 0;
}
dfwrite(&scriptptrs[0],1,MAXSCRIPTSIZE,fil);
dfwrite(&script[0],4,MAXSCRIPTSIZE,fil);
for(i=0;i<MAXSCRIPTSIZE;i++)
if( scriptptrs[i] )
{
j = script[i]+(long)&script[0];
script[i] = j;
}
for(i=0;i<MAXTILES;i++)
if(actorscrptr[i])
{
j = (long)actorscrptr[i]-(long)&script[0];
actorscrptr[i] = (long *)j;
}
dfwrite(&actorscrptr[0],4,MAXTILES,fil);
for(i=0;i<MAXTILES;i++)
if(actorscrptr[i])
{
j = (long)actorscrptr[i]+(long)&script[0];
actorscrptr[i] = (long *)j;
}
for(i=0;i<MAXSPRITES;i++)
{
scriptptrs[i] = 0;
if(actorscrptr[PN] == 0) continue;
j = (long)&script[0];
if(T2 >= j && T2 < (long)(&script[MAXSCRIPTSIZE]) )
{
scriptptrs[i] |= 1;
T2 -= j;
}
if(T5 >= j && T5 < (long)(&script[MAXSCRIPTSIZE]) )
{
scriptptrs[i] |= 2;
T5 -= j;
}
if(T6 >= j && T6 < (long)(&script[MAXSCRIPTSIZE]) )
{
scriptptrs[i] |= 4;
T6 -= j;
}
}
dfwrite(&scriptptrs[0],1,MAXSPRITES,fil);
dfwrite(&hittype[0],sizeof(struct weaponhit),MAXSPRITES,fil);
for(i=0;i<MAXSPRITES;i++)
{
if(actorscrptr[PN] == 0) continue;
j = (long)&script[0];
if(scriptptrs[i]&1)
T2 += j;
if(scriptptrs[i]&2)
T5 += j;
if(scriptptrs[i]&4)
T6 += j;
}
dfwrite(&lockclock,sizeof(lockclock),1,fil);
dfwrite(&pskybits,sizeof(pskybits),1,fil);
dfwrite(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil);
dfwrite(&animatecnt,sizeof(animatecnt),1,fil);
dfwrite(&animatesect[0],2,MAXANIMATES,fil);
for(i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]-(long)(§or[0]));
dfwrite(&animateptr[0],4,MAXANIMATES,fil);
for(i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]+(long)(§or[0]));
dfwrite(&animategoal[0],4,MAXANIMATES,fil);
dfwrite(&animatevel[0],4,MAXANIMATES,fil);
dfwrite(&earthquaketime,sizeof(earthquaketime),1,fil);
dfwrite(&ud.from_bonus,sizeof(ud.from_bonus),1,fil);
dfwrite(&ud.secretlevel,sizeof(ud.secretlevel),1,fil);
dfwrite(&ud.respawn_monsters,sizeof(ud.respawn_monsters),1,fil);
dfwrite(&ud.respawn_items,sizeof(ud.respawn_items),1,fil);
dfwrite(&ud.respawn_inventory,sizeof(ud.respawn_inventory),1,fil);
dfwrite(&ud.god,sizeof(ud.god),1,fil);
dfwrite(&ud.auto_run,sizeof(ud.auto_run),1,fil);
dfwrite(&ud.crosshair,sizeof(ud.crosshair),1,fil);
dfwrite(&ud.monsters_off,sizeof(ud.monsters_off),1,fil);
dfwrite(&ud.last_level,sizeof(ud.last_level),1,fil);
dfwrite(&ud.eog,sizeof(ud.eog),1,fil);
dfwrite(&ud.coop,sizeof(ud.coop),1,fil);
dfwrite(&ud.marker,sizeof(ud.marker),1,fil);
dfwrite(&ud.ffire,sizeof(ud.ffire),1,fil);
dfwrite(&camsprite,sizeof(camsprite),1,fil);
dfwrite(&connecthead,sizeof(connecthead),1,fil);
dfwrite(connectpoint2,sizeof(connectpoint2),1,fil);
dfwrite(&numplayersprites,sizeof(numplayersprites),1,fil);
dfwrite((short *)&frags[0][0],sizeof(frags),1,fil);
dfwrite(&randomseed,sizeof(randomseed),1,fil);
dfwrite(&global_random,sizeof(global_random),1,fil);
dfwrite(¶llaxyscale,sizeof(parallaxyscale),1,fil);
fclose(fil);
if(ud.multimode < 2)
{
strcpy(&fta_quotes[122],"GAME SAVED");
FTA(122,&ps[myconnectindex]);
}
ready2send = 1;
waitforeverybody();
ototalclock = totalclock;
return(0);
}
#define LMB (buttonstat&1)
#define RMB (buttonstat&2)
ControlInfo minfo;
long mi;
int probe(int x,int y,int i,int n)
{
short centre, s;
s = 1+(CONTROL_GetMouseSensitivity()>>4);
if( ControllerType == 1 && CONTROL_MousePresent )
{
CONTROL_GetInput( &minfo );
mi += minfo.dz;
}
else minfo.dz = minfo.dyaw = 0;
if( x == (320>>1) )
centre = 320>>2;
else centre = 0;
if(!buttonstat)
{
if( KB_KeyPressed( sc_UpArrow ) || KB_KeyPressed( sc_PgUp ) || KB_KeyPressed( sc_kpad_8 ) ||
mi < -8192 )
{
mi = 0;
KB_ClearKeyDown( sc_UpArrow );
KB_ClearKeyDown( sc_kpad_8 );
KB_ClearKeyDown( sc_PgUp );
sound(KICK_HIT);
probey--;
if(probey < 0) probey = n-1;
minfo.dz = 0;
}
if( KB_KeyPressed( sc_DownArrow ) || KB_KeyPressed( sc_PgDn ) || KB_KeyPressed( sc_kpad_2 )
|| mi > 8192 )
{
mi = 0;
KB_ClearKeyDown( sc_DownArrow );
KB_ClearKeyDown( sc_kpad_2 );
KB_ClearKeyDown( sc_PgDn );
sound(KICK_HIT);
probey++;
minfo.dz = 0;
}
}
if(probey >= n)
probey = 0;
if(centre)
{
// rotatesprite(((320>>1)+(centre)+54)<<16,(y+(probey*i)-4)<<16,65536L,0,SPINNINGNUKEICON+6-((6+(totalclock>>3))%7),sh,0,10,0,0,xdim-1,ydim-1);
// rotatesprite(((320>>1)-(centre)-54)<<16,(y+(probey*i)-4)<<16,65536L,0,SPINNINGNUKEICON+((totalclock>>3)%7),sh,0,10,0,0,xdim-1,ydim-1);
rotatesprite(((320>>1)+(centre>>1)+70)<<16,(y+(probey*i)-4)<<16,65536L,0,SPINNINGNUKEICON+6-((6+(totalclock>>3))%7),sh,0,10,0,0,xdim-1,ydim-1);
rotatesprite(((320>>1)-(centre>>1)-70)<<16,(y+(probey*i)-4)<<16,65536L,0,SPINNINGNUKEICON+((totalclock>>3)%7),sh,0,10,0,0,xdim-1,ydim-1);
}
else
rotatesprite((x-tilesizx[BIGFNTCURSOR]-4)<<16,(y+(probey*i)-4)<<16,65536L,0,SPINNINGNUKEICON+(((totalclock>>3))%7),sh,0,10,0,0,xdim-1,ydim-1);
if( KB_KeyPressed(sc_Space) || KB_KeyPressed( sc_kpad_Enter ) || KB_KeyPressed( sc_Enter ) || (LMB && !onbar) )
{
if(current_menu != 110)
sound(PISTOL_BODYHIT);
KB_ClearKeyDown( sc_Enter );
KB_ClearKeyDown( sc_Space );
KB_ClearKeyDown( sc_kpad_Enter );
return(probey);
}
else if( KB_KeyPressed( sc_Escape ) || (RMB) )
{
onbar = 0;
KB_ClearKeyDown( sc_Escape );
sound(EXITMENUSOUND);
return(-1);
}
else
{
if(onbar == 0) return(-probey-2);
if ( KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -128 ) )
return(probey);
else if ( KB_KeyPressed( sc_RightArrow ) || KB_KeyPressed( sc_kpad_6 ) || ((buttonstat&1) && minfo.dyaw > 128 ) )
return(probey);
else return(-probey-2);
}
}
int menutext(int x,int y,short s,short p,char *t)
{
short i, ac, centre;
y -= 12;
i = centre = 0;
if( x == (320>>1) )
{
while( *(t+i) )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -