Add a level warp target entity to allow maps to trigger skipping ahead in a campaign...
authorMario <mario@smbclan.net>
Thu, 16 Feb 2017 13:54:27 +0000 (23:54 +1000)
committerMario <mario@smbclan.net>
Thu, 16 Feb 2017 13:54:27 +0000 (23:54 +1000)
qcsrc/common/triggers/target/_mod.inc
qcsrc/common/triggers/target/_mod.qh
qcsrc/common/triggers/target/include.qc
qcsrc/common/triggers/target/levelwarp.qc [new file with mode: 0644]
qcsrc/common/triggers/target/levelwarp.qh [new file with mode: 0644]

index 195d5e5..71bd8c1 100644 (file)
@@ -1,6 +1,7 @@
 // generated file; do not modify
 #include <common/triggers/target/changelevel.qc>
 #include <common/triggers/target/include.qc>
+#include <common/triggers/target/levelwarp.qc>
 #include <common/triggers/target/location.qc>
 #include <common/triggers/target/music.qc>
 #include <common/triggers/target/spawn.qc>
index a5462d4..6b06b75 100644 (file)
@@ -1,6 +1,7 @@
 // generated file; do not modify
 #include <common/triggers/target/changelevel.qh>
 #include <common/triggers/target/include.qh>
+#include <common/triggers/target/levelwarp.qh>
 #include <common/triggers/target/location.qh>
 #include <common/triggers/target/music.qh>
 #include <common/triggers/target/spawn.qh>
index c53ea6d..c643e47 100644 (file)
@@ -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 (file)
index 0000000..6cef53d
--- /dev/null
@@ -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 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once