diff --git a/source/src/client.cpp b/source/src/client.cpp index 37490051..c8155aa5 100644 --- a/source/src/client.cpp +++ b/source/src/client.cpp @@ -80,19 +80,23 @@ void newteam(char *name) { if(m_teammode) { + if(!strcmp(name, player1->team)) { conoutf("\f3you are already a member of team \"%s\"", name); return; }; + if(!team_valid(name)) { conoutf("\f3\"%s\" is not a valid team name (try CLA or RVSF)", name); return; }; + bool checkteamsize = autoteambalance && players.length() >= 1; int freeteam = smallerteam(); - if(!team_valid(name)) changeteam(checkteamsize ? (uint)freeteam : rnd(2)); // random assignement - if(!strcmp(name, player1->team)) return; // same team - - int team = team_int(name); - if(checkteamsize && team != freeteam) - { - conoutf("\f3the %s team is already full", name); - return; - }; - changeteam(team); + if(team_valid(name)) + { + int team = team_int(name); + if(checkteamsize && team != freeteam) + { + conoutf("\f3the %s team is already full", name); + return; + }; + changeteam(team); + } + else changeteam(checkteamsize ? (uint)freeteam : rnd(2)); // random assignement }; } else conoutf("your team is: %s", player1->team); diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index a09c5d10..345ad1d1 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -500,6 +500,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) case SV_FORCETEAM: { changeteam(getint(p)); + break; }; diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index c41275f6..d6d6804d 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -28,10 +28,14 @@ void checkweaponswitch() { if(!player1->weaponchanging) return; int timeprogress = lastmillis-player1->lastaction; - if(timeprogress>WEAPONCHANGE_TIME) { player1->weaponchanging = false; player1->lastaction = 0; } + if(timeprogress>WEAPONCHANGE_TIME) + { + gun_changed = true; + player1->weaponchanging = false; + player1->lastaction = 0; + } else if(timeprogress>WEAPONCHANGE_TIME/2) { - gun_changed = true; if((!player1->akimbo && player1->akimbomillis && player1->nextweapon==GUN_PISTOL) || (player1->akimbo && !player1->akimbomillis && player1->gunselect==GUN_PISTOL)) player1->akimbo = !player1->akimbo; @@ -42,18 +46,17 @@ void checkweaponswitch() void weaponswitch(int gun) { player1->weaponchanging = true; + player1->thrownademillis = 0; player1->lastaction = player1->akimbolastaction[0] = player1->akimbolastaction[1] = lastmillis; player1->nextweapon = gun; playsound(S_GUNCHANGE); }; -int currentprimary() { return player1->primary; }; - void weapon(int gun) { - if(player1->state!=CS_ALIVE || player1->weaponchanging || NADE_IN_HAND || player1->reloading) return; + if(gun == player1->gunselect) return; + if(player1->state!=CS_ALIVE || player1->weaponchanging || NADE_IN_HAND || player1->reloading) return; if(gun != GUN_KNIFE && gun != GUN_GRENADE && gun != GUN_PISTOL && gun != player1->primary) return; - if(gun == player1->gunselect) return; if(m_noguns && gun != GUN_KNIFE && gun != GUN_GRENADE) return; if(m_noprimary && gun != GUN_KNIFE && gun != GUN_GRENADE && gun != GUN_PISTOL) return; @@ -61,7 +64,6 @@ void weapon(int gun) if(gun == GUN_GRENADE && !player1->mag[GUN_GRENADE]) return; setscope(false); - weaponswitch(gun); }; @@ -75,10 +77,15 @@ void shiftweapon(int s) }; }; +int currentprimary() { return player1->primary; }; +int curweapon() { return player1->gunselect; }; +int magcontent(int gun) { if(gun > 0 && gun < NUMGUNS) return player1->mag[gun]; else return -1;}; + COMMAND(weapon, ARG_1INT); COMMAND(shiftweapon, ARG_1INT); COMMAND(currentprimary, ARG_1EST); - +COMMAND(curweapon, ARG_1EXP); +COMMAND(magcontent, ARG_1EXP); VAR(scopefov, 5, 50, 50); bool scoped = false; @@ -86,6 +93,7 @@ int oldfov = 100; void setscope(bool activate) { + if(player1->gunselect != GUN_SNIPER || player1->state == CS_DEAD) return; if(activate == scoped) return; if(activate) { @@ -99,12 +107,7 @@ void setscope(bool activate) scoped = activate; } -void altaction(int activate) -{ - if(player1->gunselect == GUN_SNIPER && player1->state!=CS_DEAD) setscope(activate!=0); -}; - -COMMAND(altaction, ARG_1INT); +COMMAND(setscope, ARG_1INT); void reload(playerent *d) { @@ -358,6 +361,7 @@ void throw_nade(playerent *d, const vec &vel, bounceent *p) p->bouncestate = NADE_THROWED; d->thrownademillis = lastmillis; + d->inhandnade = NULL; if(d==player1) diff --git a/source/vcpp/cube.suo b/source/vcpp/cube.suo index 449f8353..e0b11fab 100644 Binary files a/source/vcpp/cube.suo and b/source/vcpp/cube.suo differ diff --git a/source/vcpp/cube.vcproj b/source/vcpp/cube.vcproj index f958ccf5..120ac179 100644 --- a/source/vcpp/cube.vcproj +++ b/source/vcpp/cube.vcproj @@ -1868,10 +1868,6 @@ RelativePath="..\..\config\autoexec.cfg" > - -