Description:
Make censoring more completem.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r477:ecc77c69cbf9 -

@@ -23,13 +23,23
23 class DialogEngine : Engine
23 class DialogEngine : Engine
24 {
24 {
25 public static Dictionary<string, string> replacements = new Dictionary<string,string> {{"Damn", "Drat"},
25 public static Dictionary<string, string> replacements = new Dictionary<string,string> {{"Damn", "Drat"},
26 {"Fucking hell", "Flipping heck"},
26 {"Fuck", "Fork"}, //Ty michael shur
27 {"Fuck", "Fork"}, //Ty michael shur
27 {"Motherfucker", "Motherforker"},
28 {"Motherfucker", "Motherforker"},
28 {"Shit", "Shitake mushrooms"},
29 {"Shitheel", "Slimewheel"}, //idk
30 {"Shit!", "Shitake mushrooms!"}, //depends on context
31 {"Shit", "Shitake mushroom"},
29 {"Hell", "Heck"},
32 {"Hell", "Heck"},
30 {"Oh my God", "Oh my Glob"}, //Ty Pendleton Ward
33 {"Oh my God", "Oh my Glob"}, //Ty Pendleton Ward
31 {"Bastard", "Bollocks"}
34 {"Goddammit", "Glob drat it"},
35 {"Goddamm", "Goshdarn"},
36 {"Megadick", "Megadunce"},
37 {"Dickhead", "Dunce"},
38 {"Bastard", "Bollocks"},
39 {"Asshole", "Bumhead"} //i guess
32 };
40 };
41
42 public static Dictionary<string, string> replacements_lower;
33 public Story Story;
43 public Story Story;
34 public Grammar Grammar;
44 public Grammar Grammar;
35
45
@@ -41,6 +51,9
41 this.Grammar = grammar;
51 this.Grammar = grammar;
42
52
43 this.Random = new Random();
53 this.Random = new Random();
54
55 DialogEngine.replacements_lower = DialogEngine.replacements.Select((i) => (i.Key.ToLower(), i.Value.ToLower())).ToDictionary(i => i.Item1, i => i.Item2);
56
44 }
57 }
45
58
46 public string BleepString(string s, ProfanityLevel setting)
59 public string BleepString(string s, ProfanityLevel setting)
@@ -50,17 +63,26
50 case ProfanityLevel.Uncensored:
63 case ProfanityLevel.Uncensored:
51 return s;
64 return s;
52 case ProfanityLevel.Minced:
65 case ProfanityLevel.Minced:
53 foreach (var item in replacements)
66 foreach (var item in DialogEngine.replacements)
67 {
68 s = s.Replace(item.Key, item.Value);
69 }
70 foreach (var item in DialogEngine.replacements_lower)
54 {
71 {
55 s = s.Replace(item.Key, item.Value);
72 s = s.Replace(item.Key, item.Value);
56 }
73 }
57 return s;
74 return s;
58 case ProfanityLevel.Removed:
75 case ProfanityLevel.Removed:
59 return Regex.Replace(s, "(?i)((?<=d)amn|(?<=f)uck|(?<=D)amn|(?<=F)uck)", "------");
76 return Regex.Replace(s, "(?i)((?<=d)amn|(?<=f)uck|(?<=D)amn|(?<=F)uck|(?<=S)hit|(?<=Motherf)ucker|(?<=megad)ick)", "------");
60 }
77 }
61 return s;
78 return s;
62 }
79 }
63
80
81 public string BleepAndFlatten(string s, ProfanityLevel setting)
82 {
83 return this.BleepString(this.Grammar.Flatten(s), setting);
84 }
85
64 public override void Update(double dt)
86 public override void Update(double dt)
65 {
87 {
66
88
@@ -103,17 +125,17
103
125
104 //Update the dialog component with the new speaker, dialog, and options:
126 //Update the dialog component with the new speaker, dialog, and options:
105
127
106 var continuation = this.Grammar.Flatten(this.Story.Continue());
128 var continuation = BleepAndFlatten(this.Story.Continue(), profanity_setting);
107 var parts = Regex.Split(continuation, ":", 0);
129 var parts = Regex.Split(continuation, ":", 0);
108 var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog";
130 var speaker = (parts.Length == 2) ? BleepAndFlatten(parts[0], profanity_setting) : "Dialog";
109 var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation;
131 var dialog = (parts.Length == 2) ? BleepAndFlatten(parts[1], profanity_setting) : continuation;
110
132
111 SetComponent(choiceMessage.Entity, new DialogComponent {
133 SetComponent(choiceMessage.Entity, new DialogComponent {
112 CurrentDialog = dialog,
134 CurrentDialog = dialog,
113 CurrentSpeaker = speaker.Trim(),
135 CurrentSpeaker = speaker.Trim(),
114 Options = this.Story.currentChoices
136 Options = this.Story.currentChoices
115 .Select(option => BleepString(this.Grammar.Flatten(option.text),
137 .Select(option => BleepAndFlatten(option.text,
116 profanity_setting ))
138 profanity_setting))
117 .ToList()
139 .ToList()
118 });
140 });
119
141
@@ -157,14 +179,14
157 Story.ChoosePathString(Knot);
179 Story.ChoosePathString(Knot);
158 var continuation = this.Story.Continue();
180 var continuation = this.Story.Continue();
159 var parts = Regex.Split(continuation, ":", 0);
181 var parts = Regex.Split(continuation, ":", 0);
160 var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog";
182 var speaker = (parts.Length == 2) ? BleepAndFlatten(parts[0], profanity_setting) : "Dialog";
161 var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation;
183 var dialog = (parts.Length == 2) ? BleepAndFlatten(parts[1], profanity_setting) : continuation;
162 SetComponent(lowestEntity, new DialogComponent {
184 SetComponent(lowestEntity, new DialogComponent {
163 Knot = Knot,
185 Knot = Knot,
164 CurrentDialog = dialog,
186 CurrentDialog = dialog,
165 CurrentSpeaker = speaker.Trim(),
187 CurrentSpeaker = speaker.Trim(),
166 Options = this.Story.currentChoices
188 Options = this.Story.currentChoices
167 .Select(option => BleepString(this.Grammar.Flatten(option.text),
189 .Select(option => BleepAndFlatten(option.text,
168 profanity_setting ))
190 profanity_setting ))
169 .ToList()
191 .ToList()
170 });
192 });
@@ -153,6 +153,14
153
153
154 ImGui.EndCombo();
154 ImGui.EndCombo();
155 }
155 }
156 ImGui.SameLine();
157 ImGui.TextDisabled("(?)");
158 if (ImGui.IsItemHovered())
159 {
160 ImGui.BeginTooltip();
161 ImGui.Text("Removes profanity from the game, if you must.");
162 ImGui.EndTooltip();
163 }
156
164
157 ImGui.Separator();
165 ImGui.Separator();
158
166
You need to be logged in to leave comments. Login now