Commit 0c6a347e authored by Steven Fuller's avatar Steven Fuller

Implemented PlayDemoFromFile

parent 6b84adb4
......@@ -23,8 +23,8 @@ two screens for nostalga
work the same, let the input handler do it all instead
* when viewsize is around 20, sprites end up being drawn over the border.
maybe there are clipping bugs that will cause it to fill over the top, left,
and right
* remove DEMOEXTERN, and add ability to play demos from commandline
and right (happens at any view basically, except this version of source does
not leave any artifacts after a few screen redraws)
* remove GOODTIMES (the piracy message is somewhat worthless)
* then consider removing the SOD manual check
* Use either US_CheckParm or MS_CheckParm.
......@@ -63,6 +63,11 @@ update once per frame or such.. hm
and where is that greenpixel coming from (when using end game with largest
window size)
* merge id_vl.c and id_in.c to get id_svga.c
* change id_sd to sd_oss, sd_win, sd_dos, sd_oal, etc
idea is that different <outputs> can share some drivers, unlike video
* check filehandling (ex, file missing, bad file type, and such)
PlayDemoFromFile specifically
* make sure all infinite loops are found (looping around Keyboard)
Specific:
* memory/sound intro screen goes
......
......@@ -142,6 +142,9 @@ void US_Print(char *str)
PrintX += w;
}
px = PrintX;
py = PrintY;
free(sz);
}
......
......@@ -702,7 +702,7 @@ typedef enum {
=============================================================================
*/
extern boolean MS_CheckParm (char *string);
int MS_CheckParm(char *string);
extern char str[80],str2[20];
......@@ -771,7 +771,8 @@ void DrawPlayScreen (void);
void FizzleOut (void);
void GameLoop (void);
void ClearMemory (void);
void PlayDemo (int demonumber);
void PlayDemo(int demonumber);
int PlayDemoFromFile(char *demoname);
void RecordDemo (void);
void DrawAllPlayBorder (void);
void DrawHighScores(void);
......
......@@ -895,6 +895,7 @@ void FinishDemoRecord (void)
CenterWindow(24,3);
PrintY+=6;
VW_FadeIn();
US_Print(" Demo number (0-9):");
VW_UpdateScreen();
......@@ -1037,11 +1038,16 @@ void PlayDemo(int demonumber)
ClearMemory ();
}
void PlayDemoFromFile(char *demoname)
int PlayDemoFromFile(char *demoname)
{
int length;
CA_LoadFile(demoname, &demobuffer);
if (demobuffer == NULL) {
fprintf(stderr, "Unable to load demo: %s\n", demoname);
return 0;
}
MM_SetLock(&demobuffer,true);
demoptr = (char *)demobuffer;
......@@ -1074,10 +1080,9 @@ void PlayDemoFromFile(char *demoname)
demoplayback = false;
StopMusic ();
VW_FadeOut ();
ClearMemory ();
IN_Ack();
return 1;
}
//==========================================================================
......
......@@ -698,7 +698,7 @@ void FinishSignon (void)
=================
*/
boolean MS_CheckParm(char *check)
int MS_CheckParm(char *check)
{
int i;
char *parm;
......@@ -712,10 +712,10 @@ boolean MS_CheckParm(char *check)
break; // hit end of string without an alphanum
if ( !strcasecmp(check,parm) )
return true;
return i;
}
return false;
return 0;
}
//===========================================================================
......@@ -1154,7 +1154,7 @@ void Quit(char *error)
{
memptr screen = NULL;
if (error && !*error) {
if (!error || !*error) {
CA_CacheGrChunk(ORDERSCREEN);
screen = grsegs[ORDERSCREEN];
WriteConfig();
......@@ -1166,7 +1166,7 @@ void Quit(char *error)
ShutdownId();
if (screen) {
/* blah blah */
printf("TODO: spiffy ansi screen goes here..\n");
}
if (error && *error) {
......@@ -1192,22 +1192,31 @@ void Quit(char *error)
void DemoLoop (void)
{
static int LastDemo;
int i;
//
// main game cycle
//
#ifndef UPLOAD
#if !defined(GOODTIMES) && defined(SPEAR) && !defined(SPEARDEMO)
CopyProtection();
#endif
#endif
StartCPMusic(INTROSONG);
if (!NoWait)
PG13 ();
i = MS_CheckParm("playdemo");
if ( i && ( (i+1) < _argc) ) {
i++;
for (; i < _argc; i++) {
IN_ClearKeysDown();
if (PlayDemoFromFile(_argv[i]))
IN_UserInput(3 * 70);
}
VW_FadeOut();
}
while (1)
{
while (!NoWait)
......@@ -1273,11 +1282,7 @@ void DemoLoop (void)
VW_FadeOut ();
#ifndef SPEAR
if (Keyboard[sc_Tab] && MS_CheckParm("goobers"))
#else
if (Keyboard[sc_Tab] && MS_CheckParm("debugmode"))
#endif
RecordDemo ();
else
US_ControlPanel (0);
......@@ -1303,7 +1308,7 @@ void DemoLoop (void)
==========================
*/
int main(int argc, char *argv[])
int WolfMain(int argc, char *argv[])
{
int i;
......@@ -1321,3 +1326,8 @@ int main(int argc, char *argv[])
return 0;
}
int main(int argc, char *argv[])
{
return WolfMain(argc, argv);
}
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