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
f576b52f
Commit
f576b52f
authored
Jun 11, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Changed OpenGL clearning to use a depth buffer trick
* Updates to key-handling code
parent
1536ef2c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
146 additions
and
55 deletions
+146
-55
GLDraw.c
macsrc/GLDraw.c
+50
-13
Makefile
macsrc/Makefile
+1
-5
TODO
macsrc/TODO
+15
-9
vi_glx.c
macsrc/vi_glx.c
+30
-23
vi_gtk.c
macsrc/vi_gtk.c
+16
-1
vi_svga.c
macsrc/vi_svga.c
+16
-1
vi_xlib.c
macsrc/vi_xlib.c
+18
-3
No files found.
macsrc/GLDraw.c
View file @
f576b52f
...
@@ -20,12 +20,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
...
@@ -20,12 +20,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glext.h>
#include "wolfdef.h"
#include "wolfdef.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
int
UseSharedTexturePalette
=
0
;
void
xgluPerspective
(
GLdouble
fovx
,
GLdouble
aspect
,
GLdouble
zNear
,
GLdouble
zFar
)
{
GLdouble
xmin
,
xmax
,
ymin
,
ymax
;
xmax
=
zNear
*
tan
(
fovx
*
M_PI
/
360
.
0
);
xmin
=
-
xmax
;
ymin
=
xmin
/
aspect
;
ymax
=
xmax
/
aspect
;
glFrustum
(
xmin
,
xmax
,
ymin
,
ymax
,
zNear
,
zFar
);
}
void
DisplayScreen
(
Word
res
)
void
DisplayScreen
(
Word
res
)
{
{
}
}
...
@@ -44,7 +64,7 @@ void SetAPalettePtr(unsigned char *PalPtr)
...
@@ -44,7 +64,7 @@ void SetAPalettePtr(unsigned char *PalPtr)
void
ClearTheScreen
(
Word
c
)
void
ClearTheScreen
(
Word
c
)
{
{
glClearColor
((
double
)
Pal
[
c
*
3
+
0
]
/
25
6
.
0
,
(
double
)
Pal
[
c
*
3
+
1
]
/
256
.
0
,
(
double
)
Pal
[
c
*
3
+
2
]
/
256
.
0
,
0
.
0
);
glClearColor
((
double
)
Pal
[
c
*
3
+
0
]
/
25
5
.
0
,
(
double
)
Pal
[
c
*
3
+
1
]
/
255
.
0
,
(
double
)
Pal
[
c
*
3
+
2
]
/
255
.
0
,
0
.
0
);
glClear
(
GL_COLOR_BUFFER_BIT
);
glClear
(
GL_COLOR_BUFFER_BIT
);
}
}
...
@@ -285,12 +305,7 @@ void IO_ClearViewBuffer()
...
@@ -285,12 +305,7 @@ void IO_ClearViewBuffer()
{
{
LastTexture
=
0
;
LastTexture
=
0
;
glBindTexture
(
GL_TEXTURE_2D
,
0
);
glBindTexture
(
GL_TEXTURE_2D
,
0
);
/* glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); */
glClear
(
GL_DEPTH_BUFFER_BIT
);
glDisable
(
GL_DEPTH_TEST
);
glMatrixMode
(
GL_MODELVIEW
);
glMatrixMode
(
GL_MODELVIEW
);
glLoadIdentity
();
glLoadIdentity
();
...
@@ -298,6 +313,12 @@ void IO_ClearViewBuffer()
...
@@ -298,6 +313,12 @@ 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]);
glColor3ub(Pal[0x2F*3+0], Pal[0x2F*3+1], Pal[0x2F*3+2]);
glRectf(-1, 0, 1, 1);
glRectf(-1, 0, 1, 1);
...
@@ -307,7 +328,23 @@ void IO_ClearViewBuffer()
...
@@ -307,7 +328,23 @@ void IO_ClearViewBuffer()
glColor3f(1.0, 1.0, 1.0);
glColor3f(1.0, 1.0, 1.0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_DEPTH_TEST);
#else
glEnable
(
GL_DEPTH_TEST
);
glDepthRange
(
1
.
0
,
1
.
0
);
glDepthFunc
(
GL_ALWAYS
);
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
);
glColor3f
(
1
.
0
,
1
.
0
,
1
.
0
);
glDepthRange
(
0
.
0
,
1
.
0
);
glDepthFunc
(
GL_LESS
);
#endif
glPopMatrix
();
glPopMatrix
();
}
}
...
@@ -320,6 +357,8 @@ void InitRenderView()
...
@@ -320,6 +357,8 @@ void InitRenderView()
Byte
*
pal
;
Byte
*
pal
;
int
i
;
int
i
;
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
LastTexture
=
0
;
LastTexture
=
0
;
glEnable
(
GL_TEXTURE_2D
);
glEnable
(
GL_TEXTURE_2D
);
...
@@ -417,18 +456,17 @@ void InitRenderView()
...
@@ -417,18 +456,17 @@ void InitRenderView()
ReleaseAResource
(
rGamePal
);
ReleaseAResource
(
rGamePal
);
glEnable
(
GL_DEPTH_TEST
);
glEnable
(
GL_DEPTH_TEST
);
glDepthFunc
(
GL_LE
QUAL
);
glDepthFunc
(
GL_LE
SS
);
glEnable
(
GL_ALPHA_TEST
);
glEnable
(
GL_ALPHA_TEST
);
glAlphaFunc
(
GL_GREATER
,
0
.
5
);
glAlphaFunc
(
GL_GREATER
,
0
.
5
);
/* glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); */
glClearColor
(
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
);
glClearColor
(
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
);
glMatrixMode
(
GL_PROJECTION
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glLoadIdentity
();
glFrustum
(
-
0
.
20
,
0
.
20
,
-
0
.
288675
,
0
.
288675
,
0
.
2
,
182
.
0
);
xgluPerspective
(
90
.
0
,
400
.
0
/
640
.
0
,
0
.
20
,
182
.
0
);
/*
/*
glFrontFace(GL_CCW);
glFrontFace(GL_CCW);
glCullFace(GL_BACK);
glCullFace(GL_BACK);
...
@@ -470,9 +508,8 @@ void IO_AttackShape(Word shape)
...
@@ -470,9 +508,8 @@ void IO_AttackShape(Word shape)
void
StartRenderView
()
void
StartRenderView
()
{
{
glViewport
(
0
,
VidHeight
-
ViewHeight
,
VidWidth
,
ViewHeight
);
/* glViewport(0, VidHeight - ViewHeight, VidWidth, VidHeight); */
glMatrixMode
(
GL_MODELVIEW
);
glMatrixMode
(
GL_MODELVIEW
);
/* glLoadIdentity(); */
/* glLoadIdentity(); */
...
...
macsrc/Makefile
View file @
f576b52f
...
@@ -3,11 +3,8 @@ CC = gcc
...
@@ -3,11 +3,8 @@ CC = gcc
CFLAGS
=
-Wall
-O6
-fomit-frame-pointer
-ffast-math
-funroll-loops
-mpentiumpro
-mcpu
=
pentiumpro
-march
=
pentiumpro
CFLAGS
=
-Wall
-O6
-fomit-frame-pointer
-ffast-math
-funroll-loops
-mpentiumpro
-mcpu
=
pentiumpro
-march
=
pentiumpro
#CFLAGS = -g -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
#CFLAGS = -g -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
#CFLAGS = -g -Wall
CFLAGS
=
-g
-Wall
-ansi
-pedantic
#CFLAGS = -g -Wall -ansi -pedantic
#CFLAGS = -g
#CFLAGS = -Os -g
#CFLAGS = -Os -g
#CFLAGS = -g -Wall -I/home/relnev/cvs/oal/include
OBJS
=
Data.o Doors.o EnMove.o EnThink.o Intro.o Level.o
\
OBJS
=
Data.o Doors.o EnMove.o EnThink.o Intro.o Level.o
\
Missiles.o Sounds.o PlMove.o PlStuff.o PlThink.o PushWall.o
\
Missiles.o Sounds.o PlMove.o PlStuff.o PlThink.o PushWall.o
\
...
@@ -21,7 +18,6 @@ GOBJS = $(SOFTOBJS) $(OBJS) vi_gtk.o
...
@@ -21,7 +18,6 @@ GOBJS = $(SOFTOBJS) $(OBJS) vi_gtk.o
GLOBJS
=
$(OGLOBJS)
$(OBJS)
vi_glx.o
GLOBJS
=
$(OGLOBJS)
$(OBJS)
vi_glx.o
LFLAGS
=
-lm
LFLAGS
=
-lm
#LFLAGS = -lm -L/home/relnev/cvs/oal/linux/src -lopenal -lpthread -ldl
#LFLAGS = -lm /home/relnev/ElectricFence-2.1/libefence.a
#LFLAGS = -lm /home/relnev/ElectricFence-2.1/libefence.a
#LFLAGS = -lm /home/relnev/ElectricFence-2.2.2/libefence.a -lpthread
#LFLAGS = -lm /home/relnev/ElectricFence-2.2.2/libefence.a -lpthread
...
...
macsrc/TODO
View file @
f576b52f
TODO:
TODO:
* Pause key
* Pause key
- With windowed systems, put paused in the title bar?
+ Being in a text menu could be the "pause"
- This would be fine for svgalib
* SVGAlib Hack:
* SVGAlib Hack:
- If user requests a gamemode which SVGAlib says it does not support, fail
- If user requests a gamemode which SVGAlib says it does not support, fail
- Check to make sure linear addressing is supported
- Check to make sure linear addressing is supported
+
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 if only mode supported 320x200x256 (center if
with the keypad arrow keys if only mode supported 320x200x256 (center if
640x400 or 480 is supported?)
640x400 or 480 is supported?)
- Have a "force no 512 mode" for those who do not want mode changing.
- Have a "force no 512 mode" for those who do not want mode changing.
...
@@ -11,10 +14,8 @@ TODO:
...
@@ -11,10 +14,8 @@ TODO:
* Finish OpenGL
* Finish OpenGL
+ Status bars, Introscreens [DrawShape]
+ Status bars, Introscreens [DrawShape]
- Not exactly sure how I will implement this yet.
- Not exactly sure how I will implement this yet.
- Correct viewing frustum
- Allow window resizing
- Allow window resizing
- Could use the LastTexture to have less glBegin/Ends (would need to know
- Could use the LastTexture to have less glBegin/Ends.
where to stop though (try IO_DisplayViewBuffer).
- When all drawing is implemented, remove any unnecessary state/matrix
- When all drawing is implemented, remove any unnecessary state/matrix
changes.
changes.
* Save/Load Games
* Save/Load Games
...
@@ -24,11 +25,12 @@ TODO:
...
@@ -24,11 +25,12 @@ TODO:
since this source does not have any code for determining sound position).
since this source does not have any code for determining sound position).
- Check 'csnd' for a sample, then 'snd ' if not found.
- Check 'csnd' for a sample, then 'snd ' if not found.
+ Music is planned.
+ Music is planned.
- Midi support would be not hard, all that would be needed is something
- Output using timidity with sounds did not end up sounding good.
that can get the note ons and then play the notes at the right time.
Probably the INST resources are used for ASDR/looping/etc...
(the songs seem to only use note ons and the instruments correspond to
- csnd: sox -t raw -r 11025 -c 1 -w -s a.dat -r 11025 -c 1 -w -s -t wav a.wav
sample numbers, not midi instruments. If the final result does not
- snd: sox -t raw -r 11025 -c 1 -w -u a.dat -r 11025 -c 1 -w -s -t wav a.wav
sound "desirable," go with Plan B)
- csnd might be -b -s (odd)
- 11025 will probably be the best rate
* Interface
* Interface
+ Menus and dialog boxes
+ Menus and dialog boxes
+ Command line (temporary workaround for no menus).
+ Command line (temporary workaround for no menus).
...
@@ -36,8 +38,12 @@ TODO:
...
@@ -36,8 +38,12 @@ TODO:
- Difficulty
- Difficulty
- Text only menus (similar to what snes9x has).
- Text only menus (similar to what snes9x has).
* Different depths/visuals for software clients.
* Different depths/visuals for software clients.
+ Different functions to draw with different bpps.
- 15 bpp uses same draw routes as 16 but different palette one
- not sure how to do palette fades
* Get it to compile/work with g++ if it is not too much trouble.
* Get it to compile/work with g++ if it is not too much trouble.
* SDL version (software)
* SDL version (software)
* Mouse
BUGS:
BUGS:
* Software Drawing seems like its imprecise, stationary sprites move back and
* Software Drawing seems like its imprecise, stationary sprites move back and
...
...
macsrc/vi_glx.c
View file @
f576b52f
...
@@ -40,9 +40,6 @@ XVisualInfo *vi;
...
@@ -40,9 +40,6 @@ XVisualInfo *vi;
GLXContext
ctx
;
GLXContext
ctx
;
Atom
wmDeleteWindow
;
Atom
wmDeleteWindow
;
XColor
clr
[
256
];
Byte
*
gfxbuf
;
Byte
Pal
[
768
];
Byte
Pal
[
768
];
int
attrib
[]
=
{
int
attrib
[]
=
{
...
@@ -137,10 +134,11 @@ int main(int argc, char *argv[])
...
@@ -137,10 +134,11 @@ int main(int argc, char *argv[])
cmap
=
XCreateColormap
(
dpy
,
root
,
vi
->
visual
,
AllocNone
);
cmap
=
XCreateColormap
(
dpy
,
root
,
vi
->
visual
,
AllocNone
);
attr
.
colormap
=
cmap
;
attr
.
colormap
=
cmap
;
attr
.
event_mask
=
KeyPressMask
|
KeyReleaseMask
|
ExposureMask
;
attr
.
event_mask
=
KeyPressMask
|
KeyReleaseMask
|
ExposureMask
|
StructureNotifyMask
;
mask
=
CWColormap
|
CWEventMask
;
mask
=
CWColormap
|
CWEventMask
;
win
=
XCreateWindow
(
dpy
,
root
,
0
,
0
,
320
,
20
0
,
0
,
CopyFromParent
,
win
=
XCreateWindow
(
dpy
,
root
,
0
,
0
,
640
,
48
0
,
0
,
CopyFromParent
,
InputOutput
,
vi
->
visual
,
mask
,
&
attr
);
InputOutput
,
vi
->
visual
,
mask
,
&
attr
);
if
(
win
==
None
)
{
if
(
win
==
None
)
{
...
@@ -244,14 +242,10 @@ Word NewGameWindow(Word NewVidSize)
...
@@ -244,14 +242,10 @@ Word NewGameWindow(Word NewVidSize)
LongWord
*
LongPtr
;
LongWord
*
LongPtr
;
Byte
*
DestPtr
;
Byte
*
DestPtr
;
int
i
;
int
i
;
printf
(
"Called: %d
\n
"
,
NewVidSize
);
if
(
NewVidSize
==
VidSize
)
if
(
NewVidSize
==
VidSize
)
return
VidSize
;
return
VidSize
;
printf
(
"Setting Size: %d (from %d)
\n
"
,
NewVidSize
,
VidSize
);
if
(
NewVidSize
<
4
)
{
if
(
NewVidSize
<
4
)
{
w
=
VidXs
[
NewVidSize
];
w
=
VidXs
[
NewVidSize
];
h
=
VidYs
[
NewVidSize
];
h
=
VidYs
[
NewVidSize
];
...
@@ -260,19 +254,14 @@ Word NewGameWindow(Word NewVidSize)
...
@@ -260,19 +254,14 @@ Word NewGameWindow(Word NewVidSize)
fprintf
(
stderr
,
"Invalid Vid size: %d
\n
"
,
NewVidSize
);
fprintf
(
stderr
,
"Invalid Vid size: %d
\n
"
,
NewVidSize
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
sizehints
.
min_width
=
sizehints
.
max_width
=
sizehints
.
base_width
=
w
;
sizehints
.
min_width
=
w
;
sizehints
.
min_height
=
sizehints
.
max_height
=
sizehints
.
base_height
=
h
;
sizehints
.
min_height
=
h
;
sizehints
.
flags
=
PMinSize
|
PMaxSize
|
PBaseSize
;
sizehints
.
flags
=
PMinSize
;
XSetWMNormalHints
(
dpy
,
win
,
&
sizehints
);
XSetWMNormalHints
(
dpy
,
win
,
&
sizehints
);
XResizeWindow
(
dpy
,
win
,
w
,
h
);
XResizeWindow
(
dpy
,
win
,
w
,
h
);
XSync
(
dpy
,
False
);
XSync
(
dpy
,
False
);
glViewport
(
0
,
0
,
w
,
h
);
gfxbuf
=
(
Byte
*
)
malloc
(
w
*
h
);
VideoPointer
=
gfxbuf
;
VideoWidth
=
w
;
InitYTable
();
InitYTable
();
SetAPalette
(
rBlackPal
);
SetAPalette
(
rBlackPal
);
ClearTheScreen
(
BLACK
);
ClearTheScreen
(
BLACK
);
...
@@ -563,7 +552,7 @@ void keyboard_handler(KeySym keycode, int press)
...
@@ -563,7 +552,7 @@ void keyboard_handler(KeySym keycode, int press)
joystick1
|=
JOYPAD_A
;
joystick1
|=
JOYPAD_A
;
if
(
keys
[
SC_LEFTALT
])
if
(
keys
[
SC_LEFTALT
])
joystick1
|=
JOYPAD_T
L
;
joystick1
|=
JOYPAD_T
R
;
if
(
keys
[
SC_RIGHTALT
])
if
(
keys
[
SC_RIGHTALT
])
joystick1
|=
JOYPAD_TR
;
joystick1
|=
JOYPAD_TR
;
...
@@ -577,7 +566,22 @@ void keyboard_handler(KeySym keycode, int press)
...
@@ -577,7 +566,22 @@ void keyboard_handler(KeySym keycode, int press)
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
))
joystick1
&=
~
(
JOYPAD_LFT
|
JOYPAD_RGT
);
if
((
joystick1
&
(
JOYPAD_UP
|
JOYPAD_DN
))
==
(
JOYPAD_UP
|
JOYPAD_DN
))
joystick1
&=
~
(
JOYPAD_UP
|
JOYPAD_DN
);
if
(
joystick1
&
JOYPAD_TR
)
{
if
(
joystick1
&
JOYPAD_LFT
)
{
joystick1
=
(
joystick1
&
~
(
JOYPAD_TR
|
JOYPAD_LFT
))
|
JOYPAD_TL
;
}
else
if
(
joystick1
&
JOYPAD_RGT
)
{
joystick1
=
joystick1
&
~
JOYPAD_RGT
;
}
else
{
joystick1
&=
~
JOYPAD_TR
;
}
}
}
}
int
HandleEvents
()
int
HandleEvents
()
...
@@ -591,15 +595,18 @@ int HandleEvents()
...
@@ -591,15 +595,18 @@ int HandleEvents()
switch
(
event
.
type
)
{
switch
(
event
.
type
)
{
case
KeyPress
:
case
KeyPress
:
keyboard_handler
(
XKeycodeToKeysym
(
dpy
,
event
.
xkey
.
keycode
,
0
),
1
);
keyboard_handler
(
XKeycodeToKeysym
(
dpy
,
event
.
xkey
.
keycode
,
0
),
1
);
/* ret = 1; */
ret
=
1
;
break
;
break
;
case
KeyRelease
:
case
KeyRelease
:
keyboard_handler
(
XKeycodeToKeysym
(
dpy
,
event
.
xkey
.
keycode
,
0
),
0
);
keyboard_handler
(
XKeycodeToKeysym
(
dpy
,
event
.
xkey
.
keycode
,
0
),
0
);
ret
=
1
;
ret
=
0
;
break
;
break
;
case
Expose
:
case
Expose
:
BlastScreen
();
BlastScreen
();
break
;
break
;
case
ConfigureNotify
:
glViewport
(
0
,
0
,
event
.
xconfigure
.
width
,
event
.
xconfigure
.
height
);
break
;
case
ClientMessage
:
case
ClientMessage
:
if
(
event
.
xclient
.
data
.
l
[
0
]
==
wmDeleteWindow
)
if
(
event
.
xclient
.
data
.
l
[
0
]
==
wmDeleteWindow
)
Quit
(
NULL
);
Quit
(
NULL
);
...
...
macsrc/vi_gtk.c
View file @
f576b52f
...
@@ -634,7 +634,7 @@ void keyboard_handler(int keycode, int press)
...
@@ -634,7 +634,7 @@ void keyboard_handler(int keycode, int press)
joystick1
|=
JOYPAD_A
;
joystick1
|=
JOYPAD_A
;
if
(
keys
[
SC_LEFTALT
])
if
(
keys
[
SC_LEFTALT
])
joystick1
|=
JOYPAD_T
L
;
joystick1
|=
JOYPAD_T
R
;
if
(
keys
[
SC_RIGHTALT
])
if
(
keys
[
SC_RIGHTALT
])
joystick1
|=
JOYPAD_TR
;
joystick1
|=
JOYPAD_TR
;
...
@@ -648,6 +648,21 @@ void keyboard_handler(int keycode, int press)
...
@@ -648,6 +648,21 @@ void keyboard_handler(int keycode, int press)
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
))
joystick1
&=
~
(
JOYPAD_LFT
|
JOYPAD_RGT
);
if
((
joystick1
&
(
JOYPAD_UP
|
JOYPAD_DN
))
==
(
JOYPAD_UP
|
JOYPAD_DN
))
joystick1
&=
~
(
JOYPAD_UP
|
JOYPAD_DN
);
if
(
joystick1
&
JOYPAD_TR
)
{
if
(
joystick1
&
JOYPAD_LFT
)
{
joystick1
=
(
joystick1
&
~
(
JOYPAD_TR
|
JOYPAD_LFT
))
|
JOYPAD_TL
;
}
else
if
(
joystick1
&
JOYPAD_RGT
)
{
joystick1
=
joystick1
&
~
JOYPAD_RGT
;
}
else
{
joystick1
&=
~
JOYPAD_TR
;
}
}
}
}
...
...
macsrc/vi_svga.c
View file @
f576b52f
...
@@ -414,7 +414,7 @@ void keyboard_handler(int key, int press)
...
@@ -414,7 +414,7 @@ void keyboard_handler(int key, int press)
joystick1
|=
JOYPAD_A
;
joystick1
|=
JOYPAD_A
;
if
(
keys
[
SCANCODE_LEFTALT
])
if
(
keys
[
SCANCODE_LEFTALT
])
joystick1
|=
JOYPAD_T
L
;
joystick1
|=
JOYPAD_T
R
;
if
(
keys
[
SCANCODE_RIGHTALT
])
if
(
keys
[
SCANCODE_RIGHTALT
])
joystick1
|=
JOYPAD_TR
;
joystick1
|=
JOYPAD_TR
;
...
@@ -428,6 +428,21 @@ void keyboard_handler(int key, int press)
...
@@ -428,6 +428,21 @@ void keyboard_handler(int key, int press)
if
(
keys
[
SCANCODE_RIGHTSHIFT
])
if
(
keys
[
SCANCODE_RIGHTSHIFT
])
joystick1
|=
(
JOYPAD_X
|
JOYPAD_Y
);
joystick1
|=
(
JOYPAD_X
|
JOYPAD_Y
);
}
}
if
((
joystick1
&
(
JOYPAD_LFT
|
JOYPAD_RGT
))
==
(
JOYPAD_LFT
|
JOYPAD_RGT
))
joystick1
&=
~
(
JOYPAD_LFT
|
JOYPAD_RGT
);
if
((
joystick1
&
(
JOYPAD_UP
|
JOYPAD_DN
))
==
(
JOYPAD_UP
|
JOYPAD_DN
))
joystick1
&=
~
(
JOYPAD_UP
|
JOYPAD_DN
);
if
(
joystick1
&
JOYPAD_TR
)
{
if
(
joystick1
&
JOYPAD_LFT
)
{
joystick1
=
(
joystick1
&
~
(
JOYPAD_TR
|
JOYPAD_LFT
))
|
JOYPAD_TL
;
}
else
if
(
joystick1
&
JOYPAD_RGT
)
{
joystick1
=
joystick1
&
~
JOYPAD_RGT
;
}
else
{
joystick1
&=
~
JOYPAD_TR
;
}
}
}
}
...
...
macsrc/vi_xlib.c
View file @
f576b52f
...
@@ -521,7 +521,7 @@ void keyboard_handler(KeySym keycode, int press)
...
@@ -521,7 +521,7 @@ void keyboard_handler(KeySym keycode, int press)
joystick1
|=
JOYPAD_A
;
joystick1
|=
JOYPAD_A
;
if
(
keys
[
SC_LEFTALT
])
if
(
keys
[
SC_LEFTALT
])
joystick1
|=
JOYPAD_T
L
;
joystick1
|=
JOYPAD_T
R
;
if
(
keys
[
SC_RIGHTALT
])
if
(
keys
[
SC_RIGHTALT
])
joystick1
|=
JOYPAD_TR
;
joystick1
|=
JOYPAD_TR
;
...
@@ -535,6 +535,21 @@ void keyboard_handler(KeySym keycode, int press)
...
@@ -535,6 +535,21 @@ void keyboard_handler(KeySym keycode, int press)
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
))
joystick1
&=
~
(
JOYPAD_LFT
|
JOYPAD_RGT
);
if
((
joystick1
&
(
JOYPAD_UP
|
JOYPAD_DN
))
==
(
JOYPAD_UP
|
JOYPAD_DN
))
joystick1
&=
~
(
JOYPAD_UP
|
JOYPAD_DN
);
if
(
joystick1
&
JOYPAD_TR
)
{
if
(
joystick1
&
JOYPAD_LFT
)
{
joystick1
=
(
joystick1
&
~
(
JOYPAD_TR
|
JOYPAD_LFT
))
|
JOYPAD_TL
;
}
else
if
(
joystick1
&
JOYPAD_RGT
)
{
joystick1
=
joystick1
&
~
JOYPAD_RGT
;
}
else
{
joystick1
&=
~
JOYPAD_TR
;
}
}
}
}
...
@@ -549,11 +564,11 @@ int HandleEvents()
...
@@ -549,11 +564,11 @@ int HandleEvents()
switch
(
event
.
type
)
{
switch
(
event
.
type
)
{
case
KeyPress
:
case
KeyPress
:
keyboard_handler
(
XKeycodeToKeysym
(
dpy
,
event
.
xkey
.
keycode
,
0
),
1
);
keyboard_handler
(
XKeycodeToKeysym
(
dpy
,
event
.
xkey
.
keycode
,
0
),
1
);
/* ret = 1; */
ret
=
1
;
break
;
break
;
case
KeyRelease
:
case
KeyRelease
:
keyboard_handler
(
XKeycodeToKeysym
(
dpy
,
event
.
xkey
.
keycode
,
0
),
0
);
keyboard_handler
(
XKeycodeToKeysym
(
dpy
,
event
.
xkey
.
keycode
,
0
),
0
);
ret
=
1
;
ret
=
0
;
break
;
break
;
case
Expose
:
case
Expose
:
BlastScreen
();
BlastScreen
();
...
...
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