From c1bb2adb2c56f43431898bc8c0751f2f9f1213e8 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 31 Aug 2006 19:05:23 +0000 Subject: [PATCH] Fix an OOS problem with TDM. I want to punch whoever came up with sync based networking in the balls. :D git-svn-id: https://svn.eduke32.com/eduke32@287 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/config.c | 2 +- polymer/eduke32/source/game.c | 71 +++++++++++++------------------- polymer/eduke32/source/gamedef.c | 68 +++++++++++++++--------------- polymer/eduke32/source/player.c | 3 +- 4 files changed, 66 insertions(+), 78 deletions(-) diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 65eb1d22e..8d01dadc8 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -663,7 +663,7 @@ int32 CONFIG_ReadSetup( void ) 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; + ud.pteam[0] = ud.team; SCRIPT_GetNumber( scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime); SCRIPT_GetNumber( scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode); SCRIPT_GetNumber( scripthandle, "Misc", "AutoVote",&ud.autovote); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 3bce45761..0dd5c579f 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -768,28 +768,14 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } ps[other].auto_aim = packbuf[i++]; ps[other].weaponswitch = packbuf[i++]; ps[other].palookup = ud.pcolor[other] = packbuf[i++]; - j = ps[other].team; - ps[other].team = ud.pteam[other] = packbuf[i++]; + 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(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) - { - j = 0; - switch(ps[other].team) - { - case 0: j = 3; break; - case 1: j = 21; break; - } - ps[other].palookup = ud.pcolor[other] = j; - } - - if(sprite[ps[other].i].picnum == APLAYER) - sprite[ps[other].i].pal = ud.pcolor[other]; break; case 7: //slaves in M/S mode only send to master @@ -8776,25 +8762,7 @@ void syncnames(void) buf[l++] = ps[myconnectindex].weaponswitch = ud.weaponswitch; buf[l++] = ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color; - i = ps[myconnectindex].team; - 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) - { - i = 0; - switch(ps[myconnectindex].team) - { - case 0: i = 3; break; - case 1: i = 21; break; - } - ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = i; - } + buf[l++] = ud.pteam[myconnectindex] = ud.team; for(i=connecthead;i>=0;i=connectpoint2[i]) { @@ -8870,7 +8838,7 @@ void updatenames(void) ps[myconnectindex].weaponswitch = ud.weaponswitch; ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color; j = ps[myconnectindex].team; - ps[myconnectindex].team = ud.pteam[myconnectindex] = ud.team; + ud.pteam[myconnectindex] = ud.team; if(sprite[ps[myconnectindex].i].picnum == APLAYER) sprite[ps[myconnectindex].i].pal = ud.pcolor[myconnectindex]; @@ -9275,13 +9243,13 @@ MAIN_LOOP_RESTART: ps[myconnectindex].aim_mode = ud.mouseaiming; ps[myconnectindex].auto_aim = AutoAim; ps[myconnectindex].weaponswitch = ud.weaponswitch; - ps[myconnectindex].team = ud.pteam[myconnectindex] = ud.team; + ud.pteam[myconnectindex] = ud.team; if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) { int k = 0; - switch(ps[myconnectindex].team) + switch(ud.pteam[myconnectindex]) { case 0: k = 3; break; case 1: k = 21; break; @@ -10490,6 +10458,25 @@ char domovethings(void) for(i=connecthead;i>=0;i=connectpoint2[i]) { + if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) + { + if(sync[i].extbits&(1<<6)) + { + ps[i].team = ud.pteam[i]; + hittype[ps[i].i].picnum = APLAYERTOP; + quickkill(&ps[i]); + } + j = 0; + switch(ps[i].team) + { + case 0: j = 3; break; + case 1: j = 21; break; + } + ps[i].palookup = ud.pcolor[i] = j; + } + + sprite[ps[i].i].pal = ud.pcolor[i]; + cheatkeys(i); if( ud.pause_on == 0 ) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 484e13f34..d23f0c7a7 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -5887,45 +5887,45 @@ void loadefs(char *filenam) fta_quotes[i] = Bcalloc(MAXQUOTELEN,sizeof(char)); { char *ppdeathstrings[] = { - "%^2%s ^2WAS KICKED TO THE CURB BY %s", - "%^2%s ^2WAS PICKED OFF BY %s", - "%^2%s ^2TOOK %s^2'S SHOT TO THE FACE", - "%^2%s ^2DANCED THE CHAINGUN CHA-CHA WITH %s", - "%^2%s ^2TRIED TO MAKE A BONG OUT OF %s^2'S ROCKET", - "%^2%s ^2EXPLODED. BLAME %s^2!", - "%^2%s ^2BECAME ONE WITH THE GUM ON %s^2'S SHOE", - "%^2%s ^2WAS TOO COOL FOR %s", - "%^2%s ^2EXPANDED HIS HORIZONS WITH HELP FROM %s", - "%^2%s ^2THINKS %s ^2SHOULD CHECK HIS GLASSES", + "^2%s ^2WAS KICKED TO THE CURB BY %s", + "^2%s ^2WAS PICKED OFF BY %s", + "^2%s ^2TOOK %s^2'S SHOT TO THE FACE", + "^2%s ^2DANCED THE CHAINGUN CHA-CHA WITH %s", + "^2%s ^2TRIED TO MAKE A BONG OUT OF %s^2'S ROCKET", + "^2%s ^2EXPLODED. BLAME %s^2!", + "^2%s ^2BECAME ONE WITH THE GUM ON %s^2'S SHOE", + "^2%s ^2WAS TOO COOL FOR %s", + "^2%s ^2EXPANDED HIS HORIZONS WITH HELP FROM %s", + "^2%s ^2THINKS %s ^2SHOULD CHECK HIS GLASSES", - "%^2%s ^2TOOK %s^2'S BOOT TO THE HEAD", - "%^2%s ^2FELL VICTIM TO %s^2's MAGIC AUTOAIMING PISTOL", - "%^2%s ^2WAS CHASED OFF OF %s^2'S PORCH", - "%^2%s ^2COULDN'T DANCE FAST ENOUGH FOR %s", - "%^2%s ^2TRIED TO OUTRUN %s^2'S ROCKET", - "%^2%s ^2FINALLY FOUND %s^2'S HIDDEN WMDS", - "%^2%s ^2WAS JUST TRYING TO HELP %s ^2TIE HIS SHOELACES", - "%^2%s^2's IGLOO WAS WRECKED BY %s", - "%^2%s ^2BECAME A STICKY FILM ON %s^2'S BOOTS", - "%^2%s ^2WISHES %s ^2HAD PRACTICED BEFORE PLAYING", + "^2%s ^2TOOK %s^2'S BOOT TO THE HEAD", + "^2%s ^2FELL VICTIM TO %s^2's MAGIC AUTOAIMING PISTOL", + "^2%s ^2WAS CHASED OFF OF %s^2'S PORCH", + "^2%s ^2COULDN'T DANCE FAST ENOUGH FOR %s", + "^2%s ^2TRIED TO OUTRUN %s^2'S ROCKET", + "^2%s ^2FINALLY FOUND %s^2'S HIDDEN WMDS", + "^2%s ^2WAS JUST TRYING TO HELP %s ^2TIE HIS SHOELACES", + "^2%s^2's IGLOO WAS WRECKED BY %s", + "^2%s ^2BECAME A STICKY FILM ON %s^2'S BOOTS", + "^2%s ^2WISHES %s ^2HAD PRACTICED BEFORE PLAYING", - "%^2%s ^2WAS WALKED ALL OVER BY %s", - "%^2%s ^2WAS PICKED OFF BY %s", - "%^2%s ^2WENT QUAIL HUNTING WITH VICE PRESIDENT %s", - "%^2%s ^2ENDED UP WITH A FEW NEW HOLES FROM %s^2's CHAINGUN", - "%^2%s ^2WAS TURNED INTO %s^2 BRAND CHUNKY SALSA", - "%^2%s ^2FOUND A PRESENT FROM %s", - "%^2%s ^2WAS SCATHED BY %s^2'S SHRINK RAY", - "%^2%s ^2WENT TO PIECES. %s^2, HOW COULD YOU?", - "%^2%s ^2EXPANDED HIS HORIZONS WITH HELP FROM %s", - "%^2%s ^2WANTS TO KNOW WHY %s ^2IS EVEN PLAYING COOP", + "^2%s ^2WAS WALKED ALL OVER BY %s", + "^2%s ^2WAS PICKED OFF BY %s", + "^2%s ^2WENT QUAIL HUNTING WITH VICE PRESIDENT %s", + "^2%s ^2ENDED UP WITH A FEW NEW HOLES FROM %s^2's CHAINGUN", + "^2%s ^2WAS TURNED INTO %s^2 BRAND CHUNKY SALSA", + "^2%s ^2FOUND A PRESENT FROM %s", + "^2%s ^2WAS SCATHED BY %s^2'S SHRINK RAY", + "^2%s ^2WENT TO PIECES. %s^2, HOW COULD YOU?", + "^2%s ^2EXPANDED HIS HORIZONS WITH HELP FROM %s", + "^2%s ^2WANTS TO KNOW WHY %s ^2IS EVEN PLAYING COOP", }; char *podeathstrings[] = { - "%^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" + "^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++) diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 00b29a8e5..a9c94ab67 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -2707,7 +2707,7 @@ void getinput(short snum) loc.avel = angvel = 0; loc.horz = horiz = 0; loc.bits = (((long)gamequit)<<26); - loc.extbits = 0; + loc.extbits = (ud.pteam[snum] != ps[snum].team)<<6; return; } @@ -2952,6 +2952,7 @@ void getinput(short snum) loc.extbits |= BUTTON(gamefunc_Strafe_Right)<<3; loc.extbits |= BUTTON(gamefunc_Turn_Left)<<4; loc.extbits |= BUTTON(gamefunc_Turn_Right)<<5; + loc.extbits |= (ud.pteam[snum] != ps[snum].team)<<6; if(ud.scrollmode && ud.overhead_on) {