From bc2f56b6d1a281b1881315c69e58bcd6213e1908 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Wed, 10 Aug 2022 16:51:26 -0700 Subject: [PATCH] NSView: Don't run stair smoothing code when we're going up on elevators/platforms. Change some type names around for consistency. --- src/botlib/cvar.h | 4 ++-- src/client/NSView.h | 8 ++++---- src/client/NSView.qc | 8 ++++++-- src/gs-entbase/server/info_hint.qc | 14 +++++++------- src/platform/richpresence.qc | 2 +- src/shared/NSMonster.h | 26 +++++++++++++------------- src/shared/NSMonster.qc | 6 +++--- src/shared/NSSurfacePropEntity.qc | 2 +- src/shared/pmove.h | 2 +- src/xr/NSXRInput.h | 8 ++++---- src/xr/NSXRInput.qc | 4 ++-- 11 files changed, 44 insertions(+), 40 deletions(-) diff --git a/src/botlib/cvar.h b/src/botlib/cvar.h index 9b82310a..771acbb8 100644 --- a/src/botlib/cvar.h +++ b/src/botlib/cvar.h @@ -26,8 +26,8 @@ typedef enum BOTSKILL_EASY = 1, BOTSKILL_MEDIUM, BOTSKILL_HARD -} botskill_e; +} botskill_t; -var botskill_e autocvar_bot_skill = 2; +var botskill_t autocvar_bot_skill = 2; var string autocvar_bot_prefix = ""; diff --git a/src/client/NSView.h b/src/client/NSView.h index d2f8ebc4..e793fa6d 100644 --- a/src/client/NSView.h +++ b/src/client/NSView.h @@ -28,7 +28,7 @@ typedef enum VIEWMODE_FPS, /* uses view target position + view offset */ VIEWMODE_THIRDPERSON, /* third person view, fixed */ VIEWMODE_SPECTATING /* spectating, mixed viewmodes inside */ -} viewmode_e; +} viewmode_t; class NSView @@ -39,7 +39,7 @@ NSView vector m_vecPosition; vector m_vecSize; float m_flFieldOfView; - viewmode_e m_viewmode; + viewmode_t m_viewmode; vector m_vecLastOrigin; @@ -68,8 +68,8 @@ NSView virtual void(void) UpdateView; /* set/get */ - virtual void(viewmode_e) SetViewMode; - virtual viewmode_e(void) GetViewMode; + virtual void(viewmode_t) SetViewMode; + virtual viewmode_t(void) GetViewMode; virtual void(vector) SetViewPosition; virtual void(vector) SetViewSize; diff --git a/src/client/NSView.qc b/src/client/NSView.qc index 4baad343..93d76a7e 100644 --- a/src/client/NSView.qc +++ b/src/client/NSView.qc @@ -59,6 +59,10 @@ NSView::RenderView(void) void NSView::StairSmooth(void) { + /* don't run this on anything going up or down... */ + if (fabs(m_viewTarget.groundentity.velocity[2])) + return; + /* handle stair stepping */ if (GetViewMode() == VIEWMODE_FPS) { vector endpos = origin; @@ -134,12 +138,12 @@ NSView::SetClientAngle(vector new_angle) } void -NSView::SetViewMode(viewmode_e new_mode) +NSView::SetViewMode(viewmode_t new_mode) { m_viewmode = new_mode; } -viewmode_e +viewmode_t NSView::GetViewMode(void) { return m_viewmode; diff --git a/src/gs-entbase/server/info_hint.qc b/src/gs-entbase/server/info_hint.qc index af93f024..d8a7054c 100644 --- a/src/gs-entbase/server/info_hint.qc +++ b/src/gs-entbase/server/info_hint.qc @@ -118,14 +118,14 @@ typedef enum HINT_WORLD_BLINKING_LIGHT = 1001, HINT_WORLD_HUMAN_BLOOD = 1002, HINT_WORLD_ALIEN_BLOOD = 1003, -} hinttype_e; +} hinttype_t; typedef enum { IGNORE_NO, IGNORE_YES, IGNORE_DEFAULT -} ignorefacing_e; +} ignorefacing_t; /* TODO: Make this match NSMonster more */ typedef enum @@ -133,21 +133,21 @@ typedef enum AISTATE_IDLE, AISTATE_ALERT, AISTATE_COMBAT -} aistate_e; +} aistate_t; #define HINTSF_ALLOWJUMPUP 65536 class info_hint:NSPointTrigger { - hinttype_e m_hintType; + hinttype_t m_hintType; string m_strHintActivity; float m_flNodeFOV; bool m_bStartDisabled; string m_strHintGroup; - ignorefacing_e m_ignoreFacing; - aistate_e m_minState; - aistate_e m_maxState; + ignorefacing_t m_ignoreFacing; + aistate_t m_minState; + aistate_t m_maxState; void(void) info_hint; diff --git a/src/platform/richpresence.qc b/src/platform/richpresence.qc index 97992641..8e4fb856 100644 --- a/src/platform/richpresence.qc +++ b/src/platform/richpresence.qc @@ -22,7 +22,7 @@ typedef enum { RICHPRES_STATUS, RICHPRES_CONNECT -} richpresence_e; +} richpresence_t; string g_richpres[RICHPRESENCE_KEYS]; var bool g_richpresence_set = false; diff --git a/src/shared/NSMonster.h b/src/shared/NSMonster.h index 53505a95..ae5d2524 100644 --- a/src/shared/NSMonster.h +++ b/src/shared/NSMonster.h @@ -116,7 +116,7 @@ typedef enum { ACT_FLINCH_RIGHTARM, ACT_FLINCH_LEFTLEG, ACT_FLINCH_RIGHTLEG, -} monster_activity_e; +} monster_activity_t; /* monster flags, these are defined by the level designers */ typedef enumflags @@ -134,7 +134,7 @@ typedef enumflags MSF_MULTIPLAYER, MSF_FALLING, MSF_HORDE -} monsterFlag_e; +} monsterFlag_t; /* movement states */ typedef enum @@ -146,7 +146,7 @@ typedef enum MONSTER_AIMING, MONSTER_DEAD, MONSTER_GIBBED -} monsterState_e; +} monsterState_t; /* scripted sequence states */ typedef enum @@ -155,7 +155,7 @@ typedef enum SEQUENCESTATE_IDLE, SEQUENCESTATE_ACTIVE, SEQUENCESTATE_ENDING -} sequenceState_e; +} sequenceState_t; /* alliance state */ typedef enum @@ -164,14 +164,14 @@ typedef enum MAL_ENEMY, /* unfriendly towards the player */ MAL_ALIEN, /* unfriendly towards anyone but themselves */ MAL_ROGUE /* no allies, not even amongst themselves */ -} allianceState_e; +} allianceState_t; typedef enum { MOVESTATE_IDLE, MOVESTATE_WALK, MOVESTATE_RUN -} movementState_e; +} movementState_t; /* These numerations involve the m_iTriggerCondition attribute. * Basically these conditions are being checked and triggered depending on what @@ -191,7 +191,7 @@ typedef enum MTRIG_HEARWEAPONS, /* we hear weapons being fired */ MTRIG_SEEPLAYER, /* we see a player, don't have to be angry at him. */ MTRIG_SEEPLAYER_RELAXED, /* we see a player and we're currently attacking anything */ -} triggerCondition_e; +} triggerCondition_t; /* FIXME: I'd like to move this into NSMonster, but our current IsFriend() * check is currently only checking on a .takedamage basis. */ @@ -216,7 +216,7 @@ class NSMonster:NSNavAI float m_flSequenceSpeed; vector m_vecSequenceAngle; int m_iSequenceFlags; - movementState_e m_iMoveState; + movementState_t m_iMoveState; int m_iTriggerCondition; string m_strTriggerTarget; @@ -227,8 +227,8 @@ class NSMonster:NSNavAI /* attack/alliance system */ entity m_eEnemy; float m_flAttackThink; - monsterState_e m_iMState; - monsterState_e m_iOldMState; + monsterState_t m_iMState; + monsterState_t m_iOldMState; vector m_vecLKPos; /* last-known pos */ #endif @@ -299,9 +299,9 @@ class NSMonster:NSNavAI virtual bool(void) InAnimation; /* states */ - virtual void(monsterState_e, monsterState_e) StateChanged; - virtual void(monsterState_e) SetState; - virtual monsterState_e(void) GetState; + virtual void(monsterState_t, monsterState_t) StateChanged; + virtual void(monsterState_t) SetState; + virtual monsterState_t(void) GetState; /* TriggerTarget/Condition */ virtual int(void) GetTriggerCondition; diff --git a/src/shared/NSMonster.qc b/src/shared/NSMonster.qc index f05d206c..73b62f2f 100644 --- a/src/shared/NSMonster.qc +++ b/src/shared/NSMonster.qc @@ -628,14 +628,14 @@ NSMonster::IsAlive(void) } void -NSMonster::StateChanged(monsterState_e oldState, monsterState_e newState) +NSMonster::StateChanged(monsterState_t oldState, monsterState_t newState) { NSLog("^2%s::^3StateChanged^7: state changed from %d to %d", \ classname, oldState, newState); } void -NSMonster::SetState(monsterState_e newState) +NSMonster::SetState(monsterState_t newState) { if (newState == m_iMState) return; @@ -645,7 +645,7 @@ NSMonster::SetState(monsterState_e newState) StateChanged(m_iOldMState, m_iMState); } -monsterState_e +monsterState_t NSMonster::GetState(void) { return m_iMState; diff --git a/src/shared/NSSurfacePropEntity.qc b/src/shared/NSSurfacePropEntity.qc index 1f29fc10..af1cb74c 100644 --- a/src/shared/NSSurfacePropEntity.qc +++ b/src/shared/NSSurfacePropEntity.qc @@ -75,7 +75,7 @@ typedef enum NETFIELD_ANGLE, NETFIELD_ENTITY, NETFIELD_STRING -} nettype_e; +} nettype_t; typedef struct { diff --git a/src/shared/pmove.h b/src/shared/pmove.h index 51c90f02..9f7197a8 100644 --- a/src/shared/pmove.h +++ b/src/shared/pmove.h @@ -28,7 +28,7 @@ typedef enum WATERLEVEL_KNEE, WATERLEVEL_CHEST, WATERLEVEL_SUBMERGED -} waterlevel_e; +} waterlevel_t; #ifdef SERVER void PMove_StartFrame(void); diff --git a/src/xr/NSXRInput.h b/src/xr/NSXRInput.h index bdf41904..ed1b77fd 100644 --- a/src/xr/NSXRInput.h +++ b/src/xr/NSXRInput.h @@ -20,7 +20,7 @@ typedef enum XR_INPUT_HEAD, XR_INPUT_LEFT, XR_INPUT_RIGHT -} xrinput_e; +} xrinput_t; #define XR_STATUS_ORG (1u<<0) #define XR_STATUS_ANG (1u<<1) @@ -38,10 +38,10 @@ NSXRInput unsigned int m_iStatus; unsigned int m_iWeapon; - xrinput_e m_inputType; + xrinput_t m_inputType; void(void) NSXRInput; - virtual void(xrinput_e) SetType; + virtual void(xrinput_t) SetType; virtual void(NSXRSpace) SetParentSpace; virtual vector(void) GetOrigin; @@ -50,7 +50,7 @@ NSXRInput virtual vector(void) GetAngularVelocity; virtual unsigned int(void) GetStatus; virtual unsigned int(void) GetWeapon; - virtual xrinput_e (void) GetType; + virtual xrinput_t(void) GetType; virtual bool(void) IsAvailable; virtual void(void) InputFrame; diff --git a/src/xr/NSXRInput.qc b/src/xr/NSXRInput.qc index 50ab08a6..6dac630f 100644 --- a/src/xr/NSXRInput.qc +++ b/src/xr/NSXRInput.qc @@ -64,7 +64,7 @@ NSXRInput::GetWeapon(void) return m_iWeapon; } -xrinput_e +xrinput_t NSXRInput::GetType(void) { return m_inputType; @@ -126,7 +126,7 @@ NSXRInput::IsAvailable(void) } void -NSXRInput::SetType(xrinput_e type) +NSXRInput::SetType(xrinput_t type) { m_inputType = type; }