drawing a hud radar
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.
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.
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);
}
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.DoomRater wrote:Ling, your code suggests that the sine function didn't return the correct results, but the cosine did.
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.
- Your Name Is
- Posts: 802
- Joined: Sun Oct 31, 2004 5:06 pm
- Location: Raleigh, NC
- Contact:
-
- Posts: 380
- Joined: Thu Oct 21, 2004 5:27 pm
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.

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.
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.

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.
-
- Posts: 380
- Joined: Thu Oct 21, 2004 5:27 pm
-
- Posts: 380
- Joined: Thu Oct 21, 2004 5:27 pm
- Your Name Is
- Posts: 802
- Joined: Sun Oct 31, 2004 5:06 pm
- Location: Raleigh, NC
- Contact: