From: Samual Lenks Date: Thu, 27 Sep 2012 04:43:58 +0000 (-0400) Subject: Merge remote-tracking branch 'origin/master' into samual/notification_rewrite X-Git-Tag: xonotic-v0.7.0~62^2~23^2~408 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0b401fc152bb8ea3accab7052bd615fead2fb4cc;p=xonotic%2Fxonotic-data.pk3dir.git Merge remote-tracking branch 'origin/master' into samual/notification_rewrite Conflicts: qcsrc/client/Main.qc qcsrc/server/g_world.qc --- 0b401fc152bb8ea3accab7052bd615fead2fb4cc diff --cc qcsrc/client/Main.qc index 14b31947c,c71c787c6..a1bd34534 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@@ -152,10 -152,9 +152,10 @@@ void CSQC_Init(void GetTeam(COLOR_SPECTATOR, true); // add specs first // needs to be done so early because of the constants they create - RegisterWeapons(); - RegisterGametypes(); - DecNotifs(); - + CALL_ACCUMULATED_FUNCTION(RegisterWeapons); + CALL_ACCUMULATED_FUNCTION(RegisterGametypes); - ++ CALL_ACCUMULATED_FUNCTION(DecNotifs); ++ WaypointSprite_Load(); // precaches diff --cc qcsrc/common/constants.qh index 09c1e923b,9717905b6..5214d519c --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@@ -365,6 -364,6 +365,29 @@@ float SPECIES_RESERVED = 15 // Deathtypes (weapon deathtypes are the IT_* constants below) // NOTE: when adding death types, please add an explanation to Docs/spamlog.txt too. ++#define VAR_TO_TEXT2(var) #var ++#define CHECK_FIELD_COUNT(field,first,count) if(!field) { field = (first + count); ++count; } ++#define CHECK_MAX_DEATHTYPES(name,count) if(count == DT_MAX) { error(strcat("Maximum deathtypes hit: ", VAR_TO_TEXT2(name), ": ", ftos(count), ".\n")); } ++ ++#define DT_FIRST 10000 ++#define DT_MAX 1024 // limit of recursive functions with ACCUMULATE_FUNCTION ++float DT_COUNT; ++ ++#define DEATHTYPE(name,type,notification) \ ++ float name; \ ++ void DecDeathtype_##name() \ ++ { \ ++ CHECK_FIELD_COUNT(name, DT_FIRST, DT_COUNT) \ ++ CHECK_MAX_DEATHTYPES(name, DT_COUNT) \ ++ } ++ //ACCUMULATE_FUNCTION(DecDeathtypes, DecDeathtype_##name) ++ ++#define DEATHTYPES \ ++ DEATHTYPE(DEATH_SPECIAL_START, MSG_CENTER, FALSE) \ ++ #undef DEATHTYPE ++ ++DEATHTYPES ++ float DEATH_SPECIAL_START = 10000; float DEATH_FALL = 10000; float DEATH_TELEFRAG = 10001; diff --cc qcsrc/server/g_damage.qc index 57b00a9b4,d2cc61db3..f23988c7e --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@@ -308,43 -308,32 +308,13 @@@ void LogDeath(string mode, float deatht GameLogEcho(s); } -void Send_KillNotification (string s1, string s2, string s3, float msg, float type) +void Obituary_Notification(entity notif_target, string s1, string s2, string s3, float deathtype) - {/* - print("Obituary_Notification(): ", ftos(deathtype), ".\n"); - switch(deathtype) - { - // suicide - case DEATH_AUTOTEAMCHANGE: - case DEATH_CAMP: - case DEATH_NOAMMO: - case DEATH_ROT: - case DEATH_TEAMCHANGE: - - case KILL_TEAM_SUICIDE_RED: - case KILL_TEAM_SUICIDE_BLUE: - - // murder - case KILL_TEAM_FRAG_RED: - case KILL_TEAM_FRAG_BLUE: - - case KILL_FIRST_BLOOD: - case KILL_FIRST_VICTIM: - - case KILL_FRAG: - case KILL_TYPEFRAG: - case KILL_FRAGGED: - case KILL_TYPEFRAGGED: - - // accident - case WATCH_STEP: - - case DEATH_QUIET: break; + { - WriteByte(MSG_ALL, SVC_TEMPENTITY); - WriteByte(MSG_ALL, TE_CSQC_KILLNOTIFY); - WriteString(MSG_ALL, s1); - WriteString(MSG_ALL, s2); - WriteString(MSG_ALL, s3); - WriteShort(MSG_ALL, msg); - WriteByte(MSG_ALL, type); -} ++ #define DEATHTYPE(name,type,notification) \ ++ { if(deathtype == max(0, name)) { Send_Notification(type, notif_target, notification, s1, s2, s3); return; } } - // ideally we should have ALL deathtypes listed here - default: - backtrace(strcat("Unhandled deathtype: ", ftos(deathtype), ". Please notify Samual!\n")); - break; - }*/ -// Function is used to send a generic centerprint whose content CSQC gets to decide (gentle version or not in the below cases) -void Send_CSQC_KillCenterprint(entity e, string s1, string s2, float msg, float type) -{ - if (clienttype(e) == CLIENTTYPE_REAL) - { - msg_entity = e; - WRITESPECTATABLE_MSG_ONE({ - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_KILLCENTERPRINT); - WriteString(MSG_ONE, s1); - WriteString(MSG_ONE, s2); - WriteShort(MSG_ONE, msg); - WriteByte(MSG_ONE, type); - }); - } ++ DEATHTYPES ++ backtrace("Unhandled deathtype. Please notify Samual!\n"); } void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) diff --cc qcsrc/server/g_world.qc index f4496f1ac,4cd5cc810..0284280b4 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@@ -551,11 -551,9 +551,11 @@@ void spawnfunc___init_dedicated_server( self.classname = "worldspawn"; // safeguard against various stuff ;) // needs to be done so early because of the constants they create - RegisterWeapons(); - RegisterGametypes(); + CALL_ACCUMULATED_FUNCTION(RegisterWeapons); + CALL_ACCUMULATED_FUNCTION(RegisterGametypes); + DecNotifs(); + MapInfo_Enumerate(); MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0); } @@@ -601,9 -597,8 +599,9 @@@ void spawnfunc_worldspawn (void } // needs to be done so early because of the constants they create - RegisterWeapons(); - RegisterGametypes(); - DecNotifs(); + CALL_ACCUMULATED_FUNCTION(RegisterWeapons); + CALL_ACCUMULATED_FUNCTION(RegisterGametypes); ++ CALL_ACCUMULATED_FUNCTION(DecNotifs); ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid));