KevinGPO
2006-02-03 13:12:22 UTC
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.
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.