Merge branch 'Saturn-Next' into absolutehell

This commit is contained in:
Alug committed 2024-09-09 16:05:16 +02:00
commit dd2d437a21
14 files changed
+235 -322

No files matched your search

+12
View File
@@ -151,3 +151,15 @@ Best to be used in a Loop to ensure the color wont get overwritten by the game.
Add Gamepad Rumble support for things.
To be used with Displayplayers.
Duration is in milliseconds and is optional to set, default value is 84ms.
# Other changes
## P_PlayRinglossSound(source, damager)
Add optional `damager` argument (should be `mobj_t`), which causes hurt sound also play for damager
if `karthitemdialog` option is enabled
## K_PlayHitEmSound(mobj, victim)
Add optional `victim` argument (should be a player's `mobj_t`), which causes "hit em" sound to be
delayed and played for victim too if `karthitemdialog` option is enabled
+2
View File
@@ -567,6 +567,7 @@ consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_
consvar_t cv_director = {"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartdebugdirector = {"debugdirector", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showdirectorhud = {"showdirectorhud", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showtrackaddon = {"showtrackaddon", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -995,6 +996,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_director);
CV_RegisterVar(&cv_kartdebugdirector);
CV_RegisterVar(&cv_showdirectorhud);
CV_RegisterVar(&cv_luaimmersion);
CV_RegisterVar(&cv_fakelocalskin);
+1 -1
View File
@@ -202,7 +202,7 @@ extern consvar_t cv_ps_thinkframe_page;
extern consvar_t cv_ps_samplesize;
extern consvar_t cv_ps_descriptor;
extern consvar_t cv_director, cv_kartdebugdirector;
extern consvar_t cv_director, cv_kartdebugdirector, cv_showdirectorhud;
extern consvar_t cv_showtrackaddon;
+14
View File
@@ -336,6 +336,11 @@ boolean precache = true; // if true, load all graphics at start
INT16 prevmap, nextmap;
// save if director is enabled
// so demos can disable it by default and restore it after
static int directorstate = 0;
tic_t directortoggletimer = 0;
static CV_PossibleValue_t recordmultiplayerdemos_cons_t[] = {{0, "Disabled"}, {1, "Manual Save"}, {2, "Auto Save"}, {0, NULL}};
consvar_t cv_recordmultiplayerdemos = {"netdemo_record", "Manual Save", CV_SAVE, recordmultiplayerdemos_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -1947,6 +1952,7 @@ boolean G_Responder(event_t *ev)
|| ev->data1 == gamecontrol[gc_director][1])
{
K_ToggleDirector();
directortoggletimer = 0;
}
return true;
@@ -7723,6 +7729,9 @@ post_compat:
players[i].kartweight = kartweight[i];
}
directorstate = cv_director.value;
CV_SetValue(&cv_director, 0);
demo.deferstart = true;
}
#undef SKIPERRORS
@@ -8289,6 +8298,11 @@ void G_StopDemo(void)
{
Z_Free(demobuffer);
demobuffer = NULL;
if (demo.playback)
{
CV_SetValue(&cv_director, directorstate);
directorstate = 0;
}
demo.playback = false;
if (demo.title)
modeattacking = false;
+2
View File
@@ -218,6 +218,8 @@ extern angle_t localangle[MAXSPLITSCREENPLAYERS];
extern INT32 localaiming[MAXSPLITSCREENPLAYERS]; // should be an angle_t but signed
extern boolean camspin[MAXSPLITSCREENPLAYERS]; // SRB2Kart
extern tic_t directortoggletimer;
//
// GAME
//
+166 -168
View File
@@ -116,11 +116,8 @@ consvar_t cv_grrenderdistance = {"gr_renderdistance", "Max", CV_SAVE, grrenderdi
NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grportals = {"gr_portals", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_nostencil = {"nostencil", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_portalline = {"portalline", "0", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_portalonly = {"portalonly", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
CV_PossibleValue_t secbright_cons_t[] = {{0, "MIN"}, {255, "MAX"}, {0, NULL}};
CV_PossibleValue_t secbright_cons_t[] = {{0, "MIN"}, {255, "MAX"}, {0, NULL}};
consvar_t cv_secbright = {"secbright", "0", CV_SAVE, secbright_cons_t,
NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -326,6 +323,9 @@ static float gr_viewludsin, gr_viewludcos;
// Visual portals (attr. Hannu Hanhi)
// ==========================================================================
static boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y);
static boolean HWR_PortalCheckBBox(const fixed_t *bspcoord);
enum
{
GRPORTAL_OFF,
@@ -364,25 +364,35 @@ typedef struct gl_portallist_s
// new thing
gl_portallist_t *currentportallist;
INT32 portalviewside;
// Linked list for portals.
/*gl_portal_t *portal_base_gl, *portal_cap_gl;
//For now, these aren't used.
// maybe at some point these could be organized better
static void HWR_Portal_InitList (void)
// More precise version of R_PointToAngle2 using floats and atan2.
static angle_t R_PointToAngle2Precise(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
{
portalrender = 0;
portal_base_gl = portal_cap_gl = NULL;
fixed_t dx = x - pviewx;
fixed_t dy = y - pviewy;
float radians;
if (!dx && !dy)
return 0;
// no need for correct scale with FIXED_TO_FLOAT here
// since we're just calculating the angle
radians = atan2(dy, dx);
return (angle_t)(radians / M_PI * ANGLE_180);
}
static void HWR_Portal_Remove(gl_portal_t* portal)
// More precise version of R_PointToDist2 using floats and sqrt.
static fixed_t R_PointToDist2Precise(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1)
{
portal_base_gl = portal->next;
Z_Free(portal);
// float-fixed conversions can be omitted here
// because they cancel each other out in this case
float dx = px1 - px2;
float dy = py1 - py2;
double result = sqrt(dx*dx + dy*dy);
return (fixed_t)result;
}
*/
static void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg)
{
@@ -420,20 +430,33 @@ static void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *se
// Offset the portal view by the linedef centers
start = &lines[line1];
dest = &lines[line2];
dangle = R_PointToAngle2(0,0,dest->dx,dest->dy) - R_PointToAngle2(start->dx,start->dy,0,0);
// Most fixed-point calculations and trigonometric function tables are replaced by
// floats and cmath library calls in this part to improve the precision of the
// location and angle of the new viewpoint.
//
// This reduces artefacts on the edges of portals, showing thin lines/pixels
// of the underlying graphics. (for example the sky texture) It's not 100%
// perfectly aligned and artefact-free, but looks noticeably
// better than the original code. I'm not even sure if it's this
// code or the nodebuilder or hw_map or something else causing the remaining issues..
dangle = R_PointToAngle2Precise(0,0,dest->dx,dest->dy) - R_PointToAngle2Precise(start->dx,start->dy,0,0);
// looking glass center
start_c.x = (start->v1->x + start->v2->x) / 2;
start_c.y = (start->v1->y + start->v2->y) / 2;
start_c.x = start->v1->x/2 + start->v2->x/2;
start_c.y = start->v1->y/2 + start->v2->y/2;
// other side center
dest_c.x = (dest->v1->x + dest->v2->x) / 2;
dest_c.y = (dest->v1->y + dest->v2->y) / 2;
dest_c.x = dest->v1->x/2 + dest->v2->x/2;
dest_c.y = dest->v1->y/2 + dest->v2->y/2;
disttopoint = R_PointToDist2(start_c.x, start_c.y, viewx, viewy);
angtopoint = R_PointToAngle2(start_c.x, start_c.y, viewx, viewy);
disttopoint = R_PointToDist2Precise(start_c.x, start_c.y, viewx, viewy);
angtopoint = R_PointToAngle2Precise(start_c.x, start_c.y, viewx, viewy);
angtopoint += dangle;
float fang = ((float)angtopoint / 4294967296.0f) * 2.0f * M_PI;
if (dangle == 0)
{
portal->viewx = viewx + dest_c.x - start_c.x;
@@ -441,8 +464,8 @@ static void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *se
}
else
{
portal->viewx = dest_c.x + FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewy = dest_c.y + FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewx = dest_c.x + (fixed_t)(cos(fang) * disttopoint);
portal->viewy = dest_c.y + (fixed_t)(sin(fang) * disttopoint);
}
portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight;
portal->viewangle = viewangle + dangle;
@@ -466,7 +489,6 @@ static void HWR_PortalFrame(gl_portal_t* portal)
portalclipline = &lines[portal->clipline];
portalcullsector = portalclipline->frontsector;
viewsector = portalclipline->frontsector;
portalviewside = P_PointOnLineSide(viewx, viewy, portalclipline);
}
else
{
@@ -2458,30 +2480,13 @@ static void HWR_AddLine(seg_t *line)
gr_backsector = line->backsector;
// do an extra culling check when rendering portals
// check if any line vertex is on the viewable side of the portal target line
// if not, the line can be culled.
if (portalclipline)// portalclipline should be NULL when we are not rendering portal contents
// do extra checks on the seg when rendering portals:
// don't render segs that are behind the portal destination line
if (portalclipline &&
!HWR_PortalCheckPointSide(line->v1->x, line->v1->y) &&
!HWR_PortalCheckPointSide(line->v2->x, line->v2->y))
{
vertex_t closest_point;
boolean pass = false;
// similar idea than in PortalCheckBBox, but checking the line vertices instead
// TODO could make the check more efficient and not check anything if pass==true from earlier or something
P_ClosestPointOnLine(line->v1->x, line->v1->y, portalclipline, &closest_point);
if (closest_point.x != line->v1->x || closest_point.y != line->v1->y)
{
if (P_PointOnLineSide(line->v1->x, line->v1->y, portalclipline) != portalviewside)
pass = true;
}
P_ClosestPointOnLine(line->v2->x, line->v2->y, portalclipline, &closest_point);
if (closest_point.x != line->v2->x || closest_point.y != line->v2->y)
{
if (P_PointOnLineSide(line->v2->x, line->v2->y, portalclipline) != portalviewside)
pass = true;
}
if (!pass)
return;
return;
}
if (gr_portal == GRPORTAL_STENCIL || gr_portal == GRPORTAL_DEPTH)
@@ -3268,7 +3273,6 @@ skip_stuff_for_portals:
// if its zero (or very close?) then dont return true, instead continue to next side check
// it helped with center pillars! but other parts still have issues, probably because some of bounding box is on correct side.
// idea for further clipping improvement:
// have a separate xyz coordinate for portal view side checking: one that is derived by moving the viewxyz forward
// the new coords would be at the intersection of line_a and line_b, where
@@ -3281,40 +3285,36 @@ skip_stuff_for_portals:
// use returned value as multiplier for the added values from p_thrust thing
// P_InterceptVector needs divlines which need dx and dy, dx=x2-x1 dy=y2-y1
static boolean HWR_PortalCheckBBox(const fixed_t *bspcoord)
// returns true if the point is on the correct (viewable) side of the
// portal destination line
static boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y)
{
vertex_t closest_point;
if (!portalclipline)
return true;
// we are looking for a bounding box corner that is on the viewable side of the portal exit.
// we are checking if the point is on the viewable side of the portal exit.
// being exactly on the portal exit line is not enough to pass the test.
// P_PointOnLineSide could behave differently from this expectation on this case,
// so first check if the point is precisely on the line, and then if not, check the side.
P_ClosestPointOnLine(bspcoord[BOXLEFT], bspcoord[BOXTOP], portalclipline, &closest_point);
if (closest_point.x != bspcoord[BOXLEFT] || closest_point.y != bspcoord[BOXTOP])
vertex_t closest_point;
P_ClosestPointOnLine(x, y, portalclipline, &closest_point);
if (closest_point.x != x || closest_point.y != y)
{
if (P_PointOnLineSide(bspcoord[BOXLEFT], bspcoord[BOXTOP], portalclipline) != portalviewside)
if (P_PointOnLineSide(x, y, portalclipline) != 1)
return true;
}
P_ClosestPointOnLine(bspcoord[BOXLEFT], bspcoord[BOXBOTTOM], portalclipline, &closest_point);
if (closest_point.x != bspcoord[BOXLEFT] || closest_point.y != bspcoord[BOXBOTTOM])
return false;
}
static boolean HWR_PortalCheckBBox(const fixed_t *bspcoord)
{
if (!portalclipline)
return true;
if (HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXTOP]) ||
HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXBOTTOM]) ||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXTOP]) ||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXBOTTOM]))
{
if (P_PointOnLineSide(bspcoord[BOXLEFT], bspcoord[BOXBOTTOM], portalclipline) != portalviewside)
return true;
}
P_ClosestPointOnLine(bspcoord[BOXRIGHT], bspcoord[BOXTOP], portalclipline, &closest_point);
if (closest_point.x != bspcoord[BOXRIGHT] || closest_point.y != bspcoord[BOXTOP])
{
if (P_PointOnLineSide(bspcoord[BOXRIGHT], bspcoord[BOXTOP], portalclipline) != portalviewside)
return true;
}
P_ClosestPointOnLine(bspcoord[BOXRIGHT], bspcoord[BOXBOTTOM], portalclipline, &closest_point);
if (closest_point.x != bspcoord[BOXRIGHT] || closest_point.y != bspcoord[BOXBOTTOM])
{
if (P_PointOnLineSide(bspcoord[BOXRIGHT], bspcoord[BOXBOTTOM], portalclipline) != portalviewside)
return true;
return true;
}
// we did not find any reason to pass the check, so return failure
@@ -3353,11 +3353,12 @@ static void HWR_RenderBSPNode(INT32 bspnum)
// PORTAL CULLING
if (portalclipline && portalcullsector)
{
sector_t *sect = subsectors[bspnum & ~NF_SUBSECTOR].sector;
if (sect != portalcullsector)
if (portalcullsector != subsectors[bspnum & ~NF_SUBSECTOR].sector)
return;
portalcullsector = NULL;
else
portalcullsector = NULL;
}
// e6y: support for extended nodes
HWR_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR);
}
@@ -5385,7 +5386,7 @@ static void HWR_PortalClipping(gl_portal_t *portal)
gld_clipper_SafeAddClipRange(angle2, angle1);
}
enum
enum
{
HWR_STENCIL_NORMAL,
HWR_STENCIL_BEGIN,
@@ -5397,7 +5398,7 @@ enum
// Changes the current stencil state.
static void HWR_SetStencilState(int state, int level)
{
if (!cv_nostencil.value && level > -1)
if (level > -1)
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, level);
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, state);
}
@@ -5465,8 +5466,9 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, playe
gl_portal_t *gl_portal_temp;
portallist.base = portallist.cap = NULL;
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
boolean useportals = gr_maphasportals && cv_grportals.value && allow_portals;
if (gr_maphasportals && allow_portals && cv_grportals.value && stencil_level < cv_maxportals.value)// if recursion limit is not reached
if (useportals && stencil_level < cv_maxportals.value) // if recursion limit is not reached
{
// search for portals in current frame
currentportallist = &portallist;
@@ -5486,8 +5488,6 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, playe
// note: if necessary, could sort the portals here?
for (portal = portallist.base; portal; portal = portal->next)
{
if (cv_portalline.value && cv_portalline.value != portal->startline)
continue;
HWR_RenderPortal(portal, rootportal, fpov, player, stencil_level);
}
gr_portal = GRPORTAL_INSIDE;// when portal walls are encountered in following bsp traversal, nothing should be drawn
@@ -5497,13 +5497,14 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, playe
// draw normal things in current frame in current incremented stencil buffer area
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
if (!cv_portalonly.value || rootportal)
{
HWR_SetTransform(fpov, player);
HWR_ClearClipper();
HWR_ClearSprites();
HWR_SetTransform(fpov, player);
HWR_ClearSprites();
HWR_ClearClipper();
if (useportals)
{
if (!rootportal)
portalclipline = NULL;
else
@@ -5511,70 +5512,73 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, playe
HWR_PortalFrame(rootportal);// for portalclipsector, it could have gone null from search
HWR_PortalClipping(rootportal);
}
// Set transform.
HWD.pfnSetTransform(&atransform);
validcount++;
ps_numbspcalls.value.i = 0;
ps_numpolyobjects.value.i = 0;
PS_START_TIMING(ps_bsptime);
if (cv_grbatching.value)
HWR_StartBatching();
if (!rootportal && portallist.base && !skybox)// if portals have been drawn in the main view, then render skywalls differently
gr_collect_skywalls = true;
// HAYA: Save the old portal state, and turn portals off while normally rendering the BSP tree.
// This fixes specific effects not working, such as horizon lines.
int oldgl_portal_state = gr_portal;
if (gr_portal != GRPORTAL_OFF) // if we already haven't hit the recursion limit or we already ended our portal shenanigans
gr_portal = GRPORTAL_INSIDE; // TURN IT OFF
// Recursively "render" the BSP tree.
HWR_RenderBSPNode((INT32)numnodes-1);
// woo we back
gr_portal = oldgl_portal_state;
if (allow_portals) // looks weird, but this is only true when its not skybox rendering skipping precip in skyboxes like software does
HWR_AddPrecipitationSprites();
PS_STOP_TIMING(ps_bsptime);
if (cv_grbatching.value)
HWR_RenderBatches();
if (skyWallVertexArraySize)// if there are skywalls to draw using the alternate method
{
HWR_SetStencilState(HWR_STENCIL_SKY, -1);
HWR_DrawSkyWallList();
HWR_SkyWallList_Clear();
HWR_SetStencilState(HWR_STENCIL_NORMAL, 1);
drewsky = false;
HWR_DrawSkyBackground(fpov);
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
HWD.pfnClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
HWR_SetTransform(fpov, player);// restore transform
}
gr_collect_skywalls = false;
ps_numsprites.value.i = gr_visspritecount;
PS_START_TIMING(ps_hw_spritesorttime);
HWR_SortVisSprites();
PS_STOP_TIMING(ps_hw_spritesorttime);
PS_START_TIMING(ps_hw_spritedrawtime);
HWR_DrawSprites();
PS_STOP_TIMING(ps_hw_spritedrawtime);
ps_numdrawnodes.value.i = 0;
ps_hw_nodesorttime.value.p = 0;
ps_hw_nodedrawtime.value.p = 0;
HWR_RenderDrawNodes();
}
else
portalclipline = NULL;
// Set transform.
HWD.pfnSetTransform(&atransform);
validcount++;
ps_numbspcalls.value.i = 0;
ps_numpolyobjects.value.i = 0;
PS_START_TIMING(ps_bsptime);
if (cv_grbatching.value)
HWR_StartBatching();
if (useportals && !rootportal && portallist.base && !skybox) // if portals have been drawn in the main view, then render skywalls differently
gr_collect_skywalls = true;
// HAYA: Save the old portal state, and turn portals off while normally rendering the BSP tree.
// This fixes specific effects not working, such as horizon lines.
int oldgl_portal_state = gr_portal;
if (gr_portal != GRPORTAL_OFF) // if we already haven't hit the recursion limit or we already ended our portal shenanigans
gr_portal = GRPORTAL_INSIDE; // TURN IT OFF
// Recursively "render" the BSP tree.
HWR_RenderBSPNode((INT32)numnodes-1);
// woo we back
gr_portal = oldgl_portal_state;
if (allow_portals) // looks weird, but this is only true when its not skybox rendering skipping precip in skyboxes like software does
HWR_AddPrecipitationSprites();
PS_STOP_TIMING(ps_bsptime);
if (cv_grbatching.value)
HWR_RenderBatches();
if (skyWallVertexArraySize) // if there are skywalls to draw using the alternate method
{
HWR_SetStencilState(HWR_STENCIL_SKY, -1);
HWR_DrawSkyWallList();
HWR_SkyWallList_Clear();
HWR_SetStencilState(HWR_STENCIL_NORMAL, 1);
drewsky = false;
HWR_DrawSkyBackground(fpov);
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
HWD.pfnClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
HWR_SetTransform(fpov, player);// restore transform
}
gr_collect_skywalls = false;
ps_numsprites.value.i = gr_visspritecount;
PS_START_TIMING(ps_hw_spritesorttime);
HWR_SortVisSprites();
PS_STOP_TIMING(ps_hw_spritesorttime);
PS_START_TIMING(ps_hw_spritedrawtime);
HWR_DrawSprites();
PS_STOP_TIMING(ps_hw_spritedrawtime);
ps_numdrawnodes.value.i = 0;
ps_hw_nodesorttime.value.p = 0;
ps_hw_nodedrawtime.value.p = 0;
HWR_RenderDrawNodes();
// free memory from portal list allocated by calls to Add2Lines
gl_portal_temp = portallist.base;
while (gl_portal_temp)
@@ -5583,9 +5587,6 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, playe
Z_Free(gl_portal_temp);
gl_portal_temp = nextportal;
}
// TODO: batching at some point
// TODO: is it okay if stencil test is on all the time even when its not needed?
}
@@ -5785,7 +5786,7 @@ void HWR_AddCommands(void)
CV_RegisterVar(&cv_grfiltermode);
CV_RegisterVar(&cv_granisotropicmode);
CV_RegisterVar(&cv_grsolvetjoin);
CV_RegisterVar(&cv_grbatching);
CV_RegisterVar(&cv_splitwallfix);
@@ -5795,25 +5796,22 @@ void HWR_AddCommands(void)
CV_RegisterVar(&cv_grfakecontrast);
CV_RegisterVar(&cv_grslopecontrast);
CV_RegisterVar(&cv_grhorizonlines);
CV_RegisterVar(&cv_grfovchange);
CV_RegisterVar(&cv_grmdls);
CV_RegisterVar(&cv_grfallbackplayermodel);
CV_RegisterVar(&cv_grspritebillboarding);
CV_RegisterVar(&cv_grshearing);
CV_RegisterVar(&cv_grshaders);
CV_RegisterVar(&cv_grportals);
CV_RegisterVar(&cv_nostencil);
CV_RegisterVar(&cv_portalline);
CV_RegisterVar(&cv_portalonly);
CV_RegisterVar(&cv_secbright);
CV_RegisterVar(&cv_grpaletterendering);
CV_RegisterVar(&cv_grpalettedepth);
CV_RegisterVar(&cv_grflashpal);
+1 -1
View File
@@ -49,7 +49,7 @@ static fixed_t ScaleFromMap(fixed_t n, fixed_t scale)
static boolean K_DirectorIsEnabled(void)
{
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (!playeringame[consoleplayer] || players[consoleplayer].spectator || demo.playback));
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (!playeringame[consoleplayer] || players[consoleplayer].spectator || (demo.playback && (!demo.title || !modeattacking))));
}
void K_InitDirector(void)
+8 -4
View File
@@ -2262,12 +2262,14 @@ static menuitem_t OP_SaturnHudMenu[] =
{IT_STRING | IT_CVAR, NULL, "Show Names on Minimap", &cv_showminimapnames, 70},
{IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 75},
{IT_STRING | IT_CVAR, NULL, "Uncapped HUD", &cv_uncappedhud, 85},
{IT_STRING | IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 80},
{IT_STRING | IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 95},
{IT_STRING | IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 100},
{IT_STRING | IT_CVAR, NULL, "Uncapped HUD", &cv_uncappedhud, 90},
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 110},
{IT_STRING | IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 100},
{IT_STRING | IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 105},
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 115},
};
static const char* OP_SaturnHudTooltips[] =
@@ -2286,6 +2288,7 @@ static const char* OP_SaturnHudTooltips[] =
"Show the big Cecho Messages.",
"Show player names on the minimap.",
"Minimize the player icons on the minimap.",
"Show the Director Toggle prompt when spectating.",
"Uncaps the HUD framerate, making it appear smoother.",
"Nametag Options.",
"Driftgauge Options.",
@@ -2308,6 +2311,7 @@ enum
sh_cechotogle,
sh_mapname,
sh_smallmap,
sh_directorhud,
sh_uncappedhud,
sh_nametagmen,
sh_driftgaugemen,
+2 -131
View File
@@ -584,7 +584,6 @@ static void P_LoadRawSegs(UINT8 *data)
}
}
// Loads the SSECTORS resource from a level.
FUNCINLINE static ATTRINLINE void P_LoadRawSubsectors(void *data)
{
@@ -596,7 +595,7 @@ FUNCINLINE static ATTRINLINE void P_LoadRawSubsectors(void *data)
{
ss->sector = NULL;
ss->numlines = SHORT(ms->numsegs);
ss->firstline = SHORT(ms->firstseg);
ss->firstline = (UINT16)SHORT(ms->firstseg);
#ifdef FLOORSPLATS
ss->splats = NULL;
#endif
@@ -849,73 +848,6 @@ static void P_LoadRawNodes(UINT8 *data)
}
}
//
// P_ReloadRings
// Used by NiGHTS, clears all ring/wing/etc items and respawns them
//
void P_ReloadRings(void)
{
mobj_t *mo;
thinker_t *th;
size_t i, numHoops = 0;
// Okay, if you have more than 4000 hoops in your map,
// you're insane.
mapthing_t *hoopsToRespawn[4096];
mapthing_t *mt = mapthings;
// scan the thinkers to find rings/wings/hoops to unset
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
mo = (mobj_t *)th;
if (mo->type == MT_HOOPCENTER)
{
// Hoops give me a headache
if (mo->threshold == 4242) // Dead hoop
{
hoopsToRespawn[numHoops++] = mo->spawnpoint;
P_RemoveMobj(mo);
}
continue;
}
if (!(mo->type == MT_RING || mo->type == MT_NIGHTSWING || mo->type == MT_COIN
|| mo->type == MT_BLUEBALL))
continue;
// Don't auto-disintegrate things being pulled to us
if (mo->flags2 & MF2_NIGHTSPULL)
continue;
P_RemoveMobj(mo);
}
// Reiterate through mapthings
for (i = 0; i < nummapthings; i++, mt++)
{
// Notice an omission? We handle hoops differently.
if (mt->type == 300 || mt->type == 308 || mt->type == 309
|| mt->type == 1706 || (mt->type >= 600 && mt->type <= 609)
|| mt->type == 1800)
{
mt->mobj = NULL;
// Z for objects Tails 05-26-2002
mt->z = (INT16)(R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)
->sector->floorheight>>FRACBITS);
P_SpawnHoopsAndRings (mt);
}
}
for (i = 0; i < numHoops; i++)
{
P_SpawnHoopsAndRings(hoopsToRespawn[i]);
}
}
//
// P_LoadThings
//
@@ -1283,67 +1215,6 @@ static void P_LoadLineDefs2(void)
break;
}
}
// Optimize sidedefs
if (M_CheckParm("-compress"))
{
side_t *newsides;
size_t numnewsides = 0;
size_t z;
for (i = 0; i < numsides; i++)
{
size_t j, k;
if (sides[i].sector == NULL)
continue;
for (k = numlines, ld = lines; k--; ld++)
{
if (ld->sidenum[0] == i)
ld->sidenum[0] = (UINT16)numnewsides;
if (ld->sidenum[1] == i)
ld->sidenum[1] = (UINT16)numnewsides;
}
for (j = i+1; j < numsides; j++)
{
if (sides[j].sector == NULL)
continue;
if (!memcmp(&sides[i], &sides[j], sizeof(side_t)))
{
// Find the linedefs that belong to this one
for (k = numlines, ld = lines; k--; ld++)
{
if (ld->sidenum[0] == j)
ld->sidenum[0] = (UINT16)numnewsides;
if (ld->sidenum[1] == j)
ld->sidenum[1] = (UINT16)numnewsides;
}
sides[j].sector = NULL; // Flag for deletion
}
}
numnewsides++;
}
// We're loading crap into this block anyhow, so no point in zeroing it out.
newsides = Z_Malloc(numnewsides * sizeof(*newsides), PU_LEVEL, NULL);
// Copy the sides to their new block of memory.
for (i = 0, z = 0; i < numsides; i++)
{
if (sides[i].sector != NULL)
M_Memcpy(&newsides[z++], &sides[i], sizeof(side_t));
}
CONS_Debug(DBG_SETUP, "Old sides is %s, new sides is %s\n", sizeu1(numsides), sizeu1(numnewsides));
Z_Free(sides);
sides = newsides;
numsides = numnewsides;
}
}
static void P_LoadRawSideDefs2(void *data)
@@ -1703,8 +1574,8 @@ static void P_CreateBlockMap(void)
{
register size_t i;
fixed_t minx = INT32_MAX, miny = INT32_MAX, maxx = INT32_MIN, maxy = INT32_MIN;
// First find limits of map
// First find limits of map
for (i = 0; i < numvertexes; i++)
{
if (vertexes[i].x>>FRACBITS < minx)
-1
View File
@@ -93,7 +93,6 @@ size_t P_PrecacheLevelFlats(void);
void P_AllocMapHeader(INT16 i);
// Needed for NiGHTS
void P_ReloadRings(void);
void P_DeleteGrades(INT16 i);
void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext);
UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare);
+11 -9
View File
@@ -40,7 +40,6 @@ static void P_UpdateSlopeLightOffset(pslope_t *slope)
if (slope->normal.z == 0)
{
slope->lightOffset = 0;
#ifdef HWRENDER
slope->hwLightOffset = 0;
@@ -66,7 +65,8 @@ static void P_UpdateSlopeLightOffset(pslope_t *slope)
}
// Calculate line normal
void P_CalculateSlopeNormal(pslope_t *slope) {
void P_CalculateSlopeNormal(pslope_t *slope)
{
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.x);
slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.y);
@@ -145,7 +145,8 @@ static void P_ReconfigureVertexSlope(pslope_t *slope)
}
// Recalculate dynamic slopes
void P_RunDynamicSlopes(void) {
void P_RunDynamicSlopes(void)
{
pslope_t *slope;
for (slope = slopelist; slope; slope = slope->next) {
@@ -329,7 +330,7 @@ void P_SpawnSlope_Line(int linenum)
origin.y = line->v1->y + (line->v2->y - line->v1->y)/2;
// For FOF slopes, make a special function to copy to the xy origin & direction relative to the position of the FOF on the map!
if(frontfloor || frontceil)
if (frontfloor || frontceil)
{
line->frontsector->hasslope = true; // Tell the software renderer that we're sloped
@@ -353,7 +354,7 @@ void P_SpawnSlope_Line(int linenum)
// TODO: We take origin and point 's xy values and translate them to the center of an FOF!
if(frontfloor)
if (frontfloor)
{
fixed_t highest, lowest;
size_t l;
@@ -462,7 +463,7 @@ void P_SpawnSlope_Line(int linenum)
P_CalculateSlopeNormal(cslope);
}
}
if(backfloor || backceil)
if (backfloor || backceil)
{
line->backsector->hasslope = true; // Tell the software renderer that we're sloped
@@ -485,7 +486,7 @@ void P_SpawnSlope_Line(int linenum)
direction.x = -direction.x;
direction.y = -direction.y;
if(backfloor)
if (backfloor)
{
fixed_t highest, lowest;
size_t l;
@@ -530,7 +531,7 @@ void P_SpawnSlope_Line(int linenum)
P_CalculateSlopeNormal(fslope);
}
if(backceil)
if (backceil)
{
fixed_t highest, lowest;
size_t l;
@@ -680,7 +681,8 @@ pslope_t *P_SlopeById(UINT16 id)
}
// Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes
void P_ResetDynamicSlopes(void) {
void P_ResetDynamicSlopes(void)
{
size_t i;
slopelist = NULL;
+1 -1
View File
@@ -364,7 +364,7 @@ static inline void P_DeviceRumbleTick(void)
{
low = high = 65536 / 8;
}
else if ((player->kartstuff[k_offroad])
else if ((player->kartstuff[k_offroad] && !player->kartstuff[k_hyudorotimer])
&& P_IsObjectOnGround(player->mo) && player->speed != 0)
{
low = high = 65536 / 64;
+1 -1
View File
@@ -459,7 +459,7 @@ typedef struct subsector_s
{
sector_t *sector;
INT16 numlines;
UINT16 firstline;
UINT32 firstline;
struct polyobj_s *polyList; // haleyjd 02/19/06: list of polyobjects
#if 1//#ifdef FLOORSPLATS
void *splats; // floorsplat_t list
+14 -5
View File
@@ -28,6 +28,9 @@
#include "m_menu.h"
#include "m_cheat.h"
#include "p_setup.h" // NiGHTS grading
#include "i_time.h"
#include "k_kart.h" // SRB2kart
//random index
@@ -659,17 +662,23 @@ static void ST_overlayDrawer(void)
if (!hu_showscores) // hide the following if TAB is held
{
// Countdown timer for Race Mode
// ...moved to k_kart.c so we can take advantage of the LAPS_Y value
if ((demo.playback || !P_IsLocalPlayer(stplyr)) && !splitscreen)
if (cv_showdirectorhud.value && ((demo.playback && (!demo.title || !modeattacking)) || !P_IsLocalPlayer(stplyr)) && !splitscreen)
{
char directortext[20] = {0};
snprintf(directortext, 20, "Director: %s", cv_director.value ? "On" : "Off");
V_DrawString(1, BASEVIDHEIGHT-8-1, V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_HUDTRANSHALF|V_ALLOWLOWERCASE, directortext);
if (directortoggletimer < 4*TICRATE)
{
V_DrawString(1, BASEVIDHEIGHT-8-1, V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_HUDTRANSHALF|V_ALLOWLOWERCASE, directortext);
if (renderisnewtic)
directortoggletimer++;
}
else if (cv_translucenthud.value != 0)
V_DrawString(1, BASEVIDHEIGHT-8-1, V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_80TRANS|V_ALLOWLOWERCASE, directortext); // idk if V_80TRANS is good?
}
else
directortoggletimer = 0;
if (cv_showviewpointtext.value)
{