mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
player.c: factor out large A_ShootWithZvel() block into A_ShootHardcoded()
The block is taken over verbatim; 'vec3_t srcvect' is passed by value. The primary purpose of this is that it's easier to compare custom projectile behavior in A_ShootCustom() with the hardcoded one by reading the code of these two functions. For example, this may be of use to modders wishing to emulate a hardcoded projectile. DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@5435 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6e9203ea23
commit
48e73c65df
1 changed files with 483 additions and 480 deletions
|
@ -1112,76 +1112,8 @@ static int32_t A_ShootCustom(const int32_t i, const int32_t atwith, int16_t sa,
|
|||
}
|
||||
}
|
||||
|
||||
int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel)
|
||||
{
|
||||
int16_t sa;
|
||||
vec3_t srcvect;
|
||||
spritetype *const s = &sprite[i];
|
||||
const int32_t p = (s->picnum == APLAYER) ? P_GetP(s) : -1;
|
||||
DukePlayer_t *const ps = p >= 0 ? g_player[p].ps : NULL;
|
||||
|
||||
Bassert(atwith >= 0);
|
||||
|
||||
if (override_zvel != SHOOT_HARDCODED_ZVEL)
|
||||
{
|
||||
g_overrideShootZvel = 1;
|
||||
g_shootZvel = override_zvel;
|
||||
}
|
||||
else
|
||||
g_overrideShootZvel = 0;
|
||||
|
||||
if (s->picnum == APLAYER)
|
||||
{
|
||||
Bmemcpy(&srcvect,ps,sizeof(vec3_t));
|
||||
srcvect.z += ps->pyoff+(4<<8);
|
||||
sa = ps->ang;
|
||||
|
||||
ps->crack_time = 777;
|
||||
}
|
||||
else
|
||||
{
|
||||
sa = s->ang;
|
||||
Bmemcpy(&srcvect,s,sizeof(vec3_t));
|
||||
srcvect.z -= (((s->yrepeat*tilesiz[s->picnum].y)<<1)-(4<<8));
|
||||
|
||||
if (s->picnum != ROTATEGUN)
|
||||
{
|
||||
srcvect.z -= (7<<8);
|
||||
|
||||
if (A_CheckEnemySprite(s) && PN != COMMANDER)
|
||||
{
|
||||
srcvect.x += (sintable[(sa+1024+96)&2047]>>7);
|
||||
srcvect.y += (sintable[(sa+512+96)&2047]>>7);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef POLYMER
|
||||
switch (DYNAMICTILEMAP(atwith))
|
||||
{
|
||||
case FIRELASER__STATIC:
|
||||
case SHOTGUN__STATIC:
|
||||
case SHOTSPARK1__STATIC:
|
||||
case CHAINGUN__STATIC:
|
||||
case RPG__STATIC:
|
||||
case MORTER__STATIC:
|
||||
{
|
||||
int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7);
|
||||
s->x += x;
|
||||
s->y += y;
|
||||
G_AddGameLight(0, i, PHEIGHT, 8192, 255+(95<<8), PR_LIGHT_PRIO_MAX_GAME);
|
||||
actor[i].lightcount = 2;
|
||||
s->x -= x;
|
||||
s->y -= y;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
#endif // POLYMER
|
||||
}
|
||||
|
||||
if (A_CheckSpriteTileFlags(atwith, SFLAG_PROJECTILE))
|
||||
return A_ShootCustom(i, atwith, sa, &srcvect);
|
||||
else
|
||||
static int32_t A_ShootHardcoded(int32_t i, int32_t atwith, int16_t sa, vec3_t srcvect,
|
||||
spritetype *s, int32_t p, DukePlayer_t *ps)
|
||||
{
|
||||
int32_t j, k = -1, l;
|
||||
int32_t vel, zvel = 0;
|
||||
|
@ -1656,11 +1588,82 @@ int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel)
|
|||
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel)
|
||||
{
|
||||
int16_t sa;
|
||||
vec3_t srcvect;
|
||||
spritetype *const s = &sprite[i];
|
||||
const int32_t p = (s->picnum == APLAYER) ? P_GetP(s) : -1;
|
||||
DukePlayer_t *const ps = p >= 0 ? g_player[p].ps : NULL;
|
||||
|
||||
Bassert(atwith >= 0);
|
||||
|
||||
if (override_zvel != SHOOT_HARDCODED_ZVEL)
|
||||
{
|
||||
g_overrideShootZvel = 1;
|
||||
g_shootZvel = override_zvel;
|
||||
}
|
||||
else
|
||||
g_overrideShootZvel = 0;
|
||||
|
||||
if (s->picnum == APLAYER)
|
||||
{
|
||||
Bmemcpy(&srcvect,ps,sizeof(vec3_t));
|
||||
srcvect.z += ps->pyoff+(4<<8);
|
||||
sa = ps->ang;
|
||||
|
||||
ps->crack_time = 777;
|
||||
}
|
||||
else
|
||||
{
|
||||
sa = s->ang;
|
||||
Bmemcpy(&srcvect,s,sizeof(vec3_t));
|
||||
srcvect.z -= (((s->yrepeat*tilesiz[s->picnum].y)<<1)-(4<<8));
|
||||
|
||||
if (s->picnum != ROTATEGUN)
|
||||
{
|
||||
srcvect.z -= (7<<8);
|
||||
|
||||
if (A_CheckEnemySprite(s) && PN != COMMANDER)
|
||||
{
|
||||
srcvect.x += (sintable[(sa+1024+96)&2047]>>7);
|
||||
srcvect.y += (sintable[(sa+512+96)&2047]>>7);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef POLYMER
|
||||
switch (DYNAMICTILEMAP(atwith))
|
||||
{
|
||||
case FIRELASER__STATIC:
|
||||
case SHOTGUN__STATIC:
|
||||
case SHOTSPARK1__STATIC:
|
||||
case CHAINGUN__STATIC:
|
||||
case RPG__STATIC:
|
||||
case MORTER__STATIC:
|
||||
{
|
||||
int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7);
|
||||
s->x += x;
|
||||
s->y += y;
|
||||
G_AddGameLight(0, i, PHEIGHT, 8192, 255+(95<<8), PR_LIGHT_PRIO_MAX_GAME);
|
||||
actor[i].lightcount = 2;
|
||||
s->x -= x;
|
||||
s->y -= y;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
#endif // POLYMER
|
||||
}
|
||||
|
||||
return A_CheckSpriteTileFlags(atwith, SFLAG_PROJECTILE) ?
|
||||
A_ShootCustom(i, atwith, sa, &srcvect) :
|
||||
A_ShootHardcoded(i, atwith, sa, srcvect, s, p, ps);
|
||||
}
|
||||
|
||||
|
||||
//////////////////// HUD WEAPON / MISC. DISPLAY CODE ////////////////////
|
||||
|
||||
|
|
Loading…
Reference in a new issue