main() from outside
This commit is contained in:
+22
-18
@@ -402,6 +402,22 @@ boolean D_GrabMouseCallback(void)
|
|||||||
return (gamestate == GS_LEVEL) && !demoplayback && !advancedemo;
|
return (gamestate == GS_LEVEL) && !demoplayback && !advancedemo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void doomgeneric_Tick()
|
||||||
|
{
|
||||||
|
// frame syncronous IO operations
|
||||||
|
I_StartFrame ();
|
||||||
|
|
||||||
|
TryRunTics (); // will run at least one tic
|
||||||
|
|
||||||
|
S_UpdateSounds (players[consoleplayer].mo);// move positional sounds
|
||||||
|
|
||||||
|
// Update display, next frame, with current state.
|
||||||
|
if (screenvisible)
|
||||||
|
{
|
||||||
|
D_Display ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// D_DoomLoop
|
// D_DoomLoop
|
||||||
//
|
//
|
||||||
@@ -439,21 +455,7 @@ void D_DoomLoop (void)
|
|||||||
wipegamestate = gamestate;
|
wipegamestate = gamestate;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1)
|
doomgeneric_Tick();
|
||||||
{
|
|
||||||
// frame syncronous IO operations
|
|
||||||
I_StartFrame ();
|
|
||||||
|
|
||||||
TryRunTics (); // will run at least one tic
|
|
||||||
|
|
||||||
S_UpdateSounds (players[consoleplayer].mo);// move positional sounds
|
|
||||||
|
|
||||||
// Update display, next frame, with current state.
|
|
||||||
if (screenvisible)
|
|
||||||
{
|
|
||||||
D_Display ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1812,14 +1814,16 @@ void D_DoomMain (void)
|
|||||||
{
|
{
|
||||||
singledemo = true; // quit after one demo
|
singledemo = true; // quit after one demo
|
||||||
G_DeferedPlayDemo (demolumpname);
|
G_DeferedPlayDemo (demolumpname);
|
||||||
D_DoomLoop (); // never returns
|
D_DoomLoop ();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = M_CheckParmWithArgs("-timedemo", 1);
|
p = M_CheckParmWithArgs("-timedemo", 1);
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
G_TimeDemo (demolumpname);
|
G_TimeDemo (demolumpname);
|
||||||
D_DoomLoop (); // never returns
|
D_DoomLoop ();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startloadgame >= 0)
|
if (startloadgame >= 0)
|
||||||
@@ -1836,6 +1840,6 @@ void D_DoomMain (void)
|
|||||||
D_StartTitle (); // start up intro loop
|
D_StartTitle (); // start up intro loop
|
||||||
}
|
}
|
||||||
|
|
||||||
D_DoomLoop (); // never returns
|
D_DoomLoop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "doomgeneric.h"
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
doomgeneric_Create(argc, argv);
|
||||||
|
|
||||||
|
for (int i = 0; ; i++)
|
||||||
|
{
|
||||||
|
doomgeneric_Tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,12 +1,27 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "m_argv.h"
|
||||||
|
|
||||||
#include "doomgeneric.h"
|
#include "doomgeneric.h"
|
||||||
|
|
||||||
uint32_t* DG_ScreenBuffer = 0;
|
uint32_t* DG_ScreenBuffer = 0;
|
||||||
|
|
||||||
|
void M_FindResponseFile(void);
|
||||||
|
void D_DoomMain (void);
|
||||||
|
|
||||||
void dg_Create()
|
|
||||||
|
void doomgeneric_Create(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
// save arguments
|
||||||
|
myargc = argc;
|
||||||
|
myargv = argv;
|
||||||
|
|
||||||
|
M_FindResponseFile();
|
||||||
|
|
||||||
DG_ScreenBuffer = malloc(DOOMGENERIC_RESX * DOOMGENERIC_RESY * 4);
|
DG_ScreenBuffer = malloc(DOOMGENERIC_RESX * DOOMGENERIC_RESY * 4);
|
||||||
|
|
||||||
DG_Init();
|
DG_Init();
|
||||||
|
|
||||||
|
D_DoomMain ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,11 @@
|
|||||||
|
|
||||||
extern uint32_t* DG_ScreenBuffer;
|
extern uint32_t* DG_ScreenBuffer;
|
||||||
|
|
||||||
|
void doomgeneric_Create(int argc, char **argv);
|
||||||
|
void doomgeneric_Tick();
|
||||||
|
|
||||||
|
|
||||||
|
//Implement below functions for your platform
|
||||||
void DG_Init();
|
void DG_Init();
|
||||||
void DG_DrawFrame();
|
void DG_DrawFrame();
|
||||||
void DG_SleepMs(uint32_t ms);
|
void DG_SleepMs(uint32_t ms);
|
||||||
|
|||||||
@@ -34,9 +34,7 @@ void D_DoomMain (void);
|
|||||||
|
|
||||||
void M_FindResponseFile(void);
|
void M_FindResponseFile(void);
|
||||||
|
|
||||||
void dg_Create();
|
/*
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
// save arguments
|
// save arguments
|
||||||
@@ -48,11 +46,10 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// start doom
|
// start doom
|
||||||
printf("Starting D_DoomMain\r\n");
|
printf("Starting D_DoomMain\r\n");
|
||||||
|
|
||||||
dg_Create();
|
|
||||||
|
|
||||||
D_DoomMain ();
|
D_DoomMain ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
Reference in New Issue
Block a user