mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 03:00:38 +00:00
Rename some functions and separate the player's weapon choice back out into its own packet, because we don't need to send it with player updates from the menu.
git-svn-id: https://svn.eduke32.com/eduke32@371 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
da317ac063
commit
5dda5b1660
6 changed files with 53 additions and 25 deletions
|
@ -351,7 +351,7 @@ extern void OnEvent(int iEventID, short sActor,short sPlayer,long lDist);
|
||||||
extern int isspritemakingsound(short i, int num);
|
extern int isspritemakingsound(short i, int num);
|
||||||
extern int issoundplaying(short i, int num);
|
extern int issoundplaying(short i, int num);
|
||||||
extern void stopspritesound(short num, short i);
|
extern void stopspritesound(short num, short i);
|
||||||
extern void updatenames(void);
|
extern void updateplayer(void);
|
||||||
extern void sendboardname(void);
|
extern void sendboardname(void);
|
||||||
extern void sendquit(void);
|
extern void sendquit(void);
|
||||||
|
|
||||||
|
|
|
@ -810,9 +810,6 @@ void getpackets(void)
|
||||||
ud.user_name[other][i-3] = 0;
|
ud.user_name[other][i-3] = 0;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
j = i; //This used to be Duke packet #9... now concatenated with Duke packet #6
|
|
||||||
for (;i-j<10;i++) ud.wchoice[other][i-j] = packbuf[i];
|
|
||||||
|
|
||||||
ps[other].aim_mode = packbuf[i++];
|
ps[other].aim_mode = packbuf[i++];
|
||||||
ps[other].auto_aim = packbuf[i++];
|
ps[other].auto_aim = packbuf[i++];
|
||||||
ps[other].weaponswitch = packbuf[i++];
|
ps[other].weaponswitch = packbuf[i++];
|
||||||
|
@ -825,6 +822,21 @@ void getpackets(void)
|
||||||
hittype[ps[other].i].picnum = APLAYERTOP;
|
hittype[ps[other].i].picnum = APLAYERTOP;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
//slaves in M/S mode only send to master
|
||||||
|
//Master re-transmits message to all others
|
||||||
|
if ((!networkmode) && (myconnectindex == connecthead))
|
||||||
|
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||||
|
if (i != other) sendpacket(i,packbuf,packbufleng);
|
||||||
|
|
||||||
|
other = packbuf[1];
|
||||||
|
|
||||||
|
i = 2;
|
||||||
|
|
||||||
|
j = i; //This used to be Duke packet #9... now concatenated with Duke packet #6
|
||||||
|
for (;i-j<10;i++) ud.wchoice[other][i-j] = packbuf[i];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
//slaves in M/S mode only send to master
|
//slaves in M/S mode only send to master
|
||||||
|
@ -9355,7 +9367,28 @@ void sendscore(char *s)
|
||||||
genericmultifunction(-1,s,strlen(s)+1,5);
|
genericmultifunction(-1,s,strlen(s)+1,5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void syncnames(void)
|
void sendwchoice(void)
|
||||||
|
{
|
||||||
|
int i,l;
|
||||||
|
|
||||||
|
buf[0] = 10;
|
||||||
|
buf[1] = myconnectindex;
|
||||||
|
l = 2;
|
||||||
|
|
||||||
|
for (i=0;i<10;i++)
|
||||||
|
{
|
||||||
|
ud.wchoice[myconnectindex][i] = ud.wchoice[0][i];
|
||||||
|
buf[l++] = (char)ud.wchoice[0][i];
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sendplayerupdate(void)
|
||||||
{
|
{
|
||||||
int i,l;
|
int i,l;
|
||||||
|
|
||||||
|
@ -9368,12 +9401,6 @@ void syncnames(void)
|
||||||
for (i=0;myname[i];i++) buf[l++] = Btoupper(myname[i]);
|
for (i=0;myname[i];i++) buf[l++] = Btoupper(myname[i]);
|
||||||
buf[l++] = 0;
|
buf[l++] = 0;
|
||||||
|
|
||||||
for (i=0;i<10;i++)
|
|
||||||
{
|
|
||||||
ud.wchoice[myconnectindex][i] = ud.wchoice[0][i];
|
|
||||||
buf[l++] = (char)ud.wchoice[0][i];
|
|
||||||
}
|
|
||||||
|
|
||||||
buf[l++] = ps[myconnectindex].aim_mode = ud.mouseaiming;
|
buf[l++] = ps[myconnectindex].aim_mode = ud.mouseaiming;
|
||||||
buf[l++] = ps[myconnectindex].auto_aim = AutoAim;
|
buf[l++] = ps[myconnectindex].auto_aim = AutoAim;
|
||||||
buf[l++] = ps[myconnectindex].weaponswitch = ud.weaponswitch;
|
buf[l++] = ps[myconnectindex].weaponswitch = ud.weaponswitch;
|
||||||
|
@ -9419,7 +9446,8 @@ void getnames(void)
|
||||||
|
|
||||||
if (numplayers > 1)
|
if (numplayers > 1)
|
||||||
{
|
{
|
||||||
syncnames();
|
sendplayerupdate();
|
||||||
|
sendwchoice();
|
||||||
sendboardname();
|
sendboardname();
|
||||||
getpackets();
|
getpackets();
|
||||||
waitforeverybody();
|
waitforeverybody();
|
||||||
|
@ -9429,7 +9457,7 @@ void getnames(void)
|
||||||
gameexit("Please put the Duke Nukem 3D Atomic Edition CD in the CD-ROM drive.");
|
gameexit("Please put the Duke Nukem 3D Atomic Edition CD in the CD-ROM drive.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void updatenames(void)
|
void updateplayer(void)
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
|
@ -9441,7 +9469,7 @@ void updatenames(void)
|
||||||
|
|
||||||
if (ud.multimode > 1)
|
if (ud.multimode > 1)
|
||||||
{
|
{
|
||||||
syncnames();
|
sendplayerupdate();
|
||||||
if (sprite[ps[myconnectindex].i].picnum == APLAYER && sprite[ps[myconnectindex].i].pal != 1)
|
if (sprite[ps[myconnectindex].i].picnum == APLAYER && sprite[ps[myconnectindex].i].pal != 1)
|
||||||
sprite[ps[myconnectindex].i].pal = ud.pcolor[myconnectindex];
|
sprite[ps[myconnectindex].i].pal = ud.pcolor[myconnectindex];
|
||||||
}
|
}
|
||||||
|
|
|
@ -725,26 +725,26 @@ void menus(void)
|
||||||
if (ud.color > 23)
|
if (ud.color > 23)
|
||||||
ud.color = 0;
|
ud.color = 0;
|
||||||
check_player_color((int *)&ud.color,-1);
|
check_player_color((int *)&ud.color,-1);
|
||||||
updatenames();
|
updateplayer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
ud.team = 1-ud.team;
|
ud.team = 1-ud.team;
|
||||||
updatenames();
|
updateplayer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
AutoAim = (AutoAim == 2) ? 0 : AutoAim+1;
|
AutoAim = (AutoAim == 2) ? 0 : AutoAim+1;
|
||||||
updatenames();
|
updateplayer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
ud.weaponswitch = (ud.weaponswitch == 3) ? 0 : ud.weaponswitch+1;
|
ud.weaponswitch = (ud.weaponswitch == 3) ? 0 : ud.weaponswitch+1;
|
||||||
updatenames();
|
updateplayer();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
ud.mouseaiming = !ud.mouseaiming;
|
ud.mouseaiming = !ud.mouseaiming;
|
||||||
updatenames();
|
updateplayer();
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
cmenu(20004);
|
cmenu(20004);
|
||||||
|
@ -776,7 +776,7 @@ void menus(void)
|
||||||
KB_FlushKeyboardQueue();
|
KB_FlushKeyboardQueue();
|
||||||
|
|
||||||
current_menu = 20002;
|
current_menu = 20002;
|
||||||
updatenames();
|
updateplayer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,7 +798,7 @@ void menus(void)
|
||||||
modval(0,1,(int *)&ud.mouseaiming,1,probey==5);
|
modval(0,1,(int *)&ud.mouseaiming,1,probey==5);
|
||||||
check_player_color((int *)&ud.color,ud_color);
|
check_player_color((int *)&ud.color,ud_color);
|
||||||
if (ud_color != ud.color || aaim != AutoAim || ud_weaponswitch != ud.weaponswitch || ud_maim != ud.mouseaiming || ud_team != ud.team)
|
if (ud_color != ud.color || aaim != AutoAim || ud_weaponswitch != ud.weaponswitch || ud_maim != ud.mouseaiming || ud_team != ud.team)
|
||||||
updatenames();
|
updateplayer();
|
||||||
}
|
}
|
||||||
menutext(40,50+16+16,MENUHIGHLIGHT(2),0,"TEAM");
|
menutext(40,50+16+16,MENUHIGHLIGHT(2),0,"TEAM");
|
||||||
menutext(40,50+16+16+16,MENUHIGHLIGHT(3),0,"AUTO AIM");
|
menutext(40,50+16+16+16,MENUHIGHLIGHT(3),0,"AUTO AIM");
|
||||||
|
|
|
@ -594,7 +594,7 @@ int osdcmd_cvar_set(const osdfuncparm_t *parm)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (cvar[i].type&256)
|
if (cvar[i].type&256)
|
||||||
updatenames();
|
updateplayer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OSD_Printf("\n");
|
OSD_Printf("\n");
|
||||||
|
@ -784,7 +784,7 @@ int osdcmd_name(const osdfuncparm_t *parm)
|
||||||
|
|
||||||
OSD_Printf("name %s\n",myname);
|
OSD_Printf("name %s\n",myname);
|
||||||
|
|
||||||
updatenames();
|
updateplayer();
|
||||||
|
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2752,7 +2752,7 @@ void getinput(short snum)
|
||||||
momx = momy = 0;
|
momx = momy = 0;
|
||||||
p = &ps[snum];
|
p = &ps[snum];
|
||||||
|
|
||||||
if ((p->gm&MODE_MENU) || (p->gm&MODE_TYPE) || (ud.pause_on && !KB_KeyPressed(sc_Pause)) || p->player_par < 10)
|
if ((p->gm&MODE_MENU) || (p->gm&MODE_TYPE) || (ud.pause_on && !KB_KeyPressed(sc_Pause)) || (numplayers > 1 && totalclock < 10)) // HACK: kill getinput() for the first 10 tics of a new map in multi
|
||||||
{
|
{
|
||||||
CONTROL_GetInput(&info);
|
CONTROL_GetInput(&info);
|
||||||
memset(&lastinfo, 0, sizeof(lastinfo));
|
memset(&lastinfo, 0, sizeof(lastinfo));
|
||||||
|
|
|
@ -1584,7 +1584,7 @@ int enterlevel(char g)
|
||||||
long l;
|
long l;
|
||||||
char levname[BMAX_PATH];
|
char levname[BMAX_PATH];
|
||||||
|
|
||||||
ready2send = 1; // HACK
|
ready2send = 1; // HACK: fetch any leftover p2p sync packets
|
||||||
KB_ClearKeysDown();
|
KB_ClearKeysDown();
|
||||||
handleevents();
|
handleevents();
|
||||||
getpackets();
|
getpackets();
|
||||||
|
|
Loading…
Reference in a new issue