mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 15:22:20 +00:00
Merge branch 'next' into bp_random2
This commit is contained in:
commit
1c16943be8
13 changed files with 88 additions and 46 deletions
|
@ -139,7 +139,6 @@ set(SRB2_CORE_RENDER_SOURCES
|
|||
set(SRB2_CORE_GAME_SOURCES
|
||||
p_ceilng.c
|
||||
p_enemy.c
|
||||
p_fab.c
|
||||
p_floor.c
|
||||
p_inter.c
|
||||
p_lights.c
|
||||
|
|
|
@ -437,7 +437,6 @@ OBJS:=$(i_main_o) \
|
|||
$(OBJDIR)/info.o \
|
||||
$(OBJDIR)/p_ceilng.o \
|
||||
$(OBJDIR)/p_enemy.o \
|
||||
$(OBJDIR)/p_fab.o \
|
||||
$(OBJDIR)/p_floor.o \
|
||||
$(OBJDIR)/p_inter.o \
|
||||
$(OBJDIR)/p_lights.o \
|
||||
|
|
|
@ -172,14 +172,38 @@ static int lib_pAproxDistance(lua_State *L)
|
|||
|
||||
static int lib_pClosestPointOnLine(lua_State *L)
|
||||
{
|
||||
int n = lua_gettop(L);
|
||||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE));
|
||||
vertex_t result;
|
||||
//HUDSAFE
|
||||
if (!line)
|
||||
return LUA_ErrInvalid(L, "line_t");
|
||||
P_ClosestPointOnLine(x, y, line, &result);
|
||||
if (lua_isuserdata(L, 3)) // use a real linedef to get our points
|
||||
{
|
||||
line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE));
|
||||
if (!line)
|
||||
return LUA_ErrInvalid(L, "line_t");
|
||||
P_ClosestPointOnLine(x, y, line, &result);
|
||||
}
|
||||
else // use custom coordinates of our own!
|
||||
{
|
||||
vertex_t v1, v2; // fake vertexes
|
||||
line_t junk; // fake linedef
|
||||
|
||||
if (n < 6)
|
||||
return luaL_error(L, "arguments 3 to 6 not all given (expected 4 fixed-point integers)");
|
||||
|
||||
v1.x = luaL_checkfixed(L, 3);
|
||||
v1.y = luaL_checkfixed(L, 4);
|
||||
v2.x = luaL_checkfixed(L, 5);
|
||||
v2.y = luaL_checkfixed(L, 6);
|
||||
|
||||
junk.v1 = &v1;
|
||||
junk.v2 = &v2;
|
||||
junk.dx = v2.x - v1.x;
|
||||
junk.dy = v2.y - v1.y;
|
||||
P_ClosestPointOnLine(x, y, &junk, &result);
|
||||
}
|
||||
|
||||
lua_pushfixed(L, result.x);
|
||||
lua_pushfixed(L, result.y);
|
||||
return 2;
|
||||
|
|
15
src/p_fab.c
15
src/p_fab.c
|
@ -1,15 +0,0 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file p_fab.c
|
||||
/// \brief some new action routines, separated from the original doom
|
||||
/// sources, so that you can include it or remove it easy.
|
||||
|
||||
/// \todo
|
||||
/// This file is now unused, please remove at some point
|
|
@ -1616,7 +1616,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||
|
||||
po->validcount = validcount;
|
||||
|
||||
if (!P_PointInsidePolyobj(po, x, y))
|
||||
if (!P_PointInsidePolyobj(po, x, y) || !(po->flags & POF_SOLID))
|
||||
{
|
||||
plink = (polymaplink_t *)(plink->link.next);
|
||||
continue;
|
||||
|
@ -3712,6 +3712,9 @@ static inline boolean PIT_GetSectors(line_t *ld)
|
|||
if (P_BoxOnLineSide(tmbbox, ld) != -1)
|
||||
return true;
|
||||
|
||||
if (ld->polyobj) // line belongs to a polyobject, don't add it
|
||||
return true;
|
||||
|
||||
// This line crosses through the object.
|
||||
|
||||
// Collect the sector(s) from the line and add to the
|
||||
|
@ -3744,6 +3747,9 @@ static inline boolean PIT_GetPrecipSectors(line_t *ld)
|
|||
if (P_BoxOnLineSide(preciptmbbox, ld) != -1)
|
||||
return true;
|
||||
|
||||
if (ld->polyobj) // line belongs to a polyobject, don't add it
|
||||
return true;
|
||||
|
||||
// This line crosses through the object.
|
||||
|
||||
// Collect the sector(s) from the line and add to the
|
||||
|
|
|
@ -3087,7 +3087,7 @@ static void P_DoTeeter(player_t *player)
|
|||
}
|
||||
|
||||
if (polybottom > player->mo->z + player->mo->height + tiptop
|
||||
|| (polybottom < player->mo->z
|
||||
|| (polytop < player->mo->z
|
||||
&& player->mo->z + player->mo->height < player->mo->ceilingz - tiptop))
|
||||
teeter = true;
|
||||
else
|
||||
|
@ -3105,7 +3105,7 @@ static void P_DoTeeter(player_t *player)
|
|||
}
|
||||
|
||||
if (polytop < player->mo->z - tiptop
|
||||
|| (polytop > player->mo->z + player->mo->height
|
||||
|| (polybottom > player->mo->z + player->mo->height
|
||||
&& player->mo->z > player->mo->floorz + tiptop))
|
||||
teeter = true;
|
||||
else
|
||||
|
@ -8163,7 +8163,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
|
||||
po->validcount = validcount;
|
||||
|
||||
if (!P_PointInsidePolyobj(po, x, y))
|
||||
if (!P_PointInsidePolyobj(po, x, y) || !(po->flags & POF_SOLID))
|
||||
{
|
||||
plink = (polymaplink_t *)(plink->link.next);
|
||||
continue;
|
||||
|
|
|
@ -26,6 +26,7 @@ side_t *sidedef;
|
|||
line_t *linedef;
|
||||
sector_t *frontsector;
|
||||
sector_t *backsector;
|
||||
boolean portalline; // is curline a portal seg?
|
||||
|
||||
// very ugly realloc() of drawsegs at run-time, I upped it to 512
|
||||
// instead of 256.. and someone managed to send me a level with
|
||||
|
@ -378,6 +379,7 @@ static void R_AddLine(seg_t *line)
|
|||
return;
|
||||
|
||||
curline = line;
|
||||
portalline = false;
|
||||
|
||||
// OPTIMIZE: quickly reject orthogonal back sides.
|
||||
angle1 = R_PointToAngle(line->v1->x, line->v1->y);
|
||||
|
@ -431,7 +433,7 @@ static void R_AddLine(seg_t *line)
|
|||
backsector = line->backsector;
|
||||
|
||||
// Portal line
|
||||
if (line->linedef->special == 40 && P_PointOnLineSide(viewx, viewy, line->linedef) == 0)
|
||||
if (line->linedef->special == 40 && line->side == 0)
|
||||
{
|
||||
if (portalrender < cv_maxportals.value)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@ extern side_t *sidedef;
|
|||
extern line_t *linedef;
|
||||
extern sector_t *frontsector;
|
||||
extern sector_t *backsector;
|
||||
extern boolean portalline; // is curline a portal seg?
|
||||
|
||||
// drawsegs are allocated on the fly... see r_segs.c
|
||||
|
||||
|
|
|
@ -667,6 +667,8 @@ typedef struct drawseg_s
|
|||
INT32 numthicksides;
|
||||
fixed_t frontscale[MAXVIDWIDTH];
|
||||
|
||||
UINT8 portalpass; // if > 0 and <= portalrender, do not affect sprite clipping
|
||||
|
||||
#ifdef ESLOPE
|
||||
fixed_t maskedtextureheight[MAXVIDWIDTH]; // For handling sloped midtextures
|
||||
|
||||
|
|
14
src/r_main.c
14
src/r_main.c
|
@ -91,7 +91,6 @@ typedef struct portal_pair
|
|||
INT16 *ceilingclip;
|
||||
INT16 *floorclip;
|
||||
fixed_t *frontscale;
|
||||
size_t seg;
|
||||
} portal_pair;
|
||||
portal_pair *portal_base, *portal_cap;
|
||||
line_t *portalclipline;
|
||||
|
@ -1230,7 +1229,7 @@ void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2)
|
|||
portal->start = x1;
|
||||
portal->end = x2;
|
||||
|
||||
portal->seg = ds_p-drawsegs;
|
||||
portalline = true; // this tells R_StoreWallRange that curline is a portal seg
|
||||
|
||||
portal->viewx = viewx;
|
||||
portal->viewy = viewy;
|
||||
|
@ -1344,14 +1343,6 @@ void R_RenderPlayerView(player_t *player)
|
|||
|
||||
validcount++;
|
||||
|
||||
if (portal->seg)
|
||||
{
|
||||
// Push the portal's old drawseg out of the way so it isn't interfering with sprite clipping. -Red
|
||||
drawseg_t *seg = drawsegs+portal->seg;
|
||||
seg->scale1 = 0;
|
||||
seg->scale2 = 0;
|
||||
}
|
||||
|
||||
R_RenderBSPNode((INT32)numnodes - 1);
|
||||
R_ClipSprites();
|
||||
//R_DrawPlanes();
|
||||
|
@ -1360,6 +1351,9 @@ void R_RenderPlayerView(player_t *player)
|
|||
// okay done. free it.
|
||||
portalcullsector = NULL; // Just in case...
|
||||
portal_base = portal->next;
|
||||
Z_Free(portal->ceilingclip);
|
||||
Z_Free(portal->floorclip);
|
||||
Z_Free(portal->frontscale);
|
||||
Z_Free(portal);
|
||||
}
|
||||
// END PORTAL RENDERING
|
||||
|
|
|
@ -2887,6 +2887,11 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
R_RenderSegLoop();
|
||||
colfunc = wallcolfunc;
|
||||
|
||||
if (portalline) // if curline is a portal, set portalrender for drawseg
|
||||
ds_p->portalpass = portalrender+1;
|
||||
else
|
||||
ds_p->portalpass = 0;
|
||||
|
||||
// save sprite clipping info
|
||||
if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip)
|
||||
{
|
||||
|
|
|
@ -834,10 +834,10 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
dc_texturemid = FixedDiv(dc_texturemid,this_scale);
|
||||
|
||||
//Oh lordy, mercy me. Don't freak out if sprites go offscreen!
|
||||
if (vis->xiscale > 0)
|
||||
/*if (vis->xiscale > 0)
|
||||
frac = FixedDiv(frac, this_scale);
|
||||
else if (vis->x1 <= 0)
|
||||
frac = (vis->x1 - vis->x2) * vis->xiscale;
|
||||
frac = (vis->x1 - vis->x2) * vis->xiscale;*/
|
||||
|
||||
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
|
||||
//dc_hires = 1;
|
||||
|
@ -1301,7 +1301,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
}
|
||||
|
||||
if (vis->x1 > x1)
|
||||
vis->startfrac += vis->xiscale*(vis->x1-x1);
|
||||
vis->startfrac += FixedDiv(vis->xiscale, this_scale)*(vis->x1-x1);
|
||||
|
||||
//Fab: lumppat is the lump number of the patch to use, this is different
|
||||
// than lumpid for sprites-in-pwad : the graphics are patched
|
||||
|
@ -2053,6 +2053,9 @@ void R_ClipSprites(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ds->portalpass > 0 && ds->portalpass <= portalrender)
|
||||
continue; // is a portal
|
||||
|
||||
r1 = ds->x1 < spr->x1 ? spr->x1 : ds->x1;
|
||||
r2 = ds->x2 > spr->x2 ? spr->x2 : ds->x2;
|
||||
|
||||
|
|
|
@ -336,6 +336,8 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
|||
const column_t *column;
|
||||
UINT8 *desttop, *dest, *deststart, *destend;
|
||||
const UINT8 *source, *deststop;
|
||||
fixed_t pwidth; // patch width
|
||||
fixed_t offx = 0; // x offset
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
@ -476,16 +478,36 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
|||
}
|
||||
}
|
||||
|
||||
deststart = desttop;
|
||||
destend = desttop + SHORT(patch->width) * dupx;
|
||||
if (pscale != FRACUNIT) // scale width properly
|
||||
{
|
||||
pwidth = SHORT(patch->width)<<FRACBITS;
|
||||
pwidth = FixedMul(pwidth, pscale);
|
||||
pwidth = FixedMul(pwidth, dupx<<FRACBITS);
|
||||
pwidth >>= FRACBITS;
|
||||
}
|
||||
else
|
||||
pwidth = SHORT(patch->width) * dupx;
|
||||
|
||||
for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++x, desttop++)
|
||||
deststart = desttop;
|
||||
destend = desttop + pwidth;
|
||||
|
||||
for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++offx, desttop++)
|
||||
{
|
||||
INT32 topdelta, prevdelta = -1;
|
||||
if (x < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||
continue;
|
||||
if (x >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||
break;
|
||||
if (flip) // offx is measured from right edge instead of left
|
||||
{
|
||||
if (x+pwidth-offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||
break;
|
||||
if (x+pwidth-offx >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x+offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||
continue;
|
||||
if (x+offx >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||
break;
|
||||
}
|
||||
column = (const column_t *)((const UINT8 *)(patch) + LONG(patch->columnofs[col>>FRACBITS]));
|
||||
|
||||
while (column->topdelta != 0xff)
|
||||
|
|
Loading…
Reference in a new issue