Merge branch 'Saturn-Next' into directionallight
This commit is contained in:
commit
351cb4a1ac
20 files changed
+304
-274
No files matched your search
+1
-1
@@ -298,7 +298,7 @@ else
|
||||
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_shaders.o
|
||||
endif
|
||||
|
||||
OPTS += -DCOMPVERSION -fwrapv
|
||||
OPTS += -DCOMPVERSION
|
||||
|
||||
ifndef NONX86
|
||||
ifndef GCC29
|
||||
|
||||
+1
-1
@@ -1236,7 +1236,7 @@ void CONS_Printf(const char *fmt, ...)
|
||||
txt = malloc(8192);
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsprintf(txt, fmt, argptr);
|
||||
vsnprintf(txt, 8192, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
// echo console prints to log file
|
||||
|
||||
+24
-22
@@ -54,10 +54,10 @@ static INT32 format2bpp(GLTextureFormat_t format)
|
||||
// It is now split from it for my sanity! (and the sanity of others)
|
||||
// -- Monster Iestyn (13/02/19)
|
||||
static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipmap_t *mipmap,
|
||||
INT32 pblockheight, INT32 blockmodulo,
|
||||
fixed_t yfracstep, fixed_t scale_y,
|
||||
texpatch_t *originPatch, INT32 patchheight,
|
||||
INT32 bpp, RGBA_t *palette)
|
||||
INT32 pblockheight, INT32 blockmodulo,
|
||||
fixed_t yfracstep, fixed_t scale_y,
|
||||
texpatch_t *originPatch, INT32 patchheight,
|
||||
INT32 bpp, RGBA_t *palette)
|
||||
{
|
||||
fixed_t yfrac, position, count;
|
||||
UINT8 *dest;
|
||||
@@ -73,9 +73,6 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
|
||||
(void)patchheight; // This parameter is unused
|
||||
|
||||
if (!mipmap || mipmap == NULL)
|
||||
return;
|
||||
|
||||
if (originPatch) // originPatch can be NULL here, unlike in the software version
|
||||
originy = originPatch->originy;
|
||||
|
||||
@@ -111,10 +108,10 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
count--;
|
||||
|
||||
texel = source[yfrac>>FRACBITS];
|
||||
alpha = 0xff;
|
||||
alpha = 0xFF;
|
||||
|
||||
//Hurdler: not perfect, but better than holes
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
||||
// Make pixel transparent if chroma keyed
|
||||
if ((mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
|
||||
alpha = 0x00;
|
||||
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
@@ -126,7 +123,8 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
// Alam: SRB2 uses Mingw, HUGS
|
||||
switch (bpp)
|
||||
{
|
||||
case 2 : texelu16 = (UINT16)((alpha<<8) | texel);
|
||||
case 2 : // uhhhhhhhh..........
|
||||
texelu16 = (UINT16)((alpha<<8) | texel);
|
||||
memcpy(dest, &texelu16, sizeof(UINT16));
|
||||
break;
|
||||
case 3 : colortemp = palette[texel];
|
||||
@@ -144,6 +142,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
dest += blockmodulo;
|
||||
yfrac += yfracstep;
|
||||
}
|
||||
|
||||
patchcol = (const column_t *)((const UINT8 *)patchcol + patchcol->length + 4);
|
||||
}
|
||||
}
|
||||
@@ -185,6 +184,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
||||
if (bpp < 1 || bpp > 4)
|
||||
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
@@ -263,6 +263,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
if (bpp < 1 || bpp > 4)
|
||||
I_Error("HWR_DrawTexturePatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
@@ -336,8 +337,8 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
else
|
||||
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
|
||||
|
||||
gltex->mipmap.width = SHORT(texture->width);
|
||||
gltex->mipmap.height = SHORT(texture->height);
|
||||
gltex->mipmap.width = (UINT16)(texture->width);
|
||||
gltex->mipmap.height = (UINT16)(texture->height);
|
||||
|
||||
if (skyspecial)
|
||||
gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
|
||||
@@ -362,14 +363,17 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
RGBA_t col;
|
||||
|
||||
col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX];
|
||||
|
||||
for (j = 0; j < blockheight; j++)
|
||||
{
|
||||
for (i = 0; i < blockwidth; i++)
|
||||
{
|
||||
block[4*(j*blockwidth+i)+0] = col.s.red;
|
||||
block[4*(j*blockwidth+i)+1] = col.s.green;
|
||||
block[4*(j*blockwidth+i)+2] = col.s.blue;
|
||||
block[4*(j*blockwidth+i)+3] = 0xff;
|
||||
int idx = (j*blockwidth+i);
|
||||
|
||||
block[4*idx+0] = col.s.red;
|
||||
block[4*idx+1] = col.s.green;
|
||||
block[4*idx+2] = col.s.blue;
|
||||
block[4*idx+3] = 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -378,15 +382,12 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||
{
|
||||
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
||||
HWR_DrawTexturePatchInCache(&gltex->mipmap,
|
||||
blockwidth, blockheight,
|
||||
texture, patch,
|
||||
realpatch);
|
||||
HWR_DrawTexturePatchInCache(&gltex->mipmap, blockwidth, blockheight, texture, patch, realpatch);
|
||||
Z_ChangeTag(realpatch, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
|
||||
if (format2bpp(gltex->mipmap.format)==4)
|
||||
if (format2bpp(gltex->mipmap.format) == 4)
|
||||
{
|
||||
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
|
||||
{
|
||||
@@ -437,6 +438,7 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, bo
|
||||
if (makebitmap)
|
||||
{
|
||||
MakeBlock(glMipmap);
|
||||
|
||||
HWR_DrawPatchInCache(glMipmap,
|
||||
glMipmap->width, glMipmap->height,
|
||||
glPatch->width, glPatch->height,
|
||||
|
||||
+102
-39
@@ -142,6 +142,8 @@ static void HWR_TogglePaletteRendering(void);
|
||||
// ==========================================================================
|
||||
// Commands and console variables
|
||||
// ==========================================================================
|
||||
static void HWR_RegisterCommands(void);
|
||||
static void COM_HWR_glinfo(void);
|
||||
|
||||
//
|
||||
// Onchanges
|
||||
@@ -542,7 +544,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
if (!xsub->planepoly)
|
||||
return;
|
||||
|
||||
pv = xsub->planepoly->pts;
|
||||
nrPlaneVerts = xsub->planepoly->numpts;
|
||||
|
||||
if (nrPlaneVerts < 3) //not even a triangle ?
|
||||
@@ -612,6 +613,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
||||
break;
|
||||
}
|
||||
|
||||
pv = xsub->planepoly->pts;
|
||||
|
||||
// reference point for flat texture coord for each vertex around the polygon
|
||||
flatxref = (float)(((fixed_t)pv->x & (~flatflag)) / fflatsize);
|
||||
flatyref = (float)(((fixed_t)pv->y & (~flatflag)) / fflatsize);
|
||||
@@ -979,7 +982,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
|
||||
for (INT32 i = 0; i < sector->numlights; i++)
|
||||
{
|
||||
if (endtop < endrealbot && top < realbot)
|
||||
if ((endtop < endrealbot) && (top < realbot))
|
||||
return;
|
||||
|
||||
lightlist_t *list = sector->lightlist;
|
||||
@@ -1045,20 +1048,16 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
endbheight = endrealbot;
|
||||
}
|
||||
|
||||
if (endbheight > endtop)
|
||||
endbot = endtop;
|
||||
if (endbheight >= endtop)
|
||||
continue;
|
||||
|
||||
if (bheight >= top)
|
||||
continue;
|
||||
|
||||
// Found a break
|
||||
// The heights are clamped to ensure the polygon doesn't cross itself.
|
||||
bot = bheight;
|
||||
|
||||
if (bot < realbot)
|
||||
bot = realbot;
|
||||
|
||||
endbot = min(max(endbheight, endrealbot), endtop);
|
||||
bot = CLAMP(bheight, realbot, top);
|
||||
endbot = CLAMP(endbheight, endrealbot, endtop);
|
||||
|
||||
Surf->PolyColor.s.alpha = alpha;
|
||||
|
||||
@@ -1086,7 +1085,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
||||
|
||||
bot = realbot;
|
||||
endbot = endrealbot;
|
||||
if (endtop <= endrealbot && top <= realbot)
|
||||
if ((endtop <= endrealbot) && (top <= realbot))
|
||||
return;
|
||||
|
||||
Surf->PolyColor.s.alpha = alpha;
|
||||
@@ -1187,7 +1186,7 @@ static void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf)
|
||||
}
|
||||
|
||||
// Returns true if the midtexture is visible, and false if... it isn't...
|
||||
static boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
|
||||
static inline boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
|
||||
{
|
||||
FUINT blendmode = PF_Masked;
|
||||
|
||||
@@ -1225,23 +1224,16 @@ static boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
|
||||
case 908:
|
||||
blendmode = HWR_TranstableToAlpha(tr_trans90, pSurf);
|
||||
break;
|
||||
// Translucent
|
||||
// Translucent linedef types
|
||||
case 102:
|
||||
case 121:
|
||||
case 123:
|
||||
case 124:
|
||||
case 125:
|
||||
case 141:
|
||||
case 142:
|
||||
case 144:
|
||||
case 145:
|
||||
case 121 ... 125:
|
||||
case 141 ... 145:
|
||||
case 174:
|
||||
case 175:
|
||||
case 192:
|
||||
case 195:
|
||||
case 221:
|
||||
case 253:
|
||||
case 256:
|
||||
case 253 ... 256:
|
||||
blendmode = PF_Translucent;
|
||||
break;
|
||||
default:
|
||||
@@ -1253,9 +1245,10 @@ static boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
|
||||
{
|
||||
// Polyobject translucency is shared between all of its lines
|
||||
if (gl_curline->polyseg->translucency >= NUMTRANSMAPS) // wall not drawn
|
||||
{
|
||||
pSurf->PolyColor.s.alpha = 0x00; // This shouldn't draw anything regardless of blendmode
|
||||
return false;
|
||||
//Surf.PolyColor.s.alpha = 0x00; // This shouldn't draw anything regardless of blendmode
|
||||
//blendmode = PF_Masked;
|
||||
}
|
||||
else
|
||||
blendmode = HWR_TranstableToAlpha(gl_curline->polyseg->translucency, pSurf);
|
||||
}
|
||||
@@ -1352,7 +1345,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gl_curline);
|
||||
|
||||
FSurfaceInfo Surf;
|
||||
Surf.PolyColor.s.alpha = 255;
|
||||
|
||||
if (gl_frontsector)
|
||||
Surf.PolyColor.s.alpha = 255;
|
||||
|
||||
INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
|
||||
GLMapTexture_t *glTex = NULL;
|
||||
@@ -1748,6 +1743,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
// Single sided line... Deal only with the middletexture (if one exists)
|
||||
if (gl_midtexture && gl_linedef->special != HORIZONSPECIAL) // Ignore horizon line for OGL
|
||||
{
|
||||
glTex = HWR_GetTexture(gl_midtexture, noencore);
|
||||
|
||||
fixed_t texturevpeg;
|
||||
|
||||
// PEGGING
|
||||
@@ -1758,8 +1755,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
else
|
||||
texturevpeg = gl_sidedef->rowoffset; // top of texture at top
|
||||
|
||||
glTex = HWR_GetTexture(gl_midtexture, noencore);
|
||||
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
|
||||
@@ -3670,7 +3665,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
||||
|
||||
for (i = 0; i < sector->numlights; i++)
|
||||
{
|
||||
if (endtop < endrealbot && top < realbot)
|
||||
if ((endtop < endrealbot) && (top < realbot))
|
||||
return;
|
||||
|
||||
// even if we aren't changing colormap or lightlevel, we still need to continue drawing down the sprite
|
||||
@@ -3695,18 +3690,16 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
||||
endbheight = endrealbot;
|
||||
}
|
||||
|
||||
if (endbheight >= endtop && bheight >= top)
|
||||
if (endbheight >= endtop)
|
||||
continue;
|
||||
|
||||
bot = bheight;
|
||||
if (bheight >= top)
|
||||
continue;
|
||||
|
||||
if (bot < realbot)
|
||||
bot = realbot;
|
||||
|
||||
endbot = endbheight;
|
||||
|
||||
if (endbot < endrealbot)
|
||||
endbot = endrealbot;
|
||||
// Found a break
|
||||
// The heights are clamped to ensure the polygon doesn't cross itself.
|
||||
bot = CLAMP(bheight, realbot, top);
|
||||
endbot = CLAMP(endbheight, endrealbot, endtop);
|
||||
|
||||
wallVerts[3].t = towtop + ((realtop - top) * towmult);
|
||||
wallVerts[2].t = towtop + ((endrealtop - endtop) * towmult);
|
||||
@@ -3754,7 +3747,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
||||
bot = realbot;
|
||||
endbot = endrealbot;
|
||||
|
||||
if (endtop <= endrealbot && top <= realbot)
|
||||
if ((endtop <= endrealbot) && (top <= realbot))
|
||||
return;
|
||||
|
||||
// If we're ever down here, somehow the above loop hasn't draw all the light levels of sprite
|
||||
@@ -5644,10 +5637,80 @@ void HWR_Startup(void)
|
||||
|
||||
if (msaa)
|
||||
HWD.pfnSetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
|
||||
|
||||
HWR_RegisterCommands();
|
||||
}
|
||||
startupdone = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register renderer commands.
|
||||
*/
|
||||
static void HWR_RegisterCommands(void)
|
||||
{
|
||||
COM_AddCommand("gr_glinfo", COM_HWR_glinfo);
|
||||
}
|
||||
|
||||
static void COM_HWR_glinfo(void)
|
||||
{
|
||||
if (vid.glstate != VID_GL_LIBRARY_LOADED)
|
||||
{
|
||||
CONS_Printf("Currently not using the OpenGL renderer.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int list_extensions = 0;
|
||||
size_t argc = COM_Argc();
|
||||
const char *argv;
|
||||
for (size_t i = 1; i < argc; i++)
|
||||
{
|
||||
argv = COM_Argv(i);
|
||||
|
||||
if (strcmp(argv, "--list-extensions") == 0 || strcmp(argv, "-l") == 0)
|
||||
{
|
||||
list_extensions = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("Unrecognized argument: %s\n", argv);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CONS_Printf("\x88OpenGL %s\x80\n", gl_version);
|
||||
CONS_Printf("Renderer: %s\n", gl_renderer);
|
||||
CONS_Printf("Vendor: %s\n", gl_vendor);
|
||||
|
||||
CONS_Printf("%u GL extensions present.\n", gl_num_extensions);
|
||||
if (list_extensions)
|
||||
{
|
||||
// We need this strtok loop because we cannot write the extensions list directly
|
||||
// to the output buffer, because it will overflow the output buffer of CONS_Printf
|
||||
// if the GPU is super new and supports a bajillion extensions - xyzzy
|
||||
|
||||
char *copy = strdup((const char*)gl_extensions);
|
||||
char *ext = strtok(copy, " ");
|
||||
|
||||
if (copy == NULL)
|
||||
{
|
||||
CONS_Printf("Ran out of memory listing extensions?!?!");
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
CONS_Printf(" - %s\n", ext);
|
||||
} while ((ext = strtok(NULL, " ")) != NULL);
|
||||
|
||||
free(copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("Use --list-extensions to view the list of extensions.\n");
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Free resources allocated by the hardware renderer
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@@ -116,6 +116,8 @@ static FTransform md2_transform;
|
||||
const GLubyte *gl_version = NULL;
|
||||
const GLubyte *gl_renderer = NULL;
|
||||
const GLubyte *gl_extensions = NULL;
|
||||
const GLubyte *gl_vendor = NULL;
|
||||
GLuint gl_num_extensions;
|
||||
|
||||
// Loaded OpenGL version
|
||||
int majorGL = 0, minorGL = 0;
|
||||
|
||||
@@ -119,6 +119,8 @@ extern boolean supportFBO;
|
||||
extern const GLubyte *gl_version;
|
||||
extern const GLubyte *gl_renderer;
|
||||
extern const GLubyte *gl_extensions;
|
||||
extern const GLubyte *gl_vendor;
|
||||
extern GLuint gl_num_extensions;
|
||||
|
||||
extern int majorGL, minorGL;
|
||||
|
||||
|
||||
+3
-1
@@ -6039,10 +6039,12 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
P_SetScale(overlay, player->mo->scale);
|
||||
}
|
||||
player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds
|
||||
|
||||
if (P_IsLocalPlayer(player) && cv_supermusic.value == 1 && cv_birdmusic.value)
|
||||
S_ChangeMusicSpecial("kinvnc");
|
||||
else
|
||||
S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmi : sfx_kinvnc));
|
||||
|
||||
P_RestoreMusic(player);
|
||||
K_PlayPowerGloatSound(player->mo);
|
||||
player->kartstuff[k_itemamount]--;
|
||||
@@ -9118,7 +9120,7 @@ static void K_drawNameTags(void)
|
||||
distance = R_PointToDist(players[i].mo->x, players[i].mo->y);
|
||||
if (distance > maxdistance)
|
||||
continue;
|
||||
if (!P_CheckSight(stplyr->mo, players[i].mo))
|
||||
if (!P_CheckSightFast(stplyr->mo, players[i].mo))
|
||||
continue;
|
||||
|
||||
switch (cv_nametagtrans.value)
|
||||
|
||||
@@ -1102,6 +1102,18 @@ static int lib_pCheckSight(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// DONT USE THIS FOR ANYTHING GAMEPLAY, THIS WILL DESYNCH!
|
||||
static int lib_pCheckSightFast(lua_State *L)
|
||||
{
|
||||
mobj_t *t1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *t2 = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
//HUDSAFE?
|
||||
if (!t1 || !t2)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
lua_pushboolean(L, P_CheckSightFast(t1, t2));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pCheckHoopPosition(lua_State *L)
|
||||
{
|
||||
mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
@@ -3154,6 +3166,7 @@ static luaL_Reg lib[] = {
|
||||
{"P_SlideMove",lib_pSlideMove},
|
||||
{"P_BounceMove",lib_pBounceMove},
|
||||
{"P_CheckSight", lib_pCheckSight},
|
||||
{"P_CheckSightFast", lib_pCheckSightFast},
|
||||
{"P_CheckHoopPosition",lib_pCheckHoopPosition},
|
||||
{"P_RadiusAttack",lib_pRadiusAttack},
|
||||
{"P_FloorzAtPos",lib_pFloorzAtPos},
|
||||
|
||||
+5
-1
@@ -364,7 +364,11 @@ boolean P_MoveOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
|
||||
void P_SlideMove(mobj_t *mo, boolean forceslide);
|
||||
void P_BouncePlayerMove(mobj_t *mo);
|
||||
void P_BounceMove(mobj_t *mo);
|
||||
boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
|
||||
|
||||
#define P_CheckSight(t1, t2) P_CheckSight2(t1, t2, false)
|
||||
#define P_CheckSightFast(t1, t2) P_CheckSight2(t1, t2, true)
|
||||
boolean P_CheckSight2(mobj_t *t1, mobj_t *t2, boolean fast);
|
||||
|
||||
void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fixed_t radius);
|
||||
|
||||
boolean P_CheckSector(sector_t *sector, boolean crunch);
|
||||
|
||||
+11
-4
@@ -3294,7 +3294,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
if (player->pflags & PF_TIMEOVER)
|
||||
player->kartstuff[k_timeovercam] = (2*TICRATE)+1;
|
||||
|
||||
if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead.
|
||||
if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSightFast(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead.
|
||||
P_ResetCamera(player, thiscam);
|
||||
else
|
||||
P_SlideCameraMove(thiscam);
|
||||
@@ -10201,19 +10201,26 @@ void P_SpawnPrecipitation(void)
|
||||
if (dedicated || !cv_drawdist_precip.value || curWeather == PRECIP_NONE) // SRB2Kart
|
||||
return;
|
||||
|
||||
fixed_t density = (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT);
|
||||
|
||||
if (cv_lessprecip.value)
|
||||
density *= 2; // just spawn half the precip
|
||||
|
||||
// Use the blockmap to narrow down our placing patterns
|
||||
for (i = 0; i < bmapwidth*bmapheight; ++i)
|
||||
{
|
||||
basex = bmaporgx + (i % bmapwidth) * MAPBLOCKSIZE;
|
||||
basey = bmaporgy + (i / bmapwidth) * MAPBLOCKSIZE;
|
||||
|
||||
for (j = 0; j < FRACUNIT; j += cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT)
|
||||
// If mobjscale < FRACUNIT, each blockmap cell covers
|
||||
// more area so spawn more precipitation in that area.
|
||||
for (j = 0; j < FRACUNIT; j += density)
|
||||
{
|
||||
INT32 floorz;
|
||||
INT32 ceilingz;
|
||||
|
||||
x = ((cv_lessprecip.value ? basex*1.5 : basex) + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3));
|
||||
y = ((cv_lessprecip.value ? basey*1.5 : basey) + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3));
|
||||
x = basex + ((M_RandomKey(MAPBLOCKUNITS << 3) << FRACBITS) >> 3);
|
||||
y = basey + ((M_RandomKey(MAPBLOCKUNITS << 3) << FRACBITS) >> 3);
|
||||
|
||||
precipsector = R_IsPointInSubsector(x, y);
|
||||
|
||||
|
||||
+40
-80
@@ -38,66 +38,21 @@ static INT32 sightcounts[2];
|
||||
//
|
||||
// Returns side 0 (front), 1 (back), or 2 (on).
|
||||
//
|
||||
static INT32 P_DivlineSide(fixed_t x, fixed_t y, divline_t *node)
|
||||
// killough 4/19/98: made static, cleaned up
|
||||
static INT32 P_DivlineSide(fixed_t x, fixed_t y, const divline_t *node)
|
||||
{
|
||||
fixed_t dx, dy, left, right;
|
||||
|
||||
if (!node->dx)
|
||||
{
|
||||
if (x == node->x)
|
||||
return 2;
|
||||
|
||||
if (x <= node->x)
|
||||
return (node->dy > 0);
|
||||
|
||||
return (node->dy < 0);
|
||||
}
|
||||
|
||||
if (!node->dy)
|
||||
{
|
||||
if (y == node->y)
|
||||
return 2;
|
||||
|
||||
if (y <= node->y)
|
||||
return (node->dx < 0);
|
||||
|
||||
return (node->dx > 0);
|
||||
}
|
||||
|
||||
dx = x - node->x;
|
||||
dy = y - node->y;
|
||||
|
||||
left = (node->dy>>FRACBITS) * (dx>>FRACBITS);
|
||||
right = (dy>>FRACBITS) * (node->dx>>FRACBITS);
|
||||
|
||||
if (right < left)
|
||||
return 0; // front side
|
||||
|
||||
if (left == right)
|
||||
return 2;
|
||||
|
||||
return 1; // back side
|
||||
fixed_t left, right;
|
||||
return
|
||||
!node->dx ? x == node->x ? 2 : x <= node->x ? node->dy > 0 : node->dy < 0 :
|
||||
!node->dy ? y == node->y ? 2 : y <= node->y ? node->dx < 0 : node->dx > 0 :
|
||||
(right = ((y - node->y) >> FRACBITS) * (node->dx >> FRACBITS)) <
|
||||
(left = ((x - node->x) >> FRACBITS) * (node->dy >> FRACBITS)) ? 0 :
|
||||
right == left ? 2 : 1;
|
||||
}
|
||||
|
||||
//
|
||||
// P_InterceptVector2
|
||||
//
|
||||
// Returns the fractional intercept point along the first divline.
|
||||
// This is only called by the addthings and addlines traversers.
|
||||
//
|
||||
static fixed_t P_InterceptVector2(divline_t *v2, divline_t *v1)
|
||||
static INT32 P_DivlineCrossed(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, const divline_t *node)
|
||||
{
|
||||
fixed_t frac, num, den;
|
||||
|
||||
den = FixedMul(v1->dy>>8, v2->dx) - FixedMul(v1->dx>>8, v2->dy);
|
||||
|
||||
if (!den)
|
||||
return 0;
|
||||
|
||||
num = FixedMul((v1->x - v2->x)>>8, v1->dy) + FixedMul((v2->y - v1->y)>>8, v1->dx);
|
||||
frac = FixedDiv(num, den);
|
||||
|
||||
return frac;
|
||||
return (P_DivlineSide(x1, y1, node) == P_DivlineSide(x2, y2, node));
|
||||
}
|
||||
|
||||
static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
|
||||
@@ -135,23 +90,21 @@ static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
|
||||
v2 = line->v2;
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(v1->x, v1->y, &los->strace) ==
|
||||
P_DivlineSide(v2->x, v2->y, &los->strace))
|
||||
if (P_DivlineCrossed(v1->x, v1->y, v2->x, v2->y, &los->strace))
|
||||
continue;
|
||||
|
||||
divl.dx = v2->x - (divl.x = v1->x);
|
||||
divl.dy = v2->y - (divl.y = v1->y);
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(los->strace.x, los->strace.y, &divl) ==
|
||||
P_DivlineSide(los->t2x, los->t2y, &divl))
|
||||
if (P_DivlineCrossed(los->strace.x, los->strace.y, los->t2x, los->t2y, &divl))
|
||||
continue;
|
||||
|
||||
// stop because it is not two sided
|
||||
//if (!(po->flags & POF_TESTHEIGHT))
|
||||
//return false;
|
||||
|
||||
frac = P_InterceptVector2(&los->strace, &divl);
|
||||
frac = P_InterceptVector(&los->strace, &divl);
|
||||
|
||||
// get slopes of top and bottom of this polyobject line
|
||||
topslope = FixedDiv(polysec->ceilingheight - los->sightzstart , frac);
|
||||
@@ -232,16 +185,14 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
v2 = line->v2;
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(v1->x, v1->y, &los->strace) ==
|
||||
P_DivlineSide(v2->x, v2->y, &los->strace))
|
||||
if (P_DivlineCrossed(v1->x, v1->y, v2->x, v2->y, &los->strace))
|
||||
continue;
|
||||
|
||||
divl.dx = v2->x - (divl.x = v1->x);
|
||||
divl.dy = v2->y - (divl.y = v1->y);
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(los->strace.x, los->strace.y, &divl) ==
|
||||
P_DivlineSide(los->t2x, los->t2y, &divl))
|
||||
if (P_DivlineCrossed(los->strace.x, los->strace.y, los->t2x, los->t2y, &divl))
|
||||
continue;
|
||||
|
||||
// stop because it is not two sided anyway
|
||||
@@ -249,7 +200,7 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
return false;
|
||||
|
||||
// calculate fractional intercept (how far along we are divided by how far we are from t2)
|
||||
frac = P_InterceptVector2(&los->strace, &divl);
|
||||
frac = P_InterceptVector(&los->strace, &divl);
|
||||
|
||||
front = seg->frontsector;
|
||||
back = seg->backsector;
|
||||
@@ -348,25 +299,34 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
// if strace crosses the given node successfully.
|
||||
//
|
||||
// killough 4/20/98: rewritten to remove tail recursion, clean up, and optimize
|
||||
|
||||
static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los)
|
||||
static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los, boolean fast)
|
||||
{
|
||||
while (!(bspnum & NF_SUBSECTOR))
|
||||
{
|
||||
register node_t *bsp = nodes + bspnum;
|
||||
INT32 side = P_DivlineSide(los->strace.x,los->strace.y,(divline_t *)bsp)&1;
|
||||
if (side == P_DivlineSide(los->t2x, los->t2y, (divline_t *) bsp))
|
||||
bspnum = bsp->children[side]; // doesn't touch the other side
|
||||
else // the partition plane is crossed here
|
||||
|
||||
INT32 side = (fast ? R_PointOnSideFast(los->strace.x, los->strace.y, bsp) : (P_DivlineSide(los->strace.x,los->strace.y, (divline_t *)bsp) & 1));
|
||||
INT32 side2 = (fast ? R_PointOnSideFast(los->t2x, los->t2y, bsp) : P_DivlineSide(los->t2x, los->t2y, (divline_t *) bsp));
|
||||
|
||||
if (side == side2)
|
||||
{
|
||||
if (!P_CrossBSPNode(bsp->children[side], los))
|
||||
return 0; // cross the starting side
|
||||
bspnum = bsp->children[side]; // doesn't touch the other side
|
||||
}
|
||||
else
|
||||
{
|
||||
// the partition plane is crossed here
|
||||
if (!P_CrossBSPNode(bsp->children[side], los, fast))
|
||||
{
|
||||
return false; // cross the starting side
|
||||
}
|
||||
else
|
||||
bspnum = bsp->children[side^1]; // cross the ending side
|
||||
{
|
||||
bspnum = bsp->children[side^1]; // cross the ending side
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
P_CrossSubsector((bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR), los);
|
||||
|
||||
return P_CrossSubsector((bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR), los);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -375,7 +335,7 @@ static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los)
|
||||
// Returns true if a straight line between t1 and t2 is unobstructed.
|
||||
// Uses REJECT.
|
||||
//
|
||||
boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
|
||||
boolean P_CheckSight2(mobj_t *t1, mobj_t *t2, boolean fast)
|
||||
{
|
||||
const sector_t *s1, *s2;
|
||||
size_t pnum;
|
||||
@@ -492,5 +452,5 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
|
||||
}
|
||||
|
||||
// the head node is the last node output
|
||||
return P_CrossBSPNode((INT32)numnodes - 1, &los);
|
||||
}
|
||||
return (P_CrossBSPNode((INT32)numnodes - 1, &los, fast));
|
||||
}
|
||||
+31
-58
@@ -1807,27 +1807,23 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
|
||||
precipmobj = (precipmobj_t *)think;
|
||||
|
||||
mobjtype_t type = 0;
|
||||
INT32 z = 0;
|
||||
|
||||
if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse.
|
||||
{
|
||||
precipmobj->precipflags |= PCF_INVISIBLE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (swap == PRECIP_RAIN) // Snow To Rain
|
||||
{
|
||||
precipmobj->type = MT_RAIN; // proper set the type
|
||||
precipmobj->info = &mobjinfo[MT_RAIN];
|
||||
precipmobj->flags = mobjinfo[MT_RAIN].flags;
|
||||
st = &states[mobjinfo[MT_RAIN].spawnstate];
|
||||
precipmobj->state = st;
|
||||
precipmobj->tics = st->tics;
|
||||
precipmobj->sprite = st->sprite;
|
||||
precipmobj->frame = st->frame;
|
||||
precipmobj->momz = cv_mobjscaleprecip.value ? FixedMul(mobjinfo[MT_RAIN].speed, mapobjectscale) : mobjinfo[MT_RAIN].speed;
|
||||
|
||||
precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_SPLASH); // P_PrecipThinker will add this again if it needs to
|
||||
type = MT_RAIN;
|
||||
}
|
||||
else if (swap == PRECIP_SNOW) // Rain To Snow
|
||||
{
|
||||
INT32 z;
|
||||
type = MT_SNOWFLAKE;
|
||||
|
||||
precipmobj->type = MT_SNOWFLAKE; // proper set the type
|
||||
precipmobj->info = &mobjinfo[MT_SNOWFLAKE];
|
||||
precipmobj->flags = mobjinfo[MT_SNOWFLAKE].flags;
|
||||
z = M_RandomByte();
|
||||
|
||||
if (z < 64)
|
||||
@@ -1836,92 +1832,69 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
z = 1;
|
||||
else
|
||||
z = 0;
|
||||
|
||||
st = &states[mobjinfo[MT_SNOWFLAKE].spawnstate+z];
|
||||
precipmobj->state = st;
|
||||
precipmobj->tics = st->tics;
|
||||
precipmobj->sprite = st->sprite;
|
||||
precipmobj->frame = st->frame;
|
||||
precipmobj->momz = cv_mobjscaleprecip.value ? FixedMul(mobjinfo[MT_SNOWFLAKE].speed, mapobjectscale) : mobjinfo[MT_SNOWFLAKE].speed;
|
||||
|
||||
precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_SPLASH); // P_PrecipThinker will add this again if it needs to
|
||||
}
|
||||
else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse.
|
||||
{
|
||||
precipmobj->precipflags |= PCF_INVISIBLE;
|
||||
}
|
||||
|
||||
precipmobj->type = type; // proper set the type
|
||||
precipmobj->info = &mobjinfo[type];
|
||||
precipmobj->flags = mobjinfo[type].flags;
|
||||
|
||||
st = &states[mobjinfo[type].spawnstate+z];
|
||||
|
||||
precipmobj->state = st;
|
||||
precipmobj->tics = st->tics;
|
||||
precipmobj->sprite = st->sprite;
|
||||
precipmobj->frame = st->frame;
|
||||
precipmobj->momz = (cv_mobjscaleprecip.value ? FixedMul(mobjinfo[type].speed, mapobjectscale) : mobjinfo[type].speed);
|
||||
|
||||
precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_SPLASH); // P_PrecipThinker will add this again if it needs to
|
||||
}
|
||||
}
|
||||
|
||||
boolean dontspawn = false;
|
||||
|
||||
switch (weathernum)
|
||||
{
|
||||
case PRECIP_SNOW: // snow
|
||||
curWeather = PRECIP_SNOW;
|
||||
|
||||
if (!swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
case PRECIP_RAIN: // rain
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_RAIN;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
}
|
||||
case PRECIP_STORM: // storm
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_STORM;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
}
|
||||
case PRECIP_STORM_NOSTRIKES: // storm w/o lightning
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_STORM_NOSTRIKES;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
}
|
||||
case PRECIP_STORM_NORAIN: // storm w/o rain
|
||||
curWeather = PRECIP_STORM_NORAIN;
|
||||
|
||||
if (!swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
case PRECIP_BLANK:
|
||||
curWeather = PRECIP_BLANK;
|
||||
|
||||
if (!swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
default:
|
||||
dontspawn = true;
|
||||
curWeather = PRECIP_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
}
|
||||
|
||||
/** Gets an object.
|
||||
|
||||
+2
-2
@@ -720,12 +720,12 @@ void P_Ticker(boolean run)
|
||||
continue;
|
||||
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
boolean isSkyVisibleForPlayer = skyVisiblePerPlayer[i];
|
||||
|
||||
if (isSkyVisibleForPlayer && skybox)
|
||||
if (skyVisiblePerPlayer[i] && skybox)
|
||||
{
|
||||
R_SkyboxFrame(i);
|
||||
}
|
||||
|
||||
R_SetupFrame(i, skybox);
|
||||
}
|
||||
}
|
||||
|
||||
+22
-19
@@ -91,19 +91,24 @@ static levelinterpolator_t **levelinterpolators;
|
||||
static size_t levelinterpolators_len;
|
||||
static size_t levelinterpolators_size;
|
||||
|
||||
static inline fixed_t R_LerpFixedView(fixed_t from, fixed_t to, fixed_t frac)
|
||||
{
|
||||
return from + FixedMul(frac, to - from);
|
||||
}
|
||||
|
||||
static inline angle_t R_LerpAngleView(angle_t from, angle_t to, fixed_t frac)
|
||||
{
|
||||
return from + FixedMul(frac, to - from);
|
||||
}
|
||||
|
||||
static inline fixed_t R_LerpFixed(fixed_t from, fixed_t to, fixed_t frac)
|
||||
{
|
||||
if (from == to)
|
||||
return to;
|
||||
return from + FixedMul(frac, to - from);
|
||||
return ((from == to) ? to : (from + FixedMul(frac, to - from)));
|
||||
}
|
||||
|
||||
static inline angle_t R_LerpAngle(angle_t from, angle_t to, fixed_t frac)
|
||||
{
|
||||
if (from == to)
|
||||
return to;
|
||||
return from + FixedMul(frac, to - from);
|
||||
return ((from == to) ? to : (from + FixedMul(frac, to - from)));
|
||||
}
|
||||
|
||||
/*static vector2_t *R_LerpVector2(const vector2_t *from, const vector2_t *to, fixed_t frac, vector2_t *out)
|
||||
@@ -153,7 +158,7 @@ static void R_SetupFreelook(void)
|
||||
|
||||
void R_InterpolateViewRollAngle(fixed_t frac)
|
||||
{
|
||||
viewroll = R_LerpAngle(oldview->roll, newview->roll, frac);
|
||||
viewroll = R_LerpAngleView(oldview->roll, newview->roll, frac);
|
||||
}
|
||||
|
||||
void R_InterpolateView(fixed_t frac, boolean forceinvalid)
|
||||
@@ -181,13 +186,13 @@ void R_InterpolateView(fixed_t frac, boolean forceinvalid)
|
||||
prevview = newview;
|
||||
}
|
||||
|
||||
viewx = R_LerpFixed(prevview->x, newview->x, frac);
|
||||
viewy = R_LerpFixed(prevview->y, newview->y, frac);
|
||||
viewz = R_LerpFixed(prevview->z, newview->z, frac);
|
||||
viewx = R_LerpFixedView(prevview->x, newview->x, frac);
|
||||
viewy = R_LerpFixedView(prevview->y, newview->y, frac);
|
||||
viewz = R_LerpFixedView(prevview->z, newview->z, frac);
|
||||
|
||||
viewangle = R_LerpAngle(prevview->angle, newview->angle, frac);
|
||||
aimingangle = R_LerpAngle(prevview->aim, newview->aim, frac);
|
||||
viewroll = R_LerpAngle(prevview->roll, newview->roll, frac);
|
||||
viewangle = R_LerpAngleView(prevview->angle, newview->angle, frac);
|
||||
aimingangle = R_LerpAngleView(prevview->aim, newview->aim, frac);
|
||||
viewroll = R_LerpAngleView(prevview->roll, newview->roll, frac);
|
||||
|
||||
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
@@ -301,7 +306,7 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
out->y = mobj->y;
|
||||
out->z = mobj->z;
|
||||
out->scale = mobj->scale;
|
||||
out->subsector = mobj->subsector;
|
||||
//out->subsector = mobj->subsector;
|
||||
out->angle = mobj->player ? mobj->player->frameangle : mobj->angle;
|
||||
out->pitch = mobj->pitch;
|
||||
out->roll = mobj->roll;
|
||||
@@ -322,8 +327,7 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
out->spritexoffset = mobj->resetinterp ? mobj->spritexoffset : R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
|
||||
out->spriteyoffset = mobj->resetinterp ? mobj->spriteyoffset : R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac);
|
||||
out->scale = mobj->resetinterp ? mobj->scale : R_LerpFixed(mobj->old_scale, mobj->scale, frac);
|
||||
//out->subsector = R_PointInSubsector(out->x, out->y); // why was this even done?
|
||||
out->subsector = mobj->subsector;
|
||||
//out->subsector = R_PointInSubsector(out->x, out->y); // this is unused
|
||||
|
||||
if (mobj->player)
|
||||
out->angle = mobj->resetinterp ? mobj->player->frameangle : R_LerpAngle(mobj->player->old_frameangle, mobj->player->frameangle, frac);
|
||||
@@ -359,7 +363,7 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
|
||||
out->y = mobj->y;
|
||||
out->z = mobj->z;
|
||||
out->scale = cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT;
|
||||
out->subsector = mobj->subsector;
|
||||
//out->subsector = mobj->subsector;
|
||||
out->angle = mobj->angle;
|
||||
out->spritexscale = mobj->spritexscale;
|
||||
out->spriteyscale = mobj->spriteyscale;
|
||||
@@ -376,9 +380,8 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
|
||||
out->spriteyscale = mobj->spriteyscale;
|
||||
out->spritexoffset = mobj->spritexoffset;
|
||||
out->spriteyoffset = mobj->spriteyoffset;
|
||||
//out->subsector = R_PointInSubsector(out->x, out->y); // this is unused
|
||||
|
||||
//out->subsector = R_PointInSubsector(out->x, out->y); // i dont understand lol
|
||||
out->subsector = mobj->subsector;
|
||||
out->angle = R_LerpAngle(mobj->old_angle, mobj->angle, frac);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ typedef struct {
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
fixed_t z;
|
||||
subsector_t *subsector;
|
||||
//subsector_t *subsector;
|
||||
angle_t angle;
|
||||
fixed_t scale;
|
||||
fixed_t spritexscale;
|
||||
|
||||
@@ -324,32 +324,6 @@ static void Precipstuff_OnChange(void)
|
||||
P_SpawnPrecipitation();
|
||||
}
|
||||
|
||||
//
|
||||
// R_PointOnSide
|
||||
// Traverse BSP (sub) tree,
|
||||
// check point against partition plane.
|
||||
// Returns side 0 (front) or 1 (back).
|
||||
//
|
||||
// killough 5/2/98: reformatted
|
||||
//
|
||||
PUREFUNC INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *restrict node)
|
||||
{
|
||||
if (!node->dx)
|
||||
return x <= node->x ? node->dy > 0 : node->dy < 0;
|
||||
|
||||
if (!node->dy)
|
||||
return y <= node->y ? node->dx < 0 : node->dx > 0;
|
||||
|
||||
x -= node->x;
|
||||
y -= node->y;
|
||||
|
||||
// Try to quickly decide by looking at sign bits.
|
||||
// also use a mask to avoid branch prediction
|
||||
INT32 mask = (node->dy ^ node->dx ^ x ^ y) >> 31;
|
||||
return (mask & ((node->dy ^ x) < 0)) | // (left is negative)
|
||||
(~mask & (FixedMul(y, node->dx>>FRACBITS) >= FixedMul(node->dy>>FRACBITS, x)));
|
||||
}
|
||||
|
||||
//
|
||||
// R_PointToAngle
|
||||
// To get a global angle from cartesian coordinates,
|
||||
@@ -1078,19 +1052,6 @@ void R_Init(void)
|
||||
framecount = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// R_PointInSubsector
|
||||
//
|
||||
subsector_t *R_PointInSubsector(fixed_t x, fixed_t y)
|
||||
{
|
||||
size_t nodenum = numnodes-1;
|
||||
|
||||
while (!(nodenum & NF_SUBSECTOR))
|
||||
nodenum = nodes[nodenum].children[R_PointOnSide(x, y, nodes+nodenum)];
|
||||
|
||||
return &subsectors[nodenum & ~NF_SUBSECTOR];
|
||||
}
|
||||
|
||||
//
|
||||
// R_IsPointInSubsector, same as above but returns 0 if not in subsector
|
||||
//
|
||||
|
||||
+40
-2
@@ -72,7 +72,32 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
|
||||
#define COLORMAP_REMAPOFFSET COLORMAP_SIZE
|
||||
|
||||
// Utility functions.
|
||||
INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *node);
|
||||
|
||||
//
|
||||
// R_PointOnSide
|
||||
// Traverse BSP (sub) tree,
|
||||
// check point against partition plane.
|
||||
// Returns side 0 (front) or 1 (back).
|
||||
//
|
||||
// killough 5/2/98: reformatted
|
||||
//
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *restrict node)
|
||||
{
|
||||
if (!node->dx)
|
||||
return x <= node->x ? node->dy > 0 : node->dy < 0;
|
||||
|
||||
if (!node->dy)
|
||||
return y <= node->y ? node->dx < 0 : node->dx > 0;
|
||||
|
||||
x -= node->x;
|
||||
y -= node->y;
|
||||
|
||||
// Try to quickly decide by looking at sign bits.
|
||||
// also use a mask to avoid branch prediction
|
||||
INT32 mask = (node->dy ^ node->dx ^ x ^ y) >> 31;
|
||||
return (mask & ((node->dy ^ x) < 0)) | // (left is negative)
|
||||
(~mask & (FixedMul(y, node->dx>>FRACBITS) >= FixedMul(node->dy>>FRACBITS, x)));
|
||||
}
|
||||
|
||||
// This is not as accurate
|
||||
// SHOULD NOT BE USED FOR ANYTHING GAMEPLAY RELATED!!
|
||||
@@ -99,9 +124,22 @@ angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
angle_t R_PlayerSliptideAngle(player_t *player);
|
||||
|
||||
fixed_t R_ScaleFromGlobalAngle(angle_t visangle);
|
||||
subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);
|
||||
|
||||
subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y);
|
||||
|
||||
//
|
||||
// R_PointInSubsector
|
||||
//
|
||||
FUNCINLINE static ATTRINLINE subsector_t *R_PointInSubsector(fixed_t x, fixed_t y)
|
||||
{
|
||||
size_t nodenum = numnodes-1;
|
||||
|
||||
while (!(nodenum & NF_SUBSECTOR))
|
||||
nodenum = nodes[nodenum].children[R_PointOnSide(x, y, nodes+nodenum)];
|
||||
|
||||
return &subsectors[nodenum & ~NF_SUBSECTOR];
|
||||
}
|
||||
|
||||
// uses R_PointOnSideFast
|
||||
// SHOULD NOT BE USED FOR ANYTHING GAMEPLAY RELATED!!
|
||||
FUNCINLINE static ATTRINLINE subsector_t *R_PointInSubsectorFast(fixed_t x, fixed_t y)
|
||||
|
||||
+1
-4
@@ -1854,10 +1854,7 @@ void S_StopMusic(void)
|
||||
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
|
||||
return;
|
||||
|
||||
if (cv_birdmusic.value && (strcasecmp(music_name, mapmusname) == 0))
|
||||
mapmusresume = I_GetSongPosition();
|
||||
else
|
||||
mapmusresume = 0;
|
||||
mapmusresume = (cv_birdmusic.value && (strcasecmp(music_name, mapmusname) == 0)) ? I_GetSongPosition() : 0;
|
||||
|
||||
if (I_SongPaused())
|
||||
I_ResumeSong();
|
||||
|
||||
@@ -615,6 +615,7 @@ Countstutter (int len)
|
||||
}
|
||||
else
|
||||
bytes = ( music_bytes - music_stutter_bytes );
|
||||
|
||||
I_SetSongPosition((int)( bytes/4/44100.0*1000 ));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +149,8 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
gl_version = pglGetString(GL_VERSION);
|
||||
gl_renderer = pglGetString(GL_RENDERER);
|
||||
gl_extensions = pglGetString(GL_EXTENSIONS);
|
||||
pglGetIntegerv(GL_NUM_EXTENSIONS, (GLint*)&gl_num_extensions);
|
||||
gl_vendor = pglGetString(GL_VENDOR);
|
||||
|
||||
GL_DBG_Printf("OpenGL %s\n", gl_version);
|
||||
GL_DBG_Printf("GPU: %s\n", gl_renderer);
|
||||
|
||||
Reference in new issue
Block a user