This commit is contained in:
Christoph Oelckers 2020-05-31 23:38:17 +02:00
commit ff99dfbbc6
10 changed files with 49 additions and 28 deletions

View file

@ -810,6 +810,7 @@ xx(MoveBob)
xx(StillBob) xx(StillBob)
xx(ClassicFlight) xx(ClassicFlight)
xx(WBobSpeed) xx(WBobSpeed)
xx(WBobFire)
xx(PlayerClass) xx(PlayerClass)
xx(MonsterClass) xx(MonsterClass)
xx(MorphedMonster) xx(MorphedMonster)

View file

@ -33,10 +33,7 @@
*/ */
#include <windows.h> #include <windows.h>
#include <GL/gl.h>
#include "wglext.h"
#include "gl_sysfb.h"
#include "hardware.h" #include "hardware.h"
#include "x86.h" #include "x86.h"
#include "templates.h" #include "templates.h"
@ -52,8 +49,6 @@
#include "win32basevideo.h" #include "win32basevideo.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "gl_framebuffer.h"
CVAR(Int, vid_adapter, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Int, vid_adapter, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
//========================================================================== //==========================================================================

View file

@ -65,6 +65,7 @@ CVAR (Bool, neverswitchonpickup, false, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, movebob, 0.25f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Float, movebob, 0.25f, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, stillbob, 0.f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Float, stillbob, 0.f, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, wbobspeed, 1.f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Float, wbobspeed, 1.f, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, wbobfire, 0.f, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (String, playerclass, "Fighter", CVAR_USERINFO | CVAR_ARCHIVE); CVAR (String, playerclass, "Fighter", CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Bool, classicflight, false, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Bool, classicflight, false, CVAR_USERINFO | CVAR_ARCHIVE);
@ -80,6 +81,7 @@ enum
INFO_MoveBob, INFO_MoveBob,
INFO_StillBob, INFO_StillBob,
INFO_WBobSpeed, INFO_WBobSpeed,
INFO_WBobFire,
INFO_PlayerClass, INFO_PlayerClass,
INFO_ColorSet, INFO_ColorSet,
INFO_ClassicFlight, INFO_ClassicFlight,
@ -629,7 +631,7 @@ bool D_SendServerInfoChange (FBaseCVar *cvar, UCVarValue value, ECVarType type)
{ {
if (netgame && !players[consoleplayer].settings_controller) if (netgame && !players[consoleplayer].settings_controller)
{ {
Printf("Only setting controllers can change %s\n", cvar->GetName()); Printf("Only setting controllers can change server CVAR %s\n", cvar->GetName());
cvar->MarkSafe(); cvar->MarkSafe();
return true; return true;
} }
@ -659,7 +661,10 @@ bool D_SendServerFlagChange (FBaseCVar *cvar, int bitnum, bool set, bool silent)
{ {
if (netgame && !players[consoleplayer].settings_controller) if (netgame && !players[consoleplayer].settings_controller)
{ {
if (!silent) Printf("Only setting controllers can change %s\n", cvar->GetName()); if (!silent)
{
Printf("Only setting controllers can change server CVAR %s\n", cvar->GetName());
}
return true; return true;
} }

View file

@ -1102,7 +1102,7 @@ void G_Ticker ()
if (ToggleFullscreen) if (ToggleFullscreen)
{ {
ToggleFullscreen = false; ToggleFullscreen = false;
AddCommandString ("toggle fullscreen"); AddCommandString ("toggle vid_fullscreen");
} }
// do things to change the game state // do things to change the game state

View file

@ -1702,13 +1702,6 @@ void MapLoader::LoadLineDefs (MapData * map)
} }
else else
{ {
// patch missing first sides instead of crashing out.
// Visual glitches are better than not being able to play.
if (LittleShort(mld->sidenum[0]) == NO_INDEX)
{
Printf("Line %d has no first side.\n", i);
mld->sidenum[0] = 0;
}
sidecount++; sidecount++;
if (LittleShort(mld->sidenum[1]) != NO_INDEX) if (LittleShort(mld->sidenum[1]) != NO_INDEX)
sidecount++; sidecount++;
@ -1747,6 +1740,22 @@ void MapLoader::LoadLineDefs (MapData * map)
ProcessEDLinedef(ld, mld->tag); ProcessEDLinedef(ld, mld->tag);
} }
#endif #endif
// cph 2006/09/30 - fix sidedef errors right away.
for (int j=0; j < 2; j++)
{
if (LittleShort(mld->sidenum[j]) != NO_INDEX && mld->sidenum[j] >= Level->sides.Size())
{
mld->sidenum[j] = 0; // dummy sidedef
Printf("Linedef %d has a bad sidedef\n", i);
}
}
// patch missing first sides instead of crashing out.
// Visual glitches are better than not being able to play.
if (LittleShort(mld->sidenum[0]) == NO_INDEX)
{
Printf("Line %d has no first side.\n", i);
mld->sidenum[0] = 0;
}
ld->v1 = &Level->vertexes[LittleShort(mld->v1)]; ld->v1 = &Level->vertexes[LittleShort(mld->v1)];
ld->v2 = &Level->vertexes[LittleShort(mld->v2)]; ld->v2 = &Level->vertexes[LittleShort(mld->v2)];
@ -2180,11 +2189,11 @@ void MapLoader::LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex)
// killough 4/4/98: allow sidedef texture names to be overloaded // killough 4/4/98: allow sidedef texture names to be overloaded
// killough 4/11/98: refined to allow colormaps to work as wall // killough 4/11/98: refined to allow colormaps to work as wall
// textures if invalid as colormaps but valid as textures. // textures if invalid as colormaps but valid as textures.
// cph 2006/09/30 - catch out-of-range sector numbers; use sector 0 instead
if ((unsigned)LittleShort(msd->sector)>=Level->sectors.Size()) if ((unsigned)LittleShort(msd->sector)>=Level->sectors.Size())
{ {
Printf (PRINT_HIGH, "Sidedef %d has a bad sector\n", i); Printf (PRINT_HIGH, "Sidedef %d has a bad sector\n", i);
sd->sector = sec = nullptr; sd->sector = sec = &Level->sectors[0];
} }
else else
{ {

View file

@ -232,6 +232,10 @@ struct userinfo_t : TMap<FName,FBaseCVar *>
{ {
return *static_cast<FFloatCVar *>(*CheckKey(NAME_WBobSpeed)); return *static_cast<FFloatCVar *>(*CheckKey(NAME_WBobSpeed));
} }
double GetWBobFire() const
{
return *static_cast<FFloatCVar *>(*CheckKey(NAME_WBobFire));
}
int GetPlayerClassNum() const int GetPlayerClassNum() const
{ {
return *static_cast<FIntCVar *>(*CheckKey(NAME_PlayerClass)); return *static_cast<FIntCVar *>(*CheckKey(NAME_PlayerClass));

View file

@ -790,6 +790,12 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, GetWBobSpeed)
ACTION_RETURN_FLOAT(self->userinfo.GetWBobSpeed()); ACTION_RETURN_FLOAT(self->userinfo.GetWBobSpeed());
} }
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetWBobFire)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
ACTION_RETURN_FLOAT(self->userinfo.GetWBobFire());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetMoveBob) DEFINE_ACTION_FUNCTION(_PlayerInfo, GetMoveBob)
{ {
PARAM_SELF_STRUCT_PROLOGUE(player_t); PARAM_SELF_STRUCT_PROLOGUE(player_t);

View file

@ -25,7 +25,6 @@
** **
*/ */
#include "gl_system.h"
#include "gi.h" #include "gi.h"
#include "a_dynlight.h" #include "a_dynlight.h"
#include "m_png.h" #include "m_png.h"

View file

@ -1046,6 +1046,7 @@ OptionMenu "HUDOptions" protected
Slider "$DSPLYMNU_MOVEBOB", "movebob", 0, 1.0, 0.05, 2 Slider "$DSPLYMNU_MOVEBOB", "movebob", 0, 1.0, 0.05, 2
Slider "$DSPLYMNU_STILLBOB", "stillbob", 0, 1.0, 0.05, 2 Slider "$DSPLYMNU_STILLBOB", "stillbob", 0, 1.0, 0.05, 2
Slider "$DSPLYMNU_BOBSPEED", "wbobspeed", 0, 2.0, 0.1 Slider "$DSPLYMNU_BOBSPEED", "wbobspeed", 0, 2.0, 0.1
Slider "$DSPLYMNU_BOBFIRE", "wbobfire", 0, 1.0, 0.1
StaticText " " StaticText " "
Slider "$DSPLYMNU_MENUDIM", "dimamount", 0, 1.0, 0.05, 2 Slider "$DSPLYMNU_MENUDIM", "dimamount", 0, 1.0, 0.05, 2
ColorPicker "$DSPLYMNU_DIMCOLOR", "dimcolor" ColorPicker "$DSPLYMNU_DIMCOLOR", "dimcolor"

View file

@ -2301,8 +2301,6 @@ class PlayerPawn : Actor
Vector2 p1, p2, r; Vector2 p1, p2, r;
Vector2 result; Vector2 result;
float bobtarget;
let player = self.player; let player = self.player;
if (!player) return (0, 0); if (!player) return (0, 0);
let weapon = player.ReadyWeapon; let weapon = player.ReadyWeapon;
@ -2326,17 +2324,16 @@ class PlayerPawn : Actor
// [RH] Smooth transitions between bobbing and not-bobbing frames. // [RH] Smooth transitions between bobbing and not-bobbing frames.
// This also fixes the bug where you can "stick" a weapon off-center by // This also fixes the bug where you can "stick" a weapon off-center by
// shooting it when it's at the peak of its swing. // shooting it when it's at the peak of its swing.
bobtarget = double((player.WeaponState & WF_WEAPONBOBBING) ? player.bob : 0.); if (curbob != player.bob)
if (curbob != bobtarget)
{ {
if (abs(bobtarget - curbob) <= 1) if (abs(player.bob - curbob) <= 1)
{ {
curbob = bobtarget; curbob = player.bob;
} }
else else
{ {
double zoom = MAX(1., abs(curbob - bobtarget) / 40); double zoom = MAX(1., abs(curbob - player.bob) / 40);
if (curbob > bobtarget) if (curbob > player.bob)
{ {
curbob -= zoom; curbob -= zoom;
} }
@ -2347,11 +2344,14 @@ class PlayerPawn : Actor
} }
} }
// The weapon bobbing intensity while firing can be adjusted by the player.
double BobIntensity = (player.WeaponState & WF_WEAPONBOBBING) ? 1. : player.GetWBobFire();
if (curbob != 0) if (curbob != 0)
{ {
//[SP] Added in decorate player.viewbob checks //[SP] Added in decorate player.viewbob checks
double bobx = (player.bob * Rangex * ViewBob); double bobx = (player.bob * BobIntensity * Rangex * ViewBob);
double boby = (player.bob * Rangey * ViewBob); double boby = (player.bob * BobIntensity * Rangey * ViewBob);
switch (bobstyle) switch (bobstyle)
{ {
case Bob_Normal: case Bob_Normal:
@ -2710,6 +2710,7 @@ struct PlayerInfo native play // self is what internally is known as player_t
native float GetAutoaim() const; native float GetAutoaim() const;
native bool GetNoAutostartMap() const; native bool GetNoAutostartMap() const;
native double GetWBobSpeed() const; native double GetWBobSpeed() const;
native double GetWBobFire() const;
native double GetMoveBob() const; native double GetMoveBob() const;
native double GetStillBob() const; native double GetStillBob() const;
native void SetFOV(float fov); native void SetFOV(float fov);