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

This commit is contained in:
terminx 2008-07-27 11:35:41 +00:00
parent 9ebad22ac8
commit 61d665e14d
7 changed files with 48 additions and 32 deletions

View file

@ -38,6 +38,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "scriptfile.h" #include "scriptfile.h"
#include "crc32.h" #include "crc32.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#define VERSION " 1.2.0devel" #define VERSION " 1.2.0devel"
static int floor_over_floor; static int floor_over_floor;
@ -1163,7 +1168,7 @@ static void ReadHelpFile(const char *name)
helppage=malloc(IHELP_INITPAGES * sizeof(helppage_t *)); helppage=malloc(IHELP_INITPAGES * sizeof(helppage_t *));
numallocpages=IHELP_INITPAGES; numallocpages=IHELP_INITPAGES;
if (!helppage) goto ERROR; if (!helppage) goto HELPFILE_ERROR;
i=0; i=0;
while (!Bfeof(fp) && !ferror(fp)) while (!Bfeof(fp) && !ferror(fp))
@ -1182,7 +1187,7 @@ static void ReadHelpFile(const char *name)
if (Bfeof(fp) || charsread<=0) break; if (Bfeof(fp) || charsread<=0) break;
hp=Bcalloc(1,sizeof(helppage_t) + IHELP_INITLINES*80); hp=Bcalloc(1,sizeof(helppage_t) + IHELP_INITLINES*80);
if (!hp) goto ERROR; if (!hp) goto HELPFILE_ERROR;
hp->numlines = IHELP_INITLINES; hp->numlines = IHELP_INITLINES;
if (charsread == 79 && tempbuf[78]!='\n') skip=1; if (charsread == 79 && tempbuf[78]!='\n') skip=1;
@ -1193,7 +1198,7 @@ static void ReadHelpFile(const char *name)
if (j >= hp->numlines) if (j >= hp->numlines)
{ {
hp=realloc(hp, sizeof(helppage_t) + 2*hp->numlines*80); hp=realloc(hp, sizeof(helppage_t) + 2*hp->numlines*80);
if (!hp) goto ERROR; if (!hp) goto HELPFILE_ERROR;
hp->numlines *= 2; hp->numlines *= 2;
} }
@ -1225,27 +1230,27 @@ static void ReadHelpFile(const char *name)
while (!newpage(tempbuf) && !Bfeof(fp) && charsread>0); while (!newpage(tempbuf) && !Bfeof(fp) && charsread>0);
hp=realloc(hp, sizeof(helppage_t) + j*80); hp=realloc(hp, sizeof(helppage_t) + j*80);
if (!hp) goto ERROR; if (!hp) goto HELPFILE_ERROR;
hp->numlines=j; hp->numlines=j;
if (i >= numallocpages) if (i >= numallocpages)
{ {
helppage = realloc(helppage, 2*numallocpages*sizeof(helppage_t *)); helppage = realloc(helppage, 2*numallocpages*sizeof(helppage_t *));
numallocpages *= 2; numallocpages *= 2;
if (!helppage) goto ERROR; if (!helppage) goto HELPFILE_ERROR;
} }
helppage[i] = hp; helppage[i] = hp;
i++; i++;
} }
helppage = realloc(helppage, i*sizeof(helppage_t *)); helppage = realloc(helppage, i*sizeof(helppage_t *));
if (!helppage) goto ERROR; if (!helppage) goto HELPFILE_ERROR;
numhelppages = i; numhelppages = i;
Bfclose(fp); Bfclose(fp);
return; return;
ERROR: HELPFILE_ERROR:
Bfclose(fp); Bfclose(fp);
initprintf("ReadHelpFile(): ERROR allocating memory.\n"); initprintf("ReadHelpFile(): ERROR allocating memory.\n");
@ -6698,6 +6703,12 @@ static void checkcommandline(int argc, const char **argv)
addgroup(argv[i++]); addgroup(argv[i++]);
continue; continue;
} }
if (!Bstrcasecmp(k,".def"))
{
defsfilename = (char *)argv[i++];
initprintf("Using DEF file: %s.\n",defsfilename);
continue;
}
} }
} }
i++; i++;
@ -6709,6 +6720,12 @@ int ExtPreInit(int argc,const char **argv)
{ {
wm_setapptitle("Mapster32"VERSION); wm_setapptitle("Mapster32"VERSION);
#ifdef _WIN32
tempbuf[GetModuleFileName(NULL,tempbuf,BMAX_PATH)] = 0;
Bcorrectfilename(tempbuf,1);
chdir(tempbuf);
#endif
OSD_SetLogFile("mapster32.log"); OSD_SetLogFile("mapster32.log");
OSD_SetVersionString("Mapster32"VERSION,0,2); OSD_SetVersionString("Mapster32"VERSION,0,2);
initprintf("Mapster32"VERSION" ("__DATE__" "__TIME__")\n"); initprintf("Mapster32"VERSION" ("__DATE__" "__TIME__")\n");

View file

@ -9369,6 +9369,12 @@ static void checkcommandline(int argc, const char **argv)
initprintf("Using CON file '%s'.\n",confilename); initprintf("Using CON file '%s'.\n",confilename);
continue; continue;
} }
if (!Bstrcasecmp(k,".def"))
{
duke3ddef = (char *)argv[i++];
initprintf("Using DEF file: %s.\n",duke3ddef);
continue;
}
} }
} }
i++; i++;

View file

@ -3430,6 +3430,7 @@ static int parsecommand(void)
case CON_READGAMEVAR: case CON_READGAMEVAR:
case CON_USERQUOTE: case CON_USERQUOTE:
case CON_STARTTRACKVAR: case CON_STARTTRACKVAR:
case CON_CLEARMAPSTATE:
transvar(); transvar();
return 0; return 0;
@ -3594,7 +3595,6 @@ static int parsecommand(void)
case CON_FLASH: case CON_FLASH:
case CON_SAVEMAPSTATE: case CON_SAVEMAPSTATE:
case CON_LOADMAPSTATE: case CON_LOADMAPSTATE:
case CON_CLEARMAPSTATE:
return 0; return 0;
case CON_DRAGPOINT: case CON_DRAGPOINT:

View file

@ -6504,11 +6504,10 @@ case CON_CHANGESPRITESECT:
return 0; return 0;
case CON_CLEARMAPSTATE: case CON_CLEARMAPSTATE:
if (map[ud.volume_number*MAXLEVELS+ud.level_number].savedstate)
{
FreeMapState(ud.volume_number*MAXLEVELS+ud.level_number);
}
insptr++; insptr++;
j = GetGameVarID(*insptr++,g_i,g_p);
if (map[j].savedstate)
FreeMapState(j);
return 0; return 0;
case CON_STOPALLSOUNDS: case CON_STOPALLSOUNDS:

View file

@ -105,7 +105,6 @@ static inline void SetBOSS1Palette();
static inline void SetSLIMEPalette(); static inline void SetSLIMEPalette();
static inline void SetWATERPalette(); static inline void SetWATERPalette();
static inline void SetGAMEPalette(); static inline void SetGAMEPalette();
static void kensetpalette(char *vgapal);
extern short grid; extern short grid;

View file

@ -738,7 +738,7 @@ void menus(void)
"Switch weapons when empty", "Switch weapons when empty",
"-", "-",
"-", "-",
"Network packets/sec", "Net packets per second",
"-", "-",
"-", "-",
"Multiplayer macros", "Multiplayer macros",

View file

@ -548,8 +548,8 @@ int shoot(int i,int atwith)
if (p >= 0) if (p >= 0)
{ {
int angRange; int angRange=32;
int zRange; int zRange=256;
SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p);
OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1);
@ -560,7 +560,7 @@ int shoot(int i,int atwith)
} }
if (j >= 0) if (j >= 0)
{ {
dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8);
if (((sprite[j].picnum >= GREENSLIME)&&(sprite[j].picnum <= GREENSLIME+7))||(sprite[j].picnum ==ROTATEGUN)) if (((sprite[j].picnum >= GREENSLIME)&&(sprite[j].picnum <= GREENSLIME+7))||(sprite[j].picnum ==ROTATEGUN))
{ {
dal -= (8<<8); dal -= (8<<8);
@ -570,8 +570,6 @@ int shoot(int i,int atwith)
sa = getangle(sprite[j].x-sx,sprite[j].y-sy); sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
} }
angRange=32;
zRange=256;
SetGameVarID(g_iAngRangeVarID,angRange, i,p); SetGameVarID(g_iAngRangeVarID,angRange, i,p);
SetGameVarID(g_iZRangeVarID,zRange,i,p); SetGameVarID(g_iZRangeVarID,zRange,i,p);
OnEvent(EVENT_GETSHOTRANGE, i,p, -1); OnEvent(EVENT_GETSHOTRANGE, i,p, -1);
@ -589,7 +587,7 @@ int shoot(int i,int atwith)
if (hitspr != -1) if (hitspr != -1)
{ {
if (sprite[hitspr].statnum == 1 || sprite[hitspr].statnum == 2 || sprite[hitspr].statnum == 10 || sprite[hitspr].statnum == 13) if (sprite[hitspr].statnum == 1 || sprite[hitspr].statnum == 2 || sprite[hitspr].statnum == 10 || sprite[hitspr].statnum == 13)
j = 1; j = hitspr;
} }
} }
@ -885,7 +883,7 @@ DOSKIPBULLETHOLE:
} }
if (j >= 0) if (j >= 0)
{ {
dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8);
zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]); zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]);
if (sprite[j].picnum != RECON) if (sprite[j].picnum != RECON)
sa = getangle(sprite[j].x-sx,sprite[j].y-sy); sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
@ -1115,8 +1113,8 @@ DOSKIPBULLETHOLE:
if (p >= 0) if (p >= 0)
{ {
int angRange; int angRange=32;
int zRange; int zRange=256;
SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p);
OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1);
@ -1127,7 +1125,7 @@ DOSKIPBULLETHOLE:
} }
if (j >= 0) if (j >= 0)
{ {
dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8);
if (((sprite[j].picnum>=GREENSLIME)&&(sprite[j].picnum<=GREENSLIME+7))||(sprite[j].picnum==ROTATEGUN)) if (((sprite[j].picnum>=GREENSLIME)&&(sprite[j].picnum<=GREENSLIME+7))||(sprite[j].picnum==ROTATEGUN))
{ {
@ -1138,9 +1136,6 @@ DOSKIPBULLETHOLE:
sa = getangle(sprite[j].x-sx,sprite[j].y-sy); sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
} }
angRange=32;
zRange=256;
SetGameVarID(g_iAngRangeVarID,angRange, i,p); SetGameVarID(g_iAngRangeVarID,angRange, i,p);
SetGameVarID(g_iZRangeVarID,zRange,i,p); SetGameVarID(g_iZRangeVarID,zRange,i,p);
@ -1160,7 +1155,7 @@ DOSKIPBULLETHOLE:
if (hitspr != -1) if (hitspr != -1)
{ {
if (sprite[hitspr].statnum == 1 || sprite[hitspr].statnum == 2 || sprite[hitspr].statnum == 10 || sprite[hitspr].statnum == 13) if (sprite[hitspr].statnum == 1 || sprite[hitspr].statnum == 2 || sprite[hitspr].statnum == 10 || sprite[hitspr].statnum == 13)
j = 1; j = hitspr;
} }
} }
@ -1419,7 +1414,7 @@ SKIPBULLETHOLE:
if (j >= 0) if (j >= 0)
{ {
dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)-(12<<8); dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)-(12<<8);
zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]) ; zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]) ;
sa = getangle(sprite[j].x-sx,sprite[j].y-sy); sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
} }
@ -1519,7 +1514,7 @@ SKIPBULLETHOLE:
if (j >= 0) if (j >= 0)
{ {
dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8);
zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]); zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]);
if (sprite[j].picnum != RECON) if (sprite[j].picnum != RECON)
sa = getangle(sprite[j].x-sx,sprite[j].y-sy); sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
@ -1718,7 +1713,7 @@ SKIPBULLETHOLE:
if (j >= 0) if (j >= 0)
{ {
dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8);
if (((sprite[j].picnum >= GREENSLIME)&&(sprite[j].picnum <= GREENSLIME+7))||(sprite[j].picnum ==ROTATEGUN)) if (((sprite[j].picnum >= GREENSLIME)&&(sprite[j].picnum <= GREENSLIME+7))||(sprite[j].picnum ==ROTATEGUN))
{ {
dal -= (8<<8); dal -= (8<<8);
@ -1810,7 +1805,7 @@ SKIPBULLETHOLE:
if (j >= 0) if (j >= 0)
{ {
dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1); dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1);
zvel = ((sprite[j].z-sz-dal-(4<<8))*768) / (ldist(&sprite[g_player[p].ps->i], &sprite[j])); zvel = ((sprite[j].z-sz-dal-(4<<8))*768) / (ldist(&sprite[g_player[p].ps->i], &sprite[j]));
sa = getangle(sprite[j].x-sx,sprite[j].y-sy); sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
} }