Commit 4b1c37b0 authored by Steven Fuller's avatar Steven Fuller

id_heads.h, audiosdm.h, audiowl1.h: audio headers for smd and wl1 are

redundant

wl_main.c, wl_play.c: rewrote CalcTics()

sd_oss.c: fixed thread problem (certain situations may have caused the sound
thread to not stay active after init)

vi_sdl.c: added full screen and hide mouse cursor
parent 9fe175e9
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* Network support! * Network support!
* Fully compile with no warnings/errors using -Wall -ansi -pedantic and with * Fully compile with no warnings/errors using -Wall -ansi -pedantic and with
other compilers (would need to turn off warnings about unused parameters) other compilers (would need to turn off warnings about unused parameters)
* Port to: Linux/SVGAlib, Linux/X (Windowed and DGA), Linux/OpenGL?, * Port to: Linux/SVGAlib, Unix/X (Windowed and DGA), Unix/OpenGL?,
DOS/Allegro?, Win32/GDI?, Win32/DX?, Win32/D3D?, Win32/OpenGL, BeOS?, Linux/SDL, DOS/Allegro?, Win32/GDI?, Win32/DX?, Win32/D3D?, Win32/OpenGL,
MacOS?, QNX? BeOS?, MacOS?, QNX?
* Ease in using demos. Playing demos from files, recording to files, batch * Ease in using demos. Playing demos from files, recording to files, batch
playing, and so on. playing, and so on.
* Make Wolf3D the game it was originally planned to be... More strategy... * Make Wolf3D the game it was originally planned to be... More strategy...
......
Hi.
How to use:
About:
Thanks:
----- -----
Steven Fuller Steven Fuller
......
...@@ -69,18 +69,14 @@ SD_StartMusic(chunk); ...@@ -69,18 +69,14 @@ SD_StartMusic(chunk);
* would be nice if Quit() used vsnprintf, etc * would be nice if Quit() used vsnprintf, etc
* actor walking through door is drawn in front of door: near end of E1M1 for * actor walking through door is drawn in front of door: near end of E1M1 for
example example
* clean up vi_xlib.c: fix vid mode changing, fix dga for non8bit modes and * SDL version will have all the features for now, xlib will just be a
the nonpalette setting stuff... lots of if statements 320x200 window
also, it should be able to compile without extensions
* getenv so that you can point an env. var to the proper dir * getenv so that you can point an env. var to the proper dir
* refresh rate under svgalib is horrible. the screen keeps getting updated
midframe. it's due to the way CalcTics works
* rewrite hw (sound, input) code, remove stuff like SD_SetSoundMode * rewrite hw (sound, input) code, remove stuff like SD_SetSoundMode
* proper left/right sound
* adlib sounds seem like they play at twice the freq
* fix config file and savegames * fix config file and savegames
* use static and const where appropriate * use static and const where appropriate
* convert uses of open() to fopen(), etc maybe * convert uses of open() to fopen(), etc maybe
move fileio code to a seperate file
* 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?
...@@ -92,6 +88,8 @@ specifially set to correct size ...@@ -92,6 +88,8 @@ specifially set to correct size
* or have PACKED versions of read/write structures, and transfer * or have PACKED versions of read/write structures, and transfer
to/from just for reading, so only non-packed structures are used during to/from just for reading, so only non-packed structures are used during
actual gameplay/etc. actual gameplay/etc.
this isn't as much of a big deal since compensating for endianness will
require major changes also
* is that memory intro screen needed anymore? probably not, although it * is that memory intro screen needed anymore? probably not, although it
would be nice to show what version is loaded, but doom just printed text would be nice to show what version is loaded, but doom just printed text
and the intro screen which came with wolf3d has copyrighted/trademarked images and the intro screen which came with wolf3d has copyrighted/trademarked images
...@@ -106,16 +104,13 @@ metaname like sc_Left etc or something ...@@ -106,16 +104,13 @@ metaname like sc_Left etc or something
* add a ViewMap? (could be done similar to mac version) * add a ViewMap? (could be done similar to mac version)
* find and remove any function stubs (functions which just call another * find and remove any function stubs (functions which just call another
function with same parameters, only difference is the name) function with same parameters, only difference is the name)
* fix wl_debug.c, lots of junk code..
* change the current parameter handling code to something like getopt * change the current parameter handling code to something like getopt
* remove check for debugmode? * remove check for debugmode?
* 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...
no idea how to do fizzlefade in TrueColor X 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)
* deathcam went by too fast, and right before the fizzlefade was being done * deathcam went by too fast, and right before the fizzlefade was being done
on the border on the border
same with the spear of destiny animation part of ending same with the spear of destiny animation part of ending
......
/////////////////////////////////////////////////
//
// MUSE Header for .SDM
// Created Thu Aug 27 07:12:39 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 81
#define NUMSNDCHUNKS 267
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
MISSILEHITSND, // 1
SELECTITEMSND, // 2
GHOSTSIGHTSND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
NAZIHITPLAYERSND, // 7
MISSILEFIRESND, // 8
PLAYERDEATHSND, // 9
DOGDEATHSND, // 10
ATKGATLINGSND, // 11
GETKEYSND, // 12
NOITEMSND, // 13
WALK1SND, // 14
WALK2SND, // 15
TAKEDAMAGESND, // 16
GAMEOVERSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
DONOTHINGSND, // 20
HALTSND, // 21
DEATHSCREAM2SND, // 22
ATKKNIFESND, // 23
ATKPISTOLSND, // 24
DEATHSCREAM3SND, // 25
ATKMACHINEGUNSND, // 26
HITENEMYSND, // 27
SHOOTDOORSND, // 28
DEATHSCREAM1SND, // 29
GETMACHINESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETGATLINGSND, // 38
ESCPRESSEDSND, // 39
LEVELDONESND, // 40
DOGBARKSND, // 41
ENDBONUS1SND, // 42
ENDBONUS2SND, // 43
BONUS1UPSND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
NOBONUSSND, // 47
PERCENT100SND, // 48
BOSSACTIVESND, // 49
DEATHSCREAM4SND, // 50
SCHUTZADSND, // 51
AHHHGSND, // 52
DEATHSCREAM5SND, // 53
DEATHSCREAM7SND, // 54
DEATHSCREAM8SND, // 55
LEBENSND, // 56
DEATHSCREAM6SND, // 57
NAZIFIRESND, // 58
BOSSFIRESND, // 59
SSFIRESND, // 60
SLURPIESND, // 61
GHOSTFADESND, // 62
DEATHSCREAM9SND, // 63
GETAMMOBOXSND, // 64
ANGELSIGHTSND, // 65
SPIONSND, // 66
NEINSOVASSND, // 67
DOGATTACKSND, // 68
ANGELFIRESND, // 69
TRANSSIGHTSND, // 70
TRANSDEATHSND, // 71
WILHELMSIGHTSND, // 72
WILHELMDEATHSND, // 73
UBERDEATHSND, // 74
KNIGHTSIGHTSND, // 75
KNIGHTDEATHSND, // 76
ANGELDEATHSND, // 77
KNIGHTMISSILESND, // 78
GETSPEARSND, // 79
ANGELTIREDSND, // 80
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 81
#define STARTMUSIC 243
//
// Music names & indexes
//
typedef enum {
XFUNKIE_MUS, // 0
DUNGEON_MUS, // 1
XDEATH_MUS, // 2
GETTHEM_MUS, // 3
XTIPTOE_MUS, // 4
GOINGAFT_MUS, // 5
URAHERO_MUS, // 6
XTHEEND_MUS, // 7
NAZI_OMI_MUS, // 8
POW_MUS, // 9
TWELFTH_MUS, // 10
SEARCHN_MUS, // 11
SUSPENSE_MUS, // 12
ZEROHOUR_MUS, // 13
WONDERIN_MUS, // 14
ULTIMATE_MUS, // 15
ENDLEVEL_MUS, // 16
XEVIL_MUS, // 17
XJAZNAZI_MUS, // 18
COPYPRO_MUS, // 19
XAWARD_MUS, // 20
XPUTIT_MUS, // 21
XGETYOU_MUS, // 22
XTOWER2_MUS, // 23
LASTMUSIC
} musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////
/////////////////////////////////////////////////
//
// MUSE Header for .SOD
// Created Thu Aug 13 09:25:58 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 81 #define NUMSOUNDS 81
#define NUMSNDCHUNKS 267 #define NUMSNDCHUNKS 267
...@@ -133,9 +126,3 @@ typedef enum { ...@@ -133,9 +126,3 @@ typedef enum {
XTOWER2_MUS, // 23 XTOWER2_MUS, // 23
LASTMUSIC LASTMUSIC
} musicnames; } musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////
/////////////////////////////////////////////////
//
// MUSE Header for .WL1
// Created Tue Apr 28 23:57:08 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 87
#define NUMSNDCHUNKS 288
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
SELECTWPNSND, // 1
SELECTITEMSND, // 2
HEARTBEATSND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
NAZIHITPLAYERSND, // 7
NAZIMISSSND, // 8
PLAYERDEATHSND, // 9
DOGDEATHSND, // 10
ATKGATLINGSND, // 11
GETKEYSND, // 12
NOITEMSND, // 13
WALK1SND, // 14
WALK2SND, // 15
TAKEDAMAGESND, // 16
GAMEOVERSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
DONOTHINGSND, // 20
HALTSND, // 21
DEATHSCREAM2SND, // 22
ATKKNIFESND, // 23
ATKPISTOLSND, // 24
DEATHSCREAM3SND, // 25
ATKMACHINEGUNSND, // 26
HITENEMYSND, // 27
SHOOTDOORSND, // 28
DEATHSCREAM1SND, // 29
GETMACHINESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETGATLINGSND, // 38
ESCPRESSEDSND, // 39
LEVELDONESND, // 40
DOGBARKSND, // 41
ENDBONUS1SND, // 42
ENDBONUS2SND, // 43
BONUS1UPSND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
NOBONUSSND, // 47
PERCENT100SND, // 48
BOSSACTIVESND, // 49
BOSSDIESSND, // 50
SCHUTZADSND, // 51
AHHHGSND, // 52
DIESND, // 53
EVASND, // 54
GUTENTAGSND, // 55
LEBENSND, // 56
MUTTISND, // 57
NAZIFIRESND, // 58
BOSSFIRESND, // 59
SSFIRESND, // 60
SLURPIESND, // 61
TOT_HUNDSND, // 62
MEINGOTTSND, // 63
SCHABBSHASND, // 64
HILTERHASND, // 65
SPIONSND, // 66
NEINSOVASSND, // 67
DOGATTACKSND, // 68
LASTSOUND
} soundnames;
/* TODO: YEAHSND not defined in here */
#define YEAHSND NOWAYSND
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 87
#define STARTMUSIC 261
//
// Music names & indexes
//
typedef enum {
CORNER_MUS, // 0
DUNGEON_MUS, // 1
GETOUT_MUS, // 2
GETTHEM_MUS, // 3
HEADACHE_MUS, // 4
HITLWLTZ_MUS, // 5
INTROCW3_MUS, // 6
NAZI_NOR_MUS, // 7
NAZI_OMI_MUS, // 8
POW_MUS, // 9
SALUTE_MUS, // 10
SEARCHN_MUS, // 11
SUSPENSE_MUS, // 12
VICTORS_MUS, // 13
WONDERIN_MUS, // 14
FUNKYOU_MUS, // 15
ENDLEVEL_MUS, // 16
GOINGAFT_MUS, // 17
PREGNANT_MUS, // 18
ULTIMATE_MUS, // 19
NAZI_RAP_MUS, // 20
ZEROHOUR_MUS, // 21
TWELFTH_MUS, // 22
ROSTER_MUS, // 23
URAHERO_MUS, // 24
VICMARCH_MUS, // 25
WARMRCH1_MUS, // 26
LASTMUSIC
} musicnames;
/* TOD: correct? Just changed values to corresspond to wl6 */
#define WARMARCH_MUS GETOUT_MUS
#define PACMAN_MUS WARMRCH1_MUS
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////
/////////////////////////////////////////////////
//
// MUSE Header for .WL6
// Created Tue Jul 14 15:04:53 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 87 #define NUMSOUNDS 87
#define NUMSNDCHUNKS 288 #define NUMSNDCHUNKS 288
...@@ -142,9 +135,3 @@ typedef enum { ...@@ -142,9 +135,3 @@ typedef enum {
PACMAN_MUS, // 26 PACMAN_MUS, // 26
LASTMUSIC LASTMUSIC
} musicnames; } musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////
...@@ -91,7 +91,6 @@ typedef struct fm_opl_f { ...@@ -91,7 +91,6 @@ typedef struct fm_opl_f {
INT32 vibIncr; INT32 vibIncr;
/* wave selector enable flag */ /* wave selector enable flag */
UINT8 wavesel; UINT8 wavesel;
/* external event callback handler */
} FM_OPL; } FM_OPL;
/* ---------- Generic interface section ---------- */ /* ---------- Generic interface section ---------- */
......
...@@ -69,22 +69,22 @@ typedef enum { false, true } boolean; ...@@ -69,22 +69,22 @@ typedef enum { false, true } boolean;
#ifndef UPLOAD #ifndef UPLOAD
#include "gfxv_wl6.h" #include "gfxv_wl6.h"
#include "audiowl6.h"
#else #else
#include "gfxv_wl1.h" #include "gfxv_wl1.h"
#include "audiowl1.h"
#endif #endif
#include "audiowl6.h"
#else /* SPEAR */ #else /* SPEAR */
#ifndef SPEARDEMO #ifndef SPEARDEMO
#include "gfxv_sod.h" #include "gfxv_sod.h"
#include "audiosod.h"
#else /* SPEARDEMO */ #else /* SPEARDEMO */
#include "gfxv_sdm.h" #include "gfxv_sdm.h"
#include "audiosdm.h"
#endif /* SPEARDEMO */ #endif /* SPEARDEMO */
#include "audiosod.h"
#endif /* SPEAR */ #endif /* SPEAR */
/* ---------------- */ /* ---------------- */
...@@ -125,7 +125,7 @@ void Quit(char *error); ...@@ -125,7 +125,7 @@ void Quit(char *error);
#define MAXTICS 10 #define MAXTICS 10
#define DEMOTICS 4 #define DEMOTICS 4
extern unsigned tics; extern int tics;
#define mapwidth 64 #define mapwidth 64
#define mapheight 64 #define mapheight 64
......
...@@ -229,7 +229,6 @@ void *SoundThread(void *data) ...@@ -229,7 +229,6 @@ void *SoundThread(void *data)
write(audiofd, sndbuf, sizeof(sndbuf)); write(audiofd, sndbuf, sizeof(sndbuf));
} }
} }
return NULL; return NULL;
} }
...@@ -330,12 +329,15 @@ void SD_Startup() ...@@ -330,12 +329,15 @@ void SD_Startup()
NewMusic = -1; NewMusic = -1;
AdlibPlaying = -1; AdlibPlaying = -1;
sqActive = false; sqActive = false;
SD_Started = true;
if (pthread_create(&hSoundThread, NULL, SoundThread, NULL) != 0) { if (pthread_create(&hSoundThread, NULL, SoundThread, NULL) != 0) {
SD_Started = false;
perror("pthread_create"); perror("pthread_create");
return; return;
} }
SD_Started = true;
} }
void SD_Shutdown() void SD_Shutdown()
......
...@@ -52,11 +52,13 @@ void Quit(char *error) ...@@ -52,11 +52,13 @@ void Quit(char *error)
void VL_WaitVBL(int vbls) void VL_WaitVBL(int vbls)
{ {
long last = get_TimeCount() + vbls;
while (last > get_TimeCount()) ;
} }
void VW_UpdateScreen() void VW_UpdateScreen()
{ {
VL_WaitVBL(1); //VL_WaitVBL(1);
memcpy(surface->pixels, gfxbuf, 64000); memcpy(surface->pixels, gfxbuf, 64000);
SDL_UpdateRect(surface,0,0,0,0); SDL_UpdateRect(surface,0,0,0,0);
} }
...@@ -69,7 +71,7 @@ void VW_UpdateScreen() ...@@ -69,7 +71,7 @@ void VW_UpdateScreen()
======================= =======================
*/ */
void VL_Startup (void) void VL_Startup()
{ {
if (gfxbuf == NULL) if (gfxbuf == NULL)
gfxbuf = malloc(320 * 200 * 1); gfxbuf = malloc(320 * 200 * 1);
...@@ -78,12 +80,20 @@ void VL_Startup (void) ...@@ -78,12 +80,20 @@ void VL_Startup (void)
Quit("Couldn't init SDL"); Quit("Couldn't init SDL");
} }
surface = SDL_SetVideoMode (320,200,8, SDL_SWSURFACE|SDL_HWPALETTE); if (MS_CheckParm("fullscreen"))
surface = SDL_SetVideoMode (320,200,8, SDL_SWSURFACE|SDL_HWPALETTE| SDL_FULLSCREEN);
else
surface = SDL_SetVideoMode (320,200,8, SDL_SWSURFACE|SDL_HWPALETTE);
if (surface == NULL) if (surface == NULL)
{ {
SDL_Quit(); SDL_Quit();
Quit ("Couldn't set 320x200 mode"); Quit ("Couldn't set 320x200 mode");
} }
SDL_WM_SetCaption(GAMENAME, GAMENAME);
SDL_ShowCursor(0);
} }
/* /*
...@@ -94,7 +104,7 @@ void VL_Startup (void) ...@@ -94,7 +104,7 @@ void VL_Startup (void)
======================= =======================
*/ */
void VL_Shutdown (void) void VL_Shutdown()
{ {
if (gfxbuf != NULL) { if (gfxbuf != NULL) {
free(gfxbuf); free(gfxbuf);
......
...@@ -46,9 +46,13 @@ void Quit(char *error) ...@@ -46,9 +46,13 @@ void Quit(char *error)
void VL_WaitVBL(int vbls) void VL_WaitVBL(int vbls)
{ {
int i; int i;
for (i = 0; i < vbls; i++) for (i = 0; i < vbls; i++)
vga_waitretrace(); vga_waitretrace();
// long last = get_TimeCount() + vbls;
// while (last > get_TimeCount()) ;
} }
void VW_UpdateScreen() void VW_UpdateScreen()
...@@ -65,7 +69,7 @@ void VW_UpdateScreen() ...@@ -65,7 +69,7 @@ void VW_UpdateScreen()
======================= =======================
*/ */
void VL_Startup (void) void VL_Startup()
{ {
if (gfxbuf == NULL) if (gfxbuf == NULL)
gfxbuf = malloc(320 * 200 * 1); gfxbuf = malloc(320 * 200 * 1);
...@@ -87,7 +91,7 @@ void VL_Startup (void) ...@@ -87,7 +91,7 @@ void VL_Startup (void)
======================= =======================
*/ */
void VL_Shutdown (void) void VL_Shutdown()
{ {
if (gfxbuf != NULL) { if (gfxbuf != NULL) {
free(gfxbuf); free(gfxbuf);
...@@ -113,17 +117,6 @@ void VL_ClearVideo(byte color) ...@@ -113,17 +117,6 @@ void VL_ClearVideo(byte color)
memset(gfxbuf, color, 64000); memset(gfxbuf, color, 64000);
} }
/*
=============================================================================
PALETTE OPS
To avoid snow, do a WaitVBL BEFORE calling these
=============================================================================
*/
/* /*
================= =================
= =
......
...@@ -244,16 +244,12 @@ void DrawFace() ...@@ -244,16 +244,12 @@ void DrawFace()
=============== ===============
*/ */
#define FACETICS 70 int facecount;
int facecount; void UpdateFace()
void UpdateFace (void)
{ {
if (SD_SoundPlaying() == GETGATLINGSND)
/* TODO: GETGATLINGSND is an adlib sound... :( */ return;
//if (SD_SoundPlaying() == GETGATLINGSND)
// return;
facecount += tics; facecount += tics;
if (facecount > US_RndT()) if (facecount > US_RndT())
...@@ -263,7 +259,7 @@ void UpdateFace (void) ...@@ -263,7 +259,7 @@ void UpdateFace (void)
gamestate.faceframe = 1; gamestate.faceframe = 1;
facecount = 0; facecount = 0;
DrawFace (); DrawFace();
} }
} }
...@@ -279,27 +275,26 @@ void UpdateFace (void) ...@@ -279,27 +275,26 @@ void UpdateFace (void)
=============== ===============
*/ */
void LatchNumber (int x, int y, int width, long number) void LatchNumber(int x, int y, int width, long number)
{ {
unsigned length,c; int length, c;
char str[20];
ltoa (number,str,10); ltoa(number,str,10);
length = strlen (str); length = strlen(str);
while (length<width) while(length < width)
{ {
StatusDrawPic (x,y,N_BLANKPIC); StatusDrawPic(x,y,N_BLANKPIC);
x++; x++;
width--; width--;
} }
c= length <= width ? 0 : length-width; c = length <= width ? 0 : length-width;
while (c<length) while(c<length)
{ {
StatusDrawPic (x,y,str[c]-'0'+ N_0PIC); StatusDrawPic(x,y,str[c]-'0'+ N_0PIC);
x++; x++;
c++; c++;
} }
......
...@@ -198,21 +198,6 @@ int DebugKeys() ...@@ -198,21 +198,6 @@ int DebugKeys()
ShapeTest(); ShapeTest();
return 1; return 1;
} }
else if (IN_KeyDown(sc_V)) // V = extra VBLs
{
CenterWindow(30,3);
PrintY+=6;
US_Print(" Add how many extra VBLs(0-8):");
VW_UpdateScreen();
esc = !US_LineInput (px,py,str,NULL,true,2,0);
if (!esc)
{
level = atoi (str);
if (level>=0 && level<=8)
extravbls = level;
}
return 1;
}
else if (IN_KeyDown(sc_W)) // W = warp to level else if (IN_KeyDown(sc_W)) // W = warp to level
{ {
CenterWindow(26,3); CenterWindow(26,3);
......
...@@ -769,7 +769,6 @@ extern byte spotvis[MAPSIZE][MAPSIZE]; ...@@ -769,7 +769,6 @@ extern byte spotvis[MAPSIZE][MAPSIZE];
extern objtype *actorat[MAPSIZE][MAPSIZE]; extern objtype *actorat[MAPSIZE][MAPSIZE];
extern boolean singlestep,godmode,noclip; extern boolean singlestep,godmode,noclip;
extern int extravbls;
// //
// control info // control info
......
...@@ -978,8 +978,8 @@ void Died() ...@@ -978,8 +978,8 @@ void Died()
if (player->angle < 0) if (player->angle < 0)
player->angle += ANGLES; player->angle += ANGLES;
ThreeDRefresh (); ThreeDRefresh();
CalcTics (); CalcTics();
} while (curangle != iangle); } while (curangle != iangle);
} }
......
...@@ -97,21 +97,22 @@ fixed FixedByFrac(fixed a, fixed b) ...@@ -97,21 +97,22 @@ fixed FixedByFrac(fixed a, fixed b)
void CalcTics() void CalcTics()
{ {
long newtime; int newtime;
int ticcount;
if (demoplayback || demorecord)
ticcount = DEMOTICS - 1; /* [70/4] 17.5 Hz */
else
ticcount = 0 + 1; /* 35 Hz */
/* calculate tics since last refresh for adaptive timing */
if (lasttimecount > get_TimeCount())
set_TimeCount(lasttimecount); /* if paused for a long time */
do { do {
newtime = get_TimeCount(); newtime = get_TimeCount();
tics = newtime - lasttimecount; tics = newtime - lasttimecount;
} while (!tics); /* make sure at least one tic passes */ } while (tics <= ticcount);
lasttimecount = newtime; lasttimecount = newtime;
if (tics > MAXTICS) { if (tics > MAXTICS) {
set_TimeCount(get_TimeCount() - (tics - MAXTICS));
tics = MAXTICS; tics = MAXTICS;
} }
} }
...@@ -1039,7 +1040,7 @@ void InitGame() ...@@ -1039,7 +1040,7 @@ void InitGame()
SD_Startup(); SD_Startup();
US_Startup(); US_Startup();
SignonScreen(); // SignonScreen();
// //
// build some tables // build some tables
...@@ -1080,7 +1081,7 @@ void InitGame() ...@@ -1080,7 +1081,7 @@ void InitGame()
DoJukebox(); DoJukebox();
#endif #endif
FinishSignon(); // FinishSignon();
} }
//=========================================================================== //===========================================================================
...@@ -1100,7 +1101,7 @@ boolean SetViewSize(unsigned width, unsigned height) ...@@ -1100,7 +1101,7 @@ boolean SetViewSize(unsigned width, unsigned height)
centerx = viewwidth/2-1; centerx = viewwidth/2-1;
shootdelta = viewwidth/10; shootdelta = viewwidth/10;
yoffset = (200-STATUSLINES-viewheight)/2; yoffset = (200-STATUSLINES-viewheight)/2;
xoffset = (320-viewwidth)/2; xoffset = (320-viewwidth)/2;
// //
...@@ -1220,18 +1221,17 @@ void DemoLoop() ...@@ -1220,18 +1221,17 @@ void DemoLoop()
// //
// high scores // high scores
// //
DrawHighScores (); DrawHighScores();
VW_UpdateScreen (); VW_UpdateScreen();
VW_FadeIn (); VW_FadeIn();
if (IN_UserInput(TickBase*10)) if (IN_UserInput(TickBase*10))
break; break;
// //
// demo // demo
// //
#ifndef SPEARDEMO #ifndef SPEARDEMO
PlayDemo (LastDemo++%4); PlayDemo(LastDemo++%4);
#else #else
PlayDemo(0); PlayDemo(0);
#endif #endif
...@@ -1241,16 +1241,16 @@ void DemoLoop() ...@@ -1241,16 +1241,16 @@ void DemoLoop()
StartCPMusic(INTROSONG); StartCPMusic(INTROSONG);
} }
VW_FadeOut (); VW_FadeOut();
if (IN_KeyDown(sc_Tab) && MS_CheckParm("debugmode")) if (IN_KeyDown(sc_Tab) && MS_CheckParm("debugmode"))
RecordDemo (); RecordDemo ();
else else
US_ControlPanel (0); US_ControlPanel(0);
if (startgame || loadedgame) if (startgame || loadedgame)
{ {
GameLoop (); GameLoop();
VW_FadeOut(); VW_FadeOut();
StartCPMusic(INTROSONG); StartCPMusic(INTROSONG);
} }
...@@ -1264,7 +1264,7 @@ void DemoLoop() ...@@ -1264,7 +1264,7 @@ void DemoLoop()
/* /*
========================== ==========================
= =
= main = WolfMain
= =
========================== ==========================
*/ */
...@@ -1274,6 +1274,11 @@ int WolfMain(int argc, char *argv[]) ...@@ -1274,6 +1274,11 @@ int WolfMain(int argc, char *argv[])
_argc = argc; _argc = argc;
_argv = argv; _argv = argv;
if (MS_CheckParm("version")) {
printf("Game: %s\n", GAMENAME);
Quit(NULL);
}
printf("Now Loading %s\n", GAMENAME); printf("Now Loading %s\n", GAMENAME);
CheckForEpisodes(); CheckForEpisodes();
......
...@@ -20,13 +20,12 @@ objtype objlist[MAXACTORS],*new,*obj,*player,*lastobj, ...@@ -20,13 +20,12 @@ objtype objlist[MAXACTORS],*new,*obj,*player,*lastobj,
unsigned farmapylookup[MAPSIZE]; unsigned farmapylookup[MAPSIZE];
boolean singlestep,godmode,noclip; boolean singlestep,godmode,noclip;
int extravbls;
byte tilemap[MAPSIZE][MAPSIZE]; // wall values only byte tilemap[MAPSIZE][MAPSIZE]; // wall values only
byte spotvis[MAPSIZE][MAPSIZE]; byte spotvis[MAPSIZE][MAPSIZE];
objtype *actorat[MAPSIZE][MAPSIZE]; objtype *actorat[MAPSIZE][MAPSIZE];
unsigned tics; int tics;
// //
// control info // control info
...@@ -59,7 +58,6 @@ boolean buttonstate[NUMBUTTONS]; ...@@ -59,7 +58,6 @@ boolean buttonstate[NUMBUTTONS];
static void RemoveObj(objtype *gone); static void RemoveObj(objtype *gone);
static void PollControls();
void StopMusic(); void StopMusic();
void StartMusic(); void StartMusic();
void PlayLoop(); void PlayLoop();
...@@ -409,35 +407,7 @@ void PollControls() ...@@ -409,35 +407,7 @@ void PollControls()
int max, min, i; int max, min, i;
byte buttonbits; byte buttonbits;
//
// get timing info for last frame
//
if (demoplayback) {
#if 0
if (1 /* (TEMP) TODO: TimeDemo */) {
set_TimeCount(lasttimecount + DEMOTICS);
lasttimecount += DEMOTICS;
tics = DEMOTICS;
} else
#endif
{
while ( get_TimeCount() < (lasttimecount+DEMOTICS) ) ;
set_TimeCount(lasttimecount + DEMOTICS);
lasttimecount += DEMOTICS;
tics = DEMOTICS;
}
} else if (demorecord) {
// demo recording and playback needs
// to be constant
//
// take DEMOTICS or more tics, and modify Timecount to reflect time taken
//
while (get_TimeCount() < (lasttimecount+DEMOTICS)) ;
set_TimeCount(lasttimecount + DEMOTICS);
lasttimecount += DEMOTICS;
tics = DEMOTICS;
} else
CalcTics();
controlx = 0; controlx = 0;
controly = 0; controly = 0;
...@@ -531,7 +501,7 @@ void PollControls() ...@@ -531,7 +501,7 @@ void PollControls()
*demoptr++ = controly; *demoptr++ = controly;
if (demoptr >= lastdemoptr) if (demoptr >= lastdemoptr)
Quit ("Demo buffer overflowed!"); Quit("Demo buffer overflowed!");
controlx *= (int)tics; controlx *= (int)tics;
controly *= (int)tics; controly *= (int)tics;
...@@ -1265,20 +1235,25 @@ long funnyticount; ...@@ -1265,20 +1235,25 @@ long funnyticount;
void PlayLoop() void PlayLoop()
{ {
playstate = lasttimecount = 0; playstate = lasttimecount = 0;
set_TimeCount(0);
frameon = 0; frameon = 0;
anglefrac = 0; anglefrac = 0;
facecount = 0; facecount = 0;
funnyticount = 0; funnyticount = 0;
memset (buttonstate,0,sizeof(buttonstate)); memset (buttonstate,0,sizeof(buttonstate));
ClearPaletteShifts (); ClearPaletteShifts();
if (demoplayback) if (demoplayback)
IN_StartAck (); IN_StartAck();
set_TimeCount(0);
do do
{ {
/* get timing info for last frame */
CalcTics();
/* handle input */
PollControls(); PollControls();
// //
...@@ -1326,8 +1301,6 @@ void PlayLoop() ...@@ -1326,8 +1301,6 @@ void PlayLoop()
VW_WaitVBL(14); VW_WaitVBL(14);
lasttimecount = get_TimeCount(); lasttimecount = get_TimeCount();
} }
if (extravbls)
VW_WaitVBL(extravbls);
if (demoplayback) if (demoplayback)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment