New event/userdef CON extensions to allow fiddling with the movement interpolation in multiplayer.

git-svn-id: https://svn.eduke32.com/eduke32@296 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-09-19 23:02:33 +00:00
parent c1f5d7fd0d
commit 4f021f4736
8 changed files with 244 additions and 47 deletions

View file

@ -4099,9 +4099,12 @@ int ExtInit(void)
int asperr; int asperr;
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
addsearchpath("/usr/share/games/jfduke3d");
addsearchpath("/usr/local/share/games/jfduke3d");
addsearchpath("/usr/share/games/eduke32"); addsearchpath("/usr/share/games/eduke32");
addsearchpath("/usr/local/games/eduke32"); addsearchpath("/usr/local/share/games/eduke32");
#elif defined(__APPLE__) #elif defined(__APPLE__)
addsearchpath("/Library/Application Support/JFDuke3D");
addsearchpath("/Library/Application Support/EDuke32"); addsearchpath("/Library/Application Support/EDuke32");
#endif #endif
if (getcwd(cwd,BMAX_PATH)) addsearchpath(cwd); if (getcwd(cwd,BMAX_PATH)) addsearchpath(cwd);

View file

@ -562,7 +562,7 @@ void readsavenames(void)
if(dfread(&j,sizeof(long),1,fil) != 1) { Bfclose(fil); continue; } if(dfread(&j,sizeof(long),1,fil) != 1) { Bfclose(fil); continue; }
if(dfread(g_szBuf,j,1,fil) != 1) { Bfclose(fil); continue; } if(dfread(g_szBuf,j,1,fil) != 1) { Bfclose(fil); continue; }
if (dfread(&dummy,4,1,fil) != 1) { Bfclose(fil); continue; } if (dfread(&dummy,4,1,fil) != 1) { Bfclose(fil); continue; }
if(dummy != BYTEVERSION) return; if(dummy != BYTEVERSION) { Bfclose(fil); continue; }
if (dfread(&dummy,4,1,fil) != 1) { Bfclose(fil); continue; } if (dfread(&dummy,4,1,fil) != 1) { Bfclose(fil); continue; }
if (dfread(&ud.savegame[i][0],19,1,fil) != 1) { ud.savegame[i][0] = 0; } if (dfread(&ud.savegame[i][0],19,1,fil) != 1) { ud.savegame[i][0] = 0; }
Bfclose(fil); Bfclose(fil);

View file

@ -136,7 +136,7 @@ enum gamemodes {
#define MAXCYCLERS 1024 #define MAXCYCLERS 1024
#define MAXSCRIPTSIZE 65536 #define MAXSCRIPTSIZE 98304
#define MAXANIMATES 256 #define MAXANIMATES 256
@ -702,13 +702,14 @@ enum events {
EVENT_DOFIRE, EVENT_DOFIRE,
EVENT_PRESSEDFIRE, EVENT_PRESSEDFIRE,
EVENT_USE, EVENT_USE,
EVENT_PROCESSINPUT EVENT_PROCESSINPUT,
EVENT_FAKEDOMOVETHINGS
}; };
// store global game definitions // store global game definitions
enum gamevarflags { enum gamevarflags {
MAXGAMEVARS = 1024, MAXGAMEVARS = 2048,
MAXVARLABEL = 26, MAXVARLABEL = 26,
GAMEVAR_FLAG_NORMAL = 0, // normal GAMEVAR_FLAG_NORMAL = 0, // normal
GAMEVAR_FLAG_PERPLAYER = 1, // per-player variable GAMEVAR_FLAG_PERPLAYER = 1, // per-player variable

View file

@ -8935,9 +8935,12 @@ void app_main(int argc,char **argv)
initprintf("Copyright (c) 2006 EDuke32 team\n"); initprintf("Copyright (c) 2006 EDuke32 team\n");
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
addsearchpath("/usr/share/games/jfduke3d");
addsearchpath("/usr/local/share/games/jfduke3d");
addsearchpath("/usr/share/games/eduke32"); addsearchpath("/usr/share/games/eduke32");
addsearchpath("/usr/local/share/games/eduke32"); addsearchpath("/usr/local/share/games/eduke32");
#elif defined(__APPLE__) #elif defined(__APPLE__)
addsearchpath("/Library/Application Support/JFDuke3D");
addsearchpath("/Library/Application Support/EDuke32"); addsearchpath("/Library/Application Support/EDuke32");
#endif #endif
@ -9873,6 +9876,8 @@ void fakedomovethings(void)
syn = (input *)&inputfifo[fakemovefifoplc&(MOVEFIFOSIZ-1)][myconnectindex]; syn = (input *)&inputfifo[fakemovefifoplc&(MOVEFIFOSIZ-1)][myconnectindex];
OnEvent(EVENT_FAKEDOMOVETHINGS, ps[myconnectindex].i, myconnectindex, -1);
p = &ps[myconnectindex]; p = &ps[myconnectindex];
backcstat = sprite[p->i].cstat; backcstat = sprite[p->i].cstat;

View file

@ -817,6 +817,27 @@ LABELS userdefslabels[]= {
{ "automsg", USERDEFS_AUTOMSG, 0, 0 }, { "automsg", USERDEFS_AUTOMSG, 0, 0 },
{ "idplayers", USERDEFS_IDPLAYERS, 0, 0 }, { "idplayers", USERDEFS_IDPLAYERS, 0, 0 },
{ "team", USERDEFS_TEAM, 0, 0 }, { "team", USERDEFS_TEAM, 0, 0 },
{ "myx", USERDEFS_MYX, 0, 0 },
{ "omyx", USERDEFS_OMYX, 0, 0 },
{ "myxvel", USERDEFS_MYXVEL, 0, 0 },
{ "myy", USERDEFS_MYY, 0, 0 },
{ "omyy", USERDEFS_OMYY, 0, 0 },
{ "myyvel", USERDEFS_MYYVEL, 0, 0 },
{ "myz", USERDEFS_MYZ, 0, 0 },
{ "omyz", USERDEFS_OMYZ, 0, 0 },
{ "myzvel", USERDEFS_MYZVEL, 0, 0 },
{ "myhoriz", USERDEFS_MYHORIZ, 0, 0 },
{ "omyhoriz", USERDEFS_OMYHORIZ, 0, 0 },
{ "myhorizoff", USERDEFS_MYHORIZOFF, 0, 0 },
{ "omyhorizoff", USERDEFS_OMYHORIZOFF, 0, 0 },
{ "myang", USERDEFS_MYANG, 0, 0 },
{ "omyang", USERDEFS_OMYANG, 0, 0 },
{ "mycursectnum", USERDEFS_MYCURSECTNUM, 0, 0 },
{ "myjumpingcounter", USERDEFS_MYJUMPINGCOUNTER, 0, 0 },
{ "myjumpingtoggle", USERDEFS_MYJUMPINGTOGGLE, 0, 0 },
{ "myonground", USERDEFS_MYONGROUND, 0, 0 },
{ "myhardlanding", USERDEFS_MYHARDLANDING, 0, 0 },
{ "myreturntocenter", USERDEFS_MYRETURNTOCENTER, 0, 0 },
{ "", -1, 0, 0 } // END OF LIST { "", -1, 0, 0 } // END OF LIST
}; };
@ -1022,6 +1043,7 @@ char CheckEventSync(int iEventID)
case EVENT_DISPLAYCROSSHAIR: case EVENT_DISPLAYCROSSHAIR:
case EVENT_DISPLAYREST: case EVENT_DISPLAYREST:
case EVENT_ENTERLEVEL: case EVENT_ENTERLEVEL:
case EVENT_FAKEDOMOVETHINGS:
case EVENT_GETLOADTILE: case EVENT_GETLOADTILE:
case EVENT_GETMENUTILE: case EVENT_GETMENUTILE:
case EVENT_INIT: case EVENT_INIT:
@ -1796,19 +1818,19 @@ void transvartype(int type)
*scriptptr++=i; *scriptptr++=i;
} }
inline void transvar(void) static inline void transvar(void)
{ {
transvartype(0); transvartype(0);
} }
inline void transmultvarstype(int type, char num) static inline void transmultvarstype(int type, char num)
{ {
char i; char i;
for(i=0;i<num;i++) for(i=0;i<num;i++)
transvartype(type); transvartype(type);
} }
inline void transmultvars(char num) static inline void transmultvars(char num)
{ {
transmultvarstype(0,num); transmultvarstype(0,num);
} }
@ -1951,6 +1973,9 @@ char parsecommand(void)
if( (error+warning) > 63 || ( *textptr == '\0' ) || ( *(textptr+1) == '\0' ) ) return 1; if( (error+warning) > 63 || ( *textptr == '\0' ) || ( *(textptr+1) == '\0' ) ) return 1;
if(condebug)
ReportError(-1);
if (checking_switch > 0 ) if (checking_switch > 0 )
{ {
//Bsprintf(g_szBuf,"PC(): '%.25s'",textptr); //Bsprintf(g_szBuf,"PC(): '%.25s'",textptr);
@ -2732,8 +2757,8 @@ char parsecommand(void)
if(j > 2) if(j > 2)
{ {
ReportError(-1); ReportError(-1);
error++; initprintf("%s:%ld: warning: invalid useractor type.\n",compilefile,line_number);
initprintf("%s:%ld: error: invalid useractor type.\n",compilefile,line_number); j = 0;
} }
transnum(LABEL_DEFINE); transnum(LABEL_DEFINE);
@ -4763,11 +4788,11 @@ repeatcase:
if (j != 25) continue; if (j != 25) continue;
if (keyword() != -1) { if (keyword() != -1) {
initprintf("Version 1.3D CON files detected.\n"); initprintf("Duke Nukem 3D v1.3D style CON files detected.\n");
break; break;
} else { } else {
conversion = 14; conversion = 14;
initprintf("Version 1.4+ CON files detected.\n"); initprintf("Duke Nukem 3D v1.4+ style CON files detected.\n");
} }
} }
@ -5531,6 +5556,7 @@ void AddDefaultDefinitions(void)
AddDefinition("EVENT_DRAWWEAPON",EVENT_DRAWWEAPON,LABEL_DEFINE); AddDefinition("EVENT_DRAWWEAPON",EVENT_DRAWWEAPON,LABEL_DEFINE);
AddDefinition("EVENT_EGS",EVENT_EGS,LABEL_DEFINE); AddDefinition("EVENT_EGS",EVENT_EGS,LABEL_DEFINE);
AddDefinition("EVENT_ENTERLEVEL",EVENT_ENTERLEVEL,LABEL_DEFINE); AddDefinition("EVENT_ENTERLEVEL",EVENT_ENTERLEVEL,LABEL_DEFINE);
AddDefinition("EVENT_FAKEDOMOVETHINGS",EVENT_FAKEDOMOVETHINGS,LABEL_DEFINE);
AddDefinition("EVENT_FIRE",EVENT_FIRE,LABEL_DEFINE); AddDefinition("EVENT_FIRE",EVENT_FIRE,LABEL_DEFINE);
AddDefinition("EVENT_FIREWEAPON",EVENT_FIREWEAPON,LABEL_DEFINE); AddDefinition("EVENT_FIREWEAPON",EVENT_FIREWEAPON,LABEL_DEFINE);
AddDefinition("EVENT_GAME",EVENT_GAME,LABEL_DEFINE); AddDefinition("EVENT_GAME",EVENT_GAME,LABEL_DEFINE);

View file

@ -291,7 +291,29 @@ enum userdefslabels {
USERDEFS_AUTOVOTE, USERDEFS_AUTOVOTE,
USERDEFS_AUTOMSG, USERDEFS_AUTOMSG,
USERDEFS_IDPLAYERS, USERDEFS_IDPLAYERS,
USERDEFS_TEAM USERDEFS_TEAM,
// this stuff isn't really userdef stuff, but getuserdef/setuserdef is already set up for what I want to do
USERDEFS_MYX,
USERDEFS_OMYX,
USERDEFS_MYXVEL,
USERDEFS_MYY,
USERDEFS_OMYY,
USERDEFS_MYYVEL,
USERDEFS_MYZ,
USERDEFS_OMYZ,
USERDEFS_MYZVEL,
USERDEFS_MYHORIZ,
USERDEFS_OMYHORIZ,
USERDEFS_MYHORIZOFF,
USERDEFS_OMYHORIZOFF,
USERDEFS_MYANG,
USERDEFS_OMYANG,
USERDEFS_MYCURSECTNUM,
USERDEFS_MYJUMPINGCOUNTER,
USERDEFS_MYJUMPINGTOGGLE,
USERDEFS_MYONGROUND,
USERDEFS_MYHARDLANDING,
USERDEFS_MYRETURNTOCENTER
}; };
enum sectorlabels { enum sectorlabels {

View file

@ -656,6 +656,153 @@ void DoUserDef(char bSet, long lLabelID, long lVar2, short sActor, short sPlayer
SetGameVarID((int)lVar2, ud.team, sActor, sPlayer); SetGameVarID((int)lVar2, ud.team, sActor, sPlayer);
break; break;
case USERDEFS_MYX:
if(bSet)
myx = lValue;
else
SetGameVarID((int)lVar2, myx, sActor, sPlayer);
break;
case USERDEFS_OMYX:
if(bSet)
omyx = lValue;
else
SetGameVarID((int)lVar2, omyx, sActor, sPlayer);
break;
case USERDEFS_MYXVEL:
if(bSet)
myxvel = lValue;
else
SetGameVarID((int)lVar2, myxvel, sActor, sPlayer);
break;
case USERDEFS_MYY:
if(bSet)
myy = lValue;
else
SetGameVarID((int)lVar2, myy, sActor, sPlayer);
break;
case USERDEFS_OMYY:
if(bSet)
omyy = lValue;
else
SetGameVarID((int)lVar2, omyy, sActor, sPlayer);
break;
case USERDEFS_MYYVEL:
if(bSet)
myyvel = lValue;
else
SetGameVarID((int)lVar2, myyvel, sActor, sPlayer);
break;
case USERDEFS_MYZ:
if(bSet)
myx = lValue;
else
SetGameVarID((int)lVar2, myx, sActor, sPlayer);
break;
case USERDEFS_OMYZ:
if(bSet)
omyz = lValue;
else
SetGameVarID((int)lVar2, omyz, sActor, sPlayer);
break;
case USERDEFS_MYZVEL:
if(bSet)
myzvel = lValue;
else
SetGameVarID((int)lVar2, myzvel, sActor, sPlayer);
break;
case USERDEFS_MYHORIZ:
if(bSet)
myhoriz = lValue;
else
SetGameVarID((int)lVar2, myhoriz, sActor, sPlayer);
break;
case USERDEFS_OMYHORIZ:
if(bSet)
omyhoriz = lValue;
else
SetGameVarID((int)lVar2, omyhoriz, sActor, sPlayer);
break;
case USERDEFS_MYHORIZOFF:
if(bSet)
myhorizoff = lValue;
else
SetGameVarID((int)lVar2, myhorizoff, sActor, sPlayer);
break;
case USERDEFS_OMYHORIZOFF:
if(bSet)
omyhorizoff = lValue;
else
SetGameVarID((int)lVar2, omyhorizoff, sActor, sPlayer);
break;
case USERDEFS_MYANG:
if(bSet)
myang = lValue;
else
SetGameVarID((int)lVar2, myang, sActor, sPlayer);
break;
case USERDEFS_OMYANG:
if(bSet)
omyang = lValue;
else
SetGameVarID((int)lVar2, omyang, sActor, sPlayer);
break;
case USERDEFS_MYCURSECTNUM:
if(bSet)
mycursectnum = lValue;
else
SetGameVarID((int)lVar2, mycursectnum, sActor, sPlayer);
break;
case USERDEFS_MYJUMPINGCOUNTER:
if(bSet)
myjumpingcounter = lValue;
else
SetGameVarID((int)lVar2, myjumpingcounter, sActor, sPlayer);
break;
case USERDEFS_MYJUMPINGTOGGLE:
if(bSet)
myjumpingtoggle = lValue;
else
SetGameVarID((int)lVar2, myjumpingtoggle, sActor, sPlayer);
break;
case USERDEFS_MYONGROUND:
if(bSet)
myonground = lValue;
else
SetGameVarID((int)lVar2, myonground, sActor, sPlayer);
break;
case USERDEFS_MYHARDLANDING:
if(bSet)
myhardlanding = lValue;
else
SetGameVarID((int)lVar2, myhardlanding, sActor, sPlayer);
break;
case USERDEFS_MYRETURNTOCENTER:
if(bSet)
myreturntocenter = lValue;
else
SetGameVarID((int)lVar2, myreturntocenter, sActor, sPlayer);
break;
default: default:
break; break;
} }
@ -5813,8 +5960,6 @@ good:
lVar3=*insptr++; lVar3=*insptr++;
lSprite=GetGameVarID(lVar1, g_i, g_p); lSprite=GetGameVarID(lVar1, g_i, g_p);
if(lSprite >= 0)
{
switch(tw) switch(tw)
{ {
case CON_SETACTORVAR: case CON_SETACTORVAR:
@ -5826,7 +5971,6 @@ good:
SetGameVarID(lVar3, lTemp, g_i, g_p); SetGameVarID(lVar3, lTemp, g_i, g_p);
break; break;
} }
}
break; break;
} }
@ -5846,8 +5990,6 @@ good:
lVar3=*insptr++; lVar3=*insptr++;
lSprite=GetGameVarID(lVar1, g_i, g_p); lSprite=GetGameVarID(lVar1, g_i, g_p);
if(lSprite >= 0)
{
switch(tw) switch(tw)
{ {
case CON_SETPLAYERVAR: case CON_SETPLAYERVAR:
@ -5859,7 +6001,6 @@ good:
SetGameVarID(lVar3, lTemp, g_i, g_p); SetGameVarID(lVar3, lTemp, g_i, g_p);
break; break;
} }
}
break; break;
} }
@ -6686,9 +6827,8 @@ good:
} }
default: default:
Bsprintf(tempbuf,"fatal error: Default processing in parse(): %ld, %ld\ncurrent actor: %d %d",*insptr,*(insptr-1),g_i,g_sp->picnum); OSD_Printf("fatal error: default processing: %ld, %ld\ncurrent actor: %d (%d)\n",*insptr,*(insptr-1),g_i,g_sp->picnum);
AddLog(tempbuf); gameexit("An error has occurred in the EDuke32 CON executor.\n\nPlease mail all of your CON files along with the file eduke32.log\nto terminx@gmail.com.\n\nThank you.");
gameexit("An error has occurred in the EDuke32 CON parser.\n\nPlease mail all of your CON files along with the file eduke32.log\nto terminx@gmail.com.\n\nThank you.");
break; break;
} }
return 0; return 0;

View file

@ -38,7 +38,7 @@ int loadpheader(char spot,struct savehead *saveh)
if(kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt; if(kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt;
if(kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt; if(kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt;
g_szBuf[bv]=0; g_szBuf[bv]=0;
AddLog(g_szBuf); // AddLog(g_szBuf);
if (kdfread(&bv,4,1,fil) != 1) goto corrupt; if (kdfread(&bv,4,1,fil) != 1) goto corrupt;
if(bv != BYTEVERSION) { if(bv != BYTEVERSION) {
@ -113,7 +113,7 @@ int loadplayer(signed char spot)
if(kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt; if(kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt;
if(kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt; if(kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt;
g_szBuf[bv]=0; g_szBuf[bv]=0;
AddLog(g_szBuf); // AddLog(g_szBuf);
if (kdfread(&bv,4,1,fil) != 1) return -1; if (kdfread(&bv,4,1,fil) != 1) return -1;
if(bv != BYTEVERSION) if(bv != BYTEVERSION)