X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fclient.qc;h=205eb0cb396dd0bfc55e0002006b4c4330a09a86;hb=a18210910c6400ddceffe84b446a7f3c33d4ac87;hp=2d1ff865778a8efda61ae4598f719ea83deaa282;hpb=27b2c8902c6a8c8fe481c7bea54926d88f1de434;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 2d1ff8657..205eb0cb3 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -23,6 +23,7 @@ #include "bot/api.qh" #include "../common/ent_cs.qh" +#include "../common/wepent.qh" #include #include @@ -256,7 +257,7 @@ void PutObserverInServer(entity this) this.view_ofs = '0 0 0'; } - RemoveGrapplingHook(this); + RemoveGrapplingHooks(this); Portal_ClearAll(this); Unfreeze(this); SetSpectatee(this, NULL); @@ -333,7 +334,6 @@ void PutObserverInServer(entity this) this.istypefrag = 0; setthink(this, func_null); this.nextthink = 0; - this.hook_time = 0; this.deadflag = DEAD_NO; this.crouch = false; this.revival_time = 0; @@ -342,10 +342,11 @@ void PutObserverInServer(entity this) this.weapons = '0 0 0'; this.drawonlytoclient = this; - this.weaponname = ""; this.weaponmodel = ""; for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { + this.weaponentities[slot].hook_time = 0; + this.weaponentities[slot].weaponname = ""; this.weaponentities[slot] = NULL; } this.exteriorweaponentity = NULL; @@ -691,11 +692,17 @@ void PutClientInServer(entity this) delete(spot); // usefull for checking if there are spawnpoints, that let drop through the floor } - PS(this).m_switchweapon = w_getbestweapon(this); - this.cnt = -1; // W_LastWeapon will not complain - PS(this).m_weapon = WEP_Null; - this.weaponname = ""; - PS(this).m_switchingweapon = WEP_Null; + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if(slot == 0) + this.(weaponentity).m_switchweapon = w_getbestweapon(this, weaponentity); + else + this.(weaponentity).m_switchweapon = WEP_Null; + this.(weaponentity).weaponname = ""; + this.(weaponentity).m_switchingweapon = WEP_Null; + this.(weaponentity).cnt = -1; + } if (!warmup_stage && !this.alivetime) this.alivetime = time; @@ -1142,7 +1149,10 @@ void ClientConnect(entity this) this.netname_previous = strzone(this.netname); - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && IS_PLAYER(this)) ? APP_TEAM_ENT(this, INFO_JOIN_CONNECT_TEAM) : INFO_JOIN_CONNECT), this.netname); + if(teamplay && IS_PLAYER(this)) + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_JOIN_CONNECT_TEAM), this.netname); + else + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_JOIN_CONNECT, this.netname); stuffcmd(this, clientstuff, "\n"); stuffcmd(this, "cl_particles_reloadeffects\n"); // TODO do we still need this? @@ -1244,7 +1254,7 @@ void ClientDisconnect(entity this) Unfreeze(this); - RemoveGrapplingHook(this); + RemoveGrapplingHooks(this); // Here, everything has been done that requires this player to be a client. @@ -1867,30 +1877,33 @@ void ShowRespawnCountdown(entity this) } .bool team_selected; -void JoinOrShowTeamSelection(entity this) +bool ShowTeamSelection(entity this) { if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || this.team_selected || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0) - { - TRANSMUTE(Player, this); - - SetSpectatee(this, NULL); + return false; + stuffcmd(this, "menu_showteamselect\n"); + return true; +} +void Join(entity this) +{ + TRANSMUTE(Player, this); - if(autocvar_g_campaign || autocvar_g_balance_teams) - JoinBestTeam(this, false, true); + if(!this.team_selected) + if(autocvar_g_campaign || autocvar_g_balance_teams) + JoinBestTeam(this, false, true); - if(autocvar_g_campaign) - campaign_bots_may_start = true; + if(autocvar_g_campaign) + campaign_bots_may_start = true; - Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN); + Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN); - PutClientInServer(this); - PlayerScore_Clear(this); + PutClientInServer(this); - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); - this.team_selected = false; - } + if(teamplay && this.team != -1) + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_JOIN_PLAY_TEAM), this.netname); else - stuffcmd(this, "menu_showteamselect\n"); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_JOIN_PLAY, this.netname); + this.team_selected = false; } /** @@ -2005,11 +2018,12 @@ void PrintWelcomeMessage(entity this) } } -bool spawnAllowed(entity this) +bool joinAllowed(entity this) { if (this.version_mismatch) return false; if (!nJoinAllowed(this, this)) return false; if (teamplay && lockteams) return false; + if (ShowTeamSelection(this)) return false; if (MUTATOR_CALLHOOK(ForbidSpawn, this)) return false; return true; } @@ -2023,7 +2037,7 @@ void ObserverThink(entity this) } if (this.flags & FL_JUMPRELEASED) { - if (PHYS_INPUT_BUTTON_JUMP(this) && spawnAllowed(this)) { + if (PHYS_INPUT_BUTTON_JUMP(this) && joinAllowed(this)) { this.flags &= ~FL_JUMPRELEASED; this.flags |= FL_SPAWNING; } else if(PHYS_INPUT_BUTTON_ATCK(this) && !this.version_mismatch) { @@ -2041,7 +2055,7 @@ void ObserverThink(entity this) if(this.flags & FL_SPAWNING) { this.flags &= ~FL_SPAWNING; - JoinOrShowTeamSelection(this); + Join(this); return; } } @@ -2064,7 +2078,7 @@ void SpectatorThink(entity this) } if (this.flags & FL_JUMPRELEASED) { - if (PHYS_INPUT_BUTTON_JUMP(this) && spawnAllowed(this)) { + if (PHYS_INPUT_BUTTON_JUMP(this) && joinAllowed(this)) { this.flags &= ~FL_JUMPRELEASED; this.flags |= FL_SPAWNING; } else if(PHYS_INPUT_BUTTON_ATCK(this) || this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) { @@ -2099,7 +2113,7 @@ void SpectatorThink(entity this) if(this.flags & FL_SPAWNING) { this.flags &= ~FL_SPAWNING; - JoinOrShowTeamSelection(this); + Join(this); return; } } @@ -2326,7 +2340,7 @@ void PlayerPreThink (entity this) { if ((this.respawn_flags & RESPAWN_FORCE) && !(this.respawn_time < this.respawn_time_max)) this.deadflag = DEAD_RESPAWNING; - else if (!button_pressed || (this.respawn_flags & RESPAWN_FORCE)) + else if (!button_pressed || (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE))) this.deadflag = DEAD_DEAD; break; } @@ -2414,13 +2428,11 @@ void PlayerPreThink (entity this) { this.items &= ~this.items_added; - //for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - //{ - //.entity weaponentity = weaponentities[slot]; - //W_WeaponFrame(this, weaponentity); - //} - .entity weaponentity = weaponentities[0]; // TODO - W_WeaponFrame(this, weaponentity); + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + W_WeaponFrame(this, weaponentity); + } this.items_added = 0; if (this.items & ITEM_Jetpack.m_itemid && (this.items & ITEM_JetpackRegen.m_itemid || this.ammo_fuel >= 0.01)) @@ -2433,8 +2445,12 @@ void PlayerPreThink (entity this) // WEAPONTODO: Add a weapon request for this // rot vortex charge to the charge limit - if (WEP_CVAR(vortex, charge_rot_rate) && this.vortex_charge > WEP_CVAR(vortex, charge_limit) && this.vortex_charge_rottime < time) - this.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1); + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if (WEP_CVAR(vortex, charge_rot_rate) && this.(weaponentity).vortex_charge > WEP_CVAR(vortex, charge_limit) && this.(weaponentity).vortex_charge_rottime < time) + this.(weaponentity).vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.(weaponentity).vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1); + } if (frametime) player_anim(this); @@ -2458,11 +2474,12 @@ void PlayerPreThink (entity this) } // WEAPONTODO: Add weapon request for this + .entity weaponentity = weaponentities[0]; // TODO: unhardcode if (!zoomstate_set) { SetZoomState(this, PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this) - || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_VORTEX) - || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0) + || (PHYS_INPUT_BUTTON_ATCK2(this) && this.(weaponentity).m_weapon == WEP_VORTEX) + || (PHYS_INPUT_BUTTON_ATCK2(this) && this.(weaponentity).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0) ); } @@ -2486,7 +2503,7 @@ void PlayerPreThink (entity this) // WEAPONTODO: Move into weaponsystem somehow // if a player goes unarmed after holding a loaded weapon, empty his clip size and remove the crosshair ammo ring - if (PS(this).m_weapon == WEP_Null) + if (this.(weaponentity).m_weapon == WEP_Null) this.clip_load = this.clip_size = 0; }