- palette stuff, input functions corrected.

This commit is contained in:
Christoph Oelckers 2020-07-03 16:17:37 +02:00
parent 4fbd476b17
commit 7f96d182b7
9 changed files with 21 additions and 49 deletions

View file

@ -382,12 +382,12 @@ inline int PlayerInputBits(int pl, int bits)
return (g_player[pl].input->bits & bits);
}
inline bool PlayerInputSideVel(int pl)
inline int PlayerInputSideVel(int pl)
{
return g_player[pl].input->svel;
}
inline bool PlayerInputForwardVel(int pl)
inline int PlayerInputForwardVel(int pl)
{
return g_player[pl].input->fvel;
}

View file

@ -40,18 +40,21 @@ BEGIN_DUKE_NS
//---------------------------------------------------------------------------
//
// setpal
// why is this such a mess?
//
//---------------------------------------------------------------------------
void setpal_(struct player_struct* p) // cannot be activated yet.
void setpal(struct player_struct* p)
{
int palette;;
int palette;
restorepalette = 1;
if (p->DrugMode) palette = DRUGPAL;
else if (p->heat_on || (sector[p->cursectnum].ceilingpicnum >= TILE_FLOORSLIME && sector[p->cursectnum].ceilingpicnum <= TILE_FLOORSLIME+2)) palette = SLIMEPAL;
else if (sector[p->cursectnum].lotag == 2) palette = WATERPAL;
else if (p->heat_on) palette = SLIMEPAL;
else if (p->cursectnum < 0) palette = BASEPAL; // don't crash if out of range.
else if (sector[p->cursectnum].ceilingpicnum >= TILE_FLOORSLIME && sector[p->cursectnum].ceilingpicnum <= TILE_FLOORSLIME + 2) palette = SLIMEPAL, ++restorepalette;
else if (sector[p->cursectnum].lotag == ST_2_UNDERWATER) palette = WATERPAL, ++restorepalette;
else palette = BASEPAL;
videoSetPalette(palette, 0);
p->palette = palette;
}
//---------------------------------------------------------------------------

View file

@ -413,12 +413,7 @@ void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer);
void P_ProcessInput(int playerNum);
void P_DHProcessInput(int playerNum);
void quickkill(DukePlayer_t* pPlayer);
void P_UpdateScreenPal(DukePlayer_t *pPlayer);
inline void setpal(DukePlayer_t* pPlayer)
{
P_UpdateScreenPal(pPlayer);
}
void setpal(DukePlayer_t* pPlayer);
void P_EndLevel(void);
void P_CheckWeaponI(int playerNum);
int P_GetOverheadPal(const DukePlayer_t *pPlayer);

View file

@ -1541,6 +1541,7 @@ void checksectors_d(int snum)
if (p->newowner >= 0)
{
Printf("%d, %d\n", PlayerInputSideVel(snum), PlayerInputForwardVel(snum));
if (abs(PlayerInputSideVel(snum)) > 768 || abs(PlayerInputForwardVel(snum)) > 768)
{
i = -1;

View file

@ -76,7 +76,6 @@ RECHECK:
ud.recstat = 0;
//fadepal(0,0,0, 0,252,28);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
drawbackground();
//M_DisplayMenus();
videoNextPage();

View file

@ -748,7 +748,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
{
pPlayer->drug_aspect = aspect;
}
P_UpdateScreenPal(pPlayer);
setpal(pPlayer);
}
else if (pPlayer->drug_stat[0] == 3)
{
@ -766,7 +766,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
{
pPlayer->drug_aspect = aspect;
}
P_UpdateScreenPal(pPlayer);
setpal(pPlayer);
}
else if (pPlayer->drug_stat[0] == 2)
{
@ -779,7 +779,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
pPlayer->drug_stat[2]++;
aspect = pPlayer->drug_stat[2] * 500 + viewingRange * 3;
pPlayer->drug_aspect = aspect;
P_UpdateScreenPal(pPlayer);
setpal(pPlayer);
}
}
else
@ -796,7 +796,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
pPlayer->drug_stat[2]--;
aspect = pPlayer->drug_stat[2] * 500 + viewingRange * 3;
pPlayer->drug_aspect = aspect;
P_UpdateScreenPal(pPlayer);
setpal(pPlayer);
}
}
@ -811,7 +811,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
renderSetAspect(mulscale16(viewingRange, viewingrange), yxaspect);
}
P_UpdateScreenPal(pPlayer);
setpal(pPlayer);
}
if (pPlayer->newowner < 0)
@ -1621,7 +1621,7 @@ static int G_EndOfLevel(void)
{
STAT_Update(ud.eog || (currentLevel->flags & MI_FORCEEOG));
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
P_UpdateScreenPal(g_player[myconnectindex].ps);
setpal(g_player[myconnectindex].ps);
if (g_player[myconnectindex].ps->gm&MODE_EOL)
{

View file

@ -45,32 +45,6 @@ void P_AddKills(DukePlayer_t * const pPlayer, uint16_t kills)
pPlayer->actors_killed += kills;
}
void P_UpdateScreenPal(DukePlayer_t * const pPlayer)
{
int inWater = 0;
int const playerSectnum = pPlayer->cursectnum;
if (pPlayer->DrugMode)
pPlayer->palette = DRUGPAL;
else if (pPlayer->heat_on)
pPlayer->palette = SLIMEPAL;
else if (playerSectnum < 0)
pPlayer->palette = BASEPAL;
else if (sector[playerSectnum].ceilingpicnum >= TILE_FLOORSLIME && sector[playerSectnum].ceilingpicnum <= TILE_FLOORSLIME + 2)
{
pPlayer->palette = SLIMEPAL;
inWater = 1;
}
else
{
pPlayer->palette = (sector[pPlayer->cursectnum].lotag == ST_2_UNDERWATER) ? WATERPAL : BASEPAL;
inWater = 1;
}
restorepalette = 1+inWater;
}
int P_GetOverheadPal(DukePlayer_t const * pPlayer)
{
return sprite[pPlayer->i].pal;

View file

@ -510,7 +510,7 @@ int G_EnterLevel(int gameMode)
//g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
P_UpdateScreenPal(g_player[myconnectindex].ps);
setpal(g_player[myconnectindex].ps);
renderFlushPerms();
everyothertime = 0;

View file

@ -1417,7 +1417,7 @@ static void postloadplayer(int32_t savegamep)
}
//3
P_UpdateScreenPal(g_player[myconnectindex].ps);
setpal(g_player[myconnectindex].ps);
restorepalette = -1;
//4