SVN r114 (trunk)

This commit is contained in:
Christoph Oelckers 2006-05-14 14:30:13 +00:00
parent b97c417101
commit caed57baa5
38 changed files with 372 additions and 393 deletions

View file

@ -1,3 +1,14 @@
May 14, 2006 (Changes by Graf Zahl)
- Added an AltFlash state for weapons.
- Turned FloatSpeed into an actor property and changed the value to 5
for all floating Strife actors, as a comment in the source indicated.
- Added GZDoom's code for Vavoom slope things because I wanted to test
something with a map from Silent Steel.
- Added nocrouch and allowcrouch MAPINFO commands and a DF_NO_CROUCH
dmflag.
- Added GZDoom's crouching code after cleaning it up so that adding
crouching sprites will be easier.
May 13, 2006 (Changes by Graf Zahl)
- Fixed: P_StartScript was missing a NULL pointer check for the error
message. When trying to puke a script outside a map it crashed.

View file

@ -681,6 +681,7 @@ public:
WORD UseSound; // [RH] Sound to play when an actor is used.
fixed_t Speed;
fixed_t FloatSpeed;
fixed_t MaxDropOffHeight, MaxStepHeight;
SDWORD Mass;
SWORD PainChance;

View file

@ -115,7 +115,7 @@ FButtonStatus Button_Mlook, Button_Klook, Button_Use, Button_AltAttack,
Button_Attack, Button_Speed, Button_MoveRight, Button_MoveLeft,
Button_Strafe, Button_LookDown, Button_LookUp, Button_Back,
Button_Forward, Button_Right, Button_Left, Button_MoveDown,
Button_MoveUp, Button_Jump, Button_ShowScores;
Button_MoveUp, Button_Jump, Button_ShowScores, Button_Crouch;
// To add new actions, go to the console and type "key <action name>".
// This will give you the key value to use in the first column. Then
@ -132,6 +132,7 @@ FActionMap ActionMaps[] =
{ 0x47c02d3b, &Button_Attack, "attack" },
{ 0x6dcec137, &Button_Back, "back" },
{ 0x7a67e768, &Button_Left, "left" },
{ 0x8076f318, &Button_Crouch, "crouch" },
{ 0x84b8789a, &Button_MoveLeft, "moveleft" },
{ 0x8fd9bf1e, &Button_ShowScores, "showscores" },
{ 0x94b1cc4b, &Button_Use, "use" },
@ -1280,3 +1281,4 @@ CCMD (pullin)
}
}
}

View file

@ -145,7 +145,7 @@ extern FButtonStatus Button_Mlook, Button_Klook, Button_Use, Button_AltAttack,
Button_Attack, Button_Speed, Button_MoveRight, Button_MoveLeft,
Button_Strafe, Button_LookDown, Button_LookUp, Button_Back,
Button_Forward, Button_Right, Button_Left, Button_MoveDown,
Button_MoveUp, Button_Jump, Button_ShowScores;
Button_MoveUp, Button_Jump, Button_ShowScores, Button_Crouch;
extern bool ParsingKeyConf;
void ResetButtonTriggers (); // Call ResetTriggers for all buttons

View file

@ -337,3 +337,41 @@ char *myasctime ()
return "Pre Jan 01 00:00:00 1970\n";
}
}
/************************************************************************/
/* CreatePath: creates a directory including all levels necessary */
/* */
/************************************************************************/
void DoCreatePath(const char * fn)
{
#ifdef _WIN32
char drive[_MAX_DRIVE];
#endif
char path[PATH_MAX];
char p[PATH_MAX];
int i;
#ifdef _WIN32
_splitpath(fn,drive,path,NULL,NULL);
_makepath(p,drive,path,NULL,NULL);
i=(int)strlen(p);
if (p[i-1]=='/' || p[i-1]=='\\') p[i-1]=0;
if (*path) DoCreatePath(p);
CreateDirectory(p,NULL);
#else
// FIXME: write me
#endif
}
void CreatePath(const char * fn)
{
char name[PATH_MAX];
char c = fn[strlen(fn)-1];
if (c!='\\' && c!='/')
{
sprintf(name, "%s/", fn);
DoCreatePath(name);
}
else DoCreatePath(fn);
}

View file

@ -51,4 +51,6 @@ void FormatGUID (char *text, const GUID &guid);
char *myasctime ();
void CreatePath(const char * fn);
#endif

View file

@ -84,7 +84,7 @@
#include "sbar.h"
#include "decallib.h"
#include "r_polymost.h"
#include "version.h"
#include "v_text.h"
// MACROS ------------------------------------------------------------------
@ -349,6 +349,7 @@ CVAR (Flag, sv_nofreelook, dmflags, DF_NO_FREELOOK);
CVAR (Flag, sv_respawnsuper, dmflags, DF_RESPAWN_SUPER);
CVAR (Flag, sv_nofov, dmflags, DF_NO_FOV);
CVAR (Flag, sv_noweaponspawn, dmflags, DF_NO_COOP_WEAPON_SPAWN);
CVAR (Flag, sv_nocrouch, dmflags, DF_NO_CROUCH);
//==========================================================================
//

View file

@ -2254,6 +2254,14 @@ void Net_DoCommand (int type, byte **stream, int player)
}
break;
case DEM_CROUCH:
if (gamestate == GS_LEVEL && players[player].mo != NULL)
{
players[player].crouching = players[player].crouchdir<0? 1 : -1;
}
break;
default:
I_Error ("Unknown net command: %d", type);
break;

View file

@ -53,6 +53,7 @@ class APlayerPawn : public AActor
public:
virtual void Serialize (FArchive &arc);
virtual void Tick();
virtual void AddInventory (AInventory *item);
virtual void RemoveInventory (AInventory *item);
virtual bool UseInventory (AInventory *item);
@ -278,10 +279,24 @@ public:
FString LogText; // [RH] Log for Strife
signed char crouching;
signed char crouchdir;
fixed_t crouchfactor;
fixed_t crouchoffset;
fixed_t crouchviewdelta;
fixed_t GetDeltaViewHeight() const
{
return (defaultviewheight - viewheight) >> 3;
return (defaultviewheight + crouchviewdelta - viewheight) >> 3;
}
void Uncrouch()
{
crouchfactor = FRACUNIT;
crouchoffset = 0;
crouchdir = 0;
crouching = 0;
crouchviewdelta = 0;
}
};
@ -295,6 +310,7 @@ inline FArchive &operator<< (FArchive &arc, player_s *&p)
return arc.SerializePointer (players, (BYTE **)&p, sizeof(*players));
}
#define CROUCHSPEED (FRACUNIT/12)
#define MAX_DN_ANGLE 56 // Max looking down angle
#define MAX_UP_ANGLE 32 // Max looking up angle

View file

@ -137,6 +137,7 @@ enum EDemoCommand
DEM_CENTERVIEW, // 36
DEM_SUMMONFRIEND, // 37 String: Thing to fabricate
DEM_SPRAY, // 38 String: The decal to spray
DEM_CROUCH, // 39
};
// The following are implemented by cht_DoCheat in m_cheat.cpp

View file

@ -220,6 +220,7 @@ enum
DF_RESPAWN_SUPER = 1 << 18, // Respawn invulnerability and invisibility
DF_NO_FOV = 1 << 19, // Only let the arbitrator set FOV (for all players)
DF_NO_COOP_WEAPON_SPAWN = 1 << 20, // Don't spawn multiplayer weapons in coop games
DF_NO_CROUCH = 1 << 21, // Don't allow crouching
};
// [BC] More dmflags. w00p!

View file

@ -274,6 +274,11 @@ CCMD (centerview)
Net_WriteByte (DEM_CENTERVIEW);
}
CCMD(crouch)
{
Net_WriteByte(DEM_CROUCH);
}
CCMD (land)
{
SendLand = true;
@ -534,6 +539,9 @@ void G_BuildTiccmd (ticcmd_t *cmd)
if (Button_Jump.bDown)
cmd->ucmd.buttons |= BT_JUMP;
if (Button_Crouch.bDown)
cmd->ucmd.buttons |= BT_DUCK;
// [RH] Scale joystick moves to full range of allowed speeds
if (JoyAxes[JOYAXIS_PITCH] != 0)
{

View file

@ -243,7 +243,7 @@ bool AArtiPoisonBag3::Use (bool pickup)
AActor *mo;
mo = Spawn<AThrowingBomb> (Owner->x, Owner->y,
Owner->z-Owner->floorclip+35*FRACUNIT);
Owner->z-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0));
if (mo)
{
angle_t pitch = (angle_t)Owner->pitch >> ANGLETOFINESHIFT;

View file

@ -243,6 +243,8 @@ static const char *MapInfoMapLevel[] =
"soundinfo",
"clipmidtextures",
"wrapmidtextures",
"allowcrouch",
"nocrouch",
NULL
};
@ -356,6 +358,8 @@ MapHandlers[] =
{ MITYPE_LUMPNAME, lioffset(soundinfo), 0 },
{ MITYPE_SETFLAG, LEVEL_CLIPMIDTEX, 0 },
{ MITYPE_SETFLAG, LEVEL_WRAPMIDTEX, 0 },
{ MITYPE_SCFLAGS, LEVEL_CROUCH_YES, ~LEVEL_CROUCH_NO },
{ MITYPE_SCFLAGS, LEVEL_CROUCH_NO, ~LEVEL_CROUCH_YES },
};
static const char *MapInfoClusterLevel[] =
@ -1510,6 +1514,12 @@ static void goOn (int position, bool keepFacing, bool secret)
NoWipe = 4;
D_DrawIcon = "TELEICON";
}
// un-crouch all players here
for(int i=0;i<MAXPLAYERS;i++)
{
players[i].Uncrouch();
}
}
void G_ExitLevel (int position, bool keepFacing)
@ -2124,6 +2134,10 @@ void G_InitLevelLocals ()
clear = DF_NO_JUMP;
if (level.flags & LEVEL_JUMP_NO)
set = DF_NO_JUMP;
if (level.flags & LEVEL_CROUCH_YES)
clear = DF_NO_CROUCH;
if (level.flags & LEVEL_CROUCH_NO)
set = DF_NO_CROUCH;
if (level.flags & LEVEL_FREELOOK_YES)
clear |= DF_NO_FREELOOK;
if (level.flags & LEVEL_FREELOOK_NO)

View file

@ -103,6 +103,9 @@
#define LEVEL_CLIPMIDTEX UCONST64(0x20000000000)
#define LEVEL_WRAPMIDTEX UCONST64(0x40000000000)
#define LEVEL_CROUCH_NO UCONST64(0x80000000000)
#define LEVEL_CROUCH_YES UCONST64(0x100000000000)
struct acsdefered_s;
class FBehavior;

View file

@ -208,7 +208,7 @@ public:
FState *ReadyState;
FState *AtkState, *HoldAtkState;
FState *AltAtkState, *AltHoldAtkState;
FState *FlashState;
FState *FlashState, *AltFlashState;
// In-inventory instance variables
AAmmo *Ammo1, *Ammo2;

View file

@ -1,361 +0,0 @@
#ifndef __A_PICKUPS_H__
#define __A_PICKUPS_H__
#include "dobject.h"
#include "actor.h"
#include "info.h"
#define STREAM_ENUM(e) \
inline FArchive &operator<< (FArchive &arc, e &i) \
{ \
BYTE val = (BYTE)i; \
arc << val; \
i = (e)val; \
return arc; \
} \
// Ammunition types defined.
typedef enum
{
// Doom ammo
am_clip, // Pistol / chaingun ammo.
am_shell, // Shotgun / double barreled shotgun.
am_cell, // Plasma rifle, BFG.
am_misl, // Missile launcher.
// Heretic ammo
am_goldwand,
am_crossbow,
am_blaster,
am_skullrod,
am_phoenixrod,
am_mace,
// Hexen ammo
MANA_1,
MANA_2,
// Strife ammo
// am_clip
am_electricbolt,
am_poisonbolt,
// am_cell
// am_misl
am_hegrenade,
am_phgrenade,
NUMAMMO,
MANA_BOTH,
am_noammo, // Unlimited for chainsaw / fist.
MANA_NONE = am_noammo,
SAVEVER217_NUMAMMO = MANA_2+1
} ammotype_t;
STREAM_ENUM (ammotype_t)
#define MAX_MANA 200
extern const char *AmmoPics[MANA_BOTH+1];
typedef enum
{
ARMOR_ARMOR = 0,
ARMOR_SHIELD,
ARMOR_HELMET,
ARMOR_AMULET,
NUMARMOR
} armortype_t;
extern const char *ArmorPics[NUMARMOR];
STREAM_ENUM (armortype_t)
// LUT of ammunition limits for each kind.
// This doubles with BackPack powerup item.
extern int maxammo[NUMAMMO];
// The defined weapons,
// including a marker indicating
// user has not changed weapon.
typedef enum
{
// Doom weapons
wp_fist,
wp_pistol,
wp_shotgun,
wp_chaingun,
wp_missile,
wp_plasma,
wp_bfg,
wp_chainsaw,
wp_supershotgun,
// Heretic weapons
wp_staff,
wp_goldwand,
wp_crossbow,
wp_blaster,
wp_skullrod,
wp_phoenixrod,
wp_mace,
wp_gauntlets,
wp_beak,
// Hexen weapons
wp_snout,
wp_ffist,
wp_cmace,
wp_mwand,
wp_faxe,
wp_cstaff,
wp_mfrost,
wp_fhammer,
wp_cfire,
wp_mlightning,
wp_fsword,
wp_choly,
wp_mstaff,
// Strife weapons
wp_dagger,
wp_electricxbow,
wp_assaultgun,
wp_minimissile,
wp_hegrenadelauncher,
wp_flamethrower,
wp_maulerscatter,
wp_sigil,
wp_poisonxbow,
wp_phgrenadelauncher,
wp_maulertorpedo,
NUMWEAPONS,
wp_nochange, // No pending weapon change.
SAVEVER217_NUMWEAPONS = wp_mstaff+1
} weapontype_t;
STREAM_ENUM (weapontype_t)
// Weapon info: sprite frames, ammunition use.
struct FWeaponInfo
{
DWORD flags;
ammotype_t ammo;
ammotype_t givingammo;
int ammouse;
int ammogive;
FState *upstate;
FState *downstate;
FState *readystate;
FState *atkstate;
FState *holdatkstate;
FState *flashstate;
const TypeInfo *droptype;
int kickback;
fixed_t yadjust;
const char *upsound;
const char *readysound;
TypeInfo *type; // type of actor that represents this weapon
int minammo; // minimum ammo needed to switch to this weapon
int GetMinAmmo () const
{
return (minammo < 0) ? ammouse : minammo;
}
};
enum
{
WIF_NOAUTOFIRE = 0x00000001, // weapon does not autofire
WIF_READYSNDHALF = 0x00000002, // ready sound is played ~1/2 the time
WIF_DONTBOB = 0x00000004, // don't bob the weapon
WIF_AXEBLOOD = 0x00000008, // weapon makes axe blood on impact (Hexen only)
WIF_FIREDAMAGE = 0x00000010, // weapon does fire damage on impact
WIF_NOALERT = 0x00000020, // weapon does not alert monsters
WIF_AMMO_OPTIONAL = 0x00000040, // weapon can use ammo but does not require it
};
#define MAX_WEAPONS_PER_SLOT 8
#define NUM_WEAPON_SLOTS 10
class player_s;
class FConfigFile;
class FWeaponSlot
{
public:
FWeaponSlot ();
void Clear ();
bool AddWeapon (const char *type);
bool AddWeapon (const TypeInfo *type);
bool AddWeapon (weapontype_t weap);
weapontype_t PickWeapon (player_s *player);
int CountWeapons ();
void StreamOut ();
void StreamIn (byte **stream);
inline weapontype_t GetWeapon (int index) const
{
return (weapontype_t)Weapons[index];
}
friend weapontype_t PickNextWeapon (player_s *player);
friend weapontype_t PickPrevWeapon (player_s *player);
friend struct FWeaponSlots;
private:
byte Weapons[MAX_WEAPONS_PER_SLOT];
};
// FWeaponSlots::AddDefaultWeapon return codes
enum ESlotDef
{
SLOTDEF_Exists, // Weapon was already assigned a slot
SLOTDEF_Added, // Weapon was successfully added
SLOTDEF_Full // The specifed slot was full
};
struct FWeaponSlots
{
FWeaponSlot Slots[NUM_WEAPON_SLOTS];
void Clear ();
bool LocateWeapon (weapontype_t weap, int *const slot, int *const index);
ESlotDef AddDefaultWeapon (int slot, const char *weapName, weapontype_t weap);
void RestoreSlots (FConfigFile &config);
void SaveSlots (FConfigFile &config);
void StreamOutSlots ();
void StreamInSlots (byte **stream);
};
extern FWeaponSlots LocalWeapons;
extern FWeaponInfo *wpnlev1info[NUMWEAPONS], *wpnlev2info[NUMWEAPONS];
//
// Keys
//
typedef enum
{
// Heretic keys
key_blue = 0,
key_yellow,
key_green,
// Doom keys
it_bluecard = 0,
it_yellowcard,
it_redcard,
it_blueskull,
it_yellowskull,
it_redskull,
// Hexen keys
KEY_STEEL = 0,
KEY_CAVE,
KEY_AXE,
KEY_FIRE,
KEY_EMERALD,
KEY_DUNGEON,
KEY_SILVER,
KEY_RUSTED,
KEY_HORN,
KEY_SWAMP,
KEY_CASTLE,
NUMKEYS
} keytype_t;
STREAM_ENUM (keytype_t)
/************************************************************************/
/* Class definitions */
/************************************************************************/
// A pickup is anything the player can pickup (i.e. weapons, ammo,
// powerups, etc)
class AInventory : public AActor
{
DECLARE_ACTOR (AInventory, AActor)
public:
virtual void Touch (AActor *toucher);
virtual void BeginPlay ();
virtual bool ShouldRespawn ();
virtual bool ShouldStay ();
virtual void Hide ();
virtual bool DoRespawn ();
virtual bool TryPickup (AActor *toucher);
virtual void DoPickupSpecial (AActor *toucher);
virtual const char *PickupMessage ();
virtual void PlayPickupSound (AActor *toucher);
private:
static int StaticLastMessageTic;
static const char *StaticLastMessage;
};
// A weapon is just that.
class AWeapon : public AInventory
{
DECLARE_ACTOR (AWeapon, AInventory)
public:
virtual bool TryPickup (AActor *toucher);
virtual weapontype_t OldStyleID() const;
protected:
virtual void PlayPickupSound (AActor *toucher);
virtual bool ShouldStay ();
};
#define S_LIGHTDONE 0
// Health is some item that gives the player health when picked up.
class AHealth : public AInventory
{
DECLARE_CLASS (AHealth, AInventory)
protected:
AHealth () {}
virtual void PlayPickupSound (AActor *toucher);
};
// Armor gives the player armor when picked up.
class AArmor : public AInventory
{
DECLARE_CLASS (AArmor, AInventory)
protected:
AArmor () {}
virtual void PlayPickupSound (AActor *toucher);
};
class AAmmo : public AInventory
{
DECLARE_CLASS (AAmmo, AInventory)
public:
virtual ammotype_t GetAmmoType () const;
protected:
AAmmo () {}
virtual void PlayPickupSound (AActor *toucher);
};
// A key is something the player can use to unlock something
class AKey : public AInventory
{
DECLARE_CLASS (AKey, AInventory)
public:
virtual bool TryPickup (AActor *toucher);
protected:
virtual bool ShouldStay ();
virtual void PlayPickupSound (AActor *toucher);
virtual keytype_t GetKeyType ();
AKey () {}
};
#undef STREAM_ENUM
#endif //__A_PICKUPS_H__

View file

@ -55,7 +55,7 @@ void AWeapon::Serialize (FArchive &arc)
<< UpState << DownState << ReadyState
<< AtkState << HoldAtkState
<< AltAtkState << AltHoldAtkState
<< FlashState
<< FlashState << AltFlashState
<< Ammo1 << Ammo2 << SisterWeapon
<< bAltFire;
}

View file

@ -111,6 +111,7 @@ IMPLEMENT_ACTOR (AAlienSpectre1, Strife, 129, 0)
PROP_SpeedFixed (12)
PROP_RadiusFixed (64)
PROP_HeightFixed (64)
PROP_FloatSpeed (5)
PROP_Mass (1000)
PROP_Flags (MF_SPECIAL|MF_SOLID|MF_SHOOTABLE|MF_NOGRAVITY|
MF_FLOAT|MF_SHADOW|MF_COUNTKILL|MF_NOTDMATCH|MF_STRIFEx8000000)

View file

@ -149,6 +149,7 @@ IMPLEMENT_ACTOR (AEntityBoss, Strife, 128, 0)
PROP_SpeedFixed (13)
PROP_RadiusFixed (130)
PROP_HeightFixed (200)
PROP_FloatSpeed (5)
PROP_Mass (1000)
PROP_Flags (MF_SPECIAL|MF_SOLID|MF_SHOOTABLE|MF_NOGRAVITY|
MF_FLOAT|MF_SHADOW|MF_COUNTKILL|MF_NOTDMATCH|
@ -252,6 +253,7 @@ IMPLEMENT_ACTOR (AEntitySecond, Strife, -1, 0)
PROP_SpeedFixed (14)
PROP_RadiusFixed (130)
PROP_HeightFixed (200)
PROP_FloatSpeed (5)
PROP_Mass (1000)
PROP_Flags (MF_SPECIAL|MF_SOLID|MF_SHOOTABLE|MF_NOGRAVITY|
MF_FLOAT|MF_SHADOW|MF_COUNTKILL|MF_NOTDMATCH|

View file

@ -87,6 +87,7 @@ IMPLEMENT_ACTOR (ALoremaster, Strife, 12, 0)
PROP_SpeedFixed (10)
PROP_RadiusFixed (15)
PROP_HeightFixed (56)
PROP_FloatSpeed (5)
PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_NOGRAVITY|MF_FLOAT|
MF_NOBLOOD|MF_COUNTKILL|MF_NOTDMATCH)
PROP_Flags2 (MF2_FLOORCLIP|MF2_PASSMOBJ|MF2_PUSHWALL|MF2_MCROSS)

View file

@ -87,6 +87,7 @@ IMPLEMENT_ACTOR (AProgrammer, Strife, 71, 0)
PROP_MissileState (S_PROG_MISSILE)
PROP_DeathState (S_PROG_DIE)
PROP_SpeedFixed (26)
PROP_FloatSpeed (5)
PROP_RadiusFixed (45)
PROP_HeightFixed (60)
PROP_Mass (800)

View file

@ -102,7 +102,7 @@ FGameConfigFile::FGameConfigFile ()
SetValueForKey ("Path", "$HOME", true);
SetValueForKey ("Path", "$PROGDIR", true);
#else
SetValueForKey ("Path", "~/.zdoom", true);
SetValueForKey ("Path", HOME_DIR, true);
SetValueForKey ("Path", SHARE_DIR, true);
#endif
}

View file

@ -281,6 +281,7 @@ enum
ADEF_MaxStepHeight,
ADEF_BounceFactor,
ADEF_BounceCount,
ADEF_FloatSpeed,
ADEF_SpawnState,
ADEF_SeeState,

View file

@ -185,6 +185,7 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint)
case ADEF_ReactionTime: actor->reactiontime = dataint; break;
case ADEF_PainChance: actor->PainChance = dataint; break;
case ADEF_Speed: actor->Speed = dataint; break;
case ADEF_FloatSpeed: actor->FloatSpeed = dataint; break;
case ADEF_Radius: actor->radius = dataint; break;
case ADEF_Height: actor->height = dataint; break;
case ADEF_Mass: actor->Mass = dataint; break;

View file

@ -217,6 +217,7 @@ public:
#define PROP_MaxPainChance ADD_WORD_PROP(ADEF_PainChance,256)
#define PROP_SpeedFixed(x) ADD_FIXD_PROP(ADEF_Speed,x)
#define PROP_SpeedLong(x) ADD_LONG_PROP(ADEF_Speed,x)
#define PROP_FloatSpeed(x) ADD_FIXD_PROP(ADEF_FloatSpeed,x)
#define PROP_Radius(x) ADD_LONG_PROP(ADEF_Radius,x)
#define PROP_RadiusFixed(x) ADD_FIXD_PROP(ADEF_Radius,x)
#define PROP_Height(x) ADD_LONG_PROP(ADEF_Height,x)

View file

@ -576,6 +576,7 @@ void M_ScreenShot (char *filename)
autoname = filename;
DefaultExtension (autoname, writepcx ? ".pcx" : ".png");
}
CreatePath(screenshot_dir);
// save the screenshot
screen->Lock (true);

View file

@ -376,6 +376,8 @@ static menuitem_t ControlsItems[] =
{ control, "Turn left", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)"+left"} },
{ control, "Turn right", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)"+right"} },
{ control, "Jump", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)"+jump"} },
{ control, "Crouch", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)"+crouch"} },
{ control, "Crouch Toggle", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)"crouch"} },
{ control, "Fly / Swim up", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)"+moveup"} },
{ control, "Fly / Swim down", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)"+movedown"} },
{ control, "Stop flying", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)"land"} },
@ -476,7 +478,7 @@ static value_t ColumnMethods[] = {
static value_t BloodTypes[] = {
{ 0.0, "Sprites" },
{ 1.0, "Sprites and Particles" },
{ 1.0, "Sprites & Particles" },
{ 2.0, "Particles" }
};
@ -934,6 +936,7 @@ static menuitem_t DMFlagsItems[] = {
{ bitflag, "Mega powerups respawn",{&dmflags}, {0}, {0}, {0}, {(value_t *)DF_RESPAWN_SUPER} },
{ bitflag, "Fast monsters", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_FAST_MONSTERS} },
{ bitflag, "Allow jump", {&dmflags}, {1}, {0}, {0}, {(value_t *)DF_NO_JUMP} },
{ bitflag, "Allow crouch", {&dmflags}, {1}, {0}, {0}, {(value_t *)DF_NO_CROUCH} },
{ bitflag, "Allow freelook", {&dmflags}, {1}, {0}, {0}, {(value_t *)DF_NO_FREELOOK} },
{ bitflag, "Allow FOV", {&dmflags}, {1}, {0}, {0}, {(value_t *)DF_NO_FOV} },
{ bitflag, "Allow BFG aiming", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_NO_FREEAIMBFG} },

View file

@ -479,9 +479,9 @@ BOOL P_Move (AActor *actor)
fixed_t savedz = actor->z;
if (actor->z < tmfloorz)
actor->z += FLOATSPEED;
actor->z += actor->FloatSpeed;
else
actor->z -= FLOATSPEED;
actor->z -= actor->FloatSpeed;
// [RH] Check to make sure there's nothing in the way of the float
if (P_TestMobjZ (actor))

View file

@ -29,8 +29,6 @@
#include <stdlib.h>
#define FLOATSPEED (FRACUNIT*4)
#define STEEPSLOPE 46341 // [RH] Minimum floorplane.c value for walking
#define MAXMORPHHEALTH 30

View file

@ -1496,9 +1496,9 @@ void P_FakeZMovement (AActor *mo)
fixed_t dist = P_AproxDistance (mo->x - mo->target->x, mo->y - mo->target->y);
fixed_t delta = (mo->target->z + (mo->height>>1)) - mo->z;
if (delta < 0 && dist < -(delta*3))
mo->z -= FLOATSPEED;
mo->z -= mo->FloatSpeed;
else if (delta > 0 && dist < (delta*3))
mo->z += FLOATSPEED;
mo->z += mo->FloatSpeed;
}
}
if (mo->player && mo->flags&MF_NOGRAVITY && (mo->z > mo->floorz))

View file

@ -296,6 +296,7 @@ void AActor::Serialize (FArchive &arc)
<< AR_SOUNDW(ActiveSound)
<< AR_SOUNDW(UseSound)
<< Speed
<< FloatSpeed
<< Mass
<< PainChance
<< SpawnState
@ -1285,7 +1286,8 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
int steps, step, totalsteps;
fixed_t startx, starty;
fixed_t maxmove = (mo->waterlevel < 2) || (mo->flags & MF_MISSILE) ? MAXMOVE : MAXMOVE/4;
fixed_t maxmove = (mo->waterlevel < 1) || (mo->flags & MF_MISSILE) ||
(mo->player && mo->player->crouchoffset<-10*FRACUNIT) ? MAXMOVE : MAXMOVE/4;
if (mo->flags2 & MF2_WINDTHRUST && mo->waterlevel < 2 && !(mo->flags & MF_NOCLIP))
{
@ -1311,9 +1313,10 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
// that large thrusts can't propel an actor through a wall, because wall
// running depends on the player's original movement continuing even after
// it gets blocked.
if (mo->player != NULL && (compatflags & COMPATF_WALLRUN) || (mo->waterlevel >= 2))
if (mo->player != NULL && (compatflags & COMPATF_WALLRUN) || (mo->waterlevel >= 1) ||
(mo->player != NULL && mo->player->crouchfactor < FRACUNIT*3/4))
{
// try to preserve the direction instead of clamping x and y independently.
// preserve the direction instead of clamping x and y independently.
xmove = clamp (mo->momx, -maxmove, maxmove);
ymove = clamp (mo->momy, -maxmove, maxmove);
@ -1825,9 +1828,9 @@ void P_ZMovement (AActor *mo)
dist = P_AproxDistance (mo->x - mo->target->x, mo->y - mo->target->y);
delta = (mo->target->z + (mo->height>>1)) - mo->z;
if (delta < 0 && dist < -(delta*3))
mo->z -= FLOATSPEED, mo->momz = 0;
mo->z -= mo->FloatSpeed, mo->momz = 0;
else if (delta > 0 && dist < (delta*3))
mo->z += FLOATSPEED, mo->momz = 0;
mo->z += mo->FloatSpeed, mo->momz = 0;
}
}
if (mo->player && (mo->flags & MF_NOGRAVITY) && (mo->z > mo->floorz))
@ -2983,6 +2986,7 @@ BEGIN_DEFAULTS (AActor, Any, -1, 0)
PROP_MaxStepHeight(24)
PROP_BounceFactor(FRACUNIT*7/10)
PROP_BounceCount(-1)
PROP_FloatSpeed(4)
END_DEFAULTS
//==========================================================================
@ -3410,6 +3414,7 @@ void P_SpawnPlayer (mapthing2_t *mthing)
p->lastkilltime = 0;
p->BlendR = p->BlendG = p->BlendB = p->BlendA = 0.f;
p->air_finished = level.time + level.airsupply;
p->Uncrouch();
p->momx = p->momy = 0; // killough 10/98: initialize bobbing to 0.
@ -4455,7 +4460,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
}
if (z != ONFLOORZ && z != ONCEILINGZ)
{
z += 4*8*FRACUNIT - source->floorclip;
z += 4*8*FRACUNIT - source->floorclip + (source->player? source->player->crouchoffset : 0);
}
MissileActor = Spawn (type, x, y, z);

View file

@ -663,7 +663,8 @@ void A_GunFlash (AActor *actor)
return;
}
player->mo->PlayAttacking2 ();
P_SetPsprite (player, ps_flash, player->ReadyWeapon->FlashState);
P_SetPsprite (player, ps_flash, (player->ReadyWeapon->bAltFire && player->ReadyWeapon->AltFlashState != NULL) ?
player->ReadyWeapon->AltFlashState : player->ReadyWeapon->FlashState);
}

View file

@ -1148,6 +1148,61 @@ void P_SetSlope (secplane_t *plane, BOOL setCeil, int xyangi, int zangi,
plane->c, z);
}
//-----------------------------------------------------------------------------
//
//
//-----------------------------------------------------------------------------
void P_VavoomSlope(sector_t * sec, int id, fixed_t x, fixed_t y, fixed_t z, int which)
{
for (int i=0;i<sec->linecount;i++)
{
line_t * l=sec->lines[i];
if (l->args[0]==id)
{
vec3_t v1, v2, cross;
secplane_t *srcplane = (which == 0) ? &sec->floorplane : &sec->ceilingplane;
fixed_t srcheight = (which == 0) ? sec->floortexz : sec->ceilingtexz;
v1[0] = FIXED2FLOAT (x - l->v2->x);
v1[1] = FIXED2FLOAT (y - l->v2->y);
v1[2] = FIXED2FLOAT (z - srcheight);
v2[0] = FIXED2FLOAT (x - l->v1->x);
v2[1] = FIXED2FLOAT (y - l->v1->y);
v2[2] = FIXED2FLOAT (z - srcheight);
CrossProduct (v1, v2, cross);
VectorNormalize (cross);
// Fix backward normals
if ((cross[2] < 0 && which == 0) || (cross[2] > 0 && which == 1))
{
cross[0] = -cross[0];
cross[1] = -cross[1];
cross[2] = -cross[2];
}
srcplane->a = FLOAT2FIXED (cross[0]);
srcplane->b = FLOAT2FIXED (cross[1]);
srcplane->c = FLOAT2FIXED (cross[2]);
//plane->ic = FLOAT2FIXED (1.f/cross[2]);
srcplane->ic = DivScale32 (1, srcplane->c);
srcplane->d = -TMulScale16 (srcplane->a, x,
srcplane->b, y,
srcplane->c, z);
int v=srcplane->ZatPoint(x,y);
int w=srcplane->ZatPoint(l->v1->x,l->v1->y);
int x=srcplane->ZatPoint(l->v2->x,l->v2->y);
return;
}
}
}
enum
{
THING_SlopeFloorPointLine = 9500,
@ -1156,16 +1211,23 @@ enum
THING_SetCeilingSlope = 9503,
THING_CopyFloorPlane = 9510,
THING_CopyCeilingPlane = 9511,
THING_VavoomFloor=1500,
THING_VavoomCeiling=1501,
};
//-----------------------------------------------------------------------------
//
//
//-----------------------------------------------------------------------------
static void P_SpawnSlopeMakers (mapthing2_t *firstmt, mapthing2_t *lastmt)
{
mapthing2_t *mt;
for (mt = firstmt; mt < lastmt; ++mt)
{
if (mt->type >= THING_SlopeFloorPointLine &&
mt->type <= THING_SetCeilingSlope)
if ((mt->type >= THING_SlopeFloorPointLine &&
mt->type <= THING_SetCeilingSlope) ||
mt->type==THING_VavoomFloor || mt->type==THING_VavoomCeiling)
{
fixed_t x, y, z;
secplane_t *refplane;
@ -1183,7 +1245,11 @@ static void P_SpawnSlopeMakers (mapthing2_t *firstmt, mapthing2_t *lastmt)
refplane = &sec->floorplane;
}
z = refplane->ZatPoint (x, y) + (mt->z << FRACBITS);
if (mt->type <= THING_SlopeCeilingPointLine)
if (mt->type==THING_VavoomFloor || mt->type==THING_VavoomCeiling)
{
P_VavoomSlope(sec, mt->thingid, x, y, mt->z<<FRACBITS, mt->type & 1);
}
else if (mt->type <= THING_SlopeCeilingPointLine)
{
P_SlopeLineToPoint (mt->args[0], x, y, z, mt->type & 1);
}

View file

@ -127,6 +127,12 @@ void player_s::SetLogText (const char *text)
LogText = text;
}
//===========================================================================
//
// APlayerPawn
//
//===========================================================================
IMPLEMENT_ABSTRACT_ACTOR (APlayerPawn)
IMPLEMENT_ABSTRACT_ACTOR (APlayerChunk)
@ -143,6 +149,37 @@ void APlayerPawn::BeginPlay ()
ChangeStatNum (STAT_PLAYER);
}
//===========================================================================
//
// APlayerPawn :: Tick
//
//===========================================================================
void APlayerPawn::Tick()
{
if (player != NULL && player->mo == this && player->morphTics == 0 && player->playerstate != PST_DEAD)
{
yscale = FixedMul(GetDefault()->yscale, player->crouchfactor);
height = FixedMul(GetDefault()->height, player->crouchfactor);
}
else
{
// Ensure that PlayerPawns not connected to a player or morphed players are always un-crouched.
yscale = GetDefault()->yscale;
if (health > 0) height = GetDefault()->height;
}
Super::Tick();
// Here's the place where crouching sprites should be handled
}
//===========================================================================
//
// APlayerPawn :: AddInventory
//
//===========================================================================
void APlayerPawn::AddInventory (AInventory *item)
{
// Don't add to the inventory of dead players.
@ -163,6 +200,12 @@ void APlayerPawn::AddInventory (AInventory *item)
}
}
//===========================================================================
//
// APlayerPawn :: RemoveInventory
//
//===========================================================================
void APlayerPawn::RemoveInventory (AInventory *item)
{
bool pickWeap = false;
@ -208,6 +251,12 @@ void APlayerPawn::RemoveInventory (AInventory *item)
}
}
//===========================================================================
//
// APlayerPawn :: UseInventory
//
//===========================================================================
bool APlayerPawn::UseInventory (AInventory *item)
{
const PClass *itemtype = item->GetClass();
@ -556,7 +605,7 @@ void P_CalcHeight (player_t *player)
}
}
fixed_t defaultviewheight = player->defaultviewheight;
fixed_t defaultviewheight = player->defaultviewheight + player->crouchviewdelta;
if (player->cheats & CF_NOMOMENTUM)
{
@ -695,6 +744,14 @@ void P_MovePlayer (player_t *player)
fm = FixedMul (fm, player->mo->Speed);
sm = FixedMul (sm, player->mo->Speed);
// When crouching speed and bobbing have to be reduced
if (player->morphTics==0 && player->crouchfactor != FRACUNIT)
{
fm = FixedMul(fm, player->crouchfactor);
sm = FixedMul(sm, player->crouchfactor);
bobfactor = FixedMul(bobfactor, player->crouchfactor);
}
forwardmove = Scale (fm, movefactor * 35, TICRATE << 8);
sidemove = Scale (sm, movefactor * 35, TICRATE << 8);
@ -937,6 +994,40 @@ void P_DeathThink (player_t *player)
}
}
//----------------------------------------------------------------------------
//
// PROC P_CrouchMove
//
//----------------------------------------------------------------------------
void P_CrouchMove(player_t * player, int direction)
{
fixed_t defaultheight = player->mo->GetDefault()->height;
fixed_t savedheight = player->mo->height;
fixed_t crouchspeed = direction * CROUCHSPEED;
player->crouchdir = (signed char) direction;
player->crouchfactor += crouchspeed;
// check whether the move is ok
player->mo->height = FixedMul(defaultheight, player->crouchfactor);
if (!P_TryMove(player->mo, player->mo->x, player->mo->y, false, false))
{
player->mo->height = savedheight;
if (direction > 0)
{
// doesn't fit
player->crouchfactor -= crouchspeed;
return;
}
}
player->mo->height = savedheight;
player->crouchfactor = clamp<fixed_t>(player->crouchfactor, FRACUNIT/2, FRACUNIT);
player->viewheight = FixedMul(player->defaultviewheight, player->crouchfactor);
player->crouchviewdelta = player->viewheight - player->defaultviewheight;
}
//----------------------------------------------------------------------------
//
// PROC P_PlayerThink
@ -1031,8 +1122,43 @@ void P_PlayerThink (player_t *player)
cmd->ucmd.upmove = 0;
}
// Handle crouching
if (player->morphTics == 0)
{
if (!(player->cheats & CF_TOTALLYFROZEN))
{
int crouchdir = player->crouching;
if (crouchdir==0)
{
crouchdir = (player->cmd.ucmd.buttons & BT_DUCK)? -1 : 1;
}
else if (player->cmd.ucmd.buttons & BT_DUCK)
{
player->crouching=0;
}
if (crouchdir == 1 && player->crouchfactor < FRACUNIT &&
player->mo->z + player->mo->height < player->mo->ceilingz)
{
P_CrouchMove(player, 1);
}
else if (crouchdir == -1 && player->crouchfactor > FRACUNIT/2)
{
P_CrouchMove(player, -1);
}
}
}
else
{
player->Uncrouch();
}
player->crouchoffset = -FixedMul(player->defaultviewheight, (FRACUNIT - player->crouchfactor));
if (player->playerstate == PST_DEAD)
{
player->Uncrouch();
P_DeathThink (player);
return;
}
@ -1099,6 +1225,12 @@ void P_PlayerThink (player_t *player)
// [RH] check for jump
if (cmd->ucmd.buttons & BT_JUMP)
{
if (player->crouchoffset!=0)
{
// Jumping while crouching will force an un-crouch but not jump
player->crouching = 1;
}
else
if (player->mo->waterlevel >= 2)
{
player->mo->momz = 4*FRACUNIT;
@ -1419,6 +1551,11 @@ void player_s::Serialize (FArchive &arc)
arc << CurrentPlayerClass;
arc << crouchfactor
<< crouching
<< crouchdir
<< crouchviewdelta;
if (isbot)
{
arc << angle

View file

@ -1128,7 +1128,7 @@ static const char * actor_statenames[]={"SPAWN","SEE","PAIN","MELEE","MISSILE","
"CRUSH", "YES", "NO", "GREETINGS", NULL};
static const char * weapon_statenames[]={"SELECT", "DESELECT", "READY", "FIRE", "HOLD",
"ALTFIRE", "ALTHOLD", "FLASH", NULL };
"ALTFIRE", "ALTHOLD", "FLASH", "ALTFLASH", NULL };
static const char * inventory_statenames[]={"USE", "PICKUP", "DROP", NULL };
@ -1429,7 +1429,7 @@ static void RetargetStates (intptr_t count, const char *target, const PClass *cl
if (cls->IsDescendantOf (RUNTIME_CLASS(AWeapon)))
{
AWeapon *weapon = (AWeapon *)defaults;
RetargetStatePointers (count, target, &weapon->UpState, &weapon->FlashState);
RetargetStatePointers (count, target, &weapon->UpState, &weapon->AltFlashState);
}
if (cls->IsDescendantOf (RUNTIME_CLASS(ACustomInventory)))
{
@ -1947,7 +1947,7 @@ static int FinishStates (FActorInfo *actor, AActor *defaults, Baggage &bag)
{
AWeapon *weapon = (AWeapon*)defaults;
FixStatePointers (actor, &weapon->UpState, &weapon->FlashState);
FixStatePointers (actor, &weapon->UpState, &weapon->AltFlashState);
}
if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(ACustomInventory)))
{
@ -1993,7 +1993,7 @@ static int FinishStates (FActorInfo *actor, AActor *defaults, Baggage &bag)
{
AWeapon *weapon = (AWeapon*)defaults;
FixStatePointersAgain (actor, defaults, &weapon->UpState, &weapon->FlashState);
FixStatePointersAgain (actor, defaults, &weapon->UpState, &weapon->AltFlashState);
}
if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(ACustomInventory)))
{
@ -2377,6 +2377,15 @@ static void ActorSpeed (AActor *defaults, Baggage &bag)
defaults->Speed=fixed_t(sc_Float*FRACUNIT);
}
//==========================================================================
//
//==========================================================================
static void ActorFloatSpeed (AActor *defaults, Baggage &bag)
{
SC_MustGetFloat();
defaults->FloatSpeed=fixed_t(sc_Float*FRACUNIT);
}
//==========================================================================
//
//==========================================================================
@ -3506,6 +3515,7 @@ static const ActorProps props[] =
{ "explosiondamage", ActorExplosionDamage, RUNTIME_CLASS(AActor) },
{ "explosionradius", ActorExplosionRadius, RUNTIME_CLASS(AActor) },
{ "fastspeed", ActorFastSpeed, RUNTIME_CLASS(AActor) },
{ "floatspeed", ActorFloatSpeed, RUNTIME_CLASS(AActor) },
{ "game", ActorGame, RUNTIME_CLASS(AActor) },
{ "gibhealth", ActorGibHealth, RUNTIME_CLASS(AActor) },
{ "heal", ActorHealState, RUNTIME_CLASS(AActor) },

View file

@ -532,7 +532,7 @@ void A_CustomMissile(AActor * self)
angle_t ang = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT;
fixed_t x = Spawnofs_XY * finecosine[ang];
fixed_t y = Spawnofs_XY * finesine[ang];
fixed_t z = SpawnHeight-32*FRACUNIT;
fixed_t z = SpawnHeight - 32*FRACUNIT + (self->player? self->player->crouchoffset : 0);
switch (aimmode&3)
{
@ -1197,7 +1197,8 @@ void A_ThrowGrenade(AActor * self)
AActor * bo;
bo = Spawn(missile, self->x, self->y, self->z - self->floorclip + zheight + 35*FRACUNIT);
bo = Spawn(missile, self->x, self->y,
self->z - self->floorclip + zheight + 35*FRACUNIT + (self->player? self->player->crouchoffset : 0));
if (bo)
{
int pitch = self->pitch;

View file

@ -68,6 +68,10 @@
#define GAMESIG "ZDOOM"
#define BASEWAD "zdoom.pk3"
#ifdef unix
#define HOME_DIR "~/.zdoom"
#endif
// MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 232 // Used by 2.0.99