Mirror Textures

Discuss programming in the QuakeC language.
Post Reply
Rikku2000
Posts: 49
Joined: Wed Oct 20, 2010 6:33 pm
Location: Germany
Contact:

Mirror Textures

Post by Rikku2000 »

Hey guys i want add some Mirror Textures in my Quake Engine so i have a look into the gl_rmisc.c and add some code:

Code: Select all

		if (Q_strncmp(cl.worldmodel->textures[i]->name,"window02_1",10))
			mirrortexturenum = i;
		else if (Q_strncmp(cl.worldmodel->textures[i]->name,"window01_1",10))
			mirrortexturenum = i;
		else if (Q_strncmp(cl.worldmodel->textures[i]->name,"window01_2",10))
			mirrortexturenum = i;
		else if (Q_strncmp(cl.worldmodel->textures[i]->name,"window01_3",10))
			mirrortexturenum = i;
		else if (Q_strncmp(cl.worldmodel->textures[i]->name,"window01_4",10))
			mirrortexturenum = i;
		else if (Q_strncmp(cl.worldmodel->textures[i]->name,"star_lava1_fbr",10))
			mirrortexturenum = i;
		else if (Q_strncmp(cl.worldmodel->textures[i]->name,"star_lava2_fbr",10))
			mirrortexturenum = i;
		else if (Q_strncmp(cl.worldmodel->textures[i]->name,"star_slime1",10))
			mirrortexturenum = i;
		else if (Q_strncmp(cl.worldmodel->textures[i]->name,"star_slime2",10))
			mirrortexturenum = i;
		/* else if (Q_strncmp(cl.worldmodel->textures[i]->name,"star_teleport",10))
			mirrortexturenum = i; */
		else if (Q_strncmp(cl.worldmodel->textures[i]->name,"star_water0",10))
			mirrortexturenum = i;
		else if (Q_strncmp(cl.worldmodel->textures[i]->name,"star_water1",10))
			mirrortexturenum = i;
		else if (Q_strncmp(cl.worldmodel->textures[i]->name,"star_water2",10))
			mirrortexturenum = i;
But it dont work can anyone help me, thanks.
I am sorry for my English...
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Post by ceriux »

i'm not sure if this goes in qc.
Rikku2000
Posts: 49
Joined: Wed Oct 20, 2010 6:33 pm
Location: Germany
Contact:

Post by Rikku2000 »

hmm i dont know... but the if i use without all the else ifs i can mirrow the texture
I am sorry for my English...
behind_you
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Post by behind_you »

OSAMA BIN LADEN IS DEAD!!!!!!!!!!!!!!!



ahem............. sorry for that outburst.

1- this doesnt belong in the qc category, as ceriux said

2 - try bracing your code (ie the {} stuff). it gets code to work for me sometimes.

ps if u r using dp it wont work. mirroralpha in dp is broken last i checked.....
Rikku2000
Posts: 49
Joined: Wed Oct 20, 2010 6:33 pm
Location: Germany
Contact:

Post by Rikku2000 »

i will try, thanks.

PS: i use my own Quake engine for handheld devices.
I am sorry for my English...
behind_you
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Post by behind_you »

Rikku2000 wrote: PS: i use my own Quake engine for handheld devices.

ooohhh :o what devices specifically? it must be really troublesome. i tried quake on my nokia 5230 and it was real sluggish.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

the number on the right is the length of the string. any texture names longer than 10 chars will match regardless of either the texture name or whatever you're trying to match against.

also, you only have one mirrortexturenum. only one such texture will ever be a mirror on any individual map - whichever is the last texture found in the bsp. all the others will draw as normal.
also, make sure you have r_mirroralpha set to something less than 1.
Sajt
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Post by Sajt »

Also you should probably add a not before the Q_strncmp calls (!Q_strncmp).
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Rikku2000
Posts: 49
Joined: Wed Oct 20, 2010 6:33 pm
Location: Germany
Contact:

Post by Rikku2000 »

if (Q_strncmp(cl.worldmodel->textures->name,"window02_1",10)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures->name,"window01_1",10)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures->name,"window01_2",10)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures->name,"window01_3",10)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures->name,"window01_4",10)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures->name,"star_lava1_fbr",14)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures->name,"star_lava2_fbr",14)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures->name,"star_slime1",11)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures->name,"star_slime2",11)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures->name,"star_teleport",13)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures[i]->name,"star_water0",11)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures[i]->name,"star_water1",11)) {
mirrortexturenum = i;
} else if (Q_strncmp(cl.worldmodel->textures[i]->name,"star_water2",11)) {
mirrortexturenum = i;
}

so thats right? my Quake engine is for GP2X WIZ and Caanoo thats openhandheld device.
I am sorry for my English...
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

read what sajt said
Post Reply