Skip to content

Commit

Permalink
Run through formatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraakate committed Apr 21, 2024
1 parent b860f29 commit 25b9216
Show file tree
Hide file tree
Showing 58 changed files with 9,879 additions and 9,841 deletions.
1,708 changes: 869 additions & 839 deletions AM_MAP.C

Large diffs are not rendered by default.

122 changes: 61 additions & 61 deletions CT_CHAT.C
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int tail;
byte ChatQueue[QUEUESIZE];
int chat_dest[MAXPLAYERS];
char chat_msg[MAXPLAYERS][MESSAGESIZE];
char plr_lastmsg[MAXPLAYERS][MESSAGESIZE+9]; // add in the length of the pre-string
char plr_lastmsg[MAXPLAYERS][MESSAGESIZE + 9]; // add in the length of the pre-string
int msgptr[MAXPLAYERS];
int msglen[MAXPLAYERS];

Expand Down Expand Up @@ -84,14 +84,14 @@ void CT_Init(void)
tail = 0;
chatmodeon = false;
memset(ChatQueue, 0, QUEUESIZE);
for(i = 0; i < MAXPLAYERS; i++)
for (i = 0; i < MAXPLAYERS; i++)
{
chat_dest[i] = 0;
msgptr[i] = 0;
memset(plr_lastmsg[i], 0, MESSAGESIZE+9);
memset(plr_lastmsg[i], 0, MESSAGESIZE + 9);
memset(chat_msg[i], 0, MESSAGESIZE);
}
FontABaseLump = W_GetNumForName("FONTA_S")+1;
FontABaseLump = W_GetNumForName("FONTA_S") + 1;
return;
}

Expand Down Expand Up @@ -119,49 +119,49 @@ boolean CT_Responder(event_t *ev)

int sendto;

if(!netgame)
if (!netgame)
{
return false;
}
if(ev->data1 == KEY_LALT || ev->data2 == KEY_RALT)
if (ev->data1 == KEY_LALT || ev->data2 == KEY_RALT)
{
altdown = (ev->type == ev_keydown);
return false;
}
if(ev->data1 == KEY_RSHIFT)
if (ev->data1 == KEY_RSHIFT)
{
shiftdown = (ev->type == ev_keydown);
return false;
}
if(ev->type != ev_keydown)
if (ev->type != ev_keydown)
{
return false;
}
if(!chatmodeon)
if (!chatmodeon)
{
sendto = 0;
if(ev->data1 == CT_KEY_ALL)
if (ev->data1 == CT_KEY_ALL)
{
sendto = CT_PLR_ALL;
}
else if(ev->data1 == CT_KEY_GREEN)
else if (ev->data1 == CT_KEY_GREEN)
{
sendto = CT_PLR_GREEN;
}
else if(ev->data1 == CT_KEY_YELLOW)
else if (ev->data1 == CT_KEY_YELLOW)
{
sendto = CT_PLR_YELLOW;
}
else if(ev->data1 == CT_KEY_RED)
else if (ev->data1 == CT_KEY_RED)
{
sendto = CT_PLR_RED;
}
else if(ev->data1 == CT_KEY_BLUE)
else if (ev->data1 == CT_KEY_BLUE)
{
sendto = CT_PLR_BLUE;
}
if(sendto == 0 || (sendto != CT_PLR_ALL && !playeringame[sendto-1])
|| sendto == consoleplayer+1)
if (sendto == 0 || (sendto != CT_PLR_ALL && !playeringame[sendto - 1])
|| sendto == consoleplayer + 1)
{
return false;
}
Expand All @@ -171,18 +171,18 @@ boolean CT_Responder(event_t *ev)
}
else
{
if(altdown)
if (altdown)
{
if(ev->data1 >= '0' && ev->data1 <= '9')
if (ev->data1 >= '0' && ev->data1 <= '9')
{
if(ev->data1 == '0')
if (ev->data1 == '0')
{ // macro 0 comes after macro 9
ev->data1 = '9'+1;
ev->data1 = '9' + 1;
}
macro = chat_macros[ev->data1-'1'];
macro = chat_macros[ev->data1 - '1'];
CT_queueChatChar(KEY_ENTER); //send old message
CT_queueChatChar(chat_dest[consoleplayer]); // chose the dest.
while(*macro)
while (*macro)
{
CT_queueChatChar(toupper(*macro++));
}
Expand All @@ -191,41 +191,41 @@ boolean CT_Responder(event_t *ev)
return true;
}
}
if(ev->data1 == KEY_ENTER)
if (ev->data1 == KEY_ENTER)
{
CT_queueChatChar(KEY_ENTER);
CT_Stop();
return true;
}
else if(ev->data1 == KEY_ESCAPE)
else if (ev->data1 == KEY_ESCAPE)
{
CT_queueChatChar(CT_ESCAPE);
CT_Stop();
return true;
}
else if(ev->data1 >= 'a' && ev->data1 <= 'z')
else if (ev->data1 >= 'a' && ev->data1 <= 'z')
{
CT_queueChatChar(ev->data1-32);
CT_queueChatChar(ev->data1 - 32);
return true;
}
else if(shiftdown)
else if (shiftdown)
{
if(ev->data1 == '1')
if (ev->data1 == '1')
{
CT_queueChatChar('!');
return true;
}
else if(ev->data1 == '/')
else if (ev->data1 == '/')
{
CT_queueChatChar('?');
return true;
}
}
else
{
if(ev->data1 == ' ' || ev->data1 == ',' || ev->data1 == '.'
|| (ev->data1 >= '0' && ev->data1 <= '9') || ev->data1 == '\''
|| ev->data1 == KEY_BACKSPACE || ev->data1 == '-' || ev->data1 == '=')
if (ev->data1 == ' ' || ev->data1 == ',' || ev->data1 == '.'
|| (ev->data1 >= '0' && ev->data1 <= '9') || ev->data1 == '\''
|| ev->data1 == KEY_BACKSPACE || ev->data1 == '-' || ev->data1 == '=')
{
CT_queueChatChar(ev->data1);
return true;
Expand All @@ -248,32 +248,32 @@ void CT_Ticker(void)
char c;
int numplayers;

for(i=0; i < MAXPLAYERS; i++)
for (i = 0; i < MAXPLAYERS; i++)
{
if(!playeringame[i])
if (!playeringame[i])
{
continue;
}
if((c = players[i].cmd.chatchar) != 0)
if ((c = players[i].cmd.chatchar) != 0)
{
if(c <= 5)
if (c <= 5)
{
chat_dest[i] = c;
continue;
}
else if(c == CT_ESCAPE)
else if (c == CT_ESCAPE)
{
CT_ClearChatMessage(i);
}
else if(c == KEY_ENTER)
else if (c == KEY_ENTER)
{
numplayers = 0;
for(j = 0; j < MAXPLAYERS; j++)
for (j = 0; j < MAXPLAYERS; j++)
{
numplayers += playeringame[j];
}
CT_AddChar(i, 0); // set the end of message character
if(numplayers > 2)
if (numplayers > 2)
{
strcpy(plr_lastmsg[i], CT_FromPlrText[i]);
strcat(plr_lastmsg[i], chat_msg[i]);
Expand All @@ -282,18 +282,18 @@ void CT_Ticker(void)
{
strcpy(plr_lastmsg[i], chat_msg[i]);
}
if(i != consoleplayer && (chat_dest[i] == consoleplayer+1
if (i != consoleplayer && (chat_dest[i] == consoleplayer + 1
|| chat_dest[i] == CT_PLR_ALL) && *chat_msg[i])
{
P_SetMessage(&players[consoleplayer], plr_lastmsg[i],
P_SetMessage(&players[consoleplayer], plr_lastmsg[i],
true);
S_StartSound(NULL, sfx_chat);
}
else if(i == consoleplayer && (*chat_msg[i]))
else if (i == consoleplayer && (*chat_msg[i]))
{
if(numplayers > 1)
if (numplayers > 1)
{
P_SetMessage(&players[consoleplayer], "-MESSAGE SENT-",
P_SetMessage(&players[consoleplayer], "-MESSAGE SENT-",
true);
S_StartSound(NULL, sfx_chat);
}
Expand All @@ -306,7 +306,7 @@ void CT_Ticker(void)
}
CT_ClearChatMessage(i);
}
else if(c == KEY_BACKSPACE)
else if (c == KEY_BACKSPACE)
{
CT_BackSpace(i);
}
Expand All @@ -331,19 +331,19 @@ void CT_Drawer(void)
int x;
patch_t *patch;

if(chatmodeon)
if (chatmodeon)
{
x = 25;
for(i = 0; i < msgptr[consoleplayer]; i++)
for (i = 0; i < msgptr[consoleplayer]; i++)
{
if(chat_msg[consoleplayer][i] < 33)
if (chat_msg[consoleplayer][i] < 33)
{
x += 6;
}
else
{
patch=W_CacheLumpNum(FontABaseLump+
chat_msg[consoleplayer][i]-33, PU_CACHE);
patch = W_CacheLumpNum(FontABaseLump +
chat_msg[consoleplayer][i] - 33, PU_CACHE);
V_DrawPatch(x, 10, patch);
x += patch->width;
}
Expand All @@ -362,12 +362,12 @@ void CT_Drawer(void)

void CT_queueChatChar(char ch)
{
if((tail+1)&(QUEUESIZE-1) == head)
if ((tail + 1) & (QUEUESIZE - 1) == head)
{ // the queue is full
return;
}
ChatQueue[tail] = ch;
tail = (tail+1)&(QUEUESIZE-1);
tail = (tail + 1) & (QUEUESIZE - 1);
}

//===========================================================================
Expand All @@ -380,12 +380,12 @@ char CT_dequeueChatChar(void)
{
byte temp;

if(head == tail)
if (head == tail)
{ // queue is empty
return 0;
}
temp = ChatQueue[head];
head = (head+1)&(QUEUESIZE-1);
head = (head + 1) & (QUEUESIZE - 1);
return temp;
}

Expand All @@ -399,19 +399,19 @@ void CT_AddChar(int player, char c)
{
patch_t *patch;

if(msgptr[player]+1 >= MESSAGESIZE || msglen[player] >= MESSAGELEN)
if (msgptr[player] + 1 >= MESSAGESIZE || msglen[player] >= MESSAGELEN)
{ // full.
return;
}
chat_msg[player][msgptr[player]] = c;
msgptr[player]++;
if(c < 33)
if (c < 33)
{
msglen[player] += 6;
}
else
{
patch = W_CacheLumpNum(FontABaseLump+c-33, PU_CACHE);
patch = W_CacheLumpNum(FontABaseLump + c - 33, PU_CACHE);
msglen[player] += patch->width;
}
}
Expand All @@ -428,19 +428,19 @@ void CT_BackSpace(int player)
patch_t *patch;
char c;

if(msgptr[player] == 0)
if (msgptr[player] == 0)
{ // message is already blank
return;
}
msgptr[player]--;
c = chat_msg[player][msgptr[player]];
if(c < 33)
if (c < 33)
{
msglen[player] -= 6;
}
else
{
patch = W_CacheLumpNum(FontABaseLump+c-33, PU_CACHE);
patch = W_CacheLumpNum(FontABaseLump + c - 33, PU_CACHE);
msglen[player] -= patch->width;
}
chat_msg[player][msgptr[player]] = 0;
Expand Down
Loading

0 comments on commit 25b9216

Please sign in to comment.