Function for changing map in multiplayer

git-svn-id: https://svn.eduke32.com/eduke32@414 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-12-12 08:46:32 +00:00
parent 760e784ffc
commit a35a73796c
5 changed files with 32 additions and 98 deletions

View file

@ -242,5 +242,6 @@ extern void sendquit(void);
extern void adduserquote(char *daquote);
extern char *stripcolorcodes(char *t);
extern void mpchangemap(char volume, char level);
#endif // __funct_h__

View file

@ -7482,23 +7482,7 @@ FOUNDCHEAT:
ud.m_player_skill = ud.player_skill = cheatbuf[i] - '1';
}
if (numplayers > 1 && myconnectindex == connecthead)
{
tempbuf[0] = 5;
tempbuf[1] = ud.m_level_number;
tempbuf[2] = ud.m_volume_number;
tempbuf[3] = ud.m_player_skill;
tempbuf[4] = ud.m_monsters_off;
tempbuf[5] = ud.m_respawn_monsters;
tempbuf[6] = ud.m_respawn_items;
tempbuf[7] = ud.m_respawn_inventory;
tempbuf[8] = ud.m_coop;
tempbuf[9] = ud.m_marker;
tempbuf[10] = ud.m_ffire;
tempbuf[11] = ud.m_noexits;
for (i=connecthead;i>=0;i=connectpoint2[i])
sendpacket(i,tempbuf,12);
}
mpchangemap(ud.m_volume_number,ud.m_level_number);
else ps[myconnectindex].gm |= MODE_RESTART;
ps[myconnectindex].cheat_phase = 0;
@ -9511,6 +9495,30 @@ void sendboardname(void)
}
}
void mpchangemap(char volume, char level)
{
int i;
tempbuf[0] = 5;
tempbuf[1] = ud.m_level_number = level;
tempbuf[2] = ud.m_volume_number = volume;
tempbuf[3] = ud.m_player_skill+1;
tempbuf[4] = ud.m_monsters_off;
tempbuf[5] = ud.m_respawn_monsters;
tempbuf[6] = ud.m_respawn_items;
tempbuf[7] = ud.m_respawn_inventory;
tempbuf[8] = ud.m_coop;
tempbuf[9] = ud.m_marker;
tempbuf[10] = ud.m_ffire;
tempbuf[11] = ud.m_noexits;
for (i=connecthead;i>=0;i=connectpoint2[i])
{
if (i != myconnectindex) sendpacket(i,tempbuf,12);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
}
static void getnames(void)
{
int l;

View file

@ -4475,26 +4475,7 @@ SKIPJIBS:
ud.m_volume_number = ud.volume_number = volnume;
ud.m_level_number = ud.level_number = levnume;
if (numplayers > 1 && myconnectindex == connecthead)
{
tempbuf[0] = 5;
tempbuf[1] = ud.m_level_number;
tempbuf[2] = ud.m_volume_number;
tempbuf[3] = ud.m_player_skill;
tempbuf[4] = ud.m_monsters_off;
tempbuf[5] = ud.m_respawn_monsters;
tempbuf[6] = ud.m_respawn_items;
tempbuf[7] = ud.m_respawn_inventory;
tempbuf[8] = ud.m_coop;
tempbuf[9] = ud.m_marker;
tempbuf[10] = ud.m_ffire;
tempbuf[11] = ud.m_noexits;
for (i=connecthead;i>=0;i=connectpoint2[i])
{
if (i != myconnectindex) sendpacket(i,tempbuf,12);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
}
mpchangemap(volnume,levnume);
else
{
ps[myconnectindex].gm |= MODE_EOL;

View file

@ -4498,11 +4498,6 @@ VOLUME_ALL_40x:
{
if (plrvotes > (numplayers>>1) || !ps[myconnectindex].i || (!networkmode && myconnectindex == connecthead))
{
tempbuf[0] = 5;
tempbuf[1] = ud.m_level_number;
tempbuf[2] = ud.m_volume_number;
tempbuf[3] = ud.m_player_skill+1;
if (ud.m_player_skill == 3) ud.m_respawn_monsters = 1;
else ud.m_respawn_monsters = 0;
@ -4511,27 +4506,15 @@ VOLUME_ALL_40x:
ud.m_respawn_inventory = 1;
tempbuf[4] = ud.m_monsters_off;
tempbuf[5] = ud.m_respawn_monsters;
tempbuf[6] = ud.m_respawn_items;
tempbuf[7] = ud.m_respawn_inventory;
tempbuf[8] = ud.m_coop;
tempbuf[9] = ud.m_marker;
tempbuf[10] = ud.m_ffire;
tempbuf[11] = ud.m_noexits;
for (c=connecthead;c>=0;c=connectpoint2[c])
{
resetweapons(c);
resetinventory(c);
}
for (c=connecthead;c>=0;c=connectpoint2[c])
{
if (c != myconnectindex) sendpacket(c,tempbuf,12);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
mpchangemap(ud.m_volume_number,ud.m_level_number);
if (voting == myconnectindex)
adduserquote("VOTE SUCCEEDED");

View file

@ -101,28 +101,7 @@ int osdcmd_changelevel(const osdfuncparm_t *parm)
if (numplayers > 1)
{
if (myconnectindex == connecthead && networkmode == 0)
{
int i;
tempbuf[0] = 5;
tempbuf[1] = ud.m_level_number = level;
tempbuf[2] = ud.m_volume_number = volume;
tempbuf[3] = ud.m_player_skill;
tempbuf[4] = ud.m_monsters_off;
tempbuf[5] = ud.m_respawn_monsters;
tempbuf[6] = ud.m_respawn_items;
tempbuf[7] = ud.m_respawn_inventory;
tempbuf[8] = ud.m_coop;
tempbuf[9] = ud.m_marker;
tempbuf[10] = ud.m_ffire;
tempbuf[11] = ud.m_noexits;
for (i=connecthead;i>=0;i=connectpoint2[i])
{
if (i != myconnectindex) sendpacket(i,tempbuf,12);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
}
mpchangemap(volume,level);
else if (voting == -1)
{
ud.m_volume_number = volume;
@ -221,25 +200,7 @@ int osdcmd_map(const osdfuncparm_t *parm)
if (myconnectindex == connecthead && networkmode == 0)
{
sendboardname();
tempbuf[0] = 5;
tempbuf[1] = ud.m_level_number = 7;
tempbuf[2] = ud.m_volume_number = 0;
tempbuf[3] = ud.m_player_skill;
tempbuf[4] = ud.m_monsters_off;
tempbuf[5] = ud.m_respawn_monsters;
tempbuf[6] = ud.m_respawn_items;
tempbuf[7] = ud.m_respawn_inventory;
tempbuf[8] = ud.m_coop;
tempbuf[9] = ud.m_marker;
tempbuf[10] = ud.m_ffire;
tempbuf[11] = ud.m_noexits;
for (i=connecthead;i>=0;i=connectpoint2[i])
{
if (i != myconnectindex) sendpacket(i,tempbuf,12);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
mpchangemap(0,7);
}
else if (voting == -1)
{