News | Forum | People | FAQ | Links | Search | Register | Log in
Coding Help
This is a counterpart to the "Mapping Help" thread. If you need help with QuakeC coding, or questions about how to do some engine modification, this is the place for you! We've got a few coders here on the forum and hopefully someone knows the answer.
First | Previous | Next | Last
 
oh come to think of it, i think i understand what you mean; if you have a monster charging at you and it hits an angled wall or railing or something, it can still walk towards you following the railing whereas walkmove would just stop dead. 
 
String concatenation without crazy hacked compilers: possible? I can do it by abusing the 'stuffcmd' buffer and changing the player's name, waiting a frame, getting the player's .netname and then stuffcmding it back, but this prints messages about the player's name changing. 
String Concat 
depends what you're cating. part of the problem is that even if you can hack the player's netname like that, you have to do it for every single string.
one trick (abused quite effectively in prydon gate, also in frikbot to a lesser extent) is to use writebytes for your sprints and centerprints and stuff. this can generally get close enough without visible side effects, but does mean that your strings need to be hard coded to some extent.
the last part of your message can still use writestring, so at least that part of it doesn't need to be hardcoded.

quakeworld could do something with the server's localinfo, but this does still impose a frame's delay due to localcmd. 
 
Yeah, I'm trying to create guaranteed unique targetnames, so centerprint effectively goes into the void.

Fuck it, I might as well just make them all numbers.

Here's a real contribution: I made a Notepad++ userDefineLang.xml preset for QuakeC syntax highlighting.
http://pastebin.com/G0s8mw92
it also colors quake's required globals (like self etc) and all the builtins. 
Well, That Doesn't Work 
apparently if you set something's targetname to just ftos(some_integer), it somehow changes to other numbers as you move around! 
 
ftos stores the string it creates in a shared spot in memory. if you call ftos multiple times in a frame, all strings you assigned ftos to, even if they were different numbers, will have the number of the last ftos call.
this is true for vtos as well. 
Ftos 
works in fte. :)

but yeah, in most engines, builtins that return temporary strings will overwrite the previously returned one(s), such that the old reference now refers to the new value. which is really useless.
either that or it starts complaining about stale/invalid tempstrings. including when saving games. potentially even with crash-to-console results...
as a general rule, if you have a tempstring, NEVER store it to a field or global (if you have the somewhat common frik_file engine extension, then you can use strzone for these usecases).

findfloat doesn't exist in vanilla qc (and hacking find to find a float is unreliable too, and potentially crashy), but you can use nextent to itterate over all entities manually. obviously its less efficient, but if you're really trying to avoid extensions then you won't have more than 600 ents anyway. 
Ok I'm Going To Bed 
I spawn an entity, set its targetname to self.netname, check it with an eprint, change my name, eprint it again, and the fucking targetname on the entity has changed to my new name.

I don't have a fucking clue in the world what's going on here. 
 
wait, are ALL these string fields referenced rather than copied? 
Styring References 
Lunaran: yes, it's a reference to your name string buffer. Some engines offer extensions like "zone" for allocating new buffers.

Depending on what you need to do with strings, there may be a way to do it building the string character by character at time of use. This is the way that Prydon Gate makes its menus, for example. I wrote some articles on how to organise this so it's not quite as awful as it sounds, starting at https://tomeofpreach.wordpress.com/2013/03/28/text-manipulation-in-quake-i-the-basics/ 
 
I read those. Doesn't work for my needs, unfortunately. Seems any mechanism I use to exploit that buffer trick is going to be foiled by whatever field I try to exploit to capture its result. I don't want to start exploring engine specific code, either.

A giant lookup table it is then. 
Lunaran 
Thx for the xml! 
Lookup Tables 
What you up to Lunaran? Sometimes there are ways to avoid them in QC, as they're never a pleasant task to maintain. 
 
I assumed a giant array of strings each with a unique name? 
Yep 
f.write("\\tswitch(num)\\n\\t{\\n")

for i in xrange(256):
. s = str(i)
. f.write("\\t\\tcase "+s+": return "node"+s+"";\\n")

f.write("\\t}\\n\\treturn string_null;\\n}\\n\\n")
 
 
hm. func is weird with backslashes. 
QC Math To Calc Odd / Even Number 
Has anyone run across or can post some QC that can tell weather or not a number on the positive number line is odd or even? 
 
Surely, lacking a modulo operator, something like this must work:

if (number & 0x1) {
// odd
}
else {
// even
 
"positive number line" 
 
float(float a, float n) modf = {
return a - (n * floor(a/n));
};

modulo with floating point types is fun.


but yeah, if its just odd vs even, just use value&1. 
Weapon Animation Going Faster Than 10 Fps 
For some who've been on the modelling help thread, I've been working on a machinegun weapon. I've been able to complete them and are ready to be implemented in the game.
Thing is, the viewmodel has been designed to run at 0.05 sec for each frame, more than the minimum 0.1 sec. But I've seen there's a way to go past this, as seen here: https://youtu.be/E5zyhlZ1xVI?t=2m22s .
I know Q2 got around that as well with the Chaingun's second spin, and from what I've seen in the sourcecode, the same fire pattern is applied a second time but with a 0.05 delay. Thing is, I have no idea how to accomplish it, can anyone help me on that?
Also, the weapon is supposed to fire at every two frames, the inbetween are for cosmetic purposes (meaning it'll fire as fast as the NG/SNG), and I intend to apply the same fire programming seen from the Nailgun/SNG (where the fire trigger is tied to the animation) 
Variables For Storing Persistent Info Between Maps 
I know we once had a long discussion about the most efficient and safe way to store information between maps (say if one was to try to make a hub-style continuity across maps) - anyone remember this, and got link to the posts? 
Kinn 
Not sure about that but I'm pretty sure Socks mod new mod has a better way to do this now. 
 
Daya - view weapon anim is driven by the player model's animation state, which is crappy. there's not-insignificant reengineering to be done to decouple them.

Kinn - parm1-parm16. 
Kinn, 
First | Previous | Next | Last
You must be logged in to post in this thread.
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.