ref: 27b3dc0c599e4923b7dc81bc5a413e5fa407c669
parent: f53460241b611845164bc681092ac29a78c02a59
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Wed Nov 1 06:58:11 EDT 2023
.alpha: part 5 - fix missing alpha-blended surfaces (when entity alone has .alpha set) Also rewrite entdrawflags as a function to make it look less ugly.
--- a/r_draw.c
+++ b/r_draw.c
@@ -49,7 +49,6 @@
qboolean r_lastvertvalid;
-
int
surfdrawflags(int flags)
{
@@ -61,6 +60,20 @@
return 0;
}
+int
+entdrawflags(entity_t *e)
+{
+ if(e != nil){
+ if(e->effects & EF_NODRAW)
+ return DRAW_NO;
+ if(!defalpha(e->alpha))
+ return DRAW_BLEND;
+ if(e->model != nil && e->model != cl.worldmodel && e->model->blend)
+ return DRAW_BLEND;
+ }
+ return 0;
+}
+
/*
================
R_EmitEdge
@@ -381,7 +394,7 @@
medge_t *pedges, tedge;
clipplane_t *pclip;
- if(surfdrawflags(fa->flags) ^ r_drawflags)
+ if((surfdrawflags(fa->flags) | entdrawflags(currententity)) ^ r_drawflags)
return;
// skip out if no more surfs
--- a/r_local.h
+++ b/r_local.h
@@ -4,12 +4,12 @@
enum {
DRAW_BLEND = 1<<0,
+ DRAW_NO = 1<<1,
};
int surfdrawflags(int flags);
+int entdrawflags(entity_t *e);
#define enthasalpha(e) ((e) && !defalpha((e)->alpha))
-#define entdrawflags(e) (((e) && (!defalpha((e)->alpha) || ((e)->model && (e)->model != cl.worldmodel && (e)->model->blend))) ? DRAW_BLEND : 0)
-
#define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0)
// normalizing factor so player model works out to about