From 83bb8184e8d93b4adaca61a656a45504b7da057f Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Fri, 10 Sep 2021 22:34:03 +0200 Subject: [PATCH] Add option to skip title screen --- cgdoom/cgdoom-ui.c | 4 +++- cgdoom/cgdoom-ui.h | 3 ++- cgdoom/cgdoom.c | 7 ++++++- cgdoom/d_main.c | 11 ++++++----- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/cgdoom/cgdoom-ui.c b/cgdoom/cgdoom-ui.c index fc083d9..83013fb 100644 --- a/cgdoom/cgdoom-ui.c +++ b/cgdoom/cgdoom-ui.c @@ -354,7 +354,8 @@ int Layout_Event(Layout *l, int key) } int UI_Main(WADFileInfo *wads, int wad_count, int *dev_info, int *use_mmap, - int *startmap, int *startepisode, int *trustunaligned) + int *startmap, int *startepisode, int *trustunaligned, + int *autostart) { Layout l; Layout_Init(&l); @@ -390,6 +391,7 @@ int UI_Main(WADFileInfo *wads, int wad_count, int *dev_info, int *use_mmap, Layout_Spacing(&l, 12); Layout_Integer(&l, "Start at episode:", startepisode); Layout_Integer(&l, "Start at map:", startmap); + Layout_Checkbox(&l, "Skip title screen:", autostart); Layout_Spacing(&l, 12); Layout_Checkbox(&l, "Developer info:", dev_info); diff --git a/cgdoom/cgdoom-ui.h b/cgdoom/cgdoom-ui.h index 694ef5b..2b899f2 100644 --- a/cgdoom/cgdoom-ui.h +++ b/cgdoom/cgdoom-ui.h @@ -67,7 +67,8 @@ int UI_Main(WADFileInfo *wads, int wad_count, int *use_mmap, /* Map file to memory (as opposed to using Bfile) */ int *startmap, /* Warp to this map */ int *startepisode, /* Warp to this episode */ - int *trustunaligned /* Trust unaligned lumps */ + int *trustunaligned, /* Trust unaligned lumps */ + int *autostart /* Skip main menu, straight to gameplay */ ); #endif /* CGDOOM_UI_H */ diff --git a/cgdoom/cgdoom.c b/cgdoom/cgdoom.c index cc74501..d602e43 100644 --- a/cgdoom/cgdoom.c +++ b/cgdoom/cgdoom.c @@ -3,6 +3,7 @@ #include "cgdoom.h" #include #include "libprof.h" +#include "doomtype.h" #ifndef CG_EMULATOR # include "cgdoom-alloc.h" @@ -616,6 +617,8 @@ void abort(void){ /////////////////////////////////////////////////////////////////////////////////////////////////// int main(void) { + extern boolean autostart; + int autostart_ = 0; startmap = 1; startepisode = 1; @@ -635,10 +638,12 @@ int main(void) int dev_info = 0; int choice = UI_Main(wads, wad_count, &dev_info, &gWADmethod, - &startmap, &startepisode, &CGD_TrustUnalignedLumps); + &startmap, &startepisode, &CGD_TrustUnalignedLumps, &autostart_); if(choice < 0) return 1; + autostart = autostart_; + unsigned tmp=((unsigned)getSecondaryVramAddress()+3)&(~3); SaveVRAMBuffer = (unsigned char*)tmp; /* Graph 90+E: RAM starts at 0x0c000000 in physical memory */ diff --git a/cgdoom/d_main.c b/cgdoom/d_main.c index 8f2c926..5616c8a 100644 --- a/cgdoom/d_main.c +++ b/cgdoom/d_main.c @@ -475,10 +475,6 @@ void D_DoomMain() else if(skill==3) startskill = sk_hard; else if(skill==4) startskill = sk_nightmare; - episode = startepisode; - map = startmap; - autostart = false; - // init subsystems //printf ("V_Init: Allocate screens\n"); V_Init (); @@ -532,7 +528,12 @@ void D_DoomMain() //printf ("ST_Init: Init status bar\n"); ST_Init (); //printf ("Engage... \n"); - D_StartTitle (); + + if (autostart) + G_DeferedInitNew (startskill, startepisode, startmap); + else + D_StartTitle (); + D_DoomLoop (); // never returns, except when it does I_Restore (); //calckill = bad