2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** c_dispatch.h
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2006-06-11 01:37:00 +00:00
|
|
|
** Copyright 1998-2006 Randy Heit
|
2006-02-24 04:48:15 +00:00
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __C_DISPATCH_H__
|
|
|
|
#define __C_DISPATCH_H__
|
|
|
|
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "doomtype.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
class FConfigFile;
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
class APlayerPawn;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void C_ExecCmdLineParams ();
|
|
|
|
|
|
|
|
// Add commands to the console as if they were typed in. Can handle wait
|
|
|
|
// and semicolon-separated commands. This function may modify the source
|
|
|
|
// string, but the string will be restored to its original state before
|
|
|
|
// returning. Therefore, commands passed must not be in read-only memory.
|
|
|
|
void AddCommandString (char *text, int keynum=0);
|
|
|
|
|
|
|
|
// Process a single console command. Does not handle wait.
|
|
|
|
void C_DoCommand (const char *cmd, int keynum=0);
|
|
|
|
|
|
|
|
int C_ExecFile (const char *cmd, bool usePullin);
|
|
|
|
|
|
|
|
// Write out alias commands to a file for all current aliases.
|
|
|
|
void C_ArchiveAliases (FConfigFile *f);
|
|
|
|
|
|
|
|
void C_SetAlias (const char *name, const char *cmd);
|
|
|
|
|
|
|
|
// build a single string out of multiple strings
|
2006-10-05 03:30:44 +00:00
|
|
|
FString BuildString (int argc, char **argv);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Class that can parse command lines
|
|
|
|
class FCommandLine
|
|
|
|
{
|
|
|
|
public:
|
2008-05-09 03:54:06 +00:00
|
|
|
FCommandLine (const char *commandline, bool no_escapes = false);
|
2006-02-24 04:48:15 +00:00
|
|
|
~FCommandLine ();
|
|
|
|
int argc ();
|
|
|
|
char *operator[] (int i);
|
|
|
|
const char *args () { return cmd; }
|
2008-05-09 03:54:06 +00:00
|
|
|
void Shift();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const char *cmd;
|
|
|
|
int _argc;
|
|
|
|
char **_argv;
|
|
|
|
long argsize;
|
2008-05-09 03:54:06 +00:00
|
|
|
bool noescapes;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
typedef void (*CCmdRun) (FCommandLine &argv, APlayerPawn *instigator, int key);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
class FConsoleCommand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FConsoleCommand (const char *name, CCmdRun RunFunc);
|
|
|
|
virtual ~FConsoleCommand ();
|
|
|
|
virtual bool IsAlias ();
|
|
|
|
void PrintCommand () { Printf ("%s\n", m_Name); }
|
|
|
|
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
virtual void Run (FCommandLine &args, APlayerPawn *instigator, int key);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
FConsoleCommand *m_Next, **m_Prev;
|
|
|
|
char *m_Name;
|
|
|
|
|
|
|
|
enum { HASH_SIZE = 251 }; // Is this prime?
|
|
|
|
|
|
|
|
protected:
|
|
|
|
FConsoleCommand ();
|
|
|
|
bool AddToHash (FConsoleCommand **table);
|
|
|
|
|
|
|
|
CCmdRun m_RunFunc;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#define CCMD(n) \
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
void Cmd_##n (FCommandLine &, APlayerPawn *, int key); \
|
|
|
|
FConsoleCommand Cmd_##n##_Ref (#n, Cmd_##n); \
|
|
|
|
void Cmd_##n (FCommandLine &argv, APlayerPawn *who, int key)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
const int KEY_DBLCLICKED = 0x8000;
|
|
|
|
|
|
|
|
class FConsoleAlias : public FConsoleCommand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FConsoleAlias (const char *name, const char *command, bool noSave);
|
|
|
|
~FConsoleAlias ();
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
void Run (FCommandLine &args, APlayerPawn *Instigator, int key);
|
2006-02-24 04:48:15 +00:00
|
|
|
bool IsAlias ();
|
|
|
|
void PrintAlias ();
|
|
|
|
void Archive (FConfigFile *f);
|
|
|
|
void Realias (const char *command, bool noSave);
|
|
|
|
void SafeDelete ();
|
|
|
|
protected:
|
2006-10-05 03:30:44 +00:00
|
|
|
FString m_Command[2]; // Slot 0 is saved to the ini, slot 1 is not.
|
|
|
|
bool bDoSubstitution;
|
2006-02-24 04:48:15 +00:00
|
|
|
bool bRunning;
|
|
|
|
bool bKill;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Actions
|
|
|
|
struct FButtonStatus
|
|
|
|
{
|
|
|
|
enum { MAX_KEYS = 6 }; // Maximum number of keys that can press this button
|
|
|
|
|
|
|
|
WORD Keys[MAX_KEYS];
|
|
|
|
BYTE bDown; // Button is down right now
|
|
|
|
BYTE bWentDown; // Button went down this tic
|
|
|
|
BYTE bWentUp; // Button went up this tic
|
|
|
|
BYTE padTo16Bytes;
|
|
|
|
|
2009-07-26 03:25:18 +00:00
|
|
|
bool PressKey (int keynum); // Returns true if this key caused the button to be pressed.
|
|
|
|
bool ReleaseKey (int keynum); // Returns true if this key is no longer pressed.
|
2006-02-24 04:48:15 +00:00
|
|
|
void ResetTriggers () { bWentDown = bWentUp = false; }
|
|
|
|
};
|
|
|
|
|
|
|
|
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,
|
2008-09-13 02:55:45 +00:00
|
|
|
Button_MoveUp, Button_Jump, Button_ShowScores, Button_Crouch,
|
|
|
|
Button_Zoom, Button_Reload,
|
|
|
|
Button_User1, Button_User2, Button_User3, Button_User4;
|
2006-02-24 04:48:15 +00:00
|
|
|
extern bool ParsingKeyConf;
|
|
|
|
|
|
|
|
void ResetButtonTriggers (); // Call ResetTriggers for all buttons
|
|
|
|
void ResetButtonStates (); // Same as above, but also clear bDown
|
|
|
|
|
|
|
|
extern unsigned int MakeKey (const char *s);
|
|
|
|
extern unsigned int MakeKey (const char *s, size_t len);
|
|
|
|
|
|
|
|
#endif //__C_DISPATCH_H__
|