Xonotic
markup.qc File Reference
#include "markup.qh"
#include <common/command/command.qh>
+ Include dependency graph for markup.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

string GenericCommand_markup (string s2)
 
void GenericCommand_markup_init ()
 

Function Documentation

◆ GenericCommand_markup()

string GenericCommand_markup ( string  s2)

Definition at line 61 of file markup.qc.

References GenericCommand_markup_init(), markup_from, markup_to, NUM_MARKUPS, strcat(), strlen(), and substring().

Referenced by GenericCommand().

62 {
63  int red, ccase, i, j;
64  string s, s3;
65 
67 
68  s = "";
69 
70  red = 0;
71  ccase = 0;
72  int len = strlen(s2);
73  for (i = 0; i < len; ++i)
74  {
75  for(j = 0; j < NUM_MARKUPS; ++j)
76  {
77  s3 = substring(s2, i, strlen(markup_from[j]));
78  if (s3 == markup_from[j])
79  {
80  s = strcat(s, markup_to[j]);
81  i += strlen(markup_from[j]) - 1;
82  break;
83  }
84  }
85 
86  if(j == NUM_MARKUPS)
87  {
88  if(substring(s2, i, 2) == "&&")
89  {
90  s = strcat(s, strconv(ccase, red, red, "&"));
91  ++i;
92  }
93  else if(substring(s2, i, 2) == "&d")
94  {
95  red = 2;
96  ccase = 0;
97  ++i;
98  }
99  else if(substring(s2, i, 2) == "&a")
100  {
101  red = 2;
102  ccase = 2;
103  ++i;
104  }
105  else if(substring(s2, i, 2) == "&n")
106  {
107  red = 0;
108  ccase = 0;
109  ++i;
110  }
111  else
112  s = strcat(s, strconv(ccase, red, red, substring(s2, i, 1)));
113  }
114  }
115 
116  return s;
117 }
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1 f1points s1 s2
Definition: all.inc:438
string markup_to[NUM_MARKUPS]
Definition: markup.qh:11
const int NUM_MARKUPS
Definition: markup.qh:8
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
string markup_from[NUM_MARKUPS]
Definition: markup.qh:10
void GenericCommand_markup_init()
Definition: markup.qc:10
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GenericCommand_markup_init()

void GenericCommand_markup_init ( )

Definition at line 10 of file markup.qc.

References markup_from, markup_init, and markup_to.

Referenced by GenericCommand_markup().

11 {
12  if (markup_init)
13  return;
14  markup_init = true;
15  // "&<-" doesn't have a corresponding symbol anymore
16  // replaced with similar triangle facing left ("&<|")
17  int i = 0;
18  markup_from[i] = "&alien"; markup_to[i] = "\x12"; ++i;
19  markup_from[i] = "&:-)"; markup_to[i] = "\x13"; ++i;
20  markup_from[i] = "&:-("; markup_to[i] = "\x14"; ++i;
21  markup_from[i] = "&x-P"; markup_to[i] = "\x15"; ++i;
22  markup_from[i] = "&:-/"; markup_to[i] = "\x16"; ++i;
23  markup_from[i] = "&:-D"; markup_to[i] = "\x17"; ++i;
24  markup_from[i] = "&<<"; markup_to[i] = "\x18"; ++i;
25  markup_from[i] = "&>>"; markup_to[i] = "\x19"; ++i;
26  markup_from[i] = "&dot"; markup_to[i] = "\x1a"; ++i;
27  markup_from[i] = "&^_"; markup_to[i] = "\x1b"; ++i;
28  markup_from[i] = "&ysplat"; markup_to[i] = "\x1c"; ++i;
29  markup_from[i] = "&-]"; markup_to[i] = "\x1d"; ++i;
30  markup_from[i] = "&--"; markup_to[i] = "\x1e"; ++i;
31  markup_from[i] = "&[-"; markup_to[i] = "\x1f"; ++i;
32  markup_from[i] = "&s<"; markup_to[i] = "\xac"; ++i;
33  markup_from[i] = "&s>"; markup_to[i] = "\xae"; ++i;
34  markup_from[i] = "&<-"; markup_to[i] = "\xff"; ++i; // same as "&<|"
35  markup_from[i] = "&[="; markup_to[i] = "\x80"; ++i;
36  markup_from[i] = "&=="; markup_to[i] = "\x81"; ++i;
37  markup_from[i] = "&=]"; markup_to[i] = "\x82"; ++i;
38  markup_from[i] = "&r!"; markup_to[i] = "\x84"; ++i;
39  markup_from[i] = "&|o|"; markup_to[i] = "\x85"; ++i;
40  markup_from[i] = "&|u|"; markup_to[i] = "\x86"; ++i;
41  markup_from[i] = "&|i|"; markup_to[i] = "\x87"; ++i;
42  markup_from[i] = "&|c|"; markup_to[i] = "\x88"; ++i;
43  markup_from[i] = "&[c]"; markup_to[i] = "\x89"; ++i;
44  markup_from[i] = "&[n]"; markup_to[i] = "\x8a"; ++i;
45  markup_from[i] = "&[]"; markup_to[i] = "\x8b"; ++i;
46  markup_from[i] = "&r?"; markup_to[i] = "\x8c"; ++i;
47  markup_from[i] = "&|>"; markup_to[i] = "\x8d"; ++i;
48  markup_from[i] = "&splat0"; markup_to[i] = "\x8e"; ++i;
49  markup_from[i] = "&splat1"; markup_to[i] = "\x8f"; ++i;
50  markup_from[i] = "&[["; markup_to[i] = "\x90"; ++i;
51  markup_from[i] = "&]]"; markup_to[i] = "\x91"; ++i;
52  markup_from[i] = "&splat2"; markup_to[i] = "\x9a"; ++i;
53  markup_from[i] = "&)("; markup_to[i] = "\x9b"; ++i;
54  markup_from[i] = "&splat3"; markup_to[i] = "\x9c"; ++i;
55  markup_from[i] = "&(."; markup_to[i] = "\x9d"; ++i;
56  markup_from[i] = "&.."; markup_to[i] = "\x9e"; ++i;
57  markup_from[i] = "&.)"; markup_to[i] = "\x9f"; ++i;
58  markup_from[i] = "&<|"; markup_to[i] = "\xff"; ++i;
59 }
bool markup_init
Definition: markup.qh:9
string markup_to[NUM_MARKUPS]
Definition: markup.qh:11
string markup_from[NUM_MARKUPS]
Definition: markup.qh:10
+ Here is the caller graph for this function: