From 014ee9ee758fe7a5d0062f2a5f3186cd7c7f2326 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 26 Apr 2015 17:32:03 +1000 Subject: [PATCH] Define client entity classes --- qcsrc/client/bgmscript.qc | 12 ++++++------ qcsrc/client/bgmscript.qh | 13 +++++++------ qcsrc/client/casings.qc | 4 ++-- qcsrc/client/hook.qc | 13 +++++++------ qcsrc/client/hud.qh | 27 +++++++++++++------------- qcsrc/client/laser.qc | 17 ++++++++-------- qcsrc/client/modeleffects.qh | 9 +++++---- qcsrc/client/noise.qc | 12 +++++++----- qcsrc/client/particles.qh | 23 +++++++++++----------- qcsrc/client/player_skeleton.qc | 8 ++++---- qcsrc/client/player_skeleton.qh | 11 ++++++----- qcsrc/client/rubble.qh | 3 ++- qcsrc/client/shownames.qh | 11 ++++++----- qcsrc/client/sortlist.qh | 3 ++- qcsrc/client/target_music.qh | 5 +++-- qcsrc/client/teamradar.qh | 9 +++++---- qcsrc/client/tturrets.qc | 2 +- qcsrc/client/tturrets.qh | 3 ++- qcsrc/client/tuba.qc | 10 +++++----- qcsrc/client/tuba.qh | 3 +++ qcsrc/client/vehicles/vehicles.qc | 9 +++++---- qcsrc/client/wall.qh | 11 ++++++----- qcsrc/client/waypointsprites.qh | 31 +++++++++++++++--------------- qcsrc/client/weapons/projectile.qh | 29 ++++++++++++++-------------- qcsrc/common/util-pre.qh | 4 ++-- 25 files changed, 152 insertions(+), 130 deletions(-) diff --git a/qcsrc/client/bgmscript.qc b/qcsrc/client/bgmscript.qc index b567190ca..7bc3b9b1a 100644 --- a/qcsrc/client/bgmscript.qc +++ b/qcsrc/client/bgmscript.qc @@ -15,12 +15,12 @@ float bgmscriptbuf; float bgmscriptbufsize; float bgmscriptbufloaded; -.float bgmscriptline; -.float bgmscriptline0; -.float bgmscriptvolume; -.float bgmscripttime; -.float bgmscriptstate; -.float bgmscriptstatetime; +class(BGMScript) .float bgmscriptline; +class(BGMScript) .float bgmscriptline0; +class(BGMScript) .float bgmscriptvolume; +class(BGMScript) .float bgmscripttime; +class(BGMScript) .float bgmscriptstate; +class(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 910ef6b5d..f88105ba0 100644 --- a/qcsrc/client/bgmscript.qh +++ b/qcsrc/client/bgmscript.qh @@ -1,13 +1,14 @@ #ifndef BGMSCRIPT_H #define BGMSCRIPT_H -.string bgmscript; -.float bgmscriptattack; -.float bgmscriptdecay; -.float bgmscriptsustain; -.float bgmscriptrelease; +entityclass(BGMScript) +class(BGMScript) .string bgmscript; +class(BGMScript) .float bgmscriptattack; +class(BGMScript) .float bgmscriptdecay; +class(BGMScript) .float bgmscriptsustain; +class(BGMScript) .float bgmscriptrelease; -.float just_toggled; +class(BGMScript) .float just_toggled; void BGMScript_InitEntity(entity e); float BGMScript(entity e); diff --git a/qcsrc/client/casings.qc b/qcsrc/client/casings.qc index 6068a799f..8112afb53 100644 --- a/qcsrc/client/casings.qc +++ b/qcsrc/client/casings.qc @@ -10,8 +10,8 @@ #elif defined(SVQC) #endif - -.bool silent; +entityclass(Casing) +class(Casing) .bool silent; void Casing_Delete() { diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index 8436ff622..cfc192c84 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -2,11 +2,12 @@ #include "noise.qh" #include "../warpzonelib/common.qh" -.float HookType; // ENT_CLIENT_* -.vector origin; -.vector velocity; -.float HookSilent; -.float HookRange; +entityclass(Hook) +class(Hook) .float HookType; // ENT_CLIENT_* +class(Hook) .vector origin; +class(Hook) .vector velocity; +class(Hook) .float HookSilent; +class(Hook) .float HookRange; void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg) { @@ -49,7 +50,7 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end) Draw_GrapplingHook_trace_callback_rnd += 0.25 * vlen(hit - start) / 8; } -.float teleport_time; +class(Hook) .float teleport_time; void Draw_GrapplingHook() { vector a, b, atrans; diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 16a7645fd..acff23a28 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -69,18 +69,19 @@ vector panel_size_backup; vector panel_size_copied; entity panel; -.string panel_name; -.int panel_id; -.vector current_panel_pos; -.vector current_panel_size; -.string current_panel_bg; -.float current_panel_bg_alpha; -.float current_panel_bg_border; -.vector current_panel_bg_color; -.float current_panel_bg_color_team; -.float current_panel_bg_padding; -.float current_panel_fg_alpha; -.float update_time; +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; float panel_enabled; vector panel_pos; vector panel_size; @@ -97,7 +98,7 @@ string panel_bg_border_str; float panel_bg_padding; string panel_bg_padding_str; -.void() panel_draw; +class(HUDPanel) .void() panel_draw; float current_player; diff --git a/qcsrc/client/laser.qc b/qcsrc/client/laser.qc index a74c6683a..5796157ef 100644 --- a/qcsrc/client/laser.qc +++ b/qcsrc/client/laser.qc @@ -12,14 +12,15 @@ // a laser goes from origin in direction angles // it has color 'colormod' // and stops when something is in the way -.int cnt; // end effect -.vector colormod; -.int state; // on-off -.int count; // flags for the laser -.vector velocity; -.float alpha; -.float scale; // scaling factor of the thickness -.float modelscale; // scaling factor of the dlight +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 void Draw_Laser() { diff --git a/qcsrc/client/modeleffects.qh b/qcsrc/client/modeleffects.qh index f40cfef55..a82d26400 100644 --- a/qcsrc/client/modeleffects.qh +++ b/qcsrc/client/modeleffects.qh @@ -1,10 +1,11 @@ #ifndef MODELEFFECTS_H #define MODELEFFECTS_H -.float frame1time; -.float lifetime, fadetime; -.float teleport_time; -.float scale1, scale2; +entityclass(ModelEffect) +class(ModelEffect) .float frame1time; +class(ModelEffect) .float lifetime, fadetime; +class(ModelEffect) .float teleport_time; +class(ModelEffect) .float scale1, scale2; void ModelEffect_Draw(); diff --git a/qcsrc/client/noise.qc b/qcsrc/client/noise.qc index 5635f3f99..5b64d6873 100644 --- a/qcsrc/client/noise.qc +++ b/qcsrc/client/noise.qc @@ -5,11 +5,13 @@ #elif defined(SVQC) #endif -.float noise_baccum; -.float noise_paccum; -.float noise_paccum2; -.float noise_paccum3; -.float noise_bstate; +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; + float Noise_Brown(entity e, float dt) { e.noise_baccum += random() * sqrt(dt); // same stddev for all dt diff --git a/qcsrc/client/particles.qh b/qcsrc/client/particles.qh index 12c999ba2..9016f8b1f 100644 --- a/qcsrc/client/particles.qh +++ b/qcsrc/client/particles.qh @@ -3,16 +3,17 @@ .int dphitcontentsmask; -.int cnt; // effect number -.vector velocity; // particle velocity -.float waterlevel; // direction jitter -.int count; // count multiplier -.int impulse; // density -.string noise; // sound -.float atten; -.float volume; -.float absolute; // 1 = count per second is absolute, 2 = only spawn at toggle -.vector movedir; // trace direction +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 void Draw_PointParticles(); @@ -20,7 +21,7 @@ void Ent_PointParticles_Remove(); void Ent_PointParticles(); -.float glow_color; // palette index +class(PointParticles) .float glow_color; // palette index void Draw_Rain(); diff --git a/qcsrc/client/player_skeleton.qc b/qcsrc/client/player_skeleton.qc index 0a9ac8cac..e1d85b3dd 100644 --- a/qcsrc/client/player_skeleton.qc +++ b/qcsrc/client/player_skeleton.qc @@ -2,13 +2,13 @@ #include "../warpzonelib/anglestransform.qh" -.float skeleton_info_modelindex; -.float skeleton_info_skin; +class(Skeleton) .float skeleton_info_modelindex; +class(Skeleton) .float skeleton_info_skin; const int BONETYPE_LOWER = 0; const int BONETYPE_UPPER = 1; const int MAX_BONES = 128; -.float skeleton_bonetype[MAX_BONES]; -.float skeleton_numbones; +class(Skeleton) .float skeleton_bonetype[MAX_BONES]; +class(Skeleton) .float skeleton_numbones; void skeleton_loadinfo(entity e) { diff --git a/qcsrc/client/player_skeleton.qh b/qcsrc/client/player_skeleton.qh index 6c95ce231..4f80c71d8 100644 --- a/qcsrc/client/player_skeleton.qh +++ b/qcsrc/client/player_skeleton.qh @@ -5,9 +5,10 @@ void free_skeleton_from_frames(entity e); void skeleton_from_frames(entity e, float is_dead); void skeleton_loadinfo(entity e); -.float bone_upperbody; -.int bone_weapon; -.float bone_aim[MAX_AIM_BONES]; -.float bone_aimweight[MAX_AIM_BONES]; -.float fixbone; +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; #endif diff --git a/qcsrc/client/rubble.qh b/qcsrc/client/rubble.qh index 5ff1b5577..f963d5f37 100644 --- a/qcsrc/client/rubble.qh +++ b/qcsrc/client/rubble.qh @@ -1,6 +1,7 @@ #ifndef RUBBLE_H #define RUBBLE_H -.float creationtime; +entityclass(Rubble) +class(Rubble) .float creationtime; void RubbleLimit(string cname, float limit, void() deleteproc); entity RubbleNew(string cname); #endif diff --git a/qcsrc/client/shownames.qh b/qcsrc/client/shownames.qh index f196f8f83..4d4478ca1 100644 --- a/qcsrc/client/shownames.qh +++ b/qcsrc/client/shownames.qh @@ -1,9 +1,10 @@ #ifndef SHOWNAMES_H #define SHOWNAMES_H -.float healthvalue; -.float armorvalue; -.float sameteam; -.float fadedelay; -.float pointtime; +entityclass(ShowNames) +class(ShowNames) .float healthvalue; +class(ShowNames) .float armorvalue; +class(ShowNames) .float sameteam; +class(ShowNames) .float fadedelay; +class(ShowNames) .float pointtime; #endif diff --git a/qcsrc/client/sortlist.qh b/qcsrc/client/sortlist.qh index 1b8428713..484787821 100644 --- a/qcsrc/client/sortlist.qh +++ b/qcsrc/client/sortlist.qh @@ -1,8 +1,9 @@ #ifndef SORTLIST_H #define SORTLIST_H +entityclass(Sort) //.float(entity,entity) sort_cmp; -.entity sort_next, sort_prev; +class(Sort) .entity sort_next, sort_prev; entity Sort_Spawn(); diff --git a/qcsrc/client/target_music.qh b/qcsrc/client/target_music.qh index c685214be..77aa627db 100644 --- a/qcsrc/client/target_music.qh +++ b/qcsrc/client/target_music.qh @@ -7,8 +7,9 @@ entity music_target; entity music_trigger; // FIXME also control bgmvolume here, to not require a target_music for the default track. -.int state; -.float lastvol; +entityclass(TargetMusic) +class(TargetMusic) .int state; +class(TargetMusic) .float lastvol; void TargetMusic_Advance(); diff --git a/qcsrc/client/teamradar.qh b/qcsrc/client/teamradar.qh index 31defc8ef..242d7ae7d 100644 --- a/qcsrc/client/teamradar.qh +++ b/qcsrc/client/teamradar.qh @@ -3,11 +3,12 @@ const int MAX_TEAMRADAR_TIMES = 32; +entityclass(TeamRadar) // to make entities have dots on the team radar -.float teamradar_icon; -.float teamradar_times[MAX_TEAMRADAR_TIMES]; -.int teamradar_time_index; -.vector teamradar_color; +class(TeamRadar) .float teamradar_icon; +class(TeamRadar) .float teamradar_times[MAX_TEAMRADAR_TIMES]; +class(TeamRadar) .int teamradar_time_index; +class(TeamRadar) .vector teamradar_color; float teamradar_angle; // player yaw angle vector teamradar_origin3d_in_texcoord; // player origin diff --git a/qcsrc/client/tturrets.qc b/qcsrc/client/tturrets.qc index 24506bef0..42366687e 100644 --- a/qcsrc/client/tturrets.qc +++ b/qcsrc/client/tturrets.qc @@ -162,7 +162,7 @@ void turret_remove() self.tur_head = world; } -.vector glowmod; +class(Turret) .vector glowmod; void turret_changeteam() { switch(self.team - 1) diff --git a/qcsrc/client/tturrets.qh b/qcsrc/client/tturrets.qh index 6316d795b..ab651e2fa 100644 --- a/qcsrc/client/tturrets.qh +++ b/qcsrc/client/tturrets.qh @@ -5,5 +5,6 @@ void ent_turret(); void turrets_precache(); -.entity tur_head; +entityclass(Turret) +class(Turret) .entity tur_head; #endif diff --git a/qcsrc/client/tuba.qc b/qcsrc/client/tuba.qc index cd518e091..95692e87c 100644 --- a/qcsrc/client/tuba.qc +++ b/qcsrc/client/tuba.qc @@ -6,11 +6,11 @@ const int TUBA_MIN = -18; const int TUBA_MAX = 27; const int TUBA_INSTRUMENTS = 3; -.int note; -.bool tuba_attenuate; -.float tuba_volume; -.float tuba_volume_initial; -.int tuba_instrument; +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; int Tuba_PitchStep; diff --git a/qcsrc/client/tuba.qh b/qcsrc/client/tuba.qh index bdc1386ea..a04e66762 100644 --- a/qcsrc/client/tuba.qh +++ b/qcsrc/client/tuba.qh @@ -2,4 +2,7 @@ #define TUBA_H void Ent_TubaNote(bool isNew); void Tuba_Precache(); + +entityclass(Tuba) + #endif diff --git a/qcsrc/client/vehicles/vehicles.qc b/qcsrc/client/vehicles/vehicles.qc index 290385e49..0f19c9066 100644 --- a/qcsrc/client/vehicles/vehicles.qc +++ b/qcsrc/client/vehicles/vehicles.qc @@ -60,10 +60,11 @@ void CSQC_BUMBLE_GUN_HUD(); const int MAX_AXH = 4; entity AuxiliaryXhair[MAX_AXH]; -.string axh_image; -.float axh_fadetime; -.float axh_drawflag; -.float axh_scale; +entityclass(AuxiliaryXhair) +class(AuxiliaryXhair) .string axh_image; +class(AuxiliaryXhair) .float axh_fadetime; +class(AuxiliaryXhair) .float axh_drawflag; +class(AuxiliaryXhair) .float axh_scale; const string bumb_ico = "gfx/vehicles/bumb.tga"; const string bumb_lgun = "gfx/vehicles/bumb_lgun.tga"; diff --git a/qcsrc/client/wall.qh b/qcsrc/client/wall.qh index 984b54c88..3a439e6ff 100644 --- a/qcsrc/client/wall.qh +++ b/qcsrc/client/wall.qh @@ -1,11 +1,12 @@ #ifndef WALL_H #define WALL_H -.float lip; -.float bgmscriptangular; -.int lodmodelindex0, lodmodelindex1, lodmodelindex2; -.float loddistance1, loddistance2; -.vector saved; +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; void Ent_Wall_Draw(); diff --git a/qcsrc/client/waypointsprites.qh b/qcsrc/client/waypointsprites.qh index 2a2b4cb86..575cd4809 100644 --- a/qcsrc/client/waypointsprites.qh +++ b/qcsrc/client/waypointsprites.qh @@ -26,21 +26,22 @@ float waypointsprite_distancefadescale; float waypointsprite_distancefadedistance; float waypointsprite_alpha; -.float helpme; -.float rule; -.string netname; // primary picture -.string netname2; // secondary picture -.string netname3; // tertiary picture -.int team; // team that gets netname2 -.float lifetime; -.float fadetime; -.float maxdistance; -.int hideflags; -.float spawntime; -.float health; -.float build_started; -.float build_starthealth; -.float build_finished; +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; const float SPRITE_HEALTHBAR_WIDTH = 144; const float SPRITE_HEALTHBAR_HEIGHT = 9; diff --git a/qcsrc/client/weapons/projectile.qh b/qcsrc/client/weapons/projectile.qh index 3a4cdcb04..a530df988 100644 --- a/qcsrc/client/weapons/projectile.qh +++ b/qcsrc/client/weapons/projectile.qh @@ -1,20 +1,21 @@ #ifndef PROJECTILE_H #define PROJECTILE_H -.int traileffect; - -.vector iorigin1, iorigin2; -.float spawntime; -.vector trail_oldorigin; -.float trail_oldtime; -.float fade_time, fade_rate; - -.float alphamod; -.int count; // set if clientside projectile -.int cnt; // sound index -.float gravity; -.int snd_looping; -.bool silent; +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; void SUB_Stop(); diff --git a/qcsrc/common/util-pre.qh b/qcsrc/common/util-pre.qh index b3aacfa97..f10b5c5f8 100644 --- a/qcsrc/common/util-pre.qh +++ b/qcsrc/common/util-pre.qh @@ -38,11 +38,11 @@ #endif #ifndef QCC_SUPPORT_ENTITYCLASS - #define entityclass(name) typedef entity name + #define entityclass(name) /* typedef entity name; */ #define class(name) #define new(class) spawn() #else - #define entityclass(name) entityclass name {} + #define entityclass(name) entityclass name {}; #define class(name) [[class(name)]] #define new(class) ((class) spawn()) #endif -- 2.39.2