This is better

git-svn-id: https://svn.eduke32.com/eduke32@59 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-04-18 19:23:53 +00:00
parent f47d670028
commit 3d4ac88590
5 changed files with 83 additions and 77 deletions

View file

@ -351,5 +351,5 @@ 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(int num); extern int issoundplaying(int num);
extern void stopspritesound(short num, short i); extern void stopspritesound(short num, short i);
extern void updatenames(void);
#endif // __funct_h__ #endif // __funct_h__

View file

@ -8122,7 +8122,7 @@ void getnames(void)
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;
buf[l++] = ud.pcolor[myconnectindex] = ud.color; buf[l++] = ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color;
for(i=connecthead;i>=0;i=connectpoint2[i]) for(i=connecthead;i>=0;i=connectpoint2[i])
{ {
@ -8139,6 +8139,57 @@ 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)
{
int i,l;
if(ud.multimode > 1)
{
// send update
for(l=0;l<sizeof(myname)-1;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
{
ps[myconnectindex].aim_mode = ud.mouseaiming;
ps[myconnectindex].auto_aim = AutoAim;
ps[myconnectindex].weaponswitch = ud.weaponswitch;
ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color;
if(sprite[ps[myconnectindex].i].picnum == APLAYER)
sprite[ps[myconnectindex].i].pal = ud.color;
}
}
void writestring(long a1,long a2,long a3,short a4,long vx,long vy,long vz) void writestring(long a1,long a2,long a3,short a4,long vx,long vy,long vz)
{ {
@ -8455,7 +8506,7 @@ MAIN_LOOP_RESTART:
ps[myconnectindex].aim_mode = ud.mouseaiming; ps[myconnectindex].aim_mode = ud.mouseaiming;
ps[myconnectindex].auto_aim = AutoAim; ps[myconnectindex].auto_aim = AutoAim;
ps[myconnectindex].weaponswitch = ud.weaponswitch; ps[myconnectindex].weaponswitch = ud.weaponswitch;
ud.pcolor[myconnectindex] = ud.color; ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color;
ud.warp_on = 0; ud.warp_on = 0;
KB_KeyDown[sc_Pause] = 0; // JBF: I hate the pause key KB_KeyDown[sc_Pause] = 0; // JBF: I hate the pause key

View file

@ -494,6 +494,20 @@ int getfilenames(char *path, char kind[])
long quittimer = 0; long quittimer = 0;
void check_player_color(int *color,int prev_color)
{
int i, disallowed[] = { 1, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20, 22 };
for(i=0;i<(signed)(sizeof(disallowed)/sizeof(disallowed[0]));i++) {
if(*color == disallowed[i]) {
if(*color > prev_color)
(*color)++;
else (*color)--;
i=0;
}
}
}
void menus(void) void menus(void)
{ {
CACHE1D_FIND_REC *dir; CACHE1D_FIND_REC *dir;
@ -621,73 +635,25 @@ void menus(void)
ud.color++; ud.color++;
if(ud.color > 22) if(ud.color > 22)
ud.color = 0; ud.color = 0;
goto check_player_color; check_player_color((int *)&ud.color,-1);
updatenames();
break; break;
case 2: case 2:
AutoAim = (AutoAim == 2) ? 0 : AutoAim+1; AutoAim = (AutoAim == 2) ? 0 : AutoAim+1;
goto player_menu_update; updatenames();
break; break;
case 3: case 3:
ud.weaponswitch = (ud.weaponswitch == 3) ? 0 : ud.weaponswitch+1; ud.weaponswitch = (ud.weaponswitch == 3) ? 0 : ud.weaponswitch+1;
goto player_menu_update; updatenames();
break;
case 4:
player_menu_update:
if(ud.multimode > 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
{
ps[myconnectindex].aim_mode = ud.mouseaiming;
ps[myconnectindex].auto_aim = AutoAim;
ps[myconnectindex].weaponswitch = ud.weaponswitch;
ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color;
if(sprite[ps[myconnectindex].i].picnum == APLAYER)
sprite[ps[myconnectindex].i].pal = ud.color;
}
break; break;
} }
} else { } else {
x = strget(200,50-9,buf,12,0); x = strget(200,50-9,buf,12,0);
if (x) { if (x) {
if (x == 1) { if (x == 1) {
strcpy(myname,buf); Bstrcpy(myname,buf);
// send name update // send name update
} }
KB_ClearKeyDown(sc_Enter); KB_ClearKeyDown(sc_Enter);
@ -695,7 +661,7 @@ player_menu_update:
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
current_menu = 20002; current_menu = 20002;
goto player_menu_update; updatenames();
} }
} }
@ -711,22 +677,9 @@ player_menu_update:
modval(0,23,(int *)&ud.color,1,probey==1); modval(0,23,(int *)&ud.color,1,probey==1);
modval(0,2,(int *)&AutoAim,1,probey==2); modval(0,2,(int *)&AutoAim,1,probey==2);
modval(0,3,(int *)&ud.weaponswitch,1,probey==3); modval(0,3,(int *)&ud.weaponswitch,1,probey==3);
check_player_color((int *)&ud.color,ud_color);
check_player_color: if(ud_color != ud.color || aaim != AutoAim || ud_weaponswitch != ud.weaponswitch)
{ updatenames();
int i, disallowed[] = { 1, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20, 22 };
for(i=0;i<(signed)(sizeof(disallowed)/sizeof(disallowed[0]));i++) {
if(ud.color == disallowed[i]) {
if(ud.color > ud_color)
ud.color++;
else ud.color--;
i=0;
}
}
if(ud_color != ud.color || aaim != AutoAim || ud_weaponswitch != ud.weaponswitch)
goto player_menu_update;
}
} }
menutext(40,50+20+20,0,0,"AUTO AIM"); menutext(40,50+20+20,0,0,"AUTO AIM");
menutext(40,50+20+20+20,0,0,"WEAPON SWITCH"); menutext(40,50+20+20+20,0,0,"WEAPON SWITCH");

View file

@ -434,7 +434,7 @@ struct cvarmappings {
char *name; char *name;
char *helpstr; char *helpstr;
void *var; void *var;
int type; // 0 = integer, 1 = unsigned integer, 2 = boolean, 3 = string, |128 = not in multiplayer int type; // 0 = integer, 1 = unsigned integer, 2 = boolean, 3 = string, |128 = not in multiplayer, |256 = update multi
int extra; // for string, is the length int extra; // for string, is the length
} cvar[] = } cvar[] =
{ {
@ -442,7 +442,7 @@ struct cvarmappings {
{ "showcoords", "showcoords: show your position in the game world", (void*)&ud.coords, CVAR_BOOL, 0 }, { "showcoords", "showcoords: show your position in the game world", (void*)&ud.coords, CVAR_BOOL, 0 },
{ "useprecache", "useprecache: enable/disable the pre-level caching routine", (void*)&useprecache, CVAR_BOOL, 0 }, { "useprecache", "useprecache: enable/disable the pre-level caching routine", (void*)&useprecache, CVAR_BOOL, 0 },
{ "drawweapon", "drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0 }, { "drawweapon", "drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0 },
{ "name", "name: change your multiplayer nickname", (void*)&myname[0], CVAR_STRING|128, sizeof(myname) } { "name", "name: change your multiplayer nickname", (void*)&myname[0], CVAR_STRING|256, sizeof(myname) }
}; };
int osdcmd_cvar_set(const osdfuncparm_t *parm) int osdcmd_cvar_set(const osdfuncparm_t *parm)
@ -486,6 +486,8 @@ int osdcmd_cvar_set(const osdfuncparm_t *parm)
} break; } break;
default: break; default: break;
} }
if(cvar[i].type&256)
updatenames();
} }
} }
OSD_Printf("\n"); OSD_Printf("\n");

View file

@ -2979,8 +2979,6 @@ char doincrements(struct player_struct *p)
// j = sync[snum].avel; // j = sync[snum].avel;
// p->weapon_ang = -(j/5); // p->weapon_ang = -(j/5);
p->player_par++;
if(p->invdisptime > 0) if(p->invdisptime > 0)
p->invdisptime--; p->invdisptime--;
@ -3207,6 +3205,8 @@ void processinput(short snum)
kb = &p->kickback_pic; kb = &p->kickback_pic;
p->player_par++;
OnEvent(EVENT_PROCESSINPUT, pi, snum, -1); OnEvent(EVENT_PROCESSINPUT, pi, snum, -1);
if(p->cheat_phase <= 0) sb_snum = sync[snum].bits; if(p->cheat_phase <= 0) sb_snum = sync[snum].bits;