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 23 class DialogEngine : Engine
24 24 {
25 25 public static Dictionary<string, string> replacements = new Dictionary<string,string> {{"Damn", "Drat"},
26 {"Fucking hell", "Flipping heck"},
26 27 {"Fuck", "Fork"}, //Ty michael shur
27 28 {"Motherfucker", "Motherforker"},
28 {"Shit", "Shitake mushrooms"},
29 {"Shitheel", "Slimewheel"}, //idk
30 {"Shit!", "Shitake mushrooms!"}, //depends on context
31 {"Shit", "Shitake mushroom"},
29 32 {"Hell", "Heck"},
30 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 43 public Story Story;
34 44 public Grammar Grammar;
35 45
@@ -41,6 +51,9
41 51 this.Grammar = grammar;
42 52
43 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 59 public string BleepString(string s, ProfanityLevel setting)
@@ -50,17 +63,26
50 63 case ProfanityLevel.Uncensored:
51 64 return s;
52 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 72 s = s.Replace(item.Key, item.Value);
56 73 }
57 74 return s;
58 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 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 86 public override void Update(double dt)
65 87 {
66 88
@@ -103,17 +125,17
103 125
104 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 129 var parts = Regex.Split(continuation, ":", 0);
108 var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog";
109 var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation;
130 var speaker = (parts.Length == 2) ? BleepAndFlatten(parts[0], profanity_setting) : "Dialog";
131 var dialog = (parts.Length == 2) ? BleepAndFlatten(parts[1], profanity_setting) : continuation;
110 132
111 133 SetComponent(choiceMessage.Entity, new DialogComponent {
112 134 CurrentDialog = dialog,
113 135 CurrentSpeaker = speaker.Trim(),
114 136 Options = this.Story.currentChoices
115 .Select(option => BleepString(this.Grammar.Flatten(option.text),
116 profanity_setting ))
137 .Select(option => BleepAndFlatten(option.text,
138 profanity_setting))
117 139 .ToList()
118 140 });
119 141
@@ -157,14 +179,14
157 179 Story.ChoosePathString(Knot);
158 180 var continuation = this.Story.Continue();
159 181 var parts = Regex.Split(continuation, ":", 0);
160 var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog";
161 var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation;
182 var speaker = (parts.Length == 2) ? BleepAndFlatten(parts[0], profanity_setting) : "Dialog";
183 var dialog = (parts.Length == 2) ? BleepAndFlatten(parts[1], profanity_setting) : continuation;
162 184 SetComponent(lowestEntity, new DialogComponent {
163 185 Knot = Knot,
164 186 CurrentDialog = dialog,
165 187 CurrentSpeaker = speaker.Trim(),
166 188 Options = this.Story.currentChoices
167 .Select(option => BleepString(this.Grammar.Flatten(option.text),
189 .Select(option => BleepAndFlatten(option.text,
168 190 profanity_setting ))
169 191 .ToList()
170 192 });
@@ -153,6 +153,14
153 153
154 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 165 ImGui.Separator();
158 166
You need to be logged in to leave comments. Login now