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

This commit is contained in:
terminx 2008-08-25 10:27:18 +00:00
parent 7ff5a532c6
commit 127bc3fe91
7 changed files with 79 additions and 33 deletions

View file

@ -1,6 +1,6 @@
 
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2005 # Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eduke32", "eduke32.vcproj", "{8E7A6179-0B72-4073-8A4C-E8682D481DAE}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eduke32", "eduke32.vcproj", "{8E7A6179-0B72-4073-8A4C-E8682D481DAE}"
EndProject EndProject
Global Global

View file

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8.00" Version="9.00"
Name="eduke32" Name="eduke32"
ProjectGUID="{8E7A6179-0B72-4073-8A4C-E8682D481DAE}" ProjectGUID="{8E7A6179-0B72-4073-8A4C-E8682D481DAE}"
RootNamespace="eduke32" RootNamespace="eduke32"
Keyword="MakeFileProj" Keyword="MakeFileProj"
TargetFrameworkVersion="131072"
> >
<Platforms> <Platforms>
<Platform <Platform

View file

@ -241,10 +241,10 @@ void ExtLoadMap(const char *mapname)
} }
*/ */
// Presize Sprites // Presize Sprites
for (j=0;j<MAXSPRITES;j++) for (j=numsprites;j>=0;j--)
{ {
if (tilesizx[sprite[j].picnum]==0 || tilesizy[sprite[j].picnum]==0) /* if (tilesizx[sprite[j].picnum]==0 || tilesizy[sprite[j].picnum]==0)
sprite[j].picnum=0; sprite[j].picnum=0; */
if (sprite[j].picnum>=20 && sprite[j].picnum<=59) if (sprite[j].picnum>=20 && sprite[j].picnum<=59)
{ {

View file

@ -404,7 +404,7 @@ void CONFIG_MapKey(int32 which, kb_scancode key1, kb_scancode oldkey1, kb_scanco
boundkeys[ii[k]].cmd[0] = 0; boundkeys[ii[k]].cmd[0] = 0;
tempbuf[0] = 0; tempbuf[0] = 0;
for (i=0;i<NUMGAMEFUNCTIONS;i++) for (i=NUMGAMEFUNCTIONS-1;i>=0;i--)
{ {
if (ud.config.KeyboardKeys[i][0] == ii[k] || ud.config.KeyboardKeys[i][1] == ii[k]) if (ud.config.KeyboardKeys[i][0] == ii[k] || ud.config.KeyboardKeys[i][1] == ii[k])
{ {
@ -594,6 +594,7 @@ int32 CONFIG_ReadSetup(void)
int32 dummy, i = 0; int32 dummy, i = 0;
char commmacro[] = "CommbatMacro# "; char commmacro[] = "CommbatMacro# ";
extern int32 CommandWeaponChoice; extern int32 CommandWeaponChoice;
char tempbuf[1024];
CONTROL_ClearAssignments(); CONTROL_ClearAssignments();
CONFIG_SetDefaults(); CONFIG_SetDefaults();
@ -863,6 +864,7 @@ void CONFIG_WriteBinds(void) // save binds and aliases to disk
int i; int i;
FILE *fp; FILE *fp;
char *ptr = Bstrdup(setupfilename); char *ptr = Bstrdup(setupfilename);
char tempbuf[128];
Bsprintf(tempbuf,"%s_binds.cfg",strtok(ptr,".")); Bsprintf(tempbuf,"%s_binds.cfg",strtok(ptr,"."));
fp = fopen(tempbuf, "wt"); fp = fopen(tempbuf, "wt");
@ -901,6 +903,7 @@ void CONFIG_WriteBinds(void) // save binds and aliases to disk
void CONFIG_WriteSetup(void) void CONFIG_WriteSetup(void)
{ {
int32 dummy; int32 dummy;
char tempbuf[1024];
if (!ud.config.setupread) return; if (!ud.config.setupread) return;

View file

@ -790,6 +790,7 @@ enum events {
EVENT_DISPLAYMENUREST, EVENT_DISPLAYMENUREST,
EVENT_DISPLAYLOADINGSCREEN, EVENT_DISPLAYLOADINGSCREEN,
EVENT_ANIMATESPRITES, EVENT_ANIMATESPRITES,
MAXEVENTS
}; };
enum sysstrs { enum sysstrs {

View file

@ -4643,10 +4643,10 @@ int EGS(int whatsect,int s_x,int s_y,int s_z,int s_pn,int s_s,int s_xr,int s_yr,
ResetActorGameVars(i); ResetActorGameVars(i);
hittype[i].flags = 0; hittype[i].flags = 0;
if (apScriptGameEvent[EVENT_EGS])
{ {
int pl=findplayer(&sprite[i],&p); int pl=findplayer(&sprite[i],&p);
if (apScriptGameEvent[EVENT_EGS]) OnEvent(EVENT_EGS,i, pl, p);
OnEvent(EVENT_EGS,i, pl, p);
} }
return(i); return(i);
@ -6363,8 +6363,16 @@ int spawn(int j, int pn)
} }
if (j == -1) if (j == -1)
{ {
Bsprintf(tempbuf,"Found lonely Sector Effector (lotag 0) at (%d,%d)\n",sp->x,sp->y); // Bsprintf(tempbuf,"Found lonely Sector Effector (lotag 0) at (%d,%d)\n",sp->x,sp->y);
gameexit(tempbuf); // gameexit(tempbuf);
OSD_Printf(OSD_ERROR "Found lonely Sector Effector (lotag 0) at (%d,%d)\n",sp->x,sp->y);
changespritestat(i,1);
if (apScriptGameEvent[EVENT_SPAWN])
{
int pl=findplayer(&sprite[i],&p);
OnEvent(EVENT_SPAWN,i, pl, p);
}
return i;
} }
sp->owner = j; sp->owner = j;
} }
@ -6576,10 +6584,10 @@ int spawn(int j, int pn)
break; break;
} }
if (apScriptGameEvent[EVENT_SPAWN])
{ {
int pl=findplayer(&sprite[i],&p); int pl=findplayer(&sprite[i],&p);
if (apScriptGameEvent[EVENT_SPAWN]) OnEvent(EVENT_SPAWN,i, pl, p);
OnEvent(EVENT_SPAWN,i, pl, p);
} }
return i; return i;
@ -7437,7 +7445,7 @@ PALONLY:
if (j < 0) return; if (j < 0) return;
if (display_mirror) tsprite[j].statnum = TSPR_MIRROR; if (display_mirror) tsprite[j].statnum = TSPR_MIRROR;
if (spriteext[tsprite[j].owner].flags & SPREXT_TSPRACCESS && tsprite[j].owner < MAXSPRITES && tsprite[j].owner > 0) if (tsprite[j].owner > 0 && tsprite[j].owner < MAXSPRITES && spriteext[tsprite[j].owner].flags & SPREXT_TSPRACCESS)
{ {
OnEvent(EVENT_ANIMATESPRITES,tsprite[j].owner, myconnectindex, -1); OnEvent(EVENT_ANIMATESPRITES,tsprite[j].owner, myconnectindex, -1);
spriteext[tsprite[j].owner].tspr = NULL; spriteext[tsprite[j].owner].tspr = NULL;

View file

@ -1072,8 +1072,14 @@ static int increasescriptsize(int size)
} }
//initprintf("offset: %d\n",(unsigned)(scriptptr-script)); //initprintf("offset: %d\n",(unsigned)(scriptptr-script));
g_ScriptSize = size; if (size <= g_ScriptSize)
initprintf("Increasing script buffer size to %d bytes...\n",g_ScriptSize * sizeof(intptr_t)); initprintf("Shrinking bytecode buffer, final size: %d*%d bytes\n",g_ScriptSize, sizeof(intptr_t));
else
{
g_ScriptSize = size;
initprintf("Increasing bytecode buffer to %d*%d bytes...\n",g_ScriptSize, sizeof(intptr_t));
}
newscript = (intptr_t *)Brealloc(script, g_ScriptSize * sizeof(intptr_t)); newscript = (intptr_t *)Brealloc(script, g_ScriptSize * sizeof(intptr_t));
if (newscript == NULL) if (newscript == NULL)
@ -1084,11 +1090,17 @@ static int increasescriptsize(int size)
error++; error++;
return 1; return 1;
} }
Bmemset(&newscript[osize],0,(size-osize) * sizeof(intptr_t));
bitptr = (char *)Brealloc(bitptr, g_ScriptSize * sizeof(char));
if (size > osize)
{
Bmemset(&newscript[osize],0,(size-osize) * sizeof(intptr_t));
Bmemset(&bitptr[osize],0,size-osize);
}
script = newscript; script = newscript;
scriptptr = (intptr_t *)(script+oscriptptr); scriptptr = (intptr_t *)(script+oscriptptr);
bitptr = (char *)Brealloc(bitptr, g_ScriptSize * sizeof(char));
Bmemset(&bitptr[osize],0,size-osize);
// initprintf("script: %d, bitptr: %d\n",script,bitptr); // initprintf("script: %d, bitptr: %d\n",script,bitptr);
//initprintf("offset: %d\n",(unsigned)(scriptptr-script)); //initprintf("offset: %d\n",(unsigned)(scriptptr-script));
@ -1107,12 +1119,24 @@ static int increasescriptsize(int size)
} }
} }
for (i=g_ScriptSize-(size-osize)-1;i>=0;i--) if (size > osize)
if (scriptptrs[i]) {
{ for (i=g_ScriptSize-(size-osize)-1;i>=0;i--)
j = (intptr_t)script[i]+(intptr_t)&script[0]; if (scriptptrs[i])
script[i] = j; {
} j = (intptr_t)script[i]+(intptr_t)&script[0];
script[i] = j;
}
}
else
{
for (i=g_ScriptSize-1;i>=0;i--)
if (scriptptrs[i])
{
j = (intptr_t)script[i]+(intptr_t)&script[0];
script[i] = j;
}
}
for (i=MAXTILES-1;i>=0;i--) for (i=MAXTILES-1;i>=0;i--)
{ {
@ -1187,7 +1211,7 @@ static int skipcomments(void)
} }
if ((unsigned)(scriptptr-script) > (unsigned)(g_ScriptSize-32)) if ((unsigned)(scriptptr-script) > (unsigned)(g_ScriptSize-32))
return increasescriptsize(g_ScriptSize+16384); return increasescriptsize(g_ScriptSize<<1);
return 0; return 0;
} }
@ -5618,20 +5642,29 @@ void loadefs(const char *filenam)
int j=0, k=0; int j=0, k=0;
total_lines += line_number; total_lines += line_number;
while ((g_ScriptSize-1024) > (scriptptr-script))
g_ScriptSize -= 1024;
increasescriptsize(g_ScriptSize);
initprintf("Compiled code size: %ld*%d bytes, version %s\n",(unsigned)(scriptptr-script),sizeof(intptr_t),(g_ScriptVersion == 14?"1.4+":"1.3D"));
initprintf("%ld/%ld labels, %d/%d variables\n",labelcnt,min((MAXSECTORS * sizeof(sectortype)/sizeof(int)),(MAXSPRITES * sizeof(spritetype)/(1<<6))),iGameVarCount,MAXGAMEVARS);
for (i=MAXQUOTES-1;i>=0;i--)
if (fta_quotes[i])
j++;
initprintf("%ld/%d quotes, %d quote redefinitions\n",j,MAXQUOTES,redefined_quote_count);
j = 0;
for (i=MAXGAMEEVENTS-1;i>=0;i--) for (i=MAXGAMEEVENTS-1;i>=0;i--)
{
if (apScriptGameEvent[i]) if (apScriptGameEvent[i])
j++; j++;
}
for (i=MAXTILES-1;i>=0;i--) for (i=MAXTILES-1;i>=0;i--)
{
if (actorscrptr[i]) if (actorscrptr[i])
k++; k++;
}
initprintf("Compiled code size: %ld bytes, version %s\n",(unsigned)(scriptptr-script) * sizeof(intptr_t),(g_ScriptVersion == 14?"1.4+":"1.3D")); initprintf("%ld/%d event definitions, %ld defined actors\n",j,MAXEVENTS,k);
initprintf("%ld/%ld labels, %d/%d variables\n",labelcnt,min((MAXSECTORS * sizeof(sectortype)/sizeof(int)),(MAXSPRITES * sizeof(spritetype)/(1<<6))),iGameVarCount,MAXGAMEVARS);
initprintf("%ld event definitions, %ld defined actors\n",j,k);
for (i=127;i>=0;i--) for (i=127;i>=0;i--)
if (fta_quotes[i] == NULL) if (fta_quotes[i] == NULL)