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

Implemented PlayDemoFromFile

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