X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_world.qc;h=3d3c226ad7f602f1f4e384432e22770a2402dc68;hb=3c7ef5b449d479f9a2e24fdddf767f87208c9be6;hp=651174cb6237991e15d47b67f623d4619dd5e793;hpb=2bb2db9c0f8016645a23381d7493588d748ecacf;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 651174cb6..3d3c226ad 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -14,7 +14,7 @@ void PingPLReport_Think() self.nextthink = time + delta; e = edict_num(self.cnt + 1); - if(clienttype(e) == CLIENTTYPE_REAL) + if(IS_REAL_CLIENT(e)) { WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); WriteByte(MSG_BROADCAST, TE_CSQC_PINGPLREPORT); @@ -51,7 +51,7 @@ void PingPLReport_Spawn() pingplreport.nextthink = time; } -float SPAWNFLAG_NO_WAYPOINTS_FOR_ITEMS = 1; +const float SPAWNFLAG_NO_WAYPOINTS_FOR_ITEMS = 1; string redirection_target; float world_initialized; @@ -563,7 +563,7 @@ void WeaponStats_Shutdown(); void spawnfunc_worldspawn (void) { float fd, l, i, j, n; - string s, col; + string s; cvar = cvar_normal; cvar_string = cvar_string_normal; @@ -654,8 +654,8 @@ void spawnfunc_worldspawn (void) InitGameplayMode(); readlevelcvars(); GrappleHookInit(); + ArcInit(); ElectroInit(); - LaserInit(); player_count = 0; bot_waypoints_for_items = autocvar_g_waypoints_for_items; @@ -706,10 +706,6 @@ void spawnfunc_worldspawn (void) if(autocvar_g_norecoil) s = strcat(s, ":norecoil"); - // TODO to mutator system - if(autocvar_g_midair) - s = strcat(s, ":midair"); - // TODO to mutator system if(autocvar_g_powerups == 0) s = strcat(s, ":no_powerups"); @@ -773,7 +769,7 @@ void spawnfunc_worldspawn (void) WeaponStats_Init(); - WEPSET_ADDSTAT(); + WepSet_AddStat(); addstat(STAT_SWITCHWEAPON, AS_INT, switchweapon); addstat(STAT_SWITCHINGWEAPON, AS_INT, switchingweapon); addstat(STAT_GAMESTARTTIME, AS_FLOAT, stat_game_starttime); @@ -818,58 +814,15 @@ void spawnfunc_worldspawn (void) detect_maptype(); // set up information replies for clients and server to use - lsmaps_reply = "^7Maps available: "; - lsnewmaps_reply = "^7Maps without a record set: "; - for(i = 0, j = 0; i < MapInfo_count; ++i) - { - if(MapInfo_Get_ByID(i)) - if not(MapInfo_Map_flags & MapInfo_ForbiddenFlags()) - { - if(mod(i, 2)) - col = "^2"; - else - col = "^3"; - - ++j; - - lsmaps_reply = strcat(lsmaps_reply, col, MapInfo_Map_bspname, " "); - - if(g_race && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, RACE_RECORD, "time")))) - lsnewmaps_reply = strcat(lsnewmaps_reply, col, MapInfo_Map_bspname, " "); - else if(g_cts && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, CTS_RECORD, "time")))) - lsnewmaps_reply = strcat(lsnewmaps_reply, col, MapInfo_Map_bspname, " "); - } - } - - lsmaps_reply = strzone(strcat(lsmaps_reply, "\n")); - lsnewmaps_reply = strzone(strcat(((!g_race && !g_cts) ? "Need to be playing race or CTS for lsnewmaps to work." : lsnewmaps_reply), "\n")); - - maplist_reply = "^7Maps in list: "; - n = tokenize_console(autocvar_g_maplist); - for(i = 0, j = 0; i < n; ++i) - { - if(MapInfo_CheckMap(argv(i))) - { - if(mod(j, 2)) - col = "^2"; - else - col = "^3"; - maplist_reply = strcat(maplist_reply, col, argv(i), " "); - ++j; - } - } - maplist_reply = strzone(strcat(maplist_reply, "\n")); - MapInfo_ClearTemps(); - + maplist_reply = strzone(getmaplist()); + lsmaps_reply = strzone(getlsmaps()); for(i = 0; i < 10; ++i) { s = getrecords(i); if (s) records_reply[i] = strzone(s); } - ladder_reply = strzone(getladder()); - rankings_reply = strzone(getrankings()); // begin other init @@ -887,7 +840,7 @@ void spawnfunc_worldspawn (void) s = ""; n = tokenize_console(cvar_string("sv_curl_serverpackages")); for(i = 0; i < n; ++i) - if(substring(argv(i), -14, -1) != "-serverpackage.txt") + if(substring(argv(i), -18, -1) != "-serverpackage.txt") if(substring(argv(i), -14, -1) != ".serverpackage") // OLD legacy s = strcat(s, " ", argv(i)); fd = search_begin("*-serverpackage.txt", TRUE, FALSE); @@ -1329,7 +1282,7 @@ void IntermissionThink() && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) ) { self.autoscreenshot = -1; - if(clienttype(self) == CLIENTTYPE_REAL) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"\n", GetMapname(), strftime(FALSE, "%s"))); } + if(IS_REAL_CLIENT(self)) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"\n", GetMapname(), strftime(FALSE, "%s"))); } return; } @@ -1453,11 +1406,11 @@ void DumpStats(float final) FOR_EACH_CLIENT(other) { - if ((clienttype(other) == CLIENTTYPE_REAL) || (clienttype(other) == CLIENTTYPE_BOT && autocvar_sv_logscores_bots)) + if ((IS_REAL_CLIENT(other)) || (IS_BOT_CLIENT(other) && autocvar_sv_logscores_bots)) { s = strcat(":player:see-labels:", GetPlayerScoreString(other, 0), ":"); s = strcat(s, ftos(rint(time - other.jointime)), ":"); - if(other.classname == "player" || g_arena || other.caplayer == 1 || g_lms) + if(IS_PLAYER(other) || g_arena || other.caplayer == 1 || g_lms) s = strcat(s, ftos(other.team), ":"); else s = strcat(s, "spectator:"); @@ -1522,7 +1475,7 @@ void FixIntermissionClient(entity e) if (e.weaponentity.weaponentity) e.weaponentity.weaponentity.effects = EF_NODRAW; } - if(clienttype(e) == CLIENTTYPE_REAL) + if(IS_REAL_CLIENT(e)) { stuffcmd(e, "\nscr_printspeed 1000000\n"); s = autocvar_sv_intermission_cdtrack; @@ -1616,10 +1569,10 @@ float checkrules_suddendeathwarning; float checkrules_suddendeathend; float checkrules_overtimesadded; //how many overtimes have been already added -float WINNING_NO = 0; // no winner, but time limits may terminate the game -float WINNING_YES = 1; // winner found -float WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached -float WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW +const float WINNING_NO = 0; // no winner, but time limits may terminate the game +const float WINNING_YES = 1; // winner found +const float WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached +const float WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW float InitiateSuddenDeath() { @@ -2446,7 +2399,7 @@ float MapVote_SendEntity(entity to, float sf) float i; if(sf & 1) - sf &~= 2; // if we send 1, we don't need to also send 2 + sf &= ~2; // if we send 1, we don't need to also send 2 WriteByte(MSG_ENTITY, ENT_CLIENT_MAPVOTE); WriteByte(MSG_ENTITY, sf); @@ -2672,7 +2625,7 @@ void MapVote_Tick() { other.health = 2342; other.impulse = 0; - if(clienttype(other) == CLIENTTYPE_REAL) + if(IS_REAL_CLIENT(other)) { msg_entity = other; WriteByte(MSG_ONE, SVC_FINALE); @@ -2784,7 +2737,7 @@ void EndFrame() float altime; FOR_EACH_REALCLIENT(self) { - if(self.classname == "spectator") + if(IS_SPEC(self)) { if(self.enemy.typehitsound) self.typehit_time = time;