Page 1 of 1

OP_LOAD_FLD and OP_STOREP_FLD

Posted: Fri Dec 21, 2012 3:58 am
by andrewj
I'm learning more about how QCC works, and I just noticed that OP_LOAD_FLD and OP_STOREP_FLD instructions are never generated when compiling the standard game code.

Can they actually be used in valid qc code? Or was it some unfinished feature (my guess would be an ability to pass field names as parameters and get or set that field of an entity).

Re: OP_LOAD_FLD and OP_STOREP_FLD

Posted: Fri Dec 21, 2012 4:58 am
by taniwha
They'd be fore storing fields in an entity. I imagine it would be something like the following:

Code: Select all

..float foo;    // NOTE two dots
.float bar;
entity baz;

void () somefunc=
{
    baz.foo = bar;
    ...
    baz..foo = 0; // again, two dots, but I'm not sure if this would be the syntax
}
Another thought is it was just someone over-engineering the VM and implementing load/storep for all types.

I think I got it working in qfcc, but I've never tested it. Arrays, structs, unions and objects (Objective-C style) are much more useful :). Even quaternions are much more useful.