mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Factor out almost all instances of setting ...->pals.[rgbf] into P_PalFrom.
This is so that it may be intercepted in the future. The only code that's not replaced by the function call is with the CON interface to g_player[].ps->pals via player[].pals X and .pals_time. Also, comment out one instance because it's overwritten by a succeeding one. git-svn-id: https://svn.eduke32.com/eduke32@2643 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
2ac2cce38b
commit
3f798b048c
5 changed files with 40 additions and 75 deletions
|
@ -4636,12 +4636,7 @@ DETONATEB:
|
|||
}
|
||||
|
||||
if (sprite[s->owner].picnum != APLAYER)
|
||||
{
|
||||
g_player[p].ps->pals.r = 0;
|
||||
g_player[p].ps->pals.g = 32;
|
||||
g_player[p].ps->pals.b = 0;
|
||||
g_player[p].ps->pals.f = 32;
|
||||
}
|
||||
P_PalFrom(g_player[p].ps, 32, 0,32,0);
|
||||
|
||||
if (s->owner != i || ud.respawn_items == 0)
|
||||
{
|
||||
|
@ -4718,10 +4713,8 @@ DETONATEB:
|
|||
A_PlaySound(SHORT_CIRCUIT,i);
|
||||
|
||||
sprite[g_player[p].ps->i].extra --;
|
||||
g_player[p].ps->pals.f = 32;
|
||||
g_player[p].ps->pals.r = 32;
|
||||
g_player[p].ps->pals.g = 0;
|
||||
g_player[p].ps->pals.b = 0;
|
||||
|
||||
P_PalFrom(g_player[p].ps, 32, 32,0,0);
|
||||
}
|
||||
t[0] += 128;
|
||||
if (t[3] == 0)
|
||||
|
@ -5041,10 +5034,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
|
|||
p = A_FindPlayer(s,&x);
|
||||
if (x < 512)
|
||||
{
|
||||
g_player[p].ps->pals.f = 32;
|
||||
g_player[p].ps->pals.r = 32;
|
||||
g_player[p].ps->pals.g = 0;
|
||||
g_player[p].ps->pals.b = 0;
|
||||
P_PalFrom(g_player[p].ps, 32, 32,0,0);
|
||||
sprite[g_player[p].ps->i].extra -= 4;
|
||||
}
|
||||
|
||||
|
@ -5256,10 +5246,8 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
|
|||
if (!A_CheckSoundPlaying(g_player[p].ps->i,DUKE_LONGTERM_PAIN))
|
||||
A_PlaySound(DUKE_LONGTERM_PAIN,g_player[p].ps->i);
|
||||
sprite[g_player[p].ps->i].extra --;
|
||||
g_player[p].ps->pals.f = 32;
|
||||
g_player[p].ps->pals.r = 16;
|
||||
g_player[p].ps->pals.g = 0;
|
||||
g_player[p].ps->pals.b = 0;
|
||||
|
||||
P_PalFrom(g_player[p].ps, 32, 16,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7442,10 +7430,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
A_PlaySound(DUKE_LONGTERM_PAIN,g_player[p].ps->i);
|
||||
A_PlaySound(SHORT_CIRCUIT,g_player[p].ps->i);
|
||||
sprite[g_player[p].ps->i].extra -= 8+(krand()&7);
|
||||
g_player[p].ps->pals.f = 32;
|
||||
g_player[p].ps->pals.r = 16;
|
||||
g_player[p].ps->pals.g = 0;
|
||||
g_player[p].ps->pals.b = 0;
|
||||
|
||||
P_PalFrom(g_player[p].ps, 32, 16,0,0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3323,12 +3323,9 @@ nullquote:
|
|||
}
|
||||
else
|
||||
{
|
||||
palette_t *const pals = &g_player[vm.g_p].ps->pals;
|
||||
uint8_t f=*insptr++, r=*insptr++, g=*insptr++, b=*insptr++;
|
||||
|
||||
pals->f = *insptr++;
|
||||
pals->r = *insptr++;
|
||||
pals->g = *insptr++;
|
||||
pals->b = *insptr++;
|
||||
P_PalFrom(g_player[vm.g_p].ps, f, r,g,b);
|
||||
}
|
||||
continue;
|
||||
|
||||
|
|
|
@ -40,6 +40,14 @@ extern int32_t g_levelTextTime, ticrandomseed;
|
|||
int32_t g_numObituaries = 0;
|
||||
int32_t g_numSelfObituaries = 0;
|
||||
|
||||
void P_PalFrom(DukePlayer_t *p, uint8_t f, uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
p->pals.f = f;
|
||||
p->pals.r = r;
|
||||
p->pals.g = g;
|
||||
p->pals.b = b;
|
||||
}
|
||||
|
||||
void P_UpdateScreenPal(DukePlayer_t *p)
|
||||
{
|
||||
int32_t intowater = 0;
|
||||
|
@ -101,10 +109,7 @@ static void P_IncurDamage(DukePlayer_t *p)
|
|||
|
||||
void P_QuickKill(DukePlayer_t *p)
|
||||
{
|
||||
p->pals.r = 48;
|
||||
p->pals.g = 48;
|
||||
p->pals.b = 48;
|
||||
p->pals.f = 48;
|
||||
P_PalFrom(p, 48, 48,48,48);
|
||||
|
||||
sprite[p->i].extra = 0;
|
||||
sprite[p->i].cstat |= 32768;
|
||||
|
@ -3604,10 +3609,7 @@ void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
|
|||
sprite[p->i].extra -= 5;
|
||||
|
||||
p->hurt_delay = 16;
|
||||
p->pals.f = 32;
|
||||
p->pals.r = 32;
|
||||
p->pals.g = 0;
|
||||
p->pals.b = 0;
|
||||
P_PalFrom(p, 32, 32,0,0);
|
||||
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
||||
}
|
||||
}
|
||||
|
@ -3632,10 +3634,7 @@ void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
|
|||
sprite[p->i].extra -= 5;
|
||||
|
||||
p->hurt_delay = 16;
|
||||
p->pals.f = 32;
|
||||
p->pals.r = 32;
|
||||
p->pals.g = 0;
|
||||
p->pals.b = 0;
|
||||
P_PalFrom(p, 32, 32,0,0);
|
||||
|
||||
p->vel.x = -(sintable[(p->ang+512)&2047]<<8);
|
||||
p->vel.y = -(sintable[(p->ang)&2047]<<8);
|
||||
|
@ -3684,10 +3683,9 @@ int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t j)
|
|||
{
|
||||
if (!A_CheckSoundPlaying(p->i,DUKE_LONGTERM_PAIN))
|
||||
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
||||
p->pals.r = 64;
|
||||
p->pals.g = 64;
|
||||
p->pals.b = 64;
|
||||
p->pals.f = 32;
|
||||
|
||||
P_PalFrom(p, 32, 64,64,64);
|
||||
|
||||
s->extra -= 1+(krand()&3);
|
||||
if (!A_CheckSoundPlaying(p->i,SHORT_CIRCUIT))
|
||||
A_PlaySound(SHORT_CIRCUIT,p->i);
|
||||
|
@ -3703,10 +3701,8 @@ int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t j)
|
|||
{
|
||||
if (!A_CheckSoundPlaying(p->i,DUKE_LONGTERM_PAIN))
|
||||
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
||||
p->pals.r = 0;
|
||||
p->pals.g = 8;
|
||||
p->pals.b = 0;
|
||||
p->pals.f = 32;
|
||||
|
||||
P_PalFrom(p, 32, 0,8,0);
|
||||
s->extra -= 1+(krand()&3);
|
||||
}
|
||||
}
|
||||
|
@ -3720,10 +3716,8 @@ int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t j)
|
|||
{
|
||||
if (!A_CheckSoundPlaying(p->i,DUKE_LONGTERM_PAIN))
|
||||
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
||||
p->pals.r = 8;
|
||||
p->pals.g = 0;
|
||||
p->pals.b = 0;
|
||||
p->pals.f = 32;
|
||||
|
||||
P_PalFrom(p, 32, 8,0,0);
|
||||
s->extra -= 1+(krand()&3);
|
||||
}
|
||||
}
|
||||
|
@ -3767,10 +3761,8 @@ void P_FragPlayer(int32_t snum)
|
|||
|
||||
if (s->pal != 1)
|
||||
{
|
||||
p->pals.r = 63;
|
||||
p->pals.g = 0;
|
||||
p->pals.b = 0;
|
||||
p->pals.f = 63;
|
||||
P_PalFrom(p, 63, 63,0,0);
|
||||
|
||||
p->pos.z -= (16<<8);
|
||||
s->z -= (16<<8);
|
||||
|
||||
|
@ -4398,10 +4390,8 @@ int32_t P_DoFist(DukePlayer_t *p)
|
|||
{
|
||||
if (ud.recstat == 1) G_CloseDemoWrite();
|
||||
S_PlaySound(PIPEBOMB_EXPLODE);
|
||||
p->pals.r = 64;
|
||||
p->pals.g = 64;
|
||||
p->pals.b = 64;
|
||||
p->pals.f = 48;
|
||||
|
||||
P_PalFrom(p, 48, 64,64,64);
|
||||
}
|
||||
|
||||
if (p->fist_incs > 42)
|
||||
|
@ -5043,10 +5033,8 @@ void P_ProcessInput(int32_t snum)
|
|||
if (s->extra <= 0)
|
||||
{
|
||||
A_PlaySound(SQUISHED,p->i);
|
||||
p->pals.r = 63;
|
||||
p->pals.g = 0;
|
||||
p->pals.b = 0;
|
||||
p->pals.f = 63;
|
||||
|
||||
// P_PalFrom(p, 63, 63,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5054,10 +5042,7 @@ void P_ProcessInput(int32_t snum)
|
|||
A_PlaySound(DUKE_LAND_HURT,p->i);
|
||||
}
|
||||
|
||||
p->pals.r = 16;
|
||||
p->pals.g = 0;
|
||||
p->pals.b = 0;
|
||||
p->pals.f = 32;
|
||||
P_PalFrom(p, 32, 16,0,0);
|
||||
}
|
||||
else if (p->vel.z > 2048)
|
||||
A_PlaySound(DUKE_LAND,p->i);
|
||||
|
@ -5212,10 +5197,8 @@ void P_ProcessInput(int32_t snum)
|
|||
{
|
||||
if (!A_CheckSoundPlaying(p->i,DUKE_LONGTERM_PAIN))
|
||||
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
||||
p->pals.r = 0;
|
||||
p->pals.g = 8;
|
||||
p->pals.b = 0;
|
||||
p->pals.f = 32;
|
||||
|
||||
P_PalFrom(p, 32, 0,8,0);
|
||||
s->extra--;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,5 +289,6 @@ void P_ProcessWeapon(int32_t snum);
|
|||
void P_QuickKill(DukePlayer_t *p);
|
||||
void P_SelectNextInvItem(DukePlayer_t *p);
|
||||
void P_UpdateScreenPal(DukePlayer_t *p);
|
||||
void P_PalFrom(DukePlayer_t *p, uint8_t f, uint8_t r, uint8_t g, uint8_t b);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -3300,10 +3300,8 @@ void P_CheckSectors(int32_t snum)
|
|||
case PLUG__STATIC:
|
||||
A_PlaySound(SHORT_CIRCUIT,p->i);
|
||||
sprite[p->i].extra -= 2+(krand()&3);
|
||||
p->pals.r = 48;
|
||||
p->pals.g = 48;
|
||||
p->pals.b = 64;
|
||||
p->pals.f = 32;
|
||||
|
||||
P_PalFrom(p, 32, 48,48,64);
|
||||
break;
|
||||
|
||||
case VIEWSCREEN__STATIC:
|
||||
|
|
Loading…
Reference in a new issue