News | Forum | People | FAQ | Links | Search | Register | Log in
FTEQCC Coding Thread
FTEQCC deserves its own thread. I'm switching to it now, and its current version has a lot of features that allows for substantially different coding styles.

Some examples from the readme (the whole document is a good read):


unary ++ and --

unary ~ bitwise not

<< left shift

>> right shift

+= -= |= &= &~= ^= *= <<= >>= /=

ternary ?: conditional

Given the line 'result = A ? B : C;', the result will be be equal to B ONLY if A is true, otherwise equal to C. B may be ommitted, and if so will be equivelent to A. Side effects will not be executed in the side that was not taken.
(FrikQCC only supports ternary operations as a replacement for "if" statements, with no return value. FTEQCC's implementation is more complete)

vector
Vector immediates traditionally take the form of 'x y z', but using [x, y, z] allows formulas and thus simpler argument passing.
Normally vectors act a bit like unions and define both 'vec' and 'vec_x' 'vec_y' 'vec_z' variables allowing for direct channel access. The modern way to access individual channels is with eg vec.x instead.


arrays
FTEQCC supports single-dimension arrays.
(Arrays are also supported within structs, allowing for (clumsy) multi-dimensional arrays.)

float foo[] = {1, 2, 3, 4}; will thus define a float array and will infer its length as 4. If you need to use an explicit length, or you do not wish to initialize the array, then you must put the needed length inside the square brackets.
foo.length can be read if you wish to know how long an array is (especially if the length was inferred instead of explicit).
Dynamic lengths are not supported at this time.

Indexes will be rounded down.
Dynamic indexes ARE supported in all cases, however they may come at a significant performance loss if you do not have extended opcodes enabled, so it is generally preferable to unroll small loops such that constant indexes can be used.


struct
Allows you to define a struct, which is useful for boxing multiple related variables.

union
Equivelent to structs, except all struct members start at the same offset. This can be used for either type punning or compressing mutually-exclusive fields inside complex struct layouts. By nesting structs, unions and arrays, you can get some quite complex data structures.
Note that unions and structs define within unions or structs do not need to be named. Members from child structs will automatically be accessed as if they were part of the containing stuct.

struct
{
     float type;
     union
     {
          struct
          {
               float f;
               vector bar;
          };
          struct
          {
               string s[2];
          };
     };
} foo[8];

float() foobar =
{
     if (foo[4].type)
          return stof (foo[4].s[1]);
     else
          return foo[4].f;
};


class
Class constructors double up as spawn functions, and the spawn intrisic works in the same way - the named members will be set before the constructor is called, instead of passing arguments to the constructor (which avoids the need for overloads etc).
If the parent class is omitted, entity will be assumed. The 'interval' field below is defined as a class field. Such class fields are valid ONLY on entities of that class, which allows for more efficient memory usage.
Member functions can be defined as virtual (such functions are technically pre-initialised fields, and thus compatible with things like think or touch), non-virtual (read: non-inherited), or static (where 'this' cannot be used).
Public, private, protected are parsed like in C++, but ignored.
Only a single parent type can be inherited, and it must be a class or the general entity type.

class foo : entity
{
     float interval;
     virtual void() think =
     {
          centerprint (enemy, this.message);
          nextthink = time + interval;
     };
     nonvirtual void(enemy e) setEnemy =
     {
          enemy = e;
     };
     void() foo =
     {
          nextthink = time + interval;
     };
};

void() someiplayerfunction =
{
     foo myfoo = spawn (foo, message:"Hello World", interval:5);
     myfoo.setEnemy (self);
};


 
Its GUI is a little buggy under Windows 7: screenshot
Frame Macros On Switches 
Hey, don't know if this is intended behaviour, but when I use frame macros inside switches the compiler doesn't recognize them.

Example:
$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
void() test = {
int frame = $stand1;
switch(frame)
{
case $stand1:
//
break;
}
};

Gives me:
test.qc:33: error: Unknown frame macro $stand1: 
 
Asked Spike, he told me to add a space after the frame macro name.
This works:

case $stand1 :

This doesn't:

case $stand1: 
Unclear 
I'm trying to add entities to the quake extention, but using a macro with equal statements give an error after compiling with fteqcc.
I know a lot of warnings can be corrected quiete easy, I keep getting a stale macro for some monsters.
warning F317: Stale macro used (paina, defined in monsters bla.qc)

Can I just ignore it? 
Not A Good Idea 
Somewhere in the file the warning comes from, you've got $paina (most likely as the frame in an animation). But you don't have $paina in that file, so it's using the frame number from $paina in "monsters bla.qc". You will be getting a random frame of animation rather than what you really want. Find the place where you are using $paina, and change it to the correct frame. 
Yes 
I hadn't made enough statements in the $frame count so this warning kept on appearing. Now they're vanished. 
Stubborn Warning 
While compiling with fte I keep a statement missing.
It starts in PutClientInServer.qc with
Warning F307 :type mismatch: void() player.pain to void(entity attacker,float damage) self th.pain
and then it runs through door_ secret and Sub_null, Shallrath, OldOne.

It doesn't fail the progs.dat but is there a run around for? 
Th_pain Type Mismatch Warnings 
madfox, I submitted a commit for progs_dump here which shows one way of eliminating those warnings. The commit message provides a bit of explanation. (Although this was for progs_dump, the changes shown aren't specific to that mod.) 
Thanks 
I'm a complete noob what this matter concerns.

As soon as I add a
void(entity attacker, float damage) player_pain;
to the client.qc the compiler bumps to:
Client.qc:24: error type mismatch on player_pain.void(entity attacker, float damage) should be void() 
 
madfox, you'll need to update all declarations/definitions of player_pain so that they all match (i.e. so they all have the "entity attacker, float damage" parameters). In the original v1.06 QuakeC code, player_pain is declared on line 5 of client.qc and then defined on line 337 of player.qc. Both of those would need to be updated so they match each other. If your mod declares player_pain anywhere else, those lines would need to be updated, too. 
Misfits 
I've solved the client.qc and player.qc.
Doors and shallrath won't fit with the addon.
For the old one I couldn't find a nopain in the shub.qc.

But for sofar it's all right.
Thanks for the hint! 
No Nopain() In Oldone.qc 
madfox, you've reminded me: Id added the nopain() function to oldone.qc in v1.06 to fix the bug whereby the player could shoot Shub to death. It wasn't in the v1.01 release of the QuakeC code. So I guess you're looking at the v1.01 code, or a mod that's based off of the v1.01 code.

So, the fix I linked to above (or at least that bit of it) is specific to the v1.06 QuakeC code, even if it isn't specific to progs_dump. 
Sourceforge 
I have fte from sourceforge, before I had fttqc.
Not sure what to do with the last warnings, but as long as the progs.dat works I don't mind. Glad the warnings point to a statement.

Don't seems that hard to correkt that last hussle. 
 
FTEQCCGUI has a few issues.

If you "grep for selection" on something like W_FirePlasma, it will search for the W character instead of the full selection.

If you right-click on a prototype function name and "grep for <word>", it will say "there's no search text specified". Try it on player_pain at client.qc.

The feature "suppressed 47 more warnings about unreferenced variables, as you clearly don't care about the first 10" is bad for people who are cleaning up other people's code. There seems to be no option to show everything so we can fix all warnings at once. 
 
does anyone have any links for documentation on the bytecode of Q1? i've been trying to write a small compiler by trying to match my input to fteqcc output, but it has been hard to make sense of a few opcodes. 
@7yn1c 
There is some info here: https://www.leonrische.me/pages/quakec.html

The actual quake engine source should also be a good reference since it contains the actual VM. 
I Can't Compile Sevens Modified Source Qc 
Recently I downloaded the "quake_epsilon_v2_54_18-12-2016.zip" file from the "moddb.com" website, extracted everything and then I tried, with all the fteqccgui64.exe, fteqccgui.exe, fteqcc64.exe and fteqcc.exe, to compile the "progs.src" file inside the "Sevens modified source qc" folder/directory that is inside the "00_Quake-Small-Mod-Compilation-V3.80--Seven-20120409" folder/directory that is inside the "readmes" folder/directory that is inside the "id1" folder/directory.

but compilation fails with the repeating error:

ogre.qc:986: error: Invalid UTF-8 code sequence at end of line. Lead byte was 0xa0

Both I don't know why compilation fails with this repeating error and I don't know how to get rid of this error.

In fact I don't know at all how this source code was compiled in the past.

Please help me!

I do want to modify epsilon build to my likings to make this game, Quake, even more fun than what it is now! 
 
Small-Mod-Compilation-V3.80--Seven-20120409 is heavily outdated.

You can find current versions here: https://quakeone.com/forum/quake-mod-releases/finished-works/6241-small-mod-compilation

Fteqcc is usually included in the SMC source folders. At least in newer builds.

The error you mentioned above does not exist in newer versions anymore. It was due to wrong text editor used. UTF-8 code existed in older builds source files.

So either use current SMC builds or delete the UTF-8 code out of your source files. 
 
And where I can download the latest version of this small mod compilation exactly? 
1 post not shown on this page because it was spam
You must be logged in to post in this thread.
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.