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
c71617f4
Commit
c71617f4
authored
Dec 10, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
id_ca.c: Cleaned up
parent
33b6fa93
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
168 deletions
+45
-168
IDEAS
src/IDEAS
+2
-6
TODO
src/TODO
+2
-10
id_ca.c
src/id_ca.c
+40
-152
sd_oss.c
src/sd_oss.c
+1
-0
No files found.
src/IDEAS
View file @
c71617f4
------------- Please Disregard the Following Outdated Text: ----------------
* One binary, any game type.
* A key to change viewsize while playing (note: max == 20, min == 5 or so...)
* Game able to cope at any virtual resolution in software mode. OpenGL
handles this transparently (after setting correct glViewport)
* Game able to work with any resolution in software mode
* Audio support using OpenAL
* Add support for the Mac version, if possible
* Network support!
...
...
@@ -25,3 +20,4 @@
* Configuration files and save games which work regardless of operating
system/processor/binary build
* Suite of utilities to edit the game data.
* Resolve any endian issues
src/TODO
View file @
c71617f4
...
...
@@ -13,10 +13,7 @@ Sound Menu:
* Sampling Rate:
- 44100
- 22050
------------- Please Disregard the Following Outdated Text: ----------------
------------------------------------------------------------------------------
*
SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + chunk]);
=>
...
...
@@ -39,7 +36,7 @@ prevent confusion. OR ver.c would depend on the source, but it does not have
a version number, just __TIME__. this version id would be used for
savegames until they are fixed to not use pointers
* use static and const where appropriate
* convert uses of open() to fopen(), etc
* convert uses of open() to fopen(), etc
maybe
* menu code is a mess, always does things differently than the rest of the
code, it really needs to be cleaned up
* id_ca.c cache code: fix/readd/rewrite the "garbage collection" system?
...
...
@@ -92,14 +89,9 @@ directly
* rename visable to visible
* create 'sound channels' with priority.. ie a door can only make one sound
at a time
* cat file.c | perl -e 'while($in = <STDIN>)
{$in =~ s/\/\/(.*)$/\/\* \1\ *\//gm;print $in;}'
or
cat foo.txt |sed -e "s/\/\/\(.*\)$/\/\*\1\*\//g"
* systems with no sound should still have working WaitSoundDone.. it's
possible to calculate the sound lengths in terms of 70Hz (adlib sound len / 2,
pcm sound len / 100).
Things to try:
* Convert to a 320x200xWhatever screen first then draw all at once
* Create a native palette format instead of doing conversions each frame
src/id_ca.c
View file @
c71617f4
...
...
@@ -38,8 +38,8 @@ char extension[5];
#define afilename "audiot."
#define pfilename "vswap."
static
long
*
grstarts
;
/* array of offsets in vgagraph
, -1 for sparse
*/
static
long
*
audiostarts
;
/* array of offsets in audio
/ audio
t */
static
long
*
grstarts
;
/* array of offsets in vgagraph */
static
long
*
audiostarts
;
/* array of offsets in audiot */
static
huffnode
grhuffman
[
255
];
...
...
@@ -47,27 +47,6 @@ static int grhandle; /* handle to VGAGRAPH */
static
int
maphandle
;
/* handle to GAMEMAPS */
static
int
audiohandle
;
/* handle to AUDIOT */
SDMode
oldsoundmode
;
#define FILEPOSSIZE 3
static
long
GRFILEPOS
(
int
c
)
{
long
value
;
int
offset
;
offset
=
c
*
3
;
/* TODO: unaligned access */
value
=
*
(
long
*
)(((
byte
*
)
grstarts
)
+
offset
);
value
&=
0x00ffffffl
;
if
(
value
==
0xffffffl
)
value
=
-
1
;
return
value
;
}
/*
=============================================================================
...
...
@@ -223,7 +202,7 @@ void CAL_HuffExpand(byte *source, byte *dest, long length, huffnode *htable)
{
huffnode
*
headptr
;
huffnode
*
nodeon
;
byte
mask
=
0x0
00
1
;
byte
mask
=
0x01
;
word
path
;
byte
*
endoff
=
dest
+
length
;
...
...
@@ -235,8 +214,8 @@ void CAL_HuffExpand(byte *source, byte *dest, long length, huffnode *htable)
else
path
=
nodeon
->
bit0
;
mask
<<=
1
;
if
(
mask
==
0x00
00
)
{
mask
=
0x0
00
1
;
if
(
mask
==
0x00
)
{
mask
=
0x01
;
source
++
;
}
if
(
path
<
256
)
{
...
...
@@ -354,27 +333,6 @@ void CA_RLEWexpand(word *source, word *dest, long length, word rlewtag)
=============================================================================
*/
/*
============================
=
= CAL_GetGrChunkLength
=
= Gets the length of an explicit length chunk (not tiles)
= The file pointer is positioned so the compressed data can be read in next.
=
============================
*/
static
long
CAL_GetGrChunkLength
(
int
chunk
)
{
long
chunkexplen
;
lseek
(
grhandle
,
GRFILEPOS
(
chunk
),
SEEK_SET
);
read
(
grhandle
,
&
chunkexplen
,
sizeof
(
chunkexplen
));
return
GRFILEPOS
(
chunk
+
1
)
-
GRFILEPOS
(
chunk
)
-
4
;
}
/*
======================
=
...
...
@@ -388,8 +346,10 @@ static void CAL_SetupGrFile()
char
fname
[
13
];
int
handle
;
memptr
compseg
;
long
chunkcomplen
;
byte
*
grtemp
;
int
i
;
//
// load vgadict.ext (huffman dictionary for graphics files)
//
...
...
@@ -405,16 +365,22 @@ static void CAL_SetupGrFile()
//
// load the data offsets from vgahead.ext
//
MM_GetPtr
((
memptr
)
&
grstarts
,
(
NUMCHUNKS
+
1
)
*
FILEPOSSIZE
);
MM_GetPtr
((
memptr
)
&
grstarts
,
(
NUMCHUNKS
+
1
)
*
4
);
MM_GetPtr
((
memptr
)
&
grtemp
,
(
NUMCHUNKS
+
1
)
*
3
);
strcpy
(
fname
,
gheadname
);
strcat
(
fname
,
extension
);
if
((
handle
=
open
(
fname
,
O_RDONLY
|
O_BINARY
))
==
-
1
)
CA_CannotOpen
(
fname
);
CA_FarRead
(
handle
,
(
memptr
)
gr
starts
,
(
NUMCHUNKS
+
1
)
*
FILEPOSSIZE
);
CA_FarRead
(
handle
,
(
memptr
)
gr
temp
,
(
NUMCHUNKS
+
1
)
*
3
);
for
(
i
=
0
;
i
<
NUMCHUNKS
+
1
;
i
++
)
grstarts
[
i
]
=
(
grtemp
[
i
*
3
+
0
]
<<
0
)
|
(
grtemp
[
i
*
3
+
1
]
<<
8
)
|
(
grtemp
[
i
*
3
+
2
]
<<
16
);
MM_FreePtr
((
memptr
)
&
grtemp
);
close
(
handle
);
//
...
...
@@ -429,13 +395,15 @@ static void CAL_SetupGrFile()
//
// load the pic
and sprite headers into the arrays in the data segment
// load the pic
headers into pictable
//
MM_GetPtr
((
memptr
)
&
pictable
,
NUMPICS
*
sizeof
(
pictabletype
));
chunkcomplen
=
CAL_GetGrChunkLength
(
STRUCTPIC
);
MM_GetPtr
(
&
compseg
,
chunkcomplen
);
chunkcomplen
=
grstarts
[
STRUCTPIC
+
1
]
-
grstarts
[
STRUCTPIC
];
lseek
(
grhandle
,
grstarts
[
STRUCTPIC
],
SEEK_SET
);
MM_GetPtr
(
&
compseg
,
chunkcomplen
);
CA_FarRead
(
grhandle
,
compseg
,
chunkcomplen
);
CAL_HuffExpand
(
compseg
,
(
byte
*
)
pictable
,
NUMPICS
*
sizeof
(
pictabletype
),
grhuffman
);
CAL_HuffExpand
(
compseg
+
4
,
(
byte
*
)
pictable
,
NUMPICS
*
sizeof
(
pictabletype
),
grhuffman
);
MM_FreePtr
(
&
compseg
);
}
...
...
@@ -485,16 +453,18 @@ static void CAL_SetupMapFile()
//
// load all map header
//
for
(
i
=
0
;
i
<
NUMMAPS
;
i
++
)
for
(
i
=
0
;
i
<
NUMMAPS
;
i
++
)
{
pos
=
tinf
->
headeroffsets
[
i
];
if
(
pos
<
0
)
/* $FFFFFFFF start is a sparse map */
if
(
pos
==
0
)
{
mapheaderseg
[
i
]
=
NULL
;
continue
;
MM_GetPtr
((
memptr
)
&
mapheaderseg
[
i
],
sizeof
(
maptype
));
}
MM_GetPtr
((
memptr
)
&
mapheaderseg
[
i
],
sizeof
(
maptype
));
MM_SetLock
((
memptr
)
&
mapheaderseg
[
i
],
true
);
lseek
(
maphandle
,
pos
,
SEEK_SET
);
CA_FarRead
(
maphandle
,(
memptr
)
mapheaderseg
[
i
],
sizeof
(
maptype
));
lseek
(
maphandle
,
pos
,
SEEK_SET
);
CA_FarRead
(
maphandle
,
(
memptr
)
mapheaderseg
[
i
],
sizeof
(
maptype
));
}
//
...
...
@@ -567,9 +537,6 @@ void CA_Startup()
mapon
=
-
1
;
}
//==========================================================================
/*
======================
=
...
...
@@ -633,8 +600,6 @@ void CA_UnCacheAudioChunk(int chunk)
audiosegs
[
chunk
]
=
0
;
}
//===========================================================================
/*
======================
=
...
...
@@ -649,43 +614,8 @@ void CA_LoadAllSounds()
{
unsigned
start
,
i
;
#if 0
switch (oldsoundmode)
{
case sdm_PC:
start = STARTPCSOUNDS;
break;
case sdm_AdLib:
start = STARTADLIBSOUNDS;
break;
default:
goto cachein;
}
for (i=0;i<NUMSOUNDS;i++,start++)
if (audiosegs[start])
MM_SetPurge ((memptr)&audiosegs[start],3);
// make purgable
cachein:
switch (SoundMode)
{
case sdm_PC:
start = STARTPCSOUNDS;
break;
case sdm_AdLib:
start = STARTADLIBSOUNDS;
break;
default:
return;
}
#endif
for
(
start
=
STARTADLIBSOUNDS
,
i
=
0
;
i
<
NUMSOUNDS
;
i
++
,
start
++
)
CA_CacheAudioChunk
(
start
);
oldsoundmode
=
SoundMode
;
}
//===========================================================================
...
...
@@ -711,7 +641,7 @@ static void CAL_ExpandGrChunk(int chunk, byte *source)
if
(
chunk
>=
STARTTILE8
&&
chunk
<
STARTEXTERNS
)
{
//
// expanded sizes of tile8
/16/32
are implicit
// expanded sizes of tile8 are implicit
//
expanded
=
(
8
*
8
)
*
NUMTILE8
;
width
=
8
;
...
...
@@ -744,7 +674,6 @@ static void CAL_ExpandGrChunk(int chunk, byte *source)
}
}
/*
======================
=
...
...
@@ -759,7 +688,6 @@ void CA_CacheGrChunk(int chunk)
{
long
pos
,
compressed
;
byte
*
source
;
int
next
;
/* this is due to Quit() wanting to cache the error screen before this has been set up! */
if
(
(
grhandle
==
0
)
||
(
grhandle
==
-
1
)
)
...
...
@@ -772,15 +700,9 @@ void CA_CacheGrChunk(int chunk)
//
// load the chunk into a buffer
//
pos
=
GRFILEPOS
(
chunk
);
if
(
pos
<
0
)
/* $FFFFFFFF start is a sparse tile */
return
;
pos
=
grstarts
[
chunk
];
next
=
chunk
+
1
;
while
(
GRFILEPOS
(
next
)
==
-
1
)
// skip past any sparse tiles
next
++
;
compressed
=
GRFILEPOS
(
next
)
-
pos
;
compressed
=
grstarts
[
chunk
+
1
]
-
pos
;
lseek
(
grhandle
,
pos
,
SEEK_SET
);
...
...
@@ -799,13 +721,11 @@ void CA_UnCacheGrChunk(int chunk)
return
;
}
MM_FreePtr
((
void
*
)
&
grsegs
[
chunk
]);
MM_FreePtr
((
memptr
)
&
grsegs
[
chunk
]);
grsegs
[
chunk
]
=
0
;
}
//==========================================================================
/*
======================
=
...
...
@@ -818,44 +738,12 @@ void CA_UnCacheGrChunk(int chunk)
void
CA_CacheScreen
(
int
chunk
)
{
long
pos
,
compressed
,
expanded
;
memptr
bigbufferseg
;
byte
*
source
,
*
dest
;
int
next
;
//
// load the chunk into a buffer
//
pos
=
GRFILEPOS
(
chunk
);
next
=
chunk
+
1
;
while
(
GRFILEPOS
(
next
)
==
-
1
)
// skip past any sparse tiles
next
++
;
compressed
=
GRFILEPOS
(
next
)
-
pos
;
lseek
(
grhandle
,
pos
,
SEEK_SET
);
MM_GetPtr
(
&
bigbufferseg
,
compressed
);
MM_SetLock
(
&
bigbufferseg
,
true
);
CA_FarRead
(
grhandle
,
bigbufferseg
,
compressed
);
source
=
bigbufferseg
;
expanded
=
*
(
long
*
)
source
;
source
+=
4
;
// skip over length
//
// allocate final space, decompress it, and free bigbuffer
//
MM_GetPtr
((
void
*
)
&
dest
,
expanded
);
CAL_HuffExpand
(
source
,
dest
,
expanded
,
grhuffman
);
VL_DeModeXize
(
dest
,
320
,
200
);
VL_MemToScreen
(
dest
,
320
,
200
,
0
,
0
);
MM_FreePtr
(
&
bigbufferseg
);
MM_FreePtr
((
void
*
)
&
dest
);
CA_CacheGrChunk
(
chunk
);
VL_MemToScreen
(
grsegs
[
chunk
],
320
,
200
,
0
,
0
);
CA_UnCacheGrChunk
(
chunk
);
}
/
/==========================================================================
/
* ======================================================================== */
/*
======================
...
...
@@ -962,7 +850,7 @@ static int PageFile = -1;
word
ChunksInFile
;
word
PMSpriteStart
,
PMSoundStart
;
PageListStruct
*
PMPages
,
*
PMSegPages
;
PageListStruct
*
PMPages
;
//
// PML_ReadFromFile() - Reads some data in from the page file
...
...
src/sd_oss.c
View file @
c71617f4
...
...
@@ -231,6 +231,7 @@ void Blah()
MM_GetPtr
(
&
list
,
PMPageSize
);
p
=
PM_GetPage
(
ChunksInFile
-
1
);
memcpy
((
void
*
)
list
,(
void
*
)
p
,
PMPageSize
);
pg
=
PMSoundStart
;
for
(
i
=
0
;
i
<
PMPageSize
/
(
sizeof
(
word
)
*
2
);
i
++
,
p
+=
2
)
{
...
...
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