diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 66999fdf2..aec247108 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -468,6 +468,8 @@ consvar_t cv_pingtimeout = {"pingtimeout", "10", CV_SAVE, pingtimeout_cons_t, NU static CV_PossibleValue_t showping_cons_t[] = {{0, "Off"}, {1, "Always"}, {2, "Warning"}, {0, NULL}}; consvar_t cv_showping = {"showping", "Always", CV_SAVE, showping_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_showviewpointtext = {"showviewpointtext", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL}; + // Intermission time Tails 04-19-2002 static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NULL}}; consvar_t cv_inttime = {"inttime", "20", CV_NETVAR, inttime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -732,6 +734,7 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_lagless); CV_RegisterVar(&cv_pingtimeout); CV_RegisterVar(&cv_showping); + CV_RegisterVar(&cv_showviewpointtext); #ifdef SEENAMES CV_RegisterVar(&cv_allowseenames); diff --git a/src/d_netcmd.h b/src/d_netcmd.h index ec5f885ca..29cd68818 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -147,6 +147,7 @@ extern consvar_t cv_maxping; extern consvar_t cv_lagless; extern consvar_t cv_pingtimeout; extern consvar_t cv_showping; +extern consvar_t cv_showviewpointtext; extern consvar_t cv_skipmapcheck; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index fd765afe1..b89711e20 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3564,6 +3564,9 @@ static void HWR_Subsector(size_t num) sub->sector->extra_colormap = gr_frontsector->extra_colormap; + //R_PlaneLightOverride(gr_frontsector, false, &floorlightlevel); + //R_PlaneLightOverride(gr_frontsector, true, &ceilinglightlevel); + // render floor ? #ifdef DOPLANES // yeah, easy backface cull! :) diff --git a/src/info.c b/src/info.c index 275c70018..f42532e89 100644 --- a/src/info.c +++ b/src/info.c @@ -1851,7 +1851,7 @@ state_t states[NUMSTATES] = {SPR_SPHG, 2, 4, {NULL}, 0, 0, S_GHORIZ1}, // S_GHORIZ4 // Rain - {SPR_RAIN, FF_TRANS50, -1, {NULL}, 0, 0, S_NULL}, // S_RAIN1 + {SPR_RAIN, 0, -1, {NULL}, 0, 0, S_NULL}, // S_RAIN1 {SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_RAINRETURN // Snowflake @@ -1876,9 +1876,9 @@ state_t states[NUMSTATES] = {SPR_SPLH, FF_TRANS50|8, 2, {NULL}, 0, 0, S_NULL}, // S_SPLISH9 // Water Splash - {SPR_SPLA, FF_TRANS50 , 3, {NULL}, 0, 0, S_SPLASH2}, // S_SPLASH1 - {SPR_SPLA, FF_TRANS70|1, 3, {NULL}, 0, 0, S_SPLASH3}, // S_SPLASH2 - {SPR_SPLA, FF_TRANS90|2, 3, {NULL}, 0, 0, S_NULL}, // S_SPLASH3 + {SPR_SPLA, 0, 3, {NULL}, 0, 0, S_SPLASH2}, // S_SPLASH1 + {SPR_SPLA, 1, 3, {NULL}, 0, 0, S_SPLASH3}, // S_SPLASH2 + {SPR_SPLA, 2, 3, {NULL}, 0, 0, S_NULL}, // S_SPLASH3 // Smoke {SPR_SMOK, FF_TRANS50 , 4, {NULL}, 0, 0, S_SMOKE2}, // S_SMOKE1 diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index d10a8dd0a..4ef61704b 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -139,6 +139,8 @@ enum cameraf { camera_momx, camera_momy, camera_momz, + camera_pan, + camera_pitch, camera_pnum }; @@ -158,6 +160,8 @@ static const char *const camera_opt[] = { "momx", "momy", "momz", + "pan", + "pitch", "pnum", NULL}; @@ -314,6 +318,12 @@ static int camera_get(lua_State *L) case camera_momz: lua_pushinteger(L, cam->momz); break; + case camera_pan: + lua_pushinteger(L, cam->pan); + break; + case camera_pitch: + lua_pushinteger(L, cam->pitch); + break; case camera_pnum: lua_pushinteger(L, camnum); break; diff --git a/src/p_local.h b/src/p_local.h index 1358bf195..85fd08d71 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -107,6 +107,8 @@ typedef struct camera_s // SRB2Kart: camera pans while drifting fixed_t pan; + // SRB2Kart: camera pitches on slopes + angle_t pitch; } camera_t; extern camera_t camera[MAXSPLITSCREENPLAYERS]; diff --git a/src/p_mobj.c b/src/p_mobj.c index 69129406b..1b1b28653 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6209,169 +6209,6 @@ static void P_RemoveOverlay(mobj_t *thing) } } -// Simplified version of a code bit in P_MobjFloorZ -static fixed_t P_ShadowSlopeZ(pslope_t *slope, fixed_t x, fixed_t y, fixed_t radius, boolean ceiling) -{ - fixed_t testx, testy; - - if (slope->d.x < 0) - testx = radius; - else - testx = -radius; - - if (slope->d.y < 0) - testy = radius; - else - testy = -radius; - - if ((slope->zdelta > 0) ^ !!(ceiling)) - { - testx = -testx; - testy = -testy; - } - - testx += x; - testy += y; - - return P_GetZAt(slope, testx, testy); -} - -// Sets standingslope/modeltilt, returns z position for shadows; used also for stuff like bananas -// (I would've preferred to be able to return both the slope & z, but I'll take what I can get...) -fixed_t P_CalculateShadowFloor(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z, fixed_t radius, fixed_t height, boolean flip, boolean player) -{ - fixed_t newz; - sector_t *sec; -#ifdef ESLOPE - pslope_t *slope = NULL; -#endif - - sec = R_PointInSubsector(x, y)->sector; - - if (flip) - { -#ifdef ESLOPE - if (sec->c_slope) - { - slope = sec->c_slope; - newz = P_ShadowSlopeZ(slope, x, y, radius, true); - } - else -#endif - newz = sec->ceilingheight; - } - else - { -#ifdef ESLOPE - if (sec->f_slope) - { - slope = sec->f_slope; - newz = P_ShadowSlopeZ(slope, x, y, radius, false); - } - else -#endif - newz = sec->floorheight; - } - - // Check FOFs for a better suited slope - if (sec->ffloors) - { - ffloor_t *rover; - - for (rover = sec->ffloors; rover; rover = rover->next) - { - fixed_t top, bottom; - fixed_t d1, d2; - - if (!(rover->flags & FF_EXISTS)) - continue; - - if ((!(((rover->flags & FF_BLOCKPLAYER && player) - || (rover->flags & FF_BLOCKOTHERS && !player)) - || (rover->flags & FF_QUICKSAND)) - || (rover->flags & FF_SWIMMABLE))) - continue; - -#ifdef ESLOPE - if (*rover->t_slope) - top = P_ShadowSlopeZ(*rover->t_slope, x, y, radius, false); - else -#endif - top = *rover->topheight; - -#ifdef ESLOPE - if (*rover->b_slope) - bottom = P_ShadowSlopeZ(*rover->b_slope, x, y, radius, true); - else -#endif - bottom = *rover->bottomheight; - - if (flip) - { - if (rover->flags & FF_QUICKSAND) - { - if (z < top && (z + height) > bottom) - { - if (newz > (z + height)) - { - newz = (z + height); - slope = NULL; - } - } - continue; - } - - d1 = (z + height) - (top + ((bottom - top)/2)); - d2 = z - (top + ((bottom - top)/2)); - - if (bottom < newz && abs(d1) < abs(d2)) - { - newz = bottom; -#ifdef ESLOPE - if (*rover->b_slope) - slope = *rover->b_slope; -#endif - } - } - else - { - if (rover->flags & FF_QUICKSAND) - { - if (z < top && (z + height) > bottom) - { - if (newz < z) - { - newz = z; - slope = NULL; - } - } - continue; - } - - d1 = z - (bottom + ((top - bottom)/2)); - d2 = (z + height) - (bottom + ((top - bottom)/2)); - - if (top > newz && abs(d1) < abs(d2)) - { - newz = top; -#ifdef ESLOPE - if (*rover->t_slope) - slope = *rover->t_slope; -#endif - } - } - } - } - - mobj->standingslope = slope; - -#ifdef HWRENDER - mobj->modeltilt = slope; -#endif - - return newz; -} - // SAL'S KART BATTLE MODE OVERTIME HANDLER #define MAXPLANESPERSECTOR (MAXFFLOORS+1)*2 static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, fixed_t scale, mobjtype_t type, boolean ceiling) diff --git a/src/p_user.c b/src/p_user.c index 035979c75..85f93602b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7242,8 +7242,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall { static UINT8 lookbackdelay[4] = {0,0,0,0}; UINT8 num; - angle_t angle = 0, focusangle = 0, focusaiming = 0; - fixed_t x, y, z, dist, height, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight; + angle_t angle = 0, focusangle = 0, focusaiming = 0, pitch = 0; + fixed_t x, y, z, dist, distxy, distz, height, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight; fixed_t pan, xpan, ypan; INT32 camrotate; boolean camstill, lookback; @@ -7492,8 +7492,32 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall height -= FixedMul(height, player->karthud[khud_boostcam]); } - x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist); - y = mo->y - FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist); + if (mo->standingslope) + { + pitch = (angle_t)FixedMul(P_ReturnThrustX(mo, player->frameangle - mo->standingslope->xydirection, FRACUNIT), (fixed_t)mo->standingslope->zangle); + if (mo->eflags & MFE_VERTICALFLIP) + { + if (pitch >= ANGLE_180) + pitch = 0; + } + else + { + if (pitch < ANGLE_180) + pitch = 0; + } + } + pitch = thiscam->pitch + (angle_t)FixedMul(pitch - thiscam->pitch, camspeed/4); + + if (rendermode == render_opengl && !cv_grshearing.value) + distxy = FixedMul(dist, FINECOSINE((pitch>>ANGLETOFINESHIFT) & FINEMASK)); + else + distxy = dist; + distz = -FixedMul(dist, FINESINE((pitch>>ANGLETOFINESHIFT) & FINEMASK)); + if (splitscreen == 1) // 2 player is weird, this helps keep players on screen + distz = 3*distz/5; + + x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy); + y = mo->y - FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy); // SRB2Kart: set camera panning if (camstill || resetcalled || player->playerstate == PST_DEAD) @@ -7524,9 +7548,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall pviewheight = FixedMul(32<scale); if (mo->eflags & MFE_VERTICALFLIP) - z = mo->z + mo->height - pviewheight - camheight; + z = mo->z + mo->height - pviewheight - camheight + distz; else - z = mo->z + pviewheight + camheight; + z = mo->z + pviewheight + camheight + distz; #ifndef NOCLIPCAM // Disable all z-clipping for noclip cam // move camera down to move under lower ceilings @@ -7761,6 +7785,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } thiscam->pan = pan; + thiscam->pitch = pitch; // compute aming to look the viewed point f1 = viewpointx-thiscam->x; @@ -7768,9 +7793,17 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall dist = FixedHypot(f1, f2); if (mo->eflags & MFE_VERTICALFLIP) + { angle = R_PointToAngle2(0, thiscam->z + thiscam->height, dist, mo->z + mo->height - P_GetPlayerHeight(player)); + if (thiscam->pitch < ANGLE_180 && thiscam->pitch > angle) + angle = thiscam->pitch; + } else + { angle = R_PointToAngle2(0, thiscam->z, dist, mo->z + P_GetPlayerHeight(player)); + if (thiscam->pitch >= ANGLE_180 && thiscam->pitch < angle) + angle = thiscam->pitch; + } if (player->playerstate != PST_DEAD && !((player->pflags & PF_NIGHTSMODE) && player->exiting)) angle += (focusaiming < ANGLE_180 ? focusaiming/2 : InvAngle(InvAngle(focusaiming)/2)); // overcomplicated version of '((signed)focusaiming)/2;' diff --git a/src/r_bsp.c b/src/r_bsp.c index d7641838e..13240fe47 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -57,6 +57,16 @@ static boolean R_NoEncore(sector_t *sector, boolean ceiling) return ((boolean)(sector->flags & SF_FLIPSPECIAL_FLOOR)); } +static void R_PlaneLightOverride(sector_t *sector, boolean ceiling, INT32 *lightlevel) +{ + if (GETSECSPECIAL(sector->special, 4) == 6) // Fullbright sneaker panels + { + if ((ceiling && (sector->flags & SF_FLIPSPECIAL_CEILING)) + || (!ceiling && (sector->flags & SF_FLIPSPECIAL_FLOOR))) + *lightlevel = 255; + } +} + // // R_ClearDrawSegs // @@ -895,6 +905,9 @@ static void R_Subsector(size_t num) sub->sector->extra_colormap = frontsector->extra_colormap; + R_PlaneLightOverride(frontsector, false, &floorlightlevel); + R_PlaneLightOverride(frontsector, true, &ceilinglightlevel); + if ((( #ifdef ESLOPE frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) : @@ -923,8 +936,8 @@ static void R_Subsector(size_t num) || (frontsector->heightsec != -1 && sectors[frontsector->heightsec].floorpic == skyflatnum))) { - ceilingplane = R_FindPlane(frontsector->ceilingheight, frontsector->ceilingpic, - ceilinglightlevel, frontsector->ceiling_xoffs, frontsector->ceiling_yoffs, frontsector->ceilingpic_angle, + ceilingplane = R_FindPlane(frontsector->ceilingheight, frontsector->ceilingpic, ceilinglightlevel, + frontsector->ceiling_xoffs, frontsector->ceiling_yoffs, frontsector->ceilingpic_angle, ceilingcolormap, NULL #ifdef POLYOBJECTS_PLANES , NULL diff --git a/src/r_main.c b/src/r_main.c index e01a1f446..2272eaf34 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -841,7 +841,7 @@ static void R_SetupFreelook(void) // clip it in the case we are looking a hardware 90 degrees full aiming // (lmps, network and use F12...) G_SoftwareClipAimingPitch((INT32 *)&aimingangle); - dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH; + dy = AIMINGTODY(aimingangle) * viewheight/BASEVIDHEIGHT; yslope = &yslopetab[viewheight*8 - (viewheight/2 + dy)]; } centery = (viewheight/2) + dy; diff --git a/src/st_stuff.c b/src/st_stuff.c index 02c4fe445..4f46e1b69 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1894,38 +1894,40 @@ static void ST_overlayDrawer(void) V_DrawScaledPatch(hudinfo[HUD_GRAVBOOTSICO].x, STRINGY(hudinfo[HUD_GRAVBOOTSICO].y), V_SNAPTORIGHT, gravboots); */ - if (!(multiplayer && demo.playback)) + if (cv_showviewpointtext.value) { - if(!P_IsLocalPlayer(stplyr)) + if (!(multiplayer && demo.playback)) { - /*char name[MAXPLAYERNAME+1]; - // shorten the name if its more than twelve characters. - strlcpy(name, player_names[stplyr-players], 13);*/ + if(!P_IsLocalPlayer(stplyr)) + { + /*char name[MAXPLAYERNAME+1]; + // shorten the name if its more than twelve characters. + strlcpy(name, player_names[stplyr-players], 13);*/ - // Show name of player being displayed - V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, 0, M_GetText("Viewpoint:")); - V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_ALLOWLOWERCASE, player_names[stplyr-players]); + // Show name of player being displayed + V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, 0, M_GetText("VIEWPOINT:")); + V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_ALLOWLOWERCASE, player_names[stplyr-players]); + } } - } - else if (!demo.title) - { + else if (!demo.title) + { + if (!r_splitscreen) + { + V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("VIEWPOINT:")); + V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_HUDTRANSHALF|V_ALLOWLOWERCASE, player_names[stplyr-players]); + } + else if (r_splitscreen == 1) + { + char name[MAXPLAYERNAME+12]; - if (!r_splitscreen) - { - V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Viewpoint:")); - V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_HUDTRANSHALF|V_ALLOWLOWERCASE, player_names[stplyr-players]); - } - else if (r_splitscreen == 1) - { - char name[MAXPLAYERNAME+12]; - - INT32 y = (stplyr == &players[displayplayers[0]]) ? 4 : BASEVIDHEIGHT/2-12; - sprintf(name, "VIEWPOINT: %s", player_names[stplyr-players]); - V_DrawRightAlignedThinString(BASEVIDWIDTH-40, y, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOBOTTOM|V_SNAPTORIGHT), name); - } - else if (r_splitscreen) - { - V_DrawCenteredThinString((vid.width/vid.dupx)/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT), player_names[stplyr-players]); + INT32 y = (stplyr == &players[displayplayers[0]]) ? 4 : BASEVIDHEIGHT/2-12; + sprintf(name, "VIEWPOINT: %s", player_names[stplyr-players]); + V_DrawRightAlignedThinString(BASEVIDWIDTH-40, y, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOBOTTOM|V_SNAPTORIGHT), name); + } + else if (r_splitscreen) + { + V_DrawCenteredThinString((vid.width/vid.dupx)/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT), player_names[stplyr-players]); + } } }