mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-30 13:21:04 +00:00
- changed Duke/RR palette handling to only retrieve the currently active palette right before rendering.
Storing this in the player_struct is pointless and a relic from having to use real hardware palette switches. With this now just being a translation index being passed to the backend it can be cheaply retrieved right when used and nowhere else. Also making some changes to how RRRA's psychedelic cactus handles the projection. This fixes issues with occasionally passing a bad matrix.
This commit is contained in:
parent
e8ccd9bc8c
commit
d8e331ef0f
16 changed files with 6 additions and 39 deletions
|
@ -208,7 +208,6 @@ void clearcamera(player_struct* ps)
|
||||||
ps->posz = ps->oposz;
|
ps->posz = ps->oposz;
|
||||||
ps->angle.restore();
|
ps->angle.restore();
|
||||||
updatesector(ps->posx, ps->posy, &ps->cursectnum);
|
updatesector(ps->posx, ps->posy, &ps->cursectnum);
|
||||||
setpal(ps);
|
|
||||||
|
|
||||||
DukeStatIterator it(STAT_ACTOR);
|
DukeStatIterator it(STAT_ACTOR);
|
||||||
while (auto k = it.Next())
|
while (auto k = it.Next())
|
||||||
|
|
|
@ -2150,8 +2150,6 @@ void movetransports_d(void)
|
||||||
changespritesect(act2, Owner->s.sectnum);
|
changespritesect(act2, Owner->s.sectnum);
|
||||||
setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz + PHEIGHT);
|
setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz + PHEIGHT);
|
||||||
|
|
||||||
setpal(&ps[p]);
|
|
||||||
|
|
||||||
if ((krand() & 255) < 32)
|
if ((krand() & 255) < 32)
|
||||||
spawn(act2, WATERSPLASH2);
|
spawn(act2, WATERSPLASH2);
|
||||||
|
|
||||||
|
@ -2474,7 +2472,6 @@ static void greenslime(DDukeActor *actor)
|
||||||
ps[p].angle.restore();
|
ps[p].angle.restore();
|
||||||
|
|
||||||
updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum);
|
updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum);
|
||||||
setpal(&ps[p]);
|
|
||||||
|
|
||||||
DukeStatIterator it(STAT_ACTOR);
|
DukeStatIterator it(STAT_ACTOR);
|
||||||
while (auto ac = it.Next())
|
while (auto ac = it.Next())
|
||||||
|
|
|
@ -1735,8 +1735,6 @@ void movetransports_r(void)
|
||||||
|
|
||||||
changespritesect(act2, Owner->s.sectnum);
|
changespritesect(act2, Owner->s.sectnum);
|
||||||
|
|
||||||
setpal(&ps[p]);
|
|
||||||
|
|
||||||
if ((krand() & 255) < 32)
|
if ((krand() & 255) < 32)
|
||||||
spawn(ps[p].GetActor(), WATERSPLASH2);
|
spawn(ps[p].GetActor(), WATERSPLASH2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ DDukeActor* aim(DDukeActor* s, int aang);
|
||||||
void checkweapons(struct player_struct* const p);
|
void checkweapons(struct player_struct* const p);
|
||||||
int findotherplayer(int p, int* d);
|
int findotherplayer(int p, int* d);
|
||||||
void quickkill(struct player_struct* p);
|
void quickkill(struct player_struct* p);
|
||||||
void setpal(struct player_struct* p);
|
int setpal(struct player_struct* p);
|
||||||
int madenoise(int playerNum);
|
int madenoise(int playerNum);
|
||||||
int haskey(int sect, int snum);
|
int haskey(int sect, int snum);
|
||||||
void shootbloodsplat(DDukeActor* i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST);
|
void shootbloodsplat(DDukeActor* i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST);
|
||||||
|
|
|
@ -325,7 +325,6 @@ void GameInterface::app_init()
|
||||||
registerosdcommands();
|
registerosdcommands();
|
||||||
|
|
||||||
screenpeek = myconnectindex;
|
screenpeek = myconnectindex;
|
||||||
ps[myconnectindex].palette = BASEPAL;
|
|
||||||
|
|
||||||
for (int j = numplayers; j < ud.multimode; j++)
|
for (int j = numplayers; j < ud.multimode; j++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -586,7 +586,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang)
|
||||||
if (j < 22000) j = 22000;
|
if (j < 22000) j = 22000;
|
||||||
else if (j > (65536 << 1)) j = (65536 << 1);
|
else if (j > (65536 << 1)) j = (65536 << 1);
|
||||||
|
|
||||||
DrawTexture(twod, tileGetTexture(i), xdim / 2. + x1 / 4096., ydim / 2. + y1 / 4096., DTA_TranslationIndex, TRANSLATION(Translation_Remap + pp.palette, pspr->pal), DTA_CenterOffset, true,
|
DrawTexture(twod, tileGetTexture(i), xdim / 2. + x1 / 4096., ydim / 2. + y1 / 4096., DTA_TranslationIndex, TRANSLATION(Translation_Remap + setpal(&pp), pspr->pal), DTA_CenterOffset, true,
|
||||||
DTA_Rotate, daang * (-360./2048), DTA_Color, shadeToLight(pspr->shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE);
|
DTA_Rotate, daang * (-360./2048), DTA_Color, shadeToLight(pspr->shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2054,7 +2054,6 @@ int ParseState::parse(void)
|
||||||
ps[g_p].posz = ps[g_p].oposz;
|
ps[g_p].posz = ps[g_p].oposz;
|
||||||
ps[g_p].angle.restore();
|
ps[g_p].angle.restore();
|
||||||
updatesector(ps[g_p].posx,ps[g_p].posy,&ps[g_p].cursectnum);
|
updatesector(ps[g_p].posx,ps[g_p].posy,&ps[g_p].cursectnum);
|
||||||
setpal(&ps[g_p]);
|
|
||||||
|
|
||||||
DukeStatIterator it(STAT_ACTOR);
|
DukeStatIterator it(STAT_ACTOR);
|
||||||
while (auto j = it.Next())
|
while (auto j = it.Next())
|
||||||
|
@ -2273,7 +2272,6 @@ int ParseState::parse(void)
|
||||||
resetinventory(g_p);
|
resetinventory(g_p);
|
||||||
resetweapons(g_p);
|
resetweapons(g_p);
|
||||||
}
|
}
|
||||||
setpal(&ps[g_p]);
|
|
||||||
break;
|
break;
|
||||||
case concmd_ifcoop:
|
case concmd_ifcoop:
|
||||||
parseifelse(ud.coop || numplayers > 2);
|
parseifelse(ud.coop || numplayers > 2);
|
||||||
|
|
|
@ -136,7 +136,6 @@ void hud_input(int plnum)
|
||||||
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0 && p->heat_amount > 0)
|
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0 && p->heat_amount > 0)
|
||||||
{
|
{
|
||||||
p->heat_on = !p->heat_on;
|
p->heat_on = !p->heat_on;
|
||||||
setpal(p);
|
|
||||||
p->inven_icon = 5;
|
p->inven_icon = 5;
|
||||||
S_PlayActorSound(NITEVISION_ONOFF, pact);
|
S_PlayActorSound(NITEVISION_ONOFF, pact);
|
||||||
FTA(106 + (!p->heat_on), p);
|
FTA(106 + (!p->heat_on), p);
|
||||||
|
|
|
@ -125,7 +125,7 @@ void calcviewpitch(player_struct *p, double factor)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void setpal(struct player_struct* p)
|
int setpal(struct player_struct* p)
|
||||||
{
|
{
|
||||||
int palette;
|
int palette;
|
||||||
if (p->DrugMode) palette = DRUGPAL;
|
if (p->DrugMode) palette = DRUGPAL;
|
||||||
|
@ -134,7 +134,7 @@ void setpal(struct player_struct* p)
|
||||||
else if (sector[p->cursectnum].ceilingpicnum >= TILE_FLOORSLIME && sector[p->cursectnum].ceilingpicnum <= TILE_FLOORSLIME + 2) palette = SLIMEPAL;
|
else if (sector[p->cursectnum].ceilingpicnum >= TILE_FLOORSLIME && sector[p->cursectnum].ceilingpicnum <= TILE_FLOORSLIME + 2) palette = SLIMEPAL;
|
||||||
else if (sector[p->cursectnum].lotag == ST_2_UNDERWATER) palette = WATERPAL;
|
else if (sector[p->cursectnum].lotag == ST_2_UNDERWATER) palette = WATERPAL;
|
||||||
else palette = BASEPAL;
|
else palette = BASEPAL;
|
||||||
p->palette = palette;
|
return palette;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
|
@ -1474,7 +1474,6 @@ int doincrements_d(struct player_struct* p)
|
||||||
p->heat_on = 0;
|
p->heat_on = 0;
|
||||||
checkavailinven(p);
|
checkavailinven(p);
|
||||||
S_PlayActorSound(NITEVISION_ONOFF, pact);
|
S_PlayActorSound(NITEVISION_ONOFF, pact);
|
||||||
setpal(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,6 @@ void resetplayerstats(int snum)
|
||||||
p->random_club_frame= 0;
|
p->random_club_frame= 0;
|
||||||
p->on_warping_sector = 0;
|
p->on_warping_sector = 0;
|
||||||
p->spritebridge = 0;
|
p->spritebridge = 0;
|
||||||
p->palette = 0;
|
|
||||||
|
|
||||||
if(p->steroids_amount < 400 )
|
if(p->steroids_amount < 400 )
|
||||||
{
|
{
|
||||||
|
@ -166,7 +165,6 @@ void resetplayerstats(int snum)
|
||||||
p->knuckle_incs = 1;
|
p->knuckle_incs = 1;
|
||||||
p->fist_incs = 0;
|
p->fist_incs = 0;
|
||||||
p->knee_incs = 0;
|
p->knee_incs = 0;
|
||||||
setpal(p);
|
|
||||||
p->stairs = 0;
|
p->stairs = 0;
|
||||||
p->noise_x = 0;
|
p->noise_x = 0;
|
||||||
p->noise_y = 0;
|
p->noise_y = 0;
|
||||||
|
@ -962,7 +960,6 @@ void enterlevel(MapRecord *mi, int gamemode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resetmys();
|
resetmys();
|
||||||
setpal(&ps[myconnectindex]);
|
|
||||||
|
|
||||||
everyothertime = 0;
|
everyothertime = 0;
|
||||||
global_random = 0;
|
global_random = 0;
|
||||||
|
@ -1063,7 +1060,6 @@ void exitlevel(MapRecord *nextlevel)
|
||||||
{
|
{
|
||||||
bool endofgame = nextlevel == nullptr;
|
bool endofgame = nextlevel == nullptr;
|
||||||
STAT_Update(endofgame);
|
STAT_Update(endofgame);
|
||||||
setpal(&ps[myconnectindex]);
|
|
||||||
StopCommentary();
|
StopCommentary();
|
||||||
|
|
||||||
dobonus(endofgame? -1 : 0, [=](bool)
|
dobonus(endofgame? -1 : 0, [=](bool)
|
||||||
|
|
|
@ -323,16 +323,13 @@ void setdrugmode(player_struct *p, int oyrepeat)
|
||||||
var_8c = oyrepeat + p->drug_stat[1] * 5000;
|
var_8c = oyrepeat + p->drug_stat[1] * 5000;
|
||||||
if (oyrepeat * 3 < var_8c)
|
if (oyrepeat * 3 < var_8c)
|
||||||
{
|
{
|
||||||
renderSetAspect(oyrepeat * 3, yxaspect);
|
|
||||||
p->drug_aspect = oyrepeat * 3;
|
p->drug_aspect = oyrepeat * 3;
|
||||||
p->drug_stat[0] = 2;
|
p->drug_stat[0] = 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderSetAspect(var_8c, yxaspect);
|
|
||||||
p->drug_aspect = var_8c;
|
p->drug_aspect = var_8c;
|
||||||
}
|
}
|
||||||
setpal(p);
|
|
||||||
}
|
}
|
||||||
else if (p->drug_stat[0] == 3)
|
else if (p->drug_stat[0] == 3)
|
||||||
{
|
{
|
||||||
|
@ -340,7 +337,6 @@ void setdrugmode(player_struct *p, int oyrepeat)
|
||||||
var_8c = oyrepeat + p->drug_stat[1] * 5000;
|
var_8c = oyrepeat + p->drug_stat[1] * 5000;
|
||||||
if (var_8c < oyrepeat)
|
if (var_8c < oyrepeat)
|
||||||
{
|
{
|
||||||
renderSetAspect(oyrepeat, yxaspect);
|
|
||||||
p->DrugMode = 0;
|
p->DrugMode = 0;
|
||||||
p->drug_stat[0] = 0;
|
p->drug_stat[0] = 0;
|
||||||
p->drug_stat[2] = 0;
|
p->drug_stat[2] = 0;
|
||||||
|
@ -348,10 +344,8 @@ void setdrugmode(player_struct *p, int oyrepeat)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderSetAspect(var_8c, yxaspect);
|
|
||||||
p->drug_aspect = var_8c;
|
p->drug_aspect = var_8c;
|
||||||
}
|
}
|
||||||
setpal(p);
|
|
||||||
}
|
}
|
||||||
else if (p->drug_stat[0] == 2)
|
else if (p->drug_stat[0] == 2)
|
||||||
{
|
{
|
||||||
|
@ -362,9 +356,7 @@ void setdrugmode(player_struct *p, int oyrepeat)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->drug_stat[2]++;
|
p->drug_stat[2]++;
|
||||||
renderSetAspect(p->drug_stat[2] * 500 + oyrepeat * 3, yxaspect);
|
|
||||||
p->drug_aspect = oyrepeat * 3 + p->drug_stat[2] * 500;
|
p->drug_aspect = oyrepeat * 3 + p->drug_stat[2] * 500;
|
||||||
setpal(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -379,17 +371,14 @@ void setdrugmode(player_struct *p, int oyrepeat)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->drug_stat[2]--;
|
p->drug_stat[2]--;
|
||||||
renderSetAspect(p->drug_stat[2] * 500 + oyrepeat * 3, yxaspect);
|
|
||||||
p->drug_aspect = oyrepeat * 3 + p->drug_stat[2] * 500;
|
p->drug_aspect = oyrepeat * 3 + p->drug_stat[2] * 500;
|
||||||
setpal(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (p->DrugMode > 0)
|
if (p->DrugMode > 0)
|
||||||
{
|
{
|
||||||
renderSetAspect(p->drug_aspect, yxaspect);
|
renderSetAspect(p->drug_aspect, yxaspect);
|
||||||
setpal(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,7 +503,7 @@ void displayrooms(int snum, double smoothratio)
|
||||||
|
|
||||||
// The camera texture must be rendered with the base palette, so this is the only place where the current global palette can be set.
|
// The camera texture must be rendered with the base palette, so this is the only place where the current global palette can be set.
|
||||||
// The setting here will be carried over to the rendering of the weapon sprites, but other 2D content will always default to the main palette.
|
// The setting here will be carried over to the rendering of the weapon sprites, but other 2D content will always default to the main palette.
|
||||||
setgamepalette(p->palette);
|
setgamepalette(setpal(p));
|
||||||
if (ud.cameraactor)
|
if (ud.cameraactor)
|
||||||
{
|
{
|
||||||
spritetype* s;
|
spritetype* s;
|
||||||
|
|
|
@ -133,7 +133,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
||||||
("angle", w.angle)
|
("angle", w.angle)
|
||||||
("horizon", w.horizon)
|
("horizon", w.horizon)
|
||||||
("gotweapon", w.gotweapon)
|
("gotweapon", w.gotweapon)
|
||||||
("palette", w.palette)
|
|
||||||
("pals", w.pals)
|
("pals", w.pals)
|
||||||
("fricx", w.fric.x)
|
("fricx", w.fric.x)
|
||||||
("fricy", w.fric.y)
|
("fricy", w.fric.y)
|
||||||
|
@ -476,7 +475,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
||||||
cameraclock = 0;
|
cameraclock = 0;
|
||||||
ps[myconnectindex].over_shoulder_on = 1;
|
ps[myconnectindex].over_shoulder_on = 1;
|
||||||
}
|
}
|
||||||
setpal(&ps[myconnectindex]);
|
|
||||||
|
|
||||||
memset(gotpic, 0, sizeof(gotpic));
|
memset(gotpic, 0, sizeof(gotpic));
|
||||||
if (isRR()) cacheit_r(); else cacheit_d();
|
if (isRR()) cacheit_r(); else cacheit_d();
|
||||||
|
|
|
@ -1458,7 +1458,6 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
|
||||||
ps[p].angle.restore();
|
ps[p].angle.restore();
|
||||||
|
|
||||||
updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum);
|
updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum);
|
||||||
setpal(&ps[p]);
|
|
||||||
|
|
||||||
DukeStatIterator it(STAT_ACTOR);
|
DukeStatIterator it(STAT_ACTOR);
|
||||||
while (auto j = it.Next())
|
while (auto j = it.Next())
|
||||||
|
@ -1715,7 +1714,6 @@ void checksectors_d(int snum)
|
||||||
|
|
||||||
j = p->cursectnum;
|
j = p->cursectnum;
|
||||||
p->cursectnum = spr->sectnum;
|
p->cursectnum = spr->sectnum;
|
||||||
setpal(p);
|
|
||||||
p->cursectnum = j;
|
p->cursectnum = j;
|
||||||
|
|
||||||
// parallaxtype = 2;
|
// parallaxtype = 2;
|
||||||
|
@ -1736,7 +1734,6 @@ void checksectors_d(int snum)
|
||||||
p->newOwner = nullptr;
|
p->newOwner = nullptr;
|
||||||
|
|
||||||
updatesector(p->posx, p->posy, &p->cursectnum);
|
updatesector(p->posx, p->posy, &p->cursectnum);
|
||||||
setpal(p);
|
|
||||||
|
|
||||||
DukeStatIterator it(STAT_ACTOR);
|
DukeStatIterator it(STAT_ACTOR);
|
||||||
while (auto act = it.Next())
|
while (auto act = it.Next())
|
||||||
|
|
|
@ -2406,7 +2406,6 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
|
||||||
ps[p].posz = ps[p].oposz;
|
ps[p].posz = ps[p].oposz;
|
||||||
|
|
||||||
updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum);
|
updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum);
|
||||||
setpal(&ps[p]);
|
|
||||||
|
|
||||||
DukeStatIterator it(STAT_EFFECTOR);
|
DukeStatIterator it(STAT_EFFECTOR);
|
||||||
while (auto act = it.Next())
|
while (auto act = it.Next())
|
||||||
|
|
|
@ -177,7 +177,6 @@ struct player_struct
|
||||||
FixedBitArray<MAX_WEAPONS> gotweapon;
|
FixedBitArray<MAX_WEAPONS> gotweapon;
|
||||||
|
|
||||||
// Palette management uses indices into the engine's palette table now.
|
// Palette management uses indices into the engine's palette table now.
|
||||||
unsigned int palette;
|
|
||||||
PalEntry pals;
|
PalEntry pals;
|
||||||
|
|
||||||
// this was a global variable originally.
|
// this was a global variable originally.
|
||||||
|
|
Loading…
Reference in a new issue