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
Show 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
...
...
@@ -8,8 +8,8 @@
#define MaxScores 7
typedef
struct
{
char
name
[
MaxHighName
+
1
];
long
score
;
word
completed
,
episode
;
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
];
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
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
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
...
...
@@ -101,58 +101,145 @@ void CalcTics()
/* ======================================================================== */
#if 0
/*
====================
=
= ReadConfig
=
====================
*/
static
void
DiskFlopAnim
(
int
x
,
int
y
)
{
static
char
which
=
0
;
if
(
!
x
&&
!
y
)
return
;
void ReadConfig()
VWB_DrawPic
(
x
,
y
,
C_DISKLOADING1PIC
+
which
);
VW_UpdateScreen
();
which
^=
1
;
}
static
int32_t
CalcFileChecksum
(
int
fd
,
int
len
)
{
SDMode sd;
SMMode sm;
SDSMode sds;
int32_t
cs
;
int
i
;
int8_t
c1
,
c2
;
c1
=
ReadInt8
(
fd
);
cs
=
0
;
for
(
i
=
0
;
i
<
len
-
1
;
i
++
)
{
c2
=
ReadInt8
(
fd
);
cs
+=
c1
^
c2
;
c1
=
c2
;
}
return
cs
;
}
int file;
int
WriteConfig
()
{
int
i
;
int
fd
;
int32_t
cs
;
if ((file = open(configname, O_BINARY | O_RDONLY)) != -1)
{
//
// valid config file
//
read(file,Scores,sizeof(HighScore) * MaxScores);
fd
=
OpenWrite
(
configname
);
read(file,&sd,sizeof(sd));
read(file,&sm,sizeof(sm));
read(file,&sds,sizeof(sds));
if
(
fd
!=
-
1
)
{
WriteBytes
(
fd
,
(
byte
*
)
GAMEHDR
,
8
);
/* WOLF3D, 0, 0 */
WriteBytes
(
fd
,
(
byte
*
)
CFGTYPE
,
4
);
/* CFG, 0 */
/**/
WriteInt32
(
fd
,
0xFFFFFFFF
);
/* Version (integer) */
WriteBytes
(
fd
,
(
byte
*
)
GAMETYPE
,
4
);
/* XXX, 0 */
WriteInt32
(
fd
,
time
(
NULL
));
/* Time */
WriteInt32
(
fd
,
0x00000000
);
/* Padding */
WriteInt32
(
fd
,
0x00000000
);
/* Checksum (placeholder) */
for
(
i
=
0
;
i
<
7
;
i
++
)
{
/* MaxScores = 7 */
WriteBytes
(
fd
,
(
byte
*
)
Scores
[
i
].
name
,
58
);
WriteInt32
(
fd
,
Scores
[
i
].
score
);
WriteInt32
(
fd
,
Scores
[
i
].
completed
);
WriteInt32
(
fd
,
Scores
[
i
].
episode
);
}
read(file,&mouseenabled,sizeof(mouseenabled));
read(file,&joystickenabled,sizeof(joystickenabled));
read(file,&joypadenabled,sizeof(joypadenabled));
read(file,&joystickport,sizeof(joystickport));
WriteInt32
(
fd
,
viewsize
);
read(file,&dirscan,sizeof(dirscan));
read(file,&buttonscan,sizeof(buttonscan));
read(file,&buttonmouse,sizeof(buttonmouse));
read(file,&buttonjoy,sizeof(buttonjoy));
CloseWrite
(
fd
);
read(file,&viewsize,sizeof(viewsize));
read(file,&mouseadjustment,sizeof(mouseadjustment));
fd
=
OpenRead
(
configname
);
ReadSeek
(
fd
,
32
,
SEEK_SET
);
cs
=
CalcFileChecksum
(
fd
,
ReadLength
(
fd
)
-
32
);
CloseRead
(
fd
);
close(file);
fd
=
OpenWriteAppend
(
configname
);
WriteSeek
(
fd
,
28
,
SEEK_SET
);
WriteInt32
(
fd
,
cs
);
MainMenu[6].active=1;
MainItems.curpos=0;
CloseWrite
(
fd
);
}
else
{
//
// no config file, so select by hardware
//
return
0
;
}
static
void
SetDefaults
()
{
viewsize
=
15
;
}
int
ReadConfig
()
{
int
fd
,
configokay
;
char
buf
[
8
];
int32_t
v
;
int
i
;
configokay
=
0
;
fd
=
OpenRead
(
configname
);
if
(
fd
!=
-
1
)
{
ReadBytes
(
fd
,
(
byte
*
)
buf
,
8
);
if
(
strncmp
(
buf
,
GAMEHDR
,
8
))
goto
configend
;
ReadBytes
(
fd
,
(
byte
*
)
buf
,
4
);
if
(
strncmp
(
buf
,
CFGTYPE
,
4
))
goto
configend
;
v
=
ReadInt32
(
fd
);
/**/
if
(
v
!=
0xFFFFFFFF
)
goto
configend
;
ReadBytes
(
fd
,
(
byte
*
)
buf
,
4
);
if
(
strncmp
(
buf
,
GAMETYPE
,
4
))
goto
configend
;
ReadInt32
(
fd
);
/* skip over time */
ReadInt32
(
fd
);
/* skip over padding */
v
=
ReadInt32
(
fd
);
/* get checksum */
if
(
v
!=
CalcFileChecksum
(
fd
,
ReadLength
(
fd
)
-
32
))
goto
configend
;
ReadSeek
(
fd
,
32
,
SEEK_SET
);
for
(
i
=
0
;
i
<
7
;
i
++
)
{
/* MaxScores = 7 */
ReadBytes
(
fd
,
(
byte
*
)
Scores
[
i
].
name
,
58
);
Scores
[
i
].
score
=
ReadInt32
(
fd
);
Scores
[
i
].
completed
=
ReadInt32
(
fd
);
Scores
[
i
].
episode
=
ReadInt32
(
fd
);
}
viewsize
=
ReadInt32
(
fd
);
#ifdef UPLOAD
MainMenu
[
readthis
].
active
=
1
;
MainItems
.
curpos
=
0
;
#endif
configokay
=
1
;
}
configend:
if
(
fd
!=
-
1
)
CloseRead
(
fd
);
if
(
!
configokay
)
{
printf
(
"Config: Setting defaults..
\n
"
);
SetDefaults
();
}
mouseenabled
=
false
;
...
...
@@ -166,303 +253,462 @@ void ReadConfig()
SD_SetMusicMode
(
smm_AdLib
);
SD_SetSoundMode
(
sdm_AdLib
);
SD_SetDigiDevice
(
sds_SoundBlaster
);
}
return
0
;
}
/*
====================
=
= WriteConfig
=
====================
*/
void WriteConfig()
int
SaveTheGame
(
char
*
fn
,
char
*
tag
,
int
dx
,
int
dy
)
{
int file;
objtype
*
ob
;
int
fd
,
i
,
x
,
y
;
int32_t
cs
;
file = open(configname, O_CREAT | O_BINARY | O_WRONLY,
S_IREAD | S_IWRITE | S_IFREG);
fd
=
OpenWrite
(
fn
);
if (file != -1)
{
write(file,Scores,sizeof(HighScore) * MaxScores);
if
(
fd
!=
-
1
)
{
WriteBytes
(
fd
,
(
byte
*
)
GAMEHDR
,
8
);
WriteBytes
(
fd
,
(
byte
*
)
SAVTYPE
,
4
);
WriteInt32
(
fd
,
0xFFFFFFFF
);
/* write version */
WriteBytes
(
fd
,
(
byte
*
)
GAMETYPE
,
4
);
WriteInt32
(
fd
,
time
(
NULL
));
WriteInt32
(
fd
,
0x00000000
);
WriteInt32
(
fd
,
0x00000000
);
/* write checksum (placeholder) */
WriteBytes
(
fd
,
(
byte
*
)
tag
,
32
);
/* write savegame name */
DiskFlopAnim
(
dx
,
dy
);
WriteInt32
(
fd
,
gamestate
.
difficulty
);
WriteInt32
(
fd
,
gamestate
.
mapon
);
WriteInt32
(
fd
,
gamestate
.
oldscore
);
WriteInt32
(
fd
,
gamestate
.
score
);
WriteInt32
(
fd
,
gamestate
.
nextextra
);
WriteInt32
(
fd
,
gamestate
.
lives
);
WriteInt32
(
fd
,
gamestate
.
health
);
WriteInt32
(
fd
,
gamestate
.
ammo
);
WriteInt32
(
fd
,
gamestate
.
keys
);
WriteInt32
(
fd
,
gamestate
.
bestweapon
);
WriteInt32
(
fd
,
gamestate
.
weapon
);
WriteInt32
(
fd
,
gamestate
.
chosenweapon
);
WriteInt32
(
fd
,
gamestate
.
faceframe
);
WriteInt32
(
fd
,
gamestate
.
attackframe
);
WriteInt32
(
fd
,
gamestate
.
attackcount
);
WriteInt32
(
fd
,
gamestate
.
weaponframe
);
WriteInt32
(
fd
,
gamestate
.
episode
);
WriteInt32
(
fd
,
gamestate
.
secretcount
);
WriteInt32
(
fd
,
gamestate
.
treasurecount
);
WriteInt32
(
fd
,
gamestate
.
killcount
);
WriteInt32
(
fd
,
gamestate
.
secrettotal
);
WriteInt32
(
fd
,
gamestate
.
treasuretotal
);
WriteInt32
(
fd
,
gamestate
.
killtotal
);
WriteInt32
(
fd
,
gamestate
.
TimeCount
);
WriteInt32
(
fd
,
gamestate
.
killx
);
WriteInt32
(
fd
,
gamestate
.
killy
);
WriteInt8
(
fd
,
gamestate
.
victoryflag
);
DiskFlopAnim
(
dx
,
dy
);
#ifdef SPEAR
for
(
i
=
0
;
i
<
20
;
i
++
)
{
#else
for
(
i
=
0
;
i
<
8
;
i
++
)
{
#endif
WriteInt32
(
fd
,
LevelRatios
[
i
].
kill
);
WriteInt32
(
fd
,
LevelRatios
[
i
].
secret
);
WriteInt32
(
fd
,
LevelRatios
[
i
].
treasure
);
WriteInt32
(
fd
,
LevelRatios
[
i
].
time
);
}
write(file,&SoundMode,sizeof(SoundMode));
write(file,&MusicMode,sizeof(MusicMode));
write(file,&DigiMode,sizeof(DigiMode));
DiskFlopAnim
(
dx
,
dy
);
WriteBytes
(
fd
,
(
byte
*
)
tilemap
,
64
*
64
);
/* MAPSIZE * MAPSIZE */
DiskFlopAnim
(
dx
,
dy
);
for
(
y
=
0
;
y
<
64
;
y
++
)
for
(
x
=
0
;
x
<
64
;
x
++
)
WriteInt32
(
fd
,
actorat
[
y
][
x
]);
DiskFlopAnim
(
dx
,
dy
);
WriteBytes
(
fd
,
(
byte
*
)
areaconnect
,
37
*
37
);
/* NUMAREAS * NUMAREAS */
DiskFlopAnim
(
dx
,
dy
);
for
(
i
=
0
;
i
<
37
;
i
++
)
WriteInt8
(
fd
,
areabyplayer
[
i
]);
for
(
ob
=
player
;
ob
;
ob
=
ob
->
next
)
{
DiskFlopAnim
(
dx
,
dy
);
WriteInt32
(
fd
,
ob
->
id
);
WriteInt32
(
fd
,
ob
->
active
);
WriteInt32
(
fd
,
ob
->
ticcount
);
WriteInt32
(
fd
,
ob
->
obclass
);
WriteInt32
(
fd
,
ob
->
state
);
WriteInt8
(
fd
,
ob
->
flags
);
WriteInt32
(
fd
,
ob
->
distance
);
WriteInt32
(
fd
,
ob
->
dir
);
WriteInt32
(
fd
,
ob
->
x
);
WriteInt32
(
fd
,
ob
->
y
);
WriteInt32
(
fd
,
ob
->
tilex
);
WriteInt32
(
fd
,
ob
->
tiley
);
WriteInt8
(
fd
,
ob
->
areanumber
);
WriteInt32
(
fd
,
ob
->
viewx
);
WriteInt32
(
fd
,
ob
->
viewheight
);
WriteInt32
(
fd
,
ob
->
transx
);
WriteInt32
(
fd
,
ob
->
transy
);
WriteInt32
(
fd
,
ob
->
angle
);
WriteInt32
(
fd
,
ob
->
hitpoints
);
WriteInt32
(
fd
,
ob
->
speed
);
WriteInt32
(
fd
,
ob
->
temp1
);
WriteInt32
(
fd
,
ob
->
temp2
);
WriteInt32
(
fd
,
ob
->
temp3
);
}
write(file,&mouseenabled,sizeof(mouseenabled));
write(file,&joystickenabled,sizeof(joystickenabled));
write(file,&joypadenabled,sizeof(joypadenabled));
write(file,&joystickport,sizeof(joystickport));
WriteInt32
(
fd
,
0xFFFFFFFF
);
/* end of actor list */
write(file,&dirscan,sizeof(dirscan));
write(file,&buttonscan,sizeof(buttonscan));
write(file,&buttonmouse,sizeof(buttonmouse));
write(file,&buttonjoy,sizeof(buttonjoy));
DiskFlopAnim
(
dx
,
dy
);
write(file,&viewsize,sizeof(viewsize));
write(file,&mouseadjustment,sizeof(mouseadjustment));
WriteInt32
(
fd
,
laststatobj
-
statobjlist
);
/* ptr offset */
close(file);
for
(
i
=
0
;
i
<
400
;
i
++
)
{
/* MAXSTATS */
WriteInt8
(
fd
,
statobjlist
[
i
].
tilex
);
WriteInt8
(
fd
,
statobjlist
[
i
].
tiley
);
WriteInt32
(
fd
,
statobjlist
[
i
].
shapenum
);
WriteInt8
(
fd
,
statobjlist
[
i
].
flags
);
WriteInt8
(
fd
,
statobjlist
[
i
].
itemnumber
);
}
}
#endif
DiskFlopAnim
(
dx
,
dy
);
void
DiskFlopAnim
(
int
x
,
int
y
)
{
static
char
which
=
0
;
for
(
i
=
0
;
i
<
64
;
i
++
)
{
/* MAXDOORS */
WriteInt32
(
fd
,
doorposition
[
i
]);
}
if
(
!
x
&&
!
y
)
return
;
DiskFlopAnim
(
dx
,
dy
);
VWB_DrawPic
(
x
,
y
,
C_DISKLOADING1PIC
+
which
);
VW_UpdateScreen
();
for
(
i
=
0
;
i
<
64
;
i
++
)
{
/* MAXDOORS */
WriteInt8
(
fd
,
doorobjlist
[
i
].
tilex
);
WriteInt8
(
fd
,
doorobjlist
[
i
].
tiley
);
WriteInt8
(
fd
,
doorobjlist
[
i
].
vertical
);
WriteInt8
(
fd
,
doorobjlist
[
i
].
lock
);
WriteInt8
(
fd
,
doorobjlist
[
i
].
action
);
WriteInt32
(
fd
,
doorobjlist
[
i
].
ticcount
);
}
which
^=
1
;
}
DiskFlopAnim
(
dx
,
dy
);
long
DoChecksum
(
byte
*
source
,
unsigned
size
,
long
checksum
)
{
int
i
;
WriteInt32
(
fd
,
pwallstate
);
WriteInt32
(
fd
,
pwallx
);
WriteInt32
(
fd
,
pwally
);
WriteInt32
(
fd
,
pwalldir
);
WriteInt32
(
fd
,
pwallpos
);
for
(
i
=
0
;
i
<
size
-
1
;
i
++
)
checksum
+=
source
[
i
]
^
source
[
i
+
1
];
DiskFlopAnim
(
dx
,
dy
);
return
checksum
;
}
CloseWrite
(
fd
);
int
WriteConfig
()
{
int
fd
;
fd
=
OpenRead
(
fn
);
ReadSeek
(
fd
,
64
,
SEEK_SET
);
cs
=
CalcFileChecksum
(
fd
,
ReadLength
(
fd
)
-
64
);
CloseRead
(
fd
);
fd
=
OpenWrite
(
configname
);
fd
=
OpenWriteAppend
(
fn
);
WriteSeek
(
fd
,
28
,
SEEK_SET
);
WriteInt32
(
fd
,
cs
);
if
(
fd
!=
-
1
)
{
CloseWrite
(
fd
);
}
else
{
Message
(
STR_NOSPACE1
"
\n
"
STR_NOSPACE2
);
IN_ClearKeysDown
();
IN_Ack
();
return
-
1
;
}
return
0
;
}
int
Read
Config
(
)
int
Read
SaveTag
(
char
*
fn
,
char
*
tag
)
{
char
buf
[
8
];
int
fd
;
int32_t
v
;
fd
=
OpenRead
(
configname
);
fd
=
OpenRead
(
fn
);
if
(
fd
==
-
1
)
goto
rstfail
;
if
(
fd
!=
-
1
)
{
CloseRead
(
fd
);
ReadBytes
(
fd
,
(
byte
*
)
buf
,
8
);
if
(
strncmp
(
buf
,
GAMEHDR
,
8
))
goto
rstfail
;
#ifdef UPLOAD
MainMenu
[
readthis
].
active
=
1
;
MainItems
.
curpos
=
0
;
#endif
}
else
{
viewsize
=
15
;
}
ReadBytes
(
fd
,
(
byte
*
)
buf
,
4
);
if
(
strncmp
(
buf
,
SAVTYPE
,
4
))
goto
rstfail
;
viewsize
=
15
;
v
=
ReadInt32
(
fd
);
if
(
v
!=
0xFFFFFFFF
)
goto
rstfail
;
mouseenabled
=
false
;
ReadBytes
(
fd
,
(
byte
*
)
buf
,
4
);
if
(
strncmp
(
buf
,
GAMETYPE
,
4
))
goto
rstfail
;
joystickenabled
=
false
;
joypadenabled
=
false
;
joystickport
=
0
;
ReadInt32
(
fd
);
ReadInt32
(
fd
);
mouseadjustment
=
5
;
v
=
ReadInt32
(
fd
);
/* get checksum */
SD_SetMusicMode
(
smm_AdLib
);
SD_SetSoundMode
(
sdm_AdLib
);
SD_SetDigiDevice
(
sds_SoundBlaster
)
;
ReadSeek
(
fd
,
64
,
SEEK_SET
);
if
(
v
!=
CalcFileChecksum
(
fd
,
ReadLength
(
fd
)
-
64
))
goto
rstfail
;
return
0
;
}
ReadSeek
(
fd
,
32
,
SEEK_SET
)
;
ReadBytes
(
fd
,
(
byte
*
)
tag
,
32
);
int
SaveGame
()
{
return
0
;
}
CloseRead
(
fd
);
int
LoadGame
()
{
return
0
;
}
rstfail:
if
(
fd
!=
-
1
)
CloseRead
(
fd
);
/*
==================
=
= SaveTheGame
=
==================
*/
return
-
1
;
}
boolean
SaveTheGame
(
int
file
,
int
x
,
int
y
)
int
LoadTheGame
(
char
*
fn
,
int
dx
,
int
d
y
)
{
long
checksum
;
objtype
*
ob
,
nullobj
;
checksum
=
0
;
char
buf
[
8
];
int
fd
,
i
,
x
,
y
,
id
;
int32_t
v
;
fd
=
OpenRead
(
fn
);
if
(
fd
==
-
1
)
goto
loadfail
;
ReadBytes
(
fd
,
(
byte
*
)
buf
,
8
);
if
(
strncmp
(
buf
,
GAMEHDR
,
8
))
goto
loadfail
;
ReadBytes
(
fd
,
(
byte
*
)
buf
,
4
);
if
(
strncmp
(
buf
,
SAVTYPE
,
4
))
goto
loadfail
;
v
=
ReadInt32
(
fd
);
if
(
v
!=
0xFFFFFFFF
)
goto
loadfail
;
ReadBytes
(
fd
,
(
byte
*
)
buf
,
4
);
if
(
strncmp
(
buf
,
GAMETYPE
,
4
))
goto
loadfail
;
ReadInt32
(
fd
);
ReadInt32
(
fd
);
v
=
ReadInt32
(
fd
);
/* get checksum */
ReadSeek
(
fd
,
64
,
SEEK_SET
);
if
(
v
!=
CalcFileChecksum
(
fd
,
ReadLength
(
fd
)
-
64
))
goto
loadfail
;
ReadSeek
(
fd
,
64
,
SEEK_SET
);
DiskFlopAnim
(
dx
,
dy
);
gamestate
.
difficulty
=
ReadInt32
(
fd
);
gamestate
.
mapon
=
ReadInt32
(
fd
);
gamestate
.
oldscore
=
ReadInt32
(
fd
);
gamestate
.
score
=
ReadInt32
(
fd
);
gamestate
.
nextextra
=
ReadInt32
(
fd
);
gamestate
.
lives
=
ReadInt32
(
fd
);
gamestate
.
health
=
ReadInt32
(
fd
);
gamestate
.
ammo
=
ReadInt32
(
fd
);
gamestate
.
keys
=
ReadInt32
(
fd
);
gamestate
.
bestweapon
=
ReadInt32
(
fd
);
gamestate
.
weapon
=
ReadInt32
(
fd
);
gamestate
.
chosenweapon
=
ReadInt32
(
fd
);
gamestate
.
faceframe
=
ReadInt32
(
fd
);
gamestate
.
attackframe
=
ReadInt32
(
fd
);
gamestate
.
attackcount
=
ReadInt32
(
fd
);
gamestate
.
weaponframe
=
ReadInt32
(
fd
);
gamestate
.
episode
=
ReadInt32
(
fd
);
gamestate
.
secretcount
=
ReadInt32
(
fd
);
gamestate
.
treasurecount
=
ReadInt32
(
fd
);
gamestate
.
killcount
=
ReadInt32
(
fd
);
gamestate
.
secrettotal
=
ReadInt32
(
fd
);
gamestate
.
treasuretotal
=
ReadInt32
(
fd
);
gamestate
.
killtotal
=
ReadInt32
(
fd
);
gamestate
.
TimeCount
=
ReadInt32
(
fd
);
gamestate
.
killx
=
ReadInt32
(
fd
);
gamestate
.
killy
=
ReadInt32
(
fd
);
gamestate
.
victoryflag
=
ReadInt8
(
fd
);
DiskFlopAnim
(
dx
,
dy
);
DiskFlopAnim
(
x
,
y
);
CA_FarWrite
(
file
,(
void
*
)
&
gamestate
,
sizeof
(
gamestate
));
checksum
=
DoChecksum
((
byte
*
)
&
gamestate
,
sizeof
(
gamestate
),
checksum
);
DiskFlopAnim
(
x
,
y
);
#ifdef SPEAR
CA_FarWrite
(
file
,(
void
*
)
&
LevelRatios
[
0
],
sizeof
(
LRstruct
)
*
20
);
checksum
=
DoChecksum
((
byte
*
)
&
LevelRatios
[
0
],
sizeof
(
LRstruct
)
*
20
,
checksum
);
for
(
i
=
0
;
i
<
20
;
i
++
)
{
#else
CA_FarWrite
(
file
,(
void
*
)
&
LevelRatios
[
0
],
sizeof
(
LRstruct
)
*
8
);
checksum
=
DoChecksum
((
byte
*
)
&
LevelRatios
[
0
],
sizeof
(
LRstruct
)
*
8
,
checksum
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
#endif
DiskFlopAnim
(
x
,
y
);
CA_FarWrite
(
file
,(
void
*
)
tilemap
,
sizeof
(
tilemap
));
checksum
=
DoChecksum
((
byte
*
)
tilemap
,
sizeof
(
tilemap
),
checksum
);
DiskFlopAnim
(
x
,
y
);
CA_FarWrite
(
file
,(
void
*
)
actorat
,
sizeof
(
actorat
));
checksum
=
DoChecksum
((
byte
*
)
actorat
,
sizeof
(
actorat
),
checksum
);
CA_FarWrite
(
file
,(
void
*
)
areaconnect
,
sizeof
(
areaconnect
));
CA_FarWrite
(
file
,(
void
*
)
areabyplayer
,
sizeof
(
areabyplayer
));
for
(
ob
=
player
;
ob
;
ob
=
ob
->
next
)
{
DiskFlopAnim
(
x
,
y
);
CA_FarWrite
(
file
,
(
void
*
)
ob
,
sizeof
(
*
ob
));
LevelRatios
[
i
].
kill
=
ReadInt32
(
fd
);
LevelRatios
[
i
].
secret
=
ReadInt32
(
fd
);
LevelRatios
[
i
].
treasure
=
ReadInt32
(
fd
);
LevelRatios
[
i
].
time
=
ReadInt32
(
fd
);
}
nullobj
.
active
=
ac_badobject
;
// end of file marker
DiskFlopAnim
(
x
,
y
);
CA_FarWrite
(
file
,(
void
*
)
&
nullobj
,
sizeof
(
nullobj
));
DiskFlopAnim
(
x
,
y
);
CA_FarWrite
(
file
,(
void
*
)
&
laststatobj
,
sizeof
(
laststatobj
));
checksum
=
DoChecksum
((
byte
*
)
&
laststatobj
,
sizeof
(
laststatobj
),
checksum
);
DiskFlopAnim
(
x
,
y
);
CA_FarWrite
(
file
,(
void
*
)
statobjlist
,
sizeof
(
statobjlist
));
checksum
=
DoChecksum
((
byte
*
)
statobjlist
,
sizeof
(
statobjlist
),
checksum
);
DiskFlopAnim
(
x
,
y
);
CA_FarWrite
(
file
,(
void
*
)
doorposition
,
sizeof
(
doorposition
));
checksum
=
DoChecksum
((
byte
*
)
doorposition
,
sizeof
(
doorposition
),
checksum
);
DiskFlopAnim
(
x
,
y
);
CA_FarWrite
(
file
,(
void
*
)
doorobjlist
,
sizeof
(
doorobjlist
));
checksum
=
DoChecksum
((
byte
*
)
doorobjlist
,
sizeof
(
doorobjlist
),
checksum
);
DiskFlopAnim
(
x
,
y
);
CA_FarWrite
(
file
,(
void
*
)
&
pwallstate
,
sizeof
(
pwallstate
));
checksum
=
DoChecksum
((
byte
*
)
&
pwallstate
,
sizeof
(
pwallstate
),
checksum
);
CA_FarWrite
(
file
,(
void
*
)
&
pwallx
,
sizeof
(
pwallx
));
checksum
=
DoChecksum
((
byte
*
)
&
pwallx
,
sizeof
(
pwallx
),
checksum
);
CA_FarWrite
(
file
,(
void
*
)
&
pwally
,
sizeof
(
pwally
));
checksum
=
DoChecksum
((
byte
*
)
&
pwally
,
sizeof
(
pwally
),
checksum
);
CA_FarWrite
(
file
,(
void
*
)
&
pwalldir
,
sizeof
(
pwalldir
));
checksum
=
DoChecksum
((
byte
*
)
&
pwalldir
,
sizeof
(
pwalldir
),
checksum
);
CA_FarWrite
(
file
,(
void
*
)
&
pwallpos
,
sizeof
(
pwallpos
));
checksum
=
DoChecksum
((
byte
*
)
&
pwallpos
,
sizeof
(
pwallpos
),
checksum
);
//
// WRITE OUT CHECKSUM
//
CA_FarWrite
(
file
,
(
void
*
)
&
checksum
,
sizeof
(
checksum
));
return
true
;
}
DiskFlopAnim
(
dx
,
dy
);
/*
==================
=
= LoadTheGame
=
==================
*/
SetupGameLevel
();
boolean
LoadTheGame
(
int
file
,
int
x
,
int
y
)
{
long
checksum
,
oldchecksum
;
objtype
nullobj
;
DiskFlopAnim
(
dx
,
dy
);
checksum
=
0
;
ReadBytes
(
fd
,
(
byte
*
)
tilemap
,
64
*
64
);
/* MAPSIZE * MAPSIZE */
DiskFlopAnim
(
x
,
y
);
CA_FarRead
(
file
,(
void
*
)
&
gamestate
,
sizeof
(
gamestate
));
checksum
=
DoChecksum
((
byte
*
)
&
gamestate
,
sizeof
(
gamestate
),
checksum
);
DiskFlopAnim
(
dx
,
dy
);
DiskFlopAnim
(
x
,
y
);
#ifdef SPEAR
CA_FarRead
(
file
,(
void
*
)
&
LevelRatios
[
0
],
sizeof
(
LRstruct
)
*
20
);
checksum
=
DoChecksum
((
byte
*
)
&
LevelRatios
[
0
],
sizeof
(
LRstruct
)
*
20
,
checksum
);
#else
CA_FarRead
(
file
,(
void
*
)
&
LevelRatios
[
0
],
sizeof
(
LRstruct
)
*
8
);
checksum
=
DoChecksum
((
byte
*
)
&
LevelRatios
[
0
],
sizeof
(
LRstruct
)
*
8
,
checksum
);
#endif
for
(
y
=
0
;
y
<
64
;
y
++
)
for
(
x
=
0
;
x
<
64
;
x
++
)
actorat
[
y
][
x
]
=
ReadInt32
(
fd
);
DiskFlopAnim
(
x
,
y
);
SetupGameLevel
();
DiskFlopAnim
(
dx
,
dy
);
DiskFlopAnim
(
x
,
y
);
CA_FarRead
(
file
,(
void
*
)
tilemap
,
sizeof
(
tilemap
));
checksum
=
DoChecksum
((
byte
*
)
tilemap
,
sizeof
(
tilemap
),
checksum
);
DiskFlopAnim
(
x
,
y
);
CA_FarRead
(
file
,(
void
*
)
actorat
,
sizeof
(
actorat
));
checksum
=
DoChecksum
((
byte
*
)
actorat
,
sizeof
(
actorat
),
checksum
);
ReadBytes
(
fd
,
(
byte
*
)
areaconnect
,
37
*
37
);
/* NUMAREAS * NUMAREAS */
CA_FarRead
(
file
,(
void
*
)
areaconnect
,
sizeof
(
areaconnect
));
CA_FarRead
(
file
,(
void
*
)
areabyplayer
,
sizeof
(
areabyplayer
));
DiskFlopAnim
(
dx
,
dy
);
for
(
i
=
0
;
i
<
37
;
i
++
)
areabyplayer
[
i
]
=
ReadInt8
(
fd
);
InitActorList
();
DiskFlopAnim
(
x
,
y
);
CA_FarRead
(
file
,(
void
*
)
player
,
sizeof
(
*
player
));
DiskFlopAnim
(
dx
,
dy
);
while
(
1
)
{
DiskFlopAnim
(
x
,
y
);
CA_FarRead
(
file
,(
void
*
)
&
nullobj
,
sizeof
(
nullobj
));
InitActorList
();
if
(
nullobj
.
active
==
ac_badobject
)
DiskFlopAnim
(
dx
,
dy
);
/* player ptr already set up */
id
=
ReadInt32
(
fd
);
/* get id */
player
->
active
=
ReadInt32
(
fd
);
player
->
ticcount
=
ReadInt32
(
fd
);
player
->
obclass
=
ReadInt32
(
fd
);
player
->
state
=
ReadInt32
(
fd
);
player
->
flags
=
ReadInt8
(
fd
);
player
->
distance
=
ReadInt32
(
fd
);
player
->
dir
=
ReadInt32
(
fd
);
player
->
x
=
ReadInt32
(
fd
);
player
->
y
=
ReadInt32
(
fd
);
player
->
tilex
=
ReadInt32
(
fd
);
player
->
tiley
=
ReadInt32
(
fd
);
player
->
areanumber
=
ReadInt8
(
fd
);
player
->
viewx
=
ReadInt32
(
fd
);
player
->
viewheight
=
ReadInt32
(
fd
);
player
->
transx
=
ReadInt32
(
fd
);
player
->
transy
=
ReadInt32
(
fd
);
player
->
angle
=
ReadInt32
(
fd
);
player
->
hitpoints
=
ReadInt32
(
fd
);
player
->
speed
=
ReadInt32
(
fd
);
player
->
temp1
=
ReadInt32
(
fd
);
player
->
temp2
=
ReadInt32
(
fd
);
player
->
temp3
=
ReadInt32
(
fd
);
/* update the id */
for
(
y
=
0
;
y
<
64
;
y
++
)
for
(
x
=
0
;
x
<
64
;
x
++
)
if
(
actorat
[
y
][
x
]
==
(
id
|
0x8000
))
actorat
[
y
][
x
]
=
player
->
id
|
0x8000
;
while
(
1
)
{
DiskFlopAnim
(
dx
,
dy
);
id
=
ReadInt32
(
fd
);
if
(
id
==
0xFFFFFFFF
)
break
;
GetNewActor
();
// don't copy over the links
memcpy
(
new
,
&
nullobj
,
sizeof
(
nullobj
)
-
4
);
new
->
active
=
ReadInt32
(
fd
);
new
->
ticcount
=
ReadInt32
(
fd
);
new
->
obclass
=
ReadInt32
(
fd
);
new
->
state
=
ReadInt32
(
fd
);
new
->
flags
=
ReadInt8
(
fd
);
new
->
distance
=
ReadInt32
(
fd
);
new
->
dir
=
ReadInt32
(
fd
);
new
->
x
=
ReadInt32
(
fd
);
new
->
y
=
ReadInt32
(
fd
);
new
->
tilex
=
ReadInt32
(
fd
);
new
->
tiley
=
ReadInt32
(
fd
);
new
->
areanumber
=
ReadInt8
(
fd
);
new
->
viewx
=
ReadInt32
(
fd
);
new
->
viewheight
=
ReadInt32
(
fd
);
new
->
transx
=
ReadInt32
(
fd
);
new
->
transy
=
ReadInt32
(
fd
);
new
->
angle
=
ReadInt32
(
fd
);
new
->
hitpoints
=
ReadInt32
(
fd
);
new
->
speed
=
ReadInt32
(
fd
);
new
->
temp1
=
ReadInt32
(
fd
);
new
->
temp2
=
ReadInt32
(
fd
);
new
->
temp3
=
ReadInt32
(
fd
);
for
(
y
=
0
;
y
<
64
;
y
++
)
for
(
x
=
0
;
x
<
64
;
x
++
)
if
(
actorat
[
y
][
x
]
==
(
id
|
0x8000
))
actorat
[
y
][
x
]
=
new
->
id
|
0x8000
;
}
DiskFlopAnim
(
dx
,
dy
);
laststatobj
=
statobjlist
+
ReadInt32
(
fd
);
/* ptr offset */
for
(
i
=
0
;
i
<
400
;
i
++
)
{
/* MAXSTATS */
statobjlist
[
i
].
tilex
=
ReadInt8
(
fd
);
statobjlist
[
i
].
tiley
=
ReadInt8
(
fd
);
statobjlist
[
i
].
shapenum
=
ReadInt32
(
fd
);
statobjlist
[
i
].
flags
=
ReadInt8
(
fd
);
statobjlist
[
i
].
itemnumber
=
ReadInt8
(
fd
);
statobjlist
[
i
].
visspot
=
&
spotvis
[
statobjlist
[
i
].
tilex
][
statobjlist
[
i
].
tiley
];
}
DiskFlopAnim
(
dx
,
dy
);
for
(
i
=
0
;
i
<
64
;
i
++
)
{
/* MAXDOORS */
doorposition
[
i
]
=
ReadInt32
(
fd
);
}
DiskFlopAnim
(
dx
,
dy
);
for
(
i
=
0
;
i
<
64
;
i
++
)
{
/* MAXDOORS */
doorobjlist
[
i
].
tilex
=
ReadInt8
(
fd
);
doorobjlist
[
i
].
tiley
=
ReadInt8
(
fd
);
doorobjlist
[
i
].
vertical
=
ReadInt8
(
fd
);
doorobjlist
[
i
].
lock
=
ReadInt8
(
fd
);
doorobjlist
[
i
].
action
=
ReadInt8
(
fd
);
doorobjlist
[
i
].
ticcount
=
ReadInt32
(
fd
);
}
DiskFlopAnim
(
dx
,
dy
);
pwallstate
=
ReadInt32
(
fd
);
pwallx
=
ReadInt32
(
fd
);
pwally
=
ReadInt32
(
fd
);
pwalldir
=
ReadInt32
(
fd
);
pwallpos
=
ReadInt32
(
fd
);
DiskFlopAnim
(
dx
,
dy
);
CloseRead
(
fd
);
return
0
;
loadfail:
if
(
fd
!=
-
1
)
CloseRead
(
fd
);
DiskFlopAnim
(
x
,
y
);
CA_FarRead
(
file
,(
void
*
)
&
laststatobj
,
sizeof
(
laststatobj
));
checksum
=
DoChecksum
((
byte
*
)
&
laststatobj
,
sizeof
(
laststatobj
),
checksum
);
DiskFlopAnim
(
x
,
y
);
CA_FarRead
(
file
,(
void
*
)
statobjlist
,
sizeof
(
statobjlist
));
checksum
=
DoChecksum
((
byte
*
)
statobjlist
,
sizeof
(
statobjlist
),
checksum
);
DiskFlopAnim
(
x
,
y
);
CA_FarRead
(
file
,(
void
*
)
doorposition
,
sizeof
(
doorposition
));
checksum
=
DoChecksum
((
byte
*
)
doorposition
,
sizeof
(
doorposition
),
checksum
);
DiskFlopAnim
(
x
,
y
);
CA_FarRead
(
file
,(
void
*
)
doorobjlist
,
sizeof
(
doorobjlist
));
checksum
=
DoChecksum
((
byte
*
)
doorobjlist
,
sizeof
(
doorobjlist
),
checksum
);
DiskFlopAnim
(
x
,
y
);
CA_FarRead
(
file
,(
void
*
)
&
pwallstate
,
sizeof
(
pwallstate
));
checksum
=
DoChecksum
((
byte
*
)
&
pwallstate
,
sizeof
(
pwallstate
),
checksum
);
CA_FarRead
(
file
,(
void
*
)
&
pwallx
,
sizeof
(
pwallx
));
checksum
=
DoChecksum
((
byte
*
)
&
pwallx
,
sizeof
(
pwallx
),
checksum
);
CA_FarRead
(
file
,(
void
*
)
&
pwally
,
sizeof
(
pwally
));
checksum
=
DoChecksum
((
byte
*
)
&
pwally
,
sizeof
(
pwally
),
checksum
);
CA_FarRead
(
file
,(
void
*
)
&
pwalldir
,
sizeof
(
pwalldir
));
checksum
=
DoChecksum
((
byte
*
)
&
pwalldir
,
sizeof
(
pwalldir
),
checksum
);
CA_FarRead
(
file
,(
void
*
)
&
pwallpos
,
sizeof
(
pwallpos
));
checksum
=
DoChecksum
((
byte
*
)
&
pwallpos
,
sizeof
(
pwallpos
),
checksum
);
CA_FarRead
(
file
,
(
void
*
)
&
oldchecksum
,
sizeof
(
oldchecksum
));
if
(
oldchecksum
!=
checksum
)
{
Message
(
STR_SAVECHT1
"
\n
"
STR_SAVECHT2
"
\n
"
STR_SAVECHT3
"
\n
"
...
...
@@ -471,18 +717,11 @@ boolean LoadTheGame(int file,int x,int y)
IN_ClearKeysDown
();
IN_Ack
();
gamestate
.
score
=
0
;
gamestate
.
lives
=
1
;
gamestate
.
weapon
=
gamestate
.
chosenweapon
=
gamestate
.
bestweapon
=
wp_pistol
;
gamestate
.
ammo
=
8
;
}
return
true
;
NewGame
(
1
,
0
);
return
-
1
;
}
/
/===========================================================================
/
* ======================================================================== */
/*
=================
...
...
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,15 +1327,8 @@ 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,15 +2597,13 @@ void SetupControlPanel()
which
=
f
.
ff_name
[
7
]
-
'0'
;
if
(
which
<
10
)
{
int
handle
;
char
temp
[
32
];
if
(
ReadSaveTag
(
f
.
ff_name
,
temp
)
!=
-
1
)
{
SaveGamesAvail
[
which
]
=
1
;
handle
=
open
(
f
.
ff_name
,
O_BINARY
);
read
(
handle
,
temp
,
32
);
close
(
handle
);
strcpy
(
&
SaveGameNames
[
which
][
0
],
temp
);
}
}
}
while
(
!
findnext
(
&
f
));
#else
struct
_finddata_t
f
;
...
...
@@ -2666,15 +2639,13 @@ void SetupControlPanel()
which
=
f
.
name
[
7
]
-
'0'
;
if
(
which
<
10
)
{
int
handle
;
char
temp
[
32
];
if
(
ReadSaveTag
(
f
.
name
,
temp
)
!=
-
1
)
{
SaveGamesAvail
[
which
]
=
1
;
handle
=
open
(
f
.
name
,
O_BINARY
);
read
(
handle
,
temp
,
32
);
close
(
handle
);
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