Tweaked trigger_changelevel and info_landmark. Fixed a bug because

#regressions. It should now travel across the maps that didn't before, but
it needs more testing. trigger_transition is not implemented yet.
This commit is contained in:
Marco Cawthorne 2020-03-30 22:29:05 +02:00
parent 6e47ea30d1
commit e66d0214c4
5 changed files with 56 additions and 35 deletions

View File

@ -156,7 +156,7 @@ void CBaseMonster::FreeState(void)
/* trigger when required */
if (m_strRouteEnded) {
CBaseTrigger trigger;
CBaseTrigger trigger = 0;
trigger = (CBaseTrigger)find(trigger, CBaseTrigger::m_strTargetName, m_strRouteEnded);
if (!trigger) {
print(sprintf("^1CBaseMonster::FreeState^7: %s doesn't exist. Won't trigger\n", m_strRouteEnded));

View File

@ -14,7 +14,7 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*QUAKED monster_generic (1 0 0) (-8 -8 -8) (8 8 8)
/*QUAKED monster_generic (1 0 0) (-8 -8 -8) (8 8 8) x x MGF_NONSOLID
"targetname" Name
"angles" Sets the pitch, yaw and roll angles of the model.
"model" Model file that will be displayed by the entity.
@ -22,9 +22,12 @@
Decorative, does nothing yet.
*/
#define MGF_NONSOLID 4
class monster_generic:CBaseNPC
{
void() monster_generic;
virtual void() Respawn;
};
@ -32,15 +35,25 @@ void
monster_generic::Respawn(void)
{
CBaseNPC::Respawn();
takedamage = DAMAGE_NO;
iBleeds = FALSE;
solid = SOLID_NOT;
if (spawnflags & MGF_NONSOLID) {
takedamage = DAMAGE_NO;
iBleeds = FALSE;
solid = SOLID_NOT;
}
}
void
monster_generic::monster_generic(void)
{
base_mins = VEC_HULL_MIN;
base_maxs = VEC_HULL_MAX;
/* hackhackhackhackack */
if (model == "models/player.mdl" || model == "models/holo.mdl") {
base_mins = VEC_HULL_MIN;
base_maxs = VEC_HULL_MAX;
} else {
base_mins = [-16,-16,0];
base_maxs = [16,16,72];
}
CBaseNPC::CBaseNPC();
}

View File

@ -33,6 +33,11 @@ It'll have to be triggered by another entity.
vector g_landmarkpos;
class info_landmark:CBaseTrigger
{
};
enumflags
{
LC_NOINTERMISSION,
@ -68,12 +73,18 @@ int trigger_changelevel::IsInside(entity ePlayer, entity eVolume)
void trigger_changelevel::Change(void)
{
if (m_strLandmark) {
entity landmark = find(world, CBaseTrigger::m_strTargetName, m_strLandmark);
g_landmarkpos = m_activator.origin - landmark.origin;
#ifdef GS_DEVELOPER
print( sprintf( "%s::Change: Change to `%s` using landmark '%s'\n",
this.classname, m_strMap, m_strLandmark ) );
#endif
info_landmark landmark;
/* a trigger_transition may share the same targetname, thus we do this */
for (entity e = world; (e = find(e, ::classname, "info_landmark"));) {
info_landmark lm = (info_landmark)e;
/* found it */
if (lm.m_strTargetName == m_strLandmark) {
print(sprintf("^2trigger_changelevel::Change^7: Found landmark for %s\n", m_strLandmark));
landmark = lm;
g_landmarkpos = m_activator.origin - landmark.origin;
}
}
changelevel(m_strMap, m_strLandmark);
} else {
#ifdef GS_DEVELOPER
@ -90,14 +101,9 @@ void trigger_changelevel::Trigger(void)
return;
}
/*eVolume = find(world, ::targetname, m_strLandmark);
if (eVolume && eVolume.classname == "CTriggerVolume") {
if (IsInside(other, eVolume) == FALSE) {
return;
}
}*/
/* eActivator == player who triggered the damn thing */
m_activator = eActivator;
m_activator = other;
if (m_flChangeDelay) {
#ifdef GS_DEVELOPER
print( sprintf( "%s::Trigger: Delayed change to `%s` in %d sec/s\n",
@ -144,19 +150,23 @@ void trigger_changelevel::trigger_changelevel(void)
vector Landmark_GetSpot(void)
{
entity landmark = find(world, CBaseTrigger::m_strTargetName, startspot);
info_landmark landmark;
if (!landmark) {
print(sprintf("^1ERROR^7: Landmark_GetSpot: Cannot find startspot '%s'!\n",startspot));
/* return something useful? */
landmark = find(world, ::classname, "info_player_start");
return landmark.origin;
/* a trigger_transition may share the same targetname, thus we do this */
for (entity e = world; (e = find(e, ::classname, "info_landmark"));) {
info_landmark lm = (info_landmark)e;
/* found it */
if (lm.m_strTargetName == startspot) {
print(sprintf("^2Landmark_GetSpot^7: Found landmark for %s\n", startspot));
landmark = lm;
return landmark.origin + g_landmarkpos;
}
}
return landmark.origin + g_landmarkpos;
/* return something useful at least */
if (!landmark) {
entity ips = find(world, ::classname, "info_player_start");
print(sprintf("^1ERROR^7: Landmark_GetSpot: Cannot find startspot '%s'!\n",startspot));
return ips.origin;
}
}
class info_landmark:CBaseTrigger
{
};

View File

@ -47,7 +47,6 @@ string bcl_snddie[] = {
class monster_barnacle:CBaseMonster
{
void() monster_barnacle;
virtual void(int) Death;

View File

@ -92,7 +92,6 @@ string garg_sndpain[] = {
"garg/gar_pain3.wav"
};
class monster_gargantua:CBaseMonster
{
float m_flIdleTime;
@ -189,7 +188,7 @@ void monster_gargantua::monster_gargantua(void)
for (int i = 0; i < garg_sndstep.length; i++) {
precache_sound(garg_sndstep[i]);
}
netname = "Gargantua";
model = "models/garg.mdl";
base_health = Skill_GetValue("gargantua_health");