From: Mario Date: Thu, 16 Feb 2017 13:54:27 +0000 (+1000) Subject: Add a level warp target entity to allow maps to trigger skipping ahead in a campaign... X-Git-Tag: xonotic-v0.8.2~203 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7ee5673f30485bb1feb91f3fb19cafd8baa71ff5;p=xonotic%2Fxonotic-data.pk3dir.git Add a level warp target entity to allow maps to trigger skipping ahead in a campaign (SMB-style warp zones) --- diff --git a/qcsrc/common/triggers/target/_mod.inc b/qcsrc/common/triggers/target/_mod.inc index 195d5e534..71bd8c11e 100644 --- a/qcsrc/common/triggers/target/_mod.inc +++ b/qcsrc/common/triggers/target/_mod.inc @@ -1,6 +1,7 @@ // generated file; do not modify #include #include +#include #include #include #include diff --git a/qcsrc/common/triggers/target/_mod.qh b/qcsrc/common/triggers/target/_mod.qh index a5462d497..6b06b75f1 100644 --- a/qcsrc/common/triggers/target/_mod.qh +++ b/qcsrc/common/triggers/target/_mod.qh @@ -1,6 +1,7 @@ // generated file; do not modify #include #include +#include #include #include #include diff --git a/qcsrc/common/triggers/target/include.qc b/qcsrc/common/triggers/target/include.qc index c53ea6d17..c643e4785 100644 --- a/qcsrc/common/triggers/target/include.qc +++ b/qcsrc/common/triggers/target/include.qc @@ -1,6 +1,7 @@ #include "include.qh" #include "changelevel.qc" +#include "levelwarp.qc" #include "location.qc" #include "music.qc" #include "spawn.qc" diff --git a/qcsrc/common/triggers/target/levelwarp.qc b/qcsrc/common/triggers/target/levelwarp.qc new file mode 100644 index 000000000..6cef53d6e --- /dev/null +++ b/qcsrc/common/triggers/target/levelwarp.qc @@ -0,0 +1,19 @@ +#include "levelwarp.qh" + +#ifdef SVQC +void target_levelwarp_use(entity this, entity actor, entity trigger) +{ + if(!autocvar_g_campaign) + return; // only in campaign + + if(this.cnt) + CampaignLevelWarp(this.cnt - 1); // specific level + else + CampaignLevelWarp(-1); // next level +} + +spawnfunc(target_levelwarp) +{ + this.use = target_levelwarp_use; +} +#endif diff --git a/qcsrc/common/triggers/target/levelwarp.qh b/qcsrc/common/triggers/target/levelwarp.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/triggers/target/levelwarp.qh @@ -0,0 +1 @@ +#pragma once