Demos (still don't work) and single-episode Ultimate Doom WADs

This commit is contained in:
Lephenixnoir 2021-09-14 10:52:49 +02:00
parent 808e450ed3
commit bf01ec7864
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
9 changed files with 105 additions and 39 deletions

View File

@ -355,7 +355,7 @@ 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 *autostart)
int *autostart, int *enabledemos)
{
Layout l;
Layout_Init(&l);
@ -391,7 +391,9 @@ 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_Text(&l, "Title screen:",
*autostart ? "Skip" :
!*enabledemos ? "No demos" : "Full");
Layout_Spacing(&l, 12);
Layout_Checkbox(&l, "Developer info:", dev_info);
@ -403,10 +405,19 @@ int UI_Main(WADFileInfo *wads, int wad_count, int *dev_info, int *use_mmap,
int key;
GetKey(&key);
if(Layout_Event(&l, key))
{}
else if(key == KEY_CTRL_EXE && l.focus < wad_count)
if(Layout_Event(&l, key)) {
}
else if(key == KEY_CTRL_EXE && l.focus == wad_count + 2) {
if (!*autostart && *enabledemos)
*autostart = 1;
else if (!*autostart)
*enabledemos = 1;
else
*autostart = 0, *enabledemos = 0;
}
else if(key == KEY_CTRL_EXE && l.focus < wad_count) {
return l.focus;
}
if(*startmap < 1)
*startmap = 1;

View File

@ -68,7 +68,8 @@ int UI_Main(WADFileInfo *wads, int wad_count,
int *startmap, /* Warp to this map */
int *startepisode, /* Warp to this episode */
int *trustunaligned, /* Trust unaligned lumps */
int *autostart /* Skip main menu, straight to gameplay */
int *autostart, /* Skip title screen, straight to gameplay */
int *enabledemos /* Enable demos on the title screen */
);
#endif /* CGDOOM_UI_H */

View File

@ -381,6 +381,8 @@ static SectorIndexInfo *gIndex = NULL;
/* Global options */
int CGD_TrustUnalignedLumps = 1;
int CGD_EnableDemos = 0;
int CGD_SingleEpisodeUltimate = 0;
/* Performance counters */
struct CGD_Perf CGD_Perf;
@ -638,12 +640,23 @@ int main(void)
int dev_info = 0;
int choice = UI_Main(wads, wad_count, &dev_info, &gWADmethod,
&startmap, &startepisode, &CGD_TrustUnalignedLumps, &autostart_);
&startmap, &startepisode, &CGD_TrustUnalignedLumps, &autostart_,
&CGD_EnableDemos);
if(choice < 0)
return 1;
autostart = autostart_;
/* Override version detection for single-episode Ultimate Doom WADs */
if (!CGDstrcmp(wads[choice].name, "doomu1.wad"))
CGD_SingleEpisodeUltimate = 1;
if (!CGDstrcmp(wads[choice].name, "doomu2.wad"))
CGD_SingleEpisodeUltimate = 2;
if (!CGDstrcmp(wads[choice].name, "doomu3.wad"))
CGD_SingleEpisodeUltimate = 3;
if (!CGDstrcmp(wads[choice].name, "doomu4.wad"))
CGD_SingleEpisodeUltimate = 4;
unsigned tmp=((unsigned)getSecondaryVramAddress()+3)&(~3);
SaveVRAMBuffer = (unsigned char*)tmp;
/* Graph 90+E: RAM starts at 0x0c000000 in physical memory */

View File

@ -1,7 +1,7 @@
#ifndef CGDOOM_H
#define CGDOOM_H
/* CGDoom-specific definitions that cover both calculator and native builds. */
// CGDoom-specific definitions that cover both calculator and native builds.
#include <stdint.h>
#include "libprof.h"
@ -19,14 +19,24 @@ typedef struct
int size;
} WADFileInfo;
// TODO: Move developer info here
/* CGDoom statistics */
extern struct CGD_Perf CGD_Perf;
extern struct CGD_Stats CGD_Stats;
/* Global variables interfacing with Doom itself. */
// CGDoom options (some more are specified in platform.h)
/* Enable demos in the title screen (most are incompatible and look bad) */
extern int CGD_EnableDemos;
/* The selected WAD is a split Ultimate Doom WAD with a single episode (this
exists on the fx-CG 50 and is incorrectly detected by normal logic) */
extern int CGD_SingleEpisodeUltimate;
// Global variables interfacing with Doom itself.
/* Map and episode to start at when loading the game. */
extern int startmap, startepisode;
/* Keyboard interface. */
// Keyboard interface.
// Special key names for cheats, debugs, etc (completes doomdef.h).
#define SKEY_CHEAT 0x10001

View File

@ -30,6 +30,7 @@
#include "os.h"
#include "cgdoom.h"
#include "cgdoom-alloc.h"
#include <stdlib.h>
@ -343,9 +344,9 @@ void D_DoAdvanceDemo (void)
gameaction = ga_nothing;
if ( gamemode == retail )
demosequence = (demosequence+1)%4;
demosequence = (demosequence+1)%7;
else
demosequence = (demosequence+1)%3;
demosequence = (demosequence+1)%6;
switch (demosequence)
{
@ -366,6 +367,9 @@ void D_DoAdvanceDemo (void)
pagename = "CREDIT";
break;
case 3:
G_DeferedPlayDemo ("demo2");
break;
case 4:
gamestate = GS_DEMOSCREEN;
if ( gamemode == commercial)
{
@ -382,6 +386,17 @@ void D_DoAdvanceDemo (void)
pagename = "HELP2";
}
break;
case 5:
G_DeferedPlayDemo ("demo3");
break;
case 6:
G_DeferedPlayDemo ("demo4");
break;
}
/* CGDoom: Skip demos on option (often incompatible) */
if (gameaction == ga_playdemo && !CGD_EnableDemos) {
D_DoAdvanceDemo();
}
}
@ -446,26 +461,21 @@ void D_DoomMain()
if(gamemode == indetermined) // CX port
return; // CX port
{//save sprintf
if (W_CheckNumForName("E2M1")!=-1)
{
maxepisode = 2;
if (W_CheckNumForName("E3M1")!=-1)
maxepisode = 3;
}
#if 0 //CG:seem to be useless
while(true)
{ if(gamemode==commercial)
sprintf(res,"MAP%02i",maxmap+1);
else
sprintf(res,"E1M%i",maxmap+1);
if (W_CheckNumForName(res)==-1)
break;
maxmap++;
}
#endif
if (W_CheckNumForName("E4M1")!=-1)
maxepisode = 4;
else if (W_CheckNumForName("E3M1")!=-1)
maxepisode = 3;
else if (W_CheckNumForName("E2M1")!=-1)
maxepisode = 2;
/* CGDoom: Override game mode for split WADs; we have single-episode WADs for
all episodes of Ultimate Doom, and they should identify as retail */
if (CGD_SingleEpisodeUltimate > 0) {
gamemode=retail;
maxepisode = CGD_SingleEpisodeUltimate;
}
nomonsters = 0;
respawnparm = 0;
fastparm = 0;

View File

@ -24,6 +24,7 @@
//static const char
#include "os.h"
#include "cgdoom.h"
#include "doomdef.h"
#include "doomstat.h"
@ -485,7 +486,10 @@ void G_Ticker (void)
{
cmd = &players[0].cmd;
G_BuildTiccmd (cmd);
if (demoplayback)
G_ReadDemoTiccmd (cmd);
else
G_BuildTiccmd (cmd);
if (players[0].cmd.buttons & BT_SPECIAL)
{
@ -789,6 +793,9 @@ void G_DoCompleted (void)
wminfo.epsd = gameepisode -1;
wminfo.last = gamemap -1;
if (CGD_SingleEpisodeUltimate)
wminfo.epsd = CGD_SingleEpisodeUltimate - 1;
// wminfo.next is 0 biased, unlike gamemap
if ( gamemode == commercial)
{
@ -955,15 +962,16 @@ void G_DeferedInitNew( skill_t skill, int episode, int map)
void G_DoNewGame (void)
{
// netdemo = false;
// netgame = false;
demoplayback = false;
netdemo = false;
netgame = false;
deathmatch = false;
playeringame[0] = true;
playeringame[1] = playeringame[2] = playeringame[3] = 0;
respawnparm = false;
fastparm = false;
nomonsters = false;
// consoleplayer = 0;
consoleplayer = 0;
G_InitNew (d_skill, d_episode, d_map);
gameaction = ga_nothing;
}
@ -1031,6 +1039,7 @@ void G_InitNew ( skill_t skill, int episode, int map )
usergame = true; // will be set false if a demo
paused = false;
demoplayback = false;
automapactive = false;
viewactive = true;
gameepisode = episode;
@ -1136,7 +1145,11 @@ void G_DoPlayDemo (void)
gameaction = ga_nothing;
demobuffer = demo_p = (byte *)W_CacheLumpNameConst (defdemoname, PU_STATIC);
if ( *demo_p++ != VERSION)
/* CGDoom: We have old WADs with demos at versions 108 and 109. They don't
really work whell though */
byte version = *demo_p++;
if (version != VERSION && version != 109 && version != 108)
{
// fprintf( stderr, "Demo is from a different game version!\n");
gameaction = ga_nothing;

View File

@ -23,6 +23,8 @@
//static const char
#include "os.h"
#include "cgdoom.h"
#include "doomdef.h"
#include "z_zone.h"
#include "m_swap.h"
@ -239,7 +241,10 @@ void HU_Start(void)
case shareware:
case registered:
case retail:
/* CGDoom: Use proper episode names in single-episode Ultimate Doom WADs */
a = 9*(gameepisode-1) + gamemap - 1;
if (CGD_SingleEpisodeUltimate)
a = 9*(CGD_SingleEpisodeUltimate-1) + gamemap - 1;
s = mapnames[a];
break;
/* FIXME

View File

@ -24,6 +24,7 @@
#include "os.h"
#include "cgdoom.h"
#include "doomdef.h"
@ -1289,5 +1290,10 @@ void M_Init (void)
break;
}
/* CGDoom: Change options when playing single-episode Ultimate Doom WADs */
if (CGD_SingleEpisodeUltimate) {
EpiDef.numitems -= 3;
EpisodeMenu[0] = EpisodeMenu[CGD_SingleEpisodeUltimate - 1];
}
}

View File

@ -79,9 +79,6 @@ extern int CGD_TrustUnalignedLumps;
# define CGDOOM_SCREENS_BASE SaveVRAMBuffer
#endif
extern struct CGD_Perf CGD_Perf;
extern struct CGD_Stats CGD_Stats;
//---
#include "keyboard.hpp"