Misc. fixes

git-svn-id: https://svn.eduke32.com/eduke32@469 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-01-24 03:42:54 +00:00
parent 23a468d956
commit f628faefd8
6 changed files with 87 additions and 97 deletions

View file

@ -7138,18 +7138,30 @@ if (numsprites > MAXSPRITES) { kclose(fil); return(-1); }
#include "scriptfile.h" #include "scriptfile.h"
long loadmaphack(char *filename) long loadmaphack(char *filename)
{ {
enum
{
T_EOF = -2,
T_ERROR = -1,
T_SPRITE = 0,
T_ANGOFF,
T_NOMODEL,
T_NOANIM,
T_PITCH,
T_ROLL
};
static struct { char *text; int tokenid; } legaltokens[] = { static struct { char *text; int tokenid; } legaltokens[] = {
{ "sprite", 0 }, { "sprite", T_SPRITE },
{ "angleoff", 1 }, { "angleoff", T_ANGOFF },
{ "angoff", 1 }, { "angoff", T_ANGOFF },
{ "notmd2", 2 }, { "notmd2", T_NOMODEL },
{ "notmd3", 2 }, { "notmd3", T_NOMODEL },
{ "notmd", 2 }, { "notmd", T_NOMODEL },
{ "nomd2anim", 3 }, { "nomd2anim", T_NOANIM },
{ "nomd3anim", 3 }, { "nomd3anim", T_NOANIM },
{ "nomdanim", 3 }, { "nomdanim", T_NOANIM },
{ "pitch", 4 }, { "pitch", T_PITCH },
{ "roll", 5 }, { "roll", T_ROLL },
{ NULL, -1 } { NULL, -1 }
}; };
@ -7169,7 +7181,7 @@ long loadmaphack(char *filename)
for (i=0;legaltokens[i].text;i++) if (!Bstrcasecmp(tok,legaltokens[i].text)) break; for (i=0;legaltokens[i].text;i++) if (!Bstrcasecmp(tok,legaltokens[i].text)) break;
cmdtokptr = script->ltextptr; cmdtokptr = script->ltextptr;
switch (legaltokens[i].tokenid) { switch (legaltokens[i].tokenid) {
case 0: // sprite <xx> case T_SPRITE: // sprite <xx>
if (scriptfile_getnumber(script, &whichsprite)) break; if (scriptfile_getnumber(script, &whichsprite)) break;
if ((unsigned)whichsprite >= (unsigned)MAXSPRITES) { if ((unsigned)whichsprite >= (unsigned)MAXSPRITES) {
@ -7181,7 +7193,7 @@ long loadmaphack(char *filename)
} }
break; break;
case 1: // angoff <xx> case T_ANGOFF: // angoff <xx>
{ {
int ang; int ang;
if (scriptfile_getnumber(script, &ang)) break; if (scriptfile_getnumber(script, &ang)) break;
@ -7195,7 +7207,7 @@ long loadmaphack(char *filename)
spriteext[whichsprite].angoff = (short)ang; spriteext[whichsprite].angoff = (short)ang;
} }
break; break;
case 2: // notmd case T_NOMODEL: // notmd
if (whichsprite < 0) { if (whichsprite < 0) {
// no sprite directive preceeding // no sprite directive preceeding
initprintf("Ignoring not-MD2/MD3 directive because of absent/invalid sprite number on line %s:%d\n", initprintf("Ignoring not-MD2/MD3 directive because of absent/invalid sprite number on line %s:%d\n",
@ -7204,7 +7216,7 @@ long loadmaphack(char *filename)
} }
spriteext[whichsprite].flags |= SPREXT_NOTMD; spriteext[whichsprite].flags |= SPREXT_NOTMD;
break; break;
case 3: // nomdanim case T_NOANIM: // nomdanim
if (whichsprite < 0) { if (whichsprite < 0) {
// no sprite directive preceeding // no sprite directive preceeding
initprintf("Ignoring no-MD2/MD3-anim directive because of absent/invalid sprite number on line %s:%d\n", initprintf("Ignoring no-MD2/MD3-anim directive because of absent/invalid sprite number on line %s:%d\n",
@ -7213,7 +7225,7 @@ long loadmaphack(char *filename)
} }
spriteext[whichsprite].flags |= SPREXT_NOMDANIM; spriteext[whichsprite].flags |= SPREXT_NOMDANIM;
break; break;
case 4: // pitch <xx> case T_PITCH: // pitch <xx>
{ {
int pitch; int pitch;
if (scriptfile_getnumber(script, &pitch)) break; if (scriptfile_getnumber(script, &pitch)) break;
@ -7226,7 +7238,7 @@ long loadmaphack(char *filename)
} }
spriteext[whichsprite].pitch = (short)pitch; spriteext[whichsprite].pitch = (short)pitch;
} }
case 5: // roll <xx> case T_ROLL: // roll <xx>
{ {
int roll; int roll;
if (scriptfile_getnumber(script, &roll)) break; if (scriptfile_getnumber(script, &roll)) break;

View file

@ -4313,7 +4313,7 @@ void ExtPreLoadMap(void)
static void comlinehelp(void) static void comlinehelp(void)
{ {
char *s = "Usage: mapster32 [OPTIONS] [FILE]\n\n" char *s = "Usage: mapster32 [OPTIONS] [FILE]\n\n"
"-gFILE, -grp FILE\t\tUse extra group file FILE\n" "-gFILE, -grp FILE\tUse extra group file FILE\n"
"-hFILE\t\tUse definitions file FILE\n" "-hFILE\t\tUse definitions file FILE\n"
"-jDIR, -game_dir DIR\n\t\tAdds DIR to the file path stack\n" "-jDIR, -game_dir DIR\n\t\tAdds DIR to the file path stack\n"
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) #if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
@ -4324,7 +4324,7 @@ static void comlinehelp(void)
#endif #endif
"\n-?, -help, --help\tDisplay this help message and exit" "\n-?, -help, --help\tDisplay this help message and exit"
; ;
wm_msgbox("Mapster32 Command Line Help",s); wm_msgbox("Mapster32"VERSION,s);
} }
static void addgamepath(const char *buffer) static void addgamepath(const char *buffer)
@ -4633,11 +4633,10 @@ int ExtInit(void)
int i; int i;
#if 1 #if 1
i=wm_ynbox("Texture Caching", i=wm_ynbox("Texture Caching",
"Would you like to enable the on-disk texture cache? " "Would you like to enable the on-disk texture cache? This feature may use around 140 megabytes of disk "
"This feature may use up to 200 megabytes of disk " "space if you have a great deal of high resolution textures and skins, but textures will load dramatically "
"space if you have a great deal of high resolution " "faster after the first time they are loaded.\n\n"
"textures and skins, but textures will load dramatically " "You will generally want to say 'yes' here, especially if using the HRP.");
"faster after the first time they are loaded.");
#else #else
i = 1; i = 1;
#endif #endif

View file

@ -8110,16 +8110,17 @@ static void comlinehelp(void)
"-cNUM\t\tUse MP mode NUM, 1 = DukeMatch(spawn), 2 = Coop, 3 = Dukematch(no spawn)\n" "-cNUM\t\tUse MP mode NUM, 1 = DukeMatch(spawn), 2 = Coop, 3 = Dukematch(no spawn)\n"
"-dFILE\t\tStart to play demo FILE\n" "-dFILE\t\tStart to play demo FILE\n"
/* "-fNUM\t\tSend fewer packets in multiplayer (1, 2, 4) (deprecated)\n" */ /* "-fNUM\t\tSend fewer packets in multiplayer (1, 2, 4) (deprecated)\n" */
"-gFILE, -grp FILE\t\tUse extra group file FILE\n" "-game_dir DIR\tSee -j\n"
"-gFILE, -grp FILE\tUse extra group file FILE\n"
"-hFILE\t\tUse definitions file FILE\n" "-hFILE\t\tUse definitions file FILE\n"
"-iNUM\t\tUse networking mode NUM (1/0) (multiplayer only) (default == 1)\n" "-iNUM\t\tUse networking mode NUM (1/0) (multiplayer only) (default == 1)\n"
"-jDIR\n-game_dir DIR\t\tAdds DIR to the file path stack\n" "-jDIR\t\tAdds DIR to the file path stack\n"
"-lNUM\t\tWarp to level NUM (1-11), see -v\n" "-lNUM\t\tWarp to level NUM (1-11), see -v\n"
"-m\t\tDisable monsters\n" "-m\t\tDisable monsters\n"
"-map FILE\tUse user map FILE\n" "-map FILE\tUse user map FILE\n"
"-name NAME\tUse NAME as multiplayer name\n" "-name NAME\tUse NAME as multiplayer name\n"
"-nD\t\tDump default gamevars to gamevars.txt\n" "-nD\t\tDump default gamevars to gamevars.txt\n"
"-net\t\tNetwork play; see documentation\n" "-net PARAMETERS\tNetwork play; see documentation for PARAMETERS\n"
"-nm\t\tDisable music\n" "-nm\t\tDisable music\n"
"-ns\t\tDisable sound\n" "-ns\t\tDisable sound\n"
"-qNUM\t\tUse NUM players for fake multiplayer (2-8)\n" "-qNUM\t\tUse NUM players for fake multiplayer (2-8)\n"
@ -8138,7 +8139,7 @@ static void comlinehelp(void)
"-zNUM, -condebug\tLine-by-line CON compilation debugging, NUM is verbosity\n" "-zNUM, -condebug\tLine-by-line CON compilation debugging, NUM is verbosity\n"
"\n-?, -help, --help\tDisplay this help message and exit" "\n-?, -help, --help\tDisplay this help message and exit"
; ;
wm_msgbox("EDuke32 Command Line Help",s); wm_msgbox(HEAD2,s);
} }
signed int rancid_players = 0; signed int rancid_players = 0;
@ -9578,13 +9579,14 @@ void backtomenu(void)
else wm_setapptitle(HEAD); else wm_setapptitle(HEAD);
} }
int load_script(char *szScript) int load_script(const char *szScript)
{ {
FILE* fp = fopenfrompath(szScript, "r"); FILE* fp = fopenfrompath(szScript, "r");
if (fp != NULL) if (fp != NULL)
{ {
char line[255]; char line[255];
OSD_Printf("Executing \"%s\"\n", szScript); OSD_Printf("Executing \"%s\"\n", szScript);
while (fgets(line ,sizeof(line)-1, fp) != NULL) while (fgets(line ,sizeof(line)-1, fp) != NULL)
OSD_Dispatch(strtok(line,"\r\n")); OSD_Dispatch(strtok(line,"\r\n"));
@ -9696,11 +9698,10 @@ void app_main(int argc,char **argv)
if (glusetexcache == -1 || glusetexcachecompression == -1) if (glusetexcache == -1 || glusetexcachecompression == -1)
{ {
i=wm_ynbox("Texture Caching", i=wm_ynbox("Texture Caching",
"Would you like to enable the on-disk texture cache? " "Would you like to enable the on-disk texture cache? This feature may use around 140 megabytes of disk "
"This feature may use up to 200 megabytes of disk " "space if you have a great deal of high resolution textures and skins, but textures will load dramatically "
"space if you have a great deal of high resolution " "faster after the first time they are loaded.\n\n"
"textures and skins, but textures will load dramatically " "You will generally want to say 'yes' here, especially if using the HRP.");
"faster after the first time they are loaded.");
if (i) useprecache = glusetexcompr = glusetexcache = glusetexcachecompression = 1; if (i) useprecache = glusetexcompr = glusetexcache = glusetexcachecompression = 1;
else glusetexcache = glusetexcachecompression = 0; else glusetexcache = glusetexcachecompression = 0;
} }
@ -10005,8 +10006,7 @@ void app_main(int argc,char **argv)
menutext(160,105,0,0,"LOADING SAVED GAME..."); menutext(160,105,0,0,"LOADING SAVED GAME...");
nextpage(); nextpage();
j = loadplayer(ud.warp_on-2); if (loadplayer(ud.warp_on-2))
if (j)
ud.warp_on = 0; ud.warp_on = 0;
} }
@ -10064,18 +10064,18 @@ MAIN_LOOP_RESTART:
if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
{ {
int k = 0; j = 0;
switch (ud.pteam[myconnectindex]) switch (ud.pteam[myconnectindex])
{ {
case 0: case 0:
k = 3; j = 3;
break; break;
case 1: case 1:
k = 21; j = 21;
break; break;
} }
ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = k; ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = j;
} }
else else
{ {

View file

@ -2375,7 +2375,6 @@ static int parsecommand(void)
case CON_CLIPDIST: case CON_CLIPDIST:
case CON_LOTSOFGLASS: case CON_LOTSOFGLASS:
case CON_SAVE: case CON_SAVE:
case CON_QUAKE:
if (!CheckEventSync(current_event)) if (!CheckEventSync(current_event))
ReportError(WARNING_EVENTSYNC); ReportError(WARNING_EVENTSYNC);
case CON_ANGOFF: case CON_ANGOFF:
@ -3028,6 +3027,7 @@ static int parsecommand(void)
case CON_INITTIMER: case CON_INITTIMER:
case CON_LOCKPLAYER: case CON_LOCKPLAYER:
case CON_SHOOTVAR: case CON_SHOOTVAR:
case CON_QUAKE:
if (!CheckEventSync(current_event)) if (!CheckEventSync(current_event))
ReportError(WARNING_EVENTSYNC); ReportError(WARNING_EVENTSYNC);
case CON_JUMP: case CON_JUMP:

View file

@ -134,7 +134,7 @@ static void tracers(long x1,long y1,long z1,long x2,long y2,long z2,long n)
} }
} }
void hitscantrail(long x1, long y1, long z1, long x2, long y2, long z2, short ang, short atwith) static void hitscantrail(long x1, long y1, long z1, long x2, long y2, long z2, int ang, int atwith)
{ {
long xv, yv, zv, n, j, i; long xv, yv, zv, n, j, i;
short sect = -1; short sect = -1;
@ -189,11 +189,11 @@ long hits(short i)
return (FindDistance2D(sx-SX,sy-SY)); return (FindDistance2D(sx-SX,sy-SY));
} }
static short aim(spritetype *s,short aang,short atwith) static int aim(spritetype *s,int aang,int atwith)
{ {
char gotshrinker,gotfreezer; int gotshrinker,gotfreezer;
short i, j, a, k, cans; int i, j, a, k, cans;
short aimstats[] = {10,13,1,2}; int aimstats[] = {10,13,1,2};
long dx1, dy1, dx2, dy2, dx3, dy3, smax, sdist; long dx1, dy1, dx2, dy2, dx3, dy3, smax, sdist;
long xv, yv; long xv, yv;
@ -226,8 +226,8 @@ static short aim(spritetype *s,short aang,short atwith)
j = -1; j = -1;
gotshrinker = s->picnum == APLAYER && *aplWeaponWorksLike[ps[s->yvel].curr_weapon] == SHRINKER_WEAPON; gotshrinker = (s->picnum == APLAYER && *aplWeaponWorksLike[ps[s->yvel].curr_weapon] == SHRINKER_WEAPON);
gotfreezer = s->picnum == APLAYER && *aplWeaponWorksLike[ps[s->yvel].curr_weapon] == FREEZE_WEAPON; gotfreezer = (s->picnum == APLAYER && *aplWeaponWorksLike[ps[s->yvel].curr_weapon] == FREEZE_WEAPON);
smax = 0x7fffffff; smax = 0x7fffffff;
@ -301,14 +301,11 @@ static short aim(spritetype *s,short aang,short atwith)
int shoot(int i,int atwith) int shoot(int i,int atwith)
{ {
short sect, hitsect, hitspr, hitwall, l, sa, p, j, k=-1, wh, scount; short hitsect, hitspr, hitwall, l, sa, p, j, k=-1, wh, scount;
long sx, sy, sz, vel, zvel, hitx, hity, hitz, x, oldzvel, dal; long sx, sy, sz, vel, zvel = 0, hitx, hity, hitz, x, oldzvel, dal;
unsigned char sizx,sizy; unsigned char sizx,sizy;
spritetype *s; spritetype *s = &sprite[i];
short sect = s->sectnum;
s = &sprite[i];
sect = s->sectnum;
zvel = 0;
if (s->picnum == APLAYER) if (s->picnum == APLAYER)
{ {
@ -2033,7 +2030,7 @@ static int animateaccess(int gs,int snum)
return 1; return 1;
} }
void myospalw(long x, long y, short tilenum, signed char shade, char orientation, char p) static void myospalw(long x, long y, int tilenum, int shade, int orientation, int p)
{ {
if (!ud.drawweapon) if (!ud.drawweapon)
return; return;
@ -2060,9 +2057,7 @@ void myospalw(long x, long y, short tilenum, signed char shade, char orientation
} }
} }
short fistsign; static int fistsign, last_quick_kick[MAXPLAYERS];
char last_quick_kick[MAXPLAYERS];
void displayweapon(int snum) void displayweapon(int snum)
{ {
@ -2647,14 +2642,9 @@ void displayweapon(int snum)
#define MAXHORIZ 127 #define MAXHORIZ 127
long myaimmode = 0, myaimstat = 0, omyaimstat = 0; long myaimmode = 0, myaimstat = 0, omyaimstat = 0;
int32 mouseyaxismode = -1; int32 mouseyaxismode = -1;
static ControlInfo lastinfo = static ControlInfo lastinfo = { 0,0,0,0,0,0 };
{ int jump_input = 0;
0,0,0,0,0,0
};
char jump_input = 0;
void getinput(int snum) void getinput(int snum)
{ {
@ -2960,9 +2950,6 @@ void getinput(int snum)
momx += fricxv; momx += fricxv;
momy += fricyv; momy += fricyv;
// if (momx == 0) momx = 1; // HACK; the game seems to "forget" about the rest of the data if we aren't moving
// if (momy == 0) momy = 1;
loc.fvel = momx; loc.fvel = momx;
loc.svel = momy; loc.svel = momy;
@ -2970,7 +2957,7 @@ void getinput(int snum)
loc.horz = horiz; loc.horz = horiz;
} }
static char doincrements(struct player_struct *p) static int doincrements(struct player_struct *p)
{ {
int snum = sprite[p->i].yvel; int snum = sprite[p->i].yvel;
@ -4231,6 +4218,24 @@ void processinput(int snum)
} }
} }
if (sync[snum].extbits&(1))
OnEvent(EVENT_MOVEFORWARD,pi,snum, -1);
if (sync[snum].extbits&(1<<1))
OnEvent(EVENT_MOVEBACKWARD,pi,snum, -1);
if (sync[snum].extbits&(1<<2))
OnEvent(EVENT_STRAFELEFT,pi,snum, -1);
if (sync[snum].extbits&(1<<3))
OnEvent(EVENT_STRAFERIGHT,pi,snum, -1);
if (sync[snum].extbits&(1<<4) || sync[snum].avel < 0)
OnEvent(EVENT_TURNLEFT,pi,snum, -1);
if (sync[snum].extbits&(1<<5) || sync[snum].avel > 0)
OnEvent(EVENT_TURNRIGHT,pi,snum, -1);
if (p->posxv || p->posyv || sync[snum].fvel || sync[snum].svel) if (p->posxv || p->posyv || sync[snum].fvel || sync[snum].svel)
{ {
p->crack_time = 777; p->crack_time = 777;
@ -4272,32 +4277,6 @@ void processinput(int snum)
if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400)
doubvel <<= 1; doubvel <<= 1;
/*
loc.extbits = BUTTON(gamefunc_Move_Forward);
loc.extbits |= BUTTON(gamefunc_Move_Backward)<<1;
loc.extbits |= BUTTON(gamefunc_Strafe_Left)<<2;
loc.extbits |= BUTTON(gamefunc_Strafe_Right)<<3;
loc.extbits |= BUTTON(gamefunc_Turn_Left)<<4;
loc.extbits |= BUTTON(gamefunc_Turn_Right)<<5;
*/
if (sync[snum].extbits&(1))
OnEvent(EVENT_MOVEFORWARD,pi,snum, -1);
if (sync[snum].extbits&(1<<1))
OnEvent(EVENT_MOVEBACKWARD,pi,snum, -1);
if (sync[snum].extbits&(1<<2))
OnEvent(EVENT_STRAFELEFT,pi,snum, -1);
if (sync[snum].extbits&(1<<3))
OnEvent(EVENT_STRAFERIGHT,pi,snum, -1);
if (sync[snum].extbits&(1<<4) || sync[snum].avel < 0)
OnEvent(EVENT_TURNLEFT,pi,snum, -1);
if (sync[snum].extbits&(1<<5) || sync[snum].avel > 0)
OnEvent(EVENT_TURNRIGHT,pi,snum, -1);
p->posxv += ((sync[snum].fvel*doubvel)<<6); p->posxv += ((sync[snum].fvel*doubvel)<<6);
p->posyv += ((sync[snum].svel*doubvel)<<6); p->posyv += ((sync[snum].svel*doubvel)<<6);

View file

@ -1477,7 +1477,7 @@ void waitforeverybody()
} }
} }
extern char jump_input; extern int jump_input;
void clearfifo(void) void clearfifo(void)
{ {