Ok it doesn't work. I'm desperated so, megapost:
Here is userInt1 in my psf_overrides.txt:
userInt1, 32
32 bits which is the normal int size (or that's what I've seen around google)
Here is my code at game. I made a new .c where I have the function:
Code:
void WP_SpellUpdate( gentity_t *self, usercmd_t *ucmd ){
if ( !self )
{
return;
}
if ( !self->client )
{
return;
}
if ( self->health <= 0 || (self->playerState->groundEntityNum == ENTITYNUM_NONE) )
{//if is in air, or is death
return;
}
if (self->client->ps.pm_flags & PMF_FOLLOW)
{ //not a "real" game client, it's a spectator following someone
return;
}
if (self->client->sess.sessionTeam == TEAM_SPECTATOR)
{
return;
}
if ( ucmd->buttons & BUTTON_CAST_SPELL )
{
self->s.userInt1 = 1;
self->client->ps.userInt1 = 1;
// want it to be: self->client->ps.isCasting=1;
if (BG_CanUseSpellsNow(&self->client->ps, S_DIVINEBUSTER ))
{
self->client->ps.forceHandExtend = HANDEXTEND_FORCE_HOLD;
}
}
else
{
self->client->ps.userInt1 = 0;
self->s.userInt1 = 0;
}
}
As you can see it's like a copy of WP_ForcePowersUpdate and is also called after it (In G_RunFrame function).
The game loop enters the function and if the player doesn't hold down the button then the variable userInt (I put both because of desperation) are set to 0. That should be fine, but I don't know if they are really set to 0 or if it is the default value. When I press the button, the code enters inside the conditional and I swear it set both values to 1, I've seen it with debug and also the animation of the player changes when I press it which means that it's working.
Then the game loop should enter CG_Player at cgame and when it arrives to this conditional:
Code:
if ((cent->currentState.userInt1 == 1 || cent->playerState->userInt1==1) && cent->currentState.NPC_class != CLASS_VEHICLE)
{
C_DoElements(cent);
}
It should do C_DoElements, which is the function that draws the gfx. But it doesn't! I've set userInt1 to 32 bits, I've used both userInt1's, what else? have someone done something like this before?
I have two options:
1. Leave
2. Erase forcepowers from the mod and use their variables.
I hope you guys have a solution, I don't know what else to do or where else to look...
EDIT: And also I've added inside BG_PlayerStateToEntityStateExtraPolate:
s->userInt1 = ps->userInt1;