diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index cc04cdbea..93b32369d 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -589,6 +589,8 @@ void CONFIG_ReadSetup( void ) SCRIPT_GetNumber( scripthandle, "Misc", "BrightSkins",&ud.brightskins); SCRIPT_GetNumber( scripthandle, "Misc", "DemoCams",&ud.democams); SCRIPT_GetNumber( scripthandle, "Misc", "ShowFPS",&ud.tickrate); + SCRIPT_GetNumber( scripthandle, "Misc", "Color",&ud.color); + ps[0].palookup = ud.color; dummy = useprecache; SCRIPT_GetNumber( scripthandle, "Misc", "UsePrecache",&dummy); useprecache = dummy != 0; if(ud.wchoice[0][0] == 0 && ud.wchoice[0][1] == 0) { @@ -719,6 +721,7 @@ void CONFIG_WriteSetup( void ) SCRIPT_PutNumber( scripthandle, "Misc", "BrightSkins",ud.brightskins,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "DemoCams",ud.democams,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "ShowFPS",ud.tickrate,false,false); + SCRIPT_PutNumber( scripthandle, "Misc", "Color",ud.color,false,false); SCRIPT_PutNumber( scripthandle, "Controls", "MouseAimingFlipped",ud.mouseflip,false,false); SCRIPT_PutNumber( scripthandle, "Controls","MouseAiming",ud.mouseaiming,false,false); //SCRIPT_PutNumber( scripthandle, "Controls","GameMouseAiming",(int32) ps[myconnectindex].aim_mode,false,false); diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 583ada711..8bbdbcea6 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -336,7 +336,7 @@ struct user_defs { long reccnt; int32 runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon; // JBF 20031125 - int32 brightskins,democams; + int32 brightskins,democams,color,pcolor[MAXPLAYERS]; int32 entered_name,screen_tilting,shadows,fta_on,executions,auto_run; int32 coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index a9039c16b..d18f92bc5 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -525,7 +525,9 @@ void getpackets(void) ps[other].aim_mode = packbuf[i++]; ps[other].auto_aim = packbuf[i++]; ps[other].weaponswitch = packbuf[i++]; - + ps[other].palookup = ud.pcolor[other] = packbuf[i++]; + 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 @@ -8120,6 +8122,7 @@ void getnames(void) buf[l++] = ps[myconnectindex].aim_mode = ud.mouseaiming; buf[l++] = ps[myconnectindex].auto_aim = AutoAim; buf[l++] = ps[myconnectindex].weaponswitch = ud.weaponswitch; + buf[l++] = ud.pcolor[myconnectindex] = ud.color; for(i=connecthead;i>=0;i=connectpoint2[i]) { @@ -8452,6 +8455,7 @@ MAIN_LOOP_RESTART: ps[myconnectindex].aim_mode = ud.mouseaiming; ps[myconnectindex].auto_aim = AutoAim; ps[myconnectindex].weaponswitch = ud.weaponswitch; + ud.pcolor[myconnectindex] = ud.color; ud.warp_on = 0; KB_KeyDown[sc_Pause] = 0; // JBF: I hate the pause key @@ -8637,6 +8641,7 @@ char opendemoread(char which_demo) // 0 = mine if (kread(recfilep,(int32 *)&ps[i].aim_mode,sizeof(int32)) != sizeof(int32)) goto corrupt; if (kread(recfilep,(int32 *)&ps[i].auto_aim,sizeof(int32)) != sizeof(int32)) goto corrupt; // JBF 20031126 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; } 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); @@ -8690,6 +8695,7 @@ void opendemowrite(void) fwrite((int32 *)&ps[i].aim_mode,sizeof(int32),1,frecfilep); 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); } totalreccnt = 0; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 7258bb77a..f83ecf0b6 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -799,6 +799,7 @@ LABELS userdefslabels[]= { { "weaponswitch", USERDEFS_WEAPONSWITCH, 0, 0 }, { "brightskins", USERDEFS_BRIGHTSKINS, 0, 0 }, { "democams", USERDEFS_DEMOCAMS, 0, 0 }, + { "color", USERDEFS_COLOR, 0, 0 }, { "", -1, 0, 0 } // END OF LIST }; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index a09a961ee..5d9960e26 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -284,7 +284,8 @@ enum userdefslabels { USERDEFS_MOUSEAIMING, USERDEFS_WEAPONSWITCH, USERDEFS_BRIGHTSKINS, - USERDEFS_DEMOCAMS + USERDEFS_DEMOCAMS, + USERDEFS_COLOR }; enum sectorlabels { diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index e76b98291..ccfd105c6 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -604,6 +604,13 @@ void DoUserDef(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, s SetGameVarID((int)lVar2, ud.democams, sActor, sPlayer); break; + case USERDEFS_COLOR: + if(bSet) + ud.color = lValue; + else + SetGameVarID((int)lVar2, ud.color, sActor, sPlayer); + break; + default: break; } diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 80e49ce8c..8d1f5d403 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -598,7 +598,7 @@ void menus(void) menutext(160,24,0,0,"PLAYER SETUP"); if (current_menu == 20002) { - x = probe(46,50,20,2); + x = probe(46,50,20,3); if (x == -1) cmenu(20001); else if (x == 0) { @@ -609,8 +609,39 @@ void menus(void) KB_ClearKeyDown(sc_Enter); KB_ClearKeyDown(sc_kpad_Enter); KB_FlushKeyboardQueue(); - } else if (x == 1) { - // send colour update + } else if (x == 2 && numplayers > 1) { + // send update + for(l=0;myname[l];l++) + ud.user_name[myconnectindex][l] = Btoupper(myname[l]); + + buf[0] = 6; + 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]; + 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) + 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 { x = strget(40+100,50-9,buf,31,0); @@ -632,7 +663,10 @@ void menus(void) if (current_menu == 20002) gametext(40+100,50-9,myname,0,2+8+16); menutext(40,50+20,0,0,"COLOR"); - rotatesprite((40+120)<<16,(50+20+(tilesizy[APLAYER]>>1))<<16,65536L,0,APLAYER,0,0,10,0,0,xdim-1,ydim-1); + modval(0,25,(int *)&ud.color,1,probey==1); + rotatesprite((40+120)<<16,(50+20+(tilesizy[APLAYER]>>1))<<16,65536L,0,APLAYER,0,ud.color,10,0,0,xdim-1,ydim-1); + + menutext(40,50+20+20,0,0,"ACCEPT"); break; @@ -2269,11 +2303,13 @@ cheat_for_port_credits: cmenu(203); } break; - case 3: - currentlist = 0; + cmenu(20002); + break; case 4: + currentlist = 0; case 5: + case 6: if (x==5 && (!CONTROL_JoystickEnabled || !CONTROL_JoyPresent)) break; cmenu(204+x-3); break; @@ -2282,9 +2318,10 @@ cheat_for_port_credits: menutext(160,c, 0,0,"GAME SETUP"); menutext(160,c+18, 0,0,"SOUND SETUP"); menutext(160,c+18+18, 0,0,"VIDEO SETUP"); - menutext(160,c+18+18+18, 0,0,"KEYBOARD SETUP"); - menutext(160,c+18+18+18+18, 0,0,"MOUSE SETUP"); - menutext(160,c+18+18+18+18+18, 0,CONTROL_JoyPresent==0 || CONTROL_JoystickEnabled==0,"JOYSTICK SETUP"); + menutext(160,c+18+18+18, 0,0,"PLAYER SETUP"); + menutext(160,c+18+18+18+18, 0,0,"KEYBOARD SETUP"); + menutext(160,c+18+18+18+18+18, 0,0,"MOUSE SETUP"); + menutext(160,c+18+18+18+18+18+18,0,CONTROL_JoyPresent==0 || CONTROL_JoystickEnabled==0,"JOYSTICK SETUP"); break; // JBF 20031206: Video settings menu @@ -3740,11 +3777,13 @@ VOLUME_ALL_40x: { KB_ClearKeyDown(sc_N); quittimer = 0; - if( ps[myconnectindex].gm&MODE_DEMO ) + if( ps[myconnectindex].gm&MODE_DEMO && ud.recstat == 2 ) ps[myconnectindex].gm = MODE_DEMO; else { - ps[myconnectindex].gm &= ~MODE_MENU; + if(!(ps[myconnectindex].gm & MODE_GAME || ud.recstat == 2)) + cmenu(0); + else ps[myconnectindex].gm &= ~MODE_MENU; if(ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; @@ -3990,7 +4029,6 @@ VOLUME_ALL_40x: { resetweapons(c); resetinventory(c); - } for(c=connecthead;c>=0;c=connectpoint2[c]) { diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index c06b6feda..652b9852e 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -1214,13 +1214,16 @@ void resetpspritevars(char g) s->yvel = j; - if(s->pal == 0) + if(!ud.pcolor[j]) { - s->pal = ps[j].palookup = which_palookup; - which_palookup++; - if( which_palookup >= 17 ) which_palookup = 9; - } - else ps[j].palookup = s->pal; + if(s->pal == 0) + { + s->pal = ps[j].palookup = which_palookup; + which_palookup++; + if( which_palookup >= 17 ) which_palookup = 9; + } + else ps[j].palookup = s->pal; + } else s->pal = ps[j].palookup = ud.pcolor[j]; ps[j].i = i; ps[j].frag_ps = j;