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
646cf19b
Commit
646cf19b
authored
Apr 20, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some unused stuff from id_us, added TimeCount functions
parent
98b2de85
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
116 deletions
+39
-116
id_us.c
src/id_us.c
+4
-70
id_us.h
src/id_us.h
+5
-46
misc.c
src/misc.c
+27
-0
misc.h
src/misc.h
+3
-0
No files found.
src/id_us.c
View file @
646cf19b
...
...
@@ -9,8 +9,7 @@ word WindowX,WindowY,WindowW,WindowH;
// Internal variables
static
char
*
ParmStrings
[]
=
{
"TEDLEVEL"
,
"NOWAIT"
},
*
ParmStrings2
[]
=
{
"COMP"
,
"NOCOMP"
};
static
char
*
ParmStrings
[]
=
{
"TEDLEVEL"
,
"NOWAIT"
};
static
boolean
US_Started
;
int
CursorX
,
CursorY
;
...
...
@@ -18,7 +17,6 @@ int CursorX,CursorY;
void
(
*
USL_MeasureString
)(
char
*
,
word
*
,
word
*
)
=
VW_MeasurePropString
,
(
*
USL_DrawString
)(
char
*
)
=
VWB_DrawPropString
;
SaveGame
Games
[
MaxSaveGames
];
HighScore
Scores
[
MaxScores
]
=
{
{
"id software-'92"
,
10000
,
1
},
{
"Adrian Carmack"
,
10000
,
1
},
...
...
@@ -111,25 +109,11 @@ int US_CheckParm(char *parm,char **strings)
cp
=
tolower
(
cp
);
}
}
return
(
-
1
)
;
return
-
1
;
}
// Window/Printing routines
///////////////////////////////////////////////////////////////////////////
//
// US_SetPrintRoutines() - Sets the routines used to measure and print
// from within the User Mgr. Primarily provided to allow switching
// between masked and non-masked fonts
//
///////////////////////////////////////////////////////////////////////////
void
US_SetPrintRoutines
(
void
(
*
measure
)(
char
*
,
word
*
,
word
*
),
void
(
*
print
)(
char
*
))
{
USL_MeasureString
=
measure
;
USL_DrawString
=
print
;
}
///////////////////////////////////////////////////////////////////////////
//
// US_Print() - Prints a string in the current window. Newlines are
...
...
@@ -326,54 +310,6 @@ US_DrawWindow(word x,word y,word w,word h)
VWB_DrawTile8
(
sx
,
i
,
3
),
VWB_DrawTile8
(
sx
+
sw
,
i
,
4
);
}
///////////////////////////////////////////////////////////////////////////
//
// US_CenterWindow() - Generates a window of a given width & height in the
// middle of the screen
//
///////////////////////////////////////////////////////////////////////////
void
US_CenterWindow
(
word
w
,
word
h
)
{
US_DrawWindow
(((
MaxX
/
8
)
-
w
)
/
2
,((
MaxY
/
8
)
-
h
)
/
2
,
w
,
h
);
}
///////////////////////////////////////////////////////////////////////////
//
// US_SaveWindow() - Saves the current window parms into a record for
// later restoration
//
///////////////////////////////////////////////////////////////////////////
void
US_SaveWindow
(
WindowRec
*
win
)
{
win
->
x
=
WindowX
;
win
->
y
=
WindowY
;
win
->
w
=
WindowW
;
win
->
h
=
WindowH
;
win
->
px
=
PrintX
;
win
->
py
=
PrintY
;
}
///////////////////////////////////////////////////////////////////////////
//
// US_RestoreWindow() - Sets the current window parms to those held in the
// record
//
///////////////////////////////////////////////////////////////////////////
void
US_RestoreWindow
(
WindowRec
*
win
)
{
WindowX
=
win
->
x
;
WindowY
=
win
->
y
;
WindowW
=
win
->
w
;
WindowH
=
win
->
h
;
PrintX
=
win
->
px
;
PrintY
=
win
->
py
;
}
// Input routines
///////////////////////////////////////////////////////////////////////////
...
...
@@ -381,8 +317,7 @@ US_RestoreWindow(WindowRec *win)
// USL_XORICursor() - XORs the I-bar text cursor. Used by US_LineInput()
//
///////////////////////////////////////////////////////////////////////////
static
void
USL_XORICursor
(
int
x
,
int
y
,
char
*
s
,
word
cursor
)
static
void
USL_XORICursor
(
int
x
,
int
y
,
char
*
s
,
word
cursor
)
{
static
boolean
status
;
// VGA doesn't XOR...
char
buf
[
MaxString
];
...
...
@@ -417,8 +352,7 @@ USL_XORICursor(int x,int y,char *s,word cursor)
// returned
//
///////////////////////////////////////////////////////////////////////////
boolean
US_LineInput
(
int
x
,
int
y
,
char
*
buf
,
char
*
def
,
boolean
escok
,
boolean
US_LineInput
(
int
x
,
int
y
,
char
*
buf
,
char
*
def
,
boolean
escok
,
int
maxchars
,
int
maxwidth
)
{
boolean
redraw
,
...
...
src/id_us.h
View file @
646cf19b
...
...
@@ -4,8 +4,6 @@
#define MaxX 320
#define MaxY 200
#define MaxHelpLines 500
#define MaxHighName 57
#define MaxScores 7
typedef
struct
...
...
@@ -15,16 +13,6 @@ typedef struct
word
completed
,
episode
;
}
HighScore
;
#define MaxGameName 32
#define MaxSaveGames 6
typedef
struct
{
char
signature
[
4
];
word
*
oldtest
;
boolean
present
;
char
name
[
MaxGameName
+
1
];
}
SaveGame
;
#define MaxString 128 // Maximum input string size
typedef
struct
...
...
@@ -34,23 +22,13 @@ typedef struct
px
,
py
;
}
WindowRec
;
// Record used to save & restore screen windows
typedef
enum
{
gd_Continue
,
gd_Easy
,
gd_Normal
,
gd_Hard
}
GameDiff
;
extern
boolean
tedlevel
;
/* TODO: rename or remove */
extern
int
tedlevelnum
;
extern
boolean
ingame
,
// Set by game code if a game is in progress
abortgame
,
// Set if a game load failed
loadedgame
,
// Set if the current game was loaded
NoWait
,
HighScoresDirty
;
extern
GameDiff
restartgame
;
// Normally gd_Continue, else starts game
NoWait
;
extern
word
PrintX
,
PrintY
;
// Current printing location in the window
extern
word
WindowX
,
WindowY
,
// Current location of window
WindowW
,
WindowH
;
// Current size of window
...
...
@@ -60,46 +38,27 @@ extern int CursorX,CursorY;
extern
void
(
*
USL_MeasureString
)(
char
*
,
word
*
,
word
*
),
(
*
USL_DrawString
)(
char
*
);
extern
boolean
(
*
USL_SaveGame
)(
int
),(
*
USL_LoadGame
)(
int
);
extern
void
(
*
USL_ResetGame
)(
void
);
extern
SaveGame
Games
[
MaxSaveGames
];
extern
HighScore
Scores
[];
void
US_Startup
(
void
),
US_Setup
(
void
),
US_Shutdown
(
void
),
US_InitRndT
(
boolean
randomize
),
US_SetLoadSaveHooks
(
boolean
(
*
load
)(
int
),
boolean
(
*
save
)(
int
),
void
(
*
reset
)(
void
)),
US_TextScreen
(
void
),
US_UpdateTextScreen
(
void
),
US_FinishTextScreen
(
void
),
US_DrawWindow
(
word
x
,
word
y
,
word
w
,
word
h
),
US_CenterWindow
(
word
,
word
),
US_SaveWindow
(
WindowRec
*
win
),
US_RestoreWindow
(
WindowRec
*
win
),
US_ClearWindow
(
void
),
US_SetPrintRoutines
(
void
(
*
measure
)(
char
*
,
word
*
,
word
*
),
void
(
*
print
)(
char
*
)),
US_PrintCentered
(
char
*
s
),
US_CPrint
(
char
*
s
),
US_CPrintLine
(
char
*
s
),
US_Print
(
char
*
s
),
US_PrintUnsigned
(
longword
n
),
US_PrintSigned
(
long
n
),
US_StartCursor
(
void
),
US_ShutCursor
(
void
),
US_CheckHighScore
(
long
score
,
word
other
),
US_DisplayHighScores
(
int
which
);
boolean
US_UpdateCursor
(
void
),
US_LineInput
(
int
x
,
int
y
,
char
*
buf
,
char
*
def
,
boolean
escok
,
US_CheckHighScore
(
long
score
,
word
other
);
boolean
US_LineInput
(
int
x
,
int
y
,
char
*
buf
,
char
*
def
,
boolean
escok
,
int
maxchars
,
int
maxwidth
);
int
US_CheckParm
(
char
*
parm
,
char
**
strings
),
US_RndT
(
void
);
void
USL_PrintInCenter
(
char
*
s
,
Rect
r
);
char
*
USL_GiveSaveName
(
word
game
);
#elif
#error "fix me: TODO"
...
...
src/misc.c
View file @
646cf19b
...
...
@@ -3,9 +3,36 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include "misc.h"
static
struct
timeval
t0
;
static
long
tc0
;
void
set_TimeCount
(
unsigned
long
t
)
{
tc0
=
t
;
gettimeofday
(
&
t0
,
NULL
);
}
unsigned
long
get_TimeCount
()
{
struct
timeval
t1
;
long
secs
,
usecs
;
long
tc
;
gettimeofday
(
&
t1
,
NULL
);
secs
=
t1
.
tv_sec
-
t0
.
tv_sec
;
usecs
=
t1
.
tv_usec
-
t0
.
tv_usec
;
if
(
usecs
<
0
)
{
usecs
+=
1000000
;
secs
--
;
}
tc
=
tc0
+
secs
*
70
+
usecs
*
70
/
1000000
;
return
tc
;
}
long
filelength
(
int
handle
)
{
struct
stat
buf
;
...
...
src/misc.h
View file @
646cf19b
...
...
@@ -4,6 +4,9 @@
extern
int
_argc
;
extern
char
**
_argv
;
void
set_TimeCount
(
unsigned
long
t
);
unsigned
long
get_TimeCount
();
long
filelength
(
int
handle
);
char
*
itoa
(
short
int
value
,
char
*
string
,
int
radix
);
...
...
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