X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=adf2542cbd5853f0b8f7e78ca045ac00b7b00ec4;hb=a39af09cb4b15ec94461af2c1f314098ffe7ce0c;hp=036d417d54d1aed75ae01d45444d1767e24adad1;hpb=a240e0309a8ec5837f3ac3d37c168f5262e53d5b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 036d417d5..adf2542cb 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -20,8 +20,7 @@ #include "campaign.qh" #include "command/common.qh" -#include "bot/bot.qh" -#include "bot/navigation.qh" +#include "bot/api.qh" #include "../common/vehicles/all.qh" @@ -53,8 +52,8 @@ void send_CSQC_teamnagger() { WriteByte(MSG_BROADCAST, TE_CSQC_TEAMNAGGER); } -float ClientData_Send(entity to, int sf) -{SELFPARAM(); +bool ClientData_Send(entity this, entity to, int sf) +{ if(to != self.owner) { error("wtf"); @@ -172,7 +171,7 @@ string CheckPlayerModel(string plyermodel) { void setplayermodel(entity e, string modelname) { precache_model(modelname); - setmodel(e, modelname); + _setmodel(e, modelname); player_setupanimsformodel(); UpdatePlayerSounds(); } @@ -205,6 +204,7 @@ void PutObserverInServer (void) } self.frags = FRAGS_SPECTATOR; + self.bot_attack = false; MUTATOR_CALLHOOK(MakePlayerObserver); @@ -292,7 +292,7 @@ void PutObserverInServer (void) self.weapons = '0 0 0'; self.model = ""; FixPlayermodel(); - setmodel(self, "null"); + setmodel(self, MDL_Null); self.drawonlytoclient = self; setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX); // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY @@ -329,9 +329,8 @@ void FixPlayermodel() { if(teamplay) { - string s; - s = Static_Team_ColorName_Lower(self.team); - if(s != "neutral") + string s = Static_Team_ColorName_Lower(self.team); + if (s != "neutral") { defaultmodel = cvar_string(strcat("sv_defaultplayermodel_", s)); defaultskin = cvar(strcat("sv_defaultplayerskin_", s)); @@ -511,10 +510,10 @@ void PutClientInServer() if(g_weaponarena_random) // WEAPONTODO: more stuff that should be in a mutator. also: rename those cvars { if(g_weaponarena_random_with_blaster) - self.weapons &= ~WEPSET_BLASTER; + self.weapons &= ~WEPSET(BLASTER); W_RandomWeapons(self, g_weaponarena_random); if(g_weaponarena_random_with_blaster) - self.weapons |= WEPSET_BLASTER; + self.weapons |= WEPSET(BLASTER); } self.items = start_items; @@ -620,7 +619,8 @@ void PutClientInServer() // reset fields the weapons may use for (int j = WEP_FIRST; j <= WEP_LAST; ++j) { - WEP_ACTION(j, WR_RESETPLAYER); + Weapon w = get_weaponinfo(j); + w.wr_resetplayer(w); // all weapons must be fully loaded when we spawn entity e = get_weaponinfo(j); @@ -666,8 +666,8 @@ void PutClientInServer() .float ebouncefactor, ebouncestop; // electro's values // TODO do we need all these fields, or should we stop autodetecting runtime // changes and just have a console command to update this? -float ClientInit_SendEntity(entity to, int sf) -{SELFPARAM(); +bool ClientInit_SendEntity(entity this, entity to, int sf) +{ WriteByte(MSG_ENTITY, ENT_CLIENT_INIT); WriteByte(MSG_ENTITY, g_nexball_meter_period * 32); WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[0])); @@ -856,7 +856,7 @@ void KillIndicator_Think() else { if(self.cnt <= 10) - setmodel(self, strcat("models/sprites/", ftos(self.cnt), ".spr32")); + setmodel(self, MDL_NUM(self.cnt)); if(IS_REAL_CLIENT(self.owner)) { if(self.cnt <= 10) @@ -1215,7 +1215,7 @@ void ClientConnect (void) else stuffcmd(self, "set _teams_available 0\n"); - attach_entcs(); + attach_entcs(self); bot_relinkplayerlist(); @@ -1236,7 +1236,7 @@ void ClientConnect (void) Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage()); } - if(autocvar_g_bugrigs || (g_weaponarena_weapons == WEPSET_TUBA)) + if(autocvar_g_bugrigs || (g_weaponarena_weapons == WEPSET(TUBA))) stuffcmd(self, "cl_cmd settemp chase_active 1\n"); } @@ -1301,8 +1301,7 @@ void ClientDisconnect (void) bot_clientdisconnect(); - if(self.entcs) - detach_entcs(); + detach_entcs(self); if(autocvar_sv_eventlog) GameLogEcho(strcat(":part:", ftos(self.playerid))); @@ -1366,9 +1365,9 @@ void ChatBubbleThink() remove(self); return; } - + self.mdl = ""; - + if ( !self.owner.deadflag && IS_PLAYER(self.owner) ) { if ( self.owner.active_minigame ) @@ -1376,9 +1375,9 @@ void ChatBubbleThink() else if ( self.owner.BUTTON_CHAT ) self.mdl = "models/misc/chatbubble.spr"; } - + if ( self.model != self.mdl ) - setmodel(self, self.mdl); + _setmodel(self, self.mdl); } @@ -1394,7 +1393,7 @@ void UpdateChatBubble() self.chatbubbleentity.exteriormodeltoclient = self; self.chatbubbleentity.think = ChatBubbleThink; self.chatbubbleentity.nextthink = time; - setmodel(self.chatbubbleentity, "models/misc/chatbubble.spr"); // precision set below + setmodel(self.chatbubbleentity, MDL_CHAT); // precision set below //setorigin(self.chatbubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1'); setorigin(self.chatbubbleentity, '0 0 15' + self.maxs_z * '0 0 1'); setattachment(self.chatbubbleentity, self, ""); // sticks to moving player better, also conserves bandwidth @@ -1447,7 +1446,7 @@ void play_countdown(float finished, string samp) if(IS_REAL_CLIENT(self)) if(floor(finished - time - frametime) != floor(finished - time)) if(finished - time < 6) - sound (self, CH_INFO, samp, VOL_BASE, ATTEN_NORM); + _sound (self, CH_INFO, samp, VOL_BASE, ATTEN_NORM); } void player_powerups (void) @@ -1472,7 +1471,7 @@ void player_powerups (void) { if (self.items & ITEM_Strength.m_itemid) { - play_countdown(self.strength_finished, "misc/poweroff.wav"); + play_countdown(self.strength_finished, SND(POWEROFF)); self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); if (time > self.strength_finished) { @@ -1492,7 +1491,7 @@ void player_powerups (void) } if (self.items & ITEM_Shield.m_itemid) { - play_countdown(self.invincible_finished, "misc/poweroff.wav"); + play_countdown(self.invincible_finished, SND(POWEROFF)); self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); if (time > self.invincible_finished) { @@ -1525,7 +1524,7 @@ void player_powerups (void) } else { - play_countdown(self.superweapons_finished, "misc/poweroff.wav"); + play_countdown(self.superweapons_finished, SND(POWEROFF)); if (time > self.superweapons_finished) { self.items = self.items - (self.items & IT_SUPERWEAPON); @@ -2545,14 +2544,12 @@ void PlayerPreThink (void) FixPlayermodel(); - GrapplingHookFrame(); - // LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers //if(frametime) { self.items &= ~self.items_added; - W_WeaponFrame(); + W_WeaponFrame(self); self.items_added = 0; if(self.items & ITEM_Jetpack.m_itemid)