main() from outside
This commit is contained in:
+22
-18
@@ -402,6 +402,22 @@ boolean D_GrabMouseCallback(void)
|
||||
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
|
||||
//
|
||||
@@ -439,21 +455,7 @@ void D_DoomLoop (void)
|
||||
wipegamestate = gamestate;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
// 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 ();
|
||||
}
|
||||
}
|
||||
doomgeneric_Tick();
|
||||
}
|
||||
|
||||
|
||||
@@ -1812,14 +1814,16 @@ void D_DoomMain (void)
|
||||
{
|
||||
singledemo = true; // quit after one demo
|
||||
G_DeferedPlayDemo (demolumpname);
|
||||
D_DoomLoop (); // never returns
|
||||
D_DoomLoop ();
|
||||
return;
|
||||
}
|
||||
|
||||
p = M_CheckParmWithArgs("-timedemo", 1);
|
||||
if (p)
|
||||
{
|
||||
G_TimeDemo (demolumpname);
|
||||
D_DoomLoop (); // never returns
|
||||
D_DoomLoop ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (startloadgame >= 0)
|
||||
@@ -1836,6 +1840,6 @@ void D_DoomMain (void)
|
||||
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"
|
||||
|
||||
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_Init();
|
||||
|
||||
D_DoomMain ();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,11 @@
|
||||
|
||||
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_DrawFrame();
|
||||
void DG_SleepMs(uint32_t ms);
|
||||
|
||||
@@ -34,9 +34,7 @@ void D_DoomMain (void);
|
||||
|
||||
void M_FindResponseFile(void);
|
||||
|
||||
void dg_Create();
|
||||
|
||||
|
||||
/*
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// save arguments
|
||||
@@ -48,11 +46,10 @@ int main(int argc, char **argv)
|
||||
|
||||
// start doom
|
||||
printf("Starting D_DoomMain\r\n");
|
||||
|
||||
dg_Create();
|
||||
|
||||
D_DoomMain ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user