From: TimePath Date: Sun, 18 Oct 2020 03:07:43 +0000 (+0000) Subject: Tidy up classnames X-Git-Tag: xonotic-v0.8.5~728^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0514f7948727cfa572b33bd29d1bdf2c13cd866d;p=xonotic%2Fxonotic-data.pk3dir.git Tidy up classnames --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index c5763a18f..3adef84a4 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -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)); } diff --git a/qcsrc/client/teamradar.qc b/qcsrc/client/teamradar.qc index f0111983f..9e79f0a22 100644 --- a/qcsrc/client/teamradar.qc +++ b/qcsrc/client/teamradar.qc @@ -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) diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index cd582a092..6e4903f4d 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -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; diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index f68b5af41..5b0b6d8e3 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -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; diff --git a/qcsrc/common/effects/qc/gibs.qc b/qcsrc/common/effects/qc/gibs.qc index 35f0fe522..3759248cb 100644 --- a/qcsrc/common/effects/qc/gibs.qc +++ b/qcsrc/common/effects/qc/gibs.qc @@ -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; diff --git a/qcsrc/common/effects/qc/rubble.qh b/qcsrc/common/effects/qc/rubble.qh index 6eda9b15e..83f0ce855 100644 --- a/qcsrc/common/effects/qc/rubble.qh +++ b/qcsrc/common/effects/qc/rubble.qh @@ -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; diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index 95e4af419..9b96feb3b 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -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); diff --git a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc index fcfcf32ff..48d56d1f9 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc +++ b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc @@ -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); diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index ffde264b9..937575752 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -2740,7 +2740,6 @@ spawnfunc(ctf_team) { if(!g_ctf) { delete(this); return; } - this.classname = "ctf_team"; this.team = this.cnt + 1; } diff --git a/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc b/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc index d8e2bb362..4c2084656 100644 --- a/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc +++ b/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc @@ -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); diff --git a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc index d74c2dfc2..993eb936f 100644 --- a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc +++ b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc @@ -75,7 +75,6 @@ spawnfunc(invasion_spawnpoint) { if(!g_invasion) { delete(this); return; } - this.classname = "invasion_spawnpoint"; IL_PUSH(g_invasion_spawns, this); } diff --git a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc index d48c76f39..1c2eacffd 100644 --- a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc +++ b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc @@ -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); diff --git a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc index 1959ac424..2796f2b49 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc @@ -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; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc index 2e05794da..e08ea8101 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc @@ -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); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc index f9011c7d9..6240975d7 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -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); diff --git a/qcsrc/common/gamemodes/gamemode/tdm/sv_tdm.qc b/qcsrc/common/gamemodes/gamemode/tdm/sv_tdm.qc index 1fba2215f..5e8508896 100644 --- a/qcsrc/common/gamemodes/gamemode/tdm/sv_tdm.qc +++ b/qcsrc/common/gamemodes/gamemode/tdm/sv_tdm.qc @@ -14,7 +14,6 @@ spawnfunc(tdm_team) { if(!g_tdm || !this.cnt) { delete(this); return; } - this.classname = "tdm_team"; this.team = this.cnt + 1; } diff --git a/qcsrc/common/mapobjects/func/breakable.qc b/qcsrc/common/mapobjects/func/breakable.qc index 4db651658..bf482b73a 100644 --- a/qcsrc/common/mapobjects/func/breakable.qc +++ b/qcsrc/common/mapobjects/func/breakable.qc @@ -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) diff --git a/qcsrc/common/mapobjects/func/door.qc b/qcsrc/common/mapobjects/func/door.qc index 11196ab38..05fafa4f0 100644 --- a/qcsrc/common/mapobjects/func/door.qc +++ b/qcsrc/common/mapobjects/func/door.qc @@ -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; diff --git a/qcsrc/common/mapobjects/misc/keys.qc b/qcsrc/common/mapobjects/misc/keys.qc index 2c8574249..89f6fa8f9 100644 --- a/qcsrc/common/mapobjects/misc/keys.qc +++ b/qcsrc/common/mapobjects/misc/keys.qc @@ -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); } diff --git a/qcsrc/common/mapobjects/misc/teleport_dest.qc b/qcsrc/common/mapobjects/misc/teleport_dest.qc index 6bf95f24f..efc457409 100644 --- a/qcsrc/common/mapobjects/misc/teleport_dest.qc +++ b/qcsrc/common/mapobjects/misc/teleport_dest.qc @@ -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'; diff --git a/qcsrc/common/mapobjects/platforms.qc b/qcsrc/common/mapobjects/platforms.qc index afd349673..28b420b20 100644 --- a/qcsrc/common/mapobjects/platforms.qc +++ b/qcsrc/common/mapobjects/platforms.qc @@ -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; diff --git a/qcsrc/common/mapobjects/target/location.qc b/qcsrc/common/mapobjects/target/location.qc index 5774f45f9..2169e1b89 100644 --- a/qcsrc/common/mapobjects/target/location.qc +++ b/qcsrc/common/mapobjects/target/location.qc @@ -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 diff --git a/qcsrc/common/mapobjects/trigger/gravity.qc b/qcsrc/common/mapobjects/trigger/gravity.qc index 4b9fb2236..ea63c9a74 100644 --- a/qcsrc/common/mapobjects/trigger/gravity.qc +++ b/qcsrc/common/mapobjects/trigger/gravity.qc @@ -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; diff --git a/qcsrc/common/mapobjects/trigger/impulse.qc b/qcsrc/common/mapobjects/trigger/impulse.qc index c4e7ae287..4306e2ff7 100644 --- a/qcsrc/common/mapobjects/trigger/impulse.qc +++ b/qcsrc/common/mapobjects/trigger/impulse.qc @@ -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; diff --git a/qcsrc/common/mapobjects/trigger/jumppads.qc b/qcsrc/common/mapobjects/trigger/jumppads.qc index b016dde9a..a6128d207 100644 --- a/qcsrc/common/mapobjects/trigger/jumppads.qc +++ b/qcsrc/common/mapobjects/trigger/jumppads.qc @@ -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(); diff --git a/qcsrc/common/mapobjects/trigger/keylock.qc b/qcsrc/common/mapobjects/trigger/keylock.qc index 626a588dc..368da3651 100644 --- a/qcsrc/common/mapobjects/trigger/keylock.qc +++ b/qcsrc/common/mapobjects/trigger/keylock.qc @@ -178,7 +178,6 @@ NET_HANDLE(ENT_CLIENT_KEYLOCK, bool isnew) return = true; - this.classname = "trigger_keylock"; this.entremove = trigger_remove_generic; } #endif diff --git a/qcsrc/common/mapobjects/trigger/viewloc.qc b/qcsrc/common/mapobjects/trigger/viewloc.qc index c8c083611..4679e75f7 100644 --- a/qcsrc/common/mapobjects/trigger/viewloc.qc +++ b/qcsrc/common/mapobjects/trigger/viewloc.qc @@ -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 } diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index 2fdc52fcb..74c867c3a 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -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(); diff --git a/qcsrc/common/minigames/minigame/bd.qc b/qcsrc/common/minigames/minigame/bd.qc index 744dab71a..2aea16c54 100644 --- a/qcsrc/common/minigames/minigame/bd.qc +++ b/qcsrc/common/minigames/minigame/bd.qc @@ -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; diff --git a/qcsrc/common/minigames/minigame/c4.qc b/qcsrc/common/minigames/minigame/c4.qc index be65e6ac1..5aeb7dfb2 100644 --- a/qcsrc/common/minigames/minigame/c4.qc +++ b/qcsrc/common/minigames/minigame/c4.qc @@ -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); diff --git a/qcsrc/common/minigames/minigame/nmm.qc b/qcsrc/common/minigames/minigame/nmm.qc index ab9444757..5b0d39455 100644 --- a/qcsrc/common/minigames/minigame/nmm.qc +++ b/qcsrc/common/minigames/minigame/nmm.qc @@ -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; } diff --git a/qcsrc/common/minigames/minigame/pong.qc b/qcsrc/common/minigames/minigame/pong.qc index 407eb4e8f..6b9b04804 100644 --- a/qcsrc/common/minigames/minigame/pong.qc +++ b/qcsrc/common/minigames/minigame/pong.qc @@ -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); diff --git a/qcsrc/common/minigames/minigame/pp.qc b/qcsrc/common/minigames/minigame/pp.qc index e8aed878a..5a46aa914 100644 --- a/qcsrc/common/minigames/minigame/pp.qc +++ b/qcsrc/common/minigames/minigame/pp.qc @@ -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); diff --git a/qcsrc/common/minigames/minigame/ps.qc b/qcsrc/common/minigames/minigame/ps.qc index 4457449e8..b9762464a 100644 --- a/qcsrc/common/minigames/minigame/ps.qc +++ b/qcsrc/common/minigames/minigame/ps.qc @@ -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); diff --git a/qcsrc/common/minigames/minigame/ttt.qc b/qcsrc/common/minigames/minigame/ttt.qc index ea0c9c368..bb642a282 100644 --- a/qcsrc/common/minigames/minigame/ttt.qc +++ b/qcsrc/common/minigames/minigame/ttt.qc @@ -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); diff --git a/qcsrc/common/minigames/minigames.qc b/qcsrc/common/minigames/minigames.qc index 6d14b2582..0455e8086 100644 --- a/qcsrc/common/minigames/minigames.qc +++ b/qcsrc/common/minigames/minigames.qc @@ -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 diff --git a/qcsrc/common/minigames/minigames.qh b/qcsrc/common/minigames/minigames.qh index 284001a0a..de0baf6b3 100644 --- a/qcsrc/common/minigames/minigames.qh +++ b/qcsrc/common/minigames/minigames.qh @@ -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" diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 8addac353..00aa9e6ac 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -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; diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index 0a811cb70..6b1965b54 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -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); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 7ddc7b10c..5ebf5761f 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -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; diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 07d6292bd..50b5d91b5 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -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; diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 64c67bd54..1c37195a3 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -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); diff --git a/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc b/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc index 63b43e018..328f79ac8 100644 --- a/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc +++ b/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc @@ -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); diff --git a/qcsrc/common/mutators/mutator/superspec/sv_superspec.qc b/qcsrc/common/mutators/mutator/superspec/sv_superspec.qc index c721f4571..add4bec01 100644 --- a/qcsrc/common/mutators/mutator/superspec/sv_superspec.qc +++ b/qcsrc/common/mutators/mutator/superspec/sv_superspec.qc @@ -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; diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index 8b4013c8a..ebabee158 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -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; diff --git a/qcsrc/common/turrets/checkpoint.qc b/qcsrc/common/turrets/checkpoint.qc index 25c61b4b6..976bfac28 100644 --- a/qcsrc/common/turrets/checkpoint.qc +++ b/qcsrc/common/turrets/checkpoint.qc @@ -33,7 +33,6 @@ spawnfunc(turret_checkpoint) // Compat. spawnfunc(walker_checkpoint) { - this.classname = "turret_checkpoint"; spawnfunc_turret_checkpoint(this); } diff --git a/qcsrc/common/turrets/turret/phaser_weapon.qc b/qcsrc/common/turrets/turret/phaser_weapon.qc index 6b5b4fae8..e4d09d193 100644 --- a/qcsrc/common/turrets/turret/phaser_weapon.qc +++ b/qcsrc/common/turrets/turret/phaser_weapon.qc @@ -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; diff --git a/qcsrc/common/turrets/util.qc b/qcsrc/common/turrets/util.qc index 6857ccad8..c25b892e8 100644 --- a/qcsrc/common/turrets/util.qc +++ b/qcsrc/common/turrets/util.qc @@ -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'); diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index 86e718bbb..971a5ebad 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -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; diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 5bc834a00..e12304193 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -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); diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 0a8875b48..8b34473e3 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -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; diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 6f6e85687..da2c1da0b 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -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; diff --git a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc index 7d4a250f4..dc219f571 100644 --- a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc @@ -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); diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index 069696639..d6a371b76 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -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"); diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index d19057654..848825f14 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -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; diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index accb917f6..01a922bb8 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -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); diff --git a/qcsrc/common/wepent.qc b/qcsrc/common/wepent.qc index 3d751035b..da2b0539d 100644 --- a/qcsrc/common/wepent.qc +++ b/qcsrc/common/wepent.qc @@ -191,8 +191,6 @@ MACRO_END NET_HANDLE(ENT_CLIENT_WEPENT, bool isnew) { - if (isnew) - this.classname = "wepent_receiver"; return ReadWepent(this); } diff --git a/qcsrc/lib/csqcmodel/cl_model.qc b/qcsrc/lib/csqcmodel/cl_model.qc index ccf675117..c4f6dbf0a 100644 --- a/qcsrc/lib/csqcmodel/cl_model.qc +++ b/qcsrc/lib/csqcmodel/cl_model.qc @@ -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 diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index 522b4ff23..c9cdf6981 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -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) { diff --git a/qcsrc/lib/spawnfunc.qh b/qcsrc/lib/spawnfunc.qh index 321610ad3..5c1cfac37 100644 --- a/qcsrc/lib/spawnfunc.qh +++ b/qcsrc/lib/spawnfunc.qh @@ -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; \ diff --git a/qcsrc/lib/warpzone/common.qc b/qcsrc/lib/warpzone/common.qc index 830c56de6..af0e7ef94 100644 --- a/qcsrc/lib/warpzone/common.qc +++ b/qcsrc/lib/warpzone/common.qc @@ -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; } diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 3068aa77c..e26c219a7 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -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)) diff --git a/qcsrc/server/clientkill.qc b/qcsrc/server/clientkill.qc index ee01f7ff1..e87a2b118 100644 --- a/qcsrc/server/clientkill.qc +++ b/qcsrc/server/clientkill.qc @@ -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; diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 2d12f986b..e4299039e 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -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 diff --git a/qcsrc/server/mapvoting.qc b/qcsrc/server/mapvoting.qc index 42df54c75..145f3f025 100644 --- a/qcsrc/server/mapvoting.qc +++ b/qcsrc/server/mapvoting.qc @@ -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() diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 3f5bd580a..ab0d2bea4 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -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); } diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index a36833a6d..4db498b4a 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -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 diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 24f725bd2..0aed2e507 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -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");