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
609432be
Commit
609432be
authored
Apr 22, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Demo loop works, time for gfx mode
parent
3665f119
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
117 additions
and
69 deletions
+117
-69
Makefile
src/Makefile
+1
-3
TODO
src/TODO
+2
-0
id_ca.c
src/id_ca.c
+95
-33
id_ca.h
src/id_ca.h
+5
-3
id_sd.h
src/id_sd.h
+4
-15
wl_game.c
src/wl_game.c
+4
-4
wl_inter.c
src/wl_inter.c
+1
-1
wl_main.c
src/wl_main.c
+1
-1
wl_menu.c
src/wl_menu.c
+4
-7
wl_play.c
src/wl_play.c
+0
-2
No files found.
src/Makefile
View file @
609432be
...
...
@@ -10,10 +10,8 @@ OBJS = objs.o misc.o id_ca.o id_in.o id_sd.o id_vl.o id_vh.o id_us.o \
wl_debug.o
#LFLAGS = -lm -lvga -pg
LFLAGS
=
-lm
-lvga
LFLAGS
=
-lm
-lvga
ElectricFence-2.2.2/libefence.a
-lpthread
#LFLAGS = /home/relnev/midas/lib/linux/gcdebug/libmidas.a -lpthread -lm -lvga
# /home/relnev/ElectricFence-2.0.5/libefence.a -lm -lvga
NASM
=
nasm
.SUFFIXES
:
.asm
...
...
src/TODO
View file @
609432be
...
...
@@ -9,3 +9,5 @@ in an effort to not allocate everything to memory and forget about it
* remove virtualreality
* clean up header files, especially wl_def.h, where some externs arent in
the right place
* every structure that is read/written must be PACKED, with datatypes
specifically set! (ie, no int, but short or long int)
src/id_ca.c
View file @
609432be
...
...
@@ -58,8 +58,6 @@ char extension[5],
aheadname
[
10
]
=
"audiohed."
,
afilename
[
10
]
=
"audiot."
;
void
CA_CannotOpen
(
char
*
string
);
long
*
grstarts
;
/* array of offsets in vgagraph, -1 for sparse */
long
*
audiostarts
;
/* array of offsets in audio / audiot */
...
...
@@ -125,6 +123,17 @@ void CAL_GetGrChunkLength (int chunk)
chunkcomplen
=
GRFILEPOS
(
chunk
+
1
)
-
GRFILEPOS
(
chunk
)
-
4
;
}
void
CA_CannotOpen
(
char
*
string
)
{
/* TODO Ow, string must be a small one else boom */
char
str
[
30
];
strcpy
(
str
,
"Can't open "
);
strcat
(
str
,
string
);
strcat
(
str
,
"!
\n
"
);
Quit
(
str
);
}
/*
==========================
=
...
...
@@ -286,6 +295,7 @@ boolean CA_LoadFile (char *filename, memptr *ptr)
======================
*/
/* From Ryan C. Gordon -- ryan_gordon@hotmail.com */
#if 1
void
CAL_HuffExpand
(
byte
*
source
,
byte
*
dest
,
long
length
,
huffnode
*
htable
)
{
huffnode
*
headptr
;
...
...
@@ -314,7 +324,49 @@ void CAL_HuffExpand(byte *source, byte *dest, long length, huffnode *htable)
nodeon
=
(
htable
+
(
path
-
256
));
}
while
(
dest
!=
endoff
);
}
#else
void
CAL_HuffExpand
(
byte
*
source
,
byte
*
dest
,
long
length
,
huffnode
*
hufftable
)
{
int
x
;
huffnode
*
headptr
,
*
nodeon
;
byte
*
ptr
,
*
ptrd
,
*
ptrm
;
byte
a
,
mask
;
unsigned
short
int
b
;
ptrd
=
dest
;
headptr
=
hufftable
+
254
;
/* head node is allways node 254 */
nodeon
=
headptr
;
ptr
=
source
;
a
=
*
ptr
;
ptr
++
;
mask
=
1
;
for
(
x
=
0
;
x
<
length
;
x
++
)
{
again:
if
(
a
&
mask
)
b
=
nodeon
->
bit1
;
else
b
=
nodeon
->
bit0
;
mask
<<=
1
;
if
(
mask
==
0
)
{
a
=
*
ptr
;
ptr
++
;
mask
=
1
;
}
if
(
b
&
0xFF00
)
{
nodeon
=
hufftable
+
(
b
-
256
);
goto
again
;
}
else
{
nodeon
=
headptr
;
*
ptrd
=
(
b
&
0x00FF
);
ptrd
++
;
}
}
}
#endif
/*
======================
=
...
...
@@ -696,14 +748,14 @@ void CA_Shutdown (void)
======================
*/
void
CA_CacheAudioChunk
(
int
chunk
)
void
CA_CacheAudioChunk
(
int
chunk
)
{
long
pos
,
compressed
;
if
(
audiosegs
[
chunk
])
{
MM_SetPurge
((
memptr
)
&
audiosegs
[
chunk
],
0
);
return
;
// allready in memory
return
;
}
//
...
...
@@ -715,11 +767,22 @@ void CA_CacheAudioChunk (int chunk)
lseek
(
audiohandle
,
pos
,
SEEK_SET
);
MM_GetPtr
((
memptr
)
&
audiosegs
[
chunk
],
compressed
);
MM_GetPtr
((
memptr
)
&
audiosegs
[
chunk
],
compressed
);
CA_FarRead
(
audiohandle
,
audiosegs
[
chunk
],
compressed
);
}
void
CA_UnCacheAudioChunk
(
int
chunk
)
{
if
(
audiosegs
[
chunk
]
==
0
)
{
fprintf
(
stderr
,
"Trying to free null audio chunk %d!
\n
"
,
chunk
);
return
;
}
MM_FreePtr
((
memptr
*
)
&
audiosegs
[
chunk
]);
audiosegs
[
chunk
]
=
0
;
}
//===========================================================================
/*
...
...
@@ -786,11 +849,10 @@ cachein:
======================
*/
void
CAL_ExpandGrChunk
(
int
chunk
,
byte
*
source
)
void
CAL_ExpandGrChunk
(
int
chunk
,
byte
*
source
)
{
long
expanded
;
if
(
chunk
>=
STARTTILE8
&&
chunk
<
STARTEXTERNS
)
{
//
...
...
@@ -801,7 +863,7 @@ void CAL_ExpandGrChunk (int chunk, byte *source)
#define MASKBLOCK 128
if
(
chunk
<
STARTTILE8M
)
// tile 8s are all in one chunk!
expanded
=
BLOCK
*
NUMTILE8
;
expanded
=
BLOCK
*
NUMTILE8
/
4
;
/* hmm */
else
if
(
chunk
<
STARTTILE16
)
expanded
=
MASKBLOCK
*
NUMTILE8M
;
else
if
(
chunk
<
STARTTILE16M
)
// all other tiles are one/chunk
...
...
@@ -818,7 +880,7 @@ void CAL_ExpandGrChunk (int chunk, byte *source)
//
// everything else has an explicit size longword
//
expanded
=
*
(
long
*
)
source
;
expanded
=
*
(
(
long
*
)
source
)
;
source
+=
4
;
// skip over length
}
...
...
@@ -826,8 +888,8 @@ void CAL_ExpandGrChunk (int chunk, byte *source)
// allocate final space, decompress it, and free bigbuffer
// Sprites need to have shifts made and various other junk
//
MM_GetPtr
(
&
grsegs
[
chunk
],
expanded
);
CAL_HuffExpand
(
source
,
grsegs
[
chunk
],
expanded
,
grhuffman
);
MM_GetPtr
(
&
grsegs
[
chunk
],
expanded
);
CAL_HuffExpand
(
source
,
grsegs
[
chunk
],
expanded
,
grhuffman
);
}
...
...
@@ -844,18 +906,18 @@ void CAL_ExpandGrChunk (int chunk, byte *source)
void
CA_CacheGrChunk
(
int
chunk
)
{
long
pos
,
compressed
;
memptr
bigbufferseg
;
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
)
)
/* make sure this works ok */
return
;
grneeded
[
chunk
]
|=
ca_levelbit
;
/* make sure it doesn't get removed */
if
(
grsegs
[
chunk
])
{
MM_SetPurge
(
&
grsegs
[
chunk
],
0
);
return
;
// allready in memory
MM_SetPurge
(
&
grsegs
[
chunk
],
0
);
return
;
}
//
...
...
@@ -874,17 +936,27 @@ void CA_CacheGrChunk(int chunk)
lseek
(
grhandle
,
pos
,
SEEK_SET
);
MM_GetPtr
(
&
bigbufferseg
,
compressed
);
MM_SetLock
(
&
bigbufferseg
,
true
);
CA_FarRead
(
grhandle
,
bigbufferseg
,
compressed
);
source
=
bigbufferseg
;
MM_GetPtr
((
memptr
)
&
source
,
compressed
);
CA_FarRead
(
grhandle
,
source
,
compressed
);
CAL_ExpandGrChunk
(
chunk
,
source
);
CAL_ExpandGrChunk
(
chunk
,
source
);
MM_FreePtr
(
&
bigbufferseg
);
MM_FreePtr
(
(
memptr
)
&
source
);
}
void
CA_UnCacheGrChunk
(
int
chunk
)
{
if
(
grsegs
[
chunk
]
==
0
)
{
fprintf
(
stderr
,
"Trying to free null pointer %d!
\n
"
,
chunk
);
return
;
}
MM_FreePtr
(
&
grsegs
[
chunk
]);
grneeded
[
chunk
]
&=
~
ca_levelbit
;
/* Or should MM_FreePtr set it to zero? */
grsegs
[
chunk
]
=
0
;
}
//==========================================================================
...
...
@@ -898,7 +970,7 @@ void CA_CacheGrChunk(int chunk)
======================
*/
void
CA_CacheScreen
(
int
chunk
)
void
CA_CacheScreen
(
int
chunk
)
{
long
pos
,
compressed
,
expanded
;
memptr
bigbufferseg
;
...
...
@@ -1257,16 +1329,6 @@ void CA_CacheMarks (void)
}
#endif
void
CA_CannotOpen
(
char
*
string
)
{
char
str
[
30
];
strcpy
(
str
,
"Can't open "
);
strcat
(
str
,
string
);
strcat
(
str
,
"!
\n
"
);
Quit
(
str
);
}
/*
=============================================================================
...
...
src/id_ca.h
View file @
609432be
...
...
@@ -6,7 +6,7 @@
#define NUMMAPS 60
#define MAPPLANES 2
#define UNCACHEGRCHUNK
(chunk) {MM_FreePtr(&grsegs[chunk]);grneeded[chunk]&=~ca_levelbit;}
#define UNCACHEGRCHUNK
CA_UnCacheGrChunk
//===========================================================================
...
...
@@ -60,11 +60,13 @@ void CA_Startup (void);
void
CA_Shutdown
(
void
);
void
CA_SetGrPurge
(
void
);
void
CA_CacheAudioChunk
(
int
chunk
);
void
CA_CacheAudioChunk
(
int
chunk
);
void
CA_UnCacheAudioChunk
(
int
chunk
);
void
CA_LoadAllSounds
(
void
);
void
CA_CacheMap
(
int
mapnum
);
void
CA_CacheGrChunk
(
int
chunk
);
void
CA_CacheGrChunk
(
int
chunk
);
void
CA_UnCacheGrChunk
(
int
chunk
);
void
CA_UpLevel
(
void
);
void
CA_DownLevel
(
void
);
...
...
src/id_sd.h
View file @
609432be
...
...
@@ -139,20 +139,9 @@ typedef struct
#define sf_Melodic 0
#define sf_Percussive 1
#if 1
typedef
struct
{
word
length
,
values
[
1
];
}
MusicGroup
;
#else
typedef
struct
{
word
flags
,
count
,
offsets
[
1
];
}
MusicGroup
;
#endif
typedef
struct
{
word
length
,
values
[
1
];
}
PACKED
MusicGroup
;
typedef
struct
{
...
...
src/wl_game.c
View file @
609432be
...
...
@@ -835,12 +835,12 @@ void DrawPlayScreen (void)
VW_FadeOut
();
CA_CacheGrChunk
(
STATUSBARPIC
);
CA_CacheGrChunk
(
STATUSBARPIC
);
DrawPlayBorder
();
VWB_DrawPic
(
0
,
200
-
STATUSLINES
,
STATUSBARPIC
);
DrawPlayBorder
();
VWB_DrawPic
(
0
,
200
-
STATUSLINES
,
STATUSBARPIC
);
UNCACHEGRCHUNK
(
STATUSBARPIC
);
CA_UnCacheGrChunk
(
STATUSBARPIC
);
DrawFace
();
DrawHealth
();
...
...
src/wl_inter.c
View file @
609432be
...
...
@@ -1677,7 +1677,7 @@ void CopyProtection(void)
}
for
(
i
=
0
;
i
<
NUMSOUNDS
;
i
++
,
start
++
)
MM_FreePtr
((
memptr
*
)
&
audiosegs
[
start
]
);
CA_UnCacheAudioChunk
(
start
);
return
;
}
}
...
...
src/wl_main.c
View file @
609432be
...
...
@@ -537,7 +537,7 @@ void BuildTables (void)
sintable
[
i
+
ANGLES
]
=
sintable
[
ANGLES
/
2
-
i
]
=
value
;
sintable
[
ANGLES
-
i
]
=
sintable
[
ANGLES
/
2
+
i
]
=
value
|
0x80000000l
;
sintable
[
ANGLES
/
2
+
i
]
=
-
value
;
angle
+=
anglestep
;
}
...
...
src/wl_menu.c
View file @
609432be
...
...
@@ -3604,24 +3604,21 @@ void StartCPMusic(int song)
{
musicnames
chunk
;
if
(
audiosegs
[
STARTMUSIC
+
lastmusic
])
// JDC
MM_FreePtr
((
memptr
*
)
&
audiosegs
[
STARTMUSIC
+
lastmusic
]);
CA_UnCacheAudioChunk
(
STARTMUSIC
+
lastmusic
);
lastmusic
=
song
;
SD_MusicOff
();
chunk
=
song
;
MM_BombOnError
(
false
);
CA_CacheAudioChunk
(
STARTMUSIC
+
chunk
);
MM_BombOnError
(
true
);
MM_SetLock
((
memptr
*
)
&
(
audiosegs
[
STARTMUSIC
+
chunk
]),
true
);
SD_StartMusic
((
MusicGroup
*
)
audiosegs
[
STARTMUSIC
+
chunk
]);
}
void
FreeMusic
(
void
)
void
FreeMusic
(
void
)
{
if
(
audiosegs
[
STARTMUSIC
+
lastmusic
])
// JDC
MM_FreePtr
((
memptr
*
)
&
audiosegs
[
STARTMUSIC
+
lastmusic
]);
CA_UnCacheAudioChunk
(
STARTMUSIC
+
lastmusic
);
}
...
...
src/wl_play.c
View file @
609432be
...
...
@@ -975,9 +975,7 @@ void StartMusic(void)
// if ((chunk == -1) || (MusicMode != smm_AdLib))
//DEBUG control panel return;
MM_BombOnError
(
false
);
CA_CacheAudioChunk
(
STARTMUSIC
+
chunk
);
MM_BombOnError
(
true
);
MM_SetLock
((
memptr
)
&
(
audiosegs
[
STARTMUSIC
+
chunk
]),
true
);
SD_StartMusic
((
MusicGroup
*
)
audiosegs
[
STARTMUSIC
+
chunk
]);
}
...
...
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