mirror of
https://github.com/nzp-team/quakespasm.git
synced 2024-11-22 03:41:07 +00:00
NX/VITA: Replace standard EF_ROTATE
with one that mimicks Power-Up behavior
This commit is contained in:
parent
637bc87005
commit
3f55696e09
1 changed files with 62 additions and 5 deletions
|
@ -423,6 +423,61 @@ float CL_LerpPoint (void)
|
||||||
return frac;
|
return frac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float mdlflag_poweruprotate_duration = 0.0f;
|
||||||
|
float mdlflag_poweruprotate_starttime = 0.0f;
|
||||||
|
|
||||||
|
vec3_t mdlflag_poweruprotate_startangles;
|
||||||
|
vec3_t mdlflag_poweruprotate_differenceangles;
|
||||||
|
vec3_t mdlflag_poweruprotate_currentangles;
|
||||||
|
|
||||||
|
double last_puframetime = 0.0f;
|
||||||
|
|
||||||
|
/*
|
||||||
|
===============
|
||||||
|
CL_UpdatePowerUpAngles
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
void CL_UpdatePowerUpAngles (void)
|
||||||
|
{
|
||||||
|
// Don't update more than once per frame.
|
||||||
|
if (last_puframetime != host_frametime) {
|
||||||
|
// New cycle, dictate new rotation time and target angle.
|
||||||
|
if (mdlflag_poweruprotate_duration <= cl.time) {
|
||||||
|
mdlflag_poweruprotate_starttime = cl.time;
|
||||||
|
mdlflag_poweruprotate_duration = cl.time + (float)((rand() % 25 + 25)/10.0f); // Take between 2.5 and 5 seconds.
|
||||||
|
|
||||||
|
mdlflag_poweruprotate_startangles[0] = mdlflag_poweruprotate_currentangles[0];
|
||||||
|
mdlflag_poweruprotate_startangles[1] = mdlflag_poweruprotate_currentangles[1];
|
||||||
|
mdlflag_poweruprotate_startangles[2] = mdlflag_poweruprotate_currentangles[2];
|
||||||
|
|
||||||
|
int target_pitch = rand() % 120 - 60;
|
||||||
|
int target_yaw = rand() % 240 + 60;
|
||||||
|
int target_roll = rand() % 90 - 45;
|
||||||
|
|
||||||
|
vec3_t target_angles;
|
||||||
|
target_angles[0] = target_pitch;
|
||||||
|
target_angles[1] = target_yaw;
|
||||||
|
target_angles[2] = target_roll;
|
||||||
|
|
||||||
|
// Calculate the difference from our start to our target.
|
||||||
|
for(int i = 0; i < 2; i++) {
|
||||||
|
if (mdlflag_poweruprotate_currentangles[i] > target_angles[i])
|
||||||
|
mdlflag_poweruprotate_differenceangles[i] = (mdlflag_poweruprotate_currentangles[i] - target_angles[i]) * -1;
|
||||||
|
else
|
||||||
|
mdlflag_poweruprotate_differenceangles[i] = fabs(mdlflag_poweruprotate_currentangles[i] - target_angles[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float percentage_complete = (cl.time - mdlflag_poweruprotate_starttime) / (mdlflag_poweruprotate_duration - mdlflag_poweruprotate_starttime);
|
||||||
|
|
||||||
|
for(int j = 0; j < 2; j++) {
|
||||||
|
mdlflag_poweruprotate_currentangles[j] = mdlflag_poweruprotate_startangles[j] + (mdlflag_poweruprotate_differenceangles[j] * percentage_complete);
|
||||||
|
}
|
||||||
|
|
||||||
|
last_puframetime = host_frametime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
CL_RelinkEntities
|
CL_RelinkEntities
|
||||||
|
@ -434,13 +489,14 @@ void CL_RelinkEntities (void)
|
||||||
int i, j;
|
int i, j;
|
||||||
float frac, f, d;
|
float frac, f, d;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
float bobjrotate;
|
|
||||||
vec3_t oldorg;
|
vec3_t oldorg;
|
||||||
dlight_t *dl;
|
dlight_t *dl;
|
||||||
|
|
||||||
// determine partial update time
|
// determine partial update time
|
||||||
frac = CL_LerpPoint ();
|
frac = CL_LerpPoint ();
|
||||||
|
|
||||||
|
CL_UpdatePowerUpAngles();
|
||||||
|
|
||||||
cl_numvisedicts = 0;
|
cl_numvisedicts = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -464,8 +520,6 @@ void CL_RelinkEntities (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bobjrotate = anglemod(100*cl.time);
|
|
||||||
|
|
||||||
// start on the entity after the world
|
// start on the entity after the world
|
||||||
for (i=1,ent=cl_entities+1 ; i<cl.num_entities ; i++,ent++)
|
for (i=1,ent=cl_entities+1 ; i<cl.num_entities ; i++,ent++)
|
||||||
{
|
{
|
||||||
|
@ -525,8 +579,11 @@ void CL_RelinkEntities (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// rotate binary objects locally
|
// rotate binary objects locally
|
||||||
if (ent->model->flags & EF_ROTATE)
|
if (ent->model->flags & EF_ROTATE) {
|
||||||
ent->angles[1] = bobjrotate;
|
ent->angles[0] = mdlflag_poweruprotate_currentangles[0];
|
||||||
|
ent->angles[1] = mdlflag_poweruprotate_currentangles[1];
|
||||||
|
ent->angles[2] = mdlflag_poweruprotate_currentangles[2];
|
||||||
|
}
|
||||||
|
|
||||||
if (ent->effects & EF_MUZZLEFLASH)
|
if (ent->effects & EF_MUZZLEFLASH)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue