PDA

View Full Version : problem with eflags


stubert
08-06-2004, 08:53 PM
alright, i'm working on getting the awards system from q3 working again. (it's only ifdef'd out)

the awards are

capture- make a capture
defend- defend the flag or your flag carrier
assist- pick up a downed flag and return it or kill the enemy flagger which results in a cap

excellent - a double kill
impressive- 2 consecutive zoomed distruptor hits
saber- a saber kill


when the awards happen, the graphics are drawn over your head and on your hud (other people can see the one over your head)

if you have more than 10 of any of them, there is a graphic and the number you have accumulated under it


for playing sounds, the awards are placed into a stack and played in order

if (ps->persistant[PERS_CAPTURES] != ops->persistant[PERS_CAPTURES]) {
sfx = cgs.media.captureAwardSound;

pushReward(cgs.media.captureAwardSound, cgs.media.medalCapture,
ps->persistant[PERS_CAPTURES]);
reward = qtrue;
Com_Printf("capture sound\n");
}


this also takes care of the hud part

for the ballons over the players head look at
static void CG_PlayerSprites( centity_t *cent )

ok, when a player makes a cap, it gets flagged with a

#define EF_AWARD_CAP 0x00000800

like when a player makes a capture this in team_touchourflag
[code]
other->client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET |
EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP );
other->client->ps.eFlags |= EF_AWARD_CAP;
other->client->rewardTime = level.time + REWARD_SPRITE_TIME;
other->client->ps.persistant[PERS_CAPTURES]++;


and this happens client side every frame to check for and to display the balloon



if ( cent->currentState.eFlags & EF_AWARD_CAP )
{
CG_PlayerFloatSprite( cent, cgs.media.medalCapture );
Com_Printf("capture spirte\n");
return;

}


when the award time runs out, this happens in clientThink_real


// clear the rewards if time
if ( level.time > client->rewardTime )
{
client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT |

EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP );
}


now, on to the problem


if i actually perform something to get an award or do a "/give capture" with cheats on, all the awards work right: meaning if i have 3 capture awards, 3 capture icons will display on my hud, but the balloon icon will only appear for a frame (wtf?)


all the other awards work perfectly,

in the q_shared.h there are several dataums called eFlags, i'm assuming that the one i'm working with here is the byte

the only thing that is different from capture and all the other awards is that the EF_CAP is at the end of the clear command for the byte

but i'm not really sure how to work with the byte datatype, and i assume that the line..


ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST |

EF_AWARD_DEFEND | EF_AWARD_CAP );


is resetting the flag for awards... but if none of the other flag clearing entrys in g_Active are actually mention the award flags, then how is it being taken off?

and btw, when i put on cheats and turn on the jet pack, the capture balloon STAYS on

heeelpp meee

razorace
08-07-2004, 02:04 AM
1. What is REWARD_SPRITE_TIME defined as?
2. If the jetpack stuff is affecting your capture icon, it probably means that your eflags are conflicting. Make sure that your EF_AWARD_CAP value is not the same as the other eflags.

stubert
08-07-2004, 02:30 AM
yep, it was the same as one of the jetpack flags

i use EF_NOT_USED_5 for my capture now

razorace
08-07-2004, 03:42 AM
Ok, I'm glad I could help. FYI, you can change eflag define names if you want to.

It won't break the eflag network code. :) Just don't go over the current bit transfer limit set by the external code files.