]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into samual/notification_rewrite
authorSamual Lenks <samual@xonotic.org>
Thu, 27 Sep 2012 04:43:58 +0000 (00:43 -0400)
committerSamual Lenks <samual@xonotic.org>
Thu, 27 Sep 2012 04:43:58 +0000 (00:43 -0400)
Conflicts:
qcsrc/client/Main.qc
qcsrc/server/g_world.qc

1  2 
qcsrc/client/Main.qc
qcsrc/common/constants.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_world.qc

index 14b31947c8ded095f331c74cab18a99ec5360621,c71c787c6e679cd74ecba9c869f3f7b604ff8b21..a1bd34534220afea04970c35efd055e19b87ecf3
@@@ -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
index 09c1e923b2169b6a0c2d87ae0d7337755c84c9ab,9717905b6e0f61c5d8a863a0467b9ae4826446eb..5214d519c4a7b3cec750002b72032a595a3f1cf0
@@@ -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;
index 57b00a9b48852d4628e0b2b54a1f49cfd8250d4e,d2cc61db3346cb3405ca086e9d025657fd2a4c6f..f23988c7e8c2c15e97135690e1867cb5af6414e2
@@@ -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)
index f4496f1ac7519dd8391252848a41ed9a1466ef86,4cd5cc810a1c9f456bc372c0e8106e9b2d274488..0284280b4a225f44b654da8b983f001e3a140096
@@@ -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));