Jump to content
The Dark Mod Forums

My patches and contribution


Tels

Recommended Posts

Moin,

 

since I no longer have SVN access, here are some patches and contributions for TDM. Hope this proves useful.

 

The post will be updated when things get either updated or commited. The source code diffs will be in unified form, and should apply cleanly. For the rest of the files, I'm unable to produce diffs, but hopefully merging the files is not too difficult.

 

If there are any questions or comments, feel free to post in this thread.

 

------------------------------

  • Patch A (2014-09-01, comitted by SteveL 2014-09-01) http://swift-mazes.com/pub/tdm-patches/tels_patch_a_2014-09-01.txt
  • Description: Make TDM compile on Linux again. The TDM source uses true/false (lowercase) throughout, with a few libs as an exception. MSVC seem also to understand TRUE/FALSE, but lets keep the lower version for consistency.
  • Files: game/ai/Tasks/ResolveMovementBlockTask.cpp game/ai/AI.h game/Actor.cpp

------------------------------

  • German update (2014-08-08)
  • Description: Updates the German translation
  • Files: all.lang (The file german.lang is included just for reference, it should be regenerated by the script)
  • Size: 183 K
  • URL: http://swift-mazes.c..._2014-08-08.zip

  • Add Swedish (2014-09-01)
  • Description: Adds Swedish as an Menu Option
  • Files: strings/all.lang, strings/swedish.map, guis/mainmenu_settings_language.gui (The file swedish.lang is included just for reference, it should be regenerated by the script. all.lang is after the German update above)
  • Size: 187 K
  • URL: http://swift-mazes.c..._2014-09-01.zip

Edited by Tels
  • Like 3

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

What exactly got updated in the german translation (Patch 3)?

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

What exactly got updated in the german translation (Patch 3)?

 

Here is the diff:

 

 

 

-	   "#str_02171"	"Zum Download markieren >> "
+	   "#str_02171"	"Zum Download vormerken >> "
	"#str_02172"	"Titel:"
	"#str_02173"	"Autor:"
	"#str_02174"	"Datum:"
@@ -1840,6 +1840,8 @@
	"#str_02511"	"Nicht möglich"
	"#str_02512"	"Noch nicht"
	"#str_02513"	"Ja (%s)"
+	   // Mission downloader extra legends
+	   "#str_02514"	"# Übersetzung"

	"#str_02911"	"Unbekannt"
	"#str_02916"	"Spiel gespeichert..."
@@ -1986,6 +1988,8 @@
	"#str_07320"	" in Gold"									  // Pickup message part
	"#str_07321"	" in Waren"									 // Pickup message part
	"#str_07322"	" in Juwelen"								   // Pickup message part
+	   "#str_07323"	"Halb blind;Normal;Schwer schwer"			   // AI Vision
+	   "#str_07324"	"Halb taub;Normal;Schwer;Sehr schwer"		   // AI Hearing

	// Monster names
	"#str_08000"	"Erdelementar"
@@ -2491,10 +2495,10 @@
	"#str_10051"	"Schmieden-Schlüssel"
	"#str_10052"	"Schlüssel des Hauptmanns"
	"#str_10053"	"Kellerhof-Schlüssel"
-	   "#str_10054"	"Schlüssel für\nZellblock A Key"
-	   "#str_10055"	"Schlüssel für\nZellblock B Key"
-	   "#str_10056"	"Schlüssel für\nZellblock C Key"
-	   "#str_10057"	"Schlüssel für\nZellblock 1 Key"
+	   "#str_10054"	"Schlüssel für\nZellblock A"
+	   "#str_10055"	"Schlüssel für\nZellblock B"
+	   "#str_10056"	"Schlüssel für\nZellblock C"
+	   "#str_10057"	"Schlüssel für\nZellblock 1"
	"#str_10058"	"Schlüssel für\nZellblock 2"
	"#str_10059"	"Zell-Schlüssel"
	"#str_10060"	"Zellen-Schlüssel"
@@ -2597,7 +2601,7 @@
	"#str_10157"	"Ein alter\nSchlüssel"
	"#str_10158"	"Ein alter\nKanalschlüssel"
	"#str_10159"	"Eisenschlüssel"
-	   "#str_10160"	"Schmutziger\nKey"
+	   "#str_10160"	"Schmutziger\nSchlüssel"

 

 

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

@Tels: does the all.lang in the Swedish update include the German updates too?

 

Update: tracked (3837) and committed (6096) A & B. I'll wait for you to confirm what to do with the language pack.

 

Thank you for the commits.

 

The all.lang from A is only the German fixes, B contains German + Swedish -it is just a section at the bottom - the menu entries for "Swedish" are already in TDM as of 2.02.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Thank you for the commits. The all.lang from A is only the German fixes, B contains German + Swedish -it is just a section at the bottom - the menu entries for "Swedish" are already in TDM as of 2.02.

 

Sorry, bit more clarity needed. Those are files, not patches. Do I have to merge them somehow before committing them, or does the all.lang from B include the changes to the all.lang from A?

Link to comment
Share on other sites

Sorry, bit more clarity needed. Those are files, not patches. Do I have to merge them somehow before committing them, or does the all.lang from B include the changes to the all.lang from A?

 

Yes, B does include A.

 

Sorry, but I can't really do patches, as I have no access to the current main SVN - only the v2.02 release.(and I'm not sure if diff handles UTF-8 and ISO-8859-1 correclty).

 

But what you could try is copy the new file over the old on in SVN, then do "SVN diff". That should show you the changes, and these should only be a few lines. If suddently the entire file changes, something is borked :)

 

The files "german.lang", "swedish.lang" are generated by a script (unless that was changed in the last year). The script is under devel/i18n/ IIRC. It might be that this script needs swedish being added as language so it knows to generte swedish.lang.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Yes, B does include A.

 

Sorry, but I can't really do patches,

Thanks, that's what I needed to know (B includes A).

 

Happy to report that your code patches worked flawlessly :) I was talking about the all.lang files when I said "they're not patches".

 

Sorry for not making myself clearer.

Link to comment
Share on other sites

Thanks, that's what I needed to know (B includes A).

 

Happy to report that your code patches worked flawlessly :) I was talking about the all.lang files when I said "they're not patches".

 

Sorry for not making myself clearer.

 

No problem, I understood it this way and was also talking about the .lang files. :) Thanx again!

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

"#str_07323" "Halb blind;Normal;Schwer schwer" 

This looks like a mistake. I guess it should be

"#str_07323" "Halb blind;Normal;Schwer;Sehr schwer"

guessing from how the line for ai hearing looks like.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

"#str_07323" "Halb blind;Normal;Schwer schwer"

This looks like a mistake. I guess it should be

"#str_07323" "Halb blind;Normal;Schwer;Sehr schwer"

guessing from how the line for ai hearing looks like.

 

You are right. Please correct it after putting the change in.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

I've attached one patch and a testmap to http://bugs.thedarkm...iew.php?id=3823 - this adds the spawnargs "wait", "pass_self" and "pass_activator" to trigger_touch, so it is possible to rate-limit the calling frequency of the function, as well as get both the trigger and the activating entity in the call at the same time.

 

Edit: Updated the patches (wait can be negative, so took the checks out again) and added a third patch documenting the new spawnargs and one old: http://swift-mazes.c..._2014-09-08.txt

Edited by Tels

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

I'm having some crashing problems testing the language patch, so I've not committed anything. I'll zip up and PM you the existing svn files + the details in the hope you'll be able to see why. I don't know the i18n system.

 

Steve, as written in the PM, do the crashes occur only because the "swedish.lang" file is missing? Generating this file with the command should fix it then - finding the crash is a seperate issue from the update then.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Here is another patch, repairing the linux build again. (In Linux, "ai/" and "AI/" are two different directories):

 

http://swift-mazes.com/pub/tdm-patches/tels_patch_f_linux_build_2014-09-08.txt

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

And here is another patch, this one adds the following script events to the sys object:

 

sys.strReplace( string input, string find, string replacewith );
sys.strRemove( string input, string find );
pos = sys.strFind( string input, string find, bool casesensitive, int start, int end);
sys.strToBool( string );

 

Includes documentation.

 

Here is an example:

 

string test = "this is a test for a test";
sys.println("1: " + test);
string test1 = sys.strReplace(test, "test", "foo");
sys.println("2: " + test1);
string test2 = sys.strReplace(test1, "foo", "");
sys.println("3: " + test2);
string test3 = sys.strRemove(test2, " a ");
sys.println("4: " + test3);
float rc = sys.strFind(test3, "IS", 1,0,-1);
sys.println("rc: " + rc);
rc = sys.strFind(test3, "IS", 0,0,-1);
sys.println("rc: " + rc);
rc = sys.strFind(test3, " is ", 0,3,-1);
sys.println("rc: " + rc);

sys.println("expect 1:");
sys.println("strToBool(1): " + sys.strToBool("1"));
sys.println("strToBool(on): " + sys.strToBool("on"));
sys.println("strToBool(On): " + sys.strToBool("On"));
sys.println("strToBool(ON): " + sys.strToBool("ON"));
sys.println("strToBool(true): " + sys.strToBool("true"));
sys.println("strToBool(yes): " + sys.strToBool("yes"));
sys.println("strToBool(enabled): " + sys.strToBool("enabled"));

sys.println(""); sys.println("expect 0:");
sys.println("strToBool(false): " + sys.strToBool("false"));
sys.println("strToBool(off): " + sys.strToBool("off"));
sys.println("strToBool(0): " + sys.strToBool("0"));
sys.println("strToBool(no): " + sys.strToBool("no"));
sys.println("strToBool(disabled): " + sys.strToBool("disabled"));

sys.println(""); sys.println("expect -1:");
sys.println("strToBool(2): " + sys.strToBool("2"));
sys.println("strToBool(close): " + sys.strToBool("close"));
sys.println("strToBool(): " + sys.strToBool(""));

 

It will print on the console:

 

1: this is a test for a test
2: this is a foo for a foo
3: this is a  for a
4: this is for
rc: -1
rc: 2
rc: 4
expect 1:
strToBool(1): 1
strToBool(on): 1
strToBool(On): 1
strToBool(ON): 1
strToBool(true): 1
strToBool(yes): 1
strToBool(enabled): 1

expect 0:
strToBool(false): 0
strToBool(off): 0
strToBool(0): 0
strToBool(no): 0
strToBool(disabled): 0

expect -1:
strToBool(2): -1
strToBool(close): -1
strToBool(): -1

 

http://swift-mazes.com/pub/tdm-patches/tels_patch_g_script_string_events_2014-09-12.txt

 

One thing that this patch does not fix is the state of "boolean" and "int" in scripts. This is currently somewhat of a mess.

 

The script supports "bool variablename = true", but it seems the script compiler and the script event definitions do not yet support 'b'. There are other oddities like:

  • floats are 'f', but integers are 'd' instead of 'i'. ("d" reminds one of double, not integer. And there is no "d" in inteher :)
  • ReturnInt() says true integers are not supported and stores the return value in the float part - but variableDefs do contain an IntPtr. Adding true integer variable to the script compiler/interpreter would be nice, so you can actualy say "int variableName = 1".
  • In the same vain, ReturnBool() did not exist. So I added it, but it is currently unused, because it is not clear where the bool should be stored - IntPtr or FloatPtr? And a lot of script events that return a boolean have 'd', while others have 'f'. That should be fixed so that the correct return type is used according to function description, and both ReturnInt() and ReturnBool() do what they are supposed to do. Right now, all three ReturnXYZ() store the return value in the float part, so int,bool and float are all interchangable and are used differently all over the place.

That is for another day, tho.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Whatever you're thinking of doing in that space, the result has to support the previous syntax.

 

Otherwise we'll have a problem with mission scripts and potentially anything in TDM's scripts that uses the old syntax.

 

Of course. However, there would be only two visible changes to scripts:

 

* the keyword "int" (or "integer") for variable types. This can't really clash with existing scripts, because "int foo = 1;" is not valid yet.

* the return types of script events might change from int to float - again, this will not impact existing scripts, as these use "float foo = sys.someFunc()" and if someFunc now returns an int 1 instead of float 1.0, this will silently be converted to float again.

 

The other two changes 'i' instead of 'd', and support for boolean as return values would not be visible to scripts again,as scripts either already use "bool b = sys.someFunc()", or they use "float b = sys.someFunc()" and get back 1 or 0, anyway.

 

A real patch with the changes to try would show if it works. But since it is a lot of work, I'd rather not start the work if nobody actually sees value in that.

 

That is why the current patch only adds non-controversial functions that are of value to mappers, but don't risk anything breaking.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

I'm not convinced by strToBool and ReturnBool, given that the scripting language doesn't support a true boolean. The current situation isn't confusing imo -- all numbers are floats, and floats are used as bools too. The current script event strToFloat does the useful part of the strToBool job. Anyone touching the scripts will always recognise that 1=true, 0=false, but for any other mappings, surely it's better that scripts spell out the meaning right where they use it?

 

The other problem with the proposal is the list of keywords that get interpreted as bools. Presumably they'd be hard-coded in game code. I fear that'll make for much more confusing scripts. If people want to use keywords they can #define them in their own script headers, where the definitions will be easy to find for anyone reading the script. If you map a dozen magic words to true and false in the game code, it just means people have to look them up. No-one will remember that "off" maps to 0 but "close" maps to -1. I'm finding it a bit confusing already. Is it that -1 is supposed to represent a NULL boolean, neither true nor false? And that "close" is an example of an unmapped keyword?

 

strFind and strReplace look useful. There's currently no easy and efficient way to do those things.

Link to comment
Share on other sites

I'm not convinced by strToBool and ReturnBool, given that the scripting language doesn't support a true boolean.

 

What the scripting language does syntax wise,and how it is implemented internally are two different things. Actually, the scripting language does support bool:

 

bool foo = true;
if (foo)
 {
 // do something
 }

 

And there is also support for "spawnargs.getBoolKey()" and so on.

 

It is just that the code in C++ is incomplete and not finished. F.i. there is "ReturnInt()" and as a coder it is quite confusing if there isn't a "ReturnBool()", too. The interface is just incomplete. And my patch is one step of making it more complete.

 

I can take that part out, if you wish.

 

The current situation isn't confusing imo -- all numbers are floats, and floats are used as bools too. The current script event strToFloat does the useful part of the strToBool job. Anyone touching the scripts will always recognise that 1=true, 0=false, but for any other mappings, surely it's better that scripts spell out the meaning right where they use it?

 

Actually, the interface already supports ReturnInt() - it just stuffs the result into a float - but that is merely a "TODO", "FIXME" etc item. The current code comments even talk in some cases about things that are no longer true.

 

ReturnBool() is just the first step at unifying the interface. (Edit: And it reads and looks much more cleaner to use ReturnBool( true ) as ReturnFloat( 1.0f ) - the same reason we have ReturnInt( 1 ). Convience for the coder. End of edit.)

 

The other problem with the proposal is the list of keywords that get interpreted as bools. Presumably they'd be hard-coded in game code. I fear that'll make for much more confusing scripts. If people want to use keywords they can #define them in their own script headers, where the definitions will be easy to find for anyone reading the script. If you map a dozen magic words to true and false in the game code, it just means people have to look them up. No-one will remember that "off" maps to 0 but "close" maps to -1. I'm finding it a bit confusing already. Is it that -1 is supposed to represent a NULL boolean, neither true nor false? And that "close" is an example of an unmapped keyword?

 

I knew someone would object to the list of keywords. We already have such a sitatuion with "-" and "" - both are used as "don't use" but the code not always recognises "-" as empty.

 

As for "strToBool()", well, the current getBoolKey() is incomplete, too. It only supports "1" and "0". But sometimes people might "true" in spawnargs, or options. Parsing such values in the scripting language is very cumbersome and slow (multiple passes between scripting and C++).

 

But I can take it out, if you wish. Emulating it in script will be deadslow, but possible.

 

strFind and strReplace look useful. There's currently no easy and efficient way to do those things.

Edited by Tels

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Patch updated and StrToBool() and ReturnBool() removed.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • nbohr1more

      New texture wiki article created: https://wiki.thedarkmod.com/index.php?title=Creating_textures_from_Ornate_Photos
      · 0 replies
    • Xolvix

      Took a break from TDM until I got my backlog under control. It's been months and it's still not "under control". Damnit.
      · 1 reply
    • Ansome

      I sleep well at night knowing the player will never see the absolute nightmare that is my sealing brushwork outside the playable area. Only the pointfile can judge me now.
      · 4 replies
    • JackFarmer

      Somehow I admire the fact that the material from Dune has now been filmed for the third time. Personally, I could never do much with the material, but as a child of the 80s, I of course know the David Lynch movie...and that movie was at least funny!
      · 2 replies
    • Baal

      Episode 3 of the second best Doom 3 mod, Phobos,  was just released.
      · 6 replies
×
×
  • Create New...