git-svn-id: https://svn.eduke32.com/eduke32@1179 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-12-13 07:23:13 +00:00
parent 8ec01d5ea2
commit ac36ad3943
13 changed files with 1047 additions and 1087 deletions

View file

@ -63,18 +63,18 @@ extern int cachefilehandle;
extern FILE *cacheindexptr;
extern struct HASH_table cacheH;
struct cache_entry
struct cacheitem_t
{
char name[BMAX_PATH];
int offset;
int len;
struct cache_entry *next;
struct cacheitem_t *next;
};
typedef struct cache_entry texcacheindex;
typedef struct cacheitem_t texcacheindex;
extern texcacheindex firstcacheindex;
extern texcacheindex *datextures;
extern texcacheindex *curcacheindex;
extern texcacheindex *cacheptrs[MAXTILES<<2];
extern int numcacheentries;

View file

@ -207,7 +207,7 @@ void initmultiplayers(int argc, char **argv)
if (!argc)
{
initprintf("mmulti_unstable: No configuration file specified!\n");
// initprintf("mmulti_unstable: No configuration file specified!\n");
numplayers = 1; myconnectindex = 0;
connecthead = 0; connectpoint2[0] = -1;
return;

View file

@ -339,7 +339,7 @@ void drawline2d(float x0, float y0, float x1, float y1, char col)
int cachefilehandle = -1; // texture cache file handle
FILE *cacheindexptr = NULL;
struct HASH_table cacheH = { MAXTILES<<3, NULL };
struct HASH_table cacheH = { MAXTILES<<2, NULL };
char TEXCACHEFILE[BMAX_PATH] = "textures";
@ -347,7 +347,7 @@ int mdtims, omdtims;
float alphahackarray[MAXTILES];
texcacheindex firstcacheindex;
texcacheindex *datextures = NULL;
texcacheindex *curcacheindex = NULL;
texcacheindex *cacheptrs[MAXTILES<<2];
int numcacheentries = 0;
@ -708,11 +708,11 @@ void polymost_glreset()
{
texcacheindex *index;
datextures = firstcacheindex.next;
while (datextures)
curcacheindex = firstcacheindex.next;
while (curcacheindex)
{
index = datextures;
datextures = datextures->next;
index = curcacheindex;
curcacheindex = curcacheindex->next;
Bfree(index);
}
firstcacheindex.next = NULL;
@ -891,7 +891,7 @@ void polymost_glinit()
cacheindexptr = NULL;
}
datextures = &firstcacheindex;
curcacheindex = &firstcacheindex;
numcacheentries = 0;
Bmemset(&firstcacheindex, 0, sizeof(texcacheindex));
Bmemset(&cacheptrs[0], 0, sizeof(cacheptrs));
@ -912,7 +912,7 @@ void polymost_glinit()
if (!ftell(cacheindexptr))
{
rewind(cacheindexptr);
fprintf(cacheindexptr,"// automatically generated by EDuke32, DO NOT MODIFY!\n");
Bfprintf(cacheindexptr,"// automatically generated by EDuke32, DO NOT MODIFY!\n");
}
else rewind(cacheindexptr);
@ -927,14 +927,14 @@ void polymost_glinit()
i = 0;
datextures = &firstcacheindex;
while (datextures->next)
curcacheindex = &firstcacheindex;
while (curcacheindex->next)
{
i += datextures->len;
datextures = datextures->next;
i += curcacheindex->len;
curcacheindex = curcacheindex->next;
}
datextures = &firstcacheindex;
curcacheindex = &firstcacheindex;
initprintf("Cache contains %d bytes of garbage data\n",Blseek(cachefilehandle, 0, BSEEK_END)-i);
Blseek(cachefilehandle, 0, BSEEK_SET);
}
@ -955,16 +955,16 @@ void invalidatecache(void)
{
texcacheindex *index;
datextures = firstcacheindex.next;
while (datextures)
curcacheindex = firstcacheindex.next;
while (curcacheindex)
{
index = datextures;
datextures = datextures->next;
index = curcacheindex;
curcacheindex = curcacheindex->next;
Bfree(index);
}
}
datextures = &firstcacheindex;
curcacheindex = &firstcacheindex;
numcacheentries = 0;
Bmemset(&firstcacheindex, 0, sizeof(texcacheindex));
Bmemset(&cacheptrs[0], 0, sizeof(cacheptrs));
@ -981,7 +981,7 @@ void invalidatecache(void)
return;
}
fprintf(cacheindexptr,"// automatically generated by EDuke32, DO NOT MODIFY!\n");
Bfprintf(cacheindexptr,"// automatically generated by EDuke32, DO NOT MODIFY!\n");
cachefilehandle = Bopen(TEXCACHEFILE,BO_BINARY|BO_TRUNC|BO_APPEND|BO_RDWR,BS_IREAD|BS_IWRITE);
@ -1377,23 +1377,23 @@ static int LoadCacheOffsets(void)
if (scriptfile_getnumber(script, &fsize)) break; // size
i = HASH_find(&cacheH,fname);
if (i != -1)
if (i > -1)
{
// update an existing entry
texcacheindex *cacheindex = cacheptrs[i];
cacheindex->offset = foffset;
cacheindex->len = fsize;
texcacheindex *t = cacheptrs[i];
t->offset = foffset;
t->len = fsize;
// initprintf("got a match for %s offset %d\n",cachefn,offset);
}
else
{
strncpy(datextures->name, fname, BMAX_PATH);
datextures->offset = foffset;
datextures->len = fsize;
datextures->next = Bcalloc(1, sizeof(texcacheindex));
strncpy(curcacheindex->name, fname, BMAX_PATH);
curcacheindex->offset = foffset;
curcacheindex->len = fsize;
curcacheindex->next = Bcalloc(1, sizeof(texcacheindex));
HASH_replace(&cacheH, Bstrdup(fname), numcacheentries);
cacheptrs[numcacheentries++] = datextures;
datextures = datextures->next;
cacheptrs[numcacheentries++] = curcacheindex;
curcacheindex = curcacheindex->next;
}
}
@ -1441,15 +1441,16 @@ int trytexcache(char *fn, int len, int dameth, char effect, texcacheheader *head
int i;
i = HASH_find(&cacheH,cachefn);
if (i != -1)
if (i > -1)
{
texcacheindex *cacheindex = cacheptrs[i];
len = cacheindex->len;
offset = cacheindex->offset;
texcacheindex *t = cacheptrs[i];
len = t->len;
offset = t->offset;
// initprintf("got a match for %s offset %d\n",cachefn,offset);
}
if (len == 0) return -1; // didn't find it
if (i < 0) return -1; // didn't find it
if (Blseek(cachefilehandle, offset, BSEEK_SET) == -1)
{
OSD_Printf("Cache seek error: %s\n",strerror(errno));
@ -1611,39 +1612,40 @@ void writexcache(char *fn, int len, int dameth, char effect, texcacheheader *hea
{
int i = HASH_find(&cacheH,cachefn);
if (i != -1)
if (i > -1)
{
// update an existing entry
texcacheindex *cacheindex = cacheptrs[i];
cacheindex->offset = offset;
cacheindex->len = Blseek(cachefilehandle, 0, BSEEK_CUR) - cacheindex->offset;
texcacheindex *t = cacheptrs[i];
t->offset = offset;
t->len = Blseek(cachefilehandle, 0, BSEEK_CUR) - t->offset;
// initprintf("got a match for %s offset %d\n",cachefn,offset);
if (cacheindexptr)
fprintf(cacheindexptr, "%s %d %d\n", cacheindex->name, cacheindex->offset, cacheindex->len);
Bfprintf(cacheindexptr, "%s %d %d\n", t->name, t->offset, t->len);
}
else
{
Bstrcpy(datextures->name, cachefn);
datextures->offset = offset;
datextures->len = Blseek(cachefilehandle, 0, BSEEK_CUR) - datextures->offset;
datextures->next = (texcacheindex *)Bcalloc(1,sizeof(texcacheindex));
Bstrcpy(curcacheindex->name, cachefn);
curcacheindex->offset = offset;
curcacheindex->len = Blseek(cachefilehandle, 0, BSEEK_CUR) - curcacheindex->offset;
curcacheindex->next = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex));
if (cacheindexptr)
fprintf(cacheindexptr, "%s %d %d\n", datextures->name, datextures->offset, datextures->len);
Bfprintf(cacheindexptr, "%s %d %d\n", curcacheindex->name, curcacheindex->offset, curcacheindex->len);
HASH_replace(&cacheH, Bstrdup(cachefn), numcacheentries);
cacheptrs[numcacheentries++] = datextures;
datextures = datextures->next;
HASH_add(&cacheH, Bstrdup(cachefn), numcacheentries);
cacheptrs[numcacheentries++] = curcacheindex;
curcacheindex = curcacheindex->next;
}
}
goto success;
goto success;
failure:
initprintf("failure!\n");
datextures->offset = 0;
Bmemset(datextures->name,0,sizeof(datextures->name));
curcacheindex->offset = 0;
Bmemset(curcacheindex->name,0,sizeof(curcacheindex->name));
success:
// if (fil>=0) Bclose(fil);
if (midbuf) free(midbuf);

View file

@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <shellapi.h>
#endif
#define BUILDDATE " 20081210"
#define BUILDDATE " 20081211"
#define VERSION " 1.2.0devel"
static int floor_over_floor;

View file

@ -193,8 +193,8 @@ extern inline int gametext_z(int small, int starttile, int x,int y,const char *t
extern void G_DrawTXDigiNumZ(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2, int z);
extern void G_DrawTileSmall(int x,int y,int tilenum,int shade,int orientation);
extern void G_DrawTilePalSmall(int x,int y,int tilenum,int shade,int orientation,int p);
extern void Gv_ResetVarsToDefault(void);
extern void A_ResetGameVars(int iActor);
extern void Gv_ResetVars(void);
extern void A_ResetVars(int iActor);
extern int minitext_(int x,int y,const char *t,int s,int p,int sb);
@ -225,8 +225,8 @@ extern int Gv_GetVar(int id, int iActor, int iPlayer);
extern void Gv_SetVar(int id, int lValue, int iActor, int iPlayer);
// extern void SetGameArrayID(int id,int index, int lValue);
extern int Gv_SetupVar(const char *pszLabel, int lValue, unsigned int dwFlags);
extern int Gv_AddArray(const char *pszLabel, int asize);
extern int Gv_NewVar(const char *pszLabel, int lValue, unsigned int dwFlags);
extern int Gv_NewArray(const char *pszLabel, int asize);
extern void C_ReportError(int iError);
extern void onvideomodechange(int newmode);

View file

@ -2172,7 +2172,7 @@ static void G_DrawStatusBar(int snum)
if (p->inven_icon)
rotatesprite(sbarx(69),sbary(200-30),sbarsc(65536L),0,INVENTORYBOX,0,21,10+16,0,0,xdim-1,ydim-1);
if (sprite[p->i].pal == 1 && p->last_extra < 2)
if (sprite[p->i].pal == 1 && p->last_extra < 2) // frozen
G_DrawDigiNum(20,200-17,1,-16,10+16);
else G_DrawDigiNum(20,200-17,p->last_extra,-16,10+16);
@ -2557,7 +2557,7 @@ static void G_DrawStatusBar(int snum)
#define COLOR_WHITE 31
#define LOW_FPS 30
static void G_PrintFrameRate(void)
static void G_PrintFPS(void)
{
// adapted from ZDoom because I like it better than what we had
// applicable ZDoom code available under GPL from csDoom
@ -2577,7 +2577,7 @@ static void G_PrintFrameRate(void)
printext256(windowx2-(chars<<(3-x))+1,windowy1+2,0,-1,tempbuf,x);
printext256(windowx2-(chars<<(3-x)),windowy1+1,
(LastCount < LOW_FPS) ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x);
(LastCount < LOW_FPS) ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x);
// lag meter
if (numplayers > 1 && (totalclock - lastpackettime) > 1)
@ -3873,7 +3873,7 @@ void G_DisplayRest(int smoothratio)
}
#endif
G_PrintFrameRate();
G_PrintFPS();
// JBF 20040124: display level stats in screen corner
if ((ud.overhead_on != 2 && ud.levelstats) && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
@ -4740,7 +4740,7 @@ int A_InsertSprite(int whatsect,int s_x,int s_y,int s_z,int s_pn,int s_s,int s_x
changespritestat(i,5);
}
*/
A_ResetGameVars(i);
A_ResetVars(i);
ActorExtra[i].flags = 0;
if (apScriptGameEvent[EVENT_EGS])
@ -9032,17 +9032,25 @@ static int getfilenames(const char *path, char kind[])
return(0);
}
static void DoAutoload(const char *fn)
static char *autoloadmasks[] = { "*.grp", "*.zip", "*.pk3" };
#define NUMAUTOLOADMASKS 3
static void G_DoAutoload(const char *fn)
{
Bsprintf(tempbuf,"autoload/%s",fn);
getfilenames(tempbuf,"*.grp");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",fn,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
Bsprintf(tempbuf,"autoload/%s",fn);
getfilenames(tempbuf,"*.zip");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",fn,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
Bsprintf(tempbuf,"autoload/%s",fn);
getfilenames(tempbuf,"*.pk3");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",fn,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
int i;
for (i=0;i<NUMAUTOLOADMASKS;i++)
{
Bsprintf(tempbuf,"autoload/%s",fn);
getfilenames(tempbuf,autoloadmasks[i]);
while (findfiles)
{
Bsprintf(tempbuf,"autoload/%s/%s",fn,findfiles->name);
initprintf("Using group file '%s'.\n",tempbuf);
initgroupfile(tempbuf);
findfiles = findfiles->next;
}
}
}
static char *makename(char *destname, char *OGGname, char *origname)
@ -9052,7 +9060,7 @@ static char *makename(char *destname, char *OGGname, char *origname)
if (destname)
Bfree(destname);
destname=Bcalloc(Bstrlen(OGGname)+Bstrlen(origname)+1,sizeof(char));
destname = Bcalloc(Bstrlen(OGGname) + Bstrlen(origname) + 1, sizeof(char));
if (!destname)
return NULL;
@ -9164,7 +9172,7 @@ static int parsedefinitions_game(scriptfile *script, const int preload)
{
initprintf("Using group file '%s'.\n",fn);
if (!g_noAutoLoad)
DoAutoload(fn);
G_DoAutoload(fn);
}
}
@ -9892,7 +9900,7 @@ static void G_CheckCommandLine(int argc, const char **argv)
CommandMap = (char *)argv[i++];
continue;
}
if (!Bstrcasecmp(k,".grp") || !Bstrcasecmp(k,".zip"))
if (!Bstrcasecmp(k,".grp") || !Bstrcasecmp(k,".zip") || !Bstrcasecmp(k,".pk3"))
{
G_AddGroup(argv[i++]);
continue;
@ -10104,73 +10112,54 @@ static void loadtmb(void)
}
void freehash();
static void CON_FreeMem(void)
static void G_FreeCONMem(void)
{
int i;
extern char *bitptr;
for (i=(MAXLEVELS*(MAXVOLUMES+1))-1;i>=0;i--) // +1 volume for "intro", "briefing" music
{
if (MapInfo[i].name != NULL)
Bfree(MapInfo[i].name);
if (MapInfo[i].filename != NULL)
Bfree(MapInfo[i].filename);
if (MapInfo[i].musicfn != NULL)
Bfree(MapInfo[i].musicfn);
if (MapInfo[i].musicfn1 != NULL)
Bfree(MapInfo[i].musicfn1);
if (MapInfo[i].savedstate != NULL)
G_FreeMapState(i);
if (MapInfo[i].name != NULL) Bfree(MapInfo[i].name);
if (MapInfo[i].filename != NULL) Bfree(MapInfo[i].filename);
if (MapInfo[i].musicfn != NULL) Bfree(MapInfo[i].musicfn);
if (MapInfo[i].musicfn1 != NULL) Bfree(MapInfo[i].musicfn1);
if (MapInfo[i].savedstate != NULL) G_FreeMapState(i);
}
for (i=MAXQUOTES-1;i>=0;i--)
{
if (ScriptQuotes[i] != NULL)
Bfree(ScriptQuotes[i]);
if (ScriptQuoteRedefinitions[i] != NULL)
Bfree(ScriptQuoteRedefinitions[i]);
if (ScriptQuotes[i] != NULL) Bfree(ScriptQuotes[i]);
if (ScriptQuoteRedefinitions[i] != NULL) Bfree(ScriptQuoteRedefinitions[i]);
}
for (i=g_gameVarCount-1;i>=0;i--)
{
if (aGameVars[i].szLabel != NULL)
Bfree(aGameVars[i].szLabel);
if (aGameVars[i].plValues != NULL)
Bfree(aGameVars[i].plValues);
if (aGameVars[i].szLabel != NULL) Bfree(aGameVars[i].szLabel);
if (aGameVars[i].plValues != NULL) Bfree(aGameVars[i].plValues);
}
for (i=g_gameArrayCount-1;i>=0;i--)
{
if (aGameArrays[i].szLabel != NULL)
Bfree(aGameArrays[i].szLabel);
if (aGameArrays[i].plValues != NULL)
Bfree(aGameArrays[i].plValues);
if (aGameArrays[i].szLabel != NULL) Bfree(aGameArrays[i].szLabel);
if (aGameArrays[i].plValues != NULL) Bfree(aGameArrays[i].plValues);
}
for (i=MAXPLAYERS-1;i>=0;i--)
{
if (g_player[i].ps != NULL)
Bfree(g_player[i].ps);
if (g_player[i].sync != NULL)
Bfree(g_player[i].sync);
if (g_player[i].ps != NULL) Bfree(g_player[i].ps);
if (g_player[i].sync != NULL) Bfree(g_player[i].sync);
}
for (i=MAXSOUNDS-1;i>=0;i--)
{
if (g_sounds[i].filename != NULL)
Bfree(g_sounds[i].filename);
if (g_sounds[i].filename1 != NULL)
Bfree(g_sounds[i].filename1);
if (g_sounds[i].filename != NULL) Bfree(g_sounds[i].filename);
if (g_sounds[i].filename1 != NULL) Bfree(g_sounds[i].filename1);
}
if (label != NULL)
Bfree(label);
if (labelcode != NULL)
Bfree(labelcode);
if (script != NULL)
Bfree(script);
if (bitptr != NULL)
Bfree(bitptr);
if (label != NULL) Bfree(label);
if (labelcode != NULL) Bfree(labelcode);
if (script != NULL) Bfree(script);
if (bitptr != NULL) Bfree(bitptr);
freehash();
HASH_free(&gamefuncH);
@ -10192,7 +10181,7 @@ void G_Shutdown(void)
CONTROL_Shutdown();
CONFIG_WriteSetup();
KB_Shutdown();
CON_FreeMem();
G_FreeCONMem();
uninitengine();
}
@ -10340,7 +10329,7 @@ static void G_Startup(void)
{
wm_msgbox("Build Engine Initialization Error",
"There was a problem initializing the Build engine: %s", engineerrstr);
CON_FreeMem();
G_FreeCONMem();
exit(1);
}
@ -10412,7 +10401,6 @@ static void G_Startup(void)
g_player[i].playerreadyflag = 0;
#ifndef RANCID_NETWORKING
// enet regression
if (CommandNet)
{
setup_rancid_net(CommandNet);
@ -10721,19 +10709,6 @@ void G_UpdatePlayerFromMenu(void)
}
}
#if 0
void writestring(int a1,int a2,int a3,short a4,int vx,int vy,int vz)
{
FILE *fp;
fp = (FILE *)fopen("debug.txt","rt+");
fprintf(fp,"%d %d %d %d %d %d %d\n",a1,a2,a3,a4,vx,vy,vz);
fclose(fp);
}
#endif
#if 0
char testcd(char *fn, int testsiz);
@ -11043,21 +11018,21 @@ void app_main(int argc,const char **argv)
FreeGroups();
if (WW2GI)
if (WW2GI || NAM)
{
// overwrite the default GRP and CON so that if the user chooses
// something different, they get what they asked for
Bsprintf(defaultduke3dgrp,"ww2gi.grp");
Bsprintf(defaultconfilename, "ww2gi.con");
Bsprintf(GametypeNames[0],"GRUNTMATCH (SPAWN)");
Bsprintf(GametypeNames[2],"GRUNTMATCH (NO SPAWN)");
}
else if (NAM)
{
// overwrite the default GRP and CON so that if the user chooses
// something different, they get what they asked for
Bsprintf(defaultduke3dgrp,"nam.grp");
Bsprintf(defaultconfilename, "nam.con");
if (WW2GI)
{
Bsprintf(defaultduke3dgrp,"ww2gi.grp");
Bsprintf(defaultconfilename, "ww2gi.con");
}
else
{
Bsprintf(defaultduke3dgrp,"nam.grp");
Bsprintf(defaultconfilename, "nam.con");
}
Bsprintf(GametypeNames[0],"GRUNTMATCH (SPAWN)");
Bsprintf(GametypeNames[2],"GRUNTMATCH (NO SPAWN)");
}
@ -11076,34 +11051,46 @@ void app_main(int argc,const char **argv)
i = initgroupfile(duke3dgrp);
if (i == -1)
initprintf("Warning: could not find group file '%s'.\n",duke3dgrp);
initprintf("Warning: could not find group file '%s'!\n",duke3dgrp);
else
initprintf("Using group file '%s' as main group file.\n", duke3dgrp);
if (!g_noAutoLoad)
{
getfilenames("autoload","*.grp");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
getfilenames("autoload","*.zip");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
getfilenames("autoload","*.pk3");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
int ii;
for (ii=0;ii<NUMAUTOLOADMASKS;ii++)
{
getfilenames("autoload",autoloadmasks[ii]);
while (findfiles)
{
Bsprintf(tempbuf,"autoload/%s",findfiles->name);
initprintf("Using group file '%s'.\n",tempbuf);
initgroupfile(tempbuf);
findfiles = findfiles->next;
}
}
if (i != -1)
DoAutoload(duke3dgrp);
G_DoAutoload(duke3dgrp);
}
if (mod_dir[0] != '/')
{
Bsprintf(tempbuf,"%s/",mod_dir);
getfilenames(tempbuf,"*.grp");
while (findfiles) { Bsprintf(tempbuf,"%s/%s",mod_dir,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
Bsprintf(tempbuf,"%s/",mod_dir);
getfilenames(tempbuf,"*.zip");
while (findfiles) { Bsprintf(tempbuf,"%s/%s",mod_dir,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
Bsprintf(tempbuf,"%s/",mod_dir);
getfilenames(tempbuf,"*.pk3");
while (findfiles) { Bsprintf(tempbuf,"%s/%s",mod_dir,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
int ii;
for (ii=0;ii<NUMAUTOLOADMASKS;ii++)
{
Bsprintf(tempbuf,"%s/",mod_dir);
getfilenames(tempbuf,autoloadmasks[ii]);
while (findfiles)
{
Bsprintf(tempbuf,"%s/%s",mod_dir,findfiles->name);
initprintf("Using group file '%s'.\n",tempbuf);
initgroupfile(tempbuf);
findfiles = findfiles->next;
}
}
}
loaddefinitions_game(duke3ddef, TRUE);
@ -11122,7 +11109,7 @@ void app_main(int argc,const char **argv)
g_groupFileHandle = j;
initprintf("Using group file '%s'.\n",CommandGrps->str);
if (!g_noAutoLoad)
DoAutoload(CommandGrps->str);
G_DoAutoload(CommandGrps->str);
}
free(CommandGrps->str);

View file

@ -2084,7 +2084,7 @@ static int C_ParseCommand(void)
*(g_scriptPtr-1)^=GAMEVAR_PERPLAYER;
C_ReportError(WARNING_BADGAMEVAR);
}
Gv_SetupVar(label+(g_numLabels<<6),*(g_scriptPtr-2),
Gv_NewVar(label+(g_numLabels<<6),*(g_scriptPtr-2),
(*(g_scriptPtr-1))
// can't define default or secret
& (~(GAMEVAR_DEFAULT | GAMEVAR_SECRET))
@ -2123,7 +2123,7 @@ static int C_ParseCommand(void)
}
C_GetNextValue(LABEL_DEFINE);
Gv_AddArray(label+(g_numLabels<<6),*(g_scriptPtr-1));
Gv_NewArray(label+(g_numLabels<<6),*(g_scriptPtr-1));
g_scriptPtr -= 2; // no need to save in script...
return 0;

View file

@ -88,9 +88,7 @@ void X_OnEvent(int iEventID, int iActor, int iPlayer, int lDist)
g_sp = &sprite[g_i];
g_t = &ActorExtra[g_i].temp_data[0];
insptr = (apScriptGameEvent[iEventID]);
//Bsprintf(g_szBuf,"Executing event for %d at %lX",iEventID, insptr);
//AddLog(g_szBuf);
insptr = apScriptGameEvent[iEventID];
g_killitFlag = 0;
@ -757,7 +755,7 @@ static int X_DoExecute(void)
case CON_IFCANSEE:
{
spritetype *s;
spritetype *s = &sprite[g_player[g_p].ps->i];
// select sprite for monster to target
// if holoduke is on, let them target holoduke first.
@ -775,7 +773,6 @@ static int X_DoExecute(void)
s = &sprite[g_player[g_p].ps->i];
}
}
else s = &sprite[g_player[g_p].ps->i]; // holoduke not on. look for player
// can they see player, (or player's holoduke)
j = cansee(g_sp->x,g_sp->y,g_sp->z-(krand()&((47<<8))),g_sp->sectnum,
@ -789,10 +786,10 @@ static int X_DoExecute(void)
// (the result is always j==0....)
// if ((klabs(ActorExtra[g_i].lastvx-g_sp->x)+klabs(ActorExtra[g_i].lastvy-g_sp->y)) <
// (klabs(ActorExtra[g_i].lastvx-s->x)+klabs(ActorExtra[g_i].lastvy-s->y)))
// j = 0;
// j = 0;
// um yeah, this if() will always fire....
// if (j == 0)
// if (j == 0)
{
// search around for target player
@ -841,16 +838,15 @@ static int X_DoExecute(void)
if (g_t[5]) g_t[1] = *(((intptr_t *)g_t[5])+1); // move
g_sp->hitag = *(((intptr_t *)g_t[5])+2); // move flags
g_t[0] = g_t[2] = g_t[3] = 0; // count, actioncount... g_t[3] = ???
if (A_CheckEnemySprite(g_sp) && g_sp->extra <= 0) // hack
break;
// if (A_CheckEnemySprite(g_sp) && g_sp->extra <= 0) // hack
// break;
if (g_sp->hitag&random_angle)
g_sp->ang = krand()&2047;
break;
case CON_ACTION:
insptr++;
g_t[2] = 0;
g_t[3] = 0;
g_t[2] = g_t[3] = 0;
g_t[4] = *insptr++;
break;
@ -974,19 +970,18 @@ static int X_DoExecute(void)
case CON_SHOOT:
insptr++;
A_Shoot(g_i,(short)*insptr++);
A_Shoot(g_i,*insptr++);
break;
case CON_SOUNDONCE:
insptr++;
if ((*insptr<0 || *insptr>=MAXSOUNDS) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr);
insptr++;break;
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr++);
break;
}
if (!A_CheckSoundPlaying(g_i,*insptr))
A_PlaySound((short) *insptr,g_i);
insptr++;
if (!A_CheckSoundPlaying(g_i,*insptr++))
A_PlaySound(*(insptr-1),g_i);
break;
case CON_IFSOUND:
@ -1050,7 +1045,7 @@ static int X_DoExecute(void)
else if (G_CheckForSpaceFloor(g_sp->sectnum))
j = 0;
if (!ActorExtra[g_i].cgg-- || (sector[g_sp->sectnum].floorstat&2))
if (--ActorExtra[g_i].cgg == 0 || (sector[g_sp->sectnum].floorstat&2))
{
A_GetZLimits(g_i);
ActorExtra[g_i].cgg = 3;
@ -1058,9 +1053,7 @@ static int X_DoExecute(void)
if (g_sp->z < (ActorExtra[g_i].floorz-FOURSLEIGHT))
{
g_sp->z += g_sp->zvel += j;
if (g_sp->zvel > 6144) g_sp->zvel = 6144;
g_sp->z += g_sp->zvel = min(6144, g_sp->zvel+j);
if (g_sp->z > (ActorExtra[g_i].floorz - FOURSLEIGHT))
g_sp->z = (ActorExtra[g_i].floorz - FOURSLEIGHT);
@ -1440,70 +1433,90 @@ static int X_DoExecute(void)
break;
}
case CON_HEADSPRITESTAT:
case CON_PREVSPRITESTAT:
case CON_NEXTSPRITESTAT:
case CON_HEADSPRITESECT:
case CON_PREVSPRITESECT:
case CON_NEXTSPRITESECT:
insptr++;
{
int i=*insptr++;
j=Gv_GetVar(*insptr++, g_i, g_p);
switch (tw)
{
case CON_HEADSPRITESTAT:
if ((j < 0 || j > MAXSTATUS) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid status list %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,headspritestat[j],g_i,g_p);
break;
case CON_PREVSPRITESTAT:
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,prevspritestat[j],g_i,g_p);
break;
case CON_NEXTSPRITESTAT:
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,nextspritestat[j],g_i,g_p);
break;
case CON_HEADSPRITESECT:
if ((j < 0 || j > numsectors) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid sector %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,headspritesect[j],g_i,g_p);
break;
case CON_PREVSPRITESECT:
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,prevspritesect[j],g_i,g_p);
break;
case CON_NEXTSPRITESECT:
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,nextspritesect[j],g_i,g_p);
break;
}
break;
}
case CON_HEADSPRITESTAT:
insptr++;
{
int i=*insptr++;
j=Gv_GetVar(*insptr++, g_i, g_p);
if ((j < 0 || j > MAXSTATUS) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid status list %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,headspritestat[j],g_i,g_p);
break;
}
case CON_PREVSPRITESTAT:
insptr++;
{
int i=*insptr++;
j=Gv_GetVar(*insptr++, g_i, g_p);
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,prevspritestat[j],g_i,g_p);
break;
}
case CON_NEXTSPRITESTAT:
insptr++;
{
int i=*insptr++;
j=Gv_GetVar(*insptr++, g_i, g_p);
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,nextspritestat[j],g_i,g_p);
break;
}
case CON_HEADSPRITESECT:
insptr++;
{
int i=*insptr++;
j=Gv_GetVar(*insptr++, g_i, g_p);
if ((j < 0 || j > numsectors) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid sector %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,headspritesect[j],g_i,g_p);
break;
}
case CON_PREVSPRITESECT:
insptr++;
{
int i=*insptr++;
j=Gv_GetVar(*insptr++, g_i, g_p);
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,prevspritesect[j],g_i,g_p);
break;
}
case CON_NEXTSPRITESECT:
insptr++;
{
int i=*insptr++;
j=Gv_GetVar(*insptr++, g_i, g_p);
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
break;
}
Gv_SetVar(i,nextspritesect[j],g_i,g_p);
break;
}
case CON_GETKEYNAME:
insptr++;
{
@ -3421,13 +3434,16 @@ static int X_DoExecute(void)
// syntax [gs]etactor[<var>].x <VAR>
// <varid> <xxxid> <varid>
int lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0, lVar2;
int lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0;
if (ActorLabels[lLabelID].flags & LABEL_HASPARM2)
lParm2=Gv_GetVar(*insptr++, g_i, g_p);
lVar2=*insptr++;
X_AccessSprite(tw==CON_SETACTOR, lVar1, lLabelID, lVar2, lParm2);
{
int lVar2=*insptr++;
X_AccessSprite(tw==CON_SETACTOR, lVar1, lLabelID, lVar2, lParm2);
}
break;
}
@ -3548,13 +3564,13 @@ static int X_DoExecute(void)
case CON_RANDVAR:
insptr++;
Gv_SetVar(*insptr, mulscale(krand(), *(insptr+1)+1, 16), g_i, g_p);
Gv_SetVar(*insptr, mulscale16(krand(), *(insptr+1)+1), g_i, g_p);
insptr += 2;
break;
case CON_DISPLAYRANDVAR:
insptr++;
Gv_SetVar(*insptr, mulscale(rand(), *(insptr+1)+1, 15), g_i, g_p);
Gv_SetVar(*insptr, mulscale15(rand(), *(insptr+1)+1), g_i, g_p);
insptr += 2;
break;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//-------------------------------------------------------------------------
#include "duke3d.h"
const char *s_buildDate = "20081210";
const char *s_buildDate = "20081211";
char *MusicPtr = NULL;
int g_musicSize;

View file

@ -341,7 +341,6 @@ int A_Shoot(int i,int atwith)
if (ProjectileData[atwith].offset == 0) ProjectileData[atwith].offset = 1;
// writestring(sx,sy,sz,sect,sintable[(sa+512)&2047],sintable[sa&2047],zvel<<6);
if (ProjectileData[atwith].workslike & PROJECTILE_BLOOD || ProjectileData[atwith].workslike & PROJECTILE_KNEE)
{
@ -1013,7 +1012,6 @@ DOSKIPBULLETHOLE:
}
}
// writestring(sx,sy,sz,sect,sintable[(sa+512)&2047],sintable[sa&2047],zvel<<6);
if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9];
hitscan(sx,sy,sz,sect,
sintable[(sa+512)&2047],

View file

@ -371,8 +371,8 @@ static void G_DoLoadScreen(char *statustext, int percent)
if (statustext) gametext(160,180,statustext,0,2+8+16);
j = usehightile;
usehightile = 0;
rotatesprite(33<<16,140<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(xdim-1,percent,100),ydim-1);
rotatesprite(153<<16,140<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(xdim-1,percent,100),ydim-1);
rotatesprite(33<<16,144<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(xdim-1,percent,100),ydim-1);
rotatesprite(153<<16,144<<16,65536,0,LASERLINE,0,0,2+8+16,0,0,scale(xdim-1,percent,100),ydim-1);
usehightile = j;
X_OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1);
nextpage();
@ -505,7 +505,7 @@ void G_CacheMapData(void)
}
if (totalclock - tc > TICRATE/4)
{
sprintf(tempbuf,"%d resources remaining\n",g_precacheCount-pc);
sprintf(tempbuf,"%d resources remaining\n",g_precacheCount-pc+1);
G_DoLoadScreen(tempbuf, min(100,100*pc/g_precacheCount));
tc = totalclock;
}
@ -930,7 +930,7 @@ static void prelevel(char g)
while (i >= 0)
{
nexti = nextspritestat[i];
A_ResetGameVars(i);
A_ResetVars(i);
A_LoadActor(i);
X_OnEvent(EVENT_LOADACTOR, i, -1, -1);
if (sprite[i].lotag == -1 && (sprite[i].cstat&16))
@ -1253,7 +1253,7 @@ void G_NewGame(int vn,int ln,int sk)
p->gm = 0;
//AddLog("Newgame");
Gv_ResetVarsToDefault();
Gv_ResetVars();
Gv_InitWeaponPointers();