source code rape

git-svn-id: https://svn.eduke32.com/eduke32@1143 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-11-20 14:06:36 +00:00
parent f169d5584f
commit 4910928877
41 changed files with 9860 additions and 9720 deletions

View file

@ -291,14 +291,14 @@ endif
enginelib editorlib: enginelib editorlib:
-mkdir -p $(EOBJ) -mkdir -p $(EOBJ)
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(EROOT)\033[0;35m.\033[0m\n" printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(EROOT)\033[0;35m \033[0m\n"
endif endif
$(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" \ $(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" \
SUPERBUILD=$(SUPERBUILD) POLYMOST=$(POLYMOST) \ SUPERBUILD=$(SUPERBUILD) POLYMOST=$(POLYMOST) \
USE_OPENGL=$(USE_OPENGL) BUILD32_ON_64=$(BUILD32_ON_64) \ USE_OPENGL=$(USE_OPENGL) BUILD32_ON_64=$(BUILD32_ON_64) \
NOASM=$(NOASM) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) RANCID_NETWORKING=$(RANCID_NETWORKING) $@ NOASM=$(NOASM) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) RANCID_NETWORKING=$(RANCID_NETWORKING) $@
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m.\033[0m\n" printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n"
endif endif
$(EOBJ)/$(ENGINELIB): enginelib $(EOBJ)/$(ENGINELIB): enginelib

View file

@ -194,10 +194,10 @@ ifeq ($(PRETTY_OUTPUT),1)
BUILD_STARTED = printf "\033[K\033[1;36mBuild started using \"$(CC) $(OURCFLAGS)\"\033[0m\n" BUILD_STARTED = printf "\033[K\033[1;36mBuild started using \"$(CC) $(OURCFLAGS)\"\033[0m\n"
BUILD_FINISHED = printf "\033[K\033[1;36mBuild successful:\033[0m\n" BUILD_FINISHED = printf "\033[K\033[1;36mBuild successful:\033[0m\n"
COMPILE_STATUS = printf "\033[K\033[0mBuilding object \033[1m$@\033[0m...\033[0m\r" COMPILE_STATUS = printf "\033[K\033[0mBuilding object \033[1m$@\033[0m...\033[0m\r"
COMPILE_OK = printf "\033[K\033[0;32mBuilt object \033[1;32m$@\033[0;32m.\033[0m\n" COMPILE_OK = printf "\033[K\033[0;32mBuilt object \033[1;32m$@\033[0;32m \033[0m\n"
COMPILE_FAILED = printf "\033[K\033[0;31mFailed building \033[1;31m$@\033[0;31m from\033[0m \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1 COMPILE_FAILED = printf "\033[K\033[0;31mFailed building \033[1;31m$@\033[0;31m from\033[0m \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1
LINK_STATUS = printf "\033[K\033[0;0mLinking executable \033[1m$@\033[0;0m...\033[0m\r" LINK_STATUS = printf "\033[K\033[0;0mLinking executable \033[1m$@\033[0;0m...\033[0m\r"
LINK_OK = printf "\033[K\033[0;32mLinked executable \033[1;32m$@\033[0;32m.\033[0m\n" LINK_OK = printf "\033[K\033[0;32mLinked executable \033[1;32m$@\033[0;32m \033[0m\n"
LINK_FAILED = printf "\033[K\033[0;31mFailed linking executable \033[1;31m$@\033[0;31m!\033[0m\n"; exit 1 LINK_FAILED = printf "\033[K\033[0;31mFailed linking executable \033[1;31m$@\033[0;31m!\033[0m\n"; exit 1
else else
BUILD_STARTED = BUILD_STARTED =

View file

@ -9611,7 +9611,8 @@ void getmousevalues(int *mousx, int *mousy, int *bstatus)
// //
int krand(void) int krand(void)
{ {
randomseed = (randomseed*27584621)+1; // randomseed = (randomseed*27584621)+1;
randomseed = (randomseed * 1664525ul) + 221297ul;
return(((unsigned int)randomseed)>>16); return(((unsigned int)randomseed)>>16);
} }

View file

@ -11,7 +11,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <ctype.h> #include <ctype.h>
#include <time.h> #include <time.h>
#include <sys/time.h> //HACK, for id generation
#include "mmulti_unstable.h" #include "mmulti_unstable.h"
// #include <enet/enet.h> // #include <enet/enet.h>
@ -73,6 +72,8 @@ int connecthead, connectpoint2[MAXPLAYERS];
char syncstate = 0; char syncstate = 0;
#define MAXPACKETSIZE 2048 #define MAXPACKETSIZE 2048
#define PACKET_START_GAME 0x1337
typedef struct typedef struct
{ {
// short intnum; /* communication between Game and the driver */ // short intnum; /* communication between Game and the driver */
@ -127,6 +128,11 @@ enum ECommitCMDs
COMMIT_CMD_SCORE = 5, COMMIT_CMD_SCORE = 5,
}; };
static struct
{
int host;
unsigned short port;
} allowed_addresses[MAXPLAYERS]; /* only respond to these IPs. */
// Queue of out going packets. // Queue of out going packets.
//PacketQueue outgoingPacketQueue; //PacketQueue outgoingPacketQueue;
@ -180,6 +186,8 @@ void initmultiplayers(int argc, char **argv)
outcntplc[i] = 0L; outcntplc[i] = 0L;
outcntend[i] = 0L; outcntend[i] = 0L;
bakpacketlen[i][255] = -1; bakpacketlen[i][255] = -1;
allowed_addresses[i].host = 0;
allowed_addresses[i].port = 0;
} }
// clear out the packet ordering // clear out the packet ordering
@ -544,7 +552,7 @@ int getpacket(int *other, char *bufptr)
void flushpackets() void flushpackets()
{ {
#if 0 #if 1
int i; int i;
if (numplayers < 2) return; if (numplayers < 2) return;
@ -629,12 +637,6 @@ void genericmultifunction(int other, char *bufptr, int messleng, int command)
static sockettype udpsocket = -1; static sockettype udpsocket = -1;
static unsigned short udpport = BUILD_DEFAULT_UDP_PORT; static unsigned short udpport = BUILD_DEFAULT_UDP_PORT;
static struct
{
int host;
unsigned short port;
} allowed_addresses[MAXPLAYERS]; /* only respond to these IPs. */
#if PLATFORM_WIN32 #if PLATFORM_WIN32
/* /*
* Figure out what the last failing Win32 API call was, and * Figure out what the last failing Win32 API call was, and
@ -1121,7 +1123,7 @@ static int wait_for_other_players(gcomtype *gcom, int myip)
// greeting with 0x1337 id starts the game for clients // greeting with 0x1337 id starts the game for clients
send_peer_greeting(allowed_addresses[j].host, send_peer_greeting(allowed_addresses[j].host,
allowed_addresses[j].port, allowed_addresses[j].port,
0x1337); PACKET_START_GAME);
} }
/* ok, now everyone is talking to you. Sort them into player numbers... */ /* ok, now everyone is talking to you. Sort them into player numbers... */
@ -1217,9 +1219,10 @@ static int connect_to_server(gcomtype *gcom, int myip)
while (my_id == 0) /* player number is based on id, low to high. */ while (my_id == 0) /* player number is based on id, low to high. */
{ {
struct timeval tv; /* struct timeval tv;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
my_id = (unsigned short)tv.tv_usec; //HACK my_id = (unsigned short)tv.tv_usec; //HACK */
my_id = (unsigned short) rand();
} }
initprintf("mmulti_unstable: Using 0x%X as client ID\n", my_id); initprintf("mmulti_unstable: Using 0x%X as client ID\n", my_id);
@ -1285,7 +1288,7 @@ static int connect_to_server(gcomtype *gcom, int myip)
if (!heard_from[i] || heard_from[i] == B_SWAP16(packet.id)) break; // only increase once if (!heard_from[i] || heard_from[i] == B_SWAP16(packet.id)) break; // only increase once
// greeting with 0x1337 id starts the game // greeting with 0x1337 id starts the game
if (B_SWAP16(packet.id) == 0x1337) if (B_SWAP16(packet.id) == PACKET_START_GAME)
{ {
remaining = 0; remaining = 0;
continue; continue;
@ -1427,9 +1430,10 @@ static int connect_to_everyone(gcomtype *gcom, int myip, int bcast)
while (my_id == 0) /* player number is based on id, low to high. */ while (my_id == 0) /* player number is based on id, low to high. */
{ {
struct timeval tv; /* struct timeval tv;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
my_id = (unsigned short)tv.tv_usec; //HACK my_id = (unsigned short)tv.tv_usec; //HACK */
my_id = (unsigned short) rand();
} }

View file

@ -456,6 +456,10 @@
RelativePath=".\source\startwin.game.c" RelativePath=".\source\startwin.game.c"
> >
</File> </File>
<File
RelativePath=".\source\sync.c"
>
</File>
<File <File
RelativePath=".\source\testcd.c" RelativePath=".\source\testcd.c"
> >
@ -552,6 +556,10 @@
RelativePath=".\source\startwin.game.h" RelativePath=".\source\startwin.game.h"
> >
</File> </File>
<File
RelativePath=".\source\swmacros.h"
>
</File>
</Filter> </Filter>
</Filter> </Filter>
<Filter <Filter

View file

@ -89,12 +89,13 @@ char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] =
"Quick_Kick", "Quick_Kick",
"Next_Weapon", "Next_Weapon",
"Previous_Weapon", "Previous_Weapon",
"Show_Console" "Show_Console",
"Show_DukeMatch_Scores"
}; };
#ifdef __SETUP__ #ifdef __SETUP__
#define NUMKEYENTRIES 53 #define NUMKEYENTRIES 54
char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] = char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] =
{ {
@ -150,7 +151,8 @@ char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] =
"Quick_Kick", "Q", "", "Quick_Kick", "Q", "",
"Next_Weapon", "'", "", "Next_Weapon", "'", "",
"Previous_Weapon", ";", "", "Previous_Weapon", ";", "",
"Show_Console", "`", "" "Show_Console", "`", "",
"Show_DukeMatch_Scores," "", ""
}; };
const char oldkeydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] = const char oldkeydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] =
@ -207,7 +209,8 @@ const char oldkeydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] =
"Quick_Kick", "`", "", "Quick_Kick", "`", "",
"Next_Weapon", "'", "", "Next_Weapon", "'", "",
"Previous_Weapon", ";", "", "Previous_Weapon", ";", "",
"Show_Console", "`", "" "Show_Console", "`", "",
"Show_DukeMatch_Scores", "", ""
}; };
static char * mousedefaults[] = static char * mousedefaults[] =

File diff suppressed because it is too large Load diff

View file

@ -37,31 +37,31 @@ void endanimsounds(int fr)
switch (fr) switch (fr)
{ {
case 1: case 1:
sound(WIND_AMBIENCE); S_PlaySound(WIND_AMBIENCE);
break; break;
case 26: case 26:
sound(ENDSEQVOL2SND1); S_PlaySound(ENDSEQVOL2SND1);
break; break;
case 36: case 36:
sound(ENDSEQVOL2SND2); S_PlaySound(ENDSEQVOL2SND2);
break; break;
case 54: case 54:
sound(THUD); S_PlaySound(THUD);
break; break;
case 62: case 62:
sound(ENDSEQVOL2SND3); S_PlaySound(ENDSEQVOL2SND3);
break; break;
case 75: case 75:
sound(ENDSEQVOL2SND4); S_PlaySound(ENDSEQVOL2SND4);
break; break;
case 81: case 81:
sound(ENDSEQVOL2SND5); S_PlaySound(ENDSEQVOL2SND5);
break; break;
case 115: case 115:
sound(ENDSEQVOL2SND6); S_PlaySound(ENDSEQVOL2SND6);
break; break;
case 124: case 124:
sound(ENDSEQVOL2SND7); S_PlaySound(ENDSEQVOL2SND7);
break; break;
} }
break; break;
@ -69,23 +69,23 @@ void endanimsounds(int fr)
switch (fr) switch (fr)
{ {
case 1: case 1:
sound(WIND_REPEAT); S_PlaySound(WIND_REPEAT);
break; break;
case 98: case 98:
sound(DUKE_GRUNT); S_PlaySound(DUKE_GRUNT);
break; break;
case 82+20: case 82+20:
sound(THUD); S_PlaySound(THUD);
sound(SQUISHED); S_PlaySound(SQUISHED);
break; break;
case 104+20: case 104+20:
sound(ENDSEQVOL3SND3); S_PlaySound(ENDSEQVOL3SND3);
break; break;
case 114+20: case 114+20:
sound(ENDSEQVOL3SND2); S_PlaySound(ENDSEQVOL3SND2);
break; break;
case 158: case 158:
sound(PIPEBOMB_EXPLODE); S_PlaySound(PIPEBOMB_EXPLODE);
break; break;
} }
break; break;
@ -97,10 +97,10 @@ void logoanimsounds(int fr)
switch (fr) switch (fr)
{ {
case 1: case 1:
sound(FLY_BY); S_PlaySound(FLY_BY);
break; break;
case 19: case 19:
sound(PIPEBOMB_EXPLODE); S_PlaySound(PIPEBOMB_EXPLODE);
break; break;
} }
} }
@ -110,14 +110,14 @@ void intro4animsounds(int fr)
switch (fr) switch (fr)
{ {
case 1: case 1:
sound(INTRO4_B); S_PlaySound(INTRO4_B);
break; break;
case 12: case 12:
case 34: case 34:
sound(SHORT_CIRCUIT); S_PlaySound(SHORT_CIRCUIT);
break; break;
case 18: case 18:
sound(INTRO4_5); S_PlaySound(INTRO4_5);
break; break;
} }
} }
@ -127,16 +127,16 @@ void first4animsounds(int fr)
switch (fr) switch (fr)
{ {
case 1: case 1:
sound(INTRO4_1); S_PlaySound(INTRO4_1);
break; break;
case 12: case 12:
sound(INTRO4_2); S_PlaySound(INTRO4_2);
break; break;
case 7: case 7:
sound(INTRO4_3); S_PlaySound(INTRO4_3);
break; break;
case 26: case 26:
sound(INTRO4_4); S_PlaySound(INTRO4_4);
break; break;
} }
} }
@ -146,7 +146,7 @@ void intro42animsounds(int fr)
switch (fr) switch (fr)
{ {
case 10: case 10:
sound(INTRO4_6); S_PlaySound(INTRO4_6);
break; break;
} }
} }
@ -156,10 +156,10 @@ void endanimvol41(int fr)
switch (fr) switch (fr)
{ {
case 3: case 3:
sound(DUKE_UNDERWATER); S_PlaySound(DUKE_UNDERWATER);
break; break;
case 35: case 35:
sound(VOL4ENDSND1); S_PlaySound(VOL4ENDSND1);
break; break;
} }
} }
@ -169,13 +169,13 @@ void endanimvol42(int fr)
switch (fr) switch (fr)
{ {
case 11: case 11:
sound(DUKE_UNDERWATER); S_PlaySound(DUKE_UNDERWATER);
break; break;
case 20: case 20:
sound(VOL4ENDSND1); S_PlaySound(VOL4ENDSND1);
break; break;
case 39: case 39:
sound(VOL4ENDSND2); S_PlaySound(VOL4ENDSND2);
break; break;
case 50: case 50:
FX_StopAllSounds(); FX_StopAllSounds();
@ -188,19 +188,19 @@ void endanimvol43(int fr)
switch (fr) switch (fr)
{ {
case 1: case 1:
sound(BOSS4_DEADSPEECH); S_PlaySound(BOSS4_DEADSPEECH);
break; break;
case 40: case 40:
sound(VOL4ENDSND1); S_PlaySound(VOL4ENDSND1);
sound(DUKE_UNDERWATER); S_PlaySound(DUKE_UNDERWATER);
break; break;
case 50: case 50:
sound(BIGBANG); S_PlaySound(BIGBANG);
break; break;
} }
} }
void playanm(const char *fn,char t) void G_PlayAnim(const char *fn,char t)
{ {
char *animbuf; char *animbuf;
unsigned char *palptr; unsigned char *palptr;
@ -250,7 +250,7 @@ void playanm(const char *fn,char t)
//setpalette(0L,256L,tempbuf); //setpalette(0L,256L,tempbuf);
//setbrightness(ud.brightness>>2,tempbuf,2); //setbrightness(ud.brightness>>2,tempbuf,2);
setgamepalette(g_player[myconnectindex].ps,animpal,10); SetGamePalette(g_player[myconnectindex].ps,animpal,10);
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
gltexfiltermode = 0; gltexfiltermode = 0;
@ -275,10 +275,10 @@ void playanm(const char *fn,char t)
goto ENDOFANIMLOOP; goto ENDOFANIMLOOP;
handleevents(); handleevents();
getpackets(); getpackets();
if (restorepalette == 1) if (g_restorePalette == 1)
{ {
setgamepalette(g_player[myconnectindex].ps,animpal,0); SetGamePalette(g_player[myconnectindex].ps,animpal,0);
restorepalette = 0; g_restorePalette = 0;
} }
idle(); idle();
} }

View file

@ -7331,7 +7331,7 @@ static void comlinehelp(void)
wm_msgbox("Mapster32"VERSION BUILDDATE,s); wm_msgbox("Mapster32"VERSION BUILDDATE,s);
} }
static void addgamepath(const char *buffer) static void AddGamePath(const char *buffer)
{ {
struct strllist *s; struct strllist *s;
s = (struct strllist *)Bcalloc(1,sizeof(struct strllist)); s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
@ -7347,7 +7347,7 @@ static void addgamepath(const char *buffer)
CommandPaths = s; CommandPaths = s;
} }
static void addgroup(const char *buffer) static void G_AddGroup(const char *buffer)
{ {
struct strllist *s; struct strllist *s;
s = (struct strllist *)Bcalloc(1,sizeof(struct strllist)); s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
@ -7374,7 +7374,7 @@ static void addgroup(const char *buffer)
extern char forcegl; extern char forcegl;
#endif #endif
static void checkcommandline(int argc, const char **argv) static void G_CheckCommandLine(int argc, const char **argv)
{ {
int i = 1, j, maxlen=0, *lengths; int i = 1, j, maxlen=0, *lengths;
char *c, *k; char *c, *k;
@ -7406,7 +7406,7 @@ static void checkcommandline(int argc, const char **argv)
{ {
if (argc > i+1) if (argc > i+1)
{ {
addgroup(argv[i+1]); G_AddGroup(argv[i+1]);
COPYARG(i); COPYARG(i);
COPYARG(i+1); COPYARG(i+1);
i++; i++;
@ -7419,7 +7419,7 @@ static void checkcommandline(int argc, const char **argv)
{ {
if (argc > i+1) if (argc > i+1)
{ {
addgamepath(argv[i+1]); AddGamePath(argv[i+1]);
COPYARG(i); COPYARG(i);
COPYARG(i+1); COPYARG(i+1);
i++; i++;
@ -7516,14 +7516,14 @@ static void checkcommandline(int argc, const char **argv)
case 'J': case 'J':
c++; c++;
if (!*c) break; if (!*c) break;
addgamepath(c); AddGamePath(c);
COPYARG(i); COPYARG(i);
break; break;
case 'g': case 'g':
case 'G': case 'G':
c++; c++;
if (!*c) break; if (!*c) break;
addgroup(c); G_AddGroup(c);
COPYARG(i); COPYARG(i);
break; break;
} }
@ -7535,7 +7535,7 @@ static void checkcommandline(int argc, const char **argv)
{ {
if (!Bstrcasecmp(k,".grp") || !Bstrcasecmp(k,".zip")) if (!Bstrcasecmp(k,".grp") || !Bstrcasecmp(k,".zip"))
{ {
addgroup(argv[i++]); G_AddGroup(argv[i++]);
COPYARG(i); COPYARG(i);
continue; continue;
} }
@ -7582,7 +7582,7 @@ int ExtPreInit(int argc,const char **argv)
initprintf("Mapster32"VERSION BUILDDATE"\n"); initprintf("Mapster32"VERSION BUILDDATE"\n");
initprintf("Copyright (c) 2008 EDuke32 team\n"); initprintf("Copyright (c) 2008 EDuke32 team\n");
checkcommandline(argc,argv); G_CheckCommandLine(argc,argv);
return 0; return 0;
} }
@ -8015,7 +8015,7 @@ static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens)
return T_ERROR; return T_ERROR;
} }
static void autoloadgrps(const char *fn) static void DoAutoload(const char *fn)
{ {
Bsprintf(tempbuf,"autoload/%s",fn); Bsprintf(tempbuf,"autoload/%s",fn);
getfilenames(tempbuf,"*.grp"); getfilenames(tempbuf,"*.grp");
@ -8062,7 +8062,7 @@ int parsegroupfiles(scriptfile *script)
{ {
initprintf("Using group file '%s'.\n",fn); initprintf("Using group file '%s'.\n",fn);
if (!NoAutoLoad) if (!NoAutoLoad)
autoloadgrps(fn); DoAutoload(fn);
} }
} }
@ -8529,7 +8529,7 @@ int ExtInit(void)
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
if (i != -1) if (i != -1)
autoloadgrps(duke3dgrp); DoAutoload(duke3dgrp);
} }
if (getenv("DUKE3DDEF")) if (getenv("DUKE3DDEF"))
@ -8553,7 +8553,7 @@ int ExtInit(void)
{ {
initprintf("Using group file '%s'.\n",CommandGrps->str); initprintf("Using group file '%s'.\n",CommandGrps->str);
if (!NoAutoLoad) if (!NoAutoLoad)
autoloadgrps(CommandGrps->str); DoAutoload(CommandGrps->str);
} }
free(CommandGrps->str); free(CommandGrps->str);

View file

@ -202,7 +202,7 @@ void CONFIG_SetDefaults(void)
ud.config.MusicDevice = 0; ud.config.MusicDevice = 0;
ud.config.MusicToggle = 1; ud.config.MusicToggle = 1;
ud.config.MusicVolume = 200; ud.config.MusicVolume = 200;
myaimmode = g_player[0].ps->aim_mode = 1; g_myAimMode = g_player[0].ps->aim_mode = 1;
ud.config.NumBits = 16; ud.config.NumBits = 16;
ud.config.NumChannels = 2; ud.config.NumChannels = 2;
ud.config.NumVoices = 32; ud.config.NumVoices = 32;
@ -253,7 +253,7 @@ void CONFIG_SetDefaults(void)
ud.textscale = 100; ud.textscale = 100;
Bstrcpy(ud.rtsname, "DUKE.RTS"); Bstrcpy(ud.rtsname, "DUKE.RTS");
Bstrcpy(myname, "Duke"); Bstrcpy(szPlayerName, "Duke");
Bstrcpy(ud.ridecule[0], "An inspiration for birth control."); Bstrcpy(ud.ridecule[0], "An inspiration for birth control.");
Bstrcpy(ud.ridecule[1], "You're gonna die for that!"); Bstrcpy(ud.ridecule[1], "You're gonna die for that!");
@ -587,12 +587,12 @@ void CONFIG_SetupJoystick(void)
=================== ===================
*/ */
extern char *duke3dgrp; extern char *duke3dgrp;
extern void check_valid_color(int *color,int prev_color); extern void G_CheckPlayerColor(int *color,int prev_color);
extern palette_t crosshair_colors; extern palette_t CrosshairColors;
extern palette_t default_crosshair_colors; extern palette_t DefaultCrosshairColors;
extern char mod_dir[BMAX_PATH]; extern char mod_dir[BMAX_PATH];
extern int r_maxfps; extern int r_maxfps;
extern int g_NoSetup; extern int g_noSetup;
int32 CONFIG_ReadSetup(void) int32 CONFIG_ReadSetup(void)
{ {
@ -637,8 +637,8 @@ int32 CONFIG_ReadSetup(void)
while (Bstrlen(stripcolorcodes(dummybuf,tempbuf)) > 10) while (Bstrlen(stripcolorcodes(dummybuf,tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf)-1] = '\0'; tempbuf[Bstrlen(tempbuf)-1] = '\0';
Bstrncpy(myname,tempbuf,sizeof(myname)-1); Bstrncpy(szPlayerName,tempbuf,sizeof(szPlayerName)-1);
myname[sizeof(myname)-1] = '\0'; szPlayerName[sizeof(szPlayerName)-1] = '\0';
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]); SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
@ -648,43 +648,21 @@ int32 CONFIG_ReadSetup(void)
packetrate = min(max(packetrate,50),1000); packetrate = min(max(packetrate,50),1000);
#endif #endif
SCRIPT_GetNumber(ud.config.scripthandle, "Setup","ConfigVersion",&ud.configversion);
SCRIPT_GetNumber(ud.config.scripthandle, "Setup","ForceSetup",&ud.config.ForceSetup);
#ifdef _WIN32
if (g_noSetup == 0 && mod_dir[0] == '/')
SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]);
#endif
{ {
extern char defaultduke3dgrp[BMAX_PATH]; extern char defaultduke3dgrp[BMAX_PATH];
if (!Bstrcmp(defaultduke3dgrp,"duke3d.grp")) if (!Bstrcmp(defaultduke3dgrp,"duke3d.grp"))
SCRIPT_GetString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]); SCRIPT_GetString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]);
} }
#ifdef _WIN32
if (g_NoSetup == 0 && mod_dir[0] == '/')
SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]);
#endif
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Shadows",&ud.shadows);
if (!NAM)
{ {
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup","Password",&ud.pwlockout[0]);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Out",&ud.lockout);
}
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Detail",&ud.detail);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Tilt",&ud.screen_tilting);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Messages",&ud.fta_on);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",&ud.config.ScreenWidth);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",&ud.config.ScreenHeight);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",&ud.config.ScreenMode);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenGamma",&ud.brightness);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenSize",&ud.screen_size);
tempbuf[0] = 0;
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidGamma",&tempbuf[0]);
if (tempbuf[0]) vid_gamma = atof(tempbuf);
tempbuf[0] = 0;
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidBrightness",&tempbuf[0]);
if (tempbuf[0]) vid_brightness = atof(tempbuf);
tempbuf[0] = 0;
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidContrast",&tempbuf[0]);
if (tempbuf[0]) vid_contrast = atof(tempbuf);
tempbuf[0] = 0; tempbuf[0] = 0;
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "AmbientLight",&tempbuf[0]); SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "AmbientLight",&tempbuf[0]);
if (atof(tempbuf)) if (atof(tempbuf))
@ -692,60 +670,66 @@ int32 CONFIG_ReadSetup(void)
r_ambientlight = atof(tempbuf); r_ambientlight = atof(tempbuf);
r_ambientlightrecip = 1.f/r_ambientlight; r_ambientlightrecip = 1.f/r_ambientlight;
} }
}
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Detail",&ud.detail);
{
extern int g_frameDelay;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxFPS",&r_maxfps); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxFPS",&r_maxfps);
r_maxfps = max(0,min(1000,r_maxfps)); r_maxfps = max(0,min(1000,r_maxfps));
{
extern int g_FrameDelay;
if (r_maxfps) if (r_maxfps)
g_FrameDelay = (1000/r_maxfps); g_frameDelay = (1000/r_maxfps);
else g_FrameDelay = 0; else g_frameDelay = 0;
} }
#if defined(POLYMOST) && defined(USE_OPENGL) SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Messages",&ud.fta_on);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP);
if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32; if (!NAM)
#endif {
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Out",&ud.lockout);
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup","Password",&ud.pwlockout[0]);
}
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenGamma",&ud.brightness);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",&ud.config.ScreenHeight);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",&ud.config.ScreenMode);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenSize",&ud.screen_size);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",&ud.config.ScreenWidth);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Shadows",&ud.shadows);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Tilt",&ud.screen_tilting);
{
tempbuf[0] = 0;
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidGamma",&tempbuf[0]);
if (tempbuf[0]) vid_gamma = atof(tempbuf);
}
{
tempbuf[0] = 0;
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidBrightness",&tempbuf[0]);
if (tempbuf[0]) vid_brightness = atof(tempbuf);
}
{
tempbuf[0] = 0;
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidContrast",&tempbuf[0]);
if (tempbuf[0]) vid_contrast = atof(tempbuf);
}
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32*)&maxrefreshfreq); {
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32 *)&windowpos);
windowx = -1;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32 *)&windowx);
windowy = -1;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32 *)&windowy);
}
#endif #endif
#if defined(POLYMOST) && defined(USE_OPENGL)
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy", &glanisotropy);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix", &glprojectionhacks);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLWidescreen", &glwidescreen);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", &glusetexcache); {
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCacheCompression", &glusetexcachecompression);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLDepthPeeling", &r_depthpeeling);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount", &r_peelscount);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLFullbrights", &r_fullbrights);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLDetailMapping", &r_detailmapping);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLGlowMapping", &r_glowmapping);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVertexArrays", &r_vertexarrays);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVBOs", &r_vbos);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVBOCount", &r_vbocount);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVSync", &vsync);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing", &r_animsmoothing);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyClamping", &r_parallaxskyclamping);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning", &r_parallaxskypanning);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLOcclusionChecking", &r_modelocclusionchecking);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLTextureQuality", &r_downsize);
dummy = usemodels;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseModels",&dummy);
usemodels = dummy != 0;
dummy = usehightile;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",&dummy);
usehightile = dummy != 0;
#endif
#ifdef _WIN32 #ifdef _WIN32
dummy = 0; dummy = 0;
#else #else
@ -753,98 +737,66 @@ int32 CONFIG_ReadSetup(void)
#endif #endif
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",&dummy); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",&dummy);
OSD_SetTextMode(dummy); OSD_SetTextMode(dummy);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",&osdhightile);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions);
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup",&ud.config.ForceSetup);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "RunMode",&ud.config.RunMode);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Crosshairs",&ud.crosshair);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "CrosshairScale",&ud.crosshairscale);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarScale",&ud.statusbarscale);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowLevelStats",&ud.levelstats);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowOpponentWeapons",&ud.config.ShowOpponentWeapons);
ud.showweapons = ud.config.ShowOpponentWeapons;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowViewWeapon",&ud.drawweapon);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DeathMessages",&ud.obituaries);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DemoCams",&ud.democams);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowFPS",&ud.tickrate);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Color",&ud.color);
check_valid_color((int *)&ud.color,-1);
g_player[0].ps->palookup = g_player[0].pcolor = ud.color;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Team",&dummy);
ud.team = 0;
if (dummy < 4 && dummy > -1) ud.team = dummy;
g_player[0].pteam = ud.team;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoVote",&ud.autovote);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoMsg",&ud.automsg);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "IDPlayers",&ud.idplayers);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ViewBobbing",&ud.viewbob);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponSway",&ud.weaponsway);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AltHud",&ud.althud);
dummy = ud.config.useprecache;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "UsePrecache",&dummy);
ud.config.useprecache = dummy != 0;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc","AngleInterpolation",&ud.angleinterpolation);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponScale",&ud.weaponscale);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "TextScale",&ud.textscale);
// weapon choices are defaulted in checkcommandline, which may override them
if (!CommandWeaponChoice)
for (i=0;i<10;i++)
{
Bsprintf(buf,"WeaponChoice%d",i);
dummy = -1;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", buf, &dummy);
if (dummy >= 0) g_player[0].wchoice[i] = dummy;
} }
SCRIPT_GetNumber(ud.config.scripthandle, "Setup","ConfigVersion",&ud.configversion); #ifdef RENDERTYPEWIN
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32*)&maxrefreshfreq);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXDevice",&ud.config.FXDevice);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicDevice",&ud.config.MusicDevice);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",&ud.config.FXVolume);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicVolume",&ud.config.MusicVolume);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "SoundToggle",&ud.config.SoundToggle);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",&ud.config.MusicToggle);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",&ud.config.VoiceToggle);
if (ud.config.VoiceToggle == 2) ud.config.VoiceToggle = 5;
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",&ud.config.AmbienceToggle);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumVoices",&ud.config.NumVoices);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumChannels",&ud.config.NumChannels);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumBits",&ud.config.NumBits);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MixRate",&ud.config.MixRate);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "ReverseStereo",&ud.config.ReverseStereo);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",&ud.mouseflip); // mouse aiming inverted
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAiming",&ud.mouseaiming); // 1=momentary/0=toggle
g_player[0].ps->aim_mode = ud.mouseaiming;
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseBias",&ud.config.MouseBias);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseDeadZone",&ud.config.MouseDeadZone);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","SmoothInput",&ud.config.SmoothInput);
control_smoothmouse = ud.config.SmoothInput;
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseJoystick",&ud.config.UseJoystick);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseMouse",&ud.config.UseMouse);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AimingFlag",(int32 *)&myaimmode); // (if toggle mode) gives state
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",&ud.runkey_mode); // JBF 20031125
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AutoAim",&ud.config.AutoAim); // JBF 20031125
g_player[0].ps->auto_aim = ud.config.AutoAim;
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",&ud.weaponswitch);
g_player[0].ps->weaponswitch = ud.weaponswitch;
#ifdef _WIN32
SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", &ud.config.CheckForUpdates);
SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", &ud.config.LastUpdateCheck);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32 *)&windowpos);
windowx = -1;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32 *)&windowx);
windowy = -1;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32 *)&windowy);
#endif #endif
#if defined(POLYMOST) && defined(USE_OPENGL)
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing", &r_animsmoothing);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy", &glanisotropy);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLDepthPeeling", &r_depthpeeling);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLDetailMapping", &r_detailmapping);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLFullbrights", &r_fullbrights);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLGlowMapping", &r_glowmapping);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLOcclusionChecking", &r_modelocclusionchecking);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyClamping", &r_parallaxskyclamping);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning", &r_parallaxskypanning);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount", &r_peelscount);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix", &glprojectionhacks);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLTextureQuality", &r_downsize);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", &glusetexcache);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCacheCompression", &glusetexcachecompression);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVBOCount", &r_vbocount);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVBOs", &r_vbos);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVertexArrays", &r_vertexarrays);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVSync", &vsync);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLWidescreen", &glwidescreen);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",&osdhightile);
{
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP);
if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32;
}
{
dummy = usehightile;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",&dummy);
usehightile = dummy != 0;
}
{
dummy = usemodels;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseModels",&dummy);
usemodels = dummy != 0;
}
#endif
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AltHud",&ud.althud);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc","AngleInterpolation",&ud.angleinterpolation);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoMsg",&ud.automsg);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoVote",&ud.autovote);
{
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Color",&ud.color);
G_CheckPlayerColor((int *)&ud.color,-1);
g_player[0].ps->palookup = g_player[0].pcolor = ud.color;
}
{
tempbuf[0] = 0; tempbuf[0] = 0;
SCRIPT_GetString(ud.config.scripthandle, "Misc", "CrosshairColor",&tempbuf[0]); SCRIPT_GetString(ud.config.scripthandle, "Misc", "CrosshairColor",&tempbuf[0]);
if (tempbuf[0]) if (tempbuf[0])
@ -861,12 +813,108 @@ int32 CONFIG_ReadSetup(void)
} }
if (i == 3) if (i == 3)
{ {
Bmemcpy(&crosshair_colors,&temppal,sizeof(palette_t)); Bmemcpy(&CrosshairColors,&temppal,sizeof(palette_t));
default_crosshair_colors.f = 1; DefaultCrosshairColors.f = 1;
} }
} }
} }
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "CrosshairScale",&ud.crosshairscale);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Crosshairs",&ud.crosshair);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DeathMessages",&ud.obituaries);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DemoCams",&ud.democams);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "IDPlayers",&ud.idplayers);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "RunMode",&ud.config.RunMode);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowFPS",&ud.tickrate);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowLevelStats",&ud.levelstats);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowOpponentWeapons",&ud.config.ShowOpponentWeapons); ud.showweapons = ud.config.ShowOpponentWeapons;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowViewWeapon",&ud.drawweapon);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarScale",&ud.statusbarscale);
{
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Team",&dummy);
ud.team = 0;
if (dummy < 4 && dummy > -1) ud.team = dummy;
g_player[0].pteam = ud.team;
}
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "TextScale",&ud.textscale);
dummy = ud.config.useprecache;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "UsePrecache",&dummy);
ud.config.useprecache = dummy != 0;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ViewBobbing",&ud.viewbob);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponScale",&ud.weaponscale);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponSway",&ud.weaponsway);
// weapon choices are defaulted in G_CheckCommandLine, which may override them
if (!CommandWeaponChoice)
for (i=0;i<10;i++)
{
Bsprintf(buf,"WeaponChoice%d",i);
dummy = -1;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", buf, &dummy);
if (dummy >= 0) g_player[0].wchoice[i] = dummy;
}
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",&ud.config.AmbienceToggle);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXDevice",&ud.config.FXDevice);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",&ud.config.FXVolume);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MixRate",&ud.config.MixRate);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicDevice",&ud.config.MusicDevice);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",&ud.config.MusicToggle);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicVolume",&ud.config.MusicVolume);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumBits",&ud.config.NumBits);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumChannels",&ud.config.NumChannels);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumVoices",&ud.config.NumVoices);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "ReverseStereo",&ud.config.ReverseStereo);
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "SoundToggle",&ud.config.SoundToggle);
{
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",&ud.config.VoiceToggle);
if (ud.config.VoiceToggle == 2) ud.config.VoiceToggle = 5;
}
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AimingFlag",(int32 *)&g_myAimMode); // (if toggle mode) gives state
{
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AutoAim",&ud.config.AutoAim); // JBF 20031125
g_player[0].ps->auto_aim = ud.config.AutoAim;
}
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",&ud.mouseflip); // mouse aiming inverted
{
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAiming",&ud.mouseaiming); // 1=momentary/0=toggle
g_player[0].ps->aim_mode = ud.mouseaiming;
}
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseBias",&ud.config.MouseBias);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseDeadZone",&ud.config.MouseDeadZone);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",&ud.runkey_mode); // JBF 20031125
{
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","SmoothInput",&ud.config.SmoothInput);
control_smoothmouse = ud.config.SmoothInput;
}
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseJoystick",&ud.config.UseJoystick);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseMouse",&ud.config.UseMouse);
{
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",&ud.weaponswitch);
g_player[0].ps->weaponswitch = ud.weaponswitch;
}
#ifdef _WIN32
SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", &ud.config.CheckForUpdates);
SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", &ud.config.LastUpdateCheck);
#endif
}
CONFIG_ReadKeys(); CONFIG_ReadKeys();
//CONFIG_SetupMouse(ud.config.scripthandle); //CONFIG_SetupMouse(ud.config.scripthandle);
@ -934,28 +982,36 @@ void CONFIG_WriteSetup(void)
if (ud.config.scripthandle < 0) if (ud.config.scripthandle < 0)
ud.config.scripthandle = SCRIPT_Init(setupfilename); ud.config.scripthandle = SCRIPT_Init(setupfilename);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","AimingFlag",(int) myaimmode,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Controls","AimingFlag",(int) g_myAimMode,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","AutoAim",ud.config.AutoAim,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Controls","AutoAim",ud.config.AutoAim,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",ud.mouseflip,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",ud.mouseflip,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAiming",ud.mouseaiming,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAiming",ud.mouseaiming,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseBias",ud.config.MouseBias,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseBias",ud.config.MouseBias,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseDeadZone",ud.config.MouseDeadZone,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseDeadZone",ud.config.MouseDeadZone,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","SmoothInput",ud.config.SmoothInput,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",ud.runkey_mode,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",ud.runkey_mode,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","SmoothInput",ud.config.SmoothInput,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","UseJoystick",ud.config.UseJoystick,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Controls","UseJoystick",ud.config.UseJoystick,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","UseMouse",ud.config.UseMouse,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Controls","UseMouse",ud.config.UseMouse,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",ud.weaponswitch,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",ud.weaponswitch,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AltHud",ud.althud,false,false);
// SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AngleInterpolation",ud.angleinterpolation,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AutoMsg",ud.automsg,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AutoMsg",ud.automsg,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AutoVote",ud.autovote,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AutoVote",ud.autovote,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Color",ud.color,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Color",ud.color,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Crosshairs",ud.crosshair,false,false);
if (CrosshairColors.r != DefaultCrosshairColors.r || CrosshairColors.g != DefaultCrosshairColors.g
|| CrosshairColors.b != DefaultCrosshairColors.b)
{
Bsprintf(tempbuf,"%d,%d,%d",CrosshairColors.r,CrosshairColors.g,CrosshairColors.b);
SCRIPT_PutString(ud.config.scripthandle, "Misc", "CrosshairColor",tempbuf);
}
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "CrosshairScale",ud.crosshairscale,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "CrosshairScale",ud.crosshairscale,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Crosshairs",ud.crosshair,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DeathMessages",ud.obituaries,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DeathMessages",ud.obituaries,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DemoCams",ud.democams,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DemoCams",ud.democams,false,false);
ud.executions++; SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",++ud.executions,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",ud.executions,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup",ud.config.ForceSetup,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "IDPlayers",ud.idplayers,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "IDPlayers",ud.idplayers,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "MPMessageDisplayTime",ud.msgdisptime,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "MPMessageDisplayTime",ud.msgdisptime,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "RunMode",ud.config.RunMode,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "RunMode",ud.config.RunMode,false,false);
@ -966,49 +1022,60 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "StatusBarMode",ud.statusbarmode,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "StatusBarMode",ud.statusbarmode,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "StatusBarScale",ud.statusbarscale,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "StatusBarScale",ud.statusbarscale,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Team",ud.team,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Team",ud.team,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "TextScale",ud.textscale,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "UsePrecache",ud.config.useprecache,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "UsePrecache",ud.config.useprecache,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ViewBobbing",ud.viewbob,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ViewBobbing",ud.viewbob,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "WeaponSway",ud.weaponsway,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AltHud",ud.althud,false,false); for (dummy=0;dummy<10;dummy++)
// SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AngleInterpolation",ud.angleinterpolation,false,false); {
Bsprintf(buf,"WeaponChoice%d",dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],false,false);
}
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "WeaponScale",ud.weaponscale,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "WeaponScale",ud.weaponscale,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "TextScale",ud.textscale,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "WeaponSway",ud.weaponsway,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_JF,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup",ud.config.ForceSetup,false,false);
{
Bsprintf(tempbuf,"%.2f",r_ambientlight);
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "AmbientLight",tempbuf);
}
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Detail",ud.detail,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Detail",ud.detail,false,false);
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing",r_animsmoothing,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy",glanisotropy,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy",glanisotropy,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLDepthPeeling",r_depthpeeling,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLDetailMapping", r_detailmapping,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLFullbrights", r_fullbrights,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLGlowMapping", r_glowmapping,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLOcclusionChecking", r_modelocclusionchecking,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyClamping",r_parallaxskyclamping,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning",r_parallaxskypanning,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount",r_peelscount,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix",glprojectionhacks,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix",glprojectionhacks,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode",gltexfiltermode,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode",gltexfiltermode,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLTextureQuality", r_downsize,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", glusetexcache,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", glusetexcache,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCacheCompression", glusetexcachecompression,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCacheCompression", glusetexcachecompression,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCompr",glusetexcompr,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCompr",glusetexcompr,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLWidescreen",glwidescreen,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLDepthPeeling",r_depthpeeling,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount",r_peelscount,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLFullbrights", r_fullbrights,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLDetailMapping", r_detailmapping,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLGlowMapping", r_glowmapping,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVertexArrays", r_vertexarrays,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVBOs", r_vbos,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVBOCount", r_vbocount,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVBOCount", r_vbocount,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVBOs", r_vbos,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVertexArrays", r_vertexarrays,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVSync", vsync,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVSync", vsync,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLWidescreen",glwidescreen,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing",r_animsmoothing,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyClamping",r_parallaxskyclamping,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning",r_parallaxskypanning,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLOcclusionChecking", r_modelocclusionchecking,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLTextureQuality", r_downsize,false,false);
#endif #endif
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxFPS", r_maxfps, false, false);
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq",maxrefreshfreq,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq",maxrefreshfreq,false,false);
#endif #endif
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Messages",ud.fta_on,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Messages",ud.fta_on,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",osdhightile,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",OSD_GetTextMode(),false,false);
if (!NAM) if (!NAM)
{ {
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,false,false);
@ -1023,12 +1090,27 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",ud.config.ScreenWidth,false,false); // JBF 20031206 SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",ud.config.ScreenWidth,false,false); // JBF 20031206
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Shadows",ud.shadows,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Shadows",ud.shadows,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Tilt",ud.screen_tilting,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Tilt",ud.screen_tilting,false,false);
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",usehightile,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",usehightile,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseModels",usemodels,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseModels",usemodels,false,false);
#endif #endif
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",OSD_GetTextMode(),false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",osdhightile,false,false); {
Bsprintf(tempbuf,"%.2f",vid_brightness);
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidBrightness",tempbuf);
Bsprintf(tempbuf,"%.2f",vid_contrast);
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidContrast",tempbuf);
Bsprintf(tempbuf,"%.2f",vid_gamma);
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidGamma",tempbuf);
}
#ifdef RENDERTYPEWIN
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, false, false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, false, false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, false, false);
#endif
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",ud.config.AmbienceToggle,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",ud.config.AmbienceToggle,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",ud.config.FXVolume,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",ud.config.FXVolume,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",ud.config.MusicToggle,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",ud.config.MusicToggle,false,false);
@ -1041,30 +1123,11 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "SoundToggle",ud.config.SoundToggle,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "SoundToggle",ud.config.SoundToggle,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",ud.config.VoiceToggle,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",ud.config.VoiceToggle,false,false);
Bsprintf(tempbuf,"%.2f",vid_gamma);
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidGamma",tempbuf);
Bsprintf(tempbuf,"%.2f",vid_brightness);
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidBrightness",tempbuf);
Bsprintf(tempbuf,"%.2f",vid_contrast);
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidContrast",tempbuf);
Bsprintf(tempbuf,"%.2f",r_ambientlight);
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "AmbientLight",tempbuf);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxFPS", r_maxfps, false, false);
#ifdef _WIN32 #ifdef _WIN32
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, false, false); SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, false, false);
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, false, false); SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, false, false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, false, false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, false, false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, false, false);
#endif #endif
if (crosshair_colors.r != default_crosshair_colors.r || crosshair_colors.g != default_crosshair_colors.g
|| crosshair_colors.b != default_crosshair_colors.b)
{
Bsprintf(tempbuf,"%d,%d,%d",crosshair_colors.r,crosshair_colors.g,crosshair_colors.b);
SCRIPT_PutString(ud.config.scripthandle, "Misc", "CrosshairColor",tempbuf);
}
// JBF 20031211 // JBF 20031211
for (dummy=0;dummy<NUMGAMEFUNCTIONS;dummy++) for (dummy=0;dummy<NUMGAMEFUNCTIONS;dummy++)
{ {
@ -1072,14 +1135,6 @@ void CONFIG_WriteSetup(void)
KB_ScanCodeToString(ud.config.KeyboardKeys[dummy][0]), KB_ScanCodeToString(ud.config.KeyboardKeys[dummy][1])); KB_ScanCodeToString(ud.config.KeyboardKeys[dummy][0]), KB_ScanCodeToString(ud.config.KeyboardKeys[dummy][1]));
} }
for (dummy=0;dummy<10;dummy++)
{
Bsprintf(buf,"WeaponChoice%d",dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],false,false);
}
SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_JF,false,false);
for (dummy=0;dummy<MAXMOUSEBUTTONS;dummy++) for (dummy=0;dummy<MAXMOUSEBUTTONS;dummy++)
{ {
Bsprintf(buf,"MouseButton%d",dummy); Bsprintf(buf,"MouseButton%d",dummy);
@ -1137,7 +1192,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueSaturate[dummy], false, false); SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueSaturate[dummy], false, false);
} }
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","PlayerName",&myname[0]); SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","PlayerName",&szPlayerName[0]);
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]); SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
#ifndef RANCID_NETWORKING #ifndef RANCID_NETWORKING
@ -1149,7 +1204,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]); SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]);
#ifdef _WIN32 #ifdef _WIN32
if (g_NoSetup == 0) if (g_noSetup == 0)
SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]); SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]);
#endif #endif

View file

@ -55,20 +55,22 @@ extern "C" {
#include "function.h" #include "function.h"
#include "swmacros.h"
#define HORIZ_MIN -99 #define HORIZ_MIN -99
#define HORIZ_MAX 299 #define HORIZ_MAX 299
extern int g_ScriptVersion, g_Shareware, g_GameType; extern int g_scriptVersion, g_Shareware, g_gameType;
#define GAMEDUKE 0 #define GAMEDUKE 0
#define GAMENAM 1 #define GAMENAM 1
#define GAMEWW2 3 #define GAMEWW2 3
#define VOLUMEALL (g_Shareware==0) #define VOLUMEALL (g_Shareware==0)
#define PLUTOPAK (g_ScriptVersion==14) #define PLUTOPAK (g_scriptVersion==14)
#define VOLUMEONE (g_Shareware==1) #define VOLUMEONE (g_Shareware==1)
#define NAM (g_GameType&1) #define NAM (g_gameType&1)
#define WW2GI (g_GameType&2) #define WW2GI (g_gameType&2)
#define MAXSLEEPDIST 16384 #define MAXSLEEPDIST 16384
#define SLEEPTIME 24*64 #define SLEEPTIME 24*64
@ -110,7 +112,7 @@ extern int g_ScriptVersion, g_Shareware, g_GameType;
#include "namesdyn.h" #include "namesdyn.h"
#define TICRATE (120) #define TICRATE g_timerTicsPerSecond
#define TICSPERFRAME (TICRATE/26) #define TICSPERFRAME (TICRATE/26)
// #define GC (TICSPERFRAME*44) // #define GC (TICSPERFRAME*44)
@ -126,13 +128,28 @@ extern int g_ScriptVersion, g_Shareware, g_GameType;
parm [ebx]\ parm [ebx]\
*/ */
#define STAT_DEFAULT 0
#define STAT_ACTOR 1
#define STAT_ZOMBIEACTOR 2
#define STAT_EFFECTOR 3
#define STAT_PROJECTILE 4
#define STAT_MISC 5
#define STAT_STANDABLE 6
#define STAT_LOCATOR 7
#define STAT_ACTIVATOR 8
#define STAT_TRANSPORT 9
#define STAT_PLAYER 10
#define STAT_FX 11
#define STAT_FALLER 12
#define STAT_DUMMYPLAYER 13
#define ALT_IS_PRESSED ( KB_KeyPressed( sc_RightAlt ) || KB_KeyPressed( sc_LeftAlt ) ) #define ALT_IS_PRESSED ( KB_KeyPressed( sc_RightAlt ) || KB_KeyPressed( sc_LeftAlt ) )
#define SHIFTS_IS_PRESSED ( KB_KeyPressed( sc_RightShift ) || KB_KeyPressed( sc_LeftShift ) ) #define SHIFTS_IS_PRESSED ( KB_KeyPressed( sc_RightShift ) || KB_KeyPressed( sc_LeftShift ) )
#define RANDOMSCRAP EGS(s->sectnum,s->x+(TRAND&255)-128,s->y+(TRAND&255)-128,s->z-(8<<8)-(TRAND&8191),SCRAP6+(TRAND&15),-8,48,48,TRAND&2047,(TRAND&63)+64,-512-(TRAND&2047),i,5) #define RANDOMSCRAP A_InsertSprite(s->sectnum,s->x+(krand()&255)-128,s->y+(krand()&255)-128,s->z-(8<<8)-(krand()&8191),SCRAP6+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-512-(krand()&2047),i,5)
#define PHEIGHT (38<<8) #define PHEIGHT (38<<8)
enum gamemodes { enum GameMode_t {
MODE_MENU = 1, MODE_MENU = 1,
MODE_DEMO = 2, MODE_DEMO = 2,
MODE_GAME = 4, MODE_GAME = 4,
@ -148,38 +165,16 @@ enum gamemodes {
#define MAXQUOTES 16384 #define MAXQUOTES 16384
#define PPDEATHSTRINGS MAXQUOTES-128 #define FIRST_OBITUARY_QUOTE MAXQUOTES-128
#define PSDEATHSTRINGS MAXQUOTES-32 #define FIRST_SUICIDE_QUOTE MAXQUOTES-32
#define MAXCYCLERS 1024 #define MAXCYCLERS 1024
#define MAXANIMATES 256 #define MAXANIMATES 256
#define SP sprite[i].yvel
#define SX sprite[i].x
#define SY sprite[i].y
#define SZ sprite[i].z
#define SS sprite[i].shade
#define PN sprite[i].picnum
#define SA sprite[i].ang
#define SV sprite[i].xvel
#define ZV sprite[i].zvel
#define RX sprite[i].xrepeat
#define RY sprite[i].yrepeat
#define OW sprite[i].owner
#define CS sprite[i].cstat
#define SH sprite[i].extra
#define CX sprite[i].xoffset
#define CY sprite[i].yoffset
#define CD sprite[i].clipdist
#define PL sprite[i].pal
#define SLT sprite[i].lotag
#define SHT sprite[i].hitag
#define SECT sprite[i].sectnum
// Defines the motion characteristics of an actor // Defines the motion characteristics of an actor
enum actormotion_flags { enum ActorMoveFlags_t {
face_player = 1, face_player = 1,
geth = 2, geth = 2,
getv = 4, getv = 4,
@ -200,7 +195,7 @@ enum actormotion_flags {
// Defines for 'useractor' keyword // Defines for 'useractor' keyword
enum useractor_types { enum UserActorTypes_t {
notenemy, notenemy,
enemy, enemy,
enemystayput enemystayput
@ -208,7 +203,7 @@ enum useractor_types {
// Player Actions. // Player Actions.
enum player_action_flags { enum PlayerActionFlags_t {
pstanding = 1, pstanding = 1,
pwalking = 2, pwalking = 2,
prunning = 4, prunning = 4,
@ -228,7 +223,7 @@ enum player_action_flags {
pfacing = 65536 pfacing = 65536
}; };
enum inventory_indexes { enum InventoryItem_t {
GET_STEROIDS, GET_STEROIDS,
GET_SHIELD, GET_SHIELD,
GET_SCUBA, GET_SCUBA,
@ -240,9 +235,7 @@ enum inventory_indexes {
GET_BOOTS GET_BOOTS
}; };
#define TRAND krand() enum DukeWeapon_t {
enum weapon_indexes {
KNEE_WEAPON, KNEE_WEAPON,
PISTOL_WEAPON, PISTOL_WEAPON,
SHOTGUN_WEAPON, SHOTGUN_WEAPON,
@ -258,31 +251,8 @@ enum weapon_indexes {
MAX_WEAPONS MAX_WEAPONS
}; };
#define T1 hittype[i].temp_data[0] #define deletesprite A_DeleteSprite
#define T2 hittype[i].temp_data[1] void A_DeleteSprite(int s);
#define T3 hittype[i].temp_data[2]
#define T4 hittype[i].temp_data[3]
#define T5 hittype[i].temp_data[4]
#define T6 hittype[i].temp_data[5]
#define T7 hittype[i].temp_data[6]
#define T8 hittype[i].temp_data[7]
#define T9 hittype[i].temp_data[8]
#define ESCESCAPE if(KB_KeyPressed( sc_Escape ) ) gameexit(" ");
#define IFWITHIN(B,E) if((PN)>=(B) && (PN)<=(E))
#define deletesprite deletesprite_
void deletesprite_(int s);
#define KILLIT(KX) {deletesprite(KX);goto BOLT;}
#define IFMOVING if(ssp(i,CLIPMASK0))
#define IFHIT j=ifhitbyweapon(i);if(j >= 0)
#define AFLAMABLE(X) (X==BOX||X==TREE1||X==TREE2||X==TIRE||X==CONE)
#define rnd(X) ((TRAND>>8)>=(255-(X)))
#define __USRHOOKS_H #define __USRHOOKS_H
@ -326,15 +296,15 @@ typedef struct {
extern animwalltype animwall[MAXANIMWALLS]; extern animwalltype animwall[MAXANIMWALLS];
extern short numanimwalls; extern short g_numAnimWalls;
extern int probey; extern int probey;
extern char typebuflen,typebuf[141]; extern char typebuflen,typebuf[141];
extern char *MusicPtr; extern char *MusicPtr;
extern int Musicsize; extern int Musicsize;
extern int msx[2048],msy[2048]; extern int msx[2048],msy[2048];
extern short cyclers[MAXCYCLERS][6],numcyclers; extern short cyclers[MAXCYCLERS][6],g_numCyclers;
extern char myname[32]; extern char szPlayerName[32];
struct savehead { struct savehead {
char name[19]; char name[19];
@ -446,12 +416,16 @@ typedef struct {
typedef struct { typedef struct {
int ox,oy,oz; int ox,oy,oz;
short oa,os; short oa,os;
} playerspawn_t; } PlayerSpawn_t;
extern char numplayersprites; extern char g_numPlayerSprites;
extern int fricxv,fricyv; extern int fricxv,fricyv;
// TODO: make a dummy player struct for interpolation and sort the first members
// of this struct into the same order so we can just memcpy it and get rid of the
// mywhatever type globals
typedef struct { typedef struct {
int zoom,exitx,exity; int zoom,exitx,exity;
int posx, posy, posz, horiz, ohoriz, ohorizoff, invdisptime; int posx, posy, posz, horiz, ohoriz, ohorizoff, invdisptime;
@ -513,40 +487,38 @@ typedef struct {
char walking_snd_toggle, palookup, hard_landing; char walking_snd_toggle, palookup, hard_landing;
char /*fire_flag,*/pals[3]; char /*fire_flag,*/pals[3];
char return_to_center, reloading, name[32]; char return_to_center, reloading, name[32];
} player_struct; } DukePlayer_t;
extern char tempbuf[2048], packbuf[576], menutextbuf[128]; extern char tempbuf[2048], packbuf[576], menutextbuf[128];
extern int gc; extern int SpriteGravity;
extern int impact_damage,respawnactortime,respawnitemtime; extern int g_impactDamage,g_actorRespawnTime,g_itemRespawnTime;
extern int start_armour_amount; extern int g_startArmorAmount;
#define MOVFIFOSIZ 256 #define MOVFIFOSIZ 256
extern short spriteq[1024],spriteqloc,spriteqamount; extern short SpriteDeletionQueue[1024],g_spriteDeleteQueuePos,g_spriteDeleteQueueSize;
extern user_defs ud; extern user_defs ud;
extern short int moustat; extern short int g_globalRandom;
extern short int global_random;
extern char buf[1024]; //My own generic input buffer extern char buf[1024]; //My own generic input buffer
#define MAXQUOTELEN 128 #define MAXQUOTELEN 128
extern char *fta_quotes[MAXQUOTES],*redefined_quotes[MAXQUOTES]; extern char *ScriptQuotes[MAXQUOTES],*ScriptQuoteRedefinitions[MAXQUOTES];
extern char ready2send; extern char ready2send;
void scriptinfo(void); void X_ScriptInfo(void);
extern intptr_t *script,*scriptptr,*insptr,*labelcode,*labeltype; extern intptr_t *script,*insptr,*labelcode,*labeltype;
extern int labelcnt,defaultlabelcnt; extern int g_numLabels,g_numDefaultLabels;
extern int g_ScriptSize; extern int g_scriptSize;
extern char *label; extern char *label;
extern intptr_t *actorscrptr[MAXTILES],*parsing_actor; extern intptr_t *actorscrptr[MAXTILES],*g_parsingActorPtr;
extern intptr_t *actorLoadEventScrptr[MAXTILES]; extern intptr_t *actorLoadEventScrptr[MAXTILES];
extern char actortype[MAXTILES]; extern char ActorType[MAXTILES];
extern char *music_pointer;
extern char music_select; extern char g_musicIndex;
extern char env_music_fn[MAXVOLUMES+1][BMAX_PATH]; extern char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH];
extern short camsprite; extern short camsprite;
typedef struct { typedef struct {
@ -577,7 +549,7 @@ typedef struct {
projectile_t projectile; projectile_t projectile;
} actordata_t; } actordata_t;
extern actordata_t hittype[MAXSPRITES]; extern actordata_t ActorExtra[MAXSPRITES];
extern input_t loc; extern input_t loc;
extern input_t recsync[RECSYNCBUFSIZ]; extern input_t recsync[RECSYNCBUFSIZ];
@ -587,13 +559,13 @@ extern int numplayers, myconnectindex;
extern int connecthead, connectpoint2[MAXPLAYERS]; //Player linked list variables (indeces, not connection numbers) extern int connecthead, connectpoint2[MAXPLAYERS]; //Player linked list variables (indeces, not connection numbers)
extern int screenpeek; extern int screenpeek;
extern int current_menu; extern int g_currentMenu;
extern int tempwallptr,animatecnt; extern int tempwallptr,g_animateCount;
extern int lockclock; extern int lockclock;
extern intptr_t frameplace; extern intptr_t frameplace;
extern char display_mirror,loadfromgrouponly,rtsplaying; extern char display_mirror,g_loadFromGroupOnly,g_RTSPlaying;
extern int groupfile; extern int g_groupFileHandle;
extern int ototalclock; extern int ototalclock;
extern int *animateptr[MAXANIMATES]; extern int *animateptr[MAXANIMATES];
@ -605,48 +577,48 @@ extern int neartaghitdist;
extern short animatesect[MAXANIMATES]; extern short animatesect[MAXANIMATES];
extern int movefifoplc, vel,svel,angvel,horiz; extern int movefifoplc, vel,svel,angvel,horiz;
extern short mirrorwall[64], mirrorsector[64], mirrorcnt; extern short g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
#include "funct.h" #include "funct.h"
extern int screencapt; extern int g_screenCapture;
extern char volume_names[MAXVOLUMES][33]; extern char EpisodeNames[MAXVOLUMES][33];
extern char skill_names[5][33]; extern char SkillNames[5][33];
extern int framerate; extern int g_currentFrameRate;
#define MAXGAMETYPES 16 #define MAXGAMETYPES 16
extern char gametype_names[MAXGAMETYPES][33]; extern char GametypeNames[MAXGAMETYPES][33];
extern int gametype_flags[MAXGAMETYPES]; extern int GametypeFlags[MAXGAMETYPES];
extern char num_gametypes; extern char g_numGametypes;
enum gametypeflags { enum GametypeFlags_t {
GAMETYPE_FLAG_COOP = 1, GAMETYPE_COOP = 1,
GAMETYPE_FLAG_WEAPSTAY = 2, GAMETYPE_WEAPSTAY = 2,
GAMETYPE_FLAG_FRAGBAR = 4, GAMETYPE_FRAGBAR = 4,
GAMETYPE_FLAG_SCORESHEET = 8, GAMETYPE_SCORESHEET = 8,
GAMETYPE_FLAG_DMSWITCHES = 16, GAMETYPE_DMSWITCHES = 16,
GAMETYPE_FLAG_COOPSPAWN = 32, GAMETYPE_COOPSPAWN = 32,
GAMETYPE_FLAG_ACCESSCARDSPRITES = 64, GAMETYPE_ACCESSCARDSPRITES = 64,
GAMETYPE_FLAG_COOPVIEW = 128, GAMETYPE_COOPVIEW = 128,
GAMETYPE_FLAG_COOPSOUND = 256, GAMETYPE_COOPSOUND = 256,
GAMETYPE_FLAG_OTHERPLAYERSINMAP = 512, GAMETYPE_OTHERPLAYERSINMAP = 512,
GAMETYPE_FLAG_ITEMRESPAWN = 1024, GAMETYPE_ITEMRESPAWN = 1024,
GAMETYPE_FLAG_MARKEROPTION = 2048, GAMETYPE_MARKEROPTION = 2048,
GAMETYPE_FLAG_PLAYERSFRIENDLY = 4096, GAMETYPE_PLAYERSFRIENDLY = 4096,
GAMETYPE_FLAG_FIXEDRESPAWN = 8192, GAMETYPE_FIXEDRESPAWN = 8192,
GAMETYPE_FLAG_ACCESSATSTART = 16384, GAMETYPE_ACCESSATSTART = 16384,
GAMETYPE_FLAG_PRESERVEINVENTORYDEATH = 32768, GAMETYPE_PRESERVEINVENTORYDEATH = 32768,
GAMETYPE_FLAG_TDM = 65536, GAMETYPE_TDM = 65536,
GAMETYPE_FLAG_TDMSPAWN = 131072 GAMETYPE_TDMSPAWN = 131072
}; };
#define GTFLAGS(x) (gametype_flags[ud.coop] & x) #define GTFLAGS(x) (GametypeFlags[ud.coop] & x)
extern char num_volumes; extern char g_numVolumes;
extern int lastsavedpos; extern int g_lastSaveSlot;
extern int restorepalette; extern int g_restorePalette;
#ifndef RANCID_NETWORKING #ifndef RANCID_NETWORKING
extern int packetrate; extern int packetrate;
#endif #endif
@ -654,21 +626,22 @@ extern int packetrate;
extern int cachecount; extern int cachecount;
extern char boardfilename[BMAX_PATH],waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768],animpal[768]; extern char boardfilename[BMAX_PATH],waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768],animpal[768];
extern char currentboardfilename[BMAX_PATH]; extern char currentboardfilename[BMAX_PATH];
extern char cachedebug,earthquaketime; extern char cachedebug,g_earthquakeTime;
extern int networkmode; // 0: master/slave, 1: peer-to-peer
extern int g_networkBroadcastMode;
extern char lumplockbyte[11]; extern char lumplockbyte[11];
//DUKE3D.H - replace the end "my's" with this //DUKE3D.H - replace the end "my's" with this
extern int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel; extern int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
extern short myhoriz, omyhoriz, myhorizoff, omyhorizoff, globalskillsound; extern short myhoriz, omyhoriz, myhorizoff, omyhorizoff, g_skillSoundID;
extern short myang, omyang, mycursectnum, myjumpingcounter; extern short myang, omyang, mycursectnum, myjumpingcounter;
extern char myjumpingtoggle, myonground, myhardlanding,myreturntocenter; extern char myjumpingtoggle, myonground, myhardlanding,myreturntocenter;
extern int fakemovefifoplc; extern int predictfifoplc;
extern int myxbak[MOVEFIFOSIZ], myybak[MOVEFIFOSIZ], myzbak[MOVEFIFOSIZ]; extern int myxbak[MOVEFIFOSIZ], myybak[MOVEFIFOSIZ], myzbak[MOVEFIFOSIZ];
extern int myhorizbak[MOVEFIFOSIZ]; extern int myhorizbak[MOVEFIFOSIZ];
extern short myangbak[MOVEFIFOSIZ]; extern short myangbak[MOVEFIFOSIZ];
extern short weaponsandammosprites[15]; extern short BlimpSpawnSprites[15];
//DUKE3D.H: //DUKE3D.H:
typedef struct { typedef struct {
@ -681,12 +654,12 @@ typedef struct {
} STATUSBARTYPE; } STATUSBARTYPE;
extern STATUSBARTYPE sbar; extern STATUSBARTYPE sbar;
extern int cameradist, cameraclock, dukefriction,show_shareware; extern int g_cameraDistance, g_cameraClock, g_playerFriction,g_showShareware;
extern int networkmode, movesperpacket; extern int g_networkBroadcastMode, g_movesPerPacket;
extern int gamequit; extern int g_gameQuit;
extern char pus,pub; extern char pus,pub;
extern int camerashitable,freezerhurtowner,lasermode; extern int g_damageCameras,g_freezerSelfDamage,g_tripbombLaserMode;
// TENSW: on really bad network connections, the sync FIFO queue can overflow if it is the // TENSW: on really bad network connections, the sync FIFO queue can overflow if it is the
// same size as the move fifo. // same size as the move fifo.
@ -696,23 +669,24 @@ extern int camerashitable,freezerhurtowner,lasermode;
extern char syncstat[MAXSYNCBYTES]; extern char syncstat[MAXSYNCBYTES];
extern signed char multiwho, multipos, multiwhat, multiflag; extern signed char multiwho, multipos, multiwhat, multiflag;
extern int syncvaltail, syncvaltottail; extern int syncvaltail, syncvaltottail;
extern int numfreezebounces,rpgblastradius,pipebombblastradius,tripbombblastradius,shrinkerblastradius,morterblastradius,bouncemineblastradius,seenineblastradius; extern int g_numFreezeBounces,g_rpgBlastRadius,g_pipebombBlastRadius,g_tripbombBlastRadius;
extern int g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius;
extern int everyothertime; extern int everyothertime;
extern int mymaxlag, otherminlag, bufferjitter; extern int mymaxlag, otherminlag, bufferjitter;
extern int numinterpolations, startofdynamicinterpolations; extern int g_numInterpolations, startofdynamicinterpolations;
extern int oldipos[MAXINTERPOLATIONS]; extern int oldipos[MAXINTERPOLATIONS];
extern int bakipos[MAXINTERPOLATIONS]; extern int bakipos[MAXINTERPOLATIONS];
extern int *curipos[MAXINTERPOLATIONS]; extern int *curipos[MAXINTERPOLATIONS];
extern short numclouds,clouds[128],cloudx[128],cloudy[128]; extern short g_numClouds,clouds[128],cloudx[128],cloudy[128];
extern int cloudtotalclock,totalmemory; extern int cloudtotalclock,totalmemory;
extern int stereomode, stereowidth, stereopixelwidth; extern int stereomode, stereowidth, stereopixelwidth;
extern int myaimmode, myaimstat, omyaimstat; extern int g_myAimMode, g_myAimStat, g_oldAimStat;
extern unsigned int MoveThingsCount; extern unsigned int g_moveThingsCount;
#define IFISGLMODE if (getrendermode() >= 3) #define IFISGLMODE if (getrendermode() >= 3)
#define IFISSOFTMODE if (getrendermode() < 3) #define IFISSOFTMODE if (getrendermode() < 3)
@ -723,7 +697,7 @@ extern unsigned int MoveThingsCount;
#define TILE_ANIM (MAXTILES-4) #define TILE_ANIM (MAXTILES-4)
#define TILE_VIEWSCR (MAXTILES-5) #define TILE_VIEWSCR (MAXTILES-5)
enum events { enum GameEvent_t {
EVENT_INIT, EVENT_INIT,
EVENT_ENTERLEVEL, EVENT_ENTERLEVEL,
EVENT_RESETWEAPONS, EVENT_RESETWEAPONS,
@ -815,7 +789,7 @@ enum events {
MAXEVENTS MAXEVENTS
}; };
enum sysstrs { enum SystemString_t {
STR_MAPNAME, STR_MAPNAME,
STR_MAPFILENAME, STR_MAPFILENAME,
STR_PLAYERNAME, STR_PLAYERNAME,
@ -827,30 +801,30 @@ enum sysstrs {
enum gamevarflags { enum GamevarFlags_t {
MAXGAMEVARS = 2048, // must be a power of two MAXGAMEVARS = 2048, // must be a power of two
MAXVARLABEL = 26, MAXVARLABEL = 26,
GAMEVAR_FLAG_NORMAL = 0, // normal GAMEVAR_NORMAL = 0, // normal
GAMEVAR_FLAG_PERPLAYER = 1, // per-player variable GAMEVAR_PERPLAYER = 1, // per-player variable
GAMEVAR_FLAG_PERACTOR = 2, // per-actor variable GAMEVAR_PERACTOR = 2, // per-actor variable
GAMEVAR_FLAG_USER_MASK = 3, GAMEVAR_USER_MASK = 3,
GAMEVAR_FLAG_DEFAULT = 256, // allow override GAMEVAR_DEFAULT = 256, // allow override
GAMEVAR_FLAG_SECRET = 512, // don't dump... GAMEVAR_SECRET = 512, // don't dump...
GAMEVAR_FLAG_NODEFAULT = 1024, // don't reset on actor spawn GAMEVAR_NODEFAULT = 1024, // don't reset on actor spawn
GAMEVAR_FLAG_SYSTEM = 2048, // cannot change mode flags...(only default value) GAMEVAR_SYSTEM = 2048, // cannot change mode flags...(only default value)
GAMEVAR_FLAG_READONLY = 4096, // values are read-only (no setvar allowed) GAMEVAR_READONLY = 4096, // values are read-only (no setvar allowed)
GAMEVAR_FLAG_INTPTR = 8192, // plValue is a pointer to an int GAMEVAR_INTPTR = 8192, // plValue is a pointer to an int
GAMEVAR_FLAG_SYNCCHECK = 16384, // check event sync when translating GAMEVAR_SYNCCHECK = 16384, // check event sync when translating
GAMEVAR_FLAG_SHORTPTR = 32768, // plValue is a pointer to a short GAMEVAR_SHORTPTR = 32768, // plValue is a pointer to a short
GAMEVAR_FLAG_CHARPTR = 65536, // plValue is a pointer to a char GAMEVAR_CHARPTR = 65536, // plValue is a pointer to a char
GAMEVAR_FLAG_NORESET = 131072, // var values are not reset when restoring map state GAMEVAR_NORESET = 131072, // var values are not reset when restoring map state
}; };
enum gamearrayflags { enum GamearrayFlags_t {
MAXGAMEARRAYS = (MAXGAMEVARS>>2), // must be lower than MAXGAMEVARS MAXGAMEARRAYS = (MAXGAMEVARS>>2), // must be lower than MAXGAMEVARS
MAXARRAYLABEL = MAXVARLABEL, MAXARRAYLABEL = MAXVARLABEL,
GAMEARRAY_FLAG_NORMAL = 0, GAMEARRAY_NORMAL = 0,
GAMEARRAY_FLAG_NORESET = 1, GAMEARRAY_NORESET = 1,
}; };
typedef struct { typedef struct {
@ -871,22 +845,22 @@ typedef struct {
extern gamevar_t aGameVars[MAXGAMEVARS]; extern gamevar_t aGameVars[MAXGAMEVARS];
extern gamearray_t aGameArrays[MAXGAMEARRAYS]; extern gamearray_t aGameArrays[MAXGAMEARRAYS];
extern int iGameVarCount; extern int g_gameVarCount;
extern int iGameArrayCount; extern int g_gameArrayCount;
extern int spriteflags[MAXTILES]; extern int SpriteFlags[MAXTILES];
enum spriteflags { enum SpriteFlags_t {
SPRITE_FLAG_SHADOW = 1, SPRITE_SHADOW = 1,
SPRITE_FLAG_NVG = 2, SPRITE_NVG = 2,
SPRITE_FLAG_NOSHADE = 4, SPRITE_NOSHADE = 4,
SPRITE_FLAG_PROJECTILE = 8, SPRITE_PROJECTILE = 8,
SPRITE_FLAG_DECAL = 16, SPRITE_DECAL = 16,
SPRITE_FLAG_BADGUY = 32, SPRITE_BADGUY = 32,
SPRITE_FLAG_NOPAL = 64 SPRITE_NOPAL = 64
}; };
extern short spritecache[MAXTILES][3]; extern short SpriteCacheList[MAXTILES][3];
extern int g_iReturnVarID; extern int g_iReturnVarID;
extern int g_iWeaponVarID; extern int g_iWeaponVarID;
@ -922,28 +896,29 @@ extern intptr_t *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time
extern intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID extern intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID
extern intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed extern intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed
extern intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted extern intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted
extern intptr_t *aplWeaponSelectSound[MAX_WEAPONS]; // Sound for weapon selection
extern short timer; extern short g_timerTicsPerSecond;
enum weaponflags { enum WeaponFlags_t {
WEAPON_FLAG_HOLSTER_CLEARS_CLIP = 1, // 'holstering' clears the current clip WEAPON_HOLSTER_CLEARS_CLIP = 1, // 'holstering' clears the current clip
WEAPON_FLAG_GLOWS = 2, // weapon 'glows' (shrinker and grower) WEAPON_GLOWS = 2, // weapon 'glows' (shrinker and grower)
WEAPON_FLAG_AUTOMATIC = 4, // automatic fire (continues while 'fire' is held down WEAPON_AUTOMATIC = 4, // automatic fire (continues while 'fire' is held down
WEAPON_FLAG_FIREEVERYOTHER = 8, // during 'hold time' fire every frame WEAPON_FIREEVERYOTHER = 8, // during 'hold time' fire every frame
WEAPON_FLAG_FIREEVERYTHIRD = 16, // during 'hold time' fire every third frame WEAPON_FIREEVERYTHIRD = 16, // during 'hold time' fire every third frame
WEAPON_FLAG_RANDOMRESTART = 32, // restart for automatic is 'randomized' by RND 3 WEAPON_RANDOMRESTART = 32, // restart for automatic is 'randomized' by RND 3
WEAPON_FLAG_AMMOPERSHOT = 64, // uses ammo for each shot (for automatic) WEAPON_AMMOPERSHOT = 64, // uses ammo for each shot (for automatic)
WEAPON_FLAG_BOMB_TRIGGER = 128, // weapon is the 'bomb' trigger WEAPON_BOMB_TRIGGER = 128, // weapon is the 'bomb' trigger
WEAPON_FLAG_NOVISIBLE = 256, // weapon use does not cause user to become 'visible' WEAPON_NOVISIBLE = 256, // weapon use does not cause user to become 'visible'
WEAPON_FLAG_THROWIT = 512, // weapon 'throws' the 'shoots' item... WEAPON_THROWIT = 512, // weapon 'throws' the 'shoots' item...
WEAPON_FLAG_CHECKATRELOAD = 1024, // check weapon availability at 'reload' time WEAPON_CHECKATRELOAD = 1024, // check weapon availability at 'reload' time
WEAPON_FLAG_STANDSTILL = 2048, // player stops jumping before actual fire (like tripbomb in duke) WEAPON_STANDSTILL = 2048, // player stops jumping before actual fire (like tripbomb in duke)
WEAPON_FLAG_SPAWNTYPE1 = 0, // just spawn WEAPON_SPAWNTYPE1 = 0, // just spawn
WEAPON_FLAG_SPAWNTYPE2 = 4096, // spawn like shotgun shells WEAPON_SPAWNTYPE2 = 4096, // spawn like shotgun shells
WEAPON_FLAG_SPAWNTYPE3 = 8192, // spawn like chaingun shells WEAPON_SPAWNTYPE3 = 8192, // spawn like chaingun shells
WEAPON_FLAG_SEMIAUTO = 16384, // cancel button press after each shot WEAPON_SEMIAUTO = 16384, // cancel button press after each shot
WEAPON_FLAG_RELOAD_TIMING = 32768, // special casing for pistol reload sounds WEAPON_RELOAD_TIMING = 32768, // special casing for pistol reload sounds
WEAPON_FLAG_RESET = 65536 // cycle weapon back to frame 1 if fire is held, 0 if not WEAPON_RESET = 65536 // cycle weapon back to frame 1 if fire is held, 0 if not
}; };
#define TRIPBOMB_TRIPWIRE 1 #define TRIPBOMB_TRIPWIRE 1
@ -954,57 +929,57 @@ enum weaponflags {
// custom projectiles // custom projectiles
enum projectileflags { enum ProjectileFlags_t {
PROJECTILE_FLAG_HITSCAN = 1, PROJECTILE_HITSCAN = 1,
PROJECTILE_FLAG_RPG = 2, PROJECTILE_RPG = 2,
PROJECTILE_FLAG_BOUNCESOFFWALLS = 4, PROJECTILE_BOUNCESOFFWALLS = 4,
PROJECTILE_FLAG_BOUNCESOFFMIRRORS = 8, PROJECTILE_BOUNCESOFFMIRRORS = 8,
PROJECTILE_FLAG_KNEE = 16, PROJECTILE_KNEE = 16,
PROJECTILE_FLAG_WATERBUBBLES = 32, PROJECTILE_WATERBUBBLES = 32,
PROJECTILE_FLAG_TIMED = 64, PROJECTILE_TIMED = 64,
PROJECTILE_FLAG_BOUNCESOFFSPRITES = 128, PROJECTILE_BOUNCESOFFSPRITES = 128,
PROJECTILE_FLAG_SPIT = 256, PROJECTILE_SPIT = 256,
PROJECTILE_FLAG_COOLEXPLOSION1 = 512, PROJECTILE_COOLEXPLOSION1 = 512,
PROJECTILE_FLAG_BLOOD = 1024, PROJECTILE_BLOOD = 1024,
PROJECTILE_FLAG_LOSESVELOCITY = 2048, PROJECTILE_LOSESVELOCITY = 2048,
PROJECTILE_FLAG_NOAIM = 4096, PROJECTILE_NOAIM = 4096,
PROJECTILE_FLAG_RANDDECALSIZE = 8192, PROJECTILE_RANDDECALSIZE = 8192,
PROJECTILE_FLAG_EXPLODEONTIMER = 16384, PROJECTILE_EXPLODEONTIMER = 16384,
PROJECTILE_FLAG_RPG_IMPACT = 32768, PROJECTILE_RPG_IMPACT = 32768,
PROJECTILE_FLAG_RADIUS_PICNUM = 65536, PROJECTILE_RADIUS_PICNUM = 65536,
PROJECTILE_FLAG_ACCURATE_AUTOAIM = 131072, PROJECTILE_ACCURATE_AUTOAIM = 131072,
PROJECTILE_FLAG_FORCEIMPACT = 262144 PROJECTILE_FORCEIMPACT = 262144
}; };
extern projectile_t projectile[MAXTILES], defaultprojectile[MAXTILES]; extern projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES];
// logo control // logo control
enum logoflags { enum LogoFlags_t {
LOGO_FLAG_ENABLED = 1, LOGO_ENABLED = 1,
LOGO_FLAG_PLAYANIM = 2, LOGO_PLAYANIM = 2,
LOGO_FLAG_PLAYMUSIC = 4, LOGO_PLAYMUSIC = 4,
LOGO_FLAG_3DRSCREEN = 8, LOGO_3DRSCREEN = 8,
LOGO_FLAG_TITLESCREEN = 16, LOGO_TITLESCREEN = 16,
LOGO_FLAG_DUKENUKEM = 32, LOGO_DUKENUKEM = 32,
LOGO_FLAG_THREEDEE = 64, LOGO_THREEDEE = 64,
LOGO_FLAG_PLUTOPAKSPRITE = 128, LOGO_PLUTOPAKSPRITE = 128,
LOGO_FLAG_SHAREWARESCREENS = 256, LOGO_SHAREWARESCREENS = 256,
LOGO_FLAG_TENSCREEN = 512 LOGO_TENSCREEN = 512
}; };
extern int g_NumPalettes; extern int g_numPalettes;
extern int g_ScriptDebug; extern int g_scriptDebug;
#define MAXCHEATLEN 20 #define MAXCHEATLEN 20
#define NUMCHEATCODES (signed int)(sizeof(cheatstrings)/sizeof(cheatstrings[0])) #define NUMCHEATCODES (signed int)(sizeof(CheatStrings)/sizeof(CheatStrings[0]))
extern char cheatkey[2]; extern char CheatKeys[2];
extern char cheatstrings[][MAXCHEATLEN]; extern char CheatStrings[][MAXCHEATLEN];
extern short weapon_sprites[MAX_WEAPONS]; extern short WeaponPickupSprites[MAX_WEAPONS];
extern int redefined_quote_count; extern int g_numQuoteRedefinitions;
extern char setupfilename[BMAX_PATH]; extern char setupfilename[BMAX_PATH];
@ -1023,26 +998,26 @@ typedef struct {
short headspritestat[MAXSTATUS+1]; short headspritestat[MAXSTATUS+1];
short prevspritestat[MAXSPRITES]; short prevspritestat[MAXSPRITES];
short nextspritestat[MAXSPRITES]; short nextspritestat[MAXSPRITES];
short numcyclers; short g_numCyclers;
short cyclers[MAXCYCLERS][6]; short cyclers[MAXCYCLERS][6];
playerspawn_t g_PlayerSpawnPoints[MAXPLAYERS]; PlayerSpawn_t g_playerSpawnPoints[MAXPLAYERS];
short numanimwalls; short g_numAnimWalls;
short spriteq[1024],spriteqloc; short SpriteDeletionQueue[1024],g_spriteDeleteQueuePos;
animwalltype animwall[MAXANIMWALLS]; animwalltype animwall[MAXANIMWALLS];
int msx[2048], msy[2048]; int msx[2048], msy[2048];
short mirrorwall[64], mirrorsector[64], mirrorcnt; short g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
char show2dsector[(MAXSECTORS+7)>>3]; char show2dsector[(MAXSECTORS+7)>>3];
short numclouds,clouds[128],cloudx[128],cloudy[128]; short g_numClouds,clouds[128],cloudx[128],cloudy[128];
actordata_t hittype[MAXSPRITES]; actordata_t ActorExtra[MAXSPRITES];
short pskyoff[MAXPSKYTILES], pskybits; short pskyoff[MAXPSKYTILES], pskybits;
int animategoal[MAXANIMATES], animatevel[MAXANIMATES], animatecnt; int animategoal[MAXANIMATES], animatevel[MAXANIMATES], g_animateCount;
short animatesect[MAXANIMATES]; short animatesect[MAXANIMATES];
int animateptr[MAXANIMATES]; int animateptr[MAXANIMATES];
char numplayersprites; char g_numPlayerSprites;
char earthquaketime; char g_earthquakeTime;
int lockclock; int lockclock;
int randomseed, global_random; int randomseed, g_globalRandom;
char scriptptrs[MAXSPRITES]; char scriptptrs[MAXSPRITES];
intptr_t *vars[MAXGAMEVARS]; intptr_t *vars[MAXGAMEVARS];
} mapstate_t; } mapstate_t;
@ -1053,10 +1028,10 @@ typedef struct {
mapstate_t *savedstate; mapstate_t *savedstate;
} map_t; } map_t;
extern map_t map[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music extern map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
typedef struct { typedef struct {
player_struct *ps; DukePlayer_t *ps;
input_t *sync; input_t *sync;
int32 movefifoend, syncvalhead, myminlag; int32 movefifoend, syncvalhead, myminlag;
@ -1068,7 +1043,7 @@ typedef struct {
} playerdata_t; } playerdata_t;
extern input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; extern input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
extern playerspawn_t g_PlayerSpawnPoints[MAXPLAYERS]; extern PlayerSpawn_t g_playerSpawnPoints[MAXPLAYERS];
extern playerdata_t g_player[MAXPLAYERS]; extern playerdata_t g_player[MAXPLAYERS];
#include "funct.h" #include "funct.h"
@ -1089,6 +1064,37 @@ extern struct HASH_table arrayH;
extern struct HASH_table keywH; extern struct HASH_table keywH;
extern struct HASH_table gamefuncH; extern struct HASH_table gamefuncH;
enum DukePacket_t
{
PACKET_TYPE_MASTER_TO_SLAVE,
PACKET_TYPE_SLAVE_TO_MASTER,
PACKET_TYPE_BROADCAST,
SERVER_GENERATED_BROADCAST,
PACKET_TYPE_VERSION,
/* don't change anything above this line */
PACKET_TYPE_MESSAGE,
PACKET_TYPE_NEW_GAME,
PACKET_TYPE_RTS,
PACKET_TYPE_MENU_LEVEL_QUIT,
PACKET_TYPE_WEAPON_CHOICE,
PACKET_TYPE_PLAYER_OPTIONS,
PACKET_TYPE_PLAYER_NAME,
PACKET_TYPE_USER_MAP,
PACKET_TYPE_MAP_VOTE,
PACKET_TYPE_MAP_VOTE_INITIATE,
PACKET_TYPE_MAP_VOTE_CANCEL,
PACKET_TYPE_LOAD_GAME,
PACKET_TYPE_NULL_PACKET,
PACKET_TYPE_PLAYER_READY,
PACKET_TYPE_QUIT = 255 // should match mmulti I think
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -26,50 +26,50 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __funct_h__ #define __funct_h__
extern void sendscore(const char *s); extern void sendscore(const char *s);
extern void SoundStartup(void); extern void S_SoundStartup(void);
extern void SoundShutdown(void); extern void S_SoundShutdown(void);
extern void MusicStartup(void); extern void S_MusicStartup(void);
extern void MusicShutdown(void); extern void S_MusicShutdown(void);
extern void intomenusounds(void); extern void S_MenuSound(void);
extern int playmusic(const char *fn, const int sel); extern int S_PlayMusic(const char *fn, const int sel);
extern int loadsound(unsigned num); extern int S_LoadSound(unsigned num);
extern int xyzsound(int num,int i,int x,int y,int z); extern int S_PlaySoundXYZ(int num,int i,int x,int y,int z);
extern void sound(int num); extern void S_PlaySound(int num);
extern int spritesound(unsigned int num,int i); extern int A_PlaySound(unsigned int num,int i);
extern void stopsound(int num); extern void S_StopSound(int num);
extern void stopenvsound(int num,int i); extern void S_StopEnvSound(int num,int i);
extern void pan3dsound(void); extern void pan3dsound(void);
extern void testcallback(unsigned int num); extern void S_TestSoundCallback(unsigned int num);
extern void clearsoundlocks(void); extern void S_ClearSoundLocks(void);
extern int callsound(int sn,int whatsprite); extern int A_CallSound(int sn,int whatsprite);
extern int check_activator_motion(int lotag); extern int check_activator_motion(int lotag);
extern int isadoorwall(int dapic); extern int CheckDoorTile(int dapic);
extern int isanunderoperator(int lotag); extern int isanunderoperator(int lotag);
extern int isanearoperator(int lotag); extern int isanearoperator(int lotag);
extern inline int checkcursectnums(int sect); extern inline int CheckPlayerInSector(int sect);
extern int ldist(spritetype *s1,spritetype *s2); extern int ldist(spritetype *s1,spritetype *s2);
extern int dist(spritetype *s1,spritetype *s2); extern int dist(spritetype *s1,spritetype *s2);
extern int findplayer(spritetype *s,int *d); extern int A_FindPlayer(spritetype *s,int *d);
extern int findotherplayer(int p,int *d); extern int P_FindOtherPlayer(int p,int *d);
extern void doanimations(void); extern void G_DoSectorAnimations(void);
extern int getanimationgoal(int *animptr); extern int GetAnimationGoal(int *animptr);
extern int setanimation(int animsect,int *animptr,int thegoal,int thevel); extern int SetAnimation(int animsect,int *animptr,int thegoal,int thevel);
extern void animatecamsprite(void); extern void G_AnimateCamSprite(void);
extern void animatewalls(void); extern void G_AnimateWalls(void);
extern int activatewarpelevators(int s,int d); extern int G_ActivateWarpElevators(int s,int d);
extern void operatesectors(int sn,int ii); extern void G_OperateSectors(int sn,int ii);
extern void operaterespawns(int low); extern void G_OperateRespawns(int low);
extern void operateactivators(int low,int snum); extern void G_OperateActivators(int low,int snum);
extern void operatemasterswitches(int low); extern void G_OperateMasterSwitches(int low);
extern void operateforcefields(int s,int low); extern void G_OperateForceFields(int s,int low);
extern int checkhitswitch(int snum,int w,int switchtype); extern int P_ActivateSwitch(int snum,int w,int switchtype);
extern void activatebysector(int sect,int j); extern void activatebysector(int sect,int j);
extern void checkhitwall(int spr,int dawallnum,int x,int y,int z,int atwith); extern void A_DamageWall(int spr,int dawallnum,int x,int y,int z,int atwith);
extern void checkplayerhurt(player_struct *p,int j); extern void P_CheckTouchDamage(DukePlayer_t *p,int j);
extern int checkhitceiling(int sn); extern int Sect_DamageCeiling(int sn);
extern void checkhitsprite(int i,int sn); extern void A_DamageObject(int i,int sn);
extern void allignwarpelevators(void); extern void allignwarpelevators(void);
extern void sharedkeys(int snum); extern void G_HandleSharedKeys(int snum);
extern void checksectors(int snum); extern void checksectors(int snum);
extern int32 RTS_AddFile(const char *filename); extern int32 RTS_AddFile(const char *filename);
extern void RTS_Init(const char *filename); extern void RTS_Init(const char *filename);
@ -78,76 +78,75 @@ extern int32 RTS_SoundLength(int32 lump);
extern const char *RTS_GetSoundName(int32 i); extern const char *RTS_GetSoundName(int32 i);
extern void RTS_ReadLump(int32 lump,void *dest); extern void RTS_ReadLump(int32 lump,void *dest);
extern void *RTS_GetSound(int32 lump); extern void *RTS_GetSound(int32 lump);
extern void docacheit(void); extern void G_CacheMapData(void);
extern void xyzmirror(int i,int wn); extern void xyzmirror(int i,int wn);
extern void vscrn(void); extern void G_UpdateScreenArea(void);
extern void pickrandomspot(int snum); extern void P_RandomSpawnPoint(int snum);
extern void resetweapons(int snum); extern void P_ResetWeapons(int snum);
extern void resetinventory(int snum); extern void P_ResetInventory(int snum);
extern void newgame(int vn,int ln,int sk); extern void G_NewGame(int vn,int ln,int sk);
extern void resettimevars(void); extern void G_ResetTimers(void);
extern void waitforeverybody(void); extern void waitforeverybody(void);
extern void cacheit(void);
extern void clearfifo(void); extern void clearfifo(void);
extern void resetmys(void); extern void Net_ResetPrediction(void);
extern int enterlevel(int g); extern int G_EnterLevel(int g);
extern void backtomenu(void); extern void G_BackToMenu(void);
extern void setpal(player_struct *p); extern void P_UpdateScreenPal(DukePlayer_t *p);
extern void quickkill(player_struct *p); extern void P_QuickKill(DukePlayer_t *p);
extern int hits(int i); extern int A_GetHitscanRange(int i);
extern int hitasprite(int i,short *hitsp); extern int A_CheckHitSprite(int i,short *hitsp);
extern int shoot(int i,int atwith); extern int A_Shoot(int i,int atwith);
extern void displaymasks(int snum); extern void P_DisplayScubaMask(int snum);
extern void displayweapon(int snum); extern void P_DisplayWeapons(int snum);
extern void getinput(int snum); extern void getinput(int snum);
extern void checkweapons(player_struct *p); extern void P_DropWeapon(DukePlayer_t *p);
extern void processinput(int snum); extern void P_ProcessInput(int snum);
extern void cmenu(int cm); extern void ChangeToMenu(int cm);
extern void savetemp(const char *fn,int daptr,int dasiz); // extern void savetemp(const char *fn,int daptr,int dasiz);
// extern int loadpheader(char spot,int32 *vn,int32 *ln,int32 *psk,int32 *numplr); // extern int G_LoadSaveHeader(char spot,int32 *vn,int32 *ln,int32 *psk,int32 *numplr);
extern int loadplayer(int spot); extern int G_LoadPlayer(int spot);
extern int saveplayer(int spot); extern int G_SavePlayer(int spot);
extern int menutext_(int x,int y,int s,int p,char *t,int bits); extern int menutext_(int x,int y,int s,int p,char *t,int bits);
#define menutext(x,y,s,p,t) menutext_(x,y,s,p,(char *)stripcolorcodes(menutextbuf,t),10+16) #define menutext(x,y,s,p,t) menutext_(x,y,s,p,(char *)stripcolorcodes(menutextbuf,t),10+16)
extern void menus(void); extern void M_DisplayMenus(void);
extern void palto(int r,int g,int b,int e); extern void G_FadePalette(int r,int g,int b,int e);
extern void playanm(const char *fn,char); extern void G_PlayAnim(const char *fn,char);
extern int getincangle(int a,int na); extern int G_GetAngleDelta(int a,int na);
extern void getglobalz(int iActor); extern void A_GetZLimits(int iActor);
extern void makeitfall(int iActor); extern void A_Fall(int iActor);
extern void loadefs(const char *fn); extern void C_Compile(const char *fn);
extern int furthestangle(int iActor,int angs); extern int A_GetFurthestAngle(int iActor,int angs);
extern void execute(int iActor,int iPlayer,int lDist); extern void A_Execute(int iActor,int iPlayer,int lDist);
extern void overwritesprite(int thex,int they,int tilenum,int shade,int stat,int dapalnum); extern void overwritesprite(int thex,int they,int tilenum,int shade,int stat,int dapalnum);
extern void gamenumber(int x,int y,int n,int s); extern void gamenumber(int x,int y,int n,int s);
extern void Shutdown(void); extern void G_Shutdown(void);
extern void getpackets(void); extern void getpackets(void);
extern void check_fta_sounds(int i); extern void A_PlayAlertSound(int i);
extern inline int inventory(spritetype *s); extern inline int A_CheckInventorySprite(spritetype *s);
extern inline int badguy(spritetype *s); extern inline int A_CheckEnemySprite(spritetype *s);
extern int badguypic(int pn); extern int A_CheckEnemyTile(int pn);
extern void myos(int x,int y,int tilenum,int shade,int orientation); extern void G_DrawTile(int x,int y,int tilenum,int shade,int orientation);
extern void myospal(int x,int y,int tilenum,int shade,int orientation,int p); extern void G_DrawTilePal(int x,int y,int tilenum,int shade,int orientation,int p);
extern void displayfragbar(void); extern void G_DrawFrags(void);
extern void FTA(int q,player_struct *p); extern void P_DoQuote(int q,DukePlayer_t *p);
extern void gameexit(const char *t); extern void G_GameExit(const char *t);
extern inline int strget(int x,int y,char *t,int dalen,int c); extern inline int G_EnterText(int x,int y,char *t,int dalen,int c);
extern void displayrest(int smoothratio); extern void G_DisplayRest(int smoothratio);
extern void updatesectorz(int x,int y,int z,short *sectnum); extern void updatesectorz(int x,int y,int z,short *sectnum);
extern void drawbackground(void); extern void G_DrawBackground(void);
extern void displayrooms(int snum,int smoothratio); extern void G_DrawRooms(int snum,int smoothratio);
extern int EGS(int whatsect,int s_x,int s_y,int s_z,int s_pn,int s_s,int s_xr,int s_yr,int s_a,int s_ve,int s_zv,int s_ow,int s_ss); extern int A_InsertSprite(int whatsect,int s_x,int s_y,int s_z,int s_pn,int s_s,int s_xr,int s_yr,int s_a,int s_ve,int s_zv,int s_ow,int s_ss);
extern int wallswitchcheck(int i); extern int A_CheckSwitchTile(int i);
extern int spawn(int j,int pn); extern int A_Spawn(int j,int pn);
extern void animatesprites(int x,int y,int a,int smoothratio); extern void G_DoSpriteAnimations(int x,int y,int a,int smoothratio);
extern int main(int argc,char **argv); extern int main(int argc,char **argv);
extern void opendemowrite(void); extern void G_OpenDemoWrite(void);
extern void closedemowrite(void); extern void G_CloseDemoWrite(void);
extern void dobonus(int bonusonly); extern void G_BonusScreen(int bonusonly);
extern void lotsofglass(int i,int wallnum,int n); extern void A_SpawnWallGlass(int i,int wallnum,int n);
extern void spriteglass(int i,int n); extern void A_SpawnGlass(int i,int n);
extern void ceilingglass(int i,int sectnum,int n); extern void A_SpawnCeilingGlass(int i,int sectnum,int n);
extern void lotsofcolourglass(int i,int wallnum,int n); extern void A_SpawnRandomGlass(int i,int wallnum,int n);
extern inline int GetTime(void); extern inline int GetTime(void);
extern void CONFIG_GetSetupFilename(void); extern void CONFIG_GetSetupFilename(void);
extern int32 CONFIG_FunctionNameToNum(char *func); extern int32 CONFIG_FunctionNameToNum(char *func);
@ -156,46 +155,46 @@ extern int32 CONFIG_AnalogNameToNum(char *func);
extern char *CONFIG_AnalogNumToName(int32 func); extern char *CONFIG_AnalogNumToName(int32 func);
extern void CONFIG_SetDefaults(void); extern void CONFIG_SetDefaults(void);
extern void CONFIG_ReadKeys(void); extern void CONFIG_ReadKeys(void);
extern void readsavenames(void); extern void ReadSaveGameHeaders(void);
extern int32 CONFIG_ReadSetup(void); extern int32 CONFIG_ReadSetup(void);
extern void CONFIG_WriteSetup(void); extern void CONFIG_WriteSetup(void);
extern inline void updateinterpolations(void); extern inline void G_UpdateInterpolations(void);
extern void setinterpolation(int *posptr); extern void G_SetInterpolation(int *posptr);
extern void stopinterpolation(int *posptr); extern void G_StopInterpolation(int *posptr);
extern void dointerpolations(int smoothratio); extern void G_DoInterpolations(int smoothratio);
extern inline void restoreinterpolations(void); extern inline void G_RestoreInterpolations(void);
extern inline int ceilingspace(int sectnum); extern inline int G_CheckForSpaceCeiling(int sectnum);
extern inline int floorspace(int sectnum); extern inline int G_CheckForSpaceFloor(int sectnum);
extern void addammo(int weapon,player_struct *p,int amount); extern void P_AddAmmo(int weapon,DukePlayer_t *p,int amount);
extern void addweaponnoswitch(player_struct *p,int weapon); extern void P_AddWeaponNoSwitch(DukePlayer_t *p,int weapon);
extern void addweapon(player_struct *p,int weapon); extern void P_AddWeapon(DukePlayer_t *p,int weapon);
extern void checkavailinven(player_struct *p); extern void P_SelectNextInventoryItem(DukePlayer_t *p);
extern void checkavailweapon(player_struct *p); extern void P_CheckWeapon(DukePlayer_t *p);
extern void hitradius(int i,int r,int hp1,int hp2,int hp3,int hp4); extern void A_RadiusDamage(int i,int r,int hp1,int hp2,int hp3,int hp4);
extern int movesprite(int spritenum,int xchange,int ychange,int zchange,unsigned int cliptype); extern int A_MoveSprite(int spritenum,int xchange,int ychange,int zchange,unsigned int cliptype);
extern inline int ssp(int i,unsigned int cliptype); extern inline int A_SetSprite(int i,unsigned int cliptype);
extern void insertspriteq(int i); extern void A_AddToDeleteQueue(int i);
extern void lotsofmoneymailpaper(int sp,int n,int pic); extern void A_SpawnMultiple(int sp,int pic,int n);
extern void guts(int sp,int gtype,int n); extern void A_DoGuts(int sp,int gtype,int n);
extern void setsectinterpolate(int i); extern void Sect_SetInterpolation(int i);
extern void clearsectinterpolate(int i); extern void Sect_ClearInterpolation(int i);
extern int ifhitbyweapon(int sn); extern int A_IncurDamage(int sn);
extern void moveobjects(void); extern void G_MoveWorld(void);
extern void movecyclers(void); extern void A_MoveCyclers(void);
extern void movedummyplayers(void); extern void A_MoveDummyPlayers(void);
// game.c // game.c
extern inline void setstatusbarscale(int sc); extern inline void G_SetStatusBarScale(int sc);
extern void setgamepalette(player_struct *player, char *pal, int set); extern void SetGamePalette(DukePlayer_t *player, char *pal, int set);
extern void fadepal(int r, int g, int b, int start, int end, int step); extern void fadepal(int r, int g, int b, int start, int end, int step);
extern inline int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2,int z); extern inline int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2,int z);
extern void txdigitalnumberz(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2, int z); extern void G_DrawTXDigiNumZ(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2, int z);
extern void myosx(int x,int y,int tilenum,int shade,int orientation); extern void G_DrawTileSmall(int x,int y,int tilenum,int shade,int orientation);
extern void myospalx(int x,int y,int tilenum,int shade,int orientation,int p); extern void G_DrawTilePalSmall(int x,int y,int tilenum,int shade,int orientation,int p);
extern void ResetGameVars(void); extern void Gv_ResetVarsToDefault(void);
extern void ResetActorGameVars(int iActor); extern void A_ResetGameVars(int iActor);
extern int minitext_(int x,int y,const char *t,int s,int p,int sb); extern int minitext_(int x,int y,const char *t,int s,int p,int sb);
@ -207,54 +206,55 @@ extern int minitext_(int x,int y,const char *t,int s,int p,int sb);
#define gametextpal(x,y,t,s,p) gametext_z(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536) #define gametextpal(x,y,t,s,p) gametext_z(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536)
#define gametextpalbits(x,y,t,s,p,dabits) gametext_z(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536) #define gametextpalbits(x,y,t,s,p,dabits) gametext_z(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536)
extern void setupdynamictostatic(); extern void G_InitDynamicTiles();
extern void processnames(const char *szLabel, int lValue); extern void G_ProcessDynamicTileMapping(const char *szLabel, int lValue);
extern void LoadActor(int sActor); extern void A_LoadActor(int sActor);
extern int GetGameVar(const char *szGameLabel, int lDefault, int iActor, int iPlayer); extern int Gv_GetVarByLabel(const char *szGameLabel, int lDefault, int iActor, int iPlayer);
extern void DumpGameVars(FILE *fp); extern void Gv_DumpValues(FILE *fp);
// extern void AddLog(const char *psz, ...); // extern void AddLog(const char *psz, ...);
extern void ResetSystemDefaults(void); extern void Gv_ResetSystemDefaults(void);
extern void InitGameVarPointers(void); extern void Gv_InitWeaponPointers(void);
extern void InitGameVars(void); extern void Gv_Init(void);
extern void SaveGameVars(FILE *fil); extern void Gv_WriteSave(FILE *fil);
extern int ReadGameVars(int fil); extern int Gv_ReadSave(int fil);
extern int GetGameVarID(int id, int iActor, int iPlayer); extern int Gv_GetVar(int id, int iActor, int iPlayer);
extern void SetGameVarID(int id, int lValue, int iActor, int iPlayer); extern void Gv_SetVar(int id, int lValue, int iActor, int iPlayer);
// extern void SetGameArrayID(int id,int index, int lValue); // extern void SetGameArrayID(int id,int index, int lValue);
extern int AddGameVar(const char *pszLabel, int lValue, unsigned int dwFlags); extern int Gv_SetupVar(const char *pszLabel, int lValue, unsigned int dwFlags);
extern int AddGameArray(const char *pszLabel, int asize); extern int Gv_AddArray(const char *pszLabel, int asize);
extern void ReportError(int iError); extern void C_ReportError(int iError);
extern void onvideomodechange(int newmode); extern void onvideomodechange(int newmode);
extern void OnEvent(int iEventID, int sActor, int sPlayer, int lDist); extern void X_OnEvent(int iEventID, int sActor, int sPlayer, int lDist);
extern int isspritemakingsound(int i, int num); extern int A_CheckSoundPlaying(int i, int num);
extern int issoundplaying(int i, int num); extern int S_CheckSoundPlaying(int i, int num);
extern void stopspritesound(int num, int i); extern void A_StopSound(int num, int i);
extern void updateplayer(void); extern void G_UpdatePlayerFromMenu(void);
extern void sendboardname(void); extern void Net_SendPlayerName(void);
extern void sendquit(void); extern void Net_SendUserMapName(void);
extern void Net_SendQuit(void);
extern void adduserquote(const char *daquote); extern void G_AddUserQuote(const char *daquote);
extern void mpchangemap(int volume, int level); extern void Net_NewGame(int volume, int level);
extern inline int checkspriteflags(int iActor, int iType); extern inline int A_CheckSpriteFlags(int iActor, int iType);
extern inline int checkspriteflagsp(int iPicnum, int iType); extern inline int A_CheckSpriteTileFlags(int iPicnum, int iType);
extern int getteampal(int team); extern int G_GetTeamPalette(int team);
extern void se40code(int x,int y,int z,int a,int h, int smoothratio); extern void se40code(int x,int y,int z,int a,int h, int smoothratio);
extern void FreeMapState(int mapnum); extern void G_FreeMapState(int mapnum);
extern void getlevelfromfilename(const char *fn, char *volume, char *level); extern void G_FindLevelForFilename(const char *fn, char *volume, char *level);
extern void GetCrosshairColor(void); extern void G_GetCrosshairColor(void);
extern void SetCrosshairColor(int r, int g, int b); extern void G_SetCrosshairColor(int r, int g, int b);
extern int kopen4loadfrommod(char *filename, char searchfirst); extern int kopen4loadfrommod(char *filename, char searchfirst);
#endif // __funct_h__ #endif // __funct_h__

View file

@ -36,14 +36,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern "C" { extern "C" {
#endif #endif
#define NUMKEYENTRIES 53 #define NUMKEYENTRIES 54
#define NUMGAMEFUNCTIONS 53 #define NUMGAMEFUNCTIONS 54
#define MAXGAMEFUNCLEN 32 #define MAXGAMEFUNCLEN 32
extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN]; extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN];
extern char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN]; extern char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN];
enum gamefuncs enum GameFunction_t
{ {
gamefunc_Move_Forward, gamefunc_Move_Forward,
gamefunc_Move_Backward, gamefunc_Move_Backward,
@ -97,7 +97,8 @@ enum gamefuncs
gamefunc_Quick_Kick, gamefunc_Quick_Kick,
gamefunc_Next_Weapon, gamefunc_Next_Weapon,
gamefunc_Previous_Weapon, gamefunc_Previous_Weapon,
gamefunc_Show_Console gamefunc_Show_Console,
gamefunc_Show_DukeMatch_Scores
}; };
#ifdef __cplusplus #ifdef __cplusplus
}; };

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -51,10 +51,10 @@ extern int g_gs;
extern int g_kb; extern int g_kb;
extern int g_looking_angSR1; extern int g_looking_angSR1;
extern int lastvisinc; extern int lastvisinc;
extern char cheatstrings[][MAXCHEATLEN]; extern char CheatStrings[][MAXCHEATLEN];
extern char compilefile[BMAX_PATH]; extern char g_szScriptFileName[BMAX_PATH];
extern int total_lines,line_number; extern int g_totalLines,g_lineNumber;
extern int error,warning; extern int g_numCompilerErrors,g_numCompilerWarnings;
typedef struct typedef struct
{ {
@ -64,36 +64,36 @@ typedef struct
int maxParm2; int maxParm2;
} memberlabel_t; } memberlabel_t;
extern const memberlabel_t sectorlabels[]; extern const memberlabel_t SectorLabels[];
extern const memberlabel_t walllabels[]; extern const memberlabel_t WallLabels[];
extern const memberlabel_t actorlabels[]; extern const memberlabel_t ActorLabels[];
extern const memberlabel_t playerlabels[]; extern const memberlabel_t PlayerLabels[];
extern const memberlabel_t projectilelabels[]; extern const memberlabel_t ProjectileLabels[];
extern const memberlabel_t userdeflabels[]; extern const memberlabel_t userdeflabels[];
extern const memberlabel_t inputlabels[]; extern const memberlabel_t InputLabels[];
extern const memberlabel_t tsprlabels[]; extern const memberlabel_t TsprLabels[];
extern void DoUserDef(int iSet, int lLabelID, int lVar2); extern void X_AccessUserdef(int iSet, int lLabelID, int lVar2);
extern void DoThisProjectile(int iSet, int lVar1, int lLabelID, int lVar2); extern void X_AccessActiveProjectile(int iSet, int lVar1, int lLabelID, int lVar2);
extern void DoPlayer(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2); extern void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2);
extern void DoInput(int iSet, int lVar1, int lLabelID, int lVar2); extern void X_AccessPlayerInput(int iSet, int lVar1, int lLabelID, int lVar2);
extern void DoWall(int iSet, int lVar1, int lLabelID, int lVar2); extern void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2);
extern void DoSector(int iSet, int lVar1, int lLabelID, int lVar2); extern void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2);
extern void DoActor(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2); extern void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2);
extern void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2); extern void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2);
extern void DoProjectile(int iSet, int lVar1, int lLabelID, int lVar2); extern void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVar2);
#define CON_ERROR OSD_ERROR "Line %d, %s: " #define CON_ERROR OSD_ERROR "Line %d, %s: "
extern int g_i,g_p; extern int g_i,g_p;
extern int checkCON; extern int g_scriptSanityChecks;
extern int line_num; extern int g_errorLineNum;
extern int g_tw; extern int g_tw;
extern const char *keyw[]; extern const char *keyw[];
extern spritetype *g_sp; extern spritetype *g_sp;
enum errors enum ScriptError_t
{ {
ERROR_CLOSEBRACKET, ERROR_CLOSEBRACKET,
ERROR_EVENTONLY, ERROR_EVENTONLY,
@ -123,7 +123,7 @@ enum errors
WARNING_REVEVENTSYNC WARNING_REVEVENTSYNC
}; };
enum playerlabels enum PlayerLabel_t
{ {
PLAYER_ZOOM, PLAYER_ZOOM,
PLAYER_EXITX, PLAYER_EXITX,
@ -274,7 +274,7 @@ enum playerlabels
PLAYER_END PLAYER_END
}; };
enum userdefslabels enum UserdefsLabel_t
{ {
USERDEFS_GOD, USERDEFS_GOD,
USERDEFS_WARP_ON, USERDEFS_WARP_ON,
@ -374,7 +374,7 @@ enum userdefslabels
USERDEFS_END USERDEFS_END
}; };
enum sectorlabels enum SectorLabel_t
{ {
SECTOR_WALLPTR, SECTOR_WALLPTR,
SECTOR_WALLNUM, SECTOR_WALLNUM,
@ -402,7 +402,7 @@ enum sectorlabels
SECTOR_END SECTOR_END
}; };
enum walllabels enum WallLabel_t
{ {
WALL_X, WALL_X,
WALL_Y, WALL_Y,
@ -424,7 +424,7 @@ enum walllabels
WALL_END WALL_END
}; };
enum actorlabels enum ActorLabel_t
{ {
ACTOR_X, ACTOR_X,
ACTOR_Y, ACTOR_Y,
@ -480,7 +480,7 @@ enum actorlabels
ACTOR_END ACTOR_END
}; };
enum inputlabels enum InputLabel_t
{ {
INPUT_AVEL, INPUT_AVEL,
INPUT_HORZ, INPUT_HORZ,
@ -491,7 +491,7 @@ enum inputlabels
INPUT_END INPUT_END
}; };
enum projectilelabels enum ProjectileLabel_t
{ {
PROJ_WORKSLIKE, PROJ_WORKSLIKE,
PROJ_SPAWNS, PROJ_SPAWNS,
@ -524,7 +524,7 @@ enum projectilelabels
PROJ_END PROJ_END
}; };
enum keywords enum ScriptKeywords_t
{ {
CON_DEFINELEVELNAME, // 0 CON_DEFINELEVELNAME, // 0
CON_ACTOR, // 1 CON_ACTOR, // 1

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -27,63 +27,61 @@ char *s_builddate = "20081116";
char *MusicPtr = NULL; char *MusicPtr = NULL;
int Musicsize; int Musicsize;
short global_random; short g_globalRandom;
short neartagsector, neartagwall, neartagsprite; short neartagsector, neartagwall, neartagsprite;
int neartaghitdist,lockclock,start_armour_amount; int neartaghitdist,lockclock,g_startArmorAmount;
// JBF: gc modified to default to Atomic ed. default when using 1.3d CONs // JBF: SpriteGravity modified to default to Atomic ed. default when using 1.3d CONs
int gc=176; int SpriteGravity=176;
// int temp_data[MAXSPRITES][6]; // int temp_data[MAXSPRITES][6];
actordata_t hittype[MAXSPRITES]; actordata_t ActorExtra[MAXSPRITES];
short spriteq[1024],spriteqloc,spriteqamount=64; short SpriteDeletionQueue[1024],g_spriteDeleteQueuePos,g_spriteDeleteQueueSize=64;
animwalltype animwall[MAXANIMWALLS]; animwalltype animwall[MAXANIMWALLS];
short numanimwalls; short g_numAnimWalls;
int *animateptr[MAXANIMATES]; int *animateptr[MAXANIMATES];
int animategoal[MAXANIMATES], animatevel[MAXANIMATES], animatecnt; int animategoal[MAXANIMATES], animatevel[MAXANIMATES], g_animateCount;
// int oanimateval[MAXANIMATES]; // int oanimateval[MAXANIMATES];
short animatesect[MAXANIMATES]; short animatesect[MAXANIMATES];
int msx[2048],msy[2048]; int msx[2048],msy[2048];
short cyclers[MAXCYCLERS][6],numcyclers; short cyclers[MAXCYCLERS][6],g_numCyclers;
char *fta_quotes[MAXQUOTES],*redefined_quotes[MAXQUOTES]; char *ScriptQuotes[MAXQUOTES], *ScriptQuoteRedefinitions[MAXQUOTES];
char tempbuf[2048], packbuf[576], menutextbuf[128]; char tempbuf[2048], packbuf[576], menutextbuf[128];
char buf[1024]; char buf[1024];
short camsprite; short camsprite;
short mirrorwall[64], mirrorsector[64], mirrorcnt; short g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
int current_menu; int g_currentMenu;
map_t map[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
char volume_names[MAXVOLUMES][33] = { "L.A. MELTDOWN", "LUNAR APOCALYPSE", "SHRAPNEL CITY" }; char EpisodeNames[MAXVOLUMES][33] = { "L.A. MELTDOWN", "LUNAR APOCALYPSE", "SHRAPNEL CITY" };
char skill_names[5][33] = { "PIECE OF CAKE", "LET'S ROCK", "COME GET SOME", "DAMN I'M GOOD" }; char SkillNames[5][33] = { "PIECE OF CAKE", "LET'S ROCK", "COME GET SOME", "DAMN I'M GOOD" };
char gametype_names[MAXGAMETYPES][33] = { "DUKEMATCH (SPAWN)","COOPERATIVE PLAY","DUKEMATCH (NO SPAWN)","TEAM DM (SPAWN)","TEAM DM (NO SPAWN)"}; char GametypeNames[MAXGAMETYPES][33] = { "DUKEMATCH (SPAWN)","COOPERATIVE PLAY","DUKEMATCH (NO SPAWN)","TEAM DM (SPAWN)","TEAM DM (NO SPAWN)"};
int gametype_flags[MAXGAMETYPES] = {4+8+16+1024+2048+16384,1+2+32+64+128+256+512+4096+8192+32768,2+4+8+16+16384,4+8+16+1024+2048+16384+65536+131072,2+4+8+16+16384+65536+131072}; int GametypeFlags[MAXGAMETYPES] = {4+8+16+1024+2048+16384,1+2+32+64+128+256+512+4096+8192+32768,2+4+8+16+16384,4+8+16+1024+2048+16384+65536+131072,2+4+8+16+16384+65536+131072};
char num_gametypes = 5; char g_numGametypes = 5;
short title_zoom; int g_currentFrameRate;
int framerate; char g_numVolumes = 3;
char num_volumes = 3; short g_timerTicsPerSecond=120;
short timer=120;
//fx_device device; //fx_device device;
sound_t g_sounds[ MAXSOUNDS ]; sound_t g_sounds[ MAXSOUNDS ];
char numplayersprites,loadfromgrouponly=0,earthquaketime; char g_numPlayerSprites,g_loadFromGroupOnly=0,g_earthquakeTime;
int fricxv,fricyv; int fricxv,fricyv;
playerdata_t g_player[MAXPLAYERS]; playerdata_t g_player[MAXPLAYERS];
input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
playerspawn_t g_PlayerSpawnPoints[MAXPLAYERS]; PlayerSpawn_t g_playerSpawnPoints[MAXPLAYERS];
user_defs ud; user_defs ud;
char pus, pub; char pus, pub;
@ -102,26 +100,25 @@ int screenpeek;
//Game recording variables //Game recording variables
char ready2send; char ready2send;
int vel, svel, angvel, horiz, ototalclock, respawnactortime=768, respawnitemtime=768, groupfile; int vel, svel, angvel, horiz, ototalclock, g_actorRespawnTime=768, g_itemRespawnTime=768, g_groupFileHandle;
intptr_t *scriptptr,*insptr,*labelcode,*labeltype; intptr_t *g_scriptPtr,*insptr,*labelcode,*labeltype;
int labelcnt,defaultlabelcnt; int g_numLabels,g_numDefaultLabels;
intptr_t *actorscrptr[MAXTILES],*parsing_actor; intptr_t *actorscrptr[MAXTILES],*g_parsingActorPtr;
char *label; char *label;
char *music_pointer; char ActorType[MAXTILES];
char actortype[MAXTILES];
intptr_t *script = NULL; intptr_t *script = NULL;
int g_ScriptSize = 16384; int g_scriptSize = 16384;
char typebuflen,typebuf[141]; char typebuflen,typebuf[141];
char *music_fn[MAXVOLUMES+1][MAXLEVELS],music_select; char g_musicIndex;
char env_music_fn[MAXVOLUMES+1][BMAX_PATH]; char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH];
char rtsplaying; char g_RTSPlaying;
short weaponsandammosprites[15] = short BlimpSpawnSprites[15] =
{ {
RPGSPRITE__STATIC, RPGSPRITE__STATIC,
CHAINGUNSPRITE__STATIC, CHAINGUNSPRITE__STATIC,
@ -140,8 +137,8 @@ short weaponsandammosprites[15] =
FREEZEAMMO__STATIC FREEZEAMMO__STATIC
}; };
int impact_damage; int g_impactDamage;
int g_ScriptDebug; int g_scriptDebug;
//GLOBAL.C - replace the end "my's" with this //GLOBAL.C - replace the end "my's" with this
int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel; int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
@ -151,35 +148,36 @@ short myang, omyang, mycursectnum, myjumpingcounter;
char myjumpingtoggle, myonground, myhardlanding, myreturntocenter; char myjumpingtoggle, myonground, myhardlanding, myreturntocenter;
signed char multiwho, multipos, multiwhat, multiflag; signed char multiwho, multipos, multiwhat, multiflag;
int fakemovefifoplc,movefifoplc; int predictfifoplc,movefifoplc;
int myxbak[MOVEFIFOSIZ], myybak[MOVEFIFOSIZ], myzbak[MOVEFIFOSIZ]; int myxbak[MOVEFIFOSIZ], myybak[MOVEFIFOSIZ], myzbak[MOVEFIFOSIZ];
int myhorizbak[MOVEFIFOSIZ],dukefriction = 0xcc00, show_shareware; int myhorizbak[MOVEFIFOSIZ],g_playerFriction = 0xcc00, g_showShareware;
short myangbak[MOVEFIFOSIZ]; short myangbak[MOVEFIFOSIZ];
char myname[32]; char szPlayerName[32];
int camerashitable,freezerhurtowner=0,lasermode=0; int g_damageCameras,g_freezerSelfDamage=0,g_tripbombLaserMode=0;
int networkmode = 255, movesperpacket = 1,gamequit = 0,everyothertime; int g_networkBroadcastMode = 255, g_movesPerPacket = 1,g_gameQuit = 0,everyothertime;
int numfreezebounces=3,rpgblastradius,pipebombblastradius,tripbombblastradius,shrinkerblastradius,morterblastradius,bouncemineblastradius,seenineblastradius; int g_numFreezeBounces=3,g_rpgBlastRadius,g_pipebombBlastRadius,g_tripbombBlastRadius,
g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius;
STATUSBARTYPE sbar; STATUSBARTYPE sbar;
int mymaxlag, otherminlag, bufferjitter = 1; int mymaxlag, otherminlag, bufferjitter = 1;
short numclouds,clouds[128],cloudx[128],cloudy[128]; short g_numClouds,clouds[128],cloudx[128],cloudy[128];
int cloudtotalclock = 0,totalmemory = 0; int cloudtotalclock = 0,totalmemory = 0;
int numinterpolations = 0, startofdynamicinterpolations = 0; int g_numInterpolations = 0, startofdynamicinterpolations = 0;
int oldipos[MAXINTERPOLATIONS]; int oldipos[MAXINTERPOLATIONS];
int bakipos[MAXINTERPOLATIONS]; int bakipos[MAXINTERPOLATIONS];
int *curipos[MAXINTERPOLATIONS]; int *curipos[MAXINTERPOLATIONS];
int nextvoxid = 0; int nextvoxid = 0;
int spriteflags[MAXTILES]; int SpriteFlags[MAXTILES];
projectile_t projectile[MAXTILES], thisprojectile[MAXSPRITES], defaultprojectile[MAXTILES]; projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES];
char cheatkey[2] = { sc_D, sc_N }; char CheatKeys[2] = { sc_D, sc_N };
char setupfilename[BMAX_PATH]= "duke3d.cfg"; char setupfilename[BMAX_PATH]= "duke3d.cfg";
// char datetimestring[] = ""__DATE__" "__TIME__""; // char datetimestring[] = ""__DATE__" "__TIME__"";
int doquicksave = 0; int g_doQuickSave = 0;
unsigned int MoveThingsCount = 0; unsigned int g_moveThingsCount = 0;

View file

@ -490,5 +490,5 @@ void MUSIC_RegisterTimbreBank
void MUSIC_Update(void) void MUSIC_Update(void)
{} {}
void PlayMusic(char *_filename, int loopflag) void MUSIC_PlayMusic(char *_filename, int loopflag)
{} {}

View file

@ -2977,7 +2977,7 @@ int MV_Shutdown(void)
// Stop the sound playback engine // Stop the sound playback engine
MV_StopPlayback(); MV_StopPlayback();
// Shutdown the sound card // G_Shutdown the sound card
#if defined(_WIN32) #if defined(_WIN32)
DSOUND_Shutdown(); DSOUND_Shutdown();
#else #else

View file

@ -158,9 +158,9 @@ int MUSIC_Init
// no AL support so shitcan the ogg definitions // no AL support so shitcan the ogg definitions
for (i=(MAXLEVELS*(MAXVOLUMES+1))-1;i>=0;i--) // +1 volume for "intro", "briefing" music for (i=(MAXLEVELS*(MAXVOLUMES+1))-1;i>=0;i--) // +1 volume for "intro", "briefing" music
{ {
if (map[i].musicfn1 != NULL) if (MapInfo[i].musicfn1 != NULL)
Bfree(map[i].musicfn1); Bfree(MapInfo[i].musicfn1);
map[i].musicfn1 = NULL; MapInfo[i].musicfn1 = NULL;
} }
} }
#endif #endif

View file

@ -304,7 +304,7 @@ int MUSIC_StopSong(void)
} // MUSIC_StopSong } // MUSIC_StopSong
// Duke3D-specific. --ryan. // Duke3D-specific. --ryan.
void PlayMusic(char *_filename) void MUSIC_PlayMusic(char *_filename)
{ {
int handle; int handle;
int size; int size;

View file

@ -306,7 +306,7 @@ int32 SCRIPT_ParseBuffer(int32 scripthandle, char *data, int32 length)
if (!(expect & ExpectingEntry)) if (!(expect & ExpectingEntry))
{ {
// Unexpected name start // Unexpected name start
printf("Unexpected entry label on line %d.\n", linenum); printf("Unexpected entry LabelText on line %d.\n", linenum);
SETRV(-1); SETRV(-1);
EATLINE(sp); EATLINE(sp);
continue; continue;

File diff suppressed because it is too large Load diff

View file

@ -1517,9 +1517,9 @@ int RESERVEDSLOT10 = 6141;
int RESERVEDSLOT11 = 6142; int RESERVEDSLOT11 = 6142;
int RESERVEDSLOT12 = 6143; int RESERVEDSLOT12 = 6143;
short dynamictostatic[MAXTILES]; short DynamicTileMap[MAXTILES];
void processnames(const char *szLabel, int lValue) void G_ProcessDynamicTileMapping(const char *szLabel, int lValue)
{ {
int i; int i;
if (lValue >= MAXTILES || !szLabel) if (lValue >= MAXTILES || !szLabel)
@ -1542,42 +1542,42 @@ void freehashnames()
HASH_free(&dynnamesH); HASH_free(&dynnamesH);
} }
void setupdynamictostatic(void) void G_InitDynamicTiles(void)
{ {
int i = 0; int i = 0;
clearbufbyte(dynamictostatic,MAXTILES,0); clearbufbyte(DynamicTileMap,MAXTILES,0);
while (list[i].val) while (list[i].val)
{ {
dynamictostatic[list[i].val]=list[i].vstat; DynamicTileMap[list[i].val]=list[i].vstat;
i++; i++;
} }
weaponsandammosprites[0] = RPGSPRITE; BlimpSpawnSprites[0] = RPGSPRITE;
weaponsandammosprites[1] = CHAINGUNSPRITE; BlimpSpawnSprites[1] = CHAINGUNSPRITE;
weaponsandammosprites[2] = DEVISTATORAMMO; BlimpSpawnSprites[2] = DEVISTATORAMMO;
weaponsandammosprites[3] = RPGAMMO; BlimpSpawnSprites[3] = RPGAMMO;
weaponsandammosprites[4] = RPGAMMO; BlimpSpawnSprites[4] = RPGAMMO;
weaponsandammosprites[5] = JETPACK; BlimpSpawnSprites[5] = JETPACK;
weaponsandammosprites[6] = SHIELD; BlimpSpawnSprites[6] = SHIELD;
weaponsandammosprites[7] = FIRSTAID; BlimpSpawnSprites[7] = FIRSTAID;
weaponsandammosprites[8] = STEROIDS; BlimpSpawnSprites[8] = STEROIDS;
weaponsandammosprites[9] = RPGAMMO; BlimpSpawnSprites[9] = RPGAMMO;
weaponsandammosprites[10] = RPGAMMO; BlimpSpawnSprites[10] = RPGAMMO;
weaponsandammosprites[11] = RPGSPRITE; BlimpSpawnSprites[11] = RPGSPRITE;
weaponsandammosprites[12] = RPGAMMO; BlimpSpawnSprites[12] = RPGAMMO;
weaponsandammosprites[13] = FREEZESPRITE; BlimpSpawnSprites[13] = FREEZESPRITE;
weaponsandammosprites[14] = FREEZEAMMO; BlimpSpawnSprites[14] = FREEZEAMMO;
weapon_sprites[0] = KNEE; WeaponPickupSprites[0] = KNEE;
weapon_sprites[1] = FIRSTGUNSPRITE; WeaponPickupSprites[1] = FIRSTGUNSPRITE;
weapon_sprites[2] = SHOTGUNSPRITE; WeaponPickupSprites[2] = SHOTGUNSPRITE;
weapon_sprites[3] = CHAINGUNSPRITE; WeaponPickupSprites[3] = CHAINGUNSPRITE;
weapon_sprites[4] = RPGSPRITE; WeaponPickupSprites[4] = RPGSPRITE;
weapon_sprites[5] = HEAVYHBOMB; WeaponPickupSprites[5] = HEAVYHBOMB;
weapon_sprites[6] = SHRINKERSPRITE; WeaponPickupSprites[6] = SHRINKERSPRITE;
weapon_sprites[7] = DEVISTATORSPRITE; WeaponPickupSprites[7] = DEVISTATORSPRITE;
weapon_sprites[8] = TRIPBOMBSPRITE; WeaponPickupSprites[8] = TRIPBOMBSPRITE;
weapon_sprites[9] = FREEZESPRITE; WeaponPickupSprites[9] = FREEZESPRITE;
weapon_sprites[10] = HEAVYHBOMB; WeaponPickupSprites[10] = HEAVYHBOMB;
weapon_sprites[11] = SHRINKERSPRITE; WeaponPickupSprites[11] = SHRINKERSPRITE;
} }

View file

@ -1496,4 +1496,4 @@ extern int RESERVEDSLOT11;
#define RESERVEDSLOT11__STATIC 6142 #define RESERVEDSLOT11__STATIC 6142
extern int RESERVEDSLOT12; extern int RESERVEDSLOT12;
#define RESERVEDSLOT12__STATIC 6143 #define RESERVEDSLOT12__STATIC 6143
extern short dynamictostatic[MAXTILES]; extern short DynamicTileMap[MAXTILES];

View file

@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
extern int voting, doquicksave; extern int voting, g_doQuickSave;
struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat;
float r_ambientlight = 1.0, r_ambientlightrecip = 1.0; float r_ambientlight = 1.0, r_ambientlightrecip = 1.0;
extern int althud_numbertile, althud_numberpal, althud_shadows, althud_flashing, hud_glowingquotes; extern int althud_numbertile, althud_numberpal, althud_shadows, althud_flashing, hud_glowingquotes;
@ -42,7 +42,7 @@ extern int r_maxfps;
static inline int osdcmd_quit(const osdfuncparm_t *parm) static inline int osdcmd_quit(const osdfuncparm_t *parm)
{ {
UNREFERENCED_PARAMETER(parm); UNREFERENCED_PARAMETER(parm);
sendquit(); Net_SendQuit();
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -86,14 +86,14 @@ static int osdcmd_changelevel(const osdfuncparm_t *parm)
if (!VOLUMEONE) if (!VOLUMEONE)
{ {
if (volume > num_volumes) if (volume > g_numVolumes)
{ {
OSD_Printf("changelevel: invalid volume number (range 1-%d)\n",num_volumes); OSD_Printf("changelevel: invalid volume number (range 1-%d)\n",g_numVolumes);
return OSDCMD_OK; return OSDCMD_OK;
} }
} }
if (level > MAXLEVELS || map[volume*MAXLEVELS+level].filename == NULL) if (level > MAXLEVELS || MapInfo[volume*MAXLEVELS+level].filename == NULL)
{ {
OSD_Printf("changelevel: invalid level number\n"); OSD_Printf("changelevel: invalid level number\n");
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
@ -101,8 +101,8 @@ static int osdcmd_changelevel(const osdfuncparm_t *parm)
if (numplayers > 1) if (numplayers > 1)
{ {
if (myconnectindex == connecthead && networkmode == 0) if (myconnectindex == connecthead && g_networkBroadcastMode == 0)
mpchangemap(volume,level); Net_NewGame(volume,level);
else if (voting == -1) else if (voting == -1)
{ {
ud.m_volume_number = volume; ud.m_volume_number = volume;
@ -122,23 +122,22 @@ static int osdcmd_changelevel(const osdfuncparm_t *parm)
voting = myconnectindex; voting = myconnectindex;
tempbuf[0] = 18; tempbuf[0] = PACKET_TYPE_MAP_VOTE_INITIATE;
tempbuf[1] = 1; tempbuf[1] = myconnectindex;
tempbuf[2] = myconnectindex; tempbuf[2] = ud.m_volume_number;
tempbuf[3] = ud.m_volume_number; tempbuf[3] = ud.m_level_number;
tempbuf[4] = ud.m_level_number;
for (i=connecthead;i>=0;i=connectpoint2[i]) TRAVERSE_CONNECT(i)
{ {
if (i != myconnectindex) sendpacket(i,tempbuf,5); if (i != myconnectindex) sendpacket(i,tempbuf,4);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master if ((!g_networkBroadcastMode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
} }
} }
if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && !(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_TDM)) if ((GametypeFlags[ud.m_coop] & GAMETYPE_PLAYERSFRIENDLY) && !(GametypeFlags[ud.m_coop] & GAMETYPE_TDM))
ud.m_noexits = 0; ud.m_noexits = 0;
g_player[myconnectindex].ps->gm |= MODE_MENU; g_player[myconnectindex].ps->gm |= MODE_MENU;
cmenu(603); ChangeToMenu(603);
} }
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -164,8 +163,8 @@ static int osdcmd_changelevel(const osdfuncparm_t *parm)
ud.multimode = 1; ud.multimode = 1;
newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill); G_NewGame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill);
if (enterlevel(MODE_GAME)) backtomenu(); if (G_EnterLevel(MODE_GAME)) G_BackToMenu();
} }
return OSDCMD_OK; return OSDCMD_OK;
@ -254,14 +253,16 @@ static int osdcmd_map(const osdfuncparm_t *parm)
if (numplayers > 1) if (numplayers > 1)
{ {
if (myconnectindex == connecthead && networkmode == 0) if (myconnectindex == connecthead && g_networkBroadcastMode == 0)
{ {
sendboardname(); Net_SendUserMapName();
mpchangemap(0,7); ud.m_volume_number = 0;
ud.m_level_number = 7;
Net_NewGame(ud.m_volume_number, ud.m_level_number);
} }
else if (voting == -1) else if (voting == -1)
{ {
sendboardname(); Net_SendUserMapName();
ud.m_volume_number = 0; ud.m_volume_number = 0;
ud.m_level_number = 7; ud.m_level_number = 7;
@ -279,23 +280,22 @@ static int osdcmd_map(const osdfuncparm_t *parm)
g_player[myconnectindex].vote = g_player[myconnectindex].gotvote = 1; g_player[myconnectindex].vote = g_player[myconnectindex].gotvote = 1;
voting = myconnectindex; voting = myconnectindex;
tempbuf[0] = 18; tempbuf[0] = PACKET_TYPE_MAP_VOTE_INITIATE;
tempbuf[1] = 1; tempbuf[1] = myconnectindex;
tempbuf[2] = myconnectindex; tempbuf[2] = ud.m_volume_number;
tempbuf[3] = ud.m_volume_number; tempbuf[3] = ud.m_level_number;
tempbuf[4] = ud.m_level_number;
for (i=connecthead;i>=0;i=connectpoint2[i]) TRAVERSE_CONNECT(i)
{ {
if (i != myconnectindex) sendpacket(i,tempbuf,5); if (i != myconnectindex) sendpacket(i,tempbuf,4);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master if ((!g_networkBroadcastMode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
} }
} }
if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && !(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_TDM)) if ((GametypeFlags[ud.m_coop] & GAMETYPE_PLAYERSFRIENDLY) && !(GametypeFlags[ud.m_coop] & GAMETYPE_TDM))
ud.m_noexits = 0; ud.m_noexits = 0;
g_player[myconnectindex].ps->gm |= MODE_MENU; g_player[myconnectindex].ps->gm |= MODE_MENU;
cmenu(603); ChangeToMenu(603);
} }
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -311,8 +311,8 @@ static int osdcmd_map(const osdfuncparm_t *parm)
ud.multimode = 1; ud.multimode = 1;
newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill); G_NewGame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill);
if (enterlevel(MODE_GAME)) backtomenu(); if (G_EnterLevel(MODE_GAME)) G_BackToMenu();
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -410,25 +410,25 @@ static int osdcmd_rate(const osdfuncparm_t *parm)
static int osdcmd_restartsound(const osdfuncparm_t *parm) static int osdcmd_restartsound(const osdfuncparm_t *parm)
{ {
UNREFERENCED_PARAMETER(parm); UNREFERENCED_PARAMETER(parm);
SoundShutdown(); S_SoundShutdown();
MusicShutdown(); S_MusicShutdown();
initprintf("Initializing music...\n"); initprintf("Initializing music...\n");
MusicStartup(); S_MusicStartup();
initprintf("Initializing sound...\n"); initprintf("Initializing sound...\n");
SoundStartup(); S_SoundStartup();
FX_StopAllSounds(); FX_StopAllSounds();
clearsoundlocks(); S_ClearSoundLocks();
if (ud.config.MusicToggle == 1) if (ud.config.MusicToggle == 1)
{ {
if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME) if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME)
{ {
if (map[(unsigned char)music_select].musicfn != NULL) if (MapInfo[(unsigned char)g_musicIndex].musicfn != NULL)
playmusic(&map[(unsigned char)music_select].musicfn[0],music_select); S_PlayMusic(&MapInfo[(unsigned char)g_musicIndex].musicfn[0],g_musicIndex);
} }
else playmusic(&env_music_fn[0][0],MAXVOLUMES*MAXLEVELS); else S_PlayMusic(&EnvMusicFilename[0][0],MAXVOLUMES*MAXLEVELS);
} }
return OSDCMD_OK; return OSDCMD_OK;
@ -439,9 +439,9 @@ static int osdcmd_restartvid(const osdfuncparm_t *parm)
UNREFERENCED_PARAMETER(parm); UNREFERENCED_PARAMETER(parm);
resetvideomode(); resetvideomode();
if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP)) if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP))
gameexit("restartvid: Reset failed...\n"); G_GameExit("restartvid: Reset failed...\n");
onvideomodechange(ud.config.ScreenBPP>8); onvideomodechange(ud.config.ScreenBPP>8);
vscrn(); G_UpdateScreenArea();
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -475,14 +475,14 @@ static int osdcmd_vidmode(const osdfuncparm_t *parm)
{ {
initprintf("vidmode: Mode change failed!\n"); initprintf("vidmode: Mode change failed!\n");
if (setgamemode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP)) if (setgamemode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP))
gameexit("vidmode: Reset failed!\n"); G_GameExit("vidmode: Reset failed!\n");
} }
ud.config.ScreenBPP = newbpp; ud.config.ScreenBPP = newbpp;
ud.config.ScreenWidth = newwidth; ud.config.ScreenWidth = newwidth;
ud.config.ScreenHeight = newheight; ud.config.ScreenHeight = newheight;
ud.config.ScreenMode = newfs; ud.config.ScreenMode = newfs;
onvideomodechange(ud.config.ScreenBPP>8); onvideomodechange(ud.config.ScreenBPP>8);
vscrn(); G_UpdateScreenArea();
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -495,7 +495,7 @@ static int osdcmd_setstatusbarscale(const osdfuncparm_t *parm)
} }
else if (parm->numparms != 1) return OSDCMD_SHOWHELP; else if (parm->numparms != 1) return OSDCMD_SHOWHELP;
setstatusbarscale(Batol(parm->parms[0])); G_SetStatusBarScale(Batol(parm->parms[0]));
OSD_Printf("hud_scale %d\n", ud.statusbarscale); OSD_Printf("hud_scale %d\n", ud.statusbarscale);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -553,7 +553,7 @@ static int osdcmd_spawn(const osdfuncparm_t *parm)
int i,j; int i,j;
for (j=0; j<2; j++) for (j=0; j<2; j++)
{ {
for (i=0; i<labelcnt; i++) for (i=0; i<g_numLabels; i++)
{ {
if ( if (
(j == 0 && !Bstrcmp(label+(i<<6), parm->parms[0])) || (j == 0 && !Bstrcmp(label+(i<<6), parm->parms[0])) ||
@ -564,9 +564,9 @@ static int osdcmd_spawn(const osdfuncparm_t *parm)
break; break;
} }
} }
if (i<labelcnt) break; if (i<g_numLabels) break;
} }
if (i==labelcnt) if (i==g_numLabels)
{ {
OSD_Printf("spawn: Invalid tile label given\n"); OSD_Printf("spawn: Invalid tile label given\n");
return OSDCMD_OK; return OSDCMD_OK;
@ -583,7 +583,7 @@ static int osdcmd_spawn(const osdfuncparm_t *parm)
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
} }
idx = spawn(g_player[myconnectindex].ps->i, (short)picnum); idx = A_Spawn(g_player[myconnectindex].ps->i, (short)picnum);
if (set & 1) sprite[idx].pal = (char)pal; if (set & 1) sprite[idx].pal = (char)pal;
if (set & 2) sprite[idx].cstat = (short)cstat; if (set & 2) sprite[idx].cstat = (short)cstat;
if (set & 4) sprite[idx].ang = ang; if (set & 4) sprite[idx].ang = ang;
@ -616,12 +616,12 @@ static int osdcmd_setvar(const osdfuncparm_t *parm)
varval = Batol(varname); varval = Batol(varname);
i = HASH_find(&gamevarH,varname); i = HASH_find(&gamevarH,varname);
if (i >= 0) if (i >= 0)
varval=GetGameVarID(i, g_player[myconnectindex].ps->i, myconnectindex); varval=Gv_GetVar(i, g_player[myconnectindex].ps->i, myconnectindex);
strcpy(varname,parm->parms[0]); strcpy(varname,parm->parms[0]);
i = HASH_find(&gamevarH,varname); i = HASH_find(&gamevarH,varname);
if (i >= 0) if (i >= 0)
SetGameVarID(i, varval, g_player[myconnectindex].ps->i, myconnectindex); Gv_SetVar(i, varval, g_player[myconnectindex].ps->i, myconnectindex);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -641,7 +641,7 @@ static int osdcmd_addlogvar(const osdfuncparm_t *parm)
strcpy(varname,parm->parms[0]); strcpy(varname,parm->parms[0]);
i = HASH_find(&gamevarH,varname); i = HASH_find(&gamevarH,varname);
if (i >= 0) if (i >= 0)
OSD_Printf("%s = %d\n", varname, GetGameVarID(i, g_player[myconnectindex].ps->i, myconnectindex)); OSD_Printf("%s = %d\n", varname, Gv_GetVar(i, g_player[myconnectindex].ps->i, myconnectindex));
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -670,12 +670,12 @@ static int osdcmd_setactorvar(const osdfuncparm_t *parm)
varval = Batol(varname); varval = Batol(varname);
i = HASH_find(&gamevarH,varname); i = HASH_find(&gamevarH,varname);
if (i >= 0) if (i >= 0)
varval=GetGameVarID(i, g_player[myconnectindex].ps->i, myconnectindex); varval=Gv_GetVar(i, g_player[myconnectindex].ps->i, myconnectindex);
strcpy(varname,parm->parms[1]); strcpy(varname,parm->parms[1]);
i = HASH_find(&gamevarH,varname); i = HASH_find(&gamevarH,varname);
if (i >= 0) if (i >= 0)
SetGameVarID(i, varval, ID, -1); Gv_SetVar(i, varval, ID, -1);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -711,7 +711,7 @@ static int osdcmd_cmenu(const osdfuncparm_t *parm)
} }
else else
{ {
cmenu(Batol(parm->parms[0])); ChangeToMenu(Batol(parm->parms[0]));
} }
return OSDCMD_OK; return OSDCMD_OK;
@ -844,7 +844,7 @@ static int osdcmd_cvar_set(const osdfuncparm_t *parm)
break; break;
} }
if (cvar[i].type&CVAR_MULTI) if (cvar[i].type&CVAR_MULTI)
updateplayer(); G_UpdatePlayerFromMenu();
} }
} }
OSD_Printf("\n"); OSD_Printf("\n");
@ -909,7 +909,7 @@ static int osdcmd_give(const osdfuncparm_t *parm)
else if (!Bstrcasecmp(parm->parms[0], "ammo")) else if (!Bstrcasecmp(parm->parms[0], "ammo"))
{ {
for (i=MAX_WEAPONS-(VOLUMEONE?6:1)-1;i>=PISTOL_WEAPON;i--) for (i=MAX_WEAPONS-(VOLUMEONE?6:1)-1;i>=PISTOL_WEAPON;i--)
addammo(i,g_player[myconnectindex].ps,g_player[myconnectindex].ps->max_ammo_amount[i]); P_AddAmmo(i,g_player[myconnectindex].ps,g_player[myconnectindex].ps->max_ammo_amount[i]);
return OSDCMD_OK; return OSDCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "armor")) else if (!Bstrcasecmp(parm->parms[0], "armor"))
@ -954,7 +954,7 @@ void onvideomodechange(int newmode)
} }
setbrightness(ud.brightness>>2, pal, 0); setbrightness(ud.brightness>>2, pal, 0);
restorepalette = 1; g_restorePalette = 1;
crosshair_sum = 0; crosshair_sum = 0;
} }
@ -996,7 +996,7 @@ static int osdcmd_name(const osdfuncparm_t *parm)
if (parm->numparms != 1) if (parm->numparms != 1)
{ {
OSD_Printf("\"name\" is \"%s\"\n",myname); OSD_Printf("\"name\" is \"%s\"\n",szPlayerName);
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
} }
@ -1005,12 +1005,12 @@ static int osdcmd_name(const osdfuncparm_t *parm)
while (Bstrlen(stripcolorcodes(namebuf,tempbuf)) > 10) while (Bstrlen(stripcolorcodes(namebuf,tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf)-1] = '\0'; tempbuf[Bstrlen(tempbuf)-1] = '\0';
Bstrncpy(myname,tempbuf,sizeof(myname)-1); Bstrncpy(szPlayerName,tempbuf,sizeof(szPlayerName)-1);
myname[sizeof(myname)-1] = '\0'; szPlayerName[sizeof(szPlayerName)-1] = '\0';
OSD_Printf("name %s\n",myname); OSD_Printf("name %s\n",szPlayerName);
updateplayer(); Net_SendPlayerName();
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -1285,7 +1285,7 @@ static int osdcmd_quicksave(const osdfuncparm_t *parm)
UNREFERENCED_PARAMETER(parm); UNREFERENCED_PARAMETER(parm);
if (!(g_player[myconnectindex].ps->gm & MODE_GAME)) if (!(g_player[myconnectindex].ps->gm & MODE_GAME))
OSD_Printf("quicksave: not in a game.\n"); OSD_Printf("quicksave: not in a game.\n");
else doquicksave = 1; else g_doQuickSave = 1;
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -1294,7 +1294,7 @@ static int osdcmd_quickload(const osdfuncparm_t *parm)
UNREFERENCED_PARAMETER(parm); UNREFERENCED_PARAMETER(parm);
if (!(g_player[myconnectindex].ps->gm & MODE_GAME)) if (!(g_player[myconnectindex].ps->gm & MODE_GAME))
OSD_Printf("quickload: not in a game.\n"); OSD_Printf("quickload: not in a game.\n");
else doquicksave = 2; else g_doQuickSave = 2;
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -1306,24 +1306,24 @@ static int osdcmd_screenshot(const osdfuncparm_t *parm)
return OSDCMD_OK; return OSDCMD_OK;
} }
extern void savemapstate(mapstate_t *save); extern void G_SaveMapState(mapstate_t *save);
extern void restoremapstate(mapstate_t *save); extern void G_RestoreMapState(mapstate_t *save);
/* /*
static int osdcmd_savestate(const osdfuncparm_t *parm) static int osdcmd_savestate(const osdfuncparm_t *parm)
{ {
UNREFERENCED_PARAMETER(parm); UNREFERENCED_PARAMETER(parm);
if (map[ud.volume_number*MAXLEVELS+ud.level_number].savedstate == NULL) if (MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate == NULL)
map[ud.volume_number*MAXLEVELS+ud.level_number].savedstate = Bcalloc(1,sizeof(mapstate_t)); MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate = Bcalloc(1,sizeof(mapstate_t));
savemapstate(map[ud.volume_number*MAXLEVELS+ud.level_number].savedstate); G_SaveMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate);
return OSDCMD_OK; return OSDCMD_OK;
} }
static int osdcmd_restorestate(const osdfuncparm_t *parm) static int osdcmd_restorestate(const osdfuncparm_t *parm)
{ {
UNREFERENCED_PARAMETER(parm); UNREFERENCED_PARAMETER(parm);
if (map[ud.volume_number*MAXLEVELS+ud.level_number].savedstate) if (MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate)
restoremapstate(map[ud.volume_number*MAXLEVELS+ud.level_number].savedstate); G_RestoreMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate);
return OSDCMD_OK; return OSDCMD_OK;
} }
*/ */
@ -1383,8 +1383,8 @@ static int osdcmd_setcrosshairscale(const osdfuncparm_t *parm)
return OSDCMD_OK; return OSDCMD_OK;
} }
extern void SetCrosshairColor(int r, int g, int b); extern void G_SetCrosshairColor(int r, int g, int b);
extern palette_t crosshair_colors; extern palette_t CrosshairColors;
static int osdcmd_crosshaircolor(const osdfuncparm_t *parm) static int osdcmd_crosshaircolor(const osdfuncparm_t *parm)
{ {
@ -1392,13 +1392,13 @@ static int osdcmd_crosshaircolor(const osdfuncparm_t *parm)
if (parm->numparms != 3) if (parm->numparms != 3)
{ {
OSD_Printf("crosshaircolor: r:%d g:%d b:%d\n",crosshair_colors.r,crosshair_colors.g,crosshair_colors.b); OSD_Printf("crosshaircolor: r:%d g:%d b:%d\n",CrosshairColors.r,CrosshairColors.g,CrosshairColors.b);
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
} }
r = atol(parm->parms[0]); r = atol(parm->parms[0]);
g = atol(parm->parms[1]); g = atol(parm->parms[1]);
b = atol(parm->parms[2]); b = atol(parm->parms[2]);
SetCrosshairColor(r,g,b); G_SetCrosshairColor(r,g,b);
OSD_Printf("%s\n", parm->raw); OSD_Printf("%s\n", parm->raw);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -1421,7 +1421,7 @@ static int osdcmd_visibility(const osdfuncparm_t *parm)
static int osdcmd_maxfps(const osdfuncparm_t *parm) static int osdcmd_maxfps(const osdfuncparm_t *parm)
{ {
extern int g_FrameDelay; extern int g_frameDelay;
if (parm->numparms != 1) if (parm->numparms != 1)
{ {
@ -1429,8 +1429,8 @@ static int osdcmd_maxfps(const osdfuncparm_t *parm)
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
} }
r_maxfps = max(0,min(1000,atol(parm->parms[0]))); r_maxfps = max(0,min(1000,atol(parm->parms[0])));
if (r_maxfps) g_FrameDelay = (1000/r_maxfps); if (r_maxfps) g_frameDelay = (1000/r_maxfps);
else g_FrameDelay = 0; else g_frameDelay = 0;
OSD_Printf("%s\n",parm->raw); OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -1441,16 +1441,16 @@ static int osdcmd_inittimer(const osdfuncparm_t *parm)
if (parm->numparms != 1) if (parm->numparms != 1)
{ {
OSD_Printf("%dHz timer\n",timer); OSD_Printf("%dHz timer\n",g_timerTicsPerSecond);
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
} }
j = atol(parm->parms[0]); j = atol(parm->parms[0]);
if (timer == j) if (g_timerTicsPerSecond == j)
return OSDCMD_OK; return OSDCMD_OK;
uninittimer(); uninittimer();
inittimer(j); inittimer(j);
timer = j; g_timerTicsPerSecond = j;
OSD_Printf("%s\n",parm->raw); OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK; return OSDCMD_OK;
@ -1490,11 +1490,13 @@ int registerosdcommands(void)
OSD_RegisterFunction("fileinfo","fileinfo <file>: gets a file's information", osdcmd_fileinfo); OSD_RegisterFunction("fileinfo","fileinfo <file>: gets a file's information", osdcmd_fileinfo);
for (i=0;i<NUMGAMEFUNCTIONS-1;i++) for (i=0;i<NUMGAMEFUNCTIONS;i++)
{ {
char *t; char *t;
int j; int j;
if (!Bstrcmp(gamefunctions[i],"Show_Console")) continue;
Bsprintf(tempbuf,"gamefunc_%s",gamefunctions[i]); Bsprintf(tempbuf,"gamefunc_%s",gamefunctions[i]);
t = Bstrdup(tempbuf); t = Bstrdup(tempbuf);
for (j=Bstrlen(t);j>=0;j--) for (j=Bstrlen(t);j>=0;j--)

View file

@ -2,7 +2,7 @@
#define __osdcmds_h__ #define __osdcmds_h__
struct osdcmd_cheatsinfo { struct osdcmd_cheatsinfo {
int cheatnum; // -1 = none, else = see cheats() int cheatnum; // -1 = none, else = see DoCheats()
int volume,level; int volume,level;
}; };

View file

@ -132,7 +132,7 @@ void GAME_onshowosd(int shown)
picsiz[BGTILE] += ((char)(j<<4)); picsiz[BGTILE] += ((char)(j<<4));
} }
vscrn(); G_UpdateScreenArea();
if (numplayers == 1) if (numplayers == 1)
if ((shown && !ud.pause_on) || (!shown && ud.pause_on)) if ((shown && !ud.pause_on) || (!shown && ud.pause_on))
KB_KeyDown[sc_Pause] = 1; KB_KeyDown[sc_Pause] = 1;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -28,7 +28,7 @@ extern char *bitptr;
#define BITPTR_POINTER 1 #define BITPTR_POINTER 1
void readsavenames(void) void ReadSaveGameHeaders(void)
{ {
int dummy,j; int dummy,j;
int i; int i;
@ -74,7 +74,7 @@ void readsavenames(void)
} }
} }
int loadpheader(char spot,struct savehead *saveh) int G_LoadSaveHeader(char spot,struct savehead *saveh)
{ {
char fn[13]; char fn[13];
int fil; int fil;
@ -95,7 +95,7 @@ int loadpheader(char spot,struct savehead *saveh)
if (kdfread(&bv,4,1,fil) != 1) goto corrupt; if (kdfread(&bv,4,1,fil) != 1) goto corrupt;
/* if (bv != BYTEVERSION) /* if (bv != BYTEVERSION)
{ {
FTA(114,g_player[myconnectindex].ps); P_DoQuote(114,g_player[myconnectindex].ps);
kclose(fil); kclose(fil);
return 1; return 1;
}*/ }*/
@ -122,7 +122,7 @@ corrupt:
return 1; return 1;
} }
int loadplayer(int spot) int G_LoadPlayer(int spot)
{ {
int k; int k;
char fn[13]; char fn[13];
@ -173,7 +173,7 @@ int loadplayer(int spot)
if (kdfread(&bv,4,1,fil) != 1) return -1; if (kdfread(&bv,4,1,fil) != 1) return -1;
if (bv != BYTEVERSION) if (bv != BYTEVERSION)
{ {
FTA(114,g_player[myconnectindex].ps); P_DoQuote(114,g_player[myconnectindex].ps);
kclose(fil); kclose(fil);
ototalclock = totalclock; ototalclock = totalclock;
ready2send = 1; ready2send = 1;
@ -186,7 +186,7 @@ int loadplayer(int spot)
kclose(fil); kclose(fil);
ototalclock = totalclock; ototalclock = totalclock;
ready2send = 1; ready2send = 1;
FTA(124,g_player[myconnectindex].ps); P_DoQuote(124,g_player[myconnectindex].ps);
return 1; return 1;
} }
else ud.multimode = nump; else ud.multimode = nump;
@ -195,8 +195,8 @@ int loadplayer(int spot)
{ {
pub = NUMPAGES; pub = NUMPAGES;
pus = NUMPAGES; pus = NUMPAGES;
vscrn(); G_UpdateScreenArea();
drawbackground(); G_DrawBackground();
menutext(160,100,0,0,"LOADING..."); menutext(160,100,0,0,"LOADING...");
nextpage(); nextpage();
} }
@ -204,7 +204,7 @@ int loadplayer(int spot)
waitforeverybody(); waitforeverybody();
FX_StopAllSounds(); FX_StopAllSounds();
clearsoundlocks(); S_ClearSoundLocks();
if (numplayers > 1) if (numplayers > 1)
{ {
@ -248,43 +248,43 @@ int loadplayer(int spot)
if (kdfread(&headspritesect[0],2,MAXSECTORS+1,fil) != MAXSECTORS+1) goto corrupt; if (kdfread(&headspritesect[0],2,MAXSECTORS+1,fil) != MAXSECTORS+1) goto corrupt;
if (kdfread(&prevspritesect[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt; if (kdfread(&prevspritesect[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&nextspritesect[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt; if (kdfread(&nextspritesect[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&headspritestat[0],2,MAXSTATUS+1,fil) != MAXSTATUS+1) goto corrupt; if (kdfread(&headspritestat[STAT_DEFAULT],2,MAXSTATUS+1,fil) != MAXSTATUS+1) goto corrupt;
if (kdfread(&prevspritestat[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt; if (kdfread(&prevspritestat[STAT_DEFAULT],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&nextspritestat[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt; if (kdfread(&nextspritestat[STAT_DEFAULT],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&numcyclers,sizeof(numcyclers),1,fil) != 1) goto corrupt; if (kdfread(&g_numCyclers,sizeof(g_numCyclers),1,fil) != 1) goto corrupt;
if (kdfread(&cyclers[0][0],12,MAXCYCLERS,fil) != MAXCYCLERS) goto corrupt; if (kdfread(&cyclers[0][0],12,MAXCYCLERS,fil) != MAXCYCLERS) goto corrupt;
for (i=0;i<nump;i++) for (i=0;i<nump;i++)
if (kdfread(g_player[i].ps,sizeof(player_struct),1,fil) != 1) goto corrupt; if (kdfread(g_player[i].ps,sizeof(DukePlayer_t),1,fil) != 1) goto corrupt;
if (kdfread(&g_PlayerSpawnPoints,sizeof(g_PlayerSpawnPoints),1,fil) != 1) goto corrupt; if (kdfread(&g_playerSpawnPoints,sizeof(g_playerSpawnPoints),1,fil) != 1) goto corrupt;
if (kdfread(&numanimwalls,sizeof(numanimwalls),1,fil) != 1) goto corrupt; if (kdfread(&g_numAnimWalls,sizeof(g_numAnimWalls),1,fil) != 1) goto corrupt;
if (kdfread(&animwall,sizeof(animwall),1,fil) != 1) goto corrupt; if (kdfread(&animwall,sizeof(animwall),1,fil) != 1) goto corrupt;
if (kdfread(&msx[0],sizeof(int),sizeof(msx)/sizeof(int),fil) != sizeof(msx)/sizeof(int)) goto corrupt; if (kdfread(&msx[0],sizeof(int),sizeof(msx)/sizeof(int),fil) != sizeof(msx)/sizeof(int)) goto corrupt;
if (kdfread(&msy[0],sizeof(int),sizeof(msy)/sizeof(int),fil) != sizeof(msy)/sizeof(int)) goto corrupt; if (kdfread(&msy[0],sizeof(int),sizeof(msy)/sizeof(int),fil) != sizeof(msy)/sizeof(int)) goto corrupt;
if (kdfread((short *)&spriteqloc,sizeof(short),1,fil) != 1) goto corrupt; if (kdfread((short *)&g_spriteDeleteQueuePos,sizeof(short),1,fil) != 1) goto corrupt;
if (kdfread((short *)&spriteqamount,sizeof(short),1,fil) != 1) goto corrupt; if (kdfread((short *)&g_spriteDeleteQueueSize,sizeof(short),1,fil) != 1) goto corrupt;
if (kdfread((short *)&spriteq[0],sizeof(short),spriteqamount,fil) != spriteqamount) goto corrupt; if (kdfread((short *)&SpriteDeletionQueue[0],sizeof(short),g_spriteDeleteQueueSize,fil) != g_spriteDeleteQueueSize) goto corrupt;
if (kdfread(&mirrorcnt,sizeof(short),1,fil) != 1) goto corrupt; if (kdfread(&g_mirrorCount,sizeof(short),1,fil) != 1) goto corrupt;
if (kdfread(&mirrorwall[0],sizeof(short),64,fil) != 64) goto corrupt; if (kdfread(&g_mirrorWall[0],sizeof(short),64,fil) != 64) goto corrupt;
if (kdfread(&mirrorsector[0],sizeof(short),64,fil) != 64) goto corrupt; if (kdfread(&g_mirrorSector[0],sizeof(short),64,fil) != 64) goto corrupt;
if (kdfread(&show2dsector[0],sizeof(char),MAXSECTORS>>3,fil) != (MAXSECTORS>>3)) goto corrupt; if (kdfread(&show2dsector[0],sizeof(char),MAXSECTORS>>3,fil) != (MAXSECTORS>>3)) goto corrupt;
if (kdfread(&actortype[0],sizeof(char),MAXTILES,fil) != MAXTILES) goto corrupt; if (kdfread(&ActorType[0],sizeof(char),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&numclouds,sizeof(numclouds),1,fil) != 1) goto corrupt; if (kdfread(&g_numClouds,sizeof(g_numClouds),1,fil) != 1) goto corrupt;
if (kdfread(&clouds[0],sizeof(short)<<7,1,fil) != 1) goto corrupt; if (kdfread(&clouds[0],sizeof(short)<<7,1,fil) != 1) goto corrupt;
if (kdfread(&cloudx[0],sizeof(short)<<7,1,fil) != 1) goto corrupt; if (kdfread(&cloudx[0],sizeof(short)<<7,1,fil) != 1) goto corrupt;
if (kdfread(&cloudy[0],sizeof(short)<<7,1,fil) != 1) goto corrupt; if (kdfread(&cloudy[0],sizeof(short)<<7,1,fil) != 1) goto corrupt;
if (kdfread(&g_ScriptSize,sizeof(g_ScriptSize),1,fil) != 1) goto corrupt; if (kdfread(&g_scriptSize,sizeof(g_scriptSize),1,fil) != 1) goto corrupt;
if (!g_ScriptSize) goto corrupt; if (!g_scriptSize) goto corrupt;
scriptptrs = Bcalloc(1,g_ScriptSize * sizeof(scriptptrs)); scriptptrs = Bcalloc(1,g_scriptSize * sizeof(scriptptrs));
Bfree(bitptr); Bfree(bitptr);
bitptr = Bcalloc(1,(((g_ScriptSize+7)>>3)+1) * sizeof(char)); bitptr = Bcalloc(1,(((g_scriptSize+7)>>3)+1) * sizeof(char));
if (kdfread(&bitptr[0],sizeof(char),(g_ScriptSize+7)>>3,fil) != ((g_ScriptSize+7)>>3)) goto corrupt; if (kdfread(&bitptr[0],sizeof(char),(g_scriptSize+7)>>3,fil) != ((g_scriptSize+7)>>3)) goto corrupt;
if (script != NULL) if (script != NULL)
Bfree(script); Bfree(script);
script = Bcalloc(1,g_ScriptSize * sizeof(intptr_t)); script = Bcalloc(1,g_scriptSize * sizeof(intptr_t));
if (kdfread(&script[0],sizeof(script),g_ScriptSize,fil) != g_ScriptSize) goto corrupt; if (kdfread(&script[0],sizeof(script),g_scriptSize,fil) != g_scriptSize) goto corrupt;
for (i=0;i<g_ScriptSize;i++) for (i=0;i<g_scriptSize;i++)
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7))) if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
{ {
j = (intptr_t)script[i]+(intptr_t)&script[0]; j = (intptr_t)script[i]+(intptr_t)&script[0];
@ -309,7 +309,7 @@ int loadplayer(int spot)
scriptptrs = Brealloc(scriptptrs, MAXSPRITES * sizeof(scriptptrs)); scriptptrs = Brealloc(scriptptrs, MAXSPRITES * sizeof(scriptptrs));
if (kdfread(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil) != MAXSPRITES) goto corrupt; if (kdfread(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&hittype[0],sizeof(actordata_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt; if (kdfread(&ActorExtra[0],sizeof(actordata_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
for (i=0;i<MAXSPRITES;i++) for (i=0;i<MAXSPRITES;i++)
{ {
@ -323,14 +323,14 @@ int loadplayer(int spot)
if (kdfread(&pskybits,sizeof(pskybits),1,fil) != 1) goto corrupt; if (kdfread(&pskybits,sizeof(pskybits),1,fil) != 1) goto corrupt;
if (kdfread(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil) != MAXPSKYTILES) goto corrupt; if (kdfread(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil) != MAXPSKYTILES) goto corrupt;
if (kdfread(&animatecnt,sizeof(animatecnt),1,fil) != 1) goto corrupt; if (kdfread(&g_animateCount,sizeof(g_animateCount),1,fil) != 1) goto corrupt;
if (kdfread(&animatesect[0],2,MAXANIMATES,fil) != MAXANIMATES) goto corrupt; if (kdfread(&animatesect[0],2,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
if (kdfread(&animateptr[0],sizeof(int),MAXANIMATES,fil) != MAXANIMATES) goto corrupt; if (kdfread(&animateptr[0],sizeof(int),MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
for (i = animatecnt-1;i>=0;i--) animateptr[i] = (int *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0])); for (i = g_animateCount-1;i>=0;i--) animateptr[i] = (int *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0]));
if (kdfread(&animategoal[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt; if (kdfread(&animategoal[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
if (kdfread(&animatevel[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt; if (kdfread(&animatevel[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
if (kdfread(&earthquaketime,sizeof(earthquaketime),1,fil) != 1) goto corrupt; if (kdfread(&g_earthquakeTime,sizeof(g_earthquakeTime),1,fil) != 1) goto corrupt;
if (kdfread(&ud.from_bonus,sizeof(ud.from_bonus),1,fil) != 1) goto corrupt; if (kdfread(&ud.from_bonus,sizeof(ud.from_bonus),1,fil) != 1) goto corrupt;
if (kdfread(&ud.secretlevel,sizeof(ud.secretlevel),1,fil) != 1) goto corrupt; if (kdfread(&ud.secretlevel,sizeof(ud.secretlevel),1,fil) != 1) goto corrupt;
if (kdfread(&ud.respawn_monsters,sizeof(ud.respawn_monsters),1,fil) != 1) goto corrupt; if (kdfread(&ud.respawn_monsters,sizeof(ud.respawn_monsters),1,fil) != 1) goto corrupt;
@ -358,75 +358,75 @@ int loadplayer(int spot)
if (kdfread(&camsprite,sizeof(camsprite),1,fil) != 1) goto corrupt; if (kdfread(&camsprite,sizeof(camsprite),1,fil) != 1) goto corrupt;
if (kdfread(&connecthead,sizeof(connecthead),1,fil) != 1) goto corrupt; if (kdfread(&connecthead,sizeof(connecthead),1,fil) != 1) goto corrupt;
if (kdfread(connectpoint2,sizeof(connectpoint2),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(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil) != 1) goto corrupt;
for (i=0;i<MAXPLAYERS;i++) 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((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(&randomseed,sizeof(randomseed),1,fil) != 1) goto corrupt;
if (kdfread(&global_random,sizeof(global_random),1,fil) != 1) goto corrupt; if (kdfread(&g_globalRandom,sizeof(g_globalRandom),1,fil) != 1) goto corrupt;
if (kdfread(&parallaxyscale,sizeof(parallaxyscale),1,fil) != 1) goto corrupt; if (kdfread(&parallaxyscale,sizeof(parallaxyscale),1,fil) != 1) goto corrupt;
if (kdfread(&projectile[0],sizeof(projectile_t),MAXTILES,fil) != MAXTILES) goto corrupt; if (kdfread(&ProjectileData[0],sizeof(projectile_t),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&defaultprojectile[0],sizeof(projectile_t),MAXTILES,fil) != MAXTILES) goto corrupt; if (kdfread(&DefaultProjectileData[0],sizeof(projectile_t),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&spriteflags[0],sizeof(spriteflags[0]),MAXTILES,fil) != MAXTILES) goto corrupt; if (kdfread(&SpriteFlags[0],sizeof(SpriteFlags[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&spritecache[0],sizeof(spritecache[0]),MAXTILES,fil) != MAXTILES) goto corrupt; if (kdfread(&SpriteCacheList[0],sizeof(SpriteCacheList[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&i,sizeof(int),1,fil) != 1) goto corrupt; if (kdfread(&i,sizeof(int),1,fil) != 1) goto corrupt;
while (i != MAXQUOTES) while (i != MAXQUOTES)
{ {
if (fta_quotes[i] != NULL) if (ScriptQuotes[i] != NULL)
Bfree(fta_quotes[i]); Bfree(ScriptQuotes[i]);
fta_quotes[i] = Bcalloc(MAXQUOTELEN,sizeof(char)); ScriptQuotes[i] = Bcalloc(MAXQUOTELEN,sizeof(char));
if (kdfread((char *)fta_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt; if (kdfread((char *)ScriptQuotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
if (kdfread(&i,sizeof(int),1,fil) != 1) goto corrupt; if (kdfread(&i,sizeof(int),1,fil) != 1) goto corrupt;
} }
if (kdfread(&redefined_quote_count,sizeof(redefined_quote_count),1,fil) != 1) goto corrupt; if (kdfread(&g_numQuoteRedefinitions,sizeof(g_numQuoteRedefinitions),1,fil) != 1) goto corrupt;
for (i=0;i<redefined_quote_count;i++) for (i=0;i<g_numQuoteRedefinitions;i++)
{ {
if (redefined_quotes[i] != NULL) if (ScriptQuoteRedefinitions[i] != NULL)
Bfree(redefined_quotes[i]); Bfree(ScriptQuoteRedefinitions[i]);
redefined_quotes[i] = Bcalloc(MAXQUOTELEN,sizeof(char)); ScriptQuoteRedefinitions[i] = Bcalloc(MAXQUOTELEN,sizeof(char));
if (kdfread((char *)redefined_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt; if (kdfread((char *)ScriptQuoteRedefinitions[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
} }
if (kdfread(&dynamictostatic[0],sizeof(dynamictostatic[0]),MAXTILES,fil) != MAXTILES) goto corrupt; if (kdfread(&DynamicTileMap[0],sizeof(DynamicTileMap[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&ud.noexits,sizeof(ud.noexits),1,fil) != 1) goto corrupt; if (kdfread(&ud.noexits,sizeof(ud.noexits),1,fil) != 1) goto corrupt;
ud.m_noexits = ud.noexits; ud.m_noexits = ud.noexits;
if (ReadGameVars(fil)) goto corrupt; if (Gv_ReadSave(fil)) goto corrupt;
kclose(fil); kclose(fil);
if (g_player[myconnectindex].ps->over_shoulder_on != 0) if (g_player[myconnectindex].ps->over_shoulder_on != 0)
{ {
cameradist = 0; g_cameraDistance = 0;
cameraclock = 0; g_cameraClock = 0;
g_player[myconnectindex].ps->over_shoulder_on = 1; g_player[myconnectindex].ps->over_shoulder_on = 1;
} }
screenpeek = myconnectindex; screenpeek = myconnectindex;
clearbufbyte(gotpic,sizeof(gotpic),0L); clearbufbyte(gotpic,sizeof(gotpic),0L);
clearsoundlocks(); S_ClearSoundLocks();
cacheit(); G_CacheMapData();
i = music_select; i = g_musicIndex;
music_select = (ud.volume_number*MAXLEVELS) + ud.level_number; g_musicIndex = (ud.volume_number*MAXLEVELS) + ud.level_number;
if (map[(unsigned char)music_select].musicfn != NULL && (i != music_select || map[MAXVOLUMES*MAXLEVELS+2].musicfn1)) if (MapInfo[(unsigned char)g_musicIndex].musicfn != NULL && (i != g_musicIndex || MapInfo[MAXVOLUMES*MAXLEVELS+2].musicfn1))
{ {
MUSIC_StopSong(); MUSIC_StopSong();
playmusic(&map[(unsigned char)music_select].musicfn[0],music_select); S_PlayMusic(&MapInfo[(unsigned char)g_musicIndex].musicfn[0],g_musicIndex);
} }
MUSIC_Continue(); MUSIC_Continue();
@ -434,24 +434,24 @@ int loadplayer(int spot)
ud.recstat = 0; ud.recstat = 0;
if (g_player[myconnectindex].ps->jetpack_on) if (g_player[myconnectindex].ps->jetpack_on)
spritesound(DUKE_JETPACK_IDLE,g_player[myconnectindex].ps->i); A_PlaySound(DUKE_JETPACK_IDLE,g_player[myconnectindex].ps->i);
restorepalette = 1; g_restorePalette = 1;
setpal(g_player[myconnectindex].ps); P_UpdateScreenPal(g_player[myconnectindex].ps);
vscrn(); G_UpdateScreenArea();
FX_SetReverb(0); FX_SetReverb(0);
if (ud.lockout == 0) if (ud.lockout == 0)
{ {
for (x=0;x<numanimwalls;x++) for (x=0;x<g_numAnimWalls;x++)
if (wall[animwall[x].wallnum].extra >= 0) if (wall[animwall[x].wallnum].extra >= 0)
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
} }
else else
{ {
for (x=0;x<numanimwalls;x++) for (x=0;x<g_numAnimWalls;x++)
switch (dynamictostatic[wall[animwall[x].wallnum].picnum]) switch (DynamicTileMap[wall[animwall[x].wallnum].picnum])
{ {
case FEMPIC1__STATIC: case FEMPIC1__STATIC:
wall[animwall[x].wallnum].picnum = BLANKSCREEN; wall[animwall[x].wallnum].picnum = BLANKSCREEN;
@ -463,27 +463,27 @@ int loadplayer(int spot)
} }
} }
numinterpolations = 0; g_numInterpolations = 0;
startofdynamicinterpolations = 0; startofdynamicinterpolations = 0;
k = headspritestat[3]; k = headspritestat[STAT_EFFECTOR];
while (k >= 0) while (k >= 0)
{ {
switch (sprite[k].lotag) switch (sprite[k].lotag)
{ {
case 31: case 31:
setinterpolation(&sector[sprite[k].sectnum].floorz); G_SetInterpolation(&sector[sprite[k].sectnum].floorz);
break; break;
case 32: case 32:
setinterpolation(&sector[sprite[k].sectnum].ceilingz); G_SetInterpolation(&sector[sprite[k].sectnum].ceilingz);
break; break;
case 25: case 25:
setinterpolation(&sector[sprite[k].sectnum].floorz); G_SetInterpolation(&sector[sprite[k].sectnum].floorz);
setinterpolation(&sector[sprite[k].sectnum].ceilingz); G_SetInterpolation(&sector[sprite[k].sectnum].ceilingz);
break; break;
case 17: case 17:
setinterpolation(&sector[sprite[k].sectnum].floorz); G_SetInterpolation(&sector[sprite[k].sectnum].floorz);
setinterpolation(&sector[sprite[k].sectnum].ceilingz); G_SetInterpolation(&sector[sprite[k].sectnum].ceilingz);
break; break;
case 0: case 0:
case 5: case 5:
@ -494,18 +494,18 @@ int loadplayer(int spot)
case 16: case 16:
case 26: case 26:
case 30: case 30:
setsectinterpolate(k); Sect_SetInterpolation(k);
break; break;
} }
k = nextspritestat[k]; k = nextspritestat[k];
} }
for (i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i]; for (i=g_numInterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
for (i = animatecnt-1;i>=0;i--) for (i = g_animateCount-1;i>=0;i--)
setinterpolation(animateptr[i]); G_SetInterpolation(animateptr[i]);
show_shareware = 0; g_showShareware = 0;
everyothertime = 0; everyothertime = 0;
// clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101); // clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101);
@ -513,7 +513,7 @@ int loadplayer(int spot)
for (i=0;i<MAXPLAYERS;i++) for (i=0;i<MAXPLAYERS;i++)
clearbufbyte(&g_player[i].playerquitflag,1,0x01010101); clearbufbyte(&g_player[i].playerquitflag,1,0x01010101);
resetmys(); Net_ResetPrediction();
ready2send = 1; ready2send = 1;
@ -521,16 +521,16 @@ int loadplayer(int spot)
clearfifo(); clearfifo();
waitforeverybody(); waitforeverybody();
resettimevars(); G_ResetTimers();
return(0); return(0);
corrupt: corrupt:
Bsprintf(tempbuf,"Save game file \"%s\" is corrupt or of the wrong version.",fnptr); Bsprintf(tempbuf,"Save game file \"%s\" is corrupt or of the wrong version.",fnptr);
gameexit(tempbuf); G_GameExit(tempbuf);
return -1; return -1;
} }
int saveplayer(int spot) int G_SavePlayer(int spot)
{ {
int i; int i;
intptr_t j; intptr_t j;
@ -624,35 +624,35 @@ int saveplayer(int spot)
dfwrite(&headspritesect[0],2,MAXSECTORS+1,fil); dfwrite(&headspritesect[0],2,MAXSECTORS+1,fil);
dfwrite(&prevspritesect[0],2,MAXSPRITES,fil); dfwrite(&prevspritesect[0],2,MAXSPRITES,fil);
dfwrite(&nextspritesect[0],2,MAXSPRITES,fil); dfwrite(&nextspritesect[0],2,MAXSPRITES,fil);
dfwrite(&headspritestat[0],2,MAXSTATUS+1,fil); dfwrite(&headspritestat[STAT_DEFAULT],2,MAXSTATUS+1,fil);
dfwrite(&prevspritestat[0],2,MAXSPRITES,fil); dfwrite(&prevspritestat[STAT_DEFAULT],2,MAXSPRITES,fil);
dfwrite(&nextspritestat[0],2,MAXSPRITES,fil); dfwrite(&nextspritestat[STAT_DEFAULT],2,MAXSPRITES,fil);
dfwrite(&numcyclers,sizeof(numcyclers),1,fil); dfwrite(&g_numCyclers,sizeof(g_numCyclers),1,fil);
dfwrite(&cyclers[0][0],12,MAXCYCLERS,fil); dfwrite(&cyclers[0][0],12,MAXCYCLERS,fil);
for (i=0;i<ud.multimode;i++) for (i=0;i<ud.multimode;i++)
dfwrite(g_player[i].ps,sizeof(player_struct),1,fil); dfwrite(g_player[i].ps,sizeof(DukePlayer_t),1,fil);
dfwrite(&g_PlayerSpawnPoints,sizeof(g_PlayerSpawnPoints),1,fil); dfwrite(&g_playerSpawnPoints,sizeof(g_playerSpawnPoints),1,fil);
dfwrite(&numanimwalls,sizeof(numanimwalls),1,fil); dfwrite(&g_numAnimWalls,sizeof(g_numAnimWalls),1,fil);
dfwrite(&animwall,sizeof(animwall),1,fil); dfwrite(&animwall,sizeof(animwall),1,fil);
dfwrite(&msx[0],sizeof(int),sizeof(msx)/sizeof(int),fil); dfwrite(&msx[0],sizeof(int),sizeof(msx)/sizeof(int),fil);
dfwrite(&msy[0],sizeof(int),sizeof(msy)/sizeof(int),fil); dfwrite(&msy[0],sizeof(int),sizeof(msy)/sizeof(int),fil);
dfwrite(&spriteqloc,sizeof(short),1,fil); dfwrite(&g_spriteDeleteQueuePos,sizeof(short),1,fil);
dfwrite(&spriteqamount,sizeof(short),1,fil); dfwrite(&g_spriteDeleteQueueSize,sizeof(short),1,fil);
dfwrite(&spriteq[0],sizeof(short),spriteqamount,fil); dfwrite(&SpriteDeletionQueue[0],sizeof(short),g_spriteDeleteQueueSize,fil);
dfwrite(&mirrorcnt,sizeof(short),1,fil); dfwrite(&g_mirrorCount,sizeof(short),1,fil);
dfwrite(&mirrorwall[0],sizeof(short),64,fil); dfwrite(&g_mirrorWall[0],sizeof(short),64,fil);
dfwrite(&mirrorsector[0],sizeof(short),64,fil); dfwrite(&g_mirrorSector[0],sizeof(short),64,fil);
dfwrite(&show2dsector[0],sizeof(char),MAXSECTORS>>3,fil); dfwrite(&show2dsector[0],sizeof(char),MAXSECTORS>>3,fil);
dfwrite(&actortype[0],sizeof(char),MAXTILES,fil); dfwrite(&ActorType[0],sizeof(char),MAXTILES,fil);
dfwrite(&numclouds,sizeof(numclouds),1,fil); dfwrite(&g_numClouds,sizeof(g_numClouds),1,fil);
dfwrite(&clouds[0],sizeof(short)<<7,1,fil); dfwrite(&clouds[0],sizeof(short)<<7,1,fil);
dfwrite(&cloudx[0],sizeof(short)<<7,1,fil); dfwrite(&cloudx[0],sizeof(short)<<7,1,fil);
dfwrite(&cloudy[0],sizeof(short)<<7,1,fil); dfwrite(&cloudy[0],sizeof(short)<<7,1,fil);
dfwrite(&g_ScriptSize,sizeof(g_ScriptSize),1,fil); dfwrite(&g_scriptSize,sizeof(g_scriptSize),1,fil);
scriptptrs = Bcalloc(1, g_ScriptSize * sizeof(scriptptrs)); scriptptrs = Bcalloc(1, g_scriptSize * sizeof(scriptptrs));
for (i=0;i<g_ScriptSize;i++) for (i=0;i<g_scriptSize;i++)
{ {
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7))) if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
{ {
@ -663,11 +663,11 @@ int saveplayer(int spot)
// else scriptptrs[i] = 0; // else scriptptrs[i] = 0;
} }
// dfwrite(&scriptptrs[0],sizeof(scriptptrs),g_ScriptSize,fil); // dfwrite(&scriptptrs[0],sizeof(scriptptrs),g_scriptSize,fil);
dfwrite(&bitptr[0],sizeof(char),(g_ScriptSize+7)>>3,fil); dfwrite(&bitptr[0],sizeof(char),(g_scriptSize+7)>>3,fil);
dfwrite(&script[0],sizeof(script),g_ScriptSize,fil); dfwrite(&script[0],sizeof(script),g_scriptSize,fil);
for (i=0;i<g_ScriptSize;i++) for (i=0;i<g_scriptSize;i++)
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7))) if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
{ {
j = script[i]+(intptr_t)&script[0]; j = script[i]+(intptr_t)&script[0];
@ -713,17 +713,17 @@ int saveplayer(int spot)
j = (intptr_t)&script[0]; j = (intptr_t)&script[0];
if (T2 >= j && T2 < (intptr_t)(&script[g_ScriptSize])) if (T2 >= j && T2 < (intptr_t)(&script[g_scriptSize]))
{ {
scriptptrs[i] |= 1; scriptptrs[i] |= 1;
T2 -= j; T2 -= j;
} }
if (T5 >= j && T5 < (intptr_t)(&script[g_ScriptSize])) if (T5 >= j && T5 < (intptr_t)(&script[g_scriptSize]))
{ {
scriptptrs[i] |= 2; scriptptrs[i] |= 2;
T5 -= j; T5 -= j;
} }
if (T6 >= j && T6 < (intptr_t)(&script[g_ScriptSize])) if (T6 >= j && T6 < (intptr_t)(&script[g_scriptSize]))
{ {
scriptptrs[i] |= 4; scriptptrs[i] |= 4;
T6 -= j; T6 -= j;
@ -731,7 +731,7 @@ int saveplayer(int spot)
} }
dfwrite(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil); dfwrite(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil);
dfwrite(&hittype[0],sizeof(actordata_t),MAXSPRITES,fil); dfwrite(&ActorExtra[0],sizeof(actordata_t),MAXSPRITES,fil);
for (i=0;i<MAXSPRITES;i++) for (i=0;i<MAXSPRITES;i++)
{ {
@ -749,15 +749,15 @@ int saveplayer(int spot)
dfwrite(&lockclock,sizeof(lockclock),1,fil); dfwrite(&lockclock,sizeof(lockclock),1,fil);
dfwrite(&pskybits,sizeof(pskybits),1,fil); dfwrite(&pskybits,sizeof(pskybits),1,fil);
dfwrite(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil); dfwrite(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil);
dfwrite(&animatecnt,sizeof(animatecnt),1,fil); dfwrite(&g_animateCount,sizeof(g_animateCount),1,fil);
dfwrite(&animatesect[0],2,MAXANIMATES,fil); dfwrite(&animatesect[0],2,MAXANIMATES,fil);
for (i = animatecnt-1;i>=0;i--) animateptr[i] = (int *)((intptr_t)animateptr[i]-(intptr_t)(&sector[0])); for (i = g_animateCount-1;i>=0;i--) animateptr[i] = (int *)((intptr_t)animateptr[i]-(intptr_t)(&sector[0]));
dfwrite(&animateptr[0],4,MAXANIMATES,fil); dfwrite(&animateptr[0],4,MAXANIMATES,fil);
for (i = animatecnt-1;i>=0;i--) animateptr[i] = (int *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0])); for (i = g_animateCount-1;i>=0;i--) animateptr[i] = (int *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0]));
dfwrite(&animategoal[0],4,MAXANIMATES,fil); dfwrite(&animategoal[0],4,MAXANIMATES,fil);
dfwrite(&animatevel[0],4,MAXANIMATES,fil); dfwrite(&animatevel[0],4,MAXANIMATES,fil);
dfwrite(&earthquaketime,sizeof(earthquaketime),1,fil); dfwrite(&g_earthquakeTime,sizeof(g_earthquakeTime),1,fil);
dfwrite(&ud.from_bonus,sizeof(ud.from_bonus),1,fil); dfwrite(&ud.from_bonus,sizeof(ud.from_bonus),1,fil);
dfwrite(&ud.secretlevel,sizeof(ud.secretlevel),1,fil); dfwrite(&ud.secretlevel,sizeof(ud.secretlevel),1,fil);
dfwrite(&ud.respawn_monsters,sizeof(ud.respawn_monsters),1,fil); dfwrite(&ud.respawn_monsters,sizeof(ud.respawn_monsters),1,fil);
@ -775,50 +775,50 @@ int saveplayer(int spot)
dfwrite(&camsprite,sizeof(camsprite),1,fil); dfwrite(&camsprite,sizeof(camsprite),1,fil);
dfwrite(&connecthead,sizeof(connecthead),1,fil); dfwrite(&connecthead,sizeof(connecthead),1,fil);
dfwrite(connectpoint2,sizeof(connectpoint2),1,fil); dfwrite(connectpoint2,sizeof(connectpoint2),1,fil);
dfwrite(&numplayersprites,sizeof(numplayersprites),1,fil); dfwrite(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil);
for (i=0;i<MAXPLAYERS;i++) for (i=0;i<MAXPLAYERS;i++)
dfwrite((short *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil); dfwrite((short *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil);
dfwrite(&randomseed,sizeof(randomseed),1,fil); dfwrite(&randomseed,sizeof(randomseed),1,fil);
dfwrite(&global_random,sizeof(global_random),1,fil); dfwrite(&g_globalRandom,sizeof(g_globalRandom),1,fil);
dfwrite(&parallaxyscale,sizeof(parallaxyscale),1,fil); dfwrite(&parallaxyscale,sizeof(parallaxyscale),1,fil);
dfwrite(&projectile[0],sizeof(projectile_t),MAXTILES,fil); dfwrite(&ProjectileData[0],sizeof(projectile_t),MAXTILES,fil);
dfwrite(&defaultprojectile[0],sizeof(projectile_t),MAXTILES,fil); dfwrite(&DefaultProjectileData[0],sizeof(projectile_t),MAXTILES,fil);
dfwrite(&spriteflags[0],sizeof(spriteflags[0]),MAXTILES,fil); dfwrite(&SpriteFlags[0],sizeof(SpriteFlags[0]),MAXTILES,fil);
dfwrite(&spritecache[0],sizeof(spritecache[0]),MAXTILES,fil); dfwrite(&SpriteCacheList[0],sizeof(SpriteCacheList[0]),MAXTILES,fil);
for (i=0;i<MAXQUOTES;i++) for (i=0;i<MAXQUOTES;i++)
{ {
if (fta_quotes[i] != NULL) if (ScriptQuotes[i] != NULL)
{ {
dfwrite(&i,sizeof(int),1,fil); dfwrite(&i,sizeof(int),1,fil);
dfwrite(fta_quotes[i],MAXQUOTELEN, 1, fil); dfwrite(ScriptQuotes[i],MAXQUOTELEN, 1, fil);
} }
} }
dfwrite(&i,sizeof(int),1,fil); dfwrite(&i,sizeof(int),1,fil);
dfwrite(&redefined_quote_count,sizeof(redefined_quote_count),1,fil); dfwrite(&g_numQuoteRedefinitions,sizeof(g_numQuoteRedefinitions),1,fil);
for (i=0;i<redefined_quote_count;i++) for (i=0;i<g_numQuoteRedefinitions;i++)
{ {
if (redefined_quotes[i] != NULL) if (ScriptQuoteRedefinitions[i] != NULL)
dfwrite(redefined_quotes[i],MAXQUOTELEN, 1, fil); dfwrite(ScriptQuoteRedefinitions[i],MAXQUOTELEN, 1, fil);
} }
dfwrite(&dynamictostatic[0],sizeof(dynamictostatic[0]),MAXTILES,fil); dfwrite(&DynamicTileMap[0],sizeof(DynamicTileMap[0]),MAXTILES,fil);
dfwrite(&ud.noexits,sizeof(ud.noexits),1,fil); dfwrite(&ud.noexits,sizeof(ud.noexits),1,fil);
SaveGameVars(fil); Gv_WriteSave(fil);
fclose(fil); fclose(fil);
if (ud.multimode < 2) if (ud.multimode < 2)
{ {
strcpy(fta_quotes[122],"GAME SAVED"); strcpy(ScriptQuotes[122],"GAME SAVED");
FTA(122,g_player[myconnectindex].ps); P_DoQuote(122,g_player[myconnectindex].ps);
} }
ready2send = 1; ready2send = 1;

File diff suppressed because it is too large Load diff

View file

@ -40,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define LOUDESTVOLUME 150 #define LOUDESTVOLUME 150
int backflag,numenvsnds; int backflag,g_numEnvSoundsPlaying;
/* /*
=================== ===================
@ -50,7 +50,7 @@ int backflag,numenvsnds;
=================== ===================
*/ */
void SoundStartup(void) void S_SoundStartup(void)
{ {
int status; int status;
@ -65,13 +65,13 @@ void SoundStartup(void)
{ {
FX_SetReverseStereo(!FX_GetReverseStereo()); FX_SetReverseStereo(!FX_GetReverseStereo());
} }
status = FX_SetCallBack(testcallback); status = FX_SetCallBack(S_TestSoundCallback);
} }
if (status != FX_Ok) if (status != FX_Ok)
{ {
sprintf(tempbuf, "Sound startup error: %s", FX_ErrorString(FX_Error)); sprintf(tempbuf, "Sound startup error: %s", FX_ErrorString(FX_Error));
gameexit(tempbuf); G_GameExit(tempbuf);
} }
} }
@ -83,7 +83,7 @@ void SoundStartup(void)
=================== ===================
*/ */
void SoundShutdown(void) void S_SoundShutdown(void)
{ {
int status; int status;
@ -95,7 +95,7 @@ void SoundShutdown(void)
if (status != FX_Ok) if (status != FX_Ok)
{ {
sprintf(tempbuf, "Sound shutdown error: %s", FX_ErrorString(FX_Error)); sprintf(tempbuf, "Sound shutdown error: %s", FX_ErrorString(FX_Error));
gameexit(tempbuf); G_GameExit(tempbuf);
} }
} }
@ -107,7 +107,7 @@ void SoundShutdown(void)
=================== ===================
*/ */
void MusicStartup(void) void S_MusicStartup(void)
{ {
int status; int status;
@ -125,7 +125,7 @@ void MusicStartup(void)
{ {
initprintf("Couldn't find selected sound card, or, error w/ sound card itself.\n"); initprintf("Couldn't find selected sound card, or, error w/ sound card itself.\n");
SoundShutdown(); S_SoundShutdown();
uninittimer(); uninittimer();
uninitengine(); uninitengine();
CONTROL_Shutdown(); CONTROL_Shutdown();
@ -145,7 +145,7 @@ void MusicStartup(void)
=================== ===================
*/ */
void MusicShutdown(void) void S_MusicShutdown(void)
{ {
int status; int status;
@ -165,11 +165,10 @@ void MusicUpdate(void)
MUSIC_Update(); MUSIC_Update();
} }
unsigned char menunum=0; void S_MenuSound(void)
void intomenusounds(void)
{ {
short menusnds[] = static int SoundNum=0;
static short menusnds[] =
{ {
LASERTRIP_EXPLODE, LASERTRIP_EXPLODE,
DUKE_GRUNT, DUKE_GRUNT,
@ -189,8 +188,8 @@ void intomenusounds(void)
RPG_SHOOT, RPG_SHOOT,
SELECT_WEAPON SELECT_WEAPON
}; };
sound(menusnds[menunum++]); S_PlaySound(menusnds[SoundNum++]);
menunum %= 17; SoundNum %= 17;
} }
void _playmusic(const char *fn) void _playmusic(const char *fn)
@ -198,7 +197,7 @@ void _playmusic(const char *fn)
#if defined(_WIN32) #if defined(_WIN32)
int fp, l; int fp, l;
#else #else
extern void PlayMusic(char *_filename); extern void MUSIC_PlayMusic(char *_filename);
#endif #endif
if (fn == NULL) return; if (fn == NULL) return;
@ -224,15 +223,15 @@ void _playmusic(const char *fn)
#else #else
// FIXME: I need this to get the music volume initialized (not sure why) -- Jim Bentler // FIXME: I need this to get the music volume initialized (not sure why) -- Jim Bentler
MUSIC_SetVolume(ud.config.MusicVolume); MUSIC_SetVolume(ud.config.MusicVolume);
PlayMusic((char *)fn); MUSIC_PlayMusic((char *)fn);
#endif #endif
} }
int playmusic(const char *fn, const int sel) int S_PlayMusic(const char *fn, const int sel)
{ {
Musicsize=0; Musicsize=0;
if (map[sel].musicfn1 != NULL) if (MapInfo[sel].musicfn1 != NULL)
_playmusic(map[sel].musicfn1); _playmusic(MapInfo[sel].musicfn1);
if (!Musicsize) if (!Musicsize)
{ {
_playmusic(fn); _playmusic(fn);
@ -241,7 +240,7 @@ int playmusic(const char *fn, const int sel)
return 1; return 1;
} }
int loadsound(unsigned int num) int S_LoadSound(unsigned int num)
{ {
int fp = -1, l; int fp = -1, l;
@ -254,13 +253,13 @@ int loadsound(unsigned int num)
return 0; return 0;
} }
if (g_sounds[num].filename1)fp = kopen4loadfrommod(g_sounds[num].filename1,loadfromgrouponly); if (g_sounds[num].filename1)fp = kopen4loadfrommod(g_sounds[num].filename1,g_loadFromGroupOnly);
if (fp == -1)fp = kopen4loadfrommod(g_sounds[num].filename,loadfromgrouponly); if (fp == -1)fp = kopen4loadfrommod(g_sounds[num].filename,g_loadFromGroupOnly);
if (fp == -1) if (fp == -1)
{ {
// Bsprintf(fta_quotes[113],"g_sounds %s(#%d) not found.",sounds[num],num); // Bsprintf(ScriptQuotes[113],"g_sounds %s(#%d) not found.",sounds[num],num);
// FTA(113,g_player[myconnectindex].ps); // P_DoQuote(113,g_player[myconnectindex].ps);
OSD_Printf(OSDTEXT_RED "Sound %s(#%d) not found.\n",g_sounds[num].filename,num); OSD_Printf(OSDTEXT_RED "Sound %s(#%d) not found!\n",g_sounds[num].filename,num);
return 0; return 0;
} }
@ -275,7 +274,7 @@ int loadsound(unsigned int num)
return 1; return 1;
} }
int xyzsound(int num,int i,int x,int y,int z) int S_PlaySoundXYZ(int num,int i,int x,int y,int z)
{ {
int sndist, cx, cy, cz, j,k; int sndist, cx, cy, cz, j,k;
int pitche,pitchs,cs; int pitche,pitchs,cs;
@ -294,7 +293,7 @@ int xyzsound(int num,int i,int x,int y,int z)
if (g_sounds[num].m&128) if (g_sounds[num].m&128)
{ {
sound(num); S_PlaySound(num);
return 0; return 0;
} }
@ -363,9 +362,9 @@ int xyzsound(int num,int i,int x,int y,int z)
if (g_sounds[num].num > 0 && PN != MUSICANDSFX) if (g_sounds[num].num > 0 && PN != MUSICANDSFX)
{ {
if (g_sounds[num].SoundOwner[0].i == i) stopsound(num); if (g_sounds[num].SoundOwner[0].i == i) S_StopSound(num);
else if (g_sounds[num].num > 1) stopsound(num); else if (g_sounds[num].num > 1) S_StopSound(num);
else if (badguy(&sprite[i]) && sprite[i].extra <= 0) stopsound(num); else if (A_CheckEnemySprite(&sprite[i]) && sprite[i].extra <= 0) S_StopSound(num);
} }
if (PN == APLAYER && sprite[i].yvel == screenpeek) if (PN == APLAYER && sprite[i].yvel == screenpeek)
@ -381,7 +380,7 @@ int xyzsound(int num,int i,int x,int y,int z)
if (g_sounds[num].ptr == 0) if (g_sounds[num].ptr == 0)
{ {
if (loadsound(num) == 0) return 0; if (S_LoadSound(num) == 0) return 0;
} }
else else
{ {
@ -435,7 +434,7 @@ int xyzsound(int num,int i,int x,int y,int z)
return (voice); return (voice);
} }
void sound(int num) void S_PlaySound(int num)
{ {
int pitch,pitche,pitchs,cx; int pitch,pitche,pitchs,cx;
int voice; int voice;
@ -466,7 +465,7 @@ void sound(int num)
if (g_sounds[num].ptr == 0) if (g_sounds[num].ptr == 0)
{ {
if (loadsound(num) == 0) return; if (S_LoadSound(num) == 0) return;
} }
else else
{ {
@ -512,34 +511,34 @@ void sound(int num)
g_sounds[num].lock--; g_sounds[num].lock--;
} }
int spritesound(unsigned int num, int i) int A_PlaySound(unsigned int num, int i)
{ {
if (num >= MAXSOUNDS) return -1; if (num >= MAXSOUNDS) return -1;
if (i < 0) if (i < 0)
{ {
sound(num); S_PlaySound(num);
return 0; return 0;
} }
return xyzsound(num,i,SX,SY,SZ); return S_PlaySoundXYZ(num,i,SX,SY,SZ);
} }
void stopspritesound(int num, int i) void A_StopSound(int num, int i)
{ {
UNREFERENCED_PARAMETER(i); UNREFERENCED_PARAMETER(i);
if (num >= 0 && num < MAXSOUNDS) stopsound(num); if (num >= 0 && num < MAXSOUNDS) S_StopSound(num);
} }
void stopsound(int num) void S_StopSound(int num)
{ {
if (num >= 0 && num < MAXSOUNDS) if (num >= 0 && num < MAXSOUNDS)
if (g_sounds[num].num > 0) if (g_sounds[num].num > 0)
{ {
FX_StopSound(g_sounds[num].SoundOwner[g_sounds[num].num-1].voice); FX_StopSound(g_sounds[num].SoundOwner[g_sounds[num].num-1].voice);
testcallback(num); S_TestSoundCallback(num);
} }
} }
void stopenvsound(int num,int i) void S_StopEnvSound(int num,int i)
{ {
int j, k; int j, k;
@ -561,7 +560,7 @@ void pan3dsound(void)
int sndist, sx, sy, sz, cx, cy, cz; int sndist, sx, sy, sz, cx, cy, cz;
int sndang,ca,j,k,i,cs; int sndang,ca,j,k,i,cs;
numenvsnds = 0; g_numEnvSoundsPlaying = 0;
if (ud.camerasprite == -1) if (ud.camerasprite == -1)
{ {
@ -609,7 +608,7 @@ void pan3dsound(void)
sndist += sndist>>5; sndist += sndist>>5;
if (PN == MUSICANDSFX && SLT < 999) if (PN == MUSICANDSFX && SLT < 999)
numenvsnds++; g_numEnvSoundsPlaying++;
switch (j) switch (j)
{ {
@ -621,12 +620,12 @@ void pan3dsound(void)
default: default:
if (sndist > 31444 && PN != MUSICANDSFX) if (sndist > 31444 && PN != MUSICANDSFX)
{ {
stopsound(j); S_StopSound(j);
continue; continue;
} }
} }
if (g_sounds[j].ptr == 0 && loadsound(j) == 0) continue; if (g_sounds[j].ptr == 0 && S_LoadSound(j) == 0) continue;
if (g_sounds[j].m&16) sndist = 0; if (g_sounds[j].m&16) sndist = 0;
if (sndist < ((255-LOUDESTVOLUME)<<6)) if (sndist < ((255-LOUDESTVOLUME)<<6))
@ -636,7 +635,7 @@ void pan3dsound(void)
} }
} }
void testcallback(unsigned int num) void S_TestSoundCallback(unsigned int num)
{ {
int tempi,tempj,tempk; int tempi,tempj,tempk;
@ -657,7 +656,7 @@ void testcallback(unsigned int num)
tempi = g_sounds[num].SoundOwner[tempj].i; tempi = g_sounds[num].SoundOwner[tempj].i;
if (sprite[tempi].picnum == MUSICANDSFX && sector[sprite[tempi].sectnum].lotag < 3 && sprite[tempi].lotag < 999) if (sprite[tempi].picnum == MUSICANDSFX && sector[sprite[tempi].sectnum].lotag < 3 && sprite[tempi].lotag < 999)
{ {
hittype[tempi].temp_data[0] = 0; ActorExtra[tempi].temp_data[0] = 0;
if ((tempj + 1) < tempk) if ((tempj + 1) < tempk)
{ {
g_sounds[num].SoundOwner[tempj].voice = g_sounds[num].SoundOwner[tempk-1].voice; g_sounds[num].SoundOwner[tempj].voice = g_sounds[num].SoundOwner[tempk-1].voice;
@ -674,7 +673,7 @@ void testcallback(unsigned int num)
g_sounds[num].lock--; g_sounds[num].lock--;
} }
void clearsoundlocks(void) void S_ClearSoundLocks(void)
{ {
int i; int i;
@ -687,14 +686,14 @@ void clearsoundlocks(void)
lumplockbyte[i] = 199; lumplockbyte[i] = 199;
} }
int isspritemakingsound(int i, int num) int A_CheckSoundPlaying(int i, int num)
{ {
UNREFERENCED_PARAMETER(i); UNREFERENCED_PARAMETER(i);
if (num < 0) num=0; // FIXME if (num < 0) num=0; // FIXME
return (g_sounds[num].num > 0); return (g_sounds[num].num > 0);
} }
int issoundplaying(int i, int num) int S_CheckSoundPlaying(int i, int num)
{ {
if (i == -1) if (i == -1)
{ {

View file

@ -31,10 +31,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _sounds_public_ #ifndef _sounds_public_
#define _sounds_public_ #define _sounds_public_
void SoundStartup( void ); void S_SoundStartup( void );
void SoundShutdown( void ); void S_SoundShutdown( void );
void MusicStartup( void ); void S_MusicStartup( void );
void MusicShutdown( void ); void S_MusicShutdown( void );
void AudioUpdate(void); void AudioUpdate(void);
struct audioenumdev { struct audioenumdev {

View file

@ -351,7 +351,7 @@ static GtkWidget *create_window(void)
GDK_F, GDK_MOD1_MASK, GDK_F, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
// 3D video mode label // 3D video mode LabelText
vmode3dlabel = gtk_label_new_with_mnemonic("_Video mode:"); vmode3dlabel = gtk_label_new_with_mnemonic("_Video mode:");
gtk_widget_show(vmode3dlabel); gtk_widget_show(vmode3dlabel);
gtk_fixed_put(GTK_FIXED(configlayout), vmode3dlabel, 0, 0); gtk_fixed_put(GTK_FIXED(configlayout), vmode3dlabel, 0, 0);
@ -432,7 +432,7 @@ static GtkWidget *create_window(void)
gtk_container_add(GTK_CONTAINER(tabs), gamevlayout); gtk_container_add(GTK_CONTAINER(tabs), gamevlayout);
gtk_container_set_border_width(GTK_CONTAINER(gamevlayout), 4); gtk_container_set_border_width(GTK_CONTAINER(gamevlayout), 4);
// Game data field label // Game data field LabelText
gamelabel = gtk_label_new_with_mnemonic("_Game or addon:"); gamelabel = gtk_label_new_with_mnemonic("_Game or addon:");
gtk_widget_show(gamelabel); gtk_widget_show(gamelabel);
gtk_box_pack_start(GTK_BOX(gamevlayout), gamelabel, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(gamevlayout), gamelabel, FALSE, FALSE, 0);
@ -759,7 +759,7 @@ int startwin_run(void)
settings.forcesetup = ud.config.ForceSetup; settings.forcesetup = ud.config.ForceSetup;
settings.usemouse = ud.config.UseMouse; settings.usemouse = ud.config.UseMouse;
settings.usejoy = ud.config.UseJoystick; settings.usejoy = ud.config.UseJoystick;
settings.game = g_GameType; settings.game = g_gameType;
strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH);
PopulateForm(-1); PopulateForm(-1);
@ -778,7 +778,7 @@ int startwin_run(void)
ud.config.UseMouse = settings.usemouse; ud.config.UseMouse = settings.usemouse;
ud.config.UseJoystick = settings.usejoy; ud.config.UseJoystick = settings.usejoy;
duke3dgrp = settings.selectedgrp; duke3dgrp = settings.selectedgrp;
g_GameType = settings.game; g_gameType = settings.game;
for (i = 0; i<numgrpfiles; i++) if (settings.crcval == grpfiles[i].crcval) break; for (i = 0; i<numgrpfiles; i++) if (settings.crcval == grpfiles[i].crcval) break;
if (i != numgrpfiles) if (i != numgrpfiles)

View file

@ -77,7 +77,7 @@ static int getfilenames(char *path)
extern char TEXCACHEDIR[]; extern char TEXCACHEDIR[];
#endif #endif
extern int g_NoSetup; extern int g_noSetup;
static void PopulateForm(int pgs) static void PopulateForm(int pgs)
{ {
@ -632,7 +632,7 @@ int startwin_run(void)
settings.forcesetup = ud.config.ForceSetup; settings.forcesetup = ud.config.ForceSetup;
settings.usemouse = ud.config.UseMouse; settings.usemouse = ud.config.UseMouse;
settings.usejoy = ud.config.UseJoystick; settings.usejoy = ud.config.UseJoystick;
settings.game = g_GameType; settings.game = g_gameType;
// settings.crcval = 0; // settings.crcval = 0;
strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH);
settings.gamedir = mod_dir; settings.gamedir = mod_dir;
@ -669,9 +669,9 @@ int startwin_run(void)
ud.config.UseMouse = settings.usemouse; ud.config.UseMouse = settings.usemouse;
ud.config.UseJoystick = settings.usejoy; ud.config.UseJoystick = settings.usejoy;
duke3dgrp = settings.selectedgrp; duke3dgrp = settings.selectedgrp;
g_GameType = settings.game; g_gameType = settings.game;
if (g_NoSetup == 0 && settings.gamedir != NULL) if (g_noSetup == 0 && settings.gamedir != NULL)
Bstrcpy(mod_dir,settings.gamedir); Bstrcpy(mod_dir,settings.gamedir);
else Bsprintf(mod_dir,"/"); else Bsprintf(mod_dir,"/");

View file

@ -24,7 +24,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
int NumSyncBytes = 1; int NumSyncBytes = 6;
char sync_first[MAXSYNCBYTES][60]; char sync_first[MAXSYNCBYTES][60];
int sync_found = 0; int sync_found = 0;
@ -54,9 +54,9 @@ char PlayerSync(void)
{ {
short i; short i;
unsigned short crc = 0; unsigned short crc = 0;
player_struct *pp; DukePlayer_t *pp;
for (i = connecthead; i >= 0; i = connectpoint2[i]) TRAVERSE_CONNECT(i)
{ {
pp = g_player[i].ps; pp = g_player[i].ps;
updatecrc(crc, pp->posx & 255); updatecrc(crc, pp->posx & 255);
@ -70,11 +70,13 @@ char PlayerSync(void)
char PlayerSync2(void) char PlayerSync2(void)
{ {
short i; int i;
int j, nextj;
unsigned short crc = 0; unsigned short crc = 0;
player_struct *pp; DukePlayer_t *pp;
spritetype *spr;
for (i = connecthead; i >= 0; i = connectpoint2[i]) TRAVERSE_CONNECT(i)
{ {
pp = g_player[i].ps; pp = g_player[i].ps;
@ -83,40 +85,7 @@ char PlayerSync2(void)
updatecrc(crc, pp->bobcounter & 255); updatecrc(crc, pp->bobcounter & 255);
} }
return ((char) crc & 255); TRAVERSE_SPRITE_STAT(headspritestat[STAT_PLAYER], j, nextj)
}
/*
char SOSync(void)
{
unsigned short crc = 0;
SECTOR_OBJECTp sop;
for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++)
{
// if (sop->xmid == MAXLONG)
// continue;
updatecrc(crc, (sop->xmid) & 255);
updatecrc(crc, (sop->ymid) & 255);
updatecrc(crc, (sop->zmid) & 255);
updatecrc(crc, (sop->vel) & 255);
updatecrc(crc, (sop->ang) & 255);
updatecrc(crc, (sop->ang_moving) & 255);
updatecrc(crc, (sop->spin_ang) & 255);
}
return ((char) crc & 255);
}
char EnemySync(void)
{
unsigned short crc = 0;
short j, nextj;
spritetype *spr;
extern char DemoTmpName[];
TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], j, nextj)
{ {
spr = &sprite[j]; spr = &sprite[j];
updatecrc(crc, (spr->x) & 255); updatecrc(crc, (spr->x) & 255);
@ -128,13 +97,44 @@ char EnemySync(void)
return ((char) crc & 255); return ((char) crc & 255);
} }
char MissileSync(void) char ActorSync(void)
{ {
unsigned short crc = 0; unsigned short crc = 0;
short j, nextj; int j, nextj;
spritetype *spr; spritetype *spr;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_MISSILE], j, nextj) TRAVERSE_SPRITE_STAT(headspritestat[STAT_ACTOR], j, nextj)
{
spr = &sprite[j];
updatecrc(crc, (spr->x) & 255);
updatecrc(crc, (spr->y) & 255);
updatecrc(crc, (spr->z) & 255);
updatecrc(crc, (spr->lotag) & 255);
updatecrc(crc, (spr->hitag) & 255);
updatecrc(crc, (spr->ang) & 255);
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_ZOMBIEACTOR], j, nextj)
{
spr = &sprite[j];
updatecrc(crc, (spr->x) & 255);
updatecrc(crc, (spr->y) & 255);
updatecrc(crc, (spr->z) & 255);
updatecrc(crc, (spr->lotag) & 255);
updatecrc(crc, (spr->hitag) & 255);
updatecrc(crc, (spr->ang) & 255);
}
return ((char) crc & 255);
}
char WeaponSync(void)
{
unsigned short crc = 0;
int j, nextj;
spritetype *spr;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_PROJECTILE], j, nextj)
{ {
spr = &sprite[j]; spr = &sprite[j];
updatecrc(crc, (spr->x) & 255); updatecrc(crc, (spr->x) & 255);
@ -146,107 +146,70 @@ char MissileSync(void)
return ((char) crc & 255); return ((char) crc & 255);
} }
char MissileSkip4Sync(void) char MapSync(void)
{ {
unsigned short crc = 0; unsigned short crc = 0;
short j, nextj; int j, nextj;
spritetype *spr; spritetype *spr;
walltype *wal;
sectortype *sect;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_MISSILE_SKIP4], j, nextj) TRAVERSE_SPRITE_STAT(headspritestat[STAT_EFFECTOR], j, nextj)
{ {
spr = &sprite[j]; spr = &sprite[j];
updatecrc(crc, (spr->x) & 255); updatecrc(crc, (spr->x) & 255);
updatecrc(crc, (spr->y) & 255); updatecrc(crc, (spr->y) & 255);
updatecrc(crc, (spr->z) & 255); updatecrc(crc, (spr->z) & 255);
updatecrc(crc, (spr->ang) & 255); updatecrc(crc, (spr->ang) & 255);
updatecrc(crc, (spr->lotag) & 255);
updatecrc(crc, (spr->hitag) & 255);
}
for (j=numwalls;j>=0;j--)
{
wal = &wall[j];
updatecrc(crc, (wal->x) & 255);
updatecrc(crc, (wal->y) & 255);
}
for (j=numsectors;j>=0;j--)
{
sect = &sector[j];
updatecrc(crc, (sect->floorz) & 255);
updatecrc(crc, (sect->ceilingz) & 255);
} }
return ((char) crc & 255); return ((char) crc & 255);
} }
char ShrapSync(void)
{
unsigned short crc = 0;
short j, nextj;
spritetype *spr;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SHRAP], j, nextj)
{
spr = &sprite[j];
updatecrc(crc, (spr->x) & 255);
updatecrc(crc, (spr->y) & 255);
updatecrc(crc, (spr->z) & 255);
updatecrc(crc, (spr->ang) & 255);
}
return ((char) crc & 255);
}
char MiscSync(void)
{
unsigned short crc = 0;
short j, nextj;
spritetype *spr;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_MISC], j, nextj)
{
spr = &sprite[j];
updatecrc(crc, (spr->x) & 255);
updatecrc(crc, (spr->y) & 255);
updatecrc(crc, (spr->z) & 255);
updatecrc(crc, (spr->ang) & 255);
}
return ((char) crc & 255);
}
*/
char RandomSync(void) char RandomSync(void)
{ {
unsigned short crc = 0; unsigned short crc = 0;
updatecrc(crc, randomseed & 255); updatecrc(crc, randomseed & 255);
updatecrc(crc, (randomseed >> 8) & 255); updatecrc(crc, (randomseed >> 8) & 255);
updatecrc(crc, g_globalRandom & 255);
updatecrc(crc, (g_globalRandom >> 8) & 255);
if (NumSyncBytes == 1) if (NumSyncBytes == 1)
{ {
updatecrc(crc,PlayerSync() & 255); updatecrc(crc,PlayerSync() & 255);
updatecrc(crc,PlayerSync2() & 255); updatecrc(crc,PlayerSync2() & 255);
// updatecrc(crc,WeaponSync() & 255); updatecrc(crc,WeaponSync() & 255);
updatecrc(crc,ActorSync() & 255);
} }
return ((char) crc & 255); return ((char) crc & 255);
} }
/*
movefta(); //ST 2
moveweapons(); //ST 4
movetransports(); //ST 9
moveplayers(); //ST 10
movefallers(); //ST 12
moveexplosions(); //ST 5
moveactors(); //ST 1
moveeffectors(); //ST 3
movestandables(); //ST 6
movefx(); //ST 11
*/
char *SyncNames[] = char *SyncNames[] =
{ {
"RandomSync", "Net_CheckRandomSync",
"PlayerSync", "Net_CheckPlayerSync",
"PlayerSync2", "Net_CheckPlayerSync2",
/* "FTASync", "Net_CheckWeaponSync",
"WeaponSync", "Net_CheckActorSync",
"TransportSync", "Net_CheckMapSync",
"FallerSync",
"ExplosionSync",
"ActorSync",
"EffectorSync",
"StandableSync",
"FXSync", */
NULL NULL
}; };
@ -255,15 +218,9 @@ static char(*SyncFunc[MAXSYNCBYTES + 1])(void) =
RandomSync, RandomSync,
PlayerSync, PlayerSync,
PlayerSync2, PlayerSync2,
/* FTASync,
WeaponSync, WeaponSync,
TransportSync,
FallerSync,
ExplosionSync,
ActorSync, ActorSync,
EffectorSync, MapSync,
StandableSync,
FXSync, */
NULL NULL
}; };
@ -299,7 +256,7 @@ void SyncStatMessage(void)
{ {
int i, j; int i, j;
static unsigned int MoveCount = 0; static unsigned int MoveCount = 0;
extern unsigned int MoveThingsCount; extern unsigned int g_moveThingsCount;
// if (!SyncPrintMode) // if (!SyncPrintMode)
// return; // return;
@ -314,8 +271,8 @@ void SyncStatMessage(void)
{ {
if (NumSyncBytes > 1) if (NumSyncBytes > 1)
{ {
sprintf(tempbuf, "GAME OUT OF SYNC - %s", SyncNames[i]); sprintf(tempbuf, "Out Of Sync - %s", SyncNames[i]);
printext256(68L, 68L + (i * 8), 1, 31, tempbuf, 0); printext256(4L, 100L + (i * 8), 31, 1, tempbuf, 0);
} }
if (!sync_found && sync_first[i][0] == '\0') if (!sync_found && sync_first[i][0] == '\0')
@ -324,13 +281,13 @@ void SyncStatMessage(void)
sync_found = TRUE; sync_found = TRUE;
// save off loop count // save off loop count
MoveCount = MoveThingsCount; MoveCount = g_moveThingsCount;
for (j = 0; j < NumSyncBytes; j++) for (j = 0; j < NumSyncBytes; j++)
{ {
if (syncstat[j] != 0 && sync_first[j][0] == '\0') if (syncstat[j] != 0 && sync_first[j][0] == '\0')
{ {
sprintf(tempbuf, "OUT OF SYNC - %s", SyncNames[j]); sprintf(tempbuf, "Out Of Sync - %s", SyncNames[j]);
strcpy(sync_first[j], tempbuf); strcpy(sync_first[j], tempbuf);
} }
} }
@ -346,24 +303,13 @@ void SyncStatMessage(void)
if (NumSyncBytes > 1) if (NumSyncBytes > 1)
{ {
sprintf(tempbuf, "FIRST %s", sync_first[i]); sprintf(tempbuf, "FIRST %s", sync_first[i]);
printext256(50L, 0L, 1, 31, tempbuf, 0); printext256(4L, 44L + (i * 8), 31, 1, tempbuf, 0);
sprintf(tempbuf, "MoveCount %d",MoveCount); sprintf(tempbuf, "MoveCount %d",MoveCount);
printext256(50L, 10L, 1, 31, tempbuf, 0); printext256(4L, 52L + (i * 8), 31, 1, tempbuf, 0);
} }
else else
{ {
// short w,h; printext256(4L,100L,31,0,"Out Of Sync - Please restart game",0);
// production out of sync error
// sprintf(tempbuf,"GAME OUT OF SYNC!");
// MNU_MeasureString(tempbuf, &w, &h);
// MNU_DrawString(TEXT_TEST_COL(w), 20, tempbuf, 0, 19);
// sprintf(tempbuf,"Restart the game.");
// MNU_MeasureString(tempbuf, &w, &h);
// MNU_DrawString(TEXT_TEST_COL(w), 30, tempbuf, 0, 19);
printext256(4L,130L,31,0,"Out Of Sync - Please restart game",0);
printext256(4L,138L,31,0,"RUN DN3DHELP.EXE for information.",0);
} }
} }
} }
@ -406,7 +352,7 @@ void GetSyncInfoFromPacket(char *packbuf, int packbufleng, int *j, int otherconn
// Suspect that its trying to traverse the connect list // Suspect that its trying to traverse the connect list
// for a player that does not exist. This tries to take care of that // for a player that does not exist. This tries to take care of that
for (i=connecthead;i>=0;i=connectpoint2[i]) TRAVERSE_CONNECT(i)
{ {
if (otherconnectindex == i) if (otherconnectindex == i)
found = 1; found = 1;
@ -428,7 +374,7 @@ void GetSyncInfoFromPacket(char *packbuf, int packbufleng, int *j, int otherconn
// update syncstat // update syncstat
// if any of the syncstat vars is non-0 then there is a problem // if any of the syncstat vars is non-0 then there is a problem
for (i=connecthead;i>=0;i=connectpoint2[i]) TRAVERSE_CONNECT(i)
{ {
if (g_player[i].syncvalhead == syncvaltottail) if (g_player[i].syncvalhead == syncvaltottail)
return; return;
@ -452,7 +398,7 @@ void GetSyncInfoFromPacket(char *packbuf, int packbufleng, int *j, int otherconn
syncvaltottail++; syncvaltottail++;
for (i=connecthead;i>=0;i=connectpoint2[i]) TRAVERSE_CONNECT(i)
{ {
if (g_player[i].syncvalhead == syncvaltottail) if (g_player[i].syncvalhead == syncvaltottail)
return; return;

View file

@ -65,13 +65,13 @@ int Win_MsgBox(char *name, char *fmt, ...)
// this replaces the Error() function in jmact/util_lib.c // this replaces the Error() function in jmact/util_lib.c
extern void Shutdown(void); // game.c extern void G_Shutdown(void); // game.c
void Error(char *error, ...) void Error(char *error, ...)
{ {
char buf[1000]; char buf[1000];
va_list va; va_list va;
Shutdown(); G_Shutdown();
if (error) if (error)
{ {