Fix a slew of warnings.

This commit is contained in:
Marco Cawthorne 2025-02-08 22:19:53 -08:00
parent 71dc508bad
commit 3e421aab57
30 changed files with 160 additions and 82 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -14,6 +14,8 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
float(vector org, float radius, vector lightcolours, optional float style, optional string cubemapname, optional float pflags) dynamiclight_spawnstatic2 = #0:dynamiclight_spawnstatic;
void Commandmenu_Open(void); void Commandmenu_Open(void);
void Commandmenu_Close(void); void Commandmenu_Close(void);
@ -24,12 +26,12 @@ CMD_testLight(void)
string cubeTexture = argv(1); string cubeTexture = argv(1);
if (STRING_SET(cubeTexture)) { if (STRING_SET(cubeTexture)) {
p = dynamiclight_spawnstatic(g_view.GetCameraOrigin(), 512, [1,1,1], 0, cubeTexture); p = dynamiclight_spawnstatic2(g_view.GetCameraOrigin(), 512, [1,1,1], 0, cubeTexture);
dynamiclight_set(p, LFIELD_ANGLES, g_view.GetCameraAngle()); dynamiclight_set(p, LFIELD_ANGLES, g_view.GetCameraAngle());
dynamiclight_set(p, LFIELD_FLAGS, LFLAG_NORMALMODE | LFLAG_REALTIMEMODE | LFLAG_SHADOWMAP); dynamiclight_set(p, LFIELD_FLAGS, LFLAG_NORMALMODE | LFLAG_REALTIMEMODE | LFLAG_SHADOWMAP);
dynamiclight_set(p, LFIELD_STYLE, 64); dynamiclight_set(p, LFIELD_STYLE, 64);
} else { } else {
p = dynamiclight_spawnstatic(g_view.GetCameraOrigin(), 512, [1,1,1], 0); p = dynamiclight_spawnstatic2(g_view.GetCameraOrigin(), 512, [1,1,1], 0);
dynamiclight_set(p, LFIELD_STYLE, 2); dynamiclight_set(p, LFIELD_STYLE, 2);
} }
@ -65,7 +67,7 @@ CMD_testSpotLight(void)
glow.RendererRestarted(); glow.RendererRestarted();
glow.vv_flags |= VFL_VIDREMOVE; glow.vv_flags |= VFL_VIDREMOVE;
} else { } else {
p = dynamiclight_spawnstatic(g_view.GetCameraOrigin(), 512, [1,1,1], 0); p = dynamiclight_spawnstatic2(g_view.GetCameraOrigin(), 512, [1,1,1], 0);
dynamiclight_set(p, LFIELD_STYLE, 2); dynamiclight_set(p, LFIELD_STYLE, 2);
} }
@ -77,7 +79,7 @@ CMD_testPointLight(void)
{ {
makevectors(g_view.GetCameraAngle()); makevectors(g_view.GetCameraAngle());
traceline(g_view.GetCameraOrigin(), g_view.GetCameraOrigin() + (v_forward * 4096.0f), MOVE_NORMAL, pSeat->m_ePlayer); traceline(g_view.GetCameraOrigin(), g_view.GetCameraOrigin() + (v_forward * 4096.0f), MOVE_NORMAL, pSeat->m_ePlayer);
dynamiclight_spawnstatic(trace_endpos + (v_forward * -16.0f), 1024, [1,1,1]); dynamiclight_spawnstatic2(trace_endpos + (v_forward * -16.0f), 1024, [1,1,1]);
} }
static void static void

View file

@ -42,9 +42,11 @@ public:
virtual void Restore(string,string); virtual void Restore(string,string);
nonvirtual void Setup(void); nonvirtual void Setup(void);
virtual void Touch(entity); virtual void Touch(entity);
virtual void Precaches(void);
private: private:
int m_iIsCan; int m_iIsCan;
string m_spawnSound;
}; };
void void
@ -52,6 +54,13 @@ item_food::item_food(void)
{ {
// TODO: differentiate between item_sodacan and item_food // TODO: differentiate between item_sodacan and item_food
m_iIsCan = 1; m_iIsCan = 1;
m_spawnSound = "weapons/g_bounce3.wav";
}
void
item_food::Precaches(void)
{
precache.Sound(m_spawnSound);
} }
void void
@ -94,7 +103,7 @@ item_food::Setup(void)
SetSize([-16,-16,-16], [16,16,16]); SetSize([-16,-16,-16], [16,16,16]);
//if (m_iIsCan) { //if (m_iIsCan) {
sound(this, CHAN_ITEM, "weapons/g_bounce3.wav", 1.0f, ATTN_NORM); sound(this, CHAN_ITEM, m_spawnSound, 1.0f, ATTN_NORM);
//} //}
} }

View file

@ -94,11 +94,13 @@ private:
int m_iSpawnDensity; int m_iSpawnDensity;
float m_flSpawnFrequency; float m_flSpawnFrequency;
float m_flSpawnCurrent; float m_flSpawnCurrent;
string m_bubbleModel;
}; };
void void
env_bubbles::env_bubbles(void) env_bubbles::env_bubbles(void)
{ {
m_bubbleModel = "sprites/bubble.spr";
} }
#ifdef SERVER #ifdef SERVER
@ -253,7 +255,7 @@ env_bubbles::EmitBubbles(void)
env_sprite eBubble = spawn(env_sprite); env_sprite eBubble = spawn(env_sprite);
setorigin(eBubble, vecPos); setorigin(eBubble, vecPos);
setmodel(eBubble, "sprites/bubble.spr"); setmodel(eBubble, m_bubbleModel);
eBubble.drawmask = MASK_ENGINE; eBubble.drawmask = MASK_ENGINE;
eBubble.SetRenderColor([255,255,255]); eBubble.SetRenderColor([255,255,255]);
eBubble.SetRenderMode(RM_ADDITIVE); eBubble.SetRenderMode(RM_ADDITIVE);
@ -354,5 +356,5 @@ env_bubbles::Respawn(void)
void void
env_bubbles::Precache(void) env_bubbles::Precache(void)
{ {
precache.Model("sprites/bubble.spr"); precache.Model(m_bubbleModel);
} }

View file

@ -46,6 +46,7 @@ public:
virtual float predraw(void); virtual float predraw(void);
virtual void ReceiveEntity(float,float); virtual void ReceiveEntity(float,float);
virtual void DrawSegment(vector, vector, vector); virtual void DrawSegment(vector, vector, vector);
virtual void RendererRestarted(void);
#endif #endif
#ifdef SERVER #ifdef SERVER
@ -91,9 +92,6 @@ phys_rope::DrawSegment(vector pos1, vector pos2, vector vecPlayer)
float float
phys_rope::predraw(void) phys_rope::predraw(void)
{ {
vector pos1;
vector pos2;
float segments;
vector vecPlayer; vector vecPlayer;
ncPlayer pl; ncPlayer pl;

View file

@ -164,9 +164,8 @@ ncNavInfo::FindEmptySpotNearPosition(entity traceEntity, vector position, float
vector testPos = g_vec_null; vector testPos = g_vec_null;
for (float yawTest = 0.0f; yawTest < 360.0f; yawTest += 10.0f) { for (float yawTest = 0.0f; yawTest < 360.0f; yawTest += 10.0f) {
vector testPos;
float distSquared; float distSquared;
vector testAngle = traceEntity.angles = [0, yawTest, 0]; testAngle = traceEntity.angles = [0, yawTest, 0];
testAngle[0] = testAngle[2] = 0.0f; testAngle[0] = testAngle[2] = 0.0f;
makevectors(testAngle); makevectors(testAngle);
testPos = position + (v_forward * 2048.0f); testPos = position + (v_forward * 2048.0f);
@ -185,10 +184,10 @@ ncNavInfo::FindEmptySpotNearPosition(entity traceEntity, vector position, float
} }
for (float dist = minRadius; dist < maxRadius; dist += ((maxRadius - minRadius) / 16.0f)) { for (float dist = minRadius; dist < maxRadius; dist += ((maxRadius - minRadius) / 16.0f)) {
vector testAngle = [0, bestYaw, 0]; testAngle = [0, bestYaw, 0];
testAngle[0] = testAngle[2] = 0.0f; testAngle[0] = testAngle[2] = 0.0f;
makevectors(testAngle); makevectors(testAngle);
vector testPos = position + (v_forward * dist); testPos = position + (v_forward * dist);
tracebox(testPos, traceEntity.mins, traceEntity.maxs, testPos, MOVE_NORMAL, traceEntity); tracebox(testPos, traceEntity.mins, traceEntity.maxs, testPos, MOVE_NORMAL, traceEntity);
if (!trace_startsolid) { if (!trace_startsolid) {
@ -209,9 +208,8 @@ ncNavInfo::FindEmptySpotAwayFromPosition(entity traceEntity, vector position, fl
vector testPos = g_vec_null; vector testPos = g_vec_null;
for (float yawTest = 0.0f; yawTest < 360.0f; yawTest += 10.0f) { for (float yawTest = 0.0f; yawTest < 360.0f; yawTest += 10.0f) {
vector testPos;
float distSquared; float distSquared;
vector testAngle = traceEntity.angles = [0, yawTest, 0]; testAngle = traceEntity.angles = [0, yawTest, 0];
testAngle[0] = testAngle[2] = 0.0f; testAngle[0] = testAngle[2] = 0.0f;
makevectors(testAngle); makevectors(testAngle);
testPos = position + (v_forward * 2048.0f); testPos = position + (v_forward * 2048.0f);
@ -230,10 +228,10 @@ ncNavInfo::FindEmptySpotAwayFromPosition(entity traceEntity, vector position, fl
} }
for (float dist = maxRadius; dist > minRadius; dist -= ((maxRadius - minRadius) / 16.0f)) { for (float dist = maxRadius; dist > minRadius; dist -= ((maxRadius - minRadius) / 16.0f)) {
vector testAngle = [0, bestYaw, 0]; testAngle = [0, bestYaw, 0];
testAngle[0] = testAngle[2] = 0.0f; testAngle[0] = testAngle[2] = 0.0f;
makevectors(testAngle); makevectors(testAngle);
vector testPos = position + (v_forward * dist); testPos = position + (v_forward * dist);
tracebox(testPos, traceEntity.mins, traceEntity.maxs, testPos, MOVE_NORMAL, traceEntity); tracebox(testPos, traceEntity.mins, traceEntity.maxs, testPos, MOVE_NORMAL, traceEntity);
if (!trace_startsolid) { if (!trace_startsolid) {

View file

@ -46,8 +46,8 @@ ncSchedule::InProgress(void)
void void
ncSchedule::Advance(void) ncSchedule::Advance(void)
{ {
string taskInput; string taskInput = "";
string taskParms; string taskParms = "";
bool shouldCancel = false; bool shouldCancel = false;
if (wasfreed(this)) { if (wasfreed(this)) {
@ -180,7 +180,7 @@ ncSchedule::Message(string messageString)
} }
if (lookUpValue) { if (lookUpValue) {
EntLog("^1schedule killed by message.", taskInput, taskParameter); EntLog("^1schedule killed by message.");
ReleaseThink(); ReleaseThink();
Cancel(); Cancel();
} }

View file

@ -53,6 +53,30 @@ SVPF_game_CleanUpMap(void)
multicast([0,0,0], MULTICAST_ALL); multicast([0,0,0], MULTICAST_ALL);
} }
entity
SVPF_ents_NextItem(entity lastItem)
{
return findfloat(lastItem, ::_isItem, 1);
}
entity
SVPF_ents_NextWeapon(entity lastItem)
{
return findfloat(lastItem, ::_isWeapon, 1);
}
entity
SVPF_ents_NextActor(entity lastItem)
{
return findfloat(lastItem, ::_isActor, 1);
}
entity
SVPF_ents_NextPlayer(entity lastItem)
{
return findfloat(lastItem, ::_isPlayer, 1);
}
string string
SVPF_game_GetMap(void) SVPF_game_GetMap(void)
{ {

View file

@ -93,6 +93,34 @@ typedef struct
@param entityToCheck specifies the entity to check.*/ @param entityToCheck specifies the entity to check.*/
bool isBot(entity entityToCheck); bool isBot(entity entityToCheck);
/** Returns the next entity of type 'Item' in the game.
@param lastItem The previous item, can be `world` or `__NULL__` or `0` to retrieve the first item.
@return The next item in the entity pool. Will be `world` or `__NULL__` if none are left. */
entity NextItem(entity lastItem);
/** Returns the next entity of type 'Weapon' in the game.
@param lastWeapon The previous item, can be `world` or `__NULL__` or `0` to retrieve the first item.
@return The next item in the entity pool. Will be `world` or `__NULL__` if none are left. */
entity NextWeapon(entity lastWeapon);
/** Returns the next entity of type 'Actor' in the game.
@param lastActor The previous item, can be `world` or `__NULL__` or `0` to retrieve the first item.
@return The next item in the entity pool. Will be `world` or `__NULL__` if none are left. */
entity NextActor(entity lastActor);
/** Returns the next entity of type 'Player' in the game.
@param lastPlayer The previous item, can be `world` or `__NULL__` or `0` to retrieve the first item.
@return The next item in the entity pool. Will be `world` or `__NULL__` if none are left. */
entity NextPlayer(entity lastPlayer);
} entsAPI_t; } entsAPI_t;
var entsAPI_t ents; var entsAPI_t ents;
@ -214,6 +242,12 @@ _server_main(void)
ents.isPlayer = linkToServerProgs("isPlayer"); ents.isPlayer = linkToServerProgs("isPlayer");
ents.isSentient = linkToServerProgs("isSentient"); ents.isSentient = linkToServerProgs("isSentient");
/* helpful finder */
ents.NextActor = linkToServerProgs("SVPF_ents_NextActor");
ents.NextItem = linkToServerProgs("SVPF_ents_NextItem");
ents.NextWeapon = linkToServerProgs("SVPF_ents_NextWeapon");
ents.NextPlayer = linkToServerProgs("SVPF_ents_NextPlayer");
actor.GetInventory = linkToServerProgs("SVPF_actor_GetInventory"); actor.GetInventory = linkToServerProgs("SVPF_actor_GetInventory");
actor.GetReserveAmmo = linkToServerProgs("SVPF_actor_GetReserveAmmo"); actor.GetReserveAmmo = linkToServerProgs("SVPF_actor_GetReserveAmmo");
actor.MaxAmmo = linkToServerProgs("SVPF_actor_MaxAmmo"); actor.MaxAmmo = linkToServerProgs("SVPF_actor_MaxAmmo");

View file

@ -703,7 +703,7 @@ CheckSpawn(void() spawnfunc)
1. maptweaks, can override anything. 1. maptweaks, can override anything.
2. entitydef, can even override built-in class names 2. entitydef, can even override built-in class names
2.0 entitydef, defined in a map (maps/foobar.def) 2.0 entitydef, defined in a map (maps/foobar.def)
2.1 entitydef, defined within decls/def/*.def 2.1 entitydef, defined within decls/def/X.def
3. in-code classes */ 3. in-code classes */
if (MapTweak_EntitySpawn(ent) == true) { if (MapTweak_EntitySpawn(ent) == true) {
skipLoad = true; skipLoad = true;

View file

@ -165,7 +165,7 @@ public:
/** Overridable: Called regularily to select a new schedule to perform. */ /** Overridable: Called regularily to select a new schedule to perform. */
virtual void SelectNewSchedule(void); virtual void SelectNewSchedule(void);
nonvirtual void ScheduleThink(void); nonvirtual void ThinkSchedules(void);
/** Forces a named schedule to be performed. */ /** Forces a named schedule to be performed. */
nonvirtual bool CancelSchedule(void); nonvirtual bool CancelSchedule(void);
@ -261,6 +261,7 @@ private:
.ncItem m_itemList; .ncItem m_itemList;
.ncWeapon m_activeWeapon; .ncWeapon m_activeWeapon;
.ncWeapon m_firstWeapon; .ncWeapon m_firstWeapon;
.bool _isActor;
void ncActor_ListInventory(ncActor); void ncActor_ListInventory(ncActor);

View file

@ -14,7 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
void void
ncActor::ncActor(void) ncActor::ncActor(void)
{ {
@ -268,7 +267,7 @@ void
ncActor::Spawned(void) ncActor::Spawned(void)
{ {
super::Spawned(); super::Spawned();
isActor = true; _isActor = true;
/* let's not waste time and resources */ /* let's not waste time and resources */
if (wasfreed(this)) { if (wasfreed(this)) {
@ -346,7 +345,7 @@ ncActor::RestoreComplete(void)
} }
void void
ncActor::ScheduleThink(void) ncActor::ThinkSchedules(void)
{ {
if (IsPerforming() == false && m_iNodes <= 0i) { if (IsPerforming() == false && m_iNodes <= 0i) {
SelectNewSchedule(); SelectNewSchedule();
@ -470,7 +469,7 @@ ncActor::Input(entity eAct, string strInput, string strData)
m_activeSchedule.AdvanceLater(100); m_activeSchedule.AdvanceLater(100);
break; break;
case "TargetNearestPlayer": case "TargetNearestPlayer":
entity firstPlayer = find(world, ::classname, "player"); ncEntity firstPlayer = (ncEntity)find(world, ::classname, "player");
if (firstPlayer) { if (firstPlayer) {
m_activeSchedule.SetTarget(firstPlayer); m_activeSchedule.SetTarget(firstPlayer);
@ -489,10 +488,10 @@ ncActor::Input(entity eAct, string strInput, string strData)
} }
break; break;
case "GoToSpotInRadius": case "GoToSpotInRadius":
vector t = ncNavInfo::FindEmptySpotNearPosition(this, GetOrigin(), 128.0f, stof(strData)); vector spot1 = ncNavInfo::FindEmptySpotNearPosition(this, GetOrigin(), 128.0f, stof(strData));
if (vlen(t) > 0.0f) { if (vlen(spot1) > 0.0f) {
RouteToPosition(t); RouteToPosition(spot1);
} else { } else {
CancelSchedule(); CancelSchedule();
} }
@ -641,7 +640,7 @@ ncActor::CheckRouteProgression(void)
/* it's accessible */ /* it's accessible */
if (!trace_startsolid && trace_fraction == 1.0f) { if (!trace_startsolid && trace_fraction == 1.0f) {
vector idealAngles = vectoangles(vecNextNode - origin); idealAngles = vectoangles(vecNextNode - origin);
evenpos = vecNextNode; evenpos = vecNextNode;
m_iCurNode = iNextNode; m_iCurNode = iNextNode;

View file

@ -280,7 +280,6 @@ private:
x = CreateOutput(x); \ x = CreateOutput(x); \
} }
.bool isActor;
.bool _mapspawned; .bool _mapspawned;
void void

View file

@ -39,7 +39,10 @@ ncIO::ncIO(void)
effects |= EF_NOSHADOW; effects |= EF_NOSHADOW;
#endif #endif
m_strEditorIcon = "gfx/icon16/bullet_purple"; m_strEditorIcon = "gfx/icon16/bullet_purple";
isActor = false; _isActor = false;
_isItem = false;
_isPlayer = false;
_isWeapon = false;
} }
void void

View file

@ -87,6 +87,7 @@ public:
nonvirtual void SetSpinning(bool); nonvirtual void SetSpinning(bool);
nonvirtual bool GetSpinning(void); nonvirtual bool GetSpinning(void);
nonvirtual void PickupRespawn(void); nonvirtual void PickupRespawn(void);
nonvirtual void SetRespawnTime(float);
/* only if the entity is usable in the inventory. */ /* only if the entity is usable in the inventory. */
virtual void OnInventoryUse(void); virtual void OnInventoryUse(void);
@ -130,6 +131,7 @@ private:
int m_iInvItem; int m_iInvItem;
string m_sndAcquire; string m_sndAcquire;
string m_sndRespawn; string m_sndRespawn;
float m_flRespawn;
string m_sndHum; string m_sndHum;
int m_bFloating; int m_bFloating;
bool m_bSpins; bool m_bSpins;
@ -149,6 +151,11 @@ private:
NETWORKED_FLOAT(owner_entnum) NETWORKED_FLOAT(owner_entnum)
#endif #endif
#ifdef SERVER
float m_hiddenModelIndex;
float m_hiddenSequence;
#endif
ncItem m_nextItem; ncItem m_nextItem;
ncItem m_nextItem_net; ncItem m_nextItem_net;
entity owner_net; entity owner_net;

View file

@ -31,6 +31,7 @@ ncItem::ncItem(void)
m_strRequires = __NULL__; m_strRequires = __NULL__;
m_nextItem = __NULL__; m_nextItem = __NULL__;
owner = __NULL__; owner = __NULL__;
m_flRespawn = 0;
} }
#ifdef SERVER #ifdef SERVER
@ -123,6 +124,9 @@ ncItem::SpawnKey(string strKey, string strValue)
case "requires": case "requires":
m_strRequires = ReadString(strValue); m_strRequires = ReadString(strValue);
break; break;
case "respawn":
m_flRespawn = ReadFloat(strValue);
break;
default: default:
super::SpawnKey(strKey, strValue); super::SpawnKey(strKey, strValue);
break; break;
@ -207,6 +211,10 @@ void
ncItem::Input(entity eAct, string strInput, string strData) ncItem::Input(entity eAct, string strInput, string strData)
{ {
switch (strInput) { switch (strInput) {
/* gamemodes can alternatively use this to set the respawn time of items post-init */
case "SetRespawnTime":
SetRespawnTime(stof(strData));
break;
default: default:
ncTrigger::Input(eAct, strInput, strData); ncTrigger::Input(eAct, strInput, strData);
} }
@ -218,6 +226,12 @@ ncItem::OnUse(entity user)
} }
void
ncItem::SetRespawnTime(float newTime)
{
m_flRespawn = newTime;
}
bool bool
ncItem::ItemPickupCheck(entity pickerUpper) ncItem::ItemPickupCheck(entity pickerUpper)
{ {
@ -281,13 +295,24 @@ ncItem::Touch(entity eToucher)
/* don't remove if AddItem fails */ /* don't remove if AddItem fails */
string itemToAdd = (m_strInvWeapon) ? m_strInvWeapon : classname; string itemToAdd = (m_strInvWeapon) ? m_strInvWeapon : classname;
pl.GiveItem(itemToAdd); pl.GiveItem(itemToAdd);
/* if we have the carry flag set in addition, we'll put in an extra copy of this item */
if (STRING_SET(m_strInvWeapon) && m_bInvCarry) {
pl.GiveItem(classname);
}
UseTargets(pl, TRIG_TOGGLE, m_flDelay); UseTargets(pl, TRIG_TOGGLE, m_flDelay);
if (real_owner || m_iWasDropped == 1 || cvar("sv_playerslots") == 1) { if (m_flRespawn <= 0) {
Destroy(); Destroy();
} else {
if (m_hiddenSequence) {
SetFrame(m_hiddenSequence);
} else { } else {
Disappear(); Disappear();
ScheduleThink(PickupRespawn, 30.0f); }
ScheduleThink(PickupRespawn, m_flRespawn);
} }
} }
@ -359,6 +384,8 @@ ncItem::BecomePickup(void)
modelflags &= ~MF_ROTATE; modelflags &= ~MF_ROTATE;
Show(); Show();
SetFrame(GetSpawnFloat("frame"));
m_hiddenSequence = GetSpawnFloat("hidden_frame");
if (/*GetSpawnBool("physics") == true*/ 0) { if (/*GetSpawnBool("physics") == true*/ 0) {
/* be shootable! */ /* be shootable! */

View file

@ -390,10 +390,14 @@ public:
virtual void TriggerTargets(void); virtual void TriggerTargets(void);
virtual void Trigger(entity, triggermode_t); virtual void Trigger(entity, triggermode_t);
nonvirtual void AlertNearbyToSchedule(string scheduleType);
nonvirtual bool ShouldTurn(void);
#endif #endif
nonvirtual vector GetHeadAngles(void); nonvirtual vector GetHeadAngles(void);
virtual void DebugDraw(void);
#ifdef CLIENT #ifdef CLIENT
/** overrides */ /** overrides */

View file

@ -842,7 +842,7 @@ ncMonster::SeeThink(void)
} }
/* iterate through all players, monsters. */ /* iterate through all players, monsters. */
for (entity w = world; (w = findfloat(w, ::isActor, 1));) { for (entity w = world; (w = findfloat(w, ::_isActor, 1));) {
if (w.takedamage == DAMAGE_NO) if (w.takedamage == DAMAGE_NO)
continue; continue;
@ -1637,7 +1637,7 @@ ncMonster::RunAI(void)
} }
if (InScriptedSequence() == false) { if (InScriptedSequence() == false) {
ScheduleThink(); ThinkSchedules();
} }
SeeThink(); SeeThink();
@ -2244,8 +2244,7 @@ ncMonster::Input( entity entityActivator, string inputName, string dataField )
AnimPlay(GetDefAct(dataField)); AnimPlay(GetDefAct(dataField));
if (m_activeSchedule) { if (m_activeSchedule) {
float waitTime = frameduration(modelindex, frame); m_activeSchedule.AdvanceLater(frameduration(modelindex, frame));
m_activeSchedule.AdvanceLater(waitTime);
} }
} }
break; break;
@ -2257,12 +2256,11 @@ ncMonster::Input( entity entityActivator, string inputName, string dataField )
AnimPlay(frameforname(modelindex, dataField)); AnimPlay(frameforname(modelindex, dataField));
if (m_activeSchedule) { if (m_activeSchedule) {
float waitTime = frameduration(modelindex, frame); m_activeSchedule.AdvanceLater(frameduration(modelindex, frame));
m_activeSchedule.AdvanceLater(waitTime);
} }
} else { } else {
NSError("'PlaySequence' without animation sequence, blame %S (%d)", entityActivator, num_for_edict(entityActivator)); NSError("'PlaySequence' without animation sequence, blame %S (%d)", entityActivator.classname, num_for_edict(entityActivator));
} }
break; break;
case "FindCoverFromEnemy": case "FindCoverFromEnemy":

View file

@ -590,16 +590,17 @@ ncPhysicsEntity::Touch(entity eToucher)
} }
} }
ncDict damageDecl;
if (eToucher && impactForce >= 1.0 && eToucher.takedamage != DAMAGE_NO) { if (eToucher && impactForce >= 1.0 && eToucher.takedamage != DAMAGE_NO) {
ncSurfacePropEntity impactingEntity = (ncSurfacePropEntity)eToucher; ncSurfacePropEntity impactingEntity = (ncSurfacePropEntity)eToucher;
ncDict damageDecl = spawn(ncDict); damageDecl = spawn(ncDict);
damageDecl.AddKey("damage", ftos(impactForce)); damageDecl.AddKey("damage", ftos(impactForce));
damageDecl.AddKey("push", "0"); /* avoid physics recursion/amplification */ damageDecl.AddKey("push", "0"); /* avoid physics recursion/amplification */
impactingEntity.Damage(this, this, damageDecl, 1.0f, g_vec_null, GetOrigin()); impactingEntity.Damage(this, this, damageDecl, 1.0f, g_vec_null, GetOrigin());
remove(damageDecl); remove(damageDecl);
} else { } else {
if (impactForce > GetHealth()) { if (impactForce > GetHealth()) {
ncDict damageDecl = spawn(ncDict); damageDecl = spawn(ncDict);
damageDecl.AddKey("damage", ftos(impactForce)); damageDecl.AddKey("damage", ftos(impactForce));
damageDecl.AddKey("push", "0"); /* avoid physics recursion/amplification */ damageDecl.AddKey("push", "0"); /* avoid physics recursion/amplification */
Damage(eToucher, eToucher, damageDecl, 1.0f, g_vec_null, GetOrigin()); Damage(eToucher, eToucher, damageDecl, 1.0f, g_vec_null, GetOrigin());

View file

@ -237,3 +237,5 @@ enumflags
#ifdef SERVER #ifdef SERVER
void obituary(string, string, string, string); void obituary(string, string, string, string);
#endif #endif
.bool _isPlayer;

View file

@ -17,6 +17,7 @@
void void
ncPlayer::ncPlayer(void) ncPlayer::ncPlayer(void)
{ {
_isPlayer = true;
flags |= FL_CLIENT; flags |= FL_CLIENT;
vehicle = __NULL__; vehicle = __NULL__;
} }

View file

@ -560,7 +560,7 @@ ncProjectile::Touch(entity eToucher)
if (eToucher.takedamage != DAMAGE_NO) { if (eToucher.takedamage != DAMAGE_NO) {
m_hitLocation = m_vecImpactPos; m_hitLocation = m_vecImpactPos;
m_eMultiTarget = eToucher; m_eMultiTarget = (ncSurfacePropEntity)eToucher;
m_iMultiValue = GetSubDefInt(m_defDamage, "damage"); m_iMultiValue = GetSubDefInt(m_defDamage, "damage");
_ApplyDamage(); _ApplyDamage();
} }

View file

@ -732,7 +732,7 @@ ncTalkMonster::RunAI(void)
} }
if (InScriptedSequence() == false) { if (InScriptedSequence() == false) {
ScheduleThink(); ThinkSchedules();
} }
SeeThink(); SeeThink();

View file

@ -198,13 +198,6 @@ string Util_TimeToString(float fTime);
bool Util_IsTeamplay(void); bool Util_IsTeamplay(void);
bool Util_IsPaused(void); bool Util_IsPaused(void);
__wrap void
dprint(string m)
{
if (cvar("developer") == 1)
return prior(m);
}
void void
crossprint(string m) crossprint(string m)
{ {

View file

@ -439,6 +439,8 @@ EntityDef_PrepareEntity(entity target, int id)
static void static void
EntityDef_Precaches(int index) EntityDef_Precaches(int index)
{ {
int defID = 0i;
if (time > 2.0f) { if (time > 2.0f) {
return; return;
} }
@ -458,7 +460,7 @@ EntityDef_Precaches(int index)
} else if (substring(strKey, 0, 6) == "model_") { } else if (substring(strKey, 0, 6) == "model_") {
precache.Model(strValue); precache.Model(strValue);
} else if (substring(strKey, 0, 4) == "def_" || (strKey == "item")) { } else if (substring(strKey, 0, 4) == "def_" || (strKey == "item")) {
int defID = EntityDef_IDFromName(strValue); defID = EntityDef_IDFromName(strValue);
/* only precache valid def, and avoid recursion */ /* only precache valid def, and avoid recursion */
if (defID != -1 && defID != index) { if (defID != -1 && defID != index) {
@ -467,7 +469,7 @@ EntityDef_Precaches(int index)
} else if (strKey == "weapon") { } else if (strKey == "weapon") {
for (int w = 0; w < tokenizebyseparator(strValue, ","); w++) { for (int w = 0; w < tokenizebyseparator(strValue, ","); w++) {
string weaponName = argv(w); string weaponName = argv(w);
int defID = EntityDef_IDFromName(weaponName); defID = EntityDef_IDFromName(weaponName);
/* only precache valid def, and avoid recursion */ /* only precache valid def, and avoid recursion */
if (defID != -1 && defID != index) { if (defID != -1 && defID != index) {

View file

@ -151,32 +151,26 @@ Sound_ParseField(int i, int a, string keyName, string valueCS)
break; break;
case "dist_min": case "dist_min":
if (a == 2) { if (a == 2) {
dprint("\tMin distance set\n");
g_sounds[i].dist_min = stof(setValue); g_sounds[i].dist_min = stof(setValue);
} }
break; break;
case "dist_max": case "dist_max":
if (a == 2) { if (a == 2) {
dprint("\tMax distance set\n");
g_sounds[i].dist_max = stof(setValue); g_sounds[i].dist_max = stof(setValue);
} }
break; break;
case "volume": case "volume":
if (a == 2) { if (a == 2) {
dprint("\tVolume set\n");
g_sounds[i].volume = stof(setValue); g_sounds[i].volume = stof(setValue);
} }
break; break;
case "shakes": case "shakes":
if (a == 2) { if (a == 2) {
dprint("\tShake set\n");
g_sounds[i].shakes = stof(setValue); g_sounds[i].shakes = stof(setValue);
} }
break; break;
case "pitch": case "pitch":
if (a == 2) { if (a == 2) {
dprint("\tPitch set\n");
int comma = tokenizebyseparator(setValue, ","); int comma = tokenizebyseparator(setValue, ",");
if (comma == 2) { if (comma == 2) {
@ -190,48 +184,38 @@ Sound_ParseField(int i, int a, string keyName, string valueCS)
break; break;
case "pitch_min": case "pitch_min":
if (a == 2) { if (a == 2) {
dprint("\tMinimum pitch set\n");
g_sounds[i].pitch_min = fabs(stof(setValue)) * 100; g_sounds[i].pitch_min = fabs(stof(setValue)) * 100;
} }
break; break;
case "pitch_max": case "pitch_max":
if (a == 2) { if (a == 2) {
dprint("\tMaximum pitch set\n");
g_sounds[i].pitch_max = fabs(stof(setValue)) * 100; g_sounds[i].pitch_max = fabs(stof(setValue)) * 100;
} }
break; break;
case "offset": case "offset":
if (a == 2) { if (a == 2) {
dprint("\tOffset set\n");
g_sounds[i].offset = stof(setValue); g_sounds[i].offset = stof(setValue);
} }
break; break;
case "looping": case "looping":
dprint("\tSound set to loop\n");
g_sounds[i].flags |= SNDFL_LOOPING; g_sounds[i].flags |= SNDFL_LOOPING;
break; break;
case "nodups": case "nodups":
dprint("\tSound set to not play duplicate samples\n");
g_sounds[i].flags |= SNDFL_NODUPS; g_sounds[i].flags |= SNDFL_NODUPS;
break; break;
case "global": case "global":
dprint("\tSound set to play everywhere\n");
g_sounds[i].flags |= SNDFL_GLOBAL; g_sounds[i].flags |= SNDFL_GLOBAL;
break; break;
case "private": case "private":
dprint("\tSound set to play privately\n");
g_sounds[i].flags |= SNDFL_PRIVATE; g_sounds[i].flags |= SNDFL_PRIVATE;
break; break;
case "no_reverb": case "no_reverb":
dprint("\tSound set to ignore reverb\n");
g_sounds[i].flags |= SNDFL_NOREVERB; g_sounds[i].flags |= SNDFL_NOREVERB;
break; break;
case "omnidirectional": case "omnidirectional":
dprint("\tSound set to be omnidirectional\n");
g_sounds[i].flags |= SNDFL_OMNI; g_sounds[i].flags |= SNDFL_OMNI;
break; break;
case "follow": case "follow":
dprint("\tSound set to follow\n");
g_sounds[i].flags |= SNDFL_FOLLOW; g_sounds[i].flags |= SNDFL_FOLLOW;
break; break;
case "footstep": case "footstep":
@ -244,7 +228,6 @@ Sound_ParseField(int i, int a, string keyName, string valueCS)
g_sounds[i].pointparticle = particleeffectnum(valueCS); g_sounds[i].pointparticle = particleeffectnum(valueCS);
break; break;
case "alerts": case "alerts":
dprint("\tSound set to alert enemy AI\n");
g_sounds[i].flags |= SNDFL_ALERTS; g_sounds[i].flags |= SNDFL_ALERTS;
break; break;
case "wave": case "wave":
@ -261,10 +244,6 @@ Sound_ParseField(int i, int a, string keyName, string valueCS)
case "sample": case "sample":
if (a == 2) { if (a == 2) {
dprint("\tAdded sample ");
dprint(setValue);
dprint("\n");
if (precacheSound) if (precacheSound)
precache_sound(setValue); precache_sound(setValue);
@ -300,7 +279,6 @@ Sound_Parse(int i, string line, string shader)
break; break;
} }
dprint("{\n");
braced = TRUE; braced = TRUE;
break; break;
case "}": case "}":
@ -308,7 +286,6 @@ Sound_Parse(int i, string line, string shader)
if (braced == FALSE) { if (braced == FALSE) {
break; break;
} }
dprint("}\n");
braced = FALSE; braced = FALSE;
t_name = ""; t_name = "";
return (1); return (1);
@ -322,9 +299,6 @@ Sound_Parse(int i, string line, string shader)
if (t_name == shader) { if (t_name == shader) {
/* I guess it's what we want */ /* I guess it's what we want */
dprint("Found shader ");
dprint(shader);
dprint(":\n");
g_sounds[i].name = shader; g_sounds[i].name = shader;
} else { } else {
/* not what we're looking for */ /* not what we're looking for */