1 string cache_mutatormsg;
2 string cache_lastmutatormsg;
4 // client counts for each team
6 // # of bots on those teams
7 float cb1, cb2, cb3, cb4;
9 //float audit_teams_time;
11 void TeamchangeFrags(entity e)
16 vector TeamColor(float teem)
21 return '1 0.0625 0.0625';
23 return '0.0625 0.0625 1';
33 string TeamName(float t)
35 return strcat(Team_ColorName(t), " Team");
37 string ColoredTeamName(float t)
39 return strcat(Team_ColorCode(t), Team_ColorName(t), " Team^7");
41 string TeamNoName(float t)
43 // fixme: Search for team entities and get their .netname's!
52 return "Neutral Team";
55 void runematch_init();
59 void LogTeamchange(float player_id, float team_number, float type)
61 if(!autocvar_sv_eventlog)
67 GameLogEcho(strcat(":team:", ftos(player_id), ":", ftos(team_number), ":", ftos(type)));
70 void default_delayedinit()
72 if(!scores_initialized)
76 void ActivateTeamplay()
78 serverflags |= SERVERFLAG_TEAMPLAY;
82 void InitGameplayMode()
84 float fraglimit_override, timelimit_override, leadlimit_override, qualifying_override;
86 qualifying_override = -1;
90 // find out good world mins/maxs bounds, either the static bounds found by looking for solid, or the mapinfo specified bounds
95 MapInfo_LoadMapSettings(mapname);
97 serverflags &~= SERVERFLAG_TEAMPLAY;
99 if not(cvar_value_issafe(world.fog))
101 print("The current map contains a potentially harmful fog setting, ignored\n");
102 world.fog = string_null;
104 if(MapInfo_Map_fog != "")
105 if(MapInfo_Map_fog == "none")
106 world.fog = string_null;
108 world.fog = strzone(MapInfo_Map_fog);
109 clientstuff = strzone(MapInfo_Map_clientstuff);
111 MapInfo_ClearTemps();
113 // set both here, gamemode can override it later
114 timelimit_override = autocvar_timelimit_override;
115 fraglimit_override = autocvar_fraglimit_override;
116 leadlimit_override = autocvar_leadlimit_override;
117 gamemode_name = MapInfo_Type_ToText(MapInfo_LoadedGametype);
127 if(autocvar_g_tdm_team_spawns)
128 have_team_spawns = -1; // request team spawns
134 fraglimit_override = autocvar_g_domination_point_limit;
135 leadlimit_override = autocvar_g_domination_point_leadlimit;
136 MUTATOR_ADD(gamemode_domination);
137 have_team_spawns = -1; // request team spawns
143 fraglimit_override = autocvar_capturelimit_override;
144 leadlimit_override = autocvar_captureleadlimit_override;
145 MUTATOR_ADD(gamemode_ctf);
146 have_team_spawns = -1; // request team spawns
151 fraglimit_override = 0; // no limits in TD - it's a survival mode
152 leadlimit_override = 0;
153 MUTATOR_ADD(gamemode_td);
158 fraglimit_override = 0;
159 leadlimit_override = 0;
160 MUTATOR_ADD(gamemode_rts);
165 // ActivateTeamplay();
166 fraglimit_override = autocvar_g_runematch_point_limit;
167 leadlimit_override = autocvar_g_runematch_point_leadlimit;
173 fraglimit_override = autocvar_g_lms_lives_override;
174 leadlimit_override = 0; // not supported by LMS
175 if(fraglimit_override == 0)
176 fraglimit_override = -1;
177 lms_lowest_lives = 9999;
184 fraglimit_override = autocvar_g_arena_point_limit;
185 leadlimit_override = autocvar_g_arena_point_leadlimit;
186 maxspawned = autocvar_g_arena_maxspawned;
189 arena_roundbased = autocvar_g_arena_roundbased;
195 fraglimit_override = autocvar_g_ca_point_limit;
196 leadlimit_override = autocvar_g_ca_point_leadlimit;
197 precache_sound("ctf/red_capture.wav");
198 precache_sound("ctf/blue_capture.wav");
203 fraglimit_override = autocvar_g_keyhunt_point_limit;
204 leadlimit_override = autocvar_g_keyhunt_point_leadlimit;
205 MUTATOR_ADD(gamemode_keyhunt);
211 fraglimit_override = autocvar_g_freezetag_point_limit;
212 leadlimit_override = autocvar_g_freezetag_point_leadlimit;
213 MUTATOR_ADD(gamemode_freezetag);
219 ScoreRules_assault();
220 have_team_spawns = -1; // request team spawns
226 have_team_spawns = -1; // request team spawns
227 MUTATOR_ADD(gamemode_onslaught);
233 if(autocvar_g_race_teams)
236 race_teams = bound(2, autocvar_g_race_teams, 4);
237 have_team_spawns = -1; // request team spawns
242 qualifying_override = autocvar_g_race_qualifying_timelimit_override;
243 fraglimit_override = autocvar_g_race_laps_limit;
244 leadlimit_override = 0; // currently not supported by race
249 g_race_qualifying = 1;
250 fraglimit_override = 0;
251 leadlimit_override = 0;
256 fraglimit_override = autocvar_g_nexball_goallimit;
257 leadlimit_override = autocvar_g_nexball_goalleadlimit;
259 have_team_spawns = -1; // request team spawns
260 MUTATOR_ADD(gamemode_nexball);
265 MUTATOR_ADD(gamemode_keepaway);
271 cache_mutatormsg = strzone("");
272 cache_lastmutatormsg = strzone("");
274 // enforce the server's universal frag/time limits
275 if(!autocvar_g_campaign)
277 if(fraglimit_override >= 0)
278 cvar_set("fraglimit", ftos(fraglimit_override));
279 if(timelimit_override >= 0)
280 cvar_set("timelimit", ftos(timelimit_override));
281 if(leadlimit_override >= 0)
282 cvar_set("leadlimit", ftos(leadlimit_override));
283 if(qualifying_override >= 0)
284 cvar_set("g_race_qualifying_timelimit", ftos(qualifying_override));
289 // we need to find out the correct value for g_race_qualifying
290 if(autocvar_g_campaign)
292 g_race_qualifying = 1;
294 else if(!autocvar_g_campaign && autocvar_g_race_qualifying_timelimit > 0)
296 g_race_qualifying = 2;
297 race_fraglimit = autocvar_fraglimit;
298 race_leadlimit = autocvar_leadlimit;
299 race_timelimit = autocvar_timelimit;
300 cvar_set("fraglimit", "0");
301 cvar_set("leadlimit", "0");
302 cvar_set("timelimit", ftos(autocvar_g_race_qualifying_timelimit));
305 g_race_qualifying = 0;
310 if(g_race_qualifying)
311 independent_players = 1;
316 InitializeEntity(world, default_delayedinit, INITPRIO_GAMETYPE_FALLBACK);
319 string GetClientVersionMessage() {
321 if (self.version_mismatch) {
322 if(self.version < autocvar_gameversion) {
323 versionmsg = "^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8";
325 versionmsg = "^3This server is using an outdated Xonotic version.\n\n\n ### THIS SERVER IS INCOMPATIBLE AND THUS YOU CANNOT JOIN ###.^8";
328 versionmsg = "^2client version and server version are compatible.^8";
333 string getwelcomemessage(void)
335 string s, modifications, motd;
338 MUTATOR_CALLHOOK(BuildMutatorsPrettyString);
339 modifications = ret_string;
342 modifications = strcat(modifications, ", MinstaGib");
345 if(g_weaponarena_random)
346 modifications = strcat(modifications, ", ", ftos(g_weaponarena_random), " of ", g_weaponarena_list, " Arena");
348 modifications = strcat(modifications, ", ", g_weaponarena_list, " Arena");
350 if(autocvar_g_start_weapon_laser == 0)
351 modifications = strcat(modifications, ", No start weapons");
352 if(autocvar_sv_gravity < 800)
353 modifications = strcat(modifications, ", Low gravity");
354 if(g_cloaked && !g_cts)
355 modifications = strcat(modifications, ", Cloaked");
357 modifications = strcat(modifications, ", Hook");
359 modifications = strcat(modifications, ", Midair");
361 modifications = strcat(modifications, ", Piñata");
362 if(g_weapon_stay && !g_cts)
363 modifications = strcat(modifications, ", Weapons stay");
365 modifications = strcat(modifications, ", Blood loss");
367 modifications = strcat(modifications, ", Jet pack");
368 if(autocvar_g_powerups == 0)
369 modifications = strcat(modifications, ", No powerups");
370 if(autocvar_g_powerups > 0)
371 modifications = strcat(modifications, ", Powerups");
372 modifications = substring(modifications, 2, strlen(modifications) - 2);
374 string versionmessage;
375 versionmessage = GetClientVersionMessage();
377 s = strcat("This is Xonotic ", autocvar_g_xonoticversion, "\n", versionmessage);
378 s = strcat(s, "^8\n\nmatch type is ^1", gamemode_name, "^8\n");
380 if(modifications != "")
381 s = strcat(s, "^8\nactive modifications: ^3", modifications, "^8\n");
383 if (g_grappling_hook)
384 s = strcat(s, "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n");
386 if(cache_lastmutatormsg != autocvar_g_mutatormsg)
388 if(cache_lastmutatormsg)
389 strunzone(cache_lastmutatormsg);
391 strunzone(cache_mutatormsg);
392 cache_lastmutatormsg = strzone(autocvar_g_mutatormsg);
393 cache_mutatormsg = strzone(cache_lastmutatormsg);
396 if (cache_mutatormsg != "") {
397 s = strcat(s, "\n\n^8special gameplay tips: ^7", cache_mutatormsg);
400 motd = autocvar_sv_motd;
402 s = strcat(s, "\n\n^8MOTD: ^7", strreplace("\\n", "\n", motd));
407 void SetPlayerColors(entity pl, float _color)
411 stuffcmd(pl, strcat("color ", s, " ", s, "\n") );
413 //pl.clientcolors = pl.clientcolors - (pl.clientcolors & 15) + cl;
414 pl.clientcolors = 16*cl + cl;*/
417 pants = _color & 0x0F;
418 shirt = _color & 0xF0;
422 setcolor(pl, 16*pants + pants);
424 setcolor(pl, shirt + pants);
428 void SetPlayerTeam(entity pl, float t, float s, float noprint)
433 _color = COLOR_TEAM4 - 1;
435 _color = COLOR_TEAM3 - 1;
437 _color = COLOR_TEAM2 - 1;
439 _color = COLOR_TEAM1 - 1;
441 SetPlayerColors(pl,_color);
444 LogTeamchange(pl.playerid, pl.team, 3); // log manual team join
447 bprint(pl.netname, "^7 has changed from ", TeamNoName(s), " to ", TeamNoName(t), "\n");
452 // set c1...c4 to show what teams are allowed
453 void CheckAllowedTeams (entity for_whom)
459 c1 = c2 = c3 = c4 = -1;
460 cb1 = cb2 = cb3 = cb4 = 0;
462 teament_name = string_null;
465 // onslaught is special
466 head = findchain(classname, "onslaught_generator");
469 if (head.team == COLOR_TEAM1) c1 = 0;
470 if (head.team == COLOR_TEAM2) c2 = 0;
471 if (head.team == COLOR_TEAM3) c3 = 0;
472 if (head.team == COLOR_TEAM4) c4 = 0;
476 else if(g_domination)
477 teament_name = "dom_team";
479 teament_name = "ctf_team";
481 teament_name = "tdm_team";
483 teament_name = "nexball_team";
485 c1 = c2 = 0; // Assault always has 2 teams
488 // cover anything else by treating it like tdm with no teams spawned
495 MUTATOR_CALLHOOK(GetTeamCount);
499 c1 = c2 = c3 = c4 = 0;
506 // find out what teams are allowed if necessary
509 head = find(world, classname, teament_name);
512 if(!(g_domination && head.netname == ""))
514 if(head.team == COLOR_TEAM1)
516 else if(head.team == COLOR_TEAM2)
518 else if(head.team == COLOR_TEAM3)
520 else if(head.team == COLOR_TEAM4)
523 head = find(head, classname, teament_name);
527 // TODO: Balance quantity of bots across > 2 teams when bot_vs_human is set (and remove next line)
529 if(autocvar_bot_vs_human && for_whom)
531 if(autocvar_bot_vs_human > 0)
534 if(clienttype(for_whom) == CLIENTTYPE_BOT)
542 if(clienttype(for_whom) == CLIENTTYPE_BOT)
549 // if player has a forced team, ONLY allow that one
550 if(self.team_forced == COLOR_TEAM1 && c1 >= 0)
552 else if(self.team_forced == COLOR_TEAM2 && c2 >= 0)
554 else if(self.team_forced == COLOR_TEAM3 && c3 >= 0)
556 else if(self.team_forced == COLOR_TEAM4 && c4 >= 0)
560 float PlayerValue(entity p)
563 // FIXME: it always returns 1...
566 // c1...c4 should be set to -1 (not allowed) or 0 (allowed).
567 // teams that are allowed will now have their player counts stored in c1...c4
568 void GetTeamCounts(entity ignore)
572 // now count how many players are on each team already
574 // FIXME: also find and memorize the lowest-scoring bot on each team (in case players must be shuffled around)
575 // also remember the lowest-scoring player
577 FOR_EACH_CLIENT(head)
580 if(head.classname == "player")
582 else if(head.team_forced > 0)
583 t = head.team_forced; // reserve the spot
586 if(head != ignore)// && head.netname != "")
588 value = PlayerValue(head);
589 if(clienttype(head) == CLIENTTYPE_BOT)
628 // if the player who has a forced team has not joined yet, reserve the spot
629 if(autocvar_g_campaign)
631 switch(autocvar_g_campaign_forceteam)
633 case 1: if(c1 == cb1) ++c1; break;
634 case 2: if(c2 == cb2) ++c2; break;
635 case 3: if(c3 == cb3) ++c3; break;
636 case 4: if(c4 == cb4) ++c4; break;
641 float TeamSmallerEqThanTeam(float ta, float tb, entity e)
643 // we assume that CheckAllowedTeams and GetTeamCounts have already been called
645 float ca = -1, cb = -1, cba = 0, cbb = 0, sa = 0, sb = 0;
649 case 1: ca = c1; cba = cb1; sa = team1_score; break;
650 case 2: ca = c2; cba = cb2; sa = team2_score; break;
651 case 3: ca = c3; cba = cb3; sa = team3_score; break;
652 case 4: ca = c4; cba = cb4; sa = team4_score; break;
656 case 1: cb = c1; cbb = cb1; sb = team1_score; break;
657 case 2: cb = c2; cbb = cb2; sb = team2_score; break;
658 case 3: cb = c3; cbb = cb3; sb = team3_score; break;
659 case 4: cb = c4; cbb = cb4; sb = team4_score; break;
670 if(clienttype(e) == CLIENTTYPE_REAL)
679 // keep teams alive (teams of size 0 always count as smaller, ignoring score)
695 // the more we're at the end of the match, the more take scores into account
696 f = bound(0, game_completion_ratio * autocvar_g_balance_teams_scorefactor, 1);
703 // returns # of smallest team (1, 2, 3, 4)
704 // NOTE: Assumes CheckAllowedTeams has already been called!
705 float FindSmallestTeam(entity pl, float ignore_pl)
710 // find out what teams are available
711 //CheckAllowedTeams();
713 // make sure there are at least 2 teams to join
715 totalteams = totalteams + 1;
717 totalteams = totalteams + 1;
719 totalteams = totalteams + 1;
721 totalteams = totalteams + 1;
723 if((autocvar_bot_vs_human || pl.team_forced > 0) && totalteams == 1)
728 if(autocvar_g_campaign && pl && clienttype(pl) == CLIENTTYPE_REAL)
729 return 1; // special case for campaign and player joining
730 else if(g_domination)
731 error("Too few teams available for domination\n");
733 error("Too few teams available for ctf\n");
735 error("Too few teams available for key hunt\n");
737 error("Too few teams available for freeze tag\n");
739 error("Too few teams available for team deathmatch\n");
742 // count how many players are in each team
746 GetTeamCounts(world);
748 RandomSelection_Init();
751 if(TeamSmallerEqThanTeam(2, t, pl))
753 if(TeamSmallerEqThanTeam(3, t, pl))
755 if(TeamSmallerEqThanTeam(4, t, pl))
758 // now t is the minimum, or A minimum!
759 if(t == 1 || TeamSmallerEqThanTeam(1, t, pl))
760 RandomSelection_Add(world, 1, string_null, 1, 1);
761 if(t == 2 || TeamSmallerEqThanTeam(2, t, pl))
762 RandomSelection_Add(world, 2, string_null, 1, 1);
763 if(t == 3 || TeamSmallerEqThanTeam(3, t, pl))
764 RandomSelection_Add(world, 3, string_null, 1, 1);
765 if(t == 4 || TeamSmallerEqThanTeam(4, t, pl))
766 RandomSelection_Add(world, 4, string_null, 1, 1);
768 return RandomSelection_chosen_float;
771 float JoinBestTeam(entity pl, float only_return_best, float forcebestteam)
773 float smallest, selectedteam;
775 // don't join a team if we're not playing a team game
779 // find out what teams are available
780 CheckAllowedTeams(pl);
782 // if we don't care what team he ends up on, put him on whatever team he entered as.
783 // if he's not on a valid team, then let other code put him on the smallest team
786 if( c1 >= 0 && pl.team == COLOR_TEAM1)
787 selectedteam = pl.team;
788 else if(c2 >= 0 && pl.team == COLOR_TEAM2)
789 selectedteam = pl.team;
790 else if(c3 >= 0 && pl.team == COLOR_TEAM3)
791 selectedteam = pl.team;
792 else if(c4 >= 0 && pl.team == COLOR_TEAM4)
793 selectedteam = pl.team;
799 if(!only_return_best)
801 SetPlayerColors(pl, selectedteam - 1);
803 // when JoinBestTeam is called by client.qc/ClientKill_Now_TeamChange the players team is -1 and thus skipped
804 // when JoinBestTeam is called by cl_client.qc/ClientConnect the player_id is 0 the log attempt is rejected
805 LogTeamchange(pl.playerid, pl.team, 99);
809 // otherwise end up on the smallest team (handled below)
812 smallest = FindSmallestTeam(pl, TRUE);
814 if(!only_return_best && !pl.bot_forced_team)
816 TeamchangeFrags(self);
819 SetPlayerColors(pl, COLOR_TEAM1 - 1);
821 else if(smallest == 2)
823 SetPlayerColors(pl, COLOR_TEAM2 - 1);
825 else if(smallest == 3)
827 SetPlayerColors(pl, COLOR_TEAM3 - 1);
829 else if(smallest == 4)
831 SetPlayerColors(pl, COLOR_TEAM4 - 1);
835 error("smallest team: invalid team\n");
838 LogTeamchange(pl.playerid, pl.team, 2); // log auto join
840 if(pl.deadflag == DEAD_NO)
841 Damage(pl, pl, pl, 100000, DEATH_TEAMCHANGE, pl.origin, '0 0 0');
847 //void() ctf_playerchanged;
848 void SV_ChangeTeam(float _color)
850 float scolor, dcolor, steam, dteam; //, dbotcount, scount, dcount;
852 // in normal deathmatch we can just apply the color and we're done
854 SetPlayerColors(self, _color);
858 scolor = self.clientcolors & 0x0F;
859 dcolor = _color & 0x0F;
861 if(scolor == COLOR_TEAM1 - 1)
863 else if(scolor == COLOR_TEAM2 - 1)
865 else if(scolor == COLOR_TEAM3 - 1)
867 else // if(scolor == COLOR_TEAM4 - 1)
869 if(dcolor == COLOR_TEAM1 - 1)
871 else if(dcolor == COLOR_TEAM2 - 1)
873 else if(dcolor == COLOR_TEAM3 - 1)
875 else // if(dcolor == COLOR_TEAM4 - 1)
878 CheckAllowedTeams(self);
880 if(dteam == 1 && c1 < 0) dteam = 4;
881 if(dteam == 4 && c4 < 0) dteam = 3;
882 if(dteam == 3 && c3 < 0) dteam = 2;
883 if(dteam == 2 && c2 < 0) dteam = 1;
885 // not changing teams
888 //bprint("same team change\n");
889 SetPlayerTeam(self, dteam, steam, TRUE);
893 if((autocvar_g_campaign) || (autocvar_g_changeteam_banned && self.wasplayer)) {
894 sprint(self, "Team changes not allowed\n");
895 return; // changing teams is not allowed
898 // autocvar_g_balance_teams_prevent_imbalance only makes sense if autocvar_g_balance_teams is on, as it makes the team selection dialog pointless
899 if(autocvar_g_balance_teams && autocvar_g_balance_teams_prevent_imbalance)
902 if(!TeamSmallerEqThanTeam(dteam, steam, self))
904 sprint(self, "Cannot change to a larger/better/shinier team\n");
909 // bprint("allow change teams from ", ftos(steam), " to ", ftos(dteam), "\n");
911 if(self.classname == "player" && steam != dteam)
913 // reduce frags during a team change
914 TeamchangeFrags(self);
917 SetPlayerTeam(self, dteam, steam, FALSE);
919 if(self.classname == "player" && steam != dteam)
921 // kill player when changing teams
922 if(self.deadflag == DEAD_NO)
923 Damage(self, self, self, 100000, DEATH_TEAMCHANGE, self.origin, '0 0 0');
927 void ShufflePlayerOutOfTeam (float source_team)
929 float smallestteam, smallestteam_count, steam;
930 float lowest_bot_score, lowest_player_score;
931 entity head, lowest_bot, lowest_player, selected;
934 smallestteam_count = 999999999;
936 if(c1 >= 0 && c1 < smallestteam_count)
939 smallestteam_count = c1;
941 if(c2 >= 0 && c2 < smallestteam_count)
944 smallestteam_count = c2;
946 if(c3 >= 0 && c3 < smallestteam_count)
949 smallestteam_count = c3;
951 if(c4 >= 0 && c4 < smallestteam_count)
954 smallestteam_count = c4;
959 bprint("warning: no smallest team\n");
965 else if(source_team == 2)
967 else if(source_team == 3)
969 else // if(source_team == 4)
973 lowest_bot_score = 999999999;
974 lowest_player = world;
975 lowest_player_score = 999999999;
977 // find the lowest-scoring player & bot of that team
978 FOR_EACH_PLAYER(head)
980 if(head.team == steam)
984 if(head.totalfrags < lowest_bot_score)
987 lowest_bot_score = head.totalfrags;
992 if(head.totalfrags < lowest_player_score)
994 lowest_player = head;
995 lowest_player_score = head.totalfrags;
1001 // prefers to move a bot...
1002 if(lowest_bot != world)
1003 selected = lowest_bot;
1004 // but it will move a player if it has to
1006 selected = lowest_player;
1007 // don't do anything if it couldn't find anyone
1010 bprint("warning: couldn't find a player to move from team\n");
1014 // smallest team gains a member
1015 if(smallestteam == 1)
1019 else if(smallestteam == 2)
1023 else if(smallestteam == 3)
1027 else if(smallestteam == 4)
1033 bprint("warning: destination team invalid\n");
1036 // source team loses a member
1037 if(source_team == 1)
1041 else if(source_team == 2)
1045 else if(source_team == 3)
1049 else if(source_team == 4)
1055 bprint("warning: source team invalid\n");
1059 // move the player to the new team
1060 TeamchangeFrags(selected);
1061 SetPlayerTeam(selected, smallestteam, source_team, FALSE);
1063 if(selected.deadflag == DEAD_NO)
1064 Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0');
1065 centerprint(selected, strcat("You have been moved into a different team to improve team balance\nYou are now on: ", ColoredTeamName(selected.team)));
1068 // code from here on is just to support maps that don't have team entities
1069 void tdm_spawnteam (string teamname, float teamcolor)
1073 e.classname = "tdm_team";
1074 e.netname = teamname;
1079 // spawn some default teams if the map is not set up for tdm
1080 void tdm_spawnteams()
1084 numteams = autocvar_g_tdm_teams_override;
1086 numteams = autocvar_g_tdm_teams;
1087 numteams = bound(2, numteams, 4);
1089 tdm_spawnteam("Red", COLOR_TEAM1-1);
1090 tdm_spawnteam("Blue", COLOR_TEAM2-1);
1092 tdm_spawnteam("Yellow", COLOR_TEAM3-1);
1094 tdm_spawnteam("Pink", COLOR_TEAM4-1);
1097 void tdm_delayedinit()
1099 // if no teams are found, spawn defaults
1100 if (find(world, classname, "tdm_team") == world)
1106 InitializeEntity(world, tdm_delayedinit, INITPRIO_GAMETYPE);