GDCC: An Alternative ACS Compiler [0.15.0]

Any utility that assists in the creation of mods, assets, etc, go here.
Forum rules
The Projects forums are ONLY for YOUR PROJECTS! If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.

Re: GDCC: An Alternative ACS Compiler

Postby luckyp3616 » Tue Sep 29, 2015 7:06 pm

Hi, I am new here and I would like to let you know of a problem when trying to build this in Linux with GCC.

This error comes up:
Code: Select allExpand view
In file included from /root/src/GDCC.git/inc/CPP/../CPP/PragmaDTBuf.hpp:17:0,
                 from /root/src/GDCC.git/inc/CPP/TStream.hpp:23,
                 from /root/src/GDCC.git/src/CPP/IncludeDTBuf.cpp:16:
/root/src/GDCC.git/inc/CPP/../CPP/../CPP/Pragma.hpp: In constructor ‘GDCC::CPP::PragmaParserACS::PragmaParserACS(GDCC::CPP::PragmaData&)’:
/root/src/GDCC.git/inc/CPP/../CPP/../CPP/Pragma.hpp:119:57: error: invalid initialization of non-const reference of type ‘GDCC::CPP::PragmaData&’ from an rvalue of type ‘<brace-enclosed initializer list>’
          PragmaParserACS(PragmaData &data_) : data{data_} {}
                                                         ^


I did some googling and people mention that this happens because MSVC accepts the non-const reference as a Microsoft extension. I just want you to know about this issue with compiling on Linux.

Thanks in advance.
luckyp3616
 
Joined: 29 Sep 2015

Re: GDCC: An Alternative ACS Compiler

Postby DavidPH » Wed Sep 30, 2015 2:25 pm

I am reasonably confident that is a bug in gcc. I doubt the standard is intended to prohibit conversion from a reference type to the same reference type in a member initializer. And gcc was apparently fixed in some version, since I use mingw-w64 (5.2.0) for cross-compiling to Windows. I primarily use clang for compiling, though, so you should be able to use that until your distribution updates gcc. If clang is not an option (or does not work for other reasons), you can make it compile in gcc by changing the {} reference member initializers to use ().

Incidentally, if anyone with access to Windows and MSVC would like to confirm or deny that GDCC does or does not compile in that, I would be interested in knowing.
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

Re: GDCC: An Alternative ACS Compiler

Postby luckyp3616 » Wed Sep 30, 2015 3:55 pm

OK, then GCC didn't impement it in 4.8.5. I'll have to add ~amd64 keyword to my Gentoo package.accept_keywords, because the stable GCC in that distro must be out of date.

I try it, and see.

P.S.: So GCC is up to 5.2? Wow!

EDIT: I updated GCC to 4.9.3 and then another error happened, which was fixed by updating the GMP library.
Sure enough, updating GCC and GMP fixed it.
luckyp3616
 
Joined: 29 Sep 2015

Re: GDCC: An Alternative ACS Compiler

Postby hjalg » Fri Nov 06, 2015 4:05 pm

Hmm. Looks like SetActorProperty accepts only numbers. For example, i can't set
Code: Select allExpand view
SetActorProperty(0,APROP_Species,"TEST")
, i got "cannot implicitl y convert to arithmetic type from non-arithmetic type" error instead.
User avatar
hjalg
 
Joined: 02 Nov 2012

Re: GDCC: An Alternative ACS Compiler

Postby DavidPH » Fri Nov 06, 2015 7:04 pm

You will need to use SetActorPropertyString for that. gdcc-acc inherits the implicit conversion rules from C, still. It is something I intend to fix eventually, but it is nontrivial and a low priority.
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

Re: GDCC: An Alternative ACS Compiler

Postby hjalg » Sat Nov 07, 2015 1:50 am

DavidPH wrote:You will need to use SetActorPropertyString for that

Alright, thank you. Would be nice if you update your first post with such unusual functions, to let others know about them.
User avatar
hjalg
 
Joined: 02 Nov 2012

Re: GDCC: An Alternative ACS Compiler

Postby hjalg » Sat Nov 07, 2015 3:46 am

Two more bugs:
1. Thing_Move doesn't return a boolean value, e.g.
Code: Select allExpand view
if (Thing_Move(0,TID,1))

will return "expected scalar type"

2. SetPlayerLivesLeft accepts only one argument, must be two: http://wiki.zandronum.com/SetPlayerLivesLeft
User avatar
hjalg
 
Joined: 02 Nov 2012

Re: GDCC: An Alternative ACS Compiler

Postby DavidPH » Sat Nov 07, 2015 6:35 am

Thing_Move (and other line specials) now correctly return an int. SetPlayerLivesLeft, however, already takes two arguments.

Additionally, since the ACS front is relatively usable now (but still with some caveats, as seen), I have updated the first post with information on it.
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

Re: GDCC: An Alternative ACS Compiler

Postby hjalg » Sat Nov 07, 2015 7:16 am

DavidPH wrote:Thing_Move (and other line specials) now correctly return an int...
Additionally, since the ACS front is relatively usable now (but still with some caveats, as seen), I have updated the first post with information on it.

Thanks!
DavidPH wrote:SetPlayerLivesLeft, however, already takes two arguments.

Weird. I got "too many arguments" when i use
Code: Select allExpand view
SetPlayerLivesLeft(number,10);

It works only if i change
Code: Select allExpand view
int   -105:SetPlayerLivesLeft(2, int),
to
Code: Select allExpand view
int   -105:SetPlayerLivesLeft(2, int, int),
Old version maybe? I use gdcc_v0.7.0-95-g848517c_win64
Last edited by hjalg on Sun Nov 08, 2015 3:35 am, edited 1 time in total.
User avatar
hjalg
 
Joined: 02 Nov 2012

Re: GDCC: An Alternative ACS Compiler

Postby DavidPH » Sat Nov 07, 2015 8:13 am

hjalg wrote:
Code: Select allExpand view
int   -105:SetPlayerLivesLeft(2, int),

Oops. Somehow I saw the 2 for minimum args and overlooked the lack of actual args. This has been fixed and a new build will be up shortly.
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

Re: GDCC: An Alternative ACS Compiler

Postby hjalg » Sat Nov 07, 2015 8:22 am

Thanks! Also, check ConsoleCommand please, because something wrong with it. If script contains this function, it compiles without any errors. But in game i have "Unknown P-Code in script scriptnumber" error in console, and all code after ConsoleCommand doesn't execute.
User avatar
hjalg
 
Joined: 02 Nov 2012

Re: GDCC: An Alternative ACS Compiler

Postby DavidPH » Sat Nov 07, 2015 9:03 am

ZDoom itself does not implement the ConsoleCommand instruction, and will issue that very error if it is used.
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

Re: GDCC: An Alternative ACS Compiler

Postby hjalg » Sat Nov 07, 2015 9:48 am

DavidPH wrote:ZDoom itself does not implement the ConsoleCommand instruction, and will issue that very error if it is used.

Yes, but it's still widely used in Zandronum, i thought GDCC is fully compatible with this port. Is it hard to implement it for Zan? And how can i do this?
User avatar
hjalg
 
Joined: 02 Nov 2012

Re: GDCC: An Alternative ACS Compiler

Postby Gez » Sat Nov 07, 2015 9:56 am

Well then you have to precise that the "unknown P-code" error is from Zandronum, not from ZDoom. It's probably just a #define that's wrong so ConsoleCommand is given a bad P-code.
Gez
 
 
 
Joined: 06 Jul 2007

Re: GDCC: An Alternative ACS Compiler

Postby DavidPH » Sat Nov 07, 2015 3:56 pm

As it turns out, one of the many terrible things about ConsoleCommand is that the instruction pair (stack argument and immediate argument) is in the reverse order compared to every other such instruction pair. The declarations have been fixed accordingly.

EDIT: As for the question of how to declare new pcode-based functions with gdcc-acc:
Code: Select allExpand view
special ReturnType {PCodeNumber}:FunctionName(Arguments);

As in:
Code: Select allExpand view
special void {94}:SectorSound(str sound, int volume);
special int {57, 58}:Random(int, int);

Note that the second pcode is for the immediate argument (const:) version, if any. Also note that gdcc-acc will automatically use or not use the immediate argument versions of functions based on whether the arguments can or cannot be evaluated at compile time.
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

PreviousNext

Return to Editors / Asset Manipulation

Who is online

Users browsing this forum: No registered users and 2 guests