MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DumpLevelGoals

Function DumpLevelGoals

editor/MainFrm.cpp:3559–3637  ·  view source on GitHub ↗

Writes the level goal text to a file for localization

Source from the content-addressed store, hash-verified

3557#include "levelgoal.h"
3558
3559// Writes the level goal text to a file for localization
3560void DumpLevelGoals(char *outname, char *levelname) {
3561 int n_goals = Level_goals.GetNumGoals();
3562 char buf[1000];
3563 CFILE *ofile;
3564
3565 ofile = cfopen(outname, "wt");
3566
3567 if (!ofile)
3568 return;
3569
3570 cfprintf(ofile, "!/!Level strings for %s\n\n", levelname);
3571
3572 cfprintf(ofile, "!/!Notes on Localizing This File\n");
3573 cfprintf(ofile, "!/!\n");
3574 cfprintf(ofile, "!/!Line Tokens:\n");
3575 cfprintf(ofile, "!/!\n");
3576 cfprintf(ofile, "!/! Each non-blank line begins with one of the following tokens that\n");
3577 cfprintf(ofile, "!/! identifies it as either a comment or a string in a particular\n");
3578 cfprintf(ofile, "!/! language:\n");
3579 cfprintf(ofile, "!/!\n");
3580 cfprintf(ofile, "!/! !/! = comment (optional)\n");
3581 cfprintf(ofile, "!/! !=! = English version of string\n");
3582 cfprintf(ofile, "!/! !G! = German version of string\n");
3583 cfprintf(ofile, "!/! !S! = Spanish version of string\n");
3584 cfprintf(ofile, "!/! !I! = Italian version of string\n");
3585 cfprintf(ofile, "!/! !F! = French version of string\n");
3586 cfprintf(ofile, "!/!\n");
3587 cfprintf(ofile, "!/!Rules:\n");
3588 cfprintf(ofile, "!/!\n");
3589 cfprintf(ofile, "!/! 1. There must be an English version of each string.\n");
3590 cfprintf(ofile, "!/!\n");
3591 cfprintf(ofile, "!/! 2. All text when translated should stay very near the\n");
3592 cfprintf(ofile, "!/! length of the English version, unless otherwise noted.\n");
3593 cfprintf(ofile, "!/!\n");
3594 cfprintf(ofile, "!/! 3. The maximum length of any line is 1024 characters.\n");
3595 cfprintf(ofile, "!/!\n");
3596 cfprintf(ofile, "!/! 4. All %%s,%%d,%%f and similar tokens MUST stay in the string.\n");
3597 cfprintf(ofile, "!/! In the game, these tokens will be replaced by:\n");
3598 cfprintf(ofile, "!/!\n");
3599 cfprintf(ofile, "!/! %%s = another string\n");
3600 cfprintf(ofile, "!/! %%d = an integer number\n");
3601 cfprintf(ofile, "!/! %%f = a floating point number (a number with a decimal point)\n");
3602 cfprintf(ofile, "!/!\n");
3603 cfprintf(ofile, "!/! These tokens MUST stay in the same relative order (i.e. in the\n");
3604 cfprintf(ofile, "!/! string \"%%s got %%d points\" the %%s must always come before the %%d).\n");
3605 cfprintf(ofile, "!/!\n");
3606 cfprintf(ofile, "!/!Special Characters:\n");
3607 cfprintf(ofile, "!/!\n");
3608 cfprintf(ofile, "!/! Special characters can be inserted in strings with the following tokens:\n");
3609 cfprintf(ofile, "!/!\n");
3610 cfprintf(ofile, "!/! \\t = tab\n");
3611 cfprintf(ofile, "!/! \\n = newline\n");
3612 cfprintf(ofile, "!/! \\0 - \\255 = specific ASCII character\n");
3613 cfprintf(ofile, "\n\n");
3614
3615 for (int i = 0; i < n_goals; i++) {
3616

Callers 1

OnFileSaveGoalTextMethod · 0.85

Calls 7

cfopenFunction · 0.85
cfprintfFunction · 0.85
cfcloseFunction · 0.85
GetNumGoalsMethod · 0.80
GoalGetNameMethod · 0.80
GoalGetItemNameMethod · 0.80
GoalGetDescMethod · 0.80

Tested by

no test coverage detected