mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- same render interface rework for Shadow Warrior.
This commit is contained in:
parent
757d7be18b
commit
b91441f849
11 changed files with 353 additions and 362 deletions
|
@ -844,7 +844,6 @@ void set_globalang(fixed_t const ang)
|
|||
//
|
||||
EXTERN_CVAR(Int, gl_fogmode)
|
||||
CVAR(Bool, testnewrenderer, true, 0)
|
||||
CVAR(Bool, testnewinterface, true, 0)
|
||||
|
||||
int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
|
||||
fixed_t daang, fixed_t dahoriz, int16_t dacursectnum)
|
||||
|
@ -869,24 +868,15 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!testnewrenderer)
|
||||
{
|
||||
set_globalpos(daposx, daposy, daposz);
|
||||
set_globalang(daang);
|
||||
set_globalpos(daposx, daposy, daposz);
|
||||
set_globalang(daang);
|
||||
|
||||
global100horiz = dahoriz;
|
||||
|
||||
memset(gotsector, 0, sizeof(gotsector));
|
||||
qglobalhoriz = MulScale(dahoriz, DivScale(xdimenscale, viewingrange, 16), 16) + IntToFixed(ydimen >> 1);
|
||||
globalcursectnum = dacursectnum;
|
||||
Polymost::polymost_drawrooms();
|
||||
}
|
||||
else
|
||||
{
|
||||
vec3_t pos = { daposx, daposy, daposz };
|
||||
render_drawrooms(nullptr, pos, dacursectnum, daang, dahoriz, rollang, 0);
|
||||
}
|
||||
global100horiz = dahoriz;
|
||||
|
||||
memset(gotsector, 0, sizeof(gotsector));
|
||||
qglobalhoriz = MulScale(dahoriz, DivScale(xdimenscale, viewingrange, 16), 16) + IntToFixed(ydimen >> 1);
|
||||
globalcursectnum = dacursectnum;
|
||||
Polymost::polymost_drawrooms();
|
||||
return inpreparemirror;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,8 +51,6 @@
|
|||
#include "render.h"
|
||||
|
||||
EXTERN_CVAR(Bool, cl_capfps)
|
||||
bool NoInterpolateView;
|
||||
|
||||
|
||||
PalEntry GlobalMapFog;
|
||||
float GlobalFogDensity;
|
||||
|
@ -264,19 +262,16 @@ static void CheckTimer(FRenderState &state, uint64_t ShaderStartTime)
|
|||
}
|
||||
|
||||
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, fixed_t q16angle, fixed_t q16horizon, float rollang, int flags)
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, fixed_t q16angle, fixed_t q16horizon, float rollang)
|
||||
{
|
||||
checkRotatedWalls();
|
||||
|
||||
if (gl_fogmode == 1) gl_fogmode = 2; // still needed?
|
||||
|
||||
if (flags & RSF_UPDATESECTOR)
|
||||
{
|
||||
int16_t sect = sectnum;
|
||||
updatesector(position.x, position.y, §);
|
||||
if (sect >= 0) sectnum = sect;
|
||||
if (sectnum < 0) return;
|
||||
}
|
||||
int16_t sect = sectnum;
|
||||
updatesector(position.x, position.y, §);
|
||||
if (sect >= 0) sectnum = sect;
|
||||
if (sectnum < 0) return;
|
||||
|
||||
auto RenderState = screen->RenderState();
|
||||
RenderState->SetVertexBuffer(screen->mVertexData);
|
||||
|
@ -297,27 +292,8 @@ void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sect
|
|||
screen->mLights->Clear();
|
||||
screen->mViewpoints->Clear();
|
||||
|
||||
// NoInterpolateView should have no bearing on camera textures, but needs to be preserved for the main view below.
|
||||
bool saved_niv = NoInterpolateView;
|
||||
NoInterpolateView = false;
|
||||
|
||||
// Shader start time does not need to be handled per level. Just use the one from the camera to render from.
|
||||
CheckTimer(*RenderState, 0/*ShaderStartTime*/);
|
||||
// prepare all camera textures that have been used in the last frame.
|
||||
// This must be done for all levels, not just the primary one!
|
||||
/*
|
||||
Level->canvasTextureInfo.UpdateAll([&](AActor* camera, FCanvasTexture* camtex, double fov)
|
||||
{
|
||||
screen->RenderTextureView(camtex, [=](IntRect& bounds)
|
||||
{
|
||||
FRenderViewpoint texvp;
|
||||
float ratio = camtex->aspectRatio;
|
||||
RenderViewpoint(texvp, camera, &bounds, fov, ratio, ratio, false, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
*/
|
||||
NoInterpolateView = saved_niv;
|
||||
|
||||
// now render the main view
|
||||
float fovratio;
|
||||
|
@ -333,6 +309,6 @@ void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sect
|
|||
|
||||
screen->ImageTransitionScene(true); // Only relevant for Vulkan.
|
||||
|
||||
RenderViewpoint(r_viewpoint, nullptr, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, flags & RSF_MIRROR, flags & RSF_PLANEMIRROR);
|
||||
RenderViewpoint(r_viewpoint, nullptr, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, false, false);
|
||||
All.Unclock();
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#pragma once
|
||||
#include "build.h"
|
||||
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, fixed_t q16angle, fixed_t q16horizon, float rollang, int flags);
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, fixed_t q16angle, fixed_t q16horizon, float rollang);
|
||||
|
||||
enum ERenderSceneFlags
|
||||
{
|
||||
RSF_MIRROR = 1,
|
||||
RSF_PLANEMIRROR = 2,
|
||||
RSF_UPDATESECTOR = 4,
|
||||
};
|
||||
|
|
|
@ -775,7 +775,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
fixed_t deliriumPitchI = interpolate(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate);
|
||||
int bakCstat = gView->pSprite->cstat;
|
||||
gView->pSprite->cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANSLUCENT_INVERT;
|
||||
render_drawrooms(gView->pSprite, { cX, cY, cZ }, nSectnum, cA.asq16(), cH.asq16() + deliriumPitchI, rotscrnang.asbuildf(), RSF_UPDATESECTOR);
|
||||
render_drawrooms(gView->pSprite, { cX, cY, cZ }, nSectnum, cA.asq16(), cH.asq16() + deliriumPitchI, rotscrnang.asbuildf());
|
||||
gView->pSprite->cstat = bakCstat;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -82,7 +82,7 @@ void renderView(spritetype* playersprite, int sectnum, int x, int y, int z, bina
|
|||
}
|
||||
else
|
||||
{
|
||||
render_drawrooms(playersprite, { x, y, z }, sectnum, a.asq16(), h.asq16(), rotscrnang.asbuildf() , RSF_UPDATESECTOR);
|
||||
render_drawrooms(playersprite, { x, y, z }, sectnum, a.asq16(), h.asq16(), rotscrnang.asbuildf());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ void animatecamsprite(double smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
render_drawrooms(camera, camera->pos, camera->sectnum, ang.asq16(), IntToFixed(camera->shade), 0, RSF_UPDATESECTOR);
|
||||
render_drawrooms(camera, camera->pos, camera->sectnum, ang.asq16(), IntToFixed(camera->shade), 0);
|
||||
}
|
||||
display_mirror = 0;
|
||||
renderDrawMasks();
|
||||
|
|
|
@ -367,7 +367,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
}
|
||||
else
|
||||
{
|
||||
render_drawrooms(nullptr, { nCamerax, nCameray, viewz }, nSector, nCameraa.asq16(), nCamerapan.asq16(), rotscrnang.asbuildf(), RSF_UPDATESECTOR);
|
||||
render_drawrooms(nullptr, { nCamerax, nCameray, viewz }, nSector, nCameraa.asq16(), nCamerapan.asq16(), rotscrnang.asbuildf());
|
||||
}
|
||||
|
||||
if (HavePLURemap())
|
||||
|
|
|
@ -60,3 +60,5 @@
|
|||
#include "src/zilla.cpp"
|
||||
#include "src/zombie.cpp"
|
||||
#include "src/d_menu.cpp"
|
||||
|
||||
#include "src/_polymost.cpp"
|
||||
|
|
306
source/games/sw/src/_polymost.cpp
Normal file
306
source/games/sw/src/_polymost.cpp
Normal file
|
@ -0,0 +1,306 @@
|
|||
BEGIN_SW_NS
|
||||
|
||||
void
|
||||
DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, short tsectnum)
|
||||
{
|
||||
short i;
|
||||
short match;
|
||||
|
||||
save.zcount = 0;
|
||||
|
||||
match = ViewSectorInScene(tsectnum, VIEW_LEVEL1);
|
||||
if (match != -1)
|
||||
{
|
||||
FindCeilingView(match, &tx, &ty, tz, &tsectnum);
|
||||
|
||||
if (tsectnum < 0)
|
||||
return;
|
||||
|
||||
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
||||
|
||||
// reset Z's
|
||||
for (i = 0; i < save.zcount; i++)
|
||||
{
|
||||
sector[save.sectnum[i]].floorz = save.zval[i];
|
||||
sector[save.sectnum[i]].floorpicnum = save.pic[i];
|
||||
sector[save.sectnum[i]].floorheinum = save.slope[i];
|
||||
}
|
||||
|
||||
analyzesprites(tx, ty, tz, false);
|
||||
post_analyzesprites();
|
||||
renderDrawMasks();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
match = ViewSectorInScene(tsectnum, VIEW_LEVEL2);
|
||||
if (match != -1)
|
||||
{
|
||||
FindFloorView(match, &tx, &ty, tz, &tsectnum);
|
||||
|
||||
if (tsectnum < 0)
|
||||
return;
|
||||
|
||||
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
||||
|
||||
// reset Z's
|
||||
for (i = 0; i < save.zcount; i++)
|
||||
{
|
||||
sector[save.sectnum[i]].ceilingz = save.zval[i];
|
||||
sector[save.sectnum[i]].ceilingpicnum = save.pic[i];
|
||||
sector[save.sectnum[i]].ceilingheinum = save.slope[i];
|
||||
}
|
||||
|
||||
analyzesprites(tx, ty, tz, false);
|
||||
post_analyzesprites();
|
||||
renderDrawMasks();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, short sectnum)
|
||||
{
|
||||
int i;
|
||||
StatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
{
|
||||
if (SPRITE_TAG3(i) == 0)
|
||||
{
|
||||
// back up ceilingpicnum and ceilingstat
|
||||
SPRITE_TAG5(i) = sector[sprite[i].sectnum].ceilingpicnum;
|
||||
sector[sprite[i].sectnum].ceilingpicnum = SPRITE_TAG2(i);
|
||||
SPRITE_TAG4(i) = sector[sprite[i].sectnum].ceilingstat;
|
||||
//SET(sector[sprite[i].sectnum].ceilingstat, ((int)SPRITE_TAG7(i))<<7);
|
||||
SET(sector[sprite[i].sectnum].ceilingstat, SPRITE_TAG6(i));
|
||||
RESET(sector[sprite[i].sectnum].ceilingstat, CEILING_STAT_PLAX);
|
||||
}
|
||||
else if (SPRITE_TAG3(i) == 1)
|
||||
{
|
||||
SPRITE_TAG5(i) = sector[sprite[i].sectnum].floorpicnum;
|
||||
sector[sprite[i].sectnum].floorpicnum = SPRITE_TAG2(i);
|
||||
SPRITE_TAG4(i) = sector[sprite[i].sectnum].floorstat;
|
||||
//SET(sector[sprite[i].sectnum].floorstat, ((int)SPRITE_TAG7(i))<<7);
|
||||
SET(sector[sprite[i].sectnum].floorstat, SPRITE_TAG6(i));
|
||||
RESET(sector[sprite[i].sectnum].floorstat, FLOOR_STAT_PLAX);
|
||||
}
|
||||
}
|
||||
|
||||
renderDrawRoomsQ16(x,y,z,q16ang,q16horiz,sectnum);
|
||||
|
||||
it.Reset(STAT_CEILING_FLOOR_PIC_OVERRIDE);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
{
|
||||
// manually set gotpic
|
||||
if (TEST_GOTSECTOR(sprite[i].sectnum))
|
||||
{
|
||||
SET_GOTPIC(FAF_MIRROR_PIC);
|
||||
}
|
||||
|
||||
if (SPRITE_TAG3(i) == 0)
|
||||
{
|
||||
// restore ceilingpicnum and ceilingstat
|
||||
sector[sprite[i].sectnum].ceilingpicnum = SPRITE_TAG5(i);
|
||||
sector[sprite[i].sectnum].ceilingstat = SPRITE_TAG4(i);
|
||||
//RESET(sector[sprite[i].sectnum].ceilingstat, CEILING_STAT_TYPE_MASK);
|
||||
RESET(sector[sprite[i].sectnum].ceilingstat, CEILING_STAT_PLAX);
|
||||
}
|
||||
else if (SPRITE_TAG3(i) == 1)
|
||||
{
|
||||
sector[sprite[i].sectnum].floorpicnum = SPRITE_TAG5(i);
|
||||
sector[sprite[i].sectnum].floorstat = SPRITE_TAG4(i);
|
||||
//RESET(sector[sprite[i].sectnum].floorstat, FLOOR_STAT_TYPE_MASK);
|
||||
RESET(sector[sprite[i].sectnum].floorstat, FLOOR_STAT_PLAX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void polymost_drawscreen(PLAYERp pp, int tx, int ty, int tz, binangle tang, fixedhoriz thoriz, int tsectnum)
|
||||
{
|
||||
videoSetCorrectedAspect();
|
||||
renderSetAspect(xs_CRoundToInt(double(viewingrange) * tan(r_fov * (pi::pi() / 360.))), yxaspect);
|
||||
OverlapDraw = true;
|
||||
DrawOverlapRoom(tx, ty, tz, tang.asq16(), thoriz.asq16(), tsectnum);
|
||||
OverlapDraw = false;
|
||||
|
||||
if (automapMode != am_full)// && !ScreenSavePic)
|
||||
{
|
||||
// TEST this! Changed to camerapp
|
||||
//JS_DrawMirrors(camerapp, tx, ty, tz, tang.asq16(), thoriz.asq16());
|
||||
JS_DrawMirrors(pp, tx, ty, tz, tang.asq16(), thoriz.asq16());
|
||||
}
|
||||
|
||||
// TODO: This call is redundant if the tiled overhead map is shown, but the
|
||||
// HUD elements should be properly outputted with hardware rendering first.
|
||||
if (!FAF_DebugView)
|
||||
FAF_DrawRooms(tx, ty, tz, tang.asq16(), thoriz.asq16(), tsectnum);
|
||||
|
||||
analyzesprites(tx, ty, tz, false);
|
||||
post_analyzesprites();
|
||||
renderDrawMasks();
|
||||
|
||||
}
|
||||
|
||||
void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed_t tpq16horiz)
|
||||
{
|
||||
int j, cnt;
|
||||
int dist;
|
||||
int tposx, tposy; // Camera
|
||||
int *longptr;
|
||||
fixed_t tang;
|
||||
|
||||
// int tx, ty, tz, tpang; // Interpolate so mirror doesn't
|
||||
// drift!
|
||||
bool bIsWallMirror = false;
|
||||
|
||||
// WARNING! Assuming (MIRRORLABEL&31) = 0 and MAXMIRRORS = 64 <-- JBF: wrong
|
||||
longptr = (int *)&gotpic[MIRRORLABEL >> 3];
|
||||
if (longptr && (longptr[0] || longptr[1]))
|
||||
{
|
||||
for (cnt = MAXMIRRORS - 1; cnt >= 0; cnt--)
|
||||
//if (TEST_GOTPIC(cnt + MIRRORLABEL) || TEST_GOTPIC(cnt + CAMSPRITE))
|
||||
if (TEST_GOTPIC(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic)))
|
||||
{
|
||||
bIsWallMirror = false;
|
||||
if (TEST_GOTPIC(cnt + MIRRORLABEL))
|
||||
{
|
||||
bIsWallMirror = true;
|
||||
RESET_GOTPIC(cnt + MIRRORLABEL);
|
||||
}
|
||||
//else if (TEST_GOTPIC(cnt + CAMSPRITE))
|
||||
else if ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic))
|
||||
{
|
||||
//RESET_GOTPIC(cnt + CAMSPRITE);
|
||||
RESET_GOTPIC(mirror[cnt].campic);
|
||||
}
|
||||
|
||||
mirrorinview = true;
|
||||
|
||||
// tx = pp->oposx + MulScale(pp->posx - pp->oposx, smoothratio, 16);
|
||||
// ty = pp->oposy + MulScale(pp->posy - pp->oposy, smoothratio, 16);
|
||||
// tz = pp->oposz + MulScale(pp->posz - pp->oposz, smoothratio, 16);
|
||||
// tpq16ang = pp->angle.ang.asq16();
|
||||
|
||||
|
||||
dist = 0x7fffffff;
|
||||
|
||||
if (bIsWallMirror)
|
||||
{
|
||||
j = abs(wall[mirror[cnt].mirrorwall].x - tx);
|
||||
j += abs(wall[mirror[cnt].mirrorwall].y - ty);
|
||||
if (j < dist)
|
||||
dist = j;
|
||||
}
|
||||
else
|
||||
{
|
||||
SPRITEp tp;
|
||||
|
||||
tp = &sprite[mirror[cnt].camsprite];
|
||||
|
||||
j = abs(tp->x - tx);
|
||||
j += abs(tp->y - ty);
|
||||
if (j < dist)
|
||||
dist = j;
|
||||
}
|
||||
|
||||
if (mirror[cnt].ismagic)
|
||||
{
|
||||
SPRITEp sp=NULL;
|
||||
int camhoriz;
|
||||
short w;
|
||||
int dx, dy, dz, tdx, tdy, tdz, midx, midy;
|
||||
|
||||
|
||||
ASSERT(mirror[cnt].camera != -1);
|
||||
|
||||
sp = &sprite[mirror[cnt].camera];
|
||||
|
||||
ASSERT(sp);
|
||||
|
||||
// Calculate the angle of the mirror wall
|
||||
w = mirror[cnt].mirrorwall;
|
||||
|
||||
// Get wall midpoint for offset in mirror view
|
||||
midx = (wall[w].x + wall[wall[w].point2].x) / 2;
|
||||
midy = (wall[w].y + wall[wall[w].point2].y) / 2;
|
||||
|
||||
// Finish finding offsets
|
||||
tdx = abs(midx - tx);
|
||||
tdy = abs(midy - ty);
|
||||
|
||||
if (midx >= tx)
|
||||
dx = sp->x - tdx;
|
||||
else
|
||||
dx = sp->x + tdx;
|
||||
|
||||
if (midy >= ty)
|
||||
dy = sp->y - tdy;
|
||||
else
|
||||
dy = sp->y + tdy;
|
||||
|
||||
tdz = abs(tz - sp->z);
|
||||
if (tz >= sp->z)
|
||||
dz = sp->z + tdz;
|
||||
else
|
||||
dz = sp->z - tdz;
|
||||
|
||||
|
||||
// Is it a TV cam or a teleporter that shows destination?
|
||||
// true = It's a TV cam
|
||||
mirror[cnt].mstate = m_normal;
|
||||
if (TEST_BOOL1(sp))
|
||||
mirror[cnt].mstate = m_viewon;
|
||||
|
||||
// Show teleport destination
|
||||
// NOTE: Adding MAXSECTORS lets you draw a room, even if
|
||||
// you are outside of it!
|
||||
if (mirror[cnt].mstate != m_viewon)
|
||||
{
|
||||
tileDelete(MIRROR);
|
||||
// Set TV camera sprite size to 0 to show mirror
|
||||
// behind in this case!
|
||||
|
||||
if (mirror[cnt].campic != -1)
|
||||
tileDelete(mirror[cnt].campic);
|
||||
renderDrawRoomsQ16(dx, dy, dz, tpq16ang, tpq16horiz, sp->sectnum + MAXSECTORS);
|
||||
analyzesprites(dx, dy, dz, false);
|
||||
renderDrawMasks();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// It's just a mirror
|
||||
// Prepare drawrooms for drawing mirror and calculate
|
||||
// reflected
|
||||
// position into tposx, tposy, and tang (tposz == cposz)
|
||||
// Must call preparemirror before drawrooms and
|
||||
// completemirror after drawrooms
|
||||
|
||||
renderPrepareMirror(tx, ty, tz, tpq16ang, tpq16horiz,
|
||||
mirror[cnt].mirrorwall, /*mirror[cnt].mirrorsector,*/ &tposx, &tposy, &tang);
|
||||
|
||||
renderDrawRoomsQ16(tposx, tposy, tz, (tang), tpq16horiz, mirror[cnt].mirrorsector + MAXSECTORS);
|
||||
|
||||
analyzesprites(tposx, tposy, tz, true);
|
||||
renderDrawMasks();
|
||||
|
||||
renderCompleteMirror(); // Reverse screen x-wise in this
|
||||
// function
|
||||
}
|
||||
|
||||
|
||||
// g_visibility = tvisibility;
|
||||
// g_visibility = NormalVisibility;
|
||||
|
||||
// renderDrawRoomsQ16(tx, ty, tz, tpq16ang, tpq16horiz, pp->cursectnum);
|
||||
// Clean up anything that the camera view might have done
|
||||
tileDelete(MIRROR);
|
||||
wall[mirror[cnt].mirrorwall].overpicnum = MIRRORLABEL + cnt;
|
||||
}
|
||||
else
|
||||
mirrorinview = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
END_SW_NS
|
|
@ -55,8 +55,11 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
#include "v_2ddrawer.h"
|
||||
#include "v_video.h"
|
||||
#include "v_draw.h"
|
||||
#include "render.h"
|
||||
#include "glbackend/glbackend.h"
|
||||
|
||||
EXTERN_CVAR(Bool, testnewrenderer)
|
||||
|
||||
BEGIN_SW_NS
|
||||
|
||||
static int OverlapDraw = false;
|
||||
|
@ -1405,67 +1408,14 @@ void PreDrawStackedWater(void)
|
|||
}
|
||||
|
||||
|
||||
void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, short sectnum)
|
||||
{
|
||||
int i;
|
||||
StatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
{
|
||||
if (SPRITE_TAG3(i) == 0)
|
||||
{
|
||||
// back up ceilingpicnum and ceilingstat
|
||||
SPRITE_TAG5(i) = sector[sprite[i].sectnum].ceilingpicnum;
|
||||
sector[sprite[i].sectnum].ceilingpicnum = SPRITE_TAG2(i);
|
||||
SPRITE_TAG4(i) = sector[sprite[i].sectnum].ceilingstat;
|
||||
//SET(sector[sprite[i].sectnum].ceilingstat, ((int)SPRITE_TAG7(i))<<7);
|
||||
SET(sector[sprite[i].sectnum].ceilingstat, SPRITE_TAG6(i));
|
||||
RESET(sector[sprite[i].sectnum].ceilingstat, CEILING_STAT_PLAX);
|
||||
}
|
||||
else if (SPRITE_TAG3(i) == 1)
|
||||
{
|
||||
SPRITE_TAG5(i) = sector[sprite[i].sectnum].floorpicnum;
|
||||
sector[sprite[i].sectnum].floorpicnum = SPRITE_TAG2(i);
|
||||
SPRITE_TAG4(i) = sector[sprite[i].sectnum].floorstat;
|
||||
//SET(sector[sprite[i].sectnum].floorstat, ((int)SPRITE_TAG7(i))<<7);
|
||||
SET(sector[sprite[i].sectnum].floorstat, SPRITE_TAG6(i));
|
||||
RESET(sector[sprite[i].sectnum].floorstat, FLOOR_STAT_PLAX);
|
||||
}
|
||||
}
|
||||
|
||||
renderDrawRoomsQ16(x,y,z,q16ang,q16horiz,sectnum);
|
||||
|
||||
it.Reset(STAT_CEILING_FLOOR_PIC_OVERRIDE);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
{
|
||||
// manually set gotpic
|
||||
if (TEST_GOTSECTOR(sprite[i].sectnum))
|
||||
{
|
||||
SET_GOTPIC(FAF_MIRROR_PIC);
|
||||
}
|
||||
|
||||
if (SPRITE_TAG3(i) == 0)
|
||||
{
|
||||
// restore ceilingpicnum and ceilingstat
|
||||
sector[sprite[i].sectnum].ceilingpicnum = SPRITE_TAG5(i);
|
||||
sector[sprite[i].sectnum].ceilingstat = SPRITE_TAG4(i);
|
||||
//RESET(sector[sprite[i].sectnum].ceilingstat, CEILING_STAT_TYPE_MASK);
|
||||
RESET(sector[sprite[i].sectnum].ceilingstat, CEILING_STAT_PLAX);
|
||||
}
|
||||
else if (SPRITE_TAG3(i) == 1)
|
||||
{
|
||||
sector[sprite[i].sectnum].floorpicnum = SPRITE_TAG5(i);
|
||||
sector[sprite[i].sectnum].floorstat = SPRITE_TAG4(i);
|
||||
//RESET(sector[sprite[i].sectnum].floorstat, FLOOR_STAT_TYPE_MASK);
|
||||
RESET(sector[sprite[i].sectnum].floorstat, FLOOR_STAT_PLAX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
short ScreenSavePic = false;
|
||||
|
||||
bool PicInView(short, bool);
|
||||
void DoPlayerDiveMeter(PLAYERp pp);
|
||||
|
||||
void polymost_drawscreen(PLAYERp pp, int tx, int ty, int tz, binangle tang, fixedhoriz thoriz, int tsectnum);
|
||||
|
||||
|
||||
void
|
||||
drawscreen(PLAYERp pp, double smoothratio)
|
||||
{
|
||||
|
@ -1527,8 +1477,6 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
}
|
||||
tsectnum = camerapp->cursectnum;
|
||||
|
||||
renderSetRollAngle(trotscrnang.asbuildf());
|
||||
|
||||
COVERupdatesector(tx, ty, &tsectnum);
|
||||
|
||||
if (tsectnum >= 0)
|
||||
|
@ -1613,28 +1561,15 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
JS_DrawCameras(pp, tx, ty, tz);
|
||||
}
|
||||
|
||||
|
||||
videoSetCorrectedAspect();
|
||||
renderSetAspect(xs_CRoundToInt(double(viewingrange)* tan(r_fov * (pi::pi() / 360.))), yxaspect);
|
||||
OverlapDraw = true;
|
||||
DrawOverlapRoom(tx, ty, tz, tang.asq16(), thoriz.asq16(), tsectnum);
|
||||
OverlapDraw = false;
|
||||
|
||||
if (automapMode != am_full)// && !ScreenSavePic)
|
||||
if (!testnewrenderer)
|
||||
{
|
||||
// TEST this! Changed to camerapp
|
||||
//JS_DrawMirrors(camerapp, tx, ty, tz, tang.asq16(), thoriz.asq16());
|
||||
JS_DrawMirrors(pp, tx, ty, tz, tang.asq16(), thoriz.asq16());
|
||||
renderSetRollAngle(trotscrnang.asbuildf());
|
||||
polymost_drawscreen(pp, tx, ty, tz, tang, thoriz, tsectnum);
|
||||
}
|
||||
else
|
||||
{
|
||||
render_drawrooms(pp->SpriteP, { tx, ty, tz }, tsectnum, tang.asq16(), thoriz.asq16(), trotscrnang.asbuildf());
|
||||
}
|
||||
|
||||
// TODO: This call is redundant if the tiled overhead map is shown, but the
|
||||
// HUD elements should be properly outputted with hardware rendering first.
|
||||
if (!FAF_DebugView)
|
||||
FAF_DrawRooms(tx, ty, tz, tang.asq16(), thoriz.asq16(), tsectnum);
|
||||
|
||||
analyzesprites(tx, ty, tz, false);
|
||||
post_analyzesprites();
|
||||
renderDrawMasks();
|
||||
|
||||
|
||||
if (!ScreenSavePic) UpdatePanel(smoothratio);
|
||||
|
|
|
@ -44,10 +44,14 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
#include "pal.h"
|
||||
#include "parent.h"
|
||||
#include "v_video.h"
|
||||
#include "render.h"
|
||||
#include "glbackend/glbackend.h"
|
||||
|
||||
EXTERN_CVAR(Bool, testnewrenderer)
|
||||
|
||||
BEGIN_SW_NS
|
||||
|
||||
|
||||
// V A R I A B L E D E C L A R A T I O N S //////////////////////////////////////////////////////
|
||||
|
||||
MIRRORTYPE mirror[MAXMIRRORS];
|
||||
|
@ -469,9 +473,16 @@ void drawroomstotile(int daposx, int daposy, int daposz,
|
|||
|
||||
screen->RenderTextureView(canvas, [=](IntRect& rect)
|
||||
{
|
||||
renderDrawRoomsQ16(daposx, daposy, daposz, daq16ang, daq16horiz, dacursectnum);
|
||||
analyzesprites(daposx, daposy, daposz, false);
|
||||
renderDrawMasks();
|
||||
if (!testnewrenderer)
|
||||
{
|
||||
renderDrawRoomsQ16(daposx, daposy, daposz, daq16ang, daq16horiz, dacursectnum);
|
||||
analyzesprites(daposx, daposy, daposz, false);
|
||||
renderDrawMasks();
|
||||
}
|
||||
else
|
||||
{
|
||||
render_drawrooms(nullptr, { daposx, daposy, daposz }, dacursectnum, daq16ang, daq16horiz, 0);
|
||||
}
|
||||
});
|
||||
|
||||
renderRestoreTarget();
|
||||
|
@ -723,167 +734,6 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz)
|
|||
}
|
||||
}
|
||||
|
||||
void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed_t tpq16horiz)
|
||||
{
|
||||
int j, cnt;
|
||||
int dist;
|
||||
int tposx, tposy; // Camera
|
||||
int *longptr;
|
||||
fixed_t tang;
|
||||
|
||||
// int tx, ty, tz, tpang; // Interpolate so mirror doesn't
|
||||
// drift!
|
||||
bool bIsWallMirror = false;
|
||||
|
||||
// WARNING! Assuming (MIRRORLABEL&31) = 0 and MAXMIRRORS = 64 <-- JBF: wrong
|
||||
longptr = (int *)&gotpic[MIRRORLABEL >> 3];
|
||||
if (longptr && (longptr[0] || longptr[1]))
|
||||
{
|
||||
for (cnt = MAXMIRRORS - 1; cnt >= 0; cnt--)
|
||||
//if (TEST_GOTPIC(cnt + MIRRORLABEL) || TEST_GOTPIC(cnt + CAMSPRITE))
|
||||
if (TEST_GOTPIC(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic)))
|
||||
{
|
||||
bIsWallMirror = false;
|
||||
if (TEST_GOTPIC(cnt + MIRRORLABEL))
|
||||
{
|
||||
bIsWallMirror = true;
|
||||
RESET_GOTPIC(cnt + MIRRORLABEL);
|
||||
}
|
||||
//else if (TEST_GOTPIC(cnt + CAMSPRITE))
|
||||
else if ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic))
|
||||
{
|
||||
//RESET_GOTPIC(cnt + CAMSPRITE);
|
||||
RESET_GOTPIC(mirror[cnt].campic);
|
||||
}
|
||||
|
||||
mirrorinview = true;
|
||||
|
||||
// tx = pp->oposx + MulScale(pp->posx - pp->oposx, smoothratio, 16);
|
||||
// ty = pp->oposy + MulScale(pp->posy - pp->oposy, smoothratio, 16);
|
||||
// tz = pp->oposz + MulScale(pp->posz - pp->oposz, smoothratio, 16);
|
||||
// tpq16ang = pp->angle.ang.asq16();
|
||||
|
||||
|
||||
dist = 0x7fffffff;
|
||||
|
||||
if (bIsWallMirror)
|
||||
{
|
||||
j = abs(wall[mirror[cnt].mirrorwall].x - tx);
|
||||
j += abs(wall[mirror[cnt].mirrorwall].y - ty);
|
||||
if (j < dist)
|
||||
dist = j;
|
||||
}
|
||||
else
|
||||
{
|
||||
SPRITEp tp;
|
||||
|
||||
tp = &sprite[mirror[cnt].camsprite];
|
||||
|
||||
j = abs(tp->x - tx);
|
||||
j += abs(tp->y - ty);
|
||||
if (j < dist)
|
||||
dist = j;
|
||||
}
|
||||
|
||||
if (mirror[cnt].ismagic)
|
||||
{
|
||||
SPRITEp sp=NULL;
|
||||
int camhoriz;
|
||||
short w;
|
||||
int dx, dy, dz, tdx, tdy, tdz, midx, midy;
|
||||
|
||||
|
||||
ASSERT(mirror[cnt].camera != -1);
|
||||
|
||||
sp = &sprite[mirror[cnt].camera];
|
||||
|
||||
ASSERT(sp);
|
||||
|
||||
// Calculate the angle of the mirror wall
|
||||
w = mirror[cnt].mirrorwall;
|
||||
|
||||
// Get wall midpoint for offset in mirror view
|
||||
midx = (wall[w].x + wall[wall[w].point2].x) / 2;
|
||||
midy = (wall[w].y + wall[wall[w].point2].y) / 2;
|
||||
|
||||
// Finish finding offsets
|
||||
tdx = abs(midx - tx);
|
||||
tdy = abs(midy - ty);
|
||||
|
||||
if (midx >= tx)
|
||||
dx = sp->x - tdx;
|
||||
else
|
||||
dx = sp->x + tdx;
|
||||
|
||||
if (midy >= ty)
|
||||
dy = sp->y - tdy;
|
||||
else
|
||||
dy = sp->y + tdy;
|
||||
|
||||
tdz = abs(tz - sp->z);
|
||||
if (tz >= sp->z)
|
||||
dz = sp->z + tdz;
|
||||
else
|
||||
dz = sp->z - tdz;
|
||||
|
||||
|
||||
// Is it a TV cam or a teleporter that shows destination?
|
||||
// true = It's a TV cam
|
||||
mirror[cnt].mstate = m_normal;
|
||||
if (TEST_BOOL1(sp))
|
||||
mirror[cnt].mstate = m_viewon;
|
||||
|
||||
// Show teleport destination
|
||||
// NOTE: Adding MAXSECTORS lets you draw a room, even if
|
||||
// you are outside of it!
|
||||
if (mirror[cnt].mstate != m_viewon)
|
||||
{
|
||||
tileDelete(MIRROR);
|
||||
// Set TV camera sprite size to 0 to show mirror
|
||||
// behind in this case!
|
||||
|
||||
if (mirror[cnt].campic != -1)
|
||||
tileDelete(mirror[cnt].campic);
|
||||
renderDrawRoomsQ16(dx, dy, dz, tpq16ang, tpq16horiz, sp->sectnum + MAXSECTORS);
|
||||
analyzesprites(dx, dy, dz, false);
|
||||
renderDrawMasks();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// It's just a mirror
|
||||
// Prepare drawrooms for drawing mirror and calculate
|
||||
// reflected
|
||||
// position into tposx, tposy, and tang (tposz == cposz)
|
||||
// Must call preparemirror before drawrooms and
|
||||
// completemirror after drawrooms
|
||||
|
||||
renderPrepareMirror(tx, ty, tz, tpq16ang, tpq16horiz,
|
||||
mirror[cnt].mirrorwall, /*mirror[cnt].mirrorsector,*/ &tposx, &tposy, &tang);
|
||||
|
||||
renderDrawRoomsQ16(tposx, tposy, tz, (tang), tpq16horiz, mirror[cnt].mirrorsector + MAXSECTORS);
|
||||
|
||||
analyzesprites(tposx, tposy, tz, true);
|
||||
renderDrawMasks();
|
||||
|
||||
renderCompleteMirror(); // Reverse screen x-wise in this
|
||||
// function
|
||||
}
|
||||
|
||||
|
||||
// g_visibility = tvisibility;
|
||||
// g_visibility = NormalVisibility;
|
||||
|
||||
// renderDrawRoomsQ16(tx, ty, tz, tpq16ang, tpq16horiz, pp->cursectnum);
|
||||
// Clean up anything that the camera view might have done
|
||||
tileDelete(MIRROR);
|
||||
wall[mirror[cnt].mirrorwall].overpicnum = MIRRORLABEL + cnt;
|
||||
}
|
||||
else
|
||||
mirrorinview = false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DoAutoSize(tspriteptr_t tspr)
|
||||
{
|
||||
|
|
|
@ -32,8 +32,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
|
||||
BEGIN_SW_NS
|
||||
|
||||
void FAF_DrawRooms(int posx, int posy, int posz, fixed_t q16ang, fixed_t q16horiz, short cursectnum);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FLOOR ABOVE FLOOR
|
||||
|
@ -1019,65 +1017,5 @@ ViewSectorInScene(short cursectnum, short level)
|
|||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, short tsectnum)
|
||||
{
|
||||
short i;
|
||||
short match;
|
||||
|
||||
save.zcount = 0;
|
||||
|
||||
match = ViewSectorInScene(tsectnum, VIEW_LEVEL1);
|
||||
if (match != -1)
|
||||
{
|
||||
FindCeilingView(match, &tx, &ty, tz, &tsectnum);
|
||||
|
||||
if (tsectnum < 0)
|
||||
return;
|
||||
|
||||
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
||||
//FAF_DrawRooms(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
||||
|
||||
// reset Z's
|
||||
for (i = 0; i < save.zcount; i++)
|
||||
{
|
||||
sector[save.sectnum[i]].floorz = save.zval[i];
|
||||
sector[save.sectnum[i]].floorpicnum = save.pic[i];
|
||||
sector[save.sectnum[i]].floorheinum = save.slope[i];
|
||||
}
|
||||
|
||||
analyzesprites(tx, ty, tz, false);
|
||||
post_analyzesprites();
|
||||
renderDrawMasks();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
match = ViewSectorInScene(tsectnum, VIEW_LEVEL2);
|
||||
if (match != -1)
|
||||
{
|
||||
FindFloorView(match, &tx, &ty, tz, &tsectnum);
|
||||
|
||||
if (tsectnum < 0)
|
||||
return;
|
||||
|
||||
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
||||
//FAF_DrawRooms(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
||||
|
||||
// reset Z's
|
||||
for (i = 0; i < save.zcount; i++)
|
||||
{
|
||||
sector[save.sectnum[i]].ceilingz = save.zval[i];
|
||||
sector[save.sectnum[i]].ceilingpicnum = save.pic[i];
|
||||
sector[save.sectnum[i]].ceilingheinum = save.slope[i];
|
||||
}
|
||||
|
||||
analyzesprites(tx, ty, tz, false);
|
||||
post_analyzesprites();
|
||||
renderDrawMasks();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END_SW_NS
|
||||
|
|
Loading…
Reference in a new issue