From: TimePath Date: Sun, 8 Apr 2018 10:42:55 +0000 (+1000) Subject: Improve QCC compatibility X-Git-Tag: xonotic-v0.8.5~2196 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=988f88a3e0c9ff13570e23b593b69257047188be;p=xonotic%2Fxonotic-data.pk3dir.git Improve QCC compatibility --- diff --git a/qcsrc/client/bgmscript.qc b/qcsrc/client/bgmscript.qc index 2db9e54cf..ba1fdd268 100644 --- a/qcsrc/client/bgmscript.qc +++ b/qcsrc/client/bgmscript.qc @@ -11,12 +11,12 @@ float bgmscriptbuf; float bgmscriptbufsize; float bgmscriptbufloaded; -class(BGMScript) .float bgmscriptline; -class(BGMScript) .float bgmscriptline0; -class(BGMScript) .float bgmscriptvolume; -class(BGMScript) .float bgmscripttime; -class(BGMScript) .float bgmscriptstate; -class(BGMScript) .float bgmscriptstatetime; +classfield(BGMScript) .float bgmscriptline; +classfield(BGMScript) .float bgmscriptline0; +classfield(BGMScript) .float bgmscriptvolume; +classfield(BGMScript) .float bgmscripttime; +classfield(BGMScript) .float bgmscriptstate; +classfield(BGMScript) .float bgmscriptstatetime; float GetAttackDecaySustainAmplitude(float a, float d, float s, float t) { diff --git a/qcsrc/client/bgmscript.qh b/qcsrc/client/bgmscript.qh index 18b0d5ee4..a3044d537 100644 --- a/qcsrc/client/bgmscript.qh +++ b/qcsrc/client/bgmscript.qh @@ -1,13 +1,13 @@ #pragma once entityclass(BGMScript); -class(BGMScript) .string bgmscript; -class(BGMScript) .float bgmscriptattack; -class(BGMScript) .float bgmscriptdecay; -class(BGMScript) .float bgmscriptsustain; -class(BGMScript) .float bgmscriptrelease; +classfield(BGMScript) .string bgmscript; +classfield(BGMScript) .float bgmscriptattack; +classfield(BGMScript) .float bgmscriptdecay; +classfield(BGMScript) .float bgmscriptsustain; +classfield(BGMScript) .float bgmscriptrelease; -class(BGMScript) .float just_toggled; +classfield(BGMScript) .float just_toggled; #ifdef CSQC void BGMScript_InitEntity(entity e); diff --git a/qcsrc/client/hud/hud.qh b/qcsrc/client/hud/hud.qh index dcc72efff..496d775ef 100644 --- a/qcsrc/client/hud/hud.qh +++ b/qcsrc/client/hud/hud.qh @@ -120,18 +120,18 @@ vector panel_size_copied; entity panel; entityclass(HUDPanel); -class(HUDPanel) .string panel_name; -class(HUDPanel) .int panel_id; -class(HUDPanel) .vector current_panel_pos; -class(HUDPanel) .vector current_panel_size; -class(HUDPanel) .string current_panel_bg; -class(HUDPanel) .float current_panel_bg_alpha; -class(HUDPanel) .float current_panel_bg_border; -class(HUDPanel) .vector current_panel_bg_color; -class(HUDPanel) .float current_panel_bg_color_team; -class(HUDPanel) .float current_panel_bg_padding; -class(HUDPanel) .float current_panel_fg_alpha; -class(HUDPanel) .float update_time; +classfield(HUDPanel) .string panel_name; +classfield(HUDPanel) .int panel_id; +classfield(HUDPanel) .vector current_panel_pos; +classfield(HUDPanel) .vector current_panel_size; +classfield(HUDPanel) .string current_panel_bg; +classfield(HUDPanel) .float current_panel_bg_alpha; +classfield(HUDPanel) .float current_panel_bg_border; +classfield(HUDPanel) .vector current_panel_bg_color; +classfield(HUDPanel) .float current_panel_bg_color_team; +classfield(HUDPanel) .float current_panel_bg_padding; +classfield(HUDPanel) .float current_panel_fg_alpha; +classfield(HUDPanel) .float update_time; float panel_enabled; vector panel_pos; vector panel_size; @@ -148,7 +148,7 @@ string panel_bg_border_str; float panel_bg_padding; string panel_bg_padding_str; -class(HUDPanel) .void() panel_draw; +classfield(HUDPanel) .void() panel_draw; // chat panel can be reduced / moved while the mapvote is active // let know the mapvote panel about chat pos and size diff --git a/qcsrc/client/player_skeleton.qc b/qcsrc/client/player_skeleton.qc index 55e54d8ac..220b9c612 100644 --- a/qcsrc/client/player_skeleton.qc +++ b/qcsrc/client/player_skeleton.qc @@ -8,13 +8,13 @@ .float v_angle_save_x; -class(Skeleton) .float skeleton_info_modelindex; -class(Skeleton) .float skeleton_info_skin; +classfield(Skeleton) .float skeleton_info_modelindex; +classfield(Skeleton) .float skeleton_info_skin; const int BONETYPE_LOWER = 0; const int BONETYPE_UPPER = 1; const int MAX_BONES = 128; -class(Skeleton) .float skeleton_bonetype[MAX_BONES]; -class(Skeleton) .float skeleton_numbones; +classfield(Skeleton) .float skeleton_bonetype[MAX_BONES]; +classfield(Skeleton) .float skeleton_numbones; void skeleton_loadinfo(entity e) { diff --git a/qcsrc/client/player_skeleton.qh b/qcsrc/client/player_skeleton.qh index 8c5969b09..082335e4b 100644 --- a/qcsrc/client/player_skeleton.qh +++ b/qcsrc/client/player_skeleton.qh @@ -7,8 +7,8 @@ void skeleton_from_frames(entity e, float is_dead); void skeleton_loadinfo(entity e); entityclass(Skeleton); -class(Skeleton) .float bone_upperbody; -class(Skeleton) .int bone_weapon; -class(Skeleton) .float bone_aim[MAX_AIM_BONES]; -class(Skeleton) .float bone_aimweight[MAX_AIM_BONES]; -class(Skeleton) .float fixbone; +classfield(Skeleton) .float bone_upperbody; +classfield(Skeleton) .int bone_weapon; +classfield(Skeleton) .float bone_aim[MAX_AIM_BONES]; +classfield(Skeleton) .float bone_aimweight[MAX_AIM_BONES]; +classfield(Skeleton) .float fixbone; diff --git a/qcsrc/client/shownames.qh b/qcsrc/client/shownames.qh index 24f6568d2..a05ca701d 100644 --- a/qcsrc/client/shownames.qh +++ b/qcsrc/client/shownames.qh @@ -1,10 +1,10 @@ #pragma once entityclass(ShowNames); -class(ShowNames) .float healthvalue; -class(ShowNames) .float armorvalue; -class(ShowNames) .float sameteam; -class(ShowNames) .float fadedelay; -class(ShowNames) .float pointtime; +classfield(ShowNames) .float healthvalue; +classfield(ShowNames) .float armorvalue; +classfield(ShowNames) .float sameteam; +classfield(ShowNames) .float fadedelay; +classfield(ShowNames) .float pointtime; void Draw_ShowNames_All(); diff --git a/qcsrc/client/teamradar.qh b/qcsrc/client/teamradar.qh index 251c1a53f..41c7d46c5 100644 --- a/qcsrc/client/teamradar.qh +++ b/qcsrc/client/teamradar.qh @@ -4,10 +4,10 @@ const int MAX_TEAMRADAR_TIMES = 32; entityclass(TeamRadar); // to make entities have dots on the team radar -class(TeamRadar) .float teamradar_icon; -class(TeamRadar) .float teamradar_times[MAX_TEAMRADAR_TIMES]; -class(TeamRadar) .int teamradar_time_index; -class(TeamRadar) .vector teamradar_color; +classfield(TeamRadar) .float teamradar_icon; +classfield(TeamRadar) .float teamradar_times[MAX_TEAMRADAR_TIMES]; +classfield(TeamRadar) .int teamradar_time_index; +classfield(TeamRadar) .vector teamradar_color; float teamradar_angle; // player yaw angle vector teamradar_origin3d_in_texcoord; // player origin diff --git a/qcsrc/client/wall.qh b/qcsrc/client/wall.qh index 11aebd0ed..e55bc489b 100644 --- a/qcsrc/client/wall.qh +++ b/qcsrc/client/wall.qh @@ -1,11 +1,11 @@ #pragma once entityclass(Wall); -class(Wall) .float lip; -class(Wall) .float bgmscriptangular; -class(Wall) .int lodmodelindex0, lodmodelindex1, lodmodelindex2; -class(Wall) .float loddistance1, loddistance2; -class(Wall) .vector saved; +classfield(Wall) .float lip; +classfield(Wall) .float bgmscriptangular; +classfield(Wall) .int lodmodelindex0, lodmodelindex1, lodmodelindex2; +classfield(Wall) .float loddistance1, loddistance2; +classfield(Wall) .vector saved; // Needed for interactive clientwalls .float inactive; // Clientwall disappears when inactive diff --git a/qcsrc/client/weapons/projectile.qh b/qcsrc/client/weapons/projectile.qh index a6ae46347..eaa80d05f 100644 --- a/qcsrc/client/weapons/projectile.qh +++ b/qcsrc/client/weapons/projectile.qh @@ -3,20 +3,20 @@ #include entityclass(Projectile); -class(Projectile).int traileffect; - -class(Projectile).vector iorigin1, iorigin2; -class(Projectile).float spawntime; -class(Projectile).vector trail_oldorigin; -class(Projectile).float trail_oldtime; -class(Projectile).float fade_time, fade_rate; - -class(Projectile).float alphamod; -class(Projectile).int count; // set if clientside projectile -class(Projectile).int cnt; // sound index -class(Projectile).float gravity; -class(Projectile).int snd_looping; -class(Projectile).bool silent; +classfield(Projectile).int traileffect; + +classfield(Projectile).vector iorigin1, iorigin2; +classfield(Projectile).float spawntime; +classfield(Projectile).vector trail_oldorigin; +classfield(Projectile).float trail_oldtime; +classfield(Projectile).float fade_time, fade_rate; + +classfield(Projectile).float alphamod; +classfield(Projectile).int count; // set if clientside projectile +classfield(Projectile).int cnt; // sound index +classfield(Projectile).float gravity; +classfield(Projectile).int snd_looping; +classfield(Projectile).bool silent; void SUB_Stop(entity this, entity toucher); diff --git a/qcsrc/common/effects/effectinfo.qc b/qcsrc/common/effects/effectinfo.qc index 71260eb3d..a1b278730 100644 --- a/qcsrc/common/effects/effectinfo.qc +++ b/qcsrc/common/effects/effectinfo.qc @@ -327,7 +327,7 @@ REGISTRY(EffectInfos, BITS(9)) #define EffectInfos_from(i) _EffectInfos_from(i, NULL) REGISTER_REGISTRY(EffectInfos) #define EFFECTINFO(name) \ - [[accumulate]] void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) { } \ + ACCUMULATE void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) { } \ REGISTER(EffectInfos, EFFECTINFO, name, m_id, NEW(EffectInfoGroup)) { \ effectinfo_##name(this, NULL); \ } @@ -335,8 +335,8 @@ REGISTER_REGISTRY(EffectInfos) #define MY(f) this.effectinfo_##f #define DEF(name) EFFECTINFO(name) #define SUB(name) \ - [[accumulate]] void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) { parent = EFFECTINFO_##name; parent.children[parent.children_count++] = this = NEW(EffectInfo, #name); } \ - [[accumulate]] void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) + ACCUMULATE void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) { parent = EFFECTINFO_##name; parent.children[parent.children_count++] = this = NEW(EffectInfo, #name); } \ + ACCUMULATE void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) #include "effectinfo.inc" #undef MY #undef DEF diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 2abf2122c..d225b337b 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -30,10 +30,10 @@ void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float ran #ifdef CSQC entityclass(Casing); -class(Casing) .float alpha; -class(Casing) .bool silent; -class(Casing) .int state; -class(Casing) .float cnt; +classfield(Casing) .float alpha; +classfield(Casing) .bool silent; +classfield(Casing) .int state; +classfield(Casing) .float cnt; void Casing_Delete(entity this) { diff --git a/qcsrc/common/effects/qc/modeleffects.qc b/qcsrc/common/effects/qc/modeleffects.qc index 26b3ec9f5..9849b5be7 100644 --- a/qcsrc/common/effects/qc/modeleffects.qc +++ b/qcsrc/common/effects/qc/modeleffects.qc @@ -80,10 +80,10 @@ void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector an #ifdef CSQC entityclass(ModelEffect); -class(ModelEffect) .float frame1time; -class(ModelEffect) .float lifetime, fadetime; -class(ModelEffect) .float teleport_time; -class(ModelEffect) .float scale1, scale2; +classfield(ModelEffect) .float frame1time; +classfield(ModelEffect) .float lifetime, fadetime; +classfield(ModelEffect) .float teleport_time; +classfield(ModelEffect) .float scale1, scale2; .float cnt; .float scale; diff --git a/qcsrc/common/effects/qc/rubble.qh b/qcsrc/common/effects/qc/rubble.qh index dd3785b68..6eda9b15e 100644 --- a/qcsrc/common/effects/qc/rubble.qh +++ b/qcsrc/common/effects/qc/rubble.qh @@ -3,7 +3,7 @@ #ifdef CSQC entityclass(Rubble); -class(Rubble).float creationtime; +classfield(Rubble).float creationtime; IntrusiveList g_rubble; STATIC_INIT(g_rubble) { g_rubble = IL_NEW(); } diff --git a/qcsrc/common/mutators/base.qh b/qcsrc/common/mutators/base.qh index 4f940c42b..565e39998 100644 --- a/qcsrc/common/mutators/base.qh +++ b/qcsrc/common/mutators/base.qh @@ -135,7 +135,7 @@ void RegisterCallbacks() {}; params(_MUTATOR_HANDLE_NOP, _MUTATOR_HANDLE_POPOUT) \ return ret; \ } \ - [[accumulate]] void RegisterHooks() { HOOK_##id = NEW(CallbackChain, #id); } + ACCUMULATE void RegisterHooks() { HOOK_##id = NEW(CallbackChain, #id); } #define MUTATOR_CALLHOOK(id, ...) _MUTATOR_CALLHOOK(id, __VA_ARGS__) #ifdef __STDC__ @@ -265,7 +265,7 @@ void Mutator_Remove(Mutator mut) bool MUTATOR_##id##_check() { return dependence; } \ REGISTER(Mutators, MUTATOR, id, m_id, NEW(Mutator, #id, MUTATORFUNCTION_##id)) \ { this.mutatorcheck = MUTATOR_##id##_check; } \ - [[accumulate]] bool MUTATORFUNCTION_##id(int mode) + ACCUMULATE bool MUTATORFUNCTION_##id(int mode) STATIC_INIT(Mutators) { RegisterHooks(); @@ -301,7 +301,7 @@ STATIC_INIT_LATE(Mutators) { #define _MUTATOR_CALLBACK(name, func) \ Callback CALLBACK_##name; \ bool func(); \ - [[accumulate]] void RegisterCallbacks() { CALLBACK_##name = NEW(Callback, func); } + ACCUMULATE void RegisterCallbacks() { CALLBACK_##name = NEW(Callback, func); } #define MUTATOR_HOOKFUNCTION(...) \ EVAL_MUTATOR_HOOKFUNCTION(OVERLOAD(MUTATOR_HOOKFUNCTION, __VA_ARGS__)) @@ -312,9 +312,9 @@ STATIC_INIT_LATE(Mutators) { #define MUTATOR_HOOKFUNCTION_3(mut, cb, order) \ _MUTATOR_CALLBACK(mut##_##cb, mut##_##cb) \ - [[accumulate]] bool MUTATORFUNCTION_##mut##_hooks(int mode) { MUTATOR_HOOK(cb, mut##_##cb, order); } \ + ACCUMULATE bool MUTATORFUNCTION_##mut##_hooks(int mode) { MUTATOR_HOOK(cb, mut##_##cb, order); } \ bool mut##_##cb() { return = false; } \ - [[accumulate]] bool mut##_##cb() + ACCUMULATE bool mut##_##cb() #define MUTATOR_HOOK(cb, func, order) MACRO_BEGIN { \ MUTATOR_ONADD { \ diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh index 95b8890cc..94d735a1f 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh @@ -11,21 +11,21 @@ const int SPRITERULE_SPECTATOR = 2; #ifdef CSQC entityclass(WaypointSprite); -class(WaypointSprite) .float helpme; -class(WaypointSprite) .float rule; -class(WaypointSprite) .string netname; // primary picture -class(WaypointSprite) .string netname2; // secondary picture -class(WaypointSprite) .string netname3; // tertiary picture -class(WaypointSprite) .int team; // team that gets netname2 -class(WaypointSprite) .float lifetime; -class(WaypointSprite) .float fadetime; -class(WaypointSprite) .float maxdistance; -class(WaypointSprite) .int hideflags; -class(WaypointSprite) .float spawntime; -class(WaypointSprite) .float health; -class(WaypointSprite) .float build_started; -class(WaypointSprite) .float build_starthealth; -class(WaypointSprite) .float build_finished; +classfield(WaypointSprite) .float helpme; +classfield(WaypointSprite) .float rule; +classfield(WaypointSprite) .string netname; // primary picture +classfield(WaypointSprite) .string netname2; // secondary picture +classfield(WaypointSprite) .string netname3; // tertiary picture +classfield(WaypointSprite) .int team; // team that gets netname2 +classfield(WaypointSprite) .float lifetime; +classfield(WaypointSprite) .float fadetime; +classfield(WaypointSprite) .float maxdistance; +classfield(WaypointSprite) .int hideflags; +classfield(WaypointSprite) .float spawntime; +classfield(WaypointSprite) .float health; +classfield(WaypointSprite) .float build_started; +classfield(WaypointSprite) .float build_starthealth; +classfield(WaypointSprite) .float build_finished; float autocvar_g_waypointsprite_alpha; float autocvar_g_waypointsprite_crosshairfadealpha; diff --git a/qcsrc/common/triggers/func/pointparticles.qc b/qcsrc/common/triggers/func/pointparticles.qc index 93eb83610..9286f2adb 100644 --- a/qcsrc/common/triggers/func/pointparticles.qc +++ b/qcsrc/common/triggers/func/pointparticles.qc @@ -169,17 +169,17 @@ spawnfunc(func_sparks) .int dphitcontentsmask; entityclass(PointParticles); -class(PointParticles) .int cnt; // effect number -class(PointParticles) .vector velocity; // particle velocity -class(PointParticles) .float waterlevel; // direction jitter -class(PointParticles) .int count; // count multiplier -class(PointParticles) .int impulse; // density -class(PointParticles) .string noise; // sound -class(PointParticles) .float atten; -class(PointParticles) .float volume; -class(PointParticles) .float absolute; // 1 = count per second is absolute, 2 = only spawn at toggle -class(PointParticles) .vector movedir; // trace direction -class(PointParticles) .float glow_color; // palette index +classfield(PointParticles) .int cnt; // effect number +classfield(PointParticles) .vector velocity; // particle velocity +classfield(PointParticles) .float waterlevel; // direction jitter +classfield(PointParticles) .int count; // count multiplier +classfield(PointParticles) .int impulse; // density +classfield(PointParticles) .string noise; // sound +classfield(PointParticles) .float atten; +classfield(PointParticles) .float volume; +classfield(PointParticles) .float absolute; // 1 = count per second is absolute, 2 = only spawn at toggle +classfield(PointParticles) .vector movedir; // trace direction +classfield(PointParticles) .float glow_color; // palette index void Draw_PointParticles(entity this) { diff --git a/qcsrc/common/triggers/misc/laser.qc b/qcsrc/common/triggers/misc/laser.qc index 3d5ef42d8..b7bdede72 100644 --- a/qcsrc/common/triggers/misc/laser.qc +++ b/qcsrc/common/triggers/misc/laser.qc @@ -252,14 +252,14 @@ spawnfunc(misc_laser) // it has color 'colormod' // and stops when something is in the way entityclass(Laser); -class(Laser) .int cnt; // end effect -class(Laser) .vector colormod; -class(Laser) .int state; // on-off -class(Laser) .int count; // flags for the laser -class(Laser) .vector velocity; -class(Laser) .float alpha; -class(Laser) .float scale; // scaling factor of the thickness -class(Laser) .float modelscale; // scaling factor of the dlight +classfield(Laser) .int cnt; // end effect +classfield(Laser) .vector colormod; +classfield(Laser) .int state; // on-off +classfield(Laser) .int count; // flags for the laser +classfield(Laser) .vector velocity; +classfield(Laser) .float alpha; +classfield(Laser) .float scale; // scaling factor of the thickness +classfield(Laser) .float modelscale; // scaling factor of the dlight void Draw_Laser(entity this) { diff --git a/qcsrc/common/triggers/target/music.qh b/qcsrc/common/triggers/target/music.qh index 80b3684a4..1cb32ea39 100644 --- a/qcsrc/common/triggers/target/music.qh +++ b/qcsrc/common/triggers/target/music.qh @@ -10,8 +10,8 @@ entity music_trigger; // FIXME also control bgmvolume here, to not require a target_music for the default track. entityclass(TargetMusic); -class(TargetMusic) .int state; -class(TargetMusic) .float lastvol; +classfield(TargetMusic) .int state; +classfield(TargetMusic) .float lastvol; void TargetMusic_Advance(); diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 8d569d04e..985d2ae59 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -261,11 +261,11 @@ float autocvar_cl_grapplehook_alpha = 1; void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg); entityclass(Hook); -class(Hook) .entity HookType; // ENT_CLIENT_* -class(Hook) .vector origin; -class(Hook) .vector velocity; -class(Hook) .float HookSilent; -class(Hook) .float HookRange; +classfield(Hook) .entity HookType; // ENT_CLIENT_* +classfield(Hook) .vector origin; +classfield(Hook) .vector velocity; +classfield(Hook) .float HookSilent; +classfield(Hook) .float HookRange; string Draw_GrapplingHook_trace_callback_tex; float Draw_GrapplingHook_trace_callback_rnd; @@ -281,7 +281,7 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end) Draw_GrapplingHook_trace_callback_rnd += 0.25 * vlen(hit - start) / 8; } -class(Hook) .float teleport_time; +classfield(Hook) .float teleport_time; void Draw_GrapplingHook(entity this) { vector a, b, atrans; diff --git a/qcsrc/common/weapons/weapon/tuba.qh b/qcsrc/common/weapons/weapon/tuba.qh index ffa1dd6e2..d932d98bd 100644 --- a/qcsrc/common/weapons/weapon/tuba.qh +++ b/qcsrc/common/weapons/weapon/tuba.qh @@ -45,9 +45,9 @@ SPAWNFUNC_WEAPON(weapon_tuba, WEP_TUBA) #ifdef CSQC entityclass(Tuba); -class(Tuba) .int note; -class(Tuba) .bool tuba_attenuate; -class(Tuba) .float tuba_volume; -class(Tuba) .float tuba_volume_initial; -class(Tuba) .int tuba_instrument; +classfield(Tuba) .int note; +classfield(Tuba) .bool tuba_attenuate; +classfield(Tuba) .float tuba_volume; +classfield(Tuba) .float tuba_volume_initial; +classfield(Tuba) .int tuba_instrument; #endif diff --git a/qcsrc/lib/_all.inc b/qcsrc/lib/_all.inc index d44c5e89c..d45dc208e 100644 --- a/qcsrc/lib/_all.inc +++ b/qcsrc/lib/_all.inc @@ -24,12 +24,26 @@ #define bool float #endif +#ifndef QCC_SUPPORT_ACCUMULATE + #warning "QCC does not support accumulate, may not compile correctly" + #define ACCUMULATE +#else + #define ACCUMULATE [[accumulate]] +#endif + #ifndef QCC_SUPPORT_ERASEABLE #define ERASEABLE #else #define ERASEABLE [[eraseable]] #endif +#ifndef QCC_SUPPORT_ALIAS + #warning "QCC does not support alias, may not compile correctly" + #define ALIAS(var) +#else + #define ALIAS(var) [[alias(var)]] +#endif + #include #if defined(CSQC) @@ -47,6 +61,12 @@ #include +#ifndef QCC_SUPPORT_POW + #define pow(a, b) pow(a, b) +#else + #define pow(a, b) (a ** b) +#endif + #include "self.qh" #define USING(name, T) typedef T name diff --git a/qcsrc/lib/accumulate.qh b/qcsrc/lib/accumulate.qh index c265325f8..2d1e40212 100644 --- a/qcsrc/lib/accumulate.qh +++ b/qcsrc/lib/accumulate.qh @@ -2,7 +2,7 @@ #ifdef QCC_SUPPORT_ACCUMULATE #define ACCUMULATE_FUNCTION(func, otherfunc) \ - [[accumulate]] void func() \ + ACCUMULATE void func() \ { \ otherfunc(); \ } diff --git a/qcsrc/lib/compiler.qh b/qcsrc/lib/compiler.qh index d1bdc4fe5..5ca0ed565 100644 --- a/qcsrc/lib/compiler.qh +++ b/qcsrc/lib/compiler.qh @@ -18,6 +18,18 @@ #endif #endif +#ifndef QCC_SUPPORT_ALIAS + #ifdef GMQCC + #define QCC_SUPPORT_ALIAS + #endif +#endif + +#ifndef QCC_SUPPORT_POW + #ifdef GMQCC + #define QCC_SUPPORT_POW + #endif +#endif + #ifdef GMQCC #define LABEL(id) :id #else diff --git a/qcsrc/lib/cvar.qh b/qcsrc/lib/cvar.qh index a17f2bad7..e8e2c5488 100644 --- a/qcsrc/lib/cvar.qh +++ b/qcsrc/lib/cvar.qh @@ -87,7 +87,7 @@ const noref vector default_vector = '0 0 0'; // e.g.: AUTOCVAR(mycvar, float, 2.5, "cvar description") #define __AUTOCVAR(file, archive, var, type, desc, default) \ - [[accumulate]] void RegisterCvars(void(string, string, string, bool, string) f) \ + ACCUMULATE void RegisterCvars(void(string, string, string, bool, string) f) \ { \ f( #var, repr_cvar_##type(default), desc, archive, file); \ } \ diff --git a/qcsrc/lib/defer.qh b/qcsrc/lib/defer.qh index 4f34bb485..5d6473080 100644 --- a/qcsrc/lib/defer.qh +++ b/qcsrc/lib/defer.qh @@ -6,8 +6,8 @@ #include "self.qh" entityclass(Defer); - class(Defer).entity owner; - class(Defer).void(entity) defer_func; + classfield(Defer).entity owner; + classfield(Defer).void(entity) defer_func; /** Remove entity */ void SUB_Remove(entity this) diff --git a/qcsrc/lib/misc.qh b/qcsrc/lib/misc.qh index 6c29a4b88..cbb107924 100644 --- a/qcsrc/lib/misc.qh +++ b/qcsrc/lib/misc.qh @@ -10,13 +10,15 @@ #include "p99.qh" #define OVERLOAD(F, ...) P99_IF_EMPTY(__VA_ARGS__)(P99_PASTE2(F, _00)())(P99_PASTE3(F, _, P00_NARG(__VA_ARGS__))(__VA_ARGS__)) - /** for use within a macro */ + /** for use within macros */ #define OVERLOAD_(F, ...) P99_IF_EMPTY(__VA_ARGS__)(P99_PASTE2(F, _00)())(P99_PASTE3(F, _, P00_NARG(__VA_ARGS__))(__VA_ARGS__)) + #define OVERLOAD__(F, ...) P99_IF_EMPTY(__VA_ARGS__)(P99_PASTE2(F, _00)())(P99_PASTE3(F, _, P00_NARG(__VA_ARGS__))(__VA_ARGS__)) #else #define EVAL(...) __VA_ARGS__ - #define OVERLOAD_(F, ...) F##_##__VA_COUNT__(__VA_ARGS__) #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__) + #define OVERLOAD_(F, ...) F##_##__VA_COUNT__(__VA_ARGS__) + #define OVERLOAD__(F, ...) F##_##__VA_COUNT__(__VA_ARGS__) #endif #if defined(CSQC) diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index fe2952e2c..4769a2138 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -50,7 +50,7 @@ STATIC_INIT(RegisterTempEntities_renumber) { FOREACH(TempEntities, true, it.m_id #ifdef CSQC #define REGISTER_NET_LINKED(id) \ - [[accumulate]] NET_HANDLE(id, bool isnew) \ + ACCUMULATE NET_HANDLE(id, bool isnew) \ { \ this = __self; \ this.sourceLoc = __FILE__ ":" STR(__LINE__); \ diff --git a/qcsrc/lib/noise.qh b/qcsrc/lib/noise.qh index 782798c9f..5ef9cf8b6 100644 --- a/qcsrc/lib/noise.qh +++ b/qcsrc/lib/noise.qh @@ -2,11 +2,11 @@ // noises "usually" start in the range -1..1 entityclass(Noise); -class(Noise).float noise_baccum; -class(Noise).float noise_paccum; -class(Noise).float noise_paccum2; -class(Noise).float noise_paccum3; -class(Noise).float noise_bstate; +classfield(Noise).float noise_baccum; +classfield(Noise).float noise_paccum; +classfield(Noise).float noise_paccum2; +classfield(Noise).float noise_paccum3; +classfield(Noise).float noise_bstate; ERASEABLE float Noise_Brown(entity e, float dt) diff --git a/qcsrc/lib/oo.qh b/qcsrc/lib/oo.qh index 08de37474..b22ff7915 100644 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@ -5,19 +5,16 @@ #include "static.qh" .vector origin; + .bool pure_data; -/** @deprecated use new_pure or NEW(class) */ -#define make_pure(e) \ - MACRO_BEGIN \ - { \ - (e).pure_data = true; \ - } MACRO_END -#define make_impure(e) \ - MACRO_BEGIN \ - { \ - (e).pure_data = false; \ - } MACRO_END #define is_pure(e) ((e).pure_data) +/** @deprecated use new_pure or NEW(class) */ +#define make_pure(e) MACRO_BEGIN \ + (e).pure_data = true; \ +MACRO_END +#define make_impure(e) MACRO_BEGIN \ + (e).pure_data = false; \ +MACRO_END .string classname; /** Location entity was spawned from in source */ @@ -58,11 +55,11 @@ entity __spawn(string _classname, string _sourceLoc, bool pure) #define entityclass_1(name) entityclass_2(name, Object) #ifndef QCC_SUPPORT_ENTITYCLASS #define entityclass_2(name, base) USING(name, entity) - #define class(name) + #define classfield(name) #define _new(class, pure) __spawn( #class, __FILE__ ":" STR(__LINE__), pure) #else #define entityclass_2(name, base) entityclass name : base {} - #define class(name) [[class(name)]] + #define classfield(name) [[class(name)]] #define _new(class, pure) ((class) __spawn( #class, __FILE__ ":" STR(__LINE__), pure)) #endif /** entities you care about seeing (.origin works) */ @@ -71,12 +68,13 @@ entity __spawn(string _classname, string _sourceLoc, bool pure) #define new_pure(class) _new(class, true) #define spawn() __spawn("entity", __FILE__ ":" STR(__LINE__), false) -[[accumulate]] void ONREMOVE(entity this) {} +ACCUMULATE void ONREMOVE(entity this) {} #ifndef SVQC #define delete_fn builtin_remove #endif +.void(entity this) dtor; #define delete(this) MACRO_BEGIN { \ entity _this = (this); \ void(entity) _dtor = _this.dtor; \ @@ -104,7 +102,7 @@ void clearentity(entity e) } // Classes have a `spawn##cname(entity)` constructor -// The parameter is used across [[accumulate]] functions +// The parameter is used across ACCUMULATE functions .bool transmute; @@ -138,12 +136,149 @@ void clearentity(entity e) } \ MACRO_END -#define CONSTRUCTOR(cname, ...) \ - cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) \ - { \ - return = this; \ - } \ - [[accumulate]] cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) +#define CLASS(...) EVAL_CLASS(OVERLOAD__(CLASS, __VA_ARGS__)) +#define EVAL_CLASS(...) __VA_ARGS__ + +#define ATTRIB(...) EVAL_ATTRIB(OVERLOAD_(ATTRIB, __VA_ARGS__)) +#define EVAL_ATTRIB(...) __VA_ARGS__ + +#ifdef QCC_SUPPORT_CLASS + +#warning "QCC_SUPPORT_CLASS not implemented" + +#define CLASS_1(name) CLASS_2(name, entity) +#define CLASS_2(name, base) class name : base { + +#define INIT(class) void class::class() +#define CONSTRUCTOR(class, ...) void class::class(__VA_ARGS__) +#define DESTRUCTOR(class) class::~class() + +#define SUPER(class) super + +#define ATTRIB_3(class, name, T) T name +#define ATTRIB_4(class, name, T, val) ATTRIB_3(class, name, T) = val +#define STATIC_ATTRIB(class, name, T, val) static T name = val + +#define ATTRIB_STRZONE(class, name, T, val) T name = val +#define STATIC_ATTRIB_STRZONE(class, name, T, val) static T name = val + +#define ATTRIBARRAY(class, name, T, val) T name[val] + +#define METHOD(class, name, prototype) virtual void class::name() +#define STATIC_METHOD(class, name, prototype) static void class::name() + +#define ENDCLASS(class) }; + +#else + +#define CLASS_1(cname) CLASS_2(cname, ) +#define CLASS_2(cname, base) \ + entityclass(cname, base); \ + classfield(cname).bool instanceOf##cname; \ + DEBUG_STUFF(cname) \ + VTBL(cname, base) \ + _INIT_STATIC(cname) \ + { \ + if (cname##_vtbl && !this.transmute) \ + { \ + copyentity(cname##_vtbl, this); \ + return; \ + } \ + spawn##base##_static(this); \ + this.instanceOf##cname = true; \ + } \ + INIT(cname) \ + { \ + /* Only statically initialize the current class, it contains everything it inherits */ \ + if (cname##_vtbl.vtblname == this.classname) \ + { \ + spawn##cname##_static(this); \ + this.transmute = false; \ + this.classname = #cname; \ + this.vtblname = string_null; \ + this.vtblbase = cname##_vtbl; \ + } \ + spawn##base##_1(this); \ + } + +#define INIT(cname) \ + ACCUMULATE cname spawn##cname##_1(cname this) + +#define CONSTRUCTOR(cname, ...) \ + cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) \ + { \ + return = this; \ + } \ + ACCUMULATE cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) + +#define DESTRUCTOR(cname) \ + STATIC_METHOD(cname, dtorimpl, void(cname this)); \ + METHOD(cname, dtor, void(cname this)) \ + { \ + METHOD_REFERENCE(cname, dtorimpl)(this); \ + this.instanceOf##cname = false; \ + entity super = SUPER(cname); \ + if (super != cname##_vtbl) super.dtor(this); \ + } \ + STATIC_METHOD(cname, dtorimpl, void(cname this)) + +#define SUPER(cname) (cname##_vtbl.vtblbase) + +#define ATTRIB_3(cname, name, type) classfield(cname) .type name +#define ATTRIB_4(cname, name, type, val) \ + ATTRIB_3(cname, name, type); \ + INIT(cname) \ + { \ + noref bool strzone; /* Error on strzone() calls. */ \ + this.name = val; \ + } \ + ATTRIB_3(cname, name, type) + +#define STATIC_ATTRIB(cname, name, type, val) \ + type cname##_##name; \ + _INIT_STATIC(cname) \ + { \ + noref bool strzone; /* Error on strzone() calls. */ \ + cname##_##name = val; \ + } + +// cleanup potentially zoned strings from base classes +#define ATTRIB_STRZONE(cname, name, type, val) \ + classfield(cname).type name; \ + INIT(cname) \ + { \ + strcpy(this.name, val); \ + } + +#define STATIC_ATTRIB_STRZONE(cname, name, type, val) \ + type cname##_##name; \ + _INIT_STATIC(cname) \ + { \ + strcpy(cname##_##name, val); \ + } + +#define ATTRIBARRAY(cname, name, type, cnt) \ + classfield(cname) .type name[cnt] + +#define METHOD(cname, name, prototype) \ + STATIC_METHOD(cname, name, prototype); \ + classfield(cname) .prototype name; \ + _INIT_STATIC(cname) \ + { \ + this.name = METHOD_REFERENCE(cname, name); \ + } \ + STATIC_METHOD(cname, name, prototype) + +#define STATIC_METHOD(cname, name, prototype) \ + prototype METHOD_REFERENCE(cname, name) + +#define ENDCLASS(cname) \ + INIT(cname) \ + { \ + return this; \ + } + +// impl .string vtblname; .entity vtblbase; @@ -168,124 +303,25 @@ STATIC_INIT(RegisterClasses) } \ ACCUMULATE_FUNCTION(RegisterClasses, cname##_vtbl_init) -#define _INIT_STATIC(cname) [[accumulate]] void spawn##cname##_static(cname this) -#define INIT(cname) [[accumulate]] cname spawn##cname##_1(cname this) +#define _INIT_STATIC(cname) ACCUMULATE void spawn##cname##_static(cname this) #if NDEBUG #define DEBUG_STUFF(cname) #else #define DEBUG_STUFF(cname) \ - bool is_##cname(entity e) { return e.instanceOf##cname; } \ - void isnt_##cname(entity e) { eprint(e); } + ERASEABLE bool is_##cname(entity e) { return e.instanceOf##cname; } \ + ERASEABLE void isnt_##cname(entity e) { eprint(e); } #endif - -#define CLASS(cname, base) \ - entityclass(cname, base); \ - class(cname).bool instanceOf##cname; \ - DEBUG_STUFF(cname) \ - VTBL(cname, base) \ - _INIT_STATIC(cname) \ - { \ - if (cname##_vtbl && !this.transmute)\ - { \ - copyentity(cname##_vtbl, this); \ - return; \ - } \ - spawn##base##_static(this); \ - this.instanceOf##cname = true; \ - } \ - INIT(cname) \ - { \ - /* Only statically initialize the current class, it contains everything it inherits */ \ - if (cname##_vtbl.vtblname == this.classname) \ - { \ - spawn##cname##_static(this); \ - this.transmute = false; \ - this.classname = #cname; \ - this.vtblname = string_null; \ - this.vtblbase = cname##_vtbl; \ - } \ - spawn##base##_1(this); \ - } - #define METHOD_REFERENCE(cname, name) \ cname##_##name -#define STATIC_METHOD(cname, name, prototype) \ - prototype METHOD_REFERENCE(cname, name) - -#define METHOD(cname, name, prototype) \ - STATIC_METHOD(cname, name, prototype); \ - class(cname) .prototype name; \ - _INIT_STATIC(cname) \ - { \ - this.name = METHOD_REFERENCE(cname, name); \ - } \ - STATIC_METHOD(cname, name, prototype) - -#define DESTRUCTOR(cname) \ - STATIC_METHOD(cname, dtorimpl, void(cname this)); \ - METHOD(cname, dtor, void(cname this)) \ - { \ - METHOD_REFERENCE(cname, dtorimpl)(this); \ - this.instanceOf##cname = false; \ - entity super = SUPER(cname); \ - if (super != cname##_vtbl) super.dtor(this); \ - } \ - STATIC_METHOD(cname, dtorimpl, void(cname this)) - -#define ATTRIB(...) EVAL_ATTRIB(OVERLOAD_(ATTRIB, __VA_ARGS__)) -#define EVAL_ATTRIB(...) __VA_ARGS__ -#define ATTRIB_3(cname, name, type) class(cname) .type name -#define ATTRIB_4(cname, name, type, val) \ - ATTRIB_3(cname, name, type); \ - INIT(cname) \ - { \ - noref bool strzone; /* Error on strzone() calls. */ \ - this.name = val; \ - } \ - ATTRIB_3(cname, name, type) - -#define STATIC_ATTRIB(cname, name, type, val) \ - type cname##_##name; \ - _INIT_STATIC(cname) \ - { \ - noref bool strzone; /* Error on strzone() calls. */ \ - cname##_##name = val; \ - } - -// cleanup potentially zoned strings from base classes - -#define ATTRIB_STRZONE(cname, name, type, val) \ - class(cname).type name; \ - INIT(cname) \ - { \ - strcpy(this.name, val); \ - } - -#define STATIC_ATTRIB_STRZONE(cname, name, type, val) \ - type cname##_##name; \ - _INIT_STATIC(cname) \ - { \ - strcpy(cname##_##name, val); \ - } - -#define ATTRIBARRAY(cname, name, type, cnt) \ - class(cname) .type name[cnt] - -#define ENDCLASS(cname) \ - INIT(cname) \ - { \ - return this; \ - } - -#define SUPER(cname) (cname##_vtbl.vtblbase) +#endif #define spawn_static(this) #define spawn_1(this) #define _vtbl NULL -CLASS(Object, ); +CLASS(Object) DESTRUCTOR(Object) { builtin_remove(this); } #define remove(this) delete(this) METHOD(Object, describe, string(Object this)) diff --git a/qcsrc/lib/registry.qh b/qcsrc/lib/registry.qh index 306a107d7..d8f18a02c 100644 --- a/qcsrc/lib/registry.qh +++ b/qcsrc/lib/registry.qh @@ -22,7 +22,7 @@ */ #define REGISTRY(id, max) \ void Register##id(); \ - [[accumulate]] void REGISTRY_DEPENDS_(id) {} \ + ACCUMULATE void REGISTRY_DEPENDS_(id) {} \ REGISTRY_BEGIN(id) {} \ REGISTRY_END(id) {} \ void _Register##id() {} \ @@ -40,11 +40,11 @@ #define REGISTRY_DEPENDS_(id) Register##id##_Depends() /** Called before initializing a registry. */ -#define REGISTRY_BEGIN(id) [[accumulate]] void REGISTRY_BEGIN_(id) { noref void() f = Register##id; } void REGISTRY_BEGIN_(id) +#define REGISTRY_BEGIN(id) ACCUMULATE void REGISTRY_BEGIN_(id) { noref void() f = Register##id; } void REGISTRY_BEGIN_(id) #define REGISTRY_BEGIN_(id) Register##id##_First() /** Called after initializing a registry. */ -#define REGISTRY_END(id) [[accumulate]] void REGISTRY_END_(id) { noref void() f = Register##id; } void REGISTRY_END_(id) +#define REGISTRY_END(id) ACCUMULATE void REGISTRY_END_(id) { noref void() f = Register##id; } void REGISTRY_END_(id) #define REGISTRY_END_(id) Register##id##_Done() REGISTRY(Registries, BITS(8)) @@ -104,7 +104,7 @@ REGISTRY(Registries, BITS(8)) REGISTRY_PUSH(registry, fld, e); \ } MACRO_END -#define REGISTER_INIT(id) [[accumulate]] void Register_##id##_init(entity this) +#define REGISTER_INIT(id) ACCUMULATE void Register_##id##_init(entity this) /** internal next pointer */ #define REGISTRY_NEXT enemy @@ -147,9 +147,9 @@ REGISTRY(Registries, BITS(8)) #define REGISTRY_HASH(id) Registry_hash_##id ERASEABLE -[[accumulate]] void Registry_check(string r, string server) { } +ACCUMULATE void Registry_check(string r, string server) { } ERASEABLE -[[accumulate]] void Registry_send_all() { } +ACCUMULATE void Registry_send_all() { } #ifdef SVQC void Registry_send(string id, string hash); diff --git a/qcsrc/lib/replicate.qh b/qcsrc/lib/replicate.qh index 3dc3cf22b..4031352fe 100644 --- a/qcsrc/lib/replicate.qh +++ b/qcsrc/lib/replicate.qh @@ -12,7 +12,7 @@ #define REPLICATE(...) EVAL_REPLICATE(OVERLOAD(REPLICATE, __VA_ARGS__)) #define EVAL_REPLICATE(...) __VA_ARGS__ - [[accumulate]] void ReplicateVars(entity this, entity store, string thisname, int i) {} + ACCUMULATE void ReplicateVars(entity this, entity store, string thisname, int i) {} #define REPLICATE_3(fld, type, var) REPLICATE_4(fld, type, var, ) #define REPLICATE_4(fld, type, var, func) REPLICATE_##type(fld, var, func) diff --git a/qcsrc/lib/self.qh b/qcsrc/lib/self.qh index 0a61cc003..4299c19cd 100644 --- a/qcsrc/lib/self.qh +++ b/qcsrc/lib/self.qh @@ -12,7 +12,7 @@ // Step 2: const self #if 1 #define self (RVALUE, self) - [[alias("self")]] entity __self; + ALIAS("self") entity __self; #define setself(s) (__self = s) #define WITHSELF(value, block) WITH(entity, __self, value, (RVALUE, block)) #endif diff --git a/qcsrc/lib/sortlist.qh b/qcsrc/lib/sortlist.qh index af4b47ab8..8c362d430 100644 --- a/qcsrc/lib/sortlist.qh +++ b/qcsrc/lib/sortlist.qh @@ -2,7 +2,7 @@ entityclass(Sort); // .float(entity,entity) sort_cmp; -class(Sort).entity chain, sort_next, sort_prev; +classfield(Sort).entity chain, sort_next, sort_prev; entity Sort_Spawn(); diff --git a/qcsrc/lib/spawnfunc.qh b/qcsrc/lib/spawnfunc.qh index e14002a6d..614f7efb1 100644 --- a/qcsrc/lib/spawnfunc.qh +++ b/qcsrc/lib/spawnfunc.qh @@ -86,7 +86,7 @@ noref bool require_spawnfunc_prefix; #define spawnfunc_1(id) spawnfunc_2(id, FIELDS_UNION) #define spawnfunc_2(id, whitelist) \ void __spawnfunc_##id(entity this); \ - [[accumulate]] void spawnfunc_##id(entity this) \ + ACCUMULATE void spawnfunc_##id(entity this) \ { \ if (!__spawnfunc_first) { \ __spawnfunc_first = true; \ diff --git a/qcsrc/lib/static.qh b/qcsrc/lib/static.qh index 6f511fcec..e0ec96b8e 100644 --- a/qcsrc/lib/static.qh +++ b/qcsrc/lib/static.qh @@ -17,7 +17,9 @@ void profile(string s) } #define _STATIC_INIT(func, where) \ - [[accumulate]] void _static_##func() { profile(#func); } \ + ACCUMULATE void _static_##func##profile() { profile(#func); } \ + ACCUMULATE_FUNCTION(where, _static_##func##profile) \ + ACCUMULATE void _static_##func(); \ ACCUMULATE_FUNCTION(where, _static_##func) \ void _static_##func() diff --git a/qcsrc/lib/stats.qh b/qcsrc/lib/stats.qh index 1100c474c..03bd34b81 100644 --- a/qcsrc/lib/stats.qh +++ b/qcsrc/lib/stats.qh @@ -53,7 +53,7 @@ int g_magic_stats_hole = 0; REGISTRY_RESERVE(Stats, m_id, STAT_##id, z); \ } \ } \ - [[accumulate]] void stats_get() \ + ACCUMULATE void stats_get() \ { \ T it = getstat_##T(STAT_##id.m_id); \ /* if (it != CAT(_STAT(id), _prev)) \ @@ -111,7 +111,7 @@ int g_magic_stats_hole = 0; REGISTRY_RESERVE(Stats, m_id, STAT_##id, z); \ } \ } \ - [[accumulate]] void stats_add() \ + ACCUMULATE void stats_add() \ { \ .T fld = _STAT(id); \ addstat_##T(STAT_##id.m_id, fld); \ @@ -120,7 +120,7 @@ int g_magic_stats_hole = 0; /** TODO: do we want the global copy to update? */ #define REGISTER_STAT_3(id, T, expr) \ REGISTER_STAT_2(id, T); \ - [[accumulate]] void GlobalStats_update(entity this) { STAT(id, this) = (expr); } \ + ACCUMULATE void GlobalStats_update(entity this) { STAT(id, this) = (expr); } \ STATIC_INIT(worldstat_##id) { entity this = STATS; STAT(id, this) = (expr); } #else #define REGISTER_STAT_2(id, type) diff --git a/qcsrc/lib/test.qh b/qcsrc/lib/test.qh index ff6f2d23d..8d8de76ec 100644 --- a/qcsrc/lib/test.qh +++ b/qcsrc/lib/test.qh @@ -5,7 +5,7 @@ /** Use UpperCamelCase for suite and test only */ #define TEST(suite, test) \ void _TEST_##suite##_##test(); \ - [[accumulate]] int TEST_RunAll_accumulated(int f) { \ + ACCUMULATE int TEST_RunAll_accumulated(int f) { \ if (!TEST_Run(#suite "_" #test)) ++f; \ return = f; \ } \ diff --git a/qcsrc/lib/warpzone/mathlib.qc b/qcsrc/lib/warpzone/mathlib.qc index acbc1c61d..4a7c88610 100644 --- a/qcsrc/lib/warpzone/mathlib.qc +++ b/qcsrc/lib/warpzone/mathlib.qc @@ -63,11 +63,11 @@ float tanh(float e) float exp(float e) { - return (M_E ** e); + return pow(M_E, e); } float exp2(float e) { - return (2 ** e); + return pow(2, e); } float expm1(float e) { @@ -79,16 +79,16 @@ vector frexp(float e) vector v; v.z = 0; v.y = ilogb(e) + 1; - v.x = e / (2 ** v.y); + v.x = e / pow(2, v.y); return v; } int ilogb(float e) { return floor(log2(fabs(e))); } -float ldexp(float e, int e) +float ldexp(float x, int e) { - return e * (2 ** e); + return x * pow(2, e); } float logn(float e, float base) { @@ -117,12 +117,12 @@ vector modf(float f) float scalbn(float e, int n) { - return e * (2 ** n); + return e * pow(2, n); } float cbrt(float e) { - return copysign((fabs(e) ** (1.0/3.0)), e); + return copysign(pow(fabs(e), (1.0/3.0)), e); } float hypot(float e, float f) { diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 48d42da00..7499ee8dd 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -231,5 +231,5 @@ float CalcRotRegen(float current, float regenstable, float regenfactor, float re bool Spectate(entity this, entity pl); -#define SPECTATE_COPY() [[accumulate]] void SpectateCopy(entity this, entity spectatee) +#define SPECTATE_COPY() ACCUMULATE void SpectateCopy(entity this, entity spectatee) #define SPECTATE_COPYFIELD(fld) SPECTATE_COPY() { this.(fld) = spectatee.(fld); } diff --git a/qcsrc/server/g_models.qc b/qcsrc/server/g_models.qc index 1026e3aa7..c8f85247c 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/server/g_models.qc @@ -8,11 +8,11 @@ #include "../common/triggers/triggers.qh" entityclass(BGMScript); -class(BGMScript) .string bgmscript; -class(BGMScript) .float bgmscriptattack; -class(BGMScript) .float bgmscriptdecay; -class(BGMScript) .float bgmscriptsustain; -class(BGMScript) .float bgmscriptrelease; +classfield(BGMScript) .string bgmscript; +classfield(BGMScript) .float bgmscriptattack; +classfield(BGMScript) .float bgmscriptdecay; +classfield(BGMScript) .float bgmscriptsustain; +classfield(BGMScript) .float bgmscriptrelease; #include "../common/constants.qh" #include "../lib/csqcmodel/sv_model.qh"