Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wolf3d
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
wolf3d
Commits
8ee7f853
Commit
8ee7f853
authored
Jun 02, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OpenGL mode advancement -- walls are seen (no textures yet)
parent
33d9dccc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
330 additions
and
14 deletions
+330
-14
GLDraw.c
macsrc/GLDraw.c
+308
-0
RefBsp.c
macsrc/RefBsp.c
+1
-1
Refresh.c
macsrc/Refresh.c
+3
-0
SoftDraw.c
macsrc/SoftDraw.c
+4
-0
TODO
macsrc/TODO
+12
-10
wolfdef.h
macsrc/wolfdef.h
+2
-3
No files found.
macsrc/GLDraw.c
View file @
8ee7f853
...
@@ -55,10 +55,318 @@ void IO_ScaleMaskedColumn(Word x,Word scale, unsigned short *sprite,Word column)
...
@@ -55,10 +55,318 @@ void IO_ScaleMaskedColumn(Word x,Word scale, unsigned short *sprite,Word column)
/* TODO: remove stuff from sprites */
/* TODO: remove stuff from sprites */
}
}
void
InitRenderView
()
{
glEnable
(
GL_DEPTH_TEST
);
glClearColor
(
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
//glFrustum(-0.286751, 0.286751, -0.288675, 0.288675, 0.200000, 182.000000);
glFrustum
(
-
0
.
20
,
0
.
20
,
-
0
.
288675
,
0
.
288675
,
0
.
200000
,
182
.
000000
);
//glFrustum(-0.1, 0.1, -0.1, 0.1, .50000, 182.000000);
}
void
StartRenderView
()
void
StartRenderView
()
{
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glMatrixMode
(
GL_MODELVIEW
);
glLoadIdentity
();
glRotatef
(
270
.
0
-
((
double
)
gamestate
.
viewangle
/
(
double
)
ANGLES
*
360
.
0
),
0
.
0
,
1
.
0
,
0
.
0
);
//glTranslatef(-(double)actors[0].x / 256.0, 0, (double)actors[0].y / 256.0);
glTranslatef
((
double
)
actors
[
0
].
x
/
256
.
0
,
0
,
(
double
)
actors
[
0
].
y
/
256
.
0
);
}
/*
=====================
=
= RenderWallRange
=
= Draw a wall segment between start and stop angles (inclusive) (short angles)
= No clipping is needed
=
======================
*/
int
WallSeen
=
0
;
void
WallIsSeen
(
saveseg_t
*
seg
)
{
{
/* mark the segment as visible for auto map*/
seg
->
dir
|=
DIR_SEENFLAG
;
/* for automap*/
areavis
[
seg
->
area
]
=
1
;
/* for sprite drawing*/
WallSeen
=
1
;
}
}
/*
===============================================================================
=
= ClipWallSegment
=
= Clips the given screenpost and includes it in newcolumn
===============================================================================
*/
/* a screenpost_t is a solid range of visangles, used to clip and detect*/
/* span exposures / hidings*/
typedef
struct
{
Word
top
,
bottom
;
}
screenpost_t
;
#define MAXSEGS 16
extern
screenpost_t
solidsegs
[
MAXSEGS
],
*
newend
;
/* newend is one past the last valid seg */
void
ClipWallSegment
(
Word
top
,
Word
bottom
,
saveseg_t
*
seg
,
Word
distance
)
{
screenpost_t
*
next
,
*
start
;
/* find the first clippost that touches the source post (adjacent pixels are touching)*/
start
=
solidsegs
;
while
(
start
->
bottom
>
top
+
1
)
{
start
++
;
}
if
(
top
>
start
->
top
)
{
if
(
bottom
>
start
->
top
+
1
)
{
/* post is entirely visible (above start), so insert a new clippost*/
WallIsSeen
(
seg
);
next
=
newend
;
newend
++
;
while
(
next
!=
start
)
{
*
next
=
*
(
next
-
1
);
next
--
;
}
next
->
top
=
top
;
next
->
bottom
=
bottom
;
return
;
}
/* there is a fragment above *start*/
WallIsSeen
(
seg
);
start
->
top
=
top
;
/* adjust the clip size*/
}
if
(
bottom
>=
start
->
bottom
)
return
;
/* bottom contained in start*/
next
=
start
;
while
(
bottom
<=
(
next
+
1
)
->
top
+
1
)
{
/* there is a fragment between two posts*/
WallIsSeen
(
seg
);
next
++
;
if
(
bottom
>=
next
->
bottom
)
{
/* bottom is contained in next*/
start
->
bottom
=
next
->
bottom
;
/* adjust the clip size*/
goto
crunch
;
}
}
/* there is a fragment after *next*/
WallIsSeen
(
seg
);
start
->
bottom
=
bottom
;
/* adjust the clip size*/
/* remove start+1 to next from the clip list, because start now covers their area*/
crunch:
if
(
next
==
start
)
{
return
;
/* post just extended past the bottom of one post*/
}
while
(
next
++
!=
newend
)
/* remove a post*/
*++
start
=
*
next
;
newend
=
start
+
1
;
}
/**********************************
Clip and draw a given wall segment
**********************************/
void
P_DrawSegx
(
saveseg_t
*
seg
);
void
P_DrawSeg
(
saveseg_t
*
seg
)
void
P_DrawSeg
(
saveseg_t
*
seg
)
{
{
Word
segplane
;
Word
door
;
door_t
*
door_p
;
unsigned
short
span
,
tspan
;
unsigned
short
angle1
,
angle2
;
int
texslide
;
int
distance
;
WallSeen
=
0
;
if
(
seg
->
dir
&
DIR_DISABLEDFLAG
)
{
/* Segment shut down? */
return
;
/* pushwall part*/
}
segplane
=
(
LongWord
)
seg
->
plane
<<
7
;
rw_mintex
=
(
LongWord
)
seg
->
min
<<
7
;
rw_maxtex
=
(
LongWord
)
seg
->
max
<<
7
;
/* adjust pushwall segs */
if
(
seg
==
pwallseg
)
{
/* Is this the active pushwall? */
if
(
seg
->
dir
&
1
)
{
/* east/west */
segplane
+=
PushWallRec
.
pwallychange
;
}
else
{
/* north/south */
segplane
+=
PushWallRec
.
pwallxchange
;
}
}
/* get texture*/
if
(
seg
->
texture
>=
129
)
{
/* segment is a door */
door
=
seg
->
texture
-
129
;
/* Which door is this? */
door_p
=
&
doors
[
door
];
rw_texture
=
&
textures
[
129
+
(
door_p
->
info
>>
1
)][
0
];
texslide
=
door_p
->
position
;
rw_mintex
+=
texslide
;
}
else
{
texslide
=
0
;
rw_texture
=
&
textures
[
seg
->
texture
][
0
];
}
switch
(
seg
->
dir
&
3
)
{
/* mask off the flags*/
case
di_north
:
distance
=
viewx
-
segplane
;
if
(
distance
<=
0
)
{
return
;
/* back side*/
}
rw_downside
=
FALSE
;
rw_midpoint
=
viewy
;
normalangle
=
2
*
FINEANGLES
/
4
;
angle1
=
PointToAngle
(
segplane
,
rw_maxtex
);
angle2
=
PointToAngle
(
segplane
,
rw_mintex
);
break
;
case
di_south
:
distance
=
segplane
-
viewx
;
if
(
distance
<=
0
)
{
return
;
/* back side*/
}
rw_downside
=
TRUE
;
rw_midpoint
=
viewy
;
normalangle
=
0
*
FINEANGLES
/
4
;
angle1
=
PointToAngle
(
segplane
,
rw_mintex
);
angle2
=
PointToAngle
(
segplane
,
rw_maxtex
);
break
;
case
di_east
:
distance
=
viewy
-
segplane
;
if
(
distance
<=
0
)
{
return
;
/* back side*/
}
rw_downside
=
TRUE
;
rw_midpoint
=
viewx
;
normalangle
=
1
*
FINEANGLES
/
4
;
angle1
=
PointToAngle
(
rw_mintex
,
segplane
);
angle2
=
PointToAngle
(
rw_maxtex
,
segplane
);
break
;
case
di_west
:
distance
=
segplane
-
viewy
;
if
(
distance
<=
0
)
{
return
;
/* back side*/
}
rw_downside
=
FALSE
;
rw_midpoint
=
viewx
;
normalangle
=
3
*
FINEANGLES
/
4
;
angle1
=
PointToAngle
(
rw_maxtex
,
segplane
);
angle2
=
PointToAngle
(
rw_mintex
,
segplane
);
break
;
}
/* clip to view edges*/
span
=
(
angle1
-
angle2
);
if
(
span
>=
0x8000
)
{
/* Test for negative (32 bit clean) */
return
;
}
angle1
-=
centershort
;
angle2
-=
centershort
;
++
angle2
;
/* make angle 2 non inclusive*/
tspan
=
angle1
+
clipshortangle
;
if
(
tspan
>
clipshortangle2
)
{
tspan
-=
clipshortangle2
;
if
(
tspan
>=
span
)
{
return
;
/* totally off the left edge*/
}
angle1
=
clipshortangle
;
}
tspan
=
clipshortangle
-
angle2
;
if
(
tspan
>
clipshortangle2
)
{
tspan
-=
clipshortangle2
;
if
(
tspan
>=
span
)
{
return
;
/* totally off the left edge*/
}
angle2
=
-
clipshortangle
;
}
/* calc center angle for texture mapping*/
rw_centerangle
=
(
centerangle
-
normalangle
)
&
FINEMASK
;
if
(
rw_centerangle
>
(
FINEANGLES
/
2
))
{
rw_centerangle
-=
FINEANGLES
;
}
rw_centerangle
+=
FINEANGLES
/
4
;
rw_midpoint
-=
texslide
;
rw_mintex
-=
texslide
;
angle1
+=
ANGLE180
;
/* adjust so angles are unsigned*/
angle2
+=
ANGLE180
;
ClipWallSegment
(
angle1
,
angle2
,
seg
,
distance
);
if
(
WallSeen
)
P_DrawSegx
(
seg
);
}
void
P_DrawSegx
(
saveseg_t
*
seg
)
{
/*
if (seg->dir & DIR_DISABLEDFLAG) {
return;
}
seg->dir |= DIR_SEENFLAG;
areavis[seg->area] = 1;
*/
switch
(
seg
->
dir
&
3
)
{
case
di_north
:
glColor4f
(
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
glBegin
(
GL_QUADS
);
glVertex3f
(
-
(
seg
->
plane
)
/
2
.
0
,
-
1
,
-
(
seg
->
min
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
plane
)
/
2
.
0
,
1
,
-
(
seg
->
min
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
plane
)
/
2
.
0
,
1
,
-
(
seg
->
max
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
plane
)
/
2
.
0
,
-
1
,
-
(
seg
->
max
)
/
2
.
0
);
glEnd
();
break
;
case
di_south
:
glColor4f
(
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
);
glBegin
(
GL_QUADS
);
glVertex3f
(
-
(
seg
->
plane
)
/
2
.
0
,
-
1
,
-
(
seg
->
min
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
plane
)
/
2
.
0
,
1
,
-
(
seg
->
min
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
plane
)
/
2
.
0
,
1
,
-
(
seg
->
max
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
plane
)
/
2
.
0
,
-
1
,
-
(
seg
->
max
)
/
2
.
0
);
glEnd
();
break
;
case
di_east
:
glColor4f
(
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
1
.
0
f
);
glBegin
(
GL_QUADS
);
glVertex3f
(
-
(
seg
->
min
)
/
2
.
0
,
-
1
,
-
(
seg
->
plane
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
min
)
/
2
.
0
,
1
,
-
(
seg
->
plane
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
max
)
/
2
.
0
,
1
,
-
(
seg
->
plane
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
max
)
/
2
.
0
,
-
1
,
-
(
seg
->
plane
)
/
2
.
0
);
glEnd
();
break
;
case
di_west
:
glColor4f
(
1
.
0
f
,
0
.
0
f
,
1
.
0
f
,
1
.
0
f
);
glBegin
(
GL_QUADS
);
glVertex3f
(
-
(
seg
->
min
)
/
2
.
0
,
-
1
,
-
(
seg
->
plane
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
min
)
/
2
.
0
,
1
,
-
(
seg
->
plane
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
max
)
/
2
.
0
,
1
,
-
(
seg
->
plane
)
/
2
.
0
);
glVertex3f
(
-
(
seg
->
max
)
/
2
.
0
,
-
1
,
-
(
seg
->
plane
)
/
2
.
0
);
glEnd
();
break
;
}
}
}
macsrc/RefBsp.c
View file @
8ee7f853
...
@@ -159,7 +159,7 @@ void RenderBSPNode(Word bspnum)
...
@@ -159,7 +159,7 @@ void RenderBSPNode(Word bspnum)
coordinate
=
bsp
->
plane
<<
7
;
/* stored as half tiles*/
coordinate
=
bsp
->
plane
<<
7
;
/* stored as half tiles*/
if
(
bsp
->
dir
)
{
/* True for vertical tiles */
if
(
bsp
->
dir
&
1
)
{
/* True for vertical tiles */
side
=
viewx
>
coordinate
;
/* vertical decision line*/
side
=
viewx
>
coordinate
;
/* vertical decision line*/
savednum
=
BSPLEFT
+
(
side
^
1
);
/* Left or right */
savednum
=
BSPLEFT
+
(
side
^
1
);
/* Left or right */
}
else
{
}
else
{
...
...
macsrc/Refresh.c
View file @
8ee7f853
...
@@ -321,6 +321,9 @@ Boolean StartupRendering(Word NewSize)
...
@@ -321,6 +321,9 @@ Boolean StartupRendering(Word NewSize)
return
FALSE
;
return
FALSE
;
}
}
MathSize
=
NewSize
;
MathSize
=
NewSize
;
InitRenderView
();
return
TRUE
;
return
TRUE
;
}
}
...
...
macsrc/SoftDraw.c
View file @
8ee7f853
...
@@ -619,3 +619,7 @@ void P_DrawSeg (saveseg_t *seg)
...
@@ -619,3 +619,7 @@ void P_DrawSeg (saveseg_t *seg)
void
StartRenderView
()
void
StartRenderView
()
{
{
}
}
void
InitRenderView
()
{
}
macsrc/TODO
View file @
8ee7f853
...
@@ -9,19 +9,21 @@ TODO:
...
@@ -9,19 +9,21 @@ TODO:
- If SVGAlib does not support 512x384x256, allow the user to pan around
- If SVGAlib does not support 512x384x256, allow the user to pan around
with the keypad arrow keys.
with the keypad arrow keys.
* Finish moving all 2D code to SoftDraw.c
* Finish moving all 2D code to SoftDraw.c
* Compile with -Wall -ansi -pedantic (shouldn't be much in the way)
* Compile with -Wall -ansi -pedantic (there shouldn't be much in the way)
* OpenGL
BUGS:
BUGS:
*
Drawing seems like its imprecise, stationary sprites move back and forth,
*
Software Drawing seems like its imprecise, stationary sprites move back and
and walls 'swim' when you move around, or sprites pop into different sizes
forth, and walls 'swim' when you move around, or sprites pop into different
when are far enough and get closer/farther away
sizes
when are far enough and get closer/farther away
- Possibly caused by 8.8 imprecision?
- Possibly caused by 8.8 imprecision?
* it crashes somewhere, no reason why...
* it crashes somewhere, no reason why (effects everything)...
#0 0x804fa55 in DrawXMShape (x=128, y=96, ShapePtr=0x8c8c8c8c) at
#0 0x804fa55 in DrawXMShape (x=128, y=96, ShapePtr=0x8c8c8c8c) at Burger.c:198
Burger.c:198
and
But what is trashing GameShapes's memory?
#0 0x805296e in IO_AttackShape (shape=17) at WolfIO.c:201
* added an 'and' hack to lines 33 and 50 in RefBsp.c Not sure if this causes
(gdb) print GameShapes
any problems (value was overflowing finetangent...)
$8 = (unsigned char **) 0x7070707
But what is trashing GameShapes or its memory?
IDEAS:
IDEAS:
* Menu Keys
* Menu Keys
...
...
macsrc/wolfdef.h
View file @
8ee7f853
...
@@ -378,10 +378,9 @@ typedef struct {
...
@@ -378,10 +378,9 @@ typedef struct {
/* Used by the renderer, must match the header of static_t, actor_t, missile_t */
/* Used by the renderer, must match the header of static_t, actor_t, missile_t */
/* TODO: hrm */
typedef
struct
{
typedef
struct
{
Word
x
,
y
;
/* Item's x,y */
Word
x
,
y
;
/* Item's x,y */
Word
sprite
;
/* Item's shape */
Word
sprite
;
/* Item's shape */
Word
areanumber
;
/* Item's visible area */
Word
areanumber
;
/* Item's visible area */
}
thing_t
;
}
thing_t
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment