more multiplayer crap

git-svn-id: https://svn.eduke32.com/eduke32@1572 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-12-15 05:53:15 +00:00
parent 730b9d2c1d
commit 2bb322377e
15 changed files with 343 additions and 332 deletions

View file

@ -78,6 +78,8 @@ struct cacheitem_t
typedef struct cacheitem_t texcacheindex; typedef struct cacheitem_t texcacheindex;
#define TEXCACHEMAGIC "QLZ1"
extern texcacheindex *firstcacheindex; extern texcacheindex *firstcacheindex;
extern texcacheindex *curcacheindex; extern texcacheindex *curcacheindex;
extern texcacheindex *cacheptrs[MAXTILES<<1]; extern texcacheindex *cacheptrs[MAXTILES<<1];

View file

@ -565,7 +565,7 @@ int32_t mdloadskin_trytexcache(char *fn, int32_t len, int32_t pal, char effect,
// initprintf("Loading cached skin: %s\n", cachefn); // initprintf("Loading cached skin: %s\n", cachefn);
if (Bread(cachefilehandle, head, sizeof(texcacheheader)) < (int32_t)sizeof(texcacheheader)) goto failure; if (Bread(cachefilehandle, head, sizeof(texcacheheader)) < (int32_t)sizeof(texcacheheader)) goto failure;
if (memcmp(head->magic, "PMST", 4)) goto failure; if (memcmp(head->magic, TEXCACHEMAGIC, 4)) goto failure;
head->xdim = B_LITTLE32(head->xdim); head->xdim = B_LITTLE32(head->xdim);
head->ydim = B_LITTLE32(head->ydim); head->ydim = B_LITTLE32(head->ydim);

View file

@ -1294,7 +1294,7 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache
// initprintf("Loading cached tex: %s\n", cachefn); // initprintf("Loading cached tex: %s\n", cachefn);
if (Bread(cachefilehandle, head, sizeof(texcacheheader)) < (int32_t)sizeof(texcacheheader)) goto failure; if (Bread(cachefilehandle, head, sizeof(texcacheheader)) < (int32_t)sizeof(texcacheheader)) goto failure;
if (Bmemcmp(head->magic, "PMST", 4)) goto failure; if (Bmemcmp(head->magic, TEXCACHEMAGIC, 4)) goto failure;
head->xdim = B_LITTLE32(head->xdim); head->xdim = B_LITTLE32(head->xdim);
head->ydim = B_LITTLE32(head->ydim); head->ydim = B_LITTLE32(head->ydim);
head->flags = B_LITTLE32(head->flags); head->flags = B_LITTLE32(head->flags);
@ -1359,7 +1359,7 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
offset = Blseek(cachefilehandle, 0, BSEEK_CUR); offset = Blseek(cachefilehandle, 0, BSEEK_CUR);
OSD_Printf("Caching %s, offset 0x%x\n", cachefn, offset); OSD_Printf("Caching %s, offset 0x%x\n", cachefn, offset);
Bmemcpy(head->magic, "PMST", 4); // sizes are set by caller Bmemcpy(head->magic, TEXCACHEMAGIC, 4); // sizes are set by caller
if (glusetexcache == 2) head->flags |= 4; if (glusetexcache == 2) head->flags |= 4;

View file

@ -1072,7 +1072,7 @@ static void G_MovePlayers(void)
{ {
s->extra = p->max_player_health; s->extra = p->max_player_health;
s->cstat = 257; s->cstat = 257;
p->jetpack_amount = 1599; p->inv_amount[GET_JETPACK] = 1599;
} }
@ -5175,8 +5175,8 @@ static void G_MoveMisc(void) // STATNUM 5
{ {
if (s->pal == 0 && (krand()&255) < 16 && s->picnum != PUKE) if (s->pal == 0 && (krand()&255) < 16 && s->picnum != PUKE)
{ {
if (g_player[p].ps->boot_amount > 0) if (g_player[p].ps->inv_amount[GET_BOOTS] > 0)
g_player[p].ps->boot_amount--; g_player[p].ps->inv_amount[GET_BOOTS]--;
else else
{ {
if (!A_CheckSoundPlaying(g_player[p].ps->i,DUKE_LONGTERM_PAIN)) if (!A_CheckSoundPlaying(g_player[p].ps->i,DUKE_LONGTERM_PAIN))

View file

@ -238,7 +238,8 @@ enum DukeInventory_t {
GET_HEATS, GET_HEATS,
GET_DUMMY2, GET_DUMMY2,
GET_FIRSTAID, GET_FIRSTAID,
GET_BOOTS GET_BOOTS,
GET_MAX
}; };
enum DukeWeapon_t { enum DukeWeapon_t {
@ -429,7 +430,7 @@ extern int32_t fricxv,fricyv;
typedef struct { typedef struct {
int32_t posx, posy, posz, oposx, oposy, oposz, posxv, posyv, poszv; int32_t posx, posy, posz, oposx, oposy, oposz, posxv, posyv, poszv;
int32_t bobposx, bobposy, pyoff, opyoff, horiz, ohoriz, ohorizoff, invdisptime; int32_t bobposx, bobposy, pyoff, opyoff, invdisptime;
int32_t last_pissed_time, truefz, truecz; int32_t last_pissed_time, truefz, truecz;
int32_t player_par, visibility; int32_t player_par, visibility;
int32_t bobcounter, weapon_sway; int32_t bobcounter, weapon_sway;
@ -451,26 +452,25 @@ typedef struct {
int16_t sbs, sound_pitch; int16_t sbs, sound_pitch;
int16_t ang, oang, angvel, cursectnum, look_ang, last_extra, subweapon; int16_t ang, oang, angvel, cursectnum, look_ang, last_extra, subweapon;
int16_t ammo_amount[MAX_WEAPONS], wackedbyactor, frag, fraggedself; int16_t ammo_amount[MAX_WEAPONS], inv_amount[GET_MAX], wackedbyactor, frag, fraggedself;
int16_t curr_weapon, last_weapon, tipincs, horizoff, wantweaponfire; int16_t curr_weapon, last_weapon, tipincs, horiz, horizoff, ohoriz, ohorizoff, wantweaponfire;
int16_t holoduke_amount, newowner, hurt_delay, hbomb_hold_delay; int16_t newowner, hurt_delay, hbomb_hold_delay;
int16_t jumping_counter, airleft, knee_incs, access_incs; int16_t jumping_counter, airleft, knee_incs, access_incs;
int16_t fta, ftq, access_wallnum, access_spritenum; int16_t fta, ftq, access_wallnum, access_spritenum;
int16_t kickback_pic, got_access, weapon_ang, firstaid_amount; int16_t kickback_pic, got_access, weapon_ang;
int16_t somethingonplayer, on_crane, i, one_parallax_sectnum; int16_t somethingonplayer, on_crane, i, one_parallax_sectnum;
int16_t over_shoulder_on, random_club_frame, fist_incs; int16_t over_shoulder_on, random_club_frame, fist_incs;
int16_t one_eighty_count, cheat_phase; int16_t one_eighty_count, cheat_phase;
int16_t dummyplayersprite, extra_extra8, quick_kick, last_quick_kick; int16_t dummyplayersprite, extra_extra8, quick_kick, last_quick_kick;
int16_t heat_amount, actorsqu, timebeforeexit, customexitsound; int16_t actorsqu, timebeforeexit, customexitsound;
int16_t weaprecs[16], weapreccnt; int16_t weaprecs[16], weapreccnt;
int16_t orotscrnang, rotscrnang, dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang int16_t orotscrnang, rotscrnang, dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang
int16_t scuba_amount, jetpack_amount, steroids_amount, shield_amount;
int16_t holoduke_on, pycount, weapon_pos, frag_ps; int16_t holoduke_on, pycount, weapon_pos, frag_ps;
int16_t transporter_hold, last_full_weapon, footprintshade, boot_amount; int16_t transporter_hold, last_full_weapon, footprintshade;
char aim_mode, auto_aim, weaponswitch; char aim_mode, auto_aim, weaponswitch;
@ -663,9 +663,7 @@ extern int16_t BlimpSpawnSprites[15];
#pragma pack(pop) #pragma pack(pop)
typedef struct { typedef struct {
int16_t got_access, last_extra, shield_amount, curr_weapon, holoduke_on; int16_t got_access, last_extra, inv_amount[GET_MAX], curr_weapon, holoduke_on;
int16_t firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount;
int16_t heat_amount, scuba_amount, boot_amount;
int16_t last_weapon, weapon_pos, kickback_pic; int16_t last_weapon, weapon_pos, kickback_pic;
int16_t ammo_amount[MAX_WEAPONS], frag[MAXPLAYERS]; int16_t ammo_amount[MAX_WEAPONS], frag[MAXPLAYERS];
char inven_icon, jetpack_on, heat_on, gotweapon[MAX_WEAPONS]; char inven_icon, jetpack_on, heat_on, gotweapon[MAX_WEAPONS];
@ -1062,7 +1060,8 @@ typedef struct {
DukePlayer_t *ps; DukePlayer_t *ps;
input_t *sync; input_t *sync;
int32_t movefifoend, syncvalhead, myminlag; int32_t movefifoend, syncvalhead;
int16_t ping, filler;
int32_t pcolor, pteam, frags[MAXPLAYERS], wchoice[MAX_WEAPONS]; int32_t pcolor, pteam, frags[MAXPLAYERS], wchoice[MAX_WEAPONS];
char vote, gotvote, playerreadyflag, playerquitflag; char vote, gotvote, playerreadyflag, playerquitflag;

View file

@ -199,7 +199,7 @@ enum
ENET_PEER_TIMEOUT_LIMIT = 32, ENET_PEER_TIMEOUT_LIMIT = 32,
ENET_PEER_TIMEOUT_MINIMUM = 5000, ENET_PEER_TIMEOUT_MINIMUM = 5000,
ENET_PEER_TIMEOUT_MAXIMUM = 30000, ENET_PEER_TIMEOUT_MAXIMUM = 30000,
ENET_PEER_PING_INTERVAL = 500, ENET_PEER_PING_INTERVAL = 150,
ENET_PEER_UNSEQUENCED_WINDOWS = 64, ENET_PEER_UNSEQUENCED_WINDOWS = 64,
ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 1024, ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 1024,
ENET_PEER_FREE_UNSEQUENCED_WINDOWS = 32, ENET_PEER_FREE_UNSEQUENCED_WINDOWS = 32,

View file

@ -5,12 +5,14 @@
#ifndef __ENET_WIN32_H__ #ifndef __ENET_WIN32_H__
#define __ENET_WIN32_H__ #define __ENET_WIN32_H__
#ifdef _MSC_VER
#ifdef ENET_BUILDING_LIB #ifdef ENET_BUILDING_LIB
#pragma warning (disable: 4996) // 'strncpy' was declared deprecated #pragma warning (disable: 4996) // 'strncpy' was declared deprecated
#pragma warning (disable: 4267) // size_t to int conversion #pragma warning (disable: 4267) // size_t to int conversion
#pragma warning (disable: 4244) // 64bit to 32bit int #pragma warning (disable: 4244) // 64bit to 32bit int
#pragma warning (disable: 4018) // signed/unsigned mismatch #pragma warning (disable: 4018) // signed/unsigned mismatch
#endif #endif
#endif
#include <stdlib.h> #include <stdlib.h>
#include <winsock2.h> #include <winsock2.h>

View file

@ -57,6 +57,13 @@ int32_t g_netDisconnect = 0;
int32_t net_lists[] = { STAT_PROJECTILE, STAT_STANDABLE, STAT_ACTIVATOR, STAT_TRANSPORT, STAT_EFFECTOR, STAT_ACTOR, STAT_ZOMBIEACTOR }; int32_t net_lists[] = { STAT_PROJECTILE, STAT_STANDABLE, STAT_ACTIVATOR, STAT_TRANSPORT, STAT_EFFECTOR, STAT_ACTOR, STAT_ZOMBIEACTOR };
char g_networkPassword[32]; char g_networkPassword[32];
enum NetDisconnect_t
{
DISC_BAD_PASSWORD = 1,
DISC_KICKED,
DISC_BANNED
};
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
@ -68,9 +75,6 @@ static int32_t usecwd = 0;
#endif /* _WIN32 */ #endif /* _WIN32 */
int32_t g_scriptSanityChecks = 1; int32_t g_scriptSanityChecks = 1;
#define IDFSIZE 479985668
#define IDFILENAME "DUKE3D.IDF"
#define TIMERUPDATESIZ 32 #define TIMERUPDATESIZ 32
int32_t g_cameraDistance = 0, g_cameraClock = 0; int32_t g_cameraDistance = 0, g_cameraClock = 0;
@ -536,8 +540,6 @@ void G_AddUserQuote(const char *daquote)
pub = NUMPAGES; pub = NUMPAGES;
} }
int32_t lastpackettime = 0;
void G_HandleSpecialKeys(void) void G_HandleSpecialKeys(void)
{ {
// we need CONTROL_GetInput in order to pick up joystick button presses // we need CONTROL_GetInput in order to pick up joystick button presses
@ -844,15 +846,17 @@ static int32_t peractorvals[MAXGAMEVARS][MAXSPRITES], perplayervals[MAXGAMEVARS]
static void Net_SendChallenge(void) static void Net_SendChallenge(void)
{ {
int32_t i, l; int32_t l;
uint32_t crc;
if (!net_peer) return; if (!net_peer) return;
crc = crc32once((uint8_t *)g_networkPassword, Bstrlen(g_networkPassword));
buf[0] = PACKET_AUTH; buf[0] = PACKET_AUTH;
l = 1; l = 1;
Bmemcpy(&buf[l], &crc, sizeof(int32_t));
for (i=0; g_networkPassword[i]; i++) buf[l++] = g_networkPassword[i]; l += sizeof(int32_t);
buf[l++] = 0;
buf[l++] = myconnectindex; buf[l++] = myconnectindex;
@ -861,11 +865,16 @@ static void Net_SendChallenge(void)
void P_Disconnected(int32_t i) void P_Disconnected(int32_t i)
{ {
if (i == 0) return;
g_player[i].playerquitflag = 0; g_player[i].playerquitflag = 0;
Bsprintf(buf,"%s^00 is history!",g_player[i].user_name); Bsprintf(buf,"%s^00 is history!",g_player[i].user_name);
G_AddUserQuote(buf); G_AddUserQuote(buf);
if (numplayers == 1)
S_PlaySound(GENERIC_AMBIENCE17);
if (g_player[myconnectindex].ps->gm & MODE_GAME) if (g_player[myconnectindex].ps->gm & MODE_GAME)
{ {
if (screenpeek == i) if (screenpeek == i)
@ -874,9 +883,6 @@ void P_Disconnected(int32_t i)
if (screenpeek < 0) screenpeek = 0; if (screenpeek < 0) screenpeek = 0;
} }
if (numplayers == 2)
S_PlaySound(GENERIC_AMBIENCE17);
pub = NUMPAGES; pub = NUMPAGES;
pus = NUMPAGES; pus = NUMPAGES;
G_UpdateScreenArea(); G_UpdateScreenArea();
@ -902,6 +908,8 @@ void Net_SyncPlayer(ENetEvent * event)
{ {
int32_t i, j; int32_t i, j;
S_PlaySound(DUKE_GETWEAPON2);
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
if (!g_player[i].playerquitflag) if (!g_player[i].playerquitflag)
break; break;
@ -953,8 +961,10 @@ void Net_SyncPlayer(ENetEvent * event)
j = g_player[i].ps->i; j = g_player[i].ps->i;
Bmemcpy(g_player[i].ps, g_player[0].ps, sizeof(DukePlayer_t)); Bmemcpy(g_player[i].ps, g_player[0].ps, sizeof(DukePlayer_t));
g_player[i].ps->i = j; g_player[i].ps->i = j;
changespritestat(j, STAT_PLAYER); changespritestat(j, STAT_PLAYER);
P_ResetStatus(i); P_ResetStatus(i);
P_ResetWeapons(i); P_ResetWeapons(i);
P_ResetInventory(i); P_ResetInventory(i);
@ -1015,7 +1025,7 @@ void Net_ParsePacket(ENetEvent * event)
if (i == myconnectindex && !g_player[i].ps->dead_flag) if (i == myconnectindex && !g_player[i].ps->dead_flag)
{ {
j += sizeof(input_t)-sizeof(loc.filler)+(sizeof(vec3_t)*3) + sizeof(int16_t)*2; j += sizeof(input_t)-sizeof(loc.filler)+(sizeof(vec3_t)*3) + sizeof(int16_t)*6;
goto process; goto process;
} }
@ -1035,6 +1045,8 @@ void Net_ParsePacket(ENetEvent * event)
Bmemcpy(&g_player[i].ps->ang, &packbuf[j], sizeof(int16_t) * 2); Bmemcpy(&g_player[i].ps->ang, &packbuf[j], sizeof(int16_t) * 2);
Bmemcpy(&sprite[g_player[i].ps->i].ang, &packbuf[j], sizeof(int16_t)); Bmemcpy(&sprite[g_player[i].ps->i].ang, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t) * 2; j += sizeof(int16_t) * 2;
Bmemcpy(&g_player[i].ps->horiz, &packbuf[j], sizeof(int16_t) * 4);
j += sizeof(int16_t) * 4;
process: process:
Bmemcpy(&sprite[g_player[i].ps->i].extra, &packbuf[j], sizeof(int16_t)); Bmemcpy(&sprite[g_player[i].ps->i].extra, &packbuf[j], sizeof(int16_t));
@ -1043,8 +1055,6 @@ process:
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&g_player[i].ps->kickback_pic, &packbuf[j], sizeof(int16_t)); Bmemcpy(&g_player[i].ps->kickback_pic, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&g_player[i].ps->shield_amount, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t);
Bmemcpy(&ActorExtra[g_player[i].ps->i].owner, &packbuf[j], sizeof(int16_t)); Bmemcpy(&ActorExtra[g_player[i].ps->i].owner, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&ActorExtra[g_player[i].ps->i].picnum, &packbuf[j], sizeof(int16_t)); Bmemcpy(&ActorExtra[g_player[i].ps->i].picnum, &packbuf[j], sizeof(int16_t));
@ -1053,20 +1063,30 @@ process:
j += sizeof(g_player[i].ps->gotweapon); j += sizeof(g_player[i].ps->gotweapon);
Bmemcpy(&g_player[i].ps->curr_weapon, &packbuf[j], sizeof(int16_t)); Bmemcpy(&g_player[i].ps->curr_weapon, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&g_player[i].ps->ammo_amount[0], &packbuf[j], sizeof(g_player[i].ps->ammo_amount)); Bmemcpy(&g_player[i].ps->ammo_amount[0], &packbuf[j], sizeof(g_player[i].ps->ammo_amount));
j += sizeof(g_player[i].ps->ammo_amount); j += sizeof(g_player[i].ps->ammo_amount);
Bmemcpy(&g_player[i].ps->inv_amount[0], &packbuf[j], sizeof(g_player[i].ps->inv_amount));
j += sizeof(g_player[i].ps->inv_amount);
Bmemcpy(&g_player[i].ps->last_weapon, &packbuf[j], sizeof(int16_t)); Bmemcpy(&g_player[i].ps->last_weapon, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&g_player[i].ps->wantweaponfire, &packbuf[j], sizeof(int16_t)); Bmemcpy(&g_player[i].ps->wantweaponfire, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&g_player[i].ps->frag_ps, &packbuf[j], sizeof(int16_t)); Bmemcpy(&g_player[i].ps->frag_ps, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&g_player[i].ps->frag, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t);
Bmemcpy(&g_player[i].ps->fraggedself, &packbuf[j], sizeof(int16_t)); Bmemcpy(&g_player[i].ps->fraggedself, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&g_player[i].ps->last_extra, &packbuf[j], sizeof(int16_t)); Bmemcpy(&g_player[i].ps->last_extra, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(g_player[i].frags, &packbuf[j], sizeof(g_player[i].frags)); Bmemcpy(g_player[i].frags, &packbuf[j], sizeof(g_player[i].frags));
j += sizeof(g_player[i].frags); j += sizeof(g_player[i].frags);
Bmemcpy(&g_player[i].ping, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t);
sprite[g_player[i].ps->i].pal = packbuf[j++];
l = i; l = i;
@ -1285,6 +1305,8 @@ process:
Bmemcpy(&g_player[other].ps->ang, &packbuf[j], sizeof(int16_t) * 2); Bmemcpy(&g_player[other].ps->ang, &packbuf[j], sizeof(int16_t) * 2);
Bmemcpy(&sprite[g_player[other].ps->i].ang, &packbuf[j], sizeof(int16_t)); Bmemcpy(&sprite[g_player[other].ps->i].ang, &packbuf[j], sizeof(int16_t));
j += sizeof(int16_t) * 2; j += sizeof(int16_t) * 2;
Bmemcpy(&g_player[other].ps->horiz, &packbuf[j], sizeof(int16_t) * 4);
j += sizeof(int16_t) * 4;
{ {
int16_t i = g_player[other].ps->i, jj = j++; int16_t i = g_player[other].ps->i, jj = j++;
@ -1301,7 +1323,7 @@ process:
break; break;
case PACKET_PLAYER_READY: case PACKET_PLAYER_READY:
if (net_server) if (net_server && g_player[myconnectindex].ps->gm & MODE_GAME)
{ {
packbuf[0] = PACKET_PLAYER_READY; packbuf[0] = PACKET_PLAYER_READY;
packbuf[1] = myconnectindex; packbuf[1] = myconnectindex;
@ -1374,17 +1396,18 @@ process:
break; break;
case PACKET_AUTH: case PACKET_AUTH:
for (i=1; i < packbufleng; i++) if (net_server)
tempbuf[i-1] = packbuf[i]; {
tempbuf[i-1] = 0; uint32_t crc;
i++; Bmemcpy(&crc, &packbuf[1], sizeof(int32_t));
if (!Bstrcmp(tempbuf, g_networkPassword)) if (crc == crc32once((uint8_t *)g_networkPassword, Bstrlen(g_networkPassword)))
Net_SyncPlayer(event); Net_SyncPlayer(event);
else else
{ {
enet_peer_disconnect(event->peer, 1); enet_peer_disconnect(event->peer, DISC_BAD_PASSWORD);
initprintf("Bad password: %s\n", tempbuf); initprintf("Bad password from client.\n");
}
} }
break; break;
@ -1403,6 +1426,8 @@ process:
for (i=0; i<playerswhenstarted-1; i++) connectpoint2[i] = i+1; for (i=0; i<playerswhenstarted-1; i++) connectpoint2[i] = i+1;
connectpoint2[playerswhenstarted-1] = -1; connectpoint2[playerswhenstarted-1] = -1;
S_PlaySound(DUKE_GETWEAPON2);
// myconnectindex is 0 until we get PACKET_PLAYER_INDEX // myconnectindex is 0 until we get PACKET_PLAYER_INDEX
if (net_client && myconnectindex != 0) if (net_client && myconnectindex != 0)
{ {
@ -1650,7 +1675,9 @@ void Net_GetPackets(void)
event.peer->state = ENET_PEER_STATE_CONNECTED; event.peer->state = ENET_PEER_STATE_CONNECTED;
} }
else enet_packet_destroy(event.packet); else enet_packet_destroy(event.packet);
lastpackettime = totalclock;
g_player[(intptr_t)event.peer->data].ping = (event.peer->lastRoundTripTime + event.peer->roundTripTime)/2;
break; break;
case ENET_EVENT_TYPE_DISCONNECT: case ENET_EVENT_TYPE_DISCONNECT:
numplayers--; numplayers--;
@ -1736,12 +1763,24 @@ void Net_GetPackets(void)
} }
else Net_ParsePacket(&event); else Net_ParsePacket(&event);
enet_packet_destroy (event.packet); enet_packet_destroy (event.packet);
lastpackettime = totalclock;
break; break;
case ENET_EVENT_TYPE_DISCONNECT: case ENET_EVENT_TYPE_DISCONNECT:
g_netDisconnect = 1; g_netDisconnect = 1;
initprintf (event.data == 1? "Bad password.\n" : "Disconnected.\n"); switch (event.data)
{
case DISC_BAD_PASSWORD:
initprintf("Bad password.\n");
return; return;
case DISC_KICKED:
initprintf("Kicked from server.\n");
return;
case DISC_BANNED:
initprintf("Banned from server.\n");
return;
default:
initprintf("Disconnected.\n");
return;
}
default: default:
break; break;
} }
@ -1814,6 +1853,8 @@ void faketimerhandler(void)
j += sizeof(vec3_t) * 3; j += sizeof(vec3_t) * 3;
Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->ang, sizeof(int16_t) * 2); Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->ang, sizeof(int16_t) * 2);
j += sizeof(int16_t) * 2; j += sizeof(int16_t) * 2;
Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->horiz, sizeof(int16_t) * 4);
j += sizeof(int16_t) * 4;
i = g_player[myconnectindex].ps->i; i = g_player[myconnectindex].ps->i;
@ -1877,14 +1918,14 @@ void faketimerhandler(void)
j += sizeof(vec3_t) * 3; j += sizeof(vec3_t) * 3;
Bmemcpy(&packbuf[j], &g_player[i].ps->ang, sizeof(int16_t) * 2); Bmemcpy(&packbuf[j], &g_player[i].ps->ang, sizeof(int16_t) * 2);
j += sizeof(int16_t) * 2; j += sizeof(int16_t) * 2;
Bmemcpy(&packbuf[j], &g_player[i].ps->horiz, sizeof(int16_t) * 4);
j += sizeof(int16_t) * 4;
Bmemcpy(&packbuf[j], &sprite[g_player[i].ps->i].extra, sizeof(int16_t)); Bmemcpy(&packbuf[j], &sprite[g_player[i].ps->i].extra, sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &sprite[g_player[i].ps->i].cstat, sizeof(int16_t)); Bmemcpy(&packbuf[j], &sprite[g_player[i].ps->i].cstat, sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &g_player[i].ps->kickback_pic, sizeof(int16_t)); Bmemcpy(&packbuf[j], &g_player[i].ps->kickback_pic, sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &g_player[i].ps->shield_amount, sizeof(int16_t));
j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &ActorExtra[g_player[i].ps->i].owner, sizeof(int16_t)); Bmemcpy(&packbuf[j], &ActorExtra[g_player[i].ps->i].owner, sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &ActorExtra[g_player[i].ps->i].picnum, sizeof(int16_t)); Bmemcpy(&packbuf[j], &ActorExtra[g_player[i].ps->i].picnum, sizeof(int16_t));
@ -1895,18 +1936,25 @@ void faketimerhandler(void)
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &g_player[i].ps->ammo_amount[0], sizeof(g_player[i].ps->ammo_amount)); Bmemcpy(&packbuf[j], &g_player[i].ps->ammo_amount[0], sizeof(g_player[i].ps->ammo_amount));
j += sizeof(g_player[i].ps->ammo_amount); j += sizeof(g_player[i].ps->ammo_amount);
Bmemcpy(&packbuf[j], &g_player[i].ps->inv_amount[0], sizeof(g_player[i].ps->inv_amount));
j += sizeof(g_player[i].ps->inv_amount);
Bmemcpy(&packbuf[j], &g_player[i].ps->last_weapon, sizeof(int16_t)); Bmemcpy(&packbuf[j], &g_player[i].ps->last_weapon, sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &g_player[i].ps->wantweaponfire, sizeof(int16_t)); Bmemcpy(&packbuf[j], &g_player[i].ps->wantweaponfire, sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &g_player[i].ps->frag_ps, sizeof(int16_t)); Bmemcpy(&packbuf[j], &g_player[i].ps->frag_ps, sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &g_player[i].ps->frag, sizeof(int16_t));
j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &g_player[i].ps->fraggedself, sizeof(int16_t)); Bmemcpy(&packbuf[j], &g_player[i].ps->fraggedself, sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &g_player[i].ps->last_extra, sizeof(int16_t)); Bmemcpy(&packbuf[j], &g_player[i].ps->last_extra, sizeof(int16_t));
j += sizeof(int16_t); j += sizeof(int16_t);
Bmemcpy(&packbuf[j], g_player[i].frags, sizeof(g_player[i].frags)); Bmemcpy(&packbuf[j], g_player[i].frags, sizeof(g_player[i].frags));
j += sizeof(g_player[i].frags); j += sizeof(g_player[i].frags);
Bmemcpy(&packbuf[j], &g_player[i].ping, sizeof(int16_t));
j += sizeof(int16_t);
packbuf[j++] = sprite[g_player[i].ps->i].pal;
l = i; l = i;
@ -2533,19 +2581,19 @@ static void G_DrawInventory(DukePlayer_t *p)
{ {
int32_t n, j = 0, xoff = 0, y; int32_t n, j = 0, xoff = 0, y;
n = (p->jetpack_amount > 0)<<3; n = (p->inv_amount[GET_JETPACK] > 0)<<3;
if (n&8) j++; if (n&8) j++;
n |= (p->scuba_amount > 0)<<5; n |= (p->inv_amount[GET_SCUBA] > 0)<<5;
if (n&32) j++; if (n&32) j++;
n |= (p->steroids_amount > 0)<<1; n |= (p->inv_amount[GET_STEROIDS] > 0)<<1;
if (n&2) j++; if (n&2) j++;
n |= (p->holoduke_amount > 0)<<2; n |= (p->inv_amount[GET_HOLODUKE] > 0)<<2;
if (n&4) j++; if (n&4) j++;
n |= (p->firstaid_amount > 0); n |= (p->inv_amount[GET_FIRSTAID] > 0);
if (n&1) j++; if (n&1) j++;
n |= (p->heat_amount > 0)<<4; n |= (p->inv_amount[GET_HEATS] > 0)<<4;
if (n&16) j++; if (n&16) j++;
n |= (p->boot_amount > 0)<<6; n |= (p->inv_amount[GET_BOOTS] > 0)<<6;
if (n&64) j++; if (n&64) j++;
xoff = 160-(j*11); xoff = 160-(j*11);
@ -2701,7 +2749,7 @@ static void G_DrawStatusBar(int32_t snum)
{ {
int32_t lAmount=Gv_GetVarByLabel("PLR_MORALE",-1, p->i, snum); int32_t lAmount=Gv_GetVarByLabel("PLR_MORALE",-1, p->i, snum);
if (lAmount == -1) lAmount = p->shield_amount; if (lAmount == -1) lAmount = p->inv_amount[GET_SHIELD];
G_DrawAltDigiNum(105,-(200-22),lAmount,-16,10+16); G_DrawAltDigiNum(105,-(200-22),lAmount,-16,10+16);
} }
@ -2774,28 +2822,28 @@ static void G_DrawStatusBar(int32_t snum)
switch (p->inven_icon) switch (p->inven_icon)
{ {
case 1: case 1:
i = p->firstaid_amount; i = p->inv_amount[GET_FIRSTAID];
break; break;
case 2: case 2:
i = ((p->steroids_amount+3)>>2); i = ((p->inv_amount[GET_STEROIDS]+3)>>2);
break; break;
case 3: case 3:
i = ((p->holoduke_amount+15)/24); i = ((p->inv_amount[GET_HOLODUKE]+15)/24);
j = p->holoduke_on; j = p->holoduke_on;
break; break;
case 4: case 4:
i = ((p->jetpack_amount+15)>>4); i = ((p->inv_amount[GET_JETPACK]+15)>>4);
j = p->jetpack_on; j = p->jetpack_on;
break; break;
case 5: case 5:
i = p->heat_amount/12; i = p->inv_amount[GET_HEATS]/12;
j = p->heat_on; j = p->heat_on;
break; break;
case 6: case 6:
i = ((p->scuba_amount+63)>>6); i = ((p->inv_amount[GET_SCUBA]+63)>>6);
break; break;
case 7: case 7:
i = (p->boot_amount>>1); i = (p->inv_amount[GET_BOOTS]>>1);
break; break;
} }
G_DrawInvNum(-(284-30-o),200-6-3,(uint8_t)i,0,10+permbit); G_DrawInvNum(-(284-30-o),200-6-3,(uint8_t)i,0,10+permbit);
@ -2873,28 +2921,28 @@ static void G_DrawStatusBar(int32_t snum)
switch (p->inven_icon) switch (p->inven_icon)
{ {
case 1: case 1:
i = p->firstaid_amount; i = p->inv_amount[GET_FIRSTAID];
break; break;
case 2: case 2:
i = ((p->steroids_amount+3)>>2); i = ((p->inv_amount[GET_STEROIDS]+3)>>2);
break; break;
case 3: case 3:
i = ((p->holoduke_amount+15)/24); i = ((p->inv_amount[GET_HOLODUKE]+15)/24);
j = p->holoduke_on; j = p->holoduke_on;
break; break;
case 4: case 4:
i = ((p->jetpack_amount+15)>>4); i = ((p->inv_amount[GET_JETPACK]+15)>>4);
j = p->jetpack_on; j = p->jetpack_on;
break; break;
case 5: case 5:
i = p->heat_amount/12; i = p->inv_amount[GET_HEATS]/12;
j = p->heat_on; j = p->heat_on;
break; break;
case 6: case 6:
i = ((p->scuba_amount+63)>>6); i = ((p->inv_amount[GET_SCUBA]+63)>>6);
break; break;
case 7: case 7:
i = (p->boot_amount>>1); i = (p->inv_amount[GET_BOOTS]>>1);
break; break;
} }
G_DrawInvNum(284-30-o,200-6,(uint8_t)i,0,10+permbit); G_DrawInvNum(284-30-o,200-6,(uint8_t)i,0,10+permbit);
@ -2935,18 +2983,18 @@ static void G_DrawStatusBar(int32_t snum)
int32_t lAmount=Gv_GetVarByLabel("PLR_MORALE",-1, p->i, snum); int32_t lAmount=Gv_GetVarByLabel("PLR_MORALE",-1, p->i, snum);
if (lAmount == -1) if (lAmount == -1)
{ {
if (sbar.shield_amount != p->shield_amount) if (sbar.inv_amount[GET_SHIELD] != p->inv_amount[GET_SHIELD])
{ {
sbar.shield_amount = p->shield_amount; sbar.inv_amount[GET_SHIELD] = p->inv_amount[GET_SHIELD];
u |= 2; u |= 2;
} }
} }
else else
{ {
if (sbar.shield_amount != lAmount) if (sbar.inv_amount[GET_SHIELD] != lAmount)
{ {
sbar.shield_amount = lAmount; sbar.inv_amount[GET_SHIELD] = lAmount;
u |= 2; u |= 2;
} }
@ -2997,39 +3045,39 @@ static void G_DrawStatusBar(int32_t snum)
sbar.heat_on = p->heat_on; sbar.heat_on = p->heat_on;
u |= (4096+8192); u |= (4096+8192);
} }
if (sbar.firstaid_amount != p->firstaid_amount) if (sbar.inv_amount[GET_FIRSTAID] != p->inv_amount[GET_FIRSTAID])
{ {
sbar.firstaid_amount = p->firstaid_amount; sbar.inv_amount[GET_FIRSTAID] = p->inv_amount[GET_FIRSTAID];
u |= 8192; u |= 8192;
} }
if (sbar.steroids_amount != p->steroids_amount) if (sbar.inv_amount[GET_STEROIDS] != p->inv_amount[GET_STEROIDS])
{ {
sbar.steroids_amount = p->steroids_amount; sbar.inv_amount[GET_STEROIDS] = p->inv_amount[GET_STEROIDS];
u |= 8192; u |= 8192;
} }
if (sbar.holoduke_amount != p->holoduke_amount) if (sbar.inv_amount[GET_HOLODUKE] != p->inv_amount[GET_HOLODUKE])
{ {
sbar.holoduke_amount = p->holoduke_amount; sbar.inv_amount[GET_HOLODUKE] = p->inv_amount[GET_HOLODUKE];
u |= 8192; u |= 8192;
} }
if (sbar.jetpack_amount != p->jetpack_amount) if (sbar.inv_amount[GET_JETPACK] != p->inv_amount[GET_JETPACK])
{ {
sbar.jetpack_amount = p->jetpack_amount; sbar.inv_amount[GET_JETPACK] = p->inv_amount[GET_JETPACK];
u |= 8192; u |= 8192;
} }
if (sbar.heat_amount != p->heat_amount) if (sbar.inv_amount[GET_HEATS] != p->inv_amount[GET_HEATS])
{ {
sbar.heat_amount = p->heat_amount; sbar.inv_amount[GET_HEATS] = p->inv_amount[GET_HEATS];
u |= 8192; u |= 8192;
} }
if (sbar.scuba_amount != p->scuba_amount) if (sbar.inv_amount[GET_SCUBA] != p->inv_amount[GET_SCUBA])
{ {
sbar.scuba_amount = p->scuba_amount; sbar.inv_amount[GET_SCUBA] = p->inv_amount[GET_SCUBA];
u |= 8192; u |= 8192;
} }
if (sbar.boot_amount != p->boot_amount) if (sbar.inv_amount[GET_BOOTS] != p->inv_amount[GET_BOOTS])
{ {
sbar.boot_amount = p->boot_amount; sbar.inv_amount[GET_BOOTS] = p->inv_amount[GET_BOOTS];
u |= 8192; u |= 8192;
} }
if (u == 0) return; if (u == 0) return;
@ -3090,7 +3138,7 @@ static void G_DrawStatusBar(int32_t snum)
int32_t lAmount=Gv_GetVarByLabel("PLR_MORALE",-1, p->i, snum); int32_t lAmount=Gv_GetVarByLabel("PLR_MORALE",-1, p->i, snum);
if (u != -1) G_PatchStatusBar(52,SBY+17,75,SBY+17+11); if (u != -1) G_PatchStatusBar(52,SBY+17,75,SBY+17+11);
if (lAmount == -1) if (lAmount == -1)
G_DrawDigiNum(64,SBY+17,p->shield_amount,-16,10+16); G_DrawDigiNum(64,SBY+17,p->inv_amount[GET_SHIELD],-16,10+16);
else else
G_DrawDigiNum(64,SBY+17,lAmount,-16,10+16); G_DrawDigiNum(64,SBY+17,lAmount,-16,10+16);
} }
@ -3179,25 +3227,25 @@ static void G_DrawStatusBar(int32_t snum)
switch (p->inven_icon) switch (p->inven_icon)
{ {
case 1: case 1:
i = p->firstaid_amount; i = p->inv_amount[GET_FIRSTAID];
break; break;
case 2: case 2:
i = ((p->steroids_amount+3)>>2); i = ((p->inv_amount[GET_STEROIDS]+3)>>2);
break; break;
case 3: case 3:
i = ((p->holoduke_amount+15)/24); i = ((p->inv_amount[GET_HOLODUKE]+15)/24);
break; break;
case 4: case 4:
i = ((p->jetpack_amount+15)>>4); i = ((p->inv_amount[GET_JETPACK]+15)>>4);
break; break;
case 5: case 5:
i = p->heat_amount/12; i = p->inv_amount[GET_HEATS]/12;
break; break;
case 6: case 6:
i = ((p->scuba_amount+63)>>6); i = ((p->inv_amount[GET_SCUBA]+63)>>6);
break; break;
case 7: case 7:
i = (p->boot_amount>>1); i = (p->inv_amount[GET_BOOTS]>>1);
break; break;
} }
G_DrawInvNum(284-30-o,SBY+28,(uint8_t)i,0,10+permbit); G_DrawInvNum(284-30-o,SBY+28,(uint8_t)i,0,10+permbit);
@ -3235,10 +3283,11 @@ static void G_PrintFPS(void)
// lag meter // lag meter
if (net_peer) if (net_peer)
{ {
chars = Bsprintf(tempbuf, "%d +- %d ms", net_peer->roundTripTime, net_peer->roundTripTimeVariance); chars = Bsprintf(tempbuf, "%d +- %d ms", (net_peer->lastRoundTripTime + net_peer->roundTripTime)/2,
(net_peer->lastRoundTripTimeVariance + net_peer->roundTripTimeVariance)/2);
printext256(windowx2-(chars<<(3-x))+1,windowy1+10+2,0,-1,tempbuf,x); printext256(windowx2-(chars<<(3-x))+1,windowy1+10+2,0,-1,tempbuf,x);
printext256(windowx2-(chars<<(3-x)),windowy1+10+1,net_peer->roundTripTime > 200 ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x); printext256(windowx2-(chars<<(3-x)),windowy1+10+1,net_peer->lastRoundTripTime > 200 ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x);
} }
} }
@ -7946,7 +7995,7 @@ PALONLY:
t->cstat |= 4; t->cstat |= 4;
} }
if (g_player[screenpeek].ps->heat_amount > 0 && g_player[screenpeek].ps->heat_on && if (g_player[screenpeek].ps->inv_amount[GET_HEATS] > 0 && g_player[screenpeek].ps->heat_on &&
(A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER)) (A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER))
{ {
t->pal = 6; t->pal = 6;
@ -8246,7 +8295,7 @@ void G_CheatGetInv(void)
X_OnEvent(EVENT_CHEATGETSTEROIDS, g_player[myconnectindex].ps->i, myconnectindex, -1); X_OnEvent(EVENT_CHEATGETSTEROIDS, g_player[myconnectindex].ps->i, myconnectindex, -1);
if (aGameVars[g_iReturnVarID].val.lValue >=0) if (aGameVars[g_iReturnVarID].val.lValue >=0)
{ {
g_player[myconnectindex].ps->steroids_amount = g_player[myconnectindex].ps->inv_amount[GET_STEROIDS] =
aGameVars[g_iReturnVarID].val.lValue; aGameVars[g_iReturnVarID].val.lValue;
} }
@ -8254,7 +8303,7 @@ void G_CheatGetInv(void)
X_OnEvent(EVENT_CHEATGETHEAT, g_player[myconnectindex].ps->i, myconnectindex, -1); X_OnEvent(EVENT_CHEATGETHEAT, g_player[myconnectindex].ps->i, myconnectindex, -1);
if (aGameVars[g_iReturnVarID].val.lValue >=0) if (aGameVars[g_iReturnVarID].val.lValue >=0)
{ {
g_player[myconnectindex].ps->heat_amount = g_player[myconnectindex].ps->inv_amount[GET_HEATS] =
aGameVars[g_iReturnVarID].val.lValue; aGameVars[g_iReturnVarID].val.lValue;
} }
@ -8262,7 +8311,7 @@ void G_CheatGetInv(void)
X_OnEvent(EVENT_CHEATGETBOOT, g_player[myconnectindex].ps->i, myconnectindex, -1); X_OnEvent(EVENT_CHEATGETBOOT, g_player[myconnectindex].ps->i, myconnectindex, -1);
if (aGameVars[g_iReturnVarID].val.lValue >=0) if (aGameVars[g_iReturnVarID].val.lValue >=0)
{ {
g_player[myconnectindex].ps->boot_amount = g_player[myconnectindex].ps->inv_amount[GET_BOOTS] =
aGameVars[g_iReturnVarID].val.lValue; aGameVars[g_iReturnVarID].val.lValue;
} }
@ -8270,7 +8319,7 @@ void G_CheatGetInv(void)
X_OnEvent(EVENT_CHEATGETSHIELD, g_player[myconnectindex].ps->i, myconnectindex, -1); X_OnEvent(EVENT_CHEATGETSHIELD, g_player[myconnectindex].ps->i, myconnectindex, -1);
if (aGameVars[g_iReturnVarID].val.lValue >=0) if (aGameVars[g_iReturnVarID].val.lValue >=0)
{ {
g_player[myconnectindex].ps->shield_amount = g_player[myconnectindex].ps->inv_amount[GET_SHIELD] =
aGameVars[g_iReturnVarID].val.lValue; aGameVars[g_iReturnVarID].val.lValue;
} }
@ -8278,7 +8327,7 @@ void G_CheatGetInv(void)
X_OnEvent(EVENT_CHEATGETSCUBA, g_player[myconnectindex].ps->i, myconnectindex, -1); X_OnEvent(EVENT_CHEATGETSCUBA, g_player[myconnectindex].ps->i, myconnectindex, -1);
if (aGameVars[g_iReturnVarID].val.lValue >=0) if (aGameVars[g_iReturnVarID].val.lValue >=0)
{ {
g_player[myconnectindex].ps->scuba_amount = g_player[myconnectindex].ps->inv_amount[GET_SCUBA] =
aGameVars[g_iReturnVarID].val.lValue; aGameVars[g_iReturnVarID].val.lValue;
} }
@ -8286,7 +8335,7 @@ void G_CheatGetInv(void)
X_OnEvent(EVENT_CHEATGETHOLODUKE, g_player[myconnectindex].ps->i, myconnectindex, -1); X_OnEvent(EVENT_CHEATGETHOLODUKE, g_player[myconnectindex].ps->i, myconnectindex, -1);
if (aGameVars[g_iReturnVarID].val.lValue >=0) if (aGameVars[g_iReturnVarID].val.lValue >=0)
{ {
g_player[myconnectindex].ps->holoduke_amount = g_player[myconnectindex].ps->inv_amount[GET_HOLODUKE] =
aGameVars[g_iReturnVarID].val.lValue; aGameVars[g_iReturnVarID].val.lValue;
} }
@ -8294,7 +8343,7 @@ void G_CheatGetInv(void)
X_OnEvent(EVENT_CHEATGETJETPACK, g_player[myconnectindex].ps->i, myconnectindex, -1); X_OnEvent(EVENT_CHEATGETJETPACK, g_player[myconnectindex].ps->i, myconnectindex, -1);
if (aGameVars[g_iReturnVarID].val.lValue >=0) if (aGameVars[g_iReturnVarID].val.lValue >=0)
{ {
g_player[myconnectindex].ps->jetpack_amount = g_player[myconnectindex].ps->inv_amount[GET_JETPACK] =
aGameVars[g_iReturnVarID].val.lValue; aGameVars[g_iReturnVarID].val.lValue;
} }
@ -8302,7 +8351,7 @@ void G_CheatGetInv(void)
X_OnEvent(EVENT_CHEATGETFIRSTAID, g_player[myconnectindex].ps->i, myconnectindex, -1); X_OnEvent(EVENT_CHEATGETFIRSTAID, g_player[myconnectindex].ps->i, myconnectindex, -1);
if (aGameVars[g_iReturnVarID].val.lValue >=0) if (aGameVars[g_iReturnVarID].val.lValue >=0)
{ {
g_player[myconnectindex].ps->firstaid_amount = g_player[myconnectindex].ps->inv_amount[GET_FIRSTAID] =
aGameVars[g_iReturnVarID].val.lValue; aGameVars[g_iReturnVarID].val.lValue;
} }
} }
@ -8709,8 +8758,8 @@ FOUNDCHEAT:
return; return;
case CHEAT_HYPER: case CHEAT_HYPER:
g_player[myconnectindex].ps->steroids_amount = 399; g_player[myconnectindex].ps->inv_amount[GET_STEROIDS] = 399;
g_player[myconnectindex].ps->heat_amount = 1200; g_player[myconnectindex].ps->inv_amount[GET_HEATS] = 1200;
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
P_DoQuote(37,g_player[myconnectindex].ps); P_DoQuote(37,g_player[myconnectindex].ps);
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
@ -8781,78 +8830,36 @@ FOUNDCHEAT:
static void G_ShowScores(void) static void G_ShowScores(void)
{ {
int32_t t, i, y,xfragtotal,yfragtotal; int32_t t, i;
if (playerswhenstarted > 1 && (GametypeFlags[ud.coop]&GAMETYPE_SCORESHEET)) if (playerswhenstarted > 1 && (GametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
{ {
/*
rotatesprite(160<<16,34<<16,65536L,0,INGAMEDUKETHREEDEE,0,0,10,0,0,xdim-1,ydim-1);
if (PLUTOPAK) // JBF 20030804
rotatesprite((260)<<16,36<<16,65536L,0,PLUTOPAKSPRITE+2,0,0,2+8,0,0,xdim-1,ydim-1);
*/
gametext(160,SCORESHEETOFFSET+58+2,"MULTIPLAYER TOTALS",0,2+8+16); gametext(160,SCORESHEETOFFSET+58+2,"MULTIPLAYER TOTALS",0,2+8+16);
gametext(160,SCORESHEETOFFSET+58+10,MapInfo[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name,0,2+8+16); gametext(160,SCORESHEETOFFSET+58+10,MapInfo[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name,0,2+8+16);
// gametext(160,165,"PRESS ANY KEY TO CONTINUE",0,2+8+16);
t = 0; t = 0;
minitext(23,SCORESHEETOFFSET+80," NAME KILLS",8,2+8+16+128); minitext(70,SCORESHEETOFFSET+80,"NAME",8,2+8+16+128);
for (i=playerswhenstarted-1; i>=0; i--) minitext(170,SCORESHEETOFFSET+80,"FRAGS",8,2+8+16+128);
{ minitext(200,SCORESHEETOFFSET+80,"DEATHS",8,2+8+16+128);
Bsprintf(tempbuf,"%-4d",i+1); minitext(235,SCORESHEETOFFSET+80,"PING",8,2+8+16+128);
minitext(92+(i*23),SCORESHEETOFFSET+80,tempbuf,3,2+8+16+128);
}
for (i=playerswhenstarted-1; i>=0; i--) for (i=playerswhenstarted-1; i>=0; i--)
{ {
xfragtotal = 0; if (!g_player[i].playerquitflag) continue;
Bsprintf(tempbuf,"%d",i+1);
minitext(30,SCORESHEETOFFSET+90+t,tempbuf,0,2+8+16+128); minitext(70,SCORESHEETOFFSET+90+t,g_player[i].user_name,g_player[i].ps->palookup,2+8+16+128);
minitext(38,SCORESHEETOFFSET+90+t,g_player[i].user_name,g_player[i].ps->palookup,2+8+16+128);
for (y=playerswhenstarted-1; y>=0; y--) Bsprintf(tempbuf,"%-4d",g_player[i].ps->frag);
{ minitext(170,SCORESHEETOFFSET+90+t,tempbuf,2,2+8+16+128);
if (i == y)
{
Bsprintf(tempbuf,"%-4d",g_player[y].ps->fraggedself);
minitext(92+(y*23),SCORESHEETOFFSET+90+t,tempbuf,2,2+8+16+128);
xfragtotal -= g_player[y].ps->fraggedself;
}
else
{
Bsprintf(tempbuf,"%-4d",g_player[i].frags[y]);
minitext(92+(y*23),SCORESHEETOFFSET+90+t,tempbuf,0,2+8+16+128);
xfragtotal += g_player[i].frags[y];
}
if (net_server) Bsprintf(tempbuf,"%-4d", g_player[i].frags[i] + g_player[i].ps->fraggedself);
{ minitext(200,SCORESHEETOFFSET+90+t,tempbuf,2,2+8+16+128);
Bsprintf(tempbuf,"stats %d killed %d %d\n",i+1,y+1,g_player[i].frags[y]);
sendscore(tempbuf);
}
}
Bsprintf(tempbuf,"%-4d",xfragtotal); Bsprintf(tempbuf,"%-4d",g_player[i].ping);
minitext(101+(8*23),SCORESHEETOFFSET+90+t,tempbuf,2,2+8+16+128); minitext(235,SCORESHEETOFFSET+90+t,tempbuf,2,2+8+16+128);
t += 7; t += 7;
} }
for (y=playerswhenstarted-1; y>=0; y--)
{
yfragtotal = 0;
for (i=playerswhenstarted-1; i>=0; i--)
{
if (i == y)
yfragtotal += g_player[i].ps->fraggedself;
yfragtotal += g_player[i].frags[y];
}
Bsprintf(tempbuf,"%-4d",yfragtotal);
minitext(92+(y*23),SCORESHEETOFFSET+96+(8*7),tempbuf,2,2+8+16+128);
}
minitext(45,SCORESHEETOFFSET+96+(8*7),"DEATHS",8,2+8+16+128);
} }
} }
@ -10564,8 +10571,6 @@ static void G_DisplayLogo(void)
MOUSE_ClearButton(LEFT_MOUSE); MOUSE_ClearButton(LEFT_MOUSE);
} }
Net_WaitForEverybody();
flushperms(); flushperms();
clearview(0L); clearview(0L);
nextpage(); nextpage();
@ -11642,8 +11647,6 @@ MAIN_LOOP_RESTART:
ud.m_respawn_monsters = 1; ud.m_respawn_monsters = 1;
else ud.m_respawn_monsters = 0; else ud.m_respawn_monsters = 0;
Net_WaitForEverybody();
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
{ {
P_ResetWeapons(i); P_ResetWeapons(i);
@ -11653,6 +11656,8 @@ MAIN_LOOP_RESTART:
G_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 (G_EnterLevel(MODE_GAME)) G_BackToMenu(); if (G_EnterLevel(MODE_GAME)) G_BackToMenu();
Net_WaitForEverybody();
} }
else G_DisplayLogo(); else G_DisplayLogo();
@ -11718,7 +11723,6 @@ MAIN_LOOP_RESTART:
if (g_player[myconnectindex].ps->gm&MODE_EOL) if (g_player[myconnectindex].ps->gm&MODE_EOL)
{ {
G_CloseDemoWrite(); G_CloseDemoWrite();
Net_WaitForEverybody();
ready2send = 0; ready2send = 0;
@ -11751,13 +11755,13 @@ MAIN_LOOP_RESTART:
} }
ud.display_bonus_screen = 1; ud.display_bonus_screen = 1;
ready2send = 0; ready2send = 0;
Net_WaitForEverybody();
if (numplayers > 1) g_player[myconnectindex].ps->gm = MODE_GAME; if (numplayers > 1) g_player[myconnectindex].ps->gm = MODE_GAME;
if (G_EnterLevel(g_player[myconnectindex].ps->gm)) if (G_EnterLevel(g_player[myconnectindex].ps->gm))
{ {
G_BackToMenu(); G_BackToMenu();
goto MAIN_LOOP_RESTART; goto MAIN_LOOP_RESTART;
} }
Net_WaitForEverybody();
continue; continue;
} }

View file

@ -2820,28 +2820,28 @@ nullquote:
switch (*(insptr-1)) switch (*(insptr-1))
{ {
case GET_STEROIDS: case GET_STEROIDS:
g_player[vm.g_p].ps->steroids_amount = *insptr; g_player[vm.g_p].ps->inv_amount[GET_STEROIDS] = *insptr;
g_player[vm.g_p].ps->inven_icon = 2; g_player[vm.g_p].ps->inven_icon = 2;
break; break;
case GET_SHIELD: case GET_SHIELD:
g_player[vm.g_p].ps->shield_amount += *insptr;// 100; g_player[vm.g_p].ps->inv_amount[GET_SHIELD] += *insptr;// 100;
if (g_player[vm.g_p].ps->shield_amount > g_player[vm.g_p].ps->max_shield_amount) if (g_player[vm.g_p].ps->inv_amount[GET_SHIELD] > g_player[vm.g_p].ps->max_shield_amount)
g_player[vm.g_p].ps->shield_amount = g_player[vm.g_p].ps->max_shield_amount; g_player[vm.g_p].ps->inv_amount[GET_SHIELD] = g_player[vm.g_p].ps->max_shield_amount;
break; break;
case GET_SCUBA: case GET_SCUBA:
g_player[vm.g_p].ps->scuba_amount = *insptr;// 1600; g_player[vm.g_p].ps->inv_amount[GET_SCUBA] = *insptr;// 1600;
g_player[vm.g_p].ps->inven_icon = 6; g_player[vm.g_p].ps->inven_icon = 6;
break; break;
case GET_HOLODUKE: case GET_HOLODUKE:
g_player[vm.g_p].ps->holoduke_amount = *insptr;// 1600; g_player[vm.g_p].ps->inv_amount[GET_HOLODUKE] = *insptr;// 1600;
g_player[vm.g_p].ps->inven_icon = 3; g_player[vm.g_p].ps->inven_icon = 3;
break; break;
case GET_JETPACK: case GET_JETPACK:
g_player[vm.g_p].ps->jetpack_amount = *insptr;// 1600; g_player[vm.g_p].ps->inv_amount[GET_JETPACK] = *insptr;// 1600;
g_player[vm.g_p].ps->inven_icon = 4; g_player[vm.g_p].ps->inven_icon = 4;
break; break;
@ -2861,18 +2861,18 @@ nullquote:
break; break;
case GET_HEATS: case GET_HEATS:
g_player[vm.g_p].ps->heat_amount = *insptr; g_player[vm.g_p].ps->inv_amount[GET_HEATS] = *insptr;
g_player[vm.g_p].ps->inven_icon = 5; g_player[vm.g_p].ps->inven_icon = 5;
break; break;
case GET_FIRSTAID: case GET_FIRSTAID:
g_player[vm.g_p].ps->inven_icon = 1; g_player[vm.g_p].ps->inven_icon = 1;
g_player[vm.g_p].ps->firstaid_amount = *insptr; g_player[vm.g_p].ps->inv_amount[GET_FIRSTAID] = *insptr;
break; break;
case GET_BOOTS: case GET_BOOTS:
g_player[vm.g_p].ps->inven_icon = 7; g_player[vm.g_p].ps->inven_icon = 7;
g_player[vm.g_p].ps->boot_amount = *insptr; g_player[vm.g_p].ps->inv_amount[GET_BOOTS] = *insptr;
break; break;
default: default:
OSD_Printf(CON_ERROR "Invalid inventory ID %d\n",g_errorLineNum,keyw[g_tw],*(insptr-1)); OSD_Printf(CON_ERROR "Invalid inventory ID %d\n",g_errorLineNum,keyw[g_tw],*(insptr-1));
@ -2928,7 +2928,7 @@ nullquote:
j = 1; j = 1;
else if ((l&2048) && g_player[vm.g_p].ps->jetpack_on) else if ((l&2048) && g_player[vm.g_p].ps->jetpack_on)
j = 1; j = 1;
else if ((l&4096) && g_player[vm.g_p].ps->steroids_amount > 0 && g_player[vm.g_p].ps->steroids_amount < 400) else if ((l&4096) && g_player[vm.g_p].ps->inv_amount[GET_STEROIDS] > 0 && g_player[vm.g_p].ps->inv_amount[GET_STEROIDS] < 400)
j = 1; j = 1;
else if ((l&8192) && g_player[vm.g_p].ps->on_ground) else if ((l&8192) && g_player[vm.g_p].ps->on_ground)
j = 1; j = 1;
@ -4395,21 +4395,21 @@ nullquote:
switch (*insptr++) switch (*insptr++)
{ {
case GET_STEROIDS: case GET_STEROIDS:
if (g_player[vm.g_p].ps->steroids_amount != *insptr) if (g_player[vm.g_p].ps->inv_amount[GET_STEROIDS] != *insptr)
j = 1; j = 1;
break; break;
case GET_SHIELD: case GET_SHIELD:
if (g_player[vm.g_p].ps->shield_amount != g_player[vm.g_p].ps->max_shield_amount) if (g_player[vm.g_p].ps->inv_amount[GET_SHIELD] != g_player[vm.g_p].ps->max_shield_amount)
j = 1; j = 1;
break; break;
case GET_SCUBA: case GET_SCUBA:
if (g_player[vm.g_p].ps->scuba_amount != *insptr) j = 1; if (g_player[vm.g_p].ps->inv_amount[GET_SCUBA] != *insptr) j = 1;
break; break;
case GET_HOLODUKE: case GET_HOLODUKE:
if (g_player[vm.g_p].ps->holoduke_amount != *insptr) j = 1; if (g_player[vm.g_p].ps->inv_amount[GET_HOLODUKE] != *insptr) j = 1;
break; break;
case GET_JETPACK: case GET_JETPACK:
if (g_player[vm.g_p].ps->jetpack_amount != *insptr) j = 1; if (g_player[vm.g_p].ps->inv_amount[GET_JETPACK] != *insptr) j = 1;
break; break;
case GET_ACCESS: case GET_ACCESS:
switch (vm.g_sp->pal) switch (vm.g_sp->pal)
@ -4426,13 +4426,13 @@ nullquote:
} }
break; break;
case GET_HEATS: case GET_HEATS:
if (g_player[vm.g_p].ps->heat_amount != *insptr) j = 1; if (g_player[vm.g_p].ps->inv_amount[GET_HEATS] != *insptr) j = 1;
break; break;
case GET_FIRSTAID: case GET_FIRSTAID:
if (g_player[vm.g_p].ps->firstaid_amount != *insptr) j = 1; if (g_player[vm.g_p].ps->inv_amount[GET_FIRSTAID] != *insptr) j = 1;
break; break;
case GET_BOOTS: case GET_BOOTS:
if (g_player[vm.g_p].ps->boot_amount != *insptr) j = 1; if (g_player[vm.g_p].ps->inv_amount[GET_BOOTS] != *insptr) j = 1;
break; break;
default: default:
OSD_Printf(CON_ERROR "invalid inventory ID: %d\n",g_errorLineNum,keyw[g_tw],*(insptr-1)); OSD_Printf(CON_ERROR "invalid inventory ID: %d\n",g_errorLineNum,keyw[g_tw],*(insptr-1));
@ -5047,7 +5047,6 @@ void G_RestoreMapState(mapstate_t *save)
Net_ResetPrediction(); Net_ResetPrediction();
Net_WaitForEverybody();
clearfifo(); clearfifo();
G_ResetTimers(); G_ResetTimers();
} }

View file

@ -1317,7 +1317,7 @@ static void __fastcall X_GetPlayer(register int32_t lVar1, register int32_t lLab
case PLAYER_WANTWEAPONFIRE: case PLAYER_WANTWEAPONFIRE:
Gv_SetVar(lVar2, g_player[iPlayer].ps->wantweaponfire, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->wantweaponfire, vm.g_i, vm.g_p); return;
case PLAYER_HOLODUKE_AMOUNT: case PLAYER_HOLODUKE_AMOUNT:
Gv_SetVar(lVar2, g_player[iPlayer].ps->holoduke_amount, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_HOLODUKE], vm.g_i, vm.g_p); return;
case PLAYER_NEWOWNER: case PLAYER_NEWOWNER:
Gv_SetVar(lVar2, g_player[iPlayer].ps->newowner, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->newowner, vm.g_i, vm.g_p); return;
case PLAYER_HURT_DELAY: case PLAYER_HURT_DELAY:
@ -1347,7 +1347,7 @@ static void __fastcall X_GetPlayer(register int32_t lVar1, register int32_t lLab
case PLAYER_WEAPON_ANG: case PLAYER_WEAPON_ANG:
Gv_SetVar(lVar2, g_player[iPlayer].ps->weapon_ang, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->weapon_ang, vm.g_i, vm.g_p); return;
case PLAYER_FIRSTAID_AMOUNT: case PLAYER_FIRSTAID_AMOUNT:
Gv_SetVar(lVar2, g_player[iPlayer].ps->firstaid_amount, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_FIRSTAID], vm.g_i, vm.g_p); return;
case PLAYER_SOMETHINGONPLAYER: case PLAYER_SOMETHINGONPLAYER:
Gv_SetVar(lVar2, g_player[iPlayer].ps->somethingonplayer, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->somethingonplayer, vm.g_i, vm.g_p); return;
case PLAYER_ON_CRANE: case PLAYER_ON_CRANE:
@ -1373,7 +1373,7 @@ static void __fastcall X_GetPlayer(register int32_t lVar1, register int32_t lLab
case PLAYER_QUICK_KICK: case PLAYER_QUICK_KICK:
Gv_SetVar(lVar2, g_player[iPlayer].ps->quick_kick, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->quick_kick, vm.g_i, vm.g_p); return;
case PLAYER_HEAT_AMOUNT: case PLAYER_HEAT_AMOUNT:
Gv_SetVar(lVar2, g_player[iPlayer].ps->heat_amount, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_HEATS], vm.g_i, vm.g_p); return;
case PLAYER_ACTORSQU: case PLAYER_ACTORSQU:
Gv_SetVar(lVar2, g_player[iPlayer].ps->actorsqu, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->actorsqu, vm.g_i, vm.g_p); return;
case PLAYER_TIMEBEFOREEXIT: case PLAYER_TIMEBEFOREEXIT:
@ -1393,13 +1393,13 @@ static void __fastcall X_GetPlayer(register int32_t lVar1, register int32_t lLab
case PLAYER_SHOW_EMPTY_WEAPON: case PLAYER_SHOW_EMPTY_WEAPON:
Gv_SetVar(lVar2, g_player[iPlayer].ps->show_empty_weapon, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->show_empty_weapon, vm.g_i, vm.g_p); return;
case PLAYER_SCUBA_AMOUNT: case PLAYER_SCUBA_AMOUNT:
Gv_SetVar(lVar2, g_player[iPlayer].ps->scuba_amount, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_SCUBA], vm.g_i, vm.g_p); return;
case PLAYER_JETPACK_AMOUNT: case PLAYER_JETPACK_AMOUNT:
Gv_SetVar(lVar2, g_player[iPlayer].ps->jetpack_amount, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_JETPACK], vm.g_i, vm.g_p); return;
case PLAYER_STEROIDS_AMOUNT: case PLAYER_STEROIDS_AMOUNT:
Gv_SetVar(lVar2, g_player[iPlayer].ps->steroids_amount, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_STEROIDS], vm.g_i, vm.g_p); return;
case PLAYER_SHIELD_AMOUNT: case PLAYER_SHIELD_AMOUNT:
Gv_SetVar(lVar2, g_player[iPlayer].ps->shield_amount, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_SHIELD], vm.g_i, vm.g_p); return;
case PLAYER_HOLODUKE_ON: case PLAYER_HOLODUKE_ON:
Gv_SetVar(lVar2, g_player[iPlayer].ps->holoduke_on, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->holoduke_on, vm.g_i, vm.g_p); return;
case PLAYER_PYCOUNT: case PLAYER_PYCOUNT:
@ -1415,7 +1415,7 @@ static void __fastcall X_GetPlayer(register int32_t lVar1, register int32_t lLab
case PLAYER_FOOTPRINTSHADE: case PLAYER_FOOTPRINTSHADE:
Gv_SetVar(lVar2, g_player[iPlayer].ps->footprintshade, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->footprintshade, vm.g_i, vm.g_p); return;
case PLAYER_BOOT_AMOUNT: case PLAYER_BOOT_AMOUNT:
Gv_SetVar(lVar2, g_player[iPlayer].ps->boot_amount, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->inv_amount[GET_BOOTS], vm.g_i, vm.g_p); return;
case PLAYER_SCREAM_VOICE: case PLAYER_SCREAM_VOICE:
Gv_SetVar(lVar2, g_player[iPlayer].ps->scream_voice, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->scream_voice, vm.g_i, vm.g_p); return;
case PLAYER_GM: case PLAYER_GM:
@ -1641,7 +1641,7 @@ static void __fastcall X_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVar
case PLAYER_WANTWEAPONFIRE: case PLAYER_WANTWEAPONFIRE:
g_player[iPlayer].ps->wantweaponfire=lVar1; return; g_player[iPlayer].ps->wantweaponfire=lVar1; return;
case PLAYER_HOLODUKE_AMOUNT: case PLAYER_HOLODUKE_AMOUNT:
g_player[iPlayer].ps->holoduke_amount=lVar1; return; g_player[iPlayer].ps->inv_amount[GET_HOLODUKE]=lVar1; return;
case PLAYER_NEWOWNER: case PLAYER_NEWOWNER:
g_player[iPlayer].ps->newowner=lVar1; return; g_player[iPlayer].ps->newowner=lVar1; return;
case PLAYER_HURT_DELAY: case PLAYER_HURT_DELAY:
@ -1671,7 +1671,7 @@ static void __fastcall X_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVar
case PLAYER_WEAPON_ANG: case PLAYER_WEAPON_ANG:
g_player[iPlayer].ps->weapon_ang=lVar1; return; g_player[iPlayer].ps->weapon_ang=lVar1; return;
case PLAYER_FIRSTAID_AMOUNT: case PLAYER_FIRSTAID_AMOUNT:
g_player[iPlayer].ps->firstaid_amount=lVar1; return; g_player[iPlayer].ps->inv_amount[GET_FIRSTAID]=lVar1; return;
case PLAYER_SOMETHINGONPLAYER: case PLAYER_SOMETHINGONPLAYER:
g_player[iPlayer].ps->somethingonplayer=lVar1; return; g_player[iPlayer].ps->somethingonplayer=lVar1; return;
case PLAYER_ON_CRANE: case PLAYER_ON_CRANE:
@ -1697,7 +1697,7 @@ static void __fastcall X_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVar
case PLAYER_QUICK_KICK: case PLAYER_QUICK_KICK:
g_player[iPlayer].ps->quick_kick=lVar1; return; g_player[iPlayer].ps->quick_kick=lVar1; return;
case PLAYER_HEAT_AMOUNT: case PLAYER_HEAT_AMOUNT:
g_player[iPlayer].ps->heat_amount=lVar1; return; g_player[iPlayer].ps->inv_amount[GET_HEATS]=lVar1; return;
case PLAYER_ACTORSQU: case PLAYER_ACTORSQU:
g_player[iPlayer].ps->actorsqu=lVar1; return; g_player[iPlayer].ps->actorsqu=lVar1; return;
case PLAYER_TIMEBEFOREEXIT: case PLAYER_TIMEBEFOREEXIT:
@ -1717,13 +1717,13 @@ static void __fastcall X_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVar
case PLAYER_SHOW_EMPTY_WEAPON: case PLAYER_SHOW_EMPTY_WEAPON:
g_player[iPlayer].ps->show_empty_weapon=lVar1; return; g_player[iPlayer].ps->show_empty_weapon=lVar1; return;
case PLAYER_SCUBA_AMOUNT: case PLAYER_SCUBA_AMOUNT:
g_player[iPlayer].ps->scuba_amount=lVar1; return; g_player[iPlayer].ps->inv_amount[GET_SCUBA]=lVar1; return;
case PLAYER_JETPACK_AMOUNT: case PLAYER_JETPACK_AMOUNT:
g_player[iPlayer].ps->jetpack_amount=lVar1; return; g_player[iPlayer].ps->inv_amount[GET_JETPACK]=lVar1; return;
case PLAYER_STEROIDS_AMOUNT: case PLAYER_STEROIDS_AMOUNT:
g_player[iPlayer].ps->steroids_amount=lVar1; return; g_player[iPlayer].ps->inv_amount[GET_STEROIDS]=lVar1; return;
case PLAYER_SHIELD_AMOUNT: case PLAYER_SHIELD_AMOUNT:
g_player[iPlayer].ps->shield_amount=lVar1; return; g_player[iPlayer].ps->inv_amount[GET_SHIELD]=lVar1; return;
case PLAYER_HOLODUKE_ON: case PLAYER_HOLODUKE_ON:
g_player[iPlayer].ps->holoduke_on=lVar1; return; g_player[iPlayer].ps->holoduke_on=lVar1; return;
case PLAYER_PYCOUNT: case PLAYER_PYCOUNT:
@ -1739,7 +1739,7 @@ static void __fastcall X_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVar
case PLAYER_FOOTPRINTSHADE: case PLAYER_FOOTPRINTSHADE:
g_player[iPlayer].ps->footprintshade=lVar1; return; g_player[iPlayer].ps->footprintshade=lVar1; return;
case PLAYER_BOOT_AMOUNT: case PLAYER_BOOT_AMOUNT:
g_player[iPlayer].ps->boot_amount=lVar1; return; g_player[iPlayer].ps->inv_amount[GET_BOOTS]=lVar1; return;
case PLAYER_SCREAM_VOICE: case PLAYER_SCREAM_VOICE:
g_player[iPlayer].ps->scream_voice=lVar1; return; g_player[iPlayer].ps->scream_voice=lVar1; return;
case PLAYER_GM: case PLAYER_GM:
@ -3549,7 +3549,7 @@ static int32_t __fastcall X_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int
case PLAYER_WANTWEAPONFIRE: case PLAYER_WANTWEAPONFIRE:
return g_player[iPlayer].ps->wantweaponfire; return g_player[iPlayer].ps->wantweaponfire;
case PLAYER_HOLODUKE_AMOUNT: case PLAYER_HOLODUKE_AMOUNT:
return g_player[iPlayer].ps->holoduke_amount; return g_player[iPlayer].ps->inv_amount[GET_HOLODUKE];
case PLAYER_NEWOWNER: case PLAYER_NEWOWNER:
return g_player[iPlayer].ps->newowner; return g_player[iPlayer].ps->newowner;
case PLAYER_HURT_DELAY: case PLAYER_HURT_DELAY:
@ -3579,7 +3579,7 @@ static int32_t __fastcall X_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int
case PLAYER_WEAPON_ANG: case PLAYER_WEAPON_ANG:
return g_player[iPlayer].ps->weapon_ang; return g_player[iPlayer].ps->weapon_ang;
case PLAYER_FIRSTAID_AMOUNT: case PLAYER_FIRSTAID_AMOUNT:
return g_player[iPlayer].ps->firstaid_amount; return g_player[iPlayer].ps->inv_amount[GET_FIRSTAID];
case PLAYER_SOMETHINGONPLAYER: case PLAYER_SOMETHINGONPLAYER:
return g_player[iPlayer].ps->somethingonplayer; return g_player[iPlayer].ps->somethingonplayer;
case PLAYER_ON_CRANE: case PLAYER_ON_CRANE:
@ -3605,7 +3605,7 @@ static int32_t __fastcall X_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int
case PLAYER_QUICK_KICK: case PLAYER_QUICK_KICK:
return g_player[iPlayer].ps->quick_kick; return g_player[iPlayer].ps->quick_kick;
case PLAYER_HEAT_AMOUNT: case PLAYER_HEAT_AMOUNT:
return g_player[iPlayer].ps->heat_amount; return g_player[iPlayer].ps->inv_amount[GET_HEATS];
case PLAYER_ACTORSQU: case PLAYER_ACTORSQU:
return g_player[iPlayer].ps->actorsqu; return g_player[iPlayer].ps->actorsqu;
case PLAYER_TIMEBEFOREEXIT: case PLAYER_TIMEBEFOREEXIT:
@ -3625,13 +3625,13 @@ static int32_t __fastcall X_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int
case PLAYER_SHOW_EMPTY_WEAPON: case PLAYER_SHOW_EMPTY_WEAPON:
return g_player[iPlayer].ps->show_empty_weapon; return g_player[iPlayer].ps->show_empty_weapon;
case PLAYER_SCUBA_AMOUNT: case PLAYER_SCUBA_AMOUNT:
return g_player[iPlayer].ps->scuba_amount; return g_player[iPlayer].ps->inv_amount[GET_SCUBA];
case PLAYER_JETPACK_AMOUNT: case PLAYER_JETPACK_AMOUNT:
return g_player[iPlayer].ps->jetpack_amount; return g_player[iPlayer].ps->inv_amount[GET_JETPACK];
case PLAYER_STEROIDS_AMOUNT: case PLAYER_STEROIDS_AMOUNT:
return g_player[iPlayer].ps->steroids_amount; return g_player[iPlayer].ps->inv_amount[GET_STEROIDS];
case PLAYER_SHIELD_AMOUNT: case PLAYER_SHIELD_AMOUNT:
return g_player[iPlayer].ps->shield_amount; return g_player[iPlayer].ps->inv_amount[GET_SHIELD];
case PLAYER_HOLODUKE_ON: case PLAYER_HOLODUKE_ON:
return g_player[iPlayer].ps->holoduke_on; return g_player[iPlayer].ps->holoduke_on;
case PLAYER_PYCOUNT: case PLAYER_PYCOUNT:
@ -3647,7 +3647,7 @@ static int32_t __fastcall X_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int
case PLAYER_FOOTPRINTSHADE: case PLAYER_FOOTPRINTSHADE:
return g_player[iPlayer].ps->footprintshade; return g_player[iPlayer].ps->footprintshade;
case PLAYER_BOOT_AMOUNT: case PLAYER_BOOT_AMOUNT:
return g_player[iPlayer].ps->boot_amount; return g_player[iPlayer].ps->inv_amount[GET_BOOTS];
case PLAYER_SCREAM_VOICE: case PLAYER_SCREAM_VOICE:
return g_player[iPlayer].ps->scream_voice; return g_player[iPlayer].ps->scream_voice;
case PLAYER_GM: case PLAYER_GM:

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "duke3d.h" #include "duke3d.h"
const char *s_buildDate = "20091214"; const char *s_buildDate = "20091215";
char *MusicPtr = NULL; char *MusicPtr = NULL;
int32_t g_musicSize; int32_t g_musicSize;

View file

@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "osdfuncs.h" #include "osdfuncs.h"
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
#include "enet/enet.h"
extern int32_t voting, g_doQuickSave; extern int32_t voting, g_doQuickSave;
struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat;
@ -727,7 +728,7 @@ static int32_t osdcmd_give(const osdfuncparm_t *parm)
} }
else if (!Bstrcasecmp(parm->parms[0], "armor")) else if (!Bstrcasecmp(parm->parms[0], "armor"))
{ {
g_player[myconnectindex].ps->shield_amount = 100; g_player[myconnectindex].ps->inv_amount[GET_SHIELD] = 100;
return OSDCMD_OK; return OSDCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "keys")) else if (!Bstrcasecmp(parm->parms[0], "keys"))
@ -1179,6 +1180,32 @@ static int32_t osdcmd_password(const osdfuncparm_t *parm)
return OSDCMD_OK; return OSDCMD_OK;
} }
static int32_t osdcmd_listplayers(const osdfuncparm_t *parm)
{
ENetPeer * currentPeer;
if (parm->numparms != 0)
return OSDCMD_SHOWHELP;
if (!net_server)
{
initprintf("You are not the server.\n");
return OSDCMD_OK;
}
for (currentPeer = net_server -> peers;
currentPeer < & net_server -> peers [net_server -> peerCount];
++ currentPeer)
{
if (currentPeer -> state != ENET_PEER_STATE_CONNECTED)
continue;
initprintf("%d %s\n", currentPeer, g_player[(intptr_t)currentPeer->data].user_name);
}
return OSDCMD_OK;
}
static int32_t osdcmd_cvar_set_multi(const osdfuncparm_t *parm) static int32_t osdcmd_cvar_set_multi(const osdfuncparm_t *parm)
{ {
int32_t r = osdcmd_cvar_set(parm); int32_t r = osdcmd_cvar_set(parm);
@ -1386,6 +1413,8 @@ int32_t registerosdcommands(void)
OSD_RegisterFunction("initgroupfile","initgroupfile <path>: adds a grp file into the game filesystem", osdcmd_initgroupfile); OSD_RegisterFunction("initgroupfile","initgroupfile <path>: adds a grp file into the game filesystem", osdcmd_initgroupfile);
OSD_RegisterFunction("inittimer","debug", osdcmd_inittimer); OSD_RegisterFunction("inittimer","debug", osdcmd_inittimer);
OSD_RegisterFunction("listplayers","listplayers: lists currently connected multiplayer clients", osdcmd_listplayers);
OSD_RegisterFunction("name","name: change your multiplayer nickname", osdcmd_name); OSD_RegisterFunction("name","name: change your multiplayer nickname", osdcmd_name);
OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip); OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);

View file

@ -80,17 +80,17 @@ static void P_IncurDamage(DukePlayer_t *p)
{ {
p->extra_extra8 = 0; p->extra_extra8 = 0;
if (p->shield_amount > 0) if (p->inv_amount[GET_SHIELD] > 0)
{ {
shield_damage = damage * (20 + (krand()%30)) / 100; shield_damage = damage * (20 + (krand()%30)) / 100;
damage -= shield_damage; damage -= shield_damage;
p->shield_amount += shield_damage; p->inv_amount[GET_SHIELD] += shield_damage;
if (p->shield_amount < 0) if (p->inv_amount[GET_SHIELD] < 0)
{ {
damage += p->shield_amount; damage += p->inv_amount[GET_SHIELD];
p->shield_amount = 0; p->inv_amount[GET_SHIELD] = 0;
} }
} }
@ -605,7 +605,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
if (ProjectileData[atwith].sound >= 0) A_PlaySound(ProjectileData[atwith].sound,j); if (ProjectileData[atwith].sound >= 0) A_PlaySound(ProjectileData[atwith].sound,j);
} }
if (p >= 0 && g_player[p].ps->steroids_amount > 0 && g_player[p].ps->steroids_amount < 400) if (p >= 0 && g_player[p].ps->inv_amount[GET_STEROIDS] > 0 && g_player[p].ps->inv_amount[GET_STEROIDS] < 400)
sprite[j].extra += (g_player[p].ps->max_player_health>>2); sprite[j].extra += (g_player[p].ps->max_player_health>>2);
if (hitinfo.hitsprite >= 0 && sprite[hitinfo.hitsprite].picnum != ACCESSSWITCH && sprite[hitinfo.hitsprite].picnum != ACCESSSWITCH2) if (hitinfo.hitsprite >= 0 && sprite[hitinfo.hitsprite].picnum != ACCESSSWITCH && sprite[hitinfo.hitsprite].picnum != ACCESSSWITCH2)
@ -1202,7 +1202,7 @@ DOSKIPBULLETHOLE:
ActorExtra[k].temp_data[8] = hitinfo.hitsprite; ActorExtra[k].temp_data[8] = hitinfo.hitsprite;
} }
if (p >= 0 && g_player[p].ps->steroids_amount > 0 && g_player[p].ps->steroids_amount < 400) if (p >= 0 && g_player[p].ps->inv_amount[GET_STEROIDS] > 0 && g_player[p].ps->inv_amount[GET_STEROIDS] < 400)
sprite[j].extra += (g_player[p].ps->max_player_health>>2); sprite[j].extra += (g_player[p].ps->max_player_health>>2);
if (hitinfo.hitsprite >= 0 && sprite[hitinfo.hitsprite].picnum != ACCESSSWITCH && sprite[hitinfo.hitsprite].picnum != ACCESSSWITCH2) if (hitinfo.hitsprite >= 0 && sprite[hitinfo.hitsprite].picnum != ACCESSSWITCH && sprite[hitinfo.hitsprite].picnum != ACCESSSWITCH2)
@ -3385,20 +3385,20 @@ static int32_t P_DoCounters(DukePlayer_t *p)
} }
} }
if (p->steroids_amount > 0 && p->steroids_amount < 400) if (p->inv_amount[GET_STEROIDS] > 0 && p->inv_amount[GET_STEROIDS] < 400)
{ {
p->steroids_amount--; p->inv_amount[GET_STEROIDS]--;
if (p->steroids_amount == 0) if (p->inv_amount[GET_STEROIDS] == 0)
P_SelectNextInvItem(p); P_SelectNextInvItem(p);
if (!(p->steroids_amount&7)) if (!(p->inv_amount[GET_STEROIDS]&7))
if (snum == screenpeek || GTFLAGS(GAMETYPE_COOPSOUND)) if (snum == screenpeek || GTFLAGS(GAMETYPE_COOPSOUND))
A_PlaySound(DUKE_HARTBEAT,p->i); A_PlaySound(DUKE_HARTBEAT,p->i);
} }
if (p->heat_on && p->heat_amount > 0) if (p->heat_on && p->inv_amount[GET_HEATS] > 0)
{ {
p->heat_amount--; p->inv_amount[GET_HEATS]--;
if (p->heat_amount == 0) if (p->inv_amount[GET_HEATS] == 0)
{ {
p->heat_on = 0; p->heat_on = 0;
P_SelectNextInvItem(p); P_SelectNextInvItem(p);
@ -3409,8 +3409,8 @@ static int32_t P_DoCounters(DukePlayer_t *p)
if (p->holoduke_on >= 0) if (p->holoduke_on >= 0)
{ {
p->holoduke_amount--; p->inv_amount[GET_HOLODUKE]--;
if (p->holoduke_amount <= 0) if (p->inv_amount[GET_HOLODUKE] <= 0)
{ {
A_PlaySound(TELEPORTER,p->i); A_PlaySound(TELEPORTER,p->i);
p->holoduke_on = -1; p->holoduke_on = -1;
@ -3418,10 +3418,10 @@ static int32_t P_DoCounters(DukePlayer_t *p)
} }
} }
if (p->jetpack_on && p->jetpack_amount > 0) if (p->jetpack_on && p->inv_amount[GET_JETPACK] > 0)
{ {
p->jetpack_amount--; p->inv_amount[GET_JETPACK]--;
if (p->jetpack_amount <= 0) if (p->inv_amount[GET_JETPACK] <= 0)
{ {
p->jetpack_on = 0; p->jetpack_on = 0;
P_SelectNextInvItem(p); P_SelectNextInvItem(p);
@ -3492,7 +3492,7 @@ static int32_t P_DoCounters(DukePlayer_t *p)
if (p->cursectnum >= 0 && p->scuba_on == 0 && sector[p->cursectnum].lotag == 2) if (p->cursectnum >= 0 && p->scuba_on == 0 && sector[p->cursectnum].lotag == 2)
{ {
if (p->scuba_amount > 0) if (p->inv_amount[GET_SCUBA] > 0)
{ {
p->scuba_on = 1; p->scuba_on = 1;
p->inven_icon = 6; p->inven_icon = 6;
@ -3510,10 +3510,10 @@ static int32_t P_DoCounters(DukePlayer_t *p)
} }
} }
} }
else if (p->scuba_amount > 0 && p->scuba_on) else if (p->inv_amount[GET_SCUBA] > 0 && p->scuba_on)
{ {
p->scuba_amount--; p->inv_amount[GET_SCUBA]--;
if (p->scuba_amount == 0) if (p->inv_amount[GET_SCUBA] == 0)
{ {
p->scuba_on = 0; p->scuba_on = 0;
P_SelectNextInvItem(p); P_SelectNextInvItem(p);
@ -3638,19 +3638,19 @@ void P_AddWeapon(DukePlayer_t *p,int32_t weapon)
void P_SelectNextInvItem(DukePlayer_t *p) void P_SelectNextInvItem(DukePlayer_t *p)
{ {
if (p->firstaid_amount > 0) if (p->inv_amount[GET_FIRSTAID] > 0)
p->inven_icon = 1; p->inven_icon = 1;
else if (p->steroids_amount > 0) else if (p->inv_amount[GET_STEROIDS] > 0)
p->inven_icon = 2; p->inven_icon = 2;
else if (p->holoduke_amount > 0) else if (p->inv_amount[GET_HOLODUKE] > 0)
p->inven_icon = 3; p->inven_icon = 3;
else if (p->jetpack_amount > 0) else if (p->inv_amount[GET_JETPACK] > 0)
p->inven_icon = 4; p->inven_icon = 4;
else if (p->heat_amount > 0) else if (p->inv_amount[GET_HEATS] > 0)
p->inven_icon = 5; p->inven_icon = 5;
else if (p->scuba_amount > 0) else if (p->inv_amount[GET_SCUBA] > 0)
p->inven_icon = 6; p->inven_icon = 6;
else if (p->boot_amount > 0) else if (p->inv_amount[GET_BOOTS] > 0)
p->inven_icon = 7; p->inven_icon = 7;
else p->inven_icon = 0; else p->inven_icon = 0;
} }
@ -3834,13 +3834,7 @@ void P_FragPlayer(int32_t snum)
p->pals_time = 63; p->pals_time = 63;
p->posz -= (16<<8); p->posz -= (16<<8);
s->z -= (16<<8); s->z -= (16<<8);
}
if (ud.recstat == 1 && ud.multimode < 2)
G_CloseDemoWrite();
if (s->pal != 1)
{
p->dead_flag = (512-((krand()&1)<<10)+(krand()&255)-512)&2047; p->dead_flag = (512-((krand()&1)<<10)+(krand()&255)-512)&2047;
if (p->dead_flag == 0) if (p->dead_flag == 0)
p->dead_flag++; p->dead_flag++;
@ -3880,6 +3874,7 @@ void P_FragPlayer(int32_t snum)
{ {
g_player[p->frag_ps].ps->frag++; g_player[p->frag_ps].ps->frag++;
g_player[p->frag_ps].frags[snum]++; g_player[p->frag_ps].frags[snum]++;
g_player[snum].frags[snum]++; // deaths
} }
if (snum == screenpeek) if (snum == screenpeek)
@ -4042,7 +4037,7 @@ void P_ProcessInput(int32_t snum)
else else
{ {
s->extra = 0; s->extra = 0;
p->shield_amount = 0; p->inv_amount[GET_SHIELD] = 0;
} }
p->last_extra = s->extra; p->last_extra = s->extra;
@ -4149,6 +4144,9 @@ void P_ProcessInput(int32_t snum)
if (s->extra <= 0) if (s->extra <= 0)
{ {
if (ud.recstat == 1 && ud.multimode < 2)
G_CloseDemoWrite();
if ((numplayers < 2 || net_server) && p->dead_flag == 0) if ((numplayers < 2 || net_server) && p->dead_flag == 0)
P_FragPlayer(snum); P_FragPlayer(snum);
@ -4703,11 +4701,11 @@ void P_ProcessInput(int32_t snum)
if (j == PURPLELAVA || sector[s->sectnum].ceilingpicnum == PURPLELAVA) if (j == PURPLELAVA || sector[s->sectnum].ceilingpicnum == PURPLELAVA)
{ {
if (p->boot_amount > 0) if (p->inv_amount[GET_BOOTS] > 0)
{ {
p->boot_amount--; p->inv_amount[GET_BOOTS]--;
p->inven_icon = 7; p->inven_icon = 7;
if (p->boot_amount <= 0) if (p->inv_amount[GET_BOOTS] <= 0)
P_SelectNextInvItem(p); P_SelectNextInvItem(p);
} }
else else
@ -4731,7 +4729,7 @@ void P_ProcessInput(int32_t snum)
case HURTRAIL__STATIC: case HURTRAIL__STATIC:
if (rnd(32)) if (rnd(32))
{ {
if (p->boot_amount > 0) if (p->inv_amount[GET_BOOTS] > 0)
k = 1; k = 1;
else else
{ {
@ -4750,7 +4748,7 @@ void P_ProcessInput(int32_t snum)
case FLOORSLIME__STATIC: case FLOORSLIME__STATIC:
if (rnd(16)) if (rnd(16))
{ {
if (p->boot_amount > 0) if (p->inv_amount[GET_BOOTS] > 0)
k = 1; k = 1;
else else
{ {
@ -4767,7 +4765,7 @@ void P_ProcessInput(int32_t snum)
case FLOORPLASMA__STATIC: case FLOORPLASMA__STATIC:
if (rnd(32)) if (rnd(32))
{ {
if (p->boot_amount > 0) if (p->inv_amount[GET_BOOTS] > 0)
k = 1; k = 1;
else else
{ {
@ -4787,8 +4785,8 @@ void P_ProcessInput(int32_t snum)
if (k) if (k)
{ {
P_DoQuote(75,p); P_DoQuote(75,p);
p->boot_amount -= 2; p->inv_amount[GET_BOOTS] -= 2;
if (p->boot_amount <= 0) if (p->inv_amount[GET_BOOTS] <= 0)
P_SelectNextInvItem(p); P_SelectNextInvItem(p);
} }
} }
@ -4852,7 +4850,7 @@ void P_ProcessInput(int32_t snum)
else if (p->walking_snd_toggle > 0) else if (p->walking_snd_toggle > 0)
p->walking_snd_toggle--; p->walking_snd_toggle--;
if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) if (p->jetpack_on == 0 && p->inv_amount[GET_STEROIDS] > 0 && p->inv_amount[GET_STEROIDS] < 400)
doubvel <<= 1; doubvel <<= 1;
p->posxv += ((g_player[snum].sync->fvel*doubvel)<<6); p->posxv += ((g_player[snum].sync->fvel*doubvel)<<6);
@ -5743,33 +5741,33 @@ int32_t getspritescore(int32_t snum, int32_t dapicnum)
if (sprite[g_player[snum].ps->i].extra < g_player[snum].ps->max_player_health) return(30); if (sprite[g_player[snum].ps->i].extra < g_player[snum].ps->max_player_health) return(30);
return(1); return(1);
case FIRSTAID__STATIC: case FIRSTAID__STATIC:
if (g_player[snum].ps->firstaid_amount < g_player[snum].ps->max_player_health) return(100); if (g_player[snum].ps->inv_amount[GET_FIRSTAID] < g_player[snum].ps->max_player_health) return(100);
return(1); return(1);
case SHIELD__STATIC: case SHIELD__STATIC:
if (g_player[snum].ps->shield_amount < g_player[snum].ps->max_shield_amount) return(50); if (g_player[snum].ps->inv_amount[GET_SHIELD] < g_player[snum].ps->max_shield_amount) return(50);
return(1); return(1);
case STEROIDS__STATIC: case STEROIDS__STATIC:
if (g_player[snum].ps->steroids_amount < 400) return(30); if (g_player[snum].ps->inv_amount[GET_STEROIDS] < 400) return(30);
return(1); return(1);
case AIRTANK__STATIC: case AIRTANK__STATIC:
if (g_player[snum].ps->scuba_amount < 6400) return(30); if (g_player[snum].ps->inv_amount[GET_SCUBA] < 6400) return(30);
return(1); return(1);
case JETPACK__STATIC: case JETPACK__STATIC:
if (g_player[snum].ps->jetpack_amount < 1600) return(100); if (g_player[snum].ps->inv_amount[GET_JETPACK] < 1600) return(100);
return(1); return(1);
case HEATSENSOR__STATIC: case HEATSENSOR__STATIC:
if (g_player[snum].ps->heat_amount < 1200) return(5); if (g_player[snum].ps->inv_amount[GET_HEATS] < 1200) return(5);
return(1); return(1);
case ACCESSCARD__STATIC: case ACCESSCARD__STATIC:
return(1); return(1);
case BOOTS__STATIC: case BOOTS__STATIC:
if (g_player[snum].ps->boot_amount < 200) return(15); if (g_player[snum].ps->inv_amount[GET_BOOTS] < 200) return(15);
return(1); return(1);
case ATOMICHEALTH__STATIC: case ATOMICHEALTH__STATIC:
if (sprite[g_player[snum].ps->i].extra < g_player[snum].ps->max_player_health<<1) return(50); if (sprite[g_player[snum].ps->i].extra < g_player[snum].ps->max_player_health<<1) return(50);
return(1); return(1);
case HOLODUKE__STATIC: case HOLODUKE__STATIC:
if (g_player[snum].ps->holoduke_amount < 2400) return(5); if (g_player[snum].ps->inv_amount[GET_HOLODUKE] < 2400) return(5);
return(1); return(1);
case MUSICANDSFX__STATIC: case MUSICANDSFX__STATIC:
return(1); return(1);
@ -5867,7 +5865,7 @@ void computergetinput(int32_t snum, input_t *syn)
z2 = sprite[g_player[goalplayer[snum]].ps->i].z; z2 = sprite[g_player[goalplayer[snum]].ps->i].z;
if (p->dead_flag) syn->bits |= BIT(SK_OPEN); if (p->dead_flag) syn->bits |= BIT(SK_OPEN);
if ((p->firstaid_amount > 0) && (p->last_extra < 100)) if ((p->inv_amount[GET_FIRSTAID] > 0) && (p->last_extra < 100))
syn->bits |= BIT(SK_MEDKIT); syn->bits |= BIT(SK_MEDKIT);
for (j=headspritestat[STAT_PROJECTILE]; j>=0; j=nextspritestat[j]) for (j=headspritestat[STAT_PROJECTILE]; j>=0; j=nextspritestat[j])

View file

@ -655,7 +655,7 @@ void P_ResetPlayer(int32_t snum)
g_player[snum].ps->horizoff = 0; g_player[snum].ps->horizoff = 0;
g_player[snum].ps->opyoff = 0; g_player[snum].ps->opyoff = 0;
g_player[snum].ps->wackedbyactor = -1; g_player[snum].ps->wackedbyactor = -1;
g_player[snum].ps->shield_amount = g_startArmorAmount; g_player[snum].ps->inv_amount[GET_SHIELD] = g_startArmorAmount;
g_player[snum].ps->dead_flag = 0; g_player[snum].ps->dead_flag = 0;
g_player[snum].ps->pals_time = 0; g_player[snum].ps->pals_time = 0;
g_player[snum].ps->footprintcount = 0; g_player[snum].ps->footprintcount = 0;
@ -750,9 +750,9 @@ void P_ResetStatus(int32_t snum)
p->sbs = 0; p->sbs = 0;
p->palette = (uint8_t *) &palette[0]; p->palette = (uint8_t *) &palette[0];
if (p->steroids_amount < 400) if (p->inv_amount[GET_STEROIDS] < 400)
{ {
p->steroids_amount = 0; p->inv_amount[GET_STEROIDS] = 0;
p->inven_icon = 0; p->inven_icon = 0;
} }
p->heat_on = 0; p->heat_on = 0;
@ -827,19 +827,15 @@ void P_ResetInventory(int32_t snum)
{ {
DukePlayer_t *p = g_player[snum].ps; DukePlayer_t *p = g_player[snum].ps;
Bmemset(p->inv_amount, 0, sizeof(p->inv_amount));
p->inven_icon = 0; p->inven_icon = 0;
p->boot_amount = 0;
p->scuba_on = 0; p->scuba_on = 0;
p->scuba_amount = 0;
p->heat_amount = 0;
p->heat_on = 0; p->heat_on = 0;
p->jetpack_on = 0; p->jetpack_on = 0;
p->jetpack_amount = 0;
p->shield_amount = g_startArmorAmount;
p->holoduke_on = -1; p->holoduke_on = -1;
p->holoduke_amount = 0;
p->firstaid_amount = 0; p->inv_amount[GET_SHIELD] = g_startArmorAmount;
p->steroids_amount = 0;
p->inven_icon = 0; p->inven_icon = 0;
X_OnEvent(EVENT_RESETINVENTORY, p->i, snum, -1); X_OnEvent(EVENT_RESETINVENTORY, p->i, snum, -1);
} }
@ -1297,7 +1293,6 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk)
g_skillSoundID = -1; g_skillSoundID = -1;
Net_WaitForEverybody();
ready2send = 0; ready2send = 0;
if (ud.m_recstat != 2 && ud.last_level >= 0 && ud.multimode > 1 && (ud.coop&GAMETYPE_SCORESHEET)) if (ud.m_recstat != 2 && ud.last_level >= 0 && ud.multimode > 1 && (ud.coop&GAMETYPE_SCORESHEET))
@ -1401,24 +1396,16 @@ static void resetpspritevars(char g)
tsbar[i].gotweapon[j] = g_player[i].ps->gotweapon[j]; tsbar[i].gotweapon[j] = g_player[i].ps->gotweapon[j];
} }
tsbar[i].shield_amount = g_player[i].ps->shield_amount; Bmemcpy(tsbar[i].inv_amount, g_player[i].ps->inv_amount, sizeof(tsbar[i].inv_amount));
tsbar[i].curr_weapon = g_player[i].ps->curr_weapon; tsbar[i].curr_weapon = g_player[i].ps->curr_weapon;
tsbar[i].inven_icon = g_player[i].ps->inven_icon; tsbar[i].inven_icon = g_player[i].ps->inven_icon;
tsbar[i].firstaid_amount = g_player[i].ps->firstaid_amount;
tsbar[i].steroids_amount = g_player[i].ps->steroids_amount;
tsbar[i].holoduke_amount = g_player[i].ps->holoduke_amount;
tsbar[i].jetpack_amount = g_player[i].ps->jetpack_amount;
tsbar[i].heat_amount = g_player[i].ps->heat_amount;
tsbar[i].scuba_amount = g_player[i].ps->scuba_amount;
tsbar[i].boot_amount = g_player[i].ps->boot_amount;
} }
} }
P_ResetStatus(0); P_ResetStatus(0);
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
Bmemcpy(g_player[i].ps,g_player[0].ps,sizeof(DukePlayer_t)); if (i) Bmemcpy(g_player[i].ps,g_player[0].ps,sizeof(DukePlayer_t));
if (ud.recstat != 2) if (ud.recstat != 2)
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
@ -1433,17 +1420,9 @@ static void resetpspritevars(char g)
g_player[i].ps->ammo_amount[j] = tsbar[i].ammo_amount[j]; g_player[i].ps->ammo_amount[j] = tsbar[i].ammo_amount[j];
g_player[i].ps->gotweapon[j] = tsbar[i].gotweapon[j]; g_player[i].ps->gotweapon[j] = tsbar[i].gotweapon[j];
} }
g_player[i].ps->shield_amount = tsbar[i].shield_amount;
g_player[i].ps->curr_weapon = tsbar[i].curr_weapon; g_player[i].ps->curr_weapon = tsbar[i].curr_weapon;
g_player[i].ps->inven_icon = tsbar[i].inven_icon; g_player[i].ps->inven_icon = tsbar[i].inven_icon;
Bmemcpy(g_player[i].ps->inv_amount, tsbar[i].inv_amount, sizeof(tsbar[i].inv_amount));
g_player[i].ps->firstaid_amount = tsbar[i].firstaid_amount;
g_player[i].ps->steroids_amount= tsbar[i].steroids_amount;
g_player[i].ps->holoduke_amount = tsbar[i].holoduke_amount;
g_player[i].ps->jetpack_amount = tsbar[i].jetpack_amount;
g_player[i].ps->heat_amount = tsbar[i].heat_amount;
g_player[i].ps->scuba_amount= tsbar[i].scuba_amount;
g_player[i].ps->boot_amount = tsbar[i].boot_amount;
} }
} }
@ -1580,12 +1559,6 @@ void Net_WaitForEverybody(void)
if (numplayers < 2 || net_server) return; if (numplayers < 2 || net_server) return;
packbuf[0] = PACKET_PLAYER_READY;
packbuf[1] = myconnectindex;
if (net_client)
enet_peer_send(net_peer, 0, enet_packet_create(packbuf, 2, ENET_PACKET_FLAG_RELIABLE));
if (ud.multimode > 1) if (ud.multimode > 1)
{ {
P_SetGamePalette(g_player[myconnectindex].ps, titlepal, 11); P_SetGamePalette(g_player[myconnectindex].ps, titlepal, 11);
@ -1604,6 +1577,12 @@ void Net_WaitForEverybody(void)
{ {
if (quitevent || keystatus[1]) G_GameExit(""); if (quitevent || keystatus[1]) G_GameExit("");
packbuf[0] = PACKET_PLAYER_READY;
packbuf[1] = myconnectindex;
if (net_peer)
enet_peer_send(net_peer, 0, enet_packet_create(packbuf, 2, ENET_PACKET_FLAG_RELIABLE));
handleevents(); handleevents();
Net_GetPackets(); Net_GetPackets();
@ -1642,7 +1621,6 @@ void clearfifo(void)
Bmemset(g_player[i].sync,0,sizeof(input_t)); Bmemset(g_player[i].sync,0,sizeof(input_t));
Bmemset(&g_player[i].movefifoend,0,sizeof(g_player[i].movefifoend)); Bmemset(&g_player[i].movefifoend,0,sizeof(g_player[i].movefifoend));
Bmemset(&g_player[i].syncvalhead,0,sizeof(g_player[i].syncvalhead)); Bmemset(&g_player[i].syncvalhead,0,sizeof(g_player[i].syncvalhead));
Bmemset(&g_player[i].myminlag,0,sizeof(g_player[i].myminlag));
g_player[i].vote = 0; g_player[i].vote = 0;
g_player[i].gotvote = 0; g_player[i].gotvote = 0;
} }

View file

@ -2565,7 +2565,7 @@ void G_HandleSharedKeys(int32_t snum)
aGameVars[g_iReturnVarID].val.lValue = 0; aGameVars[g_iReturnVarID].val.lValue = 0;
X_OnEvent(EVENT_USENIGHTVISION,g_player[snum].ps->i,snum, -1); X_OnEvent(EVENT_USENIGHTVISION,g_player[snum].ps->i,snum, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0 if (aGameVars[g_iReturnVarID].val.lValue == 0
&& p->heat_amount > 0) && p->inv_amount[GET_HEATS] > 0)
{ {
p->heat_on = !p->heat_on; p->heat_on = !p->heat_on;
P_UpdateScreenPal(p); P_UpdateScreenPal(p);
@ -2581,13 +2581,13 @@ void G_HandleSharedKeys(int32_t snum)
X_OnEvent(EVENT_USESTEROIDS,g_player[snum].ps->i,snum, -1); X_OnEvent(EVENT_USESTEROIDS,g_player[snum].ps->i,snum, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0) if (aGameVars[g_iReturnVarID].val.lValue == 0)
{ {
if (p->steroids_amount == 400) if (p->inv_amount[GET_STEROIDS] == 400)
{ {
p->steroids_amount--; p->inv_amount[GET_STEROIDS]--;
A_PlaySound(DUKE_TAKEPILLS,p->i); A_PlaySound(DUKE_TAKEPILLS,p->i);
P_DoQuote(12,p); P_DoQuote(12,p);
} }
if (p->steroids_amount > 0) if (p->inv_amount[GET_STEROIDS] > 0)
p->inven_icon = 2; p->inven_icon = 2;
} }
return; // is there significance to returning? return; // is there significance to returning?
@ -2617,44 +2617,44 @@ CHECKINV1:
switch (dainv) switch (dainv)
{ {
case 4: case 4:
if (p->jetpack_amount > 0 && i > 1) if (p->inv_amount[GET_JETPACK] > 0 && i > 1)
break; break;
if (k) dainv++; if (k) dainv++;
else dainv--; else dainv--;
goto CHECKINV1; goto CHECKINV1;
case 6: case 6:
if (p->scuba_amount > 0 && i > 1) if (p->inv_amount[GET_SCUBA] > 0 && i > 1)
break; break;
if (k) dainv++; if (k) dainv++;
else dainv--; else dainv--;
goto CHECKINV1; goto CHECKINV1;
case 2: case 2:
if (p->steroids_amount > 0 && i > 1) if (p->inv_amount[GET_STEROIDS] > 0 && i > 1)
break; break;
if (k) dainv++; if (k) dainv++;
else dainv--; else dainv--;
goto CHECKINV1; goto CHECKINV1;
case 3: case 3:
if (p->holoduke_amount > 0 && i > 1) if (p->inv_amount[GET_HOLODUKE] > 0 && i > 1)
break; break;
if (k) dainv++; if (k) dainv++;
else dainv--; else dainv--;
goto CHECKINV1; goto CHECKINV1;
case 0: case 0:
case 1: case 1:
if (p->firstaid_amount > 0 && i > 1) if (p->inv_amount[GET_FIRSTAID] > 0 && i > 1)
break; break;
if (k) dainv = 2; if (k) dainv = 2;
else dainv = 7; else dainv = 7;
goto CHECKINV1; goto CHECKINV1;
case 5: case 5:
if (p->heat_amount > 0 && i > 1) if (p->inv_amount[GET_HEATS] > 0 && i > 1)
break; break;
if (k) dainv++; if (k) dainv++;
else dainv--; else dainv--;
goto CHECKINV1; goto CHECKINV1;
case 7: case 7:
if (p->boot_amount > 0 && i > 1) if (p->inv_amount[GET_BOOTS] > 0 && i > 1)
break; break;
if (k) dainv = 1; if (k) dainv = 1;
else dainv = 6; else dainv = 6;
@ -2682,7 +2682,7 @@ CHECKINV1:
{ {
p->inven_icon = dainv; p->inven_icon = dainv;
if (dainv || p->firstaid_amount) if (dainv || p->inv_amount[GET_FIRSTAID])
{ {
static const int32_t i[8] = { 3, 90, 91, 88, 101, 89, 6, 0 }; static const int32_t i[8] = { 3, 90, 91, 88, 101, 89, 6, 0 };
P_DoQuote(i[dainv-1], p); P_DoQuote(i[dainv-1], p);
@ -2886,7 +2886,7 @@ CHECKINV1:
X_OnEvent(EVENT_HOLODUKEON,g_player[snum].ps->i,snum, -1); X_OnEvent(EVENT_HOLODUKEON,g_player[snum].ps->i,snum, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0) if (aGameVars[g_iReturnVarID].val.lValue == 0)
{ {
if (p->holoduke_amount > 0) if (p->inv_amount[GET_HOLODUKE] > 0)
{ {
p->inven_icon = 3; p->inven_icon = 3;
@ -2923,20 +2923,20 @@ CHECKINV1:
X_OnEvent(EVENT_USEMEDKIT,g_player[snum].ps->i,snum, -1); X_OnEvent(EVENT_USEMEDKIT,g_player[snum].ps->i,snum, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0) if (aGameVars[g_iReturnVarID].val.lValue == 0)
{ {
if (p->firstaid_amount > 0 && sprite[p->i].extra < p->max_player_health) if (p->inv_amount[GET_FIRSTAID] > 0 && sprite[p->i].extra < p->max_player_health)
{ {
j = p->max_player_health-sprite[p->i].extra; j = p->max_player_health-sprite[p->i].extra;
if ((uint32_t)p->firstaid_amount > j) if ((uint32_t)p->inv_amount[GET_FIRSTAID] > j)
{ {
p->firstaid_amount -= j; p->inv_amount[GET_FIRSTAID] -= j;
sprite[p->i].extra = p->max_player_health; sprite[p->i].extra = p->max_player_health;
p->inven_icon = 1; p->inven_icon = 1;
} }
else else
{ {
sprite[p->i].extra += p->firstaid_amount; sprite[p->i].extra += p->inv_amount[GET_FIRSTAID];
p->firstaid_amount = 0; p->inv_amount[GET_FIRSTAID] = 0;
P_SelectNextInvItem(p); P_SelectNextInvItem(p);
} }
A_PlaySound(DUKE_USEMEDKIT,p->i); A_PlaySound(DUKE_USEMEDKIT,p->i);
@ -2950,7 +2950,7 @@ CHECKINV1:
X_OnEvent(EVENT_USEJETPACK,g_player[snum].ps->i,snum, -1); X_OnEvent(EVENT_USEJETPACK,g_player[snum].ps->i,snum, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0) if (aGameVars[g_iReturnVarID].val.lValue == 0)
{ {
if (p->jetpack_amount > 0) if (p->inv_amount[GET_JETPACK] > 0)
{ {
p->jetpack_on = !p->jetpack_on; p->jetpack_on = !p->jetpack_on;
if (p->jetpack_on) if (p->jetpack_on)