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
06fba6a9
Commit
06fba6a9
authored
Jan 02, 2001
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished rewriting config files and save games. Hoping that everything still
works...
parent
3d610c50
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
623 additions
and
381 deletions
+623
-381
TODO
src/TODO
+30
-0
id_us.h
src/id_us.h
+3
-3
misc.c
src/misc.c
+13
-1
misc.h
src/misc.h
+2
-0
wl_def.h
src/wl_def.h
+11
-10
wl_game.c
src/wl_game.c
+1
-1
wl_main.c
src/wl_main.c
+538
-299
wl_menu.c
src/wl_menu.c
+24
-55
wl_play.c
src/wl_play.c
+1
-12
No files found.
src/TODO
View file @
06fba6a9
...
...
@@ -77,3 +77,33 @@ at a time
possible to calculate the sound lengths in terms of 70Hz (adlib sound len / 2,
pcm sound len / 100).
------------------------------------------------------------------------------
Save game header:
8 bytes: WOLF3D, 0, 0
4 bytes: SAV, 0
4 bytes: version (integer)
4 bytes: game type (WL1, WL6, SDM, SOD)
4 bytes: seconds past 1970 (time(NULL))
4 bytes: padding
4 bytes: checksum for the data (after text string)
32 bytes: text string
< data follows >
---
Config header:
8 bytes: WOLF3D, 0, 0
4 bytes: CFG, 0
4 bytes: version (integer)
4 bytes: game type (WL1, WL6, SDM, SOD)
4 bytes: seconds past 1970 (time(NULL))
4 bytes: padding
4 bytes: checksum for the data
Version 0xFFFFFFFF Data: (Unofficial Config data)
<see wl_main.c>
Version 0x00000000 Data: (Official)
<undetermined>
------------------------------------------------------------------------------
src/id_us.h
View file @
06fba6a9
...
...
@@ -7,9 +7,9 @@
#define MaxHighName 57
#define MaxScores 7
typedef
struct
{
char
name
[
MaxHighName
+
1
];
long
score
;
word
completed
,
episode
;
char
name
[
MaxHighName
+
1
];
int
score
;
int
completed
,
episode
;
}
HighScore
;
#define MaxString 128 // Maximum input string size
...
...
src/misc.c
View file @
06fba6a9
...
...
@@ -226,11 +226,18 @@ int OpenWrite(char *fn)
{
int
fp
;
/* fp = creat(fn, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); */
fp
=
open
(
fn
,
O_CREAT
|
O_WRONLY
|
O_TRUNC
|
O_BINARY
,
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IWGRP
|
S_IROTH
|
S_IWOTH
);
return
fp
;
}
int
OpenWriteAppend
(
char
*
fn
)
{
int
fp
;
fp
=
open
(
fn
,
O_CREAT
|
O_WRONLY
|
O_BINARY
,
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IWGRP
|
S_IROTH
|
S_IWOTH
);
return
fp
;
}
void
CloseWrite
(
int
fp
)
{
close
(
fp
);
...
...
@@ -241,6 +248,11 @@ int WriteSeek(int fp, int offset, int whence)
return
lseek
(
fp
,
offset
,
whence
);
}
int
WritePos
(
int
fp
)
{
return
lseek
(
fp
,
0
,
SEEK_CUR
);
}
int
WriteInt8
(
int
fp
,
int8_t
d
)
{
return
write
(
fp
,
&
d
,
1
);
...
...
src/misc.h
View file @
06fba6a9
...
...
@@ -25,9 +25,11 @@ char *ultoa(unsigned long value, char *string, int radix);
#endif
/* DOSISM */
extern
int
OpenWrite
(
char
*
fn
);
extern
int
OpenWriteAppend
(
char
*
fn
);
extern
void
CloseWrite
(
int
fp
);
extern
int
WriteSeek
(
int
fp
,
int
offset
,
int
whence
);
extern
int
WritePos
(
int
fp
);
extern
int
WriteInt8
(
int
fp
,
int8_t
d
);
extern
int
WriteInt16
(
int
fp
,
int16_t
d
);
...
...
src/wl_def.h
View file @
06fba6a9
...
...
@@ -689,21 +689,22 @@ extern int shootdelta;
extern
boolean
startgame
,
loadedgame
;
extern
int
mouseadjustment
;
//
// math tables
//
/* math tables */
extern
int
pixelangle
[
MAXVIEWWIDTH
];
extern
long
finetangent
[
FINEANGLES
/
4
];
extern
fixed
sintable
[],
*
costable
;
extern
char
configname
[
13
];
extern
char
configname
[
13
];
void
CalcProjection
(
long
focal
);
void
NewGame
(
int
difficulty
,
int
episode
);
void
NewViewSize
(
int
width
);
void
ShowViewSize
(
int
width
);
int
LoadTheGame
(
char
*
fn
,
int
x
,
int
y
);
int
SaveTheGame
(
char
*
fn
,
char
*
tag
,
int
x
,
int
y
);
int
ReadSaveTag
(
char
*
fn
,
char
*
tag
);
void
CalcProjection
(
long
focal
);
void
NewGame
(
int
difficulty
,
int
episode
);
void
NewViewSize
(
int
width
);
boolean
LoadTheGame
(
int
file
,
int
x
,
int
y
);
boolean
SaveTheGame
(
int
file
,
int
x
,
int
y
);
void
ShowViewSize
(
int
width
);
void
ShutdownId
();
int
WriteConfig
();
...
...
src/wl_game.c
View file @
06fba6a9
...
...
@@ -1058,7 +1058,7 @@ restartgame:
SetupGameLevel
();
#ifdef SPEAR
if
(
gamestate
.
mapon
==
20
)
// give them the key allways
if
(
gamestate
.
mapon
==
20
)
/* give them the key always */
{
gamestate
.
keys
|=
1
;
DrawKeys
();
...
...
src/wl_main.c
View file @
06fba6a9
This diff is collapsed.
Click to expand it.
src/wl_menu.c
View file @
06fba6a9
...
...
@@ -1164,11 +1164,10 @@ void DrawLSAction(int which)
////////////////////////////////////////////////////////////////////
int
CP_LoadGame
(
int
quick
)
{
int
handle
,
which
,
exit
=
0
;
int
which
,
exit
=
0
;
char
name
[
13
];
strcpy
(
name
,
SaveName
);
strcpy
(
name
,
SaveName
);
//
// QUICKLOAD?
...
...
@@ -1180,12 +1179,9 @@ int CP_LoadGame(int quick)
if
(
SaveGamesAvail
[
which
])
{
name
[
7
]
=
which
+
'0'
;
handle
=
open
(
name
,
O_BINARY
);
lseek
(
handle
,
32
,
SEEK_SET
);
loadedgame
=
true
;
LoadTheGame
(
handle
,
0
,
0
);
LoadTheGame
(
name
,
0
,
0
);
loadedgame
=
false
;
close
(
handle
);
DrawStatusBar
();
...
...
@@ -1209,14 +1205,10 @@ int CP_LoadGame(int quick)
ShootSnd
();
name
[
7
]
=
which
+
'0'
;
handle
=
open
(
name
,
O_BINARY
);
lseek
(
handle
,
32
,
SEEK_SET
);
DrawLSAction
(
0
);
loadedgame
=
true
;
LoadTheGame
(
handle
,
LSA_X
+
8
,
LSA_Y
+
5
);
close
(
handle
);
LoadTheGame
(
name
,
LSA_X
+
8
,
LSA_Y
+
5
);
StartGame
=
1
;
ShootSnd
();
...
...
@@ -1321,10 +1313,8 @@ void PrintLSEntry(int w,int color)
////////////////////////////////////////////////////////////////////
int
CP_SaveGame
(
int
quick
)
{
int
handle
,
which
,
exit
=
0
;
unsigned
nwritten
;
char
name
[
13
],
input
[
32
];
int
which
,
exit
=
0
;
char
name
[
13
],
input
[
32
];
strcpy
(
name
,
SaveName
);
...
...
@@ -1337,16 +1327,9 @@ int CP_SaveGame(int quick)
if
(
SaveGamesAvail
[
which
])
{
name
[
7
]
=
which
+
'0'
;
handle
=
creat
(
name
,
S_IREAD
|
S_IWRITE
);
strcpy
(
input
,
&
SaveGameNames
[
which
][
0
]);
nwritten
=
write
(
handle
,(
void
*
)
input
,
32
);
lseek
(
handle
,
32
,
SEEK_SET
);
SaveTheGame
(
handle
,
0
,
0
);
close
(
handle
);
name
[
7
]
=
which
+
'0'
;
SaveTheGame
(
name
,
&
SaveGameNames
[
which
][
0
],
0
,
0
);
return
1
;
}
}
...
...
@@ -1393,17 +1376,9 @@ int CP_SaveGame(int quick)
if
(
US_LineInput
(
LSM_X
+
LSItems
.
indent
+
2
,
LSM_Y
+
which
*
13
+
1
,
input
,
input
,
true
,
31
,
LSM_W
-
LSItems
.
indent
-
30
))
{
SaveGamesAvail
[
which
]
=
1
;
strcpy
(
&
SaveGameNames
[
which
][
0
],
input
);
handle
=
creat
(
name
,
S_IREAD
|
S_IWRITE
);
nwritten
=
write
(
handle
,
(
void
*
)
input
,
32
);
lseek
(
handle
,
32
,
SEEK_SET
);
DrawLSAction
(
1
);
SaveTheGame
(
handle
,
LSA_X
+
8
,
LSA_Y
+
5
);
close
(
handle
);
strcpy
(
&
SaveGameNames
[
which
][
0
],
input
);
SaveTheGame
(
name
,
input
,
LSA_X
+
8
,
LSA_Y
+
5
);
ShootSnd
();
exit
=
1
;
}
...
...
@@ -2622,14 +2597,12 @@ void SetupControlPanel()
which
=
f
.
ff_name
[
7
]
-
'0'
;
if
(
which
<
10
)
{
int
handle
;
char
temp
[
32
];
SaveGamesAvail
[
which
]
=
1
;
handle
=
open
(
f
.
ff_name
,
O_BINARY
);
read
(
handle
,
temp
,
32
);
close
(
handle
);
strcpy
(
&
SaveGameNames
[
which
][
0
],
temp
);
if
(
ReadSaveTag
(
f
.
ff_name
,
temp
)
!=
-
1
)
{
SaveGamesAvail
[
which
]
=
1
;
strcpy
(
&
SaveGameNames
[
which
][
0
],
temp
);
}
}
}
while
(
!
findnext
(
&
f
));
#else
...
...
@@ -2666,14 +2639,12 @@ void SetupControlPanel()
which
=
f
.
name
[
7
]
-
'0'
;
if
(
which
<
10
)
{
int
handle
;
char
temp
[
32
];
SaveGamesAvail
[
which
]
=
1
;
handle
=
open
(
f
.
name
,
O_BINARY
);
read
(
handle
,
temp
,
32
);
close
(
handle
);
strcpy
(
&
SaveGameNames
[
which
][
0
],
temp
);
if
(
ReadSaveTag
(
f
.
name
,
temp
)
!=
-
1
)
{
SaveGamesAvail
[
which
]
=
1
;
strcpy
(
&
SaveGameNames
[
which
][
0
],
temp
);
}
}
}
while
(
_findnext
(
hand
,
&
f
)
!=
-
1
);
#endif
...
...
@@ -2705,14 +2676,12 @@ void SetupControlPanel()
for
(
x
=
0
;
x
<
globbuf
.
gl_pathc
;
x
++
)
{
which
=
globbuf
.
gl_pathv
[
x
][
7
]
-
'0'
;
if
(
which
<
10
)
{
int
handle
;
char
temp
[
32
];
SaveGamesAvail
[
which
]
=
1
;
handle
=
open
(
globbuf
.
gl_pathv
[
x
],
O_RDONLY
);
read
(
handle
,
temp
,
32
);
close
(
handle
);
strcpy
(
SaveGameNames
[
which
],
temp
);
if
(
ReadSaveTag
(
globbuf
.
gl_pathv
[
x
],
temp
)
!=
-
1
)
{
SaveGamesAvail
[
which
]
=
1
;
strcpy
(
&
SaveGameNames
[
which
][
0
],
temp
);
}
}
}
globfree
(
&
globbuf
);
...
...
src/wl_play.c
View file @
06fba6a9
...
...
@@ -50,15 +50,7 @@ memptr demobuffer;
int
controlx
,
controly
;
// range from -100 to 100 per tic
boolean
buttonstate
[
NUMBUTTONS
];
//===========================================================================
static
void
RemoveObj
(
objtype
*
gone
);
void
StopMusic
();
void
StartMusic
();
void
PlayLoop
();
/*
=============================================================================
...
...
@@ -770,9 +762,6 @@ void InitActorList()
= Sets the global variable new to point to a free spot in objlist.
= The free spot is inserted at the end of the liked list
=
= When the object list is full, the caller can either have it bomb out ot
= return a dummy object pointer that will never get used
=
=========================
*/
...
...
@@ -805,7 +794,7 @@ void GetNewActor()
=
= RemoveObj
=
= Add the given object back into the free list, and unlink it from it
'
s
= Add the given object back into the free list, and unlink it from its
= neighbors
=
=========================
...
...
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