1 //-------------------------------------------------------------------------
2 /*
3 Copyright (C) 1996, 2003 - 3D Realms Entertainment
4 Copyright (C) 2017-2019 Nuke.YKT
5 
6 This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
7 
8 Duke Nukem 3D is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 
23 Original Source: 1996 - Todd Replogle
24 Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
25 */
26 //-------------------------------------------------------------------------
27 
28 #include "duke3d.h"
29 
30 char *mymembuf;
31 char MusicPtr[72000];
32 
33 short global_random;
34 short user_quote_time;
35 short neartagsector, neartagwall, neartagsprite;
36 
37 char *user_quote;
38 long gc,neartaghitdist,lockclock,max_player_health,max_armour_amount,max_ammo_amount[MAX_WEAPONS];
39 
40 // long temp_data[MAXSPRITES][6];
41 struct weaponhit hittype[MAXSPRITES];
42 short spriteq[1024],spriteqloc,spriteqamount=64,moustat;
43 struct animwalltype animwall[MAXANIMWALLS];
44 short numanimwalls;
45 long *animateptr[MAXANIMATES], animategoal[MAXANIMATES], animatevel[MAXANIMATES], animatecnt;
46 // long oanimateval[MAXANIMATES];
47 short animatesect[MAXANIMATES];
48 long msx[2048],msy[2048];
49 short cyclers[MAXCYCLERS][6],numcyclers;
50 
51 char fta_quotes[NUMOFFIRSTTIMEACTIVE][64];
52 
53 unsigned char tempbuf[2048], packbuf[576];
54 
55 char buf[80];
56 
57 short camsprite;
58 short mirrorwall[64], mirrorsector[64], mirrorcnt;
59 
60 int current_menu;
61 
62 char betaname[80];
63 
64 char level_names[44][33],level_file_names[44][128];
65 long partime[44],designertime[44];
66 #ifdef RRRA
67 char volume_names[6][33];
68 #else
69 char volume_names[4][33];
70 #endif
71 char skill_names[6][33];
72 
73 volatile long checksume;
74 long soundsiz[NUM_SOUNDS];
75 
76 short soundps[NUM_SOUNDS],soundpe[NUM_SOUNDS],soundvo[NUM_SOUNDS];
77 char soundm[NUM_SOUNDS],soundpr[NUM_SOUNDS];
78 char sounds[NUM_SOUNDS][14];
79 
80 short title_zoom;
81 
82 fx_device device;
83 
84 SAMPLE Sound[ NUM_SOUNDS ];
85 SOUNDOWNER SoundOwner[NUM_SOUNDS][4];
86 
87 char numplayersprites,loadfromgrouponly,earthquaketime;
88 
89 long fricxv,fricyv;
90 struct player_orig po[MAXPLAYERS];
91 struct player_struct ps[MAXPLAYERS];
92 struct user_defs ud;
93 
94 char pus, pub;
95 char syncstat, syncval[MAXPLAYERS][MOVEFIFOSIZ];
96 long syncvalhead[MAXPLAYERS], syncvaltail, syncvaltottail;
97 
98 input sync[MAXPLAYERS], loc;
99 input recsync[RECSYNCBUFSIZ];
100 long avgfvel, avgsvel, avgavel, avghorz, avgbits;
101 
102 
103 input inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
104 input recsync[RECSYNCBUFSIZ];
105 
106 long movefifosendplc;
107 
108   //Multiplayer syncing variables
109 short screenpeek;
110 long movefifoend[MAXPLAYERS];
111 
112 
113     //Game recording variables
114 
115 char playerreadyflag[MAXPLAYERS],ready2send;
116 char playerquitflag[MAXPLAYERS];
117 long vel, svel, angvel, horiz, ototalclock, respawnactortime=768, respawnitemtime=768, groupfile;
118 
119 long script[MAXSCRIPTSIZE],*scriptptr,*insptr,*labelcode,labelcnt;
120 long *actorscrptr[MAXTILES],*parsing_actor;
121 char *label,*textptr,error,warning,killit_flag;
122 char *music_pointer;
123 char actortype[MAXTILES];
124 
125 
126 char display_mirror,typebuflen,typebuf[41];
127 
128 char music_fn[4][11][13],music_select;
129 char env_music_fn[4][13];
130 char rtsplaying;
131 
132 
133 short weaponsandammosprites[15] = {
134         RPGSPRITE,
135         CHAINGUNSPRITE,
136         DEVISTATORAMMO,
137         RPGAMMO,
138         RPGAMMO,
139         JETPACK,
140         SHIELD,
141         FIRSTAID,
142         STEROIDS,
143         RPGAMMO,
144         RPGAMMO,
145         RPGSPRITE,
146         RPGAMMO,
147         FREEZESPRITE,
148         FREEZEAMMO
149     };
150 
151 long impact_damage;
152 
153         //GLOBAL.C - replace the end "my's" with this
154 long myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
155 short myhoriz, omyhoriz, myhorizoff, omyhorizoff;
156 short myang, omyang, mycursectnum, myjumpingcounter,frags[MAXPLAYERS][MAXPLAYERS];
157 
158 char myjumpingtoggle, myonground, myhardlanding, myreturntocenter;
159 signed char multiwho, multipos, multiwhat, multiflag;
160 
161 long fakemovefifoplc,movefifoplc;
162 long myxbak[MOVEFIFOSIZ], myybak[MOVEFIFOSIZ], myzbak[MOVEFIFOSIZ];
163 long myhorizbak[MOVEFIFOSIZ],rdnkfriction = 0xcc00, show_shareware;
164 
165 short myangbak[MOVEFIFOSIZ];
166 char myname[13],camerashitable,freezerhurtowner=0,lasermode;
167 char networkmode = 255, movesperpacket = 1,gamequit = 0,playonten = 0;
168 long numfreezebounces=3,rpgblastradius,pipebombblastradius,powderkegblastradius,shrinkerblastradius,morterblastradius,bouncemineblastradius,seenineblastradius;
169 STATUSBARTYPE sbar;
170 
171 long myminlag[MAXPLAYERS], mymaxlag, otherminlag, bufferjitter = 1;
172 //long totalmemory = 0;
173 long numinterpolations = 0, startofdynamicinterpolations = 0;
174 long oldipos[MAXINTERPOLATIONS];
175 long bakipos[MAXINTERPOLATIONS];
176 long *curipos[MAXINTERPOLATIONS];
177 
178 
179 short chickenplant, thunderon, ufospawn, ufocnt, cdon, hulkspawn;
180 
181 #ifdef RRRA
182 long WindTime = 0;
183 long WindDir = 0;
184 short word_119BD8 = 0;
185 short word_119BDA = 0;
186 short word_119BDC = 0;
187 short BellTime = 0;
188 short word_119BE0 = 0;
189 short word_119BE2 = 0;
190 short word_119BE4 = 0;
191 #endif
192 //long wupass = 0;