X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fmain.qc;h=65ee03aaf8e6a0fce7741ea346d101c11a5289e0;hb=a47688cb559bcb2090d69a3a3c0c92d4d8fe02d5;hp=a22d164ef073f9ccf5c55f5b9e4743cd2653c061;hpb=9ce59f684368d14ce510aad9f89f1157be1f061c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index a22d164ef..65ee03aaf 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -233,7 +233,7 @@ float SetTeam(entity o, int Team) case NUM_TEAM_4: break; default: - if(GetTeam(Team, false) == world) + if(GetTeam(Team, false) == NULL) { LOG_TRACEF("trying to switch to unsupported team %d\n", Team); Team = NUM_SPECTATOR; @@ -249,7 +249,7 @@ float SetTeam(entity o, int Team) case 0: break; default: - if(GetTeam(Team, false) == world) + if(GetTeam(Team, false) == NULL) { LOG_TRACEF("trying to switch to unsupported team %d\n", Team); Team = NUM_SPECTATOR; @@ -304,7 +304,7 @@ void Playerchecker_Think(entity this) // player disconnected SetTeam(e, -1); RemovePlayer(e); - e.sort_prev = world; + e.sort_prev = NULL; //e.gotscores = 0; } } @@ -684,6 +684,8 @@ NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new) spn_origin.y = ReadCoord(); spn_origin.z = ReadCoord(); + this.team = (teamnum + 1); + //if(is_new) //{ this.origin = spn_origin; @@ -697,7 +699,7 @@ NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new) precache_model(this.mdl); setmodel(this, this.mdl); this.drawmask = MASK_NORMAL; - //this.movetype = MOVETYPE_NOCLIP; + //this.move_movetype = MOVETYPE_NOCLIP; //this.draw = Spawn_Draw; }*/ if(autocvar_cl_spawn_point_particles) @@ -780,9 +782,8 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new) // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured. // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS. -void CSQC_Ent_Update(bool isnew) +void CSQC_Ent_Update(entity this, bool isnew) { - SELFPARAM(); // needed for engine functions this.sourceLoc = __FILE__ ":" STR(__LINE__); int t = ReadByte(); @@ -826,6 +827,7 @@ void CSQC_Ent_Update(bool isnew) if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Ent_Update(%d) at %f with this=%i {.entnum=%d, .enttype=%d} t=%s (%d)\n", isnew, savetime, this, this.entnum, this.enttype, this.classname, t); done = it.m_read(this, NULL, isnew); + MUTATOR_CALLHOOK(Ent_Update, this, isnew); break; }); time = savetime; @@ -861,9 +863,8 @@ void Ent_Remove(entity this) // TODO possibly set more stuff to defaults } // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(this) as well. -void CSQC_Ent_Remove() +void CSQC_Ent_Remove(entity this) { - SELFPARAM(); // needed for engine functions if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Ent_Remove() with this=%i {.entnum=%d, .enttype=%d}\n", this, this.entnum, this.enttype); if (wasfreed(this)) { @@ -985,6 +986,42 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew) if (!postinit) PostInit(); } +float GetSpeedUnitFactor(int speed_unit) +{ + switch(speed_unit) + { + default: + case 1: + return 1.0; + case 2: + return 0.0254; + case 3: + return 0.0254 * 3.6; + case 4: + return 0.0254 * 3.6 * 0.6213711922; + case 5: + return 0.0254 * 1.943844492; // 1 m/s = 1.943844492 knots, because 1 knot = 1.852 km/h + } +} + +string GetSpeedUnit(int speed_unit) +{ + switch(speed_unit) + { + default: + case 1: + return _(" qu/s"); + case 2: + return _(" m/s"); + case 3: + return _(" km/h"); + case 4: + return _(" mph"); + case 5: + return _(" knots"); + } +} + NET_HANDLE(TE_CSQC_RACE, bool isNew) { int b = ReadByte(); @@ -1073,16 +1110,22 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew) race_server_record = ReadInt24_t(); break; case RACE_NET_SPEED_AWARD: - race_speedaward = ReadInt24_t(); + race_speedaward = ReadInt24_t() * GetSpeedUnitFactor(autocvar_hud_panel_physics_speed_unit); if(race_speedaward_holder) strunzone(race_speedaward_holder); race_speedaward_holder = strzone(ReadString()); + if(race_speedaward_unit) + strunzone(race_speedaward_unit); + race_speedaward_unit = strzone(GetSpeedUnit(autocvar_hud_panel_physics_speed_unit)); break; case RACE_NET_SPEED_AWARD_BEST: - race_speedaward_alltimebest = ReadInt24_t(); + race_speedaward_alltimebest = ReadInt24_t() * GetSpeedUnitFactor(autocvar_hud_panel_physics_speed_unit); if(race_speedaward_alltimebest_holder) strunzone(race_speedaward_alltimebest_holder); race_speedaward_alltimebest_holder = strzone(ReadString()); + if(race_speedaward_alltimebest_unit) + strunzone(race_speedaward_alltimebest_unit); + race_speedaward_alltimebest_unit = strzone(GetSpeedUnit(autocvar_hud_panel_physics_speed_unit)); break; case RACE_NET_SERVER_RANKINGS: float prevpos, del;