More TDM stuff and a potential fix for a networking problem.

git-svn-id: https://svn.eduke32.com/eduke32@271 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-08-20 22:17:12 +00:00
parent c312a89e02
commit 20b89b70b3
8 changed files with 89 additions and 53 deletions

View file

@ -662,6 +662,7 @@ int32 CONFIG_ReadSetup( void )
SCRIPT_GetNumber( scripthandle, "Misc", "Color",&ud.color);
ps[0].palookup = ud.pcolor[0] = ud.color;
SCRIPT_GetNumber( scripthandle, "Misc", "Team",&ud.team);
if(ud.team > 1) ud.team = 0;
ps[0].team = ud.pteam[0] = ud.team;
SCRIPT_GetNumber( scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime);
SCRIPT_GetNumber( scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode);

View file

@ -131,6 +131,9 @@ enum gamemodes {
#define MAXQUOTES 16384
#define PPDEATHSTRINGS MAXQUOTES-128
#define PSDEATHSTRINGS MAXQUOTES-32
#define MAXCYCLERS 1024
#define MAXSCRIPTSIZE 65536
@ -547,6 +550,8 @@ enum gametypeflags {
GAMETYPE_FLAG_TDMSPAWN = 131072
};
#define GTFLAGS(x) (gametype_flags[ud.coop] & x)
extern char level_file_names[MAXVOLUMES*11][BMAX_PATH];
extern char num_volumes;

View file

@ -443,6 +443,7 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); }
}
if (numplayers < 2) return;
Bmemset(packbuf,0,sizeof(packbuf));
while ((packbufleng = getpacket(&other,packbuf)) > 0)
{
switch(packbuf[0])
@ -769,7 +770,10 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); }
ps[other].team = ud.pteam[other] = packbuf[i++];
if(ps[other].team != j && sprite[ps[other].i].picnum == APLAYER)
{
hittype[ps[other].i].extra = 1000;
hittype[ps[other].i].picnum = APLAYERTOP;
}
if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
{
@ -2122,20 +2126,22 @@ void coords(short snum)
printext256(250L,y+18L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"A= %d",ps[snum].ang);
printext256(250L,y+27L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"ZV= %ld",ps[snum].poszv);
Bsprintf(tempbuf,"H= %ld",ps[snum].horiz);
printext256(250L,y+36L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"OG= %d",ps[snum].on_ground);
Bsprintf(tempbuf,"ZV= %ld",ps[snum].poszv);
printext256(250L,y+45L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"AM= %d",ps[snum].ammo_amount[GROW_WEAPON]);
Bsprintf(tempbuf,"OG= %d",ps[snum].on_ground);
printext256(250L,y+54L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"LFW= %d",ps[snum].last_full_weapon);
Bsprintf(tempbuf,"AM= %d",ps[snum].ammo_amount[GROW_WEAPON]);
printext256(250L,y+63L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"SECTL= %d",sector[ps[snum].cursectnum].lotag);
Bsprintf(tempbuf,"LFW= %d",ps[snum].last_full_weapon);
printext256(250L,y+72L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"SEED= %ld",randomseed);
Bsprintf(tempbuf,"SECTL= %d",sector[ps[snum].cursectnum].lotag);
printext256(250L,y+81L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"SEED= %ld",randomseed);
printext256(250L,y+90L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"THOLD= %d",ps[snum].transporter_hold);
printext256(250L,y+90L+7,31,-1,tempbuf,0);
printext256(250L,y+99L+7,31,-1,tempbuf,0);
}
void operatefta(void)
@ -2170,7 +2176,7 @@ void operatefta(void)
if (ps[screenpeek].fta <= 1) return;
if ((gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR) && ud.screen_size > 0 && ud.multimode > 1)
if (GTFLAGS(GAMETYPE_FLAG_FRAGBAR) && ud.screen_size > 0 && ud.multimode > 1)
{
j = 0; k = 8;
for(i=connecthead;i>=0;i=connectpoint2[i])
@ -2290,7 +2296,7 @@ else if(ud.recstat == 2) { if (frecfilep) fclose(frecfilep); } // JBF: fixes cr
if(!qe && !cp)
{
if(playerswhenstarted > 1 && ps[myconnectindex].gm&MODE_GAME && (gametype_flags[ud.coop] & GAMETYPE_FLAG_SCORESHEET) && *t == ' ')
if(playerswhenstarted > 1 && ps[myconnectindex].gm&MODE_GAME && GTFLAGS(GAMETYPE_FLAG_SCORESHEET) && *t == ' ')
{
dobonus(1);
setgamemode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP);
@ -2805,7 +2811,7 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang)
x1 = mulscale(ox,xvect,16) - mulscale(oy,yvect,16);
y1 = mulscale(oy,xvect2,16) + mulscale(ox,yvect2,16);
if(p == screenpeek || (gametype_flags[ud.coop] & GAMETYPE_FLAG_OTHERPLAYERSINMAP ) )
if(p == screenpeek || GTFLAGS(GAMETYPE_FLAG_OTHERPLAYERSINMAP) )
{
if(sprite[ps[p].i].xvel > 16 && ps[p].on_ground)
i = APLAYERTOP+((totalclock>>4)&3);
@ -3067,7 +3073,19 @@ void displayrest(long smoothratio)
if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0)
rotatesprite((160L-(ps[myconnectindex].look_ang>>1))<<16,100L<<16,ud.crosshair>1?65536L>>(ud.crosshair-1):65536L,0,CROSSHAIR,0,0,2+1,windowx1,windowy1,windowx2,windowy2);
}
#if 0
if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
{
for(i=0;i<ud.multimode;i++)
{
if(ps[i].team == ps[myconnectindex].team)
{
j = min(max((getincangle(getangle(ps[i].posx-ps[myconnectindex].posx,ps[i].posy-ps[myconnectindex].posy),ps[myconnectindex].ang))>>1,-160),160);
rotatesprite((160-j)<<16,100L<<16,65536L,0,DUKEICON,0,0,2+1,windowx1,windowy1,windowx2,windowy2);
}
}
}
#endif
if(ps[myconnectindex].gm&MODE_TYPE)
typemode();
else
@ -3090,8 +3108,8 @@ void displayrest(long smoothratio)
(ps[myconnectindex].player_par/26)%60);
minitext(320-5*12,200-i-6-6-6,tempbuf,0,26);
if(ud.player_skill > 3 || (ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY)))
Bsprintf(tempbuf,"Kills: %ld",(ud.multimode>1 &&!(gametype_flags[ud.coop]&GAMETYPE_FLAG_PLAYERSFRIENDLY))?ps[i].frag-ps[i].fraggedself:ps[myconnectindex].actors_killed);
if(ud.player_skill > 3 || (ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY)))
Bsprintf(tempbuf,"Kills: %ld",(ud.multimode>1 &&!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY))?ps[i].frag-ps[i].fraggedself:ps[myconnectindex].actors_killed);
else
Bsprintf(tempbuf,"Kills: %ld/%ld",ps[myconnectindex].actors_killed,
ps[myconnectindex].max_actors_killed>ps[myconnectindex].actors_killed?
@ -3188,7 +3206,7 @@ void drawbackground(void)
{
if (ud.screen_size == 8)
y1 = scale(ydim,200-scale(tilesizy[BOTTOMSTATUSBAR],ud.statusbarscale,100),200);
else if((gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR))
else if(gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR)
{
if (ud.multimode > 1) y1 += scale(ydim,8,200);
if (ud.multimode > 4) y1 += scale(ydim,8,200);
@ -3245,7 +3263,7 @@ void drawbackground(void)
if(ud.screen_size > 8 && ( ready2send || ud.recstat == 2 ))
{
y = 0;
if((gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR))
if(gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR)
{
if (ud.multimode > 1) y += 8;
if (ud.multimode > 4) y += 8;
@ -3904,7 +3922,7 @@ short spawn( short j, short pn )
{
if( PN != ACCESSSWITCH && PN != ACCESSSWITCH2 && sprite[i].pal)
{
if( (ud.multimode < 2) || (ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_DMSWITCHES)) )
if( (ud.multimode < 2) || (ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_DMSWITCHES)) )
{
sprite[i].xrepeat = sprite[i].yrepeat = 0;
sprite[i].cstat = SLT = SHT = 0;
@ -5071,7 +5089,7 @@ short spawn( short j, short pn )
if(sp->picnum == ATOMICHEALTH)
sp->cstat |= 128;
if(ud.multimode > 1 && !(gametype_flags[ud.coop]&GAMETYPE_FLAG_ACCESSCARDSPRITES) && sp->picnum == ACCESSCARD)
if(ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_ACCESSCARDSPRITES) && sp->picnum == ACCESSCARD)
{
sp->xrepeat = sp->yrepeat = 0;
changespritestat(i,5);
@ -6646,7 +6664,7 @@ void cheats(void)
cheatbuf[cheatbuflen++] = ch;
cheatbuf[cheatbuflen] = 0;
KB_ClearKeysDown();
// KB_ClearKeysDown();
if(cheatbuflen > MAXCHEATLEN)
{
@ -7226,7 +7244,7 @@ void nonsharedkeys(void)
if( ps[myconnectindex].cheat_phase == 1 || (ps[myconnectindex].gm&(MODE_MENU|MODE_TYPE))) return;
if( BUTTON(gamefunc_See_Coop_View) && ( (gametype_flags[ud.coop] & GAMETYPE_FLAG_COOPVIEW) || ud.recstat == 2) )
if( BUTTON(gamefunc_See_Coop_View) && ( GTFLAGS(GAMETYPE_FLAG_COOPVIEW) || ud.recstat == 2) )
{
CONTROL_ClearButton( gamefunc_See_Coop_View );
screenpeek = connectpoint2[screenpeek];
@ -8746,7 +8764,10 @@ void syncnames(void)
buf[l++] = ps[myconnectindex].team = ud.pteam[myconnectindex] = ud.team;
if(ps[myconnectindex].team != i && sprite[ps[myconnectindex].i].picnum == APLAYER)
{
hittype[ps[myconnectindex].i].extra = 1000;
hittype[ps[myconnectindex].i].picnum = APLAYERTOP;
}
if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
{

View file

@ -5911,26 +5911,27 @@ void loadefs(char *filenam)
};
char *podeathstrings[] = {
"%^2%s KILLED HIMSELF. WHAT A TOOL!",
"%^2%s TRIED TO LEAVE",
"%^2%s GOT FRAGGED BY A MONSTER. IT WAS PROBABLY A LIZTROOP."
"%^2%s ^2KILLED HIMSELF. WHAT A TOOL!",
"%^2%s ^2TRIED TO LEAVE",
"%^2%s ^2GOT FRAGGED BY A MONSTER. IT WAS PROBABLY A LIZTROOP.",
"%^2%s ^2SWITCHED TO TEAM %ld"
};
for(i=0;i<(signed int)(sizeof(ppdeathstrings)/sizeof(ppdeathstrings[0]));i++)
{
if(fta_quotes[i+16300] == NULL)
if(fta_quotes[i+PPDEATHSTRINGS] == NULL)
{
fta_quotes[i+16300] = Bcalloc(MAXQUOTELEN,sizeof(char));
Bstrcpy(fta_quotes[i+16300],ppdeathstrings[i]);
fta_quotes[i+PPDEATHSTRINGS] = Bcalloc(MAXQUOTELEN,sizeof(char));
Bstrcpy(fta_quotes[i+PPDEATHSTRINGS],ppdeathstrings[i]);
}
}
for(i=0;i<(signed int)(sizeof(podeathstrings)/sizeof(podeathstrings[0]));i++)
{
if(fta_quotes[i+16350] == NULL)
if(fta_quotes[i+PSDEATHSTRINGS] == NULL)
{
fta_quotes[i+16350] = Bcalloc(MAXQUOTELEN,sizeof(char));
Bstrcpy(fta_quotes[i+16350],podeathstrings[i]);
fta_quotes[i+PSDEATHSTRINGS] = Bcalloc(MAXQUOTELEN,sizeof(char));
Bstrcpy(fta_quotes[i+PSDEATHSTRINGS],podeathstrings[i]);
}
}
}

View file

@ -6653,7 +6653,7 @@ good:
}
default:
Bsprintf(tempbuf,"fatal error: Default processing in parse(): %ld, %ld",*insptr,*(insptr-1));
Bsprintf(tempbuf,"fatal error: Default processing in parse(): %ld, %ld\ncurrent actor: %ld %ld",*insptr,*(insptr-1),g_i,g_sp->picnum);
AddLog(tempbuf);
gameexit("An error has occurred in the EDuke32 CON parser.\n\nPlease mail all of your CON files along with the file eduke32.log\nto terminx@gmail.com.\n\nThank you.");
break;

View file

@ -58,9 +58,9 @@ long partime[MAXVOLUMES*11],designertime[MAXVOLUMES*11];
char volume_names[MAXVOLUMES][33] = { "L.A. MELTDOWN", "LUNAR APOCALYPSE", "SHRAPNEL CITY" };
char skill_names[5][33] = { "PIECE OF CAKE", "LET'S ROCK", "COME GET SOME", "DAMN I'M GOOD" };
char gametype_names[MAXGAMETYPES][33] = { "DUKEMATCH (SPAWN)","COOPERATIVE PLAY","DUKEMATCH (NO SPAWN)","TEAM DUKEMATCH"};
int gametype_flags[MAXGAMETYPES] = {4+8+16+1024+2048+16384,1+2+32+64+128+256+512+4096+8192+32768,2+4+8+16+16384,4+8+16+1024+2048+16384+65536+131072};
char num_gametypes = 4;
char gametype_names[MAXGAMETYPES][33] = { "DUKEMATCH (SPAWN)","COOPERATIVE PLAY","DUKEMATCH (NO SPAWN)","TEAM DM (SPAWN)","TEAM DM (NO SPAWN)"};
int gametype_flags[MAXGAMETYPES] = {4+8+16+1024+2048+16384,1+2+32+64+128+256+512+4096+8192+32768,2+4+8+16+16384,4+8+16+1024+2048+16384+65536+131072,2+4+8+16+16384+65536+131072};
char num_gametypes = 5;
long soundsiz[NUM_SOUNDS];

View file

@ -442,7 +442,7 @@ static void modval(int min, int max,int *p,short dainc,char damodify)
}
}
#define MENUHIGHLIGHT(x) probey==x?-(sintable[(totalclock<<4)&2047]>>12):8
#define MENUHIGHLIGHT(x) probey==x?-(sintable[(totalclock<<4)&2047]>>12):6
// #define MENUHIGHLIGHT(x) probey==x?-(sintable[(totalclock<<4)&2047]>>12):probey-x>=0?(probey-x)<<2:-((probey-x)<<2)
#define SHX(X) 0
@ -686,7 +686,7 @@ void menus(void)
case 1:
ud.color++;
if(ud.color > 22)
if(ud.color > 23)
ud.color = 0;
check_player_color((int *)&ud.color,-1);
updatenames();

View file

@ -314,7 +314,7 @@ short aim(spritetype *s,short aang,short atwith)
{
if( PN == APLAYER &&
// ud.ffire == 0 &&
(gametype_flags[ud.coop]& GAMETYPE_FLAG_PLAYERSFRIENDLY || ((gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) && ps[sprite[i].yvel].team == ps[s->yvel].team)) &&
(GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) || (GTFLAGS(GAMETYPE_FLAG_TDM) && ps[sprite[i].yvel].team == ps[s->yvel].team)) &&
s->picnum == APLAYER &&
s != &sprite[i])
continue;
@ -735,7 +735,7 @@ short shoot(short i,short atwith)
if(hitspr >= 0)
{
checkhitsprite(hitspr,k);
if( sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!(gametype_flags[ud.coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) && ps[sprite[hitspr].yvel].team != ps[sprite[i].yvel].team)))
if( sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_FLAG_TDM) && ps[sprite[hitspr].yvel].team != ps[sprite[i].yvel].team)))
{
l = spawn(k,JIBS6);
sprite[k].xrepeat = sprite[k].yrepeat = 0;
@ -1241,7 +1241,7 @@ DOSKIPBULLETHOLE:
if(hitspr >= 0)
{
checkhitsprite(hitspr,k);
if( sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!(gametype_flags[ud.coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) && ps[sprite[hitspr].yvel].team != ps[sprite[i].yvel].team)))
if( sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_FLAG_TDM) && ps[sprite[hitspr].yvel].team != ps[sprite[i].yvel].team)))
{
l = spawn(k,JIBS6);
sprite[k].xrepeat = sprite[k].yrepeat = 0;
@ -3006,7 +3006,7 @@ char doincrements(struct player_struct *p)
if( p->last_pissed_time == (26*219) )
{
spritesound(FLUSH_TOILET,p->i);
if(snum == screenpeek || (gametype_flags[ud.coop] & GAMETYPE_FLAG_COOPSOUND))
if(snum == screenpeek || GTFLAGS(GAMETYPE_FLAG_COOPSOUND))
spritesound(DUKE_PISSRELIEF,p->i);
}
@ -3033,7 +3033,7 @@ char doincrements(struct player_struct *p)
if(p->steroids_amount == 0)
checkavailinven(p);
if( !(p->steroids_amount&7) )
if(snum == screenpeek || (gametype_flags[ud.coop] & GAMETYPE_FLAG_COOPSOUND))
if(snum == screenpeek || GTFLAGS(GAMETYPE_FLAG_COOPSOUND))
spritesound(DUKE_HARTBEAT,p->i);
}
@ -3155,7 +3155,7 @@ char doincrements(struct player_struct *p)
if(p->knuckle_incs==10)
{
if(totalclock > 1024)
if(snum == screenpeek || (gametype_flags[ud.coop] & GAMETYPE_FLAG_COOPSOUND))
if(snum == screenpeek || GTFLAGS(GAMETYPE_FLAG_COOPSOUND))
{
if(rand()&1)
@ -3483,8 +3483,13 @@ void processinput(short snum)
{
if(p->frag_ps != snum)
{
ps[p->frag_ps].frag++;
frags[p->frag_ps][snum]++;
if(GTFLAGS(GAMETYPE_FLAG_TDM) && ps[p->frag_ps].team == ps[snum].team)
p->fraggedself++;
else
{
ps[p->frag_ps].frag++;
frags[p->frag_ps][snum]++;
}
if(snum == screenpeek)
{
@ -3500,7 +3505,7 @@ void processinput(short snum)
{
char name1[32],name2[32];
if(gametype_flags[ud.coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY || (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM && ps[snum].team == ps[p->frag_ps].team))
if(GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) || (GTFLAGS(GAMETYPE_FLAG_TDM) && ps[snum].team == ps[p->frag_ps].team))
i = 9;
else
{
@ -3536,7 +3541,7 @@ void processinput(short snum)
Bstrcpy(name1,&ud.user_name[snum][0]);
Bstrcpy(name2,&ud.user_name[p->frag_ps][0]);
Bsprintf(tempbuf,fta_quotes[16300+i+(mulscale(krand(), 3, 16)*10)],name1,name2);
Bsprintf(tempbuf,fta_quotes[PPDEATHSTRINGS+i+(mulscale(krand(), 3, 16)*10)],name1,name2);
if(ScreenWidth >= 800)
adduserquote(tempbuf);
else OSD_Printf("%s\n",strip_color_codes(tempbuf));
@ -3544,15 +3549,18 @@ void processinput(short snum)
}
else
{
p->fraggedself++;
if(hittype[p->i].picnum != APLAYERTOP)
{
p->fraggedself++;
if(badguypic(sprite[p->wackedbyactor].picnum))
i = 2;
else if(hittype[p->i].picnum == NUKEBUTTON)
i = 1;
else i = 0;
Bsprintf(tempbuf,fta_quotes[PSDEATHSTRINGS+i],&ud.user_name[snum][0]);
}
else Bsprintf(tempbuf,fta_quotes[PSDEATHSTRINGS+3],&ud.user_name[snum][0],p->team+1);
if(badguypic(sprite[p->wackedbyactor].picnum))
i = 2;
else if(hittype[p->i].picnum == NUKEBUTTON)
i = 1;
else i = 0;
Bsprintf(tempbuf,fta_quotes[16350+i],&ud.user_name[snum][0]);
if(ScreenWidth >= 800)
adduserquote(tempbuf);
else OSD_Printf("%s\n",strip_color_codes(tempbuf));
@ -5127,7 +5135,7 @@ void computergetinput(long snum, input *syn)
{
j = 0x7fffffff;
for(i=connecthead;i>=0;i=connectpoint2[i])
if (i != snum && !((gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) && ps[snum].team == ps[i].team))
if (i != snum && !(GTFLAGS(GAMETYPE_FLAG_TDM) && ps[snum].team == ps[i].team))
{
dist = ksqrt((sprite[ps[i].i].x-x1)*(sprite[ps[i].i].x-x1)+(sprite[ps[i].i].y-y1)*(sprite[ps[i].i].y-y1));