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
f731c88d
Commit
f731c88d
authored
Dec 06, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed more unused code.
vi_null.c: Added stub version of video/input code
parent
81ab1d53
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
825 additions
and
412 deletions
+825
-412
TODO
src/TODO
+2
-5
id_ca.c
src/id_ca.c
+15
-346
id_ca.h
src/id_ca.h
+8
-22
id_heads.h
src/id_heads.h
+13
-11
vi_null.c
src/vi_null.c
+773
-0
wl_agent.c
src/wl_agent.c
+14
-18
wl_text.c
src/wl_text.c
+0
-10
No files found.
src/TODO
View file @
f731c88d
...
@@ -39,6 +39,7 @@ savegames until they are fixed to not use pointers
...
@@ -39,6 +39,7 @@ savegames until they are fixed to not use pointers
* menu code is a mess, always does things differently than the rest of the
* menu code is a mess, always does things differently than the rest of the
code, it really needs to be cleaned up
code, it really needs to be cleaned up
* id_ca.c cache code: fix/readd/rewrite the "garbage collection" system?
* id_ca.c cache code: fix/readd/rewrite the "garbage collection" system?
* rewrite id_ca.c: uniform memory handling system
* clean up header files, especially wl_def.h, where some declarations aren't
* clean up header files, especially wl_def.h, where some declarations aren't
in the right place
in the right place
* every structure that is read/written must be PACKED, with datatypes
* every structure that is read/written must be PACKED, with datatypes
...
@@ -69,9 +70,6 @@ function with same parameters, only difference is the name)
...
@@ -69,9 +70,6 @@ function with same parameters, only difference is the name)
* look for places where gfx needs to be redrawn, like back to game etc
* look for places where gfx needs to be redrawn, like back to game etc
* fizzlefade is hackish, stipple buf would work ok in opengl, maybe only
* fizzlefade is hackish, stipple buf would work ok in opengl, maybe only
update once per frame or such...
update once per frame or such...
and where is that stray pixel coming from (during fizzlefade with largest
window size, for example) in svgalib -- is that another bug with my geforce?
no idea how to do fizzlefade in TrueColor X
* check filehandling (ex, file missing, bad file type, and such)
* check filehandling (ex, file missing, bad file type, and such)
PlayDemoFromFile specifically
PlayDemoFromFile specifically
* make sure all infinite loops are found (looping around Keyboard)
* make sure all infinite loops are found (looping around Keyboard)
...
@@ -81,8 +79,7 @@ same with the spear of destiny animation part of ending
...
@@ -81,8 +79,7 @@ same with the spear of destiny animation part of ending
* move all references to gfxbuf to vi_* only (gl will need this anyway,
* move all references to gfxbuf to vi_* only (gl will need this anyway,
since it would replace id_vh, (parts of) wl_draw, wl_scale)
since it would replace id_vh, (parts of) wl_draw, wl_scale)
by putting in code from id_vh (either by using Plot or just copying it in)
by putting in code from id_vh (either by using Plot or just copying it in)
we can stop the large conversion before each UpdateScreen
we can mostly stop the large conversion before each UpdateScreen
but palette fades will still need it!
* the higher depths are a hack since a palette lookup has to be done
* the higher depths are a hack since a palette lookup has to be done
for every byte when transferring to the pixmap, palette fades require a
for every byte when transferring to the pixmap, palette fades require a
screen update
screen update
...
...
src/id_ca.c
View file @
f731c88d
...
@@ -30,9 +30,6 @@ maptype *mapheaderseg[NUMMAPS];
...
@@ -30,9 +30,6 @@ maptype *mapheaderseg[NUMMAPS];
byte
*
audiosegs
[
NUMSNDCHUNKS
];
byte
*
audiosegs
[
NUMSNDCHUNKS
];
byte
*
grsegs
[
NUMCHUNKS
];
byte
*
grsegs
[
NUMCHUNKS
];
static
byte
grneeded
[
NUMCHUNKS
];
static
byte
ca_levelbit
,
ca_levelnum
;
char
extension
[
5
],
char
extension
[
5
],
gheadname
[
10
]
=
"vgahead."
,
gheadname
[
10
]
=
"vgahead."
,
gfilename
[
10
]
=
"vgagraph."
,
gfilename
[
10
]
=
"vgagraph."
,
...
@@ -62,6 +59,7 @@ static long GRFILEPOS(int c)
...
@@ -62,6 +59,7 @@ static long GRFILEPOS(int c)
offset
=
c
*
3
;
offset
=
c
*
3
;
/* TODO: unaligned access */
value
=
*
(
long
*
)(((
byte
*
)
grstarts
)
+
offset
);
value
=
*
(
long
*
)(((
byte
*
)
grstarts
)
+
offset
);
value
&=
0x00ffffffl
;
value
&=
0x00ffffffl
;
...
@@ -82,7 +80,6 @@ static long GRFILEPOS(int c)
...
@@ -82,7 +80,6 @@ static long GRFILEPOS(int c)
static
void
CA_CannotOpen
(
char
*
string
)
static
void
CA_CannotOpen
(
char
*
string
)
{
{
/* TODO Ow, string must be a small one else boom */
char
str
[
30
];
char
str
[
30
];
strcpy
(
str
,
"Can't open "
);
strcpy
(
str
,
"Can't open "
);
...
@@ -218,7 +215,6 @@ boolean CA_LoadFile(char *filename, memptr *ptr)
...
@@ -218,7 +215,6 @@ boolean CA_LoadFile(char *filename, memptr *ptr)
======================
======================
=
=
= CAL_HuffExpand
= CAL_HuffExpand
=
= Length is the length of the EXPANDED data
= Length is the length of the EXPANDED data
=
=
======================
======================
...
@@ -258,7 +254,6 @@ void CAL_HuffExpand(byte *source, byte *dest, long length, huffnode *htable)
...
@@ -258,7 +254,6 @@ void CAL_HuffExpand(byte *source, byte *dest, long length, huffnode *htable)
======================
======================
=
=
= CAL_CarmackExpand
= CAL_CarmackExpand
=
= Length is the length of the EXPANDED data
= Length is the length of the EXPANDED data
=
=
======================
======================
...
@@ -572,8 +567,6 @@ void CA_Startup()
...
@@ -572,8 +567,6 @@ void CA_Startup()
CAL_SetupAudioFile
();
CAL_SetupAudioFile
();
mapon
=
-
1
;
mapon
=
-
1
;
ca_levelbit
=
1
;
ca_levelnum
=
0
;
}
}
//==========================================================================
//==========================================================================
...
@@ -774,8 +767,6 @@ void CA_CacheGrChunk(int chunk)
...
@@ -774,8 +767,6 @@ void CA_CacheGrChunk(int chunk)
if
(
(
grhandle
==
0
)
||
(
grhandle
==
-
1
)
)
if
(
(
grhandle
==
0
)
||
(
grhandle
==
-
1
)
)
return
;
return
;
grneeded
[
chunk
]
|=
ca_levelbit
;
/* make sure it doesn't get removed */
if
(
grsegs
[
chunk
])
{
if
(
grsegs
[
chunk
])
{
return
;
return
;
}
}
...
@@ -811,7 +802,6 @@ void CA_UnCacheGrChunk(int chunk)
...
@@ -811,7 +802,6 @@ void CA_UnCacheGrChunk(int chunk)
}
}
MM_FreePtr
((
void
*
)
&
grsegs
[
chunk
]);
MM_FreePtr
((
void
*
)
&
grsegs
[
chunk
]);
grneeded
[
chunk
]
&=
~
ca_levelbit
;
grsegs
[
chunk
]
=
0
;
grsegs
[
chunk
]
=
0
;
}
}
...
@@ -926,310 +916,44 @@ void CA_CacheMap(int mapnum)
...
@@ -926,310 +916,44 @@ void CA_CacheMap(int mapnum)
}
}
}
}
//===========================================================================
/* ======================================================================== */
/*
======================
=
= CA_UpLevel
=
= Goes up a bit level in the needed lists and clears it out.
= Everything is made purgable
=
======================
*/
void
CA_UpLevel
()
void
CA_UpLevel
()
{
{
/*
int i;
if (ca_levelnum==7)
Quit ("CA_UpLevel: Up past level 7!");
for (i=0;i<NUMCHUNKS;i++)
if (grsegs[i])
MM_SetPurge ((memptr)&grsegs[i],3);
ca_levelbit<<=1;
ca_levelnum++;
*/
}
}
//===========================================================================
void
CA_DownLevel
()
/*
======================
=
= CA_DownLevel
=
= Goes down a bit level in the needed lists and recaches
= everything from the lower level
=
======================
*/
void
CA_DownLevel
(
d
)
{
{
/*
if (!ca_levelnum)
Quit ("CA_DownLevel: Down past level 0!");
ca_levelbit>>=1;
ca_levelnum--;
CA_CacheMarks();
*/
}
}
//===========================================================================
/*
======================
=
= CA_ClearMarks
=
= Clears out all the marks at the current level
=
======================
*/
#if 0
void CA_ClearMarks()
{
int i;
for (i=0;i<NUMCHUNKS;i++)
grneeded[i]&=~ca_levelbit;
}
#endif
//===========================================================================
/*
======================
=
= CA_ClearAllMarks
=
= Clears out all the marks on all the levels
=
======================
*/
#if 0
void CA_ClearAllMarks()
{
memset (grneeded,0,sizeof(grneeded));
ca_levelbit = 1;
ca_levelnum = 0;
}
#endif
//===========================================================================
#if 0
/*
======================
=
= CA_CacheMarks
=
======================
*/
#define MAXEMPTYREAD 1024
void CA_CacheMarks()
{
int i,next,numcache;
long pos,endpos,nextpos,nextendpos,compressed;
long bufferstart,bufferend; // file position of general buffer
byte *source;
memptr bigbufferseg;
numcache = 0;
//
// go through and make everything not needed purgable
//
for (i=0;i<NUMCHUNKS;i++)
if (grneeded[i]&ca_levelbit)
{
if (grsegs[i]) // its allready in memory, make
MM_SetPurge(&grsegs[i],0); // sure it stays there!
else
numcache++;
}
else
{
if (grsegs[i]) // not needed, so make it purgeable
MM_SetPurge(&grsegs[i],3);
}
if (!numcache) // nothing to cache!
return;
//
// go through and load in anything still needed
//
bufferstart = bufferend = 0; // nothing good in buffer now
for (i=0;i<NUMCHUNKS;i++)
if ( (grneeded[i]&ca_levelbit) && !grsegs[i])
{
pos = GRFILEPOS(i);
if (pos<0)
continue;
next = i +1;
while (GRFILEPOS(next) == -1) // skip past any sparse tiles
next++;
compressed = GRFILEPOS(next)-pos;
endpos = pos+compressed;
if (compressed<=BUFFERSIZE)
{
if (bufferstart<=pos
&& bufferend>= endpos)
{
// data is allready in buffer
source = (byte *)bufferseg+(pos-bufferstart);
}
else
{
// load buffer with a new block from disk
// try to get as many of the needed blocks in as possible
while ( next < NUMCHUNKS )
{
while (next < NUMCHUNKS &&
!(grneeded[next]&ca_levelbit && !grsegs[next]))
next++;
if (next == NUMCHUNKS)
continue;
nextpos = GRFILEPOS(next);
while (GRFILEPOS(++next) == -1) // skip past any sparse tiles
;
nextendpos = GRFILEPOS(next);
if (nextpos - endpos <= MAXEMPTYREAD
&& nextendpos-pos <= BUFFERSIZE)
endpos = nextendpos;
else
next = NUMCHUNKS; // read pos to posend
}
lseek(grhandle,pos,SEEK_SET);
CA_FarRead(grhandle,bufferseg,endpos-pos);
bufferstart = pos;
bufferend = endpos;
source = bufferseg;
}
}
else
{
// big chunk, allocate temporary buffer
MM_GetPtr(&bigbufferseg,compressed);
MM_SetLock (&bigbufferseg,true);
lseek(grhandle,pos,SEEK_SET);
CA_FarRead(grhandle,bigbufferseg,compressed);
source = bigbufferseg;
}
CAL_ExpandGrChunk (i,source);
if (compressed>BUFFERSIZE)
MM_FreePtr(&bigbufferseg);
}
}
#endif
/*
===================
=
= MM_Startup
=
===================
*/
void
MM_Startup
()
void
MM_Startup
()
{
{
}
}
/*
====================
=
= MM_Shutdown
=
====================
*/
void
MM_Shutdown
()
void
MM_Shutdown
()
{
{
}
}
/*
====================
=
= MM_GetPtr
=
====================
*/
void
MM_GetPtr
(
memptr
*
baseptr
,
unsigned
long
size
)
void
MM_GetPtr
(
memptr
*
baseptr
,
unsigned
long
size
)
{
{
/* TODO: add some sort of linked list for purging */
/* TODO: add some sort of linked list for purging */
*
baseptr
=
malloc
(
size
);
*
baseptr
=
malloc
(
size
);
}
}
/*
====================
=
= MM_FreePtr
=
====================
*/
void
MM_FreePtr
(
memptr
*
baseptr
)
void
MM_FreePtr
(
memptr
*
baseptr
)
{
{
/* TODO: add some sort of linked list for purging, etc */
/* TODO: add some sort of linked list for purging, etc */
free
(
*
baseptr
);
free
(
*
baseptr
);
}
}
//==========================================================================
/*
=====================
=
= MM_SetPurge
=
= Sets the purge level for a block (locked blocks cannot be made purgable)
=
=====================
*/
void
MM_SetPurge
(
memptr
*
baseptr
,
int
purge
)
void
MM_SetPurge
(
memptr
*
baseptr
,
int
purge
)
{
{
}
}
/*
=====================
=
= MM_SetLock
=
= Locks / unlocks the block
=
=====================
*/
void
MM_SetLock
(
memptr
*
baseptr
,
boolean
locked
)
void
MM_SetLock
(
memptr
*
baseptr
,
boolean
locked
)
{
{
}
}
/*
=====================
=
= MM_SortMem
=
= Throws out all purgable stuff
=
=====================
*/
void
MM_SortMem
()
void
MM_SortMem
()
{
{
}
}
...
@@ -1240,16 +964,8 @@ static int PageFile = -1;
...
@@ -1240,16 +964,8 @@ static int PageFile = -1;
word
ChunksInFile
;
word
ChunksInFile
;
word
PMSpriteStart
,
PMSoundStart
;
word
PMSpriteStart
,
PMSoundStart
;
word
PMNumBlocks
;
long
PMFrameCount
;
PageListStruct
*
PMPages
,
*
PMSegPages
;
PageListStruct
*
PMPages
,
*
PMSegPages
;
/////////////////////////////////////////////////////////////////////////////
//
// File management code
//
/////////////////////////////////////////////////////////////////////////////
//
//
// PML_ReadFromFile() - Reads some data in from the page file
// PML_ReadFromFile() - Reads some data in from the page file
//
//
...
@@ -1261,7 +977,7 @@ static void PML_ReadFromFile(byte *buf, long offset, word length)
...
@@ -1261,7 +977,7 @@ static void PML_ReadFromFile(byte *buf, long offset, word length)
Quit
(
"PML_ReadFromFile: Zero offset"
);
Quit
(
"PML_ReadFromFile: Zero offset"
);
if
(
lseek
(
PageFile
,
offset
,
SEEK_SET
)
!=
offset
)
if
(
lseek
(
PageFile
,
offset
,
SEEK_SET
)
!=
offset
)
Quit
(
"PML_ReadFromFile: Seek failed"
);
Quit
(
"PML_ReadFromFile: Seek failed"
);
if
(
!
CA_FarRead
(
PageFile
,
buf
,
length
))
if
(
!
CA_FarRead
(
PageFile
,
buf
,
length
))
Quit
(
"PML_ReadFromFile: Read failed"
);
Quit
(
"PML_ReadFromFile: Read failed"
);
}
}
...
@@ -1286,19 +1002,18 @@ static void PML_OpenPageFile()
...
@@ -1286,19 +1002,18 @@ static void PML_OpenPageFile()
Quit
(
"PML_OpenPageFile: Unable to open page file"
);
Quit
(
"PML_OpenPageFile: Unable to open page file"
);
// Read in header variables
// Read in header variables
read
(
PageFile
,
&
ChunksInFile
,
sizeof
(
ChunksInFile
));
read
(
PageFile
,
&
ChunksInFile
,
sizeof
(
ChunksInFile
));
read
(
PageFile
,
&
PMSpriteStart
,
sizeof
(
PMSpriteStart
));
read
(
PageFile
,
&
PMSpriteStart
,
sizeof
(
PMSpriteStart
));
read
(
PageFile
,
&
PMSoundStart
,
sizeof
(
PMSoundStart
));
read
(
PageFile
,
&
PMSoundStart
,
sizeof
(
PMSoundStart
));
// Allocate and clear the page list
// Allocate and clear the page list
PMNumBlocks
=
ChunksInFile
;
MM_GetPtr
((
memptr
)
&
PMPages
,
sizeof
(
PageListStruct
)
*
ChunksInFile
);
MM_GetPtr
((
memptr
)
&
PMPages
,
sizeof
(
PageListStruct
)
*
PMNumBlocks
);
MM_SetLock
((
memptr
)
&
PMPages
,
true
);
MM_SetLock
((
memptr
)
&
PMPages
,
true
);
memset
(
PMPages
,
0
,
sizeof
(
PageListStruct
)
*
ChunksInFile
);
memset
(
PMPages
,
0
,
sizeof
(
PageListStruct
)
*
PMNumBlocks
);
// Read in the chunk offsets
// Read in the chunk offsets
size
=
sizeof
(
longword
)
*
ChunksInFile
;
size
=
sizeof
(
longword
)
*
ChunksInFile
;
MM_GetPtr
(
&
buf
,
size
);
MM_GetPtr
(
&
buf
,
size
);
if
(
!
CA_FarRead
(
PageFile
,(
byte
*
)
buf
,
size
))
if
(
!
CA_FarRead
(
PageFile
,(
byte
*
)
buf
,
size
))
Quit
(
"PML_OpenPageFile: Offset read failed"
);
Quit
(
"PML_OpenPageFile: Offset read failed"
);
offsetptr
=
(
longword
*
)
buf
;
offsetptr
=
(
longword
*
)
buf
;
...
@@ -1312,7 +1027,7 @@ static void PML_OpenPageFile()
...
@@ -1312,7 +1027,7 @@ static void PML_OpenPageFile()
if
(
!
CA_FarRead
(
PageFile
,(
byte
*
)
buf
,
size
))
if
(
!
CA_FarRead
(
PageFile
,(
byte
*
)
buf
,
size
))
Quit
(
"PML_OpenPageFile: Length read failed"
);
Quit
(
"PML_OpenPageFile: Length read failed"
);
lengthptr
=
(
word
*
)
buf
;
lengthptr
=
(
word
*
)
buf
;
for
(
i
=
0
,
page
=
PMPages
;
i
<
ChunksInFile
;
i
++
,
page
++
)
for
(
i
=
0
,
page
=
PMPages
;
i
<
ChunksInFile
;
i
++
,
page
++
)
page
->
length
=
*
lengthptr
++
;
page
->
length
=
*
lengthptr
++
;
MM_FreePtr
(
&
buf
);
MM_FreePtr
(
&
buf
);
}
}
...
@@ -1331,25 +1046,6 @@ static void PML_ClosePageFile()
...
@@ -1331,25 +1046,6 @@ static void PML_ClosePageFile()
}
}
}
}
/////////////////////////////////////////////////////////////////////////////
//
// Allocation, etc., code
//
/////////////////////////////////////////////////////////////////////////////
//
// PM_GetPageAddress() - Returns the address of a given page
// Returns NULL if block is not loaded
//
memptr
PM_GetPageAddress
(
int
pagenum
)
{
PageListStruct
*
page
;
page
=
&
PMPages
[
pagenum
];
return
page
->
addr
;
}
//
//
// PM_GetPage() - Returns the address of the page, loading it if necessary
// PM_GetPage() - Returns the address of the page, loading it if necessary
//
//
...
@@ -1362,11 +1058,9 @@ memptr PM_GetPage(int pagenum)
...
@@ -1362,11 +1058,9 @@ memptr PM_GetPage(int pagenum)
page
=
&
PMPages
[
pagenum
];
page
=
&
PMPages
[
pagenum
];
if
(
page
->
addr
==
NULL
)
{
if
(
page
->
addr
==
NULL
)
{
page
->
lastHit
=
0
;
MM_GetPtr
((
memptr
)
&
page
->
addr
,
PMPageSize
);
MM_GetPtr
((
memptr
)
&
page
->
addr
,
PMPageSize
);
PML_ReadFromFile
(
page
->
addr
,
page
->
offset
,
page
->
length
);
PML_ReadFromFile
(
page
->
addr
,
page
->
offset
,
page
->
length
);
}
}
page
->
lastHit
++
;
return
page
->
addr
;
return
page
->
addr
;
}
}
...
@@ -1375,47 +1069,22 @@ memptr PM_GetPage(int pagenum)
...
@@ -1375,47 +1069,22 @@ memptr PM_GetPage(int pagenum)
// Calls the update function after each load, indicating the current
// Calls the update function after each load, indicating the current
// page, and the total pages that need to be loaded (for thermometer).
// page, and the total pages that need to be loaded (for thermometer).
//
//
void
PM_Preload
(
boolean
(
*
update
)(
word
current
,
word
total
))
void
PM_Preload
(
boolean
(
*
update
)(
word
current
,
word
total
))
{
{
update
(
1
,
1
);
update
(
1
,
1
);
}
}
/////////////////////////////////////////////////////////////////////////////
//
// General code
//
/////////////////////////////////////////////////////////////////////////////
//
// PM_NextFrame() - Increments the frame counter
//
void
PM_NextFrame
()
{
int
i
;
// Frame count overrun - kill the LRU hit entries & reset frame count
if
(
++
PMFrameCount
>=
MAXLONG
-
4
)
{
for
(
i
=
0
;
i
<
PMNumBlocks
;
i
++
)
PMPages
[
i
].
lastHit
=
0
;
PMFrameCount
=
0
;
}
}
//
//
// PM_Reset() - Sets up caching structures
// PM_Reset() - Sets up caching structures
//
//
void
PM_Reset
()
static
void
PM_Reset
()
{
{
int
i
;
int
i
;
PageListStruct
*
page
;
PageListStruct
*
page
;
// Initialize page list
// Initialize page list
for
(
i
=
0
,
page
=
PMPages
;
i
<
PMNumBlocks
;
i
++
,
page
++
)
for
(
i
=
0
,
page
=
PMPages
;
i
<
ChunksInFile
;
i
++
,
page
++
)
{
page
->
addr
=
NULL
;
page
->
addr
=
NULL
;
}
}
}
//
//
...
...
src/id_ca.h
View file @
f731c88d
...
@@ -6,8 +6,6 @@
...
@@ -6,8 +6,6 @@
#define NUMMAPS 60
#define NUMMAPS 60
#define MAPPLANES 2
#define MAPPLANES 2
//===========================================================================
typedef
struct
typedef
struct
{
{
long
planestart
[
3
];
long
planestart
[
3
];
...
@@ -16,7 +14,7 @@ typedef struct
...
@@ -16,7 +14,7 @@ typedef struct
char
name
[
16
];
char
name
[
16
];
}
PACKED
maptype
;
}
PACKED
maptype
;
/
/===========================================================================
/
* ======================================================================== */
extern
int
mapon
;
extern
int
mapon
;
...
@@ -33,7 +31,7 @@ extern char extension[5],
...
@@ -33,7 +31,7 @@ extern char extension[5],
aheadname
[
10
],
aheadname
[
10
],
afilename
[
10
];
afilename
[
10
];
/
/===========================================================================
/
* ======================================================================== */
boolean
CA_FarRead
(
int
handle
,
byte
*
dest
,
long
length
);
boolean
CA_FarRead
(
int
handle
,
byte
*
dest
,
long
length
);
boolean
CA_FarWrite
(
int
handle
,
byte
*
source
,
long
length
);
boolean
CA_FarWrite
(
int
handle
,
byte
*
source
,
long
length
);
...
@@ -55,14 +53,6 @@ void CA_UnCacheGrChunk(int chunk);
...
@@ -55,14 +53,6 @@ void CA_UnCacheGrChunk(int chunk);
void
CA_UpLevel
();
void
CA_UpLevel
();
void
CA_DownLevel
();
void
CA_DownLevel
();
/*
void CA_ClearMarks();
void CA_ClearAllMarks();
#define CA_MarkGrChunk(chunk) grneeded[chunk]|=ca_levelbit
void CA_CacheMarks();
*/
void
CA_CacheScreen
(
int
chunk
);
void
CA_CacheScreen
(
int
chunk
);
...
@@ -84,23 +74,19 @@ typedef struct {
...
@@ -84,23 +74,19 @@ typedef struct {
longword
offset
;
// Offset of chunk into file
longword
offset
;
// Offset of chunk into file
word
length
;
// Length of the chunk
word
length
;
// Length of the chunk
memptr
addr
;
memptr
addr
;
longword
lastHit
;
// Last frame number of hit
}
PageListStruct
;
}
PageListStruct
;
extern
word
ChunksInFile
,
PMSpriteStart
,
PMSoundStart
;
extern
word
ChunksInFile
,
PMSpriteStart
,
PMSoundStart
;
extern
PageListStruct
*
PMPages
;
extern
PageListStruct
*
PMPages
;
#define PM_GetSoundPage(v) PM_GetPage(PMSoundStart + (v))
#define PM_GetSoundPage(v) PM_GetPage(PMSoundStart + (v))
#define PM_GetSpritePage(v) PM_GetPage(PMSpriteStart + (v))
#define PM_GetSpritePage(v) PM_GetPage(PMSpriteStart + (v))
void
PM_Startup
(
void
),
void
PM_Startup
();
PM_Shutdown
(
void
),
void
PM_Shutdown
();
PM_Reset
(
void
),
void
PM_Preload
(
boolean
(
*
update
)(
word
current
,
word
total
));
PM_Preload
(
boolean
(
*
update
)(
word
current
,
word
total
)),
PM_NextFrame
(
void
),
PM_SetMainPurge
(
int
level
);
memptr
PM_GetPageAddress
(
int
pagenum
),
PM_GetPage
(
int
pagenum
);
memptr
PM_GetPage
(
int
pagenum
);
#endif
#endif
src/id_heads.h
View file @
f731c88d
...
@@ -37,12 +37,10 @@ typedef bool boolean;
...
@@ -37,12 +37,10 @@ typedef bool boolean;
#define PACKED __attribute__((packed))
#define PACKED __attribute__((packed))
#define LONGLONG long long
#define LONGLONG long long
#define O_BINARY 0
#ifdef __cplusplus
#ifdef __cplusplus
typedef
bool
boolean
;
typedef
bool
boolean
;
#else
#else
typedef
enum
{
false
,
true
}
boolean
;
typedef
enum
{
false
,
true
}
boolean
;
#endif
#endif
#endif
#endif
...
@@ -58,6 +56,10 @@ typedef enum {false,true} boolean;
...
@@ -58,6 +56,10 @@ typedef enum {false,true} boolean;
#include <sys/types.h>
#include <sys/types.h>
#include <math.h>
#include <math.h>
#ifndef O_BINARY
#define O_BINARY 0
#endif
#include "misc.h"
#include "misc.h"
#include "version.h"
#include "version.h"
...
@@ -87,9 +89,9 @@ typedef enum {false,true} boolean;
...
@@ -87,9 +89,9 @@ typedef enum {false,true} boolean;
/* ---------------- */
/* ---------------- */
typedef
unsigned
char
byte
;
typedef
unsigned
char
byte
;
typedef
unsigned
short
int
word
;
typedef
unsigned
short
int
word
;
typedef
unsigned
long
longword
;
typedef
unsigned
long
longword
;
typedef
long
fixed
;
typedef
long
fixed
;
typedef
void
*
memptr
;
typedef
void
*
memptr
;
...
@@ -118,13 +120,13 @@ void Quit(char *error);
...
@@ -118,13 +120,13 @@ void Quit(char *error);
#undef PI
#undef PI
#define PI 3.141592657
#define PI 3.141592657
#define MAXTICS
10
#define MAXTICS 10
#define DEMOTICS
4
#define DEMOTICS 4
extern
unsigned
mapwidth
,
mapheight
,
tics
;
extern
unsigned
mapwidth
,
mapheight
,
tics
;
extern
byte
fontcolor
,
backcolor
;
extern
byte
fontcolor
,
backcolor
;
#define SETFONTCOLOR(f,
b) fontcolor=f;backcolor=b;
#define SETFONTCOLOR(f,
b) { fontcolor = f; backcolor = b; }
#endif
#endif
src/vi_null.c
0 → 100644
View file @
f731c88d
/* id_vl.c */
/* input/video output "/dev/null" support */
/* this file does nothing but sit there and look pretty dumb */
#include "wl_def.h"
byte
*
gfxbuf
=
NULL
;
/*
==========================
=
= Quit
=
==========================
*/
void
Quit
(
char
*
error
)
{
/* TODO: blah blah blah */
memptr
screen
=
NULL
;
if
(
!
error
||
!*
error
)
{
CA_CacheGrChunk
(
ORDERSCREEN
);
screen
=
grsegs
[
ORDERSCREEN
];
WriteConfig
();
}
else
if
(
error
)
{
CA_CacheGrChunk
(
ERRORSCREEN
);
screen
=
grsegs
[
ERRORSCREEN
];
}
ShutdownId
();
if
(
screen
)
{
printf
(
"TODO: spiffy ansi screen goes here..
\n
"
);
}
if
(
error
&&
*
error
)
{
fprintf
(
stderr
,
"Quit: %s
\n
"
,
error
);
exit
(
EXIT_FAILURE
);
}
exit
(
EXIT_SUCCESS
);
}
void
VL_WaitVBL
(
int
vbls
)
{
}
void
VW_UpdateScreen
()
{
}
/*
=======================
=
= VL_Startup
=
=======================
*/
void
VL_Startup
(
void
)
{
if
(
gfxbuf
==
NULL
)
gfxbuf
=
malloc
(
320
*
200
*
1
);
}
/*
=======================
=
= VL_Shutdown
=
=======================
*/
void
VL_Shutdown
()
{
if
(
gfxbuf
!=
NULL
)
{
free
(
gfxbuf
);
gfxbuf
=
NULL
;
}
}
//===========================================================================
/*
=================
=
= VL_ClearVideo
=
= Fill the entire video buffer with a given color
=
=================
*/
void
VL_ClearVideo
(
byte
color
)
{
memset
(
gfxbuf
,
color
,
64000
);
}
/*
=============================================================================
PALETTE OPS
To avoid snow, do a WaitVBL BEFORE calling these
=============================================================================
*/
/*
=================
=
= VL_FillPalette
=
=================
*/
void
VL_FillPalette
(
int
red
,
int
green
,
int
blue
)
{
}
//===========================================================================
/*
=================
=
= VL_SetPalette
=
=================
*/
void
VL_SetPalette
(
const
byte
*
palette
)
{
}
//===========================================================================
/*
=================
=
= VL_GetPalette
=
=================
*/
void
VL_GetPalette
(
byte
*
palette
)
{
}
/*
=============================================================================
PIXEL OPS
=============================================================================
*/
/*
=================
=
= VL_Plot
=
=================
*/
void
VL_Plot
(
int
x
,
int
y
,
int
color
)
{
*
(
gfxbuf
+
320
*
y
+
x
)
=
color
;
}
/*
=================
=
= VL_Hlin
=
=================
*/
void
VL_Hlin
(
unsigned
x
,
unsigned
y
,
unsigned
width
,
unsigned
color
)
{
memset
(
gfxbuf
+
320
*
y
+
x
,
color
,
width
);
}
/*
=================
=
= VL_Vlin
=
=================
*/
void
VL_Vlin
(
int
x
,
int
y
,
int
height
,
int
color
)
{
byte
*
ptr
=
gfxbuf
+
320
*
y
+
x
;
while
(
height
--
)
{
*
ptr
=
color
;
ptr
+=
320
;
}
}
/*
=================
=
= VL_Bar
=
=================
*/
void
VL_Bar
(
int
x
,
int
y
,
int
width
,
int
height
,
int
color
)
{
byte
*
ptr
=
gfxbuf
+
320
*
y
+
x
;
while
(
height
--
)
{
memset
(
ptr
,
color
,
width
);
ptr
+=
320
;
}
}
/*
============================================================================
MEMORY OPS
============================================================================
*/
/*
=================
=
= VL_MemToScreen
=
= Draws a block of data to the screen.
=
=================
*/
void
VL_MemToScreen
(
const
byte
*
source
,
int
width
,
int
height
,
int
x
,
int
y
)
{
byte
*
ptr
=
gfxbuf
+
320
*
y
+
x
;
while
(
height
--
)
{
memcpy
(
ptr
,
source
,
width
);
source
+=
width
;
ptr
+=
320
;
}
}
void
VL_DeModeXize
(
byte
*
buf
,
int
width
,
int
height
)
{
byte
*
mem
,
*
ptr
,
*
destline
;
int
plane
,
x
,
y
;
if
(
width
&
3
)
{
printf
(
"Not divisible by 4?
\n
"
);
return
;
}
mem
=
malloc
(
width
*
height
);
ptr
=
buf
;
for
(
plane
=
0
;
plane
<
4
;
plane
++
)
{
destline
=
mem
;
for
(
y
=
0
;
y
<
height
;
y
++
)
{
for
(
x
=
0
;
x
<
width
/
4
;
x
++
)
*
(
destline
+
x
*
4
+
plane
)
=
*
ptr
++
;
destline
+=
width
;
}
}
memcpy
(
buf
,
mem
,
width
*
height
);
free
(
mem
);
}
void
VL_DirectPlot
(
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
}
/*
=============================================================================
GLOBAL VARIABLES
=============================================================================
*/
//
// configuration variables
//
boolean
MousePresent
;
boolean
JoysPresent
[
MaxJoys
];
// Global variables
boolean
Keyboard
[
NumCodes
];
boolean
Paused
;
char
LastASCII
;
ScanCode
LastScan
;
KeyboardDef
KbdDefs
=
{
sc_Control
,
sc_Alt
,
sc_Home
,
sc_UpArrow
,
sc_PgUp
,
sc_LeftArrow
,
sc_RightArrow
,
sc_End
,
sc_DownArrow
,
sc_PgDn
};
ControlType
Controls
[
MaxPlayers
];
/*
=============================================================================
LOCAL VARIABLES
=============================================================================
*/
static
byte
ASCIINames
[]
=
// Unshifted ASCII for scan codes
{
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0
,
27
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'-'
,
'='
,
8
,
9
,
// 0
'q'
,
'w'
,
'e'
,
'r'
,
't'
,
'y'
,
'u'
,
'i'
,
'o'
,
'p'
,
'['
,
']'
,
13
,
0
,
'a'
,
's'
,
// 1
'd'
,
'f'
,
'g'
,
'h'
,
'j'
,
'k'
,
'l'
,
';'
,
39
,
'`'
,
0
,
92
,
'z'
,
'x'
,
'c'
,
'v'
,
// 2
'b'
,
'n'
,
'm'
,
','
,
'.'
,
'/'
,
0
,
'*'
,
0
,
' '
,
0
,
0
,
0
,
0
,
0
,
0
,
// 3
0
,
0
,
0
,
0
,
0
,
0
,
0
,
'7'
,
'8'
,
'9'
,
'-'
,
'4'
,
'5'
,
'6'
,
'+'
,
'1'
,
// 4
'2'
,
'3'
,
'0'
,
127
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
// 5
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
// 6
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
// 7
},
ShiftNames
[]
=
// Shifted ASCII for scan codes
{
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0
,
27
,
'!'
,
'@'
,
'#'
,
'$'
,
'%'
,
'^'
,
'&'
,
'*'
,
'('
,
')'
,
'_'
,
'+'
,
8
,
9
,
// 0
'Q'
,
'W'
,
'E'
,
'R'
,
'T'
,
'Y'
,
'U'
,
'I'
,
'O'
,
'P'
,
'{'
,
'}'
,
13
,
0
,
'A'
,
'S'
,
// 1
'D'
,
'F'
,
'G'
,
'H'
,
'J'
,
'K'
,
'L'
,
':'
,
34
,
'~'
,
0
,
'|'
,
'Z'
,
'X'
,
'C'
,
'V'
,
// 2
'B'
,
'N'
,
'M'
,
'<'
,
'>'
,
'?'
,
0
,
'*'
,
0
,
' '
,
0
,
0
,
0
,
0
,
0
,
0
,
// 3
0
,
0
,
0
,
0
,
0
,
0
,
0
,
'7'
,
'8'
,
'9'
,
'-'
,
'4'
,
'5'
,
'6'
,
'+'
,
'1'
,
// 4
'2'
,
'3'
,
'0'
,
127
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
// 5
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
// 6
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
// 7
};
static
boolean
IN_Started
;
static
boolean
CapsLock
;
static
ScanCode
CurCode
,
LastCode
;
static
Direction
DirTable
[]
=
{
// Quick lookup for total direction
dir_NorthWest
,
dir_North
,
dir_NorthEast
,
dir_West
,
dir_None
,
dir_East
,
dir_SouthWest
,
dir_South
,
dir_SouthEast
};
void
keyboard_handler
(
int
code
,
int
press
)
{
byte
k
,
c
=
0
;
k
=
code
;
{
if
(
press
==
0
)
{
Keyboard
[
k
]
=
false
;
}
else
// Make code
{
LastCode
=
CurCode
;
CurCode
=
LastScan
=
k
;
Keyboard
[
k
]
=
true
;
if
(
k
==
sc_CapsLock
)
{
CapsLock
^=
true
;
}
if
(
Keyboard
[
sc_LShift
]
||
Keyboard
[
sc_RShift
])
// If shifted
{
c
=
ShiftNames
[
k
];
if
((
c
>=
'A'
)
&&
(
c
<=
'Z'
)
&&
CapsLock
)
c
+=
'a'
-
'A'
;
}
else
{
c
=
ASCIINames
[
k
];
if
((
c
>=
'a'
)
&&
(
c
<=
'z'
)
&&
CapsLock
)
c
-=
'a'
-
'A'
;
}
if
(
c
)
LastASCII
=
c
;
}
}
}
///////////////////////////////////////////////////////////////////////////
//
// INL_GetMouseDelta() - Gets the amount that the mouse has moved from the
// mouse driver
//
///////////////////////////////////////////////////////////////////////////
static
void
INL_GetMouseDelta
(
int
*
x
,
int
*
y
)
{
*
x
=
0
;
*
y
=
0
;
}
///////////////////////////////////////////////////////////////////////////
//
// INL_GetMouseButtons() - Gets the status of the mouse buttons from the
// mouse driver
//
///////////////////////////////////////////////////////////////////////////
static
word
INL_GetMouseButtons
(
void
)
{
return
0
;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_GetJoyAbs() - Reads the absolute position of the specified joystick
//
///////////////////////////////////////////////////////////////////////////
void
IN_GetJoyAbs
(
word
joy
,
word
*
xp
,
word
*
yp
)
{
*
xp
=
0
;
*
yp
=
0
;
}
///////////////////////////////////////////////////////////////////////////
//
// INL_GetJoyDelta() - Returns the relative movement of the specified
// joystick (from +/-127)
//
///////////////////////////////////////////////////////////////////////////
void
INL_GetJoyDelta
(
word
joy
,
int
*
dx
,
int
*
dy
)
{
*
dx
=
0
;
*
dy
=
0
;
}
///////////////////////////////////////////////////////////////////////////
//
// INL_GetJoyButtons() - Returns the button status of the specified
// joystick
//
///////////////////////////////////////////////////////////////////////////
static
word
INL_GetJoyButtons
(
word
joy
)
{
return
0
;
}
///////////////////////////////////////////////////////////////////////////
//
// INL_StartKbd() - Sets up my keyboard stuff for use
//
///////////////////////////////////////////////////////////////////////////
static
void
INL_StartKbd
(
void
)
{
IN_ClearKeysDown
();
}
///////////////////////////////////////////////////////////////////////////
//
// INL_ShutKbd() - Restores keyboard control to the BIOS
//
///////////////////////////////////////////////////////////////////////////
static
void
INL_ShutKbd
(
void
)
{
}
///////////////////////////////////////////////////////////////////////////
//
// INL_StartMouse() - Detects and sets up the mouse
//
///////////////////////////////////////////////////////////////////////////
static
boolean
INL_StartMouse
(
void
)
{
return
false
;
}
///////////////////////////////////////////////////////////////////////////
//
// INL_ShutMouse() - Cleans up after the mouse
//
///////////////////////////////////////////////////////////////////////////
static
void
INL_ShutMouse
(
void
)
{
}
///////////////////////////////////////////////////////////////////////////
//
// IN_SetupJoy() - Sets up thresholding values and calls INL_SetJoyScale()
// to set up scaling values
//
///////////////////////////////////////////////////////////////////////////
void
IN_SetupJoy
(
word
joy
,
word
minx
,
word
maxx
,
word
miny
,
word
maxy
)
{
}
///////////////////////////////////////////////////////////////////////////
//
// INL_StartJoy() - Detects & auto-configures the specified joystick
// The auto-config assumes the joystick is centered
//
///////////////////////////////////////////////////////////////////////////
static
boolean
INL_StartJoy
(
word
joy
)
{
return
false
;
}
///////////////////////////////////////////////////////////////////////////
//
// INL_ShutJoy() - Cleans up the joystick stuff
//
///////////////////////////////////////////////////////////////////////////
static
void
INL_ShutJoy
(
word
joy
)
{
JoysPresent
[
joy
]
=
false
;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_Startup() - Starts up the Input Mgr
//
///////////////////////////////////////////////////////////////////////////
void
IN_Startup
(
void
)
{
boolean
checkjoys
,
checkmouse
;
word
i
;
if
(
IN_Started
)
return
;
checkjoys
=
true
;
checkmouse
=
true
;
if
(
MS_CheckParm
(
"nojoy"
))
checkjoys
=
false
;
if
(
MS_CheckParm
(
"nomouse"
))
checkmouse
=
false
;
INL_StartKbd
();
MousePresent
=
checkmouse
?
INL_StartMouse
()
:
false
;
for
(
i
=
0
;
i
<
MaxJoys
;
i
++
)
JoysPresent
[
i
]
=
checkjoys
?
INL_StartJoy
(
i
)
:
false
;
IN_Started
=
true
;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_Shutdown() - Shuts down the Input Mgr
//
///////////////////////////////////////////////////////////////////////////
void
IN_Shutdown
()
{
word
i
;
if
(
!
IN_Started
)
return
;
INL_ShutMouse
();
for
(
i
=
0
;
i
<
MaxJoys
;
i
++
)
INL_ShutJoy
(
i
);
INL_ShutKbd
();
IN_Started
=
false
;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_ClearKeysDown() - Clears the keyboard array
//
///////////////////////////////////////////////////////////////////////////
void
IN_ClearKeysDown
()
{
LastScan
=
sc_None
;
LastASCII
=
key_None
;
memset
(
Keyboard
,
0
,
sizeof
(
Keyboard
));
}
///////////////////////////////////////////////////////////////////////////
//
// IN_ReadControl() - Reads the device associated with the specified
// player and fills in the control info struct
//
///////////////////////////////////////////////////////////////////////////
void
IN_ReadControl
(
int
player
,
ControlInfo
*
info
)
{
boolean
realdelta
=
false
;
word
buttons
;
int
dx
,
dy
;
Motion
mx
,
my
;
ControlType
type
;
KeyboardDef
*
def
;
dx
=
dy
=
0
;
mx
=
my
=
motion_None
;
buttons
=
0
;
IN_CheckAck
();
switch
(
type
=
Controls
[
player
])
{
case
ctrl_Keyboard
:
def
=
&
KbdDefs
;
if
(
Keyboard
[
def
->
upleft
])
mx
=
motion_Left
,
my
=
motion_Up
;
else
if
(
Keyboard
[
def
->
upright
])
mx
=
motion_Right
,
my
=
motion_Up
;
else
if
(
Keyboard
[
def
->
downleft
])
mx
=
motion_Left
,
my
=
motion_Down
;
else
if
(
Keyboard
[
def
->
downright
])
mx
=
motion_Right
,
my
=
motion_Down
;
if
(
Keyboard
[
def
->
up
])
my
=
motion_Up
;
else
if
(
Keyboard
[
def
->
down
])
my
=
motion_Down
;
if
(
Keyboard
[
def
->
left
])
mx
=
motion_Left
;
else
if
(
Keyboard
[
def
->
right
])
mx
=
motion_Right
;
if
(
Keyboard
[
def
->
button0
])
buttons
+=
1
<<
0
;
if
(
Keyboard
[
def
->
button1
])
buttons
+=
1
<<
1
;
realdelta
=
false
;
break
;
case
ctrl_Joystick1
:
case
ctrl_Joystick2
:
INL_GetJoyDelta
(
type
-
ctrl_Joystick
,
&
dx
,
&
dy
);
buttons
=
INL_GetJoyButtons
(
type
-
ctrl_Joystick
);
realdelta
=
true
;
break
;
case
ctrl_Mouse
:
INL_GetMouseDelta
(
&
dx
,
&
dy
);
buttons
=
INL_GetMouseButtons
();
realdelta
=
true
;
break
;
}
if
(
realdelta
)
{
mx
=
(
dx
<
0
)
?
motion_Left
:
((
dx
>
0
)
?
motion_Right
:
motion_None
);
my
=
(
dy
<
0
)
?
motion_Up
:
((
dy
>
0
)
?
motion_Down
:
motion_None
);
}
else
{
dx
=
mx
*
127
;
dy
=
my
*
127
;
}
info
->
x
=
dx
;
info
->
xaxis
=
mx
;
info
->
y
=
dy
;
info
->
yaxis
=
my
;
info
->
button0
=
buttons
&
(
1
<<
0
);
info
->
button1
=
buttons
&
(
1
<<
1
);
info
->
button2
=
buttons
&
(
1
<<
2
);
info
->
button3
=
buttons
&
(
1
<<
3
);
info
->
dir
=
DirTable
[((
my
+
1
)
*
3
)
+
(
mx
+
1
)];
}
///////////////////////////////////////////////////////////////////////////
//
// IN_Ack() - waits for a button or key press. If a button is down, upon
// calling, it must be released for it to be recognized
//
///////////////////////////////////////////////////////////////////////////
boolean
btnstate
[
8
];
void
IN_StartAck
()
{
unsigned
i
,
buttons
;
//
// get initial state of everything
//
IN_ClearKeysDown
();
memset
(
btnstate
,
0
,
sizeof
(
btnstate
));
buttons
=
IN_JoyButtons
()
<<
4
;
if
(
MousePresent
)
buttons
|=
IN_MouseButtons
();
for
(
i
=
0
;
i
<
8
;
i
++
,
buttons
>>=
1
)
if
(
buttons
&
1
)
btnstate
[
i
]
=
true
;
}
boolean
IN_CheckAck
()
{
unsigned
i
,
buttons
;
if
(
LastScan
)
return
true
;
buttons
=
IN_JoyButtons
()
<<
4
;
if
(
MousePresent
)
buttons
|=
IN_MouseButtons
();
for
(
i
=
0
;
i
<
8
;
i
++
,
buttons
>>=
1
)
if
(
buttons
&
1
)
{
if
(
!
btnstate
[
i
])
return
true
;
}
else
btnstate
[
i
]
=
false
;
return
false
;
}
void
IN_Ack
(
void
)
{
IN_StartAck
();
// return; /* TODO: fix when keyboard implemented */
while
(
!
IN_CheckAck
())
;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_UserInput() - Waits for the specified delay time (in ticks) or the
// user pressing a key or a mouse button. If the clear flag is set, it
// then either clears the key or waits for the user to let the mouse
// button up.
//
///////////////////////////////////////////////////////////////////////////
boolean
IN_UserInput
(
longword
delay
)
{
longword
lasttime
;
lasttime
=
get_TimeCount
();
IN_StartAck
();
do
{
if
(
IN_CheckAck
())
return
true
;
}
while
(
(
get_TimeCount
()
-
lasttime
)
<
delay
);
return
false
;
}
//===========================================================================
/*
===================
=
= IN_MouseButtons
=
===================
*/
byte
IN_MouseButtons
(
void
)
{
return
0
;
}
/*
===================
=
= IN_JoyButtons
=
===================
*/
byte
IN_JoyButtons
(
void
)
{
return
0
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
return
WolfMain
(
argc
,
argv
);
}
src/wl_agent.c
View file @
f731c88d
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
=============================================================================
=============================================================================
*/
*/
#define MOVESCALE 150
l
#define MOVESCALE 150
#define BACKMOVESCALE 100
l
#define BACKMOVESCALE 100
#define ANGLESCALE 20
#define ANGLESCALE 20
/*
/*
...
@@ -43,17 +43,16 @@ objtype *LastAttacker;
...
@@ -43,17 +43,16 @@ objtype *LastAttacker;
*/
*/
void
T_Player
(
objtype
*
ob
);
void
T_Player
(
objtype
*
ob
);
void
T_Attack
(
objtype
*
ob
);
void
T_Attack
(
objtype
*
ob
);
statetype
s_player
=
{
false
,
0
,
0
,
T_Player
,
NULL
,
NULL
};
statetype
s_player
=
{
false
,
0
,
0
,
T_Player
,
NULL
,
NULL
};
statetype
s_attack
=
{
false
,
0
,
0
,
T_Attack
,
NULL
,
NULL
};
statetype
s_attack
=
{
false
,
0
,
0
,
T_Attack
,
NULL
,
NULL
};
struct
atkinf
struct
atkinf
{
{
char
tics
,
attack
,
frame
;
// attack is 1 for gun, 2 for knife
char
tics
,
attack
,
frame
;
// attack is 1 for gun, 2 for knife
}
static
attackinfo
[
4
][
14
]
=
}
static
attackinfo
[
4
][
14
]
=
{
{
{
{
6
,
0
,
1
},{
6
,
2
,
2
},{
6
,
0
,
3
},{
6
,
-
1
,
4
}
},
{
{
6
,
0
,
1
},{
6
,
2
,
2
},{
6
,
0
,
3
},{
6
,
-
1
,
4
}
},
{
{
6
,
0
,
1
},{
6
,
1
,
2
},{
6
,
0
,
3
},{
6
,
-
1
,
4
}
},
{
{
6
,
0
,
1
},{
6
,
1
,
2
},{
6
,
0
,
3
},{
6
,
-
1
,
4
}
},
...
@@ -217,25 +216,22 @@ void StatusDrawPic(unsigned x, unsigned y, unsigned picnum)
...
@@ -217,25 +216,22 @@ void StatusDrawPic(unsigned x, unsigned y, unsigned picnum)
==================
==================
*/
*/
void
DrawFace
(
void
)
void
DrawFace
(
)
{
{
if
(
gamestate
.
health
)
if
(
gamestate
.
health
)
{
{
#ifdef SPEAR
#ifdef SPEAR
if
(
godmode
)
if
(
godmode
)
StatusDrawPic
(
17
,
4
,
GODMODEFACE1PIC
+
gamestate
.
faceframe
);
StatusDrawPic
(
17
,
4
,
GODMODEFACE1PIC
+
gamestate
.
faceframe
);
else
else
#endif
#endif
StatusDrawPic
(
17
,
4
,
FACE1APIC
+
3
*
((
100
-
gamestate
.
health
)
/
16
)
+
gamestate
.
faceframe
);
StatusDrawPic
(
17
,
4
,
FACE1APIC
+
3
*
((
100
-
gamestate
.
health
)
/
16
)
+
gamestate
.
faceframe
);
}
}
else
{
else
{
#ifndef SPEAR
#ifndef SPEAR
if
(
LastAttacker
->
obclass
==
needleobj
)
if
(
LastAttacker
->
obclass
==
needleobj
)
StatusDrawPic
(
17
,
4
,
MUTANTBJPIC
);
StatusDrawPic
(
17
,
4
,
MUTANTBJPIC
);
else
else
#endif
#endif
StatusDrawPic
(
17
,
4
,
FACE8APIC
);
StatusDrawPic
(
17
,
4
,
FACE8APIC
);
}
}
}
}
...
@@ -334,7 +330,7 @@ void DrawHealth (void)
...
@@ -334,7 +330,7 @@ void DrawHealth (void)
===============
===============
*/
*/
void
TakeDamage
(
int
points
,
objtype
*
attacker
)
void
TakeDamage
(
int
points
,
objtype
*
attacker
)
{
{
LastAttacker
=
attacker
;
LastAttacker
=
attacker
;
...
...
src/wl_text.c
View file @
f731c88d
...
@@ -546,13 +546,6 @@ void CacheLayoutGraphics (void)
...
@@ -546,13 +546,6 @@ void CacheLayoutGraphics (void)
numpages
++
;
numpages
++
;
if
(
ch
==
'E'
)
// end of file, so load graphics and return
if
(
ch
==
'E'
)
// end of file, so load graphics and return
{
{
/*
CA_MarkGrChunk(H_TOPWINDOWPIC);
CA_MarkGrChunk(H_LEFTWINDOWPIC);
CA_MarkGrChunk(H_RIGHTWINDOWPIC);
CA_MarkGrChunk(H_BOTTOMINFOPIC);
CA_CacheMarks ();
*/
CA_CacheGrChunk
(
H_TOPWINDOWPIC
);
CA_CacheGrChunk
(
H_TOPWINDOWPIC
);
CA_CacheGrChunk
(
H_LEFTWINDOWPIC
);
CA_CacheGrChunk
(
H_LEFTWINDOWPIC
);
CA_CacheGrChunk
(
H_RIGHTWINDOWPIC
);
CA_CacheGrChunk
(
H_RIGHTWINDOWPIC
);
...
@@ -564,13 +557,11 @@ void CacheLayoutGraphics (void)
...
@@ -564,13 +557,11 @@ void CacheLayoutGraphics (void)
if
(
ch
==
'G'
)
// draw graphic command, so mark graphics
if
(
ch
==
'G'
)
// draw graphic command, so mark graphics
{
{
ParsePicCommand
();
ParsePicCommand
();
/* CA_MarkGrChunk (picnum); */
CA_CacheGrChunk
(
picnum
);
CA_CacheGrChunk
(
picnum
);
}
}
if
(
ch
==
'T'
)
// timed draw graphic command, so mark graphics
if
(
ch
==
'T'
)
// timed draw graphic command, so mark graphics
{
{
ParseTimedCommand
();
ParseTimedCommand
();
/* CA_MarkGrChunk (picnum); */
CA_CacheGrChunk
(
picnum
);
CA_CacheGrChunk
(
picnum
);
}
}
}
}
...
@@ -599,7 +590,6 @@ void ShowArticle(char *article)
...
@@ -599,7 +590,6 @@ void ShowArticle(char *article)
text
=
article
;
text
=
article
;
oldfontnumber
=
fontnumber
;
oldfontnumber
=
fontnumber
;
fontnumber
=
0
;
fontnumber
=
0
;
/* CA_MarkGrChunk(STARTFONT); */
CA_CacheGrChunk
(
STARTFONT
);
CA_CacheGrChunk
(
STARTFONT
);
VW_Bar
(
0
,
0
,
320
,
200
,
BACKCOLOR
);
VW_Bar
(
0
,
0
,
320
,
200
,
BACKCOLOR
);
CacheLayoutGraphics
();
CacheLayoutGraphics
();
...
...
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