]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Tidy up classnames
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 18 Oct 2020 03:07:43 +0000 (03:07 +0000)
committerMario <mario.mario@y7mail.com>
Sun, 18 Oct 2020 03:07:43 +0000 (03:07 +0000)
68 files changed:
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/teamradar.qc
qcsrc/client/weapons/projectile.qc
qcsrc/common/effects/qc/casings.qc
qcsrc/common/effects/qc/gibs.qc
qcsrc/common/effects/qc/rubble.qh
qcsrc/common/ent_cs.qc
qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc
qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc
qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc
qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc
qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc
qcsrc/common/gamemodes/gamemode/tdm/sv_tdm.qc
qcsrc/common/mapobjects/func/breakable.qc
qcsrc/common/mapobjects/func/door.qc
qcsrc/common/mapobjects/misc/keys.qc
qcsrc/common/mapobjects/misc/teleport_dest.qc
qcsrc/common/mapobjects/platforms.qc
qcsrc/common/mapobjects/target/location.qc
qcsrc/common/mapobjects/trigger/gravity.qc
qcsrc/common/mapobjects/trigger/impulse.qc
qcsrc/common/mapobjects/trigger/jumppads.qc
qcsrc/common/mapobjects/trigger/keylock.qc
qcsrc/common/mapobjects/trigger/viewloc.qc
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/minigames/minigame/bd.qc
qcsrc/common/minigames/minigame/c4.qc
qcsrc/common/minigames/minigame/nmm.qc
qcsrc/common/minigames/minigame/pong.qc
qcsrc/common/minigames/minigame/pp.qc
qcsrc/common/minigames/minigame/ps.qc
qcsrc/common/minigames/minigame/ttt.qc
qcsrc/common/minigames/minigames.qc
qcsrc/common/minigames/minigames.qh
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc
qcsrc/common/mutators/mutator/superspec/sv_superspec.qc
qcsrc/common/physics/player.qh
qcsrc/common/turrets/checkpoint.qc
qcsrc/common/turrets/turret/phaser_weapon.qc
qcsrc/common/turrets/util.qc
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/wepent.qc
qcsrc/lib/csqcmodel/cl_model.qc
qcsrc/lib/net.qh
qcsrc/lib/spawnfunc.qh
qcsrc/lib/warpzone/common.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/clientkill.qc
qcsrc/server/command/common.qc
qcsrc/server/mapvoting.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/weapons/tracing.qc
qcsrc/server/world.qc

index c5763a18f1a7c08e8121e446e07c3b3a43507a65..3adef84a4b5c72299ba8f8c5889013c0bd145833 100644 (file)
@@ -423,7 +423,7 @@ void CSQCModel_AutoTagIndex_Apply(entity this)
                }
 
                // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
-               if(this.tag_entity.classname == "csqcmodel")
+               if(this.tag_entity.classname == "ENT_CLIENT_MODEL")
                {
                        CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.isplayermodel & ISPLAYER_CLIENT));
                }
index f0111983fe6c8ea9e7c7901cd1456341b6dcd5e9..9e79f0a2262b062fcdd3b45398e614efde4be950 100644 (file)
@@ -202,7 +202,6 @@ NET_HANDLE(ENT_CLIENT_RADARLINK, bool isnew)
        InterpolateOrigin_Undo(this);
 
        this.iflags = IFLAG_VELOCITY | IFLAG_ORIGIN;
-       this.classname = "radarlink";
        if (isnew) IL_PUSH(g_radarlinks, this);
 
        if(sendflags & 1)
index cd582a092f9cbc4fe9fd9a08a51304ae4d104d88..6e4903f4d9648598df27fea9104ef81e3a7d5754 100644 (file)
@@ -491,7 +491,6 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
        if (!(this.count & 0x80))
                InterpolateOrigin_Note(this);
 
-       this.classname = "csqcprojectile";
        this.draw = Projectile_Draw;
        if (isnew) IL_PUSH(g_drawables, this);
        this.entremove = Ent_RemoveProjectile;
index f68b5af413f1b6ea082937444e70ba3a606a31ae..5b0b6d8e355aab48e85319c92164b8acff6628b3 100644 (file)
@@ -144,7 +144,7 @@ NET_HANDLE(casings, bool isNew)
     ang_z = ReadByte() * 360 / 256;
     return = true;
 
-    Casing casing = RubbleNew("casing");
+    Casing casing = RubbleNew(new(casing));
     casing.silent = (_state & 0x80);
     casing.state = (_state & 0x7F);
     casing.origin = org;
index 35f0fe52256b8cbca67f35bd846ea1caaf2d9957..3759248cb62c35729fe982b9c3d7f2a3bba05b2d 100644 (file)
@@ -168,7 +168,7 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector
        entity gib;
 
        // TODO remove some gibs according to cl_nogibs
-       gib = RubbleNew("gib");
+       gib = RubbleNew(new(gib));
        set_movetype(gib, MOVETYPE_BOUNCE);
        gib.gravity = 1;
        gib.solid = SOLID_CORPSE;
index 6eda9b15ef29d2b5c60a7b48e3651fcb5a538485..83f0ce855eda15d8371d10c1c49376bca57d60bb 100644 (file)
@@ -38,11 +38,8 @@ void RubbleLimit(string cname, int limit, void(entity) deleteproc)
        }
 }
 
-entity RubbleNew(string cname)
+entity RubbleNew(entity e)
 {
-       // spawn a new entity and return it
-       entity e = spawn();
-       e.classname = cname;
        e.creationtime = time;
        IL_PUSH(g_rubble, e);
        return e;
index 95e4af4194a6cd20a41f159efe653979ba70dadd..9b96feb3b28c5eab623df4e13b2dd7e55245f060 100644 (file)
@@ -274,7 +274,7 @@ ENTCS_PROP(SOLID, true, sv_solid, solid, ENTCS_SET_NORMAL,
                {
                        if (!this)
                                // initial = temp
-                               e = new_pure(entcs_receiver);
+                               e = new_pure(ENT_CLIENT_ENTCS);
                        else
                                // initial = linked
                                e = this;
@@ -310,7 +310,6 @@ ENTCS_PROP(SOLID, true, sv_solid, solid, ENTCS_SET_NORMAL,
                if (isnew)
                {
                        make_pure(this);
-                       this.classname = "entcs_receiver";
                        this.entremove = Ent_RemoveEntCS;
                }
                return ReadEntcs(this);
index fcfcf32ff38cc082fd36e18f26f06f59fe19aefd..48d56d1f90a4b38b15ea8f02d1b8775c6b45e326 100644 (file)
@@ -312,7 +312,6 @@ spawnfunc(target_objective)
 {
        if (!g_assault) { delete(this); return; }
 
-       this.classname = "target_objective";
        IL_PUSH(g_assault_objectives, this);
        this.use = assault_objective_use;
        this.reset = assault_objective_reset;
@@ -324,7 +323,6 @@ spawnfunc(target_objective_decrease)
 {
        if (!g_assault) { delete(this); return; }
 
-       this.classname = "target_objective_decrease";
        IL_PUSH(g_assault_objectivedecreasers, this);
 
        if(!this.dmg)
@@ -360,7 +358,6 @@ spawnfunc(func_assault_destructible)
        if (!g_assault) { delete(this); return; }
 
        this.spawnflags = 3;
-       this.classname = "func_assault_destructible";
        this.event_heal = destructible_heal;
        IL_PUSH(g_assault_destructibles, this);
 
@@ -376,7 +373,6 @@ spawnfunc(func_assault_wall)
 {
        if (!g_assault) { delete(this); return; }
 
-       this.classname = "func_assault_wall";
        this.mdl = this.model;
        _setmodel(this, this.mdl);
        this.solid = SOLID_BSP;
@@ -390,7 +386,6 @@ spawnfunc(target_assault_roundend)
        if (!g_assault) { delete(this); return; }
 
        this.winning = 0; // round not yet won by attackers
-       this.classname = "target_assault_roundend";
        this.use = target_assault_roundend_use;
        this.cnt = 0; // first round
        this.reset = target_assault_roundend_reset;
@@ -401,7 +396,6 @@ spawnfunc(target_assault_roundstart)
        if (!g_assault) { delete(this); return; }
 
        assault_attacker_team = NUM_TEAM_1;
-       this.classname = "target_assault_roundstart";
        this.use = assault_roundstart_use;
        this.reset2 = assault_roundstart_use_this;
        InitializeEntity(this, assault_roundstart_use_this, INITPRIO_FINDTARGET);
index ffde264b9545bd4cc53f237716a6f019bcc8a0d8..937575752af4f2c1547f11ac55c39e0060314505 100644 (file)
@@ -2740,7 +2740,6 @@ spawnfunc(ctf_team)
 {
        if(!g_ctf) { delete(this); return; }
 
-       this.classname = "ctf_team";
        this.team = this.cnt + 1;
 }
 
index d8e2bb3627d42ce3ef012ed950bccb9956ac0eed..4c208465657777e9b3c800fd45c5f8586d623ff1 100644 (file)
@@ -556,7 +556,6 @@ spawnfunc(dom_team)
                precache_sound(this.noise);
        if (this.noise1 != "")
                precache_sound(this.noise1);
-       this.classname = "dom_team";
        _setmodel(this, this.model); // precision not needed
        this.mdl = this.model;
        this.dmg = this.modelindex;
@@ -621,7 +620,6 @@ void dom_spawnteam(string teamname, float teamcolor, string pointmodel, float po
 void dom_spawnpoint(vector org)
 {
        entity e = spawn();
-       e.classname = "dom_controlpoint";
        setthink(e, spawnfunc_dom_controlpoint);
        e.nextthink = time;
        setorigin(e, org);
index d74c2dfc2d12e474b84efd4b15bb86dcfc4d7319..993eb936f4a0622d5fe7019dfda644484b33c201 100644 (file)
@@ -75,7 +75,6 @@ spawnfunc(invasion_spawnpoint)
 {
        if(!g_invasion) { delete(this); return; }
 
-       this.classname = "invasion_spawnpoint";
        IL_PUSH(g_invasion_spawns, this);
 }
 
index d48c76f3943313648aa1a4f39743a3b42845efff..1c2eacffd4e4974932096d27c07c8cd5b2de3a4e 100644 (file)
@@ -717,12 +717,10 @@ void key_reset(entity this)
        kh_Key_Remove(this);
 }
 
-const string STR_ITEM_KH_KEY = "item_kh_key";
 void kh_Key_Spawn(entity initial_owner, float _angle, float i)  // runs every time a new flag is created, ie after all the keys have been collected
 {
-       entity key = spawn();
+       entity key = new(item_kh_key);
        key.count = i;
-       key.classname = STR_ITEM_KH_KEY;
        settouch(key, kh_Key_Touch);
        setthink(key, kh_Key_Think);
        key.nextthink = time;
@@ -983,7 +981,7 @@ void kh_Initialize()  // sets up th KH environment
        kh_teams = BITS(bound(2, kh_teams, 4));
 
        // make a KH entity for controlling the game
-       kh_controller = spawn();
+       kh_controller = new(kh_controller);
        setthink(kh_controller, kh_Controller_Think);
        kh_Controller_SetThink(0, kh_WaitForPlayers);
 
index 1959ac424a2dbdc7b05bb0badbd0aa3e90fa96c1..2796f2b499fca0d1cecd8ca11c38bea3a5ca2251 100644 (file)
@@ -582,7 +582,6 @@ void SpawnBall(entity this)
 spawnfunc(nexball_basketball)
 {
        nexball_mode |= NBM_BASKETBALL;
-       this.classname = "nexball_basketball";
        if (!(balls & BALL_BASKET))
        {
                /*
@@ -606,7 +605,6 @@ spawnfunc(nexball_basketball)
 spawnfunc(nexball_football)
 {
        nexball_mode |= NBM_FOOTBALL;
-       this.classname = "nexball_football";
        this.solid = SOLID_TRIGGER;
        balls |= BALL_FOOT;
        this.pushable = autocvar_g_nexball_football_jumppad;
index 2e05794da592540de8ff1794900eb7fa2d370ec3..e08ea810109fce2aa6f9eefb1e22542e781508c9 100644 (file)
@@ -113,7 +113,7 @@ void cpicon_construct(entity this, bool isnew)
 
        if(this.icon_realmodel == NULL)
        {
-               this.icon_realmodel = spawn();
+               this.icon_realmodel = new(cpicon_model);
                setmodel(this.icon_realmodel, MDL_Null);
                setorigin(this.icon_realmodel, this.origin);
                setsize(this.icon_realmodel, CPICON_MIN, CPICON_MAX);
index f9011c7d90dfa702f1cfd157594b0d06e1bbfb18..6240975d72506a11bc1e5629fbd861b3d21f6d32 100644 (file)
@@ -1076,7 +1076,6 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o
        ons_worldgeneratorlist = gen;
 
        gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnum));
-       gen.classname = "onslaught_generator";
        gen.solid = SOLID_BBOX;
        gen.team_saved = teamnum;
        IL_PUSH(g_saved_team, gen);
index 1fba2215ff61d845e0409e943f02d62f1bf7eaa2..5e850889679fd1ebceb5992b86cbc6f605c044a4 100644 (file)
@@ -14,7 +14,6 @@ spawnfunc(tdm_team)
 {
        if(!g_tdm || !this.cnt) { delete(this); return; }
 
-       this.classname = "tdm_team";
        this.team = this.cnt + 1;
 }
 
index 4db6516580a6212880148ae30f574505dc115c3d..bf482b73a2f9dc27fd9aea6c61a4620b49b74e99 100644 (file)
@@ -50,7 +50,7 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float
 //
 void LaunchDebris (entity this, string debrisname, vector force)
 {
-       entity dbr = spawn();
+       entity dbr = new(debris);
        vector org = this.absmin
                   + '1 0 0' * random() * (this.absmax.x - this.absmin.x)
                   + '0 1 0' * random() * (this.absmax.y - this.absmin.y)
index 11196ab38d7f2bbcce2418a3bfd3f201be84bed4..05fafa4f026dc0ab881e12a28b6a87ca911dbfed 100644 (file)
@@ -361,7 +361,7 @@ void door_trigger_touch(entity this, entity toucher)
 #ifdef SVQC
                if (!((toucher.iscreature || (toucher.flags & FL_PROJECTILE)) && !IS_DEAD(toucher)))
 #elif defined(CSQC)
-               if(!((IS_CLIENT(toucher) || toucher.classname == "csqcprojectile") && !IS_DEAD(toucher)))
+               if(!((IS_CLIENT(toucher) || toucher.classname == "ENT_CLIENT_PROJECTILE") && !IS_DEAD(toucher)))
 #endif
                        return;
 
index 2c8574249ee0eb6bf822d2901d78e5464a1fb85f..89f6fa8f94def1d4f61550cc47a6511d008a2a53 100644 (file)
@@ -265,7 +265,6 @@ Don't use this entity on new maps! Use item_key instead.
 */
 spawnfunc(item_key1)
 {
-       this.classname = "item_key";
        this.itemkeys = ITEM_KEY_BIT(1);
        spawnfunc_item_key(this);
 }
@@ -284,7 +283,6 @@ Don't use this entity on new maps! Use item_key instead.
 */
 spawnfunc(item_key2)
 {
-       this.classname = "item_key";
        this.itemkeys = ITEM_KEY_BIT(0);
        spawnfunc_item_key(this);
 }
index 6bf95f24f6dfa8b2ccaa5824c1ce1bb7da839722..efc457409364d4e3b1dc2710fa087bc083f1e58b 100644 (file)
@@ -28,8 +28,6 @@ void teleport_dest_link(entity this)
 
 spawnfunc(info_teleport_destination)
 {
-       this.classname = "info_teleport_destination";
-
        this.mangle = this.angles;
        this.angles = '0 0 0';
 
index afd349673c5cba98654d9ee6d97b57f4b35309f8..28b420b20ab4f2ed6c49bde68e5383d365de1b6b 100644 (file)
@@ -20,10 +20,9 @@ void generic_plat_blocked(entity this, entity blocker)
 
 void plat_spawn_inside_trigger(entity this)
 {
-       entity trigger;
        vector tmin, tmax;
 
-       trigger = spawn();
+       entity trigger = spawn();
        settouch(trigger, plat_center_touch);
        set_movetype(trigger, MOVETYPE_NONE);
        trigger.solid = SOLID_TRIGGER;
index 5774f45f993c183bf19712391b5f877eac24daf4..2169e1b89e809486aa8bf9827682a7ea4687350a 100644 (file)
@@ -4,7 +4,6 @@ void target_push_init(entity this);
 
 spawnfunc(target_location)
 {
-    this.classname = "target_location";
     // location name in netname
     // eventually support: count, teamgame selectors, line of sight?
 
@@ -15,11 +14,7 @@ spawnfunc(target_location)
 
 spawnfunc(info_location)
 {
-    this.classname = "target_location";
     this.message = this.netname;
-
-    target_push_init(this);
-
-    IL_PUSH(g_locations, this);
+    spawnfunc_target_location(this);
 }
 #endif
index 4b9fb2236b57a85d8f2bbac6dc8a53968677919e..ea63c9a748ca54149ff3701439a6df785a1b0ba0 100644 (file)
@@ -68,7 +68,7 @@ void trigger_gravity_touch(entity this, entity toucher)
                        else
                                return;
                }
-               toucher.trigger_gravity_check = spawn();
+               toucher.trigger_gravity_check = new(trigger_gravity_checker);
                toucher.trigger_gravity_check.enemy = this;
                toucher.trigger_gravity_check.owner = toucher;
                toucher.trigger_gravity_check.gravity = toucher.gravity;
index c4e7ae287a8e9a6eda6d79532d0c06684cc38b6b..4306e2ff7b169db75f947e6e522ab534d00eba9f 100644 (file)
@@ -222,7 +222,6 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_IMPULSE, bool isnew)
        trigger_common_read(this, true);
        return = true;
 
-       this.classname = "trigger_impulse";
        this.solid = SOLID_TRIGGER;
        this.entremove = trigger_remove_generic;
        this.move_time = time;
index b016dde9a19287d7e8c9e77ede292ee22c69c6cb..a6128d207fb8c334d092dcee26cd41ab261186cb 100644 (file)
@@ -690,12 +690,7 @@ spawnfunc(target_position)
 
 NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew)
 {
-       this.classname = "jumppad";
-       int mytm = ReadByte();
-       if(mytm)
-       {
-               this.team = mytm - 1;
-       }
+       int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
        this.spawnflags = ReadInt24_t();
        this.active = ReadByte();
        this.height = ReadCoord();
@@ -719,7 +714,6 @@ void target_push_remove(entity this)
 
 NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew)
 {
-       this.classname = "push_target";
        this.cnt = ReadByte();
        this.targetname = strzone(ReadString());
        this.origin = ReadVector();
index 626a588dcb880ff625f3a7d29f68994ee274f04a..368da365193b759855f4a0757139ff60409cb3fc 100644 (file)
@@ -178,7 +178,6 @@ NET_HANDLE(ENT_CLIENT_KEYLOCK, bool isnew)
 
        return = true;
 
-       this.classname = "trigger_keylock";
        this.entremove = trigger_remove_generic;
 }
 #endif
index c8c0836117a519fb13f4066f688931a236cb8db6..4679e75f7f0f521c4248676365578de1e10b6851 100644 (file)
@@ -142,13 +142,11 @@ void viewloc_link(entity this)
 
 spawnfunc(target_viewlocation_start)
 {
-       this.classname = "target_viewlocation_start";
        this.cnt = 1;
        viewloc_link(this);
 }
 spawnfunc(target_viewlocation_end)
 {
-       this.classname = "target_viewlocation_end";
        this.cnt = 2;
        viewloc_link(this);
 }
@@ -189,7 +187,6 @@ NET_HANDLE(ENT_CLIENT_VIEWLOC_TRIGGER, bool isnew)
        setthink(this, trigger_viewloc_updatelink);
        this.nextthink = time + 1; // we need to delay this or else
 
-       this.classname = "trigger_viewlocation";
        this.drawmask = MASK_NORMAL; // not so concerned, but better keep it alive
 }
 
index 2fdc52fcbf6f4395142062a5f9db17611d5d6ca3..74c867c3ac337ed85fc6ac98d0d6dabcc9a4d0a5 100644 (file)
@@ -181,9 +181,8 @@ void HUD_MinigameMenu_EraseEntry ( entity e )
 }
 
 // Minigame menu options: create entry
-entity HUD_MinigameMenu_SpawnEntry(string s, vector offset, vector fontsize, vector color,void(entity, entity, entity) click)
+entity HUD_MinigameMenu_SpawnEntry(entity entry, string s, vector offset, vector fontsize, vector color,void(entity, entity, entity) click)
 {
-       entity entry = spawn();
        entry.message = s;
        entry.origin = offset;
        entry.size = fontsize;
@@ -199,7 +198,7 @@ entity HUD_MinigameMenu_SpawnSubEntry(string s, void(entity, entity, entity) cli
 {
        vector item_fontsize = hud_fontsize*1.25;
        vector item_offset = '1 0 0' * item_fontsize_x;
-       entity item = HUD_MinigameMenu_SpawnEntry(
+       entity item = HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_subentry),
                                s,item_offset,item_fontsize,'0.8 0.8 0.8', click );
        item.owner = parent;
        return item;
@@ -405,9 +404,8 @@ void HUD_MinigameMenu_CurrentButton()
                                HUD_MinigameMenu_EraseEntry(e);
                                break;
                        }
-               entity currb = HUD_MinigameMenu_SpawnEntry(
+               entity currb = HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_current),
                        _("Current Game"), '0 0 0', hud_fontsize*1.5,'0.7 0.84 1', HUD_MinigameMenu_ClickCurrentGame );
-               currb.classname = "hud_minigamemenu_current";
                currb.model = strzone(minigame_texture(strcat(active_minigame.descriptor.netname,"/icon")));
                HUD_MinigameMenu_InsertEntry(currb,HUD_MinigameMenu_last_entry);
                HUD_MinigameMenu_Click(currb);
@@ -430,9 +428,8 @@ void HUD_MinigameMenu_CurrentButton()
                for ( e = HUD_MinigameMenu_last_entry; e != NULL; e = e.list_prev )
                        if ( e.classname == "hud_minigamemenu_exit" )
                                return;
-               entity exit = HUD_MinigameMenu_SpawnEntry(
+               entity exit = HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_exit),
                        _("Exit Menu"),'0 0 0',hud_fontsize*1.5,'0.7 0.84 1', HUD_MinigameMenu_Close);
-               exit.classname = "hud_minigamemenu_exit";
                HUD_MinigameMenu_InsertEntry ( exit, HUD_MinigameMenu_last_entry );
        }
 }
@@ -442,10 +439,10 @@ void HUD_MinigameMenu_Open()
 {
        if ( !mv_active && !HUD_MinigameMenu_IsOpened() )
        {
-               HUD_MinigameMenu_InsertEntry( HUD_MinigameMenu_SpawnEntry(
+               HUD_MinigameMenu_InsertEntry( HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_entry),
                        _("Create"), '0 0 0', hud_fontsize*1.5,'0.7 0.84 1', HUD_MinigameMenu_ClickCreate),
                        HUD_MinigameMenu_last_entry );
-               HUD_MinigameMenu_InsertEntry ( HUD_MinigameMenu_SpawnEntry(
+               HUD_MinigameMenu_InsertEntry ( HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_entry),
                        _("Join"),'0 0 0',hud_fontsize*1.5,'0.7 0.84 1', HUD_MinigameMenu_ClickJoin),
                        HUD_MinigameMenu_last_entry );
                HUD_MinigameMenu_CurrentButton();
index 744dab71af518124cae264d9708fde3f47c189d2..2aea16c54206be9cf423c0bfe922bf969c5625f0 100644 (file)
@@ -437,7 +437,7 @@ void bd_editor_place(entity minigame, entity player, string pos, int thetile, st
                        }
                        else
                        {
-                               entity piece = msle_spawn(minigame,"minigame_board_piece");
+                               entity piece = msle_spawn(minigame,new(minigame_board_piece));
                                piece.team = 1;
                                piece.netname = strzone(pos);
                                piece.bd_tiletype = thetile;
@@ -711,7 +711,7 @@ void bd_load_piece(entity minigame, string s)
        }
        else
        {
-               entity e = msle_spawn(minigame,"minigame_board_piece");
+               entity e = msle_spawn(minigame,new(minigame_board_piece));
                e.netname = tilename;
                e.team = 1;
                e.bd_dir = dir;
index be65e6ac13528bc4446b8b0e1ee8768636387fff..5aeb7dfb2e4cf13f02de9b5b2e0c6796f78d343a 100644 (file)
@@ -163,7 +163,7 @@ void c4_move(entity minigame, entity player, string pos )
                if ( c4_valid_tile(pos) )
                if ( !c4_find_piece(minigame,pos) )
                {
-                       entity piece = msle_spawn(minigame,"minigame_board_piece");
+                       entity piece = msle_spawn(minigame,new(minigame_board_piece));
                        piece.team = player.team;
                        piece.netname = strzone(pos);
                        minigame_server_sendflags(piece,MINIG_SF_ALL);
index ab9444757e05f973fb858118cdf80c0061544391..5b0d39455da220b88d2f1055f9d48ce4a939a2ae 100644 (file)
@@ -223,10 +223,10 @@ int nmm_server_event(entity minigame, string event, ...)
                entity e;
                for ( int i = 0; i < 7; i++ )
                {
-                       e = msle_spawn(minigame,"minigame_board_piece");
+                       e = msle_spawn(minigame,new(minigame_board_piece));
                        e.team = 1;
                        e.minigame_flags = NMM_PIECE_HOME;
-                       e = msle_spawn(minigame,"minigame_board_piece");
+                       e = msle_spawn(minigame,new(minigame_board_piece));
                        e.team = 2;
                        e.minigame_flags = NMM_PIECE_HOME;
                }
index 407eb4e8fdfeafbaa12680abdc9655bb7862bbcd..6b9b0480451a12758fc05c836f0702947319cde6 100644 (file)
@@ -259,7 +259,7 @@ void pong_ai_think(entity this)
 
 entity pong_ai_spawn(entity paddle)
 {
-       entity ai = msle_spawn(paddle.owner,"pong_ai");
+       entity ai = msle_spawn(paddle.owner,new(pong_ai));
        ai.minigame_players = ai;
        ai.team = paddle.team;
        setthink(ai, pong_ai_think);
@@ -318,7 +318,7 @@ vector pong_team_to_paddlepos(int nteam)
 // if real_player is NULL, the paddle is controlled by AI
 entity pong_paddle_spawn(entity minigame, int pl_team, entity real_player)
 {
-       entity paddle = msle_spawn(minigame,"pong_paddle");
+       entity paddle = msle_spawn(minigame,new(pong_paddle));
        paddle.pong_length = autocvar_sv_minigames_pong_paddle_size;
        paddle.origin = pong_team_to_paddlepos(pl_team);
        setthink(paddle, pong_paddle_think);
@@ -401,7 +401,7 @@ int pong_server_event(entity minigame, string event, ...)
                                                entity ball;
                                                for ( int j = 0; j < autocvar_sv_minigames_pong_ball_number; j++ )
                                                {
-                                                       ball = msle_spawn(minigame,"pong_ball");
+                                                       ball = msle_spawn(minigame,new(pong_ball));
                                                        ball.pong_length = autocvar_sv_minigames_pong_ball_radius;
                                                        ball.m_mins = vec2(-ball.pong_length, -ball.pong_length);
                                                        ball.m_maxs = vec2(ball.pong_length, ball.pong_length);
index e8aed878aab9c31ce663bd453747d996e1a191a2..5a46aa91452f1ef37882514be28d20b52f48ae8e 100644 (file)
@@ -125,7 +125,7 @@ void pp_move(entity minigame, entity player, string pos )
                                delete(existing);
                        }
 
-                       entity piece = msle_spawn(minigame,"minigame_board_piece");
+                       entity piece = msle_spawn(minigame,new(minigame_board_piece));
                        piece.cnt = 1;
                        piece.team = player.team; // temporary
                        piece.netname = strzone(pos);
@@ -157,7 +157,7 @@ void pp_setup_pieces(entity minigame)
 
                if(t1_true || t2_true)
                {
-                       entity piece = msle_spawn(minigame,"minigame_board_piece");
+                       entity piece = msle_spawn(minigame,new(minigame_board_piece));
                        piece.team = ((t1_true) ? 1 : 2);
                        piece.netname = strzone(minigame_tile_buildname(i,t));
                        minigame_server_sendflags(piece,MINIG_SF_ALL);
index 4457449e86b467417e9534b724d531241b9f9cb1..b9762464a88514949317f463567d9aed1a225fa0 100644 (file)
@@ -124,7 +124,7 @@ void ps_setup_pieces(entity minigame)
                        continue;
                if(i == floor(PS_NUM_CNT * 0.5) && t == floor(PS_LET_CNT * 0.5))
                        continue; // middle piece is empty
-               entity piece = msle_spawn(minigame,"minigame_board_piece");
+               entity piece = msle_spawn(minigame,new(minigame_board_piece));
                piece.team = 1; // init default team?
                piece.netname = strzone(minigame_tile_buildname(t,i));
                minigame_server_sendflags(piece,MINIG_SF_ALL);
index ea0c9c368801c4a1f1f63b086ab0288bd141bbaa..bb642a282aa6c9acb9634d96b7f8d17422c3c74f 100644 (file)
@@ -83,7 +83,7 @@ void ttt_move(entity minigame, entity player, string pos )
                if ( ttt_valid_tile(pos) )
                if ( !ttt_find_piece(minigame,pos) )
                {
-                       entity piece = msle_spawn(minigame,"minigame_board_piece");
+                       entity piece = msle_spawn(minigame,new(minigame_board_piece));
                        piece.team = player.team;
                        piece.netname = strzone(pos);
                        minigame_server_sendflags(piece,MINIG_SF_ALL);
index 6d14b258281f973a916b346ca9540776d75f7549..0455e80867eb596cb12e83120a431b80708b505c 100644 (file)
@@ -84,10 +84,8 @@ void minigame_server_sendflags(entity ent, int mgflags)
 
 // Spawn linked entity on the server or local entity on the client
 // This entity will be removed automatically when the minigame ends
-entity msle_spawn(entity minigame_session, string class_name)
+entity msle_spawn(entity minigame_session, entity e)
 {
-       entity e = spawn();
-       e.classname = class_name;
        e.owner = minigame_session;
        e.minigame_autoclean = 1;
        #ifdef SVQC
index 284001a0a22e97997b107a386601d9f75207345f..de0baf6b388e4eba2d49dc718f5a2f7eb340ca1c 100644 (file)
@@ -114,7 +114,7 @@ const int MINIG_SF_ALL     = 0xff; // use to resend everything
 
 // Spawn linked entity on the server or local entity on the client
 // This entity will be removed automatically when the minigame ends
-entity msle_spawn(entity minigame_session, string class_name);
+entity msle_spawn(entity minigame_session, entity e);
 
 #include "minigame/all.qh"
 
index 8addac3531f58b4f02625b27d4082c078cf41371..00aa9e6acc88dcd62891d9a3405d9c8e23b2e1d7 100644 (file)
@@ -201,7 +201,7 @@ void M_Mage_Attack_Spike(entity this, vector dir)
 {
        makevectors(this.angles);
 
-       entity missile = spawn();
+       entity missile = new(M_Mage_Attack_Spike);
        missile.owner = missile.realowner = this;
        setthink(missile, M_Mage_Attack_Spike_Think);
        missile.ltime = time + 7;
index 0a811cb70b5ee9da3e259c03048e1516fa771703..6b1965b542cdd4aad816a88a206f92f3f4be75a9 100644 (file)
@@ -25,7 +25,7 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity
                        actor.anim_finished = time + 1.2;
                }
 
-               entity missile = spawn();
+               entity missile = new(WyvernAttack);
                missile.owner = missile.realowner = actor;
                missile.solid = SOLID_TRIGGER;
                set_movetype(missile, MOVETYPE_FLYMISSILE);
index 7ddc7b10ca4b74977f4ead415e891101fe15ec72..5ebf5761f4ec1d203c7714145e47812e41ccc4ef 100644 (file)
@@ -217,7 +217,7 @@ void Monster_Delay_Action(entity this)
 void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
 {
        // deferred attacking, checks if monster is still alive and target is still valid before attacking
-       entity e = spawn();
+       entity e = new(Monster_Delay);
 
        setthink(e, Monster_Delay_Action);
        e.nextthink = time + defer_amnt;
index 07d6292bd9efc39f51800795ce777286104b3970..50b5d91b50dba9d844b301ea1586319e6e13f662 100644 (file)
@@ -44,7 +44,7 @@ bool buffs_BuffModel_Customize(entity this, entity client)
 
 void buffs_BuffModel_Spawn(entity player)
 {
-       player.buff_model = spawn();
+       player.buff_model = new(buff_model);
        setmodel(player.buff_model, MDL_BUFF);
        setsize(player.buff_model, '0 0 -40', '0 0 40');
        setattachment(player.buff_model, player, "");
@@ -504,7 +504,7 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate)
        if(frag_attacker != frag_target)
        if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
        {
-               entity dmgent = spawn();
+               entity dmgent = new(dmgent);
 
                dmgent.dmg = frag_damage * autocvar_g_buffs_vengeance_damage_multiplier;
                dmgent.enemy = frag_attacker;
index 64c67bd5434d912d4712ad6c051466708dd831db..1c37195a35498ff4140c9ac1a52c7cd753b8541a 100644 (file)
@@ -355,13 +355,10 @@ void napalm_fountain_think(entity this)
 
 void nade_napalm_boom(entity this)
 {
-       entity fountain;
-       int c;
-       for (c = 0; c < autocvar_g_nades_napalm_ball_count; c++)
+       for (int c = 0; c < autocvar_g_nades_napalm_ball_count; c++)
                nade_napalm_ball(this);
 
-
-       fountain = spawn();
+       entity fountain = new(nade_napalm_fountain);
        fountain.owner = this.owner;
        fountain.realowner = this.realowner;
        fountain.origin = this.origin;
@@ -455,8 +452,7 @@ void nade_ice_think(entity this)
 
 void nade_ice_boom(entity this)
 {
-       entity fountain;
-       fountain = spawn();
+       entity fountain = new(nade_ice_fountain);
        fountain.owner = this.owner;
        fountain.realowner = this.realowner;
        fountain.origin = this.origin;
@@ -509,7 +505,7 @@ void nade_translocate_boom(entity this)
 
 void nade_spawn_boom(entity this)
 {
-       entity spawnloc = spawn();
+       entity spawnloc = new(nade_spawn_loc);
        setorigin(spawnloc, this.origin);
        setsize(spawnloc, this.realowner.mins, this.realowner.maxs);
        set_movetype(spawnloc, MOVETYPE_NONE);
@@ -551,7 +547,7 @@ entity nades_spawn_orb(entity own, entity realown, vector org, float orb_ltime,
        // NOTE: this function merely places an orb
        // you must add a custom touch function to the returned entity if desired
        // also set .colormod if you wish to have it colorized
-       entity orb = spawn(); // Net_LinkEntity sets the classname (TODO)
+       entity orb = new(nades_spawn_orb);
        orb.owner = own;
        orb.realowner = realown;
        setorigin(orb, org);
index 63b43e018378c32be72c64437eff5fd475a7f307..328f79ac877519066b85c1de88107b4387aa1682 100644 (file)
@@ -100,8 +100,7 @@ MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn)
 
        // The actual item can't be physical and trigger at the same time, so make it invisible and use a second entity for physics.
        // Ugly hack, but unless SOLID_TRIGGER is gotten to work with MOVETYPE_PHYSICS in the engine it can't be fixed.
-       entity wep;
-       wep = spawn();
+       entity wep = spawn();
        _setmodel(wep, item.model);
        setsize(wep, item.mins, item.maxs);
        setorigin(wep, item.origin);
index c721f4571b58fadbaa6f895f6e389bc0a470c955..add4bec010fc90f09f6372232d023e098b3f4edd 100644 (file)
@@ -401,7 +401,7 @@ MUTATOR_HOOKFUNCTION(superspec, ClientConnect)
        player.superspec_flags = SSF_VERBOSE;
        player.superspec_itemfilter = "";
 
-       entity _hello = spawn();
+       entity _hello = new(superspec_delayed_hello);
        _hello.enemy = player;
        setthink(_hello, superspec_hello);
        _hello.nextthink = time + 5;
index 8b4013c8a5f9c614ed7002936521856fb7dea395..ebabee158e23b5b0bedfcbcba4f8b39b13569e75 100644 (file)
@@ -190,7 +190,7 @@ STATIC_INIT(PHYS_INPUT_BUTTON)
        #define IS_CLIENT(s)                        (((s).isplayermodel & ISPLAYER_CLIENT) || (s) == csqcplayer)
        #define IS_PLAYER(s)                        ((s).isplayermodel & ISPLAYER_PLAYER)
        #define IS_NOT_A_CLIENT(s)                  (!(s).isplayermodel && (s) != csqcplayer)
-       #define IS_DEAD(s)                          (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : (GetResource((s), RES_HEALTH) <= 0))
+       #define IS_DEAD(s)                          (((s).classname == "ENT_CLIENT_MODEL") ? (s).csqcmodel_isdead : (GetResource((s), RES_HEALTH) <= 0))
 
        //float player_multijump;
        //float player_jumpheight;
index 25c61b4b67b19c1192a7752b23a77f8cd7945581..976bfac28c30061412885fa2b45759b8a8bbc8d2 100644 (file)
@@ -33,7 +33,6 @@ spawnfunc(turret_checkpoint)
 // Compat.
 spawnfunc(walker_checkpoint)
 {
-    this.classname = "turret_checkpoint";
     spawnfunc_turret_checkpoint(this);
 }
 
index 6b5b4fae803ce103d0846f783201e27a6c430788..e4d09d193f7981338fa3f71429cf1a9bc529d768 100644 (file)
@@ -19,7 +19,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
             actor.shot_speed = 1;
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
         }
-        entity beam = spawn();
+        entity beam = new(PhaserTurret_beam);
         beam.ticrate = 0.1; //autocvar_sys_ticrate;
         setmodel(beam, MDL_TUR_PHASER_BEAM);
         beam.effects = EF_LOWPRECISION;
index 6857ccad8dd8bc603637ff112e6e0e0cfc95d443..c25b892e82896f3088dc54b74e4a9d0c310bcef5 100644 (file)
@@ -178,10 +178,8 @@ MODEL(TUR_C512, "models/turrets/c512.md3");
 */
 void paint_target(entity onwho, float f_size, vector v_color, float f_time)
 {
-       entity e;
-
-       e = spawn();
-       setmodel(e, MDL_TUR_C512); // precision set above
+       entity e = spawn();
+       setmodel(e, MDL_TUR_C512);
        e.scale = (f_size/512);
        //setsize(e, '0 0 0', '0 0 0');
        //setattachment(e,onwho,"");
@@ -197,10 +195,8 @@ void paint_target(entity onwho, float f_size, vector v_color, float f_time)
 
 void paint_target2(entity onwho, float f_size, vector v_color, float f_time)
 {
-       entity e;
-
-       e = spawn();
-       setmodel(e, MDL_TUR_C512); // precision set above
+       entity e = spawn();
+       setmodel(e, MDL_TUR_C512);
        e.scale = (f_size/512);
        setsize(e, '0 0 0', '0 0 0');
 
@@ -217,9 +213,8 @@ void paint_target2(entity onwho, float f_size, vector v_color, float f_time)
 
 void paint_target3(vector where, float f_size, vector v_color, float f_time)
 {
-       entity e;
-       e = spawn();
-       setmodel(e, MDL_TUR_C512); // precision set above
+       entity e = spawn();
+       setmodel(e, MDL_TUR_C512);
        e.scale = (f_size/512);
        setsize(e, '0 0 0', '0 0 0');
        setorigin(e, where + '0 0 1');
index 86e718bbba914a9b5866264092b42a93db78a509..971a5ebad6911bc28abd53b1f26958c614b0f4d1 100644 (file)
@@ -119,7 +119,7 @@ NET_HANDLE(TE_CSQC_VEHICLESETUP, bool isnew)
                if(axh != NULL && !wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
                        delete(axh);
 
-               axh              = spawn();
+               axh              = new(AuxiliaryXhair);
                axh.draw2d       = func_null;
                axh.drawmask     = MASK_NORMAL;
                axh.axh_drawflag = DRAWFLAG_NORMAL;
index 5bc834a00b357cbc5d9919c314890108f23a64e6..e1230419339ee1137f53811444124d88dddd7df9 100644 (file)
@@ -261,10 +261,8 @@ entity vehicles_projectile(entity this, entity _mzlfx, Sound _mzlsound,
                                                   int _deahtype, float _projtype, float _health,
                                                   bool _cull, bool _clianim, entity _owner)
 {
-       TC(Sound, _mzlsound);
-       entity proj;
-
-       proj = spawn();
+    TC(Sound, _mzlsound);
+       entity proj = new(vehicles_projectile);
 
        PROJECTILE_MAKETRIGGER(proj);
        setorigin(proj, _org);
@@ -334,7 +332,7 @@ void vehicles_gib_think(entity this)
 
 entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
 {
-       entity _gib = spawn();
+       entity _gib = new(vehicle_gib);
        _setmodel(_gib, _template.model);
        vector org = gettaginfo(this, gettagindex(this, _tag));
        setorigin(_gib, org);
@@ -379,8 +377,8 @@ bool vehicle_addplayerslot( entity _owner,
        _slot.vehicle_enter = _enterfunc;
        STAT(HUD, _slot) = _hud;
        _slot.vehicle_flags = VHF_PLAYERSLOT;
-       _slot.vehicle_viewport = spawn();
-       _slot.vehicle_hudmodel = spawn();
+       _slot.vehicle_viewport = new(vehicle_viewport);
+       _slot.vehicle_hudmodel = new(vehicle_hudmodel);
        _slot.vehicle_hudmodel.viewmodelforclient = _slot;
        _slot.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
 
@@ -693,7 +691,7 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
        {
                if (wasfreed(this.vehicle_shieldent) || this.vehicle_shieldent == NULL)
                {
-                       this.vehicle_shieldent = spawn();
+                       this.vehicle_shieldent = new(vehicle_shieldent);
                        this.vehicle_shieldent.effects = EF_LOWPRECISION;
 
                        setmodel(this.vehicle_shieldent, MDL_VEH_SHIELD);
index 0a8875b48df02cb9a74f7392883d9210d7d0fda5..8b34473e398a5894256e386200459a00eec45ada 100644 (file)
@@ -831,7 +831,7 @@ METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
     if(!instance.gun1)
     {
         // for some reason, autosizing of the shield entity refuses to work for this one so set it up in advance.
-        instance.vehicle_shieldent = spawn();
+        instance.vehicle_shieldent = new(vehicle_shieldent);
         instance.vehicle_shieldent.effects = EF_LOWPRECISION;
         setmodel(instance.vehicle_shieldent, MDL_VEH_BUMBLEBEE_SHIELD);
         setattachment(instance.vehicle_shieldent, instance, "");
@@ -885,7 +885,7 @@ METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
         // Raygun beam
         if(instance.gun3.enemy == NULL)
         {
-            instance.gun3.enemy = spawn();
+            instance.gun3.enemy = new(bumble_raygun);
             Net_LinkEntity(instance.gun3.enemy, true, 0, bumble_raygun_send);
             instance.gun3.enemy.SendFlags = BRG_SETUP;
             instance.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun;
index 6f6e85687069e8d9986db250c707e9678de526d0..da2c1da0be446d6e214f4d867753534dc3fdcc26 100644 (file)
@@ -780,7 +780,7 @@ METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player))
 
         if(!dropmark)
         {
-            dropmark = spawn();
+            dropmark = new(raptor_dropmark);
             dropmark.owner = player;
             dropmark.gravity = 1;
             dropmark.dphitcontentsmask = DPCONTENTS_SOLID;
index 7d4a250f416e07b5a26aef7dbd69012c8b820525..dc219f571cc2322e1cb1b5f1a984ab209656fb0e 100644 (file)
@@ -62,7 +62,7 @@ METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weapone
         vector forward, right, up;
         MAKE_VECTORS(player.v_angle, forward, right, up);
         for(int i = 0; i < 3; ++i) {
-            entity _flare = spawn();
+            entity _flare = new(RaptorFlare_flare);
             setmodel(_flare, MDL_VEH_RAPTOR_FLARE);
             _flare.effects = EF_LOWPRECISION | EF_FLAME;
             _flare.scale = 0.5;
@@ -125,7 +125,7 @@ void raptor_bomb_burst(entity this)
 
     for(i = 0; i < autocvar_g_vehicle_raptor_bomblets; ++i)
     {
-        bomblet = spawn();
+        bomblet = new(raptor_bomb_bomblet);
         setorigin(bomblet, this.origin);
 
         set_movetype(bomblet, MOVETYPE_TOSS);
@@ -150,10 +150,8 @@ void raptor_bomb_touch(entity this, entity toucher)
 
 void raptor_bombdrop(entity this)
 {
-    entity bomb_1, bomb_2;
-
-    bomb_1 = spawn();
-    bomb_2 = spawn();
+    entity bomb_1 = new(bombmount_left);
+    entity bomb_2 = new(bombmount_right);
 
     vector org = gettaginfo(this, gettagindex(this, "bombmount_left"));
     setorigin(bomb_1, org);
@@ -234,7 +232,7 @@ void RaptorCBShellfragDraw(entity this)
 
 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
 {
-    entity sfrag = spawn();
+    entity sfrag = new(RaptorCBShellfrag);
     setmodel(sfrag, MDL_VEH_RAPTOR_CB_FRAGMENT);
     setorigin(sfrag, _org);
 
index 069696639f8f1b2bfc6f917ca8e1934ef0cabe68..d6a371b7652767b703c0493e3c87e31f4db7a5dc 100644 (file)
@@ -406,7 +406,7 @@ void spiderbot_blowup(entity this)
                return;
        }
 
-       entity h = spawn(), g1 = spawn(), g2 = spawn(), b = spawn();
+       entity h = new(spiderbot_top), g1 = new(spiderbot_gun), g2 = new(spiderbot_gun), b = new(spiderbot_body);
 
        setmodel(b, MDL_VEH_SPIDERBOT_BODY);
        setmodel(h, MDL_VEH_SPIDERBOT_TOP);
@@ -567,8 +567,8 @@ METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
     if(!instance.gun1)
     {
         instance.vehicles_impulse = spiderbot_impulse;
-        instance.gun1 = spawn();
-        instance.gun2 = spawn();
+        instance.gun1 = new(spiderbot_gun);
+        instance.gun2 = new(spiderbot_gun);
         setmodel(instance.gun1, MDL_VEH_SPIDERBOT_GUN);
         setmodel(instance.gun2, MDL_VEH_SPIDERBOT_GUN);
         setattachment(instance.gun1, instance.tur_head, "tag_hardpoint01");
index d1905765412d7d990cd204685da791cc109ab20a..848825f147dc7b6d4bcd860dd9e5f55f5a4fe33f 100644 (file)
@@ -1201,7 +1201,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
                this.move_time = time;
                loopsound(this, CH_SHOTS_SINGLE, SND_ARC_LOOP, VOL_BASE, ATTEN_NORM);
 
-               flash = spawn();
+               flash = new(arc_flash);
                flash.owner = this;
                flash.effects = EF_ADDITIVE | EF_FULLBRIGHT;
                //flash.drawmask = MASK_NORMAL;
index accb917f687e460c05108fd8fd91f71e756f3ecb..01a922bb8e47a7c6a80236062a04d902d7239738 100644 (file)
@@ -759,8 +759,7 @@ NET_HANDLE(TE_CSQC_SHOCKWAVEPARTICLE, bool isNew)
 
 void Net_ReadShockwaveParticle()
 {
-       entity shockwave;
-       shockwave = spawn();
+       entity shockwave = new(shockwave_cone);
        shockwave.draw = Draw_Shockwave;
        IL_PUSH(g_drawables, shockwave);
 
index 3d751035b029f4b186c5af77ca8f3582bf558933..da2b0539d05cf410ee743ff0e26003a2d5b37761 100644 (file)
@@ -191,8 +191,6 @@ MACRO_END
 
        NET_HANDLE(ENT_CLIENT_WEPENT, bool isnew)
        {
-               if (isnew)
-                       this.classname = "wepent_receiver";
                return ReadWepent(this);
        }
 
index ccf6751171f82522181d75e529d103ac5b848847..c4f6dbf0a5d896200d0f638592498d8d5d2518f6 100644 (file)
@@ -239,7 +239,6 @@ NET_HANDLE(ENT_CLIENT_MODEL, bool isnew)
        this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_LOCAL, islocalplayer);
        this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_PLAYER, (psf & ISPLAYER_PLAYER));
 
-       this.classname = "csqcmodel";
        this.iflags |= IFLAG_ORIGIN; // interpolate origin too
        this.iflags |= IFLAG_ANGLES; // interpolate angles too
        this.iflags |= IFLAG_VELOCITY | IFLAG_AUTOVELOCITY; // let's calculate velocity automatically
index 522b4ff2301f86b4e22f8c6d008e79a4f8103f83..c9cdf6981b8533cf6eb85f88a478c8ee4150c8ea 100644 (file)
@@ -117,7 +117,11 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
 
        void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
        {
-               if (e.classname == "") e.classname = "net_linked";
+               if (e.classname == "")
+               {
+                   LOG_WARN("Net_LinkEntity called on an entity without a classname, assigning default");
+                   e.classname = "net_linked";
+               }
 
                if (e.model == "" || e.modelindex == 0)
                {
index 321610ad3e30b225615283625993ebf959eb621a..5c1cfac379a440723d76e44b1f842fdf36706039 100644 (file)
@@ -277,6 +277,7 @@ noref bool __spawnfunc_first;
                if (!this.sourceLoc) { \
                        this.sourceLoc = __FILE__":"STR(__LINE__); \
                } \
+               this.classname = #id; \
                if (!this.spawnfunc_checked) { \
                        _checkWhitelisted(this, #id); \
                        this.spawnfunc_checked = true; \
index 830c56de65f0cca4834131760898e93b9a148006..af0e7ef9454b1d325a6ad80866917bedab05a80e 100644 (file)
@@ -778,8 +778,7 @@ void WarpZone_RefSys_Copy(entity me, entity from)
 }
 entity WarpZone_RefSys_SpawnSameRefSys(entity me)
 {
-       entity e;
-       e = spawn();
+       entity e = spawn();
        WarpZone_RefSys_Copy(e, me);
        return e;
 }
index 3068aa77c62605f53c5c631a08b4a822ef88999b..e26c219a7500223ad24cf1f963af9e97a0061496 100644 (file)
@@ -222,7 +222,7 @@ bool navigation_check_submerged_state(entity ent, vector pos)
 
 bool navigation_checkladders(entity e, vector org, vector m1, vector m2, vector end, vector end2, int movemode)
 {
-       IL_EACH(g_ladders, it.classname == "func_ladder",
+       IL_EACH(g_ladders, true,
        {
                if(it.bot_pickup)
                if(boxesoverlap(org + m1 + '-1 -1 -1', org + m2 + '1 1 1', it.absmin, it.absmax))
index ee01f7ff196433f5c2b2a5397c9bfb0d54851f6b..e87a2b11831c350714e352ddd436e08ade9ba6b7 100644 (file)
@@ -130,7 +130,7 @@ void ClientKill_TeamChange(entity this, float targetteam) // 0 = don't change, -
                {
                        float starttime = max(time, clientkilltime);
 
-                       this.killindicator = spawn();
+                       this.killindicator = new(killindicator);
                        this.killindicator.owner = this;
                        this.killindicator.scale = 0.5;
                        setattachment(this.killindicator, this, "");
@@ -144,7 +144,7 @@ void ClientKill_TeamChange(entity this, float targetteam) // 0 = don't change, -
 
                        IL_EACH(g_clones, it.enemy == this && !(it.effects & CSQCMODEL_EF_RESPAWNGHOST) && !it.killindicator,
                        {
-                               it.killindicator = spawn();
+                               it.killindicator = new(killindicator);
                                it.killindicator.owner = it;
                                it.killindicator.scale = 0.5;
                                setattachment(it.killindicator, it, "");
@@ -188,7 +188,7 @@ void ClientKill_TeamChange(entity this, float targetteam) // 0 = don't change, -
 
 void ClientKill_Silent(entity this, float _delay)
 {
-       this.killindicator = spawn();
+       this.killindicator = new(killindicator);
        this.killindicator.owner = this;
        setthink(this.killindicator, KillIndicator_Think);
        this.killindicator.nextthink = time + (this.lip) * 0.05;
index 2d12f986bfe4be8e0b940cc6df9dd7521b66f5cc..e4299039e3da1e8ee2774a559721ed6be70c6580 100644 (file)
@@ -752,7 +752,7 @@ void CommonCommand_timeout(int request, entity caller)  // DEAR GOD THIS COMMAND
                                        timeout_time = autocvar_sv_timeout_length;
                                        timeout_leadtime = autocvar_sv_timeout_leadtime;
 
-                                       timeout_handler = spawn();
+                                       timeout_handler = new(timeout_handler);
                                        setthink(timeout_handler, timeout_handler_think);
                                        timeout_handler.nextthink = time;  // always let the entity think asap
 
index 42df54c75cc085649aed46533620714ee567110a..145f3f0251cdcd7fe219d17f5cc88ba7e95dc8df 100644 (file)
@@ -406,7 +406,7 @@ bool MapVote_SendEntity(entity this, entity to, int sf)
 
 void MapVote_Spawn()
 {
-       Net_LinkEntity(mapvote_ent = spawn(), false, 0, MapVote_SendEntity);
+       Net_LinkEntity(mapvote_ent = new(mapvote_ent), false, 0, MapVote_SendEntity);
 }
 
 void MapVote_TouchMask()
index 3f5bd580aeb118cb20a6cbfaa6d0b95eed35fc2f..ab0d2bea43f1122610e555bd5eca1d8136eb2e57 100644 (file)
@@ -165,7 +165,6 @@ spawnfunc(info_player_start)
 
 spawnfunc(info_player_deathmatch)
 {
-       this.classname = "info_player_deathmatch";
        IL_PUSH(g_spawnpoints, this);
        relocate_spawnpoint(this);
 }
index a36833a6dbbfa123e657614c0873abc5d270ac6e..4db498b4a0be5fafbca77a6e692e194f294ecd44 100644 (file)
@@ -294,7 +294,7 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector
                vector beampos = start + dir * bound(0, (it.origin - start) * dir, length);
 
                if(!pseudoprojectile)
-                       pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume
+                       pseudoprojectile = new(pseudoprojectile); // we need this so the sound uses the "entchannel4" volume
 
                msg_entity = it;
                // we want this to be very loud when close but fall off quickly -> using max base volume and high attenuation
index 24f725bd268b069b7cb1667584950adf59af9247..0aed2e5078ca3f0f19510e723df3b07451c84d84 100644 (file)
@@ -590,7 +590,7 @@ spawnfunc(__init_dedicated_server)
 
        delete_fn = remove_unsafely;
 
-       entity e = spawn();
+       entity e = new(GotoFirstMap);
        setthink(e, GotoFirstMap);
        e.nextthink = time; // this is usually 1 at this point
 
@@ -1828,7 +1828,7 @@ void readplayerstartcvars()
        start_ammo_plasma = 0;
        if (random_start_ammo == NULL)
        {
-               random_start_ammo = spawn();
+               random_start_ammo = new(random_start_ammo);
        }
        start_health = cvar("g_balance_health_start");
        start_armorvalue = cvar("g_balance_armor_start");