.qc (dot qc) - the group for quake c coders of all denominations. If you make quake one mods and write code in quake c, join our group! I'll try to answer any quake c questions - please post your inquiry in the forums...
Posts | ||
---|---|---|
qc++ #define precompiler macro function | Locked | |
Thread Options | ||
|
Dec 7 2014 Anchor | |
What is a #define macro function? From the fteqcc wiki: Fteqw.com Syntax: #define {defname}[({macroparams})] [{defvalue}] * {defname} contains the define name Working example: What this does is define a macro that substitutes the macroparams into the defvalue code fragment and compiles as code where it is used. Why may you want to take this route vs. an actual function call? * limit global variable use - every function defined and its parameters are globals, the #define params are not Limits: * {macroparams} - there is a maximum of eight and they can NOT contain numerals [0-9] From the working example: framer($walk2, $walkeoc, shal_walk1, shal_walk1, , 0.1, //framer($walk2, $walkeoc, shal_walk1, frd1, 0.1, frame_arb($walk2,if (random() < 0.2) sound(self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE)); ); Will not compile: compiling shalrath.qc ************ ERROR ************ I tried /* framer($walk2, $walkeoc, shal_walk1, frd1, 0.1, */ and that also fails to compile! If you want the comment - move it above (or outside) the macro usage. Edited by: numbersix |
Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.