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
1df33246
Commit
1df33246
authored
Jul 23, 2001
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renabled gtk+ build.
Fixed colormap problem with gtk+ version.
parent
bc2f1b59
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
68 deletions
+137
-68
Makefile
macsrc/Makefile
+1
-1
TODO
macsrc/TODO
+42
-1
vi_gtk.c
macsrc/vi_gtk.c
+94
-66
No files found.
macsrc/Makefile
View file @
1df33246
...
@@ -35,7 +35,7 @@ NASM = nasm
...
@@ -35,7 +35,7 @@ NASM = nasm
.SUFFIXES
:
.asm
.SUFFIXES
:
.asm
all
:
swolf3d xwolf3d glwolf3d sdlwolf3d
all
:
swolf3d xwolf3d g
wolf3d g
lwolf3d sdlwolf3d
$(SOBJS)
:
Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h
$(SOBJS)
:
Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h
$(XOBJS)
:
Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h
$(XOBJS)
:
Sounds.h Sprites.h States.h Wolf.h burger.h wolfdef.h
...
...
macsrc/TODO
View file @
1df33246
complete:
07/22/01 disable escape
07/22/01 fix cmap problem at 8bit (Want to change cmaps when going into/from gtk+ menu)
------------------
New Game
Save Game, Load Game
find keyboard way of changing focus
fix sprite snapping
all visuals (loader and drawer code will need to be modified)
check bigendianesss
choose difficulty (with graphics from game if possible)
Psyched bar
pause key
About Box
Detect Shareware version, End Game box (Sharware/Retail)
add better error checking for invalid file in res.c
select resolution to use
make sure all needed keys work
mouse support
sound (/dev/dsp?)
music (what format?, mp3 - there's smpeg?)
options file
input config
.wolf3d/{macfull,macshare} ?
command line options
verify other todo lists are also complete
check bigendianesss
play through testing
Documentation
--------- release one anytime after this point ---------
SDL support (for full screen), optional
configure (automake, autoconf, etc?)
website (no sourceforge this time)
finish opengl version
in game menus instead of gtk+ gui
TODO:
TODO:
* See TODO in src/TODO
* See TODO in src/TODO
* FX_GLIDE_SWAPINTERVAL=0 is needed for me to prevent jerkyness
* FX_GLIDE_SWAPINTERVAL=0 is needed to prevent jerkyness (for me)
* Finish up gtk+ version and put out a release!
- Menu
- Handle all possible 8 bit Pseudo and Direct/TrueColor visuals
- Sound
- Music?
* Pause key
* Pause key
- With windowed systems, put paused in the title bar?
- With windowed systems, put paused in the title bar?
...
...
macsrc/vi_gtk.c
View file @
1df33246
...
@@ -39,11 +39,9 @@ GtkWidget *event_box;
...
@@ -39,11 +39,9 @@ GtkWidget *event_box;
GdkVisual
*
visual
;
GdkVisual
*
visual
;
GdkImage
*
image
;
GdkImage
*
image
;
GtkImage
*
image_area
;
GtkImage
*
image_area
;
GdkColormap
*
cmap
;
GdkColormap
*
cmapo
;
GdkColormap
*
cmap
;
GdkColor
colors
[
256
];
GdkColor
game_colors
[
256
],
default_colors
[
256
];
GdkColor
coloro
[
256
];
int
image_focus
=
1
;
int
image_focus
=
1
;
...
@@ -68,21 +66,23 @@ static void menu_quit(GtkWidget *w, gpointer data)
...
@@ -68,21 +66,23 @@ static void menu_quit(GtkWidget *w, gpointer data)
void
RestoreColors
()
void
RestoreColors
()
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
cmapo
->
size
;
i
++
)
gdk_color_change
(
cmap
,
&
cmapo
->
colors
[
i
]);
for
(
i
=
0
;
i
<
cmap
->
size
;
i
++
)
gdk_color_change
(
cmap
,
&
default_colors
[
i
]);
}
}
void
UpdateColors
()
void
UpdateColors
()
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
cmap
->
size
;
i
++
)
for
(
i
=
0
;
i
<
cmap
->
size
;
i
++
)
gdk_color_change
(
cmap
,
&
colors
[
i
]);
gdk_color_change
(
cmap
,
&
game_
colors
[
i
]);
}
}
static
void
image_focus_in
(
GtkWidget
*
widget
,
GdkEventButton
*
event
,
gpointer
data
)
static
void
image_focus_in
(
GtkWidget
*
widget
,
GdkEventButton
*
event
,
gpointer
data
)
{
{
UpdateColors
();
UpdateColors
();
image_focus
=
1
;
image_focus
=
1
;
}
}
...
@@ -128,7 +128,9 @@ static GtkItemFactoryEntry menu_items[] = {
...
@@ -128,7 +128,9 @@ static GtkItemFactoryEntry menu_items[] = {
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
int
i
;
int
i
;
gboolean
success
[
256
];
GdkColormap
*
cmapo
;
if
(
argc
!=
2
)
{
if
(
argc
!=
2
)
{
fprintf
(
stderr
,
"usage: %s <mac wolf3d resource fork>
\n
"
,
argv
[
0
]);
fprintf
(
stderr
,
"usage: %s <mac wolf3d resource fork>
\n
"
,
argv
[
0
]);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
...
@@ -140,33 +142,42 @@ int main(int argc, char *argv[])
...
@@ -140,33 +142,42 @@ int main(int argc, char *argv[])
}
}
gtk_init
(
&
argc
,
&
argv
);
gtk_init
(
&
argc
,
&
argv
);
/* visual = gdk_visual_get_best_with_depth(8); */
/* Get our visual and colormap, and create the main window with them */
visual
=
gdk_visual_get_best_with_both
(
8
,
GDK_VISUAL_PSEUDO_COLOR
);
visual
=
gdk_visual_get_best_with_both
(
8
,
GDK_VISUAL_PSEUDO_COLOR
);
if
(
visual
==
NULL
)
{
if
(
visual
==
NULL
)
{
fprintf
(
stderr
,
"Unable to get a 8 bpp visual
\n
"
);
fprintf
(
stderr
,
"Unable to get a 8 bpp visual
\n
"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
/* I forget what this was for ... */
/* gtk_widget_set_default_visual(visual); */
cmapo
=
gdk_colormap_get_system
();
cmap
=
gdk_colormap_new
(
visual
,
TRUE
);
cmap
=
gdk_colormap_new
(
visual
,
TRUE
);
for
(
i
=
0
;
i
<
256
;
i
++
)
colors
[
i
].
pixel
=
i
;
gtk_widget_set_default_colormap
(
cmap
);
RestoreColors
();
win
=
gtk_window_new
(
GTK_WINDOW_TOPLEVEL
);
win
=
gtk_window_new
(
GTK_WINDOW_TOPLEVEL
);
cmapo
=
gtk_widget_get_colormap
(
GTK_WIDGET
(
win
));
for
(
i
=
0
;
i
<
256
;
i
++
)
{
game_colors
[
i
].
pixel
=
i
;
default_colors
[
i
].
pixel
=
i
;
}
for
(
i
=
0
;
i
<
cmapo
->
size
;
i
++
)
default_colors
[
i
]
=
cmapo
->
colors
[
i
];
gdk_colormap_alloc_colors
(
cmap
,
default_colors
,
cmapo
->
size
,
TRUE
,
TRUE
,
success
);
gtk_widget_set_visual
(
GTK_WIDGET
(
win
),
visual
);
gtk_widget_set_colormap
(
GTK_WIDGET
(
win
),
cmap
);
/* Disable user resizing */
gtk_window_set_policy
(
GTK_WINDOW
(
win
),
FALSE
,
FALSE
,
TRUE
);
gtk_window_set_policy
(
GTK_WINDOW
(
win
),
FALSE
,
FALSE
,
TRUE
);
gtk_window_set_title
(
GTK_WINDOW
(
win
),
"Wolfenstein 3D"
);
gtk_window_set_title
(
GTK_WINDOW
(
win
),
"Wolfenstein 3D"
);
/* Setup Main Window event signals */
gtk_signal_connect
(
GTK_OBJECT
(
win
),
"delete_event"
,
GTK_SIGNAL_FUNC
(
delete_event
),
NULL
);
gtk_signal_connect
(
GTK_OBJECT
(
win
),
"delete_event"
,
GTK_SIGNAL_FUNC
(
delete_event
),
NULL
);
gtk_signal_connect
(
GTK_OBJECT
(
win
),
"destroy"
,
GTK_SIGNAL_FUNC
(
destroy
),
NULL
);
gtk_signal_connect
(
GTK_OBJECT
(
win
),
"destroy"
,
GTK_SIGNAL_FUNC
(
destroy
),
NULL
);
...
@@ -174,13 +185,17 @@ int main(int argc, char *argv[])
...
@@ -174,13 +185,17 @@ int main(int argc, char *argv[])
gtk_signal_connect
(
GTK_OBJECT
(
win
),
"key_release_event"
,
GTK_SIGNAL_FUNC
(
key_release
),
NULL
);
gtk_signal_connect
(
GTK_OBJECT
(
win
),
"key_release_event"
,
GTK_SIGNAL_FUNC
(
key_release
),
NULL
);
gtk_widget_set_events
(
GTK_WIDGET
(
win
),
GDK_EXPOSURE_MASK
|
GDK_KEY_PRESS_MASK
|
GDK_KEY_RELEASE_MASK
);
gtk_widget_set_events
(
GTK_WIDGET
(
win
),
GDK_EXPOSURE_MASK
|
GDK_KEY_PRESS_MASK
|
GDK_KEY_RELEASE_MASK
);
/* Create vbox for menu and image */
main_vbox
=
gtk_vbox_new
(
FALSE
,
1
);
main_vbox
=
gtk_vbox_new
(
FALSE
,
1
);
gtk_container_border_width
(
GTK_CONTAINER
(
main_vbox
),
1
);
gtk_container_border_width
(
GTK_CONTAINER
(
main_vbox
),
1
);
gtk_container_add
(
GTK_CONTAINER
(
win
),
main_vbox
);
gtk_container_add
(
GTK_CONTAINER
(
win
),
main_vbox
);
gtk_widget_show
(
main_vbox
);
gtk_widget_show
(
main_vbox
);
/* Create Menu */
accel_group
=
gtk_accel_group_new
();
accel_group
=
gtk_accel_group_new
();
item_factory
=
gtk_item_factory_new
(
GTK_TYPE_MENU_BAR
,
"<main>"
,
accel_group
);
item_factory
=
gtk_item_factory_new
(
GTK_TYPE_MENU_BAR
,
"<main>"
,
accel_group
);
gtk_item_factory_create_items
(
item_factory
,
sizeof
(
menu_items
)
/
sizeof
(
menu_items
[
0
]),
menu_items
,
NULL
);
gtk_item_factory_create_items
(
item_factory
,
sizeof
(
menu_items
)
/
sizeof
(
menu_items
[
0
]),
menu_items
,
NULL
);
...
@@ -191,30 +206,37 @@ int main(int argc, char *argv[])
...
@@ -191,30 +206,37 @@ int main(int argc, char *argv[])
gtk_box_pack_start
(
GTK_BOX
(
main_vbox
),
menubar
,
FALSE
,
TRUE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
main_vbox
),
menubar
,
FALSE
,
TRUE
,
0
);
gtk_widget_show
(
menubar
);
gtk_widget_show
(
menubar
);
/* Create image and image area */
image
=
gdk_image_new
(
GDK_IMAGE_FASTEST
,
visual
,
320
,
200
);
image
=
gdk_image_new
(
GDK_IMAGE_FASTEST
,
visual
,
320
,
200
);
image_area
=
(
GtkImage
*
)
gtk_image_new
(
image
,
NULL
);
image_area
=
(
GtkImage
*
)
gtk_image_new
(
image
,
NULL
);
gtk_signal_connect
(
GTK_OBJECT
(
image_area
),
"draw"
,
GTK_SIGNAL_FUNC
(
draw
),
NULL
);
gtk_signal_connect
(
GTK_OBJECT
(
image_area
),
"draw"
,
GTK_SIGNAL_FUNC
(
draw
),
NULL
);
gtk_signal_connect
(
GTK_OBJECT
(
image_area
),
"draw_default"
,
GTK_SIGNAL_FUNC
(
draw_default
),
NULL
);
gtk_signal_connect
(
GTK_OBJECT
(
image_area
),
"draw_default"
,
GTK_SIGNAL_FUNC
(
draw_default
),
NULL
);
/* Create event box for image area */
event_box
=
gtk_event_box_new
();
event_box
=
gtk_event_box_new
();
gtk_container_add
(
GTK_CONTAINER
(
main_vbox
),
event_box
);
gtk_container_add
(
GTK_CONTAINER
(
main_vbox
),
event_box
);
gtk_widget_show
(
event_box
);
gtk_widget_show
(
event_box
);
gtk_container_add
(
GTK_CONTAINER
(
event_box
),
GTK_WIDGET
(
image_area
));
gtk_container_add
(
GTK_CONTAINER
(
event_box
),
GTK_WIDGET
(
image_area
));
gtk_widget_show
(
GTK_WIDGET
(
image_area
));
gtk_widget_show
(
GTK_WIDGET
(
image_area
));
/* Setup focus changing for colormaps */
gtk_widget_set_events
(
GTK_WIDGET
(
event_box
),
GDK_BUTTON_PRESS_MASK
);
gtk_widget_set_events
(
GTK_WIDGET
(
event_box
),
GDK_BUTTON_PRESS_MASK
);
gtk_signal_connect
(
GTK_OBJECT
(
event_box
),
"button_press_event"
,
GTK_SIGNAL_FUNC
(
image_focus_in
),
NULL
);
gtk_signal_connect
(
GTK_OBJECT
(
event_box
),
"button_press_event"
,
GTK_SIGNAL_FUNC
(
image_focus_in
),
NULL
);
gtk_signal_connect
(
GTK_OBJECT
(
menubar
),
"button_press_event"
,
GTK_SIGNAL_FUNC
(
image_focus_out
),
NULL
);
gtk_signal_connect
(
GTK_OBJECT
(
menubar
),
"button_press_event"
,
GTK_SIGNAL_FUNC
(
image_focus_out
),
NULL
);
gtk_widget_realize
(
event_box
);
/* Show Main Window */
gtk_widget_show
(
win
);
/* UpdateColors(); */
gtk_widget_show
(
win
);
/* Game-related initialization */
InitData
();
InitData
();
GameViewSize
=
0
;
GameViewSize
=
0
;
...
@@ -222,18 +244,21 @@ int main(int argc, char *argv[])
...
@@ -222,18 +244,21 @@ int main(int argc, char *argv[])
ClearTheScreen
(
BLACK
);
ClearTheScreen
(
BLACK
);
BlastScreen
();
BlastScreen
();
/* Run the game */
return
WolfMain
(
argc
,
argv
);
return
WolfMain
(
argc
,
argv
);
}
}
void
Quit
(
char
*
str
)
void
Quit
(
char
*
str
)
{
{
FreeResources
();
FreeResources
();
/*
#ifdef SLOWDRAW
if
(
gfxbuf
)
if
(
gfxbuf
)
free
(
gfxbuf
);
free
(
gfxbuf
);
*/
#endif
if
(
image
)
if
(
image
)
gdk_image_destroy
(
image
);
gdk_image_destroy
(
image
);
...
@@ -250,10 +275,10 @@ void SetPalette(Byte *pal)
...
@@ -250,10 +275,10 @@ void SetPalette(Byte *pal)
int
i
;
int
i
;
for
(
i
=
0
;
i
<
256
;
i
++
)
{
for
(
i
=
0
;
i
<
256
;
i
++
)
{
colors
[
i
].
red
=
pal
[
i
*
3
+
0
]
<<
8
;
game_
colors
[
i
].
red
=
pal
[
i
*
3
+
0
]
<<
8
;
colors
[
i
].
green
=
pal
[
i
*
3
+
1
]
<<
8
;
game_
colors
[
i
].
green
=
pal
[
i
*
3
+
1
]
<<
8
;
colors
[
i
].
blue
=
pal
[
i
*
3
+
2
]
<<
8
;
game_
colors
[
i
].
blue
=
pal
[
i
*
3
+
2
]
<<
8
;
if
(
image_focus
)
gdk_color_change
(
cmap
,
&
colors
[
i
]);
if
(
image_focus
)
gdk_color_change
(
cmap
,
&
game_
colors
[
i
]);
}
}
}
}
...
@@ -264,41 +289,45 @@ int VidWidth, VidHeight, ViewHeight;
...
@@ -264,41 +289,45 @@ int VidWidth, VidHeight, ViewHeight;
void
BlastScreen2
(
Rect
*
BlastRect
)
void
BlastScreen2
(
Rect
*
BlastRect
)
{
{
/* BlastScreen(); */
GdkRectangle
r
;
GdkRectangle
r
;
/*
int x;
char *ptrs, *ptrd;
*/
r
.
x
=
BlastRect
->
left
;
r
.
x
=
BlastRect
->
left
;
r
.
y
=
BlastRect
->
top
;
r
.
y
=
BlastRect
->
top
;
r
.
width
=
BlastRect
->
right
-
BlastRect
->
left
;
r
.
width
=
BlastRect
->
right
-
BlastRect
->
left
;
r
.
height
=
BlastRect
->
bottom
-
BlastRect
->
top
;
r
.
height
=
BlastRect
->
bottom
-
BlastRect
->
top
;
#ifdef SLOWDRAW
#if 1
memcpy
(
image
->
mem
,
gfxbuf
,
w
*
h
);
memcpy
(
image
->
mem
,
gfxbuf
,
w
*
h
);
#else
/*
/*
int x;
char *ptrs, *ptrd;
ptrs = gfxbuf + (w * r.y) + r.x;
ptrs = gfxbuf + (w * r.y) + r.x;
ptrd = image->mem;
ptrd = image->mem;
ptrd += (
w * r.y) + r.x
;
ptrd += (
image->bpl * r.y) + r.x * image->bpp
;
for (x = 0; x < r.height; x++) {
for (x = 0; x < r.height; x++) {
memcpy(ptrd, ptrs, r.width);
memcpy(ptrd, ptrs, r.width
* image->bpp
);
ptrs += w;
ptrs += w;
ptrd +=
w
;
ptrd +=
image->bpl
;
}
}
*/
*/
#endif
#endif
gtk_widget_draw
(
GTK_WIDGET
(
image_area
),
&
r
);
gtk_widget_draw
(
GTK_WIDGET
(
image_area
),
&
r
);
}
}
void
BlastScreen
()
void
BlastScreen
()
{
{
#ifdef SLOWDRAW
memcpy
(
image
->
mem
,
gfxbuf
,
w
*
h
);
memcpy
(
image
->
mem
,
gfxbuf
,
w
*
h
);
#endif
gtk_widget_draw
(
GTK_WIDGET
(
image_area
),
NULL
);
gtk_widget_draw
(
GTK_WIDGET
(
image_area
),
NULL
);
/*
gtk_widget_draw_default(GTK_WIDGET(image_area));
gtk_widget_draw(GTK_WIDGET(image_area), NULL);
*/
}
}
Word
VidXs
[]
=
{
320
,
512
,
640
,
640
};
/* Screen sizes to play with */
Word
VidXs
[]
=
{
320
,
512
,
640
,
640
};
/* Screen sizes to play with */
...
@@ -336,15 +365,16 @@ Word NewGameWindow(Word NewVidSize)
...
@@ -336,15 +365,16 @@ Word NewGameWindow(Word NewVidSize)
image
=
gdk_image_new
(
GDK_IMAGE_FASTEST
,
visual
,
w
,
h
);
image
=
gdk_image_new
(
GDK_IMAGE_FASTEST
,
visual
,
w
,
h
);
gtk_image_set
(
image_area
,
image
,
NULL
);
gtk_image_set
(
image_area
,
image
,
NULL
);
/*
gtk_widget_set_usize(GTK_WIDGET(win), w, h);
*/
/*
Main window will autoshrink
*/
gtk_widget_set_usize
(
GTK_WIDGET
(
image_area
),
w
,
h
);
gtk_widget_set_usize
(
GTK_WIDGET
(
image_area
),
w
,
h
);
#ifdef SLOWDRAW
if
(
gfxbuf
)
if
(
gfxbuf
)
free
(
gfxbuf
);
free
(
gfxbuf
);
gfxbuf
=
malloc
(
w
*
h
);
gfxbuf
=
malloc
(
w
*
h
);
#else
/* gfxbuf = image->mem; */
gfxbuf
=
image
->
mem
;
#endif
VideoPointer
=
gfxbuf
;
VideoPointer
=
gfxbuf
;
VideoWidth
=
w
;
VideoWidth
=
w
;
...
@@ -600,9 +630,7 @@ void keyboard_handler(int keycode, int press)
...
@@ -600,9 +630,7 @@ void keyboard_handler(int keycode, int press)
case
GDK_slash
:
case
GDK_slash
:
joystick1
=
JOYPAD_START
;
joystick1
=
JOYPAD_START
;
break
;
break
;
case
GDK_Escape
:
}
Quit
(
NULL
);
/* fast way out */
}
}
}
if
(
keys
[
SC_CURSORUPLEFT
])
if
(
keys
[
SC_CURSORUPLEFT
])
...
...
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