Macros converted to function
This commit is contained in:
@@ -1734,17 +1734,19 @@ void setfollowplayer(int cn)
|
||||
}
|
||||
COMMANDF(setfollowplayer, "i", (int *cn) { setfollowplayer(*cn); });
|
||||
|
||||
// macros to determine when SM_OVERVIEW and SM_FLY are permitted
|
||||
// the spectate mode SM_OVERVIEW is like a radar hack and therefore is only allowed under certain conditions
|
||||
#define NOT_MATCH_NOT_PRIVATE (servstate.mastermode != MM_MATCH && servstate.mastermode != MM_PRIVATE)
|
||||
#define SM_56_FOBRIDDEN (player1->state == CS_DEAD || player1->team == TEAM_CLA_SPECT || player1->team == TEAM_RVSF_SPECT || NOT_MATCH_NOT_PRIVATE)
|
||||
bool smoverviewflyforbidden()
|
||||
{
|
||||
bool notmatchnotprivate = servstate.mastermode != MM_MATCH && servstate.mastermode != MM_PRIVATE;
|
||||
return (player1->state == CS_DEAD || player1->team == TEAM_CLA_SPECT || player1->team == TEAM_RVSF_SPECT || notmatchnotprivate);
|
||||
}
|
||||
|
||||
// set new spect mode
|
||||
void spectatemode(int mode)
|
||||
{
|
||||
if((player1->state != CS_DEAD && player1->state != CS_SPECTATE && !team_isspect(player1->team)) || (!m_teammode && !team_isspect(player1->team) && servstate.mastermode == MM_MATCH)) return; // during ffa matches only SPECTATORS can spectate
|
||||
if(mode == player1->spectatemode || (m_botmode && mode != SM_FLY)) return;
|
||||
if((mode == SM_OVERVIEW || mode == SM_FLY) && SM_56_FOBRIDDEN) return;
|
||||
if((mode == SM_OVERVIEW || mode == SM_FLY) && smoverviewflyforbidden()) return;
|
||||
showscores(false);
|
||||
switch(mode)
|
||||
{
|
||||
@@ -1790,7 +1792,7 @@ void togglespect() // cycle through all spectating modes
|
||||
{
|
||||
int mode;
|
||||
if(player1->spectatemode==SM_NONE) mode = SM_FOLLOW1ST; // start with 1st person spect
|
||||
else mode = SM_FOLLOW1ST + ((player1->spectatemode - SM_FOLLOW1ST + 1) % ((SM_56_FOBRIDDEN ? SM_FLY : SM_OVERVIEW)-SM_FOLLOW1ST)); // replace SM_OVERVIEW by SM_NUM to enable overview mode
|
||||
else mode = SM_FOLLOW1ST + ((player1->spectatemode - SM_FOLLOW1ST + 1) % ((smoverviewflyforbidden() ? SM_FLY : SM_OVERVIEW)-SM_FOLLOW1ST)); // replace SM_OVERVIEW by SM_NUM to enable overview mode
|
||||
spectatemode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user