Permalink
Browse files

Fix func_rotating

  • Loading branch information...
s1lentq committed Jun 13, 2017
1 parent 969a4ab commit 1dc484980fd2d8dac564072ca20fbd7bff718f30
@@ -352,6 +352,58 @@ void CFuncRotating::__MAKE_VHOOK(Spawn)()
Precache();
}

#ifdef REGAMEDLL_FIXES
void CFuncRotating::Restart()
{
// fan is spinning, so stop it.
SetThink(&CFuncRotating::SpinDown);
pev->nextthink = pev->ltime + 0.1;

// restore angles
pev->angles = m_angles;
pev->avelocity = g_vecZero;

// some rotating objects like fake volumetric lights will not be solid.
if (pev->spawnflags & SF_ROTATING_NOT_SOLID)
{
pev->solid = SOLID_NOT;
pev->skin = CONTENTS_EMPTY;
pev->movetype = MOVETYPE_PUSH;
}
else
{
pev->solid = SOLID_BSP;
pev->movetype = MOVETYPE_PUSH;
}

UTIL_SetOrigin(pev, pev->origin);
SET_MODEL(ENT(pev), STRING(pev->model));

SetUse(&CFuncRotating::RotatingUse);

// did level designer forget to assign speed?
if (pev->speed <= 0)
{
pev->speed = 0;
}

// instant-use brush?
if (pev->spawnflags & SF_BRUSH_ROTATE_INSTANT)
{
SetThink(&CFuncRotating::SUB_CallUseToggle);

// leave a magic delay for client to start up
pev->nextthink = pev->ltime + 0.1;
}

// can this brush inflict pain?
if (pev->spawnflags & SF_BRUSH_HURT)
{
SetTouch(&CFuncRotating::HurtTouch);
}
}
#endif

void CFuncRotating::__MAKE_VHOOK(Precache)()
{
char *szSoundFile = (char *)STRING(pev->message);
@@ -554,19 +606,6 @@ void CFuncRotating::Rotate()
pev->nextthink = pev->ltime + 10;
}

#ifdef REGAMEDLL_FIXES
void CFuncRotating::Restart()
{
// fan is spinning, so stop it.
SetThink(&CFuncRotating::SpinDown);
pev->nextthink = pev->ltime + 0.1;

// restore angles
pev->angles = m_angles;
pev->avelocity = g_vecZero;
}
#endif

// Rotating Use - when a rotating brush is triggered
void CFuncRotating::RotatingUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
@@ -32,28 +32,41 @@
#pragma once
#endif

#define SF_PENDULUM_SWING 2 // spawnflag that makes a pendulum a rope swing.
// func_rotating
#define SF_BRUSH_ROTATE_Y_AXIS 0
#define SF_BRUSH_ROTATE_INSTANT 1
#define SF_BRUSH_ROTATE_BACKWARDS 2
#define SF_BRUSH_ROTATE_Z_AXIS 4
#define SF_BRUSH_ROTATE_X_AXIS 8

#define SF_BRUSH_ACCDCC 16 // brush should accelerate and decelerate when toggled
#define SF_BRUSH_HURT 32 // rotating brush that inflicts pain based on rotation speed
#define SF_ROTATING_NOT_SOLID 64 // some special rotating objects are not solid.
#define SF_BRUSH_ACCDCC 16 // brush should accelerate and decelerate when toggled
#define SF_BRUSH_HURT 32 // rotating brush that inflicts pain based on rotation speed

#define SF_WALL_START_OFF 0x0001
#define SF_ROTATING_NOT_SOLID 64 // some special rotating objects are not solid.

#define SF_CONVEYOR_VISUAL 0x0001
#define SF_CONVEYOR_NOTSOLID 0x0002
#define SF_BRUSH_ROTATE_SMALLRADIUS 128
#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256
#define SF_BRUSH_ROTATE_LARGERADIUS 512

#define SF_WORLD_DARK 0x0001 // Fade from black at startup
#define SF_WORLD_TITLE 0x0002 // Display game title at startup
#define SF_WORLD_FORCETEAM 0x0004 // Force teams
#define FANPITCHMIN 30
#define FANPITCHMAX 100

#define FANPITCHMIN 30
#define FANPITCHMAX 100
// func_pendulum
#define SF_PENDULUM_SWING 2 // spawnflag that makes a pendulum a rope swing.
#define SF_PENDULUM_AUTO_RETURN 16
#define SF_PENDULUM_PASSABLE 32

// func_wall_toggle
#define SF_WALL_START_OFF 0x0001

// func_conveyor
#define SF_CONVEYOR_VISUAL 0x0001
#define SF_CONVEYOR_NOTSOLID 0x0002

// covering cheesy noise1, noise2, & noise3 fields so they make more sense (for rotating fans)
#define noiseStart noise1
#define noiseStop noise2
#define noiseRunning noise3
#define noiseStart noise1
#define noiseStop noise2
#define noiseRunning noise3

// This is just a solid wall if not inhibited
class CFuncWall: public CBaseEntity
@@ -680,6 +680,10 @@ class CBaseButton: public CBaseToggle {
int m_sounds;
};

#define SF_WORLD_DARK 0x0001 // Fade from black at startup
#define SF_WORLD_TITLE 0x0002 // Display game title at startup
#define SF_WORLD_FORCETEAM 0x0004 // Force teams

// This spawns first when each level begins.
class CWorld: public CBaseEntity {
public:
@@ -35,8 +35,12 @@
#define GRENADETYPE_SMOKE 1
#define GRENADETYPE_FLASH 2

#define SPAWNFLAG_NOMESSAGE 1
#define SPAWNFLAG_NOTOUCH 1

This comment has been minimized.

@Mistrick
#define SPAWNFLAG_DROIDONLY 4

#define MAX_ITEM_COUNTS 32
#define MAX_ENTITY 512 // We can only ever move 512 entities across a transition
#define MAX_ENTITY 512 // We can only ever move 512 entities across a transition

// triggers
#define SF_TRIGGER_ALLOWMONSTERS 1 // monsters allowed to fire this trigger
@@ -531,10 +535,6 @@ class CTriggerPush: public CBaseTrigger

#endif

#ifdef REGAMEDLL_FIXES
private:
Vector m_vecAngles;
#endif
};

class CTriggerTeleport: public CBaseTrigger
@@ -115,23 +115,6 @@ extern globalvars_t *gpGlobals;
#define SVC_ROOMTYPE 37
#define SVC_DIRECTOR 51

// func_rotating
#define SF_BRUSH_ROTATE_Y_AXIS 0
#define SF_BRUSH_ROTATE_INSTANT 1
#define SF_BRUSH_ROTATE_BACKWARDS 2
#define SF_BRUSH_ROTATE_Z_AXIS 4
#define SF_BRUSH_ROTATE_X_AXIS 8
#define SF_PENDULUM_AUTO_RETURN 16
#define SF_PENDULUM_PASSABLE 32

#define SF_BRUSH_ROTATE_SMALLRADIUS 128
#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256
#define SF_BRUSH_ROTATE_LARGERADIUS 512

#define SPAWNFLAG_NOMESSAGE 1
#define SPAWNFLAG_NOTOUCH 1
#define SPAWNFLAG_DROIDONLY 4

#define VEC_HULL_MIN_Z Vector(0, 0, -36)
#define VEC_DUCK_HULL_MIN_Z Vector(0, 0, -18)

@@ -27,23 +27,36 @@
*/
#pragma once

#define SF_PENDULUM_SWING 2 // spawnflag that makes a pendulum a rope swing.
// func_rotating
#define SF_BRUSH_ROTATE_Y_AXIS 0
#define SF_BRUSH_ROTATE_INSTANT 1
#define SF_BRUSH_ROTATE_BACKWARDS 2
#define SF_BRUSH_ROTATE_Z_AXIS 4
#define SF_BRUSH_ROTATE_X_AXIS 8

#define SF_BRUSH_ACCDCC 16 // brush should accelerate and decelerate when toggled
#define SF_BRUSH_HURT 32 // rotating brush that inflicts pain based on rotation speed
#define SF_ROTATING_NOT_SOLID 64 // some special rotating objects are not solid.
#define SF_BRUSH_ACCDCC 16 // brush should accelerate and decelerate when toggled
#define SF_BRUSH_HURT 32 // rotating brush that inflicts pain based on rotation speed

#define SF_WALL_START_OFF 0x0001
#define SF_ROTATING_NOT_SOLID 64 // some special rotating objects are not solid.

#define SF_CONVEYOR_VISUAL 0x0001
#define SF_CONVEYOR_NOTSOLID 0x0002
#define SF_BRUSH_ROTATE_SMALLRADIUS 128
#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256
#define SF_BRUSH_ROTATE_LARGERADIUS 512

#define SF_WORLD_DARK 0x0001 // Fade from black at startup
#define SF_WORLD_TITLE 0x0002 // Display game title at startup
#define SF_WORLD_FORCETEAM 0x0004 // Force teams
#define FANPITCHMIN 30
#define FANPITCHMAX 100

#define FANPITCHMIN 30
#define FANPITCHMAX 100
// func_pendulum
#define SF_PENDULUM_SWING 2 // spawnflag that makes a pendulum a rope swing.
#define SF_PENDULUM_AUTO_RETURN 16
#define SF_PENDULUM_PASSABLE 32

// func_wall_toggle
#define SF_WALL_START_OFF 0x0001

// func_conveyor
#define SF_CONVEYOR_VISUAL 0x0001
#define SF_CONVEYOR_NOTSOLID 0x0002

// This is just a solid wall if not inhibited
class CFuncWall: public CBaseEntity {
@@ -315,6 +315,10 @@ class CMultiSource: public CPointEntity {
string_t m_globalstate;
};

#define SF_WORLD_DARK 0x0001 // Fade from black at startup
#define SF_WORLD_TITLE 0x0002 // Display game title at startup
#define SF_WORLD_FORCETEAM 0x0004 // Force teams

// This spawns first when each level begins.
class CWorld: public CBaseEntity {
public:
@@ -30,8 +30,12 @@
#define GRENADETYPE_SMOKE 1
#define GRENADETYPE_FLASH 2

#define SPAWNFLAG_NOMESSAGE 1
#define SPAWNFLAG_NOTOUCH 1
#define SPAWNFLAG_DROIDONLY 4

#define MAX_ITEM_COUNTS 32
#define MAX_ENTITY 512 // We can only ever move 512 entities across a transition
#define MAX_ENTITY 512 // We can only ever move 512 entities across a transition

// triggers
#define SF_TRIGGER_ALLOWMONSTERS 1 // monsters allowed to fire this trigger
@@ -79,23 +79,6 @@ extern globalvars_t *gpGlobals;
#define SVC_ROOMTYPE 37
#define SVC_DIRECTOR 51

// func_rotating
#define SF_BRUSH_ROTATE_Y_AXIS 0
#define SF_BRUSH_ROTATE_INSTANT 1
#define SF_BRUSH_ROTATE_BACKWARDS 2
#define SF_BRUSH_ROTATE_Z_AXIS 4
#define SF_BRUSH_ROTATE_X_AXIS 8
#define SF_PENDULUM_AUTO_RETURN 16
#define SF_PENDULUM_PASSABLE 32

#define SF_BRUSH_ROTATE_SMALLRADIUS 128
#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256
#define SF_BRUSH_ROTATE_LARGERADIUS 512

#define SPAWNFLAG_NOMESSAGE 1
#define SPAWNFLAG_NOTOUCH 1
#define SPAWNFLAG_DROIDONLY 4

#define VEC_HULL_MIN_Z Vector(0, 0, -36)
#define VEC_DUCK_HULL_MIN_Z Vector(0, 0, -18)

0 comments on commit 1dc4849

Please sign in to comment.