mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-14 08:30:58 +00:00
Factor out 5 instances of functionally identical code into G_ClearCameraView().
git-svn-id: https://svn.eduke32.com/eduke32@2853 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
19d426ba02
commit
f1ffd6d90a
4 changed files with 32 additions and 88 deletions
|
@ -109,13 +109,32 @@ inline int32_t G_CheckForSpaceFloor(int32_t sectnum)
|
||||||
return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 && ((sector[sectnum].floorpicnum==MOONSKY1)||(sector[sectnum].floorpicnum==BIGORBIT1))?1:0);
|
return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 && ((sector[sectnum].floorpicnum==MOONSKY1)||(sector[sectnum].floorpicnum==BIGORBIT1))?1:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void G_ClearCameraView(DukePlayer_t *ps)
|
||||||
|
{
|
||||||
|
int32_t k;
|
||||||
|
|
||||||
|
ps->newowner = -1;
|
||||||
|
|
||||||
|
ps->pos.x = ps->opos.x;
|
||||||
|
ps->pos.y = ps->opos.y;
|
||||||
|
ps->pos.z = ps->opos.z;
|
||||||
|
ps->ang = ps->oang;
|
||||||
|
|
||||||
|
updatesector(ps->pos.x, ps->pos.y, &ps->cursectnum);
|
||||||
|
P_UpdateScreenPal(ps);
|
||||||
|
|
||||||
|
for (k=headspritestat[STAT_ACTOR]; k>=0; k=nextspritestat[k])
|
||||||
|
if (sprite[k].picnum==CAMERA1)
|
||||||
|
sprite[k].yvel = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4)
|
void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4)
|
||||||
{
|
{
|
||||||
spritetype *s=&sprite[i],*sj;
|
spritetype *s=&sprite[i],*sj;
|
||||||
walltype *wal;
|
walltype *wal;
|
||||||
int32_t d, q, x1, y1;
|
int32_t d, q, x1, y1;
|
||||||
int32_t sectcnt, sectend, dasect, startwall, endwall, nextsect;
|
int32_t sectcnt, sectend, dasect, startwall, endwall, nextsect;
|
||||||
int32_t j,k,p,x,nextj;
|
int32_t j,k,x,nextj;
|
||||||
int16_t sect=-1;
|
int16_t sect=-1;
|
||||||
char statlist[] = {STAT_DEFAULT,STAT_ACTOR,STAT_STANDABLE,
|
char statlist[] = {STAT_DEFAULT,STAT_ACTOR,STAT_STANDABLE,
|
||||||
STAT_PLAYER,STAT_FALLER,STAT_ZOMBIEACTOR,STAT_MISC
|
STAT_PLAYER,STAT_FALLER,STAT_ZOMBIEACTOR,STAT_MISC
|
||||||
|
@ -272,26 +291,12 @@ SKIPWALLCHECK:
|
||||||
{
|
{
|
||||||
if (sj->picnum == APLAYER)
|
if (sj->picnum == APLAYER)
|
||||||
{
|
{
|
||||||
p = sj->yvel;
|
DukePlayer_t *ps = g_player[sj->yvel].ps;
|
||||||
if (g_player[p].ps->newowner >= 0)
|
|
||||||
{
|
|
||||||
g_player[p].ps->newowner = -1;
|
|
||||||
g_player[p].ps->pos.x = g_player[p].ps->opos.x;
|
|
||||||
g_player[p].ps->pos.y = g_player[p].ps->opos.y;
|
|
||||||
g_player[p].ps->pos.z = g_player[p].ps->opos.z;
|
|
||||||
g_player[p].ps->ang = g_player[p].ps->oang;
|
|
||||||
updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&g_player[p].ps->cursectnum);
|
|
||||||
P_UpdateScreenPal(g_player[p].ps);
|
|
||||||
|
|
||||||
k = headspritestat[STAT_ACTOR];
|
if (ps->newowner >= 0)
|
||||||
while (k >= 0)
|
G_ClearCameraView(ps);
|
||||||
{
|
|
||||||
if (sprite[k].picnum==CAMERA1)
|
|
||||||
sprite[k].yvel = 0;
|
|
||||||
k = nextspritestat[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actor[j].owner = s->owner;
|
actor[j].owner = s->owner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4093,23 +4098,7 @@ ACTOR_STATIC void G_MoveActors(void)
|
||||||
t[2] += 128;
|
t[2] += 128;
|
||||||
|
|
||||||
if (g_player[p].ps->newowner >= 0)
|
if (g_player[p].ps->newowner >= 0)
|
||||||
{
|
G_ClearCameraView(g_player[p].ps);
|
||||||
g_player[p].ps->newowner = -1;
|
|
||||||
g_player[p].ps->pos.x = g_player[p].ps->opos.x;
|
|
||||||
g_player[p].ps->pos.y = g_player[p].ps->opos.y;
|
|
||||||
g_player[p].ps->pos.z = g_player[p].ps->opos.z;
|
|
||||||
g_player[p].ps->ang = g_player[p].ps->oang;
|
|
||||||
|
|
||||||
updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&g_player[p].ps->cursectnum);
|
|
||||||
P_UpdateScreenPal(g_player[p].ps);
|
|
||||||
|
|
||||||
j = headspritestat[STAT_ACTOR];
|
|
||||||
while (j >= 0)
|
|
||||||
{
|
|
||||||
if (sprite[j].picnum==CAMERA1) sprite[j].yvel = 0;
|
|
||||||
j = nextspritestat[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (t[3]>0)
|
if (t[3]>0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -258,6 +258,7 @@ void A_SpawnMultiple(int32_t sp,int32_t pic,int32_t n);
|
||||||
void G_AddGameLight(int32_t radius,int32_t srcsprite,int32_t zoffset,int32_t range,int32_t color,int32_t priority);
|
void G_AddGameLight(int32_t radius,int32_t srcsprite,int32_t zoffset,int32_t range,int32_t color,int32_t priority);
|
||||||
int32_t G_CheckForSpaceCeiling(int32_t sectnum);
|
int32_t G_CheckForSpaceCeiling(int32_t sectnum);
|
||||||
int32_t G_CheckForSpaceFloor(int32_t sectnum);
|
int32_t G_CheckForSpaceFloor(int32_t sectnum);
|
||||||
|
void G_ClearCameraView(DukePlayer_t *ps);
|
||||||
void G_DoInterpolations(int32_t smoothratio);
|
void G_DoInterpolations(int32_t smoothratio);
|
||||||
void G_MoveWorld(void);
|
void G_MoveWorld(void);
|
||||||
extern inline void G_RestoreInterpolations(void);
|
extern inline void G_RestoreInterpolations(void);
|
||||||
|
|
|
@ -1419,23 +1419,7 @@ skip_check:
|
||||||
int32_t j;
|
int32_t j;
|
||||||
|
|
||||||
if (g_player[vm.g_p].ps->newowner >= 0)
|
if (g_player[vm.g_p].ps->newowner >= 0)
|
||||||
{
|
G_ClearCameraView(g_player[vm.g_p].ps);
|
||||||
g_player[vm.g_p].ps->newowner = -1;
|
|
||||||
g_player[vm.g_p].ps->pos.x = g_player[vm.g_p].ps->opos.x;
|
|
||||||
g_player[vm.g_p].ps->pos.y = g_player[vm.g_p].ps->opos.y;
|
|
||||||
g_player[vm.g_p].ps->pos.z = g_player[vm.g_p].ps->opos.z;
|
|
||||||
g_player[vm.g_p].ps->ang = g_player[vm.g_p].ps->oang;
|
|
||||||
updatesector(g_player[vm.g_p].ps->pos.x,g_player[vm.g_p].ps->pos.y,&g_player[vm.g_p].ps->cursectnum);
|
|
||||||
P_UpdateScreenPal(g_player[vm.g_p].ps);
|
|
||||||
|
|
||||||
j = headspritestat[STAT_ACTOR];
|
|
||||||
while (j >= 0)
|
|
||||||
{
|
|
||||||
if (sprite[j].picnum==CAMERA1)
|
|
||||||
sprite[j].yvel = 0;
|
|
||||||
j = nextspritestat[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
j = sprite[g_player[vm.g_p].ps->i].extra;
|
j = sprite[g_player[vm.g_p].ps->i].extra;
|
||||||
|
|
||||||
|
|
|
@ -1972,7 +1972,7 @@ int32_t Sect_DamageCeiling(int32_t sn)
|
||||||
void A_DamageObject(int32_t i,int32_t sn)
|
void A_DamageObject(int32_t i,int32_t sn)
|
||||||
{
|
{
|
||||||
int16_t j;
|
int16_t j;
|
||||||
int32_t k, p, rpg=0;
|
int32_t k, rpg=0;
|
||||||
spritetype *s;
|
spritetype *s;
|
||||||
// int32_t switchpicnum = PN;
|
// int32_t switchpicnum = PN;
|
||||||
|
|
||||||
|
@ -2411,25 +2411,10 @@ void A_DamageObject(int32_t i,int32_t sn)
|
||||||
|
|
||||||
if (sprite[i].statnum == STAT_PLAYER)
|
if (sprite[i].statnum == STAT_PLAYER)
|
||||||
{
|
{
|
||||||
p = sprite[i].yvel;
|
DukePlayer_t *ps = g_player[sprite[i].yvel].ps;
|
||||||
if (g_player[p].ps->newowner >= 0)
|
|
||||||
{
|
|
||||||
g_player[p].ps->newowner = -1;
|
|
||||||
g_player[p].ps->pos.x = g_player[p].ps->opos.x;
|
|
||||||
g_player[p].ps->pos.y = g_player[p].ps->opos.y;
|
|
||||||
g_player[p].ps->pos.z = g_player[p].ps->opos.z;
|
|
||||||
g_player[p].ps->ang = g_player[p].ps->oang;
|
|
||||||
|
|
||||||
updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&g_player[p].ps->cursectnum);
|
if (ps->newowner >= 0)
|
||||||
P_UpdateScreenPal(g_player[p].ps);
|
G_ClearCameraView(ps);
|
||||||
|
|
||||||
j = headspritestat[STAT_ACTOR];
|
|
||||||
while (j >= 0)
|
|
||||||
{
|
|
||||||
if (sprite[j].picnum==CAMERA1) sprite[j].yvel = 0;
|
|
||||||
j = nextspritestat[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sprite[i].xrepeat < 24 && sprite[sn].picnum == SHRINKSPARK)
|
if (sprite[i].xrepeat < 24 && sprite[sn].picnum == SHRINKSPARK)
|
||||||
return;
|
return;
|
||||||
|
@ -3302,22 +3287,7 @@ void P_CheckSectors(int32_t snum)
|
||||||
CLEARCAMERAS:
|
CLEARCAMERAS:
|
||||||
|
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
{
|
G_ClearCameraView(p);
|
||||||
Bmemcpy(p, &p->opos.x, sizeof(vec3_t));
|
|
||||||
p->ang = p->oang;
|
|
||||||
p->newowner = -1;
|
|
||||||
|
|
||||||
updatesector(p->pos.x,p->pos.y,&p->cursectnum);
|
|
||||||
P_UpdateScreenPal(p);
|
|
||||||
|
|
||||||
|
|
||||||
i = headspritestat[STAT_ACTOR];
|
|
||||||
while (i >= 0)
|
|
||||||
{
|
|
||||||
if (PN==CAMERA1) SP = 0;
|
|
||||||
i = nextspritestat[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (p->newowner >= 0)
|
else if (p->newowner >= 0)
|
||||||
p->newowner = -1;
|
p->newowner = -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue