The "How do I..." Thread

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

Re: The "How do I..." Thread

Post by D2JK »

I have a projectile that spawns blue sparks behind it, using A_SpawnItemEx and SXF_TRANSFERTRANSLATION (the untranslated spark sprites are yellow). Does it make sense that ZDoom is able to apply the translation correctly, while GzDoom isn't, leaving the sparks yellow? Should I report a bug, or is there something I should first try? The sprite is converted to "PNG (paletted)" in Slade.
User avatar
phantombeta
Posts: 2166
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: The "How do I..." Thread

Post by phantombeta »

Is the palette being used by the PNG the Doom palette? If not, I think that might be messing it up.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: The "How do I..." Thread

Post by edward850 »

It logically has to be (in ZDoom anyway, GZDoom may not be doing any conversions, making translation impossible), but the problem is PNGs need to have their palettes translated, and even with the exact same colours the index is not guaranteed to come out the same way.

If you want to use translation, it is highly recommended that you use the doom sprite format, where you have a guarantee which colour indexes are used.
Revanic
Posts: 9
Joined: Sun Jan 25, 2015 7:39 am

Re: The "How do I..." Thread

Post by Revanic »

First time posting here, I was wondering on how I would go about creating a new game with ZDoom? I already understand all the DECORATE stuff, but it seems I have no other choice but to modify the zdoom.pk3 for my own playerclass, mapinfo, and iwadinfo...
User avatar
phantombeta
Posts: 2166
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: The "How do I..." Thread

Post by phantombeta »

Uhh... No.
PK3 files are just renamed zips, so if you can edit one, you can make them without editing zdoom.pk3.
And you don't need IWADINFO. It's not required. That's just so ZDoom can find it automatically for the list. You can use any WAD with the -iwad parameter... Well, almost any. It needs to have a PLAYPAL/palette.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: The "How do I..." Thread

Post by edward850 »

Revanic wrote:but it seems I have no other choice but to modify the zdoom.pk3
Absolutely never modify ZDoom.pk3.
User avatar
phantombeta
Posts: 2166
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: The "How do I..." Thread

Post by phantombeta »

I think ZDoom should check against a stored MD5 hash to make sure it isn't edited. If it is, don't let the game start, with the message "Do not edit the zdoom.pk3 file."
Revanic
Posts: 9
Joined: Sun Jan 25, 2015 7:39 am

Re: The "How do I..." Thread

Post by Revanic »

Then a modding tutorial lied to me. Whoops. Alright then, look dumb now to look smart later I guess.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: The "How do I..." Thread

Post by Matt »

Can you post a link to this tutorial that tells you to mod zdoom.pk3? I think we need to call down the Spanish Inquisition on them.
Revanic
Posts: 9
Joined: Sun Jan 25, 2015 7:39 am

Re: The "How do I..." Thread

Post by Revanic »

Well, more specifically it was a GZDoom modding tutorial. Though I would believe it would still apply to not actually modify the gzdoom.pk3 either. I also just realized it was posted on April 1st. Perhaps I am just [censored word]? ._.

www.lofibucket.com/articles/modding_doom.html
User avatar
Coincident
Posts: 85
Joined: Fri Aug 22, 2014 8:38 am
Location: Portugal

Re: The "How do I..." Thread

Post by Coincident »

I'm trying to pass a fixed point decimal from Decorate to an ACS call:

decorate

Code: Select all

		Pickup:
			TNT1 A 0 ACS_NamedExecuteAlways("testDecimal", 0, 121.5)
			Stop

ACS

Code: Select all

script "testDecimal" (int decimal) {
	printBold(f: decimal);
}
This prints 0.0000something


ACS

Code: Select all

script "testDecimal" (int decimal) {
	printBold(d: decimal);
}
This prints 121.

Is this behaviour normal? How do I pass a fixed point as argument to an ACS call?
Revanic
Posts: 9
Joined: Sun Jan 25, 2015 7:39 am

Re: The "How do I..." Thread

Post by Revanic »

Ints don't like decimals. You'll have to use a fixed_t, I believe, instead. ZDoom handles fixed_t's as floats and only floats give you the decimal place. As for printing it, I have no idea since I haven't tried ACS yet. Hopefully I'm not wrong this time. xD
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: The "How do I..." Thread

Post by cocka »

121.5
Try 7962624 instead. :lol:
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: The "How do I..." Thread

Post by edward850 »

Revanic wrote:Ints don't like decimals. You'll have to use a fixed_t, I believe, instead. ZDoom handles fixed_t's as floats and only floats give you the decimal place. As for printing it, I have no idea since I haven't tried ACS yet. Hopefully I'm not wrong this time. xD
Nothing in this post is correct.
cocka wrote:Try 7962624 instead. :lol:
Nothing in this post is remotely helpful.
Coincident wrote:I'm trying to pass a fixed point decimal from Decorate to an ACS call
Decorate has to truncate the decimal to pass a valid result to ACS, which doesn't have floating point values. There is a very functional solution to this, though, which can be used simply by remembering the basic rules of fixed point integers.
In ZDoom, fixed point is 16.16, so 16 whole bits and 16 fractional. 1. is thus the 17th bit (1 << 16), making it an integer of 65536. Visually, this:
Image
So this makes our magic number 65536. If we multiply any decimal (float/double) with this number, we get its 16.16 fixed point equivalent. Infact, you can just chuck that into decorate, like so:

Code: Select all

ACS_NamedExecuteAlways("testDecimal", 0, 121.5*65536)
This will pass the result of 7962624 to ACS, which you can then treat as a real fixed point number.
Image

Code: Select all

script "testDecimal" (int decimal)
{
   printBold(f: decimal);
}
As you can see, nothing changes in the script you wrote up. The "f:" marker will tell PrintBold that, instead of treating the number as a literal integer, that it's a fixed point number and to print it like that instead.
User avatar
Coincident
Posts: 85
Joined: Fri Aug 22, 2014 8:38 am
Location: Portugal

Re: The "How do I..." Thread

Post by Coincident »

Yeah, soon after I posted I realized that my question was quite sily: especially because ACS_NamedExecute takes INTs for arguments, unlike other action functions...
So, I have to multiply x 65536 (shift << 16) every decimal I have in decorate, to be able to pass them as a proper fixed point int.

Once again, thanks edward for the thorough response. :)

PS - a small follow-up question: is it possible to have custom decorate functions?
I already had this is ACS, but I wanted the same for Decorate:

Code: Select all

function int toDecimal(int someInt) {
	return someInt * 65536;
}
The goal is to have "cleaner" code in decorate:

Code: Select all

Pickup:
         TNT1 A 0 ACS_NamedExecuteAlways("testDecimal", 0, toDecimal(121.5))
         Stop
Last edited by Coincident on Mon Feb 02, 2015 5:18 pm, edited 1 time in total.
Locked

Return to “Editing (Archive)”