Removed some duplicated code; on a side note, the current state of DM was tested for around an hour today, including using the new player setup menu both pre and mid-game. Not a single problem!

git-svn-id: https://svn.eduke32.com/eduke32@63 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-04-18 22:59:54 +00:00
parent d8334b5444
commit c3d382dd25

View file

@ -8095,15 +8095,10 @@ void sendscore(char *s)
genericmultifunction(-1,s,strlen(s)+1,5); genericmultifunction(-1,s,strlen(s)+1,5);
} }
void getnames(void) void syncnames(void)
{ {
int i,l; int i,l;
for(l=0;myname[l];l++)
ud.user_name[myconnectindex][l] = Btoupper(myname[l]);
if(numplayers > 1)
{
buf[0] = 6; buf[0] = 6;
buf[1] = myconnectindex; buf[1] = myconnectindex;
buf[2] = BYTEVERSION; buf[2] = BYTEVERSION;
@ -8129,7 +8124,18 @@ void getnames(void)
if (i != myconnectindex) sendpacket(i,&buf[0],l); if (i != myconnectindex) sendpacket(i,&buf[0],l);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
} }
}
void getnames(void)
{
int l;
for(l=0;(unsigned)l<sizeof(myname)-1;l++)
ud.user_name[myconnectindex][l] = Btoupper(myname[l]);
if(numplayers > 1)
{
syncnames();
getpackets(); getpackets();
waitforeverybody(); waitforeverybody();
@ -8141,42 +8147,16 @@ void getnames(void)
void updatenames(void) void updatenames(void)
{ {
int i,l; int l;
if(ud.multimode > 1)
{
// send update
for(l=0;(unsigned)l<sizeof(myname)-1;l++) for(l=0;(unsigned)l<sizeof(myname)-1;l++)
ud.user_name[myconnectindex][l] = Btoupper(myname[l]); ud.user_name[myconnectindex][l] = Btoupper(myname[l]);
buf[0] = 6; if(ud.multimode > 1)
buf[1] = myconnectindex;
buf[2] = BYTEVERSION;
l = 3;
//null terminated player name to send
for(i=0;myname[i];i++) buf[l++] = Btoupper(myname[i]);
buf[l++] = 0;
for(i=0;i<10;i++)
{ {
ud.wchoice[myconnectindex][i] = ud.wchoice[0][i]; syncnames();
buf[l++] = (char)ud.wchoice[0][i];
}
buf[l++] = ps[myconnectindex].aim_mode = ud.mouseaiming;
buf[l++] = ps[myconnectindex].auto_aim = AutoAim;
buf[l++] = ps[myconnectindex].weaponswitch = ud.weaponswitch;
buf[l++] = ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color;
if(sprite[ps[myconnectindex].i].picnum == APLAYER) if(sprite[ps[myconnectindex].i].picnum == APLAYER)
sprite[ps[myconnectindex].i].pal = ud.color; sprite[ps[myconnectindex].i].pal = ud.color;
for(i=connecthead;i>=0;i=connectpoint2[i])
{
if (i != myconnectindex) sendpacket(i,&buf[0],l);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
} }
else else
{ {
@ -8198,9 +8178,7 @@ void writestring(long a1,long a2,long a3,short a4,long vx,long vy,long vz)
fp = (FILE *)fopenfrompath("debug.txt","rt+"); fp = (FILE *)fopenfrompath("debug.txt","rt+");
fprintf(fp,"%ld %ld %ld %d %ld %ld %ld\n",a1,a2,a3,a4,vx,vy,vz); fprintf(fp,"%ld %ld %ld %d %ld %ld %ld\n",a1,a2,a3,a4,vx,vy,vz);
fclose(fp); fclose(fp);
} }
char testcd(char *fn, long testsiz); char testcd(char *fn, long testsiz);