X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fview.qc;h=47cf9337d9a98e3375aa3dae1e0ed5f706c89f57;hp=dadb8d41d95378b78c6891caa6aeb2af93551fb6;hb=f8fd182f4c9d44790436a2e1aff424c1bdeeb6da;hpb=74cebbb48d9481bb83eccb4438283f319352cb74 diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index dadb8d41d9..47cf9337d9 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -363,6 +363,7 @@ STATIC_INIT(Porto) { entity e = new_pure(porto); e.draw = Porto_Draw; + IL_PUSH(g_drawables, e); e.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP; } @@ -447,7 +448,7 @@ vector GetCurrentFov(float fov) zoomspeed = 3.5; zoomdir = button_zoom; - if(hud == HUD_NORMAL) + if(hud == HUD_NORMAL && !spectatee_status) if(switchweapon == activeweapon) if((activeweapon == WEP_VORTEX && !WEP_CVAR(vortex, secondary)) || (activeweapon == WEP_RIFLE && !WEP_CVAR(rifle, secondary))) // do NOT use switchweapon here zoomdir += button_attack2; @@ -766,12 +767,12 @@ bool WantEventchase(entity this) return false; } -void HUD_Crosshair_Vehicle() +void HUD_Crosshair_Vehicle(entity this) { if(hud != HUD_BUMBLEBEE_GUN) { Vehicle info = Vehicles_from(hud); - info.vr_crosshair(info); + info.vr_crosshair(info, this); } } @@ -836,7 +837,7 @@ void HitSound() // todo: avoid very long and very short sounds from wave stretching using different sound files? seems unnecessary // todo: normalize sound pressure levels? seems unnecessary - sound7(world, CH_INFO, SND(HIT), VOL_BASE, ATTN_NONE, pitch_shift * 100, 0); + sound7(NULL, CH_INFO, SND(HIT), VOL_BASE, ATTN_NONE, pitch_shift * 100, 0); } unaccounted_damage = 0; hitsound_time_prev = time; @@ -846,7 +847,7 @@ void HitSound() float typehit_time = STAT(TYPEHIT_TIME); if (COMPARE_INCREASING(typehit_time, typehit_time_prev) > autocvar_cl_hitsound_antispam_time) { - sound(world, CH_INFO, SND_TYPEHIT, VOL_BASE, ATTN_NONE); + sound(NULL, CH_INFO, SND_TYPEHIT, VOL_BASE, ATTN_NONE); typehit_time_prev = typehit_time; } } @@ -860,7 +861,7 @@ vector crosshair_getcolor(entity this, float health_stat) { case 1: // crosshair_color_per_weapon { - if(this) + if(this != WEP_Null && hud == HUD_NORMAL) { wcross_color = this.wpcolor; break; @@ -942,9 +943,12 @@ void HUD_Crosshair(entity this) if (!autocvar_crosshair_enabled) // main toggle for crosshair rendering return; + if (spectatee_status > 0 && STAT(CAMERA_SPECTATOR) == 2) + return; + if (hud != HUD_NORMAL) { - HUD_Crosshair_Vehicle(); + HUD_Crosshair_Vehicle(this); return; } @@ -989,7 +993,7 @@ void HUD_Crosshair(entity this) string wcross_name = ""; float wcross_scale, wcross_blur; - entity e = this; // wtf? + entity e = WEP_Null; if(autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1)) { e = switchingweapon; @@ -1321,7 +1325,7 @@ void HUD_Draw(entity this) if(!intermission) if (MUTATOR_CALLHOOK(HUD_Draw_overlay)) { - drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, MUTATOR_ARGV(0, vector), autocvar_hud_colorflash_alpha * MUTATOR_ARGV(0, float), DRAWFLAG_ADDITIVE); + drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, M_ARGV(0, vector), autocvar_hud_colorflash_alpha * M_ARGV(1, float), DRAWFLAG_ADDITIVE); } else if(STAT(FROZEN)) { @@ -1346,7 +1350,6 @@ void HUD_Draw(entity this) Accuracy_LoadLevels(); HUD_Main(); - HUD_DrawScoreboard(); HUD_Scale_Disable(); } @@ -1369,9 +1372,8 @@ float prev_myteam; int lasthud; float vh_notice_time; void WaypointSprite_Load(); -void CSQC_UpdateView(float w, float h) +void CSQC_UpdateView(entity this, float w, float h) { - SELFPARAM(); TC(int, w); TC(int, h); entity e; float fov; @@ -1460,9 +1462,28 @@ void CSQC_UpdateView(float w, float h) // event chase camera if(autocvar_chase_active <= 0) // greater than 0 means it's enabled manually, and this code is skipped { + if(STAT(CAMERA_SPECTATOR)) + { + if(spectatee_status > 0) + { + if(!autocvar_chase_active) + { + cvar_set("chase_active", "-2"); + goto skip_eventchase_death; + } + } + else if(autocvar_chase_active == -2) + cvar_set("chase_active", "0"); + + if(autocvar_chase_active == -2) + goto skip_eventchase_death; + } + else if(autocvar_chase_active == -2) + cvar_set("chase_active", "0"); + float vehicle_chase = (hud != HUD_NORMAL && (autocvar_cl_eventchase_vehicle || spectatee_status > 0)); float ons_roundlost = (gametype == MAPINFO_TYPE_ONSLAUGHT && STAT(ROUNDLOST)); - entity gen = world; + entity gen = NULL; float vehicle_viewdist = 0; vector vehicle_viewofs = '0 0 0'; @@ -1570,6 +1591,8 @@ void CSQC_UpdateView(float w, float h) eventchase_current_distance = 0; } + LABEL(skip_eventchase_death); + // do lockview after event chase camera so that it still applies whenever necessary. if(autocvar_cl_lockview || (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1 || QuickMenu_IsOpened()))) { @@ -1848,7 +1871,7 @@ void CSQC_UpdateView(float w, float h) mousepos = mousepos*0.5 + getmousepos(); */ - FOREACH_ENTITY(it.draw, it.draw(it)); + IL_EACH(g_drawables, it.draw, it.draw(it)); addentities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS); renderscene(); @@ -2178,13 +2201,13 @@ void CSQC_UpdateView(float w, float h) } else */ // draw 2D entities - FOREACH_ENTITY(it.draw2d, it.draw2d(it)); + IL_EACH(g_drawables_2d, it.draw2d, it.draw2d(it)); Draw_ShowNames_All(); Debug_Draw(); scoreboard_active = HUD_WouldDrawScoreboard(); - HUD_Draw(this); + HUD_Draw(this); // this parameter for deep vehicle function if(NextFrameCommand) { @@ -2235,6 +2258,8 @@ void CSQC_UpdateView(float w, float h) // let's reset the view back to normal for the end setproperty(VF_MIN, '0 0 0'); setproperty(VF_SIZE, '1 0 0' * w + '0 1 0' * h); + + IL_ENDFRAME(); }