]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Some more cleanup to map objects, allow trigger_delay and trigger_counter to be deact...
authorMario <mario.mario@y7mail.com>
Fri, 31 Jul 2020 10:21:38 +0000 (20:21 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 31 Jul 2020 10:21:38 +0000 (20:21 +1000)
14 files changed:
qcsrc/client/bgmscript.qh
qcsrc/common/mapobjects/_mod.inc
qcsrc/common/mapobjects/_mod.qh
qcsrc/common/mapobjects/bgmscript.qc [new file with mode: 0644]
qcsrc/common/mapobjects/bgmscript.qh [new file with mode: 0644]
qcsrc/common/mapobjects/misc/laser.qc
qcsrc/common/mapobjects/misc/laser.qh
qcsrc/common/mapobjects/models.qc
qcsrc/common/mapobjects/models.qh
qcsrc/common/mapobjects/trigger/counter.qc
qcsrc/common/mapobjects/trigger/counter.qh
qcsrc/common/mapobjects/trigger/delay.qc
qcsrc/common/mapobjects/trigger/gamestart.qc
qcsrc/common/mapobjects/trigger/keylock.qc

index a3044d537cd3200bedd070f38be867b801456e9e..e1be9c805ca69e4512c7b9038ccaa88a9eb617a7 100644 (file)
@@ -1,15 +1,8 @@
 #pragma once
 
-entityclass(BGMScript);
-classfield(BGMScript) .string bgmscript;
-classfield(BGMScript) .float bgmscriptattack;
-classfield(BGMScript) .float bgmscriptdecay;
-classfield(BGMScript) .float bgmscriptsustain;
-classfield(BGMScript) .float bgmscriptrelease;
+#include <common/mapobjects/bgmscript.qh>
 
 classfield(BGMScript) .float just_toggled;
 
-#ifdef CSQC
 void BGMScript_InitEntity(entity e);
 float doBGMScript(entity e);
-#endif
index 1aab2b927ec628cecc4ed2465a522f68972001f8..ebcbac55d6ccc45e8fb15ce39cdfe54983db3054 100644 (file)
@@ -1,4 +1,5 @@
 // generated file; do not modify
+#include <common/mapobjects/bgmscript.qc>
 #include <common/mapobjects/models.qc>
 #include <common/mapobjects/platforms.qc>
 #include <common/mapobjects/subs.qc>
index ebb7a43252a61022fec03bae3cc8b184a0fab7d9..87321822584ef0ec5d1220ce5b99f6d772db35d2 100644 (file)
@@ -1,4 +1,5 @@
 // generated file; do not modify
+#include <common/mapobjects/bgmscript.qh>
 #include <common/mapobjects/models.qh>
 #include <common/mapobjects/platforms.qh>
 #include <common/mapobjects/subs.qh>
diff --git a/qcsrc/common/mapobjects/bgmscript.qc b/qcsrc/common/mapobjects/bgmscript.qc
new file mode 100644 (file)
index 0000000..939444d
--- /dev/null
@@ -0,0 +1 @@
+#include "bgmscript.qh"
diff --git a/qcsrc/common/mapobjects/bgmscript.qh b/qcsrc/common/mapobjects/bgmscript.qh
new file mode 100644 (file)
index 0000000..e64bbbf
--- /dev/null
@@ -0,0 +1,8 @@
+#pragma once
+
+entityclass(BGMScript);
+classfield(BGMScript) .string bgmscript;
+classfield(BGMScript) .float bgmscriptattack;
+classfield(BGMScript) .float bgmscriptdecay;
+classfield(BGMScript) .float bgmscriptsustain;
+classfield(BGMScript) .float bgmscriptrelease;
index 403a4681328e7e92de5b13f110d94fce6aff06e4..812dce76beff338b65307631231a084e418a6c04 100644 (file)
@@ -10,7 +10,6 @@
 REGISTER_NET_LINKED(ENT_CLIENT_LASER)
 
 #ifdef SVQC
-.float modelscale;
 void misc_laser_aim(entity this)
 {
        vector a;
@@ -291,19 +290,6 @@ spawnfunc(misc_laser)
 }
 #elif defined(CSQC)
 
-// a laser goes from origin in direction angles
-// it has color 'beam_color'
-// and stops when something is in the way
-entityclass(Laser);
-classfield(Laser) .int cnt; // end effect
-classfield(Laser) .vector colormod;
-classfield(Laser) .int state; // on-off
-classfield(Laser) .int count; // flags for the laser
-classfield(Laser) .vector velocity; // laser endpoint if it is FINITE
-classfield(Laser) .float alpha;
-classfield(Laser) .float scale; // scaling factor of the thickness
-classfield(Laser) .float modelscale; // scaling factor of the dlight
-
 void Draw_Laser(entity this)
 {
        if(this.active == ACTIVE_NOT)
index 0ff57646ad760e1c3b8b884bec49c4b53b800ea3..d5b34f2e826a6cfad4fa396f3b44e700d06ae97d 100644 (file)
@@ -1,5 +1,17 @@
 #pragma once
 
+// a laser goes from origin in direction angles
+// it has color 'beam_color'
+// and stops when something is in the way
+entityclass(Laser);
+classfield(Laser) .int cnt; // end effect
+classfield(Laser) .vector colormod;
+classfield(Laser) .int state; // on-off
+classfield(Laser) .int count; // flags for the laser
+classfield(Laser) .vector velocity; // laser endpoint if it is FINITE
+classfield(Laser) .float alpha;
+classfield(Laser) .float scale; // scaling factor of the thickness
+classfield(Laser) .float modelscale; // scaling factor of the dlight
 
 const int LASER_FINITE = BIT(1);
 const int LASER_NOTRACE = BIT(2);
index 790978b99470eb6f98a554f7f8ea2340185f1707..bcaca193f476981a9c76041126dc5891e1592e40 100644 (file)
@@ -6,18 +6,10 @@
 #include <common/net_linked.qh>
 #include "subs.qh"
 #include "triggers.qh"
-
-entityclass(BGMScript);
-classfield(BGMScript) .string bgmscript;
-classfield(BGMScript) .float bgmscriptattack;
-classfield(BGMScript) .float bgmscriptdecay;
-classfield(BGMScript) .float bgmscriptsustain;
-classfield(BGMScript) .float bgmscriptrelease;
+#include "bgmscript.qh"
 
 #include <common/constants.qh>
-#include "../../lib/csqcmodel/sv_model.qh"
-
-.float modelscale;
+#include <lib/csqcmodel/sv_model.qh>
 
 void g_model_setcolormaptoactivator(entity this, entity actor, entity trigger)
 {
index 45346dc8ea70440affb817baa6e4ddd8e5888f5e..8d2e98d15249afc104a471676c954b20c6666b0e 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+.float modelscale;
+
 #ifdef CSQC
 entityclass(Wall);
 classfield(Wall) .float lip;
index 44cbd9045307f844f473b15e0895c4a959aebfa2..765d3180e2619d118edeeeda0c521d5e6858a74c 100644 (file)
@@ -1,9 +1,11 @@
 #include "counter.qh"
-#ifdef SVQC
-void counter_reset(entity this);
 
+#ifdef SVQC
 void counter_use(entity this, entity actor, entity trigger)
 {
+       if(this.active != ACTIVE_ACTIVE)
+               return;
+
        entity store = this;
        if(this.spawnflags & COUNTER_PER_PLAYER)
        {
@@ -66,6 +68,7 @@ void counter_reset(entity this)
        setthink(this, func_null);
        this.nextthink = 0;
        this.counter_cnt = 0;
+       this.active = ACTIVE_ACTIVE;
 }
 
 /*QUAKED spawnfunc_trigger_counter (.5 .5 .5) ? nomessage COUNTER_FIRE_AT_COUNT
@@ -86,5 +89,6 @@ spawnfunc(trigger_counter)
        this.counter_cnt = 0;
        this.use = counter_use;
        this.reset = counter_reset;
+       this.active = ACTIVE_ACTIVE;
 }
 #endif
index 403a87a8920b45361bbbd404a1ff55588c19b6ae..a34e95b831fb85e97243686ada7d225ee6ccfd1e 100644 (file)
@@ -1,7 +1,7 @@
 #pragma once
 
 #ifdef SVQC
-spawnfunc(trigger_counter);
+void counter_reset(entity this);
 
 .float counter_cnt;
 
index 2cd4cfd1338ac0809f3f9ff451a65ee3f5a59f8d..7e593a56c0b7850934bf9c9fe4ad0fc12ef54ca5 100644 (file)
@@ -1,4 +1,5 @@
 #include "delay.qh"
+
 #ifdef SVQC
 void delay_delayeduse(entity this)
 {
@@ -8,6 +9,9 @@ void delay_delayeduse(entity this)
 
 void delay_use(entity this, entity actor, entity trigger)
 {
+       if(this.active != ACTIVE_ACTIVE)
+               return;
+
        this.enemy = actor;
        this.goalentity = trigger;
        setthink(this, delay_delayeduse);
@@ -19,6 +23,7 @@ void delay_reset(entity this)
        this.enemy = this.goalentity = NULL;
        setthink(this, func_null);
        this.nextthink = 0;
+       this.active = ACTIVE_ACTIVE;
 }
 
 spawnfunc(trigger_delay)
@@ -28,5 +33,6 @@ spawnfunc(trigger_delay)
 
     this.use = delay_use;
     this.reset = delay_reset;
+    this.active = ACTIVE_ACTIVE;
 }
 #endif
index 72d76d183326437bdd4f5bcd7a38393d0a578268..e7ed67c455c59b956643130fa0154bad56ba8844 100644 (file)
@@ -1,14 +1,10 @@
 #include "gamestart.qh"
+
 #ifdef SVQC
 void gamestart_use(entity this, entity actor, entity trigger)
 {
        SUB_UseTargets(this, this, trigger);
-       delete(this);
-}
-
-void gamestart_use_this(entity this)
-{
-       gamestart_use(this, NULL, NULL);
+       delete(this); // TODO: deleting this means it can't be used upon map reset!
 }
 
 spawnfunc(trigger_gamestart)
@@ -22,7 +18,6 @@ spawnfunc(trigger_gamestart)
                this.nextthink = game_starttime + this.wait;
        }
        else
-               InitializeEntity(this, gamestart_use_this, INITPRIO_FINDTARGET);
+               InitializeEntity(this, adaptor_think2use, INITPRIO_FINDTARGET);
 }
-
 #endif
index f7ecd7c1f1ab8c5c0e3afd1e202085c2e27fd460..626a588dcb880ff625f3a7d29f68994ee274f04a 100644 (file)
@@ -169,16 +169,6 @@ spawnfunc(trigger_keylock)
        trigger_keylock_link(this);
 }
 #elif defined(CSQC)
-void keylock_remove(entity this)
-{
-       strfree(this.target);
-       strfree(this.target2);
-       strfree(this.target3);
-       strfree(this.target4);
-       strfree(this.killtarget);
-       strfree(this.targetname);
-}
-
 NET_HANDLE(ENT_CLIENT_KEYLOCK, bool isnew)
 {
        this.itemkeys = ReadInt24_t();
@@ -189,6 +179,6 @@ NET_HANDLE(ENT_CLIENT_KEYLOCK, bool isnew)
        return = true;
 
        this.classname = "trigger_keylock";
-       this.entremove = keylock_remove;
+       this.entremove = trigger_remove_generic;
 }
 #endif