// 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;
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)
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);
}
}
// 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));