2 * This file is part of ShapeFusion (Copyright 2000 Tito Dal Canton)
4 * ShapeFusion is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * ShapeFusion is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with ShapeFusion; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "DefaultNames.h"
21 #include <wx/textfile.h>
22 #include <wx/tokenzr.h>
23 #include <wx/stdpaths.h>
25 static const wxString alienNames[] = {
32 _("Minor Invisible S'pht"),
33 _("Major Invisible S'pht"),
36 _("Minor Projectile Pfhor"),
37 _("Major Projectile Pfhor"),
49 _("Minor Flame Cyborg"),
50 _("Major Flame Cyborg"),
57 _("Mother of All Cyborgs"),
58 _("Mother of All Hunters"),
64 _("Minor Juggernaut"),
65 _("Major Juggernaut"),
72 _("Assimilated VacBob"),
75 static const wxString collectionNames[] = {
80 _("Explosion Effects"),
89 _("VacBob (Inf only)"),
95 _("Walls 3 (Sewage)"),
98 _("Scenery 1 (Water)"),
99 _("Scenery 2 (Lava)"),
100 _("Scenery 3 (Sewage)"),
101 _("Scenery 4 (Jjaro)"),
102 _("Scenery 5 (Pfhor)"),
103 _("Landscape 1 (Day)"),
104 _("Landscape 2 (Night)"),
105 _("Landscape 3 (Moon)"),
106 _("Landscape 4 (Space)"),
110 static const wxString classNames[] = {
114 _("Possessed Drone"),
124 _("Assimilated Bob"),
129 static const wxString damageNames[] = {
131 _("Electrical Staff"),
136 _("Alien Projectile"),
145 _("Flick'ta Projectile"),
156 static const wxString effectNames[] = {
157 _("Missile Explosion"),
158 _("Missile Contrail"),
159 _("Grenade Explosion"),
160 _("Grenade Contrail"),
161 _("Bullet Ricochet"),
162 _("Alien Weapon Impact"),
163 _("Flamethrower Burst"),
167 _("Assimilated Bob Hit"),
169 _("S'pht Bolt Impact"),
170 _("Seeking S'pht Bolt Impact"),
171 _("S'pht Bolt Contrail"),
172 _("Staff-Bolt Impact"),
174 _("Hunter Bolt Impact"),
177 _("Plasma Overload Impact"),
178 _("Plasma Contrail"),
180 _("S'pht'Kr Bolt Impact"),
181 _("Major S'pht'Kr Bolt Impact"),
184 _("Lamp Breaking 1"),
185 _("Lamp Breaking 2"),
186 _("Lamp Breaking 3"),
187 _("Lamp Breaking 4"),
188 _("Clank (melee hit)"),
191 _("Small Water Splash"),
192 _("Medium Water Splash"),
193 _("Large Water Splash"),
194 _("Large Water Emergence"),
195 _("Small Lava Splash"),
196 _("Medium Lava Splash"),
197 _("Large Lava Splash"),
198 _("Large Lava Emergence"),
199 _("Small Sewage Splash"),
200 _("Medium Sewage Splash"),
201 _("Large Sewage Splash"),
202 _("Large Sewage Emergence"),
203 _("Small Goo Splash"),
204 _("Medium Goo Splash"),
205 _("Large Goo Splash"),
206 _("Large Goo Emergence"),
207 _("Drone Bolt Impact"),
208 _("Fast Drone Bolt Impact"),
209 _("Possessed Drone Bolt Impact"),
211 _("Cyborg Grenade Detonation"),
213 _("Fusion Dispersal"),
214 _("Major Fusion Dispersal"),
215 _("Overloaded Fusion Dispersal"),
217 _("F'lickta Glob Impact"),
218 _("Water Flick'ta Hit"),
219 _("Lava Flick'ta Hit"),
220 _("Flick'ta Lava Glob Impact"),
221 _("Flick'ta Claw Impact"),
223 _("Juggernaut Missile Contrail"),
224 _("Small Special Splash"),
225 _("Medium Special Splash"),
226 _("Large Special Splash"),
227 _("Special Emergence"),
229 _("Assimilated VacBob Hit"),
232 static const wxString itemNames[] = {
235 _("Magnum Magazine"),
239 _("Assault Rifle Clip"),
241 _("Missile Launcher"),
242 _("Missile Launcher Clip"),
243 _("Invisibility Powerup"),
244 _("Invincibility Powerup"),
245 _("Infravision Powerup"),
247 _("Alien Weapon Magazine"),
249 _("Flamethrower Canister"),
250 _("Extravision Powerup"),
253 _("Double Energy Powerup"),
254 _("Triple Energy Powerup"),
256 _("Shotgun Magazine"),
259 _("Light Blue Ball"),
271 static const wxString soundNames[] = {
276 _("Creak (Inf only)"),
283 _("Can't Toggle Switch"),
289 _("Destroy Control Panel"),
293 _("Bullet Ricochet"),
294 _("Metallic Ricochet"),
296 _("S'pht Door Opening"),
297 _("S'pht Door Closing"),
298 _("S'pht Door Obstructed"),
299 _("S'pht Platform Starting"),
300 _("S'pht Platform Stopping"),
302 _("SMG firing (Inf only)"),
303 _("SMG reloading (Inf only)"),
304 _("Heavy S'pht Platform Starting"),
305 _("Heavy S'pht Platform Stopping"),
308 _("Magnum Reloading"),
309 _("Assault Rifle Firing"),
310 _("Grenade Launcher Firing"),
311 _("Grenade Exploding"),
314 _("Fusion Exploding"),
316 _("Fusion Charging"),
317 _("Rocket Expoding"),
323 _("Bullet Hitting Flesh"),
324 _("Fighter Activate"),
327 _("Fighter Chatter"),
329 _("Fighter Projectile Hit"),
330 _("Fighter Projectile Flyby"),
334 _("S'pht Projectile Flyby"),
335 _("S'pht Projectile Hit"),
340 _("Cyborg Projectile Bounce"),
341 _("Cyborg Projectile Hit"),
344 _("Drone Start Attack"),
348 _("Drone Projectile Hit"),
349 _("Drone Projectile Flyby"),
354 _("Assimilated Human Chatter"),
355 _("Human Trash Talk"),
357 _("Human Activation"),
359 _("Human Stop Shooting Me You Bastard"),
360 _("Human Area Secure"),
361 _("Kill The Player!"),
373 _("Alien Harmonics (Inf only)"),
374 _("Heavy S'pht Platform"),
375 _("Light Machinery"),
376 _("Heavy Machinery"),
378 _("Sparking Transformer"),
380 _("Walking in Water"),
383 _("Small Water Splash"),
384 _("Medium Water Splash (unused)"),
385 _("Large Water Splash"),
386 _("Walking in Lava (unused)"),
389 _("Small Lava Splash"),
390 _("Medium Lava Splash (unused)"),
391 _("Large Lava Splash"),
392 _("Walking in Sewage (unused)"),
395 _("Small Sewage Splash"),
396 _("Medium Sewage Splash (unused)"),
397 _("Large Sewage Splash"),
398 _("Walking in Goo (unused)"),
399 _("Exit Goo (unused)"),
400 _("Enter Goo (unused)"),
401 _("Small Goo Splash (unused)"),
402 _("Medium Goo Splash (unused)"),
403 _("Large Goo Splash (unused)"),
404 _("Major Fusion Firing"),
405 _("Major Fusion Charged"),
406 _("Assault Rifle Reloading"),
407 _("Assault Rifle Shell Casings"),
409 _("Shotgun Reloading"),
414 _("Computer Logout"),
416 _("Heavy S'pht Door"),
417 _("Heavy S'pht Door Opening"),
418 _("Heavy S'pht Door Closing"),
419 _("Heavy S'pht Door Open"),
420 _("Heavy S'pht Door Closed"),
421 _("Heavy S'pht Door Obstructed"),
422 _("Hunter Activate (unused)"),
424 _("Hunter Dying (unused)"),
426 _("Hunter Exploding"),
427 _("Hunter Projectile Hit"),
428 _("Hunter Projectile Flyby"),
429 _("Enforcer Activate"),
430 _("Enforcer Attack"),
431 _("Enforcer Projectile Hit"),
432 _("Enforcer Projctile Flyby"),
433 _("F'lickta Melee Attack"),
434 _("F'lickta Melee Attack Hit"),
435 _("F'lickta Projectile Attack"),
436 _("F'lickta Sewage Attack Hit"),
437 _("F'lickta Sewage Flyby"),
438 _("F'lickta Lava Attack Hit"),
439 _("F'lickta Lava Flyby"),
442 _("Machine Bookpress"),
443 _("Machine Puncher"),
447 _("Surface Explosion"),
448 _("Underground Explosion"),
449 _("S'pht'Kr Attack"),
452 _("S'pht'Kr Being Hit"),
453 _("S'pht'Kr Exploding"),
459 _("Pfhor Platform Start"),
460 _("Pfhor Platform Stop"),
462 _("Pfhor Door Opening"),
463 _("Pfhor Door Closing"),
464 _("Pfhor Door Obstructed"),
466 _("Pfhor Switch Off"),
467 _("Pfhor Switch On"),
468 _("Juggernaut Firing"),
469 _("Juggernaut Warning"),
470 _("Juggernaut Exploding"),
471 _("Juggernaut Preparing to Fire"),
472 _("Enforcer Exploding"),
479 _("Assimilated VacBob Chatter"),
480 _("VacBob Trash Talk"),
482 _("VacBob Activation"),
484 _("VacBob Stop Shooting Me You Bastard"),
485 _("VacBob Area Secure"),
486 _("VacBob Kill The Player"),
489 static const wxString shotNames[] = {
493 _("Assault Rifle Bullet"),
496 _("Pfhor Projectile"),
499 _("Seeking S'pht Bolt"),
500 _("Alien Weapon Blast"),
502 _("Fusion Overload Bolt"),
508 _("Trooper Machine Gun"),
509 _("Trooper Grenade"),
511 _("Major S'pht'Kr Bolt"),
512 _("Juggernaut Missile"),
514 _("Major Energy Drain"),
517 _("Fast Drone Bolt"),
518 _("Possessed Drone Bolt"),
519 _("Bouncing Grenade"),
520 _("Seeking Grenade"),
522 _("Fusion Media Backblast"),
523 _("Fusion Overload Media Backblast"),
524 _("Fusion Overload Self-Destruct"),
527 _("Flick'ta Lava Glob"),
531 static const wxString weaponNames[] = {
536 _("Missile Launcher"),
544 DefaultNames* DefaultNames::mInstance;
546 DefaultNames::DefaultNames()
548 for (int i = 0; i < 47; ++i) {
549 mMap[wxT("alien")][i] = alienNames[i];
552 for (int i = 0; i < 16; ++i) {
553 mMap[wxT("class")][i] = classNames[i];
556 for (int i = 0; i < 32; ++i) {
557 mMap[wxT("collection")][i] = collectionNames[i];
560 for (int i = 0; i < 24; ++i) {
561 mMap[wxT("damage")][i] = damageNames[i];
564 for (int i = 0; i < 73; ++i) {
565 mMap[wxT("effect")][i] = effectNames[i];
568 for (int i = 0; i < 36; ++i) {
569 mMap[wxT("item")][i] = itemNames[i];
572 for (int i = 0; i < 215; ++i) {
573 mMap[wxT("sound")][i] = soundNames[i];
576 for (int i = 0; i < 39; ++i) {
577 mMap[wxT("shot")][i] = shotNames[i];
580 for (int i = 0; i < 10; ++i) {
581 mMap[wxT("weapon")][i] = weaponNames[i];
584 wxTextFile namesFile(wxStandardPaths::Get().GetResourcesDir() + wxT("/DefaultNames.txt"));
586 if (namesFile.Exists()) {
587 if (namesFile.Open()) {
588 for (wxString str = namesFile.GetFirstLine(); !namesFile.Eof(); str = namesFile.GetNextLine()) {
596 // parse into three tokens
597 wxStringTokenizer tokenizer(str);
598 if (tokenizer.CountTokens() >= 3) {
599 wxString key = tokenizer.GetNextToken();
600 wxString indexStr = tokenizer.GetNextToken();
601 wxString value = tokenizer.GetString();
604 if (!indexStr.ToLong(&index)) {
608 mMap[key][index] = value;
617 wxString DefaultNames::Get(const wxString& set, int index)
619 std::map<wxString, std::map<int, wxString> >::const_iterator it = mMap.find(set);
620 if (it != mMap.end()) {
621 std::map<int, wxString>::const_iterator kvp = it->second.find(index);
622 if (kvp != it->second.end()) {
630 return set + wxString::Format(wxT(" %i"), index);
634 std::vector<wxString> DefaultNames::GetArray(const wxString& set)
636 std::vector<wxString> v;
638 int size = mMap[set].rbegin()->first + 1;
642 for (int i = 0; i < size; ++i) {
643 v[i] = GetName(set, i);