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
31fb323b
Commit
31fb323b
authored
Jun 17, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Some cleanups
* Save/Load
parent
da45c877
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
164 additions
and
25 deletions
+164
-25
Burger.c
macsrc/Burger.c
+1
-3
Doors.c
macsrc/Doors.c
+0
-1
InterMis.c
macsrc/InterMis.c
+0
-2
Intro.c
macsrc/Intro.c
+1
-1
Level.c
macsrc/Level.c
+0
-1
Main.c
macsrc/Main.c
+1
-4
RefSprite.c
macsrc/RefSprite.c
+0
-1
Refresh.c
macsrc/Refresh.c
+1
-2
Refresh2.c
macsrc/Refresh2.c
+0
-1
SaveLoad.c
macsrc/SaveLoad.c
+134
-2
SoftDraw.c
macsrc/SoftDraw.c
+1
-1
SoftDraw2.c
macsrc/SoftDraw2.c
+1
-1
TODO
macsrc/TODO
+3
-3
vi_glx.c
macsrc/vi_glx.c
+19
-2
wolfdef.h
macsrc/wolfdef.h
+2
-0
No files found.
macsrc/Burger.c
View file @
31fb323b
...
...
@@ -17,10 +17,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "wolfdef.h"
/* Get the prototypes */
#include <stdio.h>
#include <stdlib.h>
#include
<string.h>
#include
"wolfdef.h"
#define BRGR 0x42524752
...
...
macsrc/Doors.c
View file @
31fb323b
...
...
@@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "wolfdef.h"
#include <string.h>
/**********************************
...
...
macsrc/InterMis.c
View file @
31fb323b
...
...
@@ -18,8 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "wolfdef.h"
#include <string.h>
#include <stdlib.h>
extern
Word
NumberIndex
;
/* Hack for drawing numbers */
static
LongWord
BJTime
;
/* Time to draw BJ? */
...
...
macsrc/Intro.c
View file @
31fb323b
...
...
@@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "wolfdef.h"
#include <ctype.h>
#include "wolfdef.h"
/**********************************
...
...
macsrc/Level.c
View file @
31fb323b
...
...
@@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "wolfdef.h"
#include <string.h>
/* static object info*/
...
...
macsrc/Main.c
View file @
31fb323b
...
...
@@ -17,11 +17,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "wolfdef.h"
#include <string.h>
#include <stdlib.h>
#include <setjmp.h>
#include
<ctype.h>
#include
"wolfdef.h"
/**********************************
...
...
macsrc/RefSprite.c
View file @
31fb323b
...
...
@@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "wolfdef.h"
#include <string.h>
Word
*
src1
,
*
src2
,
*
dest
;
/* Used by the sort */
...
...
macsrc/Refresh.c
View file @
31fb323b
...
...
@@ -17,9 +17,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "wolfdef.h"
#include <string.h>
#include <math.h>
#include "wolfdef.h"
#define DOORPIC 59
...
...
macsrc/Refresh2.c
View file @
31fb323b
...
...
@@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "wolfdef.h"
#include <stdlib.h>
Word
MathSize
;
/* What size of math data is calculated? */
Word
*
scaleatzptr
;
/* Pointer to the scale table for z projection */
...
...
macsrc/SaveLoad.c
View file @
31fb323b
...
...
@@ -18,6 +18,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "wolfdef.h"
/*
...
...
@@ -44,21 +48,149 @@ unsigned long lMSB(unsigned long x)
/*
Save and load save games
These functions must be updated if the saved structures are ever changed!
*/
static
char
id1
[
4
]
=
"WOLF"
;
static
char
id2
[
4
]
=
"SAVE"
;
static
char
id3
[
4
]
=
"LV00"
;
static
char
id4
[
4
]
=
"0000"
;
Boolean
SaveGame
(
char
*
file
)
{
FILE
*
fp
;
Word
PWallWord
;
fp
=
fopen
(
file
,
"wb"
);
if
(
fp
==
NULL
)
goto
fail
;
fwrite
(
id1
,
1
,
sizeof
(
id1
),
fp
);
fwrite
(
id2
,
1
,
sizeof
(
id2
),
fp
);
fwrite
(
id3
,
1
,
sizeof
(
id3
),
fp
);
fwrite
(
id4
,
1
,
sizeof
(
id4
),
fp
);
fwrite
(
&
MapListPtr
->
MaxMap
,
1
,
sizeof
(
MapListPtr
->
MaxMap
),
fp
);
fwrite
(
&
gamestate
,
1
,
sizeof
(
gamestate
),
fp
);
fwrite
(
&
PushWallRec
,
1
,
sizeof
(
PushWallRec
),
fp
);
fwrite
(
&
nummissiles
,
1
,
sizeof
(
nummissiles
),
fp
);
if
(
nummissiles
)
fwrite
(
missiles
,
1
,
nummissiles
*
sizeof
(
missile_t
),
fp
);
fwrite
(
&
numactors
,
1
,
sizeof
(
numactors
),
fp
);
if
(
numactors
)
fwrite
(
actors
,
1
,
numactors
*
sizeof
(
actor_t
),
fp
);
fwrite
(
&
numdoors
,
1
,
sizeof
(
numdoors
),
fp
);
if
(
numdoors
)
fwrite
(
doors
,
1
,
numdoors
*
sizeof
(
door_t
),
fp
);
fwrite
(
&
numstatics
,
1
,
sizeof
(
numstatics
),
fp
);
if
(
numstatics
)
fwrite
(
statics
,
1
,
numstatics
*
sizeof
(
static_t
),
fp
);
fwrite
(
MapPtr
,
1
,
64
*
64
,
fp
);
fwrite
(
&
tilemap
,
1
,
sizeof
(
tilemap
),
fp
);
fwrite
(
&
ConnectCount
,
1
,
sizeof
(
ConnectCount
),
fp
);
if
(
ConnectCount
)
fwrite
(
areaconnect
,
1
,
ConnectCount
*
sizeof
(
connect_t
),
fp
);
fwrite
(
areabyplayer
,
1
,
sizeof
(
areabyplayer
),
fp
);
fwrite
(
textures
,
1
,
(
128
+
5
)
*
64
,
fp
);
PWallWord
=
0
;
if
(
pwallseg
)
PWallWord
=
(
pwallseg
-
(
saveseg_t
*
)
nodes
)
+
1
;
fwrite
(
&
PWallWord
,
1
,
sizeof
(
PWallWord
),
fp
);
fwrite
(
nodes
,
1
,
MapPtr
->
numnodes
*
sizeof
(
savenode_t
),
fp
);
fclose
(
fp
);
return
TRUE
;
fail:
if
(
fp
)
fclose
(
fp
);
return
FALSE
;
}
FILE
*
lfp
;
Boolean
LoadGame
(
char
*
file
)
{
FILE
*
fp
;
unsigned
short
maxmap
;
char
tmp
[
4
];
fp
=
fopen
(
file
,
"rb"
);
if
(
fp
==
NULL
)
goto
fail
;
fread
(
tmp
,
1
,
4
,
fp
);
if
(
strncmp
(
tmp
,
id1
,
4
))
goto
fail
;
fread
(
tmp
,
1
,
4
,
fp
);
if
(
strncmp
(
tmp
,
id2
,
4
))
goto
fail
;
fread
(
tmp
,
1
,
4
,
fp
);
if
(
strncmp
(
tmp
,
id3
,
4
))
goto
fail
;
fread
(
tmp
,
1
,
4
,
fp
);
if
(
strncmp
(
tmp
,
id4
,
4
))
goto
fail
;
fread
(
&
maxmap
,
1
,
sizeof
(
MapListPtr
->
MaxMap
),
fp
);
if
(
MapListPtr
->
MaxMap
!=
maxmap
)
goto
fail
;
fread
(
&
gamestate
,
1
,
sizeof
(
gamestate
),
fp
);
lfp
=
fp
;
return
TRUE
;
fail:
if
(
fp
)
fclose
(
fp
);
return
FALSE
;
}
void
FinishLoadGame
(
void
)
void
FinishLoadGame
()
{
Word
PWallWord
;
if
(
lfp
==
NULL
)
Quit
(
"FinishLoadGame called without handle!"
);
fseek
(
lfp
,
-
sizeof
(
gamestate
),
SEEK_CUR
);
fread
(
&
gamestate
,
1
,
sizeof
(
gamestate
),
lfp
);
fread
(
&
PushWallRec
,
1
,
sizeof
(
PushWallRec
),
lfp
);
fread
(
&
nummissiles
,
1
,
sizeof
(
nummissiles
),
lfp
);
if
(
nummissiles
)
fread
(
missiles
,
1
,
nummissiles
*
sizeof
(
missile_t
),
lfp
);
fread
(
&
numactors
,
1
,
sizeof
(
numactors
),
lfp
);
if
(
numactors
)
fread
(
actors
,
1
,
numactors
*
sizeof
(
actor_t
),
lfp
);
fread
(
&
numdoors
,
1
,
sizeof
(
numdoors
),
lfp
);
if
(
numdoors
)
fread
(
doors
,
1
,
numdoors
*
sizeof
(
door_t
),
lfp
);
fread
(
&
numstatics
,
1
,
sizeof
(
numstatics
),
lfp
);
if
(
numstatics
)
fread
(
statics
,
1
,
numstatics
*
sizeof
(
static_t
),
lfp
);
fread
(
MapPtr
,
1
,
64
*
64
,
lfp
);
fread
(
&
tilemap
,
1
,
sizeof
(
tilemap
),
lfp
);
fread
(
&
ConnectCount
,
1
,
sizeof
(
ConnectCount
),
lfp
);
if
(
ConnectCount
)
fread
(
areaconnect
,
1
,
ConnectCount
*
sizeof
(
connect_t
),
lfp
);
fread
(
areabyplayer
,
1
,
sizeof
(
areabyplayer
),
lfp
);
fread
(
textures
,
1
,
(
128
+
5
)
*
64
,
lfp
);
PWallWord
=
0
;
fread
(
&
PWallWord
,
1
,
sizeof
(
PWallWord
),
lfp
);
if
(
PWallWord
)
{
pwallseg
=
(
saveseg_t
*
)
nodes
;
pwallseg
=
&
pwallseg
[
PWallWord
-
1
];
}
fread
(
nodes
,
1
,
MapPtr
->
numnodes
*
sizeof
(
savenode_t
),
lfp
);
fclose
(
lfp
);
lfp
=
NULL
;
}
/*
...
...
macsrc/SoftDraw.c
View file @
31fb323b
...
...
@@ -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
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
along with this program; if not, write to the Free Software
...
...
macsrc/SoftDraw2.c
View file @
31fb323b
...
...
@@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "wolfdef.h"
#include <string.h>
#include "wolfdef.h"
/**********************************
...
...
macsrc/TODO
View file @
31fb323b
...
...
@@ -23,9 +23,9 @@ TODO:
- Is GL_REPLACE faster than GL_MODULATE for textures?
- Save "draw state" so redrawing works right when screen is
resized/exposed
* Save/Load Games
- Menu code does not exist yet -- so just have a compiled in default save
and load files
- What about using CVAs for the Walls - when loading level create a
CVA with every wall entry, then just reference the right one (go by BSP
number)
* Documentation
* Sound!
- Need to write sound playing code (probably access /dev/dsp directly
...
...
macsrc/vi_glx.c
View file @
31fb323b
...
...
@@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdlib.h>
#include <ctype.h>
#include <getopt.h>
#include <setjmp.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
...
...
@@ -40,8 +41,6 @@ XVisualInfo *vi;
GLXContext
ctx
;
Atom
wmDeleteWindow
;
int
VidWidth
,
VidHeight
,
ViewHeight
;
#ifdef GL_EXT_shared_texture_palette
extern
int
UseSharedTexturePalette
;
extern
PFNGLCOLORTABLEEXTPROC
pglColorTableEXT
;
...
...
@@ -49,8 +48,13 @@ extern PFNGLCOLORTABLEEXTPROC pglColorTableEXT;
extern
int
CheckToken
(
const
char
*
str
,
const
char
*
item
);
int
VidWidth
,
VidHeight
,
ViewHeight
;
int
HandleEvents
();
extern
jmp_buf
ResetJmp
;
extern
Boolean
JumpOK
;
int
attrib
[]
=
{
GLX_RGBA
,
GLX_RED_SIZE
,
5
,
...
...
@@ -424,6 +428,19 @@ void keyboard_handler(KeySym keycode, int press)
switch
(
keycode
)
{
case
XK_Escape
:
Quit
(
NULL
);
/* fast way out */
case
XK_F2
:
if
(
playstate
==
EX_STILLPLAYING
)
{
if
(
!
SaveGame
(
"wolf3d.sav"
))
fprintf
(
stderr
,
"Unable to save game
\n
"
);
}
break
;
case
XK_F3
:
if
(
!
LoadGame
(
"wolf3d.sav"
))
{
fprintf
(
stderr
,
"Unable to load game
\n
"
);
}
else
{
longjmp
(
ResetJmp
,
EX_LOADGAME
);
}
break
;
default:
break
;
}
...
...
macsrc/wolfdef.h
View file @
31fb323b
...
...
@@ -595,6 +595,8 @@ extern void InitData();
extern
int
WolfMain
(
int
argc
,
char
*
argv
[]);
extern
void
FreeResources
();
extern
void
RedrawScreen
();
extern
Boolean
SaveGame
(
char
*
file
);
extern
Boolean
LoadGame
(
char
*
file
);
extern
void
BlastScreen
(
void
);
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