🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.games.duke3d
2 messages
2 total messages Started by KevinGPO Fri, 03 Feb 2006 13:12
QUERY: programming duke graphics help...woes :S
#78620
Author: KevinGPO
Date: Fri, 03 Feb 2006 13:12
32 lines
2417 bytes
I just programming Duke Nukem 3D source code and trying to understand
the drawing graphics routines. In the (game folder) game.c: main()
function somewhere halfway down there's displayrooms() and
displayrest(). I understand displayrooms() handles the 3D rendering,
while displayrest() handles map-mode, first-person weapon-holding hand,
& status bar.

What I want to do is program to display the actual sprites of all map
objects during map-view-mode.

In displayrest() function definition calls drawmapview() for colored
map, and drawoverheadmap() for the wire-frame map.

In file menues.c: drawoverheadmap() function there's a call to
rotatesprite() to draw the colorful duke sprite in the middle of the
screen. How can we use the same function to draw the other map sprites
at their correct locations in map-view-mode?



Other queries:
1. What is significant with show2dsector[i>>3]&(1<<(i&7)) ? I see this
pattern all over the place to test/decide whether to show a map object
or not. However I do not understand why bit-shift to the right 3
places, and bitmask AND on 7, then bit-shift to left by 1 place?

2. What is significant with calling the sintable[(spr->ang)&2047] with
2047 all the time?



Anyone's help most appreciated.
Re: QUERY: programming duke graphics help...woes :S
#78621
Author: Tom Breton
Date: Fri, 10 Feb 2006 00:37
29 lines
1873 bytes
In article <1138972342.009774.60130@g44g2000cwa.googlegroups.com>,
KevinGPO <kevingpo@hotmail.com> wrote:
>I just programming Duke Nukem 3D source code and trying to understand
>the drawing graphics routines. In the (game folder) game.c: main()

Haven't looked at them carefully enough to answer you.

[...]
>Other queries:
>1. What is significant with show2dsector[i>>3]&(1<<(i&7)) ? I see this
>pattern all over the place to test/decide whether to show a map object
>or not. However I do not understand why bit-shift to the right 3
>places, and bitmask AND on 7, then bit-shift to left by 1 place?

I'm answering on the fly, so please excuse any misformatting.

He's using the lower 3 bits of "i" to select a bit in the rest of i.  

>
>2. What is significant with calling the sintable[(spr->ang)&2047] with
>2047 all the time?
>

It masks out unwanted bits that are too high, thus it prevents the table from being accessed with too-large indexes by accident.  


HTH.

Tom, the calm-eyed visionary
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads