mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
Add common.[ch] which should be used for common non-engine types/functions/data.
As inauguration, move G_AddGroup, G_AddPath and struct strllist there. The header is located in build/include, because in the future, code that resides closer to (but is not strictly part of) the engine might need to be factored into here. The source file, however, is in the source/ directory. git-svn-id: https://svn.eduke32.com/eduke32@2542 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6336856227
commit
ee5dd2cf32
5 changed files with 79 additions and 96 deletions
|
@ -103,6 +103,7 @@ JMACTOBJ=$(OBJ)/file_lib.$o \
|
|||
GAMEOBJS=$(OBJ)/game.$o \
|
||||
$(OBJ)/actors.$o \
|
||||
$(OBJ)/anim.$o \
|
||||
$(OBJ)/common.$o \
|
||||
$(OBJ)/config.$o \
|
||||
$(OBJ)/demo.$o \
|
||||
$(OBJ)/gamedef.$o \
|
||||
|
@ -124,6 +125,7 @@ GAMEOBJS=$(OBJ)/game.$o \
|
|||
$(JMACTOBJ)
|
||||
|
||||
EDITOROBJS=$(OBJ)/astub.$o \
|
||||
$(OBJ)/common.$o \
|
||||
$(OBJ)/m32def.$o \
|
||||
$(OBJ)/m32exec.$o \
|
||||
$(OBJ)/m32vars.$o \
|
||||
|
|
27
polymer/eduke32/build/include/common.h
Normal file
27
polymer/eduke32/build/include/common.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// Definitions of common non-engine data structures/functions
|
||||
// (and declarations of data appearing in both)
|
||||
// for EDuke32 and Mapster32
|
||||
//
|
||||
|
||||
#ifndef EDUKE32_COMMON_H_
|
||||
#define EDUKE32_COMMON_H_
|
||||
|
||||
|
||||
//// TYPES
|
||||
struct strllist
|
||||
{
|
||||
struct strllist *next;
|
||||
char *str;
|
||||
};
|
||||
|
||||
|
||||
//// EXTERN DECLS
|
||||
extern struct strllist *CommandPaths, *CommandGrps;
|
||||
|
||||
|
||||
//// FUNCTIONS
|
||||
void G_AddGroup(const char *buffer);
|
||||
void G_AddPath(const char *buffer);
|
||||
|
||||
#endif
|
|
@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "osdfuncs.h"
|
||||
#include "names.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "mapster32.h"
|
||||
#include "keys.h"
|
||||
|
||||
|
@ -120,13 +121,6 @@ static int32_t lastupdate, mousecol, mouseadd = 1, bstatus;
|
|||
static int32_t usecwd = 0;
|
||||
#endif
|
||||
|
||||
static struct strllist
|
||||
{
|
||||
struct strllist *next;
|
||||
char *str;
|
||||
}
|
||||
*CommandPaths = NULL, *CommandGrps = NULL;
|
||||
|
||||
const char *scripthist[SCRIPTHISTSIZ];
|
||||
int32_t scripthistend = 0;
|
||||
|
||||
|
@ -8384,47 +8378,6 @@ static void G_ShowParameterHelp(void)
|
|||
}
|
||||
|
||||
|
||||
// CODEDUP game.c
|
||||
static void G_AddPath(const char *buffer)
|
||||
{
|
||||
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
|
||||
s->str = Bstrdup(buffer);
|
||||
|
||||
if (CommandPaths)
|
||||
{
|
||||
struct strllist *t;
|
||||
for (t = CommandPaths; t->next; t=t->next) ;
|
||||
t->next = s;
|
||||
return;
|
||||
}
|
||||
|
||||
CommandPaths = s;
|
||||
}
|
||||
|
||||
// CODEDUP game.c
|
||||
static void G_AddGroup(const char *buffer)
|
||||
{
|
||||
char buf[BMAX_PATH];
|
||||
|
||||
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
|
||||
|
||||
Bstrcpy(buf, buffer);
|
||||
|
||||
if (Bstrchr(buf,'.') == 0)
|
||||
Bstrcat(buf,".grp");
|
||||
|
||||
s->str = Bstrdup(buf);
|
||||
|
||||
if (CommandGrps)
|
||||
{
|
||||
struct strllist *t;
|
||||
for (t = CommandGrps; t->next; t=t->next) ;
|
||||
t->next = s;
|
||||
return;
|
||||
}
|
||||
CommandGrps = s;
|
||||
}
|
||||
|
||||
#define COPYARG(i) \
|
||||
Bmemcpy(&testplay_addparam[j], argv[i], lengths[i]); \
|
||||
j += lengths[i]; \
|
||||
|
|
48
polymer/eduke32/source/common.c
Normal file
48
polymer/eduke32/source/common.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
//
|
||||
// Common non-engine code/data for EDuke32 and Mapster32
|
||||
//
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
struct strllist *CommandPaths, *CommandGrps;
|
||||
|
||||
void G_AddGroup(const char *buffer)
|
||||
{
|
||||
char buf[BMAX_PATH];
|
||||
|
||||
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
|
||||
|
||||
Bstrcpy(buf, buffer);
|
||||
|
||||
if (Bstrchr(buf,'.') == 0)
|
||||
Bstrcat(buf,".grp");
|
||||
|
||||
s->str = Bstrdup(buf);
|
||||
|
||||
if (CommandGrps)
|
||||
{
|
||||
struct strllist *t;
|
||||
for (t = CommandGrps; t->next; t=t->next) ;
|
||||
t->next = s;
|
||||
return;
|
||||
}
|
||||
CommandGrps = s;
|
||||
}
|
||||
|
||||
void G_AddPath(const char *buffer)
|
||||
{
|
||||
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
|
||||
s->str = Bstrdup(buffer);
|
||||
|
||||
if (CommandPaths)
|
||||
{
|
||||
struct strllist *t;
|
||||
for (t = CommandPaths; t->next; t=t->next) ;
|
||||
t->next = s;
|
||||
return;
|
||||
}
|
||||
CommandPaths = s;
|
||||
}
|
|
@ -51,6 +51,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "savegame.h"
|
||||
#include "anim.h"
|
||||
#include "demo.h"
|
||||
#include "common.h"
|
||||
|
||||
#ifdef LUNATIC_ENABLE
|
||||
# include "lunatic.h"
|
||||
|
@ -91,13 +92,6 @@ static char *CommandMap = NULL;
|
|||
static char *CommandName = NULL;
|
||||
int32_t g_forceWeaponChoice = 0;
|
||||
|
||||
static struct strllist
|
||||
{
|
||||
struct strllist *next;
|
||||
char *str;
|
||||
}
|
||||
*CommandPaths = NULL, *CommandGrps = NULL;
|
||||
|
||||
char boardfilename[BMAX_PATH] = {0}, currentboardfilename[BMAX_PATH] = {0};
|
||||
|
||||
static char g_rootDir[BMAX_PATH];
|
||||
|
@ -8571,47 +8565,6 @@ static int32_t loaddefinitions_game(const char *fn, int32_t preload)
|
|||
}
|
||||
|
||||
|
||||
// CODEDUP astub.c
|
||||
static void G_AddGroup(const char *buffer)
|
||||
{
|
||||
char buf[BMAX_PATH];
|
||||
|
||||
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
|
||||
|
||||
Bstrcpy(buf, buffer);
|
||||
|
||||
if (Bstrchr(buf,'.') == 0)
|
||||
Bstrcat(buf,".grp");
|
||||
|
||||
s->str = Bstrdup(buf);
|
||||
|
||||
if (CommandGrps)
|
||||
{
|
||||
struct strllist *t;
|
||||
for (t = CommandGrps; t->next; t=t->next) ;
|
||||
t->next = s;
|
||||
return;
|
||||
}
|
||||
CommandGrps = s;
|
||||
}
|
||||
|
||||
// CODEDUP astub.c
|
||||
static void G_AddPath(const char *buffer)
|
||||
{
|
||||
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
|
||||
s->str = Bstrdup(buffer);
|
||||
|
||||
if (CommandPaths)
|
||||
{
|
||||
struct strllist *t;
|
||||
for (t = CommandPaths; t->next; t=t->next) ;
|
||||
t->next = s;
|
||||
return;
|
||||
}
|
||||
CommandPaths = s;
|
||||
}
|
||||
|
||||
|
||||
static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||
{
|
||||
int16_t i = 1, j;
|
||||
|
|
Loading…
Reference in a new issue