Forum

Problem with CSQC

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Problem with CSQC

Postby Nahuel » Mon Jun 20, 2011 10:03 pm

I released this modified csqc HUD in quakeone.com http://quakeone.com/forums/quake-mod-releases/finished-works/7189-custom-hud-csqc.html Well, now i am trying to adapt the code to the Mission pack 1 (hipnotic) but the value
"float IT_LASER_CANNON = 8388608;" doesn´t work

8388608 is a too high number for csqc??
I do not think that, really. I tested the HUD changing the values and the icon of the laser canon works, this number is problematic....

any suggestion?
Thanks in advance!
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Re: Problem with CSQC

Postby Nahuel » Mon Jun 20, 2011 11:02 pm

I did find the solution with my hipnotic´s HUD :) :) , making strange things and codes, I do not know why these float doesn´t work!!!!!!!!
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby Spike » Tue Jun 21, 2011 10:31 am

getstatbits is able to retrieve any descrete bit within an integer stat (STAT_ITEMS is such a stat as the engine merges .items with .items2 or serverflags) to get a full 32bit int value.
floats are unable to hold a full 32bit integer value without forgetting parts of it. getstatbits can do bit shifts on the original int before giving a float result to csqc.
if the engine can see it, getstatbits can retrieve it.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Nahuel » Tue Jun 21, 2011 8:57 pm

Spike wrote: (STAT_ITEMS is such a stat as the engine merges .items with .items2 or serverflags)

thank you Spike, I have another problem.... hipnotic uses "item2".
I really need to use the "float STAT_ITEMS2" ??
.¿what number i can use for this?
Aniway I think that what you said, I do not need to use a new "STAT" but the STAT_ITEMS doesn´t work with items2 in my csqc. You know "HIP_IT_WETSUIT" it´s not a "item", it is a "item2".
any suggestion ?
Thanks!
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby Spike » Tue Jun 21, 2011 11:25 pm

like I said, getstatbits.
From csqctest:
items = getstatbits(STAT_ITEMS, 0, 23);
items2 = getstatbits(STAT_ITEMS, 23, 9);



side note:
if a mod doesn't define items2, then the upper bits contain the runes instead, thus
serverflags = getstatbits(STAT_ITEMS, 28, 4);
of course, it'll reveal only the lower 4 bits, which is sufficient for the 4 runes in quake.

Due to the way it gets munged together, (self.items & (1<<23)) is effectively the same as (self.items2 & 1) at least as far as csqc can tell.

It should be safe enough to just do:
items = getstatbits(STAT_ITEMS, 0, 24);
instead, however, more bits will degrade the fpu precision and give strange results if you pick up a wetsuit.


Note that it is for a reason that mods are not able to munge additional fields together to form unholy monsters like STAT_ITEMS, and thus getstatbits should only be used for STAT_ITEMS.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest