Big commit, work over various triggers. Clean up debug prints and make
them more consistent. Warnings are in yellow, while errors are in red. New cvar: g_developerTimestamp will display timestamps next to debug messages originating from the game-logic. Set g_developer to 1 to see them. A lot of useful into, such as which entity id messages originate from should aid in debugging quite a bit. SP level transitions should also be more reliable now in terms of transferring entities and the like. Some levels have awkward transition areas and you might find yourself jumping between levels frequently. Workarounds are in the works.
This commit is contained in:
parent
0147278359
commit
649ed825ad
160 changed files with 1990 additions and 1409 deletions
13
base/manifest.fmf
Normal file
13
base/manifest.fmf
Normal file
|
@ -0,0 +1,13 @@
|
|||
FTEMANIFEST 1
|
||||
NAME "Test Game"
|
||||
GAME base
|
||||
BASEGAME platform
|
||||
BASEGAME base
|
||||
|
||||
// you don't really want to change these
|
||||
RTCBROKER master.frag-net.com:27950
|
||||
PROTOCOLNAME "Nuclide"
|
||||
MAINCONFIG nuclide.cfg
|
||||
DOWNLOADSURL ""
|
||||
|
||||
-exec platform_default.cfg
|
|
@ -10,6 +10,7 @@
|
|||
../../../src/shared/fteextensions.qc
|
||||
../../../src/shared/defs.h
|
||||
../../../src/server/defs.h
|
||||
../../../src/botlib/botinfo.h
|
||||
../../../src/gs-entbase/server.src
|
||||
../../../src/gs-entbase/shared.src
|
||||
|
||||
|
|
|
@ -11,6 +11,10 @@ safe_copy()
|
|||
|
||||
radiant_build()
|
||||
{
|
||||
if [ "$SKIP_RADIANT" = "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
./make_mapdef.sh "$1"
|
||||
|
||||
# copy files over to RADIANT
|
||||
|
|
|
@ -39,7 +39,7 @@ typedef enum
|
|||
BOT_STATE_FLEEING /**< this is for when the AI should just get as far away as possible */
|
||||
} botstate_t;
|
||||
|
||||
/** Base class for the Bot AI.
|
||||
/** A virtual multiplayer opponent. Base class for all bots.
|
||||
*/
|
||||
class NSBot:player
|
||||
{
|
|
@ -193,8 +193,7 @@ NSBot::CheckRoute(void)
|
|||
|
||||
/* we're inside the radius */
|
||||
if (flDist <= flRadius) {
|
||||
NSLog("^2NSBot::^3CheckRoute^7: " \
|
||||
"%s reached node\n", this.targetname);
|
||||
BotEntLog("%s reached node", this.netname);
|
||||
m_iCurNode--;
|
||||
|
||||
/* if we're inside an actual node (not a virtual one */
|
||||
|
@ -218,8 +217,7 @@ NSBot::CheckRoute(void)
|
|||
|
||||
/* can we walk directly to our target destination? */
|
||||
if (trace_fraction == 1.0) {
|
||||
print("^2NSBot::^3CheckRoute^7: " \
|
||||
"Walking directly to last node\n");
|
||||
BotEntLog("Walking directly to last node.");
|
||||
m_iCurNode = -1;
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +243,7 @@ NSBot::CheckRoute(void)
|
|||
|
||||
/* after one second, also give up the route */
|
||||
if (m_flNodeGiveup >= 1.0f || m_iCurNode <= BOTROUTE_END) {
|
||||
print("taking too long! giving up!\n");
|
||||
BotEntLog("Taking too long! Giving up!");
|
||||
RouteClear();
|
||||
} else if (m_flNodeGiveup >= 0.5f) {
|
||||
/* attempt a jump after half a second */
|
||||
|
@ -279,7 +277,7 @@ NSBot::RunAI(void)
|
|||
input_angles = [0,0,0];
|
||||
|
||||
/* attempt to respawn when dead */
|
||||
if (IsDead() == true) {
|
||||
if (IsDead() == true || health <= 0) {
|
||||
RouteClear();
|
||||
WeaponAttack();
|
||||
SetEnemy(__NULL__);
|
||||
|
@ -294,7 +292,7 @@ NSBot::RunAI(void)
|
|||
if (!m_iNodes && autocvar_bot_aimless == 0) {
|
||||
CreateObjective();
|
||||
|
||||
NSLog("NSBot::RunAI: %s is calculating first bot route",
|
||||
BotEntLog("%S is calculating first bot route",
|
||||
this.netname);
|
||||
|
||||
/* our route probably has not been processed yet */
|
||||
|
@ -430,14 +428,12 @@ NSBot::RunAI(void)
|
|||
if (m_eTarget && enemyVisible && m_flEnemyDist < 256) {
|
||||
/* we are far away, inch closer */
|
||||
aimPos = m_eTarget.origin;
|
||||
//printf("going to target\n");
|
||||
} else {
|
||||
goRoute = true;
|
||||
}
|
||||
} else if (m_wtWeaponType == WPNTYPE_THROW) {
|
||||
if ((m_eTarget && enemyVisible && !enemyDistant) && m_flEnemyDist < 512) {
|
||||
aimPos = m_eTarget.origin;
|
||||
//printf("going to target\n");
|
||||
} else {
|
||||
goRoute = true;
|
||||
}
|
||||
|
@ -448,10 +444,8 @@ NSBot::RunAI(void)
|
|||
if (goRoute) {
|
||||
if (m_iCurNode <= BOTROUTE_DESTINATION) {
|
||||
aimPos = m_vecLastNode;
|
||||
//printf("going to last node\n");
|
||||
} else {
|
||||
aimPos = m_pRoute[m_iCurNode].dest;
|
||||
//printf("going to next node\n");
|
||||
}
|
||||
} else {
|
||||
RouteClear();
|
||||
|
@ -511,7 +505,7 @@ NSBot::PostFrame(void)
|
|||
/* we've picked something new up */
|
||||
if (m_iOldItems != g_items) {
|
||||
Weapons_SwitchBest(this);
|
||||
print(sprintf("%s is now using %s (%d)\n", netname, g_weapons[activeweapon].name, activeweapon));
|
||||
BotEntLog("%S is now using %S (%d)", netname, g_weapons[activeweapon].name, activeweapon);
|
||||
m_iOldItems = g_items;
|
||||
}
|
||||
#endif
|
||||
|
@ -553,7 +547,7 @@ bot_spawner_think(void)
|
|||
int minClientsCvar = (int)cvar("bot_minClients");
|
||||
|
||||
/* if -1, we are not managing _anything_ */
|
||||
if (minClientsCvar == -1) {
|
||||
if (minClientsCvar == -1i) {
|
||||
self.nextthink = time + 5.0f;
|
||||
return;
|
||||
}
|
|
@ -169,7 +169,7 @@ BotLib_Alert(vector pos, float radius, float t)
|
|||
continue;
|
||||
|
||||
/* we've heard a noise. investigate the location */
|
||||
print(sprintf("bot alerted by noise at %v\n", pos));
|
||||
BotLog("Bot %S (%d) alerted by noise at %v", f.netname, num_for_edict(f), pos);
|
||||
f.RouteClear();
|
||||
f.RouteToPosition(pos);
|
||||
}
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2023 Vera Visions LLC.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
var int autocvar_bot_aimless = FALSE;
|
||||
|
||||
var int autocvar_nav_linksize = 256;
|
||||
var int autocvar_nav_radius = 8;
|
||||
|
||||
var bool autocvar_bot_crouch = false;
|
||||
var bool autocvar_bot_walk = false;
|
||||
var bool autocvar_bot_stop = false;
|
||||
var bool autocvar_bot_dont_shoot = false;
|
||||
|
||||
var bool autocvar_bot_join_after_player = false;
|
||||
var float autocvar_bot_join_delay = 0.0f;
|
||||
var int autocvar_bot_quota = 0i;
|
||||
var string autocvar_bot_quota_mode = "normal";
|
||||
var string autocvar_bot_chatter = "normal";
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BOTSKILL_EASY = 1,
|
||||
BOTSKILL_MEDIUM,
|
||||
BOTSKILL_HARD
|
||||
} botskill_t;
|
||||
|
||||
var botskill_t autocvar_bot_skill = BOTSKILL_MEDIUM;
|
||||
|
||||
var string autocvar_bot_prefix = "";
|
|
@ -14,10 +14,85 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "bot.h"
|
||||
#include "botinfo.h"
|
||||
#include "cvar.h"
|
||||
#include "profiles.h"
|
||||
|
||||
#include "NSBot.h"
|
||||
|
||||
vector Route_SelectDestination( NSBot target );
|
||||
|
||||
var int autocvar_bot_aimless = FALSE;
|
||||
|
||||
var int autocvar_nav_linksize = 256;
|
||||
var int autocvar_nav_radius = 8;
|
||||
|
||||
var bool autocvar_bot_crouch = false;
|
||||
var bool autocvar_bot_walk = false;
|
||||
var bool autocvar_bot_stop = false;
|
||||
var bool autocvar_bot_dont_shoot = false;
|
||||
|
||||
var bool autocvar_bot_join_after_player = false;
|
||||
var float autocvar_bot_join_delay = 0.0f;
|
||||
var int autocvar_bot_quota = 0i;
|
||||
var string autocvar_bot_quota_mode = "normal";
|
||||
var string autocvar_bot_chatter = "normal";
|
||||
var bool autocvar_bot_developer = false;
|
||||
|
||||
void
|
||||
_BotLog(string functionName, string msg)
|
||||
{
|
||||
print(sprintf("%f ^xF05%s ^7: %s\n", time, functionName, msg));
|
||||
}
|
||||
|
||||
/** Logs an bot system specific log message.
|
||||
The console variable `bot_developer` has to be `1` for them to be visible.
|
||||
|
||||
@param description(...) contains a formatted string containing a description. */
|
||||
#define BotLog(...) if (autocvar_bot_developer) _BotLog(__FUNC__, sprintf(__VA_ARGS__))
|
||||
|
||||
void
|
||||
_BotEntLog(string className, string functionName, float edictNum, string warnMessage)
|
||||
{
|
||||
print(sprintf("%f ^xF05%s (id: %d) ^7: %s\n", time, functionName, edictNum, warnMessage));
|
||||
}
|
||||
|
||||
/** Logs an bot specific entity class log message.
|
||||
The console variable `bot_developer` has to be `1` for them to be visible.
|
||||
|
||||
@param description(...) contains a formatted string containing a description. */
|
||||
#define BotEntLog(...) if (autocvar_bot_developer) _BotEntLog(classname, __FUNC__, num_for_edict(this), sprintf(__VA_ARGS__))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BOTSKILL_EASY = 1,
|
||||
BOTSKILL_MEDIUM,
|
||||
BOTSKILL_HARD
|
||||
} botskill_t;
|
||||
|
||||
var botskill_t autocvar_bot_skill = BOTSKILL_MEDIUM;
|
||||
|
||||
var string autocvar_bot_prefix = "";
|
||||
|
||||
/* BotScript
|
||||
script/bots.txt
|
||||
|
||||
Listing of various bot profiles
|
||||
where infokeys can be set and interpreted
|
||||
by the game-logic at will.
|
||||
|
||||
The `name` keys has to _always_ be present.
|
||||
The `funname` key is optional.
|
||||
|
||||
Name acts as both an identifier as well
|
||||
as a nickname when `funname` is not present.
|
||||
|
||||
Anything else is considered to be extra.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
string m_strName;
|
||||
string m_strNetName;
|
||||
string m_strExtra;
|
||||
} botScript_t;
|
||||
|
||||
#define BOTSCRIPT_MAX 32
|
||||
botScript_t g_bots[BOTSCRIPT_MAX];
|
||||
var int g_botScriptCount;
|
|
@ -3,7 +3,7 @@
|
|||
#includelist
|
||||
defs.h
|
||||
profiles.qc
|
||||
bot.qc
|
||||
NSBot.qc
|
||||
bot_chat.qc
|
||||
bot_combat.qc
|
||||
route.qc
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Vera Visions LLC.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* BotScript
|
||||
script/bots.txt
|
||||
|
||||
Listing of various bot profiles
|
||||
where infokeys can be set and interpreted
|
||||
by the game-logic at will.
|
||||
|
||||
The `name` keys has to _always_ be present.
|
||||
The `funname` key is optional.
|
||||
|
||||
Name acts as both an identifier as well
|
||||
as a nickname when `funname` is not present.
|
||||
|
||||
Anything else is considered to be extra.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
string m_strName;
|
||||
string m_strNetName;
|
||||
string m_strExtra;
|
||||
} botScript_t;
|
||||
|
||||
#define BOTSCRIPT_MAX 32
|
||||
botScript_t g_bots[BOTSCRIPT_MAX];
|
||||
var int g_botScriptCount;
|
|
@ -29,7 +29,7 @@ Bot_ExistsInServer(string botName)
|
|||
}
|
||||
|
||||
bool
|
||||
Bot_AddBot_f(string botName)
|
||||
Bot_AddBot_f(string botName, float teamValue, float spawnDelay, string newName)
|
||||
{
|
||||
int extraCount = 0i;
|
||||
int foundID = -1i;
|
||||
|
@ -43,7 +43,7 @@ Bot_AddBot_f(string botName)
|
|||
}
|
||||
|
||||
if (!g_nodes_present) {
|
||||
print("^1BotScript_Add^7: Can't add bot. No waypoints.\n");
|
||||
NSError("Can't add bot. No nodes.");
|
||||
return (false);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ Bot_AddBot_f(string botName)
|
|||
}
|
||||
|
||||
if (foundID == -1i) {
|
||||
print("^1BotScript_Add^7: Named profile not found.\n");
|
||||
NSError("Named profile %S not found.", botName);
|
||||
return (false);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ Bot_AddBot_f(string botName)
|
|||
self = spawnclient();
|
||||
|
||||
if (!self) {
|
||||
print("^1BotScript_Add^7: Can't add bot. Server is full\n");
|
||||
NSError("Unable to add bot. Server is full.");
|
||||
self = oldSelf;
|
||||
return (false);
|
||||
}
|
||||
|
@ -111,11 +111,11 @@ BotProfile_AddRandom(void)
|
|||
|
||||
/* every bot exists already */
|
||||
if (spawnBot == -1i) {
|
||||
print("^1BotProfile_AddRandom^7: Not enough profiles available.\n");
|
||||
NSError("Not enough profiles available.");
|
||||
return (false);
|
||||
}
|
||||
|
||||
Bot_AddBot_f(g_bots[spawnBot].m_strName);
|
||||
Bot_AddBot_f(g_bots[spawnBot].m_strName, 0, 0.0f, __NULL__);
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
@ -127,6 +127,8 @@ BotProfile_Init(void)
|
|||
botScript_t currentDef;
|
||||
int braceDepth = 0i;
|
||||
|
||||
InitStart();
|
||||
|
||||
currentDef.m_strName = "";
|
||||
currentDef.m_strNetName = "";
|
||||
currentDef.m_strExtra = "";
|
||||
|
@ -140,6 +142,7 @@ BotProfile_Init(void)
|
|||
botScript = fopen("scripts/bots.txt", FILE_READ);
|
||||
|
||||
if (botScript < 0) {
|
||||
NSError("Missing file scripts/bots.txt");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -197,14 +200,15 @@ BotProfile_Init(void)
|
|||
}
|
||||
|
||||
fclose(botScript);
|
||||
print(sprintf("%i bots parsed\n", g_botScriptCount));
|
||||
NSLog("...%i bots parsed.", g_botScriptCount);
|
||||
InitEnd();
|
||||
}
|
||||
|
||||
void
|
||||
Bot_ListBotProfiles_f(void)
|
||||
{
|
||||
if (!g_botScriptCount) {
|
||||
print("no bot profiles found.\n");
|
||||
NSError("No bot profiles available.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ Route_SelectDestination(NSBot target)
|
|||
if (rules.IsTeamplay()) {
|
||||
/* we have the goal item, so capture it */
|
||||
if (target.flags & FL_GOALITEM) {
|
||||
print(sprintf("%s going for capture\n", target.netname));
|
||||
BotLog("%s going for capture", target.netname);
|
||||
dest = Route_SelectNearestTeam(BOTINFO_TEAM_GOALCAPTURE, target.origin, target.team);
|
||||
|
||||
/* we may have to go to our teams' goal item then */
|
||||
|
@ -177,7 +177,7 @@ Route_SelectDestination(NSBot target)
|
|||
dest = Route_SelectNearestTeam(BOTINFO_TEAM_GOALITEM, target.origin, target.team);
|
||||
}
|
||||
} else {
|
||||
print(sprintf("%s hunting for goal item\n", target.netname));
|
||||
BotLog("%s hunting for goal item", target.netname);
|
||||
dest = Route_SelectNearestEnemyTeam(BOTINFO_TEAM_GOALITEM, target.origin, target.team);
|
||||
}
|
||||
|
||||
|
@ -187,13 +187,12 @@ Route_SelectDestination(NSBot target)
|
|||
}
|
||||
|
||||
/* by now, they need something else to do involving goal items probably */
|
||||
|
||||
print(sprintf("%s can't figure out where to go for the goal\n", target.netname));
|
||||
BotLog("%s can't figure out where to go for the goal", target.netname);
|
||||
}
|
||||
|
||||
/* if we're low on health, look for health items */
|
||||
if (target.health < 50) {
|
||||
print(sprintf("%s going for health\n", target.netname));
|
||||
BotLog("%s going for health", target.netname);
|
||||
dest = Route_SelectNearest(BOTINFO_HEALTH, target.origin, target.m_vecLastPOI);
|
||||
|
||||
if (dest != __NULL__) {
|
||||
|
@ -201,13 +200,13 @@ Route_SelectDestination(NSBot target)
|
|||
return dest.origin + [0,0,32];
|
||||
}
|
||||
|
||||
print(sprintf("%s can't figure out where to go for health\n", target.netname));
|
||||
BotLog("%s can't figure out where to go for health", target.netname);
|
||||
}
|
||||
|
||||
/* armor is always a good idea to have */
|
||||
if (random() < 0.25)
|
||||
if (target.armor < 50) {
|
||||
print(sprintf("%s going for armor\n", target.netname));
|
||||
BotLog("%s going for armor", target.netname);
|
||||
dest = Route_SelectNearest(BOTINFO_ARMOR, target.origin, target.m_vecLastPOI);
|
||||
|
||||
if (dest != __NULL__) {
|
||||
|
@ -215,13 +214,13 @@ Route_SelectDestination(NSBot target)
|
|||
return dest.origin + [0,0,32];
|
||||
}
|
||||
|
||||
print(sprintf("%s can't figure out where to go for armor\n", target.netname));
|
||||
BotLog("%s can't figure out where to go for armor", target.netname);
|
||||
}
|
||||
|
||||
/* go for ammo, or weapon */
|
||||
if (random() < 0.25)
|
||||
if (!dest) {
|
||||
print(sprintf("%s going for ammo/weapon\n", target.netname));
|
||||
BotLog("%s going for ammo/weapon", target.netname);
|
||||
|
||||
if (random() < 0.5)
|
||||
dest = Route_SelectFarthest(BOTINFO_WEAPON, target.origin, target.m_vecLastPOI);
|
||||
|
@ -233,7 +232,7 @@ Route_SelectDestination(NSBot target)
|
|||
return dest.origin + [0,0,32];
|
||||
}
|
||||
|
||||
print(sprintf("%s can't figure out where to go for ammo/weapon\n", target.netname));
|
||||
BotLog("%s can't figure out where to go for ammo/weapon", target.netname);
|
||||
}
|
||||
|
||||
if (random() < 0.25)
|
||||
|
@ -255,7 +254,7 @@ Route_SelectDestination(NSBot target)
|
|||
}
|
||||
|
||||
/* if all else fails... select a random spot */
|
||||
print(sprintf("%s found nothing, going for random PoI\n", target.netname));
|
||||
BotLog("%s found nothing, going for random PoI", target.netname);
|
||||
dest = Route_SelectRandomSpot();
|
||||
target.m_eDestination = dest;
|
||||
return (dest.origin);
|
||||
|
|
|
@ -234,7 +234,7 @@ Way_SetRadius(int iID, float flRadValue)
|
|||
}
|
||||
|
||||
void
|
||||
Way_FlagJump(void)
|
||||
Way_LinkFlag(int linkFlag)
|
||||
{
|
||||
if (g_waylink_status == 0) {
|
||||
g_way1 = Way_FindClosestNode(self.origin);
|
||||
|
@ -256,41 +256,7 @@ Way_FlagJump(void)
|
|||
Way_LinkNodes(&g_pWaypoints[g_way1], &g_pWaypoints[g_way2]);
|
||||
for (int b = 0i; b < g_pWaypoints[g_way1].m_numNeighbours; b++) {
|
||||
if (g_pWaypoints[g_way1].m_pNeighbour[b].m_iNode == g_way2) {
|
||||
g_pWaypoints[g_way1].m_pNeighbour[b].m_iFlags |= LF_JUMP;
|
||||
env_message_single(self, "^2Jump-linked the two points!\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
env_message_single(self, "^1Failed to link, the two points are the same!\n");
|
||||
}
|
||||
g_way1 = g_way2 = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Way_FlagCrouch(void)
|
||||
{
|
||||
if (g_waylink_status == 0) {
|
||||
g_way1 = Way_FindClosestNode(self.origin);
|
||||
|
||||
if (g_way1 == -1i)
|
||||
return;
|
||||
|
||||
g_waylink_status = 1;
|
||||
env_message_single(self, "^2Selected first waypoint!\n");
|
||||
} else if (g_waylink_status == 1) {
|
||||
g_way2 = Way_FindClosestNode(self.origin);
|
||||
|
||||
if (g_way2 == -1i)
|
||||
return;
|
||||
|
||||
g_waylink_status = 0;
|
||||
|
||||
if (g_way1 != g_way2) {
|
||||
Way_LinkNodes(&g_pWaypoints[g_way1], &g_pWaypoints[g_way2]);
|
||||
for (int b = 0i; b < g_pWaypoints[g_way1].m_numNeighbours; b++) {
|
||||
if (g_pWaypoints[g_way1].m_pNeighbour[b].m_iNode == g_way2) {
|
||||
g_pWaypoints[g_way1].m_pNeighbour[b].m_iFlags |= LF_CROUCH;
|
||||
g_pWaypoints[g_way1].m_pNeighbour[b].m_iFlags |= linkFlag;
|
||||
env_message_single(self, "^2Crouch-linked the two points!\n");
|
||||
}
|
||||
}
|
||||
|
@ -301,108 +267,6 @@ Way_FlagCrouch(void)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Way_FlagWalk(void)
|
||||
{
|
||||
if (g_waylink_status == 0) {
|
||||
g_way1 = Way_FindClosestNode(self.origin);
|
||||
|
||||
if (g_way1 == -1i)
|
||||
return;
|
||||
|
||||
g_waylink_status = 1;
|
||||
env_message_single(self, "^2Selected first waypoint!\n");
|
||||
} else if (g_waylink_status == 1) {
|
||||
g_way2 = Way_FindClosestNode(self.origin);
|
||||
|
||||
if (g_way2 == -1i)
|
||||
return;
|
||||
|
||||
g_waylink_status = 0;
|
||||
|
||||
if (g_way1 != g_way2) {
|
||||
Way_LinkNodes(&g_pWaypoints[g_way1], &g_pWaypoints[g_way2]);
|
||||
for (int b = 0i; b < g_pWaypoints[g_way1].m_numNeighbours; b++) {
|
||||
if (g_pWaypoints[g_way1].m_pNeighbour[b].m_iNode == g_way2) {
|
||||
g_pWaypoints[g_way1].m_pNeighbour[b].m_iFlags |= LF_WALK;
|
||||
env_message_single(self, "^2Walk-linked the two points!\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
env_message_single(self, "^1Failed to link, the two points are the same!\n");
|
||||
}
|
||||
g_way1 = g_way2 = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Way_FlagAim(void)
|
||||
{
|
||||
if (g_waylink_status == 0) {
|
||||
g_way1 = Way_FindClosestNode(self.origin);
|
||||
|
||||
if (g_way1 == -1i)
|
||||
return;
|
||||
|
||||
g_waylink_status = 1;
|
||||
env_message_single(self, "^2Selected first waypoint!\n");
|
||||
} else if (g_waylink_status == 1) {
|
||||
g_way2 = Way_FindClosestNode(self.origin);
|
||||
|
||||
if (g_way2 == -1i)
|
||||
return;
|
||||
|
||||
g_waylink_status = 0;
|
||||
|
||||
if (g_way1 != g_way2) {
|
||||
Way_LinkNodes(&g_pWaypoints[g_way1], &g_pWaypoints[g_way2]);
|
||||
for (int b = 0i; b < g_pWaypoints[g_way1].m_numNeighbours; b++) {
|
||||
if (g_pWaypoints[g_way1].m_pNeighbour[b].m_iNode == g_way2) {
|
||||
g_pWaypoints[g_way1].m_pNeighbour[b].m_iFlags |= LF_AIM;
|
||||
env_message_single(self, "^2Aim-linked the two points!\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
env_message_single(self, "^1Failed to link, the two points are the same!\n");
|
||||
}
|
||||
g_way1 = g_way2 = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Way_FlagUse(void)
|
||||
{
|
||||
if (g_waylink_status == 0) {
|
||||
g_way1 = Way_FindClosestNode(self.origin);
|
||||
|
||||
if (g_way1 == -1i)
|
||||
return;
|
||||
|
||||
g_waylink_status = 1;
|
||||
env_message_single(self, "^2Selected first waypoint!\n");
|
||||
} else if (g_waylink_status == 1) {
|
||||
g_way2 = Way_FindClosestNode(self.origin);
|
||||
|
||||
if (g_way2 == -1i)
|
||||
return;
|
||||
|
||||
g_waylink_status = 0;
|
||||
|
||||
if (g_way1 != g_way2) {
|
||||
Way_LinkNodes(&g_pWaypoints[g_way1], &g_pWaypoints[g_way2]);
|
||||
for (int b = 0i; b < g_pWaypoints[g_way1].m_numNeighbours; b++) {
|
||||
if (g_pWaypoints[g_way1].m_pNeighbour[b].m_iNode == g_way2) {
|
||||
g_pWaypoints[g_way1].m_pNeighbour[b].m_iFlags |= LF_USER;
|
||||
env_message_single(self, "^2Use-linked the two points!\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
env_message_single(self, "^1Failed to link, the two points are the same!\n");
|
||||
}
|
||||
g_way1 = g_way2 = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Way_Unlink(void)
|
||||
{
|
||||
|
@ -631,8 +495,7 @@ Way_DrawDebugInfo(void)
|
|||
}
|
||||
|
||||
int iNearest = Way_FindClosestNode(self.origin);
|
||||
makevectors(self.v_angle);
|
||||
R_BeginPolygon("", 0, 0);
|
||||
makevectors([-90, 0, 0]);
|
||||
|
||||
for (int i = 0i; i < g_iWaypoints; i++) {
|
||||
waypoint_t *w = g_pWaypoints + i;
|
||||
|
@ -643,10 +506,24 @@ Way_DrawDebugInfo(void)
|
|||
rgb = [0,1,0];
|
||||
}
|
||||
|
||||
R_PolygonVertex(org + v_right * 4 - v_up * 4, [1,1], rgb, 1);
|
||||
R_PolygonVertex(org - v_right * 4 - v_up * 4, [0,1], rgb, 1);
|
||||
R_PolygonVertex(org - v_right * 4 + v_up * 4, [0,0], rgb, 1);
|
||||
R_PolygonVertex(org + v_right * 4 + v_up * 4, [1,0], rgb, 1);
|
||||
R_BeginPolygon("", 0, 0);
|
||||
R_PolygonVertex(org + v_right * 2 - v_up * 2, [1,1], rgb, 1);
|
||||
R_PolygonVertex(org - v_right * 2 - v_up * 2, [0,1], rgb, 1);
|
||||
R_EndPolygon();
|
||||
|
||||
R_BeginPolygon("", 0, 0);
|
||||
R_PolygonVertex(org - v_right * 2 - v_up * 2, [0,1], rgb, 1);
|
||||
R_PolygonVertex(org - v_right * 2 + v_up * 2, [0,0], rgb, 1);
|
||||
R_EndPolygon();
|
||||
|
||||
R_BeginPolygon("", 0, 0);
|
||||
R_PolygonVertex(org - v_right * 2 + v_up * 2, [0,0], rgb, 1);
|
||||
R_PolygonVertex(org + v_right * 2 + v_up * 2, [1,0], rgb, 1);
|
||||
R_EndPolygon();
|
||||
|
||||
R_BeginPolygon("", 0, 0);
|
||||
R_PolygonVertex(org + v_right * 2 + v_up * 2, [1,0], rgb, 1);
|
||||
R_PolygonVertex(org + v_right * 2 - v_up * 2, [1,1], rgb, 1);
|
||||
R_EndPolygon();
|
||||
}
|
||||
|
||||
|
@ -707,6 +584,9 @@ Way_DrawDebugInfo(void)
|
|||
R_EndPolygon();
|
||||
}
|
||||
|
||||
/* spheres need view angle */
|
||||
makevectors(self.v_angle);
|
||||
|
||||
R_BeginPolygon("", 0, 0);
|
||||
for (int i = 0i; i < g_iWaypoints; i++) {
|
||||
vector rgb;
|
||||
|
@ -814,20 +694,8 @@ Way_Cmd(void)
|
|||
g_pWaypoints[i].m_vecOrigin[2] *= -1;
|
||||
}
|
||||
break;
|
||||
case "linkjump":
|
||||
Way_FlagJump();
|
||||
break;
|
||||
case "linkcrouch":
|
||||
Way_FlagCrouch();
|
||||
break;
|
||||
case "linkwalk":
|
||||
Way_FlagWalk();
|
||||
break;
|
||||
case "linkaim":
|
||||
Way_FlagAim();
|
||||
break;
|
||||
case "linkuse":
|
||||
Way_FlagUse();
|
||||
case "flag":
|
||||
Way_LinkFlag(stoi(argv(2)));
|
||||
break;
|
||||
case "unlink1":
|
||||
Way_Unlink();
|
||||
|
|
|
@ -268,7 +268,7 @@ NSInteractiveSurface::NSInteractiveSurface(void)
|
|||
m_flScale = 0.25f;
|
||||
m_flUseDistance = 64;
|
||||
m_strSurfaceMat = sprintf("UISurface%d", num_for_edict(this));
|
||||
print(sprintf("Surface mat: %S\n", m_strSurfaceMat));
|
||||
EntLog("UI surface material: %S\n", m_strSurfaceMat);
|
||||
drawmask = MASK_ENGINE;
|
||||
m_bCached = false;
|
||||
isCSQC = true;
|
||||
|
|
|
@ -302,8 +302,7 @@ NSRadar::InitFromHLTVScript(string fileName)
|
|||
r_uploadimage("overview", width, height, (void *)imgData);
|
||||
memfree(imgData);
|
||||
newRadar.m_strMaterial = "overview";
|
||||
|
||||
print("Overview loaded.\n");
|
||||
NSLog("Map overview available.");
|
||||
return newRadar;
|
||||
}
|
||||
|
||||
|
@ -369,7 +368,6 @@ NSRadar::InitFromSourceHLTVScript(string fileName)
|
|||
vector imageSize = drawgetimagesize(newRadar.m_strMaterial);
|
||||
imageSize *= newRadar.m_flScale;
|
||||
newRadar.CalculateVerticesSource(imageSize[0], imageSize[1]);
|
||||
|
||||
print("Overview loaded.\n");
|
||||
NSLog("Map overview available.");
|
||||
return newRadar;
|
||||
}
|
|
@ -207,14 +207,14 @@ CMD_ListTitles(void)
|
|||
int i = 0i;
|
||||
|
||||
for (i = 0; i < g_titles_count; i++) {
|
||||
print(sprintf("%s, (x: %d, y: %d)\n",
|
||||
g_titles[i].m_strName, g_titles[i].m_flPosX, g_titles[i].m_flPosY));
|
||||
print(sprintf("\teffect: %i, fade-in: %f, fade-out: %f\n",
|
||||
g_titles[i].m_iEffect, g_titles[i].m_flFadeIn, g_titles[i].m_flFadeOut));
|
||||
print(sprintf("\thold-time: %f, fx-time: %f\n",
|
||||
g_titles[i].m_flHoldTime, g_titles[i].m_flFXTime));
|
||||
print(sprintf("\tcolor 1: %v, color 2: %v\n",
|
||||
g_titles[i].m_vecColor1, g_titles[i].m_vecColor2));
|
||||
printf("%s, (x: %d, y: %d)\n",
|
||||
g_titles[i].m_strName, g_titles[i].m_flPosX, g_titles[i].m_flPosY);
|
||||
printf("\teffect: %i, fade-in: %f, fade-out: %f\n",
|
||||
g_titles[i].m_iEffect, g_titles[i].m_flFadeIn, g_titles[i].m_flFadeOut);
|
||||
printf("\thold-time: %f, fx-time: %f\n",
|
||||
g_titles[i].m_flHoldTime, g_titles[i].m_flFXTime);
|
||||
printf("\tcolor 1: %v, color 2: %v\n",
|
||||
g_titles[i].m_vecColor1, g_titles[i].m_vecColor2);
|
||||
}
|
||||
print(sprintf("\t%i total titles loaded\n", g_titles_count));
|
||||
}
|
||||
|
@ -226,12 +226,12 @@ CMD_ListModelFramegroups(void)
|
|||
float modelIndex = getmodelindex(modelName);
|
||||
string temp = "";
|
||||
|
||||
print(sprintf("// model: %S\n", modelName));
|
||||
printf("// model: %S\n", modelName);
|
||||
|
||||
print("typedef enum {\n");
|
||||
for (int i = 0; i < modelframecount(modelIndex); i++) {
|
||||
temp = frametoname(modelIndex, i);
|
||||
print(sprintf("\t%s = %i,\n", strtoupper(temp), i));
|
||||
printf("\t%s = %i,\n", strtoupper(temp), i);
|
||||
}
|
||||
print("} framegroups_e;\n");
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ Cmd_Parse(string sCMD)
|
|||
case "listServerSoundDef":
|
||||
localcmd("sv listSoundDef\n");
|
||||
break;
|
||||
case "cleardecals":
|
||||
case "clearDecals":
|
||||
CMD_Cleardecals();
|
||||
break;
|
||||
case "testPointLight":
|
||||
|
@ -437,28 +437,28 @@ Cmd_Parse(string sCMD)
|
|||
localcmd(sprintf("sv addBot %s\n", argv(1)));
|
||||
break;
|
||||
case "killAllBots":
|
||||
localcmd(sprintf("sv killAllBots %s\n", argv(1)));
|
||||
localcmd("sv killAllBots\n");
|
||||
break;
|
||||
case "resetAllBotsGoals":
|
||||
localcmd(sprintf("sv resetAllBotsGoals %s\n", argv(1)));
|
||||
localcmd("sv resetAllBotsGoals\n");
|
||||
break;
|
||||
case "killClass":
|
||||
localcmd(sprintf("sv killClass %s\n", argv(1)));
|
||||
break;
|
||||
case "killMovables":
|
||||
localcmd(sprintf("sv killMovables %s\n", argv(1)));
|
||||
localcmd("sv killMovables\n");
|
||||
break;
|
||||
case "trigger":
|
||||
localcmd(sprintf("sv trigger %s\n", argv(1)));
|
||||
break;
|
||||
case "input":
|
||||
localcmd(sprintf("sv input %s\n", argv(1)));
|
||||
localcmd(sprintf("sv input %s %s %s\n", argv(1), argv(2), argv(3)));
|
||||
break;
|
||||
case "listBotProfiles":
|
||||
localcmd(sprintf("sv listBotProfiles %s\n", argv(1)));
|
||||
localcmd("sv listBotProfiles\n");
|
||||
break;
|
||||
case "listTargets":
|
||||
localcmd(sprintf("sv listTargets %s\n", argv(1)));
|
||||
localcmd("sv listTargets\n");
|
||||
break;
|
||||
case "teleport":
|
||||
localcmd(sprintf("sv teleport %s\n", argv(1)));
|
||||
|
@ -467,12 +467,35 @@ Cmd_Parse(string sCMD)
|
|||
localcmd(sprintf("sv teleportToClass %s\n", argv(1)));
|
||||
break;
|
||||
case "respawnEntities":
|
||||
localcmd(sprintf("sv respawnEntities %s\n", argv(1)));
|
||||
localcmd("sv respawnEntities\n");
|
||||
break;
|
||||
case "spawn":
|
||||
case "spawnDef":
|
||||
localcmd(sprintf("sv spawn %s\n", argv(1)));
|
||||
break;
|
||||
|
||||
|
||||
case "nodeAdd":
|
||||
localcmd(sprintf("sv way addsingle %s\n", argv(1)));
|
||||
break;
|
||||
case "nodeDel":
|
||||
localcmd(sprintf("sv way delete %s\n", argv(1)));
|
||||
break;
|
||||
case "nodeFlags":
|
||||
localcmd(sprintf("sv way link %s\n", argv(1)));
|
||||
break;
|
||||
case "nodeLink":
|
||||
localcmd(sprintf("sv way connect1 %s\n", argv(1)));
|
||||
break;
|
||||
case "nodeRadius":
|
||||
localcmd(sprintf("sv way radius %s\n", argv(1)));
|
||||
break;
|
||||
case "nodeOffset":
|
||||
localcmd(sprintf("sv way move %s\n", argv(1)));
|
||||
break;
|
||||
case "nodeUnlink":
|
||||
localcmd(sprintf("sv way unlink1 %s\n", argv(1)));
|
||||
break;
|
||||
|
||||
default:
|
||||
return (false);
|
||||
}
|
||||
|
@ -489,7 +512,7 @@ Register our commands for Nuclide
|
|||
void
|
||||
Cmd_Init(void)
|
||||
{
|
||||
print("--------- Initializing Cmds ----------\n");
|
||||
InitStart();
|
||||
|
||||
/* developer/debug commands */
|
||||
registercommand("listFramegroups");
|
||||
|
@ -512,10 +535,19 @@ Cmd_Init(void)
|
|||
registercommand("teleport");
|
||||
registercommand("teleportToClass");
|
||||
registercommand("respawnEntities");
|
||||
registercommand("spawn");
|
||||
registercommand("spawnDef");
|
||||
registercommand("listBotProfiles");
|
||||
|
||||
registercommand("cleardecals");
|
||||
/* nav editing */
|
||||
registercommand("nodeAdd");
|
||||
registercommand("nodeDel");
|
||||
registercommand("nodeFlags");
|
||||
registercommand("nodeLink");
|
||||
registercommand("nodeRadius");
|
||||
registercommand("nodeOffset");
|
||||
registercommand("nodeUnlink");
|
||||
|
||||
registercommand("clearDecals");
|
||||
registercommand("testLight");
|
||||
registercommand("testPointLight");
|
||||
registercommand("getpos");
|
||||
|
@ -586,4 +618,6 @@ Cmd_Init(void)
|
|||
registercommand("-menu_left");
|
||||
registercommand("+menu_right");
|
||||
registercommand("-menu_right");
|
||||
|
||||
InitEnd();
|
||||
}
|
||||
|
|
|
@ -175,6 +175,7 @@ void View_PlayAnimation(int);
|
|||
|
||||
void View_EnableViewmodel(void);
|
||||
void View_DisableViewmodel(void);
|
||||
void View_SetViewmodelSkin(float);
|
||||
|
||||
/** Draws a non-filled rectangle with a specified outline. */
|
||||
void drawrect(vector pos, vector sz, float thickness, vector rgb, float al, optional float dfl)
|
||||
|
|
|
@ -74,12 +74,10 @@ DetailTex_Reload(void)
|
|||
if (!autocvar(r_detailtextures, 0, "High-res detail texture overlays for selected maps"))
|
||||
return;
|
||||
|
||||
print("--------- Initializing DetailTex ----------\n");
|
||||
|
||||
fh = fopen(strcat("maps/", mapname, "_detail.txt"), FILE_READ);
|
||||
|
||||
if (fh < 0) {
|
||||
print(sprintf("DeailTex definition not found for %s.\n", mapname));
|
||||
NSError("DeailTex definition missing for %s.", mapname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -93,7 +91,7 @@ DetailTex_Reload(void)
|
|||
n++;
|
||||
}
|
||||
|
||||
print(sprintf("DeailTex initialized with %i entries.\n", n));
|
||||
NSLog("DeailTex initialized with %i entries.", n);
|
||||
fclose(fh);
|
||||
g_detail_initialized = 1;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,8 @@ EFX_Load(string efx_file)
|
|||
g_efx_name = (string *)memrealloc(g_efx_name, sizeof(string), i, g_efx_count);
|
||||
#else
|
||||
if (g_efx_count > EFXDATA_MAX) {
|
||||
error(sprintf("EFX_Load: Reached EFXDATA_MAX (%d)\n", EFXDATA_MAX));
|
||||
NSError("EFX_Load: Reached EFXDATA_MAX (%d)", EFXDATA_MAX);
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -210,7 +211,7 @@ EFX_Load(string efx_file)
|
|||
}
|
||||
}
|
||||
|
||||
print(sprintf("parsed EFXDef file %s\n", efx_file));
|
||||
NSLog("parsed EFXDef file %S", efx_file);
|
||||
fclose(fh);
|
||||
return i;
|
||||
}
|
||||
|
@ -318,7 +319,7 @@ EFX_UpdateListener(NSView playerView)
|
|||
}
|
||||
g_flEFXTime += clframetime;
|
||||
#else
|
||||
NSLog("EFX_UpdateListener: Changed style to %s (%i)",
|
||||
SndLog("Changed style to %s (%i)",
|
||||
g_efx_name[g_iEFX], g_iEFX);
|
||||
|
||||
old_dsp = g_iEFX;
|
||||
|
@ -332,14 +333,14 @@ EFX_Init(void)
|
|||
int efx_default;
|
||||
int efx_underwater;
|
||||
|
||||
print("--------- Initializing EFXDefs ----------\n");
|
||||
InitStart();
|
||||
|
||||
#ifndef EFXDATA_DYNAMIC
|
||||
g_efx = (reverbinfo_t *)memalloc(sizeof(reverbinfo_t) * EFXDATA_MAX);
|
||||
g_efx_name = (string *)memalloc(sizeof(string) * EFXDATA_MAX);
|
||||
print(sprintf("allocated %d bytes for EFXDefs.\n", (sizeof(string) * EFXDATA_MAX) + (sizeof(reverbinfo_t) * EFXDATA_MAX)));
|
||||
NSLog("...allocated %d bytes for EFXDefs.", (sizeof(string) * EFXDATA_MAX) + (sizeof(reverbinfo_t) * EFXDATA_MAX));
|
||||
#else
|
||||
print("dynamic allocation for EFXDefs enabled.\n");
|
||||
NSLog("...dynamic allocation for EFXDefs enabled.");
|
||||
#endif
|
||||
|
||||
efx_default = EFX_Load("default");
|
||||
|
@ -354,6 +355,7 @@ EFX_Init(void)
|
|||
|
||||
setup_reverb(12, &g_efx[g_iEFX], sizeof(reverbinfo_t));
|
||||
setup_reverb(10, &g_efx[efx_underwater], sizeof(reverbinfo_t));
|
||||
InitEnd();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -236,7 +236,6 @@ void
|
|||
Entities_RendererRestarted(void)
|
||||
{
|
||||
int c = 0;
|
||||
print("--------- Reloading Entity Resources ----------\n");
|
||||
|
||||
for (entity b = world; (b = findfloat(b, ::isCSQC, TRUE));) {
|
||||
NSEntity pf = (NSEntity) b;
|
||||
|
@ -244,5 +243,5 @@ Entities_RendererRestarted(void)
|
|||
c++;
|
||||
}
|
||||
|
||||
print(sprintf("resource reload called on %i entities\n", c));
|
||||
NSLog("...resource reload called on %i entities", c);
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ Also called when map changes happen.
|
|||
void
|
||||
CSQC_Init(float apilevel, string enginename, float engineversion)
|
||||
{
|
||||
print("--------- Initializing Client Game ----------\n");
|
||||
print("Built: " __DATE__ " " __TIME__"\n");
|
||||
print("QCC: " __QCCVER__ "\n");
|
||||
InitPrint("Initializing Client Game");
|
||||
NSLog("Built: %s %s", __DATE__, __TIME__);
|
||||
NSLog("QCC: %s", __QCCVER__);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
g_viewSeats[i] = spawn(NSView);
|
||||
|
@ -90,7 +90,7 @@ CSQC_Init(float apilevel, string enginename, float engineversion)
|
|||
Sound_Precache("Player.WeaponSelectionClose");
|
||||
|
||||
/* end msg */
|
||||
print("Client game initialized.\n");
|
||||
NSLog("Client game initialized.");
|
||||
|
||||
/* because the engine will do really bad hacks to our models otherwise. e.g. R6284 */
|
||||
cvar_set("r_fullbrightSkins", "0");
|
||||
|
@ -108,7 +108,7 @@ somewhere in csprogs.dat to ensure their resources are reloaded properly.
|
|||
void
|
||||
CSQC_RendererRestarted(string rstr)
|
||||
{
|
||||
print("--------- Reloading Graphical Resources ----------\n");
|
||||
InitStart();
|
||||
|
||||
/* Fonts */
|
||||
Font_Load("fonts/font16.font", FONT_16);
|
||||
|
@ -146,8 +146,7 @@ CSQC_RendererRestarted(string rstr)
|
|||
g_shellchromeshader = shaderforname("shellchrome", sprintf("{\ndeformVertexes bulge 1.25 1.25 0\n{\nmap %s\ntcMod scroll -0.1 0.1\ntcGen environment\nrgbGen entity\n}\n}", "textures/sfx/reflection.tga"));
|
||||
g_shellchromeshader_cull = shaderforname("shellchrome2", sprintf("{\ncull back\ndeformVertexes bulge 1.5 1.5 0\n{\nmap %s\ntcMod scroll -0.1 0.1\ntcGen environment\nrgbGen entity\n}\n}", "textures/sfx/reflection.tga"));
|
||||
|
||||
/* end msg */
|
||||
print("Graphical resources reloaded\n");
|
||||
InitEnd();
|
||||
}
|
||||
|
||||
/** Always call this instead of renderscene(); !
|
||||
|
@ -548,7 +547,8 @@ ourselves if need be.
|
|||
void
|
||||
CSQC_WorldLoaded(void)
|
||||
{
|
||||
print("--------- Initializing Client World ----------\n");
|
||||
InitStart();
|
||||
|
||||
//DetailTex_Init();
|
||||
|
||||
/* Primarily for the flashlight */
|
||||
|
@ -567,11 +567,11 @@ CSQC_WorldLoaded(void)
|
|||
break;
|
||||
}
|
||||
if (strTokenized != "{") {
|
||||
print("^1[WARNING] ^7Bad entity data\n");
|
||||
NSWarning("Bad entity data");
|
||||
break;
|
||||
}
|
||||
if (!Entities_ParseLump()) {
|
||||
print("^1[WARNING] ^7Bad entity data\n");
|
||||
NSWarning("Bad entity data");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ CSQC_WorldLoaded(void)
|
|||
/* wad files will most likely have loaded now */
|
||||
DecalGroups_Precache();
|
||||
|
||||
print("Client world initialized.\n");
|
||||
InitEnd();
|
||||
}
|
||||
|
||||
/** Called when a server tells us an active entity gets removed.
|
||||
|
@ -626,12 +626,12 @@ that is the last thing that will be called.
|
|||
void
|
||||
CSQC_Shutdown(void)
|
||||
{
|
||||
print("--------- Shutting Client Game ----------\n");
|
||||
InitPrint("Shutting Client Game");
|
||||
Decal_Shutdown();
|
||||
Sentences_Shutdown();
|
||||
Titles_Shutdown();
|
||||
Sound_Shutdown();
|
||||
PropData_Shutdown();
|
||||
EFX_Shutdown();
|
||||
print("Client game shutdown.\n");
|
||||
NSLog("Client game shutdown.");
|
||||
}
|
||||
|
|
|
@ -53,16 +53,15 @@ Fade_Update (int x, int y, int w, int h)
|
|||
if (pSeat->m_iFadeActive == FALSE) {
|
||||
return;
|
||||
}
|
||||
pSeat->m_flFadeAlpha = 1.0f;
|
||||
|
||||
if (pSeat->m_flFadeStyle & EVF_FADEDROM) {
|
||||
pSeat->m_flFadeAlpha = 1.0f;
|
||||
if (pSeat->m_flFadeTime > pSeat->m_flFadeDuration) {
|
||||
pSeat->m_flFadeAlpha -= (pSeat->m_flFadeTime - pSeat->m_flFadeDuration) * (1.0 / pSeat->m_flFadeHold);
|
||||
}
|
||||
} else {
|
||||
if (pSeat->m_flFadeTime < pSeat->m_flFadeDuration) {
|
||||
pSeat->m_flFadeAlpha = pSeat->m_flFadeTime * (1.0 / pSeat->m_flFadeDuration);
|
||||
} else {
|
||||
pSeat->m_flFadeAlpha = (pSeat->m_flFadeTime - pSeat->m_flFadeDuration) * (1.0 / pSeat->m_flFadeHold);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,14 +76,14 @@ Font_Load(string strFile, font_s &fntNew)
|
|||
}
|
||||
fclose(fileFont);
|
||||
} else {
|
||||
error(sprintf("cannot load font file %s!", strFile));
|
||||
NSError("Missing file %s", strFile);
|
||||
}
|
||||
|
||||
if (!fntNew.iScaleX || !fntNew.iScaleY) {
|
||||
error(sprintf("no valid size defined for %s!", strFile));
|
||||
NSError("Invalid size defined for %s", strFile);
|
||||
}
|
||||
|
||||
print(sprintf("loaded font definition for %s\n", strFile));
|
||||
NSLog("Loaded font definition for %s", strFile);
|
||||
|
||||
if (strRenderSize != "") {
|
||||
fntNew.iID = (int)loadfont("", strFontPath, strRenderSize, -1, 0, 0);
|
||||
|
|
|
@ -14,15 +14,29 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define SHAKE_YAW_DEGREES 5.0f
|
||||
#define SHAKE_YAW_HERTZ 15.0f
|
||||
#define SHAKE_PITCH_DEGREES 5.0f
|
||||
#define SHAKE_PITCH_HERTZ 5.0f
|
||||
#define SHAKE_ROLL_DEGREES 5.0f
|
||||
#define SHAKE_ROLL_HERTZ 5.0f
|
||||
|
||||
void
|
||||
Shake_Update(NSClientPlayer pl)
|
||||
{
|
||||
if (pSeat->m_flShakeDuration > 0.0) {
|
||||
float shakeMultiplier = (pSeat->m_flShakeDuration / pSeat->m_flShakeTime);
|
||||
float sineWave1 = (sin(time * SHAKE_PITCH_HERTZ) * SHAKE_PITCH_DEGREES) * shakeMultiplier;
|
||||
float sineWave2 = (sin(time * SHAKE_YAW_HERTZ) * SHAKE_YAW_DEGREES) * shakeMultiplier;
|
||||
float sineWave3 = (sin(time * SHAKE_ROLL_HERTZ) * SHAKE_ROLL_DEGREES) * shakeMultiplier;
|
||||
vector vecShake = [0,0,0];
|
||||
vecShake[0] += random() * 3;
|
||||
vecShake[1] += random() * 3;
|
||||
vecShake[2] += random() * 3;
|
||||
pl.punchangle += (vecShake * pSeat->m_flShakeAmp) * (pSeat->m_flShakeDuration / pSeat->m_flShakeTime);
|
||||
vecShake[0] += random() * 1.5;
|
||||
vecShake[1] += random() * 1.5;
|
||||
vecShake[2] += random() * 1.5;
|
||||
vecShake[0] += sineWave1;
|
||||
vecShake[1] += sineWave2;
|
||||
vecShake[2] += sineWave3;
|
||||
pl.punchangle += (vecShake * pSeat->m_flShakeAmp) * shakeMultiplier;
|
||||
pSeat->m_flShakeDuration -= clframetime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ Sky_Update(int force)
|
|||
return;
|
||||
|
||||
localcmd(sprintf("sky \"%s\"\n", skyPath));
|
||||
print(sprintf("sky update applying %s.\n", skyPath));
|
||||
NSLog("sky update applying %s.", skyPath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,14 +121,15 @@ Titles_Init(void)
|
|||
int braced;
|
||||
int id = 0;
|
||||
|
||||
print("--------- Initializing TitlesDef ----------\n");
|
||||
InitStart();
|
||||
|
||||
Titles_Shutdown();
|
||||
|
||||
fs_titles = fopen("titles.txt", FILE_READ);
|
||||
|
||||
if (fs_titles < 0) {
|
||||
print("^1could NOT load titles.txt\n");
|
||||
NSError("missing titles.txt");
|
||||
InitEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -165,7 +166,7 @@ Titles_Init(void)
|
|||
}
|
||||
}
|
||||
|
||||
print(sprintf("read %i titleDefs (%i bytes).\n", g_titles_count, sizeof(titles_t) * g_titles_count));
|
||||
NSLog("read %i titleDefs (%i bytes).", g_titles_count, sizeof(titles_t) * g_titles_count);
|
||||
g_titles = memalloc(sizeof(titles_t) * g_titles_count);
|
||||
fseek(fs_titles, 0);
|
||||
|
||||
|
@ -256,6 +257,8 @@ Titles_Init(void)
|
|||
}
|
||||
}
|
||||
fclose(fs_titles);
|
||||
|
||||
InitEnd();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -127,6 +127,8 @@ View_ForceChange(player pl, int targetWeapon)
|
|||
View_ClearEvents();
|
||||
View_DisableViewmodel();
|
||||
View_SetMuzzleflash(0);
|
||||
m_eViewModel.frame1time = 0.0f;
|
||||
m_eViewModelL.frame1time = 0.0f;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -286,7 +288,7 @@ View_DrawViewModel(void)
|
|||
#endif
|
||||
|
||||
/* only draw the model when it's 'enabled'... */
|
||||
if (m_eViewModel.alpha != 0.0f) {
|
||||
if (m_eViewModel.IsHidden() == false) {
|
||||
setorigin(m_eViewModel, m_eViewModel.origin);
|
||||
setorigin(m_eViewModelL, m_eViewModel.origin);
|
||||
|
||||
|
@ -359,15 +361,26 @@ View_GetAnimation(void)
|
|||
void
|
||||
View_EnableViewmodel(void)
|
||||
{
|
||||
pSeat->m_eViewModel.alpha =
|
||||
pSeat->m_eViewModelL.alpha = 1.0f;
|
||||
NSRenderableEntity viewModel;
|
||||
viewModel = (NSRenderableEntity)pSeat->m_eViewModel;
|
||||
viewModel.Show();
|
||||
viewModel = (NSRenderableEntity)pSeat->m_eViewModelL;
|
||||
viewModel.Show();
|
||||
}
|
||||
|
||||
void
|
||||
View_DisableViewmodel(void)
|
||||
{
|
||||
pSeat->m_eViewModel.alpha =
|
||||
pSeat->m_eViewModelL.alpha = 0.0f;
|
||||
pSeat->m_eViewModel.frame1time =
|
||||
pSeat->m_eViewModelL.frame1time = 0.0f;
|
||||
NSRenderableEntity viewModel;
|
||||
viewModel = (NSRenderableEntity)pSeat->m_eViewModel;
|
||||
viewModel.Hide();
|
||||
viewModel = (NSRenderableEntity)pSeat->m_eViewModelL;
|
||||
viewModel.Hide();
|
||||
}
|
||||
|
||||
void
|
||||
View_SetViewmodelSkin(float skinValue)
|
||||
{
|
||||
pSeat->m_eViewModel.skin =
|
||||
pSeat->m_eViewModelL.skin = skinValue;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ Way_Init(void)
|
|||
"3.\tFlag ^1WALK^7 (2 steps)\n" \
|
||||
"4.\tFlag ^4AIM^7 (2 steps)\n" \
|
||||
"5.\tFlag ^4USE^7 (2 steps)\n" \
|
||||
"\n" \
|
||||
"6.\tFlag ^6HAZARDOUS^7 (2 steps)\n" \
|
||||
"\n" \
|
||||
"\n" \
|
||||
"9.\tBack\n";
|
||||
|
@ -293,19 +293,22 @@ WAY_FLAGS(int n)
|
|||
{
|
||||
switch (n) {
|
||||
case 1:
|
||||
localcmd("sv way linkjump\n");
|
||||
localcmd("sv way flag 2\n");
|
||||
break;
|
||||
case 2:
|
||||
localcmd("sv way linkcrouch\n");
|
||||
localcmd("sv way flag 4\n");
|
||||
break;
|
||||
case 3:
|
||||
localcmd("sv way linkwalk\n");
|
||||
localcmd("sv way flag 16\n");
|
||||
break;
|
||||
case 4:
|
||||
localcmd("sv way linkaim\n");
|
||||
localcmd("sv way flag 32\n");
|
||||
break;
|
||||
case 5:
|
||||
localcmd("sv way linkuse\n");
|
||||
localcmd("sv way flag 64\n");
|
||||
break;
|
||||
case 6:
|
||||
localcmd("sv way flag 128\n");
|
||||
break;
|
||||
case 9:
|
||||
Textmenu_Call("WAY_MENU");
|
||||
|
|
|
@ -94,7 +94,7 @@ CMap_Shoot(void)
|
|||
string strReflectcube;
|
||||
if (self.owner) {
|
||||
env_cubemap tmp = (env_cubemap) self.owner;
|
||||
print("^3Cubemap processing...\n");
|
||||
NSLog("Generating cubemap '%v' (%dx%d)", g_vecCubePos, g_dCubeSize, g_dCubeSize);
|
||||
g_vecCubePos = tmp.origin;
|
||||
g_dCubeSize = (float)tmp.m_iSize;
|
||||
|
||||
|
@ -114,7 +114,7 @@ CMap_Shoot(void)
|
|||
self.think = CMap_Check;
|
||||
self.nextthink = time + 0.25f;
|
||||
} else {
|
||||
print("^2Cubemaps done...\n");
|
||||
NSLog("Generating level cubemaps done.");
|
||||
localcmd("r_skipEnvmap 0\n");
|
||||
localcmd("vid_reload\n");
|
||||
g_iCubeProcess = FALSE;
|
||||
|
@ -161,7 +161,8 @@ CMap_Build(void)
|
|||
localcmd("r_hdr_irisadaptation 0\n");
|
||||
localcmd("r_postprocshader \"\"0\n");
|
||||
localcmd("r_skipEnvmap 1\n");
|
||||
print("^4Building cubemaps...\n");
|
||||
|
||||
NSLog("Building cubemaps...\n");
|
||||
g_eCubeCycle = spawn();
|
||||
g_eCubeCycle.owner = find(world, classname, "env_cubemap");
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ env_sound::SpawnKey(string strField, string strKey)
|
|||
int efx_alias = stoi(strKey);
|
||||
|
||||
if (efx_alias >= g_hlefx.length) {
|
||||
NSEntWarning("invalid roomtype!");
|
||||
EntWarning("invalid roomtype!");
|
||||
m_iRoomType = 0;
|
||||
} else
|
||||
m_iRoomType = EFX_Load(g_hlefx[efx_alias]);
|
||||
|
|
|
@ -67,5 +67,6 @@ cycler::Pain(void)
|
|||
} else {
|
||||
SetFrame(GetFrame() + 1);
|
||||
}
|
||||
|
||||
SetHealth(9999);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
/*!QUAKED cycler_sprite (1 0 0) (-8 -8 -8) (8 8 8)
|
||||
# OVERVIEW
|
||||
Decorative, does nothing yet.
|
||||
Decorative sprite cycler.
|
||||
|
||||
# KEYS
|
||||
- "targetname" : Name
|
||||
|
@ -24,6 +24,7 @@ Decorative, does nothing yet.
|
|||
- "killtarget" : Target to kill when triggered.
|
||||
- "angles" : Sets the pitch, yaw and roll angles of the model.
|
||||
- "model" : Model file that will be displayed by the entity.
|
||||
- "framerate" : TODO: Frame rate of the sprite, in frames per second.
|
||||
|
||||
# TRIVIA
|
||||
This entity was introduced in Half-Life (1998).
|
||||
|
|
|
@ -142,7 +142,7 @@ env_physexplosion::TriggerExplosion(void)
|
|||
physEnt = (NSPhysicsEntity)find(world, ::targetname, m_strTargetEntity);
|
||||
|
||||
if (!physEnt) {
|
||||
NSEntWarning("Target set, but not found!");
|
||||
EntWarning("Target set, but not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,22 +97,22 @@ env_render::Trigger(entity act, triggermode_t state)
|
|||
(e = find(e, ::targetname, target));) {
|
||||
NSRenderableEntity trigger = (NSRenderableEntity)e;
|
||||
|
||||
NSLog("^2env_render::^3Trigger^7: with spawnflags %d", spawnflags);
|
||||
NSLog("\tTarget: %s", target);
|
||||
EntLog("Triggering with spawnflags %d", spawnflags);
|
||||
EntLog("\tTarget: %s", target);
|
||||
if (!HasSpawnFlags(SF_NORENDERMODE)) {
|
||||
NSLog("\tMode change from %d to %d", trigger.m_iRenderMode, m_iRenderMode);
|
||||
EntLog("\tMode change from %d to %d", trigger.m_iRenderMode, m_iRenderMode);
|
||||
trigger.SetRenderMode(m_iRenderMode);
|
||||
}
|
||||
if (!HasSpawnFlags(SF_NORENDERCOLOR)) {
|
||||
NSLog("\tColor change from %v to %v", trigger.m_vecRenderColor, m_vecRenderColor);
|
||||
EntLog("\tColor change from %v to %v", trigger.m_vecRenderColor, m_vecRenderColor);
|
||||
trigger.SetRenderColor(m_vecRenderColor);
|
||||
}
|
||||
if (!HasSpawnFlags(SF_NORENDERAMT)) {
|
||||
NSLog("\tAmt change from %d to %d", trigger.m_flRenderAmt, m_flRenderAmt);
|
||||
EntLog("\tAmt change from %d to %d", trigger.m_flRenderAmt, m_flRenderAmt);
|
||||
trigger.SetRenderAmt(m_flRenderAmt);
|
||||
}
|
||||
if (!HasSpawnFlags(SF_NORENDERFX)) {
|
||||
NSLog("\tFX change from %d to %d", trigger.m_iRenderFX, m_iRenderFX);
|
||||
EntLog("\tFX change from %d to %d", trigger.m_iRenderFX, m_iRenderFX);
|
||||
trigger.SetRenderFX(m_iRenderFX);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ enumflags
|
|||
|
||||
enum
|
||||
{
|
||||
BREAKMT_GLASS,
|
||||
BREAKMT_GLASS = 0,
|
||||
BREAKMT_WOOD,
|
||||
BREAKMT_METAL,
|
||||
BREAKMT_FLESH,
|
||||
|
@ -161,9 +161,9 @@ func_breakable::func_breakable(void)
|
|||
|
||||
/* func_breakable defaults to glass */
|
||||
if (classname == "func_breakable") {
|
||||
material = 0;
|
||||
material = BREAKMT_GLASS;
|
||||
} else {
|
||||
material = 1;
|
||||
material = BREAKMT_WOOD;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,6 +176,7 @@ func_breakable::Save(float handle)
|
|||
SaveFloat(handle, "m_flExplodeRad", m_flExplodeRad);
|
||||
SaveString(handle, "m_strBreakSpawn", m_strBreakSpawn);
|
||||
SaveBool(handle, "m_bCanTouch", m_bCanTouch);
|
||||
SaveFloat(handle, "material", material);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -197,6 +198,9 @@ func_breakable::Restore(string strKey, string strValue)
|
|||
case "m_bCanTouch":
|
||||
m_bCanTouch = ReadBool(strValue);
|
||||
break;
|
||||
case "material":
|
||||
material = ReadFloat(strValue);
|
||||
break;
|
||||
default:
|
||||
super::Restore(strKey, strValue);
|
||||
}
|
||||
|
@ -207,7 +211,7 @@ func_breakable::SpawnKey(string strKey, string strValue)
|
|||
{
|
||||
switch (strKey) {
|
||||
case "material":
|
||||
material = stof(strValue);
|
||||
material = ReadFloat(strValue);
|
||||
break;
|
||||
case "explodemagnitude":
|
||||
m_flExplodeMag = stof(strValue);
|
||||
|
@ -218,7 +222,7 @@ func_breakable::SpawnKey(string strKey, string strValue)
|
|||
|
||||
if (oid >= funcbreakable_objtable.length) {
|
||||
m_strBreakSpawn = "";
|
||||
NSEntWarning("spawnobject %i out of bounds", oid);
|
||||
EntWarning("spawnobject %i out of bounds", oid);
|
||||
} else {
|
||||
m_strBreakSpawn = funcbreakable_objtable[oid];
|
||||
}
|
||||
|
@ -288,8 +292,9 @@ func_breakable::Pain(void)
|
|||
|
||||
painSound = GetSurfaceData(SURFDATA_SND_BULLETIMPACT);
|
||||
|
||||
if (painSound)
|
||||
if (painSound) {
|
||||
StartSoundDef(painSound, CHAN_VOICE, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -354,16 +359,17 @@ func_breakable::Death(void)
|
|||
vector vecDir = vectoangles(WorldSpaceCenter() - g_dmg_vecLocation);
|
||||
string sndBreak = GetSurfaceData(SURFDATA_SND_BREAK);
|
||||
string breakModel = GetPropData(PROPINFO_BREAKMODEL);
|
||||
int gibCount = (int)bound(5, vlen(size) / 10, 32);
|
||||
|
||||
if (breakModel != "")
|
||||
BreakModel_Spawn(absmin, absmax, vecDir, g_dmg_iDamage * 2.5, vlen(size) / 10, breakModel);
|
||||
BreakModel_Spawn(absmin, absmax, vecDir, g_dmg_iDamage * 2.5, gibCount, breakModel);
|
||||
else
|
||||
NSLog("func_breakable (%s) does not have a propdata break model", funcbreakable_surftable[material]);
|
||||
EntLog("func_breakable (%s) does not have a propdata break model", funcbreakable_surftable[material]);
|
||||
|
||||
if (sndBreak != "")
|
||||
StartSoundDef(sndBreak, CHAN_BODY, true);
|
||||
else
|
||||
NSLog("func_breakable (%s) does not have a surfaceproperty for break", funcbreakable_surftable[material]);
|
||||
EntLog("func_breakable (%s) does not have a surfaceproperty for break", funcbreakable_surftable[material]);
|
||||
|
||||
Disappear();
|
||||
SetTakedamage(DAMAGE_NO);
|
||||
|
|
|
@ -148,7 +148,7 @@ func_guntarget::Move(void)
|
|||
node = (path_corner)find(world, ::targetname, target);
|
||||
|
||||
if (!node) {
|
||||
NSEntWarning("node %s for %s not found!", target, targetname);
|
||||
EntWarning("node %s for %s not found!", target, targetname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ func_guntarget::NextPath(void)
|
|||
{
|
||||
path_corner node;
|
||||
|
||||
NSLog("^2func_guntarget::^3NextPath^7: Talking to current target %s... ", target);
|
||||
EntLog("Talking to current target %s... ", target);
|
||||
node = (path_corner)find(world, ::targetname, target);
|
||||
|
||||
if (!node) {
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
virtual void Save(float);
|
||||
virtual void Restore(string,string);
|
||||
virtual void Trigger(entity, triggermode_t);
|
||||
virtual void Input(entity, string, string);
|
||||
virtual void Respawn(void);
|
||||
virtual void SpawnKey(string,string);
|
||||
virtual void Spawned(void);
|
||||
|
@ -234,6 +235,21 @@ func_plat::Respawn(void)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_plat::Input(entity entityActivator, string inputName, string dataField)
|
||||
{
|
||||
switch (inputName) {
|
||||
case "GoUp":
|
||||
MoveToPosition(GetMoverPosition1(), m_flSpeed);
|
||||
break;
|
||||
case "GoDown":
|
||||
MoveToPosition(GetMoverPosition2(), m_flSpeed);
|
||||
break;
|
||||
default:
|
||||
super::Input(entityActivator, inputName, dataField);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_plat::Trigger(entity act, triggermode_t state)
|
||||
{
|
||||
|
|
|
@ -180,7 +180,7 @@ func_pushable::Respawn(void)
|
|||
if (!m_eCollBox) {
|
||||
m_eCollBox = spawn();
|
||||
m_eCollBox.classname = "func_pushable_bbox";
|
||||
m_eCollBox.solid = SOLID_BBOX;
|
||||
m_eCollBox.solid = SOLID_TRIGGER;
|
||||
m_eCollBox.owner = this;
|
||||
setsize(m_eCollBox, -(size/2) * 0.9f, (size/2) * 0.9f);
|
||||
setorigin(m_eCollBox, WorldSpaceCenter());
|
||||
|
@ -229,7 +229,7 @@ func_pushable::customphysics(void)
|
|||
if (modelindex == 0) {
|
||||
m_eCollBox.solid = SOLID_NOT;
|
||||
} else {
|
||||
m_eCollBox.solid = SOLID_BBOX;
|
||||
m_eCollBox.solid = SOLID_TRIGGER;
|
||||
}
|
||||
|
||||
wasMoving = m_bIsMoving;
|
||||
|
|
|
@ -142,10 +142,10 @@ func_trackchange::MoverStartsMoving(void)
|
|||
ourTrain.SetVelocity(GetVelocity());
|
||||
ourTrain.SetAngularVelocity(GetAngularVelocity());
|
||||
ourTrain.ScheduleThink(ClearVelocity, 100.0f);
|
||||
print(sprintf("Changing %s to have no target\n", m_strTrainName));
|
||||
print(sprintf("%v %v\n", GetVelocity(), GetAngularVelocity()));
|
||||
EntLog("Changing %s to have no target.", m_strTrainName);
|
||||
EntLog("Velocity: %v; Angular Velocity: %v", GetVelocity(), GetAngularVelocity());
|
||||
} else {
|
||||
print(sprintf("No train to go with trackchange %s\n", targetname));
|
||||
EntLog("No train to go with trackchange %S", targetname);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,13 +159,13 @@ func_trackchange::MoverFinishesMoving(void)
|
|||
ourTrain.ClearVelocity();
|
||||
|
||||
if (GetMoverState() == MOVER_POS1) {
|
||||
print(sprintf("Changing %s from %s to %s\n", m_strTrainName, m_strBottomTrack, m_strTopTrack));
|
||||
EntLog("Changing %S from %S to %S", m_strTrainName, m_strBottomTrack, m_strTopTrack);
|
||||
ourTrain.target = m_strTopTrack;
|
||||
} else {
|
||||
print(sprintf("Changing %s from %s to %s\n", m_strTrainName, m_strBottomTrack, m_strBottomTrack));
|
||||
EntLog("Changing %S from %S to %S", m_strTrainName, m_strBottomTrack, m_strBottomTrack);
|
||||
ourTrain.target = m_strBottomTrack;
|
||||
}
|
||||
} else {
|
||||
print(sprintf("No train to go with trackchange %s\n", targetname));
|
||||
EntLog("No train to go with trackchange %S", targetname);
|
||||
}
|
||||
}
|
|
@ -110,6 +110,7 @@ public:
|
|||
nonvirtual vector GetTrainPivotPoint(bool);
|
||||
|
||||
nonvirtual void RenderDebugInfo(void);
|
||||
nonvirtual bool ControlCheck(entity);
|
||||
|
||||
/* overrides */
|
||||
virtual void Blocked(entity);
|
||||
|
@ -304,14 +305,14 @@ func_tracktrain::RenderDebugInfo(void)
|
|||
|
||||
/* line to the next node forward (green) */
|
||||
if (eNode) {
|
||||
eNode = eNode.GetPathTargetEntity();
|
||||
eNode = (path_track)eNode.GetPathTargetEntity();
|
||||
if (eNode) {
|
||||
R_BeginPolygon("", 0, 0);
|
||||
R_PolygonVertex(oldNode.GetOrigin() + [0,0, m_flHeight], [0,1], [0,0.75,0], 1.0);
|
||||
R_PolygonVertex(eNode.GetOrigin() + [0,0, m_flHeight], [1,1], [0,0.75,0], 1.0);
|
||||
R_EndPolygon();
|
||||
oldNode = eNode;
|
||||
eNode = eNode.GetPathTargetEntity();
|
||||
eNode = (path_track)eNode.GetPathTargetEntity();
|
||||
|
||||
if (eNode) {
|
||||
R_BeginPolygon("", 0, 0);
|
||||
|
@ -336,7 +337,7 @@ func_tracktrain::RenderDebugInfo(void)
|
|||
oldNode = eNode;
|
||||
|
||||
if (eNode) {
|
||||
eNode = eNode.GetSelfTargetEntity();
|
||||
eNode = (path_track)eNode.GetSelfTargetEntity();
|
||||
|
||||
if (eNode) {
|
||||
/* line to the next node forward (green) */
|
||||
|
@ -346,7 +347,7 @@ func_tracktrain::RenderDebugInfo(void)
|
|||
R_EndPolygon();
|
||||
|
||||
oldNode = eNode;
|
||||
eNode = eNode.GetSelfTargetEntity();
|
||||
eNode = (path_track)eNode.GetSelfTargetEntity();
|
||||
|
||||
if (eNode) {
|
||||
R_BeginPolygon("", 0, 0);
|
||||
|
@ -674,13 +675,13 @@ func_tracktrain::PathMoveBack(void)
|
|||
flTravelTime = (vlen(vecVelocity) / travelSpeed);
|
||||
|
||||
if (flTravelTime <= 0.0) {
|
||||
NSVehicle_Log("^1func_tracktrain::^3PathMoveBack^7: Distance short, teleporting next.");
|
||||
NSVehicle_Log("^Distance short, teleporting next.");
|
||||
ScheduleThink(_PathArrivedBack, 0.0f);
|
||||
SetVelocity([1,1,1]);
|
||||
return;
|
||||
}
|
||||
|
||||
NSVehicle_Log("^1func_tracktrain::^3PathMoveBack^7: Changing velocity from '%v' to '%v'", GetVelocity(), vecVelocity);
|
||||
NSVehicle_Log("Changing velocity from '%v' to '%v'", GetVelocity(), vecVelocity);
|
||||
SetVelocity(vecVelocity * (1 / flTravelTime));
|
||||
_SoundMove();
|
||||
|
||||
|
@ -873,8 +874,6 @@ func_tracktrain::PathClear(void)
|
|||
void
|
||||
func_tracktrain::Trigger(entity act, triggermode_t state)
|
||||
{
|
||||
breakpoint();
|
||||
|
||||
switch (state) {
|
||||
case TRIG_ON:
|
||||
PathMoveForward();
|
||||
|
@ -898,7 +897,7 @@ func_tracktrain::_AfterSpawn(void)
|
|||
path_track nodeAhead;
|
||||
|
||||
/* get the first target */
|
||||
targetNode = GetTrackNodeForward();
|
||||
targetNode = (path_track)GetTrackNodeForward();
|
||||
|
||||
/* unpossible */
|
||||
if (!targetNode || HasTriggerTarget() == false) {
|
||||
|
@ -914,7 +913,7 @@ func_tracktrain::_AfterSpawn(void)
|
|||
|
||||
/* face the train towards the next target. while it may be tempting to use
|
||||
GetPathTargetEntity() here, that node may be disabled. so look manually. */
|
||||
nodeAhead = find(world, ::targetname, targetNode.target);
|
||||
nodeAhead = (path_track)find(world, ::targetname, targetNode.target);
|
||||
|
||||
/* node found. */
|
||||
if (nodeAhead) {
|
||||
|
|
|
@ -203,7 +203,7 @@ void
|
|||
func_train::SoundMove(void)
|
||||
{
|
||||
if (m_strMoveSnd) {
|
||||
Sound_Play(this, CHAN_VOICE, m_strMoveSnd);
|
||||
StartSoundDef(m_strMoveSnd, CHAN_VOICE, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ void
|
|||
func_train::SoundStop(void)
|
||||
{
|
||||
if (m_strStopSnd) {
|
||||
Sound_Play(this, CHAN_BODY, m_strStopSnd);
|
||||
StartSoundDef(m_strStopSnd, CHAN_BODY, true);
|
||||
}
|
||||
|
||||
if (m_strMoveSnd) {
|
||||
|
@ -248,7 +248,7 @@ func_train::PathMove(void)
|
|||
}
|
||||
|
||||
SoundMove();
|
||||
NSLog("Travelling at %f up/s", m_flSpeed);
|
||||
EntLog("Travelling at %f up/s", m_flSpeed);
|
||||
|
||||
SetVelocity(vecVelocity * (1 / flTravelTime));
|
||||
ScheduleThink(PathNext, flTravelTime);
|
||||
|
@ -266,9 +266,9 @@ func_train::PathDone(void)
|
|||
}
|
||||
|
||||
if (HasTargetname()) {
|
||||
NSLog("func_train (id %d, name %S): Touched base with path_corner %S", num_for_edict(this), targetname, target);
|
||||
EntLog("func_train (id %d, name %S): Touched base with path_corner %S", num_for_edict(this), targetname, target);
|
||||
} else {
|
||||
NSLog("func_train (id %d): Touched base with path_corner %S", num_for_edict(this), target);
|
||||
EntLog("func_train (id %d): Touched base with path_corner %S", num_for_edict(this), target);
|
||||
}
|
||||
|
||||
/* fire the path_corners' target */
|
||||
|
@ -290,7 +290,7 @@ func_train::PathNext(void)
|
|||
|
||||
/* a little more serious, but we don't want to break the map. */
|
||||
if (eNode == __NULL__) {
|
||||
print(sprintf("func_tracktrain (id %d) target %S does not exist.\n", num_for_edict(this), target));
|
||||
NSError("func_tracktrain (id %d) target %S does not exist.", num_for_edict(this), target);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ game_counter::Respawn(void)
|
|||
void
|
||||
game_counter::SetCount(int value)
|
||||
{
|
||||
NSLog("%s's count set to %i", targetname, value);
|
||||
EntLog("%s's count set to %i", targetname, value);
|
||||
m_iCounted = value;
|
||||
}
|
||||
|
||||
|
@ -139,13 +139,13 @@ game_counter::Trigger(entity act, triggermode_t state)
|
|||
if (GetMaster(act) == FALSE)
|
||||
return;
|
||||
|
||||
NSLog("%s's incremented by 1", targetname);
|
||||
EntLog("%s's incremented by 1", targetname);
|
||||
m_iCounted++;
|
||||
|
||||
if (m_iCounted < m_iMaxCount)
|
||||
return;
|
||||
|
||||
NSLog("%s's triggering %s", targetname, target);
|
||||
EntLog("%s's triggering %s", targetname, target);
|
||||
//print(sprintf("%s %s %i %i\n", classname, targetname, m_iCounted, m_iMaxCount ));
|
||||
//error(sprintf("%s %i %i\n", act.classname, m_iCounted, m_iMaxCount ));
|
||||
UseTargets(act, TRIG_TOGGLE, m_flDelay);
|
||||
|
|
|
@ -101,7 +101,7 @@ game_counter_set::Trigger(entity act, triggermode_t state)
|
|||
if (GetMaster(act) == FALSE)
|
||||
return;
|
||||
|
||||
NSLog("%s's manipulating %s to be %i", targetname, target, m_iCount);
|
||||
EntLog("%s's manipulating %s to be %i", targetname, target, m_iCount);
|
||||
|
||||
/* apply the value to all the relevant game_counter entities */
|
||||
for (entity f = world; (f = find(f, ::targetname, target));) {
|
||||
|
|
|
@ -139,8 +139,7 @@ game_player_equip::SpawnUnit(string cname, vector org)
|
|||
unit.nextthink = time;
|
||||
unit.real_owner = this;
|
||||
setorigin(unit, org);
|
||||
NSLog("^2game_player_equip::^3Trigger^7: Spawning %s",
|
||||
cname);
|
||||
EntLog("Spawning %s", cname);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -150,7 +149,7 @@ game_player_equip::Trigger(entity act, triggermode_t state)
|
|||
string cname;
|
||||
|
||||
if (!(act.flags & FL_CLIENT)) {
|
||||
print("^1game_player_equip^7::^1Trigger: Activator not a client!\n");
|
||||
EntError("Activator %S not a client!", act.classname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ game_player_team::Trigger(entity entityActivator, triggermode_t state)
|
|||
toRead = (game_team_master)GetTargetEntity();
|
||||
|
||||
if (!toRead) {
|
||||
NSEntWarning("Unable to find game_team_master named %S", GetTriggerTarget());
|
||||
EntWarning("Unable to find game_team_master named %S", GetTriggerTarget());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ game_team_set::Trigger(entity activatorEntity, triggermode_t state)
|
|||
toChange = (game_team_master)GetTargetEntity();
|
||||
|
||||
if (!toChange) {
|
||||
NSEntWarning("Unable to find game_team_master named %S", GetTriggerTarget());
|
||||
EntWarning("Unable to find game_team_master named %S", GetTriggerTarget());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ logic_auto::Processing(void)
|
|||
UseOutput(this, m_strOnBackgroundMap);
|
||||
|
||||
if (HasSpawnFlags(LOGICAUTO_USEONCE)) {
|
||||
NSLog("^2logic_auto::^3Processing ^7: %s triggerer removed self", target);
|
||||
EntLog("%S triggerer removed self", target);
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -491,13 +491,13 @@ logic_case::Input(entity activatorEntity, string inputName, string dataField)
|
|||
void
|
||||
logic_case::PickRandom(entity activatorEntity)
|
||||
{
|
||||
NSEntWarning("Not implemented.");
|
||||
EntWarning("Not implemented.");
|
||||
}
|
||||
|
||||
void
|
||||
logic_case::PickRandomShuffle(entity activatorEntity)
|
||||
{
|
||||
NSEntWarning("Not implemented.");
|
||||
EntWarning("Not implemented.");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -243,13 +243,13 @@ logic_timer::Input(entity activatorEntity, string inputName, string dataField)
|
|||
if (nextthink <= 0.0)
|
||||
nextthink += stof(dataField);
|
||||
else
|
||||
NSEntWarning("AddToTimer when inactive!");
|
||||
EntWarning("AddToTimer when inactive!");
|
||||
break;
|
||||
case "SubtractFromTimer":
|
||||
if (nextthink <= 0.0)
|
||||
nextthink -= stof(dataField);
|
||||
else
|
||||
NSEntWarning("SubtractFromTimer when inactive!");
|
||||
EntWarning("SubtractFromTimer when inactive!");
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
11
src/gs-entbase/server/math_counter.qc
Normal file
11
src/gs-entbase/server/math_counter.qc
Normal file
|
@ -0,0 +1,11 @@
|
|||
class
|
||||
math_counter:NSPointTrigger
|
||||
{
|
||||
void math_counter(void);
|
||||
};
|
||||
|
||||
void
|
||||
math_counter::math_counter(void)
|
||||
{
|
||||
|
||||
}
|
|
@ -168,35 +168,13 @@ monstermaker::TurnOff(void)
|
|||
void
|
||||
monstermaker::TurnOn(void)
|
||||
{
|
||||
ScheduleThink(Spawner, m_flDelay);
|
||||
ScheduleThink(Spawner, 0.0f);
|
||||
m_iValue = 1;
|
||||
}
|
||||
|
||||
void
|
||||
monstermaker::Spawner(void)
|
||||
{
|
||||
static void monstermaker_spawnunit(void) {
|
||||
/* these will get overwritten by the monster spawnfunction */
|
||||
vector neworg = self.origin;
|
||||
vector newang = self.angles;
|
||||
string tname = self.netname;
|
||||
|
||||
/* prevent us from being deleted by callfunction() */
|
||||
self.spawnflags |= MSF_MULTIPLAYER;
|
||||
|
||||
/* become the classname assigned */
|
||||
NSMonster t = (NSMonster)self;
|
||||
callfunction(self.classname);
|
||||
|
||||
/* apply the saved values back */
|
||||
t.origin = t.m_oldOrigin = neworg;
|
||||
t.angles = t.m_oldAngle = newang;
|
||||
t.targetname = tname;
|
||||
|
||||
/* spawn anew */
|
||||
t.Respawn();
|
||||
}
|
||||
|
||||
int c = 0;
|
||||
|
||||
/* look and count the buggers that are still around */
|
||||
|
@ -222,32 +200,33 @@ monstermaker::Spawner(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (isfunction(strcat("spawnfunc_", m_strMonster))) {
|
||||
entity unit = spawn();
|
||||
unit.classname = strcat("spawnfunc_", m_strMonster);
|
||||
unit.netname = m_strChildName;
|
||||
unit.think = monstermaker_spawnunit;
|
||||
unit.nextthink = time + 0.1f;
|
||||
unit.real_owner = this;
|
||||
NSLog("^2monstermaker::^3Trigger^7: Spawning %s", m_strMonster);
|
||||
setorigin(unit, origin);
|
||||
unit.angles = angles;
|
||||
m_iMonsterSpawned++;
|
||||
NSEntity unit = Entity_CreateClass(m_strMonster);
|
||||
|
||||
if (target) {
|
||||
UseTargets(this, TRIG_TOGGLE, 0.0f);
|
||||
}
|
||||
|
||||
/* inherit the monsterclip flag */
|
||||
if (HasSpawnFlags(MMF_MONSTERCLIP)) {
|
||||
unit.spawnflags |= MSF_MONSTERCLIP;
|
||||
}
|
||||
} else {
|
||||
NSLog("^1monstermaker::^3Trigger^7: cannot call spawnfunction for %s", m_strMonster);
|
||||
if (!unit) {
|
||||
EntError("Cannot call spawnfunction for %s", m_strMonster);
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
unit.real_owner = this;
|
||||
EntLog("Spawning %s", m_strMonster);
|
||||
unit.SetOrigin(GetOrigin());
|
||||
unit.SetAngles(GetAngles());
|
||||
unit.m_oldOrigin = GetOrigin();
|
||||
unit.m_oldAngle = GetAngles();
|
||||
unit.targetname = m_strChildName;
|
||||
|
||||
m_iMonsterSpawned++;
|
||||
|
||||
if (target) {
|
||||
UseTargets(this, TRIG_TOGGLE, 0.0f);
|
||||
}
|
||||
|
||||
/* inherit the monsterclip flag */
|
||||
if (HasSpawnFlags(MMF_MONSTERCLIP)) {
|
||||
unit.spawnflags |= MSF_MONSTERCLIP;
|
||||
}
|
||||
|
||||
/* shut off for good when we've spawned all we ever wanted */
|
||||
if ((m_iTotalMonsters > 0) && m_iMonsterSpawned >= m_iTotalMonsters) {
|
||||
ReleaseThink();
|
||||
|
|
|
@ -294,8 +294,8 @@ multi_manager::Trigger(entity act, triggermode_t state)
|
|||
|
||||
entity eFind = find(world, ::targetname, wow.target);
|
||||
|
||||
NSLog("^2%s::^3Trigger^7: %s (%s)",
|
||||
this.classname, wow.target, eFind.classname);
|
||||
EntLog("Triggering %S (%S)",
|
||||
wow.target, eFind.classname);
|
||||
|
||||
wow.m_iValue = TRUE;
|
||||
UseTargets(wow.m_eActivator, TRIG_TOGGLE, 0.0f);
|
||||
|
|
|
@ -57,12 +57,12 @@ void
|
|||
multisource::Trigger(entity act, triggermode_t unused)
|
||||
{
|
||||
if (QueryTargets() == FALSE) {
|
||||
NSLog("[^1MULTISOURCE^7] %s is inactive.", targetname);
|
||||
EntLog("[^1MULTISOURCE^7] %s is inactive.", targetname);
|
||||
m_iValue = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog("[^1MULTISOURCE^7] %s is now active.", targetname);
|
||||
EntLog("[^1MULTISOURCE^7] %s is now active.", targetname);
|
||||
m_iValue = TRUE;
|
||||
UseTargets(act, TRIG_TOGGLE, m_flDelay);
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ void
|
|||
path_corner::PathPassTrigger(entity activatingEntity, triggermode_t triggerMode)
|
||||
{
|
||||
if (HasSpawnFlags(PC_FIREONCE) && m_iFired) {
|
||||
NSLog("path_corner (%s) can only fire its targets once", targetname);
|
||||
EntLog("tried to fire more than once");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -240,9 +240,7 @@ path_corner::PathPassTrigger(entity activatingEntity, triggermode_t triggerMode)
|
|||
for (entity f = world; (f = find(f, ::targetname, m_strMessage));) {
|
||||
NSTrigger trigger = (NSTrigger)f;
|
||||
|
||||
NSLog("^2%s::^3PathPassTrigger^7:" \
|
||||
"Triggering %s `%s` from %s", \
|
||||
classname, f.classname, \
|
||||
EntLog("Triggering %s `%s` from %s", f.classname, \
|
||||
trigger.targetname, activatingEntity.classname);
|
||||
|
||||
if (trigger.Trigger != __NULL__) {
|
||||
|
|
|
@ -270,10 +270,7 @@ path_track::PathEndTrigger(entity activatingEntity, triggermode_t triggerMode)
|
|||
for (entity f = world; (f = find(f, ::targetname, m_strEndTrigger));) {
|
||||
NSTrigger trigger = (NSTrigger)f;
|
||||
|
||||
NSLog("^2%s::^3PathEndTrigger^7:" \
|
||||
"Triggering %s `%s` from %s", \
|
||||
classname, f.classname, \
|
||||
trigger.targetname, activatingEntity.classname);
|
||||
EntLog("Triggering %S %S from %S", f.classname, trigger.targetname, activatingEntity.classname);
|
||||
|
||||
if (trigger.Trigger != __NULL__) {
|
||||
trigger.Trigger(activatingEntity, triggerMode);
|
||||
|
|
|
@ -149,7 +149,7 @@ phys_convert::ConvertTarget(entity activatorEnt)
|
|||
NSPhysicsEntity new;
|
||||
|
||||
if (!targetEnt) {
|
||||
NSEntWarning("Cannot find target to convert.");
|
||||
EntWarning("Cannot find target to convert.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ prop_door_rotating::Turn(vector vecDest, void(void) vFunc)
|
|||
float flTravelLength, flTravelTime;
|
||||
|
||||
if (!m_flSpeed) {
|
||||
NSLog("^1prop_door_rotating::^3RotToDest^7: No speed defined for %s!", targetname);
|
||||
EntError("No speed defined for %s!", targetname);
|
||||
prop_door_rotating::Respawn();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -173,19 +173,13 @@ random_speaker::Enable(void)
|
|||
r += (m_flMinPos * (m_flRandPercent / 100)) * random();
|
||||
|
||||
ScheduleThink(PlaySample, r);
|
||||
|
||||
NSLog("^2random_speaker::^3Disable^7: " \
|
||||
"%s playing %s in %d\n", \
|
||||
targetname, m_strSample, r);
|
||||
EntLog("%s playing %s in %d\n", targetname, m_strSample, r);
|
||||
}
|
||||
|
||||
void
|
||||
random_speaker::Disable(void)
|
||||
{
|
||||
NSLog("^2random_speaker::^3Disable^7: " \
|
||||
"Disabled %s playing %s\n", \
|
||||
targetname, m_strSample);
|
||||
|
||||
EntLog("Disabled %s playing %s\n", targetname, m_strSample);
|
||||
m_iValue = 0;
|
||||
ReleaseThink();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,14 @@ world. It'll enable mouth flapping and all sorts of other cool effects.
|
|||
- "pitch" : Desired sound pitch. May be overridden in the titles.txt entry.
|
||||
- "delay" : Delay before it'll be triggered? UNUSED RIGHT NOW.
|
||||
- "wait" : Delay before it can be triggered again? UNUSED RIGHT NOW.
|
||||
- "listener" : The name of the entity we'll look at when speaking. Can be "player".
|
||||
|
||||
# INPUTS
|
||||
- "BeginSentence" : Starts the sentence.
|
||||
|
||||
# OUTPUTS
|
||||
- "OnBeginSentence" : Fired when the sentence starts.
|
||||
- "OnEndSentence" : Fired when the sentence ends.
|
||||
|
||||
# TRIVIA
|
||||
This entity was introduced in Half-Life (1998).
|
||||
|
@ -39,18 +47,26 @@ public:
|
|||
void scripted_sentence(void);
|
||||
|
||||
/* overrides */
|
||||
virtual void Spawned(void);
|
||||
virtual void Save(float);
|
||||
virtual void Restore(string,string);
|
||||
virtual void SpawnKey(string,string);
|
||||
virtual void Trigger(entity, triggermode_t);
|
||||
virtual void Input(entity, string, string);
|
||||
|
||||
nonvirtual void SentenceEnded(void);
|
||||
|
||||
private:
|
||||
string m_strSpeaker;
|
||||
string m_strSentence;
|
||||
int m_iSentenceID;
|
||||
float m_flDelay;
|
||||
float m_flWait;
|
||||
float m_flPitch;
|
||||
float m_flDuration;
|
||||
string m_strListener;
|
||||
string m_strOnBeginSentence;
|
||||
string m_strOnEndSentence;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -62,6 +78,23 @@ scripted_sentence::scripted_sentence(void)
|
|||
m_flWait = 0.0f;
|
||||
m_flPitch = 0.0f;
|
||||
m_flDuration = 0.0f;
|
||||
m_strListener = __NULL__;
|
||||
m_strOnBeginSentence = __NULL__;
|
||||
m_strOnEndSentence = __NULL__;
|
||||
m_iSentenceID = 0i;
|
||||
}
|
||||
|
||||
void
|
||||
scripted_sentence::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
|
||||
m_iSentenceID = Sentences_GetID(m_strSentence);
|
||||
|
||||
if (m_strOnBeginSentence)
|
||||
m_strOnBeginSentence = CreateOutput(m_strOnBeginSentence);
|
||||
if (m_strOnEndSentence)
|
||||
m_strOnEndSentence = CreateOutput(m_strOnEndSentence);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -74,6 +107,10 @@ scripted_sentence::Save(float handle)
|
|||
SaveFloat(handle, "m_flWait", m_flWait);
|
||||
SaveFloat(handle, "m_flPitch", m_flPitch);
|
||||
SaveFloat(handle, "m_flDuration", m_flDuration);
|
||||
SaveString(handle, "m_strListener", m_strListener);
|
||||
SaveString(handle, "m_strOnBeginSentence", m_strOnBeginSentence);
|
||||
SaveString(handle, "m_strOnEndSentence", m_strOnEndSentence);
|
||||
SaveInt(handle, "m_iSentenceID", m_iSentenceID);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -98,35 +135,74 @@ scripted_sentence::Restore(string strKey, string strValue)
|
|||
case "m_flDuration":
|
||||
m_flDuration = ReadFloat(strValue);
|
||||
break;
|
||||
case "m_strListener":
|
||||
m_strListener = ReadString(strValue);
|
||||
break;
|
||||
case "m_strOnBeginSentence":
|
||||
m_strOnBeginSentence = ReadString(strValue);
|
||||
break;
|
||||
case "m_strOnEndSentence":
|
||||
m_strOnEndSentence = ReadString(strValue);
|
||||
break;
|
||||
case "m_iSentenceID":
|
||||
m_iSentenceID = ReadInt(strValue);
|
||||
break;
|
||||
default:
|
||||
super::Restore(strKey, strValue);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
scripted_sentence::SpawnKey(string strKey, string strValue)
|
||||
scripted_sentence::SpawnKey(string keyName, string setValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
switch (keyName) {
|
||||
case "entity":
|
||||
m_strSpeaker = strValue;
|
||||
m_strSpeaker = setValue;
|
||||
break;
|
||||
case "sentence":
|
||||
m_strSentence = strtoupper(strValue);
|
||||
m_strSentence = strtoupper(setValue);
|
||||
break;
|
||||
case "pitch":
|
||||
m_flPitch = stof(strValue);
|
||||
m_flPitch = ReadFloat(setValue);
|
||||
break;
|
||||
case "duration":
|
||||
m_flDuration = stof(strValue);
|
||||
m_flDuration = ReadFloat(setValue);
|
||||
break;
|
||||
case "wait":
|
||||
m_flWait = stof(strValue);
|
||||
m_flWait = ReadFloat(setValue);
|
||||
break;
|
||||
case "listener":
|
||||
m_strListener = ReadString(setValue);
|
||||
break;
|
||||
case "OnBeginSentence":
|
||||
m_strOnBeginSentence = ReadString(setValue);
|
||||
break;
|
||||
case "OnEndSentence":
|
||||
m_strOnEndSentence = ReadString(setValue);
|
||||
break;
|
||||
default:
|
||||
super::SpawnKey(strKey, strValue);
|
||||
super::SpawnKey(keyName, setValue);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
scripted_sentence::Input(entity entityActivator, string inputName, string dataField)
|
||||
{
|
||||
switch (inputName) {
|
||||
case "BeginSentence":
|
||||
Trigger(entityActivator, TRIG_TOGGLE);
|
||||
break;
|
||||
default:
|
||||
super::Input(entityActivator, inputName, dataField);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
scripted_sentence::SentenceEnded(void)
|
||||
{
|
||||
UseOutput(this, m_strOnEndSentence);
|
||||
}
|
||||
|
||||
void
|
||||
scripted_sentence::Trigger(entity act, triggermode_t unused)
|
||||
{
|
||||
|
@ -150,19 +226,32 @@ scripted_sentence::Trigger(entity act, triggermode_t unused)
|
|||
}
|
||||
|
||||
if (!spe) {
|
||||
print(sprintf("^1scripted_sentence::^3Trigger^7: Couldn't find %s!\n", m_strSpeaker));
|
||||
NSError("Couldn't find %s!\n", m_strSpeaker);
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog("^2scripted_sentence::^3Trigger^7: %s on %s", m_strSentence, m_strSpeaker);
|
||||
EntLog("%s on %s", m_strSentence, m_strSpeaker);
|
||||
|
||||
NSTalkMonster npc = (NSTalkMonster)spe;
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_SENTENCE);
|
||||
WriteEntity(MSG_MULTICAST, npc);
|
||||
WriteInt(MSG_MULTICAST, Sentences_GetID(m_strSentence));
|
||||
WriteInt(MSG_MULTICAST, m_iSentenceID);
|
||||
msg_entity = npc;
|
||||
multicast(npc.origin, MULTICAST_PVS);
|
||||
npc.m_flNextSentence = time + m_flDuration;
|
||||
UseTargets(act, TRIG_TOGGLE, m_flDelay);
|
||||
|
||||
/* I/O */
|
||||
/* Uncertain: Are we triggering the output on behalf of someone maybe? */
|
||||
UseOutput(this, m_strOnBeginSentence);
|
||||
ScheduleThink(SentenceEnded, m_flDuration);
|
||||
|
||||
if (m_strListener) {
|
||||
if (m_strListener == "player") {
|
||||
npc.m_eLookAt = find(world, ::classname, "player");
|
||||
} else {
|
||||
npc.m_eLookAt = find(world, ::targetname, m_strListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ This entity was introduced in Quake (1996).
|
|||
*/
|
||||
|
||||
CLASSEXPORT(info_target, info_notnull)
|
||||
CLASSEXPORT(env_sound, info_notnull)
|
||||
CLASSEXPORT(env_sun, info_notnull)
|
||||
CLASSEXPORT(env_sound, info_null)
|
||||
CLASSEXPORT(env_sun, info_null)
|
||||
CLASSEXPORT(info_intermission, info_notnull)
|
||||
|
||||
CLASSEXPORT(prop_static, info_null)
|
||||
|
|
|
@ -110,9 +110,7 @@ target_cdaudio::Touch(entity eToucher)
|
|||
return;
|
||||
}
|
||||
|
||||
NSLog("^2target_cdaudio::^3Trigger^7: CD Track %i requested",
|
||||
m_iCDTrack);
|
||||
|
||||
EntLog(" CD Track %i requested", m_iCDTrack);
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_MUSICTRACK);
|
||||
WriteByte(MSG_MULTICAST, m_iCDTrack);
|
||||
|
|
|
@ -114,8 +114,9 @@ trigger_auto::Respawn(void)
|
|||
/* deliberately add a bit more time in case we're first in the ent-lump
|
||||
also we'll only do this in multiplayer games. SP games will call
|
||||
trigger_auto_trigger() for when one player has fully joined */
|
||||
if (cvar("sv_playerslots") > 1)
|
||||
if (cvar("sv_playerslots") > 1) {
|
||||
ScheduleThink(Processing, 0.25f);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -130,7 +131,7 @@ trigger_auto::Processing(void)
|
|||
//print(sprintf("%S %d %f %f\n", target, m_iTriggerState, m_flDelay, time));
|
||||
|
||||
if (HasSpawnFlags(1)) {
|
||||
NSLog("^2trigger_auto::^3Processing^7: %s triggerer removed self", target);
|
||||
EntLog("Trigger instructed to destroy itself.");
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,8 +99,7 @@ trigger_autosave::Touch(entity eToucher)
|
|||
msg_entity = this;
|
||||
multicast(origin, MULTICAST_ALL);
|
||||
|
||||
NSLog("^2trigger_autosave::^3Touch^7: %s called autosave",
|
||||
eToucher.netname);
|
||||
EntLog("%S called autosave", eToucher.netname);
|
||||
|
||||
localcmd("save autosave\n");
|
||||
SetSolid(SOLID_NOT);
|
||||
|
|
|
@ -94,8 +94,7 @@ trigger_cdaudio::Trigger(entity act, triggermode_t unused)
|
|||
return;
|
||||
}
|
||||
|
||||
NSLog("^2trigger_cdaudio::^3Trigger^7: CD Track %i requested",
|
||||
m_iCDTrack);
|
||||
EntLog("CD Track %i requested", m_iCDTrack);
|
||||
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_MUSICTRACK);
|
||||
|
|
|
@ -94,10 +94,16 @@ to define a shared point and a transition area for entities respectively.
|
|||
- TRIGGER_ONLY (2) : Can't activate through touching, only via triggers.
|
||||
|
||||
# NOTES
|
||||
When a Landmark is specified, you will have to position two info_landmark
|
||||
When a `landmark` is specified, you will have to position two info_landmark
|
||||
entities across your two levels with the same name. They'll mark a translation
|
||||
point for the coordinates in your levels.
|
||||
|
||||
If you have set a landmark, you might also want to restrict the area in which entities get carried across to the next level. This is accomplished by placing a trigger_transition volume with the same name as the specified `landmark`.
|
||||
|
||||
If you do not make use of the trigger_transition entity, it will carry over all of the entities that are in the same PVS (room and attached hallways) of the info_landmark.
|
||||
|
||||
The PVS-culling method can prove difficult to work with. Developers have been spotted using 'killtarget' on entities before level transitions take place to manually filter through them (Half-Life's c1a0e - c1a0c).
|
||||
|
||||
# TRIVIA
|
||||
This entity was introduced in Quake (1996).
|
||||
*/
|
||||
|
@ -250,10 +256,8 @@ trigger_changelevel::Change(void)
|
|||
|
||||
/* standard level change */
|
||||
if (!m_strLandmark) {
|
||||
NSLog("^2trigger_changelevel::^3Change^7: Change to `%s`",
|
||||
m_strMap);
|
||||
EntLog("Change to %S", m_strMap);
|
||||
parm_string = m_strChangeTarget;
|
||||
trigger_transition_pvsfallback(this);
|
||||
changelevel(m_strMap);
|
||||
return;
|
||||
}
|
||||
|
@ -286,13 +290,13 @@ trigger_changelevel::Change(void)
|
|||
info_landmark lm = (info_landmark)e;
|
||||
/* found it */
|
||||
if (lm.targetname == m_strLandmark) {
|
||||
NSLog("^2trigger_changelevel::^3Change^7: Found landmark for %s", m_strLandmark);
|
||||
EntLog("Found landmark for %S", m_strLandmark);
|
||||
g_landmarkpos = m_activator.origin - lm.origin;
|
||||
|
||||
if (transitionHelper) {
|
||||
transitionHelper.SaveTransition(__NULL__, false);
|
||||
} else {
|
||||
trigger_transition_pvsfallback(this);
|
||||
trigger_transition_pvsfallback(lm);
|
||||
}
|
||||
|
||||
changelevel(m_strMap, m_strLandmark);
|
||||
|
@ -361,7 +365,7 @@ Landmark_GetSpot(void)
|
|||
|
||||
/* return something useful at least */
|
||||
entity ips = find(world, ::classname, "info_player_start");
|
||||
print(sprintf("^1ERROR^7: Landmark_GetSpot: Cannot find startspot '%s'!\n",startspot));
|
||||
NSError("Cannot find startspot %S!\n", startspot);
|
||||
return ips.origin;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,8 +86,7 @@ trigger_changetarget::Trigger(entity act, triggermode_t state)
|
|||
|
||||
for (f = __NULL__; (f = (NSEntity)find(f, ::targetname, target));) {
|
||||
|
||||
NSLog("^2trigger_changetarget::^3Trigger^7: " \
|
||||
"Changing %s (%s) target from '%s' to '%s'\n", \
|
||||
EntLog("Changing %s (%s) target from '%s' to '%s'\n", \
|
||||
target, f.classname, f.target, target);
|
||||
|
||||
/* now change the target */
|
||||
|
|
|
@ -116,9 +116,7 @@ trigger_counter::Trigger(entity act, triggermode_t state)
|
|||
|
||||
m_iCounted++;
|
||||
|
||||
NSLog("^2trigger_counter::^3Trigger^7: " \
|
||||
"Incremented '%s' by 1 (%i/%i)\n", \
|
||||
targetname, m_iCounted, m_iMaxCount);
|
||||
EntLog("Incremented '%s' by 1 (%i/%i)\n", targetname, m_iCounted, m_iMaxCount);
|
||||
|
||||
if (m_iCounted < m_iMaxCount)
|
||||
return;
|
||||
|
|
|
@ -266,11 +266,9 @@ trigger_hurt::Touch(entity eToucher)
|
|||
type |= DMG_CHEMICAL;
|
||||
}
|
||||
|
||||
EntLog("Hurting %S (%d) with %i.", eToucher.classname, num_for_edict(eToucher), m_iDamage);
|
||||
Damage_Apply(eToucher, this, m_iDamage, 0, type);
|
||||
|
||||
NSLog("^2trigger_hurt::^3Touch^7: Hurting '%s' with %i",
|
||||
eToucher.netname, m_iDamage);
|
||||
|
||||
/* shut it down if used once */
|
||||
if (HasSpawnFlags(SF_HURT_ONCE)) {
|
||||
Trigger(eToucher, TRIG_OFF);
|
||||
|
|
|
@ -169,7 +169,7 @@ trigger_look::Touch(entity eToucher)
|
|||
/* find the looktarget */
|
||||
lt = find(world, ::targetname, m_strLookTarget);
|
||||
if (!lt) {
|
||||
NSLog("^1trigger_look:Touch^7: Invalid m_strLookTarget %s!", m_strLookTarget);
|
||||
EntLog("^1trigger_look:Touch^7: Invalid m_strLookTarget %s!", m_strLookTarget);
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -187,11 +187,11 @@ trigger_once::Touch(entity eToucher)
|
|||
m_iValue = 1;
|
||||
|
||||
if (!target && !m_strKillTarget) {
|
||||
NSLog("^2trigger_once::^3Touch^7: %S is triggering OnStartTouch", eToucher.classname);
|
||||
EntLog("%S is triggering OnStartTouch", eToucher.classname);
|
||||
UseOutput(eToucher, m_strOnStartTouch);
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog("^2trigger_once::^3Touch^7: %S is triggering %S", eToucher.classname, target);
|
||||
EntLog("%S is triggering %S", eToucher.classname, target);
|
||||
UseTargets(eToucher, TRIG_TOGGLE, m_flDelay);
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ void
|
|||
trigger_relay::Trigger(entity act, triggermode_t state)
|
||||
{
|
||||
if (m_iEnabled == FALSE) {
|
||||
NSLog("trigger_relay (%s) has already been triggered", targetname);
|
||||
EntLog("trigger_relay (%s) has already been triggered", targetname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -125,6 +125,6 @@ trigger_relay::Trigger(entity act, triggermode_t state)
|
|||
}
|
||||
|
||||
m_iValue = TRUE;
|
||||
NSLog("trigger_relay (%s) will trigger %s with state %d", targetname, target, m_iTriggerState);
|
||||
EntLog("trigger_relay (%s) will trigger %s with state %d", targetname, target, m_iTriggerState);
|
||||
UseTargets(act, m_iTriggerState, m_flDelay);
|
||||
}
|
||||
|
|
|
@ -253,11 +253,9 @@ trigger_teleport::Touch(entity eToucher)
|
|||
Sound_Play(eTarget, CHAN_VOICE, m_sndTeleportExit);
|
||||
}
|
||||
|
||||
NSLog("^2trigger_teleport::^3Touch^7: Teleported '%s' to `%v`",
|
||||
eToucher.netname, endpos);
|
||||
EntLog("Teleported %S to %v", eToucher.netname, endpos);
|
||||
} else {
|
||||
print(sprintf("^2trigger_teleport::^3Touch^7: Failed to teleport '%s'\n",
|
||||
eToucher.netname));
|
||||
EntWarning("Failed to teleport %S", eToucher.netname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,6 @@ All entities touching this volume will carry across to the next level.
|
|||
# NOTES
|
||||
In order for this entity to work, one has to assign a working info_landmark entity to a trigger_changelevel, and give this entity the same targetname as said landmark.
|
||||
|
||||
In GoldSrc games, it appears that every point-entity that's part of the current PVS (mostly the 'room' and attached path-ways you're currently in) carries over to the next level - if a trigger_transition is not defined.
|
||||
This is probably not what you want to ever do, especially in large outdoor maps where the 'room' is the entire map.
|
||||
|
||||
You can also have more than one trigger_transition with the same name, so if any entity is in any of them they will move with the player across the desired level.
|
||||
|
||||
# TRIVIA
|
||||
This entity was introduced in Half-Life (1998).
|
||||
*/
|
||||
|
@ -72,17 +67,25 @@ trigger_transition::SaveTransition(entity pvsTest, bool usePVS)
|
|||
/* loop through all entities */
|
||||
for (NSEntity a = __NULL__; (a = (NSEntity)findfloat(a, ::identity, 1));) {
|
||||
bool replicateEntity = false;
|
||||
bool continueInNextMap = false;
|
||||
|
||||
/* no classname? never allow */
|
||||
if not (a.classname) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//print(sprintf("TRANSITION: %i %S %S\n", i, a.classname, a.m_strGlobalName));
|
||||
|
||||
/* if we're using the PVS, don't use the transition trigger as reference */
|
||||
if (usePVS == true && !a.m_strGlobalName) {
|
||||
if (checkpvs(a.origin, pvsTest) == true) {
|
||||
/* if we're using the PVS, use the info_landmark as a reference */
|
||||
if (usePVS == true) {
|
||||
if (checkpvs(pvsTest.origin, a) == true) {
|
||||
replicateEntity = true;
|
||||
|
||||
/* these checks are somewhat safe assumptions. */
|
||||
if (a.classname == "player") {
|
||||
replicateEntity = false;
|
||||
}
|
||||
|
||||
if (a.classname == "info_landmark") {
|
||||
replicateEntity = false;
|
||||
}
|
||||
|
@ -90,23 +93,31 @@ trigger_transition::SaveTransition(entity pvsTest, bool usePVS)
|
|||
/* to get rid of the 'out of model slots' error */
|
||||
if (a.model == "" && solid != SOLID_NOT) {
|
||||
replicateEntity = false;
|
||||
}
|
||||
|
||||
/* one thing is verified in GoldSrc: no brushes carry over. */
|
||||
if (a.m_bIsBrush == true) {
|
||||
continue;
|
||||
continueInNextMap = false;
|
||||
}
|
||||
}
|
||||
} else if (WithinBounds(a) == true) {
|
||||
replicateEntity = true;
|
||||
}
|
||||
|
||||
/* only carry brushes with a global name */
|
||||
if (a.m_bIsBrush == true) {
|
||||
replicateEntity = false;
|
||||
continueInNextMap = false;
|
||||
}
|
||||
|
||||
/* global name = always find target in next map */
|
||||
if (a.m_strGlobalName) {
|
||||
continueInNextMap = true;
|
||||
replicateEntity = false;
|
||||
}
|
||||
|
||||
if (replicateEntity == true) {
|
||||
fputs(transFile, sprintf("ENTITY \"%i\" %S\n", i, a.classname));
|
||||
fputs(transFile, "{\n");
|
||||
a.Save(transFile);
|
||||
fputs(transFile, "}\n");
|
||||
} else if (a.m_strGlobalName) {
|
||||
} else if (continueInNextMap == true) {
|
||||
fputs(transFile, sprintf("CONTINUE \"%i\" %S\n", i, a.m_strGlobalName));
|
||||
fputs(transFile, "{\n");
|
||||
a.Save(transFile);
|
||||
|
@ -129,11 +140,14 @@ trigger_transition::FindCarrierEntity(string globalName)
|
|||
return a;
|
||||
}
|
||||
}
|
||||
return __NULL__;
|
||||
|
||||
return (__NULL__);
|
||||
}
|
||||
|
||||
vector Landmark_GetPosition(void);
|
||||
|
||||
|
||||
|
||||
void
|
||||
trigger_transition::LoadTransition(void)
|
||||
{
|
||||
|
@ -144,10 +158,10 @@ trigger_transition::LoadTransition(void)
|
|||
filestream transFile = fopen("trans.dat", FILE_READ);
|
||||
|
||||
if (transFile < 0) {
|
||||
error("this should never happen.");
|
||||
NSError("Called to transition, but trans.dat does not exist.");
|
||||
}
|
||||
|
||||
print(sprintf("Found transition file. Will transition over entities.\n"));
|
||||
NSLog("Found transition file. Will transition over entities.");
|
||||
|
||||
while ((lineFeed = fgets(transFile))) {
|
||||
int c = tokenize(lineFeed);
|
||||
|
@ -156,8 +170,17 @@ trigger_transition::LoadTransition(void)
|
|||
if (argv(0) == "{") {
|
||||
continue;
|
||||
} else if (argv(0) == "}") {
|
||||
carrierEntity.TransitionComplete();
|
||||
carrierEntity = __NULL__;
|
||||
|
||||
if (carrierEntity.solid == 0 && carrierEntity.movetype == 0) {
|
||||
carrierEntity.Destroy();
|
||||
carrierEntity = __NULL__;
|
||||
}
|
||||
|
||||
if (carrierEntity) {
|
||||
carrierEntity.TransitionComplete();
|
||||
carrierEntity.SendFlags = -1;
|
||||
carrierEntity = __NULL__;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -166,16 +189,20 @@ trigger_transition::LoadTransition(void)
|
|||
carrierEntity = FindCarrierEntity(argv(2));
|
||||
isNew = false;
|
||||
} else if (argv(0) == "ENTITY") {
|
||||
carrierEntity = EntityDef_CreateClassname(argv(2));
|
||||
string desiredClass = argv(2);
|
||||
if (desiredClass == "corpse") {
|
||||
carrierEntity = __NULL__;
|
||||
continue;
|
||||
}
|
||||
|
||||
carrierEntity = Entity_CreateClass(desiredClass);
|
||||
isNew = true;
|
||||
}
|
||||
} else if (c == 2) { /* key value pairs */
|
||||
if (carrierEntity) {
|
||||
switch (argv(0)) {
|
||||
case "model":
|
||||
if (isNew) {
|
||||
carrierEntity.Restore(argv(0), argv(1));
|
||||
}
|
||||
carrierEntity.model = argv(1);
|
||||
case "modelindex":
|
||||
break;
|
||||
#if 0
|
||||
|
|
|
@ -273,7 +273,7 @@ ambient_generic::Respawn(void)
|
|||
void
|
||||
ambient_generic::UseNormal(entity act, triggermode_t state)
|
||||
{
|
||||
SndLog( "^2%s::^3UseNormal^7: %S Volume: %f; Radius: %d; Pitch: %f", classname, m_strActivePath, m_flVolume, m_flRadius, m_flPitch);
|
||||
SndEntLog("Sample: %S Volume: %f; Radius: %d; Pitch: %f", m_strActivePath, m_flVolume, m_flRadius, m_flPitch);
|
||||
|
||||
if (substring(m_strActivePath, 0, 1) == "!") {
|
||||
string seq = Sentences_GetSamples(m_strActivePath);
|
||||
|
@ -300,11 +300,11 @@ void
|
|||
ambient_generic::UseLoop(entity act, triggermode_t state)
|
||||
{
|
||||
if (m_bToggle == true) {
|
||||
SndLog( "^2%s::^3UseLoop^7: %s stops %S", classname, target, m_strActivePath);
|
||||
SndEntLog( "%s stops %S", target, m_strActivePath);
|
||||
m_strActivePath = "common/null.wav";
|
||||
} else {
|
||||
m_strActivePath = m_strSpawnPath;
|
||||
SndLog( "^2%s::^3UseLoop^7: %s plays %S", classname, target, m_strActivePath);
|
||||
SndEntLog( "%s plays %S", target, m_strActivePath);
|
||||
}
|
||||
|
||||
m_bToggle = !m_bToggle;
|
||||
|
@ -421,7 +421,7 @@ ambient_generic::ReceiveEntity(float isnew, float flChanged)
|
|||
if (flChanged & AMBIENT_ENABLED)
|
||||
m_bLoops = readbyte();
|
||||
|
||||
SndLog( "^2%s::^3ReceiveEntity^7: received: %S Volume: %f; Radius: %d; Pitch: %d, Org: %v", classname, m_strActivePath, m_flVolume, m_flRadius, m_flPitch, origin);
|
||||
SndEntLog("Received: %S Volume: %d%%; Radius: %d units; Pitch: %d, Org: %v", m_strActivePath, m_flVolume * 100, cvar("s_nominaldistance") / m_flRadius, m_flPitch, origin);
|
||||
|
||||
if (m_bLoops == true) {
|
||||
if (flChanged & AMBIENT_MODERN) {
|
||||
|
|
|
@ -157,7 +157,8 @@ decal::Place(vector org, string dname)
|
|||
|
||||
/* we never hit any wall. */
|
||||
if (g_tracedDecal.fraction == 1.0f) {
|
||||
print(sprintf("^1infodecal tracing failed at %v\n", org));
|
||||
NSWarning("Placing of decal %S failed at %v", dname, org);
|
||||
|
||||
if (classname != "tempdecal")
|
||||
remove(this);
|
||||
return;
|
||||
|
|
|
@ -92,7 +92,7 @@ void
|
|||
env_glow::Respawn(void)
|
||||
{
|
||||
if (!model && !m_strMaterial) {
|
||||
NSEntWarning("no model specified");
|
||||
EntWarning("no model specified");
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ env_glow::RendererRestarted(void)
|
|||
model = modelnameforindex(modelindex);
|
||||
m_strMaterial = spriteframe(model, 0, 0.0f);
|
||||
m_vecSize = drawgetimagesize(m_strMaterial) / 2;
|
||||
//NSEntWarning("%S %d %S %v", model, modelindex, m_strMaterial, m_vecSize);
|
||||
//EntWarning("%S %d %S %v", model, modelindex, m_strMaterial, m_vecSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ env_muzzleflash::Trigger(entity theActivator, triggermode_t triggerState)
|
|||
targetEnt = (NSEntity)find(world, ::targetname, m_parent);
|
||||
|
||||
if (!targetEnt) {
|
||||
NSEntWarning("Entity specified but not found.");
|
||||
EntWarning("Entity specified but not found.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -190,6 +190,10 @@ env_muzzleflash::predraw(void)
|
|||
addentity(this);
|
||||
alpha -= frametime * 16.0f;
|
||||
|
||||
if (m_eOwner.alpha == 0.0f) {
|
||||
alpha = 0.0f;
|
||||
}
|
||||
|
||||
if (alpha <= 0.0) {
|
||||
Destroy();
|
||||
}
|
||||
|
|
|
@ -687,9 +687,9 @@ func_vehicle::Realign(void)
|
|||
vector end_pos;
|
||||
first = (NSEntity)first;
|
||||
second = (NSEntity)second;
|
||||
NSLog("func_vehicle angles were: %v\n", angles);
|
||||
EntLog("func_vehicle angles were: %v\n", angles);
|
||||
angles = vectoangles(first.origin - second.origin);
|
||||
NSLog("func_vehicle angles is now: %v\n", angles);
|
||||
EntLog("func_vehicle angles is now: %v\n", angles);
|
||||
|
||||
end_pos = first.origin;
|
||||
end_pos[2] = m_oldOrigin[2] + 64;
|
||||
|
|
|
@ -201,7 +201,7 @@ phys_rope::EvaluateEntity(void)
|
|||
entity eFind = find(world, ::targetname, target);
|
||||
|
||||
if (!eFind) {
|
||||
print(sprintf("phys_rope: Unable to find target %S\n", target));
|
||||
EntError("phys_rope: Unable to find target %S\n", target);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,8 +104,8 @@ point_spotlight::BeamViewDelta(vector cameraAngle)
|
|||
upDelta = (v * v_up);
|
||||
forwardDelta = (v * v_forward);
|
||||
|
||||
//NSLog("forwardDelta: %f\n", forwardDelta);
|
||||
//NSLog("upDelta: %f (%f)\n", upDelta, 1.0 - upDelta);
|
||||
//EntLog("forwardDelta: %f\n", forwardDelta);
|
||||
//EntLog("upDelta: %f (%f)\n", upDelta, 1.0 - upDelta);
|
||||
|
||||
if (forwardDelta < 0.0)
|
||||
return upDelta * (1.0 - forwardDelta);
|
||||
|
@ -135,7 +135,7 @@ point_spotlight::predraw(void)
|
|||
vector vecAngle = g_view.GetCameraAngle();
|
||||
float coneAlpha = BeamViewDelta(vecAngle);
|
||||
|
||||
//NSLog("coneAlpha: %f\n", coneAlpha);
|
||||
//EntLog("coneAlpha: %f\n", coneAlpha);
|
||||
|
||||
/* beam */
|
||||
if (coneAlpha > 0.0) {
|
||||
|
|
|
@ -211,7 +211,7 @@ prop_rope::EvaluateEntity(void)
|
|||
entity eFind = find(world, ::targetname, target);
|
||||
|
||||
if (!eFind) {
|
||||
print(sprintf("prop_rope: Unable to find target %S\n", target));
|
||||
EntError("Unable to find rope target %S", target);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,13 +70,14 @@ private:
|
|||
string m_strMoveTo;
|
||||
entity m_eLooker_net;
|
||||
float m_flSpeed;
|
||||
float m_flInitialSpeed;
|
||||
#endif
|
||||
};
|
||||
|
||||
void
|
||||
trigger_camera::trigger_camera(void)
|
||||
{
|
||||
m_flWait = 4.0f;
|
||||
m_flWait = 0.0f;
|
||||
m_eLooker = __NULL__;
|
||||
#ifndef CLIENT
|
||||
m_strAimAt = __NULL__;
|
||||
|
@ -155,6 +156,9 @@ trigger_camera::SpawnKey(string strKey, string strValue)
|
|||
case "wait":
|
||||
m_flWait = ReadFloat(strValue);
|
||||
break;
|
||||
case "speed":
|
||||
m_flSpeed = ReadFloat(strValue);
|
||||
break;
|
||||
default:
|
||||
super::SpawnKey(strKey, strValue);
|
||||
}
|
||||
|
@ -200,7 +204,7 @@ trigger_camera::Restore(string strKey, string strValue)
|
|||
m_strMoveTo = ReadString(strValue);
|
||||
break;
|
||||
case "m_flSpeed":
|
||||
m_flSpeed = ReadFloat(strValue);
|
||||
m_flInitialSpeed = ReadFloat(strValue);
|
||||
break;
|
||||
default:
|
||||
super::Restore(strKey, strValue);
|
||||
|
@ -239,15 +243,18 @@ trigger_camera::SendEntity(entity ePEnt, float flFlags)
|
|||
void
|
||||
trigger_camera::EvaluateEntity(void)
|
||||
{
|
||||
entity t;
|
||||
NSEntity aimingAt;
|
||||
|
||||
if (!m_eLooker)
|
||||
return;
|
||||
|
||||
t = find(world, ::targetname, m_strAimAt);
|
||||
aimingAt = (NSEntity)find(world, ::targetname, m_strAimAt);
|
||||
|
||||
if (t) {
|
||||
angles = vectoangles(t.origin - origin);
|
||||
if (aimingAt) {
|
||||
TurnToPos(aimingAt.GetOrigin());
|
||||
} else {
|
||||
//NSEntity targetNode = (NSEntity)find(world, ::targetname, target);
|
||||
//TurnToPos(targetNode.GetOrigin());
|
||||
}
|
||||
|
||||
if (ATTR_CHANGED(origin)) {
|
||||
|
@ -272,70 +279,87 @@ trigger_camera::EvaluateEntity(void)
|
|||
void
|
||||
trigger_camera::GoToTarget(void)
|
||||
{
|
||||
float flTravelTime;
|
||||
vector vecVelocity;
|
||||
float travelTime;
|
||||
vector camVelocity;
|
||||
path_corner targetNode;
|
||||
|
||||
path_corner eNode;
|
||||
eNode = (path_corner)find(world, ::targetname, target);
|
||||
targetNode = (path_corner)find(world, ::targetname, target);
|
||||
|
||||
if (!eNode) {
|
||||
if (!targetNode) {
|
||||
EntError("Cannot find target %S", target);
|
||||
return;
|
||||
}
|
||||
|
||||
vecVelocity = (eNode.origin - origin);
|
||||
flTravelTime = (vlen(vecVelocity) / eNode.m_flSpeed);
|
||||
camVelocity = (targetNode.GetOrigin() - GetOrigin());
|
||||
|
||||
NSLog("trigger_camera (%s): Moving to path_corner %S within %f secs", targetname, target, flTravelTime);
|
||||
if (targetNode.m_flSpeed) {
|
||||
m_flSpeed = targetNode.m_flSpeed;
|
||||
}
|
||||
|
||||
if (!flTravelTime) {
|
||||
NSEntWarning("distance too short, going to next");
|
||||
travelTime = (vlen(camVelocity) / m_flSpeed);
|
||||
|
||||
EntLog("Moving to path_corner %S at %d within %f secs (%v)", target, m_flSpeed, travelTime, camVelocity);
|
||||
|
||||
if (!travelTime) {
|
||||
EntWarning("Distance too short, going to next.");
|
||||
NextPath();
|
||||
return;
|
||||
}
|
||||
|
||||
SetVelocity(vecVelocity * (1 / flTravelTime));
|
||||
ScheduleThink(NextPath, flTravelTime);
|
||||
if (!m_strAimAt) {
|
||||
vector vecAngleDiff = targetNode.GetOrigin() - GetOrigin();
|
||||
vector vecAngleDest = vectoangles(vecAngleDiff);
|
||||
vecAngleDiff = Math_AngleDiff(vecAngleDest, angles);
|
||||
SetAngularVelocity(vecAngleDiff * (1 / travelTime));
|
||||
}
|
||||
|
||||
SetVelocity(camVelocity * (1 / travelTime));
|
||||
ScheduleThink(NextPath, travelTime);
|
||||
}
|
||||
|
||||
void
|
||||
trigger_camera::NextPath(void)
|
||||
{
|
||||
path_corner eNode;
|
||||
path_corner nextNode;
|
||||
|
||||
if (target == "") {
|
||||
return;
|
||||
}
|
||||
|
||||
print(sprintf("Looking for target %S\n", target));
|
||||
eNode = (path_corner)find(world, ::targetname, target);
|
||||
nextNode = (path_corner)find(world, ::targetname, target);
|
||||
|
||||
if (!eNode) {
|
||||
if (!nextNode) {
|
||||
NSError("Node %S suddenly missing from map!", target);
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog("trigger_camera (%s): Touched base with path_corner %S", targetname, target);
|
||||
EntLog("Arrived at target node %S.", target);
|
||||
|
||||
/* fire the path_corners' target */
|
||||
eNode.Trigger(this, TRIG_TOGGLE);
|
||||
nextNode.PathPassTrigger(this, TRIG_TOGGLE);
|
||||
|
||||
if (target != m_strMoveTo)
|
||||
m_strAimAt = __NULL__;
|
||||
|
||||
SetOrigin(nextNode.origin - (mins + maxs) * 0.5);
|
||||
SetTriggerTarget(nextNode.target);
|
||||
|
||||
SetOrigin(eNode.origin - (mins + maxs) * 0.5);
|
||||
SetTriggerTarget(eNode.target);
|
||||
ClearVelocity();
|
||||
|
||||
/* warp next frame */
|
||||
if (eNode.HasSpawnFlags(PC_TELEPORT)) {
|
||||
NSLog("^1trigger_camera::^3NextPath^7: Node %s wants %s to teleport\n", eNode.targetname, targetname);
|
||||
if (nextNode.HasSpawnFlags(PC_TELEPORT)) {
|
||||
EntLog("Node %S wants %S to teleport.", nextNode.targetname, targetname);
|
||||
ScheduleThink(NextPath, 0.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
/* stop until triggered again */
|
||||
if (eNode.HasSpawnFlags(PC_WAIT)) {
|
||||
if (nextNode.HasSpawnFlags(PC_WAIT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (eNode.m_flWait > 0) {
|
||||
ScheduleThink(GoToTarget, eNode.m_flWait);
|
||||
if (nextNode.m_flWait > 0) {
|
||||
ScheduleThink(GoToTarget, nextNode.m_flWait);
|
||||
} else {
|
||||
GoToTarget();
|
||||
}
|
||||
|
@ -350,7 +374,7 @@ trigger_camera::Trigger(entity act, triggermode_t state)
|
|||
act = find(world, ::classname, "player");
|
||||
}
|
||||
|
||||
NSLog("trigger_camera for %s %S is now %S\n", act.classname, act.netname, targetname);
|
||||
EntLog("Controlling camera of %S", act.netname);
|
||||
|
||||
/* kill the other cams the player may be attached to */
|
||||
for (trigger_camera cam = __NULL__; (cam = (trigger_camera)find(cam, ::classname, "trigger_camera"));) {
|
||||
|
@ -367,15 +391,20 @@ trigger_camera::Trigger(entity act, triggermode_t state)
|
|||
|
||||
m_eLooker = act;
|
||||
m_eLooker.view2 = this;
|
||||
NSLog("Triggering it on %s\n", act.netname);
|
||||
m_flSpeed = m_flInitialSpeed;
|
||||
|
||||
if (!m_flSpeed) {
|
||||
m_flSpeed = 100.0f;
|
||||
}
|
||||
|
||||
/* Reset to the spawn values */
|
||||
SetMovetype(MOVETYPE_PUSH);
|
||||
SetSolid(SOLID_NOT);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
ClearVelocity();
|
||||
ReleaseThink();
|
||||
SetTriggerTarget(m_strMoveTo);
|
||||
NextPath();
|
||||
GoToTarget();
|
||||
SetSendFlags(0xFFFFFF);
|
||||
ScheduleThink(DeactivateCamera, m_flWait);
|
||||
pvsflags = PVSF_IGNOREPVS;
|
||||
}
|
||||
|
||||
|
@ -383,7 +412,7 @@ trigger_camera::Trigger(entity act, triggermode_t state)
|
|||
void
|
||||
trigger_camera::DeactivateCamera(void)
|
||||
{
|
||||
NSLog("Turning it off on %s\n", m_eLooker.netname);
|
||||
EntLog("Turning it off on %S", m_eLooker.netname);
|
||||
m_eLooker.view2 = __NULL__;
|
||||
m_eLooker = __NULL__;
|
||||
SetSendFlags(-1);
|
||||
|
|
|
@ -97,9 +97,9 @@ worldspawn::worldspawn(void)
|
|||
m_strAmbientSound = "";
|
||||
m_strBGMTrack = "";
|
||||
|
||||
print("--------- Map Initialization ---------\n");
|
||||
print(sprintf("Map: %s\n", mapname));
|
||||
print("----------- Game Map Init ------------\n");
|
||||
InitPrint("Map Initialization");
|
||||
NSLog("Map: %s", mapname);
|
||||
InitPrint("Game Map Init");
|
||||
|
||||
lightstyle(0, "m");
|
||||
lightstyle(1, "mmnmmommommnonmmonqnmmo");
|
||||
|
@ -125,7 +125,7 @@ worldspawn::worldspawn(void)
|
|||
if (autocvar_sv_levelexec)
|
||||
readcmd(sprintf("exec maps/%s.cfg\n", mapname));
|
||||
|
||||
print("Spawning entities\n");
|
||||
InitStart();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -202,6 +202,11 @@ worldspawn::SpawnKey(string strKey, string strValue)
|
|||
m_flHDRIrisFadeDown = ReadFloat(strValue);
|
||||
m_bHDREnabled = true;
|
||||
break;
|
||||
/* empty, ignore */
|
||||
case "wad":
|
||||
case "MaxRange":
|
||||
case "sounds":
|
||||
break;
|
||||
default:
|
||||
super::SpawnKey(strKey, strValue);
|
||||
break;
|
||||
|
|
|
@ -54,12 +54,12 @@ Menu_GammaHack(void)
|
|||
{
|
||||
if (cvar("brightness") != cvar("vid_brightness")) {
|
||||
localcmd("seta brightness 0\n");
|
||||
print("^1Menu_RendererRestarted^7: Brightness hack.\n");
|
||||
NSLog("Old config brightness. Applying brightness hack.");
|
||||
}
|
||||
|
||||
if (cvar("gamma") != cvar("vid_gamma")) {
|
||||
localcmd("seta gamma 1\n");
|
||||
print("^1Menu_RendererRestarted^7: Gamma hack.\n");
|
||||
NSLog("Old config gamma. Applying gamma hack.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ Menu_HasStartupVideos(void)
|
|||
void
|
||||
Menu_PlayStartupVideos(void)
|
||||
{
|
||||
print("playing startup videos\n");
|
||||
NSLog("Playing startup videos.\n");
|
||||
//localcmd("playvideo av:media/sierra.avi av:media/valve.avi\n");
|
||||
}
|
||||
|
||||
|
@ -94,9 +94,9 @@ m_init(void)
|
|||
|
||||
string menuMap;
|
||||
|
||||
print("--------- Initializing Menu ----------\n");
|
||||
print("Built: " __DATE__ " " __TIME__"\n");
|
||||
print("QCC: " __QCCVER__ "\n");
|
||||
NSLog("--------- Initializing Menu ----------");
|
||||
NSLog("Built: %s %s", __DATE__, __TIME__);
|
||||
NSLog("QCC: %s", __QCCVER__);
|
||||
|
||||
/* things that should really be default. platform_default.cfg is supposed to set
|
||||
* them the first time - however FTE doesn't do that when switching manifests
|
||||
|
|
|
@ -87,7 +87,7 @@ Layout_FromFile_Create(CPageTab target, string cvar, string descr, string type,
|
|||
//new = spawn(CTextBox);
|
||||
//break;
|
||||
default:
|
||||
warning(sprintf("Unknown widget type %S for cvar %S, ignoring", type, cvar));
|
||||
NSWarning("Unknown widget type %S for cvar %S, ignoring.", type, cvar);
|
||||
}
|
||||
|
||||
if (!new)
|
||||
|
|
|
@ -468,8 +468,11 @@ GameLibrary_InitCustom(void)
|
|||
games = (gameinfo_t *)memrealloc(games, sizeof(gameinfo_t), old_count, (gameinfo_count + packageinfo_count));
|
||||
|
||||
/* The things we do for frequent flyer mileage. */
|
||||
if (!games)
|
||||
error(sprintf("Attempting to allocate mod data for %i entries failed\n", gameinfo_count));
|
||||
if (!games) {
|
||||
NSError("Attempting to allocate mod data for %i entries failed.", gameinfo_count);
|
||||
crash();
|
||||
return;
|
||||
}
|
||||
|
||||
/* now loop through all the mods we found and load in the metadata */
|
||||
for (id = 1; id < gameinfo_count; id++) {
|
||||
|
@ -533,12 +536,12 @@ GameLibrary_InitCustom(void)
|
|||
|
||||
/* we may have some mods, but we're not running any of them. Fatal */
|
||||
if (gameinfo_current == -1) {
|
||||
print("^1FATAL ERROR: NO LIBLIST.GAM FOR CURRENT MOD FOUND!\n");
|
||||
NSError("No definition for current game found. Fatal.");
|
||||
crash();
|
||||
return;
|
||||
}
|
||||
|
||||
print(sprintf("GameLibrary initialized (%i entries).\n", gameinfo_count));
|
||||
NSLog("...GameLibrary initialized (%i entries).", gameinfo_count);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -583,7 +586,7 @@ static void
|
|||
GameLibrary_EndInstall(void)
|
||||
{
|
||||
int gid = g_iModInstallCache;
|
||||
print(sprintf("Installation ended for %S!\n", g_strModInstallCache));
|
||||
NSLog("Installation ended for %S.", g_strModInstallCache);
|
||||
localcmd(sprintf("game %s\n", g_strModInstallCache));
|
||||
|
||||
localcmd("stopmusic\nsnd_restart\nwait\nvid_reload\n");
|
||||
|
@ -662,14 +665,13 @@ GameLibrary_InstallStart(int gameid)
|
|||
for (int i = 0; i < count; i++) {
|
||||
int pkgid = GameLibrary_IDForPackageName(argv(i));
|
||||
localcmd(sprintf("pkg add %s\n", argv(i)));
|
||||
print(sprintf("Marking package %s for install.\n",
|
||||
argv(i)));
|
||||
NSLog("Marking package %s for install.", argv(i));
|
||||
}
|
||||
|
||||
g_iModInstallCache = gameid;
|
||||
g_strModInstallCache = games[gameid].gamedir;
|
||||
localcmd("pkg apply\n");
|
||||
print("Starting installation of custom game packages\n");
|
||||
NSLog("Starting installation of custom game packages.");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -678,15 +680,12 @@ GameLibrary_Install(int gameID)
|
|||
string st;
|
||||
|
||||
if (gameID >= gameinfo_count || gameID < 0i) {
|
||||
print(sprintf("GameLibrary_Install: Invalid game id %i!\n", gameID));
|
||||
NSError("Invalid game id %i!\n", gameID);
|
||||
return;
|
||||
}
|
||||
|
||||
st = getpackagemanagerinfo(games[gameID].pkgid, GPMI_INSTALLED);
|
||||
|
||||
print(st);
|
||||
print("\n");
|
||||
|
||||
if (st != "enabled") {
|
||||
GameLibrary_InstallStart(gameID);
|
||||
return;
|
||||
|
@ -701,7 +700,7 @@ void
|
|||
GameLibrary_Activate(int gameID)
|
||||
{
|
||||
if (gameID >= gameinfo_count || gameID < 0i) {
|
||||
print(sprintf("GameLibrary_Activate: Invalid game id %i!\n", gameID));
|
||||
NSError("Invalid game id %i.", gameID);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -757,7 +756,7 @@ __variant
|
|||
GameLibrary_GetGameInfo(int gameID, gameInfo_t infoType)
|
||||
{
|
||||
if (gameID >= gameinfo_count || gameID < 0i) {
|
||||
print(sprintf("GameLibrary_GetGameInfo: Invalid game id %i!\n", gameID));
|
||||
NSError("Invalid game id %i.", gameID);
|
||||
return __NULL__;
|
||||
}
|
||||
|
||||
|
@ -836,5 +835,5 @@ GameLibrary_DebugList(void)
|
|||
print(sprintf("%i %s (%s)\n", i, games[i].game, games[i].gamedir));
|
||||
}
|
||||
|
||||
print(sprintf("\t%i game(s) loaded\n", gameinfo_count));
|
||||
print(sprintf("\t%i game(s) loaded.", gameinfo_count));
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ MapLibrary_Init(void)
|
|||
}
|
||||
search_end(mapsearch);
|
||||
|
||||
print(sprintf("MapLibrary initialized (%i entries).\n", g_mapLibrary_count));
|
||||
NSLog("...MapLibrary initialized (%i entries).", g_mapLibrary_count);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -183,7 +183,7 @@ __variant
|
|||
MapLibrary_GetInfo(int mapID, mapType_t infoType)
|
||||
{
|
||||
if (mapID >= g_mapLibrary_count || mapID < 0i) {
|
||||
print(sprintf("MapLibrary_GetInfo: Invalid map id %i!\n", mapID));
|
||||
NSError("Invalid map id %i", mapID);
|
||||
return __NULL__;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ Master_Resolve(void)
|
|||
dprint("...\n");
|
||||
|
||||
if (!out) {
|
||||
dprint("Failed to resolve address.\n");
|
||||
NSError("Failed to resolve master server address.");
|
||||
return __NULL__;
|
||||
}
|
||||
|
||||
return out;
|
||||
|
@ -51,6 +52,7 @@ Master_GetTotalServers(void)
|
|||
if (a) {
|
||||
NSLog("Master reports a total of %i servers.", a);
|
||||
}
|
||||
|
||||
return gethostcachevalue(SLIST_HOSTCACHETOTALCOUNT);
|
||||
}
|
||||
|
||||
|
@ -95,7 +97,8 @@ Master_RecountServers(void)
|
|||
void
|
||||
Master_RefreshCache(void)
|
||||
{
|
||||
dprint("Refreshing host cache...\n");
|
||||
NSLog("Refreshing host cache...");
|
||||
|
||||
resethostcachemasks();
|
||||
sethostcachemaskstring(0, gethostcacheindexforkey("gamedir"), cvar_string("game"), SLIST_TEST_EQUAL);
|
||||
sethostcachesort(gethostcacheindexforkey("ping"), FALSE);
|
||||
|
@ -112,7 +115,7 @@ Master_RefreshCache(void)
|
|||
void
|
||||
Master_UpdateCache(void)
|
||||
{
|
||||
dprint("Updating host cache...\n");
|
||||
NSLog("Updating host cache...");
|
||||
resethostcachemasks();
|
||||
sethostcachemaskstring(0, gethostcacheindexforkey("gamedir"), cvar_string("game"), SLIST_TEST_EQUAL);
|
||||
sethostcachesort(gethostcacheindexforkey("ping"), FALSE);
|
||||
|
|
|
@ -374,10 +374,8 @@ NSGameRules::DamageApply(entity t, entity c, float dmg, int w, damageType_t type
|
|||
g_dmg_iFlags = type;
|
||||
g_dmg_iWeapon = w;
|
||||
|
||||
NSLog("Damage: %s damages %s with %d damage", c.classname, t.classname, dmg);
|
||||
NSLog("\tHit-body: %d", g_dmg_iHitBody);
|
||||
NSLog("\tFlags: %i", g_dmg_iFlags);
|
||||
NSLog("\tWeapon: %i", g_dmg_iWeapon);
|
||||
NSLog("%S does %d dmg to %S (body: %d, flags: %i, weapon: %i)",
|
||||
c.classname, dmg, t.classname, g_dmg_iHitBody, g_dmg_iFlags, g_dmg_iWeapon);
|
||||
|
||||
/* friendly fire penalty */
|
||||
if (isFriendlyFire) {
|
||||
|
@ -553,19 +551,25 @@ NSGameRules::PlayerRequestRespawn(NSClientPlayer bp)
|
|||
void
|
||||
NSGameRules::ChatMessageAll(NSClient cl, string strMessage)
|
||||
{
|
||||
float edictNum = num_for_edict(cl) - 1;
|
||||
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_CHAT);
|
||||
WriteByte(MSG_MULTICAST, num_for_edict(cl) - 1);
|
||||
WriteByte(MSG_MULTICAST, edictNum);
|
||||
WriteByte(MSG_MULTICAST, cl.team);
|
||||
WriteString(MSG_MULTICAST, strMessage);
|
||||
multicast([0,0,0], MULTICAST_ALL_R);
|
||||
|
||||
localcmd(sprintf("echo [ALL] %s: %s\n", cl.netname, strMessage));
|
||||
/* TODO: don't print on listen games */
|
||||
print(Util_ChatFormat(edictNum, 0, strMessage));
|
||||
print("\n");
|
||||
}
|
||||
|
||||
void
|
||||
NSGameRules::ChatMessageTeam(NSClient cl, string strMessage)
|
||||
{
|
||||
float edictNum = num_for_edict(cl) - 1;
|
||||
|
||||
/* their finger probably slipped */
|
||||
if (IsTeamplay() == false) {
|
||||
ChatMessageAll(cl, strMessage);
|
||||
|
@ -580,7 +584,7 @@ NSGameRules::ChatMessageTeam(NSClient cl, string strMessage)
|
|||
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_CHAT_TEAM);
|
||||
WriteByte(MSG_MULTICAST, num_for_edict(cl) - 1);
|
||||
WriteByte(MSG_MULTICAST, edictNum);
|
||||
WriteByte(MSG_MULTICAST, cl.team);
|
||||
WriteString(MSG_MULTICAST, strMessage);
|
||||
|
||||
|
@ -588,7 +592,8 @@ NSGameRules::ChatMessageTeam(NSClient cl, string strMessage)
|
|||
multicast([0,0,0], MULTICAST_ONE_R);
|
||||
}
|
||||
|
||||
localcmd(sprintf("echo [TEAM] %s: %s\n", cl.netname, strMessage));
|
||||
print(Util_ChatFormat(edictNum, cl.team, strMessage));
|
||||
print("\n");
|
||||
}
|
||||
|
||||
string
|
||||
|
|
|
@ -154,3 +154,4 @@ void main(void)
|
|||
|
||||
NSEntity EntityDef_SpawnClassname(string className);
|
||||
NSEntity EntityDef_CreateClassname(string className);
|
||||
NSEntity Entity_CreateClass(string className);
|
||||
|
|
|
@ -125,13 +125,15 @@ EntityDef_ReadFile(string filePath)
|
|||
|
||||
/* bounds check */
|
||||
if (g_entDefCount >= ENTITYDEF_MAX) {
|
||||
error(sprintf("EntityDef_ReadFile: reached limit of %d defs\n", ENTITYDEF_MAX));
|
||||
NSError("Reached limit of %d defs.", ENTITYDEF_MAX);
|
||||
error("Crash.");
|
||||
}
|
||||
|
||||
/* open file */
|
||||
defFile = fopen(filePath, FILE_READ);
|
||||
if (defFile < 0) {
|
||||
error(sprintf("EntityDef_ReadFile: unable to read %S\n", filePath));
|
||||
NSError("Unable to read %S\n", filePath);
|
||||
error("Crash.");
|
||||
}
|
||||
|
||||
/* line by line */
|
||||
|
@ -248,6 +250,8 @@ EntityDef_Init(void)
|
|||
{
|
||||
searchhandle pm;
|
||||
|
||||
InitStart();
|
||||
|
||||
g_entDefInclude = "";
|
||||
|
||||
pm = search_begin("def/*.def", TRUE, TRUE);
|
||||
|
@ -284,6 +288,8 @@ EntityDef_Init(void)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
InitEnd();
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -331,6 +337,8 @@ EntityDef_CheckCondition(int id, string keyWord, float tweakCondition, string ke
|
|||
tmp1 = stof(keyValue);
|
||||
tmp2 = stof(value);
|
||||
|
||||
print(sprintf("%d & %d\n", tmp1, tmp2));
|
||||
|
||||
if (key == keyWord && tmp2 & tmp1)
|
||||
return true;
|
||||
break;
|
||||
|
@ -498,7 +506,6 @@ EntityDef_SpawnClassname(string className)
|
|||
}
|
||||
}
|
||||
|
||||
NSLog("^1Failed spawning eDef %S", className);
|
||||
return __NULL__;
|
||||
}
|
||||
|
||||
|
@ -507,9 +514,17 @@ EntityDef_CreateClassname(string className)
|
|||
{
|
||||
entity oldSelf = self;
|
||||
NSEntity new = spawn(NSEntity);
|
||||
NSEntity test;
|
||||
self = new;
|
||||
EntityDef_SpawnClassname(className);
|
||||
test = EntityDef_SpawnClassname(className);
|
||||
self = oldSelf;
|
||||
|
||||
/* Failure */
|
||||
if (test == __NULL__) {
|
||||
new.Destroy();
|
||||
return __NULL__;
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
|
@ -564,4 +579,27 @@ EntityDef_HasSpawnClass(string className)
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
CallSpawnfuncByName(entity target, string className)
|
||||
{
|
||||
entity oldSelf = self;
|
||||
string spawnClass = strcat("spawnfunc_", className);
|
||||
self = target;
|
||||
callfunction(spawnClass);
|
||||
self = oldSelf;
|
||||
}
|
||||
|
||||
NSEntity
|
||||
Entity_CreateClass(string className)
|
||||
{
|
||||
NSEntity newEntity = EntityDef_CreateClassname(className);
|
||||
|
||||
if (!newEntity) {
|
||||
newEntity = spawn(NSEntity);
|
||||
CallSpawnfuncByName(newEntity, className);
|
||||
}
|
||||
|
||||
return newEntity;
|
||||
}
|
|
@ -89,6 +89,8 @@ ClientDisconnect(void)
|
|||
/* this will hide/remove the player from other clients */
|
||||
player pl = (player)self;
|
||||
pl.Disappear();
|
||||
pl.classname = "";
|
||||
pl.flags = 0;
|
||||
}
|
||||
|
||||
/** Called by the `kill` console command.
|
||||
|
@ -147,6 +149,12 @@ PutClientInServer(void)
|
|||
|
||||
/* handle transitions */
|
||||
if (whichpack("data/trans.dat")) {
|
||||
|
||||
for (entity a = world; (a = findfloat(a, ::identity, 1));) {
|
||||
NSEntity levelEnt = (NSEntity)a;
|
||||
levelEnt.TransitionComplete();
|
||||
}
|
||||
|
||||
trigger_transition::LoadTransition();
|
||||
}
|
||||
|
||||
|
@ -232,7 +240,7 @@ The `self` global does not refer to anything.
|
|||
void
|
||||
SetNewParms(void)
|
||||
{
|
||||
print("--------- Setting New Level Parameters ----------\n");
|
||||
InitPrint("Setting New Level Parameters");
|
||||
|
||||
if (g_ents_initialized)
|
||||
g_grMode.LevelNewParms();
|
||||
|
@ -248,7 +256,7 @@ allocated for every client.
|
|||
void
|
||||
SetChangeParms(void)
|
||||
{
|
||||
print("--------- Setting Level-Change Parameters ----------\n");
|
||||
InitPrint("Setting Level-Change Parameters");
|
||||
|
||||
if (g_ents_initialized)
|
||||
g_grMode.LevelChangeParms((NSClientPlayer)self);
|
||||
|
@ -358,9 +366,9 @@ So avoid calling spawn() related functions here. */
|
|||
void
|
||||
init(float prevprogs)
|
||||
{
|
||||
print("--------- Initializing Server Game ----------\n");
|
||||
print("Built: " __DATE__ " " __TIME__"\n");
|
||||
print("QCC: " __QCCVER__ "\n");
|
||||
InitPrint("Initializing Server Game");
|
||||
NSLog("Built: %s %s", __DATE__, __TIME__);
|
||||
NSLog("QCC: %s", __QCCVER__);
|
||||
|
||||
Plugin_Init();
|
||||
|
||||
|
@ -369,7 +377,6 @@ init(float prevprogs)
|
|||
PropData_Init();
|
||||
SurfData_Init();
|
||||
DecalGroups_Init();
|
||||
Skill_Init();
|
||||
|
||||
/* DO NOT EVER CHANGE THESE. */
|
||||
cvar_set("r_meshpitch", "1");
|
||||
|
@ -391,7 +398,9 @@ init_respawn(void)
|
|||
endspawn++;
|
||||
}
|
||||
|
||||
print(sprintf("...%i entities spawned (%i inhibited)\n", g_ent_spawned, g_ent_spawned - endspawn));
|
||||
NSLog("...%i entities spawned (%i inhibited)", g_ent_spawned, g_ent_spawned - endspawn);
|
||||
|
||||
InitEnd();
|
||||
|
||||
remove(self);
|
||||
}
|
||||
|
@ -464,7 +473,7 @@ initents(void)
|
|||
g_ents_initialized = TRUE;
|
||||
|
||||
/* engine hacks for dedicated servers */
|
||||
cvar_set("s_nominaldistance", "1024");
|
||||
cvar_set("s_nominaldistance", "1536");
|
||||
|
||||
/* other engine hacks */
|
||||
cvar_set("sv_nqplayerphysics", "0");
|
||||
|
@ -518,7 +527,11 @@ ConsoleCmd(string cmd)
|
|||
tokenize(cmd);
|
||||
switch (argv(0)) {
|
||||
case "addBot":
|
||||
Bot_AddBot_f(strtolower(argv(1)));
|
||||
string botProfile = strtolower(argv(1));
|
||||
float teamValue = stof(argv(2));
|
||||
float spawnDelay = stof(argv(3));
|
||||
string newName = argv(4);
|
||||
Bot_AddBot_f(botProfile, teamValue, spawnDelay, newName);
|
||||
break;
|
||||
case "killAllBots":
|
||||
Bot_KillAllBots();
|
||||
|
@ -597,6 +610,12 @@ ConsoleCmd(string cmd)
|
|||
if (finder)
|
||||
setorigin(pl, finder.origin);
|
||||
break;
|
||||
case "renetworkEntities":
|
||||
for (entity a = world; (a = findfloat(a, ::identity, 1));) {
|
||||
NSEntity ent = (NSEntity)a;
|
||||
ent.SendFlags = -1;
|
||||
}
|
||||
break;
|
||||
case "respawnEntities":
|
||||
for (entity a = world; (a = findfloat(a, ::identity, 1));) {
|
||||
NSEntity ent = (NSEntity)a;
|
||||
|
@ -658,7 +677,7 @@ SV_PerformLoad(float fh, float entcount, float playerslots)
|
|||
NSEntity loadent = __NULL__;
|
||||
int num_loaded = 0i;
|
||||
|
||||
print("--------- Loading Existing Save ----------\n");
|
||||
InitPrint("Loading Existing Save");
|
||||
g_isloading = true;
|
||||
|
||||
#if 0
|
||||
|
@ -695,7 +714,7 @@ SV_PerformLoad(float fh, float entcount, float playerslots)
|
|||
#ifndef REEDICT
|
||||
n = stof(argv(1));
|
||||
e = edict_num(n);
|
||||
print(sprintf("Creating %s (edict %d)\n", cname, n));
|
||||
NSLog("Creating %s (edict %d)", cname, n);
|
||||
#else
|
||||
entity e = spawn();
|
||||
#endif
|
||||
|
@ -719,7 +738,7 @@ SV_PerformLoad(float fh, float entcount, float playerslots)
|
|||
loadent = (NSEntity)e;
|
||||
self = eold;
|
||||
} else {
|
||||
print(sprintf("Could not spawn %s\n", cname));
|
||||
NSError("Could not spawn %s", cname);
|
||||
remove(e);
|
||||
self = eold;
|
||||
continue;
|
||||
|
@ -729,7 +748,7 @@ SV_PerformLoad(float fh, float entcount, float playerslots)
|
|||
if (loadent) {
|
||||
loadent.RestoreComplete();
|
||||
num_loaded++;
|
||||
print(sprintf("completed %s (edict %d)\n\n", loadent.classname, n));
|
||||
NSLog("completed %s (edict %d)", loadent.classname, n);
|
||||
loadent = __NULL__;
|
||||
}
|
||||
} else {
|
||||
|
@ -744,7 +763,7 @@ SV_PerformLoad(float fh, float entcount, float playerslots)
|
|||
}
|
||||
}
|
||||
|
||||
print(sprintf("loaded %i entities\n", num_loaded));
|
||||
NSLog("...loaded %i entities", num_loaded);
|
||||
g_isloading = false;
|
||||
}
|
||||
|
||||
|
@ -759,7 +778,7 @@ SV_PerformSave(float fh, float entcount, float playerslots)
|
|||
int num_saved = 0i;
|
||||
entity e;
|
||||
|
||||
print("--------- Performing Save ----------\n");
|
||||
InitPrint("Performing Save");
|
||||
|
||||
for (i = 0; i < entcount; i++) {
|
||||
NSEntity willsave;
|
||||
|
@ -782,7 +801,7 @@ SV_PerformSave(float fh, float entcount, float playerslots)
|
|||
num_saved++;
|
||||
}
|
||||
fclose(fh);
|
||||
print(sprintf("saved %i entities\n", num_saved));
|
||||
NSLog("saved %i entities", num_saved);
|
||||
}
|
||||
|
||||
/** Called by the engine to check with us if a spawn function exists.
|
||||
|
@ -793,17 +812,20 @@ to remove in case we won't initialize it.
|
|||
void
|
||||
CheckSpawn(void() spawnfunc)
|
||||
{
|
||||
if (MapTweak_EntitySpawn(self))
|
||||
return;
|
||||
if (EntityDef_SpawnClassname(self.classname))
|
||||
return;
|
||||
string desiredClass = self.classname;
|
||||
|
||||
if (spawnfunc) {
|
||||
if (MapTweak_EntitySpawn(self)) {
|
||||
self._mapspawned = true;
|
||||
self.classname = desiredClass;
|
||||
} else if (EntityDef_SpawnClassname(desiredClass)) {
|
||||
self._mapspawned = true;
|
||||
} else if (spawnfunc) {
|
||||
spawnfunc();
|
||||
self.classname = desiredClass;
|
||||
self._mapspawned = true;
|
||||
g_ent_spawned++;
|
||||
} else {
|
||||
print(sprintf("^1Cannot find entity class ^7%s\n", self.classname));
|
||||
NSError("Unable to spawn %s", desiredClass);
|
||||
remove(self);
|
||||
}
|
||||
|
||||
|
@ -816,4 +838,4 @@ CheckSpawn(void() spawnfunc)
|
|||
g_ent_spawned--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@ Mapcycle_Load(string filename)
|
|||
fs_mapcycle = fopen(filename, FILE_READ);
|
||||
|
||||
if (fs_mapcycle < 0) {
|
||||
print(strcat("^1could not load ", filename, "\n"));
|
||||
NSError("Missing file %s", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ Mapcycle_Load(string filename)
|
|||
/* the current map in the list will decide the nextmap */
|
||||
localcmd(sprintf("alias nextmap m%i\n", map_next));
|
||||
|
||||
print(sprintf("mapcycle initialized with %i entries.\n", mapcount));
|
||||
NSLog("...MapCycle initialized with %i entries.", mapcount);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -69,14 +69,15 @@ Mapcycle_Init(void)
|
|||
if (g_grMode.IsMultiplayer() == false)
|
||||
return;
|
||||
|
||||
print("--------- Initializing MapCycle ----------\n");
|
||||
InitStart();
|
||||
|
||||
/* in case some server admin wants a map to continously loop */
|
||||
if (cycleFile == "") {
|
||||
print("mapcycle disabled via cvar. skipping\n");
|
||||
NSLog("MapCycle disabled via cvar. Skipping.");
|
||||
localcmd("alias nextmap map_restart 0\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Mapcycle_Load(cycleFile);
|
||||
InitEnd();
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ MapTweaks_Init(void)
|
|||
string newCvar, newInfo, newItem;
|
||||
int atTweak = 0i;
|
||||
|
||||
InitStart();
|
||||
|
||||
tweakFile = fopen("scripts/maptweaks.txt", FILE_READ);
|
||||
g_mapTweakCount = 0;
|
||||
newCvar = newInfo = newItem = "";
|
||||
|
@ -60,6 +62,8 @@ MapTweaks_Init(void)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
NSError("Missing file scripts/maptweaks.txt");
|
||||
InitEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -97,6 +101,7 @@ MapTweaks_Init(void)
|
|||
}
|
||||
|
||||
fclose(tweakFile);
|
||||
InitEnd();
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
@ -164,7 +164,7 @@ Nodes_InsertNodeForClassname(string classn)
|
|||
void
|
||||
Nodes_BuildFromEnts(void)
|
||||
{
|
||||
print("rebuilding node tree...");
|
||||
NSLog("Rebuilding node tree...");
|
||||
|
||||
/* run through the ents and rebuild the tree */
|
||||
Nodes_InsertNodeForClassname("info_node");
|
||||
|
@ -179,13 +179,13 @@ Nodes_BuildFromEnts(void)
|
|||
if (g_iNodes == 0)
|
||||
Nodes_InsertNodeForClassname("info_player_deathmatch");
|
||||
|
||||
print(sprintf("%i possible nodes found in %s\n", g_iNodes, mapname));
|
||||
NSLog("%i possible nodes found in %s", g_iNodes, mapname);
|
||||
|
||||
if (g_iNodes) {
|
||||
print(sprintf("saving nodes nodes for %s\n", mapname));
|
||||
NSLog("saving nodes nodes for %s", mapname);
|
||||
Nodes_Save(sprintf("%s.way", mapname));
|
||||
} else {
|
||||
print(sprintf("no node data found for %s\n", mapname));
|
||||
NSLog("no node data found for %s", mapname);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,14 +193,14 @@ Nodes_BuildFromEnts(void)
|
|||
void
|
||||
Nodes_Init(void)
|
||||
{
|
||||
print("--------- Initializing Nodes Subsystem ----------\n");
|
||||
InitStart();
|
||||
g_nodes_present = FALSE;
|
||||
|
||||
/* skip if present. TODO: check if they're out of date? */
|
||||
if (whichpack(sprintf("data/%s.way", mapname))) {
|
||||
g_nodes_present = TRUE;
|
||||
#ifdef NODE_DEBUG
|
||||
print(sprintf("loading existing nodes for %s\n", mapname));
|
||||
NSLog("loading existing nodes for %s", mapname);
|
||||
Nodes_Load(sprintf("%s.way", mapname));
|
||||
#endif
|
||||
} else {
|
||||
|
@ -216,7 +216,7 @@ Nodes_Init(void)
|
|||
g_iNodes = 0;
|
||||
#endif
|
||||
|
||||
print("Nodes subsystem initialized.\n");
|
||||
InitEnd();
|
||||
}
|
||||
|
||||
#ifdef NODE_DEBUG
|
||||
|
@ -231,13 +231,16 @@ SV_AddDebugPolygons(void)
|
|||
{
|
||||
Way_DrawDebugInfo();
|
||||
|
||||
if (!g_iNodes) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cvar("developer") != 1)
|
||||
return;
|
||||
|
||||
#if 1
|
||||
for (entity s = world; (s = find(s, ::classname, "func_tracktrain"));) {
|
||||
func_tracktrain train = (func_tracktrain)s;
|
||||
train.RenderDebugInfo();
|
||||
}
|
||||
#endif
|
||||
|
||||
makevectors(self.v_angle);
|
||||
|
||||
/* draw the rectangles */
|
||||
|
@ -251,6 +254,22 @@ SV_AddDebugPolygons(void)
|
|||
R_EndPolygon();
|
||||
}
|
||||
|
||||
for (entity s = world; (s = find(s, ::classname, "path_track"));) {
|
||||
vector pos = s.origin;
|
||||
pos[2] += 32;
|
||||
R_BeginPolygon("textures/dev/path_track", 0, 0);
|
||||
R_PolygonVertex(pos + v_right * 24 - v_up * 24, [1,1], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(pos - v_right * 24 - v_up * 24, [0,1], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(pos - v_right * 24 + v_up * 24, [0,0], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(pos + v_right * 24 + v_up * 24, [1,0], [1,1,1], 1.0f);
|
||||
R_EndPolygon();
|
||||
|
||||
R_BeginPolygon("", 0, 0);
|
||||
R_PolygonVertex(s.origin, [0,1], [1,1,1], NODE_LINE_ALPHA);
|
||||
R_PolygonVertex(pos, [1,1], [1,1,1], NODE_LINE_ALPHA);
|
||||
R_EndPolygon();
|
||||
}
|
||||
|
||||
for (entity s = world; (s = find(s, ::classname, "scripted_sequence"));) {
|
||||
vector pos = s.origin;
|
||||
pos[2] += 32;
|
||||
|
@ -267,45 +286,5 @@ SV_AddDebugPolygons(void)
|
|||
R_PolygonVertex(pos, [1,1], [1,1,1], NODE_LINE_ALPHA);
|
||||
R_EndPolygon();
|
||||
}
|
||||
|
||||
/* draw the radius */
|
||||
R_BeginPolygon("", 0, 0);
|
||||
for (int i = 0; i < g_iNodes; i++) {
|
||||
node_t *w = g_pNodes + i;
|
||||
vector org = w->origin;
|
||||
|
||||
for (float j = 0; j < (2 * M_PI); j += (2 * M_PI) / 4) {
|
||||
R_PolygonVertex(
|
||||
org + [sin(j),cos(j)]*w->radius,
|
||||
[1,1],
|
||||
[0,0.25,0],
|
||||
1.0f
|
||||
);
|
||||
}
|
||||
R_EndPolygon();
|
||||
}
|
||||
|
||||
/* draw the lines */
|
||||
R_BeginPolygon("", 1, 0);
|
||||
for (int i = 0; i < g_iNodes; i++) {
|
||||
node_t *w = g_pNodes+i;
|
||||
vector org = w->origin;
|
||||
vector rgb = [1,1,1];
|
||||
|
||||
for (int j = 0; j < w->nb_count; j++) {
|
||||
int k = w->nb[j].node;
|
||||
|
||||
/* check for invalids */
|
||||
if (k < 0 || k >= g_iNodes) {
|
||||
break;
|
||||
}
|
||||
|
||||
node_t *w2 = &g_pNodes[k];
|
||||
|
||||
R_PolygonVertex(org, [0,1], [1,1,1], NODE_LINE_ALPHA);
|
||||
R_PolygonVertex(w2->origin, [1,1], [1,1,1], NODE_LINE_ALPHA);
|
||||
R_EndPolygon();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,18 +31,20 @@ Plugin_Init(void)
|
|||
int i;
|
||||
|
||||
if (autocvar_sv_plugins) {
|
||||
print("--------- Initializing Plugins ----------\n");
|
||||
g_plugins_enabled = 1;
|
||||
} else {
|
||||
g_plugins_enabled = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
InitStart();
|
||||
|
||||
pdb = fopen("plugins.txt", FILE_READ);
|
||||
|
||||
if (pdb < 0) {
|
||||
print("^1no plugins.txt found.\n");
|
||||
NSWarning("No plugins.txt found. Plugins disabled.\n");
|
||||
g_plugins_enabled = 0;
|
||||
InitEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -85,7 +87,8 @@ Plugin_Init(void)
|
|||
}
|
||||
}
|
||||
|
||||
print(sprintf("initialized %i plugins.\n", g_plugincount));
|
||||
NSLog("...initialized %i plugins.", g_plugincount);
|
||||
InitEnd();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -27,8 +27,13 @@ This will almost always result in them using default values, or (worst case) 0.
|
|||
void
|
||||
Skill_Init(void)
|
||||
{
|
||||
string mapSkillFile = sprintf("maps/%s_skl.cfg", serverkey("mapname"));
|
||||
|
||||
Skill_ParseConfig("cfg/skill_manifest.cfg");
|
||||
Skill_ParseConfig(sprintf("maps/%s_skl.cfg", mapname));
|
||||
|
||||
if (FileExists(mapSkillFile)) {
|
||||
Skill_ParseConfig(mapSkillFile);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -68,7 +73,7 @@ Skill_ParseConfig(string fileName)
|
|||
filestream configFile = fopen(fileName, FILE_READ);
|
||||
|
||||
if (configFile < 0) {
|
||||
print(sprintf("^1Warning: Unable to exec %S for parsing.\n", fileName));
|
||||
NSWarning("Unable to exec %S for parsing.", fileName);
|
||||
return (false);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,4 +23,5 @@
|
|||
#define LF_WALK 0x00000010i
|
||||
#define LF_AIM 0x00000020i
|
||||
#define LF_USER 0x00000040i
|
||||
#define LF_HAZARDOUS 0x00000080i
|
||||
#define LF_DESTINATION 0x80000000i
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022 Vera Visions LLC.
|
||||
* Copyright (c) 2016-2024 Vera Visions LLC.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022 Vera Visions LLC.
|
||||
* Copyright (c) 2016-2024 Vera Visions LLC.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -62,19 +62,20 @@ public:
|
|||
virtual float predraw(void);
|
||||
#endif
|
||||
|
||||
/** Get the string value of an InfoKey. */
|
||||
nonvirtual string GetInfoKey(string);
|
||||
/** Floating point based version of GetInfoKey(). */
|
||||
nonvirtual float GetInfoKeyFloat(string);
|
||||
|
||||
#ifdef SERVER
|
||||
/** Server: This is where the input* variables arrive after sending them out from the client (see ClientInputFrame). This is also where we will instruct the server to run physics on the client. */
|
||||
virtual void ServerInputFrame(void);
|
||||
|
||||
/** Set the value of an InfoKey. */
|
||||
/** Server: Set the value of an InfoKey. */
|
||||
nonvirtual void SetInfoKey(string, string);
|
||||
/** Get the string value of an InfoKey. */
|
||||
nonvirtual string GetInfoKey(string);
|
||||
|
||||
/** Floating point based version of SetInfoKey(). */
|
||||
/** Server: Floating point based version of SetInfoKey(). */
|
||||
nonvirtual void SetInfoKeyFloat(string, float);
|
||||
/** Floating point based version of GetInfoKey(). */
|
||||
nonvirtual float GetInfoKeyFloat(string);
|
||||
|
||||
/* overrides */
|
||||
virtual void Save(float);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue