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
3a4d1f62
Commit
3a4d1f62
authored
Jun 15, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* DisplayScreen in GL (uses DrawPixels)
* If LastTexture is same, don't do a new glBegin (for Walls)
parent
f4482f23
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
200 additions
and
112 deletions
+200
-112
Burger.c
macsrc/Burger.c
+0
-17
GLDraw.c
macsrc/GLDraw.c
+114
-54
InterMis.c
macsrc/InterMis.c
+3
-2
Intro.c
macsrc/Intro.c
+6
-2
Main.c
macsrc/Main.c
+1
-1
SoftDraw.c
macsrc/SoftDraw.c
+30
-2
TODO
macsrc/TODO
+5
-5
stub.c
macsrc/stub.c
+0
-5
vi_glx.c
macsrc/vi_glx.c
+39
-23
wolfdef.h
macsrc/wolfdef.h
+2
-1
No files found.
macsrc/Burger.c
View file @
3a4d1f62
...
@@ -22,25 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
...
@@ -22,25 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
unsigned
char
*
VideoPointer
;
Word
VideoWidth
;
LongWord
YTable
[
480
];
#define BRGR 0x42524752
#define BRGR 0x42524752
void
InitYTable
(
void
)
{
Word
i
;
LongWord
Offset
;
i
=
0
;
Offset
=
0
;
do
{
YTable
[
i
]
=
Offset
;
Offset
+=
VideoWidth
;
}
while
(
++
i
<
480
);
}
/**********************************
/**********************************
Load and set a palette resource
Load and set a palette resource
...
...
macsrc/GLDraw.c
View file @
3a4d1f62
...
@@ -45,6 +45,47 @@ Byte Pal[768];
...
@@ -45,6 +45,47 @@ Byte Pal[768];
Utility Functions
Utility Functions
*/
*/
GLuint
LastTexture
;
static
void
StartTexture
()
{
LastTexture
=
-
1
;
}
static
void
ChangeTexture
(
GLuint
x
)
{
if
(
x
==
0
)
fprintf
(
stderr
,
"%s/%d: Binding zero texture!
\n
"
,
__FILE__
,
__LINE__
);
if
(
LastTexture
!=
x
)
{
if
(
LastTexture
!=
-
1
)
glEnd
();
glBindTexture
(
GL_TEXTURE_2D
,
x
);
glBegin
(
GL_QUADS
);
LastTexture
=
x
;
return
;
}
}
static
void
StopTexture
()
{
if
(
LastTexture
!=
-
1
)
glEnd
();
LastTexture
=
-
1
;
}
static
void
ChangeTextureSimple
(
GLuint
x
)
{
if
(
x
==
0
)
fprintf
(
stderr
,
"%s/%d: Binding zero texture!
\n
"
,
__FILE__
,
__LINE__
);
if
(
LastTexture
!=
x
)
{
glBindTexture
(
GL_TEXTURE_2D
,
x
);
LastTexture
=
x
;
return
;
}
}
void
xgluPerspective
(
GLdouble
fovx
,
GLdouble
aspect
,
GLdouble
zNear
,
GLdouble
zFar
)
void
xgluPerspective
(
GLdouble
fovx
,
GLdouble
aspect
,
GLdouble
zNear
,
GLdouble
zFar
)
{
{
GLdouble
xmin
,
xmax
,
ymin
,
ymax
;
GLdouble
xmin
,
xmax
,
ymin
,
ymax
;
...
@@ -79,10 +120,6 @@ int CheckToken(const char *str, const char *item)
...
@@ -79,10 +120,6 @@ int CheckToken(const char *str, const char *item)
Temp Stuff
Temp Stuff
*/
*/
void
DisplayScreen
(
Word
res
)
{
}
void
FadeToPtr
(
unsigned
char
*
PalPtr
)
void
FadeToPtr
(
unsigned
char
*
PalPtr
)
{
{
SetPalette
(
PalPtr
);
SetPalette
(
PalPtr
);
...
@@ -136,10 +173,64 @@ Byte *Pal256toRGB(Byte *dat, int len, Byte *pal)
...
@@ -136,10 +173,64 @@ Byte *Pal256toRGB(Byte *dat, int len, Byte *pal)
return
buf
;
return
buf
;
}
}
typedef
struct
{
GLuint
t
;
GLfloat
w
;
GLfloat
h
;
}
Texture
;
void
RedrawScreen
()
{
BlastScreen
();
}
void
DrawShape
(
Word
x
,
Word
y
,
void
*
ShapePtr
)
void
DrawShape
(
Word
x
,
Word
y
,
void
*
ShapePtr
)
{
{
}
}
void
DrawPsyched
(
Word
Index
)
{
}
void
DisplayScreen
(
Word
res
,
Word
pres
)
{
LongWord
*
PackPtr
;
LongWord
PackLength
;
unsigned
short
*
ShapePtr
;
int
width
,
height
;
Byte
*
buf
,
*
pal
;
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glMatrixMode
(
GL_MODELVIEW
);
glLoadIdentity
();
PackPtr
=
LoadAResource
(
res
);
PackLength
=
lMSB
(
PackPtr
[
0
]);
ShapePtr
=
(
unsigned
short
*
)
AllocSomeMem
(
PackLength
);
DLZSS
((
Byte
*
)
ShapePtr
,
(
Byte
*
)
&
PackPtr
[
1
],
PackLength
);
pal
=
LoadAResource
(
pres
);
glPixelZoom
(
1
.
0
f
,
-
1
.
0
f
);
glRasterPos2f
(
-
1
.
0
f
,
1
.
0
f
);
width
=
sMSB
(
ShapePtr
[
0
]);
height
=
sMSB
(
ShapePtr
[
1
]);
buf
=
Pal256toRGB
((
Byte
*
)
&
ShapePtr
[
2
],
width
*
height
,
pal
);
glDrawPixels
(
width
,
height
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
buf
);
free
(
buf
);
FreeSomeMem
(
ShapePtr
);
ReleaseAResource
(
pres
);
ReleaseAResource
(
res
);
glFinish
();
}
void
SetNumber
(
LongWord
number
,
Word
x
,
Word
y
,
Word
digits
)
void
SetNumber
(
LongWord
number
,
Word
x
,
Word
y
,
Word
digits
)
{
{
}
}
...
@@ -205,7 +296,6 @@ void IO_DisplayViewBuffer(void)
...
@@ -205,7 +296,6 @@ void IO_DisplayViewBuffer(void)
}
}
}
}
GLuint
LastTexture
;
/*
/*
Automap Drawing
Automap Drawing
...
@@ -223,8 +313,6 @@ void MakeSmallFont()
...
@@ -223,8 +313,6 @@ void MakeSmallFont()
pal
=
LoadAResource
(
rGamePal
);
pal
=
LoadAResource
(
rGamePal
);
LastTexture
=
0
;
for
(
i
=
0
;
i
<
64
;
i
++
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
{
ArtStart
=
ArtData
[
i
];
ArtStart
=
ArtData
[
i
];
...
@@ -325,7 +413,6 @@ void DrawSmall(Word x, Word y, Word tile)
...
@@ -325,7 +413,6 @@ void DrawSmall(Word x, Word y, Word tile)
glPushMatrix
();
glPushMatrix
();
glLoadIdentity
();
glLoadIdentity
();
LastTexture
=
smltex
[
tile
];
glBindTexture
(
GL_TEXTURE_2D
,
smltex
[
tile
]);
glBindTexture
(
GL_TEXTURE_2D
,
smltex
[
tile
]);
glBegin
(
GL_QUADS
);
glBegin
(
GL_QUADS
);
...
@@ -484,8 +571,11 @@ Byte *DeXMShape256(Byte *data)
...
@@ -484,8 +571,11 @@ Byte *DeXMShape256(Byte *data)
void
IO_ClearViewBuffer
()
void
IO_ClearViewBuffer
()
{
{
LastTexture
=
0
;
StartTexture
();
glBindTexture
(
GL_TEXTURE_2D
,
0
);
glBindTexture
(
GL_TEXTURE_2D
,
0
);
/* **MESA BUG** */
glTexEnvf
(
GL_TEXTURE_ENV
,
GL_TEXTURE_ENV_MODE
,
GL_MODULATE
);
glViewport
(
0
,
VidHeight
-
ViewHeight
,
VidWidth
,
ViewHeight
);
glViewport
(
0
,
VidHeight
-
ViewHeight
,
VidWidth
,
ViewHeight
);
...
@@ -496,40 +586,27 @@ void IO_ClearViewBuffer()
...
@@ -496,40 +586,27 @@ void IO_ClearViewBuffer()
glPushMatrix
();
glPushMatrix
();
glLoadIdentity
();
glLoadIdentity
();
#if 0
/* glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); */
glClear(GL_DEPTH_BUFFER_BIT);
glDisable(GL_DEPTH_TEST);
glColor3ub(Pal[0x2F*3+0], Pal[0x2F*3+1], Pal[0x2F*3+2]);
glRectf(-1, 0, 1, 1);
glColor3ub(Pal[0x2A*3+0], Pal[0x2A*3+1], Pal[0x2A*3+2]);
glRectf(1, -1, -1, 0);
glEnable(GL_DEPTH_TEST);
#else
glEnable
(
GL_DEPTH_TEST
);
glEnable
(
GL_DEPTH_TEST
);
glDepthRange
(
1
.
0
,
1
.
0
);
glDepthRange
(
1
.
0
,
1
.
0
);
glDepthFunc
(
GL_ALWAYS
);
glDepthFunc
(
GL_ALWAYS
);
glColor3ub
(
Pal
[
0x2F
*
3
+
0
],
Pal
[
0x2F
*
3
+
1
],
Pal
[
0x2F
*
3
+
2
]);
glColor3ub
(
Pal
[
0x2F
*
3
+
0
],
Pal
[
0x2F
*
3
+
1
],
Pal
[
0x2F
*
3
+
2
]);
glRectf
(
-
1
,
0
,
1
,
1
);
glRectf
(
-
1
.
0
,
0
.
0
,
1
.
0
,
1
.
0
);
glColor3ub
(
Pal
[
0x2A
*
3
+
0
],
Pal
[
0x2A
*
3
+
1
],
Pal
[
0x2A
*
3
+
2
]);
glColor3ub
(
Pal
[
0x2A
*
3
+
0
],
Pal
[
0x2A
*
3
+
1
],
Pal
[
0x2A
*
3
+
2
]);
glRectf
(
1
,
-
1
,
-
1
,
0
);
glRectf
(
1
.
0
,
-
1
.
0
,
-
1
.
0
,
0
.
0
);
glDepthRange
(
0
.
0
,
1
.
0
);
glDepthRange
(
0
.
0
,
1
.
0
);
glDepthFunc
(
GL_LESS
);
glDepthFunc
(
GL_LESS
);
#endif
glPopMatrix
();
glPopMatrix
();
glMatrixMode
(
GL_MODELVIEW
);
glMatrixMode
(
GL_MODELVIEW
);
/* Not needed when using GL_REPLACE */
/* Not needed when using GL_REPLACE */
/* glColor3f(1.0, 1.0, 1.0); */
/* glColor3f(1.0, 1.0, 1.0); */
glTexEnvf
(
GL_TEXTURE_ENV
,
GL_TEXTURE_ENV_MODE
,
GL_REPLACE
);
glRotatef
(
270
.
0
-
((
GLfloat
)
gamestate
.
viewangle
/
(
GLfloat
)
ANGLES
*
360
.
0
),
0
.
0
,
1
.
0
,
0
.
0
);
glRotatef
(
270
.
0
-
((
GLfloat
)
gamestate
.
viewangle
/
(
GLfloat
)
ANGLES
*
360
.
0
),
0
.
0
,
1
.
0
,
0
.
0
);
glTranslatef
((
GLfloat
)
actors
[
0
].
x
/
256
.
0
,
0
,
(
GLfloat
)
actors
[
0
].
y
/
256
.
0
);
glTranslatef
((
GLfloat
)
actors
[
0
].
x
/
256
.
0
,
0
,
(
GLfloat
)
actors
[
0
].
y
/
256
.
0
);
...
@@ -544,9 +621,9 @@ void InitRenderView()
...
@@ -544,9 +621,9 @@ void InitRenderView()
Byte
*
buf
,
*
pal
;
Byte
*
buf
,
*
pal
;
int
i
;
int
i
;
glClearColor
(
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
LastTexture
=
0
;
glEnable
(
GL_TEXTURE_2D
);
glEnable
(
GL_TEXTURE_2D
);
#ifdef GL_EXT_shared_texture_palette
#ifdef GL_EXT_shared_texture_palette
...
@@ -695,8 +772,6 @@ void InitRenderView()
...
@@ -695,8 +772,6 @@ void InitRenderView()
glEnable
(
GL_ALPHA_TEST
);
glEnable
(
GL_ALPHA_TEST
);
glAlphaFunc
(
GL_GREATER
,
0
.
5
);
glAlphaFunc
(
GL_GREATER
,
0
.
5
);
glClearColor
(
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
);
glMatrixMode
(
GL_PROJECTION
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glLoadIdentity
();
...
@@ -711,7 +786,6 @@ void InitRenderView()
...
@@ -711,7 +786,6 @@ void InitRenderView()
void
IO_AttackShape
(
Word
shape
)
void
IO_AttackShape
(
Word
shape
)
{
{
LastTexture
=
weptex
[
shape
];
if
(
weptex
[
shape
]
==
0
)
{
if
(
weptex
[
shape
]
==
0
)
{
fprintf
(
stderr
,
"Weapon shape %d is zero texture!
\n
"
,
shape
);
fprintf
(
stderr
,
"Weapon shape %d is zero texture!
\n
"
,
shape
);
}
}
...
@@ -748,14 +822,7 @@ void DrawSprite(thing_t *t)
...
@@ -748,14 +822,7 @@ void DrawSprite(thing_t *t)
glTranslatef
(
-
(
GLfloat
)
t
->
x
/
256
.
0
,
0
,
-
(
GLfloat
)
t
->
y
/
256
.
0
);
glTranslatef
(
-
(
GLfloat
)
t
->
x
/
256
.
0
,
0
,
-
(
GLfloat
)
t
->
y
/
256
.
0
);
glRotatef
(
90
.
0
+
((
GLfloat
)
gamestate
.
viewangle
/
(
GLfloat
)
ANGLES
*
360
.
0
),
0
.
0
,
1
.
0
,
0
.
0
);
glRotatef
(
90
.
0
+
((
GLfloat
)
gamestate
.
viewangle
/
(
GLfloat
)
ANGLES
*
360
.
0
),
0
.
0
,
1
.
0
,
0
.
0
);
if
(
sprtex
[
t
->
sprite
]
==
0
)
{
ChangeTextureSimple
(
sprtex
[
t
->
sprite
]);
fprintf
(
stderr
,
"ERROR: 0 texture in DrawSprite (%d)
\n
"
,
t
->
sprite
);
}
if
(
LastTexture
!=
sprtex
[
t
->
sprite
])
{
LastTexture
=
sprtex
[
t
->
sprite
];
glBindTexture
(
GL_TEXTURE_2D
,
sprtex
[
t
->
sprite
]);
}
glBegin
(
GL_QUADS
);
glBegin
(
GL_QUADS
);
glTexCoord2f
(
1
.
0
,
0
.
0
);
glVertex2f
(
0
.
5
,
1
);
glTexCoord2f
(
1
.
0
,
0
.
0
);
glVertex2f
(
0
.
5
,
1
);
...
@@ -994,6 +1061,8 @@ void DrawSprites(void)
...
@@ -994,6 +1061,8 @@ void DrawSprites(void)
missile_t
*
MissilePtr
;
/* Pointer to active missile record */
missile_t
*
MissilePtr
;
/* Pointer to active missile record */
Word
*
xe
;
/* Pointer to sort value */
Word
*
xe
;
/* Pointer to sort value */
StopTexture
();
/* Draw Walls */
numvisspr
=
0
;
/* Init the sprite count */
numvisspr
=
0
;
/* Init the sprite count */
/* add all sprites in visareas*/
/* add all sprites in visareas*/
...
@@ -1039,7 +1108,6 @@ void DrawSprites(void)
...
@@ -1039,7 +1108,6 @@ void DrawSprites(void)
SortEvents
();
SortEvents
();
/* draw from smallest scale to largest */
/* draw from smallest scale to largest */
xe
=
&
firstevent
[
i
-
1
];
xe
=
&
firstevent
[
i
-
1
];
do
{
do
{
dseg
=
&
vissprites
[
xe
[
0
]
&
(
MAXVISSPRITES
-
1
)];
dseg
=
&
vissprites
[
xe
[
0
]
&
(
MAXVISSPRITES
-
1
)];
...
@@ -1300,15 +1368,8 @@ void P_DrawSegx(saveseg_t *seg)
...
@@ -1300,15 +1368,8 @@ void P_DrawSegx(saveseg_t *seg)
smin
=
-
(
pos
+
texslide
);
smin
=
-
(
pos
+
texslide
);
smax
=
-
(
pos
+
(
max
-
min
));
smax
=
-
(
pos
+
(
max
-
min
));
if
(
waltex
[
t
]
==
0
)
ChangeTexture
(
waltex
[
t
]);
fprintf
(
stderr
,
"ERROR: 0 texture in P_DrawSegx!
\n
"
);
if
(
LastTexture
!=
waltex
[
t
])
{
LastTexture
=
waltex
[
t
];
glBindTexture
(
GL_TEXTURE_2D
,
waltex
[
t
]);
}
glBegin
(
GL_QUADS
);
switch
(
seg
->
dir
&
3
)
{
switch
(
seg
->
dir
&
3
)
{
case
di_north
:
case
di_north
:
if
(
door
!=
-
1
)
{
if
(
door
!=
-
1
)
{
...
@@ -1359,6 +1420,5 @@ void P_DrawSegx(saveseg_t *seg)
...
@@ -1359,6 +1420,5 @@ void P_DrawSegx(saveseg_t *seg)
}
}
break
;
break
;
}
}
glEnd
();
}
}
}
}
macsrc/InterMis.c
View file @
3a4d1f62
...
@@ -243,7 +243,8 @@ void LevelCompleted(void)
...
@@ -243,7 +243,8 @@ void LevelCompleted(void)
NumberIndex
=
47
;
/* Hack to draw score using an alternate number set */
NumberIndex
=
47
;
/* Hack to draw score using an alternate number set */
NewGameWindow
(
1
);
/* Force 512 mode screen */
NewGameWindow
(
1
);
/* Force 512 mode screen */
DisplayScreen
(
rIntermission
);
DisplayScreen
(
rIntermission
,
rInterPal
);
BlastScreen
();
PackPtr
=
LoadAResource
(
rInterPics
);
PackPtr
=
LoadAResource
(
rInterPics
);
PackLength
=
lMSB
(
PackPtr
[
0
]);
PackLength
=
lMSB
(
PackPtr
[
0
]);
...
...
macsrc/Intro.c
View file @
3a4d1f62
...
@@ -32,19 +32,23 @@ void Intro(void)
...
@@ -32,19 +32,23 @@ void Intro(void)
FadeToBlack
();
/* Fade out the video */
FadeToBlack
();
/* Fade out the video */
DisplayScreen
(
rMacPlayPic
);
DisplayScreen
(
rMacPlayPic
,
rMacPlayPal
);
BlastScreen
();
BlastScreen
();
StartSong
(
SongListPtr
[
0
]);
/* Play the song */
StartSong
(
SongListPtr
[
0
]);
/* Play the song */
FadeTo
(
rMacPlayPal
);
/* Fade in the picture */
FadeTo
(
rMacPlayPal
);
/* Fade in the picture */
WaitTicksEvent
(
240
);
/* Wait for event */
WaitTicksEvent
(
240
);
/* Wait for event */
DisplayScreen
(
rMacPlayPic
,
rIdLogoPal
);
/* higher bpp hack */
BlastScreen
();
FadeTo
(
rIdLogoPal
);
FadeTo
(
rIdLogoPal
);
if
(
toupper
(
WaitTicksEvent
(
240
))
==
'B'
)
{
/* Wait for event */
if
(
toupper
(
WaitTicksEvent
(
240
))
==
'B'
)
{
/* Wait for event */
FadeToBlack
();
FadeToBlack
();
ClearTheScreen
(
BLACK
);
ClearTheScreen
(
BLACK
);
DisplayScreen
(
rYummyPic
);
DisplayScreen
(
rYummyPic
,
rYummyPal
);
BlastScreen
();
BlastScreen
();
FadeTo
(
rYummyPal
);
FadeTo
(
rYummyPal
);
...
...
macsrc/Main.c
View file @
3a4d1f62
...
@@ -137,7 +137,7 @@ Boolean TitleScreen()
...
@@ -137,7 +137,7 @@ Boolean TitleScreen()
NewGameWindow
(
1
);
/* Set to 512 mode */
NewGameWindow
(
1
);
/* Set to 512 mode */
FadeToBlack
();
/* Fade out the video */
FadeToBlack
();
/* Fade out the video */
DisplayScreen
(
rTitlePic
);
DisplayScreen
(
rTitlePic
,
rTitlePal
);
BlastScreen
();
BlastScreen
();
StartSong
(
SongListPtr
[
0
]);
StartSong
(
SongListPtr
[
0
]);
...
...
macsrc/SoftDraw.c
View file @
3a4d1f62
...
@@ -10,7 +10,7 @@ This program is distributed in the hope that it will be useful,
...
@@ -10,7 +10,7 @@ This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
...
@@ -19,12 +19,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
...
@@ -19,12 +19,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "wolfdef.h"
#include "wolfdef.h"
void
DisplayScreen
(
Word
res
)
unsigned
char
*
VideoPointer
;
Word
VideoWidth
;
LongWord
YTable
[
480
];
void
InitYTable
(
void
)
{
Word
i
;
LongWord
Offset
;
i
=
0
;
Offset
=
0
;
do
{
YTable
[
i
]
=
Offset
;
Offset
+=
VideoWidth
;
}
while
(
++
i
<
480
);
}
void
DisplayScreen
(
Word
res
,
Word
pal
)
{
{
LongWord
*
PackPtr
;
LongWord
*
PackPtr
;
LongWord
PackLength
;
LongWord
PackLength
;
unsigned
short
*
ShapePtr
;
unsigned
short
*
ShapePtr
;
/* pal is ignored in 8bit */
PackPtr
=
LoadAResource
(
res
);
PackPtr
=
LoadAResource
(
res
);
PackLength
=
lMSB
(
PackPtr
[
0
]);
PackLength
=
lMSB
(
PackPtr
[
0
]);
ShapePtr
=
(
unsigned
short
*
)
AllocSomeMem
(
PackLength
);
ShapePtr
=
(
unsigned
short
*
)
AllocSomeMem
(
PackLength
);
...
@@ -35,6 +54,15 @@ void DisplayScreen(Word res)
...
@@ -35,6 +54,15 @@ void DisplayScreen(Word res)
ReleaseAResource
(
res
);
ReleaseAResource
(
res
);
}
}
void
RedrawScreen
()
{
BlastScreen
();
}
void
DrawPsyched
(
Word
Index
)
{
}
/**********************************
/**********************************
Load and set a palette from a pointer
Load and set a palette from a pointer
...
...
macsrc/TODO
View file @
3a4d1f62
...
@@ -13,16 +13,16 @@ TODO:
...
@@ -13,16 +13,16 @@ TODO:
* Finish moving all 2D code to SoftDraw.c
* Finish moving all 2D code to SoftDraw.c
- Should move some code so it is not such a large file (SoftDraw2.c)
- Should move some code so it is not such a large file (SoftDraw2.c)
* Finish OpenGL
* Finish OpenGL
+ Status bars, Introscreens, Psyched [DrawShape]
+ Status bars, Level completed screen, Psyched [DrawShape]
+ Not exactly sure how I will implement this yet.
- IO_Draw* (status bar versions) are stubbed, update statusbar when
- IO_Draw* (status bar versions) are stubbed, update statusbar when
doing screen update
doing screen update
- Finish window resizing
- Finish window resizing
- Could use the LastTexture to have less glBegin/Ends.
- When all drawing is implemented, remove any unnecessary state/matrix
- When all drawing is implemented, remove any unnecessary state/matrix
changes.
changes.
- Split up GLDraw.c
- Split up GLDraw.c
- Is GL_REPLACE faster than GL_MODULATE for textures?
- Is GL_REPLACE faster than GL_MODULATE for textures?
- Save "draw state" so redrawing works right when screen is
resized/exposed
* Save/Load Games
* Save/Load Games
- Menu code does not exist yet -- so just have a compiled in default save
- Menu code does not exist yet -- so just have a compiled in default save
and load files
and load files
...
...
macsrc/stub.c
View file @
3a4d1f62
...
@@ -107,11 +107,6 @@ void ShowGetPsyched(void)
...
@@ -107,11 +107,6 @@ void ShowGetPsyched(void)
SetAPalette
(
rGamePal
);
SetAPalette
(
rGamePal
);
}
}
void
DrawPsyched
(
Word
Index
)
{
/* TODO: blah */
}
void
EndGetPsyched
(
void
)
void
EndGetPsyched
(
void
)
{
{
while
(
PsyTime
>
ReadTick
())
;
while
(
PsyTime
>
ReadTick
())
;
...
...
macsrc/vi_glx.c
View file @
3a4d1f62
...
@@ -40,6 +40,8 @@ XVisualInfo *vi;
...
@@ -40,6 +40,8 @@ XVisualInfo *vi;
GLXContext
ctx
;
GLXContext
ctx
;
Atom
wmDeleteWindow
;
Atom
wmDeleteWindow
;
int
VidWidth
,
VidHeight
,
ViewHeight
;
#ifdef GL_EXT_shared_texture_palette
#ifdef GL_EXT_shared_texture_palette
extern
int
UseSharedTexturePalette
;
extern
int
UseSharedTexturePalette
;
extern
PFNGLCOLORTABLEEXTPROC
pglColorTableEXT
;
extern
PFNGLCOLORTABLEEXTPROC
pglColorTableEXT
;
...
@@ -47,6 +49,8 @@ extern PFNGLCOLORTABLEEXTPROC pglColorTableEXT;
...
@@ -47,6 +49,8 @@ extern PFNGLCOLORTABLEEXTPROC pglColorTableEXT;
extern
int
CheckToken
(
const
char
*
str
,
const
char
*
item
);
extern
int
CheckToken
(
const
char
*
str
,
const
char
*
item
);
int
HandleEvents
();
int
attrib
[]
=
{
int
attrib
[]
=
{
GLX_RGBA
,
GLX_RGBA
,
GLX_RED_SIZE
,
5
,
GLX_RED_SIZE
,
5
,
...
@@ -189,6 +193,8 @@ int main(int argc, char *argv[])
...
@@ -189,6 +193,8 @@ int main(int argc, char *argv[])
}
}
#endif
#endif
glShadeModel
(
GL_FLAT
);
InitData
();
InitData
();
SlowDown
=
1
;
SlowDown
=
1
;
...
@@ -222,7 +228,6 @@ void BlastScreen2(Rect *BlastRect)
...
@@ -222,7 +228,6 @@ void BlastScreen2(Rect *BlastRect)
BlastScreen
();
BlastScreen
();
}
}
int
VidWidth
,
VidHeight
,
ViewHeight
;
#define w VidWidth
#define w VidWidth
#define h VidHeight
#define h VidHeight
#define v ViewHeight
#define v ViewHeight
...
@@ -243,7 +248,7 @@ void BlastScreen()
...
@@ -243,7 +248,7 @@ void BlastScreen()
}
}
}
}
Word
VidXs
[]
=
{
320
,
512
,
640
,
640
};
/* Screen sizes to play with */
Word
VidXs
[]
=
{
320
,
512
,
640
,
640
};
Word
VidYs
[]
=
{
200
,
384
,
400
,
480
};
Word
VidYs
[]
=
{
200
,
384
,
400
,
480
};
Word
VidVs
[]
=
{
160
,
320
,
320
,
400
};
Word
VidVs
[]
=
{
160
,
320
,
320
,
400
};
Word
VidPics
[]
=
{
rFaceShapes
,
rFace512
,
rFace640
,
rFace640
};
Word
VidPics
[]
=
{
rFaceShapes
,
rFace512
,
rFace640
,
rFace640
};
...
@@ -270,15 +275,18 @@ Word NewGameWindow(Word NewVidSize)
...
@@ -270,15 +275,18 @@ Word NewGameWindow(Word NewVidSize)
sizehints
.
flags
=
PMinSize
;
sizehints
.
flags
=
PMinSize
;
XSetWMNormalHints
(
dpy
,
win
,
&
sizehints
);
XSetWMNormalHints
(
dpy
,
win
,
&
sizehints
);
XResizeWindow
(
dpy
,
win
,
w
,
h
);
XResizeWindow
(
dpy
,
win
,
w
,
h
);
XSync
(
dpy
,
False
);
InitYTable
();
SetAPalette
(
rBlackPal
);
SetAPalette
(
rBlackPal
);
ClearTheScreen
(
BLACK
);
ClearTheScreen
(
BLACK
);
BlastScreen
();
BlastScreen
();
VidSize
=
NewVidSize
;
VidSize
=
NewVidSize
;
XSync
(
dpy
,
False
);
glXWaitGL
();
glXWaitX
();
HandleEvents
();
return
VidSize
;
return
VidSize
;
}
}
...
@@ -412,6 +420,15 @@ void keyboard_handler(KeySym keycode, int press)
...
@@ -412,6 +420,15 @@ void keyboard_handler(KeySym keycode, int press)
UpdateKeys
(
keycode
,
press
);
UpdateKeys
(
keycode
,
press
);
if
(
press
==
0
)
{
switch
(
keycode
)
{
case
XK_Escape
:
Quit
(
NULL
);
/* fast way out */
default:
break
;
}
}
if
(
RSJ
)
{
if
(
RSJ
)
{
if
(
press
==
0
)
{
if
(
press
==
0
)
{
for
(
i
=
0
;
i
<
CheatCount
;
i
++
)
{
for
(
i
=
0
;
i
<
CheatCount
;
i
++
)
{
...
@@ -506,8 +523,6 @@ void keyboard_handler(KeySym keycode, int press)
...
@@ -506,8 +523,6 @@ void keyboard_handler(KeySym keycode, int press)
case
XK_slash
:
case
XK_slash
:
joystick1
=
JOYPAD_START
;
joystick1
=
JOYPAD_START
;
break
;
break
;
case
XK_Escape
:
Quit
(
NULL
);
/* fast way out */
}
}
}
}
...
@@ -558,7 +573,6 @@ void keyboard_handler(KeySym keycode, int press)
...
@@ -558,7 +573,6 @@ void keyboard_handler(KeySym keycode, int press)
joystick1
|=
(
JOYPAD_X
|
JOYPAD_Y
);
joystick1
|=
(
JOYPAD_X
|
JOYPAD_Y
);
if
(
keys
[
SC_RIGHTSHIFT
])
if
(
keys
[
SC_RIGHTSHIFT
])
joystick1
|=
(
JOYPAD_X
|
JOYPAD_Y
);
joystick1
|=
(
JOYPAD_X
|
JOYPAD_Y
);
}
if
((
joystick1
&
(
JOYPAD_LFT
|
JOYPAD_RGT
))
==
(
JOYPAD_LFT
|
JOYPAD_RGT
))
if
((
joystick1
&
(
JOYPAD_LFT
|
JOYPAD_RGT
))
==
(
JOYPAD_LFT
|
JOYPAD_RGT
))
joystick1
&=
~
(
JOYPAD_LFT
|
JOYPAD_RGT
);
joystick1
&=
~
(
JOYPAD_LFT
|
JOYPAD_RGT
);
...
@@ -574,7 +588,7 @@ void keyboard_handler(KeySym keycode, int press)
...
@@ -574,7 +588,7 @@ void keyboard_handler(KeySym keycode, int press)
joystick1
&=
~
JOYPAD_TR
;
joystick1
&=
~
JOYPAD_TR
;
}
}
}
}
}
}
}
int
HandleEvents
()
int
HandleEvents
()
...
@@ -595,10 +609,12 @@ int HandleEvents()
...
@@ -595,10 +609,12 @@ int HandleEvents()
ret
=
0
;
ret
=
0
;
break
;
break
;
case
Expose
:
case
Expose
:
Blast
Screen
();
Redraw
Screen
();
break
;
break
;
case
ConfigureNotify
:
case
ConfigureNotify
:
glViewport
(
0
,
0
,
event
.
xconfigure
.
width
,
event
.
xconfigure
.
height
);
glViewport
(
0
,
0
,
event
.
xconfigure
.
width
,
event
.
xconfigure
.
height
);
glPixelZoom
(
1
.
0
f
,
-
1
.
0
f
);
glRasterPos2f
(
-
1
.
0
f
,
1
.
0
f
);
break
;
break
;
case
ClientMessage
:
case
ClientMessage
:
if
(
event
.
xclient
.
data
.
l
[
0
]
==
wmDeleteWindow
)
if
(
event
.
xclient
.
data
.
l
[
0
]
==
wmDeleteWindow
)
...
...
macsrc/wolfdef.h
View file @
3a4d1f62
...
@@ -585,7 +585,7 @@ extern Byte *ArtData[64];
...
@@ -585,7 +585,7 @@ extern Byte *ArtData[64];
extern
Byte
textures
[
MAPSIZE
*
2
+
5
][
MAPSIZE
];
/* 0-63 is horizontal, 64-127 is vertical*/
extern
Byte
textures
[
MAPSIZE
*
2
+
5
][
MAPSIZE
];
/* 0-63 is horizontal, 64-127 is vertical*/
extern
void
SetPalette
(
Byte
*
pal
);
extern
void
SetPalette
(
Byte
*
pal
);
extern
void
DisplayScreen
(
Word
res
);
extern
void
DisplayScreen
(
Word
res
,
Word
pal
);
extern
void
InitRenderView
();
extern
void
InitRenderView
();
extern
void
StartRenderView
();
extern
void
StartRenderView
();
extern
void
Quit
(
char
*
str
);
extern
void
Quit
(
char
*
str
);
...
@@ -594,6 +594,7 @@ extern int InitResources(char *name);
...
@@ -594,6 +594,7 @@ extern int InitResources(char *name);
extern
void
InitData
();
extern
void
InitData
();
extern
int
WolfMain
(
int
argc
,
char
*
argv
[]);
extern
int
WolfMain
(
int
argc
,
char
*
argv
[]);
extern
void
FreeResources
();
extern
void
FreeResources
();
extern
void
RedrawScreen
();
extern
void
BlastScreen
(
void
);
extern
void
BlastScreen
(
void
);
extern
void
BlastScreen2
(
Rect
*
BlastRect
);
extern
void
BlastScreen2
(
Rect
*
BlastRect
);
...
...
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