mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
Give most of the gamevar stuff its own object
git-svn-id: https://svn.eduke32.com/eduke32@398 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6b7ef5cd75
commit
169e0c824b
18 changed files with 1794 additions and 1895 deletions
|
@ -3489,6 +3489,20 @@ BOLT:
|
|||
}
|
||||
}
|
||||
|
||||
static short LocateTheLocator(short n,short sn)
|
||||
{
|
||||
short i;
|
||||
|
||||
i = headspritestat[7];
|
||||
while (i >= 0)
|
||||
{
|
||||
if ((sn == -1 || sn == SECT) && n == SLT)
|
||||
return i;
|
||||
i = nextspritestat[i];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void moveactors(void)
|
||||
{
|
||||
long x, m, l, *t;
|
||||
|
|
|
@ -149,7 +149,7 @@ char *Help3d[]= {
|
|||
" END = PGUP/PGDN MODIFIER (512 UNITS)",
|
||||
};
|
||||
|
||||
long GetTime(void)
|
||||
static inline long GetTime(void)
|
||||
{
|
||||
return totalclock;
|
||||
}
|
||||
|
@ -1061,7 +1061,7 @@ void ExtShowWallData(short wallnum) //F6
|
|||
PrintStatus("Boss4 =",numsprite[BOSS4],x,y+8,11);
|
||||
}// end ExtShowWallData
|
||||
|
||||
void Show2dText(char *name)
|
||||
static void Show2dText(char *name)
|
||||
{
|
||||
int fp,t;
|
||||
unsigned char x=0,y=4,xmax=0,xx=0,col=0;
|
||||
|
@ -1107,7 +1107,7 @@ void Show2dText(char *name)
|
|||
|
||||
}// end Show2dText
|
||||
|
||||
void Show3dText(char *name)
|
||||
static void Show3dText(char *name)
|
||||
{
|
||||
int fp,t;
|
||||
unsigned char x=0,y=4,xmax=0,xx=0,col=0;
|
||||
|
@ -1151,7 +1151,7 @@ void Show3dText(char *name)
|
|||
kclose(fp);
|
||||
}// end Show3dText
|
||||
|
||||
void ShowHelpText(char *name)
|
||||
static void ShowHelpText(char *name)
|
||||
{
|
||||
BFILE *fp;
|
||||
char x=0,y=4;
|
||||
|
@ -1207,7 +1207,7 @@ void ExtShowSpriteData(short spritenum) //F6
|
|||
|
||||
int fofsizex = -1;
|
||||
int fofsizey = -1;
|
||||
void ResetFOFSize()
|
||||
static void ResetFOFSize()
|
||||
{
|
||||
if (fofsizex != -1) tilesizx[FOF] = fofsizex;
|
||||
if (fofsizey != -1) tilesizy[FOF] = fofsizey;
|
||||
|
@ -1368,7 +1368,7 @@ static void ExtSE40Draw(int spnum,long x,long y,long z,short a,short h)
|
|||
|
||||
} // end SE40
|
||||
|
||||
void ExtSE40Code(long x,long y,long z,long a,long h)
|
||||
static void SE40Code(long x,long y,long z,long a,long h)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1459,7 +1459,7 @@ void ExtEditSpriteData(short spritenum) //F8
|
|||
else EditSpriteData(spritenum);
|
||||
}
|
||||
|
||||
void PrintStatus(char *string,int num,char x,char y,char color)
|
||||
static void PrintStatus(char *string,int num,char x,char y,char color)
|
||||
{
|
||||
Bsprintf(tempbuf,"%s %d",string,num);
|
||||
begindrawing();
|
||||
|
@ -1467,12 +1467,12 @@ void PrintStatus(char *string,int num,char x,char y,char color)
|
|||
enddrawing();
|
||||
}
|
||||
|
||||
void SpriteName(short spritenum, char *lo2)
|
||||
static inline void SpriteName(short spritenum, char *lo2)
|
||||
{
|
||||
Bsprintf(lo2,names[sprite[spritenum].picnum]);
|
||||
}// end SpriteName
|
||||
|
||||
void ReadPaletteTable()
|
||||
static void ReadPaletteTable()
|
||||
{
|
||||
int i,j,fp;
|
||||
char lookup_num;
|
||||
|
@ -1499,14 +1499,9 @@ void ReadPaletteTable()
|
|||
tempbuf[j] = j;
|
||||
num_tables++;
|
||||
makepalookup(num_tables, tempbuf, 15, 15, 15, 1);
|
||||
num_tables++;
|
||||
makepalookup(num_tables, tempbuf, 15, 0, 0, 1);
|
||||
num_tables++;
|
||||
makepalookup(num_tables, tempbuf, 0, 15, 0, 1);
|
||||
num_tables++;
|
||||
makepalookup(num_tables, tempbuf, 0, 0, 15, 1);
|
||||
|
||||
num_tables -= 3;
|
||||
makepalookup(num_tables + 1, tempbuf, 15, 0, 0, 1);
|
||||
makepalookup(num_tables + 2, tempbuf, 0, 15, 0, 1);
|
||||
makepalookup(num_tables + 3, tempbuf, 0, 0, 15, 1);
|
||||
|
||||
kread(fp,WATERpalette,768);
|
||||
kread(fp,SLIMEpalette,768);
|
||||
|
@ -1517,7 +1512,7 @@ void ReadPaletteTable()
|
|||
initprintf("success.\n");
|
||||
}// end ReadPaletteTable
|
||||
|
||||
void ReadGamePalette()
|
||||
static void ReadGamePalette()
|
||||
{
|
||||
int i,fp;
|
||||
if ((fp=kopen4load("palette.dat",0)) == -1)
|
||||
|
@ -1536,14 +1531,14 @@ void ReadGamePalette()
|
|||
ReadPaletteTable();
|
||||
}
|
||||
|
||||
void _message(char message[162])
|
||||
static inline void _message(char message[162])
|
||||
{
|
||||
Bsprintf(getmessage,message);
|
||||
getmessageleng = strlen(getmessage);
|
||||
getmessagetimeoff = totalclock+120*5;
|
||||
}
|
||||
|
||||
void message(char message[162])
|
||||
static void message(char message[162])
|
||||
{
|
||||
char tmpbuf[2048];
|
||||
|
||||
|
@ -1558,7 +1553,7 @@ static char lockbyte4094;
|
|||
|
||||
long lastupdate, mousecol, mouseadd = 1, bstatus;
|
||||
|
||||
void m32_showmouse(void)
|
||||
static void m32_showmouse(void)
|
||||
{
|
||||
int i, j, col;
|
||||
|
||||
|
@ -1612,7 +1607,7 @@ void m32_showmouse(void)
|
|||
}
|
||||
}
|
||||
|
||||
int AskIfSure(void)
|
||||
static int AskIfSure(void)
|
||||
{
|
||||
int retval=1;
|
||||
|
||||
|
@ -1648,7 +1643,7 @@ int AskIfSure(void)
|
|||
return(retval);
|
||||
}
|
||||
|
||||
void Keys3d(void)
|
||||
static void Keys3d(void)
|
||||
{
|
||||
long i,count,rate,nexti;
|
||||
long j, k, templong, changedir, hiz, loz;
|
||||
|
@ -3597,7 +3592,7 @@ void Keys3d(void)
|
|||
|
||||
}// end 3d
|
||||
|
||||
void Keys2d(void)
|
||||
static void Keys2d(void)
|
||||
{
|
||||
short temp=0;
|
||||
int i=0, j,k;
|
||||
|
@ -3841,9 +3836,7 @@ void Keys2d(void)
|
|||
|
||||
if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_F]) // ' F
|
||||
{
|
||||
void FuncMenu(void);
|
||||
keystatus[KEYSC_F] = 0;
|
||||
|
||||
FuncMenu();
|
||||
}
|
||||
|
||||
|
@ -4230,7 +4223,7 @@ void ExtSetupSpecialSpriteCols(void)
|
|||
}
|
||||
}
|
||||
|
||||
void InitCustomColors(void)
|
||||
static void InitCustomColors(void)
|
||||
{
|
||||
/* blue */
|
||||
/* vgapal16[9*4+0] = 63;
|
||||
|
@ -4523,7 +4516,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
|
|||
{
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
if (floor_over_floor) ExtSE40Code(posx,posy,posz,ang,horiz);
|
||||
if (floor_over_floor) SE40Code(posx,posy,posz,ang,horiz);
|
||||
if (purpleon) clearview(255);
|
||||
if (sidemode != 0)
|
||||
{
|
||||
|
@ -4670,7 +4663,7 @@ void ExtAnalyzeSprites(void)
|
|||
}
|
||||
}
|
||||
|
||||
void Keys2d3d(void)
|
||||
static void Keys2d3d(void)
|
||||
{
|
||||
int i, j;
|
||||
if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x1e]==1) // ' a
|
||||
|
@ -4852,7 +4845,7 @@ void faketimerhandler(void)
|
|||
}
|
||||
}
|
||||
|
||||
void SetBOSS1Palette()
|
||||
static void SetBOSS1Palette()
|
||||
{
|
||||
if (acurpalette==3) return;
|
||||
acurpalette=3;
|
||||
|
@ -4860,14 +4853,14 @@ void SetBOSS1Palette()
|
|||
}
|
||||
|
||||
|
||||
void SetSLIMEPalette()
|
||||
static void SetSLIMEPalette()
|
||||
{
|
||||
if (acurpalette==2) return;
|
||||
acurpalette=2;
|
||||
kensetpalette(SLIMEpalette);
|
||||
}
|
||||
|
||||
void SetWATERPalette()
|
||||
static void SetWATERPalette()
|
||||
{
|
||||
if (acurpalette==1) return;
|
||||
acurpalette=1;
|
||||
|
@ -4875,14 +4868,14 @@ void SetWATERPalette()
|
|||
}
|
||||
|
||||
|
||||
void SetGAMEPalette()
|
||||
static void SetGAMEPalette()
|
||||
{
|
||||
if (acurpalette==0) return;
|
||||
acurpalette=0;
|
||||
kensetpalette(GAMEpalette);
|
||||
}
|
||||
|
||||
void kensetpalette(char *vgapal)
|
||||
static void kensetpalette(char *vgapal)
|
||||
{
|
||||
long i;
|
||||
char vesapal[1024];
|
||||
|
@ -4897,7 +4890,7 @@ void kensetpalette(char *vgapal)
|
|||
setpalette(0L,256L,vesapal);
|
||||
}
|
||||
|
||||
void SearchSectorsForward()
|
||||
static void SearchSectorsForward()
|
||||
{
|
||||
long ii=0;
|
||||
if (cursector_lotag!=0)
|
||||
|
@ -4920,7 +4913,7 @@ void SearchSectorsForward()
|
|||
printmessage16("> Sector search: none found");
|
||||
}
|
||||
|
||||
void SearchSectorsBackward()
|
||||
static void SearchSectorsBackward()
|
||||
{
|
||||
long ii=0;
|
||||
if (cursector_lotag!=0)
|
||||
|
@ -4944,7 +4937,7 @@ void SearchSectorsBackward()
|
|||
}
|
||||
|
||||
// Build edit originally by Ed Coolidge <semicharm@earthlink.net>
|
||||
void EditSectorData(short sectnum)
|
||||
static void EditSectorData(short sectnum)
|
||||
{
|
||||
char disptext[80];
|
||||
char edittext[80];
|
||||
|
@ -5182,7 +5175,7 @@ void EditSectorData(short sectnum)
|
|||
keystatus[1] = 0;
|
||||
}
|
||||
|
||||
void EditWallData(short wallnum)
|
||||
static void EditWallData(short wallnum)
|
||||
{
|
||||
char disptext[80];
|
||||
char edittext[80];
|
||||
|
@ -5315,7 +5308,7 @@ void EditWallData(short wallnum)
|
|||
keystatus[1] = 0;
|
||||
}
|
||||
|
||||
void EditSpriteData(short spritenum)
|
||||
static void EditSpriteData(short spritenum)
|
||||
{
|
||||
char disptext[80];
|
||||
char edittext[80];
|
||||
|
@ -5667,7 +5660,7 @@ void EditSpriteData(short spritenum)
|
|||
|
||||
// Build edit
|
||||
|
||||
void FuncMenuOpts(void)
|
||||
static void FuncMenuOpts(void)
|
||||
{
|
||||
char snotbuf[80];
|
||||
|
||||
|
@ -5726,7 +5719,7 @@ void FuncMenuOpts(void)
|
|||
printext16(400,ydim-STATUS2DSIZ+96,11,-1,snotbuf,0); */
|
||||
}
|
||||
|
||||
void FuncMenu(void)
|
||||
static void FuncMenu(void)
|
||||
{
|
||||
char disptext[80];
|
||||
unsigned char col=0, row=0, rowmax=7, dispwidth = 24, editval = 0;
|
||||
|
|
|
@ -561,52 +561,6 @@ void CONFIG_SetupJoystick(void)
|
|||
}
|
||||
}
|
||||
|
||||
void readsavenames(void)
|
||||
{
|
||||
long dummy,j;
|
||||
short i;
|
||||
char fn[13];
|
||||
BFILE *fil;
|
||||
|
||||
Bstrcpy(fn,"egam_.sav");
|
||||
|
||||
for (i=0;i<10;i++)
|
||||
{
|
||||
fn[4] = i+'0';
|
||||
if ((fil = Bfopen(fn,"rb")) == NULL) 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(&dummy,4,1,fil) != 1)
|
||||
{
|
||||
Bfclose(fil);
|
||||
continue;
|
||||
}
|
||||
if (dummy != BYTEVERSION)
|
||||
{
|
||||
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;
|
||||
}
|
||||
Bfclose(fil);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
|
|
|
@ -35,8 +35,6 @@ extern void SoundStartup(void);
|
|||
extern void SoundShutdown(void);
|
||||
extern void MusicStartup(void);
|
||||
extern void MusicShutdown(void);
|
||||
extern int USRHOOKS_GetMem(char **ptr,unsigned long size);
|
||||
extern int USRHOOKS_FreeMem(char *ptr);
|
||||
extern void intomenusounds(void);
|
||||
extern void playmusic(char *fn);
|
||||
extern char loadsound(unsigned short num);
|
||||
|
@ -93,66 +91,39 @@ extern void resetweapons(short snum);
|
|||
extern void resetinventory(short snum);
|
||||
extern void newgame(char vn,char ln,char sk);
|
||||
extern void resettimevars(void);
|
||||
extern void genspriteremaps(void);
|
||||
extern void waitforeverybody(void);
|
||||
extern char checksum(long sum);
|
||||
extern char getsound(unsigned short num);
|
||||
extern void cacheit(void);
|
||||
extern void dofrontscreens(char *);
|
||||
extern void clearfifo(void);
|
||||
extern void resetmys(void);
|
||||
extern int enterlevel(char g);
|
||||
extern void backtomenu(void);
|
||||
extern void setpal(struct player_struct *p);
|
||||
extern void incur_damage(struct player_struct *p);
|
||||
extern void quickkill(struct player_struct *p);
|
||||
extern void forceplayerangle(struct player_struct *p);
|
||||
extern void tracers(long x1,long y1,long z1,long x2,long y2,long z2,long n);
|
||||
extern long hits(short i);
|
||||
extern long hitasprite(short i,short *hitsp);
|
||||
extern long hitawall(struct player_struct *p,short *hitw);
|
||||
extern short aim(spritetype *s,short aang,short atwith);
|
||||
extern short shoot(short i,short atwith);
|
||||
extern void displayloogie(short snum);
|
||||
extern void displaymasks(short snum);
|
||||
extern void displayweapon(short snum);
|
||||
extern void getinput(short snum);
|
||||
extern char doincrements(struct player_struct *p);
|
||||
extern void checkweapons(struct player_struct *p);
|
||||
extern void processinput(short snum);
|
||||
extern void cmenu(short cm);
|
||||
extern void savetemp(char *fn,long daptr,long dasiz);
|
||||
extern void getangplayers(short snum);
|
||||
// extern int loadpheader(char spot,int32 *vn,int32 *ln,int32 *psk,int32 *numplr);
|
||||
extern int loadplayer(signed char spot);
|
||||
extern int saveplayer(signed char spot);
|
||||
extern void sendgameinfo(void);
|
||||
extern int probe(int x,int y,int i,int n);
|
||||
extern int menutext(int x,int y,short s,short p,char *t);
|
||||
extern void bar(int x,int y,short *p,short dainc,char damodify,short s,short pa);
|
||||
extern void barsm(int x,int y,short *p,short dainc,char damodify,short s,short pa);
|
||||
extern void dispnames(void);
|
||||
extern int getfilenames(char *path, char kind[]);
|
||||
extern void sortfilenames(void);
|
||||
extern void menus(void);
|
||||
extern void palto(char r,char g,char b,long e);
|
||||
extern void playanm(char *fn,char);
|
||||
extern short getincangle(short a,short na);
|
||||
extern char ispecial(char c);
|
||||
extern char isaltok(char c);
|
||||
extern void getglobalz(short sActor);
|
||||
extern void makeitfall(short sActor);
|
||||
extern void getlabel(void);
|
||||
extern long keyword(void);
|
||||
extern long transword(void);
|
||||
extern long transnum(long type);
|
||||
extern char parsecommand(void);
|
||||
extern void passone(void);
|
||||
extern void loadefs(char *fn);
|
||||
extern short furthestangle(short sActor,short angs);
|
||||
extern void execute(const short *sActor,const short *sPlayer,const long *lDist);
|
||||
extern void overwritesprite(long thex,long they,short tilenum,signed char shade,char stat,char dapalnum);
|
||||
extern void timerhandler(void);
|
||||
extern int gametext(int x,int y,char *t,char s,short dabits);
|
||||
extern int gametextpal(int x,int y,char *t,char s,char p);
|
||||
extern int minitext(int x,int y,char *t,char p,short sb);
|
||||
|
@ -165,32 +136,22 @@ extern short badguy(spritetype *s);
|
|||
extern short badguypic(short pn);
|
||||
extern void myos(long x,long y,short tilenum,signed char shade,char orientation);
|
||||
extern void myospal(long x,long y,short tilenum,signed char shade,char orientation,char p);
|
||||
extern void scratchmarks(long x,long y,long n,char s,char p);
|
||||
extern void clocks(void);
|
||||
extern void displayfragbar(void);
|
||||
extern void FTA(short q,struct player_struct *p);
|
||||
extern void binscreen(void);
|
||||
extern void gameexit(char *t);
|
||||
extern short strget(short x,short y,char *t,short dalen,short c);
|
||||
extern void displayrest(long smoothratio);
|
||||
extern void updatesectorz(long x,long y,long z,short *sectnum);
|
||||
extern void drawbackground(void);
|
||||
extern void displayrooms(short snum,long smoothratio);
|
||||
extern short LocateTheLocator(short n,short sn);
|
||||
extern short EGS(short whatsect,long s_x,long s_y,long s_z,short s_pn,signed char s_s,signed char s_xr,signed char s_yr,short s_a,short s_ve,long s_zv,short s_ow,signed char s_ss);
|
||||
extern char wallswitchcheck(short i);
|
||||
extern short spawn(short j,short pn);
|
||||
extern void animatesprites(long x,long y,short a,long smoothratio);
|
||||
extern void cheats(void);
|
||||
extern void nonsharedkeys(void);
|
||||
extern void comlinehelp(void);
|
||||
extern void checkcommandline(int argc,char **argv);
|
||||
extern void printstr(short x,short y,char string[],char attribute);
|
||||
extern void Logo(void);
|
||||
extern void loadtmb(void);
|
||||
extern void compilecons(void);
|
||||
extern void Startup(long argc, char **argv);
|
||||
extern void getnames(void);
|
||||
extern int main(int argc,char **argv);
|
||||
extern void opendemowrite(void);
|
||||
extern void closedemowrite(void);
|
||||
|
@ -200,11 +161,6 @@ extern void spriteglass(short i,short n);
|
|||
extern void ceilingglass(short i,short sectnum,short n);
|
||||
extern void lotsofcolourglass(short i,short wallnum,short n);
|
||||
extern long GetTime(void);
|
||||
extern void CenterCenter(void);
|
||||
extern void UpperLeft(void);
|
||||
extern void LowerRight(void);
|
||||
extern void CenterThrottle(void);
|
||||
extern void CenterRudder(void);
|
||||
extern void CONFIG_GetSetupFilename(void);
|
||||
extern int32 CONFIG_FunctionNameToNum(char *func);
|
||||
extern char *CONFIG_FunctionNumToName(int32 func);
|
||||
|
@ -215,12 +171,6 @@ extern void CONFIG_ReadKeys(void);
|
|||
extern void readsavenames(void);
|
||||
extern int32 CONFIG_ReadSetup(void);
|
||||
extern void CONFIG_WriteSetup(void);
|
||||
extern void CheckAnimStarted(char *funcname);
|
||||
extern uint16 findpage(uint16 framenumber);
|
||||
extern void loadpage(uint16 pagenumber,uint16 *pagepointer);
|
||||
extern void CPlayRunSkipDump(char *srcP,char *dstP);
|
||||
extern void renderframe(uint16 framenumber,uint16 *pagepointer);
|
||||
extern void drawframe(uint16 framenumber);
|
||||
extern void updateinterpolations(void);
|
||||
extern void setinterpolation(long *posptr);
|
||||
extern void stopinterpolation(long *posptr);
|
||||
|
@ -258,14 +208,11 @@ extern void fadepal(int r, int g, int b, int start, int end, int step);
|
|||
extern int minitextshade(int x,int y,char *t,char s,char p,short sb);
|
||||
extern int gametext_(int small, int starttile, int x,int y,char *t,char s,char p,short orientation,long x1, long y1, long x2, long y2);
|
||||
extern void txdigitalnumber(short starttile, long x,long y,long n,char s,char pal,char cs,long x1, long y1, long x2, long y2);
|
||||
extern long txdist(spritetype *s1,spritetype *s2);
|
||||
extern void myosx(long x,long y,short tilenum,signed char shade,char orientation);
|
||||
extern void myospalx(long x,long y,short tilenum,signed char shade,char orientation,char p);
|
||||
extern void ResetGameVars(void);
|
||||
extern void ResetActorGameVars(short sActor);
|
||||
|
||||
extern void sanitizegametype();
|
||||
// extern void readnames();
|
||||
extern void setupdynamictostatic();
|
||||
extern void processnames(char *szLabel, long lValue);
|
||||
|
||||
|
@ -281,9 +228,10 @@ extern void InitGameVars(void);
|
|||
extern void SaveGameVars(FILE *fil);
|
||||
extern int ReadGameVars(long fil);
|
||||
|
||||
extern int GetGameID(char *szGameLabel);
|
||||
extern long GetGameVarID(int id, short sActor, short sPlayer);
|
||||
extern void SetGameVarID(int id, long lValue, short sActor, short sPlayer);
|
||||
extern char AddGameVar(char *pszLabel, long lValue, unsigned long dwFlags);
|
||||
extern void ReportError(int iError);
|
||||
|
||||
extern void onvideomodechange(int newmode);
|
||||
|
||||
|
@ -299,6 +247,4 @@ extern void sendquit(void);
|
|||
extern void adduserquote(char *daquote);
|
||||
extern char *strip_color_codes(char *t);
|
||||
|
||||
extern void get_level_from_filename(char *fn, int *volume, int *level);
|
||||
|
||||
#endif // __funct_h__
|
||||
|
|
|
@ -510,137 +510,6 @@ void getpackets(void)
|
|||
#endif
|
||||
switch (packbuf[0])
|
||||
{
|
||||
case 254:
|
||||
//slaves in M/S mode only send to master
|
||||
if (myconnectindex == connecthead)
|
||||
{
|
||||
//Master re-transmits message to all others
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other)
|
||||
sendpacket(i,packbuf,packbufleng);
|
||||
}
|
||||
/*
|
||||
j = packbuf[1];
|
||||
playerquitflag[j] = 0;
|
||||
|
||||
j = -1;
|
||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
||||
{
|
||||
if (playerquitflag[i]) { j = i; continue; }
|
||||
|
||||
if (i == connecthead) connecthead = connectpoint2[connecthead];
|
||||
else connectpoint2[j] = connectpoint2[i];
|
||||
|
||||
numplayers--;
|
||||
ud.multimode--;
|
||||
|
||||
Bsprintf(buf,"%s is history!",ud.user_name[i]);
|
||||
adduserquote(buf);
|
||||
|
||||
if (numplayers < 2)
|
||||
sound(GENERIC_AMBIENCE17);
|
||||
|
||||
if(i == 0 && networkmode == 0) */
|
||||
gameexit("Game aborted from menu; disconnected.");
|
||||
// }
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
//slaves in M/S mode only send to master
|
||||
if (myconnectindex == connecthead)
|
||||
{
|
||||
//Master re-transmits message to all others
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other)
|
||||
sendpacket(i,packbuf,packbufleng);
|
||||
}
|
||||
|
||||
Bstrcpy(boardfilename,packbuf+1);
|
||||
boardfilename[packbufleng-1] = 0;
|
||||
if (boardfilename[0] != 0)
|
||||
{
|
||||
if ((i = kopen4load(boardfilename,0)) < 0)
|
||||
{
|
||||
Bmemset(boardfilename,0,sizeof(boardfilename));
|
||||
sendboardname();
|
||||
}
|
||||
else kclose(i);
|
||||
}
|
||||
|
||||
if (ud.m_level_number == 7 && ud.m_volume_number == 0 && boardfilename[0] == 0)
|
||||
ud.m_level_number = 0;
|
||||
|
||||
break;
|
||||
|
||||
case 18: // map vote
|
||||
|
||||
if (myconnectindex == connecthead)
|
||||
{
|
||||
//Master re-transmits message to all others
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other)
|
||||
sendpacket(i,packbuf,packbufleng);
|
||||
}
|
||||
|
||||
switch (packbuf[1])
|
||||
{
|
||||
case 0:
|
||||
if (voting == myconnectindex && gotvote[(unsigned char)packbuf[2]] == 0)
|
||||
{
|
||||
gotvote[(unsigned char)packbuf[2]] = 1;
|
||||
votes[(unsigned char)packbuf[2]] = packbuf[3];
|
||||
Bsprintf(tempbuf,"GOT VOTE FROM %s",ud.user_name[(unsigned char)packbuf[2]]);
|
||||
adduserquote(tempbuf);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: // call map vote
|
||||
voting = packbuf[2];
|
||||
vote_episode = packbuf[3];
|
||||
vote_map = packbuf[4];
|
||||
Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",ud.user_name[(unsigned char)packbuf[2]],level_names[(unsigned char)(packbuf[3]*MAXLEVELS + packbuf[4])],packbuf[3]+1,packbuf[4]+1);
|
||||
adduserquote(tempbuf);
|
||||
Bsprintf(tempbuf,"PRESS F1 TO VOTE YES, F2 TO VOTE NO");
|
||||
adduserquote(tempbuf);
|
||||
Bmemset(votes,0,sizeof(votes));
|
||||
Bmemset(gotvote,0,sizeof(gotvote));
|
||||
gotvote[voting] = votes[voting] = 1;
|
||||
break;
|
||||
|
||||
case 2: // cancel map vote
|
||||
if (voting == packbuf[2])
|
||||
{
|
||||
voting = -1;
|
||||
i = 0;
|
||||
for (j=0;j<MAXPLAYERS;j++)
|
||||
i += gotvote[j];
|
||||
|
||||
if (i != numplayers)
|
||||
Bsprintf(tempbuf,"%s^00 HAS CANCELED THE VOTE",ud.user_name[(unsigned char)packbuf[2]]);
|
||||
else Bsprintf(tempbuf,"VOTE FAILED");
|
||||
Bmemset(votes,0,sizeof(votes));
|
||||
Bmemset(gotvote,0,sizeof(gotvote));
|
||||
adduserquote(tempbuf);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 126:
|
||||
//Slaves in M/S mode only send to master
|
||||
//Master re-transmits message to all others
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other) sendpacket(i,packbuf,packbufleng);
|
||||
|
||||
multiflag = 2;
|
||||
multiwhat = 0;
|
||||
multiwho = packbuf[2]; //other: need to send in m/s mode because of possible re-transmit
|
||||
multipos = packbuf[1];
|
||||
loadplayer(multipos);
|
||||
multiflag = 0;
|
||||
break;
|
||||
case 0: //[0] (receive master sync buffer)
|
||||
j = 1;
|
||||
|
||||
|
@ -748,134 +617,6 @@ void getpackets(void)
|
|||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
//slaves in M/S mode only send to master
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
{
|
||||
if (packbuf[1] == 255)
|
||||
{
|
||||
//Master re-transmits message to all others
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other)
|
||||
sendpacket(i,packbuf,packbufleng);
|
||||
}
|
||||
else if (((long)packbuf[1]) != myconnectindex)
|
||||
{
|
||||
//Master re-transmits message not intended for master
|
||||
sendpacket((long)packbuf[1],packbuf,packbufleng);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Bstrcpy(recbuf,packbuf+2);
|
||||
recbuf[packbufleng-2] = 0;
|
||||
|
||||
adduserquote(recbuf);
|
||||
sound(EXITMENUSOUND);
|
||||
|
||||
pus = NUMPAGES;
|
||||
pub = NUMPAGES;
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
//Slaves in M/S mode only send to master
|
||||
//Master re-transmits message to all others
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other) sendpacket(i,packbuf,packbufleng);
|
||||
|
||||
if (vote_map != -1 || vote_episode != -1 || voting != -1)
|
||||
adduserquote("VOTE SUCCEEDED");
|
||||
|
||||
ud.m_level_number = ud.level_number = packbuf[1];
|
||||
ud.m_volume_number = ud.volume_number = packbuf[2];
|
||||
ud.m_player_skill = ud.player_skill = packbuf[3];
|
||||
ud.m_monsters_off = ud.monsters_off = packbuf[4];
|
||||
ud.m_respawn_monsters = ud.respawn_monsters = packbuf[5];
|
||||
ud.m_respawn_items = ud.respawn_items = packbuf[6];
|
||||
ud.m_respawn_inventory = ud.respawn_inventory = packbuf[7];
|
||||
ud.m_coop = packbuf[8];
|
||||
ud.m_marker = ud.marker = packbuf[9];
|
||||
ud.m_ffire = ud.ffire = packbuf[10];
|
||||
ud.m_noexits = ud.noexits = packbuf[11];
|
||||
|
||||
for (i=connecthead;i>=0;i=connectpoint2[i])
|
||||
{
|
||||
resetweapons(i);
|
||||
resetinventory(i);
|
||||
}
|
||||
|
||||
newgame(ud.volume_number,ud.level_number,ud.player_skill);
|
||||
ud.coop = ud.m_coop;
|
||||
|
||||
if (enterlevel(MODE_GAME)) backtomenu();
|
||||
|
||||
break;
|
||||
case 6:
|
||||
//slaves in M/S mode only send to master
|
||||
//Master re-transmits message to all others
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other) sendpacket(i,packbuf,packbufleng);
|
||||
|
||||
if (packbuf[2] != BYTEVERSION)
|
||||
gameexit("\nYou cannot play Duke with different versions.");
|
||||
|
||||
other = packbuf[1];
|
||||
|
||||
for (i=3;packbuf[i];i++)
|
||||
ud.user_name[other][i-3] = packbuf[i];
|
||||
ud.user_name[other][i-3] = 0;
|
||||
i++;
|
||||
|
||||
ps[other].aim_mode = packbuf[i++];
|
||||
ps[other].auto_aim = packbuf[i++];
|
||||
ps[other].weaponswitch = packbuf[i++];
|
||||
ps[other].palookup = ud.pcolor[other] = packbuf[i++];
|
||||
ud.pteam[other] = packbuf[i++];
|
||||
|
||||
/* if(ps[other].team != j && sprite[ps[other].i].picnum == APLAYER)
|
||||
{
|
||||
hittype[ps[other].i].extra = 1000;
|
||||
hittype[ps[other].i].picnum = APLAYERTOP;
|
||||
} */
|
||||
|
||||
break;
|
||||
case 10:
|
||||
//slaves in M/S mode only send to master
|
||||
//Master re-transmits message to all others
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other) sendpacket(i,packbuf,packbufleng);
|
||||
|
||||
other = packbuf[1];
|
||||
|
||||
i = 2;
|
||||
|
||||
j = i; //This used to be Duke packet #9... now concatenated with Duke packet #6
|
||||
for (;i-j<10;i++) ud.wchoice[other][i-j] = packbuf[i];
|
||||
|
||||
break;
|
||||
case 7:
|
||||
//slaves in M/S mode only send to master
|
||||
//Master re-transmits message to all others
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other) sendpacket(i,packbuf,packbufleng);
|
||||
|
||||
if (numlumps == 0) break;
|
||||
|
||||
if (SoundToggle == 0 || ud.lockout == 1 || FXDevice < 0)
|
||||
break;
|
||||
rtsptr = (char *)RTS_GetSound(packbuf[1]-1);
|
||||
if (*rtsptr == 'C')
|
||||
FX_PlayVOC3D(rtsptr,0,0,0,255,-packbuf[1]);
|
||||
else
|
||||
FX_PlayWAV3D(rtsptr,0,0,0,255,-packbuf[1]);
|
||||
rtsplaying = 7;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
movefifoend[other] = movefifoplc = movefifosendplc = fakemovefifoplc = 0;
|
||||
syncvalhead[other] = syncvaltottail = 0L;
|
||||
|
@ -939,6 +680,270 @@ void getpackets(void)
|
|||
case 255:
|
||||
gameexit(" ");
|
||||
break;
|
||||
default:
|
||||
switch (packbuf[0])
|
||||
{
|
||||
case 4:
|
||||
//slaves in M/S mode only send to master
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
{
|
||||
if (packbuf[1] == 255)
|
||||
{
|
||||
//Master re-transmits message to all others
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other)
|
||||
sendpacket(i,packbuf,packbufleng);
|
||||
}
|
||||
else if (((long)packbuf[1]) != myconnectindex)
|
||||
{
|
||||
//Master re-transmits message not intended for master
|
||||
sendpacket((long)packbuf[1],packbuf,packbufleng);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Bstrcpy(recbuf,packbuf+2);
|
||||
recbuf[packbufleng-2] = 0;
|
||||
|
||||
adduserquote(recbuf);
|
||||
sound(EXITMENUSOUND);
|
||||
|
||||
pus = NUMPAGES;
|
||||
pub = NUMPAGES;
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
//Slaves in M/S mode only send to master
|
||||
//Master re-transmits message to all others
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other) sendpacket(i,packbuf,packbufleng);
|
||||
|
||||
if (vote_map != -1 || vote_episode != -1 || voting != -1)
|
||||
adduserquote("VOTE SUCCEEDED");
|
||||
|
||||
ud.m_level_number = ud.level_number = packbuf[1];
|
||||
ud.m_volume_number = ud.volume_number = packbuf[2];
|
||||
ud.m_player_skill = ud.player_skill = packbuf[3];
|
||||
ud.m_monsters_off = ud.monsters_off = packbuf[4];
|
||||
ud.m_respawn_monsters = ud.respawn_monsters = packbuf[5];
|
||||
ud.m_respawn_items = ud.respawn_items = packbuf[6];
|
||||
ud.m_respawn_inventory = ud.respawn_inventory = packbuf[7];
|
||||
ud.m_coop = packbuf[8];
|
||||
ud.m_marker = ud.marker = packbuf[9];
|
||||
ud.m_ffire = ud.ffire = packbuf[10];
|
||||
ud.m_noexits = ud.noexits = packbuf[11];
|
||||
|
||||
for (i=connecthead;i>=0;i=connectpoint2[i])
|
||||
{
|
||||
resetweapons(i);
|
||||
resetinventory(i);
|
||||
}
|
||||
|
||||
newgame(ud.volume_number,ud.level_number,ud.player_skill);
|
||||
ud.coop = ud.m_coop;
|
||||
|
||||
if (enterlevel(MODE_GAME)) backtomenu();
|
||||
|
||||
break;
|
||||
case 6:
|
||||
//slaves in M/S mode only send to master
|
||||
//Master re-transmits message to all others
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other) sendpacket(i,packbuf,packbufleng);
|
||||
|
||||
if (packbuf[2] != BYTEVERSION)
|
||||
gameexit("\nYou cannot play Duke with different versions.");
|
||||
|
||||
other = packbuf[1];
|
||||
|
||||
for (i=3;packbuf[i];i++)
|
||||
ud.user_name[other][i-3] = packbuf[i];
|
||||
ud.user_name[other][i-3] = 0;
|
||||
i++;
|
||||
|
||||
ps[other].aim_mode = packbuf[i++];
|
||||
ps[other].auto_aim = packbuf[i++];
|
||||
ps[other].weaponswitch = packbuf[i++];
|
||||
ps[other].palookup = ud.pcolor[other] = packbuf[i++];
|
||||
ud.pteam[other] = packbuf[i++];
|
||||
|
||||
/* if(ps[other].team != j && sprite[ps[other].i].picnum == APLAYER)
|
||||
{
|
||||
hittype[ps[other].i].extra = 1000;
|
||||
hittype[ps[other].i].picnum = APLAYERTOP;
|
||||
} */
|
||||
|
||||
break;
|
||||
case 10:
|
||||
//slaves in M/S mode only send to master
|
||||
//Master re-transmits message to all others
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other) sendpacket(i,packbuf,packbufleng);
|
||||
|
||||
other = packbuf[1];
|
||||
|
||||
i = 2;
|
||||
|
||||
j = i; //This used to be Duke packet #9... now concatenated with Duke packet #6
|
||||
for (;i-j<10;i++) ud.wchoice[other][i-j] = packbuf[i];
|
||||
|
||||
break;
|
||||
case 7:
|
||||
//slaves in M/S mode only send to master
|
||||
//Master re-transmits message to all others
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other) sendpacket(i,packbuf,packbufleng);
|
||||
|
||||
if (numlumps == 0) break;
|
||||
|
||||
if (SoundToggle == 0 || ud.lockout == 1 || FXDevice < 0)
|
||||
break;
|
||||
rtsptr = (char *)RTS_GetSound(packbuf[1]-1);
|
||||
if (*rtsptr == 'C')
|
||||
FX_PlayVOC3D(rtsptr,0,0,0,255,-packbuf[1]);
|
||||
else
|
||||
FX_PlayWAV3D(rtsptr,0,0,0,255,-packbuf[1]);
|
||||
rtsplaying = 7;
|
||||
break;
|
||||
|
||||
case 254:
|
||||
//slaves in M/S mode only send to master
|
||||
if (myconnectindex == connecthead)
|
||||
{
|
||||
//Master re-transmits message to all others
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other)
|
||||
sendpacket(i,packbuf,packbufleng);
|
||||
}
|
||||
/*
|
||||
j = packbuf[1];
|
||||
playerquitflag[j] = 0;
|
||||
|
||||
j = -1;
|
||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
||||
{
|
||||
if (playerquitflag[i]) { j = i; continue; }
|
||||
|
||||
if (i == connecthead) connecthead = connectpoint2[connecthead];
|
||||
else connectpoint2[j] = connectpoint2[i];
|
||||
|
||||
numplayers--;
|
||||
ud.multimode--;
|
||||
|
||||
Bsprintf(buf,"%s is history!",ud.user_name[i]);
|
||||
adduserquote(buf);
|
||||
|
||||
if (numplayers < 2)
|
||||
sound(GENERIC_AMBIENCE17);
|
||||
|
||||
if(i == 0 && networkmode == 0) */
|
||||
gameexit("Game aborted from menu; disconnected.");
|
||||
// }
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
//slaves in M/S mode only send to master
|
||||
if (myconnectindex == connecthead)
|
||||
{
|
||||
//Master re-transmits message to all others
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other)
|
||||
sendpacket(i,packbuf,packbufleng);
|
||||
}
|
||||
|
||||
Bstrcpy(boardfilename,packbuf+1);
|
||||
boardfilename[packbufleng-1] = 0;
|
||||
if (boardfilename[0] != 0)
|
||||
{
|
||||
if ((i = kopen4load(boardfilename,0)) < 0)
|
||||
{
|
||||
Bmemset(boardfilename,0,sizeof(boardfilename));
|
||||
sendboardname();
|
||||
}
|
||||
else kclose(i);
|
||||
}
|
||||
|
||||
if (ud.m_level_number == 7 && ud.m_volume_number == 0 && boardfilename[0] == 0)
|
||||
ud.m_level_number = 0;
|
||||
|
||||
break;
|
||||
|
||||
case 18: // map vote
|
||||
|
||||
if (myconnectindex == connecthead)
|
||||
{
|
||||
//Master re-transmits message to all others
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other)
|
||||
sendpacket(i,packbuf,packbufleng);
|
||||
}
|
||||
|
||||
switch (packbuf[1])
|
||||
{
|
||||
case 0:
|
||||
if (voting == myconnectindex && gotvote[(unsigned char)packbuf[2]] == 0)
|
||||
{
|
||||
gotvote[(unsigned char)packbuf[2]] = 1;
|
||||
votes[(unsigned char)packbuf[2]] = packbuf[3];
|
||||
Bsprintf(tempbuf,"GOT VOTE FROM %s",ud.user_name[(unsigned char)packbuf[2]]);
|
||||
adduserquote(tempbuf);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: // call map vote
|
||||
voting = packbuf[2];
|
||||
vote_episode = packbuf[3];
|
||||
vote_map = packbuf[4];
|
||||
Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",ud.user_name[(unsigned char)packbuf[2]],level_names[(unsigned char)(packbuf[3]*MAXLEVELS + packbuf[4])],packbuf[3]+1,packbuf[4]+1);
|
||||
adduserquote(tempbuf);
|
||||
Bsprintf(tempbuf,"PRESS F1 TO VOTE YES, F2 TO VOTE NO");
|
||||
adduserquote(tempbuf);
|
||||
Bmemset(votes,0,sizeof(votes));
|
||||
Bmemset(gotvote,0,sizeof(gotvote));
|
||||
gotvote[voting] = votes[voting] = 1;
|
||||
break;
|
||||
|
||||
case 2: // cancel map vote
|
||||
if (voting == packbuf[2])
|
||||
{
|
||||
voting = -1;
|
||||
i = 0;
|
||||
for (j=0;j<MAXPLAYERS;j++)
|
||||
i += gotvote[j];
|
||||
|
||||
if (i != numplayers)
|
||||
Bsprintf(tempbuf,"%s^00 HAS CANCELED THE VOTE",ud.user_name[(unsigned char)packbuf[2]]);
|
||||
else Bsprintf(tempbuf,"VOTE FAILED");
|
||||
Bmemset(votes,0,sizeof(votes));
|
||||
Bmemset(gotvote,0,sizeof(gotvote));
|
||||
adduserquote(tempbuf);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 126:
|
||||
//Slaves in M/S mode only send to master
|
||||
//Master re-transmits message to all others
|
||||
if ((!networkmode) && (myconnectindex == connecthead))
|
||||
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
|
||||
if (i != other) sendpacket(i,packbuf,packbufleng);
|
||||
|
||||
multiflag = 2;
|
||||
multiwhat = 0;
|
||||
multiwho = packbuf[2]; //other: need to send in m/s mode because of possible re-transmit
|
||||
multipos = packbuf[1];
|
||||
loadplayer(multipos);
|
||||
multiflag = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1813,23 +1818,6 @@ void txdigitalnumber(short starttile, long x,long y,long n,char s,char pal,char
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
void scratchmarks(long x,long y,long n,char s,char p)
|
||||
{
|
||||
long i, ni;
|
||||
|
||||
ni = n/5;
|
||||
for(i=ni;i >= 0;i--)
|
||||
{
|
||||
overwritesprite(x-2,y,SCRATCH+4,s,0,0);
|
||||
x += tilesizx[SCRATCH+4]-1;
|
||||
}
|
||||
|
||||
ni = n%5;
|
||||
if(ni) overwritesprite(x,y,SCRATCH+ni-1,s,p,0);
|
||||
}
|
||||
*/
|
||||
static void displayinventory(struct player_struct *p)
|
||||
{
|
||||
short n, j, xoff, y;
|
||||
|
@ -2533,6 +2521,13 @@ void FTA(short q,struct player_struct *p)
|
|||
else OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,p->ftq);
|
||||
}
|
||||
|
||||
void fadepal(int r, int g, int b, int start, int end, int step)
|
||||
{
|
||||
if (getrendermode() >= 3) return;
|
||||
if (step > 0) for (; start < end; start += step) palto(r,g,b,start);
|
||||
else for (; start >= end; start += step) palto(r,g,b,start);
|
||||
}
|
||||
|
||||
static void showtwoscreens(void)
|
||||
{
|
||||
if (!VOLUMEALL)
|
||||
|
@ -2564,20 +2559,6 @@ static void showtwoscreens(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
void binscreen(void)
|
||||
{
|
||||
long fil;
|
||||
#ifdef VOLUMEONE
|
||||
fil = kopen4load("dukesw.bin",1);
|
||||
#else
|
||||
fil = kopen4load("duke3d.bin",1);
|
||||
#endif
|
||||
if(fil == -1) return;
|
||||
kread(fil,(char *)0xb8000,4000);
|
||||
kclose(fil);
|
||||
}
|
||||
*/
|
||||
|
||||
extern long qsetmode;
|
||||
|
||||
|
@ -4146,20 +4127,6 @@ void displayrooms(short snum,long smoothratio)
|
|||
else p->visibility = ud.const_visibility;
|
||||
}
|
||||
|
||||
short LocateTheLocator(short n,short sn)
|
||||
{
|
||||
short i;
|
||||
|
||||
i = headspritestat[7];
|
||||
while (i >= 0)
|
||||
{
|
||||
if ((sn == -1 || sn == SECT) && n == SLT)
|
||||
return i;
|
||||
i = nextspritestat[i];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void dumpdebugdata(void)
|
||||
{
|
||||
int i,j,x;
|
||||
|
@ -7194,7 +7161,7 @@ void CheatGetInventory(void)
|
|||
|
||||
signed char cheatbuf[MAXCHEATLEN],cheatbuflen;
|
||||
|
||||
void cheats(void)
|
||||
static void cheats(void)
|
||||
{
|
||||
short ch, i, j, k=0, weapon;
|
||||
static char z=0;
|
||||
|
@ -7703,7 +7670,7 @@ FOUNDCHEAT:
|
|||
}
|
||||
}
|
||||
|
||||
void nonsharedkeys(void)
|
||||
static void nonsharedkeys(void)
|
||||
{
|
||||
short i,ch;
|
||||
long j;
|
||||
|
@ -8226,7 +8193,7 @@ FAKE_F3:
|
|||
}
|
||||
}
|
||||
|
||||
void comlinehelp(void)
|
||||
static void comlinehelp(void)
|
||||
{
|
||||
char *s = "Command line help.\n"
|
||||
"?, -?\t\tThis help message\n"
|
||||
|
@ -8482,7 +8449,7 @@ int loadgroupfiles(char *fn)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void checkcommandline(int argc,char **argv)
|
||||
static void checkcommandline(int argc,char **argv)
|
||||
{
|
||||
short i, j;
|
||||
char *c;
|
||||
|
@ -9250,7 +9217,7 @@ void compilecons(void)
|
|||
OnEvent(EVENT_INIT, -1, -1, -1);
|
||||
}
|
||||
|
||||
void sanitizegametype()
|
||||
static void sanitizegametype()
|
||||
{
|
||||
// initprintf("ud.m_coop=%i before sanitization\n",ud.m_coop);
|
||||
if (ud.m_coop >= num_gametypes || ud.m_coop < 0)
|
||||
|
@ -9264,7 +9231,7 @@ void sanitizegametype()
|
|||
// initprintf("ud.m_coop=%i after sanitisation\n",ud.m_coop);
|
||||
}
|
||||
|
||||
void genspriteremaps(void)
|
||||
static void genspriteremaps(void)
|
||||
{
|
||||
long j,fp;
|
||||
signed char look_pos;
|
||||
|
@ -9287,14 +9254,10 @@ void genspriteremaps(void)
|
|||
tempbuf[j] = j;
|
||||
numl++;
|
||||
makepalookup(numl, tempbuf, 15, 15, 15, 1);
|
||||
numl++;
|
||||
makepalookup(numl, tempbuf, 15, 0, 0, 1);
|
||||
numl++;
|
||||
makepalookup(numl, tempbuf, 0, 15, 0, 1);
|
||||
numl++;
|
||||
makepalookup(numl, tempbuf, 0, 0, 15, 1);
|
||||
makepalookup(numl + 1, tempbuf, 15, 0, 0, 1);
|
||||
makepalookup(numl + 2, tempbuf, 0, 15, 0, 1);
|
||||
makepalookup(numl + 3, tempbuf, 0, 0, 15, 1);
|
||||
|
||||
numl -= 3;
|
||||
kread(fp,&waterpal[0],768);
|
||||
kread(fp,&slimepal[0],768);
|
||||
kread(fp,&titlepal[0],768);
|
||||
|
@ -9311,7 +9274,7 @@ void genspriteremaps(void)
|
|||
extern int startwin_run(void);
|
||||
static void SetupGameButtons(void);
|
||||
|
||||
void Startup(long argc, char **argv)
|
||||
static void Startup(long argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -9536,7 +9499,7 @@ void sendboardname(void)
|
|||
}
|
||||
}
|
||||
|
||||
void getnames(void)
|
||||
static void getnames(void)
|
||||
{
|
||||
int l;
|
||||
|
||||
|
@ -9588,6 +9551,7 @@ void updateplayer(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void writestring(long a1,long a2,long a3,short a4,long vx,long vy,long vz)
|
||||
{
|
||||
|
||||
|
@ -9598,11 +9562,12 @@ void writestring(long a1,long a2,long a3,short a4,long vx,long vy,long vz)
|
|||
fprintf(fp,"%ld %ld %ld %d %ld %ld %ld\n",a1,a2,a3,a4,vx,vy,vz);
|
||||
fclose(fp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
char testcd(char *fn, long testsiz);
|
||||
|
||||
// JBF: various hacks here
|
||||
#if 0
|
||||
static void copyprotect(void)
|
||||
{
|
||||
// FILE *fp;
|
||||
|
@ -9651,21 +9616,6 @@ int load_script(char *szScript)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void get_level_from_filename(char *fn, int *volume, int *level)
|
||||
{
|
||||
for ((*volume)=0;(*volume)<MAXVOLUMES;(*volume)++)
|
||||
{
|
||||
for ((*level)=0;(*level)<MAXLEVELS;(*level)++)
|
||||
{
|
||||
if (level_file_names[((*volume)*MAXLEVELS)+(*level)] != NULL)
|
||||
if (!Bstrcasecmp(fn, level_file_names[((*volume)*MAXLEVELS)+(*level)]))
|
||||
break;
|
||||
}
|
||||
if ((*level) != MAXLEVELS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_main(int argc,char **argv)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -10029,7 +9979,7 @@ MAIN_LOOP_RESTART:
|
|||
{
|
||||
ud.m_level_number = 7;
|
||||
ud.m_volume_number = 0;
|
||||
|
||||
|
||||
if (ud.m_player_skill == 4)
|
||||
ud.m_respawn_monsters = 1;
|
||||
else ud.m_respawn_monsters = 0;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -50,10 +50,10 @@ extern long g_kb;
|
|||
extern long g_looking_angSR1;
|
||||
extern int display_bonus_screen;
|
||||
extern long lastvisinc;
|
||||
|
||||
extern void adduserquote(char *daquote);
|
||||
|
||||
extern char cheatquotes[][MAXCHEATLEN];
|
||||
extern char compilefile[BMAX_PATH];
|
||||
extern short total_lines,line_number;
|
||||
|
||||
typedef struct _labels {
|
||||
char *name;
|
||||
|
@ -62,6 +62,28 @@ typedef struct _labels {
|
|||
int maxParm2;
|
||||
} LABELS;
|
||||
|
||||
enum errors
|
||||
{
|
||||
ERROR_CLOSEBRACKET,
|
||||
ERROR_EVENTONLY,
|
||||
ERROR_EXCEEDSMAXTILES,
|
||||
ERROR_EXPECTEDKEYWORD,
|
||||
ERROR_FOUNDWITHIN,
|
||||
ERROR_ISAKEYWORD,
|
||||
ERROR_NOENDSWITCH,
|
||||
ERROR_NOTAGAMEDEF,
|
||||
ERROR_NOTAGAMEVAR,
|
||||
ERROR_OPENBRACKET,
|
||||
ERROR_PARAMUNDEFINED,
|
||||
ERROR_SYMBOLNOTRECOGNIZED,
|
||||
ERROR_SYNTAXERROR,
|
||||
ERROR_VARREADONLY,
|
||||
ERROR_VARTYPEMISMATCH,
|
||||
WARNING_DUPLICATEDEFINITION,
|
||||
WARNING_EVENTSYNC,
|
||||
WARNING_LABELSONLY,
|
||||
};
|
||||
|
||||
enum playerlabels {
|
||||
PLAYER_ZOOM,
|
||||
PLAYER_EXITX,
|
||||
|
|
|
@ -3122,6 +3122,18 @@ static long ifsquished(short i, short p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void forceplayerangle(struct player_struct *p)
|
||||
{
|
||||
short n;
|
||||
|
||||
n = 128-(TRAND&255);
|
||||
|
||||
p->horiz += 64;
|
||||
p->return_to_center = 9;
|
||||
p->look_ang = n>>1;
|
||||
p->rotscrnang = n>>1;
|
||||
}
|
||||
|
||||
static char dodge(spritetype *s)
|
||||
{
|
||||
short i;
|
||||
|
|
1180
polymer/eduke32/source/gamevars.c
Executable file
1180
polymer/eduke32/source/gamevars.c
Executable file
File diff suppressed because it is too large
Load diff
|
@ -181,4 +181,3 @@ proj_struct projectile[MAXTILES], thisprojectile[MAXSPRITES], defaultprojectile[
|
|||
char cheatkey[2] = { sc_D, sc_N };
|
||||
char setupfilename[BMAX_PATH]= "duke3d.cfg";
|
||||
|
||||
void get_level_from_filename(char *fn, int *volume, int *level);
|
||||
|
|
|
@ -2474,6 +2474,22 @@ int MV_TestPlayback(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
int USRHOOKS_GetMem(void **ptr, unsigned long size)
|
||||
{
|
||||
*ptr = malloc(size);
|
||||
|
||||
if (*ptr == NULL)
|
||||
return(USRHOOKS_Error);
|
||||
|
||||
return(USRHOOKS_Ok);
|
||||
|
||||
}
|
||||
|
||||
int USRHOOKS_FreeMem(void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
return(USRHOOKS_Ok);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MV_Init
|
||||
|
|
|
@ -94,22 +94,23 @@ unsigned char framerateon=1,tabgraphic=2,shadepreview=0,autosave=1,sidemode=0;
|
|||
extern long vel, svel, hvel, angvel;
|
||||
long xvel, yvel, timoff;
|
||||
|
||||
void SearchSectorsForward();
|
||||
void SearchSectorsBackward();
|
||||
void SpriteName(short spritenum, char *lo2);
|
||||
int ActorMem(long i);
|
||||
void PrintStatus(char *string,int num,char x,char y,char color);
|
||||
void SetBOSS1Palette();
|
||||
void SetSLIMEPalette();
|
||||
void SetWATERPalette();
|
||||
void SetGAMEPalette();
|
||||
void kensetpalette(char *vgapal);
|
||||
static void SearchSectorsForward();
|
||||
static void SearchSectorsBackward();
|
||||
static inline void SpriteName(short spritenum, char *lo2);
|
||||
static int ActorMem(long i);
|
||||
static void PrintStatus(char *string,int num,char x,char y,char color);
|
||||
static void SetBOSS1Palette();
|
||||
static void SetSLIMEPalette();
|
||||
static void SetWATERPalette();
|
||||
static void SetGAMEPalette();
|
||||
static void kensetpalette(char *vgapal);
|
||||
|
||||
extern short grid;
|
||||
|
||||
extern void EditSpriteData(short spritenum);
|
||||
extern void EditWallData(short wallnum);
|
||||
extern void EditSectorData(short sectnum);
|
||||
static void EditSpriteData(short spritenum);
|
||||
static void EditWallData(short wallnum);
|
||||
static void EditSectorData(short sectnum);
|
||||
static void FuncMenu(void);
|
||||
|
||||
char GAMEpalette[768];
|
||||
char WATERpalette[768];
|
||||
|
|
|
@ -71,6 +71,7 @@ void cmenu(short cm)
|
|||
lastprobey = -1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void savetemp(char *fn,long daptr,long dasiz)
|
||||
{
|
||||
FILE *fp;
|
||||
|
@ -82,24 +83,7 @@ void savetemp(char *fn,long daptr,long dasiz)
|
|||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
void getangplayers(short snum)
|
||||
{
|
||||
short i,a;
|
||||
|
||||
for (i=connecthead;i>=0;i=connectpoint2[i])
|
||||
{
|
||||
if (i != snum)
|
||||
{
|
||||
a = ps[snum].ang+getangle(ps[i].posx-ps[snum].posx,ps[i].posy-ps[snum].posy);
|
||||
a = a-1024;
|
||||
rotatesprite(
|
||||
(320<<15) + (((sintable[(a+512)&2047])>>7)<<15),
|
||||
(320<<15) - (((sintable[a&2047])>>8)<<15),
|
||||
klabs(sintable[((a>>1)+768)&2047]<<2),0,APLAYER,0,ps[i].palookup,0,0,0,xdim-1,ydim-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#define LMB (buttonstat&1)
|
||||
#define RMB (buttonstat&2)
|
||||
|
@ -191,16 +175,17 @@ static int probe_(int type,int x,int y,int i,int n)
|
|||
else return(-probey-2);
|
||||
}
|
||||
}
|
||||
int probe(int x,int y,int i,int n)
|
||||
static inline int probe(int x,int y,int i,int n)
|
||||
{
|
||||
return probe_(0,x,y,i,n);
|
||||
}
|
||||
int probesm(int x,int y,int i,int n)
|
||||
|
||||
static inline int probesm(int x,int y,int i,int n)
|
||||
{
|
||||
return probe_(1,x,y,i,n);
|
||||
}
|
||||
|
||||
int menutext_(int x,int y,short s,short p,char *t)
|
||||
static int menutext_(int x,int y,short s,short p,char *t)
|
||||
{
|
||||
short i, ac, centre;
|
||||
|
||||
|
@ -397,11 +382,11 @@ static void bar_(int type, int x,int y,short *p,short dainc,char damodify,short
|
|||
rotatesprite((x<<16)+((65-xloc)<<(16-type)),(y<<16)+(1<<(16-type)),65536L>>type,0,SLIDEBAR+1,s,pa,10,0,0,xdim-1,ydim-1);
|
||||
}
|
||||
|
||||
void bar(int x,int y,short *p,short dainc,char damodify,short s, short pa)
|
||||
static inline void bar(int x,int y,short *p,short dainc,char damodify,short s, short pa)
|
||||
{
|
||||
bar_(0,x,y,p,dainc,damodify,s,pa);
|
||||
}
|
||||
void barsm(int x,int y,short *p,short dainc,char damodify,short s, short pa)
|
||||
static inline void barsm(int x,int y,short *p,short dainc,char damodify,short s, short pa)
|
||||
{
|
||||
bar_(1,x,y,p,dainc,damodify,s,pa);
|
||||
}
|
||||
|
@ -485,7 +470,7 @@ static struct savehead savehead;
|
|||
//static char brdfn[BMAX_PATH];
|
||||
short lastsavedpos = -1;
|
||||
|
||||
void dispnames(void)
|
||||
static void dispnames(void)
|
||||
{
|
||||
short x, c = 160;
|
||||
|
||||
|
|
|
@ -53,14 +53,7 @@ void setpal(struct player_struct *p)
|
|||
restorepalette = 1;
|
||||
}
|
||||
|
||||
void fadepal(int r, int g, int b, int start, int end, int step)
|
||||
{
|
||||
if (getrendermode() >= 3) return;
|
||||
if (step > 0) for (; start < end; start += step) palto(r,g,b,start);
|
||||
else for (; start >= end; start += step) palto(r,g,b,start);
|
||||
}
|
||||
|
||||
void incur_damage(struct player_struct *p)
|
||||
static void incur_damage(struct player_struct *p)
|
||||
{
|
||||
long damage = 0L, shield_damage = 0L;
|
||||
|
||||
|
@ -112,19 +105,7 @@ void quickkill(struct player_struct *p)
|
|||
return;
|
||||
}
|
||||
|
||||
void forceplayerangle(struct player_struct *p)
|
||||
{
|
||||
short n;
|
||||
|
||||
n = 128-(TRAND&255);
|
||||
|
||||
p->horiz += 64;
|
||||
p->return_to_center = 9;
|
||||
p->look_ang = n>>1;
|
||||
p->rotscrnang = n>>1;
|
||||
}
|
||||
|
||||
void tracers(long x1,long y1,long z1,long x2,long y2,long z2,long n)
|
||||
static void tracers(long x1,long y1,long z1,long x2,long y2,long z2,long n)
|
||||
{
|
||||
long i, xv, yv, zv;
|
||||
short sect = -1;
|
||||
|
@ -208,56 +189,7 @@ long hits(short i)
|
|||
return (FindDistance2D(sx-SX,sy-SY));
|
||||
}
|
||||
|
||||
long hitasprite(short i,short *hitsp)
|
||||
{
|
||||
long sx,sy,sz,zoff;
|
||||
short sect,hw;
|
||||
|
||||
if (badguy(&sprite[i]))
|
||||
zoff = (42<<8);
|
||||
else if (PN == APLAYER) zoff = (39<<8);
|
||||
else zoff = 0;
|
||||
|
||||
hitscan(SX,SY,SZ-zoff,SECT,
|
||||
sintable[(SA+512)&2047],
|
||||
sintable[SA&2047],
|
||||
0,§,&hw,hitsp,&sx,&sy,&sz,CLIPMASK1);
|
||||
|
||||
if (hw >= 0 && (wall[hw].cstat&16) && badguy(&sprite[i]))
|
||||
return((1<<30));
|
||||
|
||||
return (FindDistance2D(sx-SX,sy-SY));
|
||||
}
|
||||
|
||||
/*
|
||||
long hitaspriteandwall(short i,short *hitsp,short *hitw,short *x, short *y)
|
||||
{
|
||||
long sz;
|
||||
short sect;
|
||||
|
||||
hitscan(SX,SY,SZ,SECT,
|
||||
sintable[(SA+512)&2047],
|
||||
sintable[SA&2047],
|
||||
0,§,hitw,hitsp,x,y,&sz,CLIPMASK1);
|
||||
|
||||
return ( FindDistance2D(*x-SX,*y-SY) );
|
||||
}
|
||||
*/
|
||||
|
||||
long hitawall(struct player_struct *p,short *hitw)
|
||||
{
|
||||
long sx,sy,sz;
|
||||
short sect,hs;
|
||||
|
||||
hitscan(p->posx,p->posy,p->posz,p->cursectnum,
|
||||
sintable[(p->ang+512)&2047],
|
||||
sintable[p->ang&2047],
|
||||
0,§,hitw,&hs,&sx,&sy,&sz,CLIPMASK0);
|
||||
|
||||
return (FindDistance2D(sx-p->posx,sy-p->posy));
|
||||
}
|
||||
|
||||
short aim(spritetype *s,short aang,short atwith)
|
||||
static short aim(spritetype *s,short aang,short atwith)
|
||||
{
|
||||
char gotshrinker,gotfreezer;
|
||||
short i, j, a, k, cans;
|
||||
|
@ -331,12 +263,8 @@ short aim(spritetype *s,short aang,short atwith)
|
|||
if (sprite[i].xrepeat < 20) continue;
|
||||
continue;
|
||||
}
|
||||
else if ((PN >= GREENSLIME)&&(PN <= GREENSLIME+7))
|
||||
{}
|
||||
else
|
||||
{
|
||||
else if (!(PN >= GREENSLIME && PN <= GREENSLIME+7))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (gotfreezer && sprite[i].pal == 1) continue;
|
||||
}
|
||||
|
@ -1866,7 +1794,7 @@ SKIPBULLETHOLE:
|
|||
return -1;
|
||||
}
|
||||
|
||||
void displayloogie(short snum)
|
||||
static void displayloogie(short snum)
|
||||
{
|
||||
long i, a, x, y, z;
|
||||
|
||||
|
@ -3055,7 +2983,7 @@ void getinput(short snum)
|
|||
loc.horz = horiz;
|
||||
}
|
||||
|
||||
char doincrements(struct player_struct *p)
|
||||
static char doincrements(struct player_struct *p)
|
||||
{
|
||||
short snum;
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ static void cachegoodsprites(void)
|
|||
for (i=MORTER; i<MORTER+4; i++) tloadtile(i,4);
|
||||
}
|
||||
|
||||
char getsound(unsigned short num)
|
||||
static char getsound(unsigned short num)
|
||||
{
|
||||
short fp;
|
||||
long l;
|
||||
|
@ -298,6 +298,80 @@ static void precachenecessarysounds(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void dofrontscreens(char *statustext)
|
||||
{
|
||||
long i=0,j;
|
||||
|
||||
if (ud.recstat != 2)
|
||||
{
|
||||
if (!statustext)
|
||||
{
|
||||
//ps[myconnectindex].palette = palette;
|
||||
setgamepalette(&ps[myconnectindex], palette, 1); // JBF 20040308
|
||||
fadepal(0,0,0, 0,64,7);
|
||||
i = ud.screen_size;
|
||||
ud.screen_size = 0;
|
||||
vscrn();
|
||||
clearview(0L);
|
||||
}
|
||||
|
||||
SetGameVarID(g_iReturnVarID,LOADSCREEN, -1, -1);
|
||||
OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1);
|
||||
j = GetGameVarID(g_iReturnVarID, -1, -1);
|
||||
rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64,0,0,xdim-1,ydim-1);
|
||||
if (j > MAXTILES-1)
|
||||
{
|
||||
nextpage();
|
||||
return;
|
||||
}
|
||||
if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0)
|
||||
{
|
||||
menutext(160,90,0,0,"ENTERING USER MAP");
|
||||
gametextpal(160,90+10,boardfilename,14,2);
|
||||
}
|
||||
else
|
||||
{
|
||||
menutext(160,90,0,0,"ENTERING");
|
||||
if (level_names[(ud.volume_number*MAXLEVELS) + ud.level_number] != NULL)
|
||||
menutext(160,90+16+8,0,0,level_names[(ud.volume_number*MAXLEVELS) + ud.level_number]);
|
||||
}
|
||||
|
||||
if (statustext) gametext(160,180,statustext,0,2+8+16);
|
||||
|
||||
nextpage();
|
||||
|
||||
if (!statustext)
|
||||
{
|
||||
fadepal(0,0,0, 63,0,-7);
|
||||
|
||||
KB_FlushKeyboardQueue();
|
||||
ud.screen_size = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!statustext)
|
||||
{
|
||||
clearview(0L);
|
||||
//ps[myconnectindex].palette = palette;
|
||||
//palto(0,0,0,0);
|
||||
setgamepalette(&ps[myconnectindex], palette, 0); // JBF 20040308
|
||||
}
|
||||
SetGameVarID(g_iReturnVarID,LOADSCREEN, -1, -1);
|
||||
OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1);
|
||||
j = GetGameVarID(g_iReturnVarID, -1, -1);
|
||||
rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64,0,0,xdim-1,ydim-1);
|
||||
if (j > MAXTILES-1)
|
||||
{
|
||||
nextpage();
|
||||
return;
|
||||
}
|
||||
menutext(160,105,0,0,"LOADING...");
|
||||
if (statustext) gametext(160,180,statustext,0,2+8+16);
|
||||
nextpage();
|
||||
}
|
||||
}
|
||||
|
||||
void cacheit(void)
|
||||
{
|
||||
long i,j,k, pc=0;
|
||||
|
@ -1413,80 +1487,6 @@ void waitforeverybody()
|
|||
}
|
||||
}
|
||||
|
||||
void dofrontscreens(char *statustext)
|
||||
{
|
||||
long i=0,j;
|
||||
|
||||
if (ud.recstat != 2)
|
||||
{
|
||||
if (!statustext)
|
||||
{
|
||||
//ps[myconnectindex].palette = palette;
|
||||
setgamepalette(&ps[myconnectindex], palette, 1); // JBF 20040308
|
||||
fadepal(0,0,0, 0,64,7);
|
||||
i = ud.screen_size;
|
||||
ud.screen_size = 0;
|
||||
vscrn();
|
||||
clearview(0L);
|
||||
}
|
||||
|
||||
SetGameVarID(g_iReturnVarID,LOADSCREEN, -1, -1);
|
||||
OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1);
|
||||
j = GetGameVarID(g_iReturnVarID, -1, -1);
|
||||
rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64,0,0,xdim-1,ydim-1);
|
||||
if (j > MAXTILES-1)
|
||||
{
|
||||
nextpage();
|
||||
return;
|
||||
}
|
||||
if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0)
|
||||
{
|
||||
menutext(160,90,0,0,"ENTERING USER MAP");
|
||||
gametextpal(160,90+10,boardfilename,14,2);
|
||||
}
|
||||
else
|
||||
{
|
||||
menutext(160,90,0,0,"ENTERING");
|
||||
if (level_names[(ud.volume_number*MAXLEVELS) + ud.level_number] != NULL)
|
||||
menutext(160,90+16+8,0,0,level_names[(ud.volume_number*MAXLEVELS) + ud.level_number]);
|
||||
}
|
||||
|
||||
if (statustext) gametext(160,180,statustext,0,2+8+16);
|
||||
|
||||
nextpage();
|
||||
|
||||
if (!statustext)
|
||||
{
|
||||
fadepal(0,0,0, 63,0,-7);
|
||||
|
||||
KB_FlushKeyboardQueue();
|
||||
ud.screen_size = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!statustext)
|
||||
{
|
||||
clearview(0L);
|
||||
//ps[myconnectindex].palette = palette;
|
||||
//palto(0,0,0,0);
|
||||
setgamepalette(&ps[myconnectindex], palette, 0); // JBF 20040308
|
||||
}
|
||||
SetGameVarID(g_iReturnVarID,LOADSCREEN, -1, -1);
|
||||
OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1);
|
||||
j = GetGameVarID(g_iReturnVarID, -1, -1);
|
||||
rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64,0,0,xdim-1,ydim-1);
|
||||
if (j > MAXTILES-1)
|
||||
{
|
||||
nextpage();
|
||||
return;
|
||||
}
|
||||
menutext(160,105,0,0,"LOADING...");
|
||||
if (statustext) gametext(160,180,statustext,0,2+8+16);
|
||||
nextpage();
|
||||
}
|
||||
}
|
||||
|
||||
extern char jump_input;
|
||||
|
||||
void clearfifo(void)
|
||||
|
@ -1535,6 +1535,21 @@ extern void adduserquote(char *daquote);
|
|||
|
||||
extern int gotvote[MAXPLAYERS], votes[MAXPLAYERS], voting, vote_map, vote_episode;
|
||||
|
||||
static void get_level_from_filename(char *fn, int *volume, int *level)
|
||||
{
|
||||
for ((*volume)=0;(*volume)<MAXVOLUMES;(*volume)++)
|
||||
{
|
||||
for ((*level)=0;(*level)<MAXLEVELS;(*level)++)
|
||||
{
|
||||
if (level_file_names[((*volume)*MAXLEVELS)+(*level)] != NULL)
|
||||
if (!Bstrcasecmp(fn, level_file_names[((*volume)*MAXLEVELS)+(*level)]))
|
||||
break;
|
||||
}
|
||||
if ((*level) != MAXLEVELS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int enterlevel(char g)
|
||||
{
|
||||
short i;
|
||||
|
@ -1572,9 +1587,9 @@ int enterlevel(char g)
|
|||
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
|
||||
{
|
||||
int volume, level;
|
||||
|
||||
|
||||
get_level_from_filename(boardfilename,&volume,&level);
|
||||
|
||||
|
||||
if (level != MAXLEVELS)
|
||||
{
|
||||
ud.level_number = ud.m_level_number = level;
|
||||
|
|
|
@ -22,6 +22,52 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "duke3d.h"
|
||||
|
||||
void readsavenames(void)
|
||||
{
|
||||
long dummy,j;
|
||||
short i;
|
||||
char fn[13];
|
||||
BFILE *fil;
|
||||
|
||||
Bstrcpy(fn,"egam_.sav");
|
||||
|
||||
for (i=0;i<10;i++)
|
||||
{
|
||||
fn[4] = i+'0';
|
||||
if ((fil = Bfopen(fn,"rb")) == NULL) 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(&dummy,4,1,fil) != 1)
|
||||
{
|
||||
Bfclose(fil);
|
||||
continue;
|
||||
}
|
||||
if (dummy != BYTEVERSION)
|
||||
{
|
||||
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;
|
||||
}
|
||||
Bfclose(fil);
|
||||
}
|
||||
}
|
||||
|
||||
int loadpheader(char spot,struct savehead *saveh)
|
||||
{
|
||||
char fn[13];
|
||||
|
|
|
@ -3180,6 +3180,41 @@ CHECKINV1:
|
|||
}
|
||||
}
|
||||
|
||||
long hitasprite(short i,short *hitsp)
|
||||
{
|
||||
long sx,sy,sz,zoff;
|
||||
short sect,hw;
|
||||
|
||||
if (badguy(&sprite[i]))
|
||||
zoff = (42<<8);
|
||||
else if (PN == APLAYER) zoff = (39<<8);
|
||||
else zoff = 0;
|
||||
|
||||
hitscan(SX,SY,SZ-zoff,SECT,
|
||||
sintable[(SA+512)&2047],
|
||||
sintable[SA&2047],
|
||||
0,§,&hw,hitsp,&sx,&sy,&sz,CLIPMASK1);
|
||||
|
||||
if (hw >= 0 && (wall[hw].cstat&16) && badguy(&sprite[i]))
|
||||
return((1<<30));
|
||||
|
||||
return (FindDistance2D(sx-SX,sy-SY));
|
||||
}
|
||||
|
||||
static long hitawall(struct player_struct *p,short *hitw)
|
||||
{
|
||||
long sx,sy,sz;
|
||||
short sect,hs;
|
||||
|
||||
hitscan(p->posx,p->posy,p->posz,p->cursectnum,
|
||||
sintable[(p->ang+512)&2047],
|
||||
sintable[p->ang&2047],
|
||||
0,§,hitw,&hs,&sx,&sy,&sz,CLIPMASK0);
|
||||
|
||||
return (FindDistance2D(sx-p->posx,sy-p->posy));
|
||||
}
|
||||
|
||||
|
||||
void checksectors(short snum)
|
||||
{
|
||||
long i = -1,oldz;
|
||||
|
|
|
@ -157,23 +157,6 @@ void MusicUpdate(void)
|
|||
MUSIC_Update();
|
||||
}
|
||||
|
||||
int USRHOOKS_GetMem(char **ptr, unsigned long size)
|
||||
{
|
||||
*ptr = malloc(size);
|
||||
|
||||
if (*ptr == NULL)
|
||||
return(USRHOOKS_Error);
|
||||
|
||||
return(USRHOOKS_Ok);
|
||||
|
||||
}
|
||||
|
||||
int USRHOOKS_FreeMem(char *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
return(USRHOOKS_Ok);
|
||||
}
|
||||
|
||||
unsigned char menunum=0;
|
||||
|
||||
void intomenusounds(void)
|
||||
|
|
Loading…
Reference in a new issue