From a7bad3d85237c0f72aa47bf33295531ff82f1a7a Mon Sep 17 00:00:00 2001 From: terminx Date: Fri, 18 Aug 2006 23:52:26 +0000 Subject: [PATCH] Team DukeMatch support git-svn-id: https://svn.eduke32.com/eduke32@268 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 7 +++ polymer/eduke32/source/config.c | 4 ++ polymer/eduke32/source/duke3d.h | 9 ++-- polymer/eduke32/source/game.c | 85 +++++++++++++++++++++++++++---- polymer/eduke32/source/gamedef.c | 2 + polymer/eduke32/source/gamedef.h | 6 ++- polymer/eduke32/source/gameexec.c | 14 +++++ polymer/eduke32/source/global.c | 6 +-- polymer/eduke32/source/menus.c | 62 ++++++++++++++-------- polymer/eduke32/source/player.c | 8 +-- polymer/eduke32/source/premap.c | 41 +++++++++++++-- 11 files changed, 195 insertions(+), 49 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 836a8fc94..f44ef9d42 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -890,6 +890,13 @@ short ifhitbyweapon(short sn) ud.ffire == 0 ) return -1; + if( j >= 0 && + sprite[j].picnum == APLAYER && + (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) && + ps[p].team == ps[sprite[j].yvel].team && + ud.ffire == 0 ) + return -1; + npc->extra -= hittype[sn].extra; if(j >= 0) diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 674838eb1..bf5a0de5e 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -255,6 +255,7 @@ void CONFIG_SetDefaults( void ) ud.shadows = 1; ud.statusbarmode = 0; ud.statusbarscale = 100; + ud.team = 0; ud.weaponswitch = 3; // new+empty UseJoystick = 0; UseMouse = 1; @@ -660,6 +661,8 @@ int32 CONFIG_ReadSetup( void ) SCRIPT_GetNumber( scripthandle, "Misc", "ShowFPS",&ud.tickrate); SCRIPT_GetNumber( scripthandle, "Misc", "Color",&ud.color); ps[0].palookup = ud.pcolor[0] = ud.color; + SCRIPT_GetNumber( scripthandle, "Misc", "Team",&ud.team); + ps[0].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); @@ -762,6 +765,7 @@ void CONFIG_WriteSetup( void ) SCRIPT_PutNumber( scripthandle, "Misc", "ShowViewWeapon",ud.drawweapon,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "StatusBarMode",ud.statusbarmode,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "StatusBarScale",ud.statusbarscale,false,false); + SCRIPT_PutNumber( scripthandle, "Misc", "Team",ud.team,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "UsePrecache",useprecache,false,false); SCRIPT_PutNumber( scripthandle, "Screen Setup", "Detail",ud.detail,false,false); diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index cf98da3d4..27ebad0ee 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -54,7 +54,7 @@ extern int conversion, shareware, gametype; #define BYTEVERSION_13 27 #define BYTEVERSION_14 116 #define BYTEVERSION_15 117 -#define BYTEVERSION_JF 165 // increase by 3, because atomic GRP adds 1, and Shareware adds 2 +#define BYTEVERSION_JF 168 // increase by 3, because atomic GRP adds 1, and Shareware adds 2 #define BYTEVERSION (BYTEVERSION_JF+(PLUTOPAK?1:(VOLUMEONE<<1))) // JBF 20040116: different data files give different versions @@ -342,6 +342,7 @@ struct user_defs { int32 runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon; // JBF 20031125 int32 democams,color,pcolor[MAXPLAYERS],msgdisptime,statusbarmode; int32 m_noexits,noexits,autovote,automsg,idplayers; + int32 team, pteam[MAXPLAYERS]; int32 entered_name,screen_tilting,shadows,fta_on,executions,auto_run; int32 coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair; @@ -415,7 +416,7 @@ struct player_struct { char return_to_center, reloading; long max_secret_rooms,secret_rooms,max_actors_killed,actors_killed; - long runspeed, movement_lock; + long runspeed, movement_lock, team; short sbs, sound_pitch; }; @@ -541,7 +542,9 @@ enum gametypeflags { GAMETYPE_FLAG_PLAYERSFRIENDLY = 4096, GAMETYPE_FLAG_FIXEDRESPAWN = 8192, GAMETYPE_FLAG_ACCESSATSTART = 16384, - GAMETYPE_FLAG_PRESERVEINVENTORYDEATH = 32768 + GAMETYPE_FLAG_PRESERVEINVENTORYDEATH = 32768, + GAMETYPE_FLAG_TDM = 65536, + GAMETYPE_FLAG_TDMSPAWN = 131072 }; extern char level_file_names[MAXVOLUMES*11][BMAX_PATH]; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index ee077261b..f88c40704 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -294,7 +294,7 @@ int gametext_(int small, int starttile, int x,int y,char *t,char s,char p,short } continue; } - if(*t == 32) {x+=5;t++;continue;} + if(*t == 32) {x+=5;t++;continue;} else ac = *t - '!' + starttile; if( ac < starttile || ac > (starttile + 93) ) @@ -765,6 +765,23 @@ 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++]; + + if(ps[other].team != j && sprite[ps[other].i].picnum == APLAYER) + hittype[ps[other].i].extra = 1000; + + if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) + { + j = 0; + switch(ps[other].team) + { + case 0: j = 3; break; + case 1: j = 10; break; + } + ps[other].palookup = ud.pcolor[other] = j; + } + if(sprite[ps[other].i].picnum == APLAYER) sprite[ps[other].i].pal = ud.pcolor[other]; break; @@ -8152,8 +8169,16 @@ void checkcommandline(int argc,char **argv) ud.m_respawn_monsters = ud.respawn_monsters = 1; ud.m_respawn_items = ud.respawn_items = 1; ud.m_respawn_inventory = ud.respawn_inventory = 1; - for(j=numplayers;j=0;i=connectpoint2[i]) { if (i != myconnectindex) sendpacket(i,&buf[0],l); @@ -8790,17 +8832,22 @@ void updatenames(void) { syncnames(); if(sprite[ps[myconnectindex].i].picnum == APLAYER) - sprite[ps[myconnectindex].i].pal = ud.color; + sprite[ps[myconnectindex].i].pal = ud.pcolor[myconnectindex]; } else { + int j; + ps[myconnectindex].aim_mode = ud.mouseaiming; ps[myconnectindex].auto_aim = AutoAim; 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; + if(sprite[ps[myconnectindex].i].picnum == APLAYER) - sprite[ps[myconnectindex].i].pal = ud.color; + sprite[ps[myconnectindex].i].pal = ud.pcolor[myconnectindex]; } } @@ -8940,11 +8987,11 @@ void app_main(int argc,char **argv) if(glusetexcache == -1 || glusetexcachecompression == -1) { i=wm_ynbox("Texture caching", - "Would you like to enable the on-disk texture cache? " - "This feature may use up to 200 megabytes of disk " - "space if you have a great deal of high resolution " - "textures and skins, but textures will load exponentially " - "faster after the first time they are loaded."); + "Would you like to enable the on-disk texture cache? " + "This feature may use up to 200 megabytes of disk " + "space if you have a great deal of high resolution " + "textures and skins, but textures will load exponentially " + "faster after the first time they are loaded."); if (i) i = 'y'; if(i == 'y' || i == 'Y' ) useprecache = glusetexcompr = glusetexcache = glusetexcachecompression = 1; @@ -9190,7 +9237,19 @@ MAIN_LOOP_RESTART: ps[myconnectindex].aim_mode = ud.mouseaiming; ps[myconnectindex].auto_aim = AutoAim; ps[myconnectindex].weaponswitch = ud.weaponswitch; - ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color; + ps[myconnectindex].team = ud.pteam[myconnectindex] = ud.team; + + if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) + { + int k = 0; + + switch(ps[myconnectindex].team) + { + case 0: k = 3; break; + case 1: k = 10; break; + } + ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = k; + } else ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color; ud.warp_on = 0; KB_KeyDown[sc_Pause] = 0; // JBF: I hate the pause key @@ -9383,12 +9442,15 @@ char opendemoread(char which_demo) // 0 = mine if (kread(recfilep,(int32 *)&ps[i].weaponswitch,sizeof(int32)) != sizeof(int32)) goto corrupt; if (kread(recfilep,(int32 *)&ud.pcolor[i],sizeof(int32)) != sizeof(int32)) goto corrupt; ps[i].palookup = ud.pcolor[i]; + if (kread(recfilep,(int32 *)&ud.pteam[i],sizeof(int32)) != sizeof(int32)) goto corrupt; + ps[i].team = ud.pteam[i]; if (kread(recfilep,(int32 *)&ud.m_noexits,sizeof(int32)) != sizeof(int32)) goto corrupt; } else { if (kread(recfilep,(int32 *)&ps[i].aim_mode,sizeof(char)) != sizeof(char)) goto corrupt; OSD_Printf("aim_mode: %d\n",ps[i].aim_mode); ps[i].auto_aim = 1; ps[i].weaponswitch = 3; + ps[i].team = 0; ud.m_noexits = 0; } } @@ -9439,6 +9501,7 @@ void opendemowrite(void) fwrite((int32 *)&ps[i].auto_aim,sizeof(int32),1,frecfilep); // JBF 20031126 fwrite(&ps[i].weaponswitch,sizeof(int32),1,frecfilep); fwrite(&ud.pcolor[i],sizeof(int32),1,frecfilep); + fwrite(&ud.pteam[i],sizeof(int32),1,frecfilep); fwrite((int32 *)&ud.m_noexits,sizeof(int32),1,frecfilep); } diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index a5d85ff3e..18ed4d4a2 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -688,6 +688,7 @@ LABELS playerlabels[]= { { "movement_lock", PLAYER_MOVEMENT_LOCK, 0, 0 }, { "sound_pitch", PLAYER_SOUND_PITCH, 0, 0 }, { "weaponswitch", PLAYER_WEAPONSWITCH, 0, 0 }, + { "team", PLAYER_TEAM, 0, 0 }, { "", -1, 0, 0 } // END OF LIST }; @@ -811,6 +812,7 @@ LABELS userdefslabels[]= { { "autovote", USERDEFS_AUTOVOTE, 0, 0 }, { "automsg", USERDEFS_AUTOMSG, 0, 0 }, { "idplayers", USERDEFS_IDPLAYERS, 0, 0 }, + { "team", USERDEFS_TEAM, 0, 0 }, { "", -1, 0, 0 } // END OF LIST }; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index ceefdd52e..c346b87e6 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -203,7 +203,8 @@ enum playerlabels { PLAYER_AUTO_AIM, PLAYER_MOVEMENT_LOCK, PLAYER_SOUND_PITCH, - PLAYER_WEAPONSWITCH + PLAYER_WEAPONSWITCH, + PLAYER_TEAM }; enum userdefslabels { @@ -289,7 +290,8 @@ enum userdefslabels { USERDEFS_NOEXITS, USERDEFS_AUTOVOTE, USERDEFS_AUTOMSG, - USERDEFS_IDPLAYERS + USERDEFS_IDPLAYERS, + USERDEFS_TEAM }; enum sectorlabels { diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 8b7e50384..b13638601 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -649,6 +649,13 @@ void DoUserDef(char bSet, long lLabelID, long lVar2, short sActor, short sPlayer SetGameVarID((int)lVar2, ud.idplayers, sActor, sPlayer); break; + case USERDEFS_TEAM: + if(bSet) + ud.team = lValue; + else + SetGameVarID((int)lVar2, ud.team, sActor, sPlayer); + break; + default: break; } @@ -1889,6 +1896,13 @@ void DoPlayer(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sh SetGameVarID((int)lVar2, ps[iPlayer].weaponswitch, sActor, sPlayer); break; + case PLAYER_TEAM: + if(bSet) + ps[iPlayer].team=lValue; + else + SetGameVarID((int)lVar2, ps[iPlayer].team, sActor, sPlayer); + break; + default: break; } diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index 9e2718d4a..92ccfaf55 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -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)"}; -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}; -char num_gametypes = 3; +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; long soundsiz[NUM_SOUNDS]; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 4afcdd1f3..25a322908 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -657,10 +657,17 @@ void menus(void) case 20003: rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); menutext(160,24,0,0,"PLAYER SETUP"); - rotatesprite((280)<<16,(37+(tilesizy[APLAYER]>>1))<<16,49152L,0,1441-((((4-(totalclock>>4)))&3)*5),0,ud.color,10,0,0,xdim-1,ydim-1); + if(probey == 2) + { + switch(ud.team) { + case 0: x = 3; break; + case 1: x = 10; break; + } + } else x = ud.color; + rotatesprite((280)<<16,(37+(tilesizy[APLAYER]>>1))<<16,49152L,0,1441-((((4-(totalclock>>4)))&3)*5),0,x,10,0,0,xdim-1,ydim-1); if (current_menu == 20002) { - x = probe(40,50,16,6); + x = probe(40,50,16,7); switch(x) { case -1: cmenu(202); @@ -686,19 +693,24 @@ void menus(void) break; case 2: - AutoAim = (AutoAim == 2) ? 0 : AutoAim+1; + ud.team = 1-ud.team; updatenames(); break; case 3: + AutoAim = (AutoAim == 2) ? 0 : AutoAim+1; + updatenames(); + break; + + case 4: ud.weaponswitch = (ud.weaponswitch == 3) ? 0 : ud.weaponswitch+1; updatenames(); break; - case 4: + case 5: ud.mouseaiming = !ud.mouseaiming; updatenames(); break; - case 5: + case 6: cmenu(20004); break; } @@ -731,35 +743,40 @@ void menus(void) menutext(40,50+16,MENUHIGHLIGHT(1),0,"COLOR"); { - int ud_color = -1, aaim = -1, ud_weaponswitch = -1, ud_maim = -1; + int ud_color = -1, aaim = -1, ud_weaponswitch = -1, ud_maim = -1, ud_team = -1; ud_color = ud.color; aaim = AutoAim; ud_weaponswitch = ud.weaponswitch; ud_maim = ud.mouseaiming; + ud_team = ud.team; modval(0,23,(int *)&ud.color,1,probey==1); - modval(0,2,(int *)&AutoAim,1,probey==2); - modval(0,3,(int *)&ud.weaponswitch,1,probey==3); - modval(0,1,(int *)&ud.mouseaiming,1,probey==4); + modval(0,1,(int *)&ud.team,1,probey==2); + modval(0,2,(int *)&AutoAim,1,probey==3); + modval(0,3,(int *)&ud.weaponswitch,1,probey==4); + modval(0,1,(int *)&ud.mouseaiming,1,probey==5); check_player_color((int *)&ud.color,ud_color); - if(ud_color != ud.color || aaim != AutoAim || ud_weaponswitch != ud.weaponswitch || ud_maim != ud.mouseaiming) + if(ud_color != ud.color || aaim != AutoAim || ud_weaponswitch != ud.weaponswitch || ud_maim != ud.mouseaiming || ud_team != ud.team) updatenames(); } - menutext(40,50+16+16,MENUHIGHLIGHT(2),0,"AUTO AIM"); - menutext(40,50+16+16+16,MENUHIGHLIGHT(3),0,"WEAPON SWITCH"); - menutext(40,50+16+16+16+16,MENUHIGHLIGHT(4),0,"AIMING TYPE"); - menutext(40,50+16+16+16+16+16,MENUHIGHLIGHT(5),0,"MACRO SETUP"); + 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+16,MENUHIGHLIGHT(4),0,"WEAPON SWITCH"); + menutext(40,50+16+16+16+16+16,MENUHIGHLIGHT(5),0,"AIMING TYPE"); + menutext(40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),0,"MACRO SETUP"); if (current_menu == 20002) { gametext(200,50-9,myname,MENUHIGHLIGHT(0),2+8+16); } { char *s[] = { "Auto","","","","","","","","","Blue","Dk red","Green","Gray","Dk gray","Dk green","Brown", "Dk blue","","","","","Red","","Yellow","","" }; gametext(200,50+16-9,s[ud.color],MENUHIGHLIGHT(1),2+8+16); } + { char *s[] = { "Blue", "Red" }; + gametext(200,50+16+16-9,s[ud.team],MENUHIGHLIGHT(2),2+8+16); } { char *s[] = { "Off", "Full", "Hitscan" }; - gametext(200,50+16+16-9,s[AutoAim],MENUHIGHLIGHT(2),2+8+16); } + gametext(200,50+16+16+16-9,s[AutoAim],MENUHIGHLIGHT(3),2+8+16); } { char *s[] = { "Off", "On pickup", "When empty", "Both" }; - gametext(200,50+16+16+16-9,s[ud.weaponswitch],MENUHIGHLIGHT(3),2+8+16); } - gametext(200,50+16+16+16+16-9,ud.mouseaiming?"Held":"Toggle",MENUHIGHLIGHT(4),2+8+16); + gametext(200,50+16+16+16+16-9,s[ud.weaponswitch],MENUHIGHLIGHT(4),2+8+16); } + gametext(200,50+16+16+16+16+16-9,ud.mouseaiming?"Held":"Toggle",MENUHIGHLIGHT(5),2+8+16); break; @@ -774,7 +791,7 @@ void menus(void) if(x == -1) { cmenu(20002); - probey = 5; + probey = 6; } else if(x >= 0 && x <= 9) { @@ -806,6 +823,7 @@ void menus(void) gametext(160,144,"UP/DOWN = SELECT MACRO",0,2+8+16); gametext(160,144+9,"ENTER = MODIFY",0,2+8+16); + gametext(160,144+9+9,"ACTIVATE IN GAME WITH SHIFT-F#",0,2+8+16); break; @@ -4110,7 +4128,7 @@ VOLUME_ALL_40x: if((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_MARKEROPTION)) modval(0,1,(int *)&ud.m_marker,1,probey==4); - if((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY)) + if((gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM))) modval(0,1,(int *)&ud.m_ffire,1,probey==5); else modval(0,1,(int *)&ud.m_noexits,1,probey==5); @@ -4168,7 +4186,7 @@ VOLUME_ALL_40x: break; case 5: - if((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY)) + if((gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM))) ud.m_ffire = !ud.m_ffire; else ud.m_noexits = !ud.m_noexits; break; @@ -4226,7 +4244,7 @@ VOLUME_ALL_40x: if(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_MARKEROPTION) gametext(c+70,57+16+16+16+16-7-9,ud.m_marker?"ON":"OFF",MENUHIGHLIGHT(4),2+8+16); - if(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) + if(gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM)) gametext(c+70,57+16+16+16+16+16-7-9,ud.m_ffire?"ON":"OFF",MENUHIGHLIGHT(5),2+8+16); else gametext(c+70,57+16+16+16+16+16-7-9,ud.m_noexits?"OFF":"ON",MENUHIGHLIGHT(5),2+8+16); @@ -4252,7 +4270,7 @@ VOLUME_ALL_40x: else menutext(c,57+16+16+16+16-9,MENUHIGHLIGHT(4),1,"MARKERS"); - if(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) + if(gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM)) menutext(c,57+16+16+16+16+16-9,MENUHIGHLIGHT(5),0,"FR. FIRE"); else menutext(c,57+16+16+16+16+16-9,MENUHIGHLIGHT(5),0,"MAP EXITS"); diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index ee7ba80ce..7c7dd5606 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -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_PLAYERSFRIENDLY || ((gametype_flags[ud.coop] & 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 && (!(gametype_flags[ud.coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) || ud.ffire == 1) ) + 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))) { 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 && (!(gametype_flags[ud.coop]&GAMETYPE_FLAG_PLAYERSFRIENDLY ) || ud.ffire == 1) ) + 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))) { l = spawn(k,JIBS6); sprite[k].xrepeat = sprite[k].yrepeat = 0; @@ -3500,7 +3500,7 @@ void processinput(short snum) { char name1[32],name2[32]; - if(gametype_flags[ud.coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) + if(gametype_flags[ud.coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY || (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM && ps[snum].team == ps[p->frag_ps].team)) i = 9; else { diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index a336d1c2c..42faecb46 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -410,12 +410,30 @@ void vscrn(void) void pickrandomspot(short snum) { struct player_struct *p; - short i; + short i=0,j,k; + unsigned long dist,pdist = -1; p = &ps[snum]; if( ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_FIXEDRESPAWN)) - i = TRAND%numplayersprites; + { + if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDMSPAWN) + { + for(j=0;j 0) + { + for(k=0;kbobposx = p->oposx = p->posx = po[i].ox; @@ -1205,7 +1223,7 @@ void resetpspritevars(char g) s->yvel = j; - if(!ud.pcolor[j] && ud.multimode > 1) + if(!ud.pcolor[j] && ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)) { if(s->pal == 0) { @@ -1224,7 +1242,22 @@ void resetpspritevars(char g) which_palookup = 9; } else ps[j].palookup = s->pal; - } else s->pal = ps[j].palookup = ud.pcolor[j]; + } + else + { + int k = ud.pcolor[j]; + + if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) + { + switch(ud.pteam[j]) + { + case 0: k = 3; break; + case 1: k = 10; break; + } + ps[j].team = ud.pteam[j]; + } + s->pal = ps[j].palookup = k; + } ps[j].i = i; ps[j].frag_ps = j;