No announcement yet.

The questions, they only grow. (quakec)

  • Filter
  • Time
  • Show
Clear All
new posts

  • The questions, they only grow. (quakec)

    I am not very sure if I can use arrays or not in quakec, as I have not seen an example of them being used.

    It would be really convenient if I could add an array to a player to track 30 something entities and managed them.

  • #2
    fteqcc has array support.
    they're basically emulated by using a binary search (unless you're targetting fte only), so they can be a little slow, and this forces a lack of dynamically sized arrays, and globals-only (by that I mean no locals - field arrays are technically a global array of field references, and that works fine. its field-count abuse, but it works as you'd expect).

    (binary search as in: if (i < 2) {if (i < 1) return a[0]; else return a[1];}else {if (i<3) return a[2]; else return a[3];}, with stores doing assignments instead of returns, so yes, a function call and lots of instructions for each time you access said arrays, so bear that in mind and attempt to use constants for array indexes where you can, and cache/reuse where you can't.)

    the emulated stuff works in every engine (and can be decompiled too, which is fun), but it does of course require the qcc to support the syntax.
    Some Game Thing


    • #3
      I thought arrays were basically the bytes of an entity being addressed directly? Or is that qccx's version?


      • #4
        qccx's arrays work by hardcoding some global->entity offset, which really only works in proquake - the needed offset is different in other engines (especially 64bit ones, or ones that added alpha support), and totally unworkable in fte/dp because qc rewriting the engine's code/data is fucking evil (and they use ints for ents instead of offsets).
        on the other hand, fteqcc's arrays work anywhere and without needing to change any offsets.

        qccx needs to die.
        Some Game Thing