your "touch_wall" is called from engine:
PHP Code:
void SV_RunCmd(usercmd_t *ucmd, int random_seed)
{
...
...
if (host_client->edict->v.solid)
{
vec3_t vel;
pmtrace_t *tr;
SV_LinkEdict(sv_player, true);
//Engine save current player's velocity here
VectorCopy(sv_player->v.velocity, vel);
for (i = 0; i < pmove->numtouch; i++)
{
tr = &pmove->touchindex[i];
ent = EDICT_NUM(pmove->physents[tr->hitgroup].info);
SV_ConvertPMTrace(&trace, tr, ent);
VectorCopy(tr->deltavelocity, sv_player->v.velocity)
SV_Impact(ent, sv_player, &trace);
}
//and recover velocity here in case someone modify player's velocity
VectorCopy(vel, sv_player->v.velocity);
}
...
}
and
PHP Code:
void SV_Impact(edict_t *e1, edict_t *e2, trace_t *ptrace)
{
...
...
if (e1->v.solid != SOLID_NOT)
{
SV_SetGlobalTrace(ptrace);
gEntityInterface.pfnTouch(e1, e2);
}
if (e2->v.solid != SOLID_NOT)
{
SV_SetGlobalTrace(ptrace);
gEntityInterface.pfnTouch(e2, e1);
}
...
...
}
it's obvious that your new velocity change in
PHP Code:
gEntityInterface.pfnTouch(e1, e2);
is overwritten here
PHP Code:
VectorCopy(vel, sv_player->v.velocity);
so the change has no effect. and you have no access to the "vec3_t vel" in engine 's stack memory.
you'd better do phys calculation like changing velocity in playermove code (PM_Move), or set a flags then set new velocity in PlayerPostThink