shithub: qk1

Download patch

ref: ddf01bc8098c22a4342abdcdedb0307bef89a86f
parent: 8a8dbdd2c19281aa8d06739216281855065197dc
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Mon Dec 4 15:14:30 EST 2023

allow nil sky texture: don't draw any

--- a/d_sky.c
+++ b/d_sky.c
@@ -43,6 +43,9 @@
 	fixed16_t s[2], t[2], snext[2], tnext[2], sstep[2], tstep[2];
 	float skydist;
 
+	if(r_skysource[0] == nil || r_skysource[1] == nil)
+		return;
+
 	sstep[0] = sstep[1] = 0;	// keep compiler happy
 	tstep[0] = tstep[1] = 0;	// ditto
 	skydist = skytime*skyspeed;	// TODO: add D_SetupFrame & set this there
--- a/model_bsp30.c
+++ b/model_bsp30.c
@@ -173,7 +173,7 @@
 				Con_Printf("missing texture: %s\n", tx->name);
 		}
 		if(strncmp(tx->name, "sky", 3) == 0)
-			R_InitSky(tx);
+			R_InitSky(nil); /* FIXME(sigrid): skybox */
 		else if(tx->name[0] == '{'){
 			for(j = 0; j < pixels; j++){
 				if((tx->data[j] & 0xffffff) == 0x0000ff)
--- a/r_sky.c
+++ b/r_sky.c
@@ -21,7 +21,12 @@
 	int x, y, w, n;
 	pixel_t *src;
 
-	src = (pixel_t*)((byte *)mt + mt->offsets[0]);
+	if(mt == nil){
+		r_skysource[0] = r_skysource[1] = nil;
+		return;
+	}
+
+	src = mt->data + mt->offsets[0];
 	w = mt->width;
 	skyh = mt->height;
 	if(w == skyh){ // probably without a mask?