Wanna buy some crack?

git-svn-id: https://svn.eduke32.com/eduke32@563 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-08-27 00:20:15 +00:00
parent d651d1d895
commit a2f4bdb2c8
19 changed files with 2862 additions and 2845 deletions

File diff suppressed because it is too large Load diff

View file

@ -248,7 +248,7 @@ void playanm(const char *fn,char t)
//setpalette(0L,256L,tempbuf);
//setbrightness(ud.brightness>>2,tempbuf,2);
setgamepalette(&ps[myconnectindex],animpal,10);
setgamepalette(&g_player[myconnectindex].ps,animpal,10);
#if defined(POLYMOST) && defined(USE_OPENGL)
gltexfiltermode = 0;
@ -267,7 +267,7 @@ void playanm(const char *fn,char t)
getpackets();
if (restorepalette == 1)
{
setgamepalette(&ps[myconnectindex],animpal,0);
setgamepalette(&g_player[myconnectindex].ps,animpal,0);
restorepalette = 0;
}
idle();

File diff suppressed because it is too large Load diff

View file

@ -27,70 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SETUPNAMEPARM "SETUPFILE"
typedef struct {
//
// Sound variables
//
int32 FXDevice;
int32 MusicDevice;
int32 FXVolume;
int32 MusicVolume;
int32 SoundToggle;
int32 MusicToggle;
int32 VoiceToggle;
int32 AmbienceToggle;
int32 NumVoices;
int32 NumChannels;
int32 NumBits;
int32 MixRate;
int32 ReverseStereo;
int32 UseJoystick;
int32 UseMouse;
int32 RunMode;
int32 AutoAim;
int32 ShowOpponentWeapons;
int32 MouseFilter,MouseBias;
int32 SmoothInput;
// JBF 20031211: Store the input settings because
// (currently) jmact can't regurgitate them
byte KeyboardKeys[NUMGAMEFUNCTIONS][2];
int32 MouseFunctions[MAXMOUSEBUTTONS][2];
int32 MouseDigitalFunctions[MAXMOUSEAXES][2];
int32 MouseAnalogueAxes[MAXMOUSEAXES];
int32 MouseAnalogueScale[MAXMOUSEAXES];
int32 JoystickFunctions[MAXJOYBUTTONS][2];
int32 JoystickDigitalFunctions[MAXJOYAXES][2];
int32 JoystickAnalogueAxes[MAXJOYAXES];
int32 JoystickAnalogueScale[MAXJOYAXES];
int32 JoystickAnalogueDead[MAXJOYAXES];
int32 JoystickAnalogueSaturate[MAXJOYAXES];
//
// Screen variables
//
int32 ScreenMode;
int32 ScreenWidth;
int32 ScreenHeight;
int32 ScreenBPP;
int32 ForceSetup;
int32 scripthandle;
int32 setupread;
int32 CheckForUpdates;
int32 LastUpdateCheck;
int32 useprecache;
} config_t;
extern config_t config;
int32 CONFIG_ReadSetup( void );
void CONFIG_GetSetupFilename( void );
void CONFIG_WriteSetup( void );

View file

@ -100,7 +100,6 @@ extern int g_ScriptVersion, g_Shareware, g_GameType;
#include "music.h"
#include "namesdyn.h"
#include "funct.h"
#define TICRATE (120)
#define TICSPERFRAME (TICRATE/26)
@ -306,7 +305,6 @@ typedef struct {
} input;
#define sync dsync // JBF 20040604: sync is a function on some platforms
extern input inputfifo[MOVEFIFOSIZ][MAXPLAYERS], sync[MAXPLAYERS];
extern input recsync[RECSYNCBUFSIZ];
extern long movefifosendplc;
@ -317,12 +315,12 @@ typedef struct {
int length, num;
} SAMPLE;
struct animwalltype {
typedef struct {
short wallnum;
long tag;
};
} animwalltype;
extern struct animwalltype animwall[MAXANIMWALLS];
extern animwalltype animwall[MAXANIMWALLS];
extern short numanimwalls;
extern int probey;
@ -339,10 +337,71 @@ struct savehead {
char boardfn[BMAX_PATH];
};
struct user_defs {
typedef struct {
//
// Sound variables
//
int32 FXDevice;
int32 MusicDevice;
int32 FXVolume;
int32 MusicVolume;
int32 SoundToggle;
int32 MusicToggle;
int32 VoiceToggle;
int32 AmbienceToggle;
int32 NumVoices;
int32 NumChannels;
int32 NumBits;
int32 MixRate;
int32 ReverseStereo;
int32 UseJoystick;
int32 UseMouse;
int32 RunMode;
int32 AutoAim;
int32 ShowOpponentWeapons;
int32 MouseFilter,MouseBias;
int32 SmoothInput;
// JBF 20031211: Store the input settings because
// (currently) jmact can't regurgitate them
byte KeyboardKeys[NUMGAMEFUNCTIONS][2];
int32 MouseFunctions[MAXMOUSEBUTTONS][2];
int32 MouseDigitalFunctions[MAXMOUSEAXES][2];
int32 MouseAnalogueAxes[MAXMOUSEAXES];
int32 MouseAnalogueScale[MAXMOUSEAXES];
int32 JoystickFunctions[MAXJOYBUTTONS][2];
int32 JoystickDigitalFunctions[MAXJOYAXES][2];
int32 JoystickAnalogueAxes[MAXJOYAXES];
int32 JoystickAnalogueScale[MAXJOYAXES];
int32 JoystickAnalogueDead[MAXJOYAXES];
int32 JoystickAnalogueSaturate[MAXJOYAXES];
//
// Screen variables
//
int32 ScreenMode;
int32 ScreenWidth;
int32 ScreenHeight;
int32 ScreenBPP;
int32 ForceSetup;
int32 scripthandle;
int32 setupread;
int32 CheckForUpdates;
int32 LastUpdateCheck;
int32 useprecache;
} config_t;
typedef struct {
char god,warp_on,cashman,eog,showallmap;
char show_help,scrollmode,clipping;
char user_name[MAXPLAYERS][32];
char ridecule[10][40];
char savegame[10][22];
char pwlockout[128],rtsname[128];
@ -360,31 +419,32 @@ struct user_defs {
long reccnt;
int32 runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon; // JBF 20031125
int32 democams,color,pcolor[MAXPLAYERS],msgdisptime,statusbarmode;
int32 democams,color,msgdisptime,statusbarmode;
int32 m_noexits,noexits,autovote,automsg,idplayers;
int32 team, pteam[MAXPLAYERS], viewbob, weaponsway;
int32 team, viewbob, weaponsway;
int32 entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
int32 coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair;
int32 wchoice[MAXPLAYERS][MAX_WEAPONS],playerai,angleinterpolation,deathmsgs;
int32 playerai,angleinterpolation,deathmsgs;
int32 respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness;
int32 m_respawn_items,m_respawn_monsters,m_respawn_inventory,m_recstat,m_monsters_off,detail;
int32 m_ffire,ffire,m_player_skill,m_level_number,m_volume_number,multimode;
int32 player_skill,level_number,volume_number,m_marker,marker,mouseflip;
};
config_t config;
} user_defs;
struct player_orig {
typedef struct {
long ox,oy,oz;
short oa,os;
};
} player_orig;
extern char numplayersprites;
extern long fricxv,fricyv;
struct player_struct {
typedef struct {
long zoom,exitx,exity,loogiex[64],loogiey[64],numloogs,loogcnt;
long posx, posy, posz, horiz, ohoriz, ohorizoff, invdisptime;
long bobposx,bobposy,oposx,oposy,oposz,pyoff,opyoff;
@ -437,7 +497,7 @@ struct player_struct {
long max_secret_rooms,secret_rooms,max_actors_killed,actors_killed;
long runspeed, movement_lock, team;
short sbs, sound_pitch;
};
} player_struct;
extern char tempbuf[2048], packbuf[576];
@ -448,9 +508,7 @@ extern long impact_damage,respawnactortime,respawnitemtime;
#define MOVFIFOSIZ 256
extern short spriteq[1024],spriteqloc,spriteqamount;
extern struct player_struct ps[MAXPLAYERS];
extern struct player_orig po[MAXPLAYERS];
extern struct user_defs ud;
extern user_defs ud;
extern short int moustat;
extern short int global_random;
extern long scaredfallz;
@ -459,14 +517,12 @@ extern char buf[1024]; //My own generic input buffer
#define MAXQUOTELEN 128
extern char *fta_quotes[MAXQUOTES],*redefined_quotes[MAXQUOTES];
extern char scantoasc[128],ready2send;
extern char scantoascwithshift[128];
extern char ready2send;
//extern fx_device device;
extern SAMPLE Sound[ NUM_SOUNDS ];
extern SOUNDOWNER SoundOwner[NUM_SOUNDS][4];
extern char playerreadyflag[MAXPLAYERS],playerquitflag[MAXPLAYERS];
extern char sounds[NUM_SOUNDS][BMAX_PATH];
// JBF 20040531: adding 16 extra to the script so we have some leeway
@ -483,27 +539,25 @@ extern char env_music_fn[MAXVOLUMES+1][BMAX_PATH];
extern short camsprite;
// extern char gotz;
extern char inspace(short sectnum);
struct weaponhit {
typedef struct {
char cgg;
short picnum,ang,extra,owner,movflag;
short tempang,actorstayput,dispicnum;
short timetosleep;
long floorz,ceilingz,lastvx,lastvy,bposx,bposy,bposz;
long temp_data[10];
};
} weaponhit;
extern struct weaponhit hittype[MAXSPRITES];
extern weaponhit hittype[MAXSPRITES];
struct spriteinterpolate {
typedef struct {
long x;
long y;
long z;
short ang, oldang, angdir, angdif;
};
} spriteinterpolate;
extern struct spriteinterpolate sprpos[MAXSPRITES];
extern spriteinterpolate sprpos[MAXSPRITES];
extern input loc;
extern input recsync[RECSYNCBUFSIZ];
@ -518,7 +572,7 @@ extern long tempwallptr,animatecnt;
extern long lockclock,frameplace;
extern char display_mirror,loadfromgrouponly,rtsplaying;
extern long movefifoend[MAXPLAYERS], groupfile;
extern long groupfile;
extern long ototalclock;
extern long *animateptr[MAXANIMATES], animategoal[MAXANIMATES];
@ -607,19 +661,18 @@ typedef struct {
} STATUSBARTYPE;
extern STATUSBARTYPE sbar;
extern short frags[MAXPLAYERS][MAXPLAYERS];
extern long cameradist, cameraclock, dukefriction,show_shareware;
extern int networkmode, movesperpacket;
extern int gamequit;
extern char pus,pub;
extern int camerashitable,freezerhurtowner,lasermode;
extern char syncstat, syncval[MAXPLAYERS][MOVEFIFOSIZ];
extern char syncstat;
extern signed char multiwho, multipos, multiwhat, multiflag;
extern long syncvalhead[MAXPLAYERS], syncvaltail, syncvaltottail;
extern long syncvaltail, syncvaltottail;
extern long numfreezebounces,rpgblastradius,pipebombblastradius,tripbombblastradius,shrinkerblastradius,morterblastradius,bouncemineblastradius,seenineblastradius;
extern int everyothertime;
extern long myminlag[MAXPLAYERS], mymaxlag, otherminlag, bufferjitter;
extern long mymaxlag, otherminlag, bufferjitter;
extern long numinterpolations, startofdynamicinterpolations;
extern long oldipos[MAXINTERPOLATIONS];
@ -902,6 +955,30 @@ typedef struct {
extern map_t map[MAXVOLUMES*MAXLEVELS];
typedef struct {
player_struct ps;
player_orig po;
input sync;
long movefifoend;
long syncvalhead;
long myminlag;
int frags[MAXPLAYERS];
int32 pcolor;
int32 pteam;
int32 wchoice[MAX_WEAPONS];
char syncval[MOVEFIFOSIZ];
char user_name[32];
char playerreadyflag;
char playerquitflag;
} playerdata_t;
extern input inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
extern playerdata_t g_player[MAXPLAYERS];
#include "funct.h"
#ifdef __cplusplus
}
#endif

View file

@ -25,8 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __funct_h__
#define __funct_h__
struct player_struct; // JBF: duke3d.h defines this later
extern void sendscore(const char *s);
extern void SoundStartup(void);
extern void SoundShutdown(void);
@ -67,7 +65,7 @@ extern void operateforcefields(int s,int low);
extern int checkhitswitch(int snum,long w,int switchtype);
extern void activatebysector(int sect,int j);
extern void checkhitwall(int spr,int dawallnum,long x,long y,long z,int atwith);
extern void checkplayerhurt(struct player_struct *p,int j);
extern void checkplayerhurt(player_struct *p,int j);
extern int checkhitceiling(int sn);
extern void checkhitsprite(int i,int sn);
extern void allignwarpelevators(void);
@ -94,15 +92,15 @@ extern void clearfifo(void);
extern void resetmys(void);
extern int enterlevel(int g);
extern void backtomenu(void);
extern void setpal(struct player_struct *p);
extern void quickkill(struct player_struct *p);
extern void setpal(player_struct *p);
extern void quickkill(player_struct *p);
extern long hits(int i);
extern long hitasprite(int i,short *hitsp);
extern int shoot(int i,int atwith);
extern void displaymasks(int snum);
extern void displayweapon(int snum);
extern void getinput(int snum);
extern void checkweapons(struct player_struct *p);
extern void checkweapons(player_struct *p);
extern void processinput(int snum);
extern void cmenu(int cm);
extern void savetemp(const char *fn,long daptr,long dasiz);
@ -133,7 +131,7 @@ extern int badguypic(int pn);
extern void myos(long x,long y,int tilenum,int shade,int orientation);
extern void myospal(long x,long y,int tilenum,int shade,int orientation,int p);
extern void displayfragbar(void);
extern void FTA(int q,struct player_struct *p);
extern void FTA(int q,player_struct *p);
extern void gameexit(const char *t);
extern inline int strget(int x,int y,char *t,int dalen,int c);
extern void displayrest(long smoothratio);
@ -170,11 +168,11 @@ extern void dointerpolations(long smoothratio);
extern void restoreinterpolations(void);
extern long ceilingspace(int sectnum);
extern long floorspace(int sectnum);
extern void addammo(int weapon,struct player_struct *p,int amount);
extern void addweaponnoswitch(struct player_struct *p,int weapon);
extern void addweapon(struct player_struct *p,int weapon);
extern void checkavailinven(struct player_struct *p);
extern void checkavailweapon(struct player_struct *p);
extern void addammo(int weapon,player_struct *p,int amount);
extern void addweaponnoswitch(player_struct *p,int weapon);
extern void addweapon(player_struct *p,int weapon);
extern void checkavailinven(player_struct *p);
extern void checkavailweapon(player_struct *p);
extern void hitradius(int i,long r,long hp1,long hp2,long hp3,long hp4);
extern int movesprite(int spritenum,long xchange,long ychange,long zchange,unsigned long cliptype);
extern int ssp(int i,unsigned long cliptype);
@ -194,7 +192,7 @@ extern void movedummyplayers(void);
// game.c
extern inline void setstatusbarscale(long sc);
extern void setgamepalette(struct player_struct *player, char *pal, int set);
extern void setgamepalette(player_struct *player, char *pal, int set);
extern void fadepal(int r, int g, int b, int start, int end, int step);
extern inline int minitextshade(int x,int y,const char *t,int s,int p,int sb);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -33,11 +33,11 @@ long neartaghitdist,lockclock,max_player_health,max_armour_amount,max_ammo_amoun
long gc=176;
// long temp_data[MAXSPRITES][6];
struct weaponhit hittype[MAXSPRITES];
struct spriteinterpolate sprpos[MAXSPRITES];
weaponhit hittype[MAXSPRITES];
spriteinterpolate sprpos[MAXSPRITES];
short spriteq[1024],spriteqloc,spriteqamount=64;
struct animwalltype animwall[MAXANIMWALLS];
animwalltype animwall[MAXANIMWALLS];
short numanimwalls;
long *animateptr[MAXANIMATES], animategoal[MAXANIMATES], animatevel[MAXANIMATES], animatecnt;
// long oanimateval[MAXANIMATES];
@ -86,32 +86,26 @@ SOUNDOWNER SoundOwner[NUM_SOUNDS][4];
char numplayersprites,loadfromgrouponly=0,earthquaketime;
long fricxv,fricyv;
struct player_orig po[MAXPLAYERS];
struct player_struct ps[MAXPLAYERS];
struct user_defs ud;
playerdata_t g_player[MAXPLAYERS];
input inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
user_defs ud;
char pus, pub;
char syncstat, syncval[MAXPLAYERS][MOVEFIFOSIZ];
long syncvalhead[MAXPLAYERS], syncvaltail, syncvaltottail;
char syncstat;
long syncvaltail, syncvaltottail;
input sync[MAXPLAYERS], loc;
input loc;
input recsync[RECSYNCBUFSIZ];
long avgfvel, avgsvel, avgavel, avghorz, avgbits, avgextbits;
input inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
long movefifosendplc;
//Multiplayer syncing variables
short screenpeek;
long movefifoend[MAXPLAYERS];
//Game recording variables
char playerreadyflag[MAXPLAYERS],ready2send;
char playerquitflag[MAXPLAYERS];
char ready2send;
long vel, svel, angvel, horiz, ototalclock, respawnactortime=768, respawnitemtime=768, groupfile;
long *scriptptr,*insptr,*labelcode,labelcnt,defaultlabelcnt,*labeltype;
@ -153,7 +147,7 @@ int condebug;
//GLOBAL.C - replace the end "my's" with this
long myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
short myhoriz, omyhoriz, myhorizoff, omyhorizoff;
short myang, omyang, mycursectnum, myjumpingcounter,frags[MAXPLAYERS][MAXPLAYERS];
short myang, omyang, mycursectnum, myjumpingcounter;
char myjumpingtoggle, myonground, myhardlanding, myreturntocenter;
signed char multiwho, multipos, multiwhat, multiflag;
@ -169,7 +163,7 @@ int networkmode = 255, movesperpacket = 1,gamequit = 0,everyothertime;
long numfreezebounces=3,rpgblastradius,pipebombblastradius,tripbombblastradius,shrinkerblastradius,morterblastradius,bouncemineblastradius,seenineblastradius;
STATUSBARTYPE sbar;
long myminlag[MAXPLAYERS], mymaxlag, otherminlag, bufferjitter = 1;
long mymaxlag, otherminlag, bufferjitter = 1;
short numclouds,clouds[128],cloudx[128],cloudy[128];
long cloudtotalclock = 0,totalmemory = 0;
long numinterpolations = 0, startofdynamicinterpolations = 0;

View file

@ -365,8 +365,8 @@ int xyzsound(short num, short i, long x, long y, long z)
num >= NUM_SOUNDS ||
((soundm[num] & SOUNDM_PARENT) && ud.lockout) || // parental mode
SoundToggle == 0 ||
(ps[myconnectindex].timebeforeexit > 0 && ps[myconnectindex].timebeforeexit <= 26*3) ||
(ps[myconnectindex].gm & MODE_MENU)
(g_player[myconnectindex].ps.timebeforeexit > 0 && g_player[myconnectindex].ps.timebeforeexit <= 26*3) ||
(g_player[myconnectindex].ps.gm & MODE_MENU)
) return -1;
if (soundm[num] & SOUNDM_PLAYER) {
@ -410,8 +410,8 @@ int xyzsound(short num, short i, long x, long y, long z)
refdist *= d;
}
if (PN != MUSICANDSFX &&
!cansee(ps[screenpeek].oposx,ps[screenpeek].oposy,ps[screenpeek].oposz-(24<<8),
ps[screenpeek].cursectnum,SX,SY,SZ-(24<<8),SECT) )
!cansee(g_player[screenpeek].ps.oposx,g_player[screenpeek].ps.oposy,g_player[screenpeek].ps.oposz-(24<<8),
g_player[screenpeek].ps.cursectnum,SX,SY,SZ-(24<<8),SECT) )
gain *= OCCLUDEDFACTOR;
switch(num)
@ -421,10 +421,10 @@ int xyzsound(short num, short i, long x, long y, long z)
case RPG_EXPLODE:
gain = 1.0;
global = 1;
if (sector[ps[screenpeek].cursectnum].lotag == 2) pitch -= translatepitch(1024);
if (sector[g_player[screenpeek].ps.cursectnum].lotag == 2) pitch -= translatepitch(1024);
break;
default:
if(sector[ps[screenpeek].cursectnum].lotag == 2 && (soundm[num]&SOUNDM_DUKE) == 0)
if(sector[g_player[screenpeek].ps.cursectnum].lotag == 2 && (soundm[num]&SOUNDM_DUKE) == 0)
pitch = translatepitch(-768);
//if( sndist > 31444 && PN != MUSICANDSFX)
// return -1;
@ -575,11 +575,11 @@ void pan3dsound(void)
jfaud->AgeCache();
if(ud.camerasprite == -1) {
cx = ps[screenpeek].oposx;
cy = ps[screenpeek].oposy;
cz = ps[screenpeek].oposz;
cs = ps[screenpeek].cursectnum;
ca = ps[screenpeek].ang+ps[screenpeek].look_ang;
cx = g_player[screenpeek].ps.oposx;
cy = g_player[screenpeek].ps.oposy;
cz = g_player[screenpeek].ps.oposz;
cs = g_player[screenpeek].ps.cursectnum;
ca = g_player[screenpeek].ps.ang+g_player[screenpeek].ps.look_ang;
} else {
cx = sprite[ud.camerasprite].x;
cy = sprite[ud.camerasprite].y;

View file

@ -560,7 +560,7 @@ void sendquit(void)
{
if (gamequit == 0 && (numplayers > 1))
{
if (ps[myconnectindex].gm&MODE_GAME)
if (g_player[myconnectindex].ps.gm&MODE_GAME)
{
gamequit = 1;
quittimer = totalclock+120;
@ -607,14 +607,14 @@ void menus(void)
buttonstat = MOUSE_GetButtons();
}
if ((ps[myconnectindex].gm&MODE_MENU) == 0)
if ((g_player[myconnectindex].ps.gm&MODE_MENU) == 0)
{
walock[TILE_LOADSHOT] = 1;
return;
}
ps[myconnectindex].gm &= (0xff-MODE_TYPE);
ps[myconnectindex].fta = 0;
g_player[myconnectindex].ps.gm &= (0xff-MODE_TYPE);
g_player[myconnectindex].ps.fta = 0;
x = 0;
@ -679,7 +679,7 @@ void menus(void)
ready2send = 1;
totalclock = ototalclock;
}
ps[myconnectindex].gm &= ~MODE_MENU;
g_player[myconnectindex].ps.gm &= ~MODE_MENU;
}
break;
@ -829,11 +829,11 @@ void menus(void)
break;
case 3:
i = config.AutoAim;
i = ud.config.AutoAim;
if (x == io)
config.AutoAim = (config.AutoAim == 2) ? 0 : config.AutoAim+1;
modval(0,2,(int *)&config.AutoAim,1,probey==3);
if (config.AutoAim != i)
ud.config.AutoAim = (ud.config.AutoAim == 2) ? 0 : ud.config.AutoAim+1;
modval(0,2,(int *)&ud.config.AutoAim,1,probey==3);
if (ud.config.AutoAim != i)
updateplayer();
break;
@ -957,7 +957,7 @@ void menus(void)
case 3:
{
char *s[] = { "Off", "All weapons", "Hitscan only" };
gametext(d-50,yy,s[config.AutoAim],MENUHIGHLIGHT(io),2+8+16);
gametext(d-50,yy,s[ud.config.AutoAim],MENUHIGHLIGHT(io),2+8+16);
}
break;
@ -1320,7 +1320,7 @@ void menus(void)
if (KB_KeyPressed(sc_Escape) || KB_KeyPressed(sc_N) || RMB)
{
if (sprite[ps[myconnectindex].i].extra <= 0)
if (sprite[g_player[myconnectindex].ps.i].extra <= 0)
{
if (enterlevel(MODE_GAME)) backtomenu();
return;
@ -1329,7 +1329,7 @@ void menus(void)
KB_ClearKeyDown(sc_N);
KB_ClearKeyDown(sc_Escape);
ps[myconnectindex].gm &= ~MODE_MENU;
g_player[myconnectindex].ps.gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2)
{
ready2send = 1;
@ -1346,13 +1346,13 @@ void menus(void)
if (ud.multimode > 1)
{
loadplayer(-1-lastsavedpos);
ps[myconnectindex].gm = MODE_GAME;
g_player[myconnectindex].ps.gm = MODE_GAME;
}
else
{
c = loadplayer(lastsavedpos);
if (c == 0)
ps[myconnectindex].gm = MODE_GAME;
g_player[myconnectindex].ps.gm = MODE_GAME;
}
}
@ -1506,10 +1506,10 @@ void menus(void)
if (ud.multimode > 1)
{
if (ps[myconnectindex].gm&MODE_GAME)
if (g_player[myconnectindex].ps.gm&MODE_GAME)
{
loadplayer(-1-lastsavedpos);
ps[myconnectindex].gm = MODE_GAME;
g_player[myconnectindex].ps.gm = MODE_GAME;
}
else
{
@ -1532,7 +1532,7 @@ void menus(void)
{
c = loadplayer(lastsavedpos);
if (c == 0)
ps[myconnectindex].gm = MODE_GAME;
g_player[myconnectindex].ps.gm = MODE_GAME;
}
break;
@ -1545,9 +1545,9 @@ void menus(void)
KB_ClearKeyDown(sc_N);
KB_ClearKeyDown(sc_Escape);
sound(EXITMENUSOUND);
if (ps[myconnectindex].gm&MODE_GAME)
if (g_player[myconnectindex].ps.gm&MODE_GAME)
{
ps[myconnectindex].gm &= ~MODE_MENU;
g_player[myconnectindex].ps.gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2)
{
ready2send = 1;
@ -1579,7 +1579,7 @@ void menus(void)
ready2send = 1;
totalclock = ototalclock;
}
ps[myconnectindex].gm &= ~MODE_MENU;
g_player[myconnectindex].ps.gm &= ~MODE_MENU;
sound(EXITMENUSOUND);
break;
}
@ -1963,9 +1963,9 @@ cheat_for_port_credits:
if (KB_KeyPressed(sc_Q)) cmenu(500);
if (x == -1 && (ps[myconnectindex].gm&MODE_GAME || ud.recstat == 2))
if (x == -1 && (g_player[myconnectindex].ps.gm&MODE_GAME || ud.recstat == 2))
{
ps[myconnectindex].gm &= ~MODE_MENU;
g_player[myconnectindex].ps.gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2)
{
ready2send = 1;
@ -2064,7 +2064,7 @@ cheat_for_port_credits:
cmenu(500);
break;
case -1:
ps[myconnectindex].gm &= ~MODE_MENU;
g_player[myconnectindex].ps.gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2)
{
ready2send = 1;
@ -2144,7 +2144,7 @@ cheat_for_port_credits:
}
else if (x == -1)
{
if (ps[myconnectindex].gm&MODE_GAME) cmenu(50);
if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50);
else cmenu(0);
}
@ -2499,9 +2499,9 @@ cheat_for_port_credits:
break;
case 3:
enabled = usehightile;
if (enabled && x==io) config.useprecache = !config.useprecache;
if (enabled) modval(0,1,(int *)&config.useprecache,1,probey==io);
gametextpal(d,yy, config.useprecache && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0);
if (enabled && x==io) ud.config.useprecache = !ud.config.useprecache;
if (enabled) modval(0,1,(int *)&ud.config.useprecache,1,probey==io);
gametextpal(d,yy, ud.config.useprecache && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0);
break;
case 4:
enabled = usehightile;
@ -2510,13 +2510,13 @@ cheat_for_port_credits:
gametextpal(d,yy, glusetexcompr && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0);
break;
case 5:
enabled = (glusetexcompr && usehightile && config.useprecache);
enabled = (glusetexcompr && usehightile && ud.config.useprecache);
if (enabled && x==io) glusetexcache = !glusetexcache;
if (enabled) modval(0,1,(int *)&glusetexcache,1,probey==io);
gametextpal(d,yy, glusetexcache && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0);
break;
case 6:
enabled = (glusetexcompr && usehightile && config.useprecache && glusetexcache);
enabled = (glusetexcompr && usehightile && ud.config.useprecache && glusetexcache);
if (enabled && x==io) glusetexcachecompression = !glusetexcachecompression;
if (enabled) modval(0,1,(int *)&glusetexcachecompression,1,probey==io);
gametextpal(d,yy, glusetexcachecompression && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0);
@ -2679,8 +2679,8 @@ cheat_for_port_credits:
case 7:
if (x==io) ud.showweapons = 1-ud.showweapons;
modval(0,1,(int *)&ud.showweapons,1,probey==io);
config.ShowOpponentWeapons = ud.showweapons;
gametextpal(d,yy, config.ShowOpponentWeapons ? "On" : "Off", MENUHIGHLIGHT(io), 0);
ud.config.ShowOpponentWeapons = ud.showweapons;
gametextpal(d,yy, ud.config.ShowOpponentWeapons ? "On" : "Off", MENUHIGHLIGHT(io), 0);
break;
case 8:
if (x==io) ud.democams = 1-ud.democams;
@ -2690,13 +2690,13 @@ cheat_for_port_credits:
case 9:
if (x==io)
{
enabled = !((ps[myconnectindex].gm&MODE_GAME) && ud.m_recstat != 1);
if ((ps[myconnectindex].gm&MODE_GAME)) closedemowrite();
enabled = !((g_player[myconnectindex].ps.gm&MODE_GAME) && ud.m_recstat != 1);
if ((g_player[myconnectindex].ps.gm&MODE_GAME)) closedemowrite();
else ud.m_recstat = !ud.m_recstat;
}
if ((ps[myconnectindex].gm&MODE_GAME) && ud.m_recstat != 1)
if ((g_player[myconnectindex].ps.gm&MODE_GAME) && ud.m_recstat != 1)
enabled = 0;
gametextpal(d,yy,ud.m_recstat?((ud.m_recstat && enabled && ps[myconnectindex].gm&MODE_GAME)?"Running":"On"):"Off",enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE,enabled?0:1);
gametextpal(d,yy,ud.m_recstat?((ud.m_recstat && enabled && g_player[myconnectindex].ps.gm&MODE_GAME)?"Running":"On"):"Off",enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE,enabled?0:1);
break;
case 10:
if (x==io) cmenu(201);
@ -2834,18 +2834,18 @@ cheat_for_port_credits:
gametextpal(d,yy, ud.idplayers ? "On" : "Off", MENUHIGHLIGHT(io), 0);
break;
case 7:
if (x==io) config.ForceSetup = 1-config.ForceSetup;
modval(0,1,(int *)&config.ForceSetup,1,probey==io);
gametextpal(d,yy, config.ForceSetup ? "On" : "Off", MENUHIGHLIGHT(io), 0);
if (x==io) ud.config.ForceSetup = 1-ud.config.ForceSetup;
modval(0,1,(int *)&ud.config.ForceSetup,1,probey==io);
gametextpal(d,yy, ud.config.ForceSetup ? "On" : "Off", MENUHIGHLIGHT(io), 0);
break;
#ifdef _WIN32
case 8:
i = config.CheckForUpdates;
if (x==io) config.CheckForUpdates = 1-config.CheckForUpdates;
modval(0,1,(int *)&config.CheckForUpdates,1,probey==io);
if (config.CheckForUpdates != i)
config.LastUpdateCheck = 0;
gametextpal(d,yy, config.CheckForUpdates ? "On" : "Off", MENUHIGHLIGHT(io), 0);
i = ud.config.CheckForUpdates;
if (x==io) ud.config.CheckForUpdates = 1-ud.config.CheckForUpdates;
modval(0,1,(int *)&ud.config.CheckForUpdates,1,probey==io);
if (ud.config.CheckForUpdates != i)
ud.config.LastUpdateCheck = 0;
gametextpal(d,yy, ud.config.CheckForUpdates ? "On" : "Off", MENUHIGHLIGHT(io), 0);
break;
case 9:
#else
@ -2878,7 +2878,7 @@ cheat_for_port_credits:
switch (x)
{
case -1:
if (ps[myconnectindex].gm&MODE_GAME) cmenu(50);
if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50);
else cmenu(0);
break;
@ -3170,10 +3170,10 @@ cheat_for_port_credits:
curvidset = newvidset;
changesmade = 0;
config.ScreenMode = fullscreen;
config.ScreenWidth = xdim;
config.ScreenHeight = ydim;
config.ScreenBPP = bpp;
ud.config.ScreenMode = fullscreen;
ud.config.ScreenWidth = xdim;
ud.config.ScreenHeight = ydim;
ud.config.ScreenBPP = bpp;
}
break;
@ -3236,7 +3236,7 @@ cheat_for_port_credits:
if (x==4)
{
ud.brightness = ss;
setbrightness(ud.brightness>>2,&ps[myconnectindex].palette[0],0);
setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps.palette[0],0);
}
}
@ -3339,8 +3339,8 @@ cheat_for_port_credits:
}
else if (KB_KeyPressed(sc_Delete))
{
config.KeyboardKeys[probey][currentlist] = 0;
CONTROL_MapKey(probey, config.KeyboardKeys[probey][0], config.KeyboardKeys[probey][1]);
ud.config.KeyboardKeys[probey][currentlist] = 0;
CONTROL_MapKey(probey, ud.config.KeyboardKeys[probey][0], ud.config.KeyboardKeys[probey][1]);
sound(KICK_HIT);
KB_ClearKeyDown(sc_Delete);
}
@ -3354,14 +3354,14 @@ cheat_for_port_credits:
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(70,34+l*8,tempbuf,(m+l == probey)?0:16,1,10+16);
//strcpy(tempbuf, KB_ScanCodeToString(config.KeyboardKeys[m+l][0]));
strcpy(tempbuf, (char *)getkeyname(config.KeyboardKeys[m+l][0]));
//strcpy(tempbuf, KB_ScanCodeToString(ud.config.KeyboardKeys[m+l][0]));
strcpy(tempbuf, (char *)getkeyname(ud.config.KeyboardKeys[m+l][0]));
if (!tempbuf[0]) strcpy(tempbuf, " -");
minitextshade(70+100,34+l*8,tempbuf,
(m+l == probey && !currentlist?0:16),2,10+16);
//strcpy(tempbuf, KB_ScanCodeToString(config.KeyboardKeys[m+l][1]));
strcpy(tempbuf, (char *)getkeyname(config.KeyboardKeys[m+l][1]));
//strcpy(tempbuf, KB_ScanCodeToString(ud.config.KeyboardKeys[m+l][1]));
strcpy(tempbuf, (char *)getkeyname(ud.config.KeyboardKeys[m+l][1]));
if (!tempbuf[0]) strcpy(tempbuf, " -");
minitextshade(70+120+34,34+l*8,tempbuf,
(m+l == probey && currentlist?0:16),2,10+16);
@ -3397,11 +3397,11 @@ cheat_for_port_credits:
{
sound(PISTOL_BODYHIT);
config.KeyboardKeys[function][whichkey] = KB_GetLastScanCode();
ud.config.KeyboardKeys[function][whichkey] = KB_GetLastScanCode();
if (function == gamefunc_Show_Console)
OSD_CaptureKey(KB_GetLastScanCode());
else
CONTROL_MapKey(function, config.KeyboardKeys[function][0], config.KeyboardKeys[function][1]);
CONTROL_MapKey(function, ud.config.KeyboardKeys[function][0], ud.config.KeyboardKeys[function][1]);
}
cmenu(204);
@ -3459,9 +3459,9 @@ cheat_for_port_credits:
function = 0;
whichkey = x;
if (x < (MAXMOUSEBUTTONS-2)*2)
probey = config.MouseFunctions[x>>1][x&1];
probey = ud.config.MouseFunctions[x>>1][x&1];
else
probey = config.MouseFunctions[x-4][0];
probey = ud.config.MouseFunctions[x-4][0];
if (probey < 0) probey = NUMGAMEFUNCTIONS-1;
break;
}
@ -3474,16 +3474,16 @@ cheat_for_port_credits:
if (l&1)
{
Bstrcpy(tempbuf, "Double ");
m = config.MouseFunctions[l>>1][1];
m = ud.config.MouseFunctions[l>>1][1];
}
else
m = config.MouseFunctions[l>>1][0];
m = ud.config.MouseFunctions[l>>1][0];
Bstrcat(tempbuf, mousebuttonnames[l>>1]);
}
else
{
Bstrcpy(tempbuf, mousebuttonnames[l-(MAXMOUSEBUTTONS-2)]);
m = config.MouseFunctions[l-(MAXMOUSEBUTTONS-2)][0];
m = ud.config.MouseFunctions[l-(MAXMOUSEBUTTONS-2)][0];
}
minitextshade(c+20,36+l*8,tempbuf,(l==probey)?0:16,1,10+16);
@ -3574,12 +3574,12 @@ cheat_for_port_credits:
{
if (whichkey < (MAXMOUSEBUTTONS-2)*2)
{
config.MouseFunctions[whichkey>>1][whichkey&1] = x;
ud.config.MouseFunctions[whichkey>>1][whichkey&1] = x;
CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_mouse);
}
else
{
config.MouseFunctions[whichkey-(MAXMOUSEBUTTONS-2)][0] = x;
ud.config.MouseFunctions[whichkey-(MAXMOUSEBUTTONS-2)][0] = x;
CONTROL_MapButton(x, whichkey-(MAXMOUSEBUTTONS-2), 0, controldevice_mouse);
}
cmenu(205);
@ -3587,7 +3587,7 @@ cheat_for_port_credits:
}
else if (function == 1)
{
config.MouseDigitalFunctions[whichkey>>1][whichkey&1] = x;
ud.config.MouseDigitalFunctions[whichkey>>1][whichkey&1] = x;
CONTROL_MapDigitalAxis(whichkey>>1, x, whichkey&1, controldevice_mouse);
cmenu(212);
probey = 3+(whichkey^2);
@ -3596,12 +3596,12 @@ cheat_for_port_credits:
{
if (whichkey < 2*joynumbuttons)
{
config.JoystickFunctions[whichkey>>1][whichkey&1] = x;
ud.config.JoystickFunctions[whichkey>>1][whichkey&1] = x;
CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_joystick);
}
else
{
config.JoystickFunctions[joynumbuttons + (whichkey-2*joynumbuttons)][0] = x;
ud.config.JoystickFunctions[joynumbuttons + (whichkey-2*joynumbuttons)][0] = x;
CONTROL_MapButton(x, joynumbuttons + (whichkey-2*joynumbuttons), 0, controldevice_joystick);
}
cmenu(207);
@ -3609,7 +3609,7 @@ cheat_for_port_credits:
}
else if (function == 3)
{
config.JoystickDigitalFunctions[whichkey>>1][whichkey&1] = x;
ud.config.JoystickDigitalFunctions[whichkey>>1][whichkey&1] = x;
CONTROL_MapDigitalAxis(whichkey>>1, x, whichkey&1, controldevice_joystick);
cmenu((whichkey>>2)+208);
probey = 1+((whichkey>>1)&1)*4+(whichkey&1);
@ -3739,7 +3739,7 @@ cheat_for_port_credits:
function = 1;
whichkey = (x-3)^2; // flip the actual axis number
cmenu(211);
probey = config.MouseDigitalFunctions[whichkey>>1][whichkey&1];
probey = ud.config.MouseDigitalFunctions[whichkey>>1][whichkey&1];
if (probey < 0) probey = NUMGAMEFUNCTIONS-1;
break;
}
@ -3755,79 +3755,79 @@ cheat_for_port_credits:
}
menutext(c,46,MENUHIGHLIGHT(0),0,"X-AXIS SCALE");
l = (config.MouseAnalogueScale[0]+262144) >> 13;
l = (ud.config.MouseAnalogueScale[0]+262144) >> 13;
bar(c+160+40,46,(short *)&l,1,x==0,MENUHIGHLIGHT(0),0);
l = (l<<13)-262144;
if (l != config.MouseAnalogueScale[0])
if (l != ud.config.MouseAnalogueScale[0])
{
CONTROL_SetAnalogAxisScale(0, l, controldevice_mouse);
config.MouseAnalogueScale[0] = l;
ud.config.MouseAnalogueScale[0] = l;
}
Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0);
gametext(c+160-16,46-8,tempbuf,MENUHIGHLIGHT(0),2+8+16);
menutext(c,46+16,MENUHIGHLIGHT(1),0,"Y-AXIS SCALE");
l = (config.MouseAnalogueScale[1]+262144) >> 13;
l = (ud.config.MouseAnalogueScale[1]+262144) >> 13;
bar(c+160+40,46+16,(short *)&l,1,x==1,MENUHIGHLIGHT(1),0);
l = (l<<13)-262144;
if (l != config.MouseAnalogueScale[1])
if (l != ud.config.MouseAnalogueScale[1])
{
CONTROL_SetAnalogAxisScale(1, l, controldevice_mouse);
config.MouseAnalogueScale[1] = l;
ud.config.MouseAnalogueScale[1] = l;
}
Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0);
gametext(c+160-16,46+16-8,tempbuf,MENUHIGHLIGHT(1),2+8+16);
menutext(c,46+16+16,MENUHIGHLIGHT(2),0,"DEAD ZONE");
l = config.MouseFilter>>1;
l = ud.config.MouseFilter>>1;
bar(c+160+40,46+16+16,(short *)&l,2,x==2,MENUHIGHLIGHT(2),0);
config.MouseFilter = l<<1;
ud.config.MouseFilter = l<<1;
menutext(c,46+16+16+16+8,/*(MENUHIGHLIGHT(3))+(MENUHIGHLIGHT(4))+(MENUHIGHLIGHT(5))+(MENUHIGHLIGHT(6))-24*/0,0,"DIGITAL AXES ACTIONS");
if (config.MouseFilter == 0)
if (ud.config.MouseFilter == 0)
Bsprintf(tempbuf," OFF");
else if (config.MouseFilter < 48)
else if (ud.config.MouseFilter < 48)
Bsprintf(tempbuf," LOW");
else if (config.MouseFilter < 96)
else if (ud.config.MouseFilter < 96)
Bsprintf(tempbuf," MED");
else if (config.MouseFilter < 128)
else if (ud.config.MouseFilter < 128)
Bsprintf(tempbuf,"HIGH");
gametext(c+160-16,46+16+16-8,tempbuf,MENUHIGHLIGHT(2),2+8+16);
gametextpal(c+10,90+16,"UP:",MENUHIGHLIGHT(3),10);
if (config.MouseDigitalFunctions[1][0] < 0)
if (ud.config.MouseDigitalFunctions[1][0] < 0)
strcpy(tempbuf, " -NONE-");
else
strcpy(tempbuf, CONFIG_FunctionNumToName(config.MouseDigitalFunctions[1][0]));
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[1][0]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(c+10+60,91+16,tempbuf,MENUHIGHLIGHT(3),0,10+16);
gametextpal(c+10,90+16+10,"DOWN:",MENUHIGHLIGHT(4),10);
if (config.MouseDigitalFunctions[1][1] < 0)
if (ud.config.MouseDigitalFunctions[1][1] < 0)
strcpy(tempbuf, " -NONE-");
else
strcpy(tempbuf, CONFIG_FunctionNumToName(config.MouseDigitalFunctions[1][1]));
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[1][1]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(c+10+60,91+16+10,tempbuf,MENUHIGHLIGHT(4),0,10+16);
gametextpal(c+10,90+16+10+10,"LEFT:",MENUHIGHLIGHT(5),10);
if (config.MouseDigitalFunctions[0][0] < 0)
if (ud.config.MouseDigitalFunctions[0][0] < 0)
strcpy(tempbuf, " -NONE-");
else
strcpy(tempbuf, CONFIG_FunctionNumToName(config.MouseDigitalFunctions[0][0]));
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[0][0]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(c+10+60,91+16+10+10,tempbuf,MENUHIGHLIGHT(5),0,10+16);
gametextpal(c+10,90+16+10+10+10,"RIGHT:",MENUHIGHLIGHT(6),10);
if (config.MouseDigitalFunctions[0][1] < 0)
if (ud.config.MouseDigitalFunctions[0][1] < 0)
strcpy(tempbuf, " -NONE-");
else
strcpy(tempbuf, CONFIG_FunctionNumToName(config.MouseDigitalFunctions[0][1]));
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[0][1]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(c+10+60,91+16+10+10+10,tempbuf,MENUHIGHLIGHT(6),0,10+16);
@ -3882,11 +3882,11 @@ cheat_for_port_credits:
cmenu(211);
if (x < 2*joynumbuttons)
{
probey = config.JoystickFunctions[x>>1][x&1];
probey = ud.config.JoystickFunctions[x>>1][x&1];
}
else
{
probey = config.JoystickFunctions[joynumbuttons + (x-2*joynumbuttons)][0];
probey = ud.config.JoystickFunctions[joynumbuttons + (x-2*joynumbuttons)][0];
}
if (probey < 0) probey = NUMGAMEFUNCTIONS-1;
break;
@ -3906,7 +3906,7 @@ cheat_for_port_credits:
if (m+l < 2*joynumbuttons)
{
sprintf(tempbuf, "%s%s", ((l+m)&1)?"Double ":"", getjoyname(1,(l+m)>>1));
x = config.JoystickFunctions[(l+m)>>1][(l+m)&1];
x = ud.config.JoystickFunctions[(l+m)>>1][(l+m)&1];
}
else
{
@ -3914,7 +3914,7 @@ cheat_for_port_credits:
{ "Up", "Right", "Down", "Left"
};
sprintf(tempbuf, "Hat %s", directions[(l+m)-2*joynumbuttons]);
x = config.JoystickFunctions[joynumbuttons + ((l+m)-2*joynumbuttons)][0];
x = ud.config.JoystickFunctions[joynumbuttons + ((l+m)-2*joynumbuttons)][0];
}
minitextshade(80-4,33+l*8,tempbuf,(m+l == probey)?0:16,1,10+16);
@ -4003,19 +4003,19 @@ cheat_for_port_credits:
function = 3;
whichkey = ((thispage*2+(x==5||x==6)) << 1) + (x==2||x==6);
cmenu(211);
probey = config.JoystickDigitalFunctions[whichkey>>1][whichkey&1];
probey = ud.config.JoystickDigitalFunctions[whichkey>>1][whichkey&1];
if (probey < 0) probey = NUMGAMEFUNCTIONS-1;
break;
case 3: // analogues
case 7:
l = config.JoystickAnalogueAxes[thispage*2+(x==7)];
l = ud.config.JoystickAnalogueAxes[thispage*2+(x==7)];
if (l == analog_turning) l = analog_strafing;
else if (l == analog_strafing) l = analog_lookingupanddown;
else if (l == analog_lookingupanddown) l = analog_moving;
else if (l == analog_moving) l = -1;
else l = analog_turning;
config.JoystickAnalogueAxes[thispage*2+(x==7)] = l;
ud.config.JoystickAnalogueAxes[thispage*2+(x==7)] = l;
CONTROL_MapAnalogAxis(thispage*2+(x==7),l,controldevice_joystick);
{
extern int32 mouseyaxismode; // player.c
@ -4034,38 +4034,38 @@ cheat_for_port_credits:
menutext(42,32+64,0,0,tempbuf);
}
gametext(76,38,"SCALE",0,2+8+16);
l = (config.JoystickAnalogueScale[thispage*2]+262144) >> 13;
l = (ud.config.JoystickAnalogueScale[thispage*2]+262144) >> 13;
bar(140+56,38+8,(short *)&l,1,x==0,0,0);
l = (l<<13)-262144;
if (l != config.JoystickAnalogueScale[thispage*2])
if (l != ud.config.JoystickAnalogueScale[thispage*2])
{
CONTROL_SetAnalogAxisScale(thispage*2, l, controldevice_joystick);
config.JoystickAnalogueScale[thispage*2] = l;
ud.config.JoystickAnalogueScale[thispage*2] = l;
}
Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0);
gametext(140,38,tempbuf,0,2+8+16);
gametext(76,38+15,"DIGITAL",0,2+8+16);
if (config.JoystickDigitalFunctions[thispage*2][0] < 0)
if (ud.config.JoystickDigitalFunctions[thispage*2][0] < 0)
strcpy(tempbuf, " -NONE-");
else
strcpy(tempbuf, CONFIG_FunctionNumToName(config.JoystickDigitalFunctions[thispage*2][0]));
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2][0]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitext(140+12,38+15,tempbuf,0,10+16);
if (config.JoystickDigitalFunctions[thispage*2][1] < 0)
if (ud.config.JoystickDigitalFunctions[thispage*2][1] < 0)
strcpy(tempbuf, " -NONE-");
else
strcpy(tempbuf, CONFIG_FunctionNumToName(config.JoystickDigitalFunctions[thispage*2][1]));
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2][1]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitext(140+12+72,38+15,tempbuf,0,10+16);
gametext(76,38+15+15,"ANALOG",0,2+8+16);
if (CONFIG_AnalogNumToName(config.JoystickAnalogueAxes[thispage*2]))
if (CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2]))
{
p = CONFIG_AnalogNumToName(config.JoystickAnalogueAxes[thispage*2]);
p = CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2]);
if (p)
{
gametext(140+12,38+15+15, strchr(p,'_')+1, 0, 2+8+16);
@ -4075,38 +4075,38 @@ cheat_for_port_credits:
if (twothispage)
{
gametext(76,38+64,"SCALE",0,2+8+16);
l = (config.JoystickAnalogueScale[thispage*2+1]+262144) >> 13;
l = (ud.config.JoystickAnalogueScale[thispage*2+1]+262144) >> 13;
bar(140+56,38+8+64,(short *)&l,1,x==4,0,0);
l = (l<<13)-262144;
if (l != config.JoystickAnalogueScale[thispage*2+1])
if (l != ud.config.JoystickAnalogueScale[thispage*2+1])
{
CONTROL_SetAnalogAxisScale(thispage*2+1, l, controldevice_joystick);
config.JoystickAnalogueScale[thispage*2+1] = l;
ud.config.JoystickAnalogueScale[thispage*2+1] = l;
}
Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0);
gametext(140,38+64,tempbuf,0,2+8+16);
gametext(76,38+64+15,"DIGITAL",0,2+8+16);
if (config.JoystickDigitalFunctions[thispage*2+1][0] < 0)
if (ud.config.JoystickDigitalFunctions[thispage*2+1][0] < 0)
strcpy(tempbuf, " -NONE-");
else
strcpy(tempbuf, CONFIG_FunctionNumToName(config.JoystickDigitalFunctions[thispage*2+1][0]));
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2+1][0]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitext(140+12,38+15+64,tempbuf,0,10+16);
if (config.JoystickDigitalFunctions[thispage*2+1][1] < 0)
if (ud.config.JoystickDigitalFunctions[thispage*2+1][1] < 0)
strcpy(tempbuf, " -NONE-");
else
strcpy(tempbuf, CONFIG_FunctionNumToName(config.JoystickDigitalFunctions[thispage*2+1][1]));
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2+1][1]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitext(140+12+72,38+15+64,tempbuf,0,10+16);
gametext(76,38+64+15+15,"ANALOG",0,2+8+16);
if (CONFIG_AnalogNumToName(config.JoystickAnalogueAxes[thispage*2+1]))
if (CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2+1]))
{
p = CONFIG_AnalogNumToName(config.JoystickAnalogueAxes[thispage*2+1]);
p = CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2+1]);
if (p)
{
gametext(140+12,38+64+15+15, strchr(p,'_')+1, 0, 2+8+16);
@ -4161,8 +4161,8 @@ cheat_for_port_credits:
gametext(128,48+30*(m-first)-8,"DEAD",0,2+8+16);
gametext(128,48+30*(m-first)-8+15,"SATU",0,2+8+16);
dx = odx = min(64,64l*config.JoystickAnalogueDead[m]/10000l);
dy = ody = min(64,64l*config.JoystickAnalogueSaturate[m]/10000l);
dx = odx = min(64,64l*ud.config.JoystickAnalogueDead[m]/10000l);
dy = ody = min(64,64l*ud.config.JoystickAnalogueSaturate[m]/10000l);
bar(217,48+30*(m-first),(short *)&dx,4,x==((m-first)*2),0,0);
bar(217,48+30*(m-first)+15,(short *)&dy,4,x==((m-first)*2+1),0,0);
@ -4172,10 +4172,10 @@ cheat_for_port_credits:
Bsprintf(tempbuf,"%3d%%",100*dy/64);
gametext(217-49,48+30*(m-first)-8+15,tempbuf,0,2+8+16);
if (dx != odx) config.JoystickAnalogueDead[m] = 10000l*dx/64l;
if (dy != ody) config.JoystickAnalogueSaturate[m] = 10000l*dy/64l;
if (dx != odx) ud.config.JoystickAnalogueDead[m] = 10000l*dx/64l;
if (dy != ody) ud.config.JoystickAnalogueSaturate[m] = 10000l*dy/64l;
if (dx != odx || dy != ody)
setjoydeadzone(m,config.JoystickAnalogueDead[m],config.JoystickAnalogueSaturate[m]);
setjoydeadzone(m,ud.config.JoystickAnalogueDead[m],ud.config.JoystickAnalogueSaturate[m]);
}
//gametext(160,158,"DEAD = DEAD ZONE, SAT. = SATURATION",0,2+8+16);
if (joynumaxes>4)
@ -4198,9 +4198,9 @@ cheat_for_port_credits:
switch (x)
{
case -1:
if (ps[myconnectindex].gm&MODE_GAME && current_menu == 701)
if (g_player[myconnectindex].ps.gm&MODE_GAME && current_menu == 701)
{
ps[myconnectindex].gm &= ~MODE_MENU;
g_player[myconnectindex].ps.gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2)
{
ready2send = 1;
@ -4212,10 +4212,10 @@ cheat_for_port_credits:
probey = 1;
break;
case 0:
if (config.FXDevice >= 0)
if (ud.config.FXDevice >= 0)
{
config.SoundToggle = 1-config.SoundToggle;
if (config.SoundToggle == 0)
ud.config.SoundToggle = 1-ud.config.SoundToggle;
if (ud.config.SoundToggle == 0)
{
FX_StopAllSounds();
clearsoundlocks();
@ -4224,13 +4224,13 @@ cheat_for_port_credits:
}
break;
case 1:
if (config.MusicDevice >= 0 && (numplayers < 2 || config.MusicToggle))
if (ud.config.MusicDevice >= 0 && (numplayers < 2 || ud.config.MusicToggle))
{
config.MusicToggle = 1-config.MusicToggle;
if (config.MusicToggle == 0) MUSIC_Pause();
ud.config.MusicToggle = 1-ud.config.MusicToggle;
if (ud.config.MusicToggle == 0) MUSIC_Pause();
else
{
if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME)
if (ud.recstat != 2 && g_player[myconnectindex].ps.gm&MODE_GAME)
{
if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&map[(unsigned char)music_select].musicfn[0]);
@ -4244,21 +4244,21 @@ cheat_for_port_credits:
break;
case 4:
if (config.SoundToggle && (config.FXDevice >= 0))
if (ud.config.SoundToggle && (ud.config.FXDevice >= 0))
{
config.VoiceToggle = (config.VoiceToggle == 2) ? 0 : config.VoiceToggle+1;
ud.config.VoiceToggle = (ud.config.VoiceToggle == 2) ? 0 : ud.config.VoiceToggle+1;
}
onbar = 0;
break;
case 5:
if (config.SoundToggle && (config.FXDevice >= 0)) config.AmbienceToggle = 1-config.AmbienceToggle;
if (ud.config.SoundToggle && (ud.config.FXDevice >= 0)) ud.config.AmbienceToggle = 1-ud.config.AmbienceToggle;
onbar = 0;
break;
case 6:
if (config.SoundToggle && (config.FXDevice >= 0))
if (ud.config.SoundToggle && (ud.config.FXDevice >= 0))
{
config.ReverseStereo = 1-config.ReverseStereo;
FX_SetReverseStereo(config.ReverseStereo);
ud.config.ReverseStereo = 1-ud.config.ReverseStereo;
FX_SetReverseStereo(ud.config.ReverseStereo);
}
onbar = 0;
break;
@ -4267,48 +4267,48 @@ cheat_for_port_credits:
break;
}
menutext(c+151+40,50,MENUHIGHLIGHT(0),(config.FXDevice<0),config.SoundToggle && config.FXDevice >= 0?"ON":"OFF");
menutext(c+151+40,50,MENUHIGHLIGHT(0),(ud.config.FXDevice<0),ud.config.SoundToggle && ud.config.FXDevice >= 0?"ON":"OFF");
menutext(c+151+40,50+16,MENUHIGHLIGHT(1),(config.MusicDevice<0||(numplayers > 1 && !config.MusicToggle)),(config.MusicToggle && (config.MusicDevice >= 0))?"ON":"OFF");
menutext(c+151+40,50+16,MENUHIGHLIGHT(1),(ud.config.MusicDevice<0||(numplayers > 1 && !ud.config.MusicToggle)),(ud.config.MusicToggle && (ud.config.MusicDevice >= 0))?"ON":"OFF");
menutext(c,50,MENUHIGHLIGHT(0),(config.FXDevice<0),"SOUND");
menutext(c,50+16+16,MENUHIGHLIGHT(2),(config.FXDevice<0)||config.SoundToggle==0,"SOUND VOLUME");
menutext(c,50,MENUHIGHLIGHT(0),(ud.config.FXDevice<0),"SOUND");
menutext(c,50+16+16,MENUHIGHLIGHT(2),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"SOUND VOLUME");
{
l = config.FXVolume;
config.FXVolume >>= 2;
bar(c+167+40,50+16+16,(short *)&config.FXVolume,4,(config.FXDevice>=0)&&x==2,MENUHIGHLIGHT(2),config.SoundToggle==0||(config.FXDevice<0));
if (l != config.FXVolume)
config.FXVolume <<= 2;
if (l != config.FXVolume)
FX_SetVolume((short) config.FXVolume);
l = ud.config.FXVolume;
ud.config.FXVolume >>= 2;
bar(c+167+40,50+16+16,(short *)&ud.config.FXVolume,4,(ud.config.FXDevice>=0)&&x==2,MENUHIGHLIGHT(2),ud.config.SoundToggle==0||(ud.config.FXDevice<0));
if (l != ud.config.FXVolume)
ud.config.FXVolume <<= 2;
if (l != ud.config.FXVolume)
FX_SetVolume((short) ud.config.FXVolume);
}
menutext(c,50+16,MENUHIGHLIGHT(1),(config.MusicDevice<0||(numplayers > 1 && !config.MusicToggle)),"MUSIC");
menutext(c,50+16+16+16,MENUHIGHLIGHT(3),(config.MusicDevice<0)||config.MusicToggle==0,"MUSIC VOLUME");
menutext(c,50+16,MENUHIGHLIGHT(1),(ud.config.MusicDevice<0||(numplayers > 1 && !ud.config.MusicToggle)),"MUSIC");
menutext(c,50+16+16+16,MENUHIGHLIGHT(3),(ud.config.MusicDevice<0)||ud.config.MusicToggle==0,"MUSIC VOLUME");
{
l = config.MusicVolume;
config.MusicVolume >>= 2;
l = ud.config.MusicVolume;
ud.config.MusicVolume >>= 2;
bar(c+167+40,50+16+16+16,
(short *)&config.MusicVolume,4,
(config.MusicDevice>=0) && x==3,MENUHIGHLIGHT(3),
config.MusicToggle==0||(config.MusicDevice<0));
config.MusicVolume <<= 2;
if (l != config.MusicVolume)
MUSIC_SetVolume((short) config.MusicVolume);
(short *)&ud.config.MusicVolume,4,
(ud.config.MusicDevice>=0) && x==3,MENUHIGHLIGHT(3),
ud.config.MusicToggle==0||(ud.config.MusicDevice<0));
ud.config.MusicVolume <<= 2;
if (l != ud.config.MusicVolume)
MUSIC_SetVolume((short) ud.config.MusicVolume);
}
menutext(c,50+16+16+16+16,MENUHIGHLIGHT(4),(config.FXDevice<0)||config.SoundToggle==0,"DUKE TALK");
menutext(c,50+16+16+16+16+16,MENUHIGHLIGHT(5),(config.FXDevice<0)||config.SoundToggle==0,"AMBIENCE");
menutext(c,50+16+16+16+16,MENUHIGHLIGHT(4),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"DUKE TALK");
menutext(c,50+16+16+16+16+16,MENUHIGHLIGHT(5),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"AMBIENCE");
menutext(c,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(config.FXDevice<0)||config.SoundToggle==0,"FLIP STEREO");
menutext(c,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"FLIP STEREO");
{
char *s[] = { "OFF", "LOCAL", "ALL" };
menutext(c+151+40,50+16+16+16+16,MENUHIGHLIGHT(4),(config.FXDevice<0)||config.SoundToggle==0,s[config.VoiceToggle]);
menutext(c+151+40,50+16+16+16+16,MENUHIGHLIGHT(4),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,s[ud.config.VoiceToggle]);
}
menutext(c+151+40,50+16+16+16+16+16,MENUHIGHLIGHT(5),(config.FXDevice<0)||config.SoundToggle==0,config.AmbienceToggle?"ON":"OFF");
menutext(c+151+40,50+16+16+16+16+16,MENUHIGHLIGHT(5),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,ud.config.AmbienceToggle?"ON":"OFF");
menutext(c+151+40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(config.FXDevice<0)||config.SoundToggle==0,config.ReverseStereo?"ON":"OFF");
menutext(c+151+40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,ud.config.ReverseStereo?"ON":"OFF");
break;
@ -4354,7 +4354,7 @@ cheat_for_port_credits:
if (x == -1)
{
// readsavenames();
ps[myconnectindex].gm = MODE_GAME;
g_player[myconnectindex].ps.gm = MODE_GAME;
if (ud.multimode < 2 && ud.recstat != 2)
{
ready2send = 1;
@ -4376,7 +4376,7 @@ cheat_for_port_credits:
saveplayer(-1-(current_menu-360));
else saveplayer(current_menu-360);
lastsavedpos = current_menu-360;
ps[myconnectindex].gm = MODE_GAME;
g_player[myconnectindex].ps.gm = MODE_GAME;
if (ud.multimode < 2 && ud.recstat != 2)
{
@ -4441,16 +4441,16 @@ cheat_for_port_credits:
case -1:
if (current_menu == 300)
{
if ((ps[myconnectindex].gm&MODE_GAME) != MODE_GAME)
if ((g_player[myconnectindex].ps.gm&MODE_GAME) != MODE_GAME)
{
cmenu(0);
break;
}
else
ps[myconnectindex].gm &= ~MODE_MENU;
g_player[myconnectindex].ps.gm &= ~MODE_MENU;
}
else
ps[myconnectindex].gm = MODE_GAME;
g_player[myconnectindex].ps.gm = MODE_GAME;
if (ud.multimode < 2 && ud.recstat != 2)
{
@ -4544,7 +4544,7 @@ DISPLAYNAMES:
if (KB_KeyPressed(sc_Escape))
{
if (ps[myconnectindex].gm&MODE_GAME)
if (g_player[myconnectindex].ps.gm&MODE_GAME)
cmenu(50);
else cmenu(0);
return;
@ -4604,7 +4604,7 @@ VOLUME_ALL_40x:
if (x == -1)
{
if (ps[myconnectindex].gm&MODE_GAME)
if (g_player[myconnectindex].ps.gm&MODE_GAME)
cmenu(50);
else cmenu(0);
return;
@ -4642,8 +4642,8 @@ VOLUME_ALL_40x:
{
KB_ClearKeyDown(sc_N);
quittimer = 0;
if (ps[myconnectindex].gm&MODE_DEMO && ud.recstat == 2)
ps[myconnectindex].gm = MODE_DEMO;
if (g_player[myconnectindex].ps.gm&MODE_DEMO && ud.recstat == 2)
g_player[myconnectindex].ps.gm = MODE_DEMO;
else
{
if (current_menu == 502)
@ -4651,9 +4651,9 @@ VOLUME_ALL_40x:
cmenu(last_menu);
probey = last_menu_pos;
}
else if (!(ps[myconnectindex].gm & MODE_GAME || ud.recstat == 2))
else if (!(g_player[myconnectindex].ps.gm & MODE_GAME || ud.recstat == 2))
cmenu(0);
else ps[myconnectindex].gm &= ~MODE_MENU;
else g_player[myconnectindex].ps.gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2)
{
ready2send = 1;
@ -4671,7 +4671,7 @@ VOLUME_ALL_40x:
if (KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB)
{
KB_FlushKeyboardQueue();
ps[myconnectindex].gm = MODE_DEMO;
g_player[myconnectindex].ps.gm = MODE_DEMO;
if (ud.recstat == 1)
closedemowrite();
cmenu(0);
@ -4681,7 +4681,7 @@ VOLUME_ALL_40x:
if (x == -1 || KB_KeyPressed(sc_N) || RMB)
{
ps[myconnectindex].gm &= ~MODE_MENU;
g_player[myconnectindex].ps.gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2)
{
ready2send = 1;
@ -4694,7 +4694,7 @@ VOLUME_ALL_40x:
case 601:
displayfragbar();
rotatesprite(160<<16,29<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
menutext(320>>1,34,0,0,&ud.user_name[myconnectindex][0]);
menutext(320>>1,34,0,0,&g_player[myconnectindex].user_name[0]);
sprintf(tempbuf,"Waiting for master");
gametext(160,50,tempbuf,0,2+8+16);
@ -4724,7 +4724,7 @@ VOLUME_ALL_40x:
x = probe(186,124,0,0);
if (voting != myconnectindex)
ps[myconnectindex].gm &= ~MODE_MENU;
g_player[myconnectindex].ps.gm &= ~MODE_MENU;
if (x == -1)
{
@ -4752,9 +4752,9 @@ VOLUME_ALL_40x:
plrvotes += votes[i];
j += gotvote[i];
}
if (j == numplayers || !ps[myconnectindex].i || (plrvotes > (numplayers>>1)) || (!networkmode && myconnectindex == connecthead))
if (j == numplayers || !g_player[myconnectindex].ps.i || (plrvotes > (numplayers>>1)) || (!networkmode && myconnectindex == connecthead))
{
if (plrvotes > (numplayers>>1) || !ps[myconnectindex].i || (!networkmode && myconnectindex == connecthead))
if (plrvotes > (numplayers>>1) || !g_player[myconnectindex].ps.i || (!networkmode && myconnectindex == connecthead))
{
if (ud.m_player_skill == 3) ud.m_respawn_monsters = 1;
else ud.m_respawn_monsters = 0;
@ -4799,8 +4799,8 @@ VOLUME_ALL_40x:
}
Bsprintf(fta_quotes[116],"VOTE FAILED");
FTA(116,&ps[myconnectindex]);
ps[myconnectindex].gm &= ~MODE_MENU;
FTA(116,&g_player[myconnectindex].ps);
g_player[myconnectindex].ps.gm &= ~MODE_MENU;
}
}
else
@ -4811,10 +4811,10 @@ VOLUME_ALL_40x:
}
case 600:
c = (320>>1) - 120;
if ((ps[myconnectindex].gm&MODE_GAME) != MODE_GAME)
if ((g_player[myconnectindex].ps.gm&MODE_GAME) != MODE_GAME)
displayfragbar();
rotatesprite(160<<16,26<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
menutext(160,31,0,0,&ud.user_name[myconnectindex][0]);
menutext(160,31,0,0,&g_player[myconnectindex].user_name[0]);
x = probe(c,57-8,16,8);
@ -4853,7 +4853,7 @@ VOLUME_ALL_40x:
{
case -1:
ud.m_recstat = 0;
if (ps[myconnectindex].gm&MODE_GAME) cmenu(50);
if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50);
else cmenu(0);
break;
case 0:
@ -4923,7 +4923,7 @@ VOLUME_ALL_40x:
case 7:
if (voting == -1)
{
if (ps[myconnectindex].i)
if (g_player[myconnectindex].ps.i)
{
Bmemset(votes,0,sizeof(votes));
Bmemset(gotvote,0,sizeof(gotvote));
@ -5021,7 +5021,7 @@ VOLUME_ALL_40x:
break;
}
if ((ps[myconnectindex].gm&MODE_MENU) != MODE_MENU)
if ((g_player[myconnectindex].ps.gm&MODE_MENU) != MODE_MENU)
{
vscrn();
cameraclock = totalclock;

View file

@ -112,7 +112,7 @@ static int osdcmd_changelevel(const osdfuncparm_t *parm)
ud.m_volume_number = volume;
ud.m_level_number = level;
if (ps[myconnectindex].i)
if (g_player[myconnectindex].ps.i)
{
int i;
@ -136,12 +136,12 @@ static int osdcmd_changelevel(const osdfuncparm_t *parm)
if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && !(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_TDM))
ud.m_noexits = 0;
ps[myconnectindex].gm |= MODE_MENU;
g_player[myconnectindex].ps.gm |= MODE_MENU;
cmenu(603);
}
return OSDCMD_OK;
}
if (ps[myconnectindex].gm & MODE_GAME)
if (g_player[myconnectindex].ps.gm & MODE_GAME)
{
// in-game behave like a cheat
osdcmd_cheatsinfo_stat.cheatnum = 2;
@ -214,7 +214,7 @@ static int osdcmd_map(const osdfuncparm_t *parm)
ud.m_volume_number = 0;
ud.m_level_number = 7;
if (ps[myconnectindex].i)
if (g_player[myconnectindex].ps.i)
{
int i;
@ -238,7 +238,7 @@ static int osdcmd_map(const osdfuncparm_t *parm)
if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && !(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_TDM))
ud.m_noexits = 0;
ps[myconnectindex].gm |= MODE_MENU;
g_player[myconnectindex].ps.gm |= MODE_MENU;
cmenu(603);
}
return OSDCMD_OK;
@ -263,7 +263,7 @@ static int osdcmd_map(const osdfuncparm_t *parm)
static int osdcmd_god(const osdfuncparm_t *parm)
{
if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME)
if (numplayers == 1 && g_player[myconnectindex].ps.gm & MODE_GAME)
{
osdcmd_cheatsinfo_stat.cheatnum = 0;
}
@ -277,7 +277,7 @@ static int osdcmd_god(const osdfuncparm_t *parm)
static int osdcmd_noclip(const osdfuncparm_t *parm)
{
if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME)
if (numplayers == 1 && g_player[myconnectindex].ps.gm & MODE_GAME)
{
osdcmd_cheatsinfo_stat.cheatnum = 20;
}
@ -359,9 +359,9 @@ static int osdcmd_restartsound(const osdfuncparm_t *parm)
FX_StopAllSounds();
clearsoundlocks();
if (config.MusicToggle == 1)
if (ud.config.MusicToggle == 1)
{
if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME)
if (ud.recstat != 2 && g_player[myconnectindex].ps.gm&MODE_GAME)
{
if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&map[(unsigned char)music_select].musicfn[0]);
@ -375,9 +375,9 @@ static int osdcmd_restartsound(const osdfuncparm_t *parm)
static int osdcmd_restartvid(const osdfuncparm_t *parm)
{
resetvideomode();
if (setgamemode(config.ScreenMode,config.ScreenWidth,config.ScreenHeight,config.ScreenBPP))
if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP))
gameexit("restartvid: Reset failed...\n");
onvideomodechange(config.ScreenBPP>8);
onvideomodechange(ud.config.ScreenBPP>8);
vscrn();
return OSDCMD_OK;
@ -385,8 +385,8 @@ static int osdcmd_restartvid(const osdfuncparm_t *parm)
static int osdcmd_vidmode(const osdfuncparm_t *parm)
{
int newbpp = config.ScreenBPP, newwidth = config.ScreenWidth,
newheight = config.ScreenHeight, newfs = config.ScreenMode;
int newbpp = ud.config.ScreenBPP, newwidth = ud.config.ScreenWidth,
newheight = ud.config.ScreenHeight, newfs = ud.config.ScreenMode;
if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP;
switch (parm->numparms)
@ -411,14 +411,14 @@ static int osdcmd_vidmode(const osdfuncparm_t *parm)
if (setgamemode(newfs,newwidth,newheight,newbpp))
{
initprintf("vidmode: Mode change failed!\n");
if (setgamemode(config.ScreenMode, config.ScreenWidth, config.ScreenHeight, config.ScreenBPP))
if (setgamemode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP))
gameexit("vidmode: Reset failed!\n");
}
config.ScreenBPP = newbpp;
config.ScreenWidth = newwidth;
config.ScreenHeight = newheight;
config.ScreenMode = newfs;
onvideomodechange(config.ScreenBPP>8);
ud.config.ScreenBPP = newbpp;
ud.config.ScreenWidth = newwidth;
ud.config.ScreenHeight = newheight;
ud.config.ScreenMode = newfs;
onvideomodechange(ud.config.ScreenBPP>8);
vscrn();
return OSDCMD_OK;
}
@ -445,7 +445,7 @@ static int osdcmd_spawn(const osdfuncparm_t *parm)
short ang=0;
short set=0, idx;
if (numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME))
if (numplayers > 1 || !(g_player[myconnectindex].ps.gm & MODE_GAME))
{
OSD_Printf("spawn: Can't spawn sprites in multiplayer games or demos\n");
return OSDCMD_OK;
@ -507,7 +507,7 @@ static int osdcmd_spawn(const osdfuncparm_t *parm)
return OSDCMD_SHOWHELP;
}
idx = spawn(ps[myconnectindex].i, (short)picnum);
idx = spawn(g_player[myconnectindex].ps.i, (short)picnum);
if (set & 1) sprite[idx].pal = (char)pal;
if (set & 2) sprite[idx].cstat = (short)cstat;
if (set & 4) sprite[idx].ang = ang;
@ -542,7 +542,7 @@ static int osdcmd_setvar(const osdfuncparm_t *parm)
for (i=0;i<iGameVarCount;i++)
if (aGameVars[i].szLabel != NULL)
if (Bstrcmp(varname, aGameVars[i].szLabel) == 0)
SetGameVarID(i, varval, ps[myconnectindex].i, myconnectindex);
SetGameVarID(i, varval, g_player[myconnectindex].ps.i, myconnectindex);
return OSDCMD_OK;
}
@ -622,7 +622,7 @@ cvar[] =
{
{ "crosshair", "crosshair: enable/disable crosshair", (void*)&ud.crosshair, CVAR_INT, 0, 0, 3 },
{ "cl_autoaim", "cl_autoaim: enable/disable weapon autoaim", (void*)&config.AutoAim, CVAR_INT|256, 0, 0, 2 },
{ "cl_autoaim", "cl_autoaim: enable/disable weapon autoaim", (void*)&ud.config.AutoAim, CVAR_INT|256, 0, 0, 2 },
{ "cl_automsg", "cl_automsg: enable/disable automatically sending messages to all players", (void*)&ud.automsg, CVAR_BOOL, 0, 0, 1 },
{ "cl_autovote", "cl_autovote: enable/disable automatic voting", (void*)&ud.autovote, CVAR_INT|256, 0, 0, 2 },
@ -635,12 +635,12 @@ cvar[] =
{ "cl_messagetime", "cl_messagetime: length of time to display multiplayer chat messages\n", (void*)&ud.msgdisptime, CVAR_INT, 0, 0, 3600 },
{ "cl_mousebias", "cl_mousebias: emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time\n", (void*)&config.MouseBias, CVAR_INT, 0, 0, 32 },
{ "cl_mousefilter", "cl_mousefilter: amount of mouse movement to filter out\n", (void*)&config.MouseFilter, CVAR_INT, 0, 0, 512 },
{ "cl_mousebias", "cl_mousebias: emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time\n", (void*)&ud.config.MouseBias, CVAR_INT, 0, 0, 32 },
{ "cl_mousefilter", "cl_mousefilter: amount of mouse movement to filter out\n", (void*)&ud.config.MouseFilter, CVAR_INT, 0, 0, 512 },
{ "cl_showcoords", "cl_showcoords: show your position in the game world", (void*)&ud.coords, CVAR_BOOL, 0, 0, 1 },
{ "cl_showfps", "cl_showfps: show the frame rate counter", (void*)&ud.tickrate, CVAR_BOOL, 0, 0, 1 },
{ "cl_smoothinput", "cl_smoothinput: enable/disable input smoothing\n", (void*)&config.SmoothInput, CVAR_BOOL, 0, 0, 1 },
{ "cl_smoothinput", "cl_smoothinput: enable/disable input smoothing\n", (void*)&ud.config.SmoothInput, CVAR_BOOL, 0, 0, 1 },
{ "cl_viewbob", "cl_viewbob: enable/disable player head bobbing\n", (void*)&ud.viewbob, CVAR_BOOL, 0, 0, 1 },
@ -657,17 +657,17 @@ cvar[] =
{ "pr_verbosity", "pr_verbosity: verbosity level of the polymer renderer", (void*)&pr_verbosity, CVAR_INT, 0, 0, 3 },
{ "pr_wireframe", "pr_wireframe: toggles wireframe mode", (void*)&pr_wireframe, CVAR_INT, 0, 0, 1 },
#endif
{ "r_precache", "r_precache: enable/disable the pre-level caching routine", (void*)&config.useprecache, CVAR_BOOL, 0, 0, 1 },
{ "r_precache", "r_precache: enable/disable the pre-level caching routine", (void*)&ud.config.useprecache, CVAR_BOOL, 0, 0, 1 },
{ "snd_ambience", "snd_ambience: enables/disables ambient sounds", (void*)&config.AmbienceToggle, CVAR_BOOL, 0, 0, 1 },
{ "snd_duketalk", "snd_duketalk: enables/disables Duke's speech", (void*)&config.VoiceToggle, CVAR_INT, 0, 0, 2 },
{ "snd_fxvolume", "snd_fxvolume: volume of sound effects", (void*)&config.FXVolume, CVAR_INT, 0, 0, 255 },
{ "snd_mixrate", "snd_mixrate: sound mixing rate", (void*)&config.MixRate, CVAR_INT, 0, 0, 48000 },
{ "snd_musvolume", "snd_musvolume: volume of midi music", (void*)&config.MusicVolume, CVAR_INT, 0, 0, 255 },
{ "snd_numbits", "snd_numbits: sound bits", (void*)&config.NumBits, CVAR_INT, 0, 8, 16 },
{ "snd_numchannels", "snd_numchannels: the number of sound channels", (void*)&config.NumChannels, CVAR_INT, 0, 0, 2 },
{ "snd_numvoices", "snd_numvoices: the number of concurrent sounds", (void*)&config.NumVoices, CVAR_INT, 0, 0, 32 },
{ "snd_reversestereo", "snd_reversestereo: reverses the stereo channels", (void*)&config.ReverseStereo, CVAR_BOOL, 0, 0, 16 },
{ "snd_ambience", "snd_ambience: enables/disables ambient sounds", (void*)&ud.config.AmbienceToggle, CVAR_BOOL, 0, 0, 1 },
{ "snd_duketalk", "snd_duketalk: enables/disables Duke's speech", (void*)&ud.config.VoiceToggle, CVAR_INT, 0, 0, 2 },
{ "snd_fxvolume", "snd_fxvolume: volume of sound effects", (void*)&ud.config.FXVolume, CVAR_INT, 0, 0, 255 },
{ "snd_mixrate", "snd_mixrate: sound mixing rate", (void*)&ud.config.MixRate, CVAR_INT, 0, 0, 48000 },
{ "snd_musvolume", "snd_musvolume: volume of midi music", (void*)&ud.config.MusicVolume, CVAR_INT, 0, 0, 255 },
{ "snd_numbits", "snd_numbits: sound bits", (void*)&ud.config.NumBits, CVAR_INT, 0, 8, 16 },
{ "snd_numchannels", "snd_numchannels: the number of sound channels", (void*)&ud.config.NumChannels, CVAR_INT, 0, 0, 2 },
{ "snd_numvoices", "snd_numvoices: the number of concurrent sounds", (void*)&ud.config.NumVoices, CVAR_INT, 0, 0, 32 },
{ "snd_reversestereo", "snd_reversestereo: reverses the stereo channels", (void*)&ud.config.ReverseStereo, CVAR_BOOL, 0, 0, 16 },
};
static int osdcmd_cvar_set(const osdfuncparm_t *parm)
@ -757,7 +757,7 @@ static int osdcmd_gamma(const osdfuncparm_t *parm)
return OSDCMD_SHOWHELP;
}
ud.brightness = atoi(parm->parms[0])<<2;
setbrightness(ud.brightness>>2,&ps[screenpeek].palette[0],0);
setbrightness(ud.brightness>>2,&g_player[screenpeek].ps.palette[0],0);
OSD_Printf("gamma %d\n",ud.brightness>>2);
return OSDCMD_OK;
}
@ -766,9 +766,9 @@ static int osdcmd_give(const osdfuncparm_t *parm)
{
int i;
if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME)
if (numplayers == 1 && g_player[myconnectindex].ps.gm & MODE_GAME)
{
if (ps[myconnectindex].dead_flag != 0)
if (g_player[myconnectindex].ps.dead_flag != 0)
{
OSD_Printf("give: Cannot give while dead.\n");
return OSDCMD_OK;
@ -783,7 +783,7 @@ static int osdcmd_give(const osdfuncparm_t *parm)
}
else if (!Bstrcasecmp(parm->parms[0], "health"))
{
sprite[ps[myconnectindex].i].extra = 200;
sprite[g_player[myconnectindex].ps.i].extra = 200;
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->parms[0], "weapons"))
@ -795,13 +795,13 @@ static int osdcmd_give(const osdfuncparm_t *parm)
{
for (i=PISTOL_WEAPON;i<MAX_WEAPONS-(VOLUMEONE?6:1);i++)
{
addammo(i,&ps[myconnectindex],max_ammo_amount[i]);
addammo(i,&g_player[myconnectindex].ps,max_ammo_amount[i]);
}
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->parms[0], "armor"))
{
ps[myconnectindex].shield_amount = 100;
g_player[myconnectindex].ps.shield_amount = 100;
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->parms[0], "keys"))
@ -829,20 +829,20 @@ void onvideomodechange(int newmode)
if (newmode)
{
if (ps[screenpeek].palette == palette ||
ps[screenpeek].palette == waterpal ||
ps[screenpeek].palette == titlepal ||
ps[screenpeek].palette == animpal ||
ps[screenpeek].palette == endingpal ||
ps[screenpeek].palette == drealms ||
ps[screenpeek].palette == slimepal)
pal = ps[screenpeek].palette;
if (g_player[screenpeek].ps.palette == palette ||
g_player[screenpeek].ps.palette == waterpal ||
g_player[screenpeek].ps.palette == titlepal ||
g_player[screenpeek].ps.palette == animpal ||
g_player[screenpeek].ps.palette == endingpal ||
g_player[screenpeek].ps.palette == drealms ||
g_player[screenpeek].ps.palette == slimepal)
pal = g_player[screenpeek].ps.palette;
else
pal = palette;
}
else
{
pal = ps[screenpeek].palette;
pal = g_player[screenpeek].ps.palette;
}
setbrightness(ud.brightness>>2, pal, 0);
@ -856,12 +856,12 @@ static int osdcmd_usemousejoy(const osdfuncparm_t *parm)
{
if (showval)
{
OSD_Printf("usemouse is %d\n", config.UseMouse);
OSD_Printf("usemouse is %d\n", ud.config.UseMouse);
}
else
{
config.UseMouse = (atoi(parm->parms[0]) != 0);
CONTROL_MouseEnabled = (config.UseMouse && CONTROL_MousePresent);
ud.config.UseMouse = (atoi(parm->parms[0]) != 0);
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
}
return OSDCMD_OK;
}
@ -869,12 +869,12 @@ static int osdcmd_usemousejoy(const osdfuncparm_t *parm)
{
if (showval)
{
OSD_Printf("usejoystick is %d\n", config.UseJoystick);
OSD_Printf("usejoystick is %d\n", ud.config.UseJoystick);
}
else
{
config.UseJoystick = (atoi(parm->parms[0]) != 0);
CONTROL_JoystickEnabled = (config.UseJoystick && CONTROL_JoyPresent);
ud.config.UseJoystick = (atoi(parm->parms[0]) != 0);
CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent);
}
return OSDCMD_OK;
}

File diff suppressed because it is too large Load diff

View file

@ -275,8 +275,8 @@ static int getsound(unsigned int num)
short fp;
long l;
if (num >= NUM_SOUNDS || config.SoundToggle == 0) return 0;
if (config.FXDevice < 0) return 0;
if (num >= NUM_SOUNDS || ud.config.SoundToggle == 0) return 0;
if (ud.config.FXDevice < 0) return 0;
if (!sounds[num][0]) return 0;
fp = kopen4load(sounds[num],loadfromgrouponly);
@ -301,7 +301,7 @@ static void precachenecessarysounds(void)
{
int i, j;
if (config.FXDevice < 0) return;
if (ud.config.FXDevice < 0) return;
j = 0;
for (i=0;i<NUM_SOUNDS;i++)
@ -325,8 +325,8 @@ static void dofrontscreens(char *statustext)
{
if (!statustext)
{
//ps[myconnectindex].palette = palette;
setgamepalette(&ps[myconnectindex], palette, 1); // JBF 20040308
//g_player[myconnectindex].ps.palette = palette;
setgamepalette(&g_player[myconnectindex].ps, palette, 1); // JBF 20040308
fadepal(0,0,0, 0,64,7);
i = ud.screen_size;
ud.screen_size = 0;
@ -372,9 +372,9 @@ static void dofrontscreens(char *statustext)
if (!statustext)
{
clearview(0L);
//ps[myconnectindex].palette = palette;
//g_player[myconnectindex].ps.palette = palette;
//palto(0,0,0,0);
setgamepalette(&ps[myconnectindex], palette, 0); // JBF 20040308
setgamepalette(&g_player[myconnectindex].ps, palette, 0); // JBF 20040308
}
SetGameVarID(g_iReturnVarID,LOADSCREEN, -1, -1);
OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1);
@ -451,7 +451,7 @@ void cacheit(void)
loadtile((short)i);
#if defined(POLYMOST) && defined(USE_OPENGL)
if (config.useprecache)
if (ud.config.useprecache)
{
if (precachehightile[0][i>>3] & pow2char[i&7])
for (k=0; k<MAXPALOOKUPS && !KB_KeyPressed(sc_Space); k++)
@ -543,7 +543,7 @@ void vscrn(void)
void pickrandomspot(int snum)
{
struct player_struct *p = &ps[snum];
player_struct *p = &g_player[snum].ps;
int i=snum,j,k;
unsigned long dist,pdist = -1;
@ -554,11 +554,11 @@ void pickrandomspot(int snum)
{
for (j=0;j<ud.multimode;j++)
{
if (j != snum && ps[j].team == ps[snum].team && sprite[ps[j].i].extra > 0)
if (j != snum && g_player[j].ps.team == g_player[snum].ps.team && sprite[g_player[j].ps.i].extra > 0)
{
for (k=0;k<numplayersprites;k++)
{
dist = FindDistance2D(ps[j].posx-po[k].ox,ps[j].posy-po[k].oy);
dist = FindDistance2D(g_player[j].ps.posx-g_player[k].po.ox,g_player[j].ps.posy-g_player[k].po.oy);
if (dist < pdist)
i = k, pdist = dist;
}
@ -568,16 +568,16 @@ void pickrandomspot(int snum)
}
}
p->bobposx = p->oposx = p->posx = po[i].ox;
p->bobposy = p->oposy = p->posy = po[i].oy;
p->oposz = p->posz = po[i].oz;
p->ang = po[i].oa;
p->cursectnum = po[i].os;
p->bobposx = p->oposx = p->posx = g_player[i].po.ox;
p->bobposy = p->oposy = p->posy = g_player[i].po.oy;
p->oposz = p->posz = g_player[i].po.oz;
p->ang = g_player[i].po.oa;
p->cursectnum = g_player[i].po.os;
}
static void resetplayerstats(int snum)
{
struct player_struct *p = &ps[snum];
player_struct *p = &g_player[snum].ps;
ud.show_help = 0;
ud.showallmap = 0;
@ -686,7 +686,7 @@ static void resetplayerstats(int snum)
void resetweapons(int snum)
{
int weapon;
struct player_struct *p = &ps[snum];
player_struct *p = &g_player[snum].ps;
for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++)
p->gotweapon[weapon] = 0;
@ -710,7 +710,7 @@ void resetweapons(int snum)
void resetinventory(int snum)
{
struct player_struct *p = &ps[snum];
player_struct *p = &g_player[snum].ps;
p->inven_icon = 0;
p->boot_amount = 0;
@ -731,7 +731,7 @@ void resetinventory(int snum)
static void resetprestat(int snum,int g)
{
struct player_struct *p = &ps[snum];
player_struct *p = &g_player[snum].ps;
int i;
spriteqloc = 0;
@ -872,20 +872,20 @@ static void prelevel(char g)
if (sector[i].ceilingpicnum == CLOUDYSKIES && numclouds < 127)
clouds[numclouds++] = i;
if (ps[0].one_parallax_sectnum == -1)
ps[0].one_parallax_sectnum = i;
if (g_player[0].ps.one_parallax_sectnum == -1)
g_player[0].ps.one_parallax_sectnum = i;
}
if (sector[i].lotag == 32767) //Found a secret room
{
ps[0].max_secret_rooms++;
g_player[0].ps.max_secret_rooms++;
continue;
}
if (sector[i].lotag == -1)
{
ps[0].exitx = wall[sector[i].wallptr].x;
ps[0].exity = wall[sector[i].wallptr].y;
g_player[0].ps.exitx = wall[sector[i].wallptr].x;
g_player[0].ps.exity = wall[sector[i].wallptr].y;
continue;
}
}
@ -898,8 +898,8 @@ static void prelevel(char g)
LoadActor(i);
if (sprite[i].lotag == -1 && (sprite[i].cstat&16))
{
ps[0].exitx = SX;
ps[0].exity = SY;
g_player[0].ps.exitx = SX;
g_player[0].ps.exity = SY;
}
else switch (dynamictostatic[PN])
{
@ -1155,13 +1155,13 @@ static void prelevel(char g)
void newgame(int vn,int ln,int sk)
{
struct player_struct *p = &ps[0];
player_struct *p = &g_player[0].ps;
int i;
handleevents();
getpackets();
if (globalskillsound >= 0 && config.FXDevice >= 0 && config.SoundToggle)
if (globalskillsound >= 0 && ud.config.FXDevice >= 0 && ud.config.SoundToggle)
{
while (issoundplaying(-1,globalskillsound))
{
@ -1280,65 +1280,65 @@ static void resetpspritevars(char g)
char aimmode[MAXPLAYERS],autoaim[MAXPLAYERS],weaponswitch[MAXPLAYERS];
STATUSBARTYPE tsbar[MAXPLAYERS];
EGS(ps[0].cursectnum,ps[0].posx,ps[0].posy,ps[0].posz,
APLAYER,0,0,0,ps[0].ang,0,0,0,10);
EGS(g_player[0].ps.cursectnum,g_player[0].ps.posx,g_player[0].ps.posy,g_player[0].ps.posz,
APLAYER,0,0,0,g_player[0].ps.ang,0,0,0,10);
if (ud.recstat != 2) for (i=0;i<MAXPLAYERS;i++)
{
aimmode[i] = ps[i].aim_mode;
autoaim[i] = ps[i].auto_aim;
weaponswitch[i] = ps[i].weaponswitch;
aimmode[i] = g_player[i].ps.aim_mode;
autoaim[i] = g_player[i].ps.auto_aim;
weaponswitch[i] = g_player[i].ps.weaponswitch;
if (ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{
for (j=0;j<MAX_WEAPONS;j++)
{
tsbar[i].ammo_amount[j] = ps[i].ammo_amount[j];
tsbar[i].gotweapon[j] = ps[i].gotweapon[j];
tsbar[i].ammo_amount[j] = g_player[i].ps.ammo_amount[j];
tsbar[i].gotweapon[j] = g_player[i].ps.gotweapon[j];
}
tsbar[i].shield_amount = ps[i].shield_amount;
tsbar[i].curr_weapon = ps[i].curr_weapon;
tsbar[i].inven_icon = ps[i].inven_icon;
tsbar[i].shield_amount = g_player[i].ps.shield_amount;
tsbar[i].curr_weapon = g_player[i].ps.curr_weapon;
tsbar[i].inven_icon = g_player[i].ps.inven_icon;
tsbar[i].firstaid_amount = ps[i].firstaid_amount;
tsbar[i].steroids_amount = ps[i].steroids_amount;
tsbar[i].holoduke_amount = ps[i].holoduke_amount;
tsbar[i].jetpack_amount = ps[i].jetpack_amount;
tsbar[i].heat_amount = ps[i].heat_amount;
tsbar[i].scuba_amount = ps[i].scuba_amount;
tsbar[i].boot_amount = ps[i].boot_amount;
tsbar[i].firstaid_amount = g_player[i].ps.firstaid_amount;
tsbar[i].steroids_amount = g_player[i].ps.steroids_amount;
tsbar[i].holoduke_amount = g_player[i].ps.holoduke_amount;
tsbar[i].jetpack_amount = g_player[i].ps.jetpack_amount;
tsbar[i].heat_amount = g_player[i].ps.heat_amount;
tsbar[i].scuba_amount = g_player[i].ps.scuba_amount;
tsbar[i].boot_amount = g_player[i].ps.boot_amount;
}
}
resetplayerstats(0);
for (i=1;i<MAXPLAYERS;i++)
memcpy(&ps[i],&ps[0],sizeof(ps[0]));
memcpy(&g_player[i].ps,&g_player[0].ps,sizeof(g_player[0].ps));
if (ud.recstat != 2)
for (i=0;i<MAXPLAYERS;i++)
{
ps[i].aim_mode = aimmode[i];
ps[i].auto_aim = autoaim[i];
ps[i].weaponswitch = weaponswitch[i];
g_player[i].ps.aim_mode = aimmode[i];
g_player[i].ps.auto_aim = autoaim[i];
g_player[i].ps.weaponswitch = weaponswitch[i];
if (ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{
for (j=0;j<MAX_WEAPONS;j++)
{
ps[i].ammo_amount[j] = tsbar[i].ammo_amount[j];
ps[i].gotweapon[j] = tsbar[i].gotweapon[j];
g_player[i].ps.ammo_amount[j] = tsbar[i].ammo_amount[j];
g_player[i].ps.gotweapon[j] = tsbar[i].gotweapon[j];
}
ps[i].shield_amount = tsbar[i].shield_amount;
ps[i].curr_weapon = tsbar[i].curr_weapon;
ps[i].inven_icon = tsbar[i].inven_icon;
g_player[i].ps.shield_amount = tsbar[i].shield_amount;
g_player[i].ps.curr_weapon = tsbar[i].curr_weapon;
g_player[i].ps.inven_icon = tsbar[i].inven_icon;
ps[i].firstaid_amount = tsbar[i].firstaid_amount;
ps[i].steroids_amount= tsbar[i].steroids_amount;
ps[i].holoduke_amount = tsbar[i].holoduke_amount;
ps[i].jetpack_amount = tsbar[i].jetpack_amount;
ps[i].heat_amount = tsbar[i].heat_amount;
ps[i].scuba_amount= tsbar[i].scuba_amount;
ps[i].boot_amount = tsbar[i].boot_amount;
g_player[i].ps.firstaid_amount = tsbar[i].firstaid_amount;
g_player[i].ps.steroids_amount= tsbar[i].steroids_amount;
g_player[i].ps.holoduke_amount = tsbar[i].holoduke_amount;
g_player[i].ps.jetpack_amount = tsbar[i].jetpack_amount;
g_player[i].ps.heat_amount = tsbar[i].heat_amount;
g_player[i].ps.scuba_amount= tsbar[i].scuba_amount;
g_player[i].ps.boot_amount = tsbar[i].boot_amount;
}
}
@ -1358,15 +1358,15 @@ static void resetpspritevars(char g)
if (numplayersprites == 0)
{
firstx = ps[0].posx;
firsty = ps[0].posy;
firstx = g_player[0].ps.posx;
firsty = g_player[0].ps.posy;
}
po[(unsigned char)numplayersprites].ox = s->x;
po[(unsigned char)numplayersprites].oy = s->y;
po[(unsigned char)numplayersprites].oz = s->z;
po[(unsigned char)numplayersprites].oa = s->ang;
po[(unsigned char)numplayersprites].os = s->sectnum;
g_player[(unsigned char)numplayersprites].po.ox = s->x;
g_player[(unsigned char)numplayersprites].po.oy = s->y;
g_player[(unsigned char)numplayersprites].po.oz = s->z;
g_player[(unsigned char)numplayersprites].po.oa = s->ang;
g_player[(unsigned char)numplayersprites].po.os = s->sectnum;
numplayersprites++;
if (j >= 0)
@ -1379,17 +1379,17 @@ static void resetpspritevars(char g)
s->xoffset = 0;
s->clipdist = 64;
if ((g&MODE_EOL) != MODE_EOL || ps[j].last_extra == 0)
if ((g&MODE_EOL) != MODE_EOL || g_player[j].ps.last_extra == 0)
{
ps[j].last_extra = max_player_health;
g_player[j].ps.last_extra = max_player_health;
s->extra = max_player_health;
ps[j].runspeed = dukefriction;
g_player[j].ps.runspeed = dukefriction;
}
else s->extra = ps[j].last_extra;
else s->extra = g_player[j].ps.last_extra;
s->yvel = j;
if (!ud.pcolor[j] && ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM))
if (!g_player[j].pcolor && ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM))
{
if (s->pal == 0)
{
@ -1397,7 +1397,7 @@ static void resetpspritevars(char g)
for (;k<MAXPLAYERS;k++)
{
if (which_palookup == ps[k].palookup)
if (which_palookup == g_player[k].ps.palookup)
{
which_palookup++;
if (which_palookup >= 17)
@ -1405,34 +1405,34 @@ static void resetpspritevars(char g)
k=0;
}
}
ud.pcolor[j] = s->pal = ps[j].palookup = which_palookup++;
g_player[j].pcolor = s->pal = g_player[j].ps.palookup = which_palookup++;
if (which_palookup >= 17)
which_palookup = 9;
}
else ud.pcolor[j] = ps[j].palookup = s->pal;
else g_player[j].pcolor = g_player[j].ps.palookup = s->pal;
}
else
{
int k = ud.pcolor[j];
int k = g_player[j].pcolor;
if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
{
k = getteampal(ud.pteam[j]);
ps[j].team = ud.pteam[j];
k = getteampal(g_player[j].pteam);
g_player[j].ps.team = g_player[j].pteam;
}
s->pal = ps[j].palookup = k;
s->pal = g_player[j].ps.palookup = k;
}
ps[j].i = i;
ps[j].frag_ps = j;
g_player[j].ps.i = i;
g_player[j].ps.frag_ps = j;
hittype[i].owner = i;
hittype[i].bposx = ps[j].bobposx = ps[j].oposx = ps[j].posx = s->x;
hittype[i].bposy = ps[j].bobposy = ps[j].oposy = ps[j].posy = s->y;
hittype[i].bposz = ps[j].oposz = ps[j].posz = s->z;
ps[j].oang = ps[j].ang = s->ang;
hittype[i].bposx = g_player[j].ps.bobposx = g_player[j].ps.oposx = g_player[j].ps.posx = s->x;
hittype[i].bposy = g_player[j].ps.bobposy = g_player[j].ps.oposy = g_player[j].ps.posy = s->y;
hittype[i].bposz = g_player[j].ps.oposz = g_player[j].ps.posz = s->z;
g_player[j].ps.oang = g_player[j].ps.ang = s->ang;
updatesector(s->x,s->y,&ps[j].cursectnum);
updatesector(s->x,s->y,&g_player[j].ps.cursectnum);
j = connectpoint2[j];
@ -1447,8 +1447,10 @@ static inline void clearfrags(void)
int i = 0;
while (i<MAXPLAYERS)
ps[i].frag = ps[i].fraggedself = 0, i++;
clearbufbyte(&frags[0][0],(MAXPLAYERS*MAXPLAYERS)<<1,0L);
{
g_player[i].ps.frag = g_player[i].ps.fraggedself = 0, i++;
clearbufbyte(&g_player[i].frags[0],MAXPLAYERS<<1,0L);
}
}
void resettimevars(void)
@ -1473,7 +1475,7 @@ void waitforeverybody()
if (i != myconnectindex) sendpacket(i,packbuf,1);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
playerreadyflag[myconnectindex]++;
g_player[myconnectindex].playerreadyflag++;
while (1)
{
@ -1492,7 +1494,7 @@ void waitforeverybody()
for (i=connecthead;i>=0;i=connectpoint2[i])
{
if (playerreadyflag[i] < playerreadyflag[myconnectindex]) break;
if (g_player[i].playerreadyflag < g_player[myconnectindex].playerreadyflag) break;
if ((!networkmode) && (myconnectindex != connecthead))
{
i = -1;
@ -1508,6 +1510,8 @@ extern int jump_input;
void clearfifo(void)
{
int i = 0;
syncvaltail = 0L;
syncvaltottail = 0L;
syncstat = 0;
@ -1519,33 +1523,34 @@ void clearfifo(void)
avgfvel = avgsvel = avgavel = avghorz = avgbits = avgextbits = 0;
otherminlag = mymaxlag = 0;
clearbufbyte(myminlag,MAXPLAYERS<<2,0L);
clearbufbyte(&loc,sizeof(input),0L);
clearbufbyte(&sync[0],sizeof(sync),0L);
clearbufbyte(inputfifo,sizeof(input)*MOVEFIFOSIZ*MAXPLAYERS,0L);
clearbuf(movefifoend,MAXPLAYERS,0L);
clearbuf(syncvalhead,MAXPLAYERS,0L);
clearbuf(myminlag,MAXPLAYERS,0L);
clearbufbyte(&loc,sizeof(input),0L);
clearbufbyte(inputfifo,sizeof(input)*MOVEFIFOSIZ*MAXPLAYERS,0L);
for (;i<MAXPLAYERS;i++)
{
// Bmemset(&g_player[i].inputfifo,0,sizeof(g_player[i].inputfifo));
Bmemset(&g_player[i].sync,0,sizeof(g_player[i].sync));
Bmemset(&g_player[i].movefifoend,0,sizeof(g_player[i].movefifoend));
Bmemset(&g_player[i].syncvalhead,0,sizeof(g_player[i].syncvalhead));
Bmemset(&g_player[i].myminlag,0,sizeof(g_player[i].myminlag));
}
// clearbufbyte(playerquitflag,MAXPLAYERS,0x01);
}
void resetmys(void)
{
myx = omyx = ps[myconnectindex].posx;
myy = omyy = ps[myconnectindex].posy;
myz = omyz = ps[myconnectindex].posz;
myx = omyx = g_player[myconnectindex].ps.posx;
myy = omyy = g_player[myconnectindex].ps.posy;
myz = omyz = g_player[myconnectindex].ps.posz;
myxvel = myyvel = myzvel = 0;
myang = omyang = ps[myconnectindex].ang;
myhoriz = omyhoriz = ps[myconnectindex].horiz;
myhorizoff = omyhorizoff = ps[myconnectindex].horizoff;
mycursectnum = ps[myconnectindex].cursectnum;
myjumpingcounter = ps[myconnectindex].jumping_counter;
myjumpingtoggle = ps[myconnectindex].jumping_toggle;
myonground = ps[myconnectindex].on_ground;
myhardlanding = ps[myconnectindex].hard_landing;
myreturntocenter = ps[myconnectindex].return_to_center;
myang = omyang = g_player[myconnectindex].ps.ang;
myhoriz = omyhoriz = g_player[myconnectindex].ps.horiz;
myhorizoff = omyhorizoff = g_player[myconnectindex].ps.horizoff;
mycursectnum = g_player[myconnectindex].ps.cursectnum;
myjumpingcounter = g_player[myconnectindex].ps.jumping_counter;
myjumpingtoggle = g_player[myconnectindex].ps.jumping_toggle;
myonground = g_player[myconnectindex].ps.on_ground;
myhardlanding = g_player[myconnectindex].ps.hard_landing;
myreturntocenter = g_player[myconnectindex].ps.return_to_center;
}
extern int gotvote[MAXPLAYERS], votes[MAXPLAYERS], voting, vote_map, vote_episode;
@ -1656,7 +1661,7 @@ int enterlevel(int g)
{
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
{
if (loadboard(boardfilename,0,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum) == -1)
if (loadboard(boardfilename,0,&g_player[0].ps.posx, &g_player[0].ps.posy, &g_player[0].ps.posz, &g_player[0].ps.ang,&g_player[0].ps.cursectnum) == -1)
{
initprintf("Map '%s' not found!\n",boardfilename);
//gameexit(tempbuf);
@ -1678,7 +1683,7 @@ int enterlevel(int g)
if (!loadmaphack(levname)) initprintf("Loaded map hack file '%s'\n",levname);
}
}
else if (loadboard(map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,0,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum) == -1)
else if (loadboard(map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,0,&g_player[0].ps.posx, &g_player[0].ps.posy, &g_player[0].ps.posz, &g_player[0].ps.ang,&g_player[0].ps.cursectnum) == -1)
{
initprintf("Map %s not found!\n",map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
//gameexit(tempbuf);
@ -1709,7 +1714,7 @@ int enterlevel(int g)
levname[i] = 255;
levname[i+1] = 0;
if (loadboard(levname,1,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum) == -1)
if (loadboard(levname,1,&g_player[0].ps.posx, &g_player[0].ps.posy, &g_player[0].ps.posz, &g_player[0].ps.ang,&g_player[0].ps.cursectnum) == -1)
{
initprintf("Map '%s' not found!\n",map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
//gameexit(tempbuf);
@ -1756,12 +1761,12 @@ int enterlevel(int g)
}
if ((g&MODE_GAME) || (g&MODE_EOL))
ps[myconnectindex].gm = MODE_GAME;
g_player[myconnectindex].ps.gm = MODE_GAME;
else if (g&MODE_RESTART)
{
if (ud.recstat == 2)
ps[myconnectindex].gm = MODE_DEMO;
else ps[myconnectindex].gm = MODE_GAME;
g_player[myconnectindex].ps.gm = MODE_DEMO;
else g_player[myconnectindex].ps.gm = MODE_GAME;
}
if ((ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART)
@ -1769,21 +1774,21 @@ int enterlevel(int g)
if (VOLUMEONE)
{
if (ud.level_number == 0 && ud.recstat != 2) FTA(40,&ps[myconnectindex]);
if (ud.level_number == 0 && ud.recstat != 2) FTA(40,&g_player[myconnectindex].ps);
}
for (i=connecthead;i>=0;i=connectpoint2[i])
switch (dynamictostatic[sector[sprite[ps[i].i].sectnum].floorpicnum])
switch (dynamictostatic[sector[sprite[g_player[i].ps.i].sectnum].floorpicnum])
{
case HURTRAIL__STATIC:
case FLOORSLIME__STATIC:
case FLOORPLASMA__STATIC:
resetweapons(i);
resetinventory(i);
ps[i].gotweapon[PISTOL_WEAPON] = 0;
ps[i].ammo_amount[PISTOL_WEAPON] = 0;
ps[i].curr_weapon = KNEE_WEAPON;
ps[i].kickback_pic = 0;
g_player[i].ps.gotweapon[PISTOL_WEAPON] = 0;
g_player[i].ps.ammo_amount[PISTOL_WEAPON] = 0;
g_player[i].ps.curr_weapon = KNEE_WEAPON;
g_player[i].ps.kickback_pic = 0;
break;
}
@ -1791,11 +1796,11 @@ int enterlevel(int g)
resetmys();
//ps[myconnectindex].palette = palette;
//g_player[myconnectindex].ps.palette = palette;
//palto(0,0,0,0);
setgamepalette(&ps[myconnectindex], palette, 0); // JBF 20040308
setgamepalette(&g_player[myconnectindex].ps, palette, 0); // JBF 20040308
setpal(&ps[myconnectindex]);
setpal(&g_player[myconnectindex].ps);
flushperms();
everyothertime = 0;
@ -1818,8 +1823,9 @@ int enterlevel(int g)
drawbackground();
displayrooms(myconnectindex,65536);
clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101);
ps[myconnectindex].over_shoulder_on = 0;
for (i=0;i<MAXPLAYERS;i++)
clearbufbyte(&g_player[i].playerquitflag,1,0x01010101);
g_player[myconnectindex].ps.over_shoulder_on = 0;
clearfrags();

View file

@ -93,7 +93,7 @@ int loadpheader(char spot,struct savehead *saveh)
if (kdfread(&bv,4,1,fil) != 1) goto corrupt;
if (bv != BYTEVERSION && bv != BYTEVERSION_COMPAT)
{
FTA(114,&ps[myconnectindex]);
FTA(114,&g_player[myconnectindex].ps);
kclose(fil);
return 1;
}
@ -170,7 +170,7 @@ int loadplayer(int spot)
if (kdfread(&bv,4,1,fil) != 1) return -1;
if (bv != BYTEVERSION && bv != BYTEVERSION_COMPAT)
{
FTA(114,&ps[myconnectindex]);
FTA(114,&g_player[myconnectindex].ps);
kclose(fil);
ototalclock = totalclock;
ready2send = 1;
@ -183,7 +183,7 @@ int loadplayer(int spot)
kclose(fil);
ototalclock = totalclock;
ready2send = 1;
FTA(124,&ps[myconnectindex]);
FTA(124,&g_player[myconnectindex].ps);
return 1;
}
else ud.multimode = nump;
@ -244,8 +244,10 @@ int loadplayer(int spot)
if (kdfread(&nextspritestat[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&numcyclers,sizeof(numcyclers),1,fil) != 1) goto corrupt;
if (kdfread(&cyclers[0][0],12,MAXCYCLERS,fil) != MAXCYCLERS) goto corrupt;
if (kdfread(ps,sizeof(ps),1,fil) != 1) goto corrupt;
if (kdfread(po,sizeof(po),1,fil) != 1) goto corrupt;
for (i=0;i<MAXPLAYERS;i++)
if (kdfread(&g_player[i].ps,sizeof(g_player[i].ps),1,fil) != 1) goto corrupt;
for (i=0;i<MAXPLAYERS;i++)
if (kdfread(&g_player[i].po,sizeof(g_player[i].po),1,fil) != 1) goto corrupt;
if (kdfread(&numanimwalls,sizeof(numanimwalls),1,fil) != 1) goto corrupt;
if (kdfread(&animwall,sizeof(animwall),1,fil) != 1) goto corrupt;
if (kdfread(&msx[0],sizeof(long),sizeof(msx)/sizeof(long),fil) != sizeof(msx)/sizeof(long)) goto corrupt;
@ -289,7 +291,7 @@ int loadplayer(int spot)
}
if (kdfread(&scriptptrs[0],1,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&hittype[0],sizeof(struct weaponhit),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&hittype[0],sizeof(weaponhit),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
for (i=0;i<MAXSPRITES;i++)
{
@ -339,7 +341,8 @@ int loadplayer(int spot)
if (kdfread(&connecthead,sizeof(connecthead),1,fil) != 1) goto corrupt;
if (kdfread(connectpoint2,sizeof(connectpoint2),1,fil) != 1) goto corrupt;
if (kdfread(&numplayersprites,sizeof(numplayersprites),1,fil) != 1) goto corrupt;
if (kdfread((short *)&frags[0][0],sizeof(frags),1,fil) != 1) goto corrupt;
for (i=0;i<MAXPLAYERS;i++)
if (kdfread((short *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil) != 1) goto corrupt;
if (kdfread(&randomseed,sizeof(randomseed),1,fil) != 1) goto corrupt;
if (kdfread(&global_random,sizeof(global_random),1,fil) != 1) goto corrupt;
@ -389,11 +392,11 @@ int loadplayer(int spot)
kclose(fil);
if (ps[myconnectindex].over_shoulder_on != 0)
if (g_player[myconnectindex].ps.over_shoulder_on != 0)
{
cameradist = 0;
cameraclock = 0;
ps[myconnectindex].over_shoulder_on = 1;
g_player[myconnectindex].ps.over_shoulder_on = 1;
}
screenpeek = myconnectindex;
@ -410,14 +413,14 @@ int loadplayer(int spot)
playmusic(&map[(unsigned char)music_select].musicfn[0]);
}
ps[myconnectindex].gm = MODE_GAME;
g_player[myconnectindex].ps.gm = MODE_GAME;
ud.recstat = 0;
if (ps[myconnectindex].jetpack_on)
spritesound(DUKE_JETPACK_IDLE,ps[myconnectindex].i);
if (g_player[myconnectindex].ps.jetpack_on)
spritesound(DUKE_JETPACK_IDLE,g_player[myconnectindex].ps.i);
restorepalette = 1;
setpal(&ps[myconnectindex]);
setpal(&g_player[myconnectindex].ps);
vscrn();
FX_SetReverb(0);
@ -488,7 +491,10 @@ int loadplayer(int spot)
show_shareware = 0;
everyothertime = 0;
clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101);
// clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101);
for (i=0;i<MAXPLAYERS;i++)
clearbufbyte(&g_player[i].playerquitflag,1,0x01010101);
resetmys();
@ -587,8 +593,10 @@ int saveplayer(int spot)
dfwrite(&nextspritestat[0],2,MAXSPRITES,fil);
dfwrite(&numcyclers,sizeof(numcyclers),1,fil);
dfwrite(&cyclers[0][0],12,MAXCYCLERS,fil);
dfwrite(ps,sizeof(ps),1,fil);
dfwrite(po,sizeof(po),1,fil);
for (i=0;i<MAXPLAYERS;i++)
dfwrite(&g_player[i].ps,sizeof(g_player[i].ps),1,fil);
for (i=0;i<MAXPLAYERS;i++)
dfwrite(&g_player[i].po,sizeof(g_player[i].po),1,fil);
dfwrite(&numanimwalls,sizeof(numanimwalls),1,fil);
dfwrite(&animwall,sizeof(animwall),1,fil);
dfwrite(&msx[0],sizeof(long),sizeof(msx)/sizeof(long),fil);
@ -683,7 +691,7 @@ int saveplayer(int spot)
}
dfwrite(&scriptptrs[0],1,MAXSPRITES,fil);
dfwrite(&hittype[0],sizeof(struct weaponhit),MAXSPRITES,fil);
dfwrite(&hittype[0],sizeof(weaponhit),MAXSPRITES,fil);
for (i=0;i<MAXSPRITES;i++)
{
@ -728,7 +736,8 @@ int saveplayer(int spot)
dfwrite(&connecthead,sizeof(connecthead),1,fil);
dfwrite(connectpoint2,sizeof(connectpoint2),1,fil);
dfwrite(&numplayersprites,sizeof(numplayersprites),1,fil);
dfwrite((short *)&frags[0][0],sizeof(frags),1,fil);
for (i=0;i<MAXPLAYERS;i++)
dfwrite((short *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil);
dfwrite(&randomseed,sizeof(randomseed),1,fil);
dfwrite(&global_random,sizeof(global_random),1,fil);
@ -771,7 +780,7 @@ int saveplayer(int spot)
if (ud.multimode < 2)
{
strcpy(fta_quotes[122],"GAME SAVED");
FTA(122,&ps[myconnectindex]);
FTA(122,&g_player[myconnectindex].ps);
}
ready2send = 1;

View file

@ -192,7 +192,7 @@ int checkcursectnums(int sect)
{
int i;
for (i=connecthead;i>=0;i=connectpoint2[i])
if (sprite[ps[i].i].sectnum == sect) return i;
if (sprite[g_player[i].ps.i].sectnum == sect) return i;
return -1;
}
@ -220,7 +220,7 @@ int findplayer(spritetype *s,long *d)
if (ud.multimode < 2)
{
*d = klabs(ps[myconnectindex].oposx-s->x) + klabs(ps[myconnectindex].oposy-s->y) + ((klabs(ps[myconnectindex].oposz-s->z+(28<<8)))>>4);
*d = klabs(g_player[myconnectindex].ps.oposx-s->x) + klabs(g_player[myconnectindex].ps.oposy-s->y) + ((klabs(g_player[myconnectindex].ps.oposz-s->z+(28<<8)))>>4);
return myconnectindex;
}
@ -229,8 +229,8 @@ int findplayer(spritetype *s,long *d)
for (j=connecthead;j>=0;j=connectpoint2[j])
{
x = klabs(ps[j].oposx-s->x) + klabs(ps[j].oposy-s->y) + ((klabs(ps[j].oposz-s->z+(28<<8)))>>4);
if (x < closest && sprite[ps[j].i].extra > 0)
x = klabs(g_player[j].ps.oposx-s->x) + klabs(g_player[j].ps.oposy-s->y) + ((klabs(g_player[j].ps.oposz-s->z+(28<<8)))>>4);
if (x < closest && sprite[g_player[j].ps.i].extra > 0)
{
closest_player = j;
closest = x;
@ -250,9 +250,9 @@ int findotherplayer(int p,long *d)
closest_player = p;
for (j=connecthead;j>=0;j=connectpoint2[j])
if (p != j && sprite[ps[j].i].extra > 0)
if (p != j && sprite[g_player[j].ps.i].extra > 0)
{
x = klabs(ps[j].oposx-ps[p].posx) + klabs(ps[j].oposy-ps[p].posy) + (klabs(ps[j].oposz-ps[p].posz)>>4);
x = klabs(g_player[j].ps.oposx-g_player[p].ps.posx) + klabs(g_player[j].ps.oposy-g_player[p].ps.posy) + (klabs(g_player[j].ps.oposz-g_player[p].ps.posz)>>4);
if (x < closest)
{
@ -306,17 +306,17 @@ void doanimations(void)
if (animateptr[i] == &sector[animatesect[i]].floorz)
{
for (p=connecthead;p>=0;p=connectpoint2[p])
if (ps[p].cursectnum == dasect)
if ((sector[dasect].floorz-ps[p].posz) < (64<<8))
if (sprite[ps[p].i].owner >= 0)
if (g_player[p].ps.cursectnum == dasect)
if ((sector[dasect].floorz-g_player[p].ps.posz) < (64<<8))
if (sprite[g_player[p].ps.i].owner >= 0)
{
ps[p].posz += v;
ps[p].poszv = 0;
g_player[p].ps.posz += v;
g_player[p].ps.poszv = 0;
if (p == myconnectindex)
{
myz += v;
myzvel = 0;
myzbak[((movefifoplc-1)&(MOVEFIFOSIZ-1))] = ps[p].posz;
myzbak[((movefifoplc-1)&(MOVEFIFOSIZ-1))] = g_player[p].ps.posz;
}
}
@ -389,10 +389,10 @@ void animatecamsprite(void)
{
T1 = 0;
if (ps[screenpeek].newowner >= 0)
OW = ps[screenpeek].newowner;
if (g_player[screenpeek].ps.newowner >= 0)
OW = g_player[screenpeek].ps.newowner;
else if (OW >= 0 && dist(&sprite[ps[screenpeek].i],&sprite[i]) < 2048)
else if (OW >= 0 && dist(&sprite[g_player[screenpeek].ps.i],&sprite[i]) < 2048)
{
if (waloff[TILE_VIEWSCR] == 0)
allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]);
@ -1033,8 +1033,8 @@ void operateactivators(int low,int snum)
if (snum >= 0)
{
if (sector[SECT].lotag&16384)
FTA(4,&ps[snum]);
else FTA(8,&ps[snum]);
FTA(4,&g_player[snum].ps);
else FTA(8,&g_player[snum].ps);
}
}
else
@ -1199,35 +1199,35 @@ int checkhitswitch(int snum,long w,int switchtype)
break;
case ACCESSSWITCH__STATIC:
case ACCESSSWITCH2__STATIC:
if (ps[snum].access_incs == 0)
if (g_player[snum].ps.access_incs == 0)
{
if (switchpal == 0)
{
if ((ps[snum].got_access&1))
ps[snum].access_incs = 1;
else FTA(70,&ps[snum]);
if ((g_player[snum].ps.got_access&1))
g_player[snum].ps.access_incs = 1;
else FTA(70,&g_player[snum].ps);
}
else if (switchpal == 21)
{
if (ps[snum].got_access&2)
ps[snum].access_incs = 1;
else FTA(71,&ps[snum]);
if (g_player[snum].ps.got_access&2)
g_player[snum].ps.access_incs = 1;
else FTA(71,&g_player[snum].ps);
}
else if (switchpal == 23)
{
if (ps[snum].got_access&4)
ps[snum].access_incs = 1;
else FTA(72,&ps[snum]);
if (g_player[snum].ps.got_access&4)
g_player[snum].ps.access_incs = 1;
else FTA(72,&g_player[snum].ps);
}
if (ps[snum].access_incs == 1)
if (g_player[snum].ps.access_incs == 1)
{
if (switchtype == 0)
ps[snum].access_wallnum = w;
g_player[snum].ps.access_wallnum = w;
else
ps[snum].access_spritenum = w;
g_player[snum].ps.access_spritenum = w;
}
return 0;
@ -1417,7 +1417,7 @@ int checkhitswitch(int snum,long w,int switchtype)
if (lotag == (short) 65535)
{
ps[myconnectindex].gm = MODE_EOL;
g_player[myconnectindex].ps.gm = MODE_EOL;
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
@ -1480,17 +1480,17 @@ int checkhitswitch(int snum,long w,int switchtype)
if (picnum == ALIENSWITCH || picnum == ALIENSWITCH+1)
{
if (switchtype == 1)
xyzsound(ALIEN_SWITCH1,w,sx,sy,ps[snum].posz);
else xyzsound(ALIEN_SWITCH1,ps[snum].i,sx,sy,ps[snum].posz);
xyzsound(ALIEN_SWITCH1,w,sx,sy,g_player[snum].ps.posz);
else xyzsound(ALIEN_SWITCH1,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz);
}
else
{
if (switchtype == 1)
xyzsound(SWITCH_ON,w,sx,sy,ps[snum].posz);
else xyzsound(SWITCH_ON,ps[snum].i,sx,sy,ps[snum].posz);
xyzsound(SWITCH_ON,w,sx,sy,g_player[snum].ps.posz);
else xyzsound(SWITCH_ON,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz);
}
if (numdips != correctdips) break;
xyzsound(END_OF_LEVEL_WARN,ps[snum].i,sx,sy,ps[snum].posz);
xyzsound(END_OF_LEVEL_WARN,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz);
}
case DIPSWITCH2__STATIC:
//case DIPSWITCH2+1:
@ -1548,11 +1548,11 @@ int checkhitswitch(int snum,long w,int switchtype)
case 25:
hittype[x].temp_data[4] = !hittype[x].temp_data[4];
if (hittype[x].temp_data[4])
FTA(15,&ps[snum]);
else FTA(2,&ps[snum]);
FTA(15,&g_player[snum].ps);
else FTA(2,&g_player[snum].ps);
break;
case 21:
FTA(2,&ps[screenpeek]);
FTA(2,&g_player[screenpeek].ps);
break;
}
}
@ -1560,7 +1560,7 @@ int checkhitswitch(int snum,long w,int switchtype)
}
operateactivators(lotag,snum);
operateforcefields(ps[snum].i,lotag);
operateforcefields(g_player[snum].ps.i,lotag);
operatemasterswitches(lotag);
if (picnum == DIPSWITCH || picnum == DIPSWITCH+1 ||
@ -1570,14 +1570,14 @@ int checkhitswitch(int snum,long w,int switchtype)
if (hitag == 0 && isadoorwall(picnum) == 0)
{
if (switchtype == 1)
xyzsound(SWITCH_ON,w,sx,sy,ps[snum].posz);
else xyzsound(SWITCH_ON,ps[snum].i,sx,sy,ps[snum].posz);
xyzsound(SWITCH_ON,w,sx,sy,g_player[snum].ps.posz);
else xyzsound(SWITCH_ON,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz);
}
else if (hitag != 0)
{
if (switchtype == 1 && (soundm[hitag]&4) == 0)
xyzsound(hitag,w,sx,sy,ps[snum].posz);
else spritesound(hitag,ps[snum].i);
xyzsound(hitag,w,sx,sy,g_player[snum].ps.posz);
else spritesound(hitag,g_player[snum].ps.i);
}
return 1;
@ -1705,7 +1705,7 @@ void checkhitwall(int spr,int dawallnum,long x,long y,long z,int atwith)
if (wal->nextwall >= 0)
wall[wal->nextwall].cstat = 0;
i = EGS(sn,x,y,z,SECTOREFFECTOR,0,0,0,ps[0].ang,0,0,spr,3);
i = EGS(sn,x,y,z,SECTOREFFECTOR,0,0,0,g_player[0].ps.ang,0,0,spr,3);
SLT = 128;
T2 = 5;
T3 = dawallnum;
@ -1870,7 +1870,7 @@ void checkhitwall(int spr,int dawallnum,long x,long y,long z,int atwith)
}
}
void checkplayerhurt(struct player_struct *p,int j)
void checkplayerhurt(player_struct *p,int j)
{
if ((j&49152) == 49152)
{
@ -1954,8 +1954,8 @@ int checkhitceiling(int sn)
case TECHLIGHT2__STATIC:
case TECHLIGHT4__STATIC:
ceilingglass(ps[myconnectindex].i,sn,10);
spritesound(GLASS_BREAKING,ps[screenpeek].i);
ceilingglass(g_player[myconnectindex].ps.i,sn,10);
spritesound(GLASS_BREAKING,g_player[screenpeek].ps.i);
if (sector[sn].ceilingpicnum == WALLLIGHT1)
sector[sn].ceilingpicnum = WALLLIGHTBUST1;
@ -2414,7 +2414,7 @@ void checkhitsprite(int i,int sn)
j = sprite[sn].owner;
if (j >= 0 && sprite[j].picnum == APLAYER && PN != ROTATEGUN && PN != DRONE)
if (ps[sprite[j].yvel].curr_weapon == SHOTGUN_WEAPON)
if (g_player[sprite[j].yvel].ps.curr_weapon == SHOTGUN_WEAPON)
{
shoot(i,BLOODSPLAT3);
shoot(i,BLOODSPLAT1);
@ -2455,16 +2455,16 @@ void checkhitsprite(int i,int sn)
if (sprite[i].statnum == 10)
{
p = sprite[i].yvel;
if (ps[p].newowner >= 0)
if (g_player[p].ps.newowner >= 0)
{
ps[p].newowner = -1;
ps[p].posx = ps[p].oposx;
ps[p].posy = ps[p].oposy;
ps[p].posz = ps[p].oposz;
ps[p].ang = ps[p].oang;
g_player[p].ps.newowner = -1;
g_player[p].ps.posx = g_player[p].ps.oposx;
g_player[p].ps.posy = g_player[p].ps.oposy;
g_player[p].ps.posz = g_player[p].ps.oposz;
g_player[p].ps.ang = g_player[p].ps.oang;
updatesector(ps[p].posx,ps[p].posy,&ps[p].cursectnum);
setpal(&ps[p]);
updatesector(g_player[p].ps.posx,g_player[p].ps.posy,&g_player[p].ps.cursectnum);
setpal(&g_player[p].ps);
j = headspritestat[1];
while (j >= 0)
@ -2517,8 +2517,8 @@ void allignwarpelevators(void)
void sharedkeys(int snum)
{
int i, k, dainv;
unsigned long sb_snum = sync[snum].bits, j;
struct player_struct *p = &ps[snum];
unsigned long sb_snum = g_player[snum].sync.bits, j;
player_struct *p = &g_player[snum].ps;
if (p->cheat_phase == 1) return;
@ -2560,9 +2560,9 @@ void sharedkeys(int snum)
if ((sb_snum&(1<<22)) && p->quick_kick == 0)
if (p->curr_weapon != KNEE_WEAPON || p->kickback_pic == 0)
{
SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum);
OnEvent(EVENT_QUICKKICK,ps[snum].i,snum, -1);
if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0)
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum);
OnEvent(EVENT_QUICKKICK,g_player[snum].ps.i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0)
{
p->quick_kick = 14;
FTA(80,p);
@ -2590,7 +2590,7 @@ void sharedkeys(int snum)
}
else
{
if (config.MusicToggle) MUSIC_Continue();
if (ud.config.MusicToggle) MUSIC_Continue();
pub = NUMPAGES;
pus = NUMPAGES;
}
@ -2602,9 +2602,9 @@ void sharedkeys(int snum)
if (sb_snum&(1<<30) && p->newowner == -1) // inventory button generates event for selected item
{
SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum);
OnEvent(EVENT_INVENTORY,ps[snum].i,snum, -1);
if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0)
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum);
OnEvent(EVENT_INVENTORY,g_player[snum].ps.i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0)
{
switch (p->inven_icon)
{
@ -2629,9 +2629,9 @@ void sharedkeys(int snum)
if (sb_snum&(1<<15))
{
SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum);
OnEvent(EVENT_USENIGHTVISION,ps[snum].i,snum, -1);
if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum);
OnEvent(EVENT_USENIGHTVISION,g_player[snum].ps.i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0
&& p->heat_amount > 0)
{
p->heat_on = !p->heat_on;
@ -2644,9 +2644,9 @@ void sharedkeys(int snum)
if ((sb_snum&(1<<12)))
{
SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum);
OnEvent(EVENT_USESTEROIDS,ps[snum].i,snum, -1);
if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0)
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum);
OnEvent(EVENT_USESTEROIDS,g_player[snum].ps.i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0)
{
if (p->steroids_amount == 400)
{
@ -2731,15 +2731,15 @@ CHECKINV1:
if (sb_snum&(1<<20)) // Inventory_Left
{
SetGameVarID(g_iReturnVarID,dainv,ps[snum].i,snum);
OnEvent(EVENT_INVENTORYLEFT,ps[snum].i,snum, -1);
dainv=GetGameVarID(g_iReturnVarID,ps[snum].i,snum);
SetGameVarID(g_iReturnVarID,dainv,g_player[snum].ps.i,snum);
OnEvent(EVENT_INVENTORYLEFT,g_player[snum].ps.i,snum, -1);
dainv=GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum);
}
if (sb_snum&(1<<27)) // Inventory_Right
{
SetGameVarID(g_iReturnVarID,dainv,ps[snum].i,snum);
OnEvent(EVENT_INVENTORYRIGHT,ps[snum].i,snum, -1);
dainv=GetGameVarID(g_iReturnVarID,ps[snum].i,snum);
SetGameVarID(g_iReturnVarID,dainv,g_player[snum].ps.i,snum);
OnEvent(EVENT_INVENTORYRIGHT,g_player[snum].ps.i,snum, -1);
dainv=GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum);
}
p->inven_icon = dainv;
@ -3054,9 +3054,9 @@ CHECKINV1:
if (p->holoduke_on == -1)
{
SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum);
OnEvent(EVENT_HOLODUKEON,ps[snum].i,snum, -1);
if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0)
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum);
OnEvent(EVENT_HOLODUKEON,g_player[snum].ps.i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0)
{
if (p->holoduke_amount > 0)
{
@ -3079,9 +3079,9 @@ CHECKINV1:
}
else
{
SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum);
OnEvent(EVENT_HOLODUKEOFF,ps[snum].i,snum, -1);
if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0)
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum);
OnEvent(EVENT_HOLODUKEOFF,g_player[snum].ps.i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0)
{
spritesound(TELEPORTER,p->holoduke_on);
p->holoduke_on = -1;
@ -3092,9 +3092,9 @@ CHECKINV1:
if (sb_snum&(1<<16))
{
SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum);
OnEvent(EVENT_USEMEDKIT,ps[snum].i,snum, -1);
if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0)
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum);
OnEvent(EVENT_USEMEDKIT,g_player[snum].ps.i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0)
{
if (p->firstaid_amount > 0 && sprite[p->i].extra < max_player_health)
{
@ -3119,9 +3119,9 @@ CHECKINV1:
if (sb_snum&(1<<25) && p->newowner == -1)
{
SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum);
OnEvent(EVENT_USEJETPACK,ps[snum].i,snum, -1);
if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0)
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum);
OnEvent(EVENT_USEJETPACK,g_player[snum].ps.i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0)
{
if (p->jetpack_amount > 0)
{
@ -3187,7 +3187,7 @@ long hitasprite(int i,short *hitsp)
return (FindDistance2D(sx-SX,sy-SY));
}
static long hitawall(struct player_struct *p,short *hitw)
static long hitawall(player_struct *p,short *hitw)
{
long sx,sy,sz;
short sect,hs;
@ -3204,7 +3204,7 @@ static long hitawall(struct player_struct *p,short *hitw)
void checksectors(int snum)
{
long i = -1,oldz;
struct player_struct *p = &ps[snum];
player_struct *p = &g_player[snum].ps;
short j,hitscanwall;
switch (sector[p->cursectnum].lotag)
@ -3217,7 +3217,7 @@ void checksectors(int snum)
return;
case -1:
for (i=connecthead;i>=0;i=connectpoint2[i])
ps[i].gm = MODE_EOL;
g_player[i].ps.gm = MODE_EOL;
sector[p->cursectnum].lotag = 0;
if (ud.from_bonus)
{
@ -3253,33 +3253,33 @@ void checksectors(int snum)
if (p->gm&MODE_TYPE || sprite[p->i].extra <= 0) return;
if ((sync[snum].bits&(1<<29)))
if ((g_player[snum].sync.bits&(1<<29)))
{
SetGameVarID(g_iReturnVarID,0,p->i,snum);
OnEvent(EVENT_USE, p->i, snum, -1);
if (GetGameVarID(g_iReturnVarID,p->i,snum) != 0)
sync[snum].bits &= ~(1<<29);
g_player[snum].sync.bits &= ~(1<<29);
}
if (ud.cashman && sync[snum].bits&(1<<29))
if (ud.cashman && g_player[snum].sync.bits&(1<<29))
lotsofmoney(p->i,2);
if (p->newowner >= 0)
{
if (klabs(sync[snum].svel) > 768 || klabs(sync[snum].fvel) > 768)
if (klabs(g_player[snum].sync.svel) > 768 || klabs(g_player[snum].sync.fvel) > 768)
{
i = -1;
goto CLEARCAMERAS;
}
}
if (!(sync[snum].bits&(1<<29)) && !(sync[snum].bits&(1<<31)))
if (!(g_player[snum].sync.bits&(1<<29)) && !(g_player[snum].sync.bits&(1<<31)))
p->toggle_key_flag = 0;
else if (!p->toggle_key_flag)
{
if ((sync[snum].bits&(1<<31)))
if ((g_player[snum].sync.bits&(1<<31)))
{
if (p->newowner >= 0)
{
@ -3498,7 +3498,7 @@ CLEARCAMERAS:
}
}
if ((sync[snum].bits&(1<<29)) == 0) return;
if ((g_player[snum].sync.bits&(1<<29)) == 0) return;
else if (p->newowner >= 0)
{
i = -1;

View file

@ -49,13 +49,13 @@ void SoundStartup(void)
int32 status;
// if they chose None lets return
if (config.FXDevice < 0) return;
if (ud.config.FXDevice < 0) return;
status = FX_Init(config.FXDevice, config.NumVoices, config.NumChannels, config.NumBits, config.MixRate);
status = FX_Init(ud.config.FXDevice, ud.config.NumVoices, ud.config.NumChannels, ud.config.NumBits, ud.config.MixRate);
if (status == FX_Ok)
{
FX_SetVolume(config.FXVolume);
if (config.ReverseStereo == 1)
FX_SetVolume(ud.config.FXVolume);
if (ud.config.ReverseStereo == 1)
{
FX_SetReverseStereo(!FX_GetReverseStereo());
}
@ -82,7 +82,7 @@ void SoundShutdown(void)
int32 status;
// if they chose None lets return
if (config.FXDevice < 0)
if (ud.config.FXDevice < 0)
return;
status = FX_Shutdown();
@ -106,14 +106,14 @@ void MusicStartup(void)
int32 status;
// if they chose None lets return
if (config.MusicDevice < 0)
if (ud.config.MusicDevice < 0)
return;
status = MUSIC_Init(config.MusicDevice, 0);
status = MUSIC_Init(ud.config.MusicDevice, 0);
if (status == MUSIC_Ok)
{
MUSIC_SetVolume(config.MusicVolume);
MUSIC_SetVolume(ud.config.MusicVolume);
}
else
{
@ -144,7 +144,7 @@ void MusicShutdown(void)
int32 status;
// if they chose None lets return
if (config.MusicDevice < 0)
if (ud.config.MusicDevice < 0)
return;
status = MUSIC_Shutdown();
@ -195,8 +195,8 @@ void playmusic(const char *fn)
if (fn == NULL) return;
if (config.MusicToggle == 0) return;
if (config.MusicDevice < 0) return;
if (ud.config.MusicToggle == 0) return;
if (ud.config.MusicDevice < 0) return;
fp = kopen4load((char *)fn,0);
@ -217,11 +217,11 @@ void playmusic(const char *fn)
if (fn == NULL) return;
if (config.MusicToggle == 0) return;
if (config.MusicDevice < 0) return;
if (ud.config.MusicToggle == 0) return;
if (ud.config.MusicDevice < 0) return;
// FIXME: I need this to get the music volume initialized (not sure why) -- Jim Bentler
MUSIC_SetVolume(MusicVolume);
MUSIC_SetVolume(ud.config.MusicVolume);
PlayMusic((char *)fn);
#endif
}
@ -230,14 +230,14 @@ int loadsound(unsigned int num)
{
long fp, l;
if (num >= NUM_SOUNDS || config.SoundToggle == 0) return 0;
if (config.FXDevice < 0) return 0;
if (num >= NUM_SOUNDS || ud.config.SoundToggle == 0) return 0;
if (ud.config.FXDevice < 0) return 0;
fp = kopen4load(sounds[num],loadfromgrouponly);
if (fp == -1)
{
// Bsprintf(fta_quotes[113],"Sound %s(#%d) not found.",sounds[num],num);
// FTA(113,&ps[myconnectindex]);
// FTA(113,&g_player[myconnectindex].ps);
initprintf("Sound %s(#%d) not found.\n",sounds[num],num);
return 0;
}
@ -262,13 +262,13 @@ int xyzsound(int num,int i,long x,long y,long z)
// if(num != 358) return 0;
if (num >= NUM_SOUNDS ||
config.FXDevice < 0 ||
ud.config.FXDevice < 0 ||
((soundm[num]&8) && ud.lockout) ||
config.SoundToggle == 0 ||
ud.config.SoundToggle == 0 ||
Sound[num].num > 3 ||
FX_VoiceAvailable(soundpr[num]) == 0 ||
(ps[myconnectindex].timebeforeexit > 0 && ps[myconnectindex].timebeforeexit <= 26*3) ||
ps[myconnectindex].gm&MODE_MENU) return -1;
(g_player[myconnectindex].ps.timebeforeexit > 0 && g_player[myconnectindex].ps.timebeforeexit <= 26*3) ||
g_player[myconnectindex].ps.gm&MODE_MENU) return -1;
if (soundm[num]&128)
{
@ -278,9 +278,9 @@ int xyzsound(int num,int i,long x,long y,long z)
if (soundm[num]&4)
{
if (config.VoiceToggle==0)
if (ud.config.VoiceToggle==0)
return -1;
else if (ud.multimode > 1 && PN == APLAYER && sprite[i].yvel != screenpeek && config.VoiceToggle!=2)
else if (ud.multimode > 1 && PN == APLAYER && sprite[i].yvel != screenpeek && ud.config.VoiceToggle!=2)
return -1;
for (j=0;j<NUM_SOUNDS;j++)
for (k=0;k<Sound[j].num;k++)
@ -288,11 +288,11 @@ int xyzsound(int num,int i,long x,long y,long z)
return -1;
}
cx = ps[screenpeek].oposx;
cy = ps[screenpeek].oposy;
cz = ps[screenpeek].oposz;
cs = ps[screenpeek].cursectnum;
ca = ps[screenpeek].ang+ps[screenpeek].look_ang;
cx = g_player[screenpeek].ps.oposx;
cy = g_player[screenpeek].ps.oposy;
cz = g_player[screenpeek].ps.oposz;
cs = g_player[screenpeek].ps.cursectnum;
ca = g_player[screenpeek].ps.ang+g_player[screenpeek].ps.look_ang;
sndist = FindDistance3D((cx-x),(cy-y),(cz-z)>>4);
@ -323,18 +323,18 @@ int xyzsound(int num,int i,long x,long y,long z)
case RPG_EXPLODE:
if (sndist > (6144))
sndist = 6144;
if (sector[ps[screenpeek].cursectnum].lotag == 2)
if (sector[g_player[screenpeek].ps.cursectnum].lotag == 2)
pitch -= 1024;
break;
default:
if (sector[ps[screenpeek].cursectnum].lotag == 2 && (soundm[num]&4) == 0)
if (sector[g_player[screenpeek].ps.cursectnum].lotag == 2 && (soundm[num]&4) == 0)
pitch = -768;
if (sndist > 31444 && PN != MUSICANDSFX)
return -1;
break;
}
if (ps[screenpeek].sound_pitch) pitch += ps[screenpeek].sound_pitch;
if (g_player[screenpeek].ps.sound_pitch) pitch += g_player[screenpeek].ps.sound_pitch;
if (Sound[num].num > 0 && PN != MUSICANDSFX)
{
@ -409,9 +409,9 @@ void sound(int num)
int voice;
long start;
if (config.FXDevice < 0) return;
if (config.SoundToggle==0) return;
if (config.VoiceToggle==0 && (soundm[num]&4)) return;
if (ud.config.FXDevice < 0) return;
if (ud.config.SoundToggle==0) return;
if (ud.config.VoiceToggle==0 && (soundm[num]&4)) return;
if ((soundm[num]&8) && ud.lockout) return;
if (FX_VoiceAvailable(soundpr[num]) == 0) return;
if (num > NUM_SOUNDS-1 || !sounds[num])
@ -420,7 +420,6 @@ void sound(int num)
return;
}
pitchs = soundps[num];
pitche = soundpe[num];
cx = klabs(pitche-pitchs);
@ -516,11 +515,11 @@ void pan3dsound(void)
if (ud.camerasprite == -1)
{
cx = ps[screenpeek].oposx;
cy = ps[screenpeek].oposy;
cz = ps[screenpeek].oposz;
cs = ps[screenpeek].cursectnum;
ca = ps[screenpeek].ang+ps[screenpeek].look_ang;
cx = g_player[screenpeek].ps.oposx;
cy = g_player[screenpeek].ps.oposy;
cz = g_player[screenpeek].ps.oposz;
cs = g_player[screenpeek].ps.cursectnum;
ca = g_player[screenpeek].ps.ang+g_player[screenpeek].ps.look_ang;
}
else
{

View file

@ -744,14 +744,14 @@ int startwin_run(void)
SetPage(TAB_CONFIG);
settings.fullscreen = ScreenMode;
settings.xdim3d = ScreenWidth;
settings.ydim3d = ScreenHeight;
settings.bpp3d = ScreenBPP;
settings.forcesetup = g_ForceSetup;
settings.usemouse = UseMouse;
settings.usejoy = UseJoystick;
settings.game = gametype;
settings.fullscreen = ud.config.ScreenMode;
settings.xdim3d = ud.config.ScreenWidth;
settings.ydim3d = ud.config.ScreenHeight;
settings.bpp3d = ud.config.ScreenBPP;
settings.forcesetup = ud.config.ForceSetup;
settings.usemouse = ud.config.UseMouse;
settings.usejoy = ud.config.UseJoystick;
settings.game = g_GameType;
strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH);
PopulateForm(-1);
@ -760,15 +760,15 @@ int startwin_run(void)
SetPage(TAB_MESSAGES);
if (retval)
{
ScreenMode = settings.fullscreen;
ScreenWidth = settings.xdim3d;
ScreenHeight = settings.ydim3d;
ScreenBPP = settings.bpp3d;
g_ForceSetup = settings.forcesetup;
UseMouse = settings.usemouse;
UseJoystick = settings.usejoy;
ud.config.ScreenMode = settings.fullscreen;
ud.config.ScreenWidth = settings.xdim3d;
ud.config.ScreenHeight = settings.ydim3d;
ud.config.ScreenBPP = settings.bpp3d;
ud.config.ForceSetup = settings.forcesetup;
ud.config.UseMouse = settings.usemouse;
ud.config.UseJoystick = settings.usejoy;
duke3dgrp = settings.selectedgrp;
gametype = settings.game;
g_GameType = settings.game;
}
return retval;

View file

@ -575,13 +575,13 @@ int startwin_run(void)
SetPage(TAB_CONFIG);
EnableConfig(1);
settings.fullscreen = config.ScreenMode;
settings.xdim = config.ScreenWidth;
settings.ydim = config.ScreenHeight;
settings.bpp = config.ScreenBPP;
settings.forcesetup = config.ForceSetup;
settings.usemouse = config.UseMouse;
settings.usejoy = config.UseJoystick;
settings.fullscreen = ud.config.ScreenMode;
settings.xdim = ud.config.ScreenWidth;
settings.ydim = ud.config.ScreenHeight;
settings.bpp = ud.config.ScreenBPP;
settings.forcesetup = ud.config.ForceSetup;
settings.usemouse = ud.config.UseMouse;
settings.usejoy = ud.config.UseJoystick;
settings.game = g_GameType;
strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH);
PopulateForm(-1);
@ -607,13 +607,13 @@ int startwin_run(void)
EnableConfig(0);
if (done)
{
config.ScreenMode = settings.fullscreen;
config.ScreenWidth = settings.xdim;
config.ScreenHeight = settings.ydim;
config.ScreenBPP = settings.bpp;
config.ForceSetup = settings.forcesetup;
config.UseMouse = settings.usemouse;
config.UseJoystick = settings.usejoy;
ud.config.ScreenMode = settings.fullscreen;
ud.config.ScreenWidth = settings.xdim;
ud.config.ScreenHeight = settings.ydim;
ud.config.ScreenBPP = settings.bpp;
ud.config.ForceSetup = settings.forcesetup;
ud.config.UseMouse = settings.usemouse;
ud.config.UseJoystick = settings.usejoy;
duke3dgrp = settings.selectedgrp;
g_GameType = settings.game;
}