Moved all entity field definitions into one file.

This commit is contained in:
Marco Cawthorne 2018-12-09 05:58:28 +01:00
parent 701f0e8737
commit c1497341a8
22 changed files with 157 additions and 120 deletions

View file

@ -171,7 +171,7 @@ enum {
BTN_FINDGAME,
BTN_STARTGAME,
BTN_GAMEINFO,
BTN_UPDATE,
BTN_UPDATELIST,
BTN_ADDSERVER,
BTN_DISCONNECT,
BTN_CONSOLE,

View file

@ -24,6 +24,8 @@
OTHER DEALINGS IN THE SOFTWARE.
*/
string(float a, float b) getgamedirinfo = #0;
/*
=================
m_init
@ -78,6 +80,13 @@ void m_init( void ) {
search_end( shSprays );
drawfont = loadfont( "font", "", "12", -1 );
string gamedirname;
string gamedescription;
for (int gameidx = 0; (gamedirname = getgamedirinfo(gameidx, 0)); gameidx++) {
gamedescription = getgamedirinfo(gameidx, 1);
print(sprintf("Gamedir %s, description %s\n", gamedirname, gamedescription));
}
}
/*

View file

@ -148,7 +148,9 @@ float Menu_InputEvent( float fEventType, float fKey, float fCharacter, float fDe
} else {
return FALSE;
}
m_draw(vVideoSize);
return TRUE;
}

View file

@ -106,36 +106,40 @@ Menu_Multiplayer
First mulitplayer screen with the server browser
=================
*/
void Menu_Multiplayer( void ) {
void Menu_Multiplayer(void) {
static string strCustomIP;
static int iSelectedServer = -1;
static int iScrollServer;
static int iServersTotal;
static int iAddServer = FALSE;
static void Multiplayer_ButtonJoin( void ) {
static void Multiplayer_ButtonJoin(void) {
if ( iSelectedServer >= 0 ) {
localcmd( sprintf( "connect %s\n", gethostcachestring( fldAddress, iSelectedServer ) ) );
m_hide();
}
}
static void Multiplayer_ButtonCreate( void ) {
static void Multiplayer_ButtonCreate(void) {
iMenu = MENU_MULTIPLAYER_CREATE;
}
static void Multiplayer_ButtonRefresh( void ) {
static void Multiplayer_ButtonRefresh(void) {
refreshhostcache();
resorthostcache();
}
static void Multiplayer_ButtonDone( void ) {
static void Multiplayer_ButtonUpdate(void) {
refreshhostcache(TRUE);
resorthostcache();
}
static void Multiplayer_ButtonDone(void) {
iMenu = MENU_MAIN;
}
static void Multiplayer_ButtonIRC( void ) {
static void Multiplayer_ButtonIRC(void) {
iMenu = MENU_MULTIPLAYER_IRC;
}
static void Multiplayer_ButtonAdd( void ) {
static void Multiplayer_ButtonAdd(void) {
iAddServer = 1 - iAddServer;
}
static void Multiplayer_ButtonJoinIP( void ) {
static void Multiplayer_ButtonJoinIP(void) {
if ( strCustomIP ) {
localcmd( sprintf( "connect %s\n", strCustomIP ) );
m_hide();
@ -162,18 +166,19 @@ void Menu_Multiplayer( void ) {
iServersTotal = gethostcachevalue( SLIST_HOSTCACHEVIEWCOUNT );
Menu_SetClipArea( '32 148', '164 192' );
Menu_SetClipArea( '32 148', '164 256' );
Object_Button( '32 148', BTN_JOINGAME, Multiplayer_ButtonJoin, fButtonAlpha[0] );
Object_Button( '32 180', BTN_CREATE, Multiplayer_ButtonCreate, fButtonAlpha[1] );
Object_Button( '32 212', BTN_GAMEINFO, __NULL__, fButtonAlpha[2] );
Object_Button( '32 244', BTN_REFRESHLIST, Multiplayer_ButtonRefresh, fButtonAlpha[3] );
Object_Button( '32 276', BTN_ADDSERVER, Multiplayer_ButtonAdd, fButtonAlpha[4] );
Object_Button( '32 276', BTN_UPDATELIST, Multiplayer_ButtonUpdate, fButtonAlpha[4] );
Object_Button( '32 308', BTN_ADDSERVER, Multiplayer_ButtonAdd, fButtonAlpha[5] );
if ( checkcommand( "irc" ) ) {
Object_Button( '32 276', BTN_IRCCHAT, Multiplayer_ButtonIRC, fButtonAlpha[4] );
}
//if ( checkcommand( "irc" ) ) {
Object_Button( '32 340', BTN_IRCCHAT, Multiplayer_ButtonIRC, fButtonAlpha[6] );
//}
Object_Button( '32 308', BTN_DONE, Multiplayer_ButtonDone, fButtonAlpha[5] );
Object_Button( '32 372', BTN_DONE, Multiplayer_ButtonDone, fButtonAlpha[7] );
Menu_ResetClipArea();
Object_Frame( '196 140', '404 308' );
@ -214,7 +219,7 @@ Menu_Multiplayer_Create
Server creation menu screen
=================
*/
void Menu_Multiplayer_Create( void ) {
void Menu_Multiplayer_Create(void) {
static int iSelectedMap;
static int iScrollMap;
static int iFirst = 1;
@ -255,11 +260,11 @@ void Menu_Multiplayer_Create( void ) {
drawstring( vPosition + '8 0', sMapList[ iIndex ], '12 12', autocvar_menu_fgcolor, fAlpha, 0 );
}
}
static void Create_ButtonAdvanced( void ) {
static void Create_ButtonAdvanced(void) {
// Advanced options
iMenu = MENU_MULTIPLAYER_OPTIONS;
}
static void Create_ButtonOK( void ) {
static void Create_ButtonOK(void) {
// Apply the configurations
if ( strHostname != __NULL__ ) {
localcmd( sprintf( "hostname %s\n", strHostname ) );
@ -270,7 +275,7 @@ void Menu_Multiplayer_Create( void ) {
// Start server
localcmd( sprintf( "map %s\n", sMapList[ iSelectedMap ] ) );
}
static void Create_ButtonCancel( void ) {
static void Create_ButtonCancel(void) {
iMenu = MENU_MULTIPLAYER;
}
@ -304,13 +309,43 @@ void Menu_Multiplayer_Create( void ) {
Menu_ResetClipArea();
}
void Menu_Multiplayer_IRC( void ) {
int iIRCShowRooms;
var string irc_currentroom;
static string stockrooms[] = {
"FreeCS Chat", "#freecs",
"Maps & Mods", "#maps",
"Off-Topic", "#general",
"Support", "#support"
};
void Menu_Multiplayer_IRC_Rooms(void)
{
static int iRoomsInitialized = FALSE;
static string roomlist;
static void IRC_ButtonDone(void) {
iIRCShowRooms = FALSE;
}
if (!iRoomsInitialized) {
//roomlist
}
Object_Button( '32 308', BTN_DONE, IRC_ButtonDone, fButtonAlpha[0] );
}
void Menu_Multiplayer_IRC(void) {
static int iIRCInit = FALSE;
static string currenttab;
string showtab;
static string s; //static to access it in nested functions.
static string s;
static string strGameDir_Lobby;
static string strGameDir_Support;
static string strGameDir_Maps;
static string strGameDir_Mods;
static void IRC_ButtonDone( void ) {
static void IRC_ButtonDone(void) {
iMenu = MENU_MULTIPLAYER;
}
static void IRC_ButtonSelect(void) {
@ -322,11 +357,22 @@ void Menu_Multiplayer_IRC( void ) {
con_input(currenttab, IE_FOCUS, 1/*mouse focus*/, 1/*key focus*/, 0);
}
}
if ( iIRCInit == FALSE ) {
print( "[IRC] Connecting to #freecs...\n" );
localcmd("/irc /connect irc.freenode.org #freecs\n");
localcmd("plug_load irc\n");
localcmd(sprintf("irc_nick %s\n", cvar_string("name")));
strGameDir_Lobby = sprintf("#%s_lobby", cvar_string("game"));
strGameDir_Support = sprintf("#%s_support", cvar_string("game"));
strGameDir_Maps = sprintf("#%s_maps", cvar_string("game"));
strGameDir_Mods = sprintf("#%s_mods", cvar_string("game"));
localcmd("irc /connect www.vera-visions.com\n");
iIRCInit = TRUE;
iIRCShowRooms = TRUE;
}
if (iIRCShowRooms) {
Menu_Multiplayer_IRC_Rooms();
return;
}
int iTabIdx;
@ -355,7 +401,8 @@ void Menu_Multiplayer_IRC( void ) {
if not (showtab) //the channel we're trying to target
for (s = ""; s; s = con_getset(s, "next"))
{ //try to find our target channel
if (substring(s, 0, 3) == "IRC" && substring(s, -8, -1) == ":#freecs")
print(sprintf("TAB: %s\n", s));
if (substring(s, 0, 3) == "IRC" && substring(s, -7, -1) == "#freecs")
{
showtab = s;
break;
@ -394,7 +441,7 @@ void Menu_Multiplayer_IRC( void ) {
//note that if you wish to handle IME strings then you should be doing that anyway.
if (fInputKeyCode != K_MOUSE1 && (fInputKeyCode || fInputKeyASCII))
{
//print(sprintf("Sending input: %f %f %c\n", fInputKeyCode, fInputKeyASCII, fInputKeyASCII));
//print(sprintf("Sending input: %f %f %c\n", fInputKeyCode, fInputKeyASCII, fInputKeyASCII));
con_input(currenttab, IE_KEYDOWN, fInputKeyCode, fInputKeyASCII, 0);
con_input(currenttab, IE_KEYUP, fInputKeyCode, fInputKeyASCII, 0);
fInputKeyCode = 0;

View file

@ -76,7 +76,7 @@ string sButtonLabels[ MENU_BUTTONS ] = {
_("BTN_FINDGAME"),
_("BTN_STARTGAME"),
_("BTN_GAMEINFO"),
_("BTN_UPDATE"),
_("BTN_UPDATELIST"),
_("BTN_ADDSERVER"),
_("BTN_DISCONNECT"),
_("BTN_CONSOLE"),

View file

@ -46,9 +46,6 @@ Not Toggled (32) - Older FGDs show this as Not Looped.
Must be left unchecked for looping sound files.
Note that actual looping depends purely on cue points defined in the .wav file (see notes).
*/
.float pitch;
.float loop;
.float lforate;
void ambient_generic( void ) {
static float ambient_generic_send( entity ePEnt, float fChanged ) {
WriteByte( MSG_ENTITY, ENT_AMBIENTSOUND );

View file

@ -68,9 +68,6 @@ string sArmouryModels[ 19 ] = {
"models/w_smokegrenade.mdl"
};
.float item;
.float count;
/*
=================
SPAWN: armoury_entity

View file

@ -75,20 +75,6 @@ enum {
GRENADE_READY
};
// Player specific fields
.float fInBuyZone;
.float fInHostageZone;
.float fInBombZone;
.float fMoney;
.float fStepTime;
.int iInGame;
.float fCharModel;
//.int iHasBomb;
.float fDeaths;
.int iEquipment;
.float armor;
.float fProgressBar;
// Match specific fields
int iRounds;
int iWon_T;
@ -99,13 +85,7 @@ int iAlivePlayers_CT;
float fGameState;
float fGameTime;
// Weapon specific fields
.int iCurrentMag;
.int iCurrentCaliber;
.float fSlotMelee, fSlotPrimary, fSlotSecondary, fSlotGrenade;
.float fAttackFinished;
.float fRadioFinished;
.float fAccuracy;
entity eActivator;
// Game specific fields
int iHostagesMax;
@ -120,26 +100,6 @@ int iBombRadius; // For info_map_parameters
int iHostagesRescued;
int iBombPlanted;
// Generic entity fields
.int iUsable;
.int iBleeds;
.void( int iHitBody ) vPain;
.void( int iHitBody ) vDeath;
.float fRespawns;
.entity eUser;
.float material;
// All about +use
entity eActivator;
.void() vUse;
.int iUsable;
// GoldSrc-Rendermode Fields
.vector rendercolor;
.float rendermode;
.float renderamt;
.float alpha;
void Rules_RoundOver( int iTeamWon, int iMoneyReward, float fSilent );
float Rules_BuyingPossible( void );
void Timer_Begin( float fTime, float fMode);

View file

@ -24,10 +24,6 @@
OTHER DEALINGS IN THE SOFTWARE.
*/
.entity eTargetPoint;
.entity eLastCreated;
.int iHasBeenUsed;
enum {
HOSTAGE_IDLE,
HOSTAGE_WALK,

View file

@ -105,13 +105,6 @@ Entities_InitRespawnable
Called
====================
*/
.string sOldModel;
.float fOldSolid;
.float fOldHealth;
.vector vOldOrigin;
.vector vOldAngle;
.void() vRespawn;
.void() vOldUse;
void Entities_InitRespawnable( void() vRespawnFunc ) {
self.sOldModel = self.model;
self.fOldSolid = self.solid;

View file

@ -67,7 +67,6 @@ Sprite (model) - A sprite must be specified here (sprites/spritename.spr).
Frames per second (framerate) - Framerate the sprite will run at if animated.
=================
*/
.float framerate;
void env_sprite( void ) {
static float env_sprite_send( entity ePEnt, float fChanged ) {
WriteByte( MSG_ENTITY, ENT_SPRITE ); // Identifier
@ -170,7 +169,6 @@ It's possible to create a similar effect with a combination of other entities,
but it wouldn't be much fun, so this quick and easy one is here instead!
=================
*/
.int iMagnitude;
enumflags {
ENVEXPLO_NODAMAGE,
@ -222,7 +220,7 @@ We may never know.
*/
#define SPARK_TOGGLE 32
#define SPARK_ON 64
.float MaxDelay;
void env_spark( void ) {
static void env_spark_fire( void ) {
Effect_CreateSpark( self.origin, self.angles );

View file

@ -48,15 +48,6 @@ enum {
STATE_DOWN
};
.float speed;
.float lip;
.float state;
.vector pos1, pos2;
// Not all that customizable...
.float movesnd;
.float stopsnd;
/*
====================
FuncDoor_PrecacheSounds

View file

@ -45,8 +45,6 @@ void FuncDoorRotate_RotateAway( void );
void FuncDoorRotate_RotateBack( void );
void FuncDoorRotate_Touch( void );
.float distance;
/*
=================
FuncDoorRotate_Arrived

View file

@ -24,9 +24,6 @@
OTHER DEALINGS IN THE SOFTWARE.
*/
/* decal name */
.string texture;
/* We need to save trace infos temporarily in order to figure out what to
* project the decal against. Half-Life's infodecal entity only stores origin,
* but not angles. So we have to figure them out ourselves. */

View file

@ -32,7 +32,6 @@ Only thing this ent does, is allow the change of lightstyles.
You can use custom patterns, too.
=================
*/
.string pattern;
void light( void ) {
static void light_toggle( void ) {
if ( self.health == TRUE ) {

View file

@ -31,6 +31,33 @@ enum {
BUY_NEITHER
};
/* Edit this for a custom gun-game order */
int gg_order[] = {
WEAPON_KNIFE,
WEAPON_GLOCK18,
WEAPON_USP45,
WEAPON_P228,
WEAPON_FIVESEVEN,
WEAPON_ELITES,
WEAPON_DEAGLE,
WEAPON_M3,
WEAPON_XM1014,
WEAPON_TMP,
WEAPON_MAC10,
WEAPON_MP5,
WEAPON_UMP45,
WEAPON_P90,
WEAPON_AK47,
WEAPON_SCOUT,
WEAPON_M4A1,
WEAPON_SG552,
WEAPON_AUG,
WEAPON_G3SG1,
WEAPON_SG550,
WEAPON_AWP,
WEAPON_PARA
};
/*
=================
Rules_BuyingPossible
@ -250,27 +277,27 @@ Happens rarely
*/
void Rules_SwitchTeams( void ) {
int iCTW, iTW;
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
if ( eFind.team == TEAM_CT ) {
for (entity eFind = world; (eFind = find(eFind, classname, "player"));) {
if (eFind.team == TEAM_CT) {
eFind.team = TEAM_T;
eFind.fCharModel -= 4;
} else if ( eFind.team == TEAM_T ) {
} else if (eFind.team == TEAM_T) {
eFind.team = TEAM_CT;
eFind.fCharModel += 4;
}
forceinfokey( eFind, "*team", ftos( eFind.team ) );
forceinfokey(eFind, "*team", ftos(eFind.team));
}
iCTW = iWon_CT;
iTW = iWon_T;
iWon_T = iCTW;
iWon_CT = iTW;
iCTW = iAlivePlayers_CT;
iTW = iAlivePlayers_T;
iAlivePlayers_CT = iTW;
iAlivePlayers_T = iCTW;
}
@ -316,12 +343,11 @@ void Rules_DeathCheck(void)
=================
SPAWN: info_map_parameters
Let's map authors decide who can buy stuff and who CAN'T.
Also allows people to set the bomb placing radius incase you want to use info_bomb_target.
Let map authors decide who can buy stuff and who CAN'T.
Also allows people to set the bomb placing radius incase
you want to use info_bomb_target.
=================
*/
.float buying;
.float bombradius;
void info_map_parameters( void ) {
if ( self.bombradius ) {
iBombRadius = self.bombradius;

View file

@ -347,6 +347,21 @@ void info_player_deathmatch( void ) {
}
}
/* Counter-Strike: Source compat */
void info_player_counterterrorist(void)
{
setorigin(self, self.origin + [0,0,32]);
self.classname = "info_player_start";
info_player_start();
}
void info_player_terrorist(void)
{
setorigin(self, self.origin + [0,0,32]);
self.classname = "info_player_deathmatch";
info_player_deathmatch();
}
/*
=================
info_target

View file

@ -7,6 +7,7 @@
../Globals.h
../Math.h
Defs.h
DefsFields.h
Money.c
../Shared/Animations.c

View file

@ -95,7 +95,13 @@ void Effect_Spraypaint( string sLogo, float fR, float fG, float fB ) {
#else
float Effect_Spraypaint( void ) {
makevectors( self.angles );
adddecal( self.classname, self.origin, v_up / 32, v_forward / 32, self.color, 1.0f );
float surf = getsurfacenearpoint(world, self.origin);
vector s_dir = getsurfacepointattribute(world, surf, 0, SPA_S_AXIS);
vector t_dir = getsurfacepointattribute(world, surf, 0, SPA_T_AXIS);
//vector fixedty = dotproduct(
adddecal( self.classname, self.origin, v_up / 32, t_dir / 32, self.color, 1.0f );
addentity( self );
return PREDRAW_NEXT;
#endif
@ -421,7 +427,12 @@ void Effect_BreakModel( vector vMins, vector vMaxs, vector vVel, float fStyle )
#ifdef CSQC
float Effect_Decal( void ) {
makevectors( self.angles );
adddecal( self.classname, self.origin, v_up / self.size[0], v_forward / self.size[1], self.color, 1.0f );
float surf = getsurfacenearpoint(world, self.origin);
vector s_dir = getsurfacepointattribute(world, surf, 0, SPA_S_AXIS);
vector t_dir = getsurfacepointattribute(world, surf, 0, SPA_T_AXIS);
adddecal( self.classname, self.origin, v_up / self.size[0], t_dir / self.size[1], self.color, 1.0f );
addentity( self );
return PREDRAW_NEXT;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.