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
a69bba1d
Commit
a69bba1d
authored
Apr 28, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added mitshm for vi_xlib and removed Get/SetColor
parent
5f295323
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
127 deletions
+69
-127
Makefile
src/Makefile
+1
-1
TODO
src/TODO
+2
-2
vi_comm.h
src/vi_comm.h
+0
-2
vi_glx.c
src/vi_glx.c
+0
-28
vi_svga.c
src/vi_svga.c
+0
-30
vi_xlib.c
src/vi_xlib.c
+64
-62
wl_draw.c
src/wl_draw.c
+2
-2
No files found.
src/Makefile
View file @
a69bba1d
...
...
@@ -15,7 +15,7 @@ GOBJS = $(OBJS) vi_ogl.o vi_glx.o
LFLAGS
=
-lm
#LFLAGS = -lm -lvga ElectricFence-2.2.2/libefence.a -lpthread
SLFLAGS
=
$(LFLAGS)
-lvga
XLFLAGS
=
$(LFLAGS)
-L
/usr/X11R6/lib
-lX11
XLFLAGS
=
$(LFLAGS)
-L
/usr/X11R6/lib
-lX11
-lXext
GLFLAGS
=
$(LFLAGS)
-L
/usr/X11R6/lib
-lX11
-lXext
-lGL
NASM
=
nasm
...
...
src/TODO
View file @
a69bba1d
...
...
@@ -83,9 +83,9 @@ we can stop the large conversion before each UpdateScreen
also, the higher bitrates are a hack since a palette lookup has to be done
for every byte when transferring to the pixmap, palette fades require a
screen update
*
mitshm
*
dga 1 and 2
* make sure none of the code tries to handle gfx/sound data directly
* GL_shared_texture_palette
* GL_shared_texture_palette
for opengl
Specific:
* memory/sound intro screen goes
...
...
src/vi_comm.h
View file @
a69bba1d
...
...
@@ -14,8 +14,6 @@ void VL_WaitVBL(int vbls);
void
VW_UpdateScreen
();
void
VL_FillPalette
(
int
red
,
int
green
,
int
blue
);
void
VL_SetColor
(
int
color
,
int
red
,
int
green
,
int
blue
);
void
VL_GetColor
(
int
color
,
int
*
red
,
int
*
green
,
int
*
blue
);
void
VL_SetPalette
(
byte
*
palette
);
void
VL_GetPalette
(
byte
*
palette
);
...
...
src/vi_glx.c
View file @
a69bba1d
...
...
@@ -247,34 +247,6 @@ void VL_FillPalette(int red, int green, int blue)
//===========================================================================
/*
=================
=
= VL_SetColor
=
=================
*/
void
VL_SetColor
(
int
color
,
int
red
,
int
green
,
int
blue
)
{
}
//===========================================================================
/*
=================
=
= VL_GetColor
=
=================
*/
void
VL_GetColor
(
int
color
,
int
*
red
,
int
*
green
,
int
*
blue
)
{
}
//===========================================================================
/*
=================
=
...
...
src/vi_svga.c
View file @
a69bba1d
...
...
@@ -103,36 +103,6 @@ void VL_FillPalette(int red, int green, int blue)
//===========================================================================
/*
=================
=
= VL_SetColor
=
=================
*/
void
VL_SetColor
(
int
color
,
int
red
,
int
green
,
int
blue
)
{
vga_setpalette
(
color
,
red
,
green
,
blue
);
}
//===========================================================================
/*
=================
=
= VL_GetColor
=
=================
*/
void
VL_GetColor
(
int
color
,
int
*
red
,
int
*
green
,
int
*
blue
)
{
vga_getpalette
(
color
,
red
,
green
,
blue
);
}
//===========================================================================
/*
=================
=
...
...
src/vi_xlib.c
View file @
a69bba1d
...
...
@@ -2,6 +2,9 @@
#include "id_heads.h"
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/Xutil.h>
...
...
@@ -24,9 +27,12 @@ XImage *img;
Colormap
cmap
;
Atom
wmDeleteWindow
;
XShmSegmentInfo
shminfo
;
XColor
clr
[
256
];
int
indexmode
;
int
shmmode
;
unsigned
char
mypal
[
768
];
Colormap
GetVisual
()
...
...
@@ -252,7 +258,10 @@ void VW_UpdateScreen()
}
}
XPutImage
(
dpy
,
win
,
gc
,
img
,
0
,
0
,
0
,
0
,
320
,
200
);
if
(
shmmode
)
XShmPutImage
(
dpy
,
win
,
gc
,
img
,
0
,
0
,
0
,
0
,
320
,
200
,
False
);
else
XPutImage
(
dpy
,
win
,
gc
,
img
,
0
,
0
,
0
,
0
,
320
,
200
);
}
/*
...
...
@@ -283,21 +292,52 @@ int BPP(int d)
void
VL_Startup
()
{
if
(
gfxbuf
==
NULL
)
gfxbuf
=
malloc
(
320
*
200
*
1
);
shmmode
=
0
;
if
(
indexmode
)
disbuf
=
gfxbuf
;
else
disbuf
=
malloc
(
320
*
200
*
BPP
(
vi
->
depth
));
if
(
XShmQueryExtension
(
dpy
)
==
True
)
{
img
=
XShmCreateImage
(
dpy
,
vi
->
visual
,
vi
->
depth
,
ZPixmap
,
NULL
,
&
shminfo
,
320
,
200
);
printf
(
"Shm: bpl = %d, h = %d, bp = %d
\n
"
,
img
->
bytes_per_line
,
img
->
height
,
img
->
bitmap_pad
);
if
(
img
->
bytes_per_line
!=
(
320
*
BPP
(
vi
->
depth
))
)
{
printf
(
"Currently cannot handle irregular shm sizes...
\n
"
);
}
else
{
shminfo
.
shmid
=
shmget
(
IPC_PRIVATE
,
img
->
bytes_per_line
*
img
->
height
,
IPC_CREAT
|
0777
);
shminfo
.
shmaddr
=
img
->
data
=
shmat
(
shminfo
.
shmid
,
0
,
0
);
shminfo
.
readOnly
=
False
;
disbuf
=
img
->
data
;
if
(
indexmode
)
gfxbuf
=
disbuf
;
else
gfxbuf
=
malloc
(
320
*
200
*
1
);
if
(
XShmAttach
(
dpy
,
&
shminfo
)
==
True
)
{
printf
(
"Using XShm Extension...
\n
"
);
shmmode
=
1
;
}
else
{
printf
(
"Error with XShm...
\n
"
);
}
}
}
if
(
img
==
NULL
)
{
printf
(
"Falling back on XImage...
\n
"
);
img
=
XCreateImage
(
dpy
,
vi
->
visual
,
vi
->
depth
,
ZPixmap
,
0
,
(
char
*
)
disbuf
,
320
,
200
,
if
(
gfxbuf
==
NULL
)
gfxbuf
=
malloc
(
320
*
200
*
1
);
if
(
indexmode
)
disbuf
=
gfxbuf
;
else
disbuf
=
malloc
(
320
*
200
*
BPP
(
vi
->
depth
));
img
=
XCreateImage
(
dpy
,
vi
->
visual
,
vi
->
depth
,
ZPixmap
,
0
,
(
char
*
)
disbuf
,
320
,
200
,
8
,
320
*
BPP
(
vi
->
depth
));
if
(
img
==
NULL
)
{
Quit
(
"XCreateImage returned NULL"
);
}
if
(
img
==
NULL
)
{
Quit
(
"XCreateImage returned NULL"
);
}
}
XMapWindow
(
dpy
,
win
);
XFlush
(
dpy
);
...
...
@@ -313,12 +353,22 @@ void VL_Startup()
void
VL_Shutdown
(
void
)
{
if
(
gfxbuf
!=
NULL
)
{
if
(
!
shmmode
&&
(
gfxbuf
!=
NULL
)
)
{
free
(
gfxbuf
);
gfxbuf
=
NULL
;
}
if
(
shmmode
&&
!
indexmode
&&
(
gfxbuf
!=
NULL
)
)
{
free
(
gfxbuf
);
gfxbuf
=
NULL
;
}
if
(
(
indexmode
==
0
)
&&
(
disbuf
!=
NULL
)
)
{
if
(
shmmode
)
{
XShmDetach
(
dpy
,
&
shminfo
);
XDestroyImage
(
img
);
shmdt
(
shminfo
.
shmaddr
);
shmctl
(
shminfo
.
shmid
,
IPC_RMID
,
0
);
}
else
if
(
(
indexmode
==
0
)
&&
(
disbuf
!=
NULL
)
)
{
free
(
disbuf
);
disbuf
=
NULL
;
}
...
...
@@ -383,54 +433,6 @@ void VL_FillPalette(int red, int green, int blue)
//===========================================================================
/*
=================
=
= VL_SetColor
=
=================
*/
void
VL_SetColor
(
int
color
,
int
red
,
int
green
,
int
blue
)
{
if
(
indexmode
)
{
clr
[
color
].
red
=
red
<<
10
;
clr
[
color
].
green
=
green
<<
10
;
clr
[
color
].
blue
=
blue
<<
10
;
XStoreColors
(
dpy
,
cmap
,
clr
,
256
);
}
else
{
mypal
[
color
*
3
+
0
]
=
red
;
mypal
[
color
*
3
+
1
]
=
green
;
mypal
[
color
*
3
+
2
]
=
blue
;
}
}
//===========================================================================
/*
=================
=
= VL_GetColor
=
=================
*/
void
VL_GetColor
(
int
color
,
int
*
red
,
int
*
green
,
int
*
blue
)
{
if
(
indexmode
)
{
*
red
=
clr
[
color
].
red
>>
10
;
*
green
=
clr
[
color
].
green
>>
10
;
*
blue
=
clr
[
color
].
blue
>>
10
;
}
else
{
*
red
=
mypal
[
color
*
3
+
0
];
*
green
=
mypal
[
color
*
3
+
1
];
*
blue
=
mypal
[
color
*
3
+
2
];
}
}
//===========================================================================
/*
=================
=
...
...
src/wl_draw.c
View file @
a69bba1d
...
...
@@ -168,14 +168,14 @@ boolean TransformTile (int tx, int ty, int *dispx, int *dispheight)
return
false
;
}
*
dispx
=
centerx
+
ny
*
scale
/
nx
;
// DEBUG: use assembly divide
*
dispx
=
centerx
+
ny
*
scale
/
nx
;
*
dispheight
=
heightnumerator
/
(
nx
>>
8
);
//
// see if it should be grabbed
//
if
(
nx
<
TILEGLOBAL
&&
ny
>-
TILEGLOBAL
/
2
&&
ny
<
TILEGLOBAL
/
2
)
if
(
(
nx
<
TILEGLOBAL
)
&&
(
ny
>-
TILEGLOBAL
/
2
)
&&
(
ny
<
TILEGLOBAL
/
2
)
)
return
true
;
else
return
false
;
...
...
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