From 083f47bafe8c01dd7c67b5a33f7de4339d1ec492 Mon Sep 17 00:00:00 2001 From: flowtron Date: Wed, 6 Apr 2022 17:48:12 +0200 Subject: [PATCH] vantage point uses dummyent --- config/scripts.cfg | 2 +- source/src/entity.h | 9 +++++---- source/src/worldio.cpp | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/config/scripts.cfg b/config/scripts.cfg index a15ac00e..01ccfbae 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -444,7 +444,7 @@ const __entexp_ctf-flag [ result "angle: %1\nteam: %2" ] const __entexp_sound [ concatword "config slot: #%1\nradius: %2\nsize: %3\nvolume: %4\n\n\fs\f1slot #%1 info:\n" (format2 "\f9%1\fr\nmaxuses: %2" (editmapsoundslot (getentattr 0)))] const __entexp_clip [ result "elevation: %1\nx-radius: %2\ny-radius: %3\nheight: %4\nslope: %6\nshape: %7" ] const __entexp_plclip __entexp_clip -const __entexp_dummy [ result "n/a" ] +const __entexp_dummy [ if (= (getentattr 1) 222) [ result "The Vantage Point" ] [ result "n/a" ] ] const explainclosestentity [ if (>= (getclosestent) 0) [ diff --git a/source/src/entity.h b/source/src/entity.h index 12d10b54..cf3fb309 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -20,6 +20,7 @@ extern short entwraparound[MAXENTTYPES][7]; extern uchar entscale[MAXENTTYPES][7]; #define ENTSCALE10 10 #define ENTSCALE5 5 +#define VANTAGEDUMMY2 222 enum {MAP_IS_BAD, MAP_IS_EDITABLE, MAP_IS_GOOD}; @@ -537,10 +538,10 @@ public: void selectweapon(int w, bool other = false) { - if(weaponsel) prevweaponsel = weaponsel; - weaponsel = weapons[(gunselect = w)]; - if(!prevweaponsel) prevweaponsel = weaponsel; - if(other && (prevweaponsel != weaponsel)) weaponswitch(weaponsel, true); + if(weaponsel) prevweaponsel = weaponsel; + weaponsel = weapons[(gunselect = w)]; + if(!prevweaponsel) prevweaponsel = weaponsel; + if(other && (prevweaponsel != weaponsel)) weaponswitch(weaponsel, true); } void setprimary(int w) { primweap = weapons[(primary = w)]; } diff --git a/source/src/worldio.cpp b/source/src/worldio.cpp index 01595276..d274d7b2 100644 --- a/source/src/worldio.cpp +++ b/source/src/worldio.cpp @@ -1106,6 +1106,20 @@ int load_world(char *mname) // still supports all map formats that have e parseheaderextra(); popscontext(); + short p[5]; + if(getvantagepoint(p)) + { + entity &e = ents.add(); + e.type = DUMMYENT; + e.x = float(p[0])/DMF; + e.y = float(p[1])/DMF; + e.z = float(p[2])/DMF; + e.attr1 = p[3]; + e.attr2 = VANTAGEDUMMY2; + e.attr5 = p[4]; + e.spawned = false; + } + c2skeepalive(); watch.start();