mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
- migrated displayrest and took the opportunity to un-fuck the palette management.
This commit is contained in:
parent
b6f410923e
commit
34874d1a21
25 changed files with 251 additions and 398 deletions
|
@ -2978,7 +2978,7 @@ void UpdateDacs(int nPalette, bool bNoTint)
|
|||
nGreen = ClipRange(nGreen, -255, 255);
|
||||
nBlue = ClipRange(nBlue, -255, 255);
|
||||
|
||||
videoSetPalette(nPalette, 0);
|
||||
videoSetPalette(nPalette);
|
||||
videoTintBlood(nRed, nGreen, nBlue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -422,10 +422,9 @@ static int32_t tint_blood_r = 0, tint_blood_g = 0, tint_blood_b = 0;
|
|||
glblend_t glblend[MAXBLENDTABS];
|
||||
|
||||
|
||||
void videoSetPalette(int palid, ESetPalFlags flags)
|
||||
void videoSetPalette(int palid)
|
||||
{
|
||||
curbasepal = (GPalette.GetTranslation(Translation_BasePalettes, palid) == nullptr)? 0 : palid;
|
||||
if ((flags & Pal_DontResetFade) == 0) palfadergb = 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -149,7 +149,7 @@ inline void videoSetBrightness(int brightness)
|
|||
typedef TFlags<ESetPalFlag> ESetPalFlags;
|
||||
DEFINE_TFLAGS_OPERATORS(ESetPalFlags)
|
||||
|
||||
void videoSetPalette(int dapalid, ESetPalFlags flags);
|
||||
void videoSetPalette(int dapalid);
|
||||
inline void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset)
|
||||
{
|
||||
palfadergb.r = r;
|
||||
|
|
|
@ -5635,7 +5635,7 @@ int GameInterface::app_main()
|
|||
if (g_networkMode != NET_DEDICATED_SERVER)
|
||||
{
|
||||
videoInit();
|
||||
videoSetPalette(myplayer.palette, 0);
|
||||
videoSetPalette(myplayer.palette);
|
||||
}
|
||||
|
||||
// check if the minifont will support lowercase letters (3136-3161)
|
||||
|
|
|
@ -91,7 +91,8 @@ void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, ESetPalFlags set)
|
|||
if (player != g_player[screenpeek].ps)
|
||||
return;
|
||||
|
||||
videoSetPalette(palid, set);
|
||||
videoSetPalette(palid);
|
||||
if (!set) videoclearFade();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ void MyLoadPalette()
|
|||
//
|
||||
//kread(hFile, kenpal, sizeof(kenpal));
|
||||
//kclose(hFile);
|
||||
videoSetPalette(BASEPAL, 0);
|
||||
videoSetPalette(BASEPAL);
|
||||
SetOverscan(BASEPAL);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ void GrabPalette()
|
|||
{
|
||||
SetOverscan(BASEPAL);
|
||||
|
||||
videoSetPalette(BASEPAL, 0);
|
||||
videoSetPalette(BASEPAL);
|
||||
|
||||
nPalDiff = 0;
|
||||
nPalDelay = 0;
|
||||
|
@ -183,7 +183,7 @@ void BlackOut()
|
|||
|
||||
void RestorePalette()
|
||||
{
|
||||
videoSetPalette(BASEPAL, 0);
|
||||
videoSetPalette(BASEPAL);
|
||||
videoTintBlood(0, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ set( PCH_SOURCES
|
|||
src/zz_player.cpp
|
||||
src/zz_premap.cpp
|
||||
src/zz_savegame.cpp
|
||||
src/zz_screens.cpp
|
||||
)
|
||||
|
||||
add_game_library2( duke )
|
||||
|
|
|
@ -650,7 +650,6 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
|
|||
{
|
||||
ps[screenpeek].visibility = -127;
|
||||
lastvisinc = (int)totalclock+32;
|
||||
//restorepalette = 1; // JBF 20040101: why?
|
||||
}
|
||||
t->shade = -127;
|
||||
break;
|
||||
|
|
|
@ -800,7 +800,6 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
|
|||
{
|
||||
ps[screenpeek].visibility = -127;
|
||||
lastvisinc = (int)totalclock+32;
|
||||
restorepalette = 1;
|
||||
t->pal = 0;
|
||||
}
|
||||
else if(t->picnum == FIRELASER)
|
||||
|
|
|
@ -13,6 +13,7 @@ void resetlanepics(void);
|
|||
void moveplayers();
|
||||
void doanimations();
|
||||
void movefx();
|
||||
void moveclouds(void);
|
||||
|
||||
void RANDOMSCRAP(spritetype* s, int i);
|
||||
void ms(short i);
|
||||
|
@ -191,4 +192,17 @@ void OffMotorcycle(player_struct *pl);
|
|||
void OnBoat(player_struct *pl, int snum);
|
||||
void OffBoat(player_struct *pl);
|
||||
|
||||
void drawstatusbar_d(int snum);
|
||||
void drawstatusbar_r(int snum);
|
||||
void drawoverheadmap(int cposx, int cposy, int czoom, int cang);
|
||||
void cameratext(int i);
|
||||
void dobonus(int bonusonly);
|
||||
void dobonus_d(bool bonusonly, CompletionFunc completion);
|
||||
void dobonus_r(bool bonusonly, CompletionFunc completion);
|
||||
|
||||
void displayrest(int32_t smoothratio);
|
||||
void drawbackground(void);
|
||||
void displayrooms(int32_t playerNum, int32_t smoothratio);
|
||||
void setgamepalette(int palid);
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -62,21 +62,14 @@ static inline int Menu_HaveUserMap(void)
|
|||
extern int32_t g_Shareware;
|
||||
extern int32_t cameraclock;
|
||||
extern int32_t cameradist;
|
||||
extern int32_t g_crosshairSum;
|
||||
extern int32_t g_doQuickSave;
|
||||
extern int32_t restorepalette;
|
||||
extern int32_t tempwallptr;
|
||||
|
||||
void G_BackToMenu(void);
|
||||
|
||||
void G_BonusScreen(int32_t bonusonly);
|
||||
void G_DisplayRest(int32_t smoothratio);
|
||||
void drawbackground(void);
|
||||
void displayrooms(int32_t playerNum,int32_t smoothratio);
|
||||
void G_HandleLocalKeys(void);
|
||||
void G_UpdatePlayerFromMenu(void);
|
||||
|
||||
void P_SetGamePalette(player_struct* player, uint32_t palid, ESetPalFlags flags);
|
||||
|
||||
void G_InitTimer(int32_t ticspersec);
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
|||
#include "statusbar.h"
|
||||
#include "st_start.h"
|
||||
#include "i_interface.h"
|
||||
#include "prediction.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -134,7 +135,7 @@ void gameexitfrommenu()
|
|||
// MP scoreboard
|
||||
if (playerswhenstarted > 1 && g_player[myconnectindex].ps->gm & MODE_GAME && !ud.coop)
|
||||
{
|
||||
G_BonusScreen(1);
|
||||
dobonus(1);
|
||||
}
|
||||
|
||||
// shareware and TEN screens
|
||||
|
@ -293,6 +294,194 @@ void drawbackground(void)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// this is from ZDoom
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void V_AddBlend (float r, float g, float b, float a, float v_blend[4])
|
||||
{
|
||||
r = clamp(r/255.f, 0.f, 0.25f);
|
||||
g = clamp(r/255.f, 0.f, 0.25f);
|
||||
b = clamp(r/255.f, 0.f, 0.25f);
|
||||
a = clamp(a/255.f, 0.f, 0.25f);
|
||||
|
||||
|
||||
float a2, a3;
|
||||
|
||||
if (a <= 0)
|
||||
return;
|
||||
a2 = v_blend[3] + (1-v_blend[3])*a; // new total alpha
|
||||
a3 = v_blend[3]/a2; // fraction of color from old
|
||||
|
||||
v_blend[0] = v_blend[0]*a3 + r*(1-a3);
|
||||
v_blend[1] = v_blend[1]*a3 + g*(1-a3);
|
||||
v_blend[2] = v_blend[2]*a3 + b*(1-a3);
|
||||
v_blend[3] = a2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void setgamepalette(int palid)
|
||||
{
|
||||
if (palid >= MAXBASEPALS || palid < 0) palid = 0;
|
||||
auto& fstint = lookups.tables[MAXPALOOKUPS - 1];
|
||||
if (palid == WATERPAL) fstint.tintColor = PalEntry(224, 192, 255);
|
||||
else if (palid == SLIMEPAL) fstint.tintColor = PalEntry(208, 255, 192);
|
||||
else fstint.tintColor = 0xffffff;
|
||||
videoSetPalette(palid);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// 'rest' in this case means everything not part of the 3D scene and its weapon sprite.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void displayrest(int smoothratio)
|
||||
{
|
||||
int i, j;
|
||||
unsigned char fader = 0, fadeg = 0, fadeb = 0, fadef = 0, tintr = 0, tintg = 0, tintb = 0, tintf = 0, dotint = 0;
|
||||
|
||||
struct player_struct* pp;
|
||||
walltype* wal;
|
||||
int cposx, cposy, cang;
|
||||
|
||||
pp = &ps[screenpeek];
|
||||
|
||||
float blend[4] = {};
|
||||
|
||||
// this does pain tinting etc from the CON
|
||||
V_AddBlend(pp->pals.r, pp->pals.g, pp->pals.b, pp->pals.a, blend);
|
||||
// loogies courtesy of being snotted on
|
||||
if (pp->loogcnt > 0)
|
||||
{
|
||||
V_AddBlend(0, 63, 0, (pp->loogcnt >> 1), blend);
|
||||
}
|
||||
if (blend[3])
|
||||
{
|
||||
// result must be multiplied by 4 and normalised to 255. (4*255 = 1020)
|
||||
auto comp = [&](int i) { return clamp(int(blend[i] * 1020), 0, 255); };
|
||||
videoFadePalette(comp(0), comp(1), comp(2), comp(3));
|
||||
}
|
||||
else
|
||||
videoclearFade();
|
||||
|
||||
i = pp->cursectnum;
|
||||
|
||||
show2dsector.Set(i);
|
||||
wal = &wall[sector[i].wallptr];
|
||||
for (j = sector[i].wallnum; j > 0; j--, wal++)
|
||||
{
|
||||
i = wal->nextsector;
|
||||
if (i < 0) continue;
|
||||
if (wal->cstat & 0x0071) continue;
|
||||
if (wall[wal->nextwall].cstat & 0x0071) continue;
|
||||
if (sector[i].lotag == 32767) continue;
|
||||
if (sector[i].ceilingz >= sector[i].floorz) continue;
|
||||
show2dsector.Set(i);
|
||||
}
|
||||
|
||||
if (ud.camerasprite == -1)
|
||||
{
|
||||
if (ud.overhead_on != 2)
|
||||
{
|
||||
if (!isRR() && pp->newowner >= 0)
|
||||
cameratext(pp->newowner);
|
||||
else
|
||||
{
|
||||
fi.displayweapon(screenpeek);
|
||||
if (pp->over_shoulder_on == 0)
|
||||
fi.displaymasks(screenpeek);
|
||||
}
|
||||
if (!isRR())
|
||||
moveclouds();
|
||||
}
|
||||
|
||||
if (ud.overhead_on > 0)
|
||||
{
|
||||
// smoothratio = min(max(smoothratio,0),65536);
|
||||
smoothratio = calc_smoothratio(totalclock, ototalclock);
|
||||
dointerpolations(smoothratio);
|
||||
|
||||
if (ud.scrollmode == 0)
|
||||
{
|
||||
if (pp->newowner == -1 && !ud.pause_on)
|
||||
{
|
||||
if (screenpeek == myconnectindex && numplayers > 1)
|
||||
{
|
||||
cposx = omyx + mulscale16(myx - omyx, smoothratio);
|
||||
cposy = omyy + mulscale16(myy - omyy, smoothratio);
|
||||
cang = fix16_to_int(omyang) + mulscale16((fix16_to_int(myang + F16(1024) - omyang) & 2047) - 1024, smoothratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
cposx = pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio);
|
||||
cposy = pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio);
|
||||
cang = pp->getang();// + mulscale16((fix16_to_int(pp->q16ang+F16(1024)-pp->oq16ang)&2047)-1024, smoothratio);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cposx = pp->oposx;
|
||||
cposy = pp->oposy;
|
||||
cang = fix16_to_int(pp->oq16ang);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ud.pause_on)
|
||||
{
|
||||
ud.fola += ud.folavel >> 3;
|
||||
ud.folx += (ud.folfvel * sintable[(512 + 2048 - ud.fola) & 2047]) >> 14;
|
||||
ud.foly += (ud.folfvel * sintable[(512 + 1024 - 512 - ud.fola) & 2047]) >> 14;
|
||||
}
|
||||
cposx = ud.folx;
|
||||
cposy = ud.foly;
|
||||
cang = ud.fola;
|
||||
}
|
||||
|
||||
if (ud.overhead_on == 2)
|
||||
{
|
||||
twod->ClearScreen();
|
||||
renderDrawMapView(cposx, cposy, pp->zoom, cang);
|
||||
}
|
||||
drawoverheadmap(cposx, cposy, pp->zoom, cang);
|
||||
|
||||
restoreinterpolations();
|
||||
}
|
||||
}
|
||||
|
||||
if (isRR()) drawstatusbar_r(screenpeek);
|
||||
else drawstatusbar_d(screenpeek);
|
||||
|
||||
if (ps[myconnectindex].newowner == -1 && ud.overhead_on == 0 && ud.crosshair && ud.camerasprite == -1)
|
||||
{
|
||||
int32_t a = TILE_CROSSHAIR;
|
||||
|
||||
if ((unsigned)a < MAXTILES)
|
||||
{
|
||||
vec2_t crosshairpos = { };
|
||||
//vec2_t crosshairpos = { ud.returnvar[0], ud.returnvar[1] };
|
||||
uint32_t crosshair_o = 1 | 2;
|
||||
double crosshair_scale = cl_crosshairscale * .001;
|
||||
if (isRR()) crosshair_scale *= .5;
|
||||
|
||||
DrawTexture(twod, tileGetTexture(a), 160 - (ps[myconnectindex].look_ang >> 1), 100,
|
||||
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale,
|
||||
DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x, DTA_ViewportY, windowxy2.y - windowxy1.y, TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (ud.pause_on == 1 && (ps[myconnectindex].gm & MODE_MENU) == 0)
|
||||
fi.PrintPaused();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -631,6 +820,28 @@ void cameratext(int i)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void dobonus(int bonusonly)
|
||||
{
|
||||
if (isRRRA());
|
||||
else if (isRR()) dobonus_r(bonusonly, nullptr);
|
||||
else dobonus_d(bonusonly, nullptr);
|
||||
|
||||
// This hack needs to go away!
|
||||
if (RRRA_EndEpisode)
|
||||
{
|
||||
RRRA_EndEpisode = 0;
|
||||
ud.m_volume_number = ud.volume_number = 1;
|
||||
m_level_number = ud.level_number = 0;
|
||||
ud.eog = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int startrts(int lumpNum, int localPlayer)
|
||||
{
|
||||
if (SoundEnabled() &&
|
||||
|
|
|
@ -240,7 +240,6 @@ extern playerdata_t *const g_player;
|
|||
G_EXTERN player_orig po[MAXPLAYERS];
|
||||
#pragma pack(pop)
|
||||
|
||||
G_EXTERN int32_t restorepalette;
|
||||
G_EXTERN uint32_t everyothertime;
|
||||
G_EXTERN uint32_t g_moveThingsCount;
|
||||
G_EXTERN double g_gameUpdateTime;
|
||||
|
|
|
@ -47,12 +47,11 @@ BEGIN_DUKE_NS
|
|||
void setpal(struct player_struct* p)
|
||||
{
|
||||
int palette;
|
||||
restorepalette = 1;
|
||||
if (p->DrugMode) palette = DRUGPAL;
|
||||
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 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 palette = BASEPAL;
|
||||
p->palette = palette;
|
||||
}
|
||||
|
|
|
@ -670,8 +670,6 @@ void enterlevel(char g)
|
|||
|
||||
for(i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
|
||||
|
||||
restorepalette = 1;
|
||||
|
||||
flushpackets();
|
||||
waitforeverybody();
|
||||
|
||||
|
|
|
@ -977,8 +977,6 @@ void loadlevel(const char *filename)
|
|||
|
||||
for(i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
|
||||
|
||||
restorepalette = 1;
|
||||
|
||||
flushpackets();
|
||||
waitforeverybody();
|
||||
|
||||
|
|
|
@ -498,8 +498,10 @@ void displayrooms(int snum, int smoothratio)
|
|||
|
||||
dointerpolations(smoothratio);
|
||||
|
||||
setgamepalette(BASEPAL);
|
||||
animatecamsprite(smoothratio);
|
||||
|
||||
setgamepalette(p->palette);
|
||||
if (ud.camerasprite >= 0)
|
||||
{
|
||||
spritetype* s;
|
||||
|
@ -623,7 +625,6 @@ void displayrooms(int snum, int smoothratio)
|
|||
renderDrawMasks();
|
||||
}
|
||||
}
|
||||
|
||||
restoreinterpolations();
|
||||
|
||||
if (!isRRRA() || !fogactive)
|
||||
|
|
|
@ -158,7 +158,6 @@ void G_HandleLocalKeys(void)
|
|||
buttonMap.ClearButton(gamefunc_See_Coop_View);
|
||||
screenpeek = connectpoint2[screenpeek];
|
||||
if (screenpeek == -1) screenpeek = 0;
|
||||
restorepalette = -1;
|
||||
}
|
||||
|
||||
if ((g_netServer || ud.multimode > 1) && buttonMap.ButtonDown(gamefunc_Show_Opponents_Weapon))
|
||||
|
@ -275,8 +274,6 @@ void G_HandleLocalKeys(void)
|
|||
if (ud.overhead_on == 3) ud.overhead_on = 0;
|
||||
ud.last_overhead = ud.overhead_on;
|
||||
}
|
||||
|
||||
restorepalette = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -460,14 +457,13 @@ void G_BackToMenu(void)
|
|||
static int G_EndOfLevel(void)
|
||||
{
|
||||
STAT_Update(ud.eog || (currentLevel->flags & MI_FORCEEOG));
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
|
||||
setpal(g_player[myconnectindex].ps);
|
||||
|
||||
if (g_player[myconnectindex].ps->gm&MODE_EOL)
|
||||
{
|
||||
ready2send = 0;
|
||||
|
||||
G_BonusScreen(0);
|
||||
dobonus(0);
|
||||
|
||||
// Clear potentially loaded per-map ART only after the bonus screens.
|
||||
artClearMapArt();
|
||||
|
@ -703,7 +699,7 @@ int GameInterface::app_main()
|
|||
|
||||
videoInit();
|
||||
V_LoadTranslations();
|
||||
videoSetPalette(BASEPAL, 0);
|
||||
videoSetPalette(BASEPAL);
|
||||
|
||||
FX_StopAllSounds();
|
||||
app_loop();
|
||||
|
@ -850,7 +846,7 @@ MAIN_LOOP_RESTART:
|
|||
drawtime.Reset();
|
||||
drawtime.Clock();
|
||||
displayrooms(screenpeek, smoothRatio);
|
||||
G_DisplayRest(smoothRatio);
|
||||
displayrest(smoothRatio);
|
||||
drawtime.Unclock();
|
||||
videoNextPage();
|
||||
}
|
||||
|
|
|
@ -97,11 +97,11 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
|
|||
if (m_recstat != 2 && ud.last_level >= 0 &&
|
||||
(g_netServer || ud.multimode > 1) && (ud.coop&GAMETYPE_SCORESHEET))
|
||||
{
|
||||
G_BonusScreen(1);
|
||||
dobonus(1);
|
||||
}
|
||||
|
||||
if (isRR() && !isRRRA() && ud.level_number == 6 && ud.volume_number == 0)
|
||||
G_BonusScreen(0);
|
||||
dobonus(0);
|
||||
#endif
|
||||
|
||||
show_shareware = REALGAMETICSPERSEC*30;
|
||||
|
@ -424,7 +424,6 @@ int G_EnterLevel(int gameMode)
|
|||
Net_ResetPrediction();
|
||||
|
||||
//g_player[myconnectindex].ps->palette = palette;
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
|
||||
setpal(g_player[myconnectindex].ps);
|
||||
renderFlushPerms();
|
||||
|
||||
|
@ -458,11 +457,9 @@ int G_EnterLevel(int gameMode)
|
|||
mapList[mii].DisplayName());
|
||||
}
|
||||
|
||||
restorepalette = -1;
|
||||
|
||||
videoClearViewableArea(0L);
|
||||
displayrooms(myconnectindex,65536);
|
||||
G_DisplayRest(65536);
|
||||
displayrest(65536);
|
||||
|
||||
Net_WaitForEverybody();
|
||||
return 0;
|
||||
|
|
|
@ -1403,7 +1403,6 @@ static void postloadplayer(int32_t savegamep)
|
|||
|
||||
//3
|
||||
setpal(g_player[myconnectindex].ps);
|
||||
restorepalette = -1;
|
||||
|
||||
//4
|
||||
if (savegamep)
|
||||
|
|
|
@ -1,351 +0,0 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
This file is part of EDuke32.
|
||||
|
||||
EDuke32 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
#include "ns.h" // Must come before everything else!
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "sbar.h"
|
||||
#include "mdsprite.h"
|
||||
#include "gamecvars.h"
|
||||
#include "menu/menu.h"
|
||||
#include "mapinfo.h"
|
||||
#include "v_2ddrawer.h"
|
||||
#include "screenjob.h"
|
||||
#include "prediction.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
#define quotepulseshade (sintable[((uint32_t)totalclock<<5)&2047]>>11)
|
||||
|
||||
void drawstatusbar_d(int snum);
|
||||
void drawstatusbar_r(int snum);
|
||||
void drawoverheadmap(int cposx, int cposy, int czoom, int cang);
|
||||
void cameratext(int i);
|
||||
|
||||
int32_t g_crosshairSum = -1;
|
||||
// yxaspect and viewingrange just before the 'main' drawrooms call
|
||||
double g_moveActorsTime, g_moveWorldTime; // in ms, smoothed
|
||||
|
||||
|
||||
void P_SetGamePalette(struct player_struct *player, uint32_t palid, ESetPalFlags set)
|
||||
{
|
||||
if (palid >= MAXBASEPALS)
|
||||
palid = 0;
|
||||
|
||||
player->palette = palid;
|
||||
|
||||
if (player != g_player[screenpeek].ps)
|
||||
return;
|
||||
|
||||
videoSetPalette(palid, set);
|
||||
}
|
||||
|
||||
|
||||
////////// TINT ACCUMULATOR //////////
|
||||
|
||||
typedef struct {
|
||||
int32_t r, g, b;
|
||||
// f: 0-63 scale
|
||||
int32_t maxf, sumf;
|
||||
} palaccum_t;
|
||||
|
||||
#define PALACCUM_INITIALIZER { 0, 0, 0, 0, 0 }
|
||||
|
||||
/* For a picture frame F and n tints C_1, C_2, ... C_n weighted a_1, a_2,
|
||||
* ... a_n (on a 0-1 scale), the faded frame is calculated as
|
||||
*
|
||||
* F_new := (1-max_i(a_i))*F + d*sum_i(a_i), where
|
||||
*
|
||||
* d := max_i(a_i)/sum_i(a_i).
|
||||
*
|
||||
* This means that
|
||||
* 1) tint application is independent of their order.
|
||||
* 2) going from n+1 to n tints is continuous when the leaving one has faded.
|
||||
*
|
||||
* But note that for more than one tint, the composite tint will in general
|
||||
* change its hue as the ratio of the weights of the individual ones changes.
|
||||
*/
|
||||
static void palaccum_add(palaccum_t *pa, const PalEntry *pal, int32_t f)
|
||||
{
|
||||
f = clamp(f, 0, 63);
|
||||
if (f == 0)
|
||||
return;
|
||||
|
||||
pa->maxf = max(pa->maxf, f);
|
||||
pa->sumf += f;
|
||||
|
||||
pa->r += f*clamp(pal->r, 0, 63);
|
||||
pa->g += f*clamp(pal->g, 0, 63);
|
||||
pa->b += f*clamp(pal->b, 0, 63);
|
||||
}
|
||||
|
||||
static void G_FadePalaccum(const palaccum_t *pa)
|
||||
{
|
||||
videoFadePalette(tabledivide32_noinline(pa->r, pa->sumf)<<2,
|
||||
tabledivide32_noinline(pa->g, pa->sumf)<<2,
|
||||
tabledivide32_noinline(pa->b, pa->sumf)<<2, pa->maxf<<2);
|
||||
}
|
||||
|
||||
|
||||
static int32_t gtextsc(int32_t sc)
|
||||
{
|
||||
return scale(sc, hud_textscale, 400);
|
||||
}
|
||||
|
||||
////////// DISPLAYREST //////////
|
||||
|
||||
|
||||
void displayweapon(int snum);
|
||||
void moveclouds();
|
||||
|
||||
void G_DisplayRest(int32_t smoothratio)
|
||||
{
|
||||
int32_t i, j;
|
||||
palaccum_t tint = PALACCUM_INITIALIZER;
|
||||
|
||||
struct player_struct *const pp = g_player[screenpeek].ps;
|
||||
int32_t cposx, cposy, cang;
|
||||
|
||||
// this takes care of fullscreen tint for OpenGL
|
||||
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||
{
|
||||
auto & fstint = lookups.tables[MAXPALOOKUPS-1];
|
||||
|
||||
if (pp->palette == WATERPAL)
|
||||
{
|
||||
fstint.tintColor.r = 224;
|
||||
fstint.tintColor.g = 192;
|
||||
fstint.tintColor.b = 255;
|
||||
fstint.tintFlags = 0;
|
||||
}
|
||||
else if (pp->palette == SLIMEPAL)
|
||||
{
|
||||
fstint.tintColor.r = 208;
|
||||
fstint.tintColor.g = 255;
|
||||
fstint.tintColor.b = 192;
|
||||
fstint.tintFlags = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fstint.tintColor.r = 255;
|
||||
fstint.tintColor.g = 255;
|
||||
fstint.tintColor.b = 255;
|
||||
fstint.tintFlags = 0;
|
||||
}
|
||||
}
|
||||
palaccum_add(&tint, &pp->pals, pp->pals.a);
|
||||
if (!isRR())
|
||||
{
|
||||
static const PalEntry loogiepal(0, 63, 0, 0 );
|
||||
|
||||
palaccum_add(&tint, &loogiepal, pp->loogcnt>>1);
|
||||
}
|
||||
|
||||
if (restorepalette)
|
||||
{
|
||||
// reset a normal palette
|
||||
static uint32_t omovethingscnt;
|
||||
|
||||
if (restorepalette < 2 || omovethingscnt+1 == g_moveThingsCount)
|
||||
{
|
||||
int32_t pal = pp->palette;
|
||||
|
||||
// restorepalette < 0: reset tinting, too (e.g. when loading new game)
|
||||
P_SetGamePalette(pp, pal, (restorepalette > 0) ? Pal_DontResetFade : ESetPalFlags::FromInt(0));
|
||||
restorepalette = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// delay setting the palette by one game tic
|
||||
omovethingscnt = g_moveThingsCount;
|
||||
}
|
||||
}
|
||||
|
||||
i = pp->cursectnum;
|
||||
if (i > -1)
|
||||
{
|
||||
const walltype *wal = &wall[sector[i].wallptr];
|
||||
|
||||
show2dsector.Set(i);
|
||||
for (j=sector[i].wallnum; j>0; j--, wal++)
|
||||
{
|
||||
i = wal->nextsector;
|
||||
if (i < 0) continue;
|
||||
if (wal->cstat&0x0071) continue;
|
||||
if (wall[wal->nextwall].cstat&0x0071) continue;
|
||||
if (sector[i].lotag == 32767) continue;
|
||||
if (sector[i].ceilingz >= sector[i].floorz) continue;
|
||||
show2dsector.Set(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (ud.camerasprite == -1)
|
||||
{
|
||||
if (ud.overhead_on != 2)
|
||||
{
|
||||
if (!isRR() && pp->newowner >= 0)
|
||||
cameratext(pp->newowner);
|
||||
else
|
||||
{
|
||||
PspTwoDSetter set;
|
||||
fi.displayweapon(screenpeek);
|
||||
|
||||
if (pp->over_shoulder_on == 0)
|
||||
fi.displaymasks(screenpeek);
|
||||
}
|
||||
if (!isRR())
|
||||
moveclouds();
|
||||
}
|
||||
|
||||
if (ud.overhead_on > 0)
|
||||
{
|
||||
// smoothratio = min(max(smoothratio,0),65536);
|
||||
smoothratio = calc_smoothratio(totalclock, ototalclock);
|
||||
dointerpolations(smoothratio);
|
||||
|
||||
if (ud.scrollmode == 0)
|
||||
{
|
||||
if (pp->newowner == -1 && !ud.pause_on)
|
||||
{
|
||||
if (screenpeek == myconnectindex && numplayers > 1)
|
||||
{
|
||||
cposx = omyx + mulscale16(myx-omyx, smoothratio);
|
||||
cposy = omyy + mulscale16(myy-omyy, smoothratio);
|
||||
cang = fix16_to_int(omyang) + mulscale16((fix16_to_int(myang+F16(1024)-omyang)&2047)-1024, smoothratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
cposx = pp->oposx + mulscale16(pp->posx-pp->oposx, smoothratio);
|
||||
cposy = pp->oposy + mulscale16(pp->posy-pp->oposy, smoothratio);
|
||||
cang = fix16_to_int(pp->oq16ang) + mulscale16((fix16_to_int(pp->q16ang+F16(1024)-pp->oq16ang)&2047)-1024, smoothratio);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cposx = pp->oposx;
|
||||
cposy = pp->oposy;
|
||||
cang = fix16_to_int(pp->oq16ang);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ud.pause_on)
|
||||
{
|
||||
ud.fola += ud.folavel>>3;
|
||||
ud.folx += (ud.folfvel*sintable[(512+2048-ud.fola)&2047])>>14;
|
||||
ud.foly += (ud.folfvel*sintable[(512+1024-512-ud.fola)&2047])>>14;
|
||||
}
|
||||
cposx = ud.folx;
|
||||
cposy = ud.foly;
|
||||
cang = ud.fola;
|
||||
}
|
||||
|
||||
if (ud.overhead_on == 2)
|
||||
{
|
||||
twod->ClearScreen();
|
||||
renderDrawMapView(cposx, cposy, pp->zoom, cang);
|
||||
}
|
||||
drawoverheadmap(cposx, cposy, pp->zoom, cang);
|
||||
|
||||
restoreinterpolations();
|
||||
}
|
||||
}
|
||||
|
||||
if (isRR()) drawstatusbar_r(screenpeek);
|
||||
else drawstatusbar_d(screenpeek);
|
||||
|
||||
if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1)
|
||||
{
|
||||
int32_t a = TILE_CROSSHAIR;
|
||||
|
||||
if ((unsigned) a < MAXTILES)
|
||||
{
|
||||
vec2_t crosshairpos = { };
|
||||
//vec2_t crosshairpos = { ud.returnvar[0], ud.returnvar[1] };
|
||||
uint32_t crosshair_o = 1|2;
|
||||
double crosshair_scale = cl_crosshairscale * .001;
|
||||
if (isRR()) crosshair_scale *= .5;
|
||||
|
||||
DrawTexture(twod, tileGetTexture(a), 160 - (g_player[myconnectindex].ps->look_ang >> 1), 100,
|
||||
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale,
|
||||
DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x, DTA_ViewportY, windowxy2.y - windowxy1.y, TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (ud.pause_on == 1 && (g_player[myconnectindex].ps->gm & MODE_MENU) == 0)
|
||||
fi.PrintPaused();
|
||||
|
||||
mdpause = (ud.pause_on || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2));
|
||||
|
||||
Net_DisplaySyncMsg();
|
||||
|
||||
if (VOLUMEONE)
|
||||
{
|
||||
if (show_shareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
|
||||
rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, TILE_BETAVERSION, 0, 0, 2+8+16+128);
|
||||
}
|
||||
|
||||
{
|
||||
if (g_player[myconnectindex].ps->gm&MODE_TYPE)
|
||||
Net_SendMessage();
|
||||
//else
|
||||
//M_DisplayMenus();
|
||||
}
|
||||
|
||||
{
|
||||
static int32_t applied = 0;
|
||||
|
||||
if (tint.maxf)
|
||||
{
|
||||
G_FadePalaccum(&tint);
|
||||
applied = 1;
|
||||
}
|
||||
else if (applied)
|
||||
{
|
||||
// be sure to always un-apply a tint.
|
||||
videoFadePalette(0, 0, 0, 0);
|
||||
applied = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dobonus_d(bool bonusonly, CompletionFunc completion);
|
||||
void dobonus_r(bool bonusonly, CompletionFunc completion);
|
||||
|
||||
void G_BonusScreen(int32_t bonusonly)
|
||||
{
|
||||
if (isRRRA());
|
||||
else if (isRR()) dobonus_r(bonusonly, nullptr);
|
||||
else dobonus_d(bonusonly, nullptr);
|
||||
|
||||
// This hack needs to go away!
|
||||
if (RRRA_EndEpisode)
|
||||
{
|
||||
RRRA_EndEpisode = 0;
|
||||
ud.m_volume_number = ud.volume_number = 1;
|
||||
m_level_number = ud.level_number = 0;
|
||||
ud.eog = 0;
|
||||
}
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
|
@ -7103,7 +7103,7 @@ int GameInterface::app_main()
|
|||
#endif
|
||||
|
||||
videoInit();
|
||||
videoSetPalette(BASEPAL, 0);
|
||||
videoSetPalette(BASEPAL);
|
||||
|
||||
// check if the minifont will support lowercase letters (3136-3161)
|
||||
// there is room for them in tiles012.art between "[\]^_." and "{|}~"
|
||||
|
|
|
@ -1874,7 +1874,8 @@ static void prelevel(char g)
|
|||
|
||||
if (RR && !thunderon)
|
||||
{
|
||||
videoSetPalette(BASEPAL,0);
|
||||
videoSetPalette(BASEPAL);
|
||||
videoclearFade();
|
||||
g_visibility = g_player[screenpeek].ps->visibility;
|
||||
}
|
||||
if (RR)
|
||||
|
|
|
@ -90,7 +90,8 @@ void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, ESetPalFlags set)
|
|||
if (player != g_player[screenpeek].ps)
|
||||
return;
|
||||
|
||||
videoSetPalette(palid, set);
|
||||
videoSetPalette(palid);
|
||||
if (!set) videoclearFade();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1421,7 +1421,7 @@ void LogoLevel(void)
|
|||
|
||||
twod->ClearScreen();
|
||||
videoNextPage();
|
||||
videoSetPalette(BASEPAL, 0);
|
||||
videoSetPalette(BASEPAL);
|
||||
|
||||
// put up a blank screen while loading
|
||||
|
||||
|
|
Loading…
Reference in a new issue