drawing a hud radar

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
blender81
Posts: 49
Joined: Fri Feb 20, 2004 6:13 pm
Contact:

Post by blender81 »

enjay: thanks for the heads-up, I didn't know about that distance glitch. I'm guessing the problem might lie with a sqrt error earlier pointed out in this thread; still haven't looked at it yet.

And yes, the code definitely can be tidier!
Linguica
Posts: 50
Joined: Thu Nov 13, 2003 6:00 pm

Post by Linguica »

Here is the code I hacked in for my gravgun.wad, it is extremely stupid looking but I tried to do it as fast as I could and with as little thought as possible.

Code: Select all

function int stupidcos(int angle){
	if(angle>32767){
		angle*=-1;
		angle+=65536;
	}
	return cos(angle);
}

function int stupidsin(int angle){
	if(angle>49152){
		angle*=-1;
		angle+=32768;
	}
	angle+=16384;
	return -stupidcos(angle);
}
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Post by DoomRater »

Ling, your code suggests that the sine function didn't return the correct results, but the cosine did. Maybe there's something wrong with the code for sine?

Also... a quick reminder, we need to convert the angles into binary angle measurements before we pass them to these routines, NOT RADIANS.
Linguica
Posts: 50
Joined: Thu Nov 13, 2003 6:00 pm

Post by Linguica »

DoomRater wrote:Ling, your code suggests that the sine function didn't return the correct results, but the cosine did.
It was bizarre, like half of the cos function wouldn't work and 3/4 of the range of the sin function wouldn't work, or something like that.

So I just used the half of the cos function that worked, then flipped it upside down for the other half, then shifted it over by pi/2 for the sin function.
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Post by DoomRater »

I think someone should print out test data of the sine function and the cosine functions and compare it to the real answers, then submit it to Randy or something. This really is holding back some cool tools.
User avatar
Your Name Is
Posts: 802
Joined: Sun Oct 31, 2004 5:06 pm
Location: Raleigh, NC
Contact:

Post by Your Name Is »

I am so sorry, but I have not figured out any improvements yet. I am still sorting out the script code.
Cptschrodinger
Posts: 380
Joined: Thu Oct 21, 2004 5:27 pm

Post by Cptschrodinger »

Just whats in that package anyway? Pie?
blender81
Posts: 49
Joined: Fri Feb 20, 2004 6:13 pm
Contact:

Post by blender81 »

sniper joe:
The wad package contains a first pass at making a compass/radar hud display with a hint of lemon meringue. If anyone can improve the recipe feel free to share.

Image

My intention for doing this is to accomodate giant maps, a la Operation Flashpoint or Far Cry. I thought it would be neat to simply give the player an objective at the far end of a map, tell the player "there's a taco stand three miles away, go blow it up", and let the map play itself out.

Another idea bounced around these forums are the on-screen objective markers (ie halo) that directly draw an overlay on your viewpoint. This would be fantastic, but I don't know of any ACS provisions that would make this possible (some sort of thing coordinate -> screen coordinate conversion). I suppose you could do some really fancy coding with the player angle & objective distance & FOV, but that sounds fairly headache-inducing.

This is further going off on a tangent, but this floating overlay draw could also be applied to a crosshair system similar to the Smartgun in the Aliens vs Predator games. It would be pretty cool to have some uber handcannon that automatically tracks monsters, its crosshair locking on and turning green when it has a successful lock.
Cptschrodinger
Posts: 380
Joined: Thu Oct 21, 2004 5:27 pm

Post by Cptschrodinger »

*Eating box* What? It's a wad? *notices the pagage has glass in it* ACK! Glass in gums!! AAAAUUUUGGGG!!!!!! *Falls over* My mouths a river of blood!!! *Passes out*
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Post by Xaser »

"ACK! GLAFF IN TEEFH!"

Heh, this radar thing looks incredibly awesome! I didn't even know something like this was possible in Zdoom... heh. :P
Cptschrodinger
Posts: 380
Joined: Thu Oct 21, 2004 5:27 pm

Post by Cptschrodinger »

With my last breath I curse Xaser!!! *Dies*
User avatar
Grubber
Posts: 1031
Joined: Wed Oct 15, 2003 12:19 am
Location: Czech Republic
Contact:

Post by Grubber »

My contribution:
User avatar
Nmn
Posts: 4631
Joined: Fri Apr 16, 2004 1:41 pm
Preferred Pronouns: He/Him
Contact:

Post by Nmn »

^ PRAISE :rock: :rock: :rock:
User avatar
Your Name Is
Posts: 802
Joined: Sun Oct 31, 2004 5:06 pm
Location: Raleigh, NC
Contact:

Post by Your Name Is »

Holy jesus thank you Grubber!
User avatar
jallamann
Posts: 2271
Joined: Mon May 24, 2004 8:25 am
Location: Ålesund, Norway
Contact:

Post by jallamann »

:surprise:
Locked

Return to “Editing (Archive)”